@peers-app/peers-sdk 0.21.0 → 0.21.2
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/dist/context/user-context.d.ts +10 -3
- package/dist/context/user-context.js +12 -12
- package/dist/contracts/__tests__/builder.test.js +158 -4
- package/dist/contracts/__tests__/registry.test.js +45 -303
- package/dist/contracts/__tests__/system-contracts.test.d.ts +1 -0
- package/dist/contracts/__tests__/system-contracts.test.js +52 -0
- package/dist/contracts/builder.d.ts +43 -2
- package/dist/contracts/builder.js +79 -5
- package/dist/contracts/contract-proxy.d.ts +61 -21
- package/dist/contracts/create-local-consumer.d.ts +12 -0
- package/dist/contracts/create-local-consumer.js +19 -0
- package/dist/contracts/index.d.ts +5 -3
- package/dist/contracts/index.js +8 -1
- package/dist/contracts/registry.d.ts +17 -0
- package/dist/contracts/registry.js +36 -0
- package/dist/contracts/system/device-operations-contract.js +7 -0
- package/dist/contracts/system/index.d.ts +8 -0
- package/dist/contracts/system/index.js +22 -0
- package/dist/contracts/system/logs-contract.d.ts +18 -1
- package/dist/contracts/system/logs-contract.js +8 -2
- package/dist/contracts/system-contracts.d.ts +47 -0
- package/dist/contracts/system-contracts.js +69 -0
- package/dist/contracts/types.d.ts +44 -0
- package/dist/package-installer/index.d.ts +1 -0
- package/dist/package-installer/index.js +1 -0
- package/dist/package-installer/package-author-signer.d.ts +25 -0
- package/dist/package-installer/package-author-signer.js +57 -0
- package/dist/package-installer/package-installer.d.ts +27 -0
- package/dist/package-installer/package-installer.js +88 -18
- package/dist/package-installer/package-installer.test.js +49 -0
- package/dist/package-installer/types.d.ts +1 -1
- package/dist/package-loader/contract-package-loader.test.d.ts +1 -0
- package/dist/package-loader/contract-package-loader.test.js +88 -0
- package/dist/package-loader/package-loader.d.ts +11 -3
- package/dist/package-loader/package-loader.js +31 -5
- package/dist/package-loader/package-loader.test.d.ts +1 -0
- package/dist/package-loader/package-loader.test.js +98 -0
- package/dist/package-loader/resolve-consumed-contracts.d.ts +13 -0
- package/dist/package-loader/resolve-consumed-contracts.js +55 -0
- package/dist/package-loader/resolve-consumed-contracts.test.d.ts +1 -0
- package/dist/package-loader/resolve-consumed-contracts.test.js +123 -0
- package/dist/rpc-types.d.ts +6 -0
- package/dist/rpc-types.js +2 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ITableDefinition } from "../data/orm/table-definitions.type";
|
|
2
2
|
import type { IToolInstance } from "../data/tools";
|
|
3
|
+
import type { IContractConsumer, IContractConsumerBase } from "./contract-proxy";
|
|
3
4
|
import type { IExtractableTableDef, IExtractableToolInstance } from "./extract";
|
|
4
|
-
import type { IAlsoImplementsDeclaration, IContractDefinition, IContractEvent, IContractObservable, IPackageDefinitionResult } from "./types";
|
|
5
|
+
import type { IAlsoImplementsDeclaration, IConsumedContractHandle, IConsumedContractOptions, IContractDefinition, IContractEvent, IContractObservable, IPackageDefinitionResult } from "./types";
|
|
5
6
|
/**
|
|
6
7
|
* Scoped builder for a single contract within a package. Returned by
|
|
7
8
|
* `PackageBuilder.contract()`.
|
|
@@ -56,6 +57,27 @@ export declare class ContractBuilder {
|
|
|
56
57
|
tableDefinitions: ITableDefinition[];
|
|
57
58
|
};
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a deferred consumed-contract handle. Settlement is SDK-owned via
|
|
62
|
+
* {@link settleConsumedContractHandle} / {@link rejectConsumedContractHandle}.
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export declare function createConsumedContractHandle<T extends IContractConsumerBase | undefined = IContractConsumerBase | undefined>(): IConsumedContractHandle<T>;
|
|
67
|
+
/**
|
|
68
|
+
* Resolve a consumed-contract handle with a live proxy, or `undefined` for an
|
|
69
|
+
* unmatched optional dependency. One-shot — throws if already settled.
|
|
70
|
+
*
|
|
71
|
+
* @internal Used by the package-loader when settling `consumes` handles.
|
|
72
|
+
*/
|
|
73
|
+
export declare function settleConsumedContractHandle(handle: IConsumedContractHandle<IContractConsumerBase | undefined>, consumer: IContractConsumerBase | undefined): void;
|
|
74
|
+
/**
|
|
75
|
+
* Reject a consumed-contract handle (e.g. required dependency missing).
|
|
76
|
+
* One-shot — throws if already settled.
|
|
77
|
+
*
|
|
78
|
+
* @internal Used by the package-loader when settling `consumes` handles.
|
|
79
|
+
*/
|
|
80
|
+
export declare function rejectConsumedContractHandle(handle: IConsumedContractHandle<IContractConsumerBase | undefined>, reason: unknown): void;
|
|
59
81
|
/**
|
|
60
82
|
* Top-level builder passed to the `definePackage` callback.
|
|
61
83
|
*
|
|
@@ -95,8 +117,27 @@ export declare class PackageBuilder {
|
|
|
95
117
|
contract(contractId: string, version: number, name: string): ContractBuilder;
|
|
96
118
|
/**
|
|
97
119
|
* Declare a dependency on another package's contract.
|
|
120
|
+
*
|
|
121
|
+
* Returns a deferred handle immediately. Await `handle.consumer` from
|
|
122
|
+
* runtime code after package definition — not inside this callback — so
|
|
123
|
+
* package loading stays non-blocking. The package-loader settles the
|
|
124
|
+
* promise once providers are registered (follow-up work).
|
|
125
|
+
*
|
|
126
|
+
* Pass a type argument to narrow the resolved consumer beyond the default
|
|
127
|
+
* {@link IContractConsumer} shape, e.g. `pkg.consumes<ILogsConsumer>(id, 1)`.
|
|
128
|
+
* Typed consumers need only extend {@link IContractConsumerBase}.
|
|
129
|
+
*
|
|
130
|
+
* @typeParam T - Consumer proxy type (defaults to {@link IContractConsumer}).
|
|
131
|
+
* @param contractId - Must be a valid peer ID (25-char alphanumeric from `newid()`).
|
|
132
|
+
* @param version - Positive integer version number.
|
|
133
|
+
* @param opts - Optional dependency and provider-preference options.
|
|
98
134
|
*/
|
|
99
|
-
consumes(contractId: string, version: number
|
|
135
|
+
consumes<T extends IContractConsumerBase = IContractConsumer>(contractId: string, version: number, opts: IConsumedContractOptions & {
|
|
136
|
+
optional: true;
|
|
137
|
+
}): IConsumedContractHandle<T | undefined>;
|
|
138
|
+
consumes<T extends IContractConsumerBase = IContractConsumer>(contractId: string, version: number, opts?: Omit<IConsumedContractOptions, "optional"> & {
|
|
139
|
+
optional?: false;
|
|
140
|
+
}): IConsumedContractHandle<T>;
|
|
100
141
|
/** @internal Finalize and return the package definition result. */
|
|
101
142
|
_build(): IPackageDefinitionResult;
|
|
102
143
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PackageBuilder = exports.ContractBuilder = void 0;
|
|
4
|
+
exports.createConsumedContractHandle = createConsumedContractHandle;
|
|
5
|
+
exports.settleConsumedContractHandle = settleConsumedContractHandle;
|
|
6
|
+
exports.rejectConsumedContractHandle = rejectConsumedContractHandle;
|
|
4
7
|
exports.definePackage = definePackage;
|
|
5
8
|
const utils_1 = require("../utils");
|
|
6
9
|
const extract_1 = require("./extract");
|
|
@@ -103,6 +106,61 @@ class ContractBuilder {
|
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
exports.ContractBuilder = ContractBuilder;
|
|
109
|
+
const consumedContractDeferreds = new WeakMap();
|
|
110
|
+
/**
|
|
111
|
+
* Create a deferred consumed-contract handle. Settlement is SDK-owned via
|
|
112
|
+
* {@link settleConsumedContractHandle} / {@link rejectConsumedContractHandle}.
|
|
113
|
+
*
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
function createConsumedContractHandle() {
|
|
117
|
+
let resolve;
|
|
118
|
+
let reject;
|
|
119
|
+
const consumer = new Promise((res, rej) => {
|
|
120
|
+
resolve = res;
|
|
121
|
+
reject = rej;
|
|
122
|
+
});
|
|
123
|
+
// Avoid unhandled-rejection noise when the package-loader settles with an
|
|
124
|
+
// error before any package code awaits the handle.
|
|
125
|
+
consumer.catch(() => { });
|
|
126
|
+
const handle = { consumer };
|
|
127
|
+
consumedContractDeferreds.set(handle, { resolve, reject, settled: false });
|
|
128
|
+
return handle;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Resolve a consumed-contract handle with a live proxy, or `undefined` for an
|
|
132
|
+
* unmatched optional dependency. One-shot — throws if already settled.
|
|
133
|
+
*
|
|
134
|
+
* @internal Used by the package-loader when settling `consumes` handles.
|
|
135
|
+
*/
|
|
136
|
+
function settleConsumedContractHandle(handle, consumer) {
|
|
137
|
+
const deferred = consumedContractDeferreds.get(handle);
|
|
138
|
+
if (!deferred) {
|
|
139
|
+
throw new Error("Unknown consumed-contract handle");
|
|
140
|
+
}
|
|
141
|
+
if (deferred.settled) {
|
|
142
|
+
throw new Error("Consumed-contract handle has already been settled");
|
|
143
|
+
}
|
|
144
|
+
deferred.settled = true;
|
|
145
|
+
deferred.resolve(consumer);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Reject a consumed-contract handle (e.g. required dependency missing).
|
|
149
|
+
* One-shot — throws if already settled.
|
|
150
|
+
*
|
|
151
|
+
* @internal Used by the package-loader when settling `consumes` handles.
|
|
152
|
+
*/
|
|
153
|
+
function rejectConsumedContractHandle(handle, reason) {
|
|
154
|
+
const deferred = consumedContractDeferreds.get(handle);
|
|
155
|
+
if (!deferred) {
|
|
156
|
+
throw new Error("Unknown consumed-contract handle");
|
|
157
|
+
}
|
|
158
|
+
if (deferred.settled) {
|
|
159
|
+
throw new Error("Consumed-contract handle has already been settled");
|
|
160
|
+
}
|
|
161
|
+
deferred.settled = true;
|
|
162
|
+
deferred.reject(reason);
|
|
163
|
+
}
|
|
106
164
|
/**
|
|
107
165
|
* Top-level builder passed to the `definePackage` callback.
|
|
108
166
|
*
|
|
@@ -165,14 +223,30 @@ class PackageBuilder {
|
|
|
165
223
|
this._contracts.push(builder);
|
|
166
224
|
return builder;
|
|
167
225
|
}
|
|
168
|
-
|
|
169
|
-
* Declare a dependency on another package's contract.
|
|
170
|
-
*/
|
|
171
|
-
consumes(contractId, version) {
|
|
226
|
+
consumes(contractId, version, opts) {
|
|
172
227
|
if (!(0, utils_1.isid)(contractId)) {
|
|
173
228
|
throw new Error(`consumes contractId must be a valid peer ID (25-char alphanumeric), got "${contractId}"`);
|
|
174
229
|
}
|
|
175
|
-
|
|
230
|
+
if (version < 1 || !Number.isInteger(version)) {
|
|
231
|
+
throw new Error(`consumes version must be a positive integer, got ${version}`);
|
|
232
|
+
}
|
|
233
|
+
if (opts?.providerPackageIds) {
|
|
234
|
+
for (const providerPackageId of opts.providerPackageIds) {
|
|
235
|
+
if (!(0, utils_1.isid)(providerPackageId)) {
|
|
236
|
+
throw new Error(`consumes providerPackageIds entries must be valid peer IDs (25-char alphanumeric), got "${providerPackageId}"`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
const handle = createConsumedContractHandle();
|
|
241
|
+
this._consumes.push({
|
|
242
|
+
contractId,
|
|
243
|
+
version,
|
|
244
|
+
optional: opts?.optional,
|
|
245
|
+
providerPackageIds: opts?.providerPackageIds ? [...opts.providerPackageIds] : undefined,
|
|
246
|
+
fallbackToDefaultProvider: opts?.fallbackToDefaultProvider,
|
|
247
|
+
handle,
|
|
248
|
+
});
|
|
249
|
+
return handle;
|
|
176
250
|
}
|
|
177
251
|
/** @internal Finalize and return the package definition result. */
|
|
178
252
|
_build() {
|
|
@@ -89,8 +89,9 @@ export interface IContractNotification {
|
|
|
89
89
|
* subscribable that rides the notify channel like a generic event (subscription-gated).
|
|
90
90
|
*
|
|
91
91
|
* Declared as an intersection so `dataChanged` type-checks as a subscribable while
|
|
92
|
-
* `.list(...)`, `.save(...)`, etc. still type-check as async methods.
|
|
93
|
-
*
|
|
92
|
+
* `.list(...)`, `.save(...)`, etc. still type-check as async methods. Prefer
|
|
93
|
+
* {@link ITableProxy} when declaring typed contract consumers — this open form does
|
|
94
|
+
* not contribute named IntelliSense for table methods.
|
|
94
95
|
*/
|
|
95
96
|
export type IContractTableProxy = Record<string, (...args: any[]) => Promise<any>> & {
|
|
96
97
|
/**
|
|
@@ -102,14 +103,68 @@ export type IContractTableProxy = Record<string, (...args: any[]) => Promise<any
|
|
|
102
103
|
subscribe(handler: (event: any) => void): ISubscriptionResult;
|
|
103
104
|
};
|
|
104
105
|
};
|
|
106
|
+
/** Standard {@link Table} methods the contract provider allows over the wire. */
|
|
107
|
+
type StandardRemoteTableMethodName = "get" | "list" | "count" | "findOne" | "save" | "insert" | "update" | "delete";
|
|
108
|
+
/**
|
|
109
|
+
* Payload type of `TTable.dataChanged.subscribe` when the table exposes one.
|
|
110
|
+
*/
|
|
111
|
+
type TableDataChangedPayload<TTable> = TTable extends {
|
|
112
|
+
dataChanged: {
|
|
113
|
+
subscribe: (handler: (event: infer E) => any, ...args: any[]) => any;
|
|
114
|
+
};
|
|
115
|
+
} ? E : unknown;
|
|
116
|
+
/**
|
|
117
|
+
* Consumer-side view of a real table class over a contract proxy.
|
|
118
|
+
*
|
|
119
|
+
* Picks the remotely callable standard {@link Table} methods (and optional extras such
|
|
120
|
+
* as `@ProxyClientTableMethodCalls` methods) with their real signatures, plus a
|
|
121
|
+
* `dataChanged` subscribe surface. Does **not** claim to be a literal {@link Table}
|
|
122
|
+
* instance — non-remote members (`dataSource`, `metaData`, `cursor`, …) are omitted.
|
|
123
|
+
*
|
|
124
|
+
* No open string index signature, so IntelliSense lists the actual method names.
|
|
125
|
+
*
|
|
126
|
+
* @typeParam TTable - Concrete table class (e.g. `ConsoleLogsTable`).
|
|
127
|
+
* @typeParam TExtraMethods - Additional remotely callable method names on `TTable`.
|
|
128
|
+
*/
|
|
129
|
+
export type ITableProxy<TTable, TExtraMethods extends keyof TTable = never> = Pick<TTable, Extract<keyof TTable, StandardRemoteTableMethodName> | TExtraMethods> & {
|
|
130
|
+
/**
|
|
131
|
+
* Subscribe to the provider table's `dataChanged` event over the transport.
|
|
132
|
+
* Same subscribe shape as a local table, without Event helpers like `next` / `union`.
|
|
133
|
+
*/
|
|
134
|
+
dataChanged: {
|
|
135
|
+
subscribe(handler: (event: TableDataChangedPayload<TTable>) => void): ISubscriptionResult;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Minimal contract-consumer identity shared by typed consumers and the open
|
|
140
|
+
* {@link IContractConsumer} runtime shape. Typed consumers may omit empty
|
|
141
|
+
* `tools` / `events` / `observables` bags.
|
|
142
|
+
*/
|
|
143
|
+
export interface IContractConsumerBase {
|
|
144
|
+
contractId: string;
|
|
145
|
+
version: number;
|
|
146
|
+
/**
|
|
147
|
+
* Resolves once every observable's initial snapshot has loaded (so reads are meaningful),
|
|
148
|
+
* then is re-chained on each local observable write so `await consumer.loadingPromise`
|
|
149
|
+
* also awaits write durability. Always resolves (never rejects).
|
|
150
|
+
*/
|
|
151
|
+
loadingPromise: Promise<void>;
|
|
152
|
+
/**
|
|
153
|
+
* Idempotently detach everything this consumer opened. New remote calls and
|
|
154
|
+
* subscriptions reject after disposal.
|
|
155
|
+
*/
|
|
156
|
+
dispose(): void;
|
|
157
|
+
}
|
|
105
158
|
/**
|
|
106
159
|
* A live proxy over a contract, handed to a **consumer**. Every member access is
|
|
107
160
|
* turned into an {@link IContractCall} and dispatched through the transport, so the
|
|
108
161
|
* consumer interacts with the contract identically no matter where the provider runs.
|
|
162
|
+
*
|
|
163
|
+
* This is the open runtime shape from {@link createContractConsumer}. Prefer a
|
|
164
|
+
* hand-maintained (or later generated) typed consumer that extends
|
|
165
|
+
* {@link IContractConsumerBase} and lists only the members that contract exposes.
|
|
109
166
|
*/
|
|
110
|
-
export interface IContractConsumer {
|
|
111
|
-
contractId: string;
|
|
112
|
-
version: number;
|
|
167
|
+
export interface IContractConsumer extends IContractConsumerBase {
|
|
113
168
|
/**
|
|
114
169
|
* `tables[name].<method>(...args)` → the remote table method's result, or
|
|
115
170
|
* `tables[name].dataChanged.subscribe(handler)` → a subscription to the remote table's
|
|
@@ -139,22 +194,6 @@ export interface IContractConsumer {
|
|
|
139
194
|
events: Record<string, {
|
|
140
195
|
subscribe: (handler: (value: any) => void) => ISubscriptionResult;
|
|
141
196
|
}>;
|
|
142
|
-
/**
|
|
143
|
-
* Resolves once every observable's initial snapshot has loaded (so reads are meaningful),
|
|
144
|
-
* then is re-chained on each local observable write so `await consumer.loadingPromise`
|
|
145
|
-
* also awaits write durability. Mirrors the persistent-var `loadingPromise` pattern
|
|
146
|
-
* ([`persistent-vars.ts`](../data/persistent-vars.ts)). Always resolves (never rejects);
|
|
147
|
-
* a failed writable set is logged once and leaves the optimistic mirror in place until
|
|
148
|
-
* the next provider push reconciles it.
|
|
149
|
-
*/
|
|
150
|
-
loadingPromise: Promise<void>;
|
|
151
|
-
/**
|
|
152
|
-
* Idempotently detach everything this consumer opened: generic events, table events,
|
|
153
|
-
* always-on observable streams, observable write observers, and its notify listener.
|
|
154
|
-
* New remote table/tool calls and subscriptions reject after disposal; cached observable
|
|
155
|
-
* reads remain available, but observable writes throw.
|
|
156
|
-
*/
|
|
157
|
-
dispose(): void;
|
|
158
197
|
}
|
|
159
198
|
/**
|
|
160
199
|
* Build the **consumer** side of a contract proxy from a contract definition and a
|
|
@@ -331,3 +370,4 @@ export declare function createContractProviderEndpoint(resolution: IContractReso
|
|
|
331
370
|
* @param opts Optional permission gate and default caller context.
|
|
332
371
|
*/
|
|
333
372
|
export declare function createContractProviderSession(resolution: IContractResolution, transport: IContractTransport, opts?: IContractProviderSessionOptions): IContractProviderSession;
|
|
373
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type IContractConsumer, type IContractResolution } from "./contract-proxy";
|
|
2
|
+
import type { IContractDefinition } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Build a same-process contract consumer wired to a live provider resolution.
|
|
5
|
+
*
|
|
6
|
+
* Creates an {@link inProcessTransportPair}, attaches a provider session on one
|
|
7
|
+
* end and a consumer proxy on the other. Intended for package-loader settlement
|
|
8
|
+
* of `consumes` handles when the provider runs in the same process.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createLocalContractConsumer(definition: IContractDefinition, resolution: IContractResolution, opts?: {
|
|
11
|
+
dataContextId?: string;
|
|
12
|
+
}): IContractConsumer;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLocalContractConsumer = createLocalContractConsumer;
|
|
4
|
+
const contract_proxy_1 = require("./contract-proxy");
|
|
5
|
+
const contract_transport_1 = require("./contract-transport");
|
|
6
|
+
/**
|
|
7
|
+
* Build a same-process contract consumer wired to a live provider resolution.
|
|
8
|
+
*
|
|
9
|
+
* Creates an {@link inProcessTransportPair}, attaches a provider session on one
|
|
10
|
+
* end and a consumer proxy on the other. Intended for package-loader settlement
|
|
11
|
+
* of `consumes` handles when the provider runs in the same process.
|
|
12
|
+
*/
|
|
13
|
+
function createLocalContractConsumer(definition, resolution, opts) {
|
|
14
|
+
const [consumerTransport, providerTransport] = (0, contract_transport_1.inProcessTransportPair)();
|
|
15
|
+
(0, contract_proxy_1.createContractProviderSession)(resolution, providerTransport);
|
|
16
|
+
return (0, contract_proxy_1.createContractConsumer)(definition, consumerTransport, {
|
|
17
|
+
dataContextId: opts?.dataContextId,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
export { ContractBuilder, definePackage, PackageBuilder } from "./builder";
|
|
2
2
|
export { type ContractCallAuthorizer, type ContractProviderEndpointResolver, createContractProviderRouter, type IAuthorizedContractRoute, type IContractProviderEndpointRequest, type IContractProviderRouter, type IContractProviderRouterOptions, } from "./contract-provider-router";
|
|
3
3
|
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, type IContractCall, type IContractCallContext, type IContractConsumer, type IContractNotification, type IContractProviderEndpoint, type IContractProviderEndpointOptions, type IContractProviderSession, type IContractProviderSessionOptions, type IContractResolution, sameUserContractPermissionCheck, } from "./contract-proxy";
|
|
4
|
+
export { CONTRACT_CALL_RPC, type ContractMemberType, type ContractNotificationSink, type ContractPermissionCheck, createContractConsumer, createContractProvider, createContractProviderEndpoint, createContractProviderSession, type IContractCall, type IContractCallContext, type IContractConsumer, type IContractConsumerBase, type IContractNotification, type IContractProviderEndpoint, type IContractProviderEndpointOptions, type IContractProviderSession, type IContractProviderSessionOptions, type IContractResolution, type IContractTableProxy, type ITableProxy, sameUserContractPermissionCheck, } from "./contract-proxy";
|
|
5
5
|
export { type ContractRemoteIdentity, type ContractResolver, createUserContextContractProviderRouter, getContractResolver, handleContractCall, isSelfTrustedContractCaller, registerContractResolver, } from "./contract-resolvers";
|
|
6
6
|
export { CONTRACT_NOTIFY_CHANNEL, CONTRACT_REQUEST_CHANNEL, connectionContractTransport, type IContractTransport, type IDuplexEmitter, inProcessTransportPair, } from "./contract-transport";
|
|
7
7
|
export { Contracts, ContractsTable, contractsMetaData, contractsSchema, type IContractRecord, } from "./contracts.table";
|
|
8
|
+
export { createLocalContractConsumer } from "./create-local-consumer";
|
|
8
9
|
export { extractTableShape, extractToolShape, type IExtractableTableDef, type IExtractableToolInstance, setSchemaToFieldsFn, } from "./extract";
|
|
9
10
|
export { PersistentContractRegistry } from "./persistent-registry";
|
|
10
11
|
export { ContractRegistry } from "./registry";
|
|
11
12
|
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";
|
|
12
|
-
export { getLogsContractDefinition, LOGS_CONTRACT_VERSION, resolveLogsContract, } from "./system/logs-contract";
|
|
13
|
-
export
|
|
13
|
+
export { getLogsContractDefinition, type ILogsConsumer, LOGS_CONTRACT_VERSION, resolveLogsContract, } from "./system/logs-contract";
|
|
14
|
+
export { type ISystemContractRegistration, installSystemContracts, listSystemContracts, registerSystemContract, } from "./system-contracts";
|
|
15
|
+
export type { IAlsoImplementsDeclaration, IConsumedContract, IConsumedContractHandle, IConsumedContractOptions, IContractDefinition, IContractEvent, IContractObservable, IContractTable, IContractTool, IPackageDefinitionResult, IResolvedContract, IValidationError, IValidationResult, } from "./types";
|
|
14
16
|
export { contractKey } from "./types";
|
|
15
17
|
export { validateAlsoImplements, validateImmutability, validateProviderSatisfiesContract, } from "./validate";
|
package/dist/contracts/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.validateImmutability = exports.validateAlsoImplements = exports.contractKey = exports.registerSystemContract = exports.listSystemContracts = exports.installSystemContracts = exports.resolveLogsContract = exports.LOGS_CONTRACT_VERSION = exports.getLogsContractDefinition = 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.ContractRegistry = exports.PersistentContractRegistry = 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.registerContractResolver = exports.isSelfTrustedContractCaller = exports.handleContractCall = exports.getContractResolver = exports.createUserContextContractProviderRouter = exports.sameUserContractPermissionCheck = exports.createContractProviderSession = exports.createContractProviderEndpoint = exports.createContractProvider = exports.createContractConsumer = exports.CONTRACT_CALL_RPC = exports.contractProvidersSchema = exports.contractProvidersMetaData = exports.ContractProvidersTable = exports.ContractProviders = exports.createContractProviderRouter = exports.PackageBuilder = exports.definePackage = exports.ContractBuilder = void 0;
|
|
4
|
+
exports.validateProviderSatisfiesContract = void 0;
|
|
4
5
|
var builder_1 = require("./builder");
|
|
5
6
|
Object.defineProperty(exports, "ContractBuilder", { enumerable: true, get: function () { return builder_1.ContractBuilder; } });
|
|
6
7
|
Object.defineProperty(exports, "definePackage", { enumerable: true, get: function () { return builder_1.definePackage; } });
|
|
@@ -35,6 +36,8 @@ Object.defineProperty(exports, "Contracts", { enumerable: true, get: function ()
|
|
|
35
36
|
Object.defineProperty(exports, "ContractsTable", { enumerable: true, get: function () { return contracts_table_1.ContractsTable; } });
|
|
36
37
|
Object.defineProperty(exports, "contractsMetaData", { enumerable: true, get: function () { return contracts_table_1.contractsMetaData; } });
|
|
37
38
|
Object.defineProperty(exports, "contractsSchema", { enumerable: true, get: function () { return contracts_table_1.contractsSchema; } });
|
|
39
|
+
var create_local_consumer_1 = require("./create-local-consumer");
|
|
40
|
+
Object.defineProperty(exports, "createLocalContractConsumer", { enumerable: true, get: function () { return create_local_consumer_1.createLocalContractConsumer; } });
|
|
38
41
|
var extract_1 = require("./extract");
|
|
39
42
|
Object.defineProperty(exports, "extractTableShape", { enumerable: true, get: function () { return extract_1.extractTableShape; } });
|
|
40
43
|
Object.defineProperty(exports, "extractToolShape", { enumerable: true, get: function () { return extract_1.extractToolShape; } });
|
|
@@ -56,6 +59,10 @@ var logs_contract_1 = require("./system/logs-contract");
|
|
|
56
59
|
Object.defineProperty(exports, "getLogsContractDefinition", { enumerable: true, get: function () { return logs_contract_1.getLogsContractDefinition; } });
|
|
57
60
|
Object.defineProperty(exports, "LOGS_CONTRACT_VERSION", { enumerable: true, get: function () { return logs_contract_1.LOGS_CONTRACT_VERSION; } });
|
|
58
61
|
Object.defineProperty(exports, "resolveLogsContract", { enumerable: true, get: function () { return logs_contract_1.resolveLogsContract; } });
|
|
62
|
+
var system_contracts_1 = require("./system-contracts");
|
|
63
|
+
Object.defineProperty(exports, "installSystemContracts", { enumerable: true, get: function () { return system_contracts_1.installSystemContracts; } });
|
|
64
|
+
Object.defineProperty(exports, "listSystemContracts", { enumerable: true, get: function () { return system_contracts_1.listSystemContracts; } });
|
|
65
|
+
Object.defineProperty(exports, "registerSystemContract", { enumerable: true, get: function () { return system_contracts_1.registerSystemContract; } });
|
|
59
66
|
var types_1 = require("./types");
|
|
60
67
|
Object.defineProperty(exports, "contractKey", { enumerable: true, get: function () { return types_1.contractKey; } });
|
|
61
68
|
var validate_1 = require("./validate");
|
|
@@ -39,6 +39,23 @@ export declare class ContractRegistry {
|
|
|
39
39
|
resolve(contractId: string, version: number): IContractDefinition | undefined;
|
|
40
40
|
/** Get the active provider's package ID for a contract. */
|
|
41
41
|
getProviderPackageId(contractId: string, version: number): string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Package IDs registered as providers for a contract version (registration order).
|
|
44
|
+
* Includes inactive providers.
|
|
45
|
+
*/
|
|
46
|
+
getRegisteredProviderIds(contractId: string, version: number): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Pick a provider for a consumed-contract declaration.
|
|
49
|
+
*
|
|
50
|
+
* - No `providerPackageIds` → active provider
|
|
51
|
+
* - With `providerPackageIds` → first listed id that is registered
|
|
52
|
+
* - If none match and `fallbackToDefaultProvider === true` → active provider
|
|
53
|
+
* - Otherwise → `undefined` (missing)
|
|
54
|
+
*/
|
|
55
|
+
selectProvider(dep: IConsumedContract): {
|
|
56
|
+
providerPackageId: string;
|
|
57
|
+
definition: IContractDefinition;
|
|
58
|
+
} | undefined;
|
|
42
59
|
/** Get the stored contract definition (regardless of active provider). */
|
|
43
60
|
getDefinition(contractId: string, version: number): IContractDefinition | undefined;
|
|
44
61
|
/** Replace the stored definition for a contract (e.g. to freeze a dev contract). */
|
|
@@ -98,6 +98,42 @@ class ContractRegistry {
|
|
|
98
98
|
const key = (0, types_1.contractKey)(contractId, version);
|
|
99
99
|
return this.activeProviders.get(key)?.providerPackageId;
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Package IDs registered as providers for a contract version (registration order).
|
|
103
|
+
* Includes inactive providers.
|
|
104
|
+
*/
|
|
105
|
+
getRegisteredProviderIds(contractId, version) {
|
|
106
|
+
const key = (0, types_1.contractKey)(contractId, version);
|
|
107
|
+
return (this.allProviders.get(key) ?? []).map((p) => p.providerPackageId);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Pick a provider for a consumed-contract declaration.
|
|
111
|
+
*
|
|
112
|
+
* - No `providerPackageIds` → active provider
|
|
113
|
+
* - With `providerPackageIds` → first listed id that is registered
|
|
114
|
+
* - If none match and `fallbackToDefaultProvider === true` → active provider
|
|
115
|
+
* - Otherwise → `undefined` (missing)
|
|
116
|
+
*/
|
|
117
|
+
selectProvider(dep) {
|
|
118
|
+
const key = (0, types_1.contractKey)(dep.contractId, dep.version);
|
|
119
|
+
const providers = this.allProviders.get(key) ?? [];
|
|
120
|
+
const active = this.activeProviders.get(key);
|
|
121
|
+
if (!dep.providerPackageIds || dep.providerPackageIds.length === 0) {
|
|
122
|
+
return active
|
|
123
|
+
? { providerPackageId: active.providerPackageId, definition: active.definition }
|
|
124
|
+
: undefined;
|
|
125
|
+
}
|
|
126
|
+
for (const preferredId of dep.providerPackageIds) {
|
|
127
|
+
const match = providers.find((p) => p.providerPackageId === preferredId);
|
|
128
|
+
if (match) {
|
|
129
|
+
return { providerPackageId: match.providerPackageId, definition: match.definition };
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (dep.fallbackToDefaultProvider === true && active) {
|
|
133
|
+
return { providerPackageId: active.providerPackageId, definition: active.definition };
|
|
134
|
+
}
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
101
137
|
/** Get the stored contract definition (regardless of active provider). */
|
|
102
138
|
getDefinition(contractId, version) {
|
|
103
139
|
return this.definitions.get((0, types_1.contractKey)(contractId, version));
|
|
@@ -4,6 +4,7 @@ exports.deviceOperationsProviderPackageId = exports.deviceOperationsToolIds = ex
|
|
|
4
4
|
exports.getDeviceOperationsContractDefinition = getDeviceOperationsContractDefinition;
|
|
5
5
|
const system_ids_1 = require("../../system-ids");
|
|
6
6
|
const field_type_1 = require("../../types/field-type");
|
|
7
|
+
const system_contracts_1 = require("../system-contracts");
|
|
7
8
|
/** Version of the built-in System Device Operations contract. */
|
|
8
9
|
exports.DEVICE_OPERATIONS_CONTRACT_VERSION = 1;
|
|
9
10
|
/** Maximum SQL text accepted by the remote database operation. */
|
|
@@ -108,3 +109,9 @@ function getDeviceOperationsContractDefinition() {
|
|
|
108
109
|
}
|
|
109
110
|
/** Package ID used by live System Device Operations tool instances. */
|
|
110
111
|
exports.deviceOperationsProviderPackageId = system_ids_1.peersSystemPackageId;
|
|
112
|
+
(0, system_contracts_1.registerSystemContract)({
|
|
113
|
+
providerPackageId: system_ids_1.peersSystemPackageId,
|
|
114
|
+
contractId: system_ids_1.deviceOperationsContractId,
|
|
115
|
+
version: exports.DEVICE_OPERATIONS_CONTRACT_VERSION,
|
|
116
|
+
getDefinition: getDeviceOperationsContractDefinition,
|
|
117
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in system contracts. Importing this barrel runs each module's
|
|
3
|
+
* {@link registerSystemContract} side effect so the catalog is populated.
|
|
4
|
+
*/
|
|
5
|
+
import "./device-operations-contract";
|
|
6
|
+
import "./logs-contract";
|
|
7
|
+
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 "./device-operations-contract";
|
|
8
|
+
export { getLogsContractDefinition, type ILogsConsumer, LOGS_CONTRACT_VERSION, resolveLogsContract, } from "./logs-contract";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveLogsContract = exports.LOGS_CONTRACT_VERSION = exports.getLogsContractDefinition = 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 = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Built-in system contracts. Importing this barrel runs each module's
|
|
6
|
+
* {@link registerSystemContract} side effect so the catalog is populated.
|
|
7
|
+
*/
|
|
8
|
+
require("./device-operations-contract");
|
|
9
|
+
require("./logs-contract");
|
|
10
|
+
var device_operations_contract_1 = require("./device-operations-contract");
|
|
11
|
+
Object.defineProperty(exports, "DEVICE_OPERATIONS_CONTRACT_VERSION", { enumerable: true, get: function () { return device_operations_contract_1.DEVICE_OPERATIONS_CONTRACT_VERSION; } });
|
|
12
|
+
Object.defineProperty(exports, "DEVICE_OPERATIONS_MAX_QUERY_LENGTH", { enumerable: true, get: function () { return device_operations_contract_1.DEVICE_OPERATIONS_MAX_QUERY_LENGTH; } });
|
|
13
|
+
Object.defineProperty(exports, "DEVICE_OPERATIONS_MAX_RESULT_BYTES", { enumerable: true, get: function () { return device_operations_contract_1.DEVICE_OPERATIONS_MAX_RESULT_BYTES; } });
|
|
14
|
+
Object.defineProperty(exports, "DEVICE_OPERATIONS_MAX_ROWS", { enumerable: true, get: function () { return device_operations_contract_1.DEVICE_OPERATIONS_MAX_ROWS; } });
|
|
15
|
+
Object.defineProperty(exports, "DEVICE_OPERATIONS_MAX_TOOLS", { enumerable: true, get: function () { return device_operations_contract_1.DEVICE_OPERATIONS_MAX_TOOLS; } });
|
|
16
|
+
Object.defineProperty(exports, "deviceOperationsProviderPackageId", { enumerable: true, get: function () { return device_operations_contract_1.deviceOperationsProviderPackageId; } });
|
|
17
|
+
Object.defineProperty(exports, "deviceOperationsToolIds", { enumerable: true, get: function () { return device_operations_contract_1.deviceOperationsToolIds; } });
|
|
18
|
+
Object.defineProperty(exports, "getDeviceOperationsContractDefinition", { enumerable: true, get: function () { return device_operations_contract_1.getDeviceOperationsContractDefinition; } });
|
|
19
|
+
var logs_contract_1 = require("./logs-contract");
|
|
20
|
+
Object.defineProperty(exports, "getLogsContractDefinition", { enumerable: true, get: function () { return logs_contract_1.getLogsContractDefinition; } });
|
|
21
|
+
Object.defineProperty(exports, "LOGS_CONTRACT_VERSION", { enumerable: true, get: function () { return logs_contract_1.LOGS_CONTRACT_VERSION; } });
|
|
22
|
+
Object.defineProperty(exports, "resolveLogsContract", { enumerable: true, get: function () { return logs_contract_1.resolveLogsContract; } });
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
import type { DataContext } from "../../context/data-context";
|
|
2
|
-
import
|
|
2
|
+
import { ConsoleLogsTable } from "../../logging/console-logs.table";
|
|
3
|
+
import type { IContractConsumerBase, IContractResolution, ITableProxy } from "../contract-proxy";
|
|
3
4
|
import type { IContractDefinition } from "../types";
|
|
4
5
|
/** Version of the built-in System Logs contract. */
|
|
5
6
|
export declare const LOGS_CONTRACT_VERSION = 1;
|
|
7
|
+
/**
|
|
8
|
+
* Consumer-side TypeScript shape for the System Logs contract.
|
|
9
|
+
*
|
|
10
|
+
* Hand-maintained for now so packages can narrow `pkg.consumes(...)` (e.g.
|
|
11
|
+
* `pkg.consumes<ILogsConsumer>(logsContractId, 1)`). Expect this to be
|
|
12
|
+
* replaced by types generated from package/contract definitions.
|
|
13
|
+
*
|
|
14
|
+
* Omits empty `tools` / `events` / `observables` bags. `ConsoleLogs` is an
|
|
15
|
+
* {@link ITableProxy} of the remotely callable table surface — not a literal
|
|
16
|
+
* {@link ConsoleLogsTable} instance.
|
|
17
|
+
*/
|
|
18
|
+
export interface ILogsConsumer extends IContractConsumerBase {
|
|
19
|
+
tables: {
|
|
20
|
+
ConsoleLogs: ITableProxy<ConsoleLogsTable, "deleteOldLogs">;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
6
23
|
/**
|
|
7
24
|
* The first built-in **system contract**: read and write the local device's console logs.
|
|
8
25
|
*
|
|
@@ -7,7 +7,7 @@ const user_context_singleton_1 = require("../../context/user-context-singleton")
|
|
|
7
7
|
const types_1 = require("../../data/orm/types");
|
|
8
8
|
const console_logs_table_1 = require("../../logging/console-logs.table");
|
|
9
9
|
const system_ids_1 = require("../../system-ids");
|
|
10
|
-
const
|
|
10
|
+
const system_contracts_1 = require("../system-contracts");
|
|
11
11
|
/** Version of the built-in System Logs contract. */
|
|
12
12
|
exports.LOGS_CONTRACT_VERSION = 1;
|
|
13
13
|
let _definition;
|
|
@@ -57,4 +57,10 @@ function resolveLogsContract(ctx) {
|
|
|
57
57
|
tables: { [console_logs_table_1.consoleLogsMetaData.name]: consoleLogs },
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
(0,
|
|
60
|
+
(0, system_contracts_1.registerSystemContract)({
|
|
61
|
+
providerPackageId: system_ids_1.peersSystemPackageId,
|
|
62
|
+
contractId: system_ids_1.logsContractId,
|
|
63
|
+
version: exports.LOGS_CONTRACT_VERSION,
|
|
64
|
+
getDefinition: getLogsContractDefinition,
|
|
65
|
+
resolve: resolveLogsContract,
|
|
66
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ContractResolver } from "./contract-resolvers";
|
|
2
|
+
import type { ContractRegistry } from "./registry";
|
|
3
|
+
import type { IContractDefinition } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* A built-in system contract that should appear in every data context's
|
|
6
|
+
* {@link ContractRegistry} without being installed as a user package.
|
|
7
|
+
*/
|
|
8
|
+
export interface ISystemContractRegistration {
|
|
9
|
+
/** Synthetic provider package id (typically `peersSystemPackageId`). */
|
|
10
|
+
providerPackageId: string;
|
|
11
|
+
/**
|
|
12
|
+
* Lazy definition builder. Kept lazy so contracts like Logs can defer schema
|
|
13
|
+
* access until after module initialization completes.
|
|
14
|
+
*/
|
|
15
|
+
getDefinition: () => IContractDefinition;
|
|
16
|
+
/**
|
|
17
|
+
* Optional live resolver for contract calls. When provided, `contractId` and
|
|
18
|
+
* `version` must also be set so the resolver can be keyed without building
|
|
19
|
+
* the definition at registration time.
|
|
20
|
+
*/
|
|
21
|
+
resolve?: ContractResolver;
|
|
22
|
+
/** Required when {@link resolve} is set — resolver map key without calling `getDefinition`. */
|
|
23
|
+
contractId?: string;
|
|
24
|
+
/** Required when {@link resolve} is set. */
|
|
25
|
+
version?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Self-register a built-in system contract.
|
|
29
|
+
*
|
|
30
|
+
* Call once from the contract module (side effect at import). Later
|
|
31
|
+
* {@link installSystemContracts} installs every registered entry into a
|
|
32
|
+
* concrete registry. New system contracts only need this one call.
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerSystemContract(registration: ISystemContractRegistration): void;
|
|
35
|
+
/**
|
|
36
|
+
* Register every known system contract into `registry` as a provider.
|
|
37
|
+
* Safe to call more than once for the same registry (provider updates in place).
|
|
38
|
+
*/
|
|
39
|
+
export declare function installSystemContracts(registry: ContractRegistry): void;
|
|
40
|
+
/** Snapshot of registered system contracts (for tests and diagnostics). */
|
|
41
|
+
export declare function listSystemContracts(): readonly ISystemContractRegistration[];
|
|
42
|
+
/**
|
|
43
|
+
* Clear the system-contract catalog. Test-only — production code must not call this.
|
|
44
|
+
*
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare function _clearSystemContractsForTests(): void;
|