@camstack/system 1.2.444 → 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/dist/addon-runner.js +40 -31
- package/dist/addon-runner.mjs +41 -32
- 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 +9 -2
- package/dist/builtins/alerts/alerts.addon.js +289 -150
- package/dist/builtins/alerts/alerts.addon.mjs +288 -150
- 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/index.js +1 -1
- package/dist/builtins/record-entries/index.mjs +1 -1
- 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/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/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-engine-types.d.ts +5 -0
- package/dist/builtins/sqlite-storage/records/records-engine.d.ts +4 -0
- package/dist/builtins/sqlite-storage/records/records-provider.d.ts +5 -1
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +17 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +111 -3
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +111 -3
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +9 -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-C3rKncIF.mjs → composition-sources-BMt5cFYb.mjs} +1 -1
- package/dist/{composition-sources-NAPZddic.js → composition-sources-D3fi9Xns.js} +1 -1
- package/dist/{constants-BKX2QnIg.mjs → constants-BMHCxRzb.mjs} +1 -1
- package/dist/{constants-BXiNEIeV.js → constants-Br879Axi.js} +1 -1
- package/dist/{device-ca-DT9X2S6d.js → device-ca-CnJ_va7i.js} +1 -1
- package/dist/{device-ca-jxjSL8Ov.mjs → device-ca-T8osSMos.mjs} +1 -1
- package/dist/{dist-DERK-gP5.mjs → dist-BNunRyXT.mjs} +174 -58
- package/dist/{dist-D1vECb_6.js → dist-DgOG8flk.js} +233 -57
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-Cah9GCIg.js → hub-mdns-ciao-BIkTHq-n.js} +2 -2
- package/dist/{hub-mdns-ciao-CRaC97V0.mjs → hub-mdns-ciao-D16oRQ9K.mjs} +2 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3093 -2820
- package/dist/index.mjs +3065 -2809
- 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/remote-logger.d.ts +2 -2
- 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-daKyE24F.mjs → restore-archive-DR9MtO7J.mjs} +339 -9
- package/dist/{restore-archive-Dy-qKTdF.js → restore-archive-DjJnCgap.js} +353 -5
- package/dist/tls/agent-https-names.d.ts +9 -13
- package/dist/{wal-maintenance-dAv4IdzC.js → wal-maintenance-CODGqhKY.js} +0 -0
- package/dist/{wal-maintenance-zRc24mOC.mjs → wal-maintenance-CfvgtQ7C.mjs} +0 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DgOG8flk.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -32,70 +32,72 @@ function defaultCalendarColor(calendarId) {
|
|
|
32
32
|
return CALENDAR_COLOR_PALETTE[Math.abs(hash) % CALENDAR_COLOR_PALETTE.length];
|
|
33
33
|
}
|
|
34
34
|
//#endregion
|
|
35
|
+
//#region src/builtins/calendars/record-kinds.ts
|
|
36
|
+
/**
|
|
37
|
+
* Record kinds owned by calendars (phase 4).
|
|
38
|
+
*/
|
|
39
|
+
/** Legacy collection / adoptsFrom target. */
|
|
40
|
+
var CALENDARS_USER_PREFS_COLLECTION = "calendars:user-prefs";
|
|
41
|
+
var CalendarUserPrefsBodySchema = zod.z.object({
|
|
42
|
+
calendars: require_dist.CalendarPreferencesSchema.shape.calendars,
|
|
43
|
+
updatedAt: zod.z.number()
|
|
44
|
+
});
|
|
45
|
+
var _calendarsRecordKinds = require_dist.defineRecordKinds({ "user-prefs": {
|
|
46
|
+
schema: CalendarUserPrefsBodySchema,
|
|
47
|
+
class: "config",
|
|
48
|
+
writeTrigger: "`setCalendarPreference` upserts the caller user row",
|
|
49
|
+
device: "none",
|
|
50
|
+
at: "none",
|
|
51
|
+
indexes: [{
|
|
52
|
+
name: "updated_at",
|
|
53
|
+
fields: ["updatedAt"]
|
|
54
|
+
}],
|
|
55
|
+
retention: { none: "a missing row reads as empty prefs (all visible, system colours)" },
|
|
56
|
+
adoptsFrom: CALENDARS_USER_PREFS_COLLECTION
|
|
57
|
+
} });
|
|
58
|
+
var calendarsRecordKinds = _calendarsRecordKinds;
|
|
59
|
+
_calendarsRecordKinds["user-prefs"];
|
|
60
|
+
//#endregion
|
|
35
61
|
//#region src/builtins/calendars/calendar-prefs-store.ts
|
|
36
62
|
/**
|
|
37
63
|
* Per-user calendar UI preferences (colour override + visibility).
|
|
38
64
|
*
|
|
39
|
-
* One row per `userId`. The calendars builtin owns
|
|
65
|
+
* One row per `userId`. The calendars builtin owns read/write via records;
|
|
40
66
|
* the browser never talks to `settingsStore` directly.
|
|
41
67
|
*/
|
|
42
|
-
/**
|
|
43
|
-
* @durable class=config owner=calendars
|
|
44
|
-
* write="`setCalendarPreference` upserts the caller's row"
|
|
45
|
-
* retention="none — a missing row reads as empty prefs (all visible,
|
|
46
|
-
* system colours). Losing the table silently resets every operator's
|
|
47
|
-
* colour/hide choices."
|
|
48
|
-
*/
|
|
49
|
-
var CALENDARS_USER_PREFS_COLLECTION = "calendars:user-prefs";
|
|
50
|
-
var COLUMNS = [
|
|
51
|
-
{
|
|
52
|
-
name: "userId",
|
|
53
|
-
type: "TEXT",
|
|
54
|
-
primaryKey: true,
|
|
55
|
-
notNull: true
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "calendars",
|
|
59
|
-
type: "JSON",
|
|
60
|
-
notNull: true
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "updatedAt",
|
|
64
|
-
type: "INTEGER",
|
|
65
|
-
notNull: true
|
|
66
|
-
}
|
|
67
|
-
];
|
|
68
68
|
var StoredRowSchema = zod.z.object({
|
|
69
69
|
calendars: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
70
70
|
updatedAt: zod.z.number()
|
|
71
71
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
await store.set.mutate({
|
|
91
|
-
collection: CALENDARS_USER_PREFS_COLLECTION,
|
|
92
|
-
key: userId,
|
|
93
|
-
value: {
|
|
72
|
+
var CalendarPrefsStore = class CalendarPrefsStore {
|
|
73
|
+
kind;
|
|
74
|
+
constructor(kind) {
|
|
75
|
+
this.kind = kind;
|
|
76
|
+
}
|
|
77
|
+
static of(records) {
|
|
78
|
+
return new CalendarPrefsStore(records.kind(calendarsRecordKinds["user-prefs"]));
|
|
79
|
+
}
|
|
80
|
+
async load(userId) {
|
|
81
|
+
const row = await this.kind.get(userId);
|
|
82
|
+
if (row === null) return { calendars: {} };
|
|
83
|
+
const parsed = StoredRowSchema.safeParse(row.data);
|
|
84
|
+
if (!parsed.success) return { calendars: {} };
|
|
85
|
+
const prefs = require_dist.CalendarPreferencesSchema.safeParse({ calendars: parsed.data.calendars });
|
|
86
|
+
return prefs.success ? prefs.data : { calendars: {} };
|
|
87
|
+
}
|
|
88
|
+
async save(userId, prefs, nowMs) {
|
|
89
|
+
const body = {
|
|
94
90
|
calendars: prefs.calendars,
|
|
95
91
|
updatedAt: nowMs
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
};
|
|
93
|
+
const parsed = calendarsRecordKinds["user-prefs"].schema.safeParse(body);
|
|
94
|
+
if (!parsed.success) return;
|
|
95
|
+
await this.kind.put({
|
|
96
|
+
id: userId,
|
|
97
|
+
data: parsed.data
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
99
101
|
/**
|
|
100
102
|
* Patch one calendar's preference entry. `color: null` clears the override;
|
|
101
103
|
* omitting a field leaves it unchanged. An entry that becomes empty is dropped.
|
|
@@ -138,11 +140,15 @@ function withSystemColors(entry) {
|
|
|
138
140
|
}
|
|
139
141
|
var CalendarsAddon = class extends require_dist.BaseAddon {
|
|
140
142
|
id = "calendars";
|
|
141
|
-
|
|
143
|
+
prefsStore = null;
|
|
142
144
|
constructor() {
|
|
143
145
|
super({});
|
|
144
146
|
}
|
|
145
147
|
async onInitialize() {
|
|
148
|
+
const records = this.ctx.records;
|
|
149
|
+
if (records === void 0) throw new Error("calendars needs ctx.records on the hub");
|
|
150
|
+
await records.declare(calendarsRecordKinds);
|
|
151
|
+
this.prefsStore = CalendarPrefsStore.of(records);
|
|
146
152
|
const provider = {
|
|
147
153
|
listCalendars: async () => this.listCalendars(),
|
|
148
154
|
listEvents: async (input) => this.listEvents(input),
|
|
@@ -159,10 +165,9 @@ var CalendarsAddon = class extends require_dist.BaseAddon {
|
|
|
159
165
|
provider
|
|
160
166
|
}];
|
|
161
167
|
}
|
|
162
|
-
|
|
163
|
-
if (this.
|
|
164
|
-
|
|
165
|
-
this.prefsDeclared = true;
|
|
168
|
+
prefs() {
|
|
169
|
+
if (this.prefsStore === null) throw new Error("calendars prefs store not initialized");
|
|
170
|
+
return this.prefsStore;
|
|
166
171
|
}
|
|
167
172
|
sources() {
|
|
168
173
|
return (this.capabilities?.getCollectionEntries("calendar-source") ?? []).map(([id, provider]) => ({
|
|
@@ -213,17 +218,15 @@ var CalendarsAddon = class extends require_dist.BaseAddon {
|
|
|
213
218
|
return out.toSorted((a, b) => a.startMs - b.startMs);
|
|
214
219
|
}
|
|
215
220
|
async getPreferences(caller) {
|
|
216
|
-
|
|
217
|
-
return loadCalendarPreferences(this.ctx.api.settingsStore, caller.userId);
|
|
221
|
+
return this.prefs().load(caller.userId);
|
|
218
222
|
}
|
|
219
223
|
async setCalendarPreference(caller, patch) {
|
|
220
|
-
|
|
221
|
-
const
|
|
222
|
-
const next = patchCalendarPreference(await loadCalendarPreferences(store, caller.userId), patch.calendarId, {
|
|
224
|
+
const store = this.prefs();
|
|
225
|
+
const next = patchCalendarPreference(await store.load(caller.userId), patch.calendarId, {
|
|
223
226
|
visible: patch.visible,
|
|
224
227
|
color: patch.color
|
|
225
228
|
});
|
|
226
|
-
await
|
|
229
|
+
await store.save(caller.userId, next, Date.now());
|
|
227
230
|
return next;
|
|
228
231
|
}
|
|
229
232
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Di as defineRecordKinds, Rr as BaseAddon, g as CalendarPreferencesSchema, xt as calendarsCapability } from "../../dist-BNunRyXT.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -26,71 +26,65 @@ function defaultCalendarColor(calendarId) {
|
|
|
26
26
|
}
|
|
27
27
|
return CALENDAR_COLOR_PALETTE[Math.abs(hash) % CALENDAR_COLOR_PALETTE.length];
|
|
28
28
|
}
|
|
29
|
+
var _calendarsRecordKinds = defineRecordKinds({ "user-prefs": {
|
|
30
|
+
schema: z.object({
|
|
31
|
+
calendars: CalendarPreferencesSchema.shape.calendars,
|
|
32
|
+
updatedAt: z.number()
|
|
33
|
+
}),
|
|
34
|
+
class: "config",
|
|
35
|
+
writeTrigger: "`setCalendarPreference` upserts the caller user row",
|
|
36
|
+
device: "none",
|
|
37
|
+
at: "none",
|
|
38
|
+
indexes: [{
|
|
39
|
+
name: "updated_at",
|
|
40
|
+
fields: ["updatedAt"]
|
|
41
|
+
}],
|
|
42
|
+
retention: { none: "a missing row reads as empty prefs (all visible, system colours)" },
|
|
43
|
+
adoptsFrom: "calendars:user-prefs"
|
|
44
|
+
} });
|
|
45
|
+
var calendarsRecordKinds = _calendarsRecordKinds;
|
|
46
|
+
_calendarsRecordKinds["user-prefs"];
|
|
29
47
|
//#endregion
|
|
30
48
|
//#region src/builtins/calendars/calendar-prefs-store.ts
|
|
31
49
|
/**
|
|
32
50
|
* Per-user calendar UI preferences (colour override + visibility).
|
|
33
51
|
*
|
|
34
|
-
* One row per `userId`. The calendars builtin owns
|
|
52
|
+
* One row per `userId`. The calendars builtin owns read/write via records;
|
|
35
53
|
* the browser never talks to `settingsStore` directly.
|
|
36
54
|
*/
|
|
37
|
-
/**
|
|
38
|
-
* @durable class=config owner=calendars
|
|
39
|
-
* write="`setCalendarPreference` upserts the caller's row"
|
|
40
|
-
* retention="none — a missing row reads as empty prefs (all visible,
|
|
41
|
-
* system colours). Losing the table silently resets every operator's
|
|
42
|
-
* colour/hide choices."
|
|
43
|
-
*/
|
|
44
|
-
var CALENDARS_USER_PREFS_COLLECTION = "calendars:user-prefs";
|
|
45
|
-
var COLUMNS = [
|
|
46
|
-
{
|
|
47
|
-
name: "userId",
|
|
48
|
-
type: "TEXT",
|
|
49
|
-
primaryKey: true,
|
|
50
|
-
notNull: true
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: "calendars",
|
|
54
|
-
type: "JSON",
|
|
55
|
-
notNull: true
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: "updatedAt",
|
|
59
|
-
type: "INTEGER",
|
|
60
|
-
notNull: true
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
55
|
var StoredRowSchema = z.object({
|
|
64
56
|
calendars: z.record(z.string(), z.unknown()),
|
|
65
57
|
updatedAt: z.number()
|
|
66
58
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
await store.set.mutate({
|
|
86
|
-
collection: CALENDARS_USER_PREFS_COLLECTION,
|
|
87
|
-
key: userId,
|
|
88
|
-
value: {
|
|
59
|
+
var CalendarPrefsStore = class CalendarPrefsStore {
|
|
60
|
+
kind;
|
|
61
|
+
constructor(kind) {
|
|
62
|
+
this.kind = kind;
|
|
63
|
+
}
|
|
64
|
+
static of(records) {
|
|
65
|
+
return new CalendarPrefsStore(records.kind(calendarsRecordKinds["user-prefs"]));
|
|
66
|
+
}
|
|
67
|
+
async load(userId) {
|
|
68
|
+
const row = await this.kind.get(userId);
|
|
69
|
+
if (row === null) return { calendars: {} };
|
|
70
|
+
const parsed = StoredRowSchema.safeParse(row.data);
|
|
71
|
+
if (!parsed.success) return { calendars: {} };
|
|
72
|
+
const prefs = CalendarPreferencesSchema.safeParse({ calendars: parsed.data.calendars });
|
|
73
|
+
return prefs.success ? prefs.data : { calendars: {} };
|
|
74
|
+
}
|
|
75
|
+
async save(userId, prefs, nowMs) {
|
|
76
|
+
const body = {
|
|
89
77
|
calendars: prefs.calendars,
|
|
90
78
|
updatedAt: nowMs
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
};
|
|
80
|
+
const parsed = calendarsRecordKinds["user-prefs"].schema.safeParse(body);
|
|
81
|
+
if (!parsed.success) return;
|
|
82
|
+
await this.kind.put({
|
|
83
|
+
id: userId,
|
|
84
|
+
data: parsed.data
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
};
|
|
94
88
|
/**
|
|
95
89
|
* Patch one calendar's preference entry. `color: null` clears the override;
|
|
96
90
|
* omitting a field leaves it unchanged. An entry that becomes empty is dropped.
|
|
@@ -133,11 +127,15 @@ function withSystemColors(entry) {
|
|
|
133
127
|
}
|
|
134
128
|
var CalendarsAddon = class extends BaseAddon {
|
|
135
129
|
id = "calendars";
|
|
136
|
-
|
|
130
|
+
prefsStore = null;
|
|
137
131
|
constructor() {
|
|
138
132
|
super({});
|
|
139
133
|
}
|
|
140
134
|
async onInitialize() {
|
|
135
|
+
const records = this.ctx.records;
|
|
136
|
+
if (records === void 0) throw new Error("calendars needs ctx.records on the hub");
|
|
137
|
+
await records.declare(calendarsRecordKinds);
|
|
138
|
+
this.prefsStore = CalendarPrefsStore.of(records);
|
|
141
139
|
const provider = {
|
|
142
140
|
listCalendars: async () => this.listCalendars(),
|
|
143
141
|
listEvents: async (input) => this.listEvents(input),
|
|
@@ -154,10 +152,9 @@ var CalendarsAddon = class extends BaseAddon {
|
|
|
154
152
|
provider
|
|
155
153
|
}];
|
|
156
154
|
}
|
|
157
|
-
|
|
158
|
-
if (this.
|
|
159
|
-
|
|
160
|
-
this.prefsDeclared = true;
|
|
155
|
+
prefs() {
|
|
156
|
+
if (this.prefsStore === null) throw new Error("calendars prefs store not initialized");
|
|
157
|
+
return this.prefsStore;
|
|
161
158
|
}
|
|
162
159
|
sources() {
|
|
163
160
|
return (this.capabilities?.getCollectionEntries("calendar-source") ?? []).map(([id, provider]) => ({
|
|
@@ -208,17 +205,15 @@ var CalendarsAddon = class extends BaseAddon {
|
|
|
208
205
|
return out.toSorted((a, b) => a.startMs - b.startMs);
|
|
209
206
|
}
|
|
210
207
|
async getPreferences(caller) {
|
|
211
|
-
|
|
212
|
-
return loadCalendarPreferences(this.ctx.api.settingsStore, caller.userId);
|
|
208
|
+
return this.prefs().load(caller.userId);
|
|
213
209
|
}
|
|
214
210
|
async setCalendarPreference(caller, patch) {
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
const next = patchCalendarPreference(await loadCalendarPreferences(store, caller.userId), patch.calendarId, {
|
|
211
|
+
const store = this.prefs();
|
|
212
|
+
const next = patchCalendarPreference(await store.load(caller.userId), patch.calendarId, {
|
|
218
213
|
visible: patch.visible,
|
|
219
214
|
color: patch.color
|
|
220
215
|
});
|
|
221
|
-
await
|
|
216
|
+
await store.save(caller.userId, next, Date.now());
|
|
222
217
|
return next;
|
|
223
218
|
}
|
|
224
219
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record kinds owned by calendars (phase 4).
|
|
3
|
+
*/
|
|
4
|
+
import { CalendarPreferencesSchema, type DefinedRecordKind } from "@camstack/types";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
/** Legacy collection / adoptsFrom target. */
|
|
7
|
+
export declare const CALENDARS_USER_PREFS_COLLECTION = "calendars:user-prefs";
|
|
8
|
+
export type CalendarUserPrefsBody = {
|
|
9
|
+
readonly calendars: z.infer<typeof CalendarPreferencesSchema.shape.calendars>;
|
|
10
|
+
readonly updatedAt: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const CalendarUserPrefsBodySchema: z.ZodType<CalendarUserPrefsBody>;
|
|
13
|
+
export type CalendarsRecordKindsMap = {
|
|
14
|
+
readonly "user-prefs": DefinedRecordKind<z.ZodType<CalendarUserPrefsBody>>;
|
|
15
|
+
};
|
|
16
|
+
export declare const calendarsRecordKinds: CalendarsRecordKindsMap;
|
|
17
|
+
/** Narrow kind for `records.kind()`. */
|
|
18
|
+
export declare const calendarUserPrefsRecordKind: DefinedRecordKind<z.ZodType<CalendarUserPrefsBody>>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DgOG8flk.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
let _camstack_types_node = require("@camstack/types/node");
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ci as createEvent, Cr as buildFfmpegArgs, En as memoizePinnedFfmpeg, Ir as DeviceType, It as declarationOwnerNodeId, K as MOTION_CLOSE_AFTER_MS, Lr as errMsg, Mi as hydrateSchema, Pr as DeviceFeature, Rr as BaseAddon, St as cameraGridLayoutCapability, ar as snapshotCapability, fr as streamCatalogCapability, j as DeclaredDevices, kn as motionCapability, la as EventCategory, o as BaseDevice, w as DERIVED_CAMERA_SILENCED_CAP_NAMES } from "../../dist-BNunRyXT.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { FfmpegProcess } from "@camstack/types/node";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record kinds owned by cluster-agent (phase 4 — hub-main).
|
|
3
|
+
*/
|
|
4
|
+
import { type DefinedRecordKind } from "@camstack/types";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
export declare const CLUSTER_NODE_HISTORY_COLLECTION = "cluster-node-history";
|
|
7
|
+
export interface ClusterNodePackageEntryBody {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly version: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface ClusterNodeDescriptorBody {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly hostname: string;
|
|
15
|
+
readonly platform: string;
|
|
16
|
+
readonly arch: string;
|
|
17
|
+
readonly cpuModel: string | null;
|
|
18
|
+
readonly cpuCores: number;
|
|
19
|
+
readonly memoryMB: number;
|
|
20
|
+
readonly engines: readonly string[];
|
|
21
|
+
readonly isHub: boolean;
|
|
22
|
+
readonly localIps: readonly string[];
|
|
23
|
+
readonly addonIds: readonly string[];
|
|
24
|
+
readonly packages?: readonly ClusterNodePackageEntryBody[];
|
|
25
|
+
}
|
|
26
|
+
export interface ClusterNodeHistoryBody {
|
|
27
|
+
readonly descriptor: ClusterNodeDescriptorBody;
|
|
28
|
+
}
|
|
29
|
+
export declare const ClusterNodeDescriptorBodySchema: z.ZodType<ClusterNodeDescriptorBody>;
|
|
30
|
+
export declare const ClusterNodeHistoryBodySchema: z.ZodType<ClusterNodeHistoryBody>;
|
|
31
|
+
export type ClusterAgentRecordKindsMap = {
|
|
32
|
+
readonly "node-history": DefinedRecordKind<z.ZodType<ClusterNodeHistoryBody>>;
|
|
33
|
+
};
|
|
34
|
+
export declare const clusterAgentRecordKinds: ClusterAgentRecordKindsMap;
|
|
35
|
+
/** Narrow kind for `records.kind()` — `IsolatedRecordKinds` string index is `| undefined`. */
|
|
36
|
+
export declare const clusterNodeHistoryRecordKind: DefinedRecordKind<z.ZodType<ClusterNodeHistoryBody>>;
|
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_composition_sources = require("../../composition-sources-
|
|
6
|
+
const require_dist = require("../../dist-DgOG8flk.js");
|
|
7
|
+
const require_composition_sources = require("../../composition-sources-D3fi9Xns.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/shared/device-state-changed.ts
|
|
10
10
|
/** Structural narrowing helper for untrusted bus payloads. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as normalizedNativeOwner } from "../../composition-sources-
|
|
1
|
+
import { Ar as compositionSourceKey, Ci as createEvent, Dr as compositionFeatureEnabled, Er as composedDeviceStableId, Et as compositionFieldKey, In as planComposition, Ir as DeviceType, Lr as errMsg, Mr as disarmRoseMemory, Nr as toExpressionValue, Or as compositionItemFieldPath, Qt as expressionContainsBuiltinCall, Rr as BaseAddon, Sr as COMPOSER_ADDON_ID, Tr as composedDeviceRef, Tt as composerCapability, Yt as evaluateCompositionField, _t as buildCapabilityLookup, f as COMPOSED_ITEM_FIXED_FIELDS, j as DeclaredDevices, jr as createStatefulExpressionMemory, kr as compositionSliceKey, la as EventCategory, o as BaseDevice, r as ALL_CAPABILITY_DEFINITIONS, wr as cloneStatefulExpressionMemory } from "../../dist-BNunRyXT.mjs";
|
|
2
|
+
import { n as normalizedNativeOwner } from "../../composition-sources-BMt5cFYb.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/shared/device-state-changed.ts
|
|
5
5
|
/** Structural narrowing helper for untrusted bus payloads. */
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-DgOG8flk.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
9
|
var LEVEL_RANK = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Rr as BaseAddon, xn as logDestinationCapability } from "../../dist-BNunRyXT.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
4
|
var LEVEL_RANK = {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { type ConfigUISchema, type RawSecretMigrationReport, type SecretsAccess, type SettingsStoreClient } from "@camstack/types";
|
|
1
|
+
import { type ConfigUISchema, type RawSecretMigrationReport, type SecretsAccess, type RecordKindHandle, type RecordsAccess, type SettingsStoreClient } from "@camstack/types";
|
|
2
|
+
import { type CoreBlockSettingsBodySchema } from "./record-kinds.js";
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
type CoreBlockSettingsBody = z.infer<typeof CoreBlockSettingsBodySchema>;
|
|
2
5
|
/**
|
|
3
6
|
* @durable class=config owner=core-blocks
|
|
4
7
|
* write="NOTHING since D880 - the values live in the block addon's `addon-settings` rows. Only the one-shot `migrateRawSecrets` reads it, then deletes each row."
|
|
5
8
|
* retention="legacy: every row is deleted by the verified operator migration; the declaration goes with it once every hub ran it."
|
|
6
9
|
*/
|
|
7
|
-
export
|
|
10
|
+
export { CORE_BLOCK_SETTINGS_COLLECTION } from "./record-kinds.js";
|
|
8
11
|
export declare const CORE_BLOCK_SETTINGS_COLUMNS: readonly [{
|
|
9
12
|
readonly name: "id";
|
|
10
13
|
readonly type: "TEXT";
|
|
@@ -20,6 +23,7 @@ export declare const CORE_BLOCK_SETTINGS_COLUMNS: readonly [{
|
|
|
20
23
|
export type SecretsForOwner = (owner: string) => SecretsAccess | null;
|
|
21
24
|
export interface BlockSettingsStoreDeps {
|
|
22
25
|
readonly store: SettingsStoreClient;
|
|
26
|
+
readonly legacySettings: RecordKindHandle<CoreBlockSettingsBody>;
|
|
23
27
|
readonly keychainFor: SecretsForOwner;
|
|
24
28
|
/** Told about keychain refs a write dropped but could not delete (they are now orphans). */
|
|
25
29
|
readonly onOrphaned?: (blockId: string, refs: readonly string[]) => void;
|
|
@@ -41,11 +45,11 @@ export interface BlockSecretsSubject {
|
|
|
41
45
|
}
|
|
42
46
|
export declare class BlockSettingsStore {
|
|
43
47
|
private readonly store;
|
|
48
|
+
private readonly legacySettings;
|
|
44
49
|
private readonly keychainFor;
|
|
45
50
|
private readonly onOrphaned;
|
|
46
51
|
constructor(deps: BlockSettingsStoreDeps);
|
|
47
|
-
|
|
48
|
-
static declare(store: SettingsStoreClient): Promise<void>;
|
|
52
|
+
static legacyKindOf(records: Pick<RecordsAccess, "kind">): RecordKindHandle<CoreBlockSettingsBody>;
|
|
49
53
|
private rows;
|
|
50
54
|
/**
|
|
51
55
|
* The block's stored values - markers, NOT resolved. For the admin form
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type { ComposerUnreadableBlock, CompositionBlockInput, CompositionBlockPatch, CoreBlock, CoreBlockInput, IScopedLogger,
|
|
1
|
+
import type { ComposerUnreadableBlock, CompositionBlockInput, CompositionBlockPatch, CoreBlock, CoreBlockInput, IScopedLogger, RecordKindHandle, RecordsAccess } from "@camstack/types";
|
|
2
|
+
import { type CoreBlockRowBodySchema } from "./record-kinds.js";
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
type CoreBlockRowBody = z.infer<typeof CoreBlockRowBodySchema>;
|
|
2
5
|
/**
|
|
3
6
|
* A composition block as the store keeps it: always NAMED. A customization's
|
|
4
7
|
* client input carries no name — the API derives it before the store sees it (D663).
|
|
@@ -6,18 +9,7 @@ import type { ComposerUnreadableBlock, CompositionBlockInput, CompositionBlockPa
|
|
|
6
9
|
export interface NamedCompositionInput extends CompositionBlockInput {
|
|
7
10
|
readonly name: string;
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
* @durable class=config owner=core-blocks
|
|
11
|
-
* write="`create` and `update` persist the operator's block after it compiles;
|
|
12
|
-
* `setStatus` rewrites what the runner reported (status, `lastChangedAt`,
|
|
13
|
-
* `lastError`) — so a running block is written on every state change"
|
|
14
|
-
* retention="`delete` only, when the operator removes a block. Nothing ages out,
|
|
15
|
-
* and a row whose JSON stops validating is left on disk rather than repaired.
|
|
16
|
-
* The real loss path is a `declareCollection` REBUILD — a legacy (id, data)
|
|
17
|
-
* shape, or a new PK/UNIQUE/NOT-NULL-without-default column — which drops the
|
|
18
|
-
* table and takes the operator's source code with it."
|
|
19
|
-
*/
|
|
20
|
-
export declare const CORE_BLOCKS_COLLECTION = "core_blocks";
|
|
12
|
+
export { CORE_BLOCKS_COLLECTION } from "./record-kinds.js";
|
|
21
13
|
export declare const CORE_BLOCKS_COLUMNS: readonly [{
|
|
22
14
|
readonly name: "id";
|
|
23
15
|
readonly type: "TEXT";
|
|
@@ -55,7 +47,7 @@ export declare const CORE_BLOCKS_INDEXES: readonly [{
|
|
|
55
47
|
*/
|
|
56
48
|
export declare const CORE_BLOCKS_LOAD_LIMIT = 1e3;
|
|
57
49
|
export interface CoreBlockStoreDeps {
|
|
58
|
-
readonly
|
|
50
|
+
readonly blocks: RecordKindHandle<CoreBlockRowBody>;
|
|
59
51
|
readonly logger: IScopedLogger;
|
|
60
52
|
readonly now?: () => number;
|
|
61
53
|
readonly newId?: () => string;
|
|
@@ -64,7 +56,7 @@ export declare class CoreBlockStore {
|
|
|
64
56
|
private readonly byId;
|
|
65
57
|
/** Rows that exist but do not parse and may be compositions — held for the composer, never dropped (D49). */
|
|
66
58
|
private unreadable;
|
|
67
|
-
private readonly
|
|
59
|
+
private readonly blocks;
|
|
68
60
|
private readonly logger;
|
|
69
61
|
private readonly now;
|
|
70
62
|
private readonly newId;
|
|
@@ -72,7 +64,7 @@ export declare class CoreBlockStore {
|
|
|
72
64
|
/** Consecutive failed reads — the warn is once per run of them, not once per retry. */
|
|
73
65
|
private failedLoads;
|
|
74
66
|
constructor(deps: CoreBlockStoreDeps);
|
|
75
|
-
static
|
|
67
|
+
static of(records: Pick<RecordsAccess, "kind">, logger: IScopedLogger): CoreBlockStore;
|
|
76
68
|
/** True only after a `load()` that READ the table. The composer withdraws nothing otherwise (D49). */
|
|
77
69
|
isLoaded(): boolean;
|
|
78
70
|
/** Stored composition rows that do not parse, by id — the composer holds their devices. */
|