@jam-nodes/nodes 0.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.
- package/dist/examples/http-request.d.ts +99 -0
- package/dist/examples/http-request.d.ts.map +1 -0
- package/dist/examples/http-request.js +122 -0
- package/dist/examples/http-request.js.map +1 -0
- package/dist/examples/index.d.ts +4 -0
- package/dist/examples/index.d.ts.map +1 -0
- package/dist/examples/index.js +3 -0
- package/dist/examples/index.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/logic/conditional.d.ts +110 -0
- package/dist/logic/conditional.d.ts.map +1 -0
- package/dist/logic/conditional.js +129 -0
- package/dist/logic/conditional.js.map +1 -0
- package/dist/logic/delay.d.ts +54 -0
- package/dist/logic/delay.d.ts.map +1 -0
- package/dist/logic/delay.js +54 -0
- package/dist/logic/delay.js.map +1 -0
- package/dist/logic/end.d.ts +45 -0
- package/dist/logic/end.d.ts.map +1 -0
- package/dist/logic/end.js +46 -0
- package/dist/logic/end.js.map +1 -0
- package/dist/logic/index.d.ts +10 -0
- package/dist/logic/index.d.ts.map +1 -0
- package/dist/logic/index.js +7 -0
- package/dist/logic/index.js.map +1 -0
- package/dist/transform/filter.d.ts +79 -0
- package/dist/transform/filter.d.ts.map +1 -0
- package/dist/transform/filter.js +143 -0
- package/dist/transform/filter.js.map +1 -0
- package/dist/transform/index.d.ts +7 -0
- package/dist/transform/index.d.ts.map +1 -0
- package/dist/transform/index.js +5 -0
- package/dist/transform/index.js.map +1 -0
- package/dist/transform/map.d.ts +54 -0
- package/dist/transform/map.d.ts.map +1 -0
- package/dist/transform/map.js +90 -0
- package/dist/transform/map.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* HTTP method schema
|
|
4
|
+
*/
|
|
5
|
+
export declare const HttpMethodSchema: z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>;
|
|
6
|
+
export type HttpMethod = z.infer<typeof HttpMethodSchema>;
|
|
7
|
+
/**
|
|
8
|
+
* Input schema for HTTP request node
|
|
9
|
+
*/
|
|
10
|
+
export declare const HttpRequestInputSchema: z.ZodObject<{
|
|
11
|
+
/** URL to request */
|
|
12
|
+
url: z.ZodString;
|
|
13
|
+
/** HTTP method */
|
|
14
|
+
method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>;
|
|
15
|
+
/** Request headers */
|
|
16
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
17
|
+
/** Request body (for POST, PUT, PATCH) */
|
|
18
|
+
body: z.ZodOptional<z.ZodUnknown>;
|
|
19
|
+
/** Timeout in milliseconds */
|
|
20
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
url: string;
|
|
23
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
24
|
+
timeout: number;
|
|
25
|
+
headers?: Record<string, string> | undefined;
|
|
26
|
+
body?: unknown;
|
|
27
|
+
}, {
|
|
28
|
+
url: string;
|
|
29
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
|
|
30
|
+
headers?: Record<string, string> | undefined;
|
|
31
|
+
body?: unknown;
|
|
32
|
+
timeout?: number | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
export type HttpRequestInput = z.infer<typeof HttpRequestInputSchema>;
|
|
35
|
+
/**
|
|
36
|
+
* Output schema for HTTP request node
|
|
37
|
+
*/
|
|
38
|
+
export declare const HttpRequestOutputSchema: z.ZodObject<{
|
|
39
|
+
status: z.ZodNumber;
|
|
40
|
+
statusText: z.ZodString;
|
|
41
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
42
|
+
body: z.ZodUnknown;
|
|
43
|
+
ok: z.ZodBoolean;
|
|
44
|
+
durationMs: z.ZodNumber;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
status: number;
|
|
47
|
+
durationMs: number;
|
|
48
|
+
headers: Record<string, string>;
|
|
49
|
+
statusText: string;
|
|
50
|
+
ok: boolean;
|
|
51
|
+
body?: unknown;
|
|
52
|
+
}, {
|
|
53
|
+
status: number;
|
|
54
|
+
durationMs: number;
|
|
55
|
+
headers: Record<string, string>;
|
|
56
|
+
statusText: string;
|
|
57
|
+
ok: boolean;
|
|
58
|
+
body?: unknown;
|
|
59
|
+
}>;
|
|
60
|
+
export type HttpRequestOutput = z.infer<typeof HttpRequestOutputSchema>;
|
|
61
|
+
/**
|
|
62
|
+
* HTTP Request node - make HTTP requests to external APIs.
|
|
63
|
+
*
|
|
64
|
+
* Supports all common HTTP methods with configurable headers,
|
|
65
|
+
* body, and timeout.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* // GET request
|
|
70
|
+
* {
|
|
71
|
+
* url: 'https://api.example.com/data',
|
|
72
|
+
* method: 'GET',
|
|
73
|
+
* headers: { 'Authorization': 'Bearer {{apiKey}}' }
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* // POST request with JSON body
|
|
77
|
+
* {
|
|
78
|
+
* url: 'https://api.example.com/submit',
|
|
79
|
+
* method: 'POST',
|
|
80
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
81
|
+
* body: { name: '{{userName}}', email: '{{userEmail}}' }
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const httpRequestNode: import("@jam-nodes/core").NodeDefinition<{
|
|
86
|
+
url: string;
|
|
87
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
|
|
88
|
+
headers?: Record<string, string> | undefined;
|
|
89
|
+
body?: unknown;
|
|
90
|
+
timeout?: number | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
status: number;
|
|
93
|
+
durationMs: number;
|
|
94
|
+
headers: Record<string, string>;
|
|
95
|
+
statusText: string;
|
|
96
|
+
ok: boolean;
|
|
97
|
+
body?: unknown;
|
|
98
|
+
}>;
|
|
99
|
+
//# sourceMappingURL=http-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-request.d.ts","sourceRoot":"","sources":["../../src/examples/http-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,gBAAgB,sDAAoD,CAAC;AAElF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,sBAAsB;IACjC,qBAAqB;;IAErB,kBAAkB;;IAElB,sBAAsB;;IAEtB,0CAA0C;;IAE1C,8BAA8B;;;;;;;;;;;;;;EAE9B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;EAOlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;EAqE1B,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineNode } from '@jam-nodes/core';
|
|
3
|
+
/**
|
|
4
|
+
* HTTP method schema
|
|
5
|
+
*/
|
|
6
|
+
export const HttpMethodSchema = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
|
|
7
|
+
/**
|
|
8
|
+
* Input schema for HTTP request node
|
|
9
|
+
*/
|
|
10
|
+
export const HttpRequestInputSchema = z.object({
|
|
11
|
+
/** URL to request */
|
|
12
|
+
url: z.string().url(),
|
|
13
|
+
/** HTTP method */
|
|
14
|
+
method: HttpMethodSchema.default('GET'),
|
|
15
|
+
/** Request headers */
|
|
16
|
+
headers: z.record(z.string()).optional(),
|
|
17
|
+
/** Request body (for POST, PUT, PATCH) */
|
|
18
|
+
body: z.unknown().optional(),
|
|
19
|
+
/** Timeout in milliseconds */
|
|
20
|
+
timeout: z.number().min(1000).max(60000).default(30000),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Output schema for HTTP request node
|
|
24
|
+
*/
|
|
25
|
+
export const HttpRequestOutputSchema = z.object({
|
|
26
|
+
status: z.number(),
|
|
27
|
+
statusText: z.string(),
|
|
28
|
+
headers: z.record(z.string()),
|
|
29
|
+
body: z.unknown(),
|
|
30
|
+
ok: z.boolean(),
|
|
31
|
+
durationMs: z.number(),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* HTTP Request node - make HTTP requests to external APIs.
|
|
35
|
+
*
|
|
36
|
+
* Supports all common HTTP methods with configurable headers,
|
|
37
|
+
* body, and timeout.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* // GET request
|
|
42
|
+
* {
|
|
43
|
+
* url: 'https://api.example.com/data',
|
|
44
|
+
* method: 'GET',
|
|
45
|
+
* headers: { 'Authorization': 'Bearer {{apiKey}}' }
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* // POST request with JSON body
|
|
49
|
+
* {
|
|
50
|
+
* url: 'https://api.example.com/submit',
|
|
51
|
+
* method: 'POST',
|
|
52
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
53
|
+
* body: { name: '{{userName}}', email: '{{userEmail}}' }
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export const httpRequestNode = defineNode({
|
|
58
|
+
type: 'http_request',
|
|
59
|
+
name: 'HTTP Request',
|
|
60
|
+
description: 'Make an HTTP request to an external API',
|
|
61
|
+
category: 'integration',
|
|
62
|
+
inputSchema: HttpRequestInputSchema,
|
|
63
|
+
outputSchema: HttpRequestOutputSchema,
|
|
64
|
+
estimatedDuration: 5,
|
|
65
|
+
capabilities: {
|
|
66
|
+
supportsRerun: true,
|
|
67
|
+
supportsCancel: true,
|
|
68
|
+
},
|
|
69
|
+
executor: async (input) => {
|
|
70
|
+
const controller = new AbortController();
|
|
71
|
+
const timeoutId = setTimeout(() => controller.abort(), input.timeout);
|
|
72
|
+
const start = Date.now();
|
|
73
|
+
try {
|
|
74
|
+
const response = await fetch(input.url, {
|
|
75
|
+
method: input.method,
|
|
76
|
+
headers: input.headers,
|
|
77
|
+
body: input.body ? JSON.stringify(input.body) : undefined,
|
|
78
|
+
signal: controller.signal,
|
|
79
|
+
});
|
|
80
|
+
clearTimeout(timeoutId);
|
|
81
|
+
// Try to parse as JSON, fall back to text
|
|
82
|
+
let body;
|
|
83
|
+
const contentType = response.headers.get('content-type') || '';
|
|
84
|
+
if (contentType.includes('application/json')) {
|
|
85
|
+
body = await response.json();
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
body = await response.text();
|
|
89
|
+
}
|
|
90
|
+
// Convert headers to plain object
|
|
91
|
+
const headers = {};
|
|
92
|
+
response.headers.forEach((value, key) => {
|
|
93
|
+
headers[key] = value;
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
success: true,
|
|
97
|
+
output: {
|
|
98
|
+
status: response.status,
|
|
99
|
+
statusText: response.statusText,
|
|
100
|
+
headers,
|
|
101
|
+
body,
|
|
102
|
+
ok: response.ok,
|
|
103
|
+
durationMs: Date.now() - start,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
clearTimeout(timeoutId);
|
|
109
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
error: `Request timed out after ${input.timeout}ms`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
success: false,
|
|
117
|
+
error: error instanceof Error ? error.message : 'Request failed',
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=http-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../src/examples/http-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAIlF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,qBAAqB;IACrB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACrB,kBAAkB;IAClB,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC;IACvC,sBAAsB;IACtB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,0CAA0C;IAC1C,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5B,8BAA8B;IAC9B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;CACxD,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC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K,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB;aACjE,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { httpRequestNode } from './http-request.js';
|
|
2
|
+
export type { HttpRequestInput, HttpRequestOutput, HttpMethod } from './http-request.js';
|
|
3
|
+
export { HttpRequestInputSchema, HttpRequestOutputSchema, HttpMethodSchema, } from './http-request.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/examples/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/examples/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export { conditionalNode, endNode, delayNode, ConditionalInputSchema, ConditionalOutputSchema, ConditionSchema, ConditionTypeSchema, EndInputSchema, EndOutputSchema, DelayInputSchema, DelayOutputSchema, } from './logic/index.js';
|
|
2
|
+
export type { ConditionalInput, ConditionalOutput, Condition, ConditionType, EndInput, EndOutput, DelayInput, DelayOutput, } from './logic/index.js';
|
|
3
|
+
export { mapNode, filterNode, MapInputSchema, MapOutputSchema, FilterInputSchema, FilterOutputSchema, FilterOperatorSchema, } from './transform/index.js';
|
|
4
|
+
export type { MapInput, MapOutput, FilterInput, FilterOutput, FilterOperator, } from './transform/index.js';
|
|
5
|
+
export { httpRequestNode, HttpRequestInputSchema, HttpRequestOutputSchema, HttpMethodSchema, } from './examples/index.js';
|
|
6
|
+
export type { HttpRequestInput, HttpRequestOutput, HttpMethod, } from './examples/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* All built-in nodes as an array for easy registration
|
|
9
|
+
*/
|
|
10
|
+
export declare const builtInNodes: (import("@jam-nodes/core").NodeDefinition<{
|
|
11
|
+
condition: {
|
|
12
|
+
type: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists";
|
|
13
|
+
variableName: string;
|
|
14
|
+
value?: unknown;
|
|
15
|
+
};
|
|
16
|
+
trueNodeId: string;
|
|
17
|
+
falseNodeId: string;
|
|
18
|
+
}, {
|
|
19
|
+
conditionMet: boolean;
|
|
20
|
+
selectedBranch: string;
|
|
21
|
+
}> | import("@jam-nodes/core").NodeDefinition<{
|
|
22
|
+
message?: string | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
completed: boolean;
|
|
25
|
+
message?: string | undefined;
|
|
26
|
+
}> | import("@jam-nodes/core").NodeDefinition<{
|
|
27
|
+
durationMs: number;
|
|
28
|
+
message?: string | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
waited: boolean;
|
|
31
|
+
actualDurationMs: number;
|
|
32
|
+
message?: string | undefined;
|
|
33
|
+
}> | import("@jam-nodes/core").NodeDefinition<{
|
|
34
|
+
path: string;
|
|
35
|
+
items: unknown[];
|
|
36
|
+
}, {
|
|
37
|
+
results: unknown[];
|
|
38
|
+
count: number;
|
|
39
|
+
}> | import("@jam-nodes/core").NodeDefinition<{
|
|
40
|
+
path: string;
|
|
41
|
+
items: unknown[];
|
|
42
|
+
operator: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists" | "not_contains" | "not_exists";
|
|
43
|
+
value?: unknown;
|
|
44
|
+
}, {
|
|
45
|
+
results: unknown[];
|
|
46
|
+
count: number;
|
|
47
|
+
originalCount: number;
|
|
48
|
+
}> | import("@jam-nodes/core").NodeDefinition<{
|
|
49
|
+
url: string;
|
|
50
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
|
|
51
|
+
headers?: Record<string, string> | undefined;
|
|
52
|
+
body?: unknown;
|
|
53
|
+
timeout?: number | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
status: number;
|
|
56
|
+
durationMs: number;
|
|
57
|
+
headers: Record<string, string>;
|
|
58
|
+
statusText: string;
|
|
59
|
+
ok: boolean;
|
|
60
|
+
body?: unknown;
|
|
61
|
+
}>)[];
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,OAAO,EACP,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,QAAQ,EACR,SAAS,EACT,UAAU,EACV,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,OAAO,EACP,UAAU,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,qBAAqB,CAAC;AAU7B;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOxB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Logic nodes
|
|
2
|
+
export { conditionalNode, endNode, delayNode, ConditionalInputSchema, ConditionalOutputSchema, ConditionSchema, ConditionTypeSchema, EndInputSchema, EndOutputSchema, DelayInputSchema, DelayOutputSchema, } from './logic/index.js';
|
|
3
|
+
// Transform nodes
|
|
4
|
+
export { mapNode, filterNode, MapInputSchema, MapOutputSchema, FilterInputSchema, FilterOutputSchema, FilterOperatorSchema, } from './transform/index.js';
|
|
5
|
+
// Example nodes
|
|
6
|
+
export { httpRequestNode, HttpRequestInputSchema, HttpRequestOutputSchema, HttpMethodSchema, } from './examples/index.js';
|
|
7
|
+
// All nodes as a collection
|
|
8
|
+
import { conditionalNode } from './logic/index.js';
|
|
9
|
+
import { endNode } from './logic/index.js';
|
|
10
|
+
import { delayNode } from './logic/index.js';
|
|
11
|
+
import { mapNode } from './transform/index.js';
|
|
12
|
+
import { filterNode } from './transform/index.js';
|
|
13
|
+
import { httpRequestNode } from './examples/index.js';
|
|
14
|
+
/**
|
|
15
|
+
* All built-in nodes as an array for easy registration
|
|
16
|
+
*/
|
|
17
|
+
export const builtInNodes = [
|
|
18
|
+
conditionalNode,
|
|
19
|
+
endNode,
|
|
20
|
+
delayNode,
|
|
21
|
+
mapNode,
|
|
22
|
+
filterNode,
|
|
23
|
+
httpRequestNode,
|
|
24
|
+
];
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EACL,eAAe,EACf,OAAO,EACP,SAAS,EACT,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAa1B,kBAAkB;AAClB,OAAO,EACL,OAAO,EACP,UAAU,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAU9B,gBAAgB;AAChB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAQ7B,4BAA4B;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,eAAe;IACf,OAAO;IACP,SAAS;IACT,OAAO;IACP,UAAU;IACV,eAAe;CAChB,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Condition types for conditional branching
|
|
4
|
+
*/
|
|
5
|
+
export declare const ConditionTypeSchema: z.ZodEnum<["equals", "not_equals", "greater_than", "less_than", "contains", "exists"]>;
|
|
6
|
+
export type ConditionType = z.infer<typeof ConditionTypeSchema>;
|
|
7
|
+
/**
|
|
8
|
+
* Condition configuration
|
|
9
|
+
*/
|
|
10
|
+
export declare const ConditionSchema: z.ZodObject<{
|
|
11
|
+
type: z.ZodEnum<["equals", "not_equals", "greater_than", "less_than", "contains", "exists"]>;
|
|
12
|
+
variableName: z.ZodString;
|
|
13
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
type: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists";
|
|
16
|
+
variableName: string;
|
|
17
|
+
value?: unknown;
|
|
18
|
+
}, {
|
|
19
|
+
type: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists";
|
|
20
|
+
variableName: string;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
export type Condition = z.infer<typeof ConditionSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Input schema for conditional node
|
|
26
|
+
*/
|
|
27
|
+
export declare const ConditionalInputSchema: z.ZodObject<{
|
|
28
|
+
condition: z.ZodObject<{
|
|
29
|
+
type: z.ZodEnum<["equals", "not_equals", "greater_than", "less_than", "contains", "exists"]>;
|
|
30
|
+
variableName: z.ZodString;
|
|
31
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
type: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists";
|
|
34
|
+
variableName: string;
|
|
35
|
+
value?: unknown;
|
|
36
|
+
}, {
|
|
37
|
+
type: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists";
|
|
38
|
+
variableName: string;
|
|
39
|
+
value?: unknown;
|
|
40
|
+
}>;
|
|
41
|
+
trueNodeId: z.ZodString;
|
|
42
|
+
falseNodeId: z.ZodString;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
condition: {
|
|
45
|
+
type: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists";
|
|
46
|
+
variableName: string;
|
|
47
|
+
value?: unknown;
|
|
48
|
+
};
|
|
49
|
+
trueNodeId: string;
|
|
50
|
+
falseNodeId: string;
|
|
51
|
+
}, {
|
|
52
|
+
condition: {
|
|
53
|
+
type: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists";
|
|
54
|
+
variableName: string;
|
|
55
|
+
value?: unknown;
|
|
56
|
+
};
|
|
57
|
+
trueNodeId: string;
|
|
58
|
+
falseNodeId: string;
|
|
59
|
+
}>;
|
|
60
|
+
export type ConditionalInput = z.infer<typeof ConditionalInputSchema>;
|
|
61
|
+
/**
|
|
62
|
+
* Output schema for conditional node
|
|
63
|
+
*/
|
|
64
|
+
export declare const ConditionalOutputSchema: z.ZodObject<{
|
|
65
|
+
conditionMet: z.ZodBoolean;
|
|
66
|
+
selectedBranch: z.ZodEnum<["true", "false"]>;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
conditionMet: boolean;
|
|
69
|
+
selectedBranch: "true" | "false";
|
|
70
|
+
}, {
|
|
71
|
+
conditionMet: boolean;
|
|
72
|
+
selectedBranch: "true" | "false";
|
|
73
|
+
}>;
|
|
74
|
+
export type ConditionalOutput = z.infer<typeof ConditionalOutputSchema>;
|
|
75
|
+
/**
|
|
76
|
+
* Conditional branching node.
|
|
77
|
+
*
|
|
78
|
+
* Directs workflow flow based on variable values. Supports:
|
|
79
|
+
* - equals/not_equals: Simple equality checks
|
|
80
|
+
* - greater_than/less_than: Numeric comparisons
|
|
81
|
+
* - contains: String/array membership checks
|
|
82
|
+
* - exists: Null/undefined checks
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* // Branch based on contact count
|
|
87
|
+
* {
|
|
88
|
+
* condition: {
|
|
89
|
+
* type: 'greater_than',
|
|
90
|
+
* variableName: 'contacts.length',
|
|
91
|
+
* value: 0
|
|
92
|
+
* },
|
|
93
|
+
* trueNodeId: 'send-emails',
|
|
94
|
+
* falseNodeId: 'no-contacts-found'
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare const conditionalNode: import("@jam-nodes/core").NodeDefinition<{
|
|
99
|
+
condition: {
|
|
100
|
+
type: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists";
|
|
101
|
+
variableName: string;
|
|
102
|
+
value?: unknown;
|
|
103
|
+
};
|
|
104
|
+
trueNodeId: string;
|
|
105
|
+
falseNodeId: string;
|
|
106
|
+
}, {
|
|
107
|
+
conditionMet: boolean;
|
|
108
|
+
selectedBranch: string;
|
|
109
|
+
}>;
|
|
110
|
+
//# sourceMappingURL=conditional.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional.d.ts","sourceRoot":"","sources":["../../src/logic/conditional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,mBAAmB,wFAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;EAI1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;EAGlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AA8CxE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;EAyC1B,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineNode } from '@jam-nodes/core';
|
|
3
|
+
/**
|
|
4
|
+
* Condition types for conditional branching
|
|
5
|
+
*/
|
|
6
|
+
export const ConditionTypeSchema = z.enum([
|
|
7
|
+
'equals',
|
|
8
|
+
'not_equals',
|
|
9
|
+
'greater_than',
|
|
10
|
+
'less_than',
|
|
11
|
+
'contains',
|
|
12
|
+
'exists',
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* Condition configuration
|
|
16
|
+
*/
|
|
17
|
+
export const ConditionSchema = z.object({
|
|
18
|
+
type: ConditionTypeSchema,
|
|
19
|
+
variableName: z.string(),
|
|
20
|
+
value: z.unknown().optional(),
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* Input schema for conditional node
|
|
24
|
+
*/
|
|
25
|
+
export const ConditionalInputSchema = z.object({
|
|
26
|
+
condition: ConditionSchema,
|
|
27
|
+
trueNodeId: z.string(),
|
|
28
|
+
falseNodeId: z.string(),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Output schema for conditional node
|
|
32
|
+
*/
|
|
33
|
+
export const ConditionalOutputSchema = z.object({
|
|
34
|
+
conditionMet: z.boolean(),
|
|
35
|
+
selectedBranch: z.enum(['true', 'false']),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Evaluate a condition against a value
|
|
39
|
+
*/
|
|
40
|
+
function evaluateCondition(type, actualValue, expectedValue) {
|
|
41
|
+
switch (type) {
|
|
42
|
+
case 'equals':
|
|
43
|
+
return actualValue === expectedValue;
|
|
44
|
+
case 'not_equals':
|
|
45
|
+
return actualValue !== expectedValue;
|
|
46
|
+
case 'greater_than':
|
|
47
|
+
if (typeof actualValue === 'number' && typeof expectedValue === 'number') {
|
|
48
|
+
return actualValue > expectedValue;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
case 'less_than':
|
|
52
|
+
if (typeof actualValue === 'number' && typeof expectedValue === 'number') {
|
|
53
|
+
return actualValue < expectedValue;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
case 'contains':
|
|
57
|
+
if (typeof actualValue === 'string' && typeof expectedValue === 'string') {
|
|
58
|
+
return actualValue.includes(expectedValue);
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(actualValue)) {
|
|
61
|
+
return actualValue.includes(expectedValue);
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
case 'exists':
|
|
65
|
+
return actualValue !== null && actualValue !== undefined;
|
|
66
|
+
default:
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Conditional branching node.
|
|
72
|
+
*
|
|
73
|
+
* Directs workflow flow based on variable values. Supports:
|
|
74
|
+
* - equals/not_equals: Simple equality checks
|
|
75
|
+
* - greater_than/less_than: Numeric comparisons
|
|
76
|
+
* - contains: String/array membership checks
|
|
77
|
+
* - exists: Null/undefined checks
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // Branch based on contact count
|
|
82
|
+
* {
|
|
83
|
+
* condition: {
|
|
84
|
+
* type: 'greater_than',
|
|
85
|
+
* variableName: 'contacts.length',
|
|
86
|
+
* value: 0
|
|
87
|
+
* },
|
|
88
|
+
* trueNodeId: 'send-emails',
|
|
89
|
+
* falseNodeId: 'no-contacts-found'
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export const conditionalNode = defineNode({
|
|
94
|
+
type: 'conditional',
|
|
95
|
+
name: 'Conditional',
|
|
96
|
+
description: 'Branch workflow based on a condition',
|
|
97
|
+
category: 'logic',
|
|
98
|
+
inputSchema: ConditionalInputSchema,
|
|
99
|
+
outputSchema: ConditionalOutputSchema,
|
|
100
|
+
estimatedDuration: 0,
|
|
101
|
+
capabilities: {
|
|
102
|
+
supportsRerun: true,
|
|
103
|
+
},
|
|
104
|
+
executor: async (input, context) => {
|
|
105
|
+
try {
|
|
106
|
+
// Use resolveNestedPath to support dot notation like "contacts.length"
|
|
107
|
+
const variableValue = context.resolveNestedPath(input.condition.variableName);
|
|
108
|
+
// Evaluate the condition
|
|
109
|
+
const conditionMet = evaluateCondition(input.condition.type, variableValue, input.condition.value);
|
|
110
|
+
const selectedBranch = conditionMet ? 'true' : 'false';
|
|
111
|
+
const nextNodeId = conditionMet ? input.trueNodeId : input.falseNodeId;
|
|
112
|
+
return {
|
|
113
|
+
success: true,
|
|
114
|
+
output: {
|
|
115
|
+
conditionMet,
|
|
116
|
+
selectedBranch,
|
|
117
|
+
},
|
|
118
|
+
nextNodeId,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
return {
|
|
123
|
+
success: false,
|
|
124
|
+
error: error instanceof Error ? error.message : 'Failed to evaluate condition',
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
//# sourceMappingURL=conditional.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../src/logic/conditional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC;IACxC,QAAQ;IACR,YAAY;IACZ,cAAc;IACd,WAAW;IACX,UAAU;IACV,QAAQ;CACT,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,mBAAmB;IACzB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,WAAW,EAAE,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
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Input schema for delay node
|
|
4
|
+
*/
|
|
5
|
+
export declare const DelayInputSchema: z.ZodObject<{
|
|
6
|
+
/** Duration to wait in milliseconds */
|
|
7
|
+
durationMs: z.ZodNumber;
|
|
8
|
+
/** Optional message to log */
|
|
9
|
+
message: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
durationMs: number;
|
|
12
|
+
message?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
durationMs: number;
|
|
15
|
+
message?: string | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type DelayInput = z.infer<typeof DelayInputSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* Output schema for delay node
|
|
20
|
+
*/
|
|
21
|
+
export declare const DelayOutputSchema: z.ZodObject<{
|
|
22
|
+
waited: z.ZodBoolean;
|
|
23
|
+
actualDurationMs: z.ZodNumber;
|
|
24
|
+
message: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
waited: boolean;
|
|
27
|
+
actualDurationMs: number;
|
|
28
|
+
message?: string | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
waited: boolean;
|
|
31
|
+
actualDurationMs: number;
|
|
32
|
+
message?: string | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
export type DelayOutput = z.infer<typeof DelayOutputSchema>;
|
|
35
|
+
/**
|
|
36
|
+
* Delay node - pause workflow execution for a specified duration.
|
|
37
|
+
*
|
|
38
|
+
* Useful for rate limiting, scheduling, or waiting for external processes.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* // Wait 5 seconds
|
|
43
|
+
* { durationMs: 5000, message: 'Waiting before next API call' }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const delayNode: import("@jam-nodes/core").NodeDefinition<{
|
|
47
|
+
durationMs: number;
|
|
48
|
+
message?: string | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
waited: boolean;
|
|
51
|
+
actualDurationMs: number;
|
|
52
|
+
message?: string | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
//# sourceMappingURL=delay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../src/logic/delay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B,uCAAuC;;IAEvC,8BAA8B;;;;;;;;EAE9B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAI5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;;;;;;EAwBpB,CAAC"}
|