@loxtep/sdk 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -5
- package/dist/authoring/agent.d.ts +164 -0
- package/dist/authoring/agent.d.ts.map +1 -0
- package/dist/authoring/agent.js +376 -0
- package/dist/authoring/agent.js.map +1 -0
- package/dist/authoring/compiler.d.ts +98 -0
- package/dist/authoring/compiler.d.ts.map +1 -0
- package/dist/authoring/compiler.js +156 -0
- package/dist/authoring/compiler.js.map +1 -0
- package/dist/authoring/define-data-workflow.d.ts +24 -0
- package/dist/authoring/define-data-workflow.d.ts.map +1 -0
- package/dist/authoring/define-data-workflow.js +93 -0
- package/dist/authoring/define-data-workflow.js.map +1 -0
- package/dist/authoring/index.d.ts +19 -0
- package/dist/authoring/index.d.ts.map +1 -0
- package/dist/authoring/index.js +15 -0
- package/dist/authoring/index.js.map +1 -0
- package/dist/authoring/toolbox.d.ts +133 -0
- package/dist/authoring/toolbox.d.ts.map +1 -0
- package/dist/authoring/toolbox.js +166 -0
- package/dist/authoring/toolbox.js.map +1 -0
- package/dist/authoring/triggers.d.ts +41 -0
- package/dist/authoring/triggers.d.ts.map +1 -0
- package/dist/authoring/triggers.js +60 -0
- package/dist/authoring/triggers.js.map +1 -0
- package/dist/authoring/types.d.ts +64 -0
- package/dist/authoring/types.d.ts.map +1 -0
- package/dist/authoring/types.js +9 -0
- package/dist/authoring/types.js.map +1 -0
- package/dist/cli/commands/activity-cmd.d.ts +28 -0
- package/dist/cli/commands/activity-cmd.d.ts.map +1 -0
- package/dist/cli/commands/activity-cmd.js +78 -0
- package/dist/cli/commands/activity-cmd.js.map +1 -0
- package/dist/cli/commands/attach-cmd.d.ts +38 -0
- package/dist/cli/commands/attach-cmd.d.ts.map +1 -0
- package/dist/cli/commands/attach-cmd.js +141 -0
- package/dist/cli/commands/attach-cmd.js.map +1 -0
- package/dist/cli/commands/deploy-cmd.d.ts +101 -0
- package/dist/cli/commands/deploy-cmd.d.ts.map +1 -0
- package/dist/cli/commands/deploy-cmd.js +461 -0
- package/dist/cli/commands/deploy-cmd.js.map +1 -0
- package/dist/cli/commands/generate-cmd.d.ts +35 -0
- package/dist/cli/commands/generate-cmd.d.ts.map +1 -0
- package/dist/cli/commands/generate-cmd.js +134 -0
- package/dist/cli/commands/generate-cmd.js.map +1 -0
- package/dist/cli/commands/improvements-cmd.d.ts +44 -0
- package/dist/cli/commands/improvements-cmd.d.ts.map +1 -0
- package/dist/cli/commands/improvements-cmd.js +215 -0
- package/dist/cli/commands/improvements-cmd.js.map +1 -0
- package/dist/cli/commands/init-cmd.d.ts +78 -0
- package/dist/cli/commands/init-cmd.d.ts.map +1 -0
- package/dist/cli/commands/init-cmd.js +250 -0
- package/dist/cli/commands/init-cmd.js.map +1 -0
- package/dist/cli/commands/login.d.ts +4 -4
- package/dist/cli/commands/login.js +4 -4
- package/dist/cli/commands/login.js.map +1 -1
- package/dist/cli/commands/test-cmd.d.ts +89 -0
- package/dist/cli/commands/test-cmd.d.ts.map +1 -0
- package/dist/cli/commands/test-cmd.js +378 -0
- package/dist/cli/commands/test-cmd.js.map +1 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +150 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/project-context.d.ts +153 -0
- package/dist/cli/project-context.d.ts.map +1 -0
- package/dist/cli/project-context.js +190 -0
- package/dist/cli/project-context.js.map +1 -0
- package/dist/client/activity-types.d.ts +66 -0
- package/dist/client/activity-types.d.ts.map +1 -0
- package/dist/client/activity-types.js +9 -0
- package/dist/client/activity-types.js.map +1 -0
- package/dist/client/activity.d.ts +22 -0
- package/dist/client/activity.d.ts.map +1 -0
- package/dist/client/activity.js +43 -0
- package/dist/client/activity.js.map +1 -0
- package/dist/client/data-products.d.ts.map +1 -1
- package/dist/client/data-products.js +4 -98
- package/dist/client/data-products.js.map +1 -1
- package/dist/client/flow-types.d.ts +4 -2
- package/dist/client/flow-types.d.ts.map +1 -1
- package/dist/client/flows.d.ts +1 -1
- package/dist/client/flows.d.ts.map +1 -1
- package/dist/client/flows.js +49 -124
- package/dist/client/flows.js.map +1 -1
- package/dist/client/improvements-types.d.ts +55 -0
- package/dist/client/improvements-types.d.ts.map +1 -0
- package/dist/client/improvements-types.js +9 -0
- package/dist/client/improvements-types.js.map +1 -0
- package/dist/client/improvements.d.ts +29 -0
- package/dist/client/improvements.d.ts.map +1 -0
- package/dist/client/improvements.js +50 -0
- package/dist/client/improvements.js.map +1 -0
- package/dist/client/index.d.ts +6 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/loxtep-client.d.ts +45 -0
- package/dist/client/loxtep-client.d.ts.map +1 -1
- package/dist/client/loxtep-client.js +68 -0
- package/dist/client/loxtep-client.js.map +1 -1
- package/dist/client/projects-types.d.ts +25 -0
- package/dist/client/projects-types.d.ts.map +1 -1
- package/dist/client/projects.d.ts +2 -1
- package/dist/client/projects.d.ts.map +1 -1
- package/dist/client/projects.js +17 -0
- package/dist/client/projects.js.map +1 -1
- package/dist/client/queue-types.d.ts +15 -2
- package/dist/client/queue-types.d.ts.map +1 -1
- package/dist/client/queues.d.ts.map +1 -1
- package/dist/client/queues.js +3 -14
- package/dist/client/queues.js.map +1 -1
- package/dist/codegen/emit.d.ts +25 -0
- package/dist/codegen/emit.d.ts.map +1 -0
- package/dist/codegen/emit.js +158 -0
- package/dist/codegen/emit.js.map +1 -0
- package/dist/codegen/index.d.ts +17 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/index.js +16 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/load-workspace-context.d.ts +30 -0
- package/dist/codegen/load-workspace-context.d.ts.map +1 -0
- package/dist/codegen/load-workspace-context.js +127 -0
- package/dist/codegen/load-workspace-context.js.map +1 -0
- package/dist/codegen/normalize.d.ts +35 -0
- package/dist/codegen/normalize.d.ts.map +1 -0
- package/dist/codegen/normalize.js +77 -0
- package/dist/codegen/normalize.js.map +1 -0
- package/dist/codegen/types.d.ts +89 -0
- package/dist/codegen/types.d.ts.map +1 -0
- package/dist/codegen/types.js +9 -0
- package/dist/codegen/types.js.map +1 -0
- package/dist/codegen/write-artifact.d.ts +40 -0
- package/dist/codegen/write-artifact.d.ts.map +1 -0
- package/dist/codegen/write-artifact.js +74 -0
- package/dist/codegen/write-artifact.js.map +1 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/workspace-config.d.ts +76 -0
- package/dist/config/workspace-config.d.ts.map +1 -0
- package/dist/config/workspace-config.js +129 -0
- package/dist/config/workspace-config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/rstreams/event-bridge.d.ts +16 -2
- package/dist/rstreams/event-bridge.d.ts.map +1 -1
- package/dist/rstreams/event-bridge.js +38 -5
- package/dist/rstreams/event-bridge.js.map +1 -1
- package/dist/skills/check-scope.d.ts +42 -0
- package/dist/skills/check-scope.d.ts.map +1 -0
- package/dist/skills/check-scope.js +84 -0
- package/dist/skills/check-scope.js.map +1 -0
- package/dist/skills/index.d.ts +14 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +12 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +79 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +102 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/types.d.ts +55 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +9 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/skills/validate-references.d.ts +54 -0
- package/dist/skills/validate-references.d.ts.map +1 -0
- package/dist/skills/validate-references.js +80 -0
- package/dist/skills/validate-references.js.map +1 -0
- package/package.json +5 -3
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineDataWorkflow` factory — the core code-first authoring entry point.
|
|
3
|
+
*
|
|
4
|
+
* Validates the module specification synchronously using zod and throws a
|
|
5
|
+
* `ValidationError` naming the invalid argument on failure.
|
|
6
|
+
*/
|
|
7
|
+
import type { DataWorkflowModule } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Validates a `DataWorkflowModule` specification and returns it unchanged.
|
|
10
|
+
*
|
|
11
|
+
* Throws `ValidationError` (from `@loxtep/sdk/errors`) with a `field_errors`
|
|
12
|
+
* entry naming the invalid argument when validation fails.
|
|
13
|
+
*
|
|
14
|
+
* Validation rules:
|
|
15
|
+
* - `name`: 1–64 characters (R3.1, R3.8)
|
|
16
|
+
* - `triggers`: at least 1 and at most 10 entries (R3.1, R3.8)
|
|
17
|
+
* - `requireApproval`: at most 100 entries, each 1–256 characters (R6.1)
|
|
18
|
+
*
|
|
19
|
+
* @param spec - The workflow module specification to validate.
|
|
20
|
+
* @returns The validated specification (unchanged).
|
|
21
|
+
* @throws {ValidationError} If any argument is invalid.
|
|
22
|
+
*/
|
|
23
|
+
export declare function defineDataWorkflow(spec: DataWorkflowModule): DataWorkflowModule;
|
|
24
|
+
//# sourceMappingURL=define-data-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-data-workflow.d.ts","sourceRoot":"","sources":["../../src/authoring/define-data-workflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAWrD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CAiE/E"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `defineDataWorkflow` factory — the core code-first authoring entry point.
|
|
3
|
+
*
|
|
4
|
+
* Validates the module specification synchronously using zod and throws a
|
|
5
|
+
* `ValidationError` naming the invalid argument on failure.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { ValidationError } from '../errors/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Zod schema for the `requireApproval` array.
|
|
11
|
+
* Each entry is a non-empty string of 1–256 characters, with at most 100 entries.
|
|
12
|
+
*/
|
|
13
|
+
const requireApprovalSchema = z
|
|
14
|
+
.array(z.string().min(1).max(256))
|
|
15
|
+
.max(100)
|
|
16
|
+
.optional();
|
|
17
|
+
/**
|
|
18
|
+
* Validates a `DataWorkflowModule` specification and returns it unchanged.
|
|
19
|
+
*
|
|
20
|
+
* Throws `ValidationError` (from `@loxtep/sdk/errors`) with a `field_errors`
|
|
21
|
+
* entry naming the invalid argument when validation fails.
|
|
22
|
+
*
|
|
23
|
+
* Validation rules:
|
|
24
|
+
* - `name`: 1–64 characters (R3.1, R3.8)
|
|
25
|
+
* - `triggers`: at least 1 and at most 10 entries (R3.1, R3.8)
|
|
26
|
+
* - `requireApproval`: at most 100 entries, each 1–256 characters (R6.1)
|
|
27
|
+
*
|
|
28
|
+
* @param spec - The workflow module specification to validate.
|
|
29
|
+
* @returns The validated specification (unchanged).
|
|
30
|
+
* @throws {ValidationError} If any argument is invalid.
|
|
31
|
+
*/
|
|
32
|
+
export function defineDataWorkflow(spec) {
|
|
33
|
+
const errors = [];
|
|
34
|
+
// Validate name (1–64 characters)
|
|
35
|
+
if (typeof spec.name !== 'string' || spec.name.length < 1 || spec.name.length > 64) {
|
|
36
|
+
errors.push({
|
|
37
|
+
field: 'name',
|
|
38
|
+
message: `name must be between 1 and 64 characters, got ${typeof spec.name === 'string' ? spec.name.length : typeof spec.name}`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
// Validate triggers (1–10)
|
|
42
|
+
if (!Array.isArray(spec.triggers) || spec.triggers.length < 1 || spec.triggers.length > 10) {
|
|
43
|
+
const count = Array.isArray(spec.triggers) ? spec.triggers.length : 0;
|
|
44
|
+
errors.push({
|
|
45
|
+
field: 'triggers',
|
|
46
|
+
message: `triggers must contain between 1 and 10 entries, got ${count}`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Validate requireApproval (≤100 entries, each 1–256 chars)
|
|
50
|
+
if (spec.requireApproval !== undefined) {
|
|
51
|
+
const result = requireApprovalSchema.safeParse(spec.requireApproval);
|
|
52
|
+
if (!result.success) {
|
|
53
|
+
const zodIssues = result.error.issues;
|
|
54
|
+
// Provide a targeted message based on the zod failure
|
|
55
|
+
const issue = zodIssues[0];
|
|
56
|
+
if (issue) {
|
|
57
|
+
if (issue.code === 'too_big' && issue.path.length === 0) {
|
|
58
|
+
errors.push({
|
|
59
|
+
field: 'requireApproval',
|
|
60
|
+
message: `requireApproval must contain at most 100 entries, got ${spec.requireApproval.length}`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else if (issue.code === 'too_small' && issue.path.length > 0) {
|
|
64
|
+
const idx = String(issue.path[0]);
|
|
65
|
+
errors.push({
|
|
66
|
+
field: 'requireApproval',
|
|
67
|
+
message: `requireApproval[${idx}] must be between 1 and 256 characters`,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else if (issue.code === 'too_big' && issue.path.length > 0) {
|
|
71
|
+
const idx = issue.path[0];
|
|
72
|
+
const idxStr = String(idx);
|
|
73
|
+
errors.push({
|
|
74
|
+
field: 'requireApproval',
|
|
75
|
+
message: `requireApproval[${idxStr}] must be between 1 and 256 characters, got ${spec.requireApproval[idx]?.length}`,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
errors.push({
|
|
80
|
+
field: 'requireApproval',
|
|
81
|
+
message: `requireApproval is invalid: ${issue.message}`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (errors.length > 0) {
|
|
88
|
+
const message = errors.map((e) => `${e.field}: ${e.message}`).join('; ');
|
|
89
|
+
throw new ValidationError(`Invalid defineDataWorkflow specification: ${message}`, errors);
|
|
90
|
+
}
|
|
91
|
+
return spec;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=define-data-workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-data-workflow.js","sourceRoot":"","sources":["../../src/authoring/define-data-workflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC;KAC5B,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACjC,GAAG,CAAC,GAAG,CAAC;KACR,QAAQ,EAAE,CAAC;AAEd;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAwB;IACzD,MAAM,MAAM,GAA8C,EAAE,CAAC;IAE7D,kCAAkC;IAClC,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACnF,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,iDAAiD,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,IAAI,EAAE;SAChI,CAAC,CAAC;IACL,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI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wC;qBACxE,CAAC,CAAC;gBACL,CAAC;qBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7D,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;oBAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;oBAC3B,MAAM,CAAC,IAAI,CAAC;wBACV,KAAK,EAAE,iBAAiB;wBACxB,OAAO,EAAE,mBAAmB,MAAM,+CAAgD,IAAI,CAAC,eAA4B,CAAC,GAAa,CAAC,EAAE,MAAM,EAAE;qBAC7I,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC;wBACV,KAAK,EAAE,iBAAiB;wBACxB,OAAO,EAAE,+BAA+B,KAAK,CAAC,OAAO,EAAE;qBACxD,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzE,MAAM,IAAI,eAAe,CACvB,6CAA6C,OAAO,EAAE,EACtD,MAAM,CACP,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code-first data workflow authoring surface.
|
|
3
|
+
*
|
|
4
|
+
* Entry points:
|
|
5
|
+
* - `defineDataWorkflow` — validates and returns a `DataWorkflowModule` spec
|
|
6
|
+
* - `on` — trigger builders (`queueEvent`, `connectorEvent`, `schedule`, `webhook`)
|
|
7
|
+
* - `createToolbox` — deterministic typed platform calls (no model in the loop)
|
|
8
|
+
* - `agent` — agentic operation entry point with scope enforcement and action trace
|
|
9
|
+
*/
|
|
10
|
+
export { defineDataWorkflow } from './define-data-workflow.js';
|
|
11
|
+
export { on } from './triggers.js';
|
|
12
|
+
export { createToolbox, ToolboxOperationError } from './toolbox.js';
|
|
13
|
+
export { agent, validateAgentOptions, computeReachableScope, enforceAgentScope, createScopeGuardedToolbox, ActionTrace, AgentScopeError, } from './agent.js';
|
|
14
|
+
export type { DataWorkflowModule, TriggerSpec, QueueRef, ConnectorRef, HandlerContext, } from './types.js';
|
|
15
|
+
export { compileModule, computeRemovalSet } from './compiler.js';
|
|
16
|
+
export type { GraphPatchOp, ResourceRef, CompiledWorkflow, } from './compiler.js';
|
|
17
|
+
export type { Toolbox, ToolboxDataProducts, ToolboxQueues, ToolboxConnections, ToolboxWorkflows, CreateToolboxOptions, DataProductRef, WorkflowRef, WriteResult, QueryRows, } from './toolbox.js';
|
|
18
|
+
export type { SkillRef, AgentOptions, ActionOutcome, ActionTraceEntry, AgentResult, AgentExecutionContext, } from './agent.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authoring/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,KAAK,EACL,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACjE,YAAY,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,OAAO,EACP,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,WAAW,EACX,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code-first data workflow authoring surface.
|
|
3
|
+
*
|
|
4
|
+
* Entry points:
|
|
5
|
+
* - `defineDataWorkflow` — validates and returns a `DataWorkflowModule` spec
|
|
6
|
+
* - `on` — trigger builders (`queueEvent`, `connectorEvent`, `schedule`, `webhook`)
|
|
7
|
+
* - `createToolbox` — deterministic typed platform calls (no model in the loop)
|
|
8
|
+
* - `agent` — agentic operation entry point with scope enforcement and action trace
|
|
9
|
+
*/
|
|
10
|
+
export { defineDataWorkflow } from './define-data-workflow.js';
|
|
11
|
+
export { on } from './triggers.js';
|
|
12
|
+
export { createToolbox, ToolboxOperationError } from './toolbox.js';
|
|
13
|
+
export { agent, validateAgentOptions, computeReachableScope, enforceAgentScope, createScopeGuardedToolbox, ActionTrace, AgentScopeError, } from './agent.js';
|
|
14
|
+
export { compileModule, computeRemovalSet } from './compiler.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authoring/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,KAAK,EACL,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic `toolbox` namespace — direct, typed platform calls with no model
|
|
3
|
+
* in the loop (R4.1, R4.7).
|
|
4
|
+
*
|
|
5
|
+
* Each method is a thin wrapper over the corresponding `LoxtepClient` namespace
|
|
6
|
+
* method. On success, it returns a typed result. On failure, it throws a
|
|
7
|
+
* `ToolboxOperationError` identifying the failed operation — it never falls back
|
|
8
|
+
* to a model.
|
|
9
|
+
*/
|
|
10
|
+
import type { LoxtepClient } from '../client/loxtep-client.js';
|
|
11
|
+
import type { DataProduct, DataProductQueryResult } from '../client/data-products-types.js';
|
|
12
|
+
import type { Connection, ConnectionTestResult } from '../client/connection-types.js';
|
|
13
|
+
import type { Flow } from '../client/flow-types.js';
|
|
14
|
+
import type { WorkflowGraph } from '../client/workflows-types.js';
|
|
15
|
+
import type { QueueRef } from './types.js';
|
|
16
|
+
import { LoxtepError } from '../errors/base.js';
|
|
17
|
+
/** Result of a data product write operation. */
|
|
18
|
+
export interface WriteResult {
|
|
19
|
+
/** Whether the write succeeded. */
|
|
20
|
+
success: true;
|
|
21
|
+
/** Number of events written. */
|
|
22
|
+
events_written: number;
|
|
23
|
+
}
|
|
24
|
+
/** Rows returned from a data product query. */
|
|
25
|
+
export interface QueryRows {
|
|
26
|
+
items: Record<string, unknown>[];
|
|
27
|
+
metadata: DataProductQueryResult['metadata'];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown when a deterministic toolbox operation fails.
|
|
31
|
+
* Identifies the failed operation and namespace so the caller can
|
|
32
|
+
* distinguish it from other errors.
|
|
33
|
+
*
|
|
34
|
+
* Per R4.7 — the SDK never falls back to a model on failure.
|
|
35
|
+
*/
|
|
36
|
+
export declare class ToolboxOperationError extends LoxtepError {
|
|
37
|
+
/** The toolbox namespace where the failure occurred (e.g. 'dataProducts'). */
|
|
38
|
+
readonly namespace: string;
|
|
39
|
+
/** The operation that failed (e.g. 'write', 'query', 'list'). */
|
|
40
|
+
readonly operation: string;
|
|
41
|
+
constructor(namespace: string, operation: string, message: string, cause?: unknown);
|
|
42
|
+
}
|
|
43
|
+
/** Typed reference to a data product from the Generated_SDK_Artifact. */
|
|
44
|
+
export interface DataProductRef {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
}
|
|
48
|
+
/** Typed reference to a workflow from the Generated_SDK_Artifact. */
|
|
49
|
+
export interface WorkflowRef {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
}
|
|
53
|
+
export type { QueueRef, ConnectorRef } from './types.js';
|
|
54
|
+
/**
|
|
55
|
+
* Data products toolbox — deterministic operations on data products.
|
|
56
|
+
*/
|
|
57
|
+
export interface ToolboxDataProducts {
|
|
58
|
+
/** Write an event to a data product's stream queue. */
|
|
59
|
+
write(ref: DataProductRef, event: unknown): Promise<WriteResult>;
|
|
60
|
+
/** Execute a SQL query against a data product. */
|
|
61
|
+
query(ref: DataProductRef, sql: string): Promise<QueryRows>;
|
|
62
|
+
/** Get a data product by reference. */
|
|
63
|
+
get(ref: DataProductRef): Promise<DataProduct>;
|
|
64
|
+
/** List data products (optionally filtered by domain). */
|
|
65
|
+
list(filters?: {
|
|
66
|
+
domain_id?: string;
|
|
67
|
+
}): Promise<DataProduct[]>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Queues toolbox — deterministic operations on queues.
|
|
71
|
+
*/
|
|
72
|
+
export interface ToolboxQueues {
|
|
73
|
+
/** Write an event to a queue. */
|
|
74
|
+
write(ref: QueueRef, event: unknown): Promise<void>;
|
|
75
|
+
/** Get queue metadata. */
|
|
76
|
+
getMetadata(ref: QueueRef): Promise<{
|
|
77
|
+
queue_name: string;
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Connections toolbox — deterministic operations on connections.
|
|
83
|
+
*/
|
|
84
|
+
export interface ToolboxConnections {
|
|
85
|
+
/** List connections for the project. */
|
|
86
|
+
list(): Promise<Connection[]>;
|
|
87
|
+
/** Get a specific connection. */
|
|
88
|
+
get(connectionId: string): Promise<Connection>;
|
|
89
|
+
/** Test a connection. */
|
|
90
|
+
test(connectionId: string): Promise<ConnectionTestResult>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Workflows toolbox — deterministic operations on workflows.
|
|
94
|
+
*/
|
|
95
|
+
export interface ToolboxWorkflows {
|
|
96
|
+
/** List workflows for the project. */
|
|
97
|
+
list(): Promise<Flow[]>;
|
|
98
|
+
/** Get a workflow's graph. */
|
|
99
|
+
getGraph(ref: WorkflowRef): Promise<WorkflowGraph>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The deterministic Toolbox namespace — thin typed wrappers over
|
|
103
|
+
* `LoxtepClient` namespaces. Each method returns typed results or throws a
|
|
104
|
+
* `ToolboxOperationError`. No model is ever invoked.
|
|
105
|
+
*/
|
|
106
|
+
export interface Toolbox {
|
|
107
|
+
dataProducts: ToolboxDataProducts;
|
|
108
|
+
queues: ToolboxQueues;
|
|
109
|
+
connections: ToolboxConnections;
|
|
110
|
+
workflows: ToolboxWorkflows;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Options for creating a toolbox.
|
|
114
|
+
*/
|
|
115
|
+
export interface CreateToolboxOptions {
|
|
116
|
+
/** The LoxtepClient instance to use for platform calls. */
|
|
117
|
+
client: LoxtepClient;
|
|
118
|
+
/** The project ID (used for project-scoped operations). */
|
|
119
|
+
projectId: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create a `Toolbox` — deterministic, typed platform operations with no model
|
|
123
|
+
* in the loop.
|
|
124
|
+
*
|
|
125
|
+
* On success each method returns a typed result. On failure, a
|
|
126
|
+
* `ToolboxOperationError` is thrown identifying the failed operation.
|
|
127
|
+
* The toolbox never falls back to an AI model.
|
|
128
|
+
*
|
|
129
|
+
* @param options - Client and project configuration.
|
|
130
|
+
* @returns A `Toolbox` instance.
|
|
131
|
+
*/
|
|
132
|
+
export declare function createToolbox(options: CreateToolboxOptions): Toolbox;
|
|
133
|
+
//# sourceMappingURL=toolbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbox.d.ts","sourceRoot":"","sources":["../../src/authoring/toolbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,gDAAgD;AAChD,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,OAAO,EAAE,IAAI,CAAC;IACd,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,+CAA+C;AAC/C,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACjC,QAAQ,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;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,EAAE,QAAQ,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAC;CACrF;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9B,iCAAiC;IACjC,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/C,yBAAyB;IACzB,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAC3D;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sCAAsC;IACtC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACxB,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACpD;AAED;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,YAAY,EAAE,mBAAmB,CAAC;IAClC,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,EAAE,kBAAkB,CAAC;IAChC,SAAS,EAAE,gBAAgB,CAAC;CAC7B;AAID;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,MAAM,EAAE,YAAY,CAAC;IACrB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CA0KpE"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic `toolbox` namespace — direct, typed platform calls with no model
|
|
3
|
+
* in the loop (R4.1, R4.7).
|
|
4
|
+
*
|
|
5
|
+
* Each method is a thin wrapper over the corresponding `LoxtepClient` namespace
|
|
6
|
+
* method. On success, it returns a typed result. On failure, it throws a
|
|
7
|
+
* `ToolboxOperationError` identifying the failed operation — it never falls back
|
|
8
|
+
* to a model.
|
|
9
|
+
*/
|
|
10
|
+
import { LoxtepError } from '../errors/base.js';
|
|
11
|
+
// ─── Error type ──────────────────────────────────────────────────────────────
|
|
12
|
+
/**
|
|
13
|
+
* Error thrown when a deterministic toolbox operation fails.
|
|
14
|
+
* Identifies the failed operation and namespace so the caller can
|
|
15
|
+
* distinguish it from other errors.
|
|
16
|
+
*
|
|
17
|
+
* Per R4.7 — the SDK never falls back to a model on failure.
|
|
18
|
+
*/
|
|
19
|
+
export class ToolboxOperationError extends LoxtepError {
|
|
20
|
+
/** The toolbox namespace where the failure occurred (e.g. 'dataProducts'). */
|
|
21
|
+
namespace;
|
|
22
|
+
/** The operation that failed (e.g. 'write', 'query', 'list'). */
|
|
23
|
+
operation;
|
|
24
|
+
constructor(namespace, operation, message, cause) {
|
|
25
|
+
super(`toolbox.${namespace}.${operation} failed: ${message}`, {
|
|
26
|
+
code: 'TOOLBOX_OPERATION_FAILED',
|
|
27
|
+
status_code: cause?.status_code,
|
|
28
|
+
details: {
|
|
29
|
+
namespace,
|
|
30
|
+
operation,
|
|
31
|
+
...(cause instanceof Error ? { cause_message: cause.message } : {}),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
this.name = 'ToolboxOperationError';
|
|
35
|
+
this.namespace = namespace;
|
|
36
|
+
this.operation = operation;
|
|
37
|
+
Object.setPrototypeOf(this, ToolboxOperationError.prototype);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a `Toolbox` — deterministic, typed platform operations with no model
|
|
42
|
+
* in the loop.
|
|
43
|
+
*
|
|
44
|
+
* On success each method returns a typed result. On failure, a
|
|
45
|
+
* `ToolboxOperationError` is thrown identifying the failed operation.
|
|
46
|
+
* The toolbox never falls back to an AI model.
|
|
47
|
+
*
|
|
48
|
+
* @param options - Client and project configuration.
|
|
49
|
+
* @returns A `Toolbox` instance.
|
|
50
|
+
*/
|
|
51
|
+
export function createToolbox(options) {
|
|
52
|
+
const { client, projectId } = options;
|
|
53
|
+
const dataProducts = {
|
|
54
|
+
async write(ref, event) {
|
|
55
|
+
try {
|
|
56
|
+
const writer = await client.data_products.get_writer(ref.name);
|
|
57
|
+
writer.write(event);
|
|
58
|
+
await writer.close();
|
|
59
|
+
return { success: true, events_written: 1 };
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
throw new ToolboxOperationError('dataProducts', 'write', err instanceof Error ? err.message : String(err), err);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
async query(ref, sql) {
|
|
66
|
+
try {
|
|
67
|
+
const result = await client.data_products.query(ref.id, sql);
|
|
68
|
+
return { items: result.items, metadata: result.metadata };
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
throw new ToolboxOperationError('dataProducts', 'query', err instanceof Error ? err.message : String(err), err);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
async get(ref) {
|
|
75
|
+
try {
|
|
76
|
+
return await client.data_products.get(ref.id);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
throw new ToolboxOperationError('dataProducts', 'get', err instanceof Error ? err.message : String(err), err);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
async list(filters) {
|
|
83
|
+
try {
|
|
84
|
+
const result = await client.data_products.list({
|
|
85
|
+
domain_id: filters?.domain_id,
|
|
86
|
+
});
|
|
87
|
+
return result.items;
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
throw new ToolboxOperationError('dataProducts', 'list', err instanceof Error ? err.message : String(err), err);
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
const queues = {
|
|
95
|
+
async write(ref, event) {
|
|
96
|
+
try {
|
|
97
|
+
const writer = await client.queues.open_writer({
|
|
98
|
+
bot_id: `toolbox-writer-${ref.name}`,
|
|
99
|
+
queue_name: ref.name,
|
|
100
|
+
});
|
|
101
|
+
await writer.write(event);
|
|
102
|
+
await writer.close();
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
throw new ToolboxOperationError('queues', 'write', err instanceof Error ? err.message : String(err), err);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
async getMetadata(ref) {
|
|
109
|
+
try {
|
|
110
|
+
const metadata = await client.queues.get_queue_metadata(ref.name);
|
|
111
|
+
return metadata;
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
throw new ToolboxOperationError('queues', 'getMetadata', err instanceof Error ? err.message : String(err), err);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
const connections = {
|
|
119
|
+
async list() {
|
|
120
|
+
try {
|
|
121
|
+
const result = await client.connections.list();
|
|
122
|
+
return result.items;
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
throw new ToolboxOperationError('connections', 'list', err instanceof Error ? err.message : String(err), err);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
async get(connectionId) {
|
|
129
|
+
try {
|
|
130
|
+
return await client.connections.get(connectionId);
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
throw new ToolboxOperationError('connections', 'get', err instanceof Error ? err.message : String(err), err);
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
async test(connectionId) {
|
|
137
|
+
try {
|
|
138
|
+
return await client.connections.test(connectionId);
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
throw new ToolboxOperationError('connections', 'test', err instanceof Error ? err.message : String(err), err);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
const workflows = {
|
|
146
|
+
async list() {
|
|
147
|
+
try {
|
|
148
|
+
const result = await client.workflows.listWorkflows({ project_id: projectId });
|
|
149
|
+
return result.items;
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
throw new ToolboxOperationError('workflows', 'list', err instanceof Error ? err.message : String(err), err);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
async getGraph(ref) {
|
|
156
|
+
try {
|
|
157
|
+
return await client.workflows.getWorkflowGraph(ref.id, projectId);
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
throw new ToolboxOperationError('workflows', 'getGraph', err instanceof Error ? err.message : String(err), err);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
return { dataProducts, queues, connections, workflows };
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=toolbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbox.js","sourceRoot":"","sources":["../../src/authoring/toolbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAkBhD,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,OAAO,qBAAsB,SAAQ,WAAW;IACpD,8EAA8E;IACrE,SAAS,CAAS;IAC3B,iEAAiE;IACxD,SAAS,CAAS;IAE3B,YACE,SAAiB,EACjB,SAAiB,EACjB,OAAe,EACf,KAAe;QAEf,KAAK,CACH,WAAW,SAAS,IAAI,SAAS,YAAY,OAAO,EAAE,EACtD;YACE,IAAI,EAAE,0BAA0B;YAChC,WAAW,EAAG,KAA8C,EAAE,WAAW;YACzE,OAAO,EAAE;gBACP,SAAS;gBACT,SAAS;gBACT,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpE;SACF,CACF,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,MAAM,CAAC,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AC,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YACpE,CAAC;YAAC,OAAO,GAAY,EAAE,CAAC;gBACtB,MAAM,IAAI,qBAAqB,CAC7B,WAAW,EACX,UAAU,EACV,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAChD,GAAG,CACJ,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;IAEF,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigger builders for code-first data workflow authoring.
|
|
3
|
+
*
|
|
4
|
+
* Each builder accepts typed constants from the Generated_SDK_Artifact and
|
|
5
|
+
* returns a `TriggerSpec` describing the event source.
|
|
6
|
+
*/
|
|
7
|
+
import type { TriggerSpec, QueueRef, ConnectorRef } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Trigger builder namespace. Each method constructs a `TriggerSpec` from a
|
|
10
|
+
* typed workspace constant.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { on } from '@loxtep/sdk/authoring';
|
|
15
|
+
* import { queues, connectors } from './.loxtep/generated/index';
|
|
16
|
+
*
|
|
17
|
+
* on.queueEvent(queues.orders_raw)
|
|
18
|
+
* on.connectorEvent(connectors.shopify_main)
|
|
19
|
+
* on.schedule('0 * * * *')
|
|
20
|
+
* on.webhook('/ingest/orders')
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const on: {
|
|
24
|
+
/**
|
|
25
|
+
* Trigger on a queue event from a typed queue constant.
|
|
26
|
+
*/
|
|
27
|
+
readonly queueEvent: (queue: QueueRef) => TriggerSpec;
|
|
28
|
+
/**
|
|
29
|
+
* Trigger on a connector event from a typed connector constant.
|
|
30
|
+
*/
|
|
31
|
+
readonly connectorEvent: (connector: ConnectorRef) => TriggerSpec;
|
|
32
|
+
/**
|
|
33
|
+
* Trigger on a cron schedule.
|
|
34
|
+
*/
|
|
35
|
+
readonly schedule: (cron: string) => TriggerSpec;
|
|
36
|
+
/**
|
|
37
|
+
* Trigger on an incoming webhook at the given path.
|
|
38
|
+
*/
|
|
39
|
+
readonly webhook: (path: string) => TriggerSpec;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=triggers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../src/authoring/triggers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,EAAE;IACb;;OAEG;iCACe,QAAQ,KAAG,WAAW;IAOxC;;OAEG;yCACuB,YAAY,KAAG,WAAW;IAOpD;;OAEG;8BACY,MAAM,KAAG,WAAW;IAOnC;;OAEG;6BACW,MAAM,KAAG,WAAW;CAM1B,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trigger builders for code-first data workflow authoring.
|
|
3
|
+
*
|
|
4
|
+
* Each builder accepts typed constants from the Generated_SDK_Artifact and
|
|
5
|
+
* returns a `TriggerSpec` describing the event source.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Trigger builder namespace. Each method constructs a `TriggerSpec` from a
|
|
9
|
+
* typed workspace constant.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { on } from '@loxtep/sdk/authoring';
|
|
14
|
+
* import { queues, connectors } from './.loxtep/generated/index';
|
|
15
|
+
*
|
|
16
|
+
* on.queueEvent(queues.orders_raw)
|
|
17
|
+
* on.connectorEvent(connectors.shopify_main)
|
|
18
|
+
* on.schedule('0 * * * *')
|
|
19
|
+
* on.webhook('/ingest/orders')
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const on = {
|
|
23
|
+
/**
|
|
24
|
+
* Trigger on a queue event from a typed queue constant.
|
|
25
|
+
*/
|
|
26
|
+
queueEvent(queue) {
|
|
27
|
+
return {
|
|
28
|
+
kind: 'queue',
|
|
29
|
+
ref: { id: queue.id, name: queue.name },
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Trigger on a connector event from a typed connector constant.
|
|
34
|
+
*/
|
|
35
|
+
connectorEvent(connector) {
|
|
36
|
+
return {
|
|
37
|
+
kind: 'connector',
|
|
38
|
+
ref: { id: connector.id, name: connector.type },
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Trigger on a cron schedule.
|
|
43
|
+
*/
|
|
44
|
+
schedule(cron) {
|
|
45
|
+
return {
|
|
46
|
+
kind: 'schedule',
|
|
47
|
+
schedule: cron,
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* Trigger on an incoming webhook at the given path.
|
|
52
|
+
*/
|
|
53
|
+
webhook(path) {
|
|
54
|
+
return {
|
|
55
|
+
kind: 'webhook',
|
|
56
|
+
path,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=triggers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggers.js","sourceRoot":"","sources":["../../src/authoring/triggers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB;;OAEG;IACH,UAAU,CAAC,KAAe;QACxB,OAAO;YACL,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;SACxC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,SAAuB;QACpC,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,GAAG,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE;SAChD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,IAAY;QACnB,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAY;QAClB,OAAO;YACL,IAAI,EAAE,SAAS;YACf,IAAI;SACL,CAAC;IACJ,CAAC;CACO,CAAC"}
|