@web3-storage/clock
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -23,14 +23,3 @@ /** | ||
/** | ||
* Instruct a clock to follow the issuer, or optionally a different issuer, | ||
* contributing to a different clock. | ||
* | ||
* @template T | ||
* @param {import('./api').InvocationConfig} conf | ||
* @param {import('./api').FollowOptions<T>} [options] | ||
*/ | ||
export function follow<T>({ issuer, with: resource, proofs, audience }: import('./api').InvocationConfig, options?: import("./api.js").FollowOptions<T> | undefined): Promise<{ | ||
error?: undefined; | ||
}>; | ||
/** | ||
* @template T | ||
* @param {object} [options] | ||
@@ -47,4 +36,4 @@ * @param {import('@ucanto/interface').Principal} [options.servicePrincipal] | ||
export * from "../service.js"; | ||
export const SERVICE_URL: "http://clock.web3.storage"; | ||
export const SERVICE_URL: "https://clock.web3.storage"; | ||
export const SERVICE_PRINCIPAL: "did:web:clock.web3.storage"; | ||
//# sourceMappingURL=index.d.ts.map |
import { Failure, ServiceMethod, DID } from '@ucanto/interface'; | ||
import { ClockFollow, ClockUnfollow, ClockFollowing, ClockAdvance, ClockHead } from './capabilities.js'; | ||
import { ClockAdvance, ClockHead } from './capabilities.js'; | ||
import { EventLink } from '@alanshaw/pail/clock'; | ||
@@ -9,10 +9,8 @@ /** DID of a merkle clock. */ | ||
export interface Service<T> { | ||
clock: { | ||
advance: ServiceMethod<ClockAdvance, EventLink<T>[], Failure>; | ||
head: ServiceMethod<ClockHead, EventLink<T>[], Failure>; | ||
follow: ServiceMethod<ClockFollow, {}, Failure>; | ||
unfollow: ServiceMethod<ClockUnfollow, {}, Failure>; | ||
following: ServiceMethod<ClockFollowing, Array<[ClockDID, EmitterDID[]]>, Failure>; | ||
}; | ||
clock: ClockService<T>; | ||
} | ||
export interface ClockService<T> { | ||
advance: ServiceMethod<ClockAdvance, EventLink<T>[], Failure>; | ||
head: ServiceMethod<ClockHead, EventLink<T>[], Failure>; | ||
} | ||
//# sourceMappingURL=service.d.ts.map |
{ | ||
"name": "@web3-storage/clock", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "UCAN based Merkle Clock as a service.", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "npm run build:debug && miniflare dist/worker.mjs --watch --debug -m", | ||
"build": "npm run build:worker && npm run build:client", | ||
"dev": "npm run build:worker:debug && miniflare dist/worker.mjs --watch --debug -m", | ||
"build": "npm run build:worker && npm run build:module", | ||
"build:worker": "esbuild --bundle src/worker/index.js --format=esm --sourcemap --minify --outfile=dist/worker.mjs", | ||
"build:worker:debug": "esbuild --bundle src/worker/index.js --format=esm --sourcemap --outfile=dist/worker.mjs", | ||
"build:client": "tsc --build", | ||
"build:module": "tsc --build", | ||
"test": "mocha --experimental-vm-modules 'test/**/*.test.js'", | ||
@@ -33,2 +33,6 @@ "coverage": "c8 --reporter=text --reporter=html --exclude=node_modules --exclude=test --exclude-after-remap npm run test", | ||
"import": "./src/client/capabilities.js" | ||
}, | ||
"./server": { | ||
"types": "./dist/src/server/index.d.ts", | ||
"import": "./src/server/index.js" | ||
} | ||
@@ -46,2 +50,5 @@ }, | ||
"dist/src/capabilities.d.ts" | ||
], | ||
"server": [ | ||
"dist/src/server/index.d.ts" | ||
] | ||
@@ -53,17 +60,19 @@ } | ||
"src/client", | ||
"src/server", | ||
"dist/src/*.d.ts", | ||
"dist/src/*.d.ts.map", | ||
"dist/src/client" | ||
"dist/src/client", | ||
"dist/src/server" | ||
], | ||
"dependencies": { | ||
"@alanshaw/pail": "^0.3.0", | ||
"@alanshaw/pail": "^0.3.3", | ||
"@ipld/dag-cbor": "^9.0.0", | ||
"@ucanto/client": "^5.0.0", | ||
"@ucanto/interface": "^5.0.0", | ||
"@ucanto/principal": "^5.0.0", | ||
"@ucanto/server": "^5.0.0", | ||
"@ucanto/transport": "^5.0.0", | ||
"@ucanto/validator": "^5.0.0", | ||
"@ucanto/client": "^5.1.0", | ||
"@ucanto/interface": "^6.2.0", | ||
"@ucanto/principal": "^5.1.0", | ||
"@ucanto/server": "^6.1.0", | ||
"@ucanto/transport": "^5.1.1", | ||
"@ucanto/validator": "^6.1.0", | ||
"hashlru": "^2.3.0", | ||
"multiformats": "^11.0.1" | ||
"multiformats": "^11.0.2" | ||
}, | ||
@@ -70,0 +79,0 @@ "devDependencies": { |
@@ -27,3 +27,3 @@ # w3clock | ||
#### `clock/follow` | ||
<!-- #### `clock/follow` | ||
@@ -38,2 +38,2 @@ Follow advances made by an event issuer to a clock. | ||
TBD | ||
TBD --> |
@@ -9,3 +9,3 @@ import { connect as clientConnect } from '@ucanto/client' | ||
export const SERVICE_URL = 'http://clock.web3.storage' | ||
export const SERVICE_URL = 'https://clock.web3.storage' | ||
export const SERVICE_PRINCIPAL = 'did:web:clock.web3.storage' | ||
@@ -60,3 +60,3 @@ | ||
if (result.error) { | ||
throw new Error(`failed ${ClockCaps.advance.can} invocation`, { cause: result }) | ||
throw new Error(`failed ${ClockCaps.head.can} invocation`, { cause: result }) | ||
} | ||
@@ -67,31 +67,31 @@ | ||
/** | ||
* Instruct a clock to follow the issuer, or optionally a different issuer, | ||
* contributing to a different clock. | ||
* | ||
* @template T | ||
* @param {import('./api').InvocationConfig} conf | ||
* @param {import('./api').FollowOptions<T>} [options] | ||
*/ | ||
export async function follow ({ issuer, with: resource, proofs, audience }, options) { | ||
const conn = options?.connection ?? connect() | ||
const result = await ClockCaps.follow | ||
.invoke({ | ||
issuer, | ||
audience: audience ?? conn.id, | ||
with: resource, | ||
nb: { | ||
...(options?.issuer ? { iss: options.issuer } : {}), | ||
...(options?.with ? { with: options.with } : {}) | ||
}, | ||
proofs | ||
}) | ||
.execute(conn) | ||
// /** | ||
// * Instruct a clock to follow the issuer, or optionally a different issuer, | ||
// * contributing to a different clock. | ||
// * | ||
// * @template T | ||
// * @param {import('./api').InvocationConfig} conf | ||
// * @param {import('./api').FollowOptions<T>} [options] | ||
// */ | ||
// export async function follow ({ issuer, with: resource, proofs, audience }, options) { | ||
// const conn = options?.connection ?? connect() | ||
// const result = await ClockCaps.follow | ||
// .invoke({ | ||
// issuer, | ||
// audience: audience ?? conn.id, | ||
// with: resource, | ||
// nb: { | ||
// ...(options?.issuer ? { iss: options.issuer } : {}), | ||
// ...(options?.with ? { with: options.with } : {}) | ||
// }, | ||
// proofs | ||
// }) | ||
// .execute(conn) | ||
if (result.error) { | ||
throw new Error(`failed ${ClockCaps.follow.can} invocation`, { cause: result }) | ||
} | ||
// if (result.error) { | ||
// throw new Error(`failed ${ClockCaps.follow.can} invocation`, { cause: result }) | ||
// } | ||
return result | ||
} | ||
// return result | ||
// } | ||
@@ -98,0 +98,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37128
19
478
+ Added@ucanto/server@6.1.0(transitive)
+ Added@ucanto/validator@6.1.0(transitive)
- Removed@ipld/dag-cbor@8.0.1(transitive)
- Removed@ucanto/interface@5.0.0(transitive)
- Removed@ucanto/server@5.0.0(transitive)
- Removed@ucanto/validator@5.0.0(transitive)
- Removedcborg@1.10.2(transitive)
Updated@alanshaw/pail@^0.3.3
Updated@ucanto/client@^5.1.0
Updated@ucanto/interface@^6.2.0
Updated@ucanto/principal@^5.1.0
Updated@ucanto/server@^6.1.0
Updated@ucanto/transport@^5.1.1
Updated@ucanto/validator@^6.1.0
Updatedmultiformats@^11.0.2