@cargo-ai/cdk 1.0.11 → 1.0.12
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/build/src/cli/commands/deploy.d.ts.map +1 -1
- package/build/src/cli/commands/deploy.js +105 -1
- package/build/src/deploy/executors.live.d.ts.map +1 -1
- package/build/src/deploy/executors.live.js +56 -2
- package/build/src/deploy/import.d.ts +12 -0
- package/build/src/deploy/import.d.ts.map +1 -1
- package/build/src/deploy/import.js +79 -9
- package/build/src/deploy/index.d.ts +2 -0
- package/build/src/deploy/index.d.ts.map +1 -1
- package/build/src/deploy/index.js +1 -0
- package/build/src/deploy/pull/enumerate.d.ts +8 -0
- package/build/src/deploy/pull/enumerate.d.ts.map +1 -0
- package/build/src/deploy/pull/enumerate.js +258 -0
- package/build/src/deploy/pull/index.d.ts +28 -0
- package/build/src/deploy/pull/index.d.ts.map +1 -0
- package/build/src/deploy/pull/index.js +152 -0
- package/build/src/deploy/pull/ir.d.ts +45 -0
- package/build/src/deploy/pull/ir.d.ts.map +1 -0
- package/build/src/deploy/pull/ir.js +72 -0
- package/build/src/deploy/pull/mappers.d.ts +10 -0
- package/build/src/deploy/pull/mappers.d.ts.map +1 -0
- package/build/src/deploy/pull/mappers.js +689 -0
- package/build/src/deploy/pull/print.d.ts +9 -0
- package/build/src/deploy/pull/print.d.ts.map +1 -0
- package/build/src/deploy/pull/print.js +59 -0
- package/build/src/deploy/pull/resolve.d.ts +24 -0
- package/build/src/deploy/pull/resolve.d.ts.map +1 -0
- package/build/src/deploy/pull/resolve.js +113 -0
- package/build/src/deploy/pull/untar.d.ts +6 -0
- package/build/src/deploy/pull/untar.d.ts.map +1 -0
- package/build/src/deploy/pull/untar.js +84 -0
- package/build/src/deploy/readers.live.d.ts +3 -0
- package/build/src/deploy/readers.live.d.ts.map +1 -1
- package/build/src/deploy/readers.live.js +12 -6
- package/build/src/index.d.ts +3 -3
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +1 -1
- package/build/src/refs.d.ts +7 -1
- package/build/src/refs.d.ts.map +1 -1
- package/build/src/refs.js +10 -0
- package/build/src/resources/customIntegration.d.ts +3 -2
- package/build/src/resources/customIntegration.d.ts.map +1 -1
- package/build/src/resources/model.d.ts +56 -8
- package/build/src/resources/model.d.ts.map +1 -1
- package/build/src/resources/model.js +48 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type GeneratedAsset } from "./ir.js";
|
|
2
|
+
import { type ResolvedResource } from "./resolve.js";
|
|
3
|
+
export type GeneratedSource = {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly source: string;
|
|
6
|
+
};
|
|
7
|
+
export type GeneratedFile = GeneratedSource | GeneratedAsset;
|
|
8
|
+
export declare function printResource(resource: ResolvedResource): GeneratedSource;
|
|
9
|
+
//# sourceMappingURL=print.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../../../src/deploy/pull/print.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,cAAc,EAAgB,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAsChE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAGF,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,cAAc,CAAC;AAE7D,wBAAgB,aAAa,CAAC,QAAQ,EAAE,gBAAgB,GAAG,eAAe,CAoBzE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// TS source printer. Turns a ResolvedResource into a `<dir>/<slug>.ts` module:
|
|
2
|
+
// the import header followed by `export const <id> = define<Kind>("slug", {…})`.
|
|
3
|
+
// Formatting is cosmetic — the content hash is computed from the runtime spec,
|
|
4
|
+
// not the source text — but output is deterministic so re-pulls diff cleanly.
|
|
5
|
+
import { isCallMarker } from "./ir.js";
|
|
6
|
+
import { isRawExpr } from "./resolve.js";
|
|
7
|
+
const IDENT = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
8
|
+
function printKey(key) {
|
|
9
|
+
return IDENT.test(key) ? key : JSON.stringify(key);
|
|
10
|
+
}
|
|
11
|
+
function printValue(value, indent) {
|
|
12
|
+
if (isRawExpr(value))
|
|
13
|
+
return value.__expr;
|
|
14
|
+
if (isCallMarker(value)) {
|
|
15
|
+
const args = value.args.map((arg) => printValue(arg, indent));
|
|
16
|
+
return `${value.fn}(${args.join(", ")})`;
|
|
17
|
+
}
|
|
18
|
+
if (value === null)
|
|
19
|
+
return "null";
|
|
20
|
+
if (typeof value === "string")
|
|
21
|
+
return JSON.stringify(value);
|
|
22
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
23
|
+
return String(value);
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
if (value.length === 0)
|
|
27
|
+
return "[]";
|
|
28
|
+
const inner = indent + " ";
|
|
29
|
+
const items = value.map((item) => `${inner}${printValue(item, inner)}`);
|
|
30
|
+
return `[\n${items.join(",\n")},\n${indent}]`;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === "object") {
|
|
33
|
+
const entries = Object.entries(value).filter(([, v]) => v !== undefined);
|
|
34
|
+
if (entries.length === 0)
|
|
35
|
+
return "{}";
|
|
36
|
+
const inner = indent + " ";
|
|
37
|
+
const lines = entries.map(([key, v]) => `${inner}${printKey(key)}: ${printValue(v, inner)}`);
|
|
38
|
+
return `{\n${lines.join(",\n")},\n${indent}}`;
|
|
39
|
+
}
|
|
40
|
+
// undefined / functions — should never reach here for a mapped spec.
|
|
41
|
+
return "undefined";
|
|
42
|
+
}
|
|
43
|
+
export function printResource(resource) {
|
|
44
|
+
const header = [
|
|
45
|
+
`import { ${resource.cdkImports.join(", ")} } from "@cargo-ai/cdk";`,
|
|
46
|
+
];
|
|
47
|
+
if (resource.localImports.length > 0) {
|
|
48
|
+
header.push("");
|
|
49
|
+
for (const imp of resource.localImports) {
|
|
50
|
+
header.push(`import { ${imp.identifier} } from ${JSON.stringify(imp.from)};`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const args = resource.singleton
|
|
54
|
+
? printValue(resource.spec, "")
|
|
55
|
+
: `${JSON.stringify(resource.slug)}, ${printValue(resource.spec, "")}`;
|
|
56
|
+
const body = `export const ${resource.identifier} = ${resource.defineFn}(${args});`;
|
|
57
|
+
const source = `${header.join("\n")}\n\n${body}\n`;
|
|
58
|
+
return { path: `${resource.dir}/${resource.slug}.ts`, source };
|
|
59
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type IRResource } from "./ir.js";
|
|
2
|
+
export type RawExpr = {
|
|
3
|
+
readonly __expr: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function rawExpr(code: string): RawExpr;
|
|
6
|
+
export declare function isRawExpr(value: unknown): value is RawExpr;
|
|
7
|
+
export type LocalImport = {
|
|
8
|
+
readonly identifier: string;
|
|
9
|
+
readonly from: string;
|
|
10
|
+
};
|
|
11
|
+
export type ResolvedResource = {
|
|
12
|
+
readonly kind: IRResource["kind"];
|
|
13
|
+
readonly slug: string;
|
|
14
|
+
readonly uuid: string;
|
|
15
|
+
readonly identifier: string;
|
|
16
|
+
readonly defineFn: string;
|
|
17
|
+
readonly dir: string;
|
|
18
|
+
readonly singleton: boolean;
|
|
19
|
+
readonly cdkImports: readonly string[];
|
|
20
|
+
readonly localImports: readonly LocalImport[];
|
|
21
|
+
readonly spec: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
export declare function resolveResources(resources: readonly IRResource[]): ResolvedResource[];
|
|
24
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../src/deploy/pull/resolve.ts"],"names":[],"mappings":"AAgBA,OAAO,EAEL,KAAK,UAAU,EAMhB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAM1D;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAEvC,QAAQ,CAAC,YAAY,EAAE,SAAS,WAAW,EAAE,CAAC;IAE9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC,CAAC;AA6BF,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,SAAS,UAAU,EAAE,GAC/B,gBAAgB,EAAE,CAsEpB"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Cross-reference resolution. Given all pulled IR resources, rewrite every
|
|
2
|
+
// RefMarker into either a code handle (when the target is also being pulled —
|
|
3
|
+
// the preferred form, which auto-wires the deploy dependency) or a literal
|
|
4
|
+
// `xxRef("uuid")` (when it isn't). SecretMarkers become `secret("NAME")` —
|
|
5
|
+
// core's `secret()` takes the env-var NAME, read at apply time.
|
|
6
|
+
// The output carries the exact import set each generated file needs.
|
|
7
|
+
//
|
|
8
|
+
// Export identifiers are assigned globally and uniquely: slugs are only unique
|
|
9
|
+
// per kind (and distinct slugs can camelCase identically), so a colliding
|
|
10
|
+
// identifier gets a deterministic numeric suffix — otherwise a folder named
|
|
11
|
+
// like its model would shadow it (duplicate binding / silently mis-wired
|
|
12
|
+
// import).
|
|
13
|
+
//
|
|
14
|
+
// Markers are replaced by `RawExpr` nodes ({ __expr }) so the printer emits them
|
|
15
|
+
// verbatim instead of quoting them as JSON.
|
|
16
|
+
import { isCallMarker, isRefMarker, isSecretMarker, KIND_META, toIdentifier, } from "./ir.js";
|
|
17
|
+
export function rawExpr(code) {
|
|
18
|
+
return { __expr: code };
|
|
19
|
+
}
|
|
20
|
+
export function isRawExpr(value) {
|
|
21
|
+
return (typeof value === "object" &&
|
|
22
|
+
value !== null &&
|
|
23
|
+
typeof value.__expr === "string");
|
|
24
|
+
}
|
|
25
|
+
// Relative import path from one resource file to another (each resource is its
|
|
26
|
+
// own `<dir>/<slug>.ts`). Same dir → "./slug"; else "../otherDir/slug".
|
|
27
|
+
function importPath(fromDir, toDir, toSlug) {
|
|
28
|
+
return fromDir === toDir ? `./${toSlug}` : `../${toDir}/${toSlug}`;
|
|
29
|
+
}
|
|
30
|
+
// One unique identifier per resource, in input order: the first taker keeps
|
|
31
|
+
// the plain camelCased slug, later collisions get `<identifier>2`, `…3`.
|
|
32
|
+
function assignIdentifiers(resources) {
|
|
33
|
+
const byUuid = new Map();
|
|
34
|
+
const used = new Set();
|
|
35
|
+
for (const resource of resources) {
|
|
36
|
+
const base = toIdentifier(resource.slug);
|
|
37
|
+
let identifier = base;
|
|
38
|
+
let n = 1;
|
|
39
|
+
while (used.has(identifier)) {
|
|
40
|
+
n += 1;
|
|
41
|
+
identifier = `${base}${String(n)}`;
|
|
42
|
+
}
|
|
43
|
+
used.add(identifier);
|
|
44
|
+
byUuid.set(resource.uuid, identifier);
|
|
45
|
+
}
|
|
46
|
+
return byUuid;
|
|
47
|
+
}
|
|
48
|
+
export function resolveResources(resources) {
|
|
49
|
+
const byUuid = new Map();
|
|
50
|
+
for (const resource of resources)
|
|
51
|
+
byUuid.set(resource.uuid, resource);
|
|
52
|
+
const identifiers = assignIdentifiers(resources);
|
|
53
|
+
return resources.map((resource) => {
|
|
54
|
+
const meta = KIND_META[resource.kind];
|
|
55
|
+
if (meta === undefined) {
|
|
56
|
+
throw new Error(`cdk pull: unsupported kind "${resource.kind}"`);
|
|
57
|
+
}
|
|
58
|
+
const cdkImports = new Set([meta.defineFn]);
|
|
59
|
+
const localImports = new Map();
|
|
60
|
+
const walk = (value) => {
|
|
61
|
+
if (isSecretMarker(value)) {
|
|
62
|
+
cdkImports.add("secret");
|
|
63
|
+
return rawExpr(`secret(${JSON.stringify(value.envName)})`);
|
|
64
|
+
}
|
|
65
|
+
if (isRefMarker(value)) {
|
|
66
|
+
const target = byUuid.get(value.uuid);
|
|
67
|
+
if (target !== undefined && target.uuid !== resource.uuid) {
|
|
68
|
+
const targetMeta = KIND_META[target.kind];
|
|
69
|
+
if (targetMeta !== undefined) {
|
|
70
|
+
const identifier = identifiers.get(target.uuid);
|
|
71
|
+
localImports.set(identifier, importPath(meta.dir, targetMeta.dir, target.slug));
|
|
72
|
+
const accessor = value.accessor === undefined ? "" : value.accessor;
|
|
73
|
+
return rawExpr(`${identifier}${accessor}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return walk(value.fallback);
|
|
77
|
+
}
|
|
78
|
+
if (isCallMarker(value)) {
|
|
79
|
+
cdkImports.add(value.fn);
|
|
80
|
+
const marker = {
|
|
81
|
+
__call: true,
|
|
82
|
+
fn: value.fn,
|
|
83
|
+
args: value.args.map(walk),
|
|
84
|
+
};
|
|
85
|
+
return marker;
|
|
86
|
+
}
|
|
87
|
+
if (Array.isArray(value))
|
|
88
|
+
return value.map(walk);
|
|
89
|
+
if (typeof value === "object" && value !== null) {
|
|
90
|
+
const out = {};
|
|
91
|
+
for (const [key, inner] of Object.entries(value))
|
|
92
|
+
out[key] = walk(inner);
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
};
|
|
97
|
+
const spec = walk(resource.spec);
|
|
98
|
+
return {
|
|
99
|
+
kind: resource.kind,
|
|
100
|
+
slug: resource.slug,
|
|
101
|
+
uuid: resource.uuid,
|
|
102
|
+
identifier: identifiers.get(resource.uuid),
|
|
103
|
+
defineFn: meta.defineFn,
|
|
104
|
+
dir: meta.dir,
|
|
105
|
+
singleton: meta.singleton === true,
|
|
106
|
+
cdkImports: [...cdkImports].sort(),
|
|
107
|
+
localImports: [...localImports.entries()]
|
|
108
|
+
.map(([identifier, from]) => ({ identifier, from }))
|
|
109
|
+
.sort((a, b) => a.from.localeCompare(b.from)),
|
|
110
|
+
spec,
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"untar.d.ts","sourceRoot":"","sources":["../../../../src/deploy/pull/untar.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AA2B9D,wBAAgB,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,WAAW,EAAE,CA6D1D"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Minimal tar.gz extraction for pulled worker/app source archives. The backend
|
|
2
|
+
// builds them with archiver's tar-stream (USTAR headers, PAX extended headers
|
|
3
|
+
// only for >100-char paths), so a small reader covers the format: 512-byte
|
|
4
|
+
// header blocks, octal size, `prefix` field, and PAX `path=` overrides.
|
|
5
|
+
import { gunzipSync } from "node:zlib";
|
|
6
|
+
const BLOCK = 512;
|
|
7
|
+
function readString(block, offset, length) {
|
|
8
|
+
const slice = block.subarray(offset, offset + length);
|
|
9
|
+
const end = slice.indexOf(0);
|
|
10
|
+
return new TextDecoder().decode(end === -1 ? slice : slice.subarray(0, end));
|
|
11
|
+
}
|
|
12
|
+
function readOctal(block, offset, length) {
|
|
13
|
+
const text = readString(block, offset, length).trim();
|
|
14
|
+
return text.length === 0 ? 0 : parseInt(text, 8);
|
|
15
|
+
}
|
|
16
|
+
// Parse a PAX extended header body: lines of `<len> <key>=<value>\n`.
|
|
17
|
+
function paxPath(body) {
|
|
18
|
+
const text = new TextDecoder().decode(body);
|
|
19
|
+
for (const line of text.split("\n")) {
|
|
20
|
+
const space = line.indexOf(" ");
|
|
21
|
+
if (space === -1)
|
|
22
|
+
continue;
|
|
23
|
+
const entry = line.slice(space + 1);
|
|
24
|
+
if (entry.startsWith("path="))
|
|
25
|
+
return entry.slice("path=".length);
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
export function untarGz(archive) {
|
|
30
|
+
const tar = gunzipSync(archive);
|
|
31
|
+
const files = [];
|
|
32
|
+
let offset = 0;
|
|
33
|
+
let overridePath;
|
|
34
|
+
while (offset + BLOCK <= tar.length) {
|
|
35
|
+
const header = tar.subarray(offset, offset + BLOCK);
|
|
36
|
+
// Two all-zero blocks mark the end of the archive.
|
|
37
|
+
if (header.every((byte) => byte === 0))
|
|
38
|
+
break;
|
|
39
|
+
const size = readOctal(header, 124, 12);
|
|
40
|
+
const typeflag = String.fromCharCode(header[156] ?? 0);
|
|
41
|
+
const dataStart = offset + BLOCK;
|
|
42
|
+
const dataEnd = dataStart + size;
|
|
43
|
+
offset = dataStart + Math.ceil(size / BLOCK) * BLOCK;
|
|
44
|
+
// PAX extended header ('x') — may carry a long `path=` for the NEXT entry.
|
|
45
|
+
if (typeflag === "x" || typeflag === "g") {
|
|
46
|
+
const pathFromPax = paxPath(tar.subarray(dataStart, dataEnd));
|
|
47
|
+
if (typeflag === "x" && pathFromPax !== undefined) {
|
|
48
|
+
overridePath = pathFromPax;
|
|
49
|
+
}
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
// GNU long-name entry ('L') — the data IS the next entry's name.
|
|
53
|
+
if (typeflag === "L") {
|
|
54
|
+
overridePath = new TextDecoder()
|
|
55
|
+
.decode(tar.subarray(dataStart, dataEnd))
|
|
56
|
+
.replace(/\0+$/, "");
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
// Regular file ('0' or NUL); everything else (dirs, links) is skipped.
|
|
60
|
+
if (typeflag === "0" || typeflag === "\0") {
|
|
61
|
+
const name = readString(header, 0, 100);
|
|
62
|
+
const prefix = readString(header, 345, 155);
|
|
63
|
+
const rawPath = overridePath !== undefined
|
|
64
|
+
? overridePath
|
|
65
|
+
: prefix.length > 0
|
|
66
|
+
? `${prefix}/${name}`
|
|
67
|
+
: name;
|
|
68
|
+
overridePath = undefined;
|
|
69
|
+
// Normalize away leading ./ and /; reject traversal. The `..` check is
|
|
70
|
+
// segment-wise so legitimate names like `CHANGELOG..md` survive, and a
|
|
71
|
+
// backslash anywhere is rejected (a path separator on Windows).
|
|
72
|
+
const path = rawPath.replace(/^\.\//, "").replace(/^\/+/, "");
|
|
73
|
+
if (path.length === 0 ||
|
|
74
|
+
path.includes("\\") ||
|
|
75
|
+
path.split("/").includes("..")) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
files.push({ path, bytes: tar.subarray(dataStart, dataEnd) });
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
overridePath = undefined;
|
|
82
|
+
}
|
|
83
|
+
return files;
|
|
84
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Api } from "@cargo-ai/api";
|
|
2
2
|
import { type LiveReaders } from "./refresh.js";
|
|
3
|
+
export declare const VOLATILE: Set<string>;
|
|
4
|
+
export declare function deepOmit(value: unknown, isLeaf?: (value: unknown) => boolean): unknown;
|
|
5
|
+
export declare function isNotFound(error: unknown): boolean;
|
|
3
6
|
export declare function liveReaders(api: Api): LiveReaders;
|
|
4
7
|
//# sourceMappingURL=readers.live.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readers.live.d.ts","sourceRoot":"","sources":["../../../src/deploy/readers.live.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"readers.live.d.ts","sourceRoot":"","sources":["../../../src/deploy/readers.live.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAO5E,eAAO,MAAM,QAAQ,aAOnB,CAAC;AAIH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,GACnC,OAAO,CAYT;AAMD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKlD;AAeD,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,WAAW,CAqUjD"}
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
import { fingerprint } from "./refresh.js";
|
|
9
9
|
const GONE = { exists: false };
|
|
10
10
|
// Keys stripped anywhere in a projection before hashing: per-resource volatile
|
|
11
|
-
// ids and canvas coordinates that change without being user edits.
|
|
12
|
-
|
|
11
|
+
// ids and canvas coordinates that change without being user edits. Shared with
|
|
12
|
+
// the pull mappers, whose generated specs must hash-match this projection.
|
|
13
|
+
export const VOLATILE = new Set([
|
|
13
14
|
"temporalScheduleWorkflowId",
|
|
14
15
|
"temporalWorkflowId",
|
|
15
16
|
"position",
|
|
@@ -17,15 +18,19 @@ const VOLATILE = new Set([
|
|
|
17
18
|
"updatedAt",
|
|
18
19
|
"deletedAt",
|
|
19
20
|
]);
|
|
20
|
-
|
|
21
|
+
// Deep-copy dropping VOLATILE keys. `isLeaf` stops descent (pull passes its
|
|
22
|
+
// marker guard so embedded markers ship verbatim).
|
|
23
|
+
export function deepOmit(value, isLeaf) {
|
|
24
|
+
if (isLeaf !== undefined && isLeaf(value))
|
|
25
|
+
return value;
|
|
21
26
|
if (Array.isArray(value))
|
|
22
|
-
return value.map(deepOmit);
|
|
27
|
+
return value.map((item) => deepOmit(item, isLeaf));
|
|
23
28
|
if (value !== null && typeof value === "object") {
|
|
24
29
|
const out = {};
|
|
25
30
|
for (const [key, inner] of Object.entries(value)) {
|
|
26
31
|
if (VOLATILE.has(key))
|
|
27
32
|
continue;
|
|
28
|
-
out[key] = deepOmit(inner);
|
|
33
|
+
out[key] = deepOmit(inner, isLeaf);
|
|
29
34
|
}
|
|
30
35
|
return out;
|
|
31
36
|
}
|
|
@@ -34,7 +39,7 @@ function deepOmit(value) {
|
|
|
34
39
|
function present(config) {
|
|
35
40
|
return { exists: true, fingerprint: fingerprint(deepOmit(config)) };
|
|
36
41
|
}
|
|
37
|
-
function isNotFound(error) {
|
|
42
|
+
export function isNotFound(error) {
|
|
38
43
|
const reason = error.reason;
|
|
39
44
|
if (typeof reason === "string" && /notfound/i.test(reason))
|
|
40
45
|
return true;
|
|
@@ -132,6 +137,7 @@ export function liveReaders(api) {
|
|
|
132
137
|
"config",
|
|
133
138
|
"schedule",
|
|
134
139
|
"unification",
|
|
140
|
+
"additionalColumns",
|
|
135
141
|
"folderUuid",
|
|
136
142
|
"kind",
|
|
137
143
|
"connectorUuid",
|
package/build/src/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type { FolderHandle, FolderKind, FolderSpec, } from "./resources/folder.j
|
|
|
16
16
|
export { defineFolder } from "./resources/folder.js";
|
|
17
17
|
export type { McpServerHandle, McpServerSpec } from "./resources/mcpServer.js";
|
|
18
18
|
export { defineMcpServer } from "./resources/mcpServer.js";
|
|
19
|
-
export type { ExtractorColumns, ExtractorConfigs, ExtractorSlugs, ModelColumns, ModelHandle, ModelSpec,
|
|
19
|
+
export type { ExtractorColumns, ExtractorConfigs, ExtractorSlugs, ModelAdditionalColumnSpec, ModelAdditionalColumnSpecBase, ModelColumns, ModelComputedColumnSpec, ModelCustomColumnSpec, ModelHandle, ModelLookupColumnSpec, ModelMetricColumnSpec, ModelSpec, ModelUnificationColumnSpec, ModelUnificationParentSpec, ModelUnificationSpec, } from "./resources/model.js";
|
|
20
20
|
export { defineModel } from "./resources/model.js";
|
|
21
21
|
export type { PlayHandle, PlaySpec } from "./resources/play.js";
|
|
22
22
|
export { definePlay } from "./resources/play.js";
|
|
@@ -34,7 +34,7 @@ export { createWorker, OpenAPIRoute } from "@cargo-ai/worker-sdk";
|
|
|
34
34
|
export { agentRef, defineWorkflow, defineWorkflowFromNodes, toolRef, type WorkflowFromNodes, type WorkflowResourceRef, } from "@cargo-ai/workflow-sdk";
|
|
35
35
|
export type { EncryptionRef, ResourceKind, ResourceNode, SecretRef, Token, } from "./core.js";
|
|
36
36
|
export { env, isSecret, isToken, resolveSecrets, secret, token, } from "./core.js";
|
|
37
|
-
export type { AgentRef, ConnectorActionRef, ConnectorRef, DatasetRef, FolderRef, MemberRef, ModelRef, PlayRef, ResourceRef, SegmentRef, ToolRef, } from "./refs.js";
|
|
38
|
-
export { connectorActionRef, connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, segmentRef, } from "./refs.js";
|
|
37
|
+
export type { AgentRef, ConnectorActionRef, ConnectorRef, DatasetRef, FolderRef, MemberRef, ModelRef, PlayRef, RelationshipRef, ResourceRef, SegmentRef, ToolRef, WorkerRef, } from "./refs.js";
|
|
38
|
+
export { connectorActionRef, connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, relationshipRef, segmentRef, workerRef, } from "./refs.js";
|
|
39
39
|
export * from "./deploy/index.js";
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|
package/build/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAUA,YAAY,EACV,aAAa,EACb,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,QAAQ,EACR,sBAAsB,EACtB,YAAY,EACZ,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACrE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,YAAY,EACV,0BAA0B,EAC1B,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpE,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,YAAY,EACV,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,YAAY,EACV,YAAY,EACZ,UAAU,EACV,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,YAAY,EAAE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E,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMlE,OAAO,EACL,QAAQ,EACR,cAAc,EACd,uBAAuB,EACvB,OAAO,EACP,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,wBAAwB,CAAC;AAGhC,YAAY,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,KAAK,GACN,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,GAAG,EACH,QAAQ,EACR,OAAO,EACP,cAAc,EACd,MAAM,EACN,KAAK,GACN,MAAM,WAAW,CAAC;AAGnB,YAAY,EACV,QAAQ,EACR,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,eAAe,EACf,WAAW,EACX,UAAU,EACV,OAAO,EACP,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,OAAO,EACP,eAAe,EACf,UAAU,EACV,SAAS,GACV,MAAM,WAAW,CAAC;AAGnB,cAAc,mBAAmB,CAAC"}
|
package/build/src/index.js
CHANGED
|
@@ -30,6 +30,6 @@ export { createWorker, OpenAPIRoute } from "@cargo-ai/worker-sdk";
|
|
|
30
30
|
// types stay in `@cargo-ai/workflow-sdk`.
|
|
31
31
|
export { agentRef, defineWorkflow, defineWorkflowFromNodes, toolRef, } from "@cargo-ai/workflow-sdk";
|
|
32
32
|
export { env, isSecret, isToken, resolveSecrets, secret, token, } from "./core.js";
|
|
33
|
-
export { connectorActionRef, connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, segmentRef, } from "./refs.js";
|
|
33
|
+
export { connectorActionRef, connectorRef, datasetRef, folderRef, memberRef, modelRef, playRef, refUuid, relationshipRef, segmentRef, workerRef, } from "./refs.js";
|
|
34
34
|
// ── deployment: plan + apply ─────────────────────────────────────────────────
|
|
35
35
|
export * from "./deploy/index.js";
|
package/build/src/refs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Token } from "./core.js";
|
|
2
|
-
export type ResourceKindRef = "connector" | "dataset" | "model" | "folder" | "play" | "tool" | "agent" | "member" | "segment";
|
|
2
|
+
export type ResourceKindRef = "connector" | "dataset" | "model" | "folder" | "play" | "tool" | "agent" | "member" | "segment" | "relationship" | "worker";
|
|
3
3
|
export type ResourceRef<K extends ResourceKindRef = ResourceKindRef> = {
|
|
4
4
|
readonly uuid: Token | string;
|
|
5
5
|
readonly resource: K;
|
|
@@ -13,6 +13,8 @@ export type ToolRef = ResourceRef<"tool">;
|
|
|
13
13
|
export type AgentRef = ResourceRef<"agent">;
|
|
14
14
|
export type MemberRef = ResourceRef<"member">;
|
|
15
15
|
export type SegmentRef = ResourceRef<"segment">;
|
|
16
|
+
export type RelationshipRef = ResourceRef<"relationship">;
|
|
17
|
+
export type WorkerRef = ResourceRef<"worker">;
|
|
16
18
|
/** Reference a connector by uuid (e.g. an adopted OAuth connector). */
|
|
17
19
|
export declare const connectorRef: (uuid: string) => ConnectorRef;
|
|
18
20
|
/** Reference a connector's auto-created dataset by uuid, for `defineModel`. */
|
|
@@ -27,6 +29,10 @@ export declare const playRef: (uuid: string) => PlayRef;
|
|
|
27
29
|
export declare const memberRef: (uuid: string) => MemberRef;
|
|
28
30
|
/** Reference a segment by uuid. */
|
|
29
31
|
export declare const segmentRef: (uuid: string) => SegmentRef;
|
|
32
|
+
/** Reference a model relationship by uuid (e.g. for a metric column). */
|
|
33
|
+
export declare const relationshipRef: (uuid: string) => RelationshipRef;
|
|
34
|
+
/** Reference a hosting worker by uuid (e.g. a custom integration's backend). */
|
|
35
|
+
export declare const workerRef: (uuid: string) => WorkerRef;
|
|
30
36
|
/**
|
|
31
37
|
* A reference to one action of a connector (e.g. an enrichment endpoint), for an
|
|
32
38
|
* agent's / MCP server's `uses`. Produced by accessing the action off a connector
|
package/build/src/refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/refs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,SAAS,GACT,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../src/refs.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,SAAS,GACT,OAAO,GACP,QAAQ,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,QAAQ,GACR,SAAS,GACT,cAAc,GACd,QAAQ,CAAC;AAEb,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IAAI;IACrE,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;AAChD,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAC5C,MAAM,MAAM,SAAS,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAC1C,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAC1C,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC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C,EAAE,MAAM,CAAA;CAAE,cACjD,MAAM,gBACJ,MAAM,KACnB,kBAUD,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,OAAO,QAAS;IAAE,IAAI,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,KAAG,KAAK,GAAG,MACtD,CAAC"}
|
package/build/src/refs.js
CHANGED
|
@@ -38,6 +38,16 @@ export const segmentRef = (uuid) => ({
|
|
|
38
38
|
uuid,
|
|
39
39
|
resource: "segment",
|
|
40
40
|
});
|
|
41
|
+
/** Reference a model relationship by uuid (e.g. for a metric column). */
|
|
42
|
+
export const relationshipRef = (uuid) => ({
|
|
43
|
+
uuid,
|
|
44
|
+
resource: "relationship",
|
|
45
|
+
});
|
|
46
|
+
/** Reference a hosting worker by uuid (e.g. a custom integration's backend). */
|
|
47
|
+
export const workerRef = (uuid) => ({
|
|
48
|
+
uuid,
|
|
49
|
+
resource: "worker",
|
|
50
|
+
});
|
|
41
51
|
/**
|
|
42
52
|
* Reference a connector action by an explicit connector + action slug — the
|
|
43
53
|
* escape hatch when you don't have a typed connector handle (`connector.actions.<slug>`
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type Token } from "../core.js";
|
|
2
|
+
import { type WorkerRef } from "../refs.js";
|
|
2
3
|
import type { WorkerHandle } from "./worker.js";
|
|
3
4
|
export type CustomIntegrationSpec = {
|
|
4
|
-
/** The worker serving the Custom Integration HTTP contract
|
|
5
|
-
worker: WorkerHandle;
|
|
5
|
+
/** The worker serving the Custom Integration HTTP contract — a handle or `workerRef(uuid)`. */
|
|
6
|
+
worker: WorkerHandle | WorkerRef;
|
|
6
7
|
};
|
|
7
8
|
export type CustomIntegrationHandle = {
|
|
8
9
|
readonly slug: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customIntegration.d.ts","sourceRoot":"","sources":["../../../src/resources/customIntegration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"customIntegration.d.ts","sourceRoot":"","sources":["../../../src/resources/customIntegration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG;IAClC,+FAA+F;IAC/F,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;CACtB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,qBAAqB,GAC1B,uBAAuB,CAWzB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { SegmentationTypes, StorageTypes } from "@cargo-ai/types";
|
|
1
|
+
import type { ExpressionTypes, SegmentationTypes, StorageTypes } from "@cargo-ai/types";
|
|
2
2
|
import { type Token } from "../core.js";
|
|
3
|
-
import { type DatasetRef, type FolderRef, type ModelRef } from "../refs.js";
|
|
3
|
+
import { type DatasetRef, type FolderRef, type ModelRef, type RelationshipRef } from "../refs.js";
|
|
4
4
|
import type { ConnectorHandle } from "./connector.js";
|
|
5
5
|
import type { FolderHandle } from "./folder.js";
|
|
6
|
+
import type { RelationshipHandle } from "./relationship.js";
|
|
6
7
|
export type ScheduleSpec = {
|
|
7
8
|
type: "cron";
|
|
8
9
|
cron: string;
|
|
@@ -10,11 +11,11 @@ export type ScheduleSpec = {
|
|
|
10
11
|
type: "dbt";
|
|
11
12
|
jobId: string;
|
|
12
13
|
};
|
|
13
|
-
export type
|
|
14
|
+
export type ModelUnificationColumnSpec = {
|
|
14
15
|
slug: string;
|
|
15
16
|
reference: string;
|
|
16
17
|
};
|
|
17
|
-
export type
|
|
18
|
+
export type ModelUnificationParentSpec = {
|
|
18
19
|
kind: "model";
|
|
19
20
|
columnSlug: string;
|
|
20
21
|
parent: ModelHandle | ModelRef;
|
|
@@ -23,20 +24,60 @@ export type UnificationParentSpec = {
|
|
|
23
24
|
columnSlug: string;
|
|
24
25
|
reference: string;
|
|
25
26
|
};
|
|
26
|
-
export type
|
|
27
|
+
export type ModelUnificationSpec = {
|
|
27
28
|
source: "integration";
|
|
28
29
|
} | {
|
|
29
30
|
source: "custom";
|
|
30
31
|
type: StorageTypes.ModelUnificationType;
|
|
31
|
-
uniqueColumns:
|
|
32
|
+
uniqueColumns: ModelUnificationColumnSpec[];
|
|
32
33
|
/** Columns exposed on the unified model (defaults to all). */
|
|
33
34
|
selectedColumnSlugs?: string[];
|
|
34
35
|
/** Column carrying the event timestamp (event unification types only). */
|
|
35
36
|
timeColumnSlug?: string;
|
|
36
|
-
parent?:
|
|
37
|
+
parent?: ModelUnificationParentSpec;
|
|
37
38
|
/** Restrict which rows take part in unification (defaults to all rows). */
|
|
38
39
|
filter?: SegmentationTypes.Filter;
|
|
39
40
|
};
|
|
41
|
+
export type ModelAdditionalColumnSpecBase = {
|
|
42
|
+
slug: string;
|
|
43
|
+
type: StorageTypes.ColumnType;
|
|
44
|
+
/** Display name. Defaults to the title-cased slug. */
|
|
45
|
+
label?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
properties?: string[];
|
|
48
|
+
};
|
|
49
|
+
/** A manually-filled column (values written per record, no formula). */
|
|
50
|
+
export type ModelCustomColumnSpec = ModelAdditionalColumnSpecBase & {
|
|
51
|
+
kind: "custom";
|
|
52
|
+
};
|
|
53
|
+
/** A formula column evaluated per record. */
|
|
54
|
+
export type ModelComputedColumnSpec = ModelAdditionalColumnSpecBase & {
|
|
55
|
+
kind: "computed";
|
|
56
|
+
expression: ExpressionTypes.Expression;
|
|
57
|
+
columnsUsed?: string[];
|
|
58
|
+
};
|
|
59
|
+
/** An aggregation over the records a relationship joins to. */
|
|
60
|
+
export type ModelMetricColumnSpec = ModelAdditionalColumnSpecBase & {
|
|
61
|
+
kind: "metric";
|
|
62
|
+
relationship: RelationshipHandle | RelationshipRef;
|
|
63
|
+
aggregation: {
|
|
64
|
+
function: StorageTypes.AggregationFunction;
|
|
65
|
+
columnSlug: string;
|
|
66
|
+
};
|
|
67
|
+
filter?: SegmentationTypes.Filter;
|
|
68
|
+
};
|
|
69
|
+
/** A value copied from a matching record of another model. */
|
|
70
|
+
export type ModelLookupColumnSpec = ModelAdditionalColumnSpecBase & {
|
|
71
|
+
kind: "lookup";
|
|
72
|
+
join: {
|
|
73
|
+
model: ModelHandle | ModelRef;
|
|
74
|
+
fromColumnSlug: string;
|
|
75
|
+
toColumnSlug: string;
|
|
76
|
+
};
|
|
77
|
+
extractColumnSlug: string;
|
|
78
|
+
filter?: SegmentationTypes.Filter;
|
|
79
|
+
};
|
|
80
|
+
export type ModelAdditionalColumnSpec = ModelCustomColumnSpec | ModelComputedColumnSpec | ModelMetricColumnSpec | ModelLookupColumnSpec;
|
|
40
81
|
export interface ExtractorConfigs {
|
|
41
82
|
}
|
|
42
83
|
type ExtractorConfigFor<S extends string, E extends string> = S extends keyof ExtractorConfigs ? E extends keyof ExtractorConfigs[S] ? ExtractorConfigs[S][E] : Record<string, unknown> : Record<string, unknown>;
|
|
@@ -81,7 +122,14 @@ export type ModelSpec<S extends string = string, E extends LiteralUnion<Extracto
|
|
|
81
122
|
* via an update once the model exists, so it also covers models the deploy
|
|
82
123
|
* adopts.
|
|
83
124
|
*/
|
|
84
|
-
unification?:
|
|
125
|
+
unification?: ModelUnificationSpec;
|
|
126
|
+
/**
|
|
127
|
+
* Columns added on top of the extracted schema (custom / computed / metric /
|
|
128
|
+
* lookup). When declared, the list is authoritative: deploy creates missing
|
|
129
|
+
* columns, updates changed ones, and removes additional columns no longer
|
|
130
|
+
* listed. Omit to leave the model's live additional columns untouched.
|
|
131
|
+
*/
|
|
132
|
+
additionalColumns?: ModelAdditionalColumnSpec[];
|
|
85
133
|
};
|
|
86
134
|
export type ModelHandle<Slug extends string = string, S extends string = string, E extends string = string> = {
|
|
87
135
|
readonly slug: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/resources/model.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/resources/model.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EAEb,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAKnC,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAKF,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;I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