@ucanto/server
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -12,3 +12,3 @@ import * as API from '@ucanto/interface'; | ||
capability: API.ParsedCapability<A, R, API.InferCaveats<C>>; | ||
invocation: API.Invocation<API.Capability<A, R['href']> & API.InferCaveats<C>>; | ||
invocation: API.Invocation<API.Capability<A, R, API.InferCaveats<C>>>; | ||
context: API.InvocationContext; | ||
@@ -18,5 +18,5 @@ } | ||
capability: T; | ||
invocation: API.Invocation<API.Capability<T['can'], T['with']> & T['caveats']>; | ||
invocation: API.Invocation<API.Capability<T['can'], T['with'], T['nb']>>; | ||
context: API.InvocationContext; | ||
} | ||
//# sourceMappingURL=api.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export function provide<T extends API.ParsedCapability<API.Ability, API.URI<`${string}:`>, any>, U extends unknown>(capability: API.CapabilityParser<API.Match<T, API.UnknownMatch>>, handler: (input: API.ProviderInput<T>) => API.Await<U>): API.ServiceMethod<API.Capability<T["can"], T["with"]> & T["caveats"], Exclude<U, { | ||
export function provide<A extends API.Ability, R extends API.URI<`${string}:`>, C extends API.Caveats, U extends unknown>(capability: API.CapabilityParser<API.Match<API.ParsedCapability<A, R, API.InferCaveats<C>>, API.UnknownMatch>>, handler: (input: API.ProviderInput<API.ParsedCapability<A, R, API.InferCaveats<C>>>) => API.Await<U>): API.ServiceMethod<API.Capability<A, R, API.InferCaveats<C>>, Exclude<U, { | ||
error: true; | ||
@@ -3,0 +3,0 @@ }>, Exclude<U, Exclude<U, { |
export * from "./server.js"; | ||
export * from "@ucanto/principal"; | ||
export * from "@ucanto/core"; | ||
@@ -4,0 +3,0 @@ export * from "./api.js"; |
export function create<Service extends Record<string, any>>(options: API.Server<Service>): API.ServerView<Service>; | ||
export function handle<T extends Record<string, any>, C extends API.Capability<API.Ability, `${string}:${string}`>, I extends API.Transport.Tuple<API.ServiceInvocation<C, T>>>(server: API.ServerView<T>, request: API.HTTPRequest<I>): Promise<API.HTTPResponse<API.InferServiceInvocations<I, T>>>; | ||
export function execute<Service extends Record<string, any>, C extends API.Capability<API.Ability, `${string}:${string}`>, I extends API.Transport.Tuple<API.ServiceInvocation<C, Service>>>(invocations: API.InferInvocations<I>, server: API.ServerView<Service>): Promise<API.InferServiceInvocations<I, Service>>; | ||
export function invoke<Service extends Record<string, any>, C extends API.Capability<API.Ability, `${string}:${string}`>>(invocation: API.InferInvocation<API.ServiceInvocation<C, Service>>, server: API.ServerView<Service>): Promise<API.InferServiceInvocationReturn<C, Service>>; | ||
export function handle<T extends Record<string, any>, C extends API.Capability<API.Ability, `${string}:${string}`, any>, I extends API.Transport.Tuple<API.ServiceInvocation<C, T>>>(server: API.ServerView<T>, request: API.HTTPRequest<I>): Promise<API.HTTPResponse<API.InferServiceInvocations<I, T>>>; | ||
export function execute<Service extends Record<string, any>, C extends API.Capability<API.Ability, `${string}:${string}`, any>, I extends API.Transport.Tuple<API.ServiceInvocation<C, Service>>>(invocations: API.InferInvocations<I>, server: API.ServerView<Service>): Promise<API.InferServiceInvocations<I, Service>>; | ||
export function invoke<Service extends Record<string, any>, C extends API.Capability<API.Ability, `${string}:${string}`, any>>(invocation: API.InferInvocation<API.ServiceInvocation<C, Service>>, server: API.ServerView<Service>): Promise<API.InferServiceInvocationReturn<C, Service>>; | ||
/** | ||
@@ -15,3 +15,3 @@ * @implements {API.HandlerNotFound} | ||
error: true; | ||
capability: API.Capability<API.Ability, `${string}:${string}`>; | ||
capability: API.Capability<API.Ability, `${string}:${string}`, any>; | ||
/** @type {'HandlerNotFound'} */ | ||
@@ -42,7 +42,11 @@ get name(): "HandlerNotFound"; | ||
context: { | ||
my?: ((issuer: `did:${string}`) => API.Capability<API.Ability, `${string}:${string}`>[]) | undefined; | ||
my?: ((issuer: `did:${string}:${string}`) => API.Capability<API.Ability, `${string}:${string}`, unknown>[]) | undefined; | ||
resolve?: ((proof: API.UCANLink<API.Capabilities, number>) => API.Await<API.Result<API.Delegation<API.Capabilities>, API.UnavailableProof>>) | undefined; | ||
id: API.Principal<number>; | ||
principal: API.PrincipalParser<number>; | ||
canIssue: (capability: API.ParsedCapability<API.Ability, API.URI<`${string}:`>, {}>, issuer: `did:${string}`) => boolean; | ||
id: API.Principal<string>; | ||
principal: API.PrincipalParser; | ||
canIssue: (capability: { | ||
can: API.Ability; | ||
with: API.URI<`${string}:`>; | ||
nb?: {} | undefined; | ||
}, issuer: `did:${string}:${string}`) => boolean; | ||
}; | ||
@@ -53,3 +57,3 @@ service: Service; | ||
catch: (err: API.HandlerExecutionError) => void; | ||
get id(): API.Principal<number>; | ||
get id(): API.Principal<string>; | ||
/** | ||
@@ -61,5 +65,5 @@ * @template {API.Capability} C | ||
*/ | ||
request<C extends API.Capability<API.Ability, `${string}:${string}`>, I extends API.Transport.Tuple<API.ServiceInvocation<C, Service>>>(request: API.HTTPRequest<I>): API.Await<API.HTTPResponse<API.InferServiceInvocations<I, Service>>>; | ||
request<C extends API.Capability<API.Ability, `${string}:${string}`, any>, I extends API.Transport.Tuple<API.ServiceInvocation<C, Service>>>(request: API.HTTPRequest<I>): API.Await<API.HTTPResponse<API.InferServiceInvocations<I, Service>>>; | ||
} | ||
export { capability, URI, Link, Failure, MalformedCapability } from "@ucanto/validator"; | ||
//# sourceMappingURL=server.d.ts.map |
{ | ||
"name": "@ucanto/server", | ||
"description": "UCAN RPC Server", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"types": "./dist/src/lib.d.ts", | ||
@@ -23,5 +23,5 @@ "main": "./src/lib.js", | ||
"dependencies": { | ||
"@ucanto/core": "^1.0.1", | ||
"@ucanto/interface": "^1.0.0", | ||
"@ucanto/validator": "^1.0.1" | ||
"@ucanto/core": "^2.0.0", | ||
"@ucanto/interface": "^2.0.0", | ||
"@ucanto/validator": "^2.0.0" | ||
}, | ||
@@ -32,5 +32,5 @@ "devDependencies": { | ||
"@types/mocha": "^9.1.0", | ||
"@ucanto/principal": "^1.0.1", | ||
"@ucanto/client": "^1.0.1", | ||
"@ucanto/transport": "^1.0.1", | ||
"@ucanto/principal": "^2.0.0", | ||
"@ucanto/client": "^2.0.0", | ||
"@ucanto/transport": "^2.0.0", | ||
"@web-std/fetch": "^4.1.0", | ||
@@ -37,0 +37,0 @@ "@web-std/file": "^3.0.2", |
@@ -27,3 +27,3 @@ import * as API from '@ucanto/interface' | ||
capability: API.ParsedCapability<A, R, API.InferCaveats<C>> | ||
invocation: API.Invocation<API.Capability<A, R['href']> & API.InferCaveats<C>> | ||
invocation: API.Invocation<API.Capability<A, R, API.InferCaveats<C>>> | ||
@@ -35,5 +35,5 @@ context: API.InvocationContext | ||
capability: T | ||
invocation: API.Invocation<API.Capability<T['can'], T['with']> & T['caveats']> | ||
invocation: API.Invocation<API.Capability<T['can'], T['with'], T['nb']>> | ||
context: API.InvocationContext | ||
} |
@@ -5,7 +5,9 @@ import * as API from './api.js' | ||
/** | ||
* @template {API.ParsedCapability} T | ||
* @template {API.Ability} A | ||
* @template {API.URI} R | ||
* @template {API.Caveats} C | ||
* @template {unknown} U | ||
* @param {API.CapabilityParser<API.Match<T>>} capability | ||
* @param {(input:API.ProviderInput<T>) => API.Await<U>} handler | ||
* @returns {API.ServiceMethod<API.Capability<T['can'], T['with']> & T['caveats'], Exclude<U, {error:true}>, Exclude<U, Exclude<U, {error:true}>>>} | ||
* @param {API.CapabilityParser<API.Match<API.ParsedCapability<A, R, API.InferCaveats<C>>>>} capability | ||
* @param {(input:API.ProviderInput<API.ParsedCapability<A, R, API.InferCaveats<C>>>) => API.Await<U>} handler | ||
* @returns {API.ServiceMethod<API.Capability<A, R, API.InferCaveats<C>>, Exclude<U, {error:true}>, Exclude<U, Exclude<U, {error:true}>>>} | ||
*/ | ||
@@ -16,3 +18,3 @@ | ||
/** | ||
* @param {API.Invocation<API.Capability<T['can'], T['with']> & T['caveats']>} invocation | ||
* @param {API.Invocation<API.Capability<A, R, API.InferCaveats<C>>>} invocation | ||
* @param {API.InvocationContext} options | ||
@@ -19,0 +21,0 @@ */ |
export * from './server.js' | ||
export * from '@ucanto/principal' | ||
export * from '@ucanto/core' | ||
@@ -4,0 +3,0 @@ export { invoke } from '@ucanto/core' |
import * as API from '@ucanto/interface' | ||
import { InvalidAudience } from '@ucanto/validator' | ||
import { Principal } from '@ucanto/principal' | ||
import { Verifier } from '@ucanto/principal/ed25519' | ||
export { | ||
@@ -19,3 +19,3 @@ capability, | ||
*/ | ||
export const create = (options) => new Server(options) | ||
export const create = options => new Server(options) | ||
@@ -35,3 +35,3 @@ /** | ||
decoder, | ||
principal = Principal, | ||
principal = Verifier, | ||
canIssue = (capability, issuer) => | ||
@@ -38,0 +38,0 @@ capability.with === issuer || issuer === id.did(), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17958
408
+ Added@ipld/dag-ucan@4.0.0-beta(transitive)
+ Added@ucanto/core@2.0.0(transitive)
+ Added@ucanto/interface@2.0.0(transitive)
+ Added@ucanto/validator@2.0.0(transitive)
- Removed@ipld/dag-ucan@3.0.0-beta(transitive)
- Removed@ucanto/core@1.0.1(transitive)
- Removed@ucanto/interface@1.0.0(transitive)
- Removed@ucanto/validator@1.0.2(transitive)
Updated@ucanto/core@^2.0.0
Updated@ucanto/interface@^2.0.0
Updated@ucanto/validator@^2.0.0