@codemation/core-nodes 1.0.1 → 1.1.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/dist/index.cjs +3002 -65
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +1521 -551
  5. package/dist/index.d.ts +1521 -551
  6. package/dist/index.js +2969 -73
  7. package/dist/index.js.map +1 -1
  8. package/package.json +5 -3
  9. package/src/authoring/defineRestNode.types.ts +204 -0
  10. package/src/credentials/ApiKeyCredentialType.ts +60 -0
  11. package/src/credentials/BasicAuthCredentialType.ts +51 -0
  12. package/src/credentials/BearerTokenCredentialType.ts +40 -0
  13. package/src/credentials/OAuth2ClientCredentialsTypeFactory.ts +117 -0
  14. package/src/credentials/OAuth2TokenExchangeFactory.ts +52 -0
  15. package/src/credentials/index.ts +4 -0
  16. package/src/http/HttpBodyBuilder.ts +90 -0
  17. package/src/http/HttpRequestExecutor.ts +150 -0
  18. package/src/http/HttpUrlBuilder.ts +22 -0
  19. package/src/http/httpRequest.types.ts +69 -0
  20. package/src/index.ts +9 -0
  21. package/src/nodes/AIAgentNode.ts +101 -3
  22. package/src/nodes/AgentToolExecutionCoordinator.ts +29 -3
  23. package/src/nodes/AssertionNode.ts +42 -0
  24. package/src/nodes/CronTriggerFactory.ts +45 -0
  25. package/src/nodes/CronTriggerNode.ts +40 -0
  26. package/src/nodes/HttpRequestNodeFactory.ts +99 -23
  27. package/src/nodes/IsTestRunNode.ts +25 -0
  28. package/src/nodes/NodeBackedToolRuntime.ts +40 -4
  29. package/src/nodes/TestTriggerNode.ts +33 -0
  30. package/src/nodes/aiAgentSupport.types.ts +18 -3
  31. package/src/nodes/assertion.ts +42 -0
  32. package/src/nodes/collections/collectionDeleteNode.types.ts +23 -0
  33. package/src/nodes/collections/collectionFindOneNode.types.ts +26 -0
  34. package/src/nodes/collections/collectionGetNode.types.ts +26 -0
  35. package/src/nodes/collections/collectionInsertNode.types.ts +22 -0
  36. package/src/nodes/collections/collectionListNode.types.ts +30 -0
  37. package/src/nodes/collections/collectionUpdateNode.types.ts +23 -0
  38. package/src/nodes/collections/index.ts +6 -0
  39. package/src/nodes/httpRequest.ts +61 -1
  40. package/src/nodes/isTestRun.ts +24 -0
  41. package/src/nodes/testTrigger.ts +72 -0
@@ -0,0 +1,72 @@
1
+ import type {
2
+ CredentialRequirement,
3
+ Item,
4
+ TestTriggerNodeConfig,
5
+ TestTriggerSetupContext,
6
+ TypeToken,
7
+ } from "@codemation/core";
8
+
9
+ import { TestTriggerNode } from "./TestTriggerNode";
10
+
11
+ export interface TestTriggerOptions<TOutputJson> {
12
+ readonly name?: string;
13
+ readonly id?: string;
14
+ readonly icon?: string;
15
+ /** Cap on simultaneous in-flight test cases for one suite run. Default: 4 (orchestrator). */
16
+ readonly concurrency?: number;
17
+ readonly credentialRequirements?: ReadonlyArray<CredentialRequirement>;
18
+ /**
19
+ * Free-form description of where the test cases come from. Shown in the node properties
20
+ * panel and the Tests-tab suite-detail header so authors revisiting the workflow six months
21
+ * later remember which mailbox / folder / fixture file the cases originate from.
22
+ */
23
+ readonly description?: string;
24
+ /**
25
+ * Author callback that yields one item per test case. Items are dispatched as separate
26
+ * workflow runs by the TestSuiteOrchestrator, with `executionOptions.testContext` set.
27
+ * The provided context exposes credential resolution and an AbortSignal for cancellation.
28
+ */
29
+ generateItems(ctx: TestTriggerSetupContext<TestTrigger<TOutputJson>>): AsyncIterable<Item<TOutputJson>>;
30
+ /**
31
+ * Optional resolver: extract a human-readable label from a yielded item. The orchestrator
32
+ * persists this on the run, so the Tests-tab tree-table shows e.g. "RFQ for batch 14"
33
+ * instead of an opaque runId. Typical use: `(item) => item.json.subject` for mailbox tests.
34
+ */
35
+ caseLabel?(item: Item<TOutputJson>): string | undefined;
36
+ }
37
+
38
+ /**
39
+ * Trigger config for a test fixture source. Drop one (or more) of these on the canvas alongside
40
+ * a workflow's live triggers; clicking "Run tests" on the Tests tab invokes
41
+ * {@link TestTriggerOptions.generateItems} via the TestSuiteOrchestrator.
42
+ */
43
+ export class TestTrigger<TOutputJson = unknown> implements TestTriggerNodeConfig<TOutputJson> {
44
+ readonly kind = "trigger" as const;
45
+ readonly triggerKind = "test" as const;
46
+ readonly type: TypeToken<unknown> = TestTriggerNode;
47
+ readonly icon: string;
48
+ readonly name: string;
49
+ readonly id?: string;
50
+ readonly concurrency?: number;
51
+ readonly description?: string;
52
+ readonly generateItems: TestTriggerOptions<TOutputJson>["generateItems"];
53
+ readonly caseLabel?: TestTriggerOptions<TOutputJson>["caseLabel"];
54
+ private readonly credentialRequirements: ReadonlyArray<CredentialRequirement>;
55
+
56
+ constructor(options: TestTriggerOptions<TOutputJson>) {
57
+ this.name = options.name ?? "Test trigger";
58
+ this.id = options.id;
59
+ this.icon = options.icon ?? "lucide:flask-conical";
60
+ this.concurrency = options.concurrency;
61
+ this.description = options.description;
62
+ this.credentialRequirements = options.credentialRequirements ?? [];
63
+ this.generateItems = options.generateItems;
64
+ this.caseLabel = options.caseLabel;
65
+ }
66
+
67
+ getCredentialRequirements(): ReadonlyArray<CredentialRequirement> {
68
+ return this.credentialRequirements;
69
+ }
70
+ }
71
+
72
+ export { TestTriggerNode } from "./TestTriggerNode";