@procedures/snapshot 0.1.0 → 0.2.1
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 +37 -0
- package/README.md +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts +7 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +19 -1
- package/dist/module.js.map +1 -1
- package/dist/register.d.ts +3 -4
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +4 -9
- package/dist/register.js.map +1 -1
- package/package.json +11 -8
- package/src/index.ts +1 -2
- package/src/module.ts +20 -1
- package/src/register.ts +4 -10
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - medium: + node_modules (~2GB)
|
|
10
10
|
* - heavy: + pnpm store (~10GB+)
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
export * from "./module.js";
|
|
13
13
|
export type { SnapshotPreset, RepositoryInfo, SnapshotMetadata, SnapshotCreateInput, SnapshotCreateOutput, SnapshotRestoreInput, SnapshotRestoreOutput, SnapshotListInput, SnapshotListOutput, SnapshotListEntry, SnapshotDiffInput, SnapshotDiffOutput, SnapshotDiffRepository, SnapshotDeleteInput, SnapshotDeleteOutput, } from "./types.js";
|
|
14
14
|
export { SnapshotPresetSchema, SnapshotCreateInputSchema, SnapshotRestoreInputSchema, SnapshotListInputSchema, SnapshotDiffInputSchema, SnapshotDeleteInputSchema, } from "./types.js";
|
|
15
15
|
export { snapshotCreate, snapshotList, snapshotRestore, snapshotDiff, snapshotDelete, } from "./procedures/snapshot/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,aAAa,CAAC;AAG5B,YAAY,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,cAAc,EACd,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,cAAc,GACf,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
* - medium: + node_modules (~2GB)
|
|
10
10
|
* - heavy: + pnpm store (~10GB+)
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
import "./register.js";
|
|
12
|
+
export * from "./module.js";
|
|
14
13
|
// Re-export schemas
|
|
15
14
|
export { SnapshotPresetSchema, SnapshotCreateInputSchema, SnapshotRestoreInputSchema, SnapshotListInputSchema, SnapshotDiffInputSchema, SnapshotDeleteInputSchema, } from "./types.js";
|
|
16
15
|
// Re-export procedure implementations
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,aAAa,CAAC;AAqB5B,oBAAoB;AACpB,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAEpB,sCAAsC;AACtC,OAAO,EACL,cAAc,EACd,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,cAAc,GACf,MAAM,gCAAgC,CAAC"}
|
package/dist/module.d.ts
CHANGED
|
@@ -5,11 +5,17 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Provides snapshot.create, snapshot.list, snapshot.restore, snapshot.diff, snapshot.delete procedures.
|
|
7
7
|
*/
|
|
8
|
-
import { type ProcedureModule } from "@procedures/client";
|
|
8
|
+
import { type ProcedureModule, type ProcedureRegistry } from "@procedures/client";
|
|
9
9
|
/**
|
|
10
10
|
* The module of this package, for `createRegistry()`: its procedures as data. Importing this
|
|
11
11
|
* file registers nothing. (`register.ts` registers the same procedures in the global registry.)
|
|
12
12
|
*/
|
|
13
13
|
export declare const snapshotModule: ProcedureModule;
|
|
14
14
|
export default snapshotModule;
|
|
15
|
+
/**
|
|
16
|
+
* This function registers the procedures of @procedures/snapshot, and of the modules that it requires, in
|
|
17
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
18
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerSnapshotProcedures(registry?: ProcedureRegistry): void;
|
|
15
21
|
//# sourceMappingURL=module.d.ts.map
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA6C,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA6C,KAAK,eAAe,EAAuC,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AA6HlK;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,eAMzB,CAAC;eAEU,cAAc;AAE7B;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,GAAE,iBAAsC,GAAG,IAAI,CAEjG"}
|
package/dist/module.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Provides snapshot.create, snapshot.list, snapshot.restore, snapshot.diff, snapshot.delete procedures.
|
|
7
7
|
*/
|
|
8
|
-
import { createProcedure, zodAdapter, defineModule } from "@procedures/client";
|
|
8
|
+
import { createProcedure, zodAdapter, defineModule, PROCEDURE_REGISTRY, registerModules } from "@procedures/client";
|
|
9
9
|
import { snapshotCreate, snapshotList, snapshotRestore, snapshotDiff, snapshotDelete, } from "./procedures/snapshot/index.js";
|
|
10
10
|
import { SnapshotCreateInputSchema, SnapshotListInputSchema, SnapshotRestoreInputSchema, SnapshotDiffInputSchema, SnapshotDeleteInputSchema, SnapshotCreateOutputSchema, SnapshotRestoreOutputSchema, SnapshotListOutputSchema, SnapshotDiffOutputSchema, SnapshotDeleteOutputSchema, } from "./types.js";
|
|
11
11
|
// =============================================================================
|
|
@@ -17,6 +17,9 @@ const snapshotCreateProcedure = createProcedure()
|
|
|
17
17
|
.output(zodAdapter(SnapshotCreateOutputSchema))
|
|
18
18
|
.meta({
|
|
19
19
|
description: "Create environment snapshot and upload to S3",
|
|
20
|
+
// It writes the archive to a new folder of the temporary directory and to new S3 keys with a
|
|
21
|
+
// unique id, so it replaces no data
|
|
22
|
+
effects: { reads: ["fs", "s3", "network"], writes: ["fs", "s3", "network"], destructive: false },
|
|
20
23
|
args: ["name"],
|
|
21
24
|
shorts: { bucket: "b", preset: "p", description: "d" },
|
|
22
25
|
output: "json",
|
|
@@ -31,6 +34,8 @@ const snapshotListProcedure = createProcedure()
|
|
|
31
34
|
.output(zodAdapter(SnapshotListOutputSchema))
|
|
32
35
|
.meta({
|
|
33
36
|
description: "List available snapshots in S3 bucket",
|
|
37
|
+
// It downloads the metadata files into memory, not to a file
|
|
38
|
+
effects: { reads: ["s3", "network"], writes: [] },
|
|
34
39
|
args: [],
|
|
35
40
|
shorts: { bucket: "b", prefix: "p", maxResults: "n" },
|
|
36
41
|
output: "json",
|
|
@@ -45,6 +50,8 @@ const snapshotRestoreProcedure = createProcedure()
|
|
|
45
50
|
.output(zodAdapter(SnapshotRestoreOutputSchema))
|
|
46
51
|
.meta({
|
|
47
52
|
description: "Restore environment from S3 snapshot",
|
|
53
|
+
// With overwrite: true, a restored folder replaces the existing folder
|
|
54
|
+
effects: { reads: ["fs", "s3", "network"], writes: ["fs"] },
|
|
48
55
|
args: ["id"],
|
|
49
56
|
shorts: { bucket: "b", targetPath: "t", overwrite: "f" },
|
|
50
57
|
output: "json",
|
|
@@ -59,6 +66,8 @@ const snapshotDiffProcedure = createProcedure()
|
|
|
59
66
|
.output(zodAdapter(SnapshotDiffOutputSchema))
|
|
60
67
|
.meta({
|
|
61
68
|
description: "Compare current state against a snapshot",
|
|
69
|
+
// It reads the repositories with git queries that change nothing
|
|
70
|
+
effects: { reads: ["fs", "s3", "network"], writes: [] },
|
|
62
71
|
args: ["id"],
|
|
63
72
|
shorts: { bucket: "b" },
|
|
64
73
|
output: "json",
|
|
@@ -73,6 +82,7 @@ const snapshotDeleteProcedure = createProcedure()
|
|
|
73
82
|
.output(zodAdapter(SnapshotDeleteOutputSchema))
|
|
74
83
|
.meta({
|
|
75
84
|
description: "Delete a snapshot from S3",
|
|
85
|
+
effects: { reads: ["s3", "network"], writes: ["s3", "network"] },
|
|
76
86
|
args: ["id"],
|
|
77
87
|
shorts: { bucket: "b" },
|
|
78
88
|
output: "json",
|
|
@@ -96,4 +106,12 @@ export const snapshotModule = defineModule("@procedures/snapshot", [
|
|
|
96
106
|
snapshotDeleteProcedure,
|
|
97
107
|
]);
|
|
98
108
|
export default snapshotModule;
|
|
109
|
+
/**
|
|
110
|
+
* This function registers the procedures of @procedures/snapshot, and of the modules that it requires, in
|
|
111
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
112
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
113
|
+
*/
|
|
114
|
+
export function registerSnapshotProcedures(registry = PROCEDURE_REGISTRY) {
|
|
115
|
+
registerModules(registry, [snapshotModule]);
|
|
116
|
+
}
|
|
99
117
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAwB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAwB,kBAAkB,EAAE,eAAe,EAA0B,MAAM,oBAAoB,CAAC;AAElK,OAAO,EACL,cAAc,EACd,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,cAAc,GACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EAWzB,0BAA0B,EAC1B,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AAEpB,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,MAAM,uBAAuB,GAAG,eAAe,EAAE;KAC9C,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;KAC5B,KAAK,CAAC,UAAU,CAAsB,yBAAyB,CAAC,CAAC;KACjE,MAAM,CAAC,UAAU,CAAuB,0BAA0B,CAAC,CAAC;KACpE,IAAI,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ot
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Importing this file registers the procedures of @procedures/snapshot, and of the modules that it
|
|
3
|
+
* requires, in the global registry: `import "@procedures/snapshot/register"`. The package root and the
|
|
4
|
+
* `./module` entry register nothing (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
5
5
|
*/
|
|
6
6
|
export * from "./module.js";
|
|
7
|
-
export declare function registerSnapshotProcedures(): void;
|
|
8
7
|
//# sourceMappingURL=register.d.ts.map
|
package/dist/register.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,cAAc,aAAa,CAAC"}
|
package/dist/register.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Importing this file registers the procedures of @procedures/snapshot
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Importing this file registers the procedures of @procedures/snapshot, and of the modules that it
|
|
3
|
+
* requires, in the global registry: `import "@procedures/snapshot/register"`. The package root and the
|
|
4
|
+
* `./module` entry register nothing (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { snapshotModule } from "./module.js";
|
|
6
|
+
import { registerSnapshotProcedures } from "./module.js";
|
|
8
7
|
export * from "./module.js";
|
|
9
|
-
export function registerSnapshotProcedures() {
|
|
10
|
-
registerProcedures(snapshotModule.procedures);
|
|
11
|
-
}
|
|
12
|
-
// Auto-register when this module is loaded
|
|
13
8
|
registerSnapshotProcedures();
|
|
14
9
|
//# sourceMappingURL=register.js.map
|
package/dist/register.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzD,cAAc,aAAa,CAAC;AAE5B,0BAA0B,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@procedures/snapshot",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "Snapshot and restore development environments with S3: git state, packages and files, with streamed archives and a safe restore.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"snapshot",
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
"types": "./dist/module.d.ts",
|
|
35
35
|
"import": "./dist/module.js"
|
|
36
36
|
},
|
|
37
|
+
"./register": {
|
|
38
|
+
"types": "./dist/register.d.ts",
|
|
39
|
+
"import": "./dist/register.js"
|
|
40
|
+
},
|
|
37
41
|
"./register.js": {
|
|
38
42
|
"import": "./dist/register.js"
|
|
39
43
|
}
|
|
@@ -47,7 +51,6 @@
|
|
|
47
51
|
"CHANGELOG.md"
|
|
48
52
|
],
|
|
49
53
|
"sideEffects": [
|
|
50
|
-
"./dist/index.js",
|
|
51
54
|
"./dist/register.js"
|
|
52
55
|
],
|
|
53
56
|
"engines": {
|
|
@@ -58,12 +61,12 @@
|
|
|
58
61
|
"provenance": true
|
|
59
62
|
},
|
|
60
63
|
"dependencies": {
|
|
61
|
-
"@procedures/client": "0.1
|
|
62
|
-
"@procedures/fs": "0.1
|
|
63
|
-
"@procedures/git": "0.1
|
|
64
|
-
"@procedures/pnpm": "0.1
|
|
65
|
-
"@procedures/s3": "0.1
|
|
66
|
-
"@procedures/shell": "0.1
|
|
64
|
+
"@procedures/client": "0.2.1",
|
|
65
|
+
"@procedures/fs": "0.2.1",
|
|
66
|
+
"@procedures/git": "0.2.1",
|
|
67
|
+
"@procedures/pnpm": "0.2.1",
|
|
68
|
+
"@procedures/s3": "0.2.1",
|
|
69
|
+
"@procedures/shell": "0.2.1",
|
|
67
70
|
"tar": "^7.5.0",
|
|
68
71
|
"zod": "^4.6.5"
|
|
69
72
|
},
|
package/src/index.ts
CHANGED
package/src/module.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Provides snapshot.create, snapshot.list, snapshot.restore, snapshot.diff, snapshot.delete procedures.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { createProcedure, zodAdapter, defineModule, type ProcedureModule } from "@procedures/client";
|
|
9
|
+
import { createProcedure, zodAdapter, defineModule, type ProcedureModule, PROCEDURE_REGISTRY, registerModules, type ProcedureRegistry } from "@procedures/client";
|
|
10
10
|
import type { ProcedureContext } from "@procedures/client";
|
|
11
11
|
import {
|
|
12
12
|
snapshotCreate,
|
|
@@ -48,6 +48,9 @@ const snapshotCreateProcedure = createProcedure()
|
|
|
48
48
|
.output(zodAdapter<SnapshotCreateOutput>(SnapshotCreateOutputSchema))
|
|
49
49
|
.meta({
|
|
50
50
|
description: "Create environment snapshot and upload to S3",
|
|
51
|
+
// It writes the archive to a new folder of the temporary directory and to new S3 keys with a
|
|
52
|
+
// unique id, so it replaces no data
|
|
53
|
+
effects: { reads: ["fs", "s3", "network"], writes: ["fs", "s3", "network"], destructive: false },
|
|
51
54
|
args: ["name"],
|
|
52
55
|
shorts: { bucket: "b", preset: "p", description: "d" },
|
|
53
56
|
output: "json",
|
|
@@ -63,6 +66,8 @@ const snapshotListProcedure = createProcedure()
|
|
|
63
66
|
.output(zodAdapter<SnapshotListOutput>(SnapshotListOutputSchema))
|
|
64
67
|
.meta({
|
|
65
68
|
description: "List available snapshots in S3 bucket",
|
|
69
|
+
// It downloads the metadata files into memory, not to a file
|
|
70
|
+
effects: { reads: ["s3", "network"], writes: [] },
|
|
66
71
|
args: [],
|
|
67
72
|
shorts: { bucket: "b", prefix: "p", maxResults: "n" },
|
|
68
73
|
output: "json",
|
|
@@ -78,6 +83,8 @@ const snapshotRestoreProcedure = createProcedure()
|
|
|
78
83
|
.output(zodAdapter<SnapshotRestoreOutput>(SnapshotRestoreOutputSchema))
|
|
79
84
|
.meta({
|
|
80
85
|
description: "Restore environment from S3 snapshot",
|
|
86
|
+
// With overwrite: true, a restored folder replaces the existing folder
|
|
87
|
+
effects: { reads: ["fs", "s3", "network"], writes: ["fs"] },
|
|
81
88
|
args: ["id"],
|
|
82
89
|
shorts: { bucket: "b", targetPath: "t", overwrite: "f" },
|
|
83
90
|
output: "json",
|
|
@@ -93,6 +100,8 @@ const snapshotDiffProcedure = createProcedure()
|
|
|
93
100
|
.output(zodAdapter<SnapshotDiffOutput>(SnapshotDiffOutputSchema))
|
|
94
101
|
.meta({
|
|
95
102
|
description: "Compare current state against a snapshot",
|
|
103
|
+
// It reads the repositories with git queries that change nothing
|
|
104
|
+
effects: { reads: ["fs", "s3", "network"], writes: [] },
|
|
96
105
|
args: ["id"],
|
|
97
106
|
shorts: { bucket: "b" },
|
|
98
107
|
output: "json",
|
|
@@ -108,6 +117,7 @@ const snapshotDeleteProcedure = createProcedure()
|
|
|
108
117
|
.output(zodAdapter<SnapshotDeleteOutput>(SnapshotDeleteOutputSchema))
|
|
109
118
|
.meta({
|
|
110
119
|
description: "Delete a snapshot from S3",
|
|
120
|
+
effects: { reads: ["s3", "network"], writes: ["s3", "network"] },
|
|
111
121
|
args: ["id"],
|
|
112
122
|
shorts: { bucket: "b" },
|
|
113
123
|
output: "json",
|
|
@@ -134,3 +144,12 @@ export const snapshotModule: ProcedureModule = defineModule("@procedures/snapsho
|
|
|
134
144
|
]);
|
|
135
145
|
|
|
136
146
|
export default snapshotModule;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* This function registers the procedures of @procedures/snapshot, and of the modules that it requires, in
|
|
150
|
+
* a registry. The default is the global registry. Importing this file registers nothing: the
|
|
151
|
+
* `./register` entry starts this function (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
152
|
+
*/
|
|
153
|
+
export function registerSnapshotProcedures(registry: ProcedureRegistry = PROCEDURE_REGISTRY): void {
|
|
154
|
+
registerModules(registry, [snapshotModule]);
|
|
155
|
+
}
|
package/src/register.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Importing this file registers the procedures of @procedures/snapshot
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Importing this file registers the procedures of @procedures/snapshot, and of the modules that it
|
|
3
|
+
* requires, in the global registry: `import "@procedures/snapshot/register"`. The package root and the
|
|
4
|
+
* `./module` entry register nothing (ARCHITECTURE-PROPOSALS-2026-10, P9).
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { snapshotModule } from "./module.js";
|
|
7
|
+
import { registerSnapshotProcedures } from "./module.js";
|
|
9
8
|
|
|
10
9
|
export * from "./module.js";
|
|
11
10
|
|
|
12
|
-
export function registerSnapshotProcedures(): void {
|
|
13
|
-
registerProcedures(snapshotModule.procedures);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Auto-register when this module is loaded
|
|
17
11
|
registerSnapshotProcedures();
|