@camstack/types 1.2.533 → 1.2.534

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.
@@ -1,5 +1,4 @@
1
1
  import type { z } from 'zod';
2
- import type { IntegrationInstanceRef } from '../addon/integration-instance-ref.js';
3
2
  import type { PackageRequires } from '../addon/package-requires.js';
4
3
  import type { ScopedSettingsDeclaration, ScopedSettingsScope } from '../addon/scoped-settings.js';
5
4
  import type { CapabilityDefinition, InferProvider } from '../capabilities/capability-definition.js';
@@ -899,11 +898,6 @@ export interface ICamstackAddon {
899
898
  */
900
899
  onHubReachable?(): Promise<void> | void;
901
900
  shutdown(): Promise<void>;
902
- /**
903
- * The form of ONE integration instance (create wizard or edit page): the addon's per-instance
904
- * schema when it declares one, else its global schema. See `BaseAddon.getIntegrationFormSchema`.
905
- */
906
- getIntegrationFormSchema?(instance: IntegrationInstanceRef, nodeId?: string): Promise<ConfigUISchemaWithValues | null>;
907
901
  /**
908
902
  * D986: the schema one capability this addon provides declares for a settings scope
909
903
  * (`cluster`, `node`, `device-defaults`), or `null`. See `BaseAddon.getScopedSettingsSchema`.
@@ -3309,16 +3309,6 @@ var BaseAddon = class {
3309
3309
  return null;
3310
3310
  }
3311
3311
  /**
3312
- * The form schema of ONE integration instance, or `null` to use the scoped form.
3313
- *
3314
- * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
3315
- * needs its connection fields, the default integration the addon's own sections. It is the
3316
- * SHAPE of the form only — the values live on the instance record.
3317
- */
3318
- async integrationFormSchema(_instance) {
3319
- return null;
3320
- }
3321
- /**
3322
3312
  * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
3323
3313
  * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
3324
3314
  * declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
@@ -3346,8 +3336,7 @@ var BaseAddon = class {
3346
3336
  }
3347
3337
  /**
3348
3338
  * The host's read of the scoped declarations: the schema one capability declares for `scope`,
3349
- * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
3350
- * host asks this method.
3339
+ * or `null`. The hook is protected, the host asks this method.
3351
3340
  */
3352
3341
  async getScopedSettingsSchema(scope, cap) {
3353
3342
  switch (scope) {
@@ -3515,22 +3504,6 @@ var BaseAddon = class {
3515
3504
  return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
3516
3505
  }
3517
3506
  /**
3518
- * What the create wizard and the integration edit page render for one instance: the addon's
3519
- * per-instance schema when it declares one, else its global schema (what they always showed).
3520
- */
3521
- async getIntegrationFormSchema(instance, nodeId) {
3522
- const scoped = await this.integrationFormSchema(instance);
3523
- if (scoped === null) return this.scopedForm(nodeId);
3524
- return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
3525
- }
3526
- /** The form of the scoped schemas this addon declared, hydrated from its store. */
3527
- async scopedForm(nodeId) {
3528
- await this.loadScopedSchemas();
3529
- const schema = this.scopedFormSchema();
3530
- if (!schema) return { sections: [] };
3531
- return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
3532
- }
3533
- /**
3534
3507
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
3535
3508
  * every `perNode: true` field carries THAT node's scoped value on its bare
3536
3509
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -3717,12 +3690,6 @@ var BaseAddon = class {
3717
3690
  this._nodeKeysByCap = /* @__PURE__ */ new Map();
3718
3691
  this._addonSecretTree = null;
3719
3692
  }
3720
- /** The form of an addon's scoped schemas: their sections, each shown once. */
3721
- scopedFormSchema(cap) {
3722
- const byId = /* @__PURE__ */ new Map();
3723
- for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
3724
- return byId.size === 0 ? null : { sections: [...byId.values()] };
3725
- }
3726
3693
  /** Every loaded scoped schema of `cap`, or of every loaded capability. */
3727
3694
  loadedScopedSchemas(cap) {
3728
3695
  if (cap !== void 0) return this._scopedByCap.get(cap) ?? [];
@@ -4312,6 +4279,70 @@ function normalizeAddonInitResult(result) {
4312
4279
  if (Array.isArray(result)) return { providers: result };
4313
4280
  return result;
4314
4281
  }
4282
+ //#endregion
4283
+ //#region src/i18n/camstack-error.ts
4284
+ /**
4285
+ * A user-facing error with a STABLE code (D863).
4286
+ *
4287
+ * `message` is always the English text, so every consumer that knows nothing
4288
+ * of codes (old clients, logs, the mesh) behaves exactly as before. The hub's
4289
+ * tRPC error formatter reads `code` + `params` and, when the request language
4290
+ * has a text for `server:<code>`, replaces the response `message`; the code
4291
+ * stays in the payload (`data.i18n`).
4292
+ */
4293
+ /** Dotted lower-case code, e.g. `auth.invalid-credentials`. It is the key in the `server` catalog. */
4294
+ var ErrorCodeSchema = z.string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/);
4295
+ /** What travels in the error payload next to the message. */
4296
+ var ErrorI18nPayloadSchema = z.object({
4297
+ code: ErrorCodeSchema,
4298
+ params: z.record(z.string(), z.union([z.string(), z.number()])).optional()
4299
+ });
4300
+ var CamstackError = class extends Error {
4301
+ i18nCode;
4302
+ i18nParams;
4303
+ constructor(code, params, englishMessage) {
4304
+ super(englishMessage);
4305
+ this.name = "CamstackError";
4306
+ this.i18nCode = code;
4307
+ this.i18nParams = params;
4308
+ }
4309
+ };
4310
+ /** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
4311
+ function userError(code, params, englishFallback) {
4312
+ return new CamstackError(code, params, englishFallback);
4313
+ }
4314
+ /**
4315
+ * Finds a code on `err` or anywhere down its `.cause` chain. Duck-typed on
4316
+ * the field so it survives a module boundary (self-contained addons).
4317
+ */
4318
+ function readErrorI18n(err) {
4319
+ let current = err;
4320
+ for (let depth = 0; depth < 8; depth++) {
4321
+ if (typeof current !== "object" || current === null) return null;
4322
+ const code = Reflect.get(current, "i18nCode");
4323
+ if (typeof code === "string") {
4324
+ const parsed = ErrorI18nPayloadSchema.safeParse({
4325
+ code,
4326
+ params: Reflect.get(current, "i18nParams")
4327
+ });
4328
+ return parsed.success ? parsed.data : null;
4329
+ }
4330
+ const cause = Reflect.get(current, "cause");
4331
+ if (cause === current) return null;
4332
+ current = cause;
4333
+ }
4334
+ return null;
4335
+ }
4336
+ /**
4337
+ * A provider that refuses a caller throws an Error whose message starts with this prefix. The
4338
+ * class does not survive the UDS hop to a forked addon, the message does, so the hub's tRPC
4339
+ * error formatter answers FORBIDDEN (403) for it instead of a 500.
4340
+ */
4341
+ var FORBIDDEN_MESSAGE_PREFIX = "forbidden: ";
4342
+ /** `throw forbiddenError('target not owned: tg-1')` */
4343
+ function forbiddenError(reason) {
4344
+ return /* @__PURE__ */ new Error(`${FORBIDDEN_MESSAGE_PREFIX}${reason}`);
4345
+ }
4315
4346
  z.object({
4316
4347
  field: z.string().min(1),
4317
4348
  on: z.literal("advance")
@@ -4509,12 +4540,6 @@ function systemMethod(input, output, options) {
4509
4540
  systemOnly: true
4510
4541
  };
4511
4542
  }
4512
- /**
4513
- * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
4514
- * on `InferProvider`. The `providerOptional: true` literal is what
4515
- * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
4516
- * for when this is the honest answer and when it is a soft stub.
4517
- */
4518
4543
  function optionalMethod(input, output, options) {
4519
4544
  return {
4520
4545
  ...method(input, output, options),
@@ -16395,60 +16420,6 @@ function isDeviceScopedCap(capName) {
16395
16420
  return DEVICE_SCOPED_CAPS.has(capName);
16396
16421
  }
16397
16422
  //#endregion
16398
- //#region src/i18n/camstack-error.ts
16399
- /**
16400
- * A user-facing error with a STABLE code (D863).
16401
- *
16402
- * `message` is always the English text, so every consumer that knows nothing
16403
- * of codes (old clients, logs, the mesh) behaves exactly as before. The hub's
16404
- * tRPC error formatter reads `code` + `params` and, when the request language
16405
- * has a text for `server:<code>`, replaces the response `message`; the code
16406
- * stays in the payload (`data.i18n`).
16407
- */
16408
- /** Dotted lower-case code, e.g. `auth.invalid-credentials`. It is the key in the `server` catalog. */
16409
- var ErrorCodeSchema = z.string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/);
16410
- /** What travels in the error payload next to the message. */
16411
- var ErrorI18nPayloadSchema = z.object({
16412
- code: ErrorCodeSchema,
16413
- params: z.record(z.string(), z.union([z.string(), z.number()])).optional()
16414
- });
16415
- var CamstackError = class extends Error {
16416
- i18nCode;
16417
- i18nParams;
16418
- constructor(code, params, englishMessage) {
16419
- super(englishMessage);
16420
- this.name = "CamstackError";
16421
- this.i18nCode = code;
16422
- this.i18nParams = params;
16423
- }
16424
- };
16425
- /** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
16426
- function userError(code, params, englishFallback) {
16427
- return new CamstackError(code, params, englishFallback);
16428
- }
16429
- /**
16430
- * Finds a code on `err` or anywhere down its `.cause` chain. Duck-typed on
16431
- * the field so it survives a module boundary (self-contained addons).
16432
- */
16433
- function readErrorI18n(err) {
16434
- let current = err;
16435
- for (let depth = 0; depth < 8; depth++) {
16436
- if (typeof current !== "object" || current === null) return null;
16437
- const code = Reflect.get(current, "i18nCode");
16438
- if (typeof code === "string") {
16439
- const parsed = ErrorI18nPayloadSchema.safeParse({
16440
- code,
16441
- params: Reflect.get(current, "i18nParams")
16442
- });
16443
- return parsed.success ? parsed.data : null;
16444
- }
16445
- const cause = Reflect.get(current, "cause");
16446
- if (cause === current) return null;
16447
- current = cause;
16448
- }
16449
- return null;
16450
- }
16451
- //#endregion
16452
16423
  //#region src/util/boot-recovery-backoff.ts
16453
16424
  /**
16454
16425
  * The ONE retry schedule for work that can fail simply because the node was
@@ -16680,4 +16651,4 @@ function sleepCancellable(ms, signal) {
16680
16651
  });
16681
16652
  }
16682
16653
  //#endregion
16683
- export { PipelineRunResultBridge as $, dehydrateSchema as $i, DEVICE_SETTINGS_CONTRIBUTION_METHODS as $n, RECORD_MAX_DATA_BYTES as $r, DEFAULT_DISPLAY_PREFERENCE as $t, isCommand as A, RevConflictError as Ai, PEER_BYTES_STALL_MS as An, createDurableState as Ar, isDebugChannelName as At, withoutCallerStamp as B, secretsOverMigrationApi as Bi, RecordFieldPathSchema as Bn, mapSecretLeaves as Br, DecodedAudioChunkSchema as Bt, addonSliceHandleApi as C, PlaintextSecretError as Ci, forgetKnownSecret as Cn, resolveSecretMarkers as Cr, DEBUG_WATCH_REARM_EVERY_MS as Ct, createSliceHandle as D, RecordTooLargeError as Di, shortSecretRefHash as Dn, resolveDeviceSettings as Dr, __resetDebugInterestForTests as Dt, createMirrorSource as E, RecordSecretUnavailableError as Ei, scrubKnownSecrets as En, nodeIdOfScopedKey as Er, DebugWatchTable as Et, CAP_ADVANCE_FIELDS as F, recordsErrorFromMessage as Fi, SHARE_VIEW_KINDS as Fn, RecordIntegrationInstances as Fr, CAM_PROFILE_ORDER as Ft, CAP_COMMAND_ORIGIN_CONTEXT_KEY as G, createEvent as Gi, StoredRecordKindDeclarationSchema as Gn, secretArrayPrefixes as Gr, StreamSourceEntrySchema$1 as Gt, defineCustomActions as H, AddonMigrationDefinitionError as Hi, RecordKindDeclarationSchema as Hn, recordArrayItemPath as Hr, ProfileRtspEntrySchema as Ht, CAP_METHOD_TIMEOUTS_MS as I, defaultIntegrationDepsOver as Ii, DisposerChain as In, isInstanceEnabled as Ir, CamProfileSchema as It, nodePin as J, WELL_KNOWN_TABS as Ji, defineRecordKinds as Jn, RECORD_CLASSES as Jr, SubscribeAudioChunksResultSchema as Jt, CAP_NODE_PIN_CONTEXT_KEY as K, emitReadiness as Ki, assertValidDeclaration as Kn, RECORD_BATCH_MAX as Kr, StreamSourceSchema as Kt, CAP_NAMES as L, integrationRowsApiOver as Li, defineEntryKind as Ln, secretViewsOf as Lr, CamStreamKindSchema as Lt, HF_BASE_URL as M, UnindexedFilterError as Mi, PeerBytesTicketSchema as Mn, registrySwitchPortsOver as Mr, AudioStreamPickSchema as Mt, HF_REPO as N, UnknownRecordKindError as Ni, CALLER_USERNAME_HEADER as Nn, registrySwitchToBodyId as Nr, BrokerStatsSchema as Nt, auditedFields as O, RecordUniqueViolationError as Oi, PEER_BYTES_CHUNK_BYTES as On, resolvedValues as Or, createDebugEmitter as Ot, RUNTIME_DEFAULTS as P, asRecordsError as Pi, DATAPLANE_SECRET_HEADER as Pn, registrySwitchToBodyMigration as Pr, BrokerStatusSchema as Pt, viewerUiCapability as Q, dehydrateConfigField as Qi, DEFAULT_RUNTIME_STATE_DURABILITY as Qn, RECORD_ID_MAX_LENGTH as Qr, selectAssignedProfileSlots as Qt, CAP_STATE_LEAVES as R, recordsOverMigrationApi as Ri, entryBody as Rn, REMOVE_LEAF as Rr, CamStreamResolutionSchema as Rt, invokeTrpcLeaf as S, isAudioChunkFormat as Sa, NoCallerError as Si, clearKnownSecrets as Sn, isSecretRefOwnedBy as Sr, DEBUG_WATCH_HARD_CAP_MS as St, createLazyTrpcSource as T, RecordNotFoundError as Ti, registerKnownSecret as Tn, SCOPED_SETTINGS_SCOPES as Tr, DebugInterest as Tt, describeCustomActions as U, defineAddonMigrations as Ui, RecordKindNameSchema as Un, recordSecretCollection as Ur, ProfileSlotSchema as Ut, customAction as V, switchRecordsOverMigrationApi as Vi, RecordIndexSchema as Vn, parseSecretPath as Vr, FrameHandleSchema as Vt, deviceCustomAction as W, runAddonMigrations as Wi, RecordRetentionSchema as Wn, recordSecretRef as Wr, ProfileSlotStatusSchema as Wt, readNodePin as X, collectHydratedFieldEntries as Xi, collectZodSecretPaths as Xn, RECORD_DEFAULT_MAX_DATA_BYTES as Xr, makeSourceBrokerId as Xt, readCommandOrigin as Y, WELL_KNOWN_TAB_MAP as Yi, SECRET_META as Yn, RECORD_DATABASES as Yr, makeProfileBrokerId as Yt, toNodeId as Z, collectHydratedFieldValues as Zi, isZodSecret as Zn, RECORD_DELETE_BATCH as Zr, parseProfileBrokerId as Zt, readErrorI18n as _, AddonMigrationsBlockedError as _a, BatchTooLargeError as _i, assertTransactScope as _n, parseSecretStatePath as _r, ReadinessTimeoutError as _t, asJsonArray as a, isSecretFieldView as aa, RECORD_SWEEP_INTERVAL_MS as ai, historyUnitFor as an, expandCapMethods as ar, adminUiCapability as at, isDeviceScopedCap as b, audioChunkBytesPerSample as ba, ForeignSecretMarkerError as bi, createSecretsAccess as bn, KeychainWriteRefusedError as br, scopeKey as bt, asString as c, makeSecretMarker as ca, buildSecretRef as ci, DeviceTransitionSchema as cn, method as cr, actionEffect as ct, parseJsonUnknown as d, collectKeychainStoredKeys as da, isSecretRef as di, TransitionCommandSchema as dn, systemMethod as dr, vocabActionIdFor as dt, hydrateSchema as ea, RECORD_MAX_INDEXES as ei, DISPLAY_PREFERENCES as en, DEVICE_STATUS_METHOD as er, PipelineStepInputSchema as et, hfModelUrl as f, collectSecretConfigKeys as fa, normalizeSecretOwner as fi, TransitionOutcomeSchema as fn, BaseAddon as fr, CAP_VOCABULARY as ft, ErrorI18nPayloadSchema as g, schemaDeclaresAnyField as ga, optionalLinkField as gi, createRecordsAccess as gn, mergeSecretStatePaths as gr, ReadinessRegistry as gt, ErrorCodeSchema as h, omitTransientConfig as ha, linksOfKind as hi, makeInMemoryRecords as hn, normalizeAddonInitResult as hr, MODEL_FORMATS as ht, asBoolean as i, isSecretClear as ia, RECORD_SETTINGS_MAX_ROWS as ii, displayUnitFor as in, event as ir, DEVICE_CHILDREN_BATCH_MAX as it, DEFAULT_TOKEN_EXPIRY as j, TransactRefusedError as ji, PEER_BYTES_TICKET_TTL_MS as jn, moveRegistrySwitchToBody as jr, AudioChunkFormatSchema as jt, commandEffect as k, RecordsError as ki, PEER_BYTES_MAX_OUTSTANDING as kn, normalizeNodeId as kr, getDebugInterest as kt, parseJsonArray as l, toSecretFieldView as la, formatSecretScope as li, TransitionActorKindSchema as ln, optionalMethod as lr, allVocabActions as lt, CamstackError as m, isSecretConfigField as ma, linkField as mi, CommandOriginClaimSchema as mn, migrationSet as mr, t as mt, sleepCancellable as n, SECRET_CLEAR as na, RECORD_QUERY_MAX as ni, ReadingQuantitySchema as nn, HISTORY_UNIT_LABELS as nr, RawStateResultSchema as nt, asJsonObject as o, isSecretMarker as oa, SECRET_REF_SCHEME as oi, isReadingQuantity as on, historyItemFieldPath as or, AddonPageDeclarationSchema as ot, BOOT_RECOVERY_BACKOFF_MS as p, isKeychainStoredField as pa, parseSecretRef as pi, TransitionValueSchema as pn, classifyStoreError as pr, CAP_VOCABULARY_BY_NAME as pt, commandOrigin as q, isEvent as qi, declarationsOf as qn, RECORD_BATCH_MAX_BYTES as qr, SubscribeAudioChunksInputSchema as qt, maskUrlCredentials as r, classifySecretWrite as ra, RECORD_SECRET_COLLECTION_PREFIX as ri, baseUnitOf as rn, PROVIDER_PIN_FIELD as rr, deviceOpsCapability as rt, asNumber as s, isSecretMarkerLike as sa, arrayItemFieldPath as si, readingMeta as sn, isDeviceConfigCap as sr, addonPagesSourceCapability as st, sleep as t, resolveHydratedFieldValue as ta, RECORD_MAX_INDEX_FIELDS as ti, QUANTITY_BASE as tn, HISTORY_DEFAULT_MIN_INTERVAL_MS as tr, MIGRATION_API_VERSION as tt, parseJsonObject as u, REDACTED_SECRET as ua, globalSecretScope as ui, TransitionActorSchema as un, resolveCapMount as ur, findVocabAction as ut, userError as v, findMigrationsBlocked as va, DeclarationRefusedError as vi, resolveSecretViewsIn as vn, secretTreeFromPaths as vr, emitDownForOwnedCaps as vt, createEventBusSliceSource as w, RECORDS_ERROR_CODES as wi, knownSecretCount as wn, transformSecretWrite as wr, DEBUG_WATCH_WINDOW_MS as wt, createDeviceProxy as x, expandAudioChunkToF32le as xa, InvalidRecordError as xi, MIN_SCRUBBED_LENGTH as xn, collectSecretMarkerRefs as xr, DEBUG_CHANNEL_PREFIX as xt, DEVICE_SCOPED_CAPS as y, AUDIO_CHUNK_FORMATS as ya, FilterRequiredError as yi, REVALIDATE_AFTER_MS as yn, secretTreeFromSchema as yr, readinessKey as yt, CALLER_STAMPED_CAPABILITIES as z, rowsDepsOver as zi, EntryDescriptorSchema as zn, collectSecretLeaves as zr, CameraStreamSchema as zt };
16654
+ export { DEVICE_CHILDREN_BATCH_MAX as $, collectHydratedFieldValues as $i, event as $n, RECORD_DELETE_BATCH as $r, displayUnitFor as $t, CAP_ADVANCE_FIELDS as A, RecordUniqueViolationError as Ai, SHARE_VIEW_KINDS as An, resolvedValues as Ar, CAM_PROFILE_ORDER as At, CAP_COMMAND_ORIGIN_CONTEXT_KEY as B, recordsOverMigrationApi as Bi, StoredRecordKindDeclarationSchema as Bn, REMOVE_LEAF as Br, StreamSourceEntrySchema$1 as Bt, auditedFields as C, expandAudioChunkToF32le as Ca, InvalidRecordError as Ci, PEER_BYTES_CHUNK_BYTES as Cn, collectSecretMarkerRefs as Cr, createDebugEmitter as Ct, HF_BASE_URL as D, RecordNotFoundError as Di, PeerBytesTicketSchema as Dn, SCOPED_SETTINGS_SCOPES as Dr, AudioStreamPickSchema as Dt, DEFAULT_TOKEN_EXPIRY as E, RECORDS_ERROR_CODES as Ei, PEER_BYTES_TICKET_TTL_MS as En, transformSecretWrite as Er, AudioChunkFormatSchema as Et, withoutCallerStamp as F, UnknownRecordKindError as Fi, RecordFieldPathSchema as Fn, registrySwitchToBodyId as Fr, DecodedAudioChunkSchema as Ft, readNodePin as G, defineAddonMigrations as Gi, collectZodSecretPaths as Gn, recordSecretCollection as Gr, makeSourceBrokerId as Gt, commandOrigin as H, secretsOverMigrationApi as Hi, declarationsOf as Hn, mapSecretLeaves as Hr, SubscribeAudioChunksInputSchema as Ht, customAction as I, asRecordsError as Ii, RecordIndexSchema as In, registrySwitchToBodyMigration as Ir, FrameHandleSchema as It, PipelineRunResultBridge as J, emitReadiness as Ji, DEVICE_SETTINGS_CONTRIBUTION_METHODS as Jn, RECORD_BATCH_MAX as Jr, DEFAULT_DISPLAY_PREFERENCE as Jt, toNodeId as K, runAddonMigrations as Ki, isZodSecret as Kn, recordSecretRef as Kr, parseProfileBrokerId as Kt, defineCustomActions as L, recordsErrorFromMessage as Li, RecordKindDeclarationSchema as Ln, RecordIntegrationInstances as Lr, ProfileRtspEntrySchema as Lt, CAP_NAMES as M, RevConflictError as Mi, defineEntryKind as Mn, createDurableState as Mr, CamStreamKindSchema as Mt, CAP_STATE_LEAVES as N, TransactRefusedError as Ni, entryBody as Nn, moveRegistrySwitchToBody as Nr, CamStreamResolutionSchema as Nt, HF_REPO as O, RecordSecretUnavailableError as Oi, CALLER_USERNAME_HEADER as On, nodeIdOfScopedKey as Or, BrokerStatsSchema as Ot, CALLER_STAMPED_CAPABILITIES as P, UnindexedFilterError as Pi, EntryDescriptorSchema as Pn, registrySwitchPortsOver as Pr, CameraStreamSchema as Pt, deviceOpsCapability as Q, collectHydratedFieldEntries as Qi, PROVIDER_PIN_FIELD as Qn, RECORD_DEFAULT_MAX_DATA_BYTES as Qr, baseUnitOf as Qt, describeCustomActions as R, defaultIntegrationDepsOver as Ri, RecordKindNameSchema as Rn, isInstanceEnabled as Rr, ProfileSlotSchema as Rt, createSliceHandle as S, audioChunkBytesPerSample as Sa, ForeignSecretMarkerError as Si, shortSecretRefHash as Sn, KeychainWriteRefusedError as Sr, __resetDebugInterestForTests as St, isCommand as T, PlaintextSecretError as Ti, PEER_BYTES_STALL_MS as Tn, resolveSecretMarkers as Tr, isDebugChannelName as Tt, nodePin as U, switchRecordsOverMigrationApi as Ui, defineRecordKinds as Un, parseSecretPath as Ur, SubscribeAudioChunksResultSchema as Ut, CAP_NODE_PIN_CONTEXT_KEY as V, rowsDepsOver as Vi, assertValidDeclaration as Vn, collectSecretLeaves as Vr, StreamSourceSchema as Vt, readCommandOrigin as W, AddonMigrationDefinitionError as Wi, SECRET_META as Wn, recordArrayItemPath as Wr, makeProfileBrokerId as Wt, MIGRATION_API_VERSION as X, WELL_KNOWN_TABS as Xi, HISTORY_DEFAULT_MIN_INTERVAL_MS as Xn, RECORD_CLASSES as Xr, QUANTITY_BASE as Xt, PipelineStepInputSchema as Y, isEvent as Yi, DEVICE_STATUS_METHOD as Yn, RECORD_BATCH_MAX_BYTES as Yr, DISPLAY_PREFERENCES as Yt, RawStateResultSchema as Z, WELL_KNOWN_TAB_MAP as Zi, HISTORY_UNIT_LABELS as Zn, RECORD_DATABASES as Zr, ReadingQuantitySchema as Zt, invokeTrpcLeaf as _, omitTransientConfig as _a, linksOfKind as _i, clearKnownSecrets as _n, normalizeAddonInitResult as _r, DEBUG_WATCH_HARD_CAP_MS as _t, asJsonArray as a, classifySecretWrite as aa, RECORD_SECRET_COLLECTION_PREFIX as ai, TransitionActorSchema as an, resolveCapMount as ar, findVocabAction as at, createLazyTrpcSource as b, findMigrationsBlocked as ba, DeclarationRefusedError as bi, registerKnownSecret as bn, secretTreeFromPaths as br, DebugInterest as bt, asString as c, isSecretMarker as ca, SECRET_REF_SCHEME as ci, TransitionValueSchema as cn, ErrorCodeSchema as cr, CAP_VOCABULARY_BY_NAME as ct, parseJsonUnknown as d, toSecretFieldView as da, formatSecretScope as di, createRecordsAccess as dn, forbiddenError as dr, ReadinessRegistry as dt, dehydrateConfigField as ea, RECORD_ID_MAX_LENGTH as ei, historyUnitFor as en, expandCapMethods as er, adminUiCapability as et, hfModelUrl as f, REDACTED_SECRET as fa, globalSecretScope as fi, assertTransactScope as fn, readErrorI18n as fr, ReadinessTimeoutError as ft, createDeviceProxy as g, isSecretConfigField as ga, linkField as gi, MIN_SCRUBBED_LENGTH as gn, migrationSet as gr, DEBUG_CHANNEL_PREFIX as gt, isDeviceScopedCap as h, isKeychainStoredField as ha, parseSecretRef as hi, createSecretsAccess as hn, classifyStoreError as hr, scopeKey as ht, asBoolean as i, SECRET_CLEAR as ia, RECORD_QUERY_MAX as ii, TransitionActorKindSchema as in, optionalMethod as ir, allVocabActions as it, CAP_METHOD_TIMEOUTS_MS as j, RecordsError as ji, DisposerChain as jn, normalizeNodeId as jr, CamProfileSchema as jt, RUNTIME_DEFAULTS as k, RecordTooLargeError as ki, DATAPLANE_SECRET_HEADER as kn, resolveDeviceSettings as kr, BrokerStatusSchema as kt, parseJsonArray as l, isSecretMarkerLike as la, arrayItemFieldPath as li, CommandOriginClaimSchema as ln, ErrorI18nPayloadSchema as lr, t as lt, DEVICE_SCOPED_CAPS as m, collectSecretConfigKeys as ma, normalizeSecretOwner as mi, REVALIDATE_AFTER_MS as mn, BaseAddon as mr, readinessKey as mt, sleepCancellable as n, hydrateSchema as na, RECORD_MAX_INDEXES as ni, readingMeta as nn, isDeviceConfigCap as nr, addonPagesSourceCapability as nt, asJsonObject as o, isSecretClear as oa, RECORD_SETTINGS_MAX_ROWS as oi, TransitionCommandSchema as on, systemMethod as or, vocabActionIdFor as ot, BOOT_RECOVERY_BACKOFF_MS as p, collectKeychainStoredKeys as pa, isSecretRef as pi, resolveSecretViewsIn as pn, userError as pr, emitDownForOwnedCaps as pt, viewerUiCapability as q, createEvent as qi, DEFAULT_RUNTIME_STATE_DURABILITY as qn, secretArrayPrefixes as qr, selectAssignedProfileSlots as qt, maskUrlCredentials as r, resolveHydratedFieldValue as ra, RECORD_MAX_INDEX_FIELDS as ri, DeviceTransitionSchema as rn, method as rr, actionEffect as rt, asNumber as s, isSecretFieldView as sa, RECORD_SWEEP_INTERVAL_MS as si, TransitionOutcomeSchema as sn, CamstackError as sr, CAP_VOCABULARY as st, sleep as t, dehydrateSchema as ta, RECORD_MAX_DATA_BYTES as ti, isReadingQuantity as tn, historyItemFieldPath as tr, AddonPageDeclarationSchema as tt, parseJsonObject as u, makeSecretMarker as ua, buildSecretRef as ui, makeInMemoryRecords as un, FORBIDDEN_MESSAGE_PREFIX as ur, MODEL_FORMATS as ut, addonSliceHandleApi as v, schemaDeclaresAnyField as va, optionalLinkField as vi, forgetKnownSecret as vn, mergeSecretStatePaths as vr, DEBUG_WATCH_REARM_EVERY_MS as vt, commandEffect as w, isAudioChunkFormat as wa, NoCallerError as wi, PEER_BYTES_MAX_OUTSTANDING as wn, isSecretRefOwnedBy as wr, getDebugInterest as wt, createMirrorSource as x, AUDIO_CHUNK_FORMATS as xa, FilterRequiredError as xi, scrubKnownSecrets as xn, secretTreeFromSchema as xr, DebugWatchTable as xt, createEventBusSliceSource as y, AddonMigrationsBlockedError as ya, BatchTooLargeError as yi, knownSecretCount as yn, parseSecretStatePath as yr, DEBUG_WATCH_WINDOW_MS as yt, deviceCustomAction as z, integrationRowsApiOver as zi, RecordRetentionSchema as zn, secretViewsOf as zr, ProfileSlotStatusSchema as zt };
@@ -3309,16 +3309,6 @@ var BaseAddon = class {
3309
3309
  return null;
3310
3310
  }
3311
3311
  /**
3312
- * The form schema of ONE integration instance, or `null` to use the scoped form.
3313
- *
3314
- * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
3315
- * needs its connection fields, the default integration the addon's own sections. It is the
3316
- * SHAPE of the form only — the values live on the instance record.
3317
- */
3318
- async integrationFormSchema(_instance) {
3319
- return null;
3320
- }
3321
- /**
3322
3312
  * D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
3323
3313
  * provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
3324
3314
  * declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
@@ -3346,8 +3336,7 @@ var BaseAddon = class {
3346
3336
  }
3347
3337
  /**
3348
3338
  * The host's read of the scoped declarations: the schema one capability declares for `scope`,
3349
- * or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
3350
- * host asks this method.
3339
+ * or `null`. The hook is protected, the host asks this method.
3351
3340
  */
3352
3341
  async getScopedSettingsSchema(scope, cap) {
3353
3342
  switch (scope) {
@@ -3515,22 +3504,6 @@ var BaseAddon = class {
3515
3504
  return Object.fromEntries([...collectHydratedFieldValues(form)].filter(([, value]) => value !== void 0));
3516
3505
  }
3517
3506
  /**
3518
- * What the create wizard and the integration edit page render for one instance: the addon's
3519
- * per-instance schema when it declares one, else its global schema (what they always showed).
3520
- */
3521
- async getIntegrationFormSchema(instance, nodeId) {
3522
- const scoped = await this.integrationFormSchema(instance);
3523
- if (scoped === null) return this.scopedForm(nodeId);
3524
- return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
3525
- }
3526
- /** The form of the scoped schemas this addon declared, hydrated from its store. */
3527
- async scopedForm(nodeId) {
3528
- await this.loadScopedSchemas();
3529
- const schema = this.scopedFormSchema();
3530
- if (!schema) return { sections: [] };
3531
- return hydrateSchema(schema, await this.readRawProjectedStore(nodeId), { inlineSecretsAsViews: true });
3532
- }
3533
- /**
3534
3507
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
3535
3508
  * every `perNode: true` field carries THAT node's scoped value on its bare
3536
3509
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -3717,12 +3690,6 @@ var BaseAddon = class {
3717
3690
  this._nodeKeysByCap = /* @__PURE__ */ new Map();
3718
3691
  this._addonSecretTree = null;
3719
3692
  }
3720
- /** The form of an addon's scoped schemas: their sections, each shown once. */
3721
- scopedFormSchema(cap) {
3722
- const byId = /* @__PURE__ */ new Map();
3723
- for (const entry of this.loadedScopedSchemas(cap)) for (const section of entry.schema.sections) if (!byId.has(section.id)) byId.set(section.id, section);
3724
- return byId.size === 0 ? null : { sections: [...byId.values()] };
3725
- }
3726
3693
  /** Every loaded scoped schema of `cap`, or of every loaded capability. */
3727
3694
  loadedScopedSchemas(cap) {
3728
3695
  if (cap !== void 0) return this._scopedByCap.get(cap) ?? [];
@@ -4312,6 +4279,70 @@ function normalizeAddonInitResult(result) {
4312
4279
  if (Array.isArray(result)) return { providers: result };
4313
4280
  return result;
4314
4281
  }
4282
+ //#endregion
4283
+ //#region src/i18n/camstack-error.ts
4284
+ /**
4285
+ * A user-facing error with a STABLE code (D863).
4286
+ *
4287
+ * `message` is always the English text, so every consumer that knows nothing
4288
+ * of codes (old clients, logs, the mesh) behaves exactly as before. The hub's
4289
+ * tRPC error formatter reads `code` + `params` and, when the request language
4290
+ * has a text for `server:<code>`, replaces the response `message`; the code
4291
+ * stays in the payload (`data.i18n`).
4292
+ */
4293
+ /** Dotted lower-case code, e.g. `auth.invalid-credentials`. It is the key in the `server` catalog. */
4294
+ var ErrorCodeSchema = zod.z.string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/);
4295
+ /** What travels in the error payload next to the message. */
4296
+ var ErrorI18nPayloadSchema = zod.z.object({
4297
+ code: ErrorCodeSchema,
4298
+ params: zod.z.record(zod.z.string(), zod.z.union([zod.z.string(), zod.z.number()])).optional()
4299
+ });
4300
+ var CamstackError = class extends Error {
4301
+ i18nCode;
4302
+ i18nParams;
4303
+ constructor(code, params, englishMessage) {
4304
+ super(englishMessage);
4305
+ this.name = "CamstackError";
4306
+ this.i18nCode = code;
4307
+ this.i18nParams = params;
4308
+ }
4309
+ };
4310
+ /** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
4311
+ function userError(code, params, englishFallback) {
4312
+ return new CamstackError(code, params, englishFallback);
4313
+ }
4314
+ /**
4315
+ * Finds a code on `err` or anywhere down its `.cause` chain. Duck-typed on
4316
+ * the field so it survives a module boundary (self-contained addons).
4317
+ */
4318
+ function readErrorI18n(err) {
4319
+ let current = err;
4320
+ for (let depth = 0; depth < 8; depth++) {
4321
+ if (typeof current !== "object" || current === null) return null;
4322
+ const code = Reflect.get(current, "i18nCode");
4323
+ if (typeof code === "string") {
4324
+ const parsed = ErrorI18nPayloadSchema.safeParse({
4325
+ code,
4326
+ params: Reflect.get(current, "i18nParams")
4327
+ });
4328
+ return parsed.success ? parsed.data : null;
4329
+ }
4330
+ const cause = Reflect.get(current, "cause");
4331
+ if (cause === current) return null;
4332
+ current = cause;
4333
+ }
4334
+ return null;
4335
+ }
4336
+ /**
4337
+ * A provider that refuses a caller throws an Error whose message starts with this prefix. The
4338
+ * class does not survive the UDS hop to a forked addon, the message does, so the hub's tRPC
4339
+ * error formatter answers FORBIDDEN (403) for it instead of a 500.
4340
+ */
4341
+ var FORBIDDEN_MESSAGE_PREFIX = "forbidden: ";
4342
+ /** `throw forbiddenError('target not owned: tg-1')` */
4343
+ function forbiddenError(reason) {
4344
+ return /* @__PURE__ */ new Error(`${FORBIDDEN_MESSAGE_PREFIX}${reason}`);
4345
+ }
4315
4346
  zod.z.object({
4316
4347
  field: zod.z.string().min(1),
4317
4348
  on: zod.z.literal("advance")
@@ -4509,12 +4540,6 @@ function systemMethod(input, output, options) {
4509
4540
  systemOnly: true
4510
4541
  };
4511
4542
  }
4512
- /**
4513
- * A method a SOURCE of a collection cap may legitimately not serve — OPTIONAL
4514
- * on `InferProvider`. The `providerOptional: true` literal is what
4515
- * `InferProvider` keys on; see {@link CapabilityMethodSchema.providerOptional}
4516
- * for when this is the honest answer and when it is a soft stub.
4517
- */
4518
4543
  function optionalMethod(input, output, options) {
4519
4544
  return {
4520
4545
  ...method(input, output, options),
@@ -16395,60 +16420,6 @@ function isDeviceScopedCap(capName) {
16395
16420
  return DEVICE_SCOPED_CAPS.has(capName);
16396
16421
  }
16397
16422
  //#endregion
16398
- //#region src/i18n/camstack-error.ts
16399
- /**
16400
- * A user-facing error with a STABLE code (D863).
16401
- *
16402
- * `message` is always the English text, so every consumer that knows nothing
16403
- * of codes (old clients, logs, the mesh) behaves exactly as before. The hub's
16404
- * tRPC error formatter reads `code` + `params` and, when the request language
16405
- * has a text for `server:<code>`, replaces the response `message`; the code
16406
- * stays in the payload (`data.i18n`).
16407
- */
16408
- /** Dotted lower-case code, e.g. `auth.invalid-credentials`. It is the key in the `server` catalog. */
16409
- var ErrorCodeSchema = zod.z.string().regex(/^[a-z][a-z0-9-]*(\.[a-z0-9-]+)+$/);
16410
- /** What travels in the error payload next to the message. */
16411
- var ErrorI18nPayloadSchema = zod.z.object({
16412
- code: ErrorCodeSchema,
16413
- params: zod.z.record(zod.z.string(), zod.z.union([zod.z.string(), zod.z.number()])).optional()
16414
- });
16415
- var CamstackError = class extends Error {
16416
- i18nCode;
16417
- i18nParams;
16418
- constructor(code, params, englishMessage) {
16419
- super(englishMessage);
16420
- this.name = "CamstackError";
16421
- this.i18nCode = code;
16422
- this.i18nParams = params;
16423
- }
16424
- };
16425
- /** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
16426
- function userError(code, params, englishFallback) {
16427
- return new CamstackError(code, params, englishFallback);
16428
- }
16429
- /**
16430
- * Finds a code on `err` or anywhere down its `.cause` chain. Duck-typed on
16431
- * the field so it survives a module boundary (self-contained addons).
16432
- */
16433
- function readErrorI18n(err) {
16434
- let current = err;
16435
- for (let depth = 0; depth < 8; depth++) {
16436
- if (typeof current !== "object" || current === null) return null;
16437
- const code = Reflect.get(current, "i18nCode");
16438
- if (typeof code === "string") {
16439
- const parsed = ErrorI18nPayloadSchema.safeParse({
16440
- code,
16441
- params: Reflect.get(current, "i18nParams")
16442
- });
16443
- return parsed.success ? parsed.data : null;
16444
- }
16445
- const cause = Reflect.get(current, "cause");
16446
- if (cause === current) return null;
16447
- current = cause;
16448
- }
16449
- return null;
16450
- }
16451
- //#endregion
16452
16423
  //#region src/util/boot-recovery-backoff.ts
16453
16424
  /**
16454
16425
  * The ONE retry schedule for work that can fail simply because the node was
@@ -16980,6 +16951,12 @@ Object.defineProperty(exports, "ErrorI18nPayloadSchema", {
16980
16951
  return ErrorI18nPayloadSchema;
16981
16952
  }
16982
16953
  });
16954
+ Object.defineProperty(exports, "FORBIDDEN_MESSAGE_PREFIX", {
16955
+ enumerable: true,
16956
+ get: function() {
16957
+ return FORBIDDEN_MESSAGE_PREFIX;
16958
+ }
16959
+ });
16983
16960
  Object.defineProperty(exports, "FilterRequiredError", {
16984
16961
  enumerable: true,
16985
16962
  get: function() {
@@ -17838,6 +17815,12 @@ Object.defineProperty(exports, "findVocabAction", {
17838
17815
  return findVocabAction;
17839
17816
  }
17840
17817
  });
17818
+ Object.defineProperty(exports, "forbiddenError", {
17819
+ enumerable: true,
17820
+ get: function() {
17821
+ return forbiddenError;
17822
+ }
17823
+ });
17841
17824
  Object.defineProperty(exports, "forgetKnownSecret", {
17842
17825
  enumerable: true,
17843
17826
  get: function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.533",
3
+ "version": "1.2.534",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",
@@ -1,21 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Which integration instance a settings form is for. An addon that serves several instances
4
- * (`instanceMode: multiple`) can show a different form per instance — an NVR integration
5
- * needs its connection, the default integration needs the addon's own sections.
6
- *
7
- * - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
8
- * setting up a NEW instance.
9
- * - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
10
- * - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
11
- */
12
- export declare const IntegrationInstanceRefSchema: z.ZodObject<{
13
- integrationId: z.ZodNullable<z.ZodString>;
14
- mode: z.ZodEnum<{
15
- account: "account";
16
- broker: "broker";
17
- standalone: "standalone";
18
- }>;
19
- candidateStableId: z.ZodOptional<z.ZodString>;
20
- }, z.core.$strip>;
21
- export type IntegrationInstanceRef = z.infer<typeof IntegrationInstanceRefSchema>;