@camstack/system 1.2.443 → 1.2.445
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/assets/record-entries/icon.svg +8 -0
- package/dist/addon-runner.js +81 -42
- package/dist/addon-runner.mjs +82 -43
- package/dist/{agent-https-DlpTMDqA.js → agent-https-CiOW0-sj.js} +810 -12
- package/dist/{agent-https-U0d4uvn2.mjs → agent-https-D4Q8iFNd.mjs} +697 -13
- package/dist/auth/admin-token-manager.d.ts +9 -3
- package/dist/auth/api-key-manager.d.ts +9 -3
- package/dist/auth/auth-audit-log.d.ts +9 -3
- package/dist/auth/device-credential-manager.d.ts +5 -1
- package/dist/auth/external-identity-manager.d.ts +8 -21
- package/dist/auth/login-session-manager.d.ts +11 -3
- package/dist/auth/scoped-token-manager.d.ts +8 -52
- package/dist/auth/totp-manager.d.ts +11 -3
- package/dist/auth/user-manager.d.ts +10 -17
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alert-store.d.ts +32 -0
- package/dist/builtins/alerts/alerts.addon.d.ts +19 -4
- package/dist/builtins/alerts/alerts.addon.js +331 -159
- package/dist/builtins/alerts/alerts.addon.mjs +330 -159
- package/dist/builtins/alerts/record-kinds.d.ts +15 -0
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +1 -0
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +134 -193
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +134 -193
- package/dist/builtins/backup-orchestrator/destination-policy.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/encryption-key-store.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/record-kinds.d.ts +58 -0
- package/dist/builtins/backup-orchestrator/schedule-store.d.ts +4 -2
- package/dist/builtins/backup-orchestrator/seed-marker-store.d.ts +4 -2
- package/dist/builtins/calendars/calendar-prefs-store.d.ts +13 -5
- package/dist/builtins/calendars/calendars.addon.d.ts +2 -2
- package/dist/builtins/calendars/calendars.addon.js +67 -64
- package/dist/builtins/calendars/calendars.addon.mjs +59 -64
- package/dist/builtins/calendars/record-kinds.d.ts +18 -0
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/cluster-agent/record-kinds.d.ts +36 -0
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/block-settings-store.d.ts +8 -4
- package/dist/builtins/core-blocks/core-block-store.d.ts +8 -16
- package/dist/builtins/core-blocks/core-blocks.addon.js +85 -112
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +86 -113
- package/dist/builtins/core-blocks/index.mjs +1 -1
- package/dist/builtins/core-blocks/record-kinds.d.ts +26 -0
- package/dist/builtins/device-manager/device-manager.addon.js +111 -187
- package/dist/builtins/device-manager/device-manager.addon.mjs +110 -187
- package/dist/builtins/device-manager/device-tombstone-store.d.ts +9 -48
- package/dist/builtins/device-manager/record-kinds.d.ts +14 -0
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +152 -22
- package/dist/builtins/keychain/index.mjs +152 -22
- package/dist/builtins/keychain/keychain-service.d.ts +3 -2
- package/dist/builtins/keychain/keychain-store.d.ts +13 -2
- package/dist/builtins/keychain/record-kinds.d.ts +16 -0
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +3 -1
- package/dist/builtins/local-auth/local-auth.addon.js +2903 -2123
- package/dist/builtins/local-auth/local-auth.addon.mjs +2904 -2124
- package/dist/builtins/local-auth/oauth-session-manager.d.ts +8 -48
- package/dist/builtins/local-auth/record-kinds.d.ts +141 -0
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/record-entries/entries-service.d.ts +42 -0
- package/dist/builtins/record-entries/index.d.ts +1 -0
- package/dist/builtins/record-entries/index.js +142 -0
- package/dist/builtins/record-entries/index.mjs +136 -0
- package/dist/builtins/record-entries/record-entries.addon.d.ts +13 -0
- package/dist/builtins/records/legacy-table-row-count.d.ts +5 -0
- package/dist/builtins/records/phase6-declare-gate.d.ts +28 -0
- package/dist/builtins/records-isolated.d.ts +10 -0
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/file-host-client.d.ts +2 -0
- package/dist/builtins/sqlite-storage/file-host-handlers.d.ts +4 -0
- package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +7 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/integration-record-kinds.d.ts +30 -0
- package/dist/builtins/sqlite-storage/integration-registry.d.ts +10 -16
- package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +7 -0
- package/dist/builtins/sqlite-storage/placement-router.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/count-settings-array-legacy.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/count-settings-brokers-legacy.d.ts +6 -0
- package/dist/builtins/sqlite-storage/records/records-catalog.d.ts +29 -0
- package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +51 -0
- package/dist/builtins/sqlite-storage/records/records-engine.d.ts +94 -0
- package/dist/builtins/sqlite-storage/records/records-explain.d.ts +18 -0
- package/dist/builtins/sqlite-storage/records/records-plan.d.ts +90 -0
- package/dist/builtins/sqlite-storage/records/records-probe.d.ts +33 -0
- package/dist/builtins/sqlite-storage/records/records-provider.d.ts +63 -0
- package/dist/builtins/sqlite-storage/records/records-rows.d.ts +46 -0
- package/dist/builtins/sqlite-storage/records/records-sql.d.ts +41 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +17 -10
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +8 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +446 -5
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +446 -5
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +15 -1
- package/dist/builtins/storage-orchestrator/drain-state-store.d.ts +5 -2
- package/dist/builtins/storage-orchestrator/location-store.d.ts +7 -2
- package/dist/builtins/storage-orchestrator/record-kinds.d.ts +38 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +2 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +196 -5
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +195 -6
- package/dist/builtins/system-config/record-kinds.d.ts +32 -0
- package/dist/builtins/system-config/system-config.addon.js +53 -618
- package/dist/builtins/system-config/system-config.addon.mjs +29 -577
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-C8tUG2uL.mjs → composition-sources-BMt5cFYb.mjs} +1 -1
- package/dist/{composition-sources-BUXX1e8j.js → composition-sources-D3fi9Xns.js} +1 -1
- package/dist/{constants-CGwVaAV3.mjs → constants-BMHCxRzb.mjs} +1 -1
- package/dist/{constants-DWmm7_of.js → constants-Br879Axi.js} +1 -1
- package/dist/{device-ca-DGayRmC0.js → device-ca-CnJ_va7i.js} +1 -1
- package/dist/{device-ca-DBfiJ_SB.mjs → device-ca-T8osSMos.mjs} +1 -1
- package/dist/{dist-Bxt_S-9a.mjs → dist-BNunRyXT.mjs} +1133 -93
- package/dist/{dist-D9qT3jHr.js → dist-DgOG8flk.js} +1354 -92
- package/dist/file-host-worker.js +11 -1
- package/dist/file-host-worker.mjs +11 -1
- package/dist/{hub-mdns-ciao-B-wk9nzx.js → hub-mdns-ciao-BIkTHq-n.js} +2 -2
- package/dist/{hub-mdns-ciao-DpPcQDg-.mjs → hub-mdns-ciao-D16oRQ9K.mjs} +2 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3111 -2806
- package/dist/index.mjs +3083 -2795
- package/dist/kernel/index.d.ts +2 -0
- package/dist/kernel/moleculer/event-bus.d.ts +3 -1
- package/dist/kernel/moleculer/mesh-mtls/mesh-certificate-registry.d.ts +5 -1
- package/dist/kernel/moleculer/records-api-transport.d.ts +9 -0
- package/dist/kernel/moleculer/remote-logger.d.ts +2 -2
- package/dist/kernel/settings-view-types.d.ts +0 -7
- package/dist/kernel/transport/cap-route-resolver.d.ts +9 -38
- package/dist/phase6-declare-gate-Ci1-8uUn.js +98 -0
- package/dist/phase6-declare-gate-tkKOEitw.mjs +93 -0
- package/dist/read-all-rows-CVoO1ONM.js +29 -0
- package/dist/read-all-rows-TaPqdWNF.mjs +25 -0
- package/dist/records/read-all-rows.d.ts +6 -0
- package/dist/{restore-archive-9CGgeBzD.mjs → restore-archive-DR9MtO7J.mjs} +339 -9
- package/dist/{restore-archive-BMNXwWWD.js → restore-archive-DjJnCgap.js} +353 -5
- package/dist/tls/agent-https-names.d.ts +9 -13
- package/dist/{wal-maintenance-cRHR4rUY.js → wal-maintenance-CODGqhKY.js} +0 -0
- package/dist/{wal-maintenance-sIB32ONp.mjs → wal-maintenance-CfvgtQ7C.mjs} +0 -0
- package/package.json +22 -1
package/dist/kernel/index.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ export { createAddonService, validateProviderRegistrations } from "./moleculer/a
|
|
|
49
49
|
export { createCoreCapService, CORE_CAP_SERVICE_NAME } from "./moleculer/core-cap-service.js";
|
|
50
50
|
export type { CoreCapAction, CoreCapCallOrigin, CoreCapServiceOptions } from "./moleculer/core-cap-service.js";
|
|
51
51
|
export { createAddonContext, createUdsAddonContext, setHubConnected, adaptBrokerToCluster, registerEventBusService, setNodeEventInterest, getMoleculerEventStats, subscribePassthrough, getBrokerEventBus, clusterEventTopic, EVENT_TOPIC_PREFIX } from "./moleculer/addon-context-factory.js";
|
|
52
|
+
export { asBrokerLike } from "./moleculer/event-bus.js";
|
|
53
|
+
export type { BrokerLike } from "./moleculer/event-bus.js";
|
|
52
54
|
export type { MoleculerEventStats } from "./moleculer/addon-context-factory.js";
|
|
53
55
|
export { HubLogForwarder } from "./moleculer/hub-log-forwarder.js";
|
|
54
56
|
export type { AddonContextOptions } from "./moleculer/addon-context-factory.js";
|
|
@@ -4,7 +4,7 @@ import type { ServiceBroker } from "moleculer";
|
|
|
4
4
|
* Narrow interface for the Moleculer ServiceBroker surface used in this file.
|
|
5
5
|
* moleculer's index.d.ts chains through eventemitter2 whose package.json has
|
|
6
6
|
* no `types` field; typescript-eslint's no-unsafe-* rules flag every
|
|
7
|
-
* broker.X access
|
|
7
|
+
* broker.X access when eslint no-unsafe rules apply elsewhere.
|
|
8
8
|
*/
|
|
9
9
|
export interface BrokerLike {
|
|
10
10
|
readonly nodeID: string;
|
|
@@ -19,6 +19,8 @@ export interface BrokerLike {
|
|
|
19
19
|
warn?: (msg: string) => void;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
/** Documented boundary: CamStack brokers are always `createBroker` products. */
|
|
23
|
+
export declare function asBrokerLike(broker: ServiceBroker): BrokerLike;
|
|
22
24
|
/**
|
|
23
25
|
* Topic prefix for clustered EventBus broadcasts. The `camstack.evt.`
|
|
24
26
|
* namespace keeps our events disjoint from Moleculer internal events
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CollectionColumn, IScopedLogger, SettingsStoreClient } from "@camstack/types";
|
|
1
|
+
import type { CollectionColumn, IScopedLogger, RecordKindHandle, SettingsStoreClient } from "@camstack/types";
|
|
2
|
+
import type { MeshNodeCertificateBody } from "../../../builtins/system-config/record-kinds.js";
|
|
2
3
|
import type { MeshCrl } from "./mesh-crl.js";
|
|
3
4
|
/**
|
|
4
5
|
* @durable class=config owner=system-config
|
|
@@ -45,7 +46,9 @@ export declare class MeshCertificateRegistry {
|
|
|
45
46
|
constructor(store: SettingsStoreClient, deps?: {
|
|
46
47
|
readonly now?: () => number;
|
|
47
48
|
readonly logger?: IScopedLogger;
|
|
49
|
+
readonly meshKind?: RecordKindHandle<MeshNodeCertificateBody> | null;
|
|
48
50
|
});
|
|
51
|
+
private recordToBody;
|
|
49
52
|
private now;
|
|
50
53
|
load(): Promise<void>;
|
|
51
54
|
/** Write down a leaf the hub just issued. Idempotent per fingerprint. */
|
|
@@ -95,6 +98,7 @@ export declare class MeshCertificateRegistry {
|
|
|
95
98
|
isRevoked(serial: string): boolean;
|
|
96
99
|
reap(): Promise<number>;
|
|
97
100
|
private insert;
|
|
101
|
+
private deleteRow;
|
|
98
102
|
private persist;
|
|
99
103
|
}
|
|
100
104
|
export declare function setProcessMeshCertificateRegistry(registry: MeshCertificateRegistry | null): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wire of `ctx.records` for an addon that runs in a forked runner or on an
|
|
3
|
+
* agent (D881): every call is a cap call on `ctx.api.records`, and the parent
|
|
4
|
+
* (or, on an agent, the agent and then `$hub-cap-fwd`) STAMPS who is calling
|
|
5
|
+
* from the connection the call arrived on. The input carries no identity, so
|
|
6
|
+
* there is nothing here an addon could change to read another addon's kind.
|
|
7
|
+
*/
|
|
8
|
+
import type { AddonApi, RecordsTransport } from "@camstack/types";
|
|
9
|
+
export declare function recordsTransportOf(api: AddonApi): RecordsTransport;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ServiceBroker } from "moleculer";
|
|
2
2
|
import type { IScopedLogger, LogTags } from "@camstack/types";
|
|
3
|
-
import type
|
|
3
|
+
import { type BrokerLike } from "./event-bus.js";
|
|
4
4
|
/**
|
|
5
5
|
* Call after `broker.waitForServices('$hub')` to enable log forwarding.
|
|
6
6
|
*
|
|
@@ -17,7 +17,7 @@ declare function setHubConnected(broker?: ServiceBroker): void;
|
|
|
17
17
|
*/
|
|
18
18
|
declare function __resetHubConnectedForTests(): void;
|
|
19
19
|
export { __resetHubConnectedForTests };
|
|
20
|
-
declare function createRemoteLogger(broker:
|
|
20
|
+
declare function createRemoteLogger(broker: BrokerLike, addonId: string, scope?: string, tags?: LogTags): IScopedLogger;
|
|
21
21
|
export { createRemoteLogger };
|
|
22
22
|
/**
|
|
23
23
|
* Build a hub-forwarding logger for a forked-process runner (process-runner
|
|
@@ -53,13 +53,6 @@ export interface ISettingsStore {
|
|
|
53
53
|
/** Addon-level global settings (apply to every device unless overridden). */
|
|
54
54
|
getAllAddon(addonId: string): Record<string, unknown>;
|
|
55
55
|
setAllAddon(addonId: string, config: Record<string, unknown>): void;
|
|
56
|
-
/** Legacy per-provider settings (used by some older wiring paths). */
|
|
57
|
-
getAllProvider(providerId: string): Record<string, unknown>;
|
|
58
|
-
setProvider(providerId: string, key: string, value: unknown): void;
|
|
59
|
-
/** Legacy flat per-device settings. Kept for backward compatibility
|
|
60
|
-
* with pre-addon wiring; new code should use the addon-device API. */
|
|
61
|
-
getAllDevice(deviceId: string): Record<string, unknown>;
|
|
62
|
-
setDevice(deviceId: string, key: string, value: unknown): void;
|
|
63
56
|
/**
|
|
64
57
|
* Per-device runtime state — the whole cap-slice map as ONE row in the
|
|
65
58
|
* `device-runtime-state` collection.
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CapRouteResolver — builds a live CapRouteSnapshot from injected deps and
|
|
3
|
-
* dispatches a resolved CapRoute to the appropriate transport.
|
|
4
|
-
*
|
|
5
|
-
* Layer boundary: this file lives in `@camstack/kernel` and MUST NOT import
|
|
6
|
-
* from `server/backend`. All server-side state is injected via narrow named
|
|
7
|
-
* interfaces (NodeCapAuthority, InProcessProviderLookup, BrokerHandle).
|
|
8
|
-
*
|
|
9
|
-
* Wire conventions (kept here as the single source of truth):
|
|
10
|
-
*
|
|
11
|
-
* remote-moleculer dispatch
|
|
12
|
-
* action : `${addonId}.${capName}.${method}`
|
|
13
|
-
* params : methodArgs (passed through)
|
|
14
|
-
* options : { nodeID: route.nodeId, timeout: 60_000 }
|
|
15
|
-
* note : addonId is resolved by NodeCapAuthority.getAddonId(nodeId, cap)
|
|
16
|
-
*
|
|
17
|
-
* agent-child-forward dispatch
|
|
18
|
-
* service : `$agent-cap-fwd`
|
|
19
|
-
* action : `$agent-cap-fwd.forward`
|
|
20
|
-
* params : { capName, method, args, childId, deviceId? }
|
|
21
|
-
* options : { nodeID: route.agentNodeId, timeout: 60_000 }
|
|
22
|
-
* note : Task 6's agent-side service MUST register the Moleculer service
|
|
23
|
-
* `$agent-cap-fwd` with action `forward` that accepts this shape
|
|
24
|
-
* and fans the call over UDS to route.childId.
|
|
25
|
-
*/
|
|
26
1
|
import type { ServiceDiscoveryBroker } from "../moleculer/resilient-cap-call.js";
|
|
27
2
|
import type { CapRoute, CapRouteOpts, HubLocalUdsRoute, InProcessProviderRef } from "./cap-route.js";
|
|
28
3
|
import type { CapCallInput } from "./child-cap-protocol.js";
|
|
@@ -186,9 +161,10 @@ export declare function extractNodeId(args: unknown): string | undefined;
|
|
|
186
161
|
* keychain owner-checks on this field, and until 2026-10-08 an unstamped
|
|
187
162
|
* call let a child's own `callerAddonId` through untouched.
|
|
188
163
|
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
164
|
+
* Hub-main in-process contexts that bypass tRPC (addon-registry's stated
|
|
165
|
+
* transports) never reach this function. Co-located broker/agent callers
|
|
166
|
+
* stamp here inside `localProviderLink` before the zero-copy invoke.
|
|
167
|
+
* A non-object `args` (or `null`/array) is returned unchanged: there
|
|
192
168
|
* is nowhere to attach a key, and nowhere one could hide.
|
|
193
169
|
*/
|
|
194
170
|
export declare function stampCallerAddonId(args: unknown, callerAddonId: string | undefined): unknown;
|
|
@@ -234,19 +210,14 @@ export declare class CapRouteResolver {
|
|
|
234
210
|
* provider). Only meaningful for `agent-child-forward` — a `remote-moleculer`
|
|
235
211
|
* route already encodes the provider in its action name
|
|
236
212
|
* (`${addonId}.${cap}.${method}`, via `NodeCapAuthority.getAddonId`), and a
|
|
237
|
-
* `
|
|
238
|
-
* talks to `LocalChildRegistry.callCapOnChild` directly rather than through
|
|
239
|
-
* `dispatch`.
|
|
213
|
+
* `buildCapCallFn`'s direct UDS branch when it already knows the child.
|
|
240
214
|
* @param callerAddonId Optional out-of-band CALLER-identity hint — the
|
|
241
215
|
* addon that ORIGINATED the call, distinct from `addonId` above (which
|
|
242
216
|
* names the resolved PROVIDER, not the caller). Set by
|
|
243
|
-
* `onUnownedCall` from
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
* fleet-read census) can read it without every provider method changing
|
|
248
|
-
* signature, the same "extra field the provider destructures or
|
|
249
|
-
* ignores" convention `nodeId` already uses on this path.
|
|
217
|
+
* `onUnownedCall` / `buildCapCallFn` from a stated in-process claim.
|
|
218
|
+
* `hub-in-process` merges it into `args`; `hub-local-uds` carries it on
|
|
219
|
+
* {@link CapCallInput.callerAddonId} so the child can stamp before invoke
|
|
220
|
+
* (without it, `stampCallerAddonId` strips an args-only claim).
|
|
250
221
|
*/
|
|
251
222
|
dispatch(route: CapRoute, method: string, args: unknown, addonId?: string, callerAddonId?: string): Promise<unknown>;
|
|
252
223
|
/**
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const require_dist = require("./dist-DgOG8flk.js");
|
|
2
|
+
//#region src/builtins/records/legacy-table-row-count.ts
|
|
3
|
+
/** Row count for a physical settings-db table (matches the records engine `legacyRowCount`). */
|
|
4
|
+
function legacyTableRowCountFromList(tables, collection) {
|
|
5
|
+
return tables.find((t) => t.name === collection)?.rows ?? 0;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/builtins/records/phase6-declare-gate.ts
|
|
9
|
+
/**
|
|
10
|
+
* Phase 6 auth/alert builtins: do not call `ctx.records.declare` while legacy
|
|
11
|
+
* tables still hold rows unless every kind is already adopted, or the operator
|
|
12
|
+
* set {@link CAMSTACK_RECORDS_DECLARE_PHASE6} for the declare pass before
|
|
13
|
+
* `records-adopt.ts --apply`.
|
|
14
|
+
*/
|
|
15
|
+
/** Operator override: declare kinds even when adoption is still pending (legacy path until adopt completes). */
|
|
16
|
+
var CAMSTACK_RECORDS_DECLARE_PHASE6 = "CAMSTACK_RECORDS_DECLARE_PHASE6";
|
|
17
|
+
function isPhase6RecordsDeclareForced() {
|
|
18
|
+
const raw = process.env[CAMSTACK_RECORDS_DECLARE_PHASE6]?.trim().toLowerCase();
|
|
19
|
+
return raw === "1" || raw === "true" || raw === "yes";
|
|
20
|
+
}
|
|
21
|
+
async function legacyTablesHoldRows(collections, legacyRowCount) {
|
|
22
|
+
for (const collection of collections) if (await legacyRowCount(collection) > 0) return true;
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
async function catalogKindsFullyAdopted(owner, kindNames, declarations, listKindsForOwner, isAdoptedLegacyTable) {
|
|
26
|
+
const listed = await listKindsForOwner(owner);
|
|
27
|
+
const byKind = new Map(listed.map((k) => [k.kind, k]));
|
|
28
|
+
for (const name of kindNames) {
|
|
29
|
+
if (byKind.get(name) === void 0) return false;
|
|
30
|
+
const legacy = declarations[name]?.adoptsFrom;
|
|
31
|
+
if (typeof legacy !== "string") continue;
|
|
32
|
+
if (!await isAdoptedLegacyTable(legacy)) return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @returns `true` when stores should bind record kinds; `false` for legacy collections only.
|
|
38
|
+
*/
|
|
39
|
+
async function resolvePhase6UseRecordsPath(deps) {
|
|
40
|
+
const declarations = require_dist.declarationsOf(deps.kinds);
|
|
41
|
+
const kindNames = Object.keys(deps.kinds);
|
|
42
|
+
if (await catalogKindsFullyAdopted(deps.owner, kindNames, declarations, deps.listKindsForOwner, deps.isAdoptedLegacyTable)) {
|
|
43
|
+
await deps.records.declare(deps.kinds);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (!await legacyTablesHoldRows(deps.legacyCollections, deps.legacyRowCount)) {
|
|
47
|
+
await deps.records.declare(deps.kinds);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
if (isPhase6RecordsDeclareForced()) {
|
|
51
|
+
try {
|
|
52
|
+
await deps.records.declare(deps.kinds);
|
|
53
|
+
} catch (err) {
|
|
54
|
+
if (!(err instanceof Error ? err.message : String(err)).startsWith("records/adoption-pending:")) throw err;
|
|
55
|
+
deps.log.info("phase 6: records kinds declared; legacy tables until adopt completes", { owner: deps.owner });
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
deps.log.info("phase 6: skipping records.declare — serving legacy collections until adopt completes", { owner: deps.owner });
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
/** Shared wiring for hub builtins (local-auth, keychain, alert-center). */
|
|
63
|
+
async function resolvePhase6UseRecordsPathForHub(ctx, owner, kinds, legacyCollections) {
|
|
64
|
+
const records = ctx.records;
|
|
65
|
+
const store = ctx.api?.settingsStore;
|
|
66
|
+
if (records === void 0 || store === void 0) return false;
|
|
67
|
+
const admin = ctx.api?.storageAdmin;
|
|
68
|
+
return resolvePhase6UseRecordsPath({
|
|
69
|
+
owner,
|
|
70
|
+
records,
|
|
71
|
+
kinds,
|
|
72
|
+
legacyCollections,
|
|
73
|
+
legacyRowCount: async (collection) => {
|
|
74
|
+
if (admin !== void 0) {
|
|
75
|
+
const fromEngine = legacyTableRowCountFromList((await admin.listTables.query({})).tables, collection);
|
|
76
|
+
if (fromEngine > 0) return fromEngine;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return await store.count.query({ collection });
|
|
80
|
+
} catch {
|
|
81
|
+
return admin === void 0 ? 0 : legacyTableRowCountFromList((await admin.listTables.query({})).tables, collection);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
listKindsForOwner: async (o) => admin === void 0 ? [] : (await admin.listKinds.query({
|
|
85
|
+
owner: o,
|
|
86
|
+
counts: false
|
|
87
|
+
})).kinds,
|
|
88
|
+
isAdoptedLegacyTable: async (collection) => admin === void 0 ? false : (await admin.isAdoptedLegacyTable.query({ collection })).adopted,
|
|
89
|
+
log: { info: (message, meta) => ctx.logger.info(message, meta ? { meta } : void 0) }
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
Object.defineProperty(exports, "resolvePhase6UseRecordsPathForHub", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function() {
|
|
96
|
+
return resolvePhase6UseRecordsPathForHub;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Ti as declarationsOf } from "./dist-BNunRyXT.mjs";
|
|
2
|
+
//#region src/builtins/records/legacy-table-row-count.ts
|
|
3
|
+
/** Row count for a physical settings-db table (matches the records engine `legacyRowCount`). */
|
|
4
|
+
function legacyTableRowCountFromList(tables, collection) {
|
|
5
|
+
return tables.find((t) => t.name === collection)?.rows ?? 0;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/builtins/records/phase6-declare-gate.ts
|
|
9
|
+
/**
|
|
10
|
+
* Phase 6 auth/alert builtins: do not call `ctx.records.declare` while legacy
|
|
11
|
+
* tables still hold rows unless every kind is already adopted, or the operator
|
|
12
|
+
* set {@link CAMSTACK_RECORDS_DECLARE_PHASE6} for the declare pass before
|
|
13
|
+
* `records-adopt.ts --apply`.
|
|
14
|
+
*/
|
|
15
|
+
/** Operator override: declare kinds even when adoption is still pending (legacy path until adopt completes). */
|
|
16
|
+
var CAMSTACK_RECORDS_DECLARE_PHASE6 = "CAMSTACK_RECORDS_DECLARE_PHASE6";
|
|
17
|
+
function isPhase6RecordsDeclareForced() {
|
|
18
|
+
const raw = process.env[CAMSTACK_RECORDS_DECLARE_PHASE6]?.trim().toLowerCase();
|
|
19
|
+
return raw === "1" || raw === "true" || raw === "yes";
|
|
20
|
+
}
|
|
21
|
+
async function legacyTablesHoldRows(collections, legacyRowCount) {
|
|
22
|
+
for (const collection of collections) if (await legacyRowCount(collection) > 0) return true;
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
async function catalogKindsFullyAdopted(owner, kindNames, declarations, listKindsForOwner, isAdoptedLegacyTable) {
|
|
26
|
+
const listed = await listKindsForOwner(owner);
|
|
27
|
+
const byKind = new Map(listed.map((k) => [k.kind, k]));
|
|
28
|
+
for (const name of kindNames) {
|
|
29
|
+
if (byKind.get(name) === void 0) return false;
|
|
30
|
+
const legacy = declarations[name]?.adoptsFrom;
|
|
31
|
+
if (typeof legacy !== "string") continue;
|
|
32
|
+
if (!await isAdoptedLegacyTable(legacy)) return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @returns `true` when stores should bind record kinds; `false` for legacy collections only.
|
|
38
|
+
*/
|
|
39
|
+
async function resolvePhase6UseRecordsPath(deps) {
|
|
40
|
+
const declarations = declarationsOf(deps.kinds);
|
|
41
|
+
const kindNames = Object.keys(deps.kinds);
|
|
42
|
+
if (await catalogKindsFullyAdopted(deps.owner, kindNames, declarations, deps.listKindsForOwner, deps.isAdoptedLegacyTable)) {
|
|
43
|
+
await deps.records.declare(deps.kinds);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (!await legacyTablesHoldRows(deps.legacyCollections, deps.legacyRowCount)) {
|
|
47
|
+
await deps.records.declare(deps.kinds);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
if (isPhase6RecordsDeclareForced()) {
|
|
51
|
+
try {
|
|
52
|
+
await deps.records.declare(deps.kinds);
|
|
53
|
+
} catch (err) {
|
|
54
|
+
if (!(err instanceof Error ? err.message : String(err)).startsWith("records/adoption-pending:")) throw err;
|
|
55
|
+
deps.log.info("phase 6: records kinds declared; legacy tables until adopt completes", { owner: deps.owner });
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
deps.log.info("phase 6: skipping records.declare — serving legacy collections until adopt completes", { owner: deps.owner });
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
/** Shared wiring for hub builtins (local-auth, keychain, alert-center). */
|
|
63
|
+
async function resolvePhase6UseRecordsPathForHub(ctx, owner, kinds, legacyCollections) {
|
|
64
|
+
const records = ctx.records;
|
|
65
|
+
const store = ctx.api?.settingsStore;
|
|
66
|
+
if (records === void 0 || store === void 0) return false;
|
|
67
|
+
const admin = ctx.api?.storageAdmin;
|
|
68
|
+
return resolvePhase6UseRecordsPath({
|
|
69
|
+
owner,
|
|
70
|
+
records,
|
|
71
|
+
kinds,
|
|
72
|
+
legacyCollections,
|
|
73
|
+
legacyRowCount: async (collection) => {
|
|
74
|
+
if (admin !== void 0) {
|
|
75
|
+
const fromEngine = legacyTableRowCountFromList((await admin.listTables.query({})).tables, collection);
|
|
76
|
+
if (fromEngine > 0) return fromEngine;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return await store.count.query({ collection });
|
|
80
|
+
} catch {
|
|
81
|
+
return admin === void 0 ? 0 : legacyTableRowCountFromList((await admin.listTables.query({})).tables, collection);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
listKindsForOwner: async (o) => admin === void 0 ? [] : (await admin.listKinds.query({
|
|
85
|
+
owner: o,
|
|
86
|
+
counts: false
|
|
87
|
+
})).kinds,
|
|
88
|
+
isAdoptedLegacyTable: async (collection) => admin === void 0 ? false : (await admin.isAdoptedLegacyTable.query({ collection })).adopted,
|
|
89
|
+
log: { info: (message, meta) => ctx.logger.info(message, meta ? { meta } : void 0) }
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { resolvePhase6UseRecordsPathForHub as t };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/records/read-all-rows.js
|
|
2
|
+
var require_read_all_rows = /* @__PURE__ */ require("./chunk-Cek0wNdY.js").__commonJSMin(((exports) => {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.readAllRows = readAllRows;
|
|
5
|
+
var PAGE_SIZE = 1e3;
|
|
6
|
+
var MAX_PAGES = 100;
|
|
7
|
+
async function readAllRows(kind, query = {}, options = {}) {
|
|
8
|
+
const out = [];
|
|
9
|
+
let cursor;
|
|
10
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
11
|
+
const answer = await kind.query({
|
|
12
|
+
...query,
|
|
13
|
+
limit: PAGE_SIZE,
|
|
14
|
+
...cursor === void 0 ? {} : { cursor }
|
|
15
|
+
}, options);
|
|
16
|
+
out.push(...answer.records);
|
|
17
|
+
if (answer.nextCursor === null) return out;
|
|
18
|
+
cursor = answer.nextCursor;
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`record kind "${kind.name}" holds more than ${MAX_PAGES * PAGE_SIZE} rows`);
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
//#endregion
|
|
24
|
+
Object.defineProperty(exports, "require_read_all_rows", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function() {
|
|
27
|
+
return require_read_all_rows;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { t as __commonJSMin } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
+
//#region src/records/read-all-rows.js
|
|
3
|
+
var require_read_all_rows = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.readAllRows = readAllRows;
|
|
6
|
+
var PAGE_SIZE = 1e3;
|
|
7
|
+
var MAX_PAGES = 100;
|
|
8
|
+
async function readAllRows(kind, query = {}, options = {}) {
|
|
9
|
+
const out = [];
|
|
10
|
+
let cursor;
|
|
11
|
+
for (let page = 0; page < MAX_PAGES; page += 1) {
|
|
12
|
+
const answer = await kind.query({
|
|
13
|
+
...query,
|
|
14
|
+
limit: PAGE_SIZE,
|
|
15
|
+
...cursor === void 0 ? {} : { cursor }
|
|
16
|
+
}, options);
|
|
17
|
+
out.push(...answer.records);
|
|
18
|
+
if (answer.nextCursor === null) return out;
|
|
19
|
+
cursor = answer.nextCursor;
|
|
20
|
+
}
|
|
21
|
+
throw new Error(`record kind "${kind.name}" holds more than ${MAX_PAGES * PAGE_SIZE} rows`);
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
//#endregion
|
|
25
|
+
export { require_read_all_rows as t };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read every row of a record kind, page by page (hub-main stores, D881).
|
|
3
|
+
*/
|
|
4
|
+
import type { RecordKindHandle, RecordQueryInput, RecordQueryOptions, RecordRow } from "@camstack/types";
|
|
5
|
+
export type RecordPageQuery = Omit<RecordQueryInput, "kind" | "limit" | "cursor">;
|
|
6
|
+
export declare function readAllRows<T>(kind: RecordKindHandle<T>, query?: RecordPageQuery, options?: RecordQueryOptions): Promise<RecordRow<T>[]>;
|