@fluidgrids/cli 2026.1021.1 → 2026.1028.2
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/README.md +157 -5
- package/dist/auth/device-login.d.ts +31 -0
- package/dist/auth/device-login.d.ts.map +1 -0
- package/dist/auth/device-login.js +75 -0
- package/dist/auth/device-login.js.map +1 -0
- package/dist/auth/token-auth.d.ts +49 -0
- package/dist/auth/token-auth.d.ts.map +1 -0
- package/dist/auth/token-auth.js +279 -0
- package/dist/auth/token-auth.js.map +1 -0
- package/dist/cli.d.ts +4 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +18 -32
- package/dist/cli.js.map +1 -1
- package/dist/code-first/api.d.ts +357 -0
- package/dist/code-first/api.d.ts.map +1 -0
- package/dist/code-first/api.js +288 -0
- package/dist/code-first/api.js.map +1 -0
- package/dist/code-first/code-upload.d.ts +52 -0
- package/dist/code-first/code-upload.d.ts.map +1 -0
- package/dist/code-first/code-upload.js +161 -0
- package/dist/code-first/code-upload.js.map +1 -0
- package/dist/code-first/commands/codegen.d.ts +20 -0
- package/dist/code-first/commands/codegen.d.ts.map +1 -0
- package/dist/code-first/commands/codegen.js +50 -0
- package/dist/code-first/commands/codegen.js.map +1 -0
- package/dist/code-first/commands/diff.d.ts +28 -0
- package/dist/code-first/commands/diff.d.ts.map +1 -0
- package/dist/code-first/commands/diff.js +73 -0
- package/dist/code-first/commands/diff.js.map +1 -0
- package/dist/code-first/commands/hotfix.d.ts +54 -0
- package/dist/code-first/commands/hotfix.d.ts.map +1 -0
- package/dist/code-first/commands/hotfix.js +225 -0
- package/dist/code-first/commands/hotfix.js.map +1 -0
- package/dist/code-first/commands/import.d.ts +40 -0
- package/dist/code-first/commands/import.d.ts.map +1 -0
- package/dist/code-first/commands/import.js +235 -0
- package/dist/code-first/commands/import.js.map +1 -0
- package/dist/code-first/commands/init.d.ts +33 -0
- package/dist/code-first/commands/init.d.ts.map +1 -0
- package/dist/code-first/commands/init.js +177 -0
- package/dist/code-first/commands/init.js.map +1 -0
- package/dist/code-first/commands/interface.d.ts +12 -0
- package/dist/code-first/commands/interface.d.ts.map +1 -0
- package/dist/code-first/commands/interface.js +21 -0
- package/dist/code-first/commands/interface.js.map +1 -0
- package/dist/code-first/commands/pull.d.ts +63 -0
- package/dist/code-first/commands/pull.d.ts.map +1 -0
- package/dist/code-first/commands/pull.js +266 -0
- package/dist/code-first/commands/pull.js.map +1 -0
- package/dist/code-first/commands/push.d.ts +97 -0
- package/dist/code-first/commands/push.d.ts.map +1 -0
- package/dist/code-first/commands/push.js +313 -0
- package/dist/code-first/commands/push.js.map +1 -0
- package/dist/code-first/commands/replay.d.ts +44 -0
- package/dist/code-first/commands/replay.d.ts.map +1 -0
- package/dist/code-first/commands/replay.js +238 -0
- package/dist/code-first/commands/replay.js.map +1 -0
- package/dist/code-first/commands/runs.d.ts +94 -0
- package/dist/code-first/commands/runs.d.ts.map +1 -0
- package/dist/code-first/commands/runs.js +304 -0
- package/dist/code-first/commands/runs.js.map +1 -0
- package/dist/code-first/commands/validate.d.ts +38 -0
- package/dist/code-first/commands/validate.d.ts.map +1 -0
- package/dist/code-first/commands/validate.js +140 -0
- package/dist/code-first/commands/validate.js.map +1 -0
- package/dist/code-first/commands/versions.d.ts +14 -0
- package/dist/code-first/commands/versions.d.ts.map +1 -0
- package/dist/code-first/commands/versions.js +30 -0
- package/dist/code-first/commands/versions.js.map +1 -0
- package/dist/code-first/connections.d.ts +55 -0
- package/dist/code-first/connections.d.ts.map +1 -0
- package/dist/code-first/connections.js +180 -0
- package/dist/code-first/connections.js.map +1 -0
- package/dist/code-first/durable-operations.d.ts +42 -0
- package/dist/code-first/durable-operations.d.ts.map +1 -0
- package/dist/code-first/durable-operations.js +136 -0
- package/dist/code-first/durable-operations.js.map +1 -0
- package/dist/code-first/history.d.ts +30 -0
- package/dist/code-first/history.d.ts.map +1 -0
- package/dist/code-first/history.js +139 -0
- package/dist/code-first/history.js.map +1 -0
- package/dist/code-first/imports.d.ts +22 -0
- package/dist/code-first/imports.d.ts.map +1 -0
- package/dist/code-first/imports.js +67 -0
- package/dist/code-first/imports.js.map +1 -0
- package/dist/code-first/index.d.ts +17 -0
- package/dist/code-first/index.d.ts.map +1 -0
- package/dist/code-first/index.js +35 -0
- package/dist/code-first/index.js.map +1 -0
- package/dist/code-first/lowering.d.ts +81 -0
- package/dist/code-first/lowering.d.ts.map +1 -0
- package/dist/code-first/lowering.js +225 -0
- package/dist/code-first/lowering.js.map +1 -0
- package/dist/code-first/operations.d.ts +57 -0
- package/dist/code-first/operations.d.ts.map +1 -0
- package/dist/code-first/operations.js +167 -0
- package/dist/code-first/operations.js.map +1 -0
- package/dist/code-first/presigned.d.ts +21 -0
- package/dist/code-first/presigned.d.ts.map +1 -0
- package/dist/code-first/presigned.js +85 -0
- package/dist/code-first/presigned.js.map +1 -0
- package/dist/code-first/project.d.ts +123 -0
- package/dist/code-first/project.d.ts.map +1 -0
- package/dist/code-first/project.js +301 -0
- package/dist/code-first/project.js.map +1 -0
- package/dist/code-first/python.d.ts +81 -0
- package/dist/code-first/python.d.ts.map +1 -0
- package/dist/code-first/python.js +249 -0
- package/dist/code-first/python.js.map +1 -0
- package/dist/code-first/register.d.ts +27 -0
- package/dist/code-first/register.d.ts.map +1 -0
- package/dist/code-first/register.js +270 -0
- package/dist/code-first/register.js.map +1 -0
- package/dist/code-first/remote.d.ts +58 -0
- package/dist/code-first/remote.d.ts.map +1 -0
- package/dist/code-first/remote.js +126 -0
- package/dist/code-first/remote.js.map +1 -0
- package/dist/code-first/replay.d.ts +36 -0
- package/dist/code-first/replay.d.ts.map +1 -0
- package/dist/code-first/replay.js +52 -0
- package/dist/code-first/replay.js.map +1 -0
- package/dist/code-first/shared.d.ts +51 -0
- package/dist/code-first/shared.d.ts.map +1 -0
- package/dist/code-first/shared.js +93 -0
- package/dist/code-first/shared.js.map +1 -0
- package/dist/modules.d.ts +4 -0
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +6 -0
- package/dist/modules.js.map +1 -1
- package/dist/program.d.ts +20 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +43 -0
- package/dist/program.js.map +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fluidgrids versions list <key>`: every stored version of a workflow with
|
|
3
|
+
* the code bundle it references (`workflowCodeBundle`), so the build each
|
|
4
|
+
* version runs, the builds a hotfix kept compatible and when it was replaced
|
|
5
|
+
* are visible. Rollouts and drainage (`versions rollout | drainage`) arrive
|
|
6
|
+
* with the Phase B parity release (spec 11 §2.27).
|
|
7
|
+
*/
|
|
8
|
+
import { sortVersions } from '../remote.js';
|
|
9
|
+
import { emit } from '../shared.js';
|
|
10
|
+
export async function runVersionsList(env, workflowKey, options) {
|
|
11
|
+
const versions = sortVersions(await env.api.workflowVersions(workflowKey));
|
|
12
|
+
const rows = [];
|
|
13
|
+
for (const version of versions) {
|
|
14
|
+
rows.push({ ...version, bundle: await env.api.codeBundle(workflowKey, version.version) });
|
|
15
|
+
}
|
|
16
|
+
emit(env, options, rows, {
|
|
17
|
+
headers: ['Version', 'Status', 'Active', 'Created', 'Build', 'SDK', 'Replaced'],
|
|
18
|
+
rows: rows.map((row) => [
|
|
19
|
+
row.version,
|
|
20
|
+
row.status,
|
|
21
|
+
row.isActive ? 'yes' : 'no',
|
|
22
|
+
row.createdAt,
|
|
23
|
+
row.bundle ? row.bundle.buildId : '-',
|
|
24
|
+
row.bundle ? row.bundle.sdkVersion : '-',
|
|
25
|
+
row.bundle?.replacedAt ?? '-',
|
|
26
|
+
]),
|
|
27
|
+
});
|
|
28
|
+
return rows;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../src/code-first/commands/versions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OA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 -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connection names in code (`connection: 'slack-ops'`) resolve to the
|
|
3
|
+
* `{ connectionId, adapter }` references a node stores (spec 07 §3 rule 7, §6).
|
|
4
|
+
*
|
|
5
|
+
* The id comes from the workspace's connections, matched by name. The adapter
|
|
6
|
+
* is the name of the node's connection slot, which a connection name alone does
|
|
7
|
+
* not tell, so it is taken, in order, from:
|
|
8
|
+
* 1. the adapter the remote versions of the pushed workflows already bind that
|
|
9
|
+
* connection to (exact for every workflow that was pulled), then
|
|
10
|
+
* 2. the one adapter in the node registry whose provider is the connection's
|
|
11
|
+
* provider.
|
|
12
|
+
* When neither gives exactly one answer the name is left unresolved and the CLI
|
|
13
|
+
* says why; the code can then bind the connection by id with
|
|
14
|
+
* `connections: [{ connectionId, adapter }]`.
|
|
15
|
+
*/
|
|
16
|
+
import type { ConnectionRef, NodeManifest } from '@fluidgrids/workflows/ir';
|
|
17
|
+
import type { WorkspaceConnection } from './api.js';
|
|
18
|
+
export interface ConnectionIndex {
|
|
19
|
+
/** Name → reference, for every name that resolves to exactly one reference. */
|
|
20
|
+
refs: Record<string, ConnectionRef>;
|
|
21
|
+
/** Name → why it does not resolve. */
|
|
22
|
+
problems: Record<string, string>;
|
|
23
|
+
/** connectionId → name, for lifting. */
|
|
24
|
+
namesById: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
/** connectionId → every adapter a definition binds it to. */
|
|
27
|
+
export declare function adaptersInDefinitions(definitions: readonly unknown[]): Map<string, Set<string>>;
|
|
28
|
+
/**
|
|
29
|
+
* Provider key (lower case) → the adapter names the registry declares for it,
|
|
30
|
+
* from `connectionAdapters` / `credentialAdapters` on manifests and operations,
|
|
31
|
+
* the shapes the builder reads. The wildcard provider `*` is not indexed: it
|
|
32
|
+
* accepts any connection, so it never identifies one adapter.
|
|
33
|
+
*/
|
|
34
|
+
export declare function registryAdaptersByProvider(manifests: readonly NodeManifest[]): Map<string, Set<string>>;
|
|
35
|
+
export declare function buildConnectionIndex(connections: readonly WorkspaceConnection[], options?: {
|
|
36
|
+
remoteDefinitions?: readonly unknown[];
|
|
37
|
+
registry?: readonly NodeManifest[];
|
|
38
|
+
}): ConnectionIndex;
|
|
39
|
+
/** One line per unresolved name, saying what to do. */
|
|
40
|
+
export declare function explainUnresolved(names: readonly string[], index: ConnectionIndex): string[];
|
|
41
|
+
/**
|
|
42
|
+
* A resolver that accepts every name, for `validate --offline`: the reference
|
|
43
|
+
* marks the name instead of pointing at a real connection.
|
|
44
|
+
*/
|
|
45
|
+
export declare function placeholderRef(name: string): ConnectionRef;
|
|
46
|
+
/**
|
|
47
|
+
* The part of a connectionId → name map that lifting `definitions` needs: the
|
|
48
|
+
* ids the definitions bind, plus every other id that shares one of their names,
|
|
49
|
+
* so a name two connections have is still recognised as ambiguous. The service
|
|
50
|
+
* caps the map it accepts (500 entries), and a workspace may hold more.
|
|
51
|
+
*/
|
|
52
|
+
export declare function namesForDefinitions(namesById: Readonly<Record<string, string>>, definitions: readonly unknown[]): Record<string, string>;
|
|
53
|
+
/** The subset of `refs` that `names` asks for: what a lowering actually resolved. */
|
|
54
|
+
export declare function refsForNames(refs: Readonly<Record<string, ConnectionRef>>, names: Iterable<string>): Record<string, ConnectionRef>;
|
|
55
|
+
//# sourceMappingURL=connections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/code-first/connections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACpC,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC,MAAM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
|
+
/**
|
|
2
|
+
* Connection names in code (`connection: 'slack-ops'`) resolve to the
|
|
3
|
+
* `{ connectionId, adapter }` references a node stores (spec 07 §3 rule 7, §6).
|
|
4
|
+
*
|
|
5
|
+
* The id comes from the workspace's connections, matched by name. The adapter
|
|
6
|
+
* is the name of the node's connection slot, which a connection name alone does
|
|
7
|
+
* not tell, so it is taken, in order, from:
|
|
8
|
+
* 1. the adapter the remote versions of the pushed workflows already bind that
|
|
9
|
+
* connection to (exact for every workflow that was pulled), then
|
|
10
|
+
* 2. the one adapter in the node registry whose provider is the connection's
|
|
11
|
+
* provider.
|
|
12
|
+
* When neither gives exactly one answer the name is left unresolved and the CLI
|
|
13
|
+
* says why; the code can then bind the connection by id with
|
|
14
|
+
* `connections: [{ connectionId, adapter }]`.
|
|
15
|
+
*/
|
|
16
|
+
import { operationsOf } from '@fluidgrids/workflows/ir';
|
|
17
|
+
function isRecord(value) {
|
|
18
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
function setOwn(target, key, value) {
|
|
21
|
+
Object.defineProperty(target, key, {
|
|
22
|
+
value,
|
|
23
|
+
enumerable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function getOwn(record, key) {
|
|
29
|
+
return Object.hasOwn(record, key) ? record[key] : undefined;
|
|
30
|
+
}
|
|
31
|
+
/** connectionId → every adapter a definition binds it to. */
|
|
32
|
+
export function adaptersInDefinitions(definitions) {
|
|
33
|
+
const out = new Map();
|
|
34
|
+
for (const definition of definitions) {
|
|
35
|
+
const data = isRecord(definition) && isRecord(definition['data']) ? definition['data'] : {};
|
|
36
|
+
const nodes = Array.isArray(data['nodes']) ? data['nodes'] : [];
|
|
37
|
+
for (const node of nodes) {
|
|
38
|
+
const args = isRecord(node) && isRecord(node['args']) ? node['args'] : undefined;
|
|
39
|
+
const refs = Array.isArray(args?.['connections']) ? args['connections'] : [];
|
|
40
|
+
for (const ref of refs) {
|
|
41
|
+
if (isRecord(ref) &&
|
|
42
|
+
typeof ref['connectionId'] === 'string' &&
|
|
43
|
+
typeof ref['adapter'] === 'string') {
|
|
44
|
+
const set = out.get(ref['connectionId']) ?? new Set();
|
|
45
|
+
set.add(ref['adapter']);
|
|
46
|
+
out.set(ref['connectionId'], set);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
function adapterDeclarations(value) {
|
|
54
|
+
if (!Array.isArray(value))
|
|
55
|
+
return [];
|
|
56
|
+
return value
|
|
57
|
+
.filter(isRecord)
|
|
58
|
+
.map((entry) => ({
|
|
59
|
+
name: typeof entry['name'] === 'string' ? entry['name'].trim() : '',
|
|
60
|
+
provider: typeof entry['provider'] === 'string' ? entry['provider'].trim() : '',
|
|
61
|
+
}))
|
|
62
|
+
.filter((entry) => entry.name !== '' && entry.provider !== '');
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Provider key (lower case) → the adapter names the registry declares for it,
|
|
66
|
+
* from `connectionAdapters` / `credentialAdapters` on manifests and operations,
|
|
67
|
+
* the shapes the builder reads. The wildcard provider `*` is not indexed: it
|
|
68
|
+
* accepts any connection, so it never identifies one adapter.
|
|
69
|
+
*/
|
|
70
|
+
export function registryAdaptersByProvider(manifests) {
|
|
71
|
+
const out = new Map();
|
|
72
|
+
const add = (declarations) => {
|
|
73
|
+
for (const { name, provider } of declarations) {
|
|
74
|
+
if (provider === '*')
|
|
75
|
+
continue;
|
|
76
|
+
const key = provider.toLowerCase();
|
|
77
|
+
const set = out.get(key) ?? new Set();
|
|
78
|
+
set.add(name);
|
|
79
|
+
out.set(key, set);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
for (const manifest of manifests) {
|
|
83
|
+
add(adapterDeclarations(manifest['connectionAdapters']));
|
|
84
|
+
add(adapterDeclarations(manifest['credentialAdapters']));
|
|
85
|
+
for (const operation of operationsOf(manifest)) {
|
|
86
|
+
add(adapterDeclarations(operation['connectionAdapters']));
|
|
87
|
+
add(adapterDeclarations(operation['credentialAdapters']));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
function only(set) {
|
|
93
|
+
return set && set.size === 1 ? [...set][0] : undefined;
|
|
94
|
+
}
|
|
95
|
+
export function buildConnectionIndex(connections, options = {}) {
|
|
96
|
+
const bound = adaptersInDefinitions(options.remoteDefinitions ?? []);
|
|
97
|
+
const byProvider = registryAdaptersByProvider(options.registry ?? []);
|
|
98
|
+
const byName = new Map();
|
|
99
|
+
const namesById = {};
|
|
100
|
+
for (const connection of connections) {
|
|
101
|
+
byName.set(connection.name, [...(byName.get(connection.name) ?? []), connection]);
|
|
102
|
+
setOwn(namesById, connection.id, connection.name);
|
|
103
|
+
}
|
|
104
|
+
const refs = {};
|
|
105
|
+
const problems = {};
|
|
106
|
+
for (const [name, matches] of [...byName].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))) {
|
|
107
|
+
const [connection] = matches;
|
|
108
|
+
if (matches.length > 1 || !connection) {
|
|
109
|
+
setOwn(problems, name, `${matches.length} connections are named "${name}"; rename one, or bind by id with connections: [{ connectionId, adapter }]`);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const used = bound.get(connection.id);
|
|
113
|
+
if (used && used.size > 1) {
|
|
114
|
+
setOwn(problems, name, `"${name}" is bound to several adapters (${[...used].sort().join(', ')}); bind it by id with connections: [{ connectionId, adapter }]`);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const adapter = only(used) ??
|
|
118
|
+
(connection.providerKey
|
|
119
|
+
? only(byProvider.get(connection.providerKey.toLowerCase()))
|
|
120
|
+
: undefined);
|
|
121
|
+
if (adapter === undefined) {
|
|
122
|
+
const candidates = connection.providerKey
|
|
123
|
+
? [...(byProvider.get(connection.providerKey.toLowerCase()) ?? [])].sort()
|
|
124
|
+
: [];
|
|
125
|
+
setOwn(problems, name, candidates.length > 1
|
|
126
|
+
? `"${name}" (provider ${connection.providerKey}) fits several adapters (${candidates.join(', ')}); bind it by id with connections: [{ connectionId: '${connection.id}', adapter }]`
|
|
127
|
+
: `no node declares an adapter for "${name}" (provider ${connection.providerKey ?? 'unknown'}); bind it by id with connections: [{ connectionId: '${connection.id}', adapter }]`);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
setOwn(refs, name, { connectionId: connection.id, adapter });
|
|
131
|
+
}
|
|
132
|
+
return { refs, problems, namesById };
|
|
133
|
+
}
|
|
134
|
+
/** One line per unresolved name, saying what to do. */
|
|
135
|
+
export function explainUnresolved(names, index) {
|
|
136
|
+
return [...names].sort().map((name) => {
|
|
137
|
+
const problem = getOwn(index.problems, name);
|
|
138
|
+
return problem
|
|
139
|
+
? `${name}: ${problem}`
|
|
140
|
+
: `${name}: no connection with this name exists in the workspace; create it first`;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A resolver that accepts every name, for `validate --offline`: the reference
|
|
145
|
+
* marks the name instead of pointing at a real connection.
|
|
146
|
+
*/
|
|
147
|
+
export function placeholderRef(name) {
|
|
148
|
+
return { connectionId: `unresolved:${name}`, adapter: 'unresolved' };
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The part of a connectionId → name map that lifting `definitions` needs: the
|
|
152
|
+
* ids the definitions bind, plus every other id that shares one of their names,
|
|
153
|
+
* so a name two connections have is still recognised as ambiguous. The service
|
|
154
|
+
* caps the map it accepts (500 entries), and a workspace may hold more.
|
|
155
|
+
*/
|
|
156
|
+
export function namesForDefinitions(namesById, definitions) {
|
|
157
|
+
const used = new Set();
|
|
158
|
+
for (const id of adaptersInDefinitions(definitions).keys()) {
|
|
159
|
+
const name = getOwn(namesById, id);
|
|
160
|
+
if (name !== undefined)
|
|
161
|
+
used.add(name);
|
|
162
|
+
}
|
|
163
|
+
const out = {};
|
|
164
|
+
for (const [id, name] of Object.entries(namesById)) {
|
|
165
|
+
if (used.has(name))
|
|
166
|
+
setOwn(out, id, name);
|
|
167
|
+
}
|
|
168
|
+
return out;
|
|
169
|
+
}
|
|
170
|
+
/** The subset of `refs` that `names` asks for: what a lowering actually resolved. */
|
|
171
|
+
export function refsForNames(refs, names) {
|
|
172
|
+
const out = {};
|
|
173
|
+
for (const name of names) {
|
|
174
|
+
const ref = getOwn(refs, name);
|
|
175
|
+
if (ref !== undefined)
|
|
176
|
+
setOwn(out, name, ref);
|
|
177
|
+
}
|
|
178
|
+
return out;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=connections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connections.js","sourceRoot":"","sources":["../../src/code-first/connections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAaxD,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,MAAM,CAAI,MAAyB,EAAE,GAAW,EAAE,KAAQ;IACjE,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE;QACjC,KAAK;QACL,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;AACL,CAAC;AAED,SAAS,MAAM,CAAI,MAAyB,EAAE,GAAW;IACvD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC9D,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,qBAAqB,CAAC,WAA+B;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1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL documents for durable functions (managed tier-2 workflows, BOFF-9905
|
|
3
|
+
* Phase B): code bundle upload and hotfix, durable run start, history, signal,
|
|
4
|
+
* terminate and stack trace.
|
|
5
|
+
*
|
|
6
|
+
* Every document targets the WORKSPACE gateway (wspace-workflow-svc). The names
|
|
7
|
+
* and shapes are the Phase B contract (PLAN-B §5 B8 and B9, spec 08 §4). They
|
|
8
|
+
* are validated by `tests/code-first/durable-operations.test.ts` against the
|
|
9
|
+
* vendored supergraph once `bun run schema:pull` brings the service release
|
|
10
|
+
* in, and against `schema/durable.pending.graphql` until then.
|
|
11
|
+
*
|
|
12
|
+
* The service gates every operation that starts new durable work
|
|
13
|
+
* (`prepareWorkflowCodeUpload`, `replaceWorkflowVersionCode`, `startWorkflow`,
|
|
14
|
+
* `signalWorkflowRun` on a DURABLE_FN run, and versions with a `codeBundle`) on
|
|
15
|
+
* the `fluidgrids.durable-functions` feature flag, fail closed. A workspace
|
|
16
|
+
* without the flag gets a GraphQL error that the CLI prints as it is; the CLI
|
|
17
|
+
* never decides the flag itself.
|
|
18
|
+
*/
|
|
19
|
+
/** A presigned bundle PUT (skipped when `alreadyStored`) and a presigned source PUT. */
|
|
20
|
+
export declare const CF_PREPARE_WORKFLOW_CODE_UPLOAD = "\n mutation FluidgridsCodePrepareWorkflowCodeUpload($input: PrepareWorkflowCodeUploadInput!) {\n prepareWorkflowCodeUpload(input: $input) {\n uploadId\n bundle { url method headers expiresAt alreadyStored }\n source { url method headers expiresAt alreadyStored }\n }\n }\n";
|
|
21
|
+
/** Hotfix: replace the bundle of an existing version; an asynchronous, replay-verified job. */
|
|
22
|
+
export declare const CF_REPLACE_WORKFLOW_VERSION_CODE = "\n mutation FluidgridsCodeReplaceWorkflowVersionCode(\n $workflowKey: String!\n $version: String!\n $codeBundle: CodeBundleInput!\n $verifyReplay: Boolean\n ) {\n replaceWorkflowVersionCode(\n workflowKey: $workflowKey\n version: $version\n codeBundle: $codeBundle\n verifyReplay: $verifyReplay\n ) { \n id status buildId previousBuildId verifiedRuns\n violations { runId seq message }\n }\n }\n";
|
|
23
|
+
/** Poll a hotfix job. */
|
|
24
|
+
export declare const CF_WORKFLOW_CODE_REPLACE = "\n query FluidgridsCodeWorkflowCodeReplace($id: ID!) {\n workflowCodeReplace(id: $id) { \n id status buildId previousBuildId verifiedRuns\n violations { runId seq message }\n }\n }\n";
|
|
25
|
+
/** The code bundle a version references, or null for a version without code. */
|
|
26
|
+
export declare const CF_WORKFLOW_CODE_BUNDLE = "\n query FluidgridsCodeWorkflowCodeBundle($workflowKey: String!, $version: String!) {\n workflowCodeBundle(workflowKey: $workflowKey, version: $version) {\n id buildId language sdkVersion entry exports determinism\n bundleBytes sourceBytes compatibleBuildIds replacedAt createdAt\n }\n }\n";
|
|
27
|
+
/** Start a root durable-function run (DB18). */
|
|
28
|
+
export declare const CF_START_WORKFLOW = "\n mutation FluidgridsCodeStartWorkflow($input: StartWorkflowInput!) {\n startWorkflow(input: $input) {\n existing\n run { \n id workflowId workflowKey version status mode triggerNodeId\n executionKind workflowFn taskQueue buildId historyLength parentClosePolicy\n parentRunId rootRunId cancelRequestedAt\n createdAt startedAt completedAt errorMessage errorType\n determinism { failing cause attempts since lastFailureSeq message }\n }\n }\n }\n";
|
|
29
|
+
/** One run with its durable fields. */
|
|
30
|
+
export declare const CF_DESCRIBE_RUN = "\n query FluidgridsCodeDescribeRun($id: ID!) {\n workflowRun(id: $id) { \n id workflowId workflowKey version status mode triggerNodeId\n executionKind workflowFn taskQueue buildId historyLength parentClosePolicy\n parentRunId rootRunId cancelRequestedAt\n createdAt startedAt completedAt errorMessage errorType\n determinism { failing cause attempts since lastFailureSeq message }\n }\n }\n";
|
|
31
|
+
/** One page of a run's event history. */
|
|
32
|
+
export declare const CF_WORKFLOW_RUN_HISTORY = "\n query FluidgridsCodeWorkflowRunHistory($runId: ID!, $after: Int, $limit: Int) {\n workflowRunHistory(runId: $runId, after: $after, limit: $limit) {\n events { runId seq type taskId payload payloadUrl createdAt }\n nextAfter hasMore historyLength historyBytes\n }\n }\n";
|
|
33
|
+
export declare const CF_SIGNAL_WORKFLOW_RUN = "\n mutation FluidgridsCodeSignalWorkflowRun(\n $runId: ID!\n $name: String!\n $payload: JSON\n $idempotencyKey: String\n ) {\n signalWorkflowRun(runId: $runId, name: $name, payload: $payload, idempotencyKey: $idempotencyKey) {\n accepted delivered buffered forwardedToRunId seq duplicate\n }\n }\n";
|
|
34
|
+
/** Terminate a run of either kind; no code runs (durable) and no node runs (graph). */
|
|
35
|
+
export declare const CF_TERMINATE_WORKFLOW_RUN = "\n mutation FluidgridsCodeTerminateWorkflowRun($runId: ID!, $reason: String) {\n terminateWorkflowRun(runId: $runId, reason: $reason) { id status completedAt errorMessage }\n }\n";
|
|
36
|
+
/** The built-in `__stack_trace` / `__enhanced_stack_trace` query, replayed in the service. */
|
|
37
|
+
export declare const CF_WORKFLOW_RUN_STACK_TRACE = "\n query FluidgridsCodeWorkflowRunStackTrace($runId: ID!, $enhanced: Boolean) {\n workflowRunStackTrace(runId: $runId, enhanced: $enhanced) { trace enhanced }\n }\n";
|
|
38
|
+
/** Runs of one workflow key (newest first), for `push --hotfix --replay-sample`. */
|
|
39
|
+
export declare const CF_LIST_RUNS = "\n query FluidgridsCodeListRuns($input: ListWorkflowRunsInput!) {\n workflowRuns(input: $input) {\n items { id workflowKey version status executionKind }\n hasMore\n }\n }\n";
|
|
40
|
+
/** Trigger a stored version from one of its trigger nodes (`fluidgrids run`). */
|
|
41
|
+
export declare const CF_TRIGGER_WORKFLOW = "\n mutation FluidgridsCodeTriggerWorkflow($input: TriggerWorkflowInput!) {\n triggerWorkflow(input: $input) { runId status workflowKey version triggerNodeId }\n }\n";
|
|
42
|
+
//# sourceMappingURL=durable-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durable-operations.d.ts","sourceRoot":"","sources":["../../src/code-first/durable-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,wFAAwF;AACxF,eAAO,MAAM,+BAA+B,4SAQ3C,CAAC;AAOF,+FAA+F;AAC/F,eAAO,MAAM,gCAAgC,2bAc5C,CAAC;AAEF,yBAAyB;AACzB,eAAO,MAAM,wBAAwB,kMAIpC,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,uBAAuB,wTAOnC,CAAC;AAWF,gDAAgD;AAChD,eAAO,MAAM,iBAAiB,ydAO7B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,eAAe,qZAI3B,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,uBAAuB,sSAOnC,CAAC;AAEF,eAAO,MAAM,sBAAsB,wUAWlC,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,yBAAyB,4LAIrC,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,2BAA2B,8KAIvC,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,YAAY,oMAOxB,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,8KAI/B,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL documents for durable functions (managed tier-2 workflows, BOFF-9905
|
|
3
|
+
* Phase B): code bundle upload and hotfix, durable run start, history, signal,
|
|
4
|
+
* terminate and stack trace.
|
|
5
|
+
*
|
|
6
|
+
* Every document targets the WORKSPACE gateway (wspace-workflow-svc). The names
|
|
7
|
+
* and shapes are the Phase B contract (PLAN-B §5 B8 and B9, spec 08 §4). They
|
|
8
|
+
* are validated by `tests/code-first/durable-operations.test.ts` against the
|
|
9
|
+
* vendored supergraph once `bun run schema:pull` brings the service release
|
|
10
|
+
* in, and against `schema/durable.pending.graphql` until then.
|
|
11
|
+
*
|
|
12
|
+
* The service gates every operation that starts new durable work
|
|
13
|
+
* (`prepareWorkflowCodeUpload`, `replaceWorkflowVersionCode`, `startWorkflow`,
|
|
14
|
+
* `signalWorkflowRun` on a DURABLE_FN run, and versions with a `codeBundle`) on
|
|
15
|
+
* the `fluidgrids.durable-functions` feature flag, fail closed. A workspace
|
|
16
|
+
* without the flag gets a GraphQL error that the CLI prints as it is; the CLI
|
|
17
|
+
* never decides the flag itself.
|
|
18
|
+
*/
|
|
19
|
+
const PRESIGNED_PUT_FIELDS = 'url method headers expiresAt alreadyStored';
|
|
20
|
+
/** A presigned bundle PUT (skipped when `alreadyStored`) and a presigned source PUT. */
|
|
21
|
+
export const CF_PREPARE_WORKFLOW_CODE_UPLOAD = `
|
|
22
|
+
mutation FluidgridsCodePrepareWorkflowCodeUpload($input: PrepareWorkflowCodeUploadInput!) {
|
|
23
|
+
prepareWorkflowCodeUpload(input: $input) {
|
|
24
|
+
uploadId
|
|
25
|
+
bundle { ${PRESIGNED_PUT_FIELDS} }
|
|
26
|
+
source { ${PRESIGNED_PUT_FIELDS} }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
const CODE_REPLACE_FIELDS = `
|
|
31
|
+
id status buildId previousBuildId verifiedRuns
|
|
32
|
+
violations { runId seq message }
|
|
33
|
+
`;
|
|
34
|
+
/** Hotfix: replace the bundle of an existing version; an asynchronous, replay-verified job. */
|
|
35
|
+
export const CF_REPLACE_WORKFLOW_VERSION_CODE = `
|
|
36
|
+
mutation FluidgridsCodeReplaceWorkflowVersionCode(
|
|
37
|
+
$workflowKey: String!
|
|
38
|
+
$version: String!
|
|
39
|
+
$codeBundle: CodeBundleInput!
|
|
40
|
+
$verifyReplay: Boolean
|
|
41
|
+
) {
|
|
42
|
+
replaceWorkflowVersionCode(
|
|
43
|
+
workflowKey: $workflowKey
|
|
44
|
+
version: $version
|
|
45
|
+
codeBundle: $codeBundle
|
|
46
|
+
verifyReplay: $verifyReplay
|
|
47
|
+
) { ${CODE_REPLACE_FIELDS} }
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
/** Poll a hotfix job. */
|
|
51
|
+
export const CF_WORKFLOW_CODE_REPLACE = `
|
|
52
|
+
query FluidgridsCodeWorkflowCodeReplace($id: ID!) {
|
|
53
|
+
workflowCodeReplace(id: $id) { ${CODE_REPLACE_FIELDS} }
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
/** The code bundle a version references, or null for a version without code. */
|
|
57
|
+
export const CF_WORKFLOW_CODE_BUNDLE = `
|
|
58
|
+
query FluidgridsCodeWorkflowCodeBundle($workflowKey: String!, $version: String!) {
|
|
59
|
+
workflowCodeBundle(workflowKey: $workflowKey, version: $version) {
|
|
60
|
+
id buildId language sdkVersion entry exports determinism
|
|
61
|
+
bundleBytes sourceBytes compatibleBuildIds replacedAt createdAt
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
/** Run fields the durable commands print. */
|
|
66
|
+
const DURABLE_RUN_FIELDS = `
|
|
67
|
+
id workflowId workflowKey version status mode triggerNodeId
|
|
68
|
+
executionKind workflowFn taskQueue buildId historyLength parentClosePolicy
|
|
69
|
+
parentRunId rootRunId cancelRequestedAt
|
|
70
|
+
createdAt startedAt completedAt errorMessage errorType
|
|
71
|
+
determinism { failing cause attempts since lastFailureSeq message }
|
|
72
|
+
`;
|
|
73
|
+
/** Start a root durable-function run (DB18). */
|
|
74
|
+
export const CF_START_WORKFLOW = `
|
|
75
|
+
mutation FluidgridsCodeStartWorkflow($input: StartWorkflowInput!) {
|
|
76
|
+
startWorkflow(input: $input) {
|
|
77
|
+
existing
|
|
78
|
+
run { ${DURABLE_RUN_FIELDS} }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
/** One run with its durable fields. */
|
|
83
|
+
export const CF_DESCRIBE_RUN = `
|
|
84
|
+
query FluidgridsCodeDescribeRun($id: ID!) {
|
|
85
|
+
workflowRun(id: $id) { ${DURABLE_RUN_FIELDS} }
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
/** One page of a run's event history. */
|
|
89
|
+
export const CF_WORKFLOW_RUN_HISTORY = `
|
|
90
|
+
query FluidgridsCodeWorkflowRunHistory($runId: ID!, $after: Int, $limit: Int) {
|
|
91
|
+
workflowRunHistory(runId: $runId, after: $after, limit: $limit) {
|
|
92
|
+
events { runId seq type taskId payload payloadUrl createdAt }
|
|
93
|
+
nextAfter hasMore historyLength historyBytes
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
export const CF_SIGNAL_WORKFLOW_RUN = `
|
|
98
|
+
mutation FluidgridsCodeSignalWorkflowRun(
|
|
99
|
+
$runId: ID!
|
|
100
|
+
$name: String!
|
|
101
|
+
$payload: JSON
|
|
102
|
+
$idempotencyKey: String
|
|
103
|
+
) {
|
|
104
|
+
signalWorkflowRun(runId: $runId, name: $name, payload: $payload, idempotencyKey: $idempotencyKey) {
|
|
105
|
+
accepted delivered buffered forwardedToRunId seq duplicate
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
/** Terminate a run of either kind; no code runs (durable) and no node runs (graph). */
|
|
110
|
+
export const CF_TERMINATE_WORKFLOW_RUN = `
|
|
111
|
+
mutation FluidgridsCodeTerminateWorkflowRun($runId: ID!, $reason: String) {
|
|
112
|
+
terminateWorkflowRun(runId: $runId, reason: $reason) { id status completedAt errorMessage }
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
/** The built-in `__stack_trace` / `__enhanced_stack_trace` query, replayed in the service. */
|
|
116
|
+
export const CF_WORKFLOW_RUN_STACK_TRACE = `
|
|
117
|
+
query FluidgridsCodeWorkflowRunStackTrace($runId: ID!, $enhanced: Boolean) {
|
|
118
|
+
workflowRunStackTrace(runId: $runId, enhanced: $enhanced) { trace enhanced }
|
|
119
|
+
}
|
|
120
|
+
`;
|
|
121
|
+
/** Runs of one workflow key (newest first), for `push --hotfix --replay-sample`. */
|
|
122
|
+
export const CF_LIST_RUNS = `
|
|
123
|
+
query FluidgridsCodeListRuns($input: ListWorkflowRunsInput!) {
|
|
124
|
+
workflowRuns(input: $input) {
|
|
125
|
+
items { id workflowKey version status executionKind }
|
|
126
|
+
hasMore
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
/** Trigger a stored version from one of its trigger nodes (`fluidgrids run`). */
|
|
131
|
+
export const CF_TRIGGER_WORKFLOW = `
|
|
132
|
+
mutation FluidgridsCodeTriggerWorkflow($input: TriggerWorkflowInput!) {
|
|
133
|
+
triggerWorkflow(input: $input) { runId status workflowKey version triggerNodeId }
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
//# sourceMappingURL=durable-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durable-operations.js","sourceRoot":"","sources":["../../src/code-first/durable-operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,oBAAoB,GAAG,4CAA4C,CAAC;AAE1E,wFAAwF;AACxF,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;iBAI9B,oBAAoB;iBACpB,oBAAoB;;;CAGpC,CAAC;AAEF,MAAM,mBAAmB,GAAG;;;CAG3B,CAAC;AAEF,+FAA+F;AAC/F,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;;;;;;;UAYtC,mBAAmB;;CAE5B,CAAC;AAEF,yBAAyB;AACzB,MAAM,CAAC,MAAM,wBAAwB,GAAG;;qCAEH,mBAAmB;;CAEvD,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;CAOtC,CAAC;AAEF,6CAA6C;AAC7C,MAAM,kBAAkB,GAAG;;;;;;CAM1B,CAAC;AAEF,gDAAgD;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;cAInB,kBAAkB;;;CAG/B,CAAC;AAEF,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG;;6BAEF,kBAAkB;;CAE9C,CAAC;AAEF,yCAAyC;AACzC,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;CAOtC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;CAWrC,CAAC;AAEF,uFAAuF;AACvF,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;CAIxC,CAAC;AAEF,8FAA8F;AAC9F,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;CAI1C,CAAC;AAEF,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;CAO3B,CAAC;AAEF,iFAAiF;AACjF,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;CAIlC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A durable run's history as a `fluidgrids.history` file (C-HIST,
|
|
3
|
+
* `schema/history-file.schema.json` of `@fluidgrids/workflows`): every page of
|
|
4
|
+
* `workflowRunHistory`, with offloaded payloads fetched through their
|
|
5
|
+
* presigned `payloadUrl` and inlined, so the file replays on its own.
|
|
6
|
+
*/
|
|
7
|
+
import { type HistoryFile, type RunEventRecord } from '@fluidgrids/workflows/history';
|
|
8
|
+
import { type DurableRun } from './api.js';
|
|
9
|
+
import { type CommandEnv } from './shared.js';
|
|
10
|
+
/** Events per `workflowRunHistory` page (the service's default and maximum). */
|
|
11
|
+
export declare const HISTORY_PAGE_SIZE = 500;
|
|
12
|
+
/** Largest offloaded payload the CLI reads (the service's resolved-bytes cap). */
|
|
13
|
+
export declare const MAX_OFFLOADED_PAYLOAD_BYTES: number;
|
|
14
|
+
export interface FetchedHistory {
|
|
15
|
+
run: DurableRun;
|
|
16
|
+
file: HistoryFile;
|
|
17
|
+
historyBytes: number;
|
|
18
|
+
}
|
|
19
|
+
/** The run's events, every page, offloaded payloads inlined. */
|
|
20
|
+
export declare function fetchRunEvents(env: CommandEnv, runId: string): Promise<{
|
|
21
|
+
events: RunEventRecord[];
|
|
22
|
+
historyBytes: number;
|
|
23
|
+
}>;
|
|
24
|
+
/** Refuse a run that has no event history (a canvas run). */
|
|
25
|
+
export declare function assertDurable(run: DurableRun): void;
|
|
26
|
+
/** Download a durable run's history as a validated history file. */
|
|
27
|
+
export declare function fetchHistory(env: CommandEnv, runId: string): Promise<FetchedHistory>;
|
|
28
|
+
/** Read and validate a history file from disk. */
|
|
29
|
+
export declare function parseHistoryText(text: string, path: string): HistoryFile;
|
|
30
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/code-first/history.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,cAAc,EAEpB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAa,KAAK,UAAU,EAAuB,MAAM,UAAU,CAAC;AAE3E,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7D,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,kFAAkF;AAClF,eAAO,MAAM,2BAA2B,QAAmB,CAAC;AAE5D,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,UAAU,CAAC;IAChB,IAAI,EAAE,WAAW,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAoDD,gEAAgE;AAChE,wBAAsB,cAAc,CAClC,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CA2B7D;AAED,6DAA6D;AAC7D,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAOnD;AAED,oEAAoE;AACpE,wBAAsB,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAmC1F;AAED,kDAAkD;AAClD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAWxE"}
|