@peers-app/peers-sdk 0.25.17 → 0.25.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/contracts/__tests__/action-dispatch.test.d.ts +1 -0
- package/dist/contracts/__tests__/action-dispatch.test.js +339 -0
- package/dist/contracts/__tests__/contract-proxy.test.js +24 -1
- package/dist/contracts/__tests__/contract-resolvers.test.js +3 -0
- package/dist/contracts/__tests__/generic-tool-dispatch.test.d.ts +1 -0
- package/dist/contracts/__tests__/generic-tool-dispatch.test.js +173 -0
- package/dist/contracts/action-dispatch.d.ts +12 -0
- package/dist/contracts/action-dispatch.js +73 -0
- package/dist/contracts/contract-provider-router.d.ts +16 -2
- package/dist/contracts/contract-provider-router.js +11 -1
- package/dist/contracts/contract-providers.table.d.ts +2 -2
- package/dist/contracts/contract-proxy.d.ts +58 -0
- package/dist/contracts/contract-proxy.js +163 -19
- package/dist/contracts/contract-resolvers.js +12 -1
- package/dist/contracts/index.d.ts +5 -1
- package/dist/contracts/index.js +21 -2
- package/dist/contracts/system/contract-catalog-contract.d.ts +40 -0
- package/dist/contracts/system/contract-catalog-contract.js +51 -0
- package/dist/contracts/system/http-contract.d.ts +80 -0
- package/dist/contracts/system/http-contract.js +93 -0
- package/dist/contracts/system/index.d.ts +3 -0
- package/dist/contracts/system/index.js +3 -0
- package/dist/contracts/system/scheduler-contract.d.ts +54 -0
- package/dist/contracts/system/scheduler-contract.js +70 -0
- package/dist/data/messages.d.ts +3 -3
- package/dist/data/package-versions.d.ts +10 -10
- package/dist/data/tool-access-approvals.d.ts +3 -3
- package/dist/data/tool-access.d.ts +3 -1
- package/dist/data/tool-access.js +5 -2
- package/dist/data/tool-access.test.js +7 -0
- package/dist/data/tools.d.ts +7 -3
- package/dist/data/tools.js +7 -1
- package/dist/invites/invite-messages.d.ts +2 -2
- package/dist/package-loader/host-authority-loading.test.d.ts +1 -0
- package/dist/package-loader/host-authority-loading.test.js +87 -0
- package/dist/package-loader/host-dispatch-policy.test.d.ts +1 -0
- package/dist/package-loader/host-dispatch-policy.test.js +56 -0
- package/dist/package-loader/index.d.ts +1 -0
- package/dist/package-loader/index.js +1 -0
- package/dist/package-loader/isolated-artifact.d.ts +53 -2
- package/dist/package-loader/isolated-artifact.js +118 -4
- package/dist/package-loader/isolated-artifact.test.js +63 -0
- package/dist/package-loader/isolated-persistent-var-gateway.js +19 -0
- package/dist/package-loader/isolated-runtime.d.ts +43 -1
- package/dist/package-loader/package-loader.d.ts +2 -0
- package/dist/package-loader/package-loader.js +64 -0
- package/dist/package-loader/package-loader.test.js +50 -2
- package/dist/package-loader/package-network-policy.d.ts +52 -0
- package/dist/package-loader/package-network-policy.js +62 -0
- package/dist/system-ids.d.ts +31 -0
- package/dist/system-ids.js +32 -1
- package/package.json +1 -1
|
@@ -27,10 +27,17 @@ export interface IContractProviderEndpointRequest {
|
|
|
27
27
|
/** Target contract version. */
|
|
28
28
|
version: number;
|
|
29
29
|
/**
|
|
30
|
-
* Provider selected by trusted host state
|
|
31
|
-
*
|
|
30
|
+
* Provider selected by trusted host state after any requested provider has
|
|
31
|
+
* been checked against the registry.
|
|
32
32
|
*/
|
|
33
33
|
providerPackageId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Provider named on the call by a local UI consumer.
|
|
36
|
+
*
|
|
37
|
+
* Set only when the router was created with `allowRequestedProvider`. Remote
|
|
38
|
+
* routers leave this unset.
|
|
39
|
+
*/
|
|
40
|
+
requestedProviderPackageId?: string;
|
|
34
41
|
/** Canonical data context returned by the authorization hook. */
|
|
35
42
|
dataContextId?: string;
|
|
36
43
|
/**
|
|
@@ -65,6 +72,13 @@ export interface IContractProviderRouterOptions {
|
|
|
65
72
|
* provider-aware and automatically selects a new endpoint after a provider switch.
|
|
66
73
|
*/
|
|
67
74
|
resolveProviderPackageId?: ContractProviderPackageResolver;
|
|
75
|
+
/**
|
|
76
|
+
* When true, a local caller may name `providerPackageId` on the call.
|
|
77
|
+
*
|
|
78
|
+
* The resolver must still reject ids that are not registered. Remote routers
|
|
79
|
+
* leave this false.
|
|
80
|
+
*/
|
|
81
|
+
allowRequestedProvider?: boolean;
|
|
68
82
|
/** Resolves an endpoint after authorization succeeds. */
|
|
69
83
|
resolveEndpoint: ContractProviderEndpointResolver;
|
|
70
84
|
/** Caller identity derived from the trusted underlying connection/session. */
|
|
@@ -116,16 +116,26 @@ function createContractProviderRouter(transport, opts) {
|
|
|
116
116
|
if (disposed) {
|
|
117
117
|
throw new Error("Contract provider router is disposed");
|
|
118
118
|
}
|
|
119
|
-
const context =
|
|
119
|
+
const context = {
|
|
120
|
+
...(authorization.context ?? inboundContext),
|
|
121
|
+
authority: inboundContext.authority,
|
|
122
|
+
};
|
|
123
|
+
if (targetDeviceId && context.authority?.strictActionScope) {
|
|
124
|
+
throw new Error("Strict delegated calls cannot target another device until authority transport is supported");
|
|
125
|
+
}
|
|
120
126
|
const routedCall = {
|
|
121
127
|
...call,
|
|
122
128
|
dataContextId: authorization.dataContextId,
|
|
123
129
|
};
|
|
130
|
+
const requestedProviderPackageId = opts.allowRequestedProvider && !targetDeviceId && typeof call.providerPackageId === "string"
|
|
131
|
+
? call.providerPackageId
|
|
132
|
+
: undefined;
|
|
124
133
|
const endpointRequest = {
|
|
125
134
|
contractId: call.contractId,
|
|
126
135
|
version: call.version,
|
|
127
136
|
dataContextId: authorization.dataContextId,
|
|
128
137
|
targetDeviceId,
|
|
138
|
+
requestedProviderPackageId,
|
|
129
139
|
context,
|
|
130
140
|
notify,
|
|
131
141
|
};
|
|
@@ -17,15 +17,15 @@ declare const schema: z.ZodObject<{
|
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
version: number;
|
|
19
19
|
contractId: string;
|
|
20
|
-
contractProviderId: string;
|
|
21
20
|
providerPackageId: string;
|
|
21
|
+
contractProviderId: string;
|
|
22
22
|
isActive: boolean;
|
|
23
23
|
registeredAt: string;
|
|
24
24
|
}, {
|
|
25
25
|
version: number;
|
|
26
26
|
contractId: string;
|
|
27
|
-
contractProviderId: string;
|
|
28
27
|
providerPackageId: string;
|
|
28
|
+
contractProviderId: string;
|
|
29
29
|
isActive: boolean;
|
|
30
30
|
registeredAt: string;
|
|
31
31
|
}>;
|
|
@@ -3,6 +3,7 @@ import type { Table } from "../data/orm/table";
|
|
|
3
3
|
import type { IToolInstance } from "../data/tools";
|
|
4
4
|
import type { Event, ISubscriptionResult } from "../events";
|
|
5
5
|
import { type Observable } from "../observable";
|
|
6
|
+
import type { IIsolatedCallPrincipal } from "../package-loader/isolated-runtime";
|
|
6
7
|
import { type IContractTransport } from "./contract-transport";
|
|
7
8
|
import type { IContractDefinition, IRemoteContractConsumer } from "./types";
|
|
8
9
|
/**
|
|
@@ -62,6 +63,14 @@ export interface IContractCall {
|
|
|
62
63
|
* under its own identity.
|
|
63
64
|
*/
|
|
64
65
|
targetDeviceId?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Provider to address when a contract has more than one.
|
|
68
|
+
*
|
|
69
|
+
* Honored by the local UI router after it checks the id is registered, and by
|
|
70
|
+
* the isolated runtime when the caller declared a consume of this contract.
|
|
71
|
+
* Remote device routers ignore it and keep the active provider.
|
|
72
|
+
*/
|
|
73
|
+
providerPackageId?: string;
|
|
65
74
|
/**
|
|
66
75
|
* For any subscription call (a generic `event`, a table `dataChanged`, or an observable
|
|
67
76
|
* value stream): the consumer-chosen id that ties a `"subscribe"` (and its later
|
|
@@ -225,6 +234,18 @@ export interface IContractToolContext {
|
|
|
225
234
|
* Absent for trusted local callers (the signed-in UI session and the CLI).
|
|
226
235
|
*/
|
|
227
236
|
callerPackageId?: string;
|
|
237
|
+
/** Trusted frame, retained across host-backed action dispatch; never from arguments. */
|
|
238
|
+
authority?: IIsolatedCallPrincipal;
|
|
239
|
+
/** Select a target under this tool’s trusted frame; authority never belongs in arguments. */
|
|
240
|
+
dispatchTool?: (target: IContractToolTarget, args: unknown) => Promise<any>;
|
|
241
|
+
/** Checked alias dispatch supplied only by the host provider. */
|
|
242
|
+
dispatchAction?: (name: string, args: unknown) => Promise<any>;
|
|
243
|
+
/** Signed actor selected by the host. */
|
|
244
|
+
actorUserId?: string;
|
|
245
|
+
/** Incoming host frame for read-only infrastructure projections; preserves the turn ceiling. */
|
|
246
|
+
callContext?: IContractCallContext;
|
|
247
|
+
/** Original turn context for read-only catalog projection, before infrastructure admission. */
|
|
248
|
+
incomingCallContext?: IContractCallContext;
|
|
228
249
|
}
|
|
229
250
|
/**
|
|
230
251
|
* Build the **consumer** side of a contract proxy from a contract definition and a
|
|
@@ -256,9 +277,12 @@ export interface IContractToolContext {
|
|
|
256
277
|
* @param transport Bidirectional channel to the provider; requests go out on
|
|
257
278
|
* {@link CONTRACT_REQUEST_CHANNEL}, notifications arrive on {@link CONTRACT_NOTIFY_CHANNEL}.
|
|
258
279
|
* @param opts.dataContextId Optional data context to scope every call to.
|
|
280
|
+
* @param opts.providerPackageId Optional provider to address. The local host
|
|
281
|
+
* accepts it only when that package is registered for this contract version.
|
|
259
282
|
*/
|
|
260
283
|
export declare function createContractConsumer(contract: IContractDefinition, transport: IContractTransport, opts?: {
|
|
261
284
|
dataContextId?: string;
|
|
285
|
+
providerPackageId?: string;
|
|
262
286
|
}): IContractConsumer;
|
|
263
287
|
/**
|
|
264
288
|
* Build the **remote** consumer side of a contract: a factory of tools-only consumers whose
|
|
@@ -293,6 +317,12 @@ export interface IContractResolution {
|
|
|
293
317
|
version: number;
|
|
294
318
|
tables?: Record<string, Table<any>>;
|
|
295
319
|
tools?: Record<string, IToolInstance>;
|
|
320
|
+
/** Tool used for alias catalog admission; defaults to a tool requesting preservation. */
|
|
321
|
+
actionDispatcher?: string;
|
|
322
|
+
/** Private canonical tools; selectors never carry their own numeric permissions. */
|
|
323
|
+
actionTools?: Record<string, IToolInstance>;
|
|
324
|
+
/** Package-owned selector-to-tool mapping, validated by the host. */
|
|
325
|
+
actionAliases?: Record<string, string>;
|
|
296
326
|
/**
|
|
297
327
|
* Host-only capabilities appended as the final argument to provider tool functions.
|
|
298
328
|
* Omit this for remote or otherwise untrusted provider routes.
|
|
@@ -355,6 +385,8 @@ export interface IContractCallContext {
|
|
|
355
385
|
* In-process only — never serialized across a connection.
|
|
356
386
|
*/
|
|
357
387
|
dataContext?: DataContext;
|
|
388
|
+
/** In-process delegated execution frame. Never serialized or read from a call payload. */
|
|
389
|
+
authority?: IIsolatedCallPrincipal;
|
|
358
390
|
}
|
|
359
391
|
/**
|
|
360
392
|
* A gate that decides whether a given call is allowed. Runs before dispatch on the
|
|
@@ -369,6 +401,25 @@ export type ContractPermissionCheck = (call: IContractCall, context: IContractCa
|
|
|
369
401
|
* for compatibility and isolated in-process providers that intentionally need the old gate.
|
|
370
402
|
*/
|
|
371
403
|
export declare const sameUserContractPermissionCheck: ContractPermissionCheck;
|
|
404
|
+
/** Validate private alias registrations before exposing any action wrapper. */
|
|
405
|
+
export declare function validateContractActions(resolution: IContractResolution): void;
|
|
406
|
+
/**
|
|
407
|
+
* Project executable aliases using live tool metadata and trusted caller identity.
|
|
408
|
+
*
|
|
409
|
+
* Catalog filtering is advisory; execution rechecks every target.
|
|
410
|
+
*/
|
|
411
|
+
export declare function authorizedContractActionNames(resolution: IContractResolution, context: IContractCallContext): Promise<string[]>;
|
|
412
|
+
/** Dynamic local tool reference; provider pinning is required for package-owned actions. */
|
|
413
|
+
export interface IContractToolTarget {
|
|
414
|
+
contractId: string;
|
|
415
|
+
version: number;
|
|
416
|
+
toolName: string;
|
|
417
|
+
providerPackageId?: string;
|
|
418
|
+
dataContextId?: string;
|
|
419
|
+
targetDeviceId?: string;
|
|
420
|
+
}
|
|
421
|
+
/** Host dispatch bridge invoked only with a frame bound by the provider. */
|
|
422
|
+
export type ContractToolDispatch = (target: IContractToolTarget, args: unknown, context: IContractCallContext) => Promise<any>;
|
|
372
423
|
/**
|
|
373
424
|
* Build the **provider** side of a contract proxy: an async handler that permission-checks
|
|
374
425
|
* an {@link IContractCall} and dispatches it to the live table method / tool fn / observable
|
|
@@ -379,12 +430,17 @@ export declare const sameUserContractPermissionCheck: ContractPermissionCheck;
|
|
|
379
430
|
*
|
|
380
431
|
* @param resolution The live contract implementation to dispatch to.
|
|
381
432
|
* @param opts.permissionCheck Optional gate run before every dispatch.
|
|
433
|
+
* @param opts.dispatchTool Trusted runtime target resolver and invoker for `context.dispatchTool`.
|
|
382
434
|
*/
|
|
383
435
|
export declare function createContractProvider(resolution: IContractResolution, opts?: {
|
|
384
436
|
permissionCheck?: ContractPermissionCheck;
|
|
437
|
+
/** Trusted runtime target resolver and invoker. */
|
|
438
|
+
dispatchTool?: ContractToolDispatch;
|
|
385
439
|
}): (call: IContractCall, context?: IContractCallContext) => Promise<any>;
|
|
386
440
|
/** Options for {@link createContractProviderSession}. */
|
|
387
441
|
export interface IContractProviderSessionOptions {
|
|
442
|
+
/** Trusted runtime target resolver and invoker. */
|
|
443
|
+
dispatchTool?: ContractToolDispatch;
|
|
388
444
|
/** Gate run before every request and every event `subscribe` (see {@link ContractPermissionCheck}). */
|
|
389
445
|
permissionCheck?: ContractPermissionCheck;
|
|
390
446
|
/**
|
|
@@ -416,6 +472,8 @@ export interface IContractProviderSession {
|
|
|
416
472
|
export type ContractNotificationSink = (notification: IContractNotification) => Promise<unknown>;
|
|
417
473
|
/** Options for {@link createContractProviderEndpoint}. */
|
|
418
474
|
export interface IContractProviderEndpointOptions {
|
|
475
|
+
/** Trusted runtime target resolver and invoker. */
|
|
476
|
+
dispatchTool?: ContractToolDispatch;
|
|
419
477
|
/** Delivers subscription payloads without binding the endpoint to a transport. */
|
|
420
478
|
notify: ContractNotificationSink;
|
|
421
479
|
/** Optional defense-in-depth gate run before calls and subscription creation. */
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.sameUserContractPermissionCheck = exports.CONTRACT_CALL_RPC = void 0;
|
|
4
4
|
exports.createContractConsumer = createContractConsumer;
|
|
5
5
|
exports.createRemoteContractConsumer = createRemoteContractConsumer;
|
|
6
|
+
exports.validateContractActions = validateContractActions;
|
|
7
|
+
exports.authorizedContractActionNames = authorizedContractActionNames;
|
|
6
8
|
exports.createContractProvider = createContractProvider;
|
|
7
9
|
exports.createContractProviderEndpoint = createContractProviderEndpoint;
|
|
8
10
|
exports.createContractProviderSession = createContractProviderSession;
|
|
@@ -11,6 +13,7 @@ const group_permissions_1 = require("../data/group-permissions");
|
|
|
11
13
|
const decorators_1 = require("../data/orm/decorators");
|
|
12
14
|
const observable_1 = require("../observable");
|
|
13
15
|
const utils_1 = require("../utils");
|
|
16
|
+
const action_dispatch_1 = require("./action-dispatch");
|
|
14
17
|
const contract_transport_1 = require("./contract-transport");
|
|
15
18
|
const STANDARD_REMOTE_TABLE_METHODS = new Set([
|
|
16
19
|
"get",
|
|
@@ -73,12 +76,17 @@ exports.CONTRACT_CALL_RPC = contract_transport_1.CONTRACT_REQUEST_CHANNEL;
|
|
|
73
76
|
* @param transport Bidirectional channel to the provider; requests go out on
|
|
74
77
|
* {@link CONTRACT_REQUEST_CHANNEL}, notifications arrive on {@link CONTRACT_NOTIFY_CHANNEL}.
|
|
75
78
|
* @param opts.dataContextId Optional data context to scope every call to.
|
|
79
|
+
* @param opts.providerPackageId Optional provider to address. The local host
|
|
80
|
+
* accepts it only when that package is registered for this contract version.
|
|
76
81
|
*/
|
|
77
82
|
function createContractConsumer(contract, transport, opts = {}) {
|
|
78
83
|
const { contractId, version } = contract;
|
|
79
|
-
const { dataContextId } = opts;
|
|
84
|
+
const { dataContextId, providerPackageId } = opts;
|
|
80
85
|
let disposed = false;
|
|
81
|
-
const emitRequest = (call) => transport.emit(contract_transport_1.CONTRACT_REQUEST_CHANNEL,
|
|
86
|
+
const emitRequest = (call) => transport.emit(contract_transport_1.CONTRACT_REQUEST_CHANNEL, {
|
|
87
|
+
...call,
|
|
88
|
+
...(providerPackageId ? { providerPackageId } : {}),
|
|
89
|
+
});
|
|
82
90
|
const request = (call) => disposed
|
|
83
91
|
? Promise.reject(new Error(`Contract consumer ${contractId} v${version} is disposed`))
|
|
84
92
|
: emitRequest(call);
|
|
@@ -451,8 +459,9 @@ exports.sameUserContractPermissionCheck = sameUserContractPermissionCheck;
|
|
|
451
459
|
/**
|
|
452
460
|
* Deny a contract tool when the caller’s group/personal access is below the tool.
|
|
453
461
|
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
462
|
+
* Ordinary infrastructure tools at {@link AccessLevel.None} need no caller identity.
|
|
463
|
+
* Strict dispatch requires trusted identity/context even at None. Higher levels
|
|
464
|
+
* fail closed if the transport omitted `callerUserId`
|
|
456
465
|
* and `localUserId`. Role lookup uses {@link IContractCallContext.dataContext}
|
|
457
466
|
* when the host attached one, so multi-device processes do not wait on the
|
|
458
467
|
* user-context singleton.
|
|
@@ -464,21 +473,98 @@ exports.sameUserContractPermissionCheck = sameUserContractPermissionCheck;
|
|
|
464
473
|
* @param context - Caller identity from the transport.
|
|
465
474
|
*/
|
|
466
475
|
async function assertContractToolAccess(tool, call, context) {
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
476
|
+
const mode = tool.tool.authorityPropagation ?? "cap";
|
|
477
|
+
const required = (0, action_dispatch_1.dispatchAdmissionLevel)(tool.tool.accessLevel, tool.tool.authorityPropagation);
|
|
478
|
+
const strict = mode === "preserve" || context.authority?.strictActionScope === true;
|
|
479
|
+
if (strict && call.dataContextId && call.dataContextId !== context.dataContext?.dataContextId)
|
|
480
|
+
throw new Error("Cross-context action dispatch is denied");
|
|
481
|
+
if (strict && call.targetDeviceId)
|
|
482
|
+
throw new Error("Strict delegated calls cannot target another device until authority transport is supported");
|
|
471
483
|
const userId = context.callerUserId ?? context.localUserId;
|
|
472
|
-
|
|
473
|
-
|
|
484
|
+
// Preserve unrestricted infrastructure calls outside the bounded action scope.
|
|
485
|
+
if (!strict && required === access_level_1.AccessLevel.None)
|
|
486
|
+
return {
|
|
487
|
+
...context.authority,
|
|
488
|
+
userId,
|
|
489
|
+
userAccessLevel: context.authority?.userAccessLevel ?? access_level_1.AccessLevel.None,
|
|
490
|
+
strictActionScope: false,
|
|
491
|
+
callingToolAccessLevel: required,
|
|
492
|
+
authorityPropagation: "cap",
|
|
493
|
+
};
|
|
494
|
+
if ((!userId || (strict && !context.dataContext)) && (strict || required > access_level_1.AccessLevel.None)) {
|
|
495
|
+
throw new Error(`Permission denied: missing caller identity or trusted context for tool '${tool.tool.name}'`);
|
|
474
496
|
}
|
|
475
|
-
const userLevel =
|
|
476
|
-
?
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
497
|
+
const userLevel = userId
|
|
498
|
+
? context.dataContext
|
|
499
|
+
? await (0, group_permissions_1.getUserAccessLevel)(context.dataContext, userId)
|
|
500
|
+
: (0, access_level_1.accessLevelFromGroupRole)(await (0, group_permissions_1.getUserRole)(call.dataContextId || context.localUserId || userId, userId))
|
|
501
|
+
: access_level_1.AccessLevel.None;
|
|
502
|
+
return (0, action_dispatch_1.authorizeToolDispatch)({ ...context.authority, userId, userAccessLevel: userLevel }, required, mode, strict);
|
|
503
|
+
}
|
|
504
|
+
/** Validate private alias registrations before exposing any action wrapper. */
|
|
505
|
+
function validateContractActions(resolution) {
|
|
506
|
+
for (const [name, target] of Object.entries(resolution.actionAliases ?? {})) {
|
|
507
|
+
const tool = resolution.actionTools?.[target];
|
|
508
|
+
if (!name || !tool || tool.tool.name !== target || target === resolution.actionDispatcher)
|
|
509
|
+
throw new Error(`Unregistered action target: ${name} -> ${target}`);
|
|
480
510
|
}
|
|
481
511
|
}
|
|
512
|
+
/**
|
|
513
|
+
* Project executable aliases using live tool metadata and trusted caller identity.
|
|
514
|
+
*
|
|
515
|
+
* Catalog filtering is advisory; execution rechecks every target.
|
|
516
|
+
*/
|
|
517
|
+
async function authorizedContractActionNames(resolution, context) {
|
|
518
|
+
validateContractActions(resolution);
|
|
519
|
+
if (!(context.callerUserId ?? context.localUserId) || !context.dataContext)
|
|
520
|
+
return [];
|
|
521
|
+
const wrapperName = resolution.actionDispatcher ??
|
|
522
|
+
Object.keys(resolution.tools ?? {}).find((name) => resolution.tools?.[name].tool.authorityPropagation === "preserve");
|
|
523
|
+
const wrapper = wrapperName ? resolution.tools?.[wrapperName] : undefined;
|
|
524
|
+
if (!wrapper)
|
|
525
|
+
return [];
|
|
526
|
+
let wrapperAuthority;
|
|
527
|
+
try {
|
|
528
|
+
wrapperAuthority = await assertContractToolAccess(wrapper, {
|
|
529
|
+
contractId: resolution.contractId,
|
|
530
|
+
version: resolution.version,
|
|
531
|
+
member: "tool",
|
|
532
|
+
name: wrapperName,
|
|
533
|
+
operation: "run",
|
|
534
|
+
args: [],
|
|
535
|
+
}, context);
|
|
536
|
+
}
|
|
537
|
+
catch {
|
|
538
|
+
return [];
|
|
539
|
+
}
|
|
540
|
+
const allowed = [];
|
|
541
|
+
for (const [name, target] of Object.entries(resolution.actionAliases ?? {})) {
|
|
542
|
+
try {
|
|
543
|
+
const action = resolution.actionTools?.[target];
|
|
544
|
+
if (!action)
|
|
545
|
+
continue;
|
|
546
|
+
await assertContractToolAccess(action, {
|
|
547
|
+
contractId: resolution.contractId,
|
|
548
|
+
version: resolution.version,
|
|
549
|
+
member: "tool",
|
|
550
|
+
name: target,
|
|
551
|
+
operation: "run",
|
|
552
|
+
args: [],
|
|
553
|
+
}, {
|
|
554
|
+
...context,
|
|
555
|
+
authority: {
|
|
556
|
+
...wrapperAuthority,
|
|
557
|
+
strictActionScope: true,
|
|
558
|
+
},
|
|
559
|
+
});
|
|
560
|
+
allowed.push(name);
|
|
561
|
+
}
|
|
562
|
+
catch {
|
|
563
|
+
/* Denied aliases are not executable. */
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
return allowed;
|
|
567
|
+
}
|
|
482
568
|
/**
|
|
483
569
|
* Build the **provider** side of a contract proxy: an async handler that permission-checks
|
|
484
570
|
* an {@link IContractCall} and dispatches it to the live table method / tool fn / observable
|
|
@@ -489,9 +575,11 @@ async function assertContractToolAccess(tool, call, context) {
|
|
|
489
575
|
*
|
|
490
576
|
* @param resolution The live contract implementation to dispatch to.
|
|
491
577
|
* @param opts.permissionCheck Optional gate run before every dispatch.
|
|
578
|
+
* @param opts.dispatchTool Trusted runtime target resolver and invoker for `context.dispatchTool`.
|
|
492
579
|
*/
|
|
493
580
|
function createContractProvider(resolution, opts = {}) {
|
|
494
581
|
const { permissionCheck } = opts;
|
|
582
|
+
validateContractActions(resolution);
|
|
495
583
|
return async (call, context = {}) => {
|
|
496
584
|
if (call.contractId !== resolution.contractId || call.version !== resolution.version) {
|
|
497
585
|
throw new Error(`Contract mismatch: resolution provides ${resolution.contractId} v${resolution.version} ` +
|
|
@@ -533,17 +621,70 @@ function createContractProvider(resolution, opts = {}) {
|
|
|
533
621
|
if (!tool) {
|
|
534
622
|
throw new Error(`Contract ${call.contractId} does not provide tool '${call.name}'`);
|
|
535
623
|
}
|
|
536
|
-
|
|
537
|
-
|
|
624
|
+
if (resolution.actionTools && !Object.keys(resolution.actionAliases ?? {}).length)
|
|
625
|
+
throw new Error("Action dispatcher requires registered checked actions");
|
|
626
|
+
const authority = await assertContractToolAccess(tool, call, context);
|
|
627
|
+
if (resolution.toolContext ||
|
|
628
|
+
resolution.forwardCallContext ||
|
|
629
|
+
resolution.actionAliases ||
|
|
630
|
+
authority.strictActionScope) {
|
|
631
|
+
if (call.args.length > 1) {
|
|
632
|
+
throw new Error("Permission denied: tool runs accept a single argument when host context is forwarded");
|
|
633
|
+
}
|
|
538
634
|
const base = resolution.toolContext ?? {
|
|
539
635
|
dataContextId: context.dataContext?.dataContextId ?? "",
|
|
540
636
|
getVariable: async () => {
|
|
541
637
|
throw new Error("Persistent variables are not available to this contract tool");
|
|
542
638
|
},
|
|
543
639
|
};
|
|
544
|
-
|
|
640
|
+
const dispatchTool = (frame) => async (target, args) => {
|
|
641
|
+
if (target.dataContextId &&
|
|
642
|
+
target.dataContextId !== context.dataContext?.dataContextId)
|
|
643
|
+
throw new Error("Cross-context action dispatch is denied");
|
|
644
|
+
if (target.targetDeviceId)
|
|
645
|
+
throw new Error("Strict delegated calls cannot target another device until authority transport is supported");
|
|
646
|
+
if (!context.dataContext || !frame.userId)
|
|
647
|
+
throw new Error("Missing trusted execution context");
|
|
648
|
+
if (!opts.dispatchTool)
|
|
649
|
+
throw new Error("Runtime tool dispatch is unavailable");
|
|
650
|
+
return opts.dispatchTool(target, args, {
|
|
651
|
+
...context,
|
|
652
|
+
authority: (0, action_dispatch_1.narrowActionPrincipal)(frame, true),
|
|
653
|
+
});
|
|
654
|
+
};
|
|
655
|
+
const checkedActionDispatcher = (frame, capabilities) => async (name, args) => {
|
|
656
|
+
const target = resolution.actionAliases?.[name];
|
|
657
|
+
const action = target ? resolution.actionTools?.[target] : undefined;
|
|
658
|
+
if (!target || !action)
|
|
659
|
+
throw new Error(`Unknown action selector: ${name}`);
|
|
660
|
+
const actionCall = { ...call, name: target, args: [args] };
|
|
661
|
+
const actionContext = {
|
|
662
|
+
...context,
|
|
663
|
+
authority: { ...frame, strictActionScope: true },
|
|
664
|
+
};
|
|
665
|
+
const checked = await assertContractToolAccess(action, actionCall, actionContext);
|
|
666
|
+
return action.toolFn(args, {
|
|
667
|
+
...capabilities,
|
|
668
|
+
callerPackageId: context.callerPackageId,
|
|
669
|
+
actorUserId: checked.userId,
|
|
670
|
+
authority: checked,
|
|
671
|
+
callContext: { ...context, authority: checked },
|
|
672
|
+
incomingCallContext: actionContext,
|
|
673
|
+
dispatchAction: checkedActionDispatcher(checked, capabilities),
|
|
674
|
+
dispatchTool: dispatchTool(checked),
|
|
675
|
+
});
|
|
676
|
+
};
|
|
677
|
+
return tool.toolFn(call.args[0], {
|
|
545
678
|
...base,
|
|
546
679
|
callerPackageId: context.callerPackageId,
|
|
680
|
+
actorUserId: authority.userId,
|
|
681
|
+
callContext: { ...context, authority },
|
|
682
|
+
incomingCallContext: context,
|
|
683
|
+
dispatchTool: dispatchTool(authority),
|
|
684
|
+
authority,
|
|
685
|
+
dispatchAction: resolution.actionAliases
|
|
686
|
+
? checkedActionDispatcher(authority, base)
|
|
687
|
+
: undefined,
|
|
547
688
|
});
|
|
548
689
|
}
|
|
549
690
|
return tool.toolFn(...call.args);
|
|
@@ -592,7 +733,10 @@ function createContractProvider(resolution, opts = {}) {
|
|
|
592
733
|
*/
|
|
593
734
|
function createContractProviderEndpoint(resolution, opts) {
|
|
594
735
|
const { notify, permissionCheck, context: defaultContext } = opts;
|
|
595
|
-
const dispatch = createContractProvider(resolution, {
|
|
736
|
+
const dispatch = createContractProvider(resolution, {
|
|
737
|
+
permissionCheck,
|
|
738
|
+
dispatchTool: opts.dispatchTool,
|
|
739
|
+
});
|
|
596
740
|
// One live subscription per resolved subscription key, refcounted by the subscribers
|
|
597
741
|
// currently attached to it, plus a reverse index for unsubscribe. Each subscriber keeps
|
|
598
742
|
// the caller context from its subscribe call so event filters can differ per consumer.
|
|
@@ -147,9 +147,12 @@ async function isSelfTrustedContractCaller(userContext, remoteIdentity) {
|
|
|
147
147
|
}
|
|
148
148
|
const permissionDenied = (call, reason) => new Error(`Permission denied: ${call.member} '${call.name}'.${call.operation} on contract ${call.contractId}${reason ? ` (${reason})` : ""}`);
|
|
149
149
|
const localOnlyContractIds = new Set([
|
|
150
|
+
system_ids_1.contractCatalogContractId,
|
|
151
|
+
system_ids_1.httpContractId,
|
|
150
152
|
system_ids_1.identityContractId,
|
|
151
153
|
system_ids_1.invitesContractId,
|
|
152
154
|
system_ids_1.localFoldersContractId,
|
|
155
|
+
system_ids_1.schedulerContractId,
|
|
153
156
|
system_ids_1.toolAccessControlContractId,
|
|
154
157
|
]);
|
|
155
158
|
/**
|
|
@@ -322,6 +325,7 @@ function resolvesWithoutUser(contractId, version, peekUserContext) {
|
|
|
322
325
|
function createLocalUserContextContractProviderRouter(transport, opts) {
|
|
323
326
|
const { getUserContext, peekUserContext, allowedContractIds, resolveVariable } = opts;
|
|
324
327
|
return (0, contract_provider_router_1.createContractProviderRouter)(transport, {
|
|
328
|
+
allowRequestedProvider: true,
|
|
325
329
|
authorizeCall: async (call) => {
|
|
326
330
|
if (allowedContractIds && !allowedContractIds.has(call.contractId)) {
|
|
327
331
|
throw new Error(`Permission denied: contract ${call.contractId} is not available locally`);
|
|
@@ -341,12 +345,19 @@ function createLocalUserContextContractProviderRouter(transport, opts) {
|
|
|
341
345
|
context,
|
|
342
346
|
};
|
|
343
347
|
},
|
|
344
|
-
resolveProviderPackageId: async ({ contractId, version, dataContextId }) => {
|
|
348
|
+
resolveProviderPackageId: async ({ contractId, version, dataContextId, requestedProviderPackageId, }) => {
|
|
345
349
|
if (resolvesWithoutUser(contractId, version, peekUserContext)) {
|
|
346
350
|
return undefined;
|
|
347
351
|
}
|
|
348
352
|
const userContext = await getUserContext();
|
|
349
353
|
const dataContext = getAuthorizedLocalDataContext(userContext, dataContextId);
|
|
354
|
+
if (requestedProviderPackageId) {
|
|
355
|
+
const registered = dataContext.packageLoader?.contractRegistry.getRegisteredProviderIds(contractId, version) ?? [];
|
|
356
|
+
if (!registered.includes(requestedProviderPackageId)) {
|
|
357
|
+
throw new Error(`Package ${requestedProviderPackageId} is not a registered provider for ${contractId} v${version}`);
|
|
358
|
+
}
|
|
359
|
+
return requestedProviderPackageId;
|
|
360
|
+
}
|
|
350
361
|
return getActiveProviderPackageId(dataContext, contractId, version);
|
|
351
362
|
},
|
|
352
363
|
resolveEndpoint: async (request) => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
export * from "./action-dispatch";
|
|
1
2
|
export { ContractBuilder, definePackage, PackageBuilder } from "./builder";
|
|
2
3
|
export { type ContractCallAuthorizer, type ContractProviderEndpointResolver, type ContractProviderPackageResolver, createContractProviderRouter, type IAuthorizedContractRoute, type IContractProviderEndpointRequest, type IContractProviderRouter, type IContractProviderRouterOptions, } from "./contract-provider-router";
|
|
3
4
|
export { ContractProviders, ContractProvidersTable, contractProvidersMetaData, contractProvidersSchema, type IContractProviderRecord, } from "./contract-providers.table";
|
|
4
|
-
export { CONTRACT_CALL_RPC, type ContractMemberType, type ContractNotificationSink, type ContractPermissionCheck, createContractConsumer, createContractProvider, createContractProviderEndpoint, createContractProviderSession, createRemoteContractConsumer, type IContractCall, type IContractCallContext, type IContractConsumer, type IContractConsumerBase, type IContractNotification, type IContractProviderEndpoint, type IContractProviderEndpointOptions, type IContractProviderSession, type IContractProviderSessionOptions, type IContractResolution, type IContractTableProxy, type IContractToolContext, type ITableProxy, sameUserContractPermissionCheck, } from "./contract-proxy";
|
|
5
|
+
export { authorizedContractActionNames, CONTRACT_CALL_RPC, type ContractMemberType, type ContractNotificationSink, type ContractPermissionCheck, type ContractToolDispatch, createContractConsumer, createContractProvider, createContractProviderEndpoint, createContractProviderSession, createRemoteContractConsumer, type IContractCall, type IContractCallContext, type IContractConsumer, type IContractConsumerBase, type IContractNotification, type IContractProviderEndpoint, type IContractProviderEndpointOptions, type IContractProviderSession, type IContractProviderSessionOptions, type IContractResolution, type IContractTableProxy, type IContractToolContext, type IContractToolTarget, type ITableProxy, sameUserContractPermissionCheck, validateContractActions, } from "./contract-proxy";
|
|
5
6
|
export { authorizeRemoteContractCall, type ContractRemoteIdentity, type ContractResolver, createLocalUserContextContractProviderRouter, createUserContextContractProviderRouter, getContractResolver, handleContractCall, type IContractResolverRegistrationOptions, type ILocalContractVariableRequest, isSelfTrustedContractCaller, type LocalContractVariableResolver, registerContractResolver, verifyRemoteContractIdentity, } from "./contract-resolvers";
|
|
6
7
|
export { CONTRACT_NOTIFY_CHANNEL, CONTRACT_REQUEST_CHANNEL, connectionContractTransport, type IContractTransport, type IDuplexEmitter, inProcessTransportPair, } from "./contract-transport";
|
|
7
8
|
export { Contracts, ContractsTable, contractsMetaData, contractsSchema, type IContractRecord, } from "./contracts.table";
|
|
@@ -12,12 +13,15 @@ export { getHostContractTransport, type HostContractTransportListener, registerH
|
|
|
12
13
|
export { PersistentContractRegistry } from "./persistent-registry";
|
|
13
14
|
export { ContractRegistry, type IContractProviderRegistration } from "./registry";
|
|
14
15
|
export { createRemoteContractEndpoint, getRemoteContractTransportFactory, type IRemoteContractHost, type IRemoteContractTarget, type RemoteContractTransportFactory, resolveRemoteTargetEndpoint, setRemoteContractTransportFactory, } from "./remote-contract-transport";
|
|
16
|
+
export { CONTRACT_CATALOG_VERSION, contractCatalogProviderPackageId, getContractCatalogDefinition, type IContractCatalogConsumer, type IContractProviderInfo, type IListContractProvidersInput, } from "./system/contract-catalog-contract";
|
|
15
17
|
export { DEVICE_OPERATIONS_CONTRACT_VERSION, DEVICE_OPERATIONS_MAX_QUERY_LENGTH, DEVICE_OPERATIONS_MAX_RESULT_BYTES, DEVICE_OPERATIONS_MAX_ROWS, DEVICE_OPERATIONS_MAX_TOOLS, type DeviceOperationCapability, deviceOperationsProviderPackageId, deviceOperationsToolIds, getDeviceOperationsContractDefinition, type IDeviceDatabaseQueryInput, type IDeviceDatabaseQueryResult, type IDeviceOperationStatus, type IDeviceToolListInput, type IDeviceToolLookupInput, type IDeviceToolLookupResult, type IDeviceToolRunInput, } from "./system/device-operations-contract";
|
|
18
|
+
export { getHttpContractDefinition, HTTP_CONTRACT_VERSION, HTTP_DEFAULT_TIMEOUT_MS, HTTP_MAX_BODY_BYTES, HTTP_MAX_TIMEOUT_MS, httpProviderPackageId, type IHttpCancelInput, type IHttpConsumer, type IHttpCredentialInfo, type IHttpMultipartPart, type IHttpPolicyInfo, type IHttpRequestInput, type IHttpRequestResult, } from "./system/http-contract";
|
|
16
19
|
export { getIdentityContractDefinition, IDENTITY_CONTRACT_VERSION, type IIdentityConsumer, type IIdentityKeyInfo, type IIdentityRegistryKey, type IIdentityRotateKeyInput, type IIdentityRotateKeyResult, type IIdentitySessionInfo, } from "./system/identity-contract";
|
|
17
20
|
export { getInvitesContractDefinition, type IAcceptInviteResult, type ICreatedInvite, type IInvitePreview, type IInvitesConsumer, INVITES_CONTRACT_VERSION, } from "./system/invites-contract";
|
|
18
21
|
export { getLocalFoldersContractDefinition, type ILocalFolderAssembleInput, type ILocalFolderAssembleResult, type ILocalFolderChange, type ILocalFolderChangedEvent, type ILocalFolderEntry, type ILocalFolderFileBlocks, type ILocalFolderFileBlocksInput, type ILocalFolderGrantInfo, type ILocalFolderIndexInput, type ILocalFolderIndexResult, type ILocalFolderJobFinishedEvent, type ILocalFolderJobHandle, type ILocalFolderJobInfo, type ILocalFolderJobProgressEvent, type ILocalFolderListInput, type ILocalFolderManifestBlock, type ILocalFolderMoveInput, type ILocalFolderPathInput, type ILocalFolderPurgeTrashInput, type ILocalFolderReadRangeInput, type ILocalFolderReadRangeResult, type ILocalFolderRequestGrantInput, type ILocalFolderStatInput, LOCAL_FOLDERS_ASSEMBLE_STALL_MS, LOCAL_FOLDERS_CHUNK_AVG, LOCAL_FOLDERS_CHUNK_MAX, LOCAL_FOLDERS_CHUNK_MIN, LOCAL_FOLDERS_CONTRACT_VERSION, LOCAL_FOLDERS_GETBLOCKS_MAX_BLOCKS, LOCAL_FOLDERS_GETBLOCKS_MAX_BYTES, LOCAL_FOLDERS_HAVE_BATCH, LOCAL_FOLDERS_JOB_TTL_MS, LOCAL_FOLDERS_READ_RANGE_MAX, LOCAL_FOLDERS_RESERVED_DIR, type LocalFolderChangeKind, type LocalFolderEntryKind, type LocalFolderJobKind, type LocalFolderMode, localFoldersProviderPackageId, } from "./system/local-folders-contract";
|
|
19
22
|
export { getLogsContractDefinition, type ILogsConsumer, LOGS_CONTRACT_VERSION, resolveLogsContract, } from "./system/logs-contract";
|
|
20
23
|
export * from "./system/network-contracts";
|
|
24
|
+
export { getSchedulerContractDefinition, type IScheduleInfo, type IScheduleInput, type ISchedulerConsumer, SCHEDULER_CONTRACT_VERSION, SCHEDULER_MAX_DELAY_MS, schedulerProviderPackageId, } from "./system/scheduler-contract";
|
|
21
25
|
export { getToolAccessControlContractDefinition, type IToolAccessControlConsumer, TOOL_ACCESS_CONTROL_CONTRACT_VERSION, } from "./system/tool-access-control-contract";
|
|
22
26
|
export { type ISystemContractRegistration, installSystemContracts, listSystemContracts, registerSystemContract, } from "./system-contracts";
|
|
23
27
|
export type { IAlsoImplementsDeclaration, IConsumedContract, IConsumedContractHandle, IConsumedContractOptions, IContractDefinition, IContractEvent, IContractObservable, IContractTable, IContractTool, IPackageDefinitionResult, IRemoteContract, IRemoteContractConsumer, IRemoteContractHandle, IResolvedContract, IValidationError, IValidationResult, } from "./types";
|
package/dist/contracts/index.js
CHANGED
|
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.validateProviderSatisfiesContract = exports.validateImmutability = exports.validateAlsoImplements = exports.contractKey = exports.registerSystemContract = exports.listSystemContracts = exports.installSystemContracts = exports.TOOL_ACCESS_CONTROL_CONTRACT_VERSION = exports.getToolAccessControlContractDefinition = exports.resolveLogsContract = exports.LOGS_CONTRACT_VERSION = exports.getLogsContractDefinition = exports.localFoldersProviderPackageId = exports.LOCAL_FOLDERS_RESERVED_DIR = exports.LOCAL_FOLDERS_READ_RANGE_MAX = exports.LOCAL_FOLDERS_JOB_TTL_MS = exports.LOCAL_FOLDERS_HAVE_BATCH = exports.LOCAL_FOLDERS_GETBLOCKS_MAX_BYTES = exports.LOCAL_FOLDERS_GETBLOCKS_MAX_BLOCKS = exports.LOCAL_FOLDERS_CONTRACT_VERSION = exports.LOCAL_FOLDERS_CHUNK_MIN = exports.LOCAL_FOLDERS_CHUNK_MAX = exports.LOCAL_FOLDERS_CHUNK_AVG = exports.LOCAL_FOLDERS_ASSEMBLE_STALL_MS = exports.getLocalFoldersContractDefinition = exports.INVITES_CONTRACT_VERSION = exports.getInvitesContractDefinition = exports.IDENTITY_CONTRACT_VERSION = exports.getIdentityContractDefinition = exports.getDeviceOperationsContractDefinition = exports.deviceOperationsToolIds = exports.deviceOperationsProviderPackageId = exports.DEVICE_OPERATIONS_MAX_TOOLS = void 0;
|
|
17
|
+
exports.contractCatalogProviderPackageId = exports.CONTRACT_CATALOG_VERSION = exports.setRemoteContractTransportFactory = exports.resolveRemoteTargetEndpoint = exports.getRemoteContractTransportFactory = exports.createRemoteContractEndpoint = exports.ContractRegistry = exports.PersistentContractRegistry = exports.waitForHostContractTransport = exports.subscribeHostContractTransport = exports.registerHostContractTransport = exports.getHostContractTransport = exports.hostContractConsumer = exports.setSchemaToFieldsFn = exports.extractToolShape = exports.extractTableShape = exports.createLocalContractConsumer = exports.contractsSchema = exports.contractsMetaData = exports.ContractsTable = exports.Contracts = exports.inProcessTransportPair = exports.connectionContractTransport = exports.CONTRACT_REQUEST_CHANNEL = exports.CONTRACT_NOTIFY_CHANNEL = exports.verifyRemoteContractIdentity = exports.registerContractResolver = exports.isSelfTrustedContractCaller = exports.handleContractCall = exports.getContractResolver = exports.createUserContextContractProviderRouter = exports.createLocalUserContextContractProviderRouter = exports.authorizeRemoteContractCall = exports.validateContractActions = exports.sameUserContractPermissionCheck = exports.createRemoteContractConsumer = exports.createContractProviderSession = exports.createContractProviderEndpoint = exports.createContractProvider = exports.createContractConsumer = exports.CONTRACT_CALL_RPC = exports.authorizedContractActionNames = exports.contractProvidersSchema = exports.contractProvidersMetaData = exports.ContractProvidersTable = exports.ContractProviders = exports.createContractProviderRouter = exports.PackageBuilder = exports.definePackage = exports.ContractBuilder = void 0;
|
|
18
|
+
exports.validateProviderSatisfiesContract = exports.validateImmutability = exports.validateAlsoImplements = exports.contractKey = exports.registerSystemContract = exports.listSystemContracts = exports.installSystemContracts = exports.TOOL_ACCESS_CONTROL_CONTRACT_VERSION = exports.getToolAccessControlContractDefinition = exports.schedulerProviderPackageId = exports.SCHEDULER_MAX_DELAY_MS = exports.SCHEDULER_CONTRACT_VERSION = exports.getSchedulerContractDefinition = exports.resolveLogsContract = exports.LOGS_CONTRACT_VERSION = exports.getLogsContractDefinition = exports.localFoldersProviderPackageId = exports.LOCAL_FOLDERS_RESERVED_DIR = exports.LOCAL_FOLDERS_READ_RANGE_MAX = exports.LOCAL_FOLDERS_JOB_TTL_MS = exports.LOCAL_FOLDERS_HAVE_BATCH = exports.LOCAL_FOLDERS_GETBLOCKS_MAX_BYTES = exports.LOCAL_FOLDERS_GETBLOCKS_MAX_BLOCKS = exports.LOCAL_FOLDERS_CONTRACT_VERSION = exports.LOCAL_FOLDERS_CHUNK_MIN = exports.LOCAL_FOLDERS_CHUNK_MAX = exports.LOCAL_FOLDERS_CHUNK_AVG = exports.LOCAL_FOLDERS_ASSEMBLE_STALL_MS = exports.getLocalFoldersContractDefinition = exports.INVITES_CONTRACT_VERSION = exports.getInvitesContractDefinition = exports.IDENTITY_CONTRACT_VERSION = exports.getIdentityContractDefinition = exports.httpProviderPackageId = exports.HTTP_MAX_TIMEOUT_MS = exports.HTTP_MAX_BODY_BYTES = exports.HTTP_DEFAULT_TIMEOUT_MS = exports.HTTP_CONTRACT_VERSION = exports.getHttpContractDefinition = exports.getDeviceOperationsContractDefinition = exports.deviceOperationsToolIds = exports.deviceOperationsProviderPackageId = exports.DEVICE_OPERATIONS_MAX_TOOLS = exports.DEVICE_OPERATIONS_MAX_ROWS = exports.DEVICE_OPERATIONS_MAX_RESULT_BYTES = exports.DEVICE_OPERATIONS_MAX_QUERY_LENGTH = exports.DEVICE_OPERATIONS_CONTRACT_VERSION = exports.getContractCatalogDefinition = void 0;
|
|
19
|
+
__exportStar(require("./action-dispatch"), exports);
|
|
19
20
|
var builder_1 = require("./builder");
|
|
20
21
|
Object.defineProperty(exports, "ContractBuilder", { enumerable: true, get: function () { return builder_1.ContractBuilder; } });
|
|
21
22
|
Object.defineProperty(exports, "definePackage", { enumerable: true, get: function () { return builder_1.definePackage; } });
|
|
@@ -28,6 +29,7 @@ Object.defineProperty(exports, "ContractProvidersTable", { enumerable: true, get
|
|
|
28
29
|
Object.defineProperty(exports, "contractProvidersMetaData", { enumerable: true, get: function () { return contract_providers_table_1.contractProvidersMetaData; } });
|
|
29
30
|
Object.defineProperty(exports, "contractProvidersSchema", { enumerable: true, get: function () { return contract_providers_table_1.contractProvidersSchema; } });
|
|
30
31
|
var contract_proxy_1 = require("./contract-proxy");
|
|
32
|
+
Object.defineProperty(exports, "authorizedContractActionNames", { enumerable: true, get: function () { return contract_proxy_1.authorizedContractActionNames; } });
|
|
31
33
|
Object.defineProperty(exports, "CONTRACT_CALL_RPC", { enumerable: true, get: function () { return contract_proxy_1.CONTRACT_CALL_RPC; } });
|
|
32
34
|
Object.defineProperty(exports, "createContractConsumer", { enumerable: true, get: function () { return contract_proxy_1.createContractConsumer; } });
|
|
33
35
|
Object.defineProperty(exports, "createContractProvider", { enumerable: true, get: function () { return contract_proxy_1.createContractProvider; } });
|
|
@@ -35,6 +37,7 @@ Object.defineProperty(exports, "createContractProviderEndpoint", { enumerable: t
|
|
|
35
37
|
Object.defineProperty(exports, "createContractProviderSession", { enumerable: true, get: function () { return contract_proxy_1.createContractProviderSession; } });
|
|
36
38
|
Object.defineProperty(exports, "createRemoteContractConsumer", { enumerable: true, get: function () { return contract_proxy_1.createRemoteContractConsumer; } });
|
|
37
39
|
Object.defineProperty(exports, "sameUserContractPermissionCheck", { enumerable: true, get: function () { return contract_proxy_1.sameUserContractPermissionCheck; } });
|
|
40
|
+
Object.defineProperty(exports, "validateContractActions", { enumerable: true, get: function () { return contract_proxy_1.validateContractActions; } });
|
|
38
41
|
var contract_resolvers_1 = require("./contract-resolvers");
|
|
39
42
|
Object.defineProperty(exports, "authorizeRemoteContractCall", { enumerable: true, get: function () { return contract_resolvers_1.authorizeRemoteContractCall; } });
|
|
40
43
|
Object.defineProperty(exports, "createLocalUserContextContractProviderRouter", { enumerable: true, get: function () { return contract_resolvers_1.createLocalUserContextContractProviderRouter; } });
|
|
@@ -76,6 +79,10 @@ Object.defineProperty(exports, "createRemoteContractEndpoint", { enumerable: tru
|
|
|
76
79
|
Object.defineProperty(exports, "getRemoteContractTransportFactory", { enumerable: true, get: function () { return remote_contract_transport_1.getRemoteContractTransportFactory; } });
|
|
77
80
|
Object.defineProperty(exports, "resolveRemoteTargetEndpoint", { enumerable: true, get: function () { return remote_contract_transport_1.resolveRemoteTargetEndpoint; } });
|
|
78
81
|
Object.defineProperty(exports, "setRemoteContractTransportFactory", { enumerable: true, get: function () { return remote_contract_transport_1.setRemoteContractTransportFactory; } });
|
|
82
|
+
var contract_catalog_contract_1 = require("./system/contract-catalog-contract");
|
|
83
|
+
Object.defineProperty(exports, "CONTRACT_CATALOG_VERSION", { enumerable: true, get: function () { return contract_catalog_contract_1.CONTRACT_CATALOG_VERSION; } });
|
|
84
|
+
Object.defineProperty(exports, "contractCatalogProviderPackageId", { enumerable: true, get: function () { return contract_catalog_contract_1.contractCatalogProviderPackageId; } });
|
|
85
|
+
Object.defineProperty(exports, "getContractCatalogDefinition", { enumerable: true, get: function () { return contract_catalog_contract_1.getContractCatalogDefinition; } });
|
|
79
86
|
var device_operations_contract_1 = require("./system/device-operations-contract");
|
|
80
87
|
Object.defineProperty(exports, "DEVICE_OPERATIONS_CONTRACT_VERSION", { enumerable: true, get: function () { return device_operations_contract_1.DEVICE_OPERATIONS_CONTRACT_VERSION; } });
|
|
81
88
|
Object.defineProperty(exports, "DEVICE_OPERATIONS_MAX_QUERY_LENGTH", { enumerable: true, get: function () { return device_operations_contract_1.DEVICE_OPERATIONS_MAX_QUERY_LENGTH; } });
|
|
@@ -85,6 +92,13 @@ Object.defineProperty(exports, "DEVICE_OPERATIONS_MAX_TOOLS", { enumerable: true
|
|
|
85
92
|
Object.defineProperty(exports, "deviceOperationsProviderPackageId", { enumerable: true, get: function () { return device_operations_contract_1.deviceOperationsProviderPackageId; } });
|
|
86
93
|
Object.defineProperty(exports, "deviceOperationsToolIds", { enumerable: true, get: function () { return device_operations_contract_1.deviceOperationsToolIds; } });
|
|
87
94
|
Object.defineProperty(exports, "getDeviceOperationsContractDefinition", { enumerable: true, get: function () { return device_operations_contract_1.getDeviceOperationsContractDefinition; } });
|
|
95
|
+
var http_contract_1 = require("./system/http-contract");
|
|
96
|
+
Object.defineProperty(exports, "getHttpContractDefinition", { enumerable: true, get: function () { return http_contract_1.getHttpContractDefinition; } });
|
|
97
|
+
Object.defineProperty(exports, "HTTP_CONTRACT_VERSION", { enumerable: true, get: function () { return http_contract_1.HTTP_CONTRACT_VERSION; } });
|
|
98
|
+
Object.defineProperty(exports, "HTTP_DEFAULT_TIMEOUT_MS", { enumerable: true, get: function () { return http_contract_1.HTTP_DEFAULT_TIMEOUT_MS; } });
|
|
99
|
+
Object.defineProperty(exports, "HTTP_MAX_BODY_BYTES", { enumerable: true, get: function () { return http_contract_1.HTTP_MAX_BODY_BYTES; } });
|
|
100
|
+
Object.defineProperty(exports, "HTTP_MAX_TIMEOUT_MS", { enumerable: true, get: function () { return http_contract_1.HTTP_MAX_TIMEOUT_MS; } });
|
|
101
|
+
Object.defineProperty(exports, "httpProviderPackageId", { enumerable: true, get: function () { return http_contract_1.httpProviderPackageId; } });
|
|
88
102
|
var identity_contract_1 = require("./system/identity-contract");
|
|
89
103
|
Object.defineProperty(exports, "getIdentityContractDefinition", { enumerable: true, get: function () { return identity_contract_1.getIdentityContractDefinition; } });
|
|
90
104
|
Object.defineProperty(exports, "IDENTITY_CONTRACT_VERSION", { enumerable: true, get: function () { return identity_contract_1.IDENTITY_CONTRACT_VERSION; } });
|
|
@@ -110,6 +124,11 @@ Object.defineProperty(exports, "getLogsContractDefinition", { enumerable: true,
|
|
|
110
124
|
Object.defineProperty(exports, "LOGS_CONTRACT_VERSION", { enumerable: true, get: function () { return logs_contract_1.LOGS_CONTRACT_VERSION; } });
|
|
111
125
|
Object.defineProperty(exports, "resolveLogsContract", { enumerable: true, get: function () { return logs_contract_1.resolveLogsContract; } });
|
|
112
126
|
__exportStar(require("./system/network-contracts"), exports);
|
|
127
|
+
var scheduler_contract_1 = require("./system/scheduler-contract");
|
|
128
|
+
Object.defineProperty(exports, "getSchedulerContractDefinition", { enumerable: true, get: function () { return scheduler_contract_1.getSchedulerContractDefinition; } });
|
|
129
|
+
Object.defineProperty(exports, "SCHEDULER_CONTRACT_VERSION", { enumerable: true, get: function () { return scheduler_contract_1.SCHEDULER_CONTRACT_VERSION; } });
|
|
130
|
+
Object.defineProperty(exports, "SCHEDULER_MAX_DELAY_MS", { enumerable: true, get: function () { return scheduler_contract_1.SCHEDULER_MAX_DELAY_MS; } });
|
|
131
|
+
Object.defineProperty(exports, "schedulerProviderPackageId", { enumerable: true, get: function () { return scheduler_contract_1.schedulerProviderPackageId; } });
|
|
113
132
|
var tool_access_control_contract_1 = require("./system/tool-access-control-contract");
|
|
114
133
|
Object.defineProperty(exports, "getToolAccessControlContractDefinition", { enumerable: true, get: function () { return tool_access_control_contract_1.getToolAccessControlContractDefinition; } });
|
|
115
134
|
Object.defineProperty(exports, "TOOL_ACCESS_CONTROL_CONTRACT_VERSION", { enumerable: true, get: function () { return tool_access_control_contract_1.TOOL_ACCESS_CONTROL_CONTRACT_VERSION; } });
|