Skip to content

Commit

Permalink
fix: exports and types
Browse files Browse the repository at this point in the history
  • Loading branch information
alanshaw committed Apr 23, 2024
1 parent 4e63824 commit 3a42c21
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 9 deletions.
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,22 @@
"author": "Alan Shaw",
"license": "Apache-2.0 OR MIT",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./src/index.js"
},
"./api": {
"types": "./dist/src/api.d.ts",
"import": "./src/api.js"
},
"./client": {
"types": "./dist/src/client/index.d.ts",
"import": "./src/client/index.js"
},
"./client/api": {
"types": "./dist/src/client/api.d.ts",
"import": "./src/client/api.js"
},
"./capabilities": {
"types": "./dist/src/capabilities.d.ts",
"import": "./src/capabilities.js"
Expand All @@ -41,9 +53,15 @@
"*": [
"dist/*"
],
"api": [
"dist/src/api.d.ts"
],
"client": [
"dist/src/client/index.d.ts"
],
"client/api": [
"dist/src/client/api.d.ts"
],
"capabilities": [
"dist/src/capabilities.d.ts"
],
Expand Down
1 change: 1 addition & 0 deletions src/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {} // eslint-disable-line
File renamed without changes.
1 change: 1 addition & 0 deletions src/client/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {} // eslint-disable-line
2 changes: 1 addition & 1 deletion src/client/api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Signer, Proof, DID, Principal, ConnectionView, Block } from '@ucanto/interface'
import { EventView } from '@web3-storage/pail/clock/api'
import { Service } from '../service'
import { Service } from '../api'

export interface InvocationConfig {
/**
Expand Down
5 changes: 1 addition & 4 deletions src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import { CAR, HTTP } from '@ucanto/transport'
import * as DID from '@ipld/dag-ucan/did'
import * as ClockCaps from '../capabilities.js'

export * from './api.js'
export * from '../service.js'

export const SERVICE_URL = 'https://clock.web3.storage'
export const SERVICE_PRINCIPAL = 'did:web:clock.web3.storage'

Expand Down Expand Up @@ -91,7 +88,7 @@ export async function head ({ issuer, with: resource, proofs, audience }, option
* @param {object} [options]
* @param {import('@ucanto/interface').Principal} [options.servicePrincipal]
* @param {URL} [options.serviceURL]
* @returns {import('@ucanto/interface').ConnectionView<import('../service').Service<T>>}
* @returns {import('@ucanto/interface').ConnectionView<import('../api.js').Service<T>>}
*/
export function connect (options) {
const url = options?.serviceURL ?? new URL(SERVICE_URL)
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * as Server from './server/index.js'
export * as Client from './client/index.js'
export * as Capabilities from './capabilities.js'
2 changes: 1 addition & 1 deletion src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { access, Schema, Failure } from '@ucanto/validator'
/**
* @template T
* @param {import('@ucanto/interface').Signer} signer
* @param {import('../service').Service<T>} service
* @param {import('../api').Service<T>} service
*/
export function createServer (signer, service) {
return Server.create({
Expand Down
Empty file removed src/service.js
Empty file.
4 changes: 2 additions & 2 deletions src/worker/durable-clock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { GatewayBlockFetcher, LRUBlockstore, MemoryBlockstore, MultiBlockFetcher

/**
* @typedef {{ method: string, args: any[] }} MethodCall
* @typedef {import('../service').EmitterDID} EmitterDID DID of an clock event emitter (usually an agent).
* @typedef {import('../service').ClockDID} ClockDID DID of a merkle clock.
* @typedef {import('../api.js').EmitterDID} EmitterDID DID of an clock event emitter (usually an agent).
* @typedef {import('../api.js').ClockDID} ClockDID DID of a merkle clock.
* @typedef {Map<ClockDID, Set<EmitterDID>>} Followings Event emitters that this clock is following (and the associated clock DID they are contributing to).
* @typedef {Map<ClockDID, Set<EmitterDID>>} Subscribers Clocks that want to receive advances made to this clock.
* @typedef {'follow'|'unfollow'|'following'|'subscribe'|'unsubscribe'|'subscribers'|'advance'|'head'} DurableClockAPIMethod
Expand Down
2 changes: 1 addition & 1 deletion src/worker/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export { createServer } from '../server/index.js'
/**
* @template T
* @param {{ clockNamespace: import('@cloudflare/workers-types').DurableObjectNamespace }} conf
* @returns {import('../service').Service<T>}
* @returns {import('../api.js').Service<T>}
*/
export function createService ({ clockNamespace }) {
return {
Expand Down

0 comments on commit 3a42c21

Please sign in to comment.