@dominevo/types 0.1.0 → 0.1.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/CHANGELOG.md +15 -0
- package/dist/addon/base-addon.d.ts +2 -16
- package/dist/addon.d.ts +4 -4
- package/dist/addon.js +2 -2
- package/dist/addon.mjs +2 -2
- package/dist/app-bridge.d.ts +16 -16
- package/dist/auth/app-callback.d.ts +2 -3
- package/dist/auth/credential-scope.d.ts +1 -1
- package/dist/auth/device-certificate.d.ts +5 -5
- package/dist/auth/sso-state.d.ts +1 -1
- package/dist/brokers/smtp-inbound.d.ts +1 -1
- package/dist/cap-call-context.d.ts +2 -2
- package/dist/capabilities/backup.cap.d.ts +1 -1
- package/dist/capabilities/capability-definition.d.ts +1 -1
- package/dist/capabilities/custom-model-registry.cap.d.ts +8 -8
- package/dist/capabilities/display-palette.cap.d.ts +2 -2
- package/dist/capabilities/hub-address.d.ts +5 -5
- package/dist/capabilities/index.d.ts +2 -2
- package/dist/capabilities/keychain-admin.cap.d.ts +2 -2
- package/dist/capabilities/load-contribution.cap.d.ts +1 -1
- package/dist/capabilities/local-network.cap.d.ts +2 -2
- package/dist/capabilities/metrics-provider.cap.d.ts +1 -1
- package/dist/capabilities/migrations.cap.d.ts +1 -1
- package/dist/capabilities/model-convert.cap.d.ts +2 -2
- package/dist/capabilities/model-distributor.cap.d.ts +4 -4
- package/dist/capabilities/notification-rules.cap.d.ts +1 -1
- package/dist/capabilities/oauth-integration.cap.d.ts +1 -1
- package/dist/capabilities/pipeline-executor.cap.d.ts +5 -5
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +1 -1
- package/dist/capabilities/pipeline-runner.cap.d.ts +1 -1
- package/dist/capabilities/recording.cap.d.ts +5 -5
- package/dist/capabilities/reserved-collection-sources.d.ts +1 -1
- package/dist/capabilities/server-management.cap.d.ts +4 -4
- package/dist/capabilities/settings-store.cap.d.ts +1 -1
- package/dist/capabilities/training.cap.d.ts +1 -1
- package/dist/capabilities/user-management.cap.d.ts +8 -2
- package/dist/capabilities/videoclips.cap.d.ts +5 -5
- package/dist/capabilities/viewer-link-url.d.ts +6 -6
- package/dist/catalogs/display-palette-tables.d.ts +2 -2
- package/dist/catalogs/display-palette.d.ts +3 -3
- package/dist/catalogs/palette-entries.d.ts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +19 -27
- package/dist/client.mjs +19 -27
- package/dist/constants.d.ts +2 -2
- package/dist/deps/edgetpu-delegate.d.ts +4 -4
- package/dist/deps/ffmpeg-binary-source.d.ts +2 -2
- package/dist/deps/ffmpeg-downloader.d.ts +1 -1
- package/dist/device/icon-catalog.generated.d.ts +2 -5
- package/dist/enums/event-category.d.ts +2 -2
- package/dist/enums.js +1 -1
- package/dist/enums.mjs +1 -1
- package/dist/esm/addon/base-addon.mjs +2 -22
- package/dist/esm/addon/notification-targets.mjs +1 -1
- package/dist/esm/addon/record-integration-instances.mjs +2 -2
- package/dist/esm/addon.mjs +1 -1
- package/dist/esm/app-bridge.mjs +2 -2
- package/dist/esm/auth/app-callback.mjs +3 -9
- package/dist/esm/auth/credential-scope.mjs +2 -2
- package/dist/esm/auth/device-certificate.mjs +6 -11
- package/dist/esm/auth/sso-state.mjs +1 -1
- package/dist/esm/brokers/smtp-inbound.mjs +1 -1
- package/dist/esm/cap-call-context.mjs +2 -2
- package/dist/esm/capabilities/backup.cap.mjs +1 -1
- package/dist/esm/capabilities/custom-model-registry.cap.mjs +1 -1
- package/dist/esm/capabilities/device-export.cap.mjs +1 -1
- package/dist/esm/capabilities/face-gallery.cap.mjs +1 -1
- package/dist/esm/capabilities/hub-address.mjs +8 -8
- package/dist/esm/capabilities/ir-transmitter.cap.mjs +1 -1
- package/dist/esm/capabilities/keychain-admin.cap.mjs +2 -2
- package/dist/esm/capabilities/load-contribution.cap.mjs +1 -1
- package/dist/esm/capabilities/local-network.cap.mjs +3 -3
- package/dist/esm/capabilities/mesh-network.cap.mjs +2 -2
- package/dist/esm/capabilities/metrics-provider.cap.mjs +2 -2
- package/dist/esm/capabilities/migrations.cap.mjs +1 -1
- package/dist/esm/capabilities/notification-rules.cap.mjs +1 -1
- package/dist/esm/capabilities/oauth-integration.cap.mjs +1 -1
- package/dist/esm/capabilities/pipeline-orchestrator.cap.mjs +2 -2
- package/dist/esm/capabilities/pipeline-runner.cap.mjs +2 -2
- package/dist/esm/capabilities/recording.cap.mjs +7 -7
- package/dist/esm/capabilities/reserved-collection-sources.mjs +1 -1
- package/dist/esm/capabilities/server-management.cap.mjs +4 -4
- package/dist/esm/capabilities/settings-store.cap.mjs +1 -1
- package/dist/esm/capabilities/sso-bridge.cap.mjs +1 -1
- package/dist/esm/capabilities/training-provider.cap.mjs +1 -1
- package/dist/esm/capabilities/user-management.cap.mjs +5 -1
- package/dist/esm/capabilities/videoclips.cap.mjs +6 -6
- package/dist/esm/capabilities/viewer-link-url.mjs +5 -5
- package/dist/esm/catalogs/display-palette-tables.mjs +3 -3
- package/dist/esm/catalogs/display-palette.mjs +6 -6
- package/dist/esm/catalogs/event-taxonomy.mjs +2 -2
- package/dist/esm/catalogs/palette-entries.mjs +1 -1
- package/dist/esm/constants.mjs +1 -1
- package/dist/esm/deps/binary-downloader.mjs +1 -1
- package/dist/esm/deps/edgetpu-delegate.mjs +6 -6
- package/dist/esm/deps/ffmpeg-artifacts.mjs +1 -1
- package/dist/esm/deps/ffmpeg-binary-source.mjs +2 -2
- package/dist/esm/deps/ffmpeg-downloader.mjs +1 -1
- package/dist/esm/deps/python-downloader.mjs +1 -1
- package/dist/esm/device/icon-catalog.generated.mjs +2 -5
- package/dist/esm/enums/event-category.mjs +2 -2
- package/dist/esm/ffmpeg/egress-sharing-key.mjs +19 -0
- package/dist/esm/ffmpeg/sharing-key.mjs +1 -35
- package/dist/esm/generated/method-descriptions.mjs +4 -4
- package/dist/esm/generated/scope-presets.mjs +1 -1
- package/dist/esm/i18n/{camstack-error.mjs → dominevo-error.mjs} +5 -5
- package/dist/esm/index.mjs +7 -8
- package/dist/esm/interfaces/addon-data-plane.mjs +2 -2
- package/dist/esm/interfaces/config-ui-secrets.mjs +1 -1
- package/dist/esm/interfaces/storage-location-declaration.mjs +4 -4
- package/dist/esm/keychain/known-secrets.mjs +1 -1
- package/dist/esm/keychain/secret-marker.mjs +1 -1
- package/dist/esm/node.mjs +5 -2
- package/dist/esm/notification/email-mime.mjs +2 -2
- package/dist/esm/notification/scope-picker-items.mjs +3 -3
- package/dist/esm/pipeline/native-lease.mjs +1 -1
- package/dist/esm/pipeline/node-benchmark/schemas.mjs +1 -1
- package/dist/esm/records/errors.mjs +1 -1
- package/dist/esm/records/in-memory-records-rows.mjs +1 -1
- package/dist/esm/records/secret-views.mjs +1 -1
- package/dist/esm/storage/atomic-write.mjs +1 -1
- package/dist/esm/storage/filesystem-storage-provider.mjs +3 -3
- package/dist/esm/template/automation-template.mjs +1 -1
- package/dist/esm/training/trainer-contract.mjs +10 -10
- package/dist/esm/treeshake-canary.mjs +1 -1
- package/dist/esm/types/models.mjs +7 -7
- package/dist/esm/util/models-dir.mjs +19 -0
- package/dist/esm/utils/pool-memory-watchdog.mjs +8 -8
- package/dist/esm/vendor-login-proxy/login-proxy.mjs +1 -1
- package/dist/esm/vendor-login-proxy/url-rewrite.mjs +1 -1
- package/dist/{event-category-7IiGF_Ui.mjs → event-category-CwprdwEL.mjs} +2 -2
- package/dist/{event-category-BJe9O5KZ.js → event-category-DhlUHlM5.js} +2 -2
- package/dist/ffmpeg/egress-sharing-key.d.ts +19 -0
- package/dist/ffmpeg/sharing-key.d.ts +19 -12
- package/dist/generated/addon-api.d.ts +40 -6
- package/dist/i18n/{camstack-error.d.ts → dominevo-error.d.ts} +2 -2
- package/dist/index.d.ts +3 -4
- package/dist/index.js +141 -330
- package/dist/index.mjs +134 -320
- package/dist/interfaces/addon-data-plane.d.ts +4 -4
- package/dist/interfaces/addon.d.ts +11 -11
- package/dist/interfaces/analysis.d.ts +2 -2
- package/dist/interfaces/capability.d.ts +1 -1
- package/dist/interfaces/config-ui-secrets.d.ts +1 -1
- package/dist/interfaces/context.d.ts +2 -2
- package/dist/interfaces/detection-addon.d.ts +2 -2
- package/dist/interfaces/device-provider.d.ts +2 -2
- package/dist/interfaces/event-bus.d.ts +1 -1
- package/dist/interfaces/kernel-abstractions.d.ts +1 -1
- package/dist/interfaces/storage-location-declaration.d.ts +1 -1
- package/dist/node.d.ts +3 -0
- package/dist/node.js +168 -13
- package/dist/node.mjs +164 -13
- package/dist/notification/scope-picker-items.d.ts +2 -2
- package/dist/{runtime-capabilities-B9CE8DzI.js → runtime-capabilities-Db29ELdy.js} +26 -46
- package/dist/{runtime-capabilities-CAGwQ-Ec.mjs → runtime-capabilities-Dg5DXZkO.mjs} +21 -41
- package/dist/storage/filesystem-storage-provider.d.ts +1 -1
- package/dist/template/automation-template.d.ts +2 -2
- package/dist/training/trainer-contract.d.ts +9 -9
- package/dist/treeshake-canary.d.ts +3 -3
- package/dist/types/agent-pipeline-settings.d.ts +1 -1
- package/dist/types/models.d.ts +11 -11
- package/dist/util/models-dir.d.ts +10 -0
- package/dist/utils/pool-memory-watchdog.d.ts +1 -1
- package/dist/{wake-on-lan-BocEJPCO.js → wake-on-lan-CAbNKvo9.js} +62 -34
- package/dist/{wake-on-lan-Dm-fxZ7N.mjs → wake-on-lan-DqbzeHhm.mjs} +57 -35
- package/package.json +4 -4
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
import { canonicalHash } from "../utils/canonical-hash.mjs";
|
|
2
1
|
//#region src/ffmpeg/sharing-key.ts
|
|
3
2
|
/**
|
|
4
|
-
* The sharing key for `streamBroker.acquireEgressTranscode`.
|
|
5
|
-
*
|
|
6
|
-
* **Two requesters asking for exactly the same argument set reach the same
|
|
7
|
-
* process.** Exact match, never fuzzy: a quantised ladder that merged
|
|
8
|
-
* NEARLY-identical requests would make the stream a consumer receives depend
|
|
9
|
-
* on who else is watching and in what order they arrived — unpredictable in
|
|
10
|
-
* precisely the way a debugging session cannot tolerate. Same arguments ⇒ same
|
|
11
|
-
* process. Different arguments ⇒ different process, and that is fine; the
|
|
12
|
-
* operator accepted the cost ("it's fine to have several processes").
|
|
13
|
-
*
|
|
14
|
-
* Derived from the STRUCTURED plan, not from a flag array. `pipelineKeyFor`
|
|
15
|
-
* (`transcode-pipeline.ts`) folds `getStreamWithCodec`'s raw `outputArgs` into
|
|
16
|
-
* its key, so that method's extensibility hatch and its sharing key are the
|
|
17
|
-
* same field — a consumer needing one extra flag silently forks the child, and
|
|
18
|
-
* two consumers that want the same thing but spell it differently never share.
|
|
19
|
-
* Here every knob is a named field, and defaults are APPLIED before hashing so
|
|
20
|
-
* an omitted field and its explicit default land on the same key.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
3
|
* The transport a CAP request describes. `fragments` is deliberately
|
|
24
4
|
* unreachable from here — the request schema has no way to ask for it, so the
|
|
25
5
|
* cap path can never be handed a fragment child by accident.
|
|
@@ -73,19 +53,5 @@ function canonicalEgressPlan(request, delivery = egressTransportFromRequest(requ
|
|
|
73
53
|
decodeHwAccel: request.decodeHwAccel ?? UNSET
|
|
74
54
|
};
|
|
75
55
|
}
|
|
76
|
-
/**
|
|
77
|
-
* The refcount / dedup key. `canonicalHash` sorts object keys at every depth,
|
|
78
|
-
* so a request built with a different field order produces the same digest.
|
|
79
|
-
*
|
|
80
|
-
* The handle this keys is IMMUTABLE: there is no `reconfigure`. A consumer
|
|
81
|
-
* whose requirements change RELEASES and re-acquires; the refcount does the
|
|
82
|
-
* rest. That is what stops co-tenants disturbing each other — the co-tenant
|
|
83
|
-
* hazard that made Alexa's shared `derived:alexa-<id>` stream a hazard was
|
|
84
|
-
* exactly a mutable shared object, where one consumer's downgrade dragged
|
|
85
|
-
* every other consumer to 360p.
|
|
86
|
-
*/
|
|
87
|
-
function egressTranscodeSharingKey(request, delivery = egressTransportFromRequest(request)) {
|
|
88
|
-
return `egress:${canonicalHash(canonicalEgressPlan(request, delivery))}`;
|
|
89
|
-
}
|
|
90
56
|
//#endregion
|
|
91
|
-
export { canonicalEgressPlan,
|
|
57
|
+
export { canonicalEgressPlan, egressTransportFromRequest };
|
|
@@ -124,7 +124,7 @@ var METHOD_DESCRIPTIONS = /* @__PURE__ */ Object.freeze({
|
|
|
124
124
|
"backup.deleteSchedule": "Delete a schedule by id. Does not touch the target locations.",
|
|
125
125
|
"backup.disableEncryption": "New archives are plain again. Existing encrypted archives keep needing their key.",
|
|
126
126
|
"backup.getEncryption": "The encryption setting — public keys only.",
|
|
127
|
-
"backup.getEntries": "Read the embedded .
|
|
127
|
+
"backup.getEntries": "Read the embedded .dominevo-backup-manifest.json from a previously-created archive. The manifest carries the full file/dir listing with sizes + mtimes — the readdir snapshot the UI shows in the \"Contents\" panel. Returns null when the archive predates manifests (created before this feature shipped).",
|
|
128
128
|
"backup.list": "Union of every destination's archives, each tagged with destinationId.",
|
|
129
129
|
"backup.listArchives": "List archives at a single destination. Reads the per-location manifests.json and returns one entry per archive (newest first). Powers the destinations-table drill-in in admin UI.",
|
|
130
130
|
"backup.listAvailableDatabases": "The database files that exist on this hub right now (the owner's open files), so the selection UI can offer all of them and mark a file that is not created yet. answered: false = the owner did not answer, which is not the same as \"none exist\".",
|
|
@@ -667,7 +667,7 @@ var METHOD_DESCRIPTIONS = /* @__PURE__ */ Object.freeze({
|
|
|
667
667
|
"localNetwork.getAllowedAddresses": "Read the operator's allowlist. Empty = \"auto\" (no filter). Used by the admin UI's address selector to seed its checkbox state.",
|
|
668
668
|
"localNetwork.getConnectionEndpoints": "Ordered candidate base URLs (the palette the Network tab shows). Includes LAN IPv4, stable LAN IPv6, the public tunnel, and mesh when joined. Loopback is off by default. The SDK races the subset from getViewerEndpoints, not this full list — IPv6 stays here because WebRTC ICE gathers dual-stack regardless of the HTTP race. Honours getAllowedAddresses() when set — addresses outside the allowlist are dropped (the public tunnel is still included as an escape hatch).",
|
|
669
669
|
"localNetwork.getHubAddresses": "The hub's cluster and browser addresses (deprecated; use getAddresses).",
|
|
670
|
-
"localNetwork.getNotificationEndpoint": "The notificationTaps role (D734): where TAPPING a notification opens. baseUrl: null means AUTO, which is the Dominevo app link (D709): taps go through https://
|
|
670
|
+
"localNetwork.getNotificationEndpoint": "The notificationTaps role (D734): where TAPPING a notification opens. baseUrl: null means AUTO, which is the Dominevo app link (D709): taps go through https://viewer.dominevo.app/…?hub=<appLinkHub> and open the app. Any hub address the palette lists can be flagged instead; then a tap opens that address. Only the tap: action buttons, attachment / media links and admin links follow the publicEndpoint role (getAddresses().roles.publicEndpoint), never this one.",
|
|
671
671
|
"localNetwork.getPreferred": "Auto-selected outbound interface. Heuristic: 1. Skip internal / link-local / 169.254.*. 2. Prefer LAN/wifi (real Ethernet) over docker/vpn. 3. IPv4 wins over IPv6 (compat with legacy consumers). 4. Tie-break on lowest CIDR mask (most-specific subnet). Returns null only when the host has zero non-loopback addresses. Honours getAllowedAddresses() — if the operator pinned an allowlist, only those addresses are candidates.",
|
|
672
672
|
"localNetwork.getScanSubnets": "Extra subnets every scan covers besides the hub's own, as CIDR strings.",
|
|
673
673
|
"localNetwork.getTlsStatus": "Live TLS material for the Network → Local access certificate card. LAN HTTP / hostname are scoped settings (the cap's own form), not a second store — this query is status, not configuration.",
|
|
@@ -735,7 +735,7 @@ var METHOD_DESCRIPTIONS = /* @__PURE__ */ Object.freeze({
|
|
|
735
735
|
"metricsProvider.getLoadSeries": "The retained per-node load series — the ONE reader over BOTH tiers.",
|
|
736
736
|
"metricsProvider.getProcessStats": "Per-PID resource stats. Missing/dead PIDs are omitted from the result.",
|
|
737
737
|
"metricsProvider.listAddonInstances": "List addon instances known to this node — one entry per forked worker plus a synthetic 'hub' entry representing the local hub process. Used by benchmarks/observability to detect whether a given addon runs in its own process (measurable independently) or inline with the hub.",
|
|
738
|
-
"metricsProvider.listNodeProcesses": "Snapshot of every
|
|
738
|
+
"metricsProvider.listNodeProcesses": "Snapshot of every dominevo-related process on this node with a root/managed/system classification. Powers the Cluster → Agent → Processes tab: cross-references $process.list against a ps scan so per-addon CPU and RSS can be attributed, and so a process the cluster does not manage is still visible.",
|
|
739
739
|
"migrations.clearLegacyIntegrationRows": "Migration-only. Delete that integration's rows. The caller releases the keychain values first. secrets is how many marker refs the rows held. A missing store deletes nothing. Deleted with the last copy migration.",
|
|
740
740
|
"migrations.declareOwner": "An ADDON offers its catalogue at its own boot (D987 M3). The engine checks it together with every other owner's, takes the pre-migration snapshot of each file a pending migration touches, and answers the owner's steps in the order the framework decides. A catalogue the engine refuses (a cycle, a foreign owner, a body kind the owner cannot run) is refused whole and writes nothing.",
|
|
741
741
|
"migrations.deleteLegacyIntegrationRowKeys": "Migration-only. Remove the named keys. present is false when the store is gone; removed is what those keys held (markers included). Deleted with the last copy migration.",
|
|
@@ -1057,7 +1057,7 @@ var METHOD_DESCRIPTIONS = /* @__PURE__ */ Object.freeze({
|
|
|
1057
1057
|
"pipelineOrchestrator.setAgentDecodeLimits": "Size ONE node's decode admission: its RAM budget and live-worker cap. null clears a limit (back to the cluster setting or the RAM-derived default); an omitted key leaves it alone. Read by the node's runner on its next lease refresh (D365).",
|
|
1058
1058
|
"pipelineOrchestrator.setAgentInferenceDevices": "Set one node's multi-device inference opt-in (Phase 4 multi-device) — the per-node deviceKey → { enabled, weight } map that decides which accelerators the dispatcher may balance detection sessions across. The map REPLACES the node's stored inferenceDevices wholesale (pass the complete desired set; an empty map clears the opt-in → the node reverts to its single DEFAULT accelerator). weight is optional and defaults to 1. models is the optional per-device model override (stepId → modelId, C7.2/C7.4) — a stepId absent ⇒ the step uses that device's default model. Creates the node's settings entry if absent. Changes take effect on the next dispatch/rebalance cycle — the dispatcher reads the enabled set via PipelineSettingsStore.buildNodeInferenceDevices when placing sessions and the per-(node,device) base provisioning via buildNodeInferenceDeviceSteps. maxSessions is a LIMIT, with one exception: when the node's default pool is itself an excluded device (turned off or not functional) a camera that would overflow every cap is placed over the cap on the least-loaded eligible device, because the default pool must never serve it (#610). The overflow is logged, naming any pin it overrode.",
|
|
1059
1059
|
"pipelineOrchestrator.setAgentMaxCameras": "Set the per-node camera cap for one agent.",
|
|
1060
|
-
"pipelineOrchestrator.setAgentReachableHost": "Set (or clear) the operator override for the LAN host a cross-node decoder dials to reach this node's restream. Pass a non-empty string to override the auto-detected address (the runner's
|
|
1060
|
+
"pipelineOrchestrator.setAgentReachableHost": "Set (or clear) the operator override for the LAN host a cross-node decoder dials to reach this node's restream. Pass a non-empty string to override the auto-detected address (the runner's DOMINEVO_HUB_URL default); pass null or an empty string to clear it and revert to auto-detect. Applied on the next dispatch cycle — takes effect for new cross-node attaches; existing attaches keep their current host until re-dispatched.",
|
|
1061
1061
|
"pipelineOrchestrator.setCameraDetectionSource": "Pick where this camera's detections come from. Writes detectionSources and arms (or disarms) the vendor's boxed sub-stream that the choice drives. Refuses onboard on a camera with no onboard detector.",
|
|
1062
1062
|
"pipelineOrchestrator.setCameraSensors": "Attach sensors to a camera, or detach them with config: null (D672 configuration, G5/D676). Written to the orchestrator's per-device store under the same key applyDeviceSettingsPatch writes, and announced as a settings change so the camera-sensors bridge refreshes. Refused by name — nothing written — for a device that cannot be read, does not exist, is not a camera, or names itself as its own sensor.",
|
|
1063
1063
|
"pipelineOrchestrator.setCameraStepSettings": "Write or clear one step's CAMERA-WIDE settings (D754) — the camera-semantic fields this camera overrides on every accelerator it runs on. settings is the whole field-level bag for that step (only the overridden keys); null or {} clears it. Merged at dispatch over the node base, key by key. REFUSES a model-scoped key — a model id, a model binding or a minConfidence* floor (D927): those belong to the accelerator that runs the model.",
|
|
@@ -45,7 +45,7 @@ var SCOPE_PRESETS = [
|
|
|
45
45
|
{
|
|
46
46
|
id: "cli-deployer",
|
|
47
47
|
label: "CLI deployer",
|
|
48
|
-
description: "Push addons to the hub and tail their logs. Used by the `
|
|
48
|
+
description: "Push addons to the hub and tail their logs. Used by the `dominevo` CLI on dev machines. No delete access — a stolen token cannot uninstall.",
|
|
49
49
|
rows: [{
|
|
50
50
|
type: "capability",
|
|
51
51
|
target: "addons",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/i18n/
|
|
2
|
+
//#region src/i18n/dominevo-error.ts
|
|
3
3
|
/**
|
|
4
4
|
* A user-facing error with a STABLE code (D863).
|
|
5
5
|
*
|
|
@@ -16,19 +16,19 @@ var ErrorI18nPayloadSchema = /* @__PURE__ */ z.object({
|
|
|
16
16
|
code: ErrorCodeSchema,
|
|
17
17
|
params: /* @__PURE__ */ z.record(/* @__PURE__ */ z.string(), /* @__PURE__ */ z.union([/* @__PURE__ */ z.string(), /* @__PURE__ */ z.number()])).optional()
|
|
18
18
|
});
|
|
19
|
-
var
|
|
19
|
+
var DominevoError = class extends Error {
|
|
20
20
|
i18nCode;
|
|
21
21
|
i18nParams;
|
|
22
22
|
constructor(code, params, englishMessage) {
|
|
23
23
|
super(englishMessage);
|
|
24
|
-
this.name = "
|
|
24
|
+
this.name = "DominevoError";
|
|
25
25
|
this.i18nCode = code;
|
|
26
26
|
this.i18nParams = params;
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
/** `throw userError('device.not-found', { id }, 'Device 12 not found')` */
|
|
30
30
|
function userError(code, params, englishFallback) {
|
|
31
|
-
return new
|
|
31
|
+
return new DominevoError(code, params, englishFallback);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Finds a code on `err` or anywhere down its `.cause` chain. Duck-typed on
|
|
@@ -63,4 +63,4 @@ function forbiddenError(reason) {
|
|
|
63
63
|
return /* @__PURE__ */ new Error(`${FORBIDDEN_MESSAGE_PREFIX}${reason}`);
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
|
-
export {
|
|
66
|
+
export { DominevoError, ErrorCodeSchema, ErrorI18nPayloadSchema, FORBIDDEN_MESSAGE_PREFIX, forbiddenError, readErrorI18n, userError };
|