@cargo-ai/cdk 1.0.5 → 1.0.7
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 +59 -9
- package/build/src/cli/commands/from.d.ts +65 -0
- package/build/src/cli/commands/from.d.ts.map +1 -0
- package/build/src/cli/commands/from.js +275 -0
- package/build/src/cli/commands/init.d.ts +1 -1
- package/build/src/cli/commands/init.d.ts.map +1 -1
- package/build/src/cli/commands/init.js +32 -13
- package/build/src/cli/commands/types.d.ts.map +1 -1
- package/build/src/cli/commands/types.js +75 -37
- package/build/src/core.d.ts +1 -1
- package/build/src/core.d.ts.map +1 -1
- package/build/src/deploy/apply.d.ts +6 -0
- package/build/src/deploy/apply.d.ts.map +1 -1
- package/build/src/deploy/apply.js +4 -0
- package/build/src/deploy/destroy.d.ts.map +1 -1
- package/build/src/deploy/destroy.js +33 -0
- package/build/src/deploy/executors.live.d.ts.map +1 -1
- package/build/src/deploy/executors.live.js +157 -1
- package/build/src/deploy/readers.live.d.ts.map +1 -1
- package/build/src/deploy/readers.live.js +34 -1
- package/build/src/index.d.ts +11 -7
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +6 -4
- package/build/src/refs.d.ts +22 -0
- package/build/src/refs.d.ts.map +1 -1
- package/build/src/refs.js +11 -2
- package/build/src/resources/actions.d.ts +39 -19
- package/build/src/resources/actions.d.ts.map +1 -1
- package/build/src/resources/actions.js +60 -33
- package/build/src/resources/agent.d.ts +33 -23
- package/build/src/resources/agent.d.ts.map +1 -1
- package/build/src/resources/agent.js +24 -24
- package/build/src/resources/app.d.ts +3 -1
- package/build/src/resources/app.d.ts.map +1 -1
- package/build/src/resources/app.js +2 -1
- package/build/src/resources/capacity.d.ts +11 -0
- package/build/src/resources/capacity.d.ts.map +1 -1
- package/build/src/resources/capacity.js +81 -0
- package/build/src/resources/connector.d.ts +10 -0
- package/build/src/resources/connector.d.ts.map +1 -1
- package/build/src/resources/connector.js +18 -1
- package/build/src/resources/customIntegration.d.ts +12 -0
- package/build/src/resources/customIntegration.d.ts.map +1 -0
- package/build/src/resources/customIntegration.js +18 -0
- package/build/src/resources/mcpServer.d.ts +8 -10
- package/build/src/resources/mcpServer.d.ts.map +1 -1
- package/build/src/resources/mcpServer.js +4 -7
- package/build/src/resources/model.d.ts +47 -4
- package/build/src/resources/model.d.ts.map +1 -1
- package/build/src/resources/model.js +38 -1
- package/build/src/resources/relationship.d.ts +21 -0
- package/build/src/resources/relationship.d.ts.map +1 -0
- package/build/src/resources/relationship.js +39 -0
- package/build/src/resources/worker.d.ts +13 -1
- package/build/src/resources/worker.d.ts.map +1 -1
- package/build/src/resources/worker.js +3 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/templates/blank/cargo.ts +17 -22
- package/templates/full/README.md +7 -4
- package/templates/full/agents/sdr.ts +12 -8
- package/templates/full/connectors/hunter.ts +10 -0
- package/templates/full/mcp/crm.ts +9 -6
- package/templates/full/tools/enrich.ts +28 -9
|
@@ -5,8 +5,22 @@
|
|
|
5
5
|
// revenue-organization `CreateCapacityPayload`.
|
|
6
6
|
import { register, resourceId, token } from "../core.js";
|
|
7
7
|
import { refUuid } from "../refs.js";
|
|
8
|
+
/**
|
|
9
|
+
* The `{{member.ids.<connector_slug>}}` expression for a capacity filter —
|
|
10
|
+
* resolved by the backend at allocation time to the members' user ids in that
|
|
11
|
+
* connector. Use it as the `values` of a `kind: "string"`, `operator: "is"`
|
|
12
|
+
* condition on the column holding each record's owner id. Pass a connector
|
|
13
|
+
* handle, or a raw workspace connector slug for a connector not defined in
|
|
14
|
+
* code (e.g. an adopted OAuth connector whose actual slug differs from the
|
|
15
|
+
* CDK slug).
|
|
16
|
+
*/
|
|
17
|
+
export function memberIds(connector) {
|
|
18
|
+
const slug = typeof connector === "string" ? connector : connector.slug;
|
|
19
|
+
return `{{member.ids.${slug}}}`;
|
|
20
|
+
}
|
|
8
21
|
export function defineCapacity(slug, spec) {
|
|
9
22
|
const id = resourceId("capacity", slug);
|
|
23
|
+
validateCapacityFilter(slug, spec);
|
|
10
24
|
register({
|
|
11
25
|
id,
|
|
12
26
|
kind: "capacity",
|
|
@@ -28,6 +42,73 @@ export function defineCapacity(slug, spec) {
|
|
|
28
42
|
});
|
|
29
43
|
return { slug, uuid: token(id, "uuid"), resource: "capacity" };
|
|
30
44
|
}
|
|
45
|
+
// Mirrors the backend's capacity-filter rules (create/update reject the payload
|
|
46
|
+
// otherwise): a model-mapped capacity needs id/time columns and a filter with at
|
|
47
|
+
// least one member-ids condition, and every member-ids condition must be a
|
|
48
|
+
// single-valued `is` on a string column of the capacity's own model.
|
|
49
|
+
const MEMBER_IDS = /{{\s*member\.ids\.[a-z0-9_-]+\s*}}/;
|
|
50
|
+
const MEMBERS_IDS_TYPO = /{{\s*members\.ids\./;
|
|
51
|
+
function fail(slug, message) {
|
|
52
|
+
throw new Error(`capacity "${slug}" — ${message}`);
|
|
53
|
+
}
|
|
54
|
+
function validateCapacityFilter(slug, spec) {
|
|
55
|
+
const conditions = spec.filter === undefined
|
|
56
|
+
? []
|
|
57
|
+
: spec.filter.groups.flatMap((group) => group.conditions);
|
|
58
|
+
const memberIdsConditions = conditions.filter((condition) => {
|
|
59
|
+
const strings = stringsIn(condition);
|
|
60
|
+
if (strings.some((value) => MEMBERS_IDS_TYPO.test(value))) {
|
|
61
|
+
fail(slug, 'filter references "{{members.ids.…}}" — the expression root is singular; use memberIds(connector) → "{{member.ids.<connector_slug>}}".');
|
|
62
|
+
}
|
|
63
|
+
return strings.some((value) => MEMBER_IDS.test(value));
|
|
64
|
+
});
|
|
65
|
+
for (const condition of memberIdsConditions) {
|
|
66
|
+
if (condition.kind !== "string") {
|
|
67
|
+
fail(slug, `a member-ids expression must live on a { kind: "string" } condition, got kind "${condition.kind}".`);
|
|
68
|
+
}
|
|
69
|
+
if (condition.operator !== "is") {
|
|
70
|
+
fail(slug, `member-ids conditions only support the "is" operator, got "${condition.operator}".`);
|
|
71
|
+
}
|
|
72
|
+
if (Array.isArray(condition.values)) {
|
|
73
|
+
fail(slug, "member-ids conditions take a single value — pass values: memberIds(connector), not an array.");
|
|
74
|
+
}
|
|
75
|
+
if (condition.relatedModelUuid !== undefined) {
|
|
76
|
+
fail(slug, "member-ids conditions on a related model are not supported — reference a column of the capacity's own model.");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (spec.model === undefined)
|
|
80
|
+
return;
|
|
81
|
+
if (spec.filter === undefined) {
|
|
82
|
+
fail(slug, "a capacity with a model needs a filter mapping records to members — add a condition with values: memberIds(connector).");
|
|
83
|
+
}
|
|
84
|
+
if (spec.idColumnSlug === undefined) {
|
|
85
|
+
fail(slug, "idColumnSlug is required when model is set.");
|
|
86
|
+
}
|
|
87
|
+
if (spec.timeColumnSlug === undefined) {
|
|
88
|
+
fail(slug, "timeColumnSlug is required when model is set.");
|
|
89
|
+
}
|
|
90
|
+
if (memberIdsConditions.length === 0) {
|
|
91
|
+
fail(slug, 'the filter must map records to members — add { kind: "string", columnSlug: "<owner column>", operator: "is", values: memberIds(connector) }.');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** Every string reachable in a condition (values live at different keys per kind). */
|
|
95
|
+
function stringsIn(value, acc = []) {
|
|
96
|
+
if (typeof value === "string") {
|
|
97
|
+
acc.push(value);
|
|
98
|
+
return acc;
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(value)) {
|
|
101
|
+
for (const item of value)
|
|
102
|
+
stringsIn(item, acc);
|
|
103
|
+
return acc;
|
|
104
|
+
}
|
|
105
|
+
if (value !== null && typeof value === "object") {
|
|
106
|
+
for (const item of Object.values(value))
|
|
107
|
+
stringsIn(item, acc);
|
|
108
|
+
return acc;
|
|
109
|
+
}
|
|
110
|
+
return acc;
|
|
111
|
+
}
|
|
31
112
|
function toTitle(slug) {
|
|
32
113
|
return slug
|
|
33
114
|
.split(/[-_]/)
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { Integrations } from "@cargo-ai/workflow-sdk";
|
|
1
2
|
import { type Token } from "../core.js";
|
|
3
|
+
import type { ConnectorActionRef } from "../refs.js";
|
|
2
4
|
export type RateLimitSpec = {
|
|
3
5
|
unit: "day" | "hour" | "minute" | "second";
|
|
4
6
|
max: number;
|
|
@@ -15,6 +17,11 @@ export type ConnectorSpec<S extends string = string> = {
|
|
|
15
17
|
cacheTtlMilliseconds?: number;
|
|
16
18
|
adopt?: boolean;
|
|
17
19
|
};
|
|
20
|
+
type ConnectorActions<S extends string> = S extends keyof Integrations ? {
|
|
21
|
+
readonly [A in keyof Integrations[S] & string]: ConnectorActionRef;
|
|
22
|
+
} : {
|
|
23
|
+
readonly [actionSlug: string]: ConnectorActionRef;
|
|
24
|
+
};
|
|
18
25
|
export type ConnectorHandle<S extends string = string> = {
|
|
19
26
|
readonly slug: string;
|
|
20
27
|
readonly integrationSlug: S;
|
|
@@ -24,6 +31,9 @@ export type ConnectorHandle<S extends string = string> = {
|
|
|
24
31
|
* dataset, via `defineModel`) is referenced. Carries the integration slug `S`
|
|
25
32
|
* so `defineModel({ dataset })` can type extractor config. */
|
|
26
33
|
readonly resource: "connector";
|
|
34
|
+
/** This connector's actions — `connector.actions.<actionSlug>` — for an
|
|
35
|
+
* agent's / MCP server's `uses`. */
|
|
36
|
+
readonly actions: ConnectorActions<S>;
|
|
27
37
|
};
|
|
28
38
|
export declare function defineConnector<S extends string>(slug: string, spec: ConnectorSpec<S>): ConnectorHandle<S>;
|
|
29
39
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/resources/connector.ts"],"names":[],"mappings":"AAYA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../src/resources/connector.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;A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AAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;IAC5B;;mEAE+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B;yCACqC;IACrC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAC9C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACrB,eAAe,CAAC,CAAC,CAAC,CAuCpB"}
|
|
@@ -26,12 +26,29 @@ export function defineConnector(slug, spec) {
|
|
|
26
26
|
adopt: spec.adopt === undefined ? false : spec.adopt,
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
|
+
const uuid = token(id, "uuid");
|
|
30
|
+
// A small Proxy: `connector.actions.<slug>` → a `ConnectorActionRef` pinned to
|
|
31
|
+
// this connector. The handle itself stays a plain object; only this dedicated
|
|
32
|
+
// `actions` namespace is proxied (symbols and `then` pass through as undefined).
|
|
33
|
+
const actions = new Proxy({}, {
|
|
34
|
+
get(_target, prop) {
|
|
35
|
+
if (typeof prop !== "string" || prop === "then")
|
|
36
|
+
return undefined;
|
|
37
|
+
return {
|
|
38
|
+
resource: "connectorAction",
|
|
39
|
+
connectorUuid: uuid,
|
|
40
|
+
integration: spec.integration,
|
|
41
|
+
actionSlug: prop,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
29
45
|
return {
|
|
30
46
|
slug,
|
|
31
47
|
integrationSlug: spec.integration,
|
|
32
|
-
uuid
|
|
48
|
+
uuid,
|
|
33
49
|
datasetUuid: token(id, "datasetUuid"),
|
|
34
50
|
resource: "connector",
|
|
51
|
+
actions,
|
|
35
52
|
};
|
|
36
53
|
}
|
|
37
54
|
function toTitle(slug) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Token } from "../core.js";
|
|
2
|
+
import type { WorkerHandle } from "./worker.js";
|
|
3
|
+
export type CustomIntegrationSpec = {
|
|
4
|
+
/** The worker serving the Custom Integration HTTP contract. */
|
|
5
|
+
worker: WorkerHandle;
|
|
6
|
+
};
|
|
7
|
+
export type CustomIntegrationHandle = {
|
|
8
|
+
readonly slug: string;
|
|
9
|
+
readonly uuid: Token;
|
|
10
|
+
};
|
|
11
|
+
export declare function defineCustomIntegration(slug: string, spec: CustomIntegrationSpec): CustomIntegrationHandle;
|
|
12
|
+
//# sourceMappingURL=customIntegration.d.ts.map
|
|
@@ -0,0 +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;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG;IAClC,+DAA+D;IAC/D,MAAM,EAAE,YAAY,CAAC;CACtB,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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// defineCustomIntegration — registers a worker-backed custom integration in
|
|
2
|
+
// the workspace's connector catalog. The worker serves the Custom Integration
|
|
3
|
+
// HTTP contract (`createCustomIntegration` from @cargo-ai/worker-sdk); Cargo
|
|
4
|
+
// reads its `GET /manifest` once the worker is deployed and promoted.
|
|
5
|
+
import { register, resourceId, token } from "../core.js";
|
|
6
|
+
import { refUuid } from "../refs.js";
|
|
7
|
+
export function defineCustomIntegration(slug, spec) {
|
|
8
|
+
const id = resourceId("customIntegration", slug);
|
|
9
|
+
register({
|
|
10
|
+
id,
|
|
11
|
+
kind: "customIntegration",
|
|
12
|
+
slug,
|
|
13
|
+
spec: {
|
|
14
|
+
workerUuid: refUuid(spec.worker),
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
return { slug, uuid: token(id, "uuid") };
|
|
18
|
+
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { type Token } from "../core.js";
|
|
2
2
|
import { type FolderRef } from "../refs.js";
|
|
3
|
-
import { type AgentUse
|
|
4
|
-
import { type ModelUse } from "./agent.js";
|
|
3
|
+
import { type AgentUse } from "./actions.js";
|
|
5
4
|
import type { FolderHandle } from "./folder.js";
|
|
6
5
|
export type McpServerSpec = {
|
|
7
6
|
name?: string;
|
|
8
7
|
description?: string;
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
models?: ModelUse[];
|
|
8
|
+
/**
|
|
9
|
+
* Everything the server exposes, in one array — tools, agents, connector
|
|
10
|
+
* actions, and data models. Each entry is a handle (bare or `{ ref, …options }`):
|
|
11
|
+
* a `defineTool` / `defineAgent` / `defineModel` handle, or a connector action
|
|
12
|
+
* `connector.<actionSlug>`. See `AgentUse`.
|
|
13
|
+
*/
|
|
14
|
+
uses?: AgentUse[];
|
|
17
15
|
folder?: FolderHandle | FolderRef;
|
|
18
16
|
};
|
|
19
17
|
export type McpServerHandle = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../../src/resources/mcpServer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,YAAY,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../../../src/resources/mcpServer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;CAChC,CAAC;AAEF,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,aAAa,GAClB,eAAe,CAiBjB"}
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
// `CreateMcpServerPayload`. Uuid-only identity (no slug) — state-tracked.
|
|
5
5
|
import { register, resourceId, token } from "../core.js";
|
|
6
6
|
import { refUuid } from "../refs.js";
|
|
7
|
-
import {
|
|
8
|
-
import { normalizeModels } from "./agent.js";
|
|
7
|
+
import { normalizeUses } from "./actions.js";
|
|
9
8
|
export function defineMcpServer(slug, spec) {
|
|
10
9
|
const id = resourceId("mcpServer", slug);
|
|
11
10
|
register({
|
|
@@ -17,11 +16,9 @@ export function defineMcpServer(slug, spec) {
|
|
|
17
16
|
name: spec.name === undefined ? toTitle(slug) : spec.name,
|
|
18
17
|
description: spec.description === undefined ? null : spec.description,
|
|
19
18
|
folderUuid: spec.folder === undefined ? undefined : refUuid(spec.folder),
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
connectorActions: normalizeConnectorActions(spec.connectorActions),
|
|
24
|
-
models: normalizeModels(spec.models, true),
|
|
19
|
+
// `uses` splits into the four buckets the executor resolves →
|
|
20
|
+
// AiTypes.Action[] / Resource[].
|
|
21
|
+
...normalizeUses(spec.uses),
|
|
25
22
|
},
|
|
26
23
|
});
|
|
27
24
|
return { slug, uuid: token(id, "uuid"), resource: "mcpServer" };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { SegmentationTypes, StorageTypes } from "@cargo-ai/types";
|
|
1
2
|
import { type Token } from "../core.js";
|
|
2
|
-
import { type DatasetRef, type FolderRef } from "../refs.js";
|
|
3
|
+
import { type DatasetRef, type FolderRef, type ModelRef } from "../refs.js";
|
|
3
4
|
import type { ConnectorHandle } from "./connector.js";
|
|
4
5
|
import type { FolderHandle } from "./folder.js";
|
|
5
6
|
export type ScheduleSpec = {
|
|
@@ -9,26 +10,68 @@ export type ScheduleSpec = {
|
|
|
9
10
|
type: "dbt";
|
|
10
11
|
jobId: string;
|
|
11
12
|
};
|
|
13
|
+
export type UnificationColumnSpec = {
|
|
14
|
+
slug: string;
|
|
15
|
+
reference: string;
|
|
16
|
+
};
|
|
17
|
+
export type UnificationParentSpec = {
|
|
18
|
+
kind: "model";
|
|
19
|
+
columnSlug: string;
|
|
20
|
+
parent: ModelHandle | ModelRef;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "reference";
|
|
23
|
+
columnSlug: string;
|
|
24
|
+
reference: string;
|
|
25
|
+
};
|
|
26
|
+
export type UnificationSpec = {
|
|
27
|
+
source: "integration";
|
|
28
|
+
} | {
|
|
29
|
+
source: "custom";
|
|
30
|
+
type: StorageTypes.ModelUnificationType;
|
|
31
|
+
uniqueColumns: UnificationColumnSpec[];
|
|
32
|
+
/** Columns exposed on the unified model (defaults to all). */
|
|
33
|
+
selectedColumnSlugs?: string[];
|
|
34
|
+
/** Column carrying the event timestamp (event unification types only). */
|
|
35
|
+
timeColumnSlug?: string;
|
|
36
|
+
parent?: UnificationParentSpec;
|
|
37
|
+
/** Restrict which rows take part in unification (defaults to all rows). */
|
|
38
|
+
filter?: SegmentationTypes.Filter;
|
|
39
|
+
};
|
|
12
40
|
export interface ExtractorConfigs {
|
|
13
41
|
}
|
|
14
42
|
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>;
|
|
15
|
-
export
|
|
43
|
+
export interface ExtractorSlugs {
|
|
44
|
+
}
|
|
45
|
+
type ExtractorSlugFor<S extends string> = S extends keyof ExtractorSlugs ? ExtractorSlugs[S] & string : string;
|
|
46
|
+
type LiteralUnion<T extends string> = T | (string & {});
|
|
47
|
+
export type ModelSpec<S extends string = string, E extends LiteralUnion<ExtractorSlugFor<S>> = LiteralUnion<ExtractorSlugFor<S>>> = {
|
|
16
48
|
name?: string;
|
|
17
49
|
description?: string;
|
|
18
50
|
/** Source dataset — a connector handle (its dataset) or a `datasetRef(uuid)`. */
|
|
19
51
|
dataset: ConnectorHandle<S> | DatasetRef;
|
|
20
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* An extractor the source's integration exposes, e.g. "fetchRecords". After
|
|
54
|
+
* `cargo-ai cdk types`, editors autocomplete the connector's known extractors;
|
|
55
|
+
* an unsynced/newer slug is still accepted.
|
|
56
|
+
*/
|
|
21
57
|
extractSlug: E;
|
|
22
58
|
/** Extractor config — validated against the extractor's schema on apply. */
|
|
23
59
|
config?: ExtractorConfigFor<S, E>;
|
|
24
60
|
schedule?: ScheduleSpec;
|
|
25
61
|
folder?: FolderHandle | FolderRef;
|
|
62
|
+
/**
|
|
63
|
+
* How this model participates in unification. Omit to keep the source's
|
|
64
|
+
* default (a connector model defaults to its integration's mapping). Applied
|
|
65
|
+
* via an update once the model exists, so it also covers models the deploy
|
|
66
|
+
* adopts.
|
|
67
|
+
*/
|
|
68
|
+
unification?: UnificationSpec;
|
|
26
69
|
};
|
|
27
70
|
export type ModelHandle = {
|
|
28
71
|
readonly slug: string;
|
|
29
72
|
readonly uuid: Token;
|
|
30
73
|
readonly resource: "model";
|
|
31
74
|
};
|
|
32
|
-
export declare function defineModel<S extends string, E extends
|
|
75
|
+
export declare function defineModel<S extends string, E extends LiteralUnion<ExtractorSlugFor<S>>>(slug: string, spec: ModelSpec<S, E>): ModelHandle;
|
|
33
76
|
export {};
|
|
34
77
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/resources/model.ts"],"names":[],"mappings":"AAYA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/resources/model.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,QAAQ,EAEd,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,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,qBAAqB,GAAG;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAKF,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,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AG,MAAM,EACzB,CAAC,SAAS,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CACxD,gBAAgB,CAAC,CAAC,CAAC,CACpB,IACC;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IACzC;;;;OAIG;IACH,WAAW,EAAE,CAAC,CAAC;IACf,4EAA4E;IAC5E,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B,CAAC;AAQF,wBAAgB,WAAW,CACzB,CAAC,SAAS,MAAM,EAChB,CAAC,SAAS,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAC3C,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAsBlD"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
//
|
|
11
11
|
// Compiles to the storage `CreateModelPayload` once tokens are resolved.
|
|
12
12
|
import { register, resourceId, token } from "../core.js";
|
|
13
|
-
import { refUuid } from "../refs.js";
|
|
13
|
+
import { refUuid, } from "../refs.js";
|
|
14
14
|
// A connector handle references its auto-created dataset (`.datasetUuid`); a
|
|
15
15
|
// `datasetRef` references the dataset directly (`.uuid`).
|
|
16
16
|
function datasetUuidOf(dataset) {
|
|
@@ -31,10 +31,47 @@ export function defineModel(slug, spec) {
|
|
|
31
31
|
config: spec.config === undefined ? {} : spec.config,
|
|
32
32
|
schedule: spec.schedule,
|
|
33
33
|
folderUuid: spec.folder === undefined ? undefined : refUuid(spec.folder),
|
|
34
|
+
unification: spec.unification === undefined
|
|
35
|
+
? undefined
|
|
36
|
+
: compileUnification(spec.unification),
|
|
34
37
|
},
|
|
35
38
|
});
|
|
36
39
|
return { slug, uuid: token(id, "uuid"), resource: "model" };
|
|
37
40
|
}
|
|
41
|
+
// Lower a `UnificationSpec` to the wire shape `StorageTypes.ModelUnification`.
|
|
42
|
+
// The only reshaping is the parent link: a `model` parent carries a handle/ref
|
|
43
|
+
// in code (so the dependency shows up in the graph), which becomes a
|
|
44
|
+
// `parentModelUuid` token resolved at apply time.
|
|
45
|
+
function compileUnification(unification) {
|
|
46
|
+
if (unification.source === "integration") {
|
|
47
|
+
return { source: "integration" };
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
source: "custom",
|
|
51
|
+
type: unification.type,
|
|
52
|
+
uniqueColumns: unification.uniqueColumns,
|
|
53
|
+
selectedColumnSlugs: unification.selectedColumnSlugs,
|
|
54
|
+
timeColumnSlug: unification.timeColumnSlug,
|
|
55
|
+
parent: unification.parent === undefined
|
|
56
|
+
? undefined
|
|
57
|
+
: compileUnificationParent(unification.parent),
|
|
58
|
+
filter: unification.filter,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function compileUnificationParent(parent) {
|
|
62
|
+
if (parent.kind === "model") {
|
|
63
|
+
return {
|
|
64
|
+
kind: "model",
|
|
65
|
+
columnSlug: parent.columnSlug,
|
|
66
|
+
parentModelUuid: refUuid(parent.parent),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
kind: "reference",
|
|
71
|
+
columnSlug: parent.columnSlug,
|
|
72
|
+
reference: parent.reference,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
38
75
|
function toTitle(slug) {
|
|
39
76
|
return slug
|
|
40
77
|
.split(/[-_]/)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Token } from "../core.js";
|
|
2
|
+
import { type ModelRef } from "../refs.js";
|
|
3
|
+
import type { ModelHandle } from "./model.js";
|
|
4
|
+
export type RelationshipRelation = "oneToOne" | "oneToMany" | "manyToOne";
|
|
5
|
+
export type RelationshipEndpointSpec = {
|
|
6
|
+
model: ModelHandle | ModelRef;
|
|
7
|
+
column: string;
|
|
8
|
+
property?: string;
|
|
9
|
+
};
|
|
10
|
+
export type RelationshipSpec = {
|
|
11
|
+
from: RelationshipEndpointSpec;
|
|
12
|
+
to: RelationshipEndpointSpec;
|
|
13
|
+
relation: RelationshipRelation;
|
|
14
|
+
};
|
|
15
|
+
export type RelationshipHandle = {
|
|
16
|
+
readonly slug: string;
|
|
17
|
+
readonly uuid: Token;
|
|
18
|
+
readonly resource: "relationship";
|
|
19
|
+
};
|
|
20
|
+
export declare function defineRelationship(slug: string, spec: RelationshipSpec): RelationshipHandle;
|
|
21
|
+
//# sourceMappingURL=relationship.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relationship.d.ts","sourceRoot":"","sources":["../../../src/resources/relationship.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAwB,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,KAAK,QAAQ,EAAW,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;AAK1E,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,wBAAwB,CAAC;IAC/B,EAAE,EAAE,wBAAwB,CAAC;IAC7B,QAAQ,EAAE,oBAAoB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,gBAAgB,GACrB,kBAAkB,CAmBpB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// defineRelationship — a join between two data models in the SAME dataset (a
|
|
2
|
+
// `StorageTypes.Relationship`). It links a column on a `from` model to a column
|
|
3
|
+
// on a `to` model with a cardinality (`oneToOne` / `oneToMany` / `manyToOne`),
|
|
4
|
+
// optionally navigating into a JSON column via a property slug:
|
|
5
|
+
//
|
|
6
|
+
// const accounts = defineModel("accounts", { ... });
|
|
7
|
+
// const contacts = defineModel("contacts", { ... });
|
|
8
|
+
// defineRelationship("contact-account", {
|
|
9
|
+
// from: { model: contacts, column: "account_id" },
|
|
10
|
+
// to: { model: accounts, column: "id" },
|
|
11
|
+
// relation: "manyToOne",
|
|
12
|
+
// });
|
|
13
|
+
//
|
|
14
|
+
// Both models must live in the same dataset (the server derives the dataset from
|
|
15
|
+
// the `from` model at deploy). Relationships have no server-side slug, so the
|
|
16
|
+
// `slug` is a local identifier only; identity is tracked by the state uuid. The
|
|
17
|
+
// backend `set` endpoint is a per-dataset declarative replace, so the executor
|
|
18
|
+
// read-merges the dataset's live relationships around this one.
|
|
19
|
+
import { register, resourceId, token } from "../core.js";
|
|
20
|
+
import { refUuid } from "../refs.js";
|
|
21
|
+
export function defineRelationship(slug, spec) {
|
|
22
|
+
const id = resourceId("relationship", slug);
|
|
23
|
+
register({
|
|
24
|
+
id,
|
|
25
|
+
kind: "relationship",
|
|
26
|
+
slug,
|
|
27
|
+
spec: {
|
|
28
|
+
slug,
|
|
29
|
+
fromModelUuid: refUuid(spec.from.model),
|
|
30
|
+
fromColumnSlug: spec.from.column,
|
|
31
|
+
fromPropertySlug: spec.from.property === undefined ? null : spec.from.property,
|
|
32
|
+
toModelUuid: refUuid(spec.to.model),
|
|
33
|
+
toColumnSlug: spec.to.column,
|
|
34
|
+
toPropertySlug: spec.to.property === undefined ? null : spec.to.property,
|
|
35
|
+
relation: spec.relation,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
return { slug, uuid: token(id, "uuid"), resource: "relationship" };
|
|
39
|
+
}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import { type Token } from "../core.js";
|
|
1
|
+
import { type SecretRef, type Token } from "../core.js";
|
|
2
2
|
import { type FolderRef } from "../refs.js";
|
|
3
3
|
import type { FolderHandle } from "./folder.js";
|
|
4
|
+
export type WorkerTrigger = {
|
|
5
|
+
name?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
cron: string;
|
|
8
|
+
path: string;
|
|
9
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
10
|
+
data?: Record<string, unknown>;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
};
|
|
4
13
|
export type WorkerSpec = {
|
|
5
14
|
/** Path to the worker's code directory (uploaded + built on deploy). */
|
|
6
15
|
path: string;
|
|
7
16
|
name?: string;
|
|
8
17
|
description?: string;
|
|
9
18
|
folder?: FolderHandle | FolderRef;
|
|
19
|
+
triggers?: WorkerTrigger[];
|
|
20
|
+
/** Env vars baked into the build. Use `secret("NAME")` for secret values. */
|
|
21
|
+
env?: Record<string, string | SecretRef>;
|
|
10
22
|
};
|
|
11
23
|
export type WorkerHandle = {
|
|
12
24
|
readonly slug: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../../../src/resources/worker.ts"],"names":[],"mappings":"AAKA,OAAO,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AAE,IAAI,EAAE,UAAU,GAAG,YAAY,CAoBzE"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// directory. Distinct from @cargo-ai/worker-sdk's `createWorker`, which is the
|
|
3
3
|
// worker's *runtime code* (the Hono app at <path>/src/index.ts). On deploy the
|
|
4
4
|
// reconciler creates the worker slot, uploads the bundle, and promotes it.
|
|
5
|
-
import { register, resourceId, token } from "../core.js";
|
|
5
|
+
import { register, resourceId, token, } from "../core.js";
|
|
6
6
|
import { refUuid } from "../refs.js";
|
|
7
7
|
import { assertBundleFiles, bundleHash } from "./bundle.js";
|
|
8
8
|
// Files the hosting worker build always requires at the bundle root: a manifest
|
|
@@ -35,6 +35,8 @@ export function defineWorker(slug, spec) {
|
|
|
35
35
|
// hash the code now so editing it shows as drift on the next deploy
|
|
36
36
|
contentHash: bundleHash(spec.path),
|
|
37
37
|
folderUuid: spec.folder === undefined ? undefined : refUuid(spec.folder),
|
|
38
|
+
triggers: spec.triggers === undefined ? [] : spec.triggers,
|
|
39
|
+
env: spec.env === undefined ? {} : spec.env,
|
|
38
40
|
},
|
|
39
41
|
});
|
|
40
42
|
return { slug, uuid: token(id, "uuid"), url: token(id, "url") };
|