@camstack/system 1.2.444 → 1.2.446
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-5DYAOJMO.js} +810 -12
- package/dist/{agent-https-U0d4uvn2.mjs → agent-https-BWUEf6ev.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 +373 -154
- package/dist/builtins/alerts/alerts.addon.mjs +372 -154
- package/dist/builtins/alerts/critical-push.d.ts +4 -0
- package/dist/builtins/alerts/emit-alert-policy.d.ts +28 -0
- 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-BmC5jAUv.mjs} +1 -1
- package/dist/{composition-sources-NAPZddic.js → composition-sources-BwIIltnZ.js} +1 -1
- package/dist/{constants-BKX2QnIg.mjs → constants-6XHGmEUF.mjs} +1 -1
- package/dist/{constants-BXiNEIeV.js → constants-DA_tjzIk.js} +1 -1
- package/dist/{device-ca-jxjSL8Ov.mjs → device-ca-Bh_ClxMO.mjs} +1 -1
- package/dist/{device-ca-DT9X2S6d.js → device-ca-CnbrgfmW.js} +1 -1
- package/dist/{dist-D1vECb_6.js → dist-BkNfEJKa.js} +521 -64
- package/dist/{dist-DERK-gP5.mjs → dist-CkZIrsAP.mjs} +462 -65
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-CRaC97V0.mjs → hub-mdns-ciao-CoyIUWHC.mjs} +2 -2
- package/dist/{hub-mdns-ciao-Cah9GCIg.js → hub-mdns-ciao-m5LIr4oA.js} +2 -2
- package/dist/index.d.ts +7 -0
- package/dist/index.js +3095 -2821
- package/dist/index.mjs +3067 -2810
- 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-BDWZuB2n.mjs +93 -0
- package/dist/phase6-declare-gate-Bl7KocEs.js +98 -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-Dy-qKTdF.js → restore-archive-B57xI5Ue.js} +353 -5
- package/dist/{restore-archive-daKyE24F.mjs → restore-archive-CMr4V7Fi.mjs} +339 -9
- package/dist/tls/agent-https-names.d.ts +9 -13
- package/dist/{wal-maintenance-zRc24mOC.mjs → wal-maintenance-Bqm4zrNA.mjs} +0 -0
- package/dist/{wal-maintenance-dAv4IdzC.js → wal-maintenance-CuG1DUca.js} +0 -0
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as DataStoreDatabaseSchema, Di as defineRecordKinds, b as DATABASE_SNAPSHOT_SUFFIX } from "./dist-CkZIrsAP.mjs";
|
|
2
|
+
import { t as require_read_all_rows } from "./read-all-rows-TaPqdWNF.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
2
4
|
import { createCipheriv, createDecipheriv, createHash, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes } from "node:crypto";
|
|
3
5
|
import { Buffer as Buffer$1 } from "buffer";
|
|
4
6
|
import * as fsp from "node:fs/promises";
|
|
@@ -383,6 +385,334 @@ async function decryptBackupFile(input, output, secretKey) {
|
|
|
383
385
|
}
|
|
384
386
|
}
|
|
385
387
|
//#endregion
|
|
388
|
+
//#region src/builtins/backup-orchestrator/encryption-key-store.ts
|
|
389
|
+
var import_read_all_rows = require_read_all_rows();
|
|
390
|
+
/**
|
|
391
|
+
* @durable class=config owner=backup-orchestrator
|
|
392
|
+
* write="`setupEncryption` inserts one row per generated key and retires the
|
|
393
|
+
* previous active row; `disableEncryption` retires the active row"
|
|
394
|
+
* retention="none — one small row per key ever generated; a retired row
|
|
395
|
+
* names the key older archives need"
|
|
396
|
+
*/
|
|
397
|
+
var BACKUP_ENCRYPTION_KEYS_COLLECTION = "backup_encryption_keys";
|
|
398
|
+
var COLUMNS$1 = [
|
|
399
|
+
{
|
|
400
|
+
name: "key_id",
|
|
401
|
+
type: "TEXT",
|
|
402
|
+
primaryKey: true
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
name: "public_key",
|
|
406
|
+
type: "TEXT",
|
|
407
|
+
notNull: true
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: "created_at",
|
|
411
|
+
type: "INTEGER",
|
|
412
|
+
notNull: true
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
name: "retired_at",
|
|
416
|
+
type: "INTEGER"
|
|
417
|
+
}
|
|
418
|
+
];
|
|
419
|
+
var BackupEncryptionKeyStore = class {
|
|
420
|
+
store;
|
|
421
|
+
now;
|
|
422
|
+
declared = false;
|
|
423
|
+
keysKind;
|
|
424
|
+
constructor(store, now = Date.now, keysKind = null) {
|
|
425
|
+
this.store = store;
|
|
426
|
+
this.now = now;
|
|
427
|
+
this.keysKind = keysKind;
|
|
428
|
+
}
|
|
429
|
+
async ensureDeclared() {
|
|
430
|
+
if (this.keysKind !== null) return;
|
|
431
|
+
if (this.declared) return;
|
|
432
|
+
await this.store.declareCollection({
|
|
433
|
+
collection: BACKUP_ENCRYPTION_KEYS_COLLECTION,
|
|
434
|
+
columns: COLUMNS$1
|
|
435
|
+
});
|
|
436
|
+
this.declared = true;
|
|
437
|
+
}
|
|
438
|
+
/** Every key, newest first. */
|
|
439
|
+
async list() {
|
|
440
|
+
await this.ensureDeclared();
|
|
441
|
+
const kind = this.keysKind;
|
|
442
|
+
if (kind !== null) {
|
|
443
|
+
const rows = await (0, import_read_all_rows.readAllRows)(kind);
|
|
444
|
+
rows.sort((a, b) => b.data.createdAt - a.data.createdAt);
|
|
445
|
+
const out = [];
|
|
446
|
+
for (const row of rows) {
|
|
447
|
+
const record = bodyToRecord(row.id, row.data);
|
|
448
|
+
if (record !== null) out.push(record);
|
|
449
|
+
}
|
|
450
|
+
return out;
|
|
451
|
+
}
|
|
452
|
+
const rows = await this.store.query({
|
|
453
|
+
collection: BACKUP_ENCRYPTION_KEYS_COLLECTION,
|
|
454
|
+
filter: { orderBy: {
|
|
455
|
+
field: "created_at",
|
|
456
|
+
direction: "desc"
|
|
457
|
+
} }
|
|
458
|
+
});
|
|
459
|
+
const out = [];
|
|
460
|
+
for (const row of rows) {
|
|
461
|
+
const record = toRecord(row.data);
|
|
462
|
+
if (record !== null) out.push(record);
|
|
463
|
+
}
|
|
464
|
+
return out;
|
|
465
|
+
}
|
|
466
|
+
/** The key new archives are encrypted to; `null` = encryption off. */
|
|
467
|
+
async active() {
|
|
468
|
+
return (await this.list()).find((k) => k.retiredAt === null) ?? null;
|
|
469
|
+
}
|
|
470
|
+
/** Make `publicKey` the active key; the previous one is retired, kept listed. */
|
|
471
|
+
async activate(input) {
|
|
472
|
+
const parsed = parseBackupPublicKey(input.publicKey);
|
|
473
|
+
const t = this.now();
|
|
474
|
+
await this.retireActive(t);
|
|
475
|
+
const record = {
|
|
476
|
+
keyId: parsed.keyId,
|
|
477
|
+
publicKey: input.publicKey.trim(),
|
|
478
|
+
createdAt: t,
|
|
479
|
+
retiredAt: null
|
|
480
|
+
};
|
|
481
|
+
await this.write(record);
|
|
482
|
+
return record;
|
|
483
|
+
}
|
|
484
|
+
/** Encryption off: the active key is retired. Archives already made keep needing it. */
|
|
485
|
+
async disable() {
|
|
486
|
+
await this.retireActive(this.now());
|
|
487
|
+
}
|
|
488
|
+
async retireActive(at) {
|
|
489
|
+
for (const key of await this.list()) if (key.retiredAt === null) await this.write({
|
|
490
|
+
...key,
|
|
491
|
+
retiredAt: at
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
async write(record) {
|
|
495
|
+
await this.ensureDeclared();
|
|
496
|
+
const kind = this.keysKind;
|
|
497
|
+
if (kind !== null) {
|
|
498
|
+
const body = {
|
|
499
|
+
keyId: record.keyId,
|
|
500
|
+
publicKey: record.publicKey,
|
|
501
|
+
createdAt: record.createdAt,
|
|
502
|
+
retiredAt: record.retiredAt
|
|
503
|
+
};
|
|
504
|
+
const data = backupOrchestratorRecordKinds["encryption-keys"].schema.parse(body);
|
|
505
|
+
await kind.put({
|
|
506
|
+
id: record.keyId,
|
|
507
|
+
data
|
|
508
|
+
});
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
await this.store.deleteWhere({
|
|
512
|
+
collection: BACKUP_ENCRYPTION_KEYS_COLLECTION,
|
|
513
|
+
filter: { where: { key_id: record.keyId } }
|
|
514
|
+
});
|
|
515
|
+
await this.store.insert({
|
|
516
|
+
collection: BACKUP_ENCRYPTION_KEYS_COLLECTION,
|
|
517
|
+
record: {
|
|
518
|
+
id: record.keyId,
|
|
519
|
+
data: {
|
|
520
|
+
key_id: record.keyId,
|
|
521
|
+
public_key: record.publicKey,
|
|
522
|
+
created_at: record.createdAt,
|
|
523
|
+
retired_at: record.retiredAt
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
function bodyToRecord(keyId, body) {
|
|
530
|
+
if (!keyId) return null;
|
|
531
|
+
return {
|
|
532
|
+
keyId: body.keyId,
|
|
533
|
+
publicKey: body.publicKey,
|
|
534
|
+
createdAt: body.createdAt,
|
|
535
|
+
retiredAt: body.retiredAt
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function toRecord(row) {
|
|
539
|
+
const keyId = row["key_id"];
|
|
540
|
+
const publicKey = row["public_key"];
|
|
541
|
+
const createdAt = row["created_at"];
|
|
542
|
+
if (typeof keyId !== "string" || typeof publicKey !== "string") return null;
|
|
543
|
+
const retired = row["retired_at"];
|
|
544
|
+
return {
|
|
545
|
+
keyId,
|
|
546
|
+
publicKey,
|
|
547
|
+
createdAt: typeof createdAt === "number" ? createdAt : Number(createdAt ?? 0),
|
|
548
|
+
retiredAt: typeof retired === "number" ? retired : null
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/builtins/backup-orchestrator/seed-marker-store.ts
|
|
553
|
+
/**
|
|
554
|
+
* @durable class=config owner=backup-orchestrator
|
|
555
|
+
* write="the orchestrator inserts one row per seed id the first time that
|
|
556
|
+
* seed is created (or found already created); never updated"
|
|
557
|
+
* retention="none — one tiny row per seed ever made; deleting it lets the
|
|
558
|
+
* seed be re-created once more on the next boot"
|
|
559
|
+
*/
|
|
560
|
+
var BACKUP_SEED_MARKERS_COLLECTION = "backup_seed_markers";
|
|
561
|
+
var COLUMNS = [{
|
|
562
|
+
name: "seed_id",
|
|
563
|
+
type: "TEXT",
|
|
564
|
+
primaryKey: true
|
|
565
|
+
}, {
|
|
566
|
+
name: "seeded_at",
|
|
567
|
+
type: "INTEGER",
|
|
568
|
+
notNull: true
|
|
569
|
+
}];
|
|
570
|
+
var BackupSeedMarkerStore = class {
|
|
571
|
+
store;
|
|
572
|
+
now;
|
|
573
|
+
declared = false;
|
|
574
|
+
markersKind;
|
|
575
|
+
constructor(store, now = Date.now, markersKind = null) {
|
|
576
|
+
this.store = store;
|
|
577
|
+
this.now = now;
|
|
578
|
+
this.markersKind = markersKind;
|
|
579
|
+
}
|
|
580
|
+
async ensureDeclared() {
|
|
581
|
+
if (this.markersKind !== null) return;
|
|
582
|
+
if (this.declared) return;
|
|
583
|
+
await this.store.declareCollection({
|
|
584
|
+
collection: BACKUP_SEED_MARKERS_COLLECTION,
|
|
585
|
+
columns: COLUMNS
|
|
586
|
+
});
|
|
587
|
+
this.declared = true;
|
|
588
|
+
}
|
|
589
|
+
async has(seedId) {
|
|
590
|
+
await this.ensureDeclared();
|
|
591
|
+
const kind = this.markersKind;
|
|
592
|
+
if (kind !== null) return await kind.get(seedId) !== null;
|
|
593
|
+
return (await this.store.query({
|
|
594
|
+
collection: BACKUP_SEED_MARKERS_COLLECTION,
|
|
595
|
+
filter: {
|
|
596
|
+
where: { seed_id: seedId },
|
|
597
|
+
limit: 1
|
|
598
|
+
}
|
|
599
|
+
})).length > 0;
|
|
600
|
+
}
|
|
601
|
+
async mark(seedId) {
|
|
602
|
+
await this.ensureDeclared();
|
|
603
|
+
if (await this.has(seedId)) return;
|
|
604
|
+
const kind = this.markersKind;
|
|
605
|
+
if (kind !== null) {
|
|
606
|
+
const body = { seededAt: this.now() };
|
|
607
|
+
const data = backupOrchestratorRecordKinds["seed-markers"].schema.parse(body);
|
|
608
|
+
await kind.put({
|
|
609
|
+
id: seedId,
|
|
610
|
+
data
|
|
611
|
+
});
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
await this.store.insert({
|
|
615
|
+
collection: BACKUP_SEED_MARKERS_COLLECTION,
|
|
616
|
+
record: {
|
|
617
|
+
id: seedId,
|
|
618
|
+
data: {
|
|
619
|
+
seed_id: seedId,
|
|
620
|
+
seeded_at: this.now()
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
//#endregion
|
|
627
|
+
//#region src/builtins/backup-orchestrator/record-kinds.ts
|
|
628
|
+
var BACKUP_SCHEDULES_LEGACY = "backup_schedules";
|
|
629
|
+
var BACKUP_DESTINATION_POLICIES_LEGACY = "backup_destination_policies";
|
|
630
|
+
var BackupScheduleBodySchema = z.object({
|
|
631
|
+
label: z.string(),
|
|
632
|
+
cron: z.string(),
|
|
633
|
+
enabled: z.boolean(),
|
|
634
|
+
locationIds: z.array(z.string()).readonly(),
|
|
635
|
+
retentionCount: z.number(),
|
|
636
|
+
dataSources: z.array(z.string()).readonly().optional(),
|
|
637
|
+
databases: z.array(DataStoreDatabaseSchema).readonly().optional(),
|
|
638
|
+
lastAttemptAt: z.number().optional(),
|
|
639
|
+
lastSuccessAt: z.number().optional(),
|
|
640
|
+
lastError: z.string().optional()
|
|
641
|
+
});
|
|
642
|
+
var BackupDestinationPolicyBodySchema = z.object({
|
|
643
|
+
enabled: z.boolean(),
|
|
644
|
+
retentionCount: z.number(),
|
|
645
|
+
label: z.string().optional(),
|
|
646
|
+
lastAttemptAt: z.number().optional(),
|
|
647
|
+
lastError: z.string().optional()
|
|
648
|
+
});
|
|
649
|
+
var BackupEncryptionKeyBodySchema = z.object({
|
|
650
|
+
keyId: z.string(),
|
|
651
|
+
publicKey: z.string(),
|
|
652
|
+
createdAt: z.number(),
|
|
653
|
+
retiredAt: z.number().nullable()
|
|
654
|
+
});
|
|
655
|
+
var BackupSeedMarkerBodySchema = z.object({ seededAt: z.number() });
|
|
656
|
+
var _backupOrchestratorRecordKinds = defineRecordKinds({
|
|
657
|
+
schedules: {
|
|
658
|
+
schema: BackupScheduleBodySchema,
|
|
659
|
+
class: "config",
|
|
660
|
+
writeTrigger: "operator upsert/delete; orchestrator stamps lastAttempt/success/error",
|
|
661
|
+
device: "none",
|
|
662
|
+
at: "none",
|
|
663
|
+
indexes: [{
|
|
664
|
+
name: "enabled",
|
|
665
|
+
fields: ["enabled"]
|
|
666
|
+
}],
|
|
667
|
+
retention: { none: "operator delete only" },
|
|
668
|
+
adoptsFrom: BACKUP_SCHEDULES_LEGACY,
|
|
669
|
+
entry: {
|
|
670
|
+
title: "Backup schedules",
|
|
671
|
+
nameField: "label"
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
"destination-policies": {
|
|
675
|
+
schema: BackupDestinationPolicyBodySchema,
|
|
676
|
+
class: "config",
|
|
677
|
+
writeTrigger: "ensureDefault, operator upsert, recordAttempt after each archive write",
|
|
678
|
+
device: "none",
|
|
679
|
+
at: "none",
|
|
680
|
+
retention: { none: "row outlives location; ensureDefault recreates" },
|
|
681
|
+
adoptsFrom: BACKUP_DESTINATION_POLICIES_LEGACY
|
|
682
|
+
},
|
|
683
|
+
"encryption-keys": {
|
|
684
|
+
schema: BackupEncryptionKeyBodySchema,
|
|
685
|
+
class: "config",
|
|
686
|
+
writeTrigger: "setupEncryption activate; disableEncryption retires active row",
|
|
687
|
+
device: "none",
|
|
688
|
+
at: "none",
|
|
689
|
+
retention: { none: "retired keys kept for archive decryption hints" },
|
|
690
|
+
adoptsFrom: BACKUP_ENCRYPTION_KEYS_COLLECTION
|
|
691
|
+
},
|
|
692
|
+
"seed-markers": {
|
|
693
|
+
schema: BackupSeedMarkerBodySchema,
|
|
694
|
+
class: "config",
|
|
695
|
+
writeTrigger: "mark() once per seed id after seed landed",
|
|
696
|
+
device: "none",
|
|
697
|
+
at: "none",
|
|
698
|
+
retention: { none: "one row per seed id ever" },
|
|
699
|
+
adoptsFrom: BACKUP_SEED_MARKERS_COLLECTION
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
var backupOrchestratorRecordKinds = _backupOrchestratorRecordKinds;
|
|
703
|
+
var backupSchedulesRecordKind = _backupOrchestratorRecordKinds.schedules;
|
|
704
|
+
var backupDestinationPoliciesRecordKind = _backupOrchestratorRecordKinds["destination-policies"];
|
|
705
|
+
var backupEncryptionKeysRecordKind = _backupOrchestratorRecordKinds["encryption-keys"];
|
|
706
|
+
var backupSeedMarkersRecordKind = _backupOrchestratorRecordKinds["seed-markers"];
|
|
707
|
+
function backupRecordStoresOf(records) {
|
|
708
|
+
return {
|
|
709
|
+
schedules: records.kind(backupSchedulesRecordKind),
|
|
710
|
+
destinationPolicies: records.kind(backupDestinationPoliciesRecordKind),
|
|
711
|
+
encryptionKeys: records.kind(backupEncryptionKeysRecordKind),
|
|
712
|
+
seedMarkers: records.kind(backupSeedMarkersRecordKind)
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
//#endregion
|
|
386
716
|
//#region node_modules/tar/dist/esm/index.min.js
|
|
387
717
|
var Mr = Object.defineProperty;
|
|
388
718
|
var Br = (s, t) => {
|
|
@@ -394,7 +724,7 @@ var Br = (s, t) => {
|
|
|
394
724
|
var xs = typeof process == "object" && process ? process : {
|
|
395
725
|
stdout: null,
|
|
396
726
|
stderr: null
|
|
397
|
-
}, zr = (s) => !!s && typeof s == "object" && (s instanceof A || s instanceof As || Ur(s) || Hr(s)), Ur = (s) => !!s && typeof s == "object" && s instanceof EventEmitter && typeof s.pipe == "function" && s.pipe !== As.Writable.prototype.pipe, Hr = (s) => !!s && typeof s == "object" && s instanceof EventEmitter && typeof s.write == "function" && typeof s.end == "function", q = Symbol("EOF"), Q = Symbol("maybeEmitEnd"), rt = Symbol("emittedEnd"), Le = Symbol("emittingEnd"), qt = Symbol("emittedError"), Ne = Symbol("closed"), Ls = Symbol("read"), De = Symbol("flush"), Ns = Symbol("flushChunk"), z = Symbol("encoding"), Mt = Symbol("decoder"), g = Symbol("flowing"), Qt = Symbol("paused"), Bt = Symbol("resume"), b = Symbol("buffer"), D = Symbol("pipes"), _ = Symbol("bufferLength"), gi = Symbol("bufferPush"), Ae = Symbol("bufferShift"), L = Symbol("objectMode"), w = Symbol("destroyed"), bi = Symbol("error"), _i = Symbol("emitData"), Ds = Symbol("emitEnd"), Oi = Symbol("emitEnd2"), Z = Symbol("async"), Ti = Symbol("abort"), Ie = Symbol("aborted"), Jt = Symbol("signal"), Rt = Symbol("dataListeners"), F = Symbol("discarded"), jt = (s) => Promise.resolve().then(s), Wr = (s) => s(), Gr = (s) => s === "end" || s === "finish" || s === "prefinish", Zr = (s) => s instanceof ArrayBuffer || !!s && typeof s == "object" && s.constructor && s.constructor.name === "ArrayBuffer" && s.byteLength >= 0, Yr = (s) => !Buffer.isBuffer(s) && ArrayBuffer.isView(s), Fe = class {
|
|
727
|
+
}, zr = (s) => !!s && typeof s == "object" && (s instanceof A || s instanceof As || Ur(s) || Hr(s)), Ur = (s) => !!s && typeof s == "object" && s instanceof EventEmitter && typeof s.pipe == "function" && s.pipe !== As.Writable.prototype.pipe, Hr = (s) => !!s && typeof s == "object" && s instanceof EventEmitter && typeof s.write == "function" && typeof s.end == "function", q = Symbol("EOF"), Q = Symbol("maybeEmitEnd"), rt = Symbol("emittedEnd"), Le = Symbol("emittingEnd"), qt = Symbol("emittedError"), Ne = Symbol("closed"), Ls = Symbol("read"), De = Symbol("flush"), Ns = Symbol("flushChunk"), z$1 = Symbol("encoding"), Mt = Symbol("decoder"), g = Symbol("flowing"), Qt = Symbol("paused"), Bt = Symbol("resume"), b = Symbol("buffer"), D = Symbol("pipes"), _ = Symbol("bufferLength"), gi = Symbol("bufferPush"), Ae = Symbol("bufferShift"), L = Symbol("objectMode"), w = Symbol("destroyed"), bi = Symbol("error"), _i = Symbol("emitData"), Ds = Symbol("emitEnd"), Oi = Symbol("emitEnd2"), Z = Symbol("async"), Ti = Symbol("abort"), Ie = Symbol("aborted"), Jt = Symbol("signal"), Rt = Symbol("dataListeners"), F = Symbol("discarded"), jt = (s) => Promise.resolve().then(s), Wr = (s) => s(), Gr = (s) => s === "end" || s === "finish" || s === "prefinish", Zr = (s) => s instanceof ArrayBuffer || !!s && typeof s == "object" && s.constructor && s.constructor.name === "ArrayBuffer" && s.byteLength >= 0, Yr = (s) => !Buffer.isBuffer(s) && ArrayBuffer.isView(s), Fe = class {
|
|
398
728
|
src;
|
|
399
729
|
dest;
|
|
400
730
|
opts;
|
|
@@ -422,7 +752,7 @@ var xs = typeof process == "object" && process ? process : {
|
|
|
422
752
|
[D] = [];
|
|
423
753
|
[b] = [];
|
|
424
754
|
[L];
|
|
425
|
-
[z];
|
|
755
|
+
[z$1];
|
|
426
756
|
[Z];
|
|
427
757
|
[Mt];
|
|
428
758
|
[q] = !1;
|
|
@@ -441,7 +771,7 @@ var xs = typeof process == "object" && process ? process : {
|
|
|
441
771
|
constructor(...t) {
|
|
442
772
|
let e = t[0] || {};
|
|
443
773
|
if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
|
|
444
|
-
Kr(e) ? (this[L] = !0, this[z] = null) : Vr(e) ? (this[z] = e.encoding, this[L] = !1) : (this[L] = !1, this[z] = null), this[Z] = !!e.async, this[Mt] = this[z] ? new StringDecoder(this[z]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[b] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[D] });
|
|
774
|
+
Kr(e) ? (this[L] = !0, this[z$1] = null) : Vr(e) ? (this[z$1] = e.encoding, this[L] = !1) : (this[L] = !1, this[z$1] = null), this[Z] = !!e.async, this[Mt] = this[z$1] ? new StringDecoder(this[z$1]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[b] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[D] });
|
|
445
775
|
let { signal: i } = e;
|
|
446
776
|
i && (this[Jt] = i, i.aborted ? this[Ti]() : i.addEventListener("abort", () => this[Ti]()));
|
|
447
777
|
}
|
|
@@ -449,7 +779,7 @@ var xs = typeof process == "object" && process ? process : {
|
|
|
449
779
|
return this[_];
|
|
450
780
|
}
|
|
451
781
|
get encoding() {
|
|
452
|
-
return this[z];
|
|
782
|
+
return this[z$1];
|
|
453
783
|
}
|
|
454
784
|
set encoding(t) {
|
|
455
785
|
throw new Error("Encoding must be set at instantiation time");
|
|
@@ -487,12 +817,12 @@ var xs = typeof process == "object" && process ? process : {
|
|
|
487
817
|
else if (Zr(t)) t = Buffer.from(t);
|
|
488
818
|
else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
489
819
|
}
|
|
490
|
-
return this[L] ? (this[g] && this[_] !== 0 && this[De](!0), this[g] ? this.emit("data", t) : this[gi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : t.length ? (typeof t == "string" && !(e === this[z] && !this[Mt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[z] && (t = this[Mt].write(t)), this[g] && this[_] !== 0 && this[De](!0), this[g] ? this.emit("data", t) : this[gi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : (this[_] !== 0 && this.emit("readable"), i && r(i), this[g]);
|
|
820
|
+
return this[L] ? (this[g] && this[_] !== 0 && this[De](!0), this[g] ? this.emit("data", t) : this[gi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : t.length ? (typeof t == "string" && !(e === this[z$1] && !this[Mt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[z$1] && (t = this[Mt].write(t)), this[g] && this[_] !== 0 && this[De](!0), this[g] ? this.emit("data", t) : this[gi](t), this[_] !== 0 && this.emit("readable"), i && r(i), this[g]) : (this[_] !== 0 && this.emit("readable"), i && r(i), this[g]);
|
|
491
821
|
}
|
|
492
822
|
read(t) {
|
|
493
823
|
if (this[w]) return null;
|
|
494
824
|
if (this[F] = !1, this[_] === 0 || t === 0 || t && t > this[_]) return this[Q](), null;
|
|
495
|
-
this[L] && (t = null), this[b].length > 1 && !this[L] && (this[b] = [this[z] ? this[b].join("") : Buffer.concat(this[b], this[_])]);
|
|
825
|
+
this[L] && (t = null), this[b].length > 1 && !this[L] && (this[b] = [this[z$1] ? this[b].join("") : Buffer.concat(this[b], this[_])]);
|
|
496
826
|
let e = this[Ls](t || null, this[b][0]);
|
|
497
827
|
return this[Q](), e;
|
|
498
828
|
}
|
|
@@ -634,7 +964,7 @@ while (this[Ns](this[Ae]()) && this[b].length);
|
|
|
634
964
|
async concat() {
|
|
635
965
|
if (this[L]) throw new Error("cannot concat in objectMode");
|
|
636
966
|
let t = await this.collect();
|
|
637
|
-
return this[z] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
967
|
+
return this[z$1] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
638
968
|
}
|
|
639
969
|
async promise() {
|
|
640
970
|
return new Promise((t, e) => {
|
|
@@ -4127,4 +4457,4 @@ async function prepareRestoreArchive(input) {
|
|
|
4127
4457
|
}
|
|
4128
4458
|
}
|
|
4129
4459
|
//#endregion
|
|
4130
|
-
export { BackupSnapshotRefusedError as a,
|
|
4460
|
+
export { parseBackupSecretKey as _, BackupSnapshotRefusedError as a, backupOrchestratorRecordKinds as c, BackupEncryptionKeyStore as d, BackupDecryptError as f, generateBackupKeyPair as g, ENCRYPTED_BACKUP_SUFFIX as h, BackupCancelledError as i, backupRecordStoresOf as l, BackupKeyMismatchError as m, precheckRestoreKey as n, DEFAULT_BACKUP_DATABASES as o, BackupKeyFormatError as p, prepareRestoreArchive as r, SystemBackupService as s, BackupKeyRequiredError as t, BackupSeedMarkerStore as u, readBackupEncryptionHeader as v };
|
|
@@ -2,26 +2,22 @@
|
|
|
2
2
|
* Which names the hub has certified to which agent (D856): the memory behind "a name
|
|
3
3
|
* already certified to another node is never signed again". Hub only.
|
|
4
4
|
*/
|
|
5
|
-
import type { CollectionColumn, SettingsStoreClient } from "@camstack/types";
|
|
6
|
-
|
|
7
|
-
* @durable class=config owner=system-config
|
|
8
|
-
* write="the hub records the names it signed into an agent's HTTPS leaf, replacing that
|
|
9
|
-
* node's previous row"
|
|
10
|
-
* retention="one row per node, replaced on every issue; a forgotten node's row stays until
|
|
11
|
-
* the node is issued again or an operator clears it (it only blocks reuse of its names)"
|
|
12
|
-
*/
|
|
5
|
+
import type { CollectionColumn, RecordKindHandle, SettingsStoreClient } from "@camstack/types";
|
|
6
|
+
import type { AgentHttpsNameBody } from "../builtins/system-config/record-kinds.js";
|
|
13
7
|
export declare const AGENT_HTTPS_NAMES_COLLECTION = "agent_https_names";
|
|
14
8
|
export declare const AGENT_HTTPS_NAMES_COLUMNS: readonly CollectionColumn[];
|
|
9
|
+
export interface AgentHttpsNamesDeps {
|
|
10
|
+
readonly agentHttpsNamesKind: RecordKindHandle<AgentHttpsNameBody>;
|
|
11
|
+
readonly legacyStore?: SettingsStoreClient;
|
|
12
|
+
}
|
|
15
13
|
export declare class AgentHttpsNames {
|
|
16
|
-
private readonly store;
|
|
17
14
|
private readonly byNode;
|
|
18
|
-
|
|
15
|
+
private readonly kind;
|
|
16
|
+
private readonly store;
|
|
17
|
+
constructor(deps: SettingsStoreClient | AgentHttpsNamesDeps);
|
|
19
18
|
load(): Promise<void>;
|
|
20
|
-
/** The names certified to `nodeId` (its id and the address of its live mesh socket), or `null`. */
|
|
21
19
|
namesOf(nodeId: string): readonly string[] | null;
|
|
22
|
-
/** Every name certified to a node other than `nodeId`. */
|
|
23
20
|
takenByOthers(nodeId: string): ReadonlySet<string>;
|
|
24
|
-
/** Free every name certified to a node that was forgotten. */
|
|
25
21
|
release(nodeId: string): Promise<boolean>;
|
|
26
22
|
record(nodeId: string, names: readonly string[]): Promise<void>;
|
|
27
23
|
}
|
|
Binary file
|
|
Binary file
|