@camstack/system 1.2.347 → 1.2.349

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.
Files changed (80) hide show
  1. package/dist/addon-runner.js +2 -2
  2. package/dist/addon-runner.mjs +2 -2
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/autotrack/index.js +1 -1
  10. package/dist/builtins/autotrack/index.mjs +1 -1
  11. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  12. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  13. package/dist/builtins/calendars/calendar-color.d.ts +5 -0
  14. package/dist/builtins/calendars/calendar-prefs-store.d.ts +13 -0
  15. package/dist/builtins/calendars/calendars.addon.d.ts +4 -1
  16. package/dist/builtins/calendars/calendars.addon.js +143 -23
  17. package/dist/builtins/calendars/calendars.addon.mjs +143 -23
  18. package/dist/builtins/camera-grid/index.js +1 -1
  19. package/dist/builtins/camera-grid/index.mjs +1 -1
  20. package/dist/builtins/composer/composer.addon.js +2 -2
  21. package/dist/builtins/composer/composer.addon.mjs +2 -2
  22. package/dist/builtins/console-logging/index.js +1 -1
  23. package/dist/builtins/console-logging/index.mjs +1 -1
  24. package/dist/builtins/core-blocks/block-package.d.ts +12 -1
  25. package/dist/builtins/core-blocks/block-settings-store.d.ts +25 -0
  26. package/dist/builtins/core-blocks/block-supervisor.d.ts +6 -1
  27. package/dist/builtins/core-blocks/compile-block.d.ts +33 -2
  28. package/dist/builtins/core-blocks/core-block-store.d.ts +5 -0
  29. package/dist/builtins/core-blocks/core-blocks.addon.d.ts +10 -1
  30. package/dist/builtins/core-blocks/core-blocks.addon.js +363 -20
  31. package/dist/builtins/core-blocks/core-blocks.addon.mjs +360 -21
  32. package/dist/builtins/core-blocks/extract-settings-schema.d.ts +6 -0
  33. package/dist/builtins/core-blocks/index.d.ts +3 -1
  34. package/dist/builtins/core-blocks/index.js +3 -0
  35. package/dist/builtins/core-blocks/index.mjs +2 -2
  36. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  37. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  38. package/dist/builtins/hub-forwarder/index.js +1 -1
  39. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  40. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  41. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  42. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  43. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  44. package/dist/builtins/local-network/local-network.addon.js +3 -3
  45. package/dist/builtins/local-network/local-network.addon.mjs +3 -3
  46. package/dist/builtins/loki-logging/index.js +1 -1
  47. package/dist/builtins/loki-logging/index.mjs +1 -1
  48. package/dist/builtins/native-metrics/native-metrics.addon.js +4 -4
  49. package/dist/builtins/native-metrics/native-metrics.addon.mjs +4 -4
  50. package/dist/builtins/platform-probe/index.js +3 -3
  51. package/dist/builtins/platform-probe/index.mjs +2 -2
  52. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  53. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  54. package/dist/builtins/snapshot/index.js +1 -1
  55. package/dist/builtins/snapshot/index.mjs +1 -1
  56. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +2 -2
  57. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +2 -2
  58. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  59. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  60. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  61. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  62. package/dist/builtins/system-config/system-config.addon.js +1 -1
  63. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  64. package/dist/builtins/winston-logging/index.js +1 -1
  65. package/dist/builtins/winston-logging/index.mjs +1 -1
  66. package/dist/{child-cap-dispatch-CVOa1BZI.js → child-cap-dispatch-DiDBYNY4.js} +3 -3
  67. package/dist/{child-cap-dispatch-OLFN-F85.mjs → child-cap-dispatch-Pkx_sEKR.mjs} +3 -3
  68. package/dist/{composition-sources-pQsmMdpR.mjs → composition-sources-DK-hFG7I.mjs} +1 -1
  69. package/dist/{composition-sources-CeZ3tyH8.js → composition-sources-w_NIID5d.js} +1 -1
  70. package/dist/{dist-BUFcHq7H.mjs → dist-C6CPaa8G.mjs} +5646 -5301
  71. package/dist/{dist-DTgd2gOR.js → dist-DvAczrLl.js} +5669 -5300
  72. package/dist/index.js +7 -7
  73. package/dist/index.mjs +6 -6
  74. package/dist/{retired-settings-keys-Ddb5cCNR.js → retired-settings-keys-BQYjCJWI.js} +1 -1
  75. package/dist/{retired-settings-keys-ltKefX3N.mjs → retired-settings-keys-tmMQQ9OH.mjs} +1 -1
  76. package/package.json +1 -1
  77. package/dist/{resource-monitor-B1v6E07R.mjs → resource-monitor-B2WZ8_q9.mjs} +1 -1
  78. package/dist/{resource-monitor-DzNn_IZK.js → resource-monitor-BgWGRxN5.js} +1 -1
  79. package/dist/{tls-DAtaKVUT.mjs → tls-DTlVWwAI.mjs} +1 -1
  80. package/dist/{tls-DEjOOARt.js → tls-ue_Xefmv.js} +1 -1
