@anchrd/intel-contract 0.13.0 → 0.14.0
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/contract/bundle.d.ts +85 -0
- package/dist/contract/bundle.js +63 -0
- package/dist/contract/contract.d.ts +3 -2245
- package/dist/contract/contract.js +24 -1108
- package/dist/contract/flow-run.d.ts +346 -0
- package/dist/contract/flow-run.js +181 -0
- package/dist/contract/flow.d.ts +995 -0
- package/dist/contract/flow.js +417 -0
- package/dist/contract/node.d.ts +402 -0
- package/dist/contract/node.js +286 -0
- package/dist/contract/share.d.ts +142 -0
- package/dist/contract/share.js +67 -0
- package/dist/contract/table.d.ts +162 -0
- package/dist/contract/table.js +117 -0
- package/dist/contract/tool.d.ts +122 -0
- package/dist/contract/tool.js +172 -0
- package/package.json +29 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const BundleManifestFilename = "manifest.json";
|
|
3
|
+
/**
|
|
4
|
+
* What a bundle entry can be. `flow` joins the node kinds because a flow shares the folder tree
|
|
5
|
+
* without being a node (ADR-0004), and the bundle mirrors the tree, not the tables.
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ `agent` and `board` are STILL HERE, and that is the one place in this file where a value
|
|
8
|
+
* survives its feature (#390). A bundle is somebody else's file: an export written before Agents
|
|
9
|
+
* and Board were parked (#385) is a correct export, and it has to PARSE so the import can refuse it
|
|
10
|
+
* by name — with the entry, the kind and the branch the code is on. Take them out and the same
|
|
11
|
+
* bundle fails as `unexpected enum value`, which sends its holder looking for a broken file that is
|
|
12
|
+
* not broken.
|
|
13
|
+
*
|
|
14
|
+
* They belong to the wire format of a file that already exists, not to the product. Nothing may
|
|
15
|
+
* create either kind; `NodeKind` is the enum that says so.
|
|
16
|
+
*/
|
|
17
|
+
export declare const BundleEntryKind: z.ZodEnum<{
|
|
18
|
+
folder: "folder";
|
|
19
|
+
document: "document";
|
|
20
|
+
table: "table";
|
|
21
|
+
attachment: "attachment";
|
|
22
|
+
agent: "agent";
|
|
23
|
+
board: "board";
|
|
24
|
+
flow: "flow";
|
|
25
|
+
}>;
|
|
26
|
+
export type BundleEntryKind = z.infer<typeof BundleEntryKind>;
|
|
27
|
+
export declare const BundleManifestEntry: z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
kind: z.ZodEnum<{
|
|
30
|
+
folder: "folder";
|
|
31
|
+
document: "document";
|
|
32
|
+
table: "table";
|
|
33
|
+
attachment: "attachment";
|
|
34
|
+
agent: "agent";
|
|
35
|
+
board: "board";
|
|
36
|
+
flow: "flow";
|
|
37
|
+
}>;
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
description: z.ZodNullable<z.ZodString>;
|
|
40
|
+
mediaType: z.ZodNullable<z.ZodString>;
|
|
41
|
+
path: z.ZodString;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
export type BundleManifestEntry = z.infer<typeof BundleManifestEntry>;
|
|
44
|
+
export declare const BundleExclusion: z.ZodEnum<{
|
|
45
|
+
"version-history": "version-history";
|
|
46
|
+
grants: "grants";
|
|
47
|
+
"flow-runs": "flow-runs";
|
|
48
|
+
"archived-nodes": "archived-nodes";
|
|
49
|
+
}>;
|
|
50
|
+
export type BundleExclusion = z.infer<typeof BundleExclusion>;
|
|
51
|
+
export declare const BundleManifest: z.ZodObject<{
|
|
52
|
+
version: z.ZodLiteral<1>;
|
|
53
|
+
exportedAt: z.ZodISODateTime;
|
|
54
|
+
rootId: z.ZodNullable<z.ZodString>;
|
|
55
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
kind: z.ZodEnum<{
|
|
58
|
+
folder: "folder";
|
|
59
|
+
document: "document";
|
|
60
|
+
table: "table";
|
|
61
|
+
attachment: "attachment";
|
|
62
|
+
agent: "agent";
|
|
63
|
+
board: "board";
|
|
64
|
+
flow: "flow";
|
|
65
|
+
}>;
|
|
66
|
+
title: z.ZodString;
|
|
67
|
+
description: z.ZodNullable<z.ZodString>;
|
|
68
|
+
mediaType: z.ZodNullable<z.ZodString>;
|
|
69
|
+
path: z.ZodString;
|
|
70
|
+
}, z.core.$strict>>;
|
|
71
|
+
excluded: z.ZodArray<z.ZodEnum<{
|
|
72
|
+
"version-history": "version-history";
|
|
73
|
+
grants: "grants";
|
|
74
|
+
"flow-runs": "flow-runs";
|
|
75
|
+
"archived-nodes": "archived-nodes";
|
|
76
|
+
}>>;
|
|
77
|
+
}, z.core.$strict>;
|
|
78
|
+
export type BundleManifest = z.infer<typeof BundleManifest>;
|
|
79
|
+
export declare const BundleImportResult: z.ZodObject<{
|
|
80
|
+
nodes: z.ZodNumber;
|
|
81
|
+
flows: z.ZodNumber;
|
|
82
|
+
rootNodeIds: z.ZodArray<z.ZodString>;
|
|
83
|
+
replayed: z.ZodBoolean;
|
|
84
|
+
}, z.core.$strict>;
|
|
85
|
+
export type BundleImportResult = z.infer<typeof BundleImportResult>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { IntelId, IsoDateTime } from "./contract.js";
|
|
3
|
+
// ── Bundle export (#136) ────────────────────────────────────────────────────────────────────────
|
|
4
|
+
// The one name the importer looks for at the zip root. A different spelling would make a bundle a
|
|
5
|
+
// naked folder, so the constant lives in the contract rather than in each surface.
|
|
6
|
+
export const BundleManifestFilename = "manifest.json";
|
|
7
|
+
/**
|
|
8
|
+
* What a bundle entry can be. `flow` joins the node kinds because a flow shares the folder tree
|
|
9
|
+
* without being a node (ADR-0004), and the bundle mirrors the tree, not the tables.
|
|
10
|
+
*
|
|
11
|
+
* ⚠️ `agent` and `board` are STILL HERE, and that is the one place in this file where a value
|
|
12
|
+
* survives its feature (#390). A bundle is somebody else's file: an export written before Agents
|
|
13
|
+
* and Board were parked (#385) is a correct export, and it has to PARSE so the import can refuse it
|
|
14
|
+
* by name — with the entry, the kind and the branch the code is on. Take them out and the same
|
|
15
|
+
* bundle fails as `unexpected enum value`, which sends its holder looking for a broken file that is
|
|
16
|
+
* not broken.
|
|
17
|
+
*
|
|
18
|
+
* They belong to the wire format of a file that already exists, not to the product. Nothing may
|
|
19
|
+
* create either kind; `NodeKind` is the enum that says so.
|
|
20
|
+
*/
|
|
21
|
+
export const BundleEntryKind = z.enum([
|
|
22
|
+
"folder",
|
|
23
|
+
"document",
|
|
24
|
+
"table",
|
|
25
|
+
"attachment",
|
|
26
|
+
"agent",
|
|
27
|
+
"board",
|
|
28
|
+
"flow",
|
|
29
|
+
]);
|
|
30
|
+
// One entry of the manifest: the identity a re-import needs, next to the relative path where the
|
|
31
|
+
// bytes sit in the zip. A folder carries no media type — it has no bytes.
|
|
32
|
+
export const BundleManifestEntry = z.strictObject({
|
|
33
|
+
id: IntelId,
|
|
34
|
+
kind: BundleEntryKind,
|
|
35
|
+
title: z.string().min(1).max(240),
|
|
36
|
+
description: z.string().max(2_000).nullable(),
|
|
37
|
+
mediaType: z.string().min(1).max(160).nullable(),
|
|
38
|
+
// Relative to the zip root, forward slashes, no leading slash. Folders end with a slash so an
|
|
39
|
+
// empty folder still has an address.
|
|
40
|
+
path: z.string().min(1).max(4_000),
|
|
41
|
+
});
|
|
42
|
+
// What an export leaves out on purpose, named so a bundle says it rather than a reader guessing:
|
|
43
|
+
// version history, grants/shares, flow runs, and archived nodes are not in any bundle (#136).
|
|
44
|
+
export const BundleExclusion = z.enum(["version-history", "grants", "flow-runs", "archived-nodes"]);
|
|
45
|
+
export const BundleManifest = z.strictObject({
|
|
46
|
+
version: z.literal(1),
|
|
47
|
+
exportedAt: IsoDateTime,
|
|
48
|
+
// The node the export started at; `null` is the root of the tree — the whole installation as the
|
|
49
|
+
// exporting caller may read it.
|
|
50
|
+
rootId: IntelId.nullable(),
|
|
51
|
+
entries: z.array(BundleManifestEntry),
|
|
52
|
+
excluded: z.array(BundleExclusion),
|
|
53
|
+
});
|
|
54
|
+
// ── Bundle import (#137) ────────────────────────────────────────────────────────────────────────
|
|
55
|
+
// What one import made. Import always creates new nodes — no merge, no overwrite, no restored IDs
|
|
56
|
+
// (#137, phase 1) — so the answer is counts and the new roots, never a diff. `replayed` marks the
|
|
57
|
+
// idempotent second answer to the same key: nothing was created twice.
|
|
58
|
+
export const BundleImportResult = z.strictObject({
|
|
59
|
+
nodes: z.number().int().nonnegative(),
|
|
60
|
+
flows: z.number().int().nonnegative(),
|
|
61
|
+
rootNodeIds: z.array(IntelId),
|
|
62
|
+
replayed: z.boolean(),
|
|
63
|
+
});
|