@@ -16,8 +16,14 @@ export interface MaterializeBlockInput {
16
16
  readonly root: string;
17
17
  readonly blockId: string;
18
18
  readonly blockName: string;
19
- /** The block's transpiled JavaScript. */
19
+ /** The block's bundled / transpiled JavaScript (written to `dist/block.js`). */
20
20
  readonly js: string;
21
+ /**
22
+ * Optional TypeScript sources (path → content). Written under `src/` so a
23
+ * multi-file project is inspectable on disk next to the bundle the runner
24
+ * loads. Absent for a legacy single-file materialize.
25
+ */
26
+ readonly files?: Readonly<Record<string, string>>;
21
27
  }
22
28
  export interface MaterializedBlock {
23
29
  /** What `$process.spawnRunner` gets as `addonDir` — the package root. */
@@ -34,6 +40,11 @@ export declare function renderBlockManifest(blockId: string, blockName: string):
34
40
  * rewrite: the author's code is the thing that changes, and a partial update
35
41
  * that left a stale `block.js` behind would run yesterday's code while the
36
42
  * editor showed today's.
43
+ *
44
+ * Layout:
45
+ * `src/<path>` — author TypeScript when `files` is provided
46
+ * `dist/block.js` — bundled / transpiled entry (what the wrapper imports)
47
+ * `dist/index.js` — generated BaseAddon wrapper
37
48
  */
38
49
  export declare function materializeBlock(input: MaterializeBlockInput): Promise<MaterializedBlock>;
39
50
  /** Remove a block's package. Idempotent — a missing directory is the desired
@@ -0,0 +1,25 @@
1
+ import { SettingsStoreClient } from '@camstack/types';
2
+ export declare const CORE_BLOCK_SETTINGS_COLLECTION = "core-blocks:settings";
3
+ export declare const CORE_BLOCK_SETTINGS_COLUMNS: readonly [{
4
+ readonly name: "id";
5
+ readonly type: "TEXT";
6
+ readonly primaryKey: true;
7
+ readonly notNull: true;
8
+ }, {
9
+ readonly name: "values";
10
+ readonly type: "JSON";
11
+ readonly notNull: true;
12
+ readonly defaultValue: "{}";
13
+ }];
14
+ export interface BlockSettingsStoreDeps {
15
+ readonly store: SettingsStoreClient;
16
+ }
17
+ export declare class BlockSettingsStore {
18
+ private readonly store;
19
+ constructor(deps: BlockSettingsStoreDeps);
20
+ static declare(store: SettingsStoreClient): Promise<void>;
21
+ getValues(blockId: string): Promise<Record<string, unknown>>;
22
+ mergeValues(blockId: string, patch: Record<string, unknown>): Promise<Record<string, unknown>>;
23
+ delete(blockId: string): Promise<void>;
24
+ private mirrorToBlockAddon;
25
+ }
@@ -28,6 +28,11 @@ export interface BlockCompileOutcome {
28
28
  readonly error?: string;
29
29
  readonly js?: string;
30
30
  }
31
+ export interface BlockCompileSource {
32
+ readonly code: string;
33
+ readonly files?: Readonly<Record<string, string>>;
34
+ readonly entry?: string;
35
+ }
31
36
  /** The composer's one verb, as the supervisor needs it. */
32
37
  export interface ComposerPort {
33
38
  apply(input: ComposerApplyInput): Promise<ComposerApplyResult>;
@@ -39,7 +44,7 @@ export interface BlockSupervisorDeps {
39
44
  readonly root: string;
40
45
  readonly store: BlockStoreView;
41
46
  readonly host: BlockProcessHost;
42
- readonly compile: (code: string) => Promise<BlockCompileOutcome>;
47
+ readonly compile: (source: BlockCompileSource) => Promise<BlockCompileOutcome>;
43
48
  readonly logger: IScopedLogger;
44
49
  /** Null when this node exposes no composer, and then every composition says so. */
45
50
  readonly composer: ComposerPort | null;
@@ -1,4 +1,4 @@
1
- import { CoreBlockCompileResult } from '@camstack/types';
1
+ import { CoreBlockCompileResult, DEFAULT_CORE_BLOCK_ENTRY } from '@camstack/types';
2
2
  /** The esbuild surface this needs — injected so the compile is testable and so
3
3
  * the kernel does not hard-depend on a bundler at import time. */
4
4
  export interface BlockTranspiler {
@@ -9,7 +9,37 @@ export interface BlockTranspiler {
9
9
  }): Promise<{
10
10
  code: string;
11
11
  }>;
12
+ /**
13
+ * Multi-file bundle. Absent on a node that only got `transform` (tests that
14
+ * never exercise files); then a files compile answers "unavailable".
15
+ */
16
+ build?(options: BlockBundleOptions): Promise<BlockBundleResult>;
12
17
  }
18
+ export interface BlockBundleOptions {
19
+ readonly absWorkingDir: string;
20
+ readonly entryPoints: readonly string[];
21
+ readonly outfile: string;
22
+ readonly bundle: true;
23
+ readonly format: 'esm';
24
+ readonly platform: 'node';
25
+ readonly target: string;
26
+ readonly write: true;
27
+ readonly logLevel: 'silent';
28
+ }
29
+ export interface BlockBundleResult {
30
+ readonly errors: readonly {
31
+ text: string;
32
+ location?: {
33
+ line: number;
34
+ column: number;
35
+ } | null;
36
+ }[];
37
+ }
38
+ export interface CompileBlockFilesInput {
39
+ readonly files: Readonly<Record<string, string>>;
40
+ readonly entry?: string;
41
+ }
42
+ export type CompileBlockSource = string | CompileBlockFilesInput;
13
43
  export interface CompileBlockResult extends CoreBlockCompileResult {
14
44
  /** The emitted JavaScript, when it compiled. */
15
45
  readonly js?: string;
@@ -18,4 +48,5 @@ export interface CompileBlockResult extends CoreBlockCompileResult {
18
48
  * Never throws. A compile failure is an ANSWER — the author needs to read it,
19
49
  * and a thrown error at this layer becomes a 500 with the useful part buried.
20
50
  */
21
- export declare function compileBlock(transpiler: BlockTranspiler, code: string): Promise<CompileBlockResult>;
51
+ export declare function compileBlock(transpiler: BlockTranspiler, source: CompileBlockSource): Promise<CompileBlockResult>;
52
+ export { DEFAULT_CORE_BLOCK_ENTRY };
@@ -120,4 +120,9 @@ export declare class CoreBlockStore {
120
120
  /** Idempotent delete — an unknown id is a no-op. */
121
121
  delete(blockId: string): Promise<void>;
122
122
  private persist;
123
+ /**
124
+ * Resolve a source-affecting patch into the normalized `{ code, files?, entry? }`
125
+ * that will be stored. `null` when the patch does not touch source.
126
+ */
127
+ private normalizeSourcePatch;
123
128
  }
@@ -9,6 +9,7 @@ export declare class CoreBlocksAddon extends BaseAddon {
9
9
  */
10
10
  constructor();
11
11
  private store;
12
+ private prefs;
12
13
  private transpiler;
13
14
  private typeDefs;
14
15
  private supervisor;
@@ -47,13 +48,21 @@ export declare class CoreBlocksAddon extends BaseAddon {
47
48
  private convergeSoon;
48
49
  private requireStore;
49
50
  /**
50
- * Compile, or explain why not.
51
+ * Compile, or explain why not. Returns the emitted JS so a successful gate
52
+ * can also extract `settingsSchema` without compiling twice.
51
53
  *
52
54
  * A missing transpiler REFUSES the write rather than waving it through: code
53
55
  * that reached disk uncompiled is code the runner will fail on, far from the
54
56
  * person who wrote it.
55
57
  */
56
58
  private gate;
59
+ private requirePrefs;
60
+ /**
61
+ * After a successful compile, cache the entry's `settingsSchema` export on
62
+ * the block when the author did not set one by hand. Never overwrites an
63
+ * explicit schema the editor already stored.
64
+ */
65
+ private maybeCacheSettingsSchema;
57
66
  private buildProvider;
58
67
  /**
59
68
  * The composition methods (D659), flat. Sources and existing targets are read