@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.
Files changed (41) hide show
  1. package/dist/examples/http-request.d.ts +99 -0
  2. package/dist/examples/http-request.d.ts.map +1 -0
  3. package/dist/examples/http-request.js +122 -0
  4. package/dist/examples/http-request.js.map +1 -0
  5. package/dist/examples/index.d.ts +4 -0
  6. package/dist/examples/index.d.ts.map +1 -0
  7. package/dist/examples/index.js +3 -0
  8. package/dist/examples/index.js.map +1 -0
  9. package/dist/index.d.ts +62 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +25 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/logic/conditional.d.ts +110 -0
  14. package/dist/logic/conditional.d.ts.map +1 -0
  15. package/dist/logic/conditional.js +129 -0
  16. package/dist/logic/conditional.js.map +1 -0
  17. package/dist/logic/delay.d.ts +54 -0
  18. package/dist/logic/delay.d.ts.map +1 -0
  19. package/dist/logic/delay.js +54 -0
  20. package/dist/logic/delay.js.map +1 -0
  21. package/dist/logic/end.d.ts +45 -0
  22. package/dist/logic/end.d.ts.map +1 -0
  23. package/dist/logic/end.js +46 -0
  24. package/dist/logic/end.js.map +1 -0
  25. package/dist/logic/index.d.ts +10 -0
  26. package/dist/logic/index.d.ts.map +1 -0
  27. package/dist/logic/index.js +7 -0
  28. package/dist/logic/index.js.map +1 -0
  29. package/dist/transform/filter.d.ts +79 -0
  30. package/dist/transform/filter.d.ts.map +1 -0
  31. package/dist/transform/filter.js +143 -0
  32. package/dist/transform/filter.js.map +1 -0
  33. package/dist/transform/index.d.ts +7 -0
  34. package/dist/transform/index.d.ts.map +1 -0
  35. package/dist/transform/index.js +5 -0
  36. package/dist/transform/index.js.map +1 -0
  37. package/dist/transform/map.d.ts +54 -0
  38. package/dist/transform/map.d.ts.map +1 -0
  39. package/dist/transform/map.js +90 -0
  40. package/dist/transform/map.js.map +1 -0
  41. package/package.json +59 -0
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ import { defineNode } from '@jam-nodes/core';
3
+ /**
4
+ * Input schema for delay node
5
+ */
6
+ export const DelayInputSchema = z.object({
7
+ /** Duration to wait in milliseconds */
8
+ durationMs: z.number().min(0).max(3600000), // Max 1 hour
9
+ /** Optional message to log */
10
+ message: z.string().optional(),
11
+ });
12
+ /**
13
+ * Output schema for delay node
14
+ */
15
+ export const DelayOutputSchema = z.object({
16
+ waited: z.boolean(),
17
+ actualDurationMs: z.number(),
18
+ message: z.string().optional(),
19
+ });
20
+ /**
21
+ * Delay node - pause workflow execution for a specified duration.
22
+ *
23
+ * Useful for rate limiting, scheduling, or waiting for external processes.
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * // Wait 5 seconds
28
+ * { durationMs: 5000, message: 'Waiting before next API call' }
29
+ * ```
30
+ */
31
+ export const delayNode = defineNode({
32
+ type: 'delay',
33
+ name: 'Delay',
34
+ description: 'Wait for a specified duration before continuing',
35
+ category: 'logic',
36
+ inputSchema: DelayInputSchema,
37
+ outputSchema: DelayOutputSchema,
38
+ capabilities: {
39
+ supportsCancel: true,
40
+ },
41
+ executor: async (input) => {
42
+ const start = Date.now();
43
+ await new Promise((resolve) => setTimeout(resolve, input.durationMs));
44
+ return {
45
+ success: true,
46
+ output: {
47
+ waited: true,
48
+ actualDurationMs: Date.now() - start,
49
+ message: input.message,
50
+ },
51
+ };
52
+ },
53
+ });
54
+ //# sourceMappingURL=delay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delay.js","sourceRoot":"","sources":["../../src/logic/delay.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,MAAM,CAAC;IACvC,uCAAuC;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,E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6
+ message: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ message?: string | undefined;
9
+ }, {
10
+ message?: string | undefined;
11
+ }>;
12
+ export type EndInput = z.infer<typeof EndInputSchema>;
13
+ /**
14
+ * Output schema for end node
15
+ */
16
+ export declare const EndOutputSchema: z.ZodObject<{
17
+ completed: z.ZodBoolean;
18
+ message: z.ZodOptional<z.ZodString>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ completed: boolean;
21
+ message?: string | undefined;
22
+ }, {
23
+ completed: boolean;
24
+ message?: string | undefined;
25
+ }>;
26
+ export type EndOutput = z.infer<typeof EndOutputSchema>;
27
+ /**
28
+ * End node - marks the completion of a workflow branch.
29
+ *
30
+ * This is a terminal node that signals the workflow executor
31
+ * that this execution path has completed successfully.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * // Simple end
36
+ * { message: 'Workflow completed successfully' }
37
+ * ```
38
+ */
39
+ export declare const endNode: import("@jam-nodes/core").NodeDefinition<{
40
+ message?: string | undefined;
41
+ }, {
42
+ completed: boolean;
43
+ message?: string | undefined;
44
+ }>;
45
+ //# sourceMappingURL=end.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end.d.ts","sourceRoot":"","sources":["../../src/logic/end.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;EAEzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;EAG1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO;;;;;EAiBlB,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { defineNode } from '@jam-nodes/core';
3
+ /**
4
+ * Input schema for end node
5
+ */
6
+ export const EndInputSchema = z.object({
7
+ message: z.string().optional(),
8
+ });
9
+ /**
10
+ * Output schema for end node
11
+ */
12
+ export const EndOutputSchema = z.object({
13
+ completed: z.boolean(),
14
+ message: z.string().optional(),
15
+ });
16
+ /**
17
+ * End node - marks the completion of a workflow branch.
18
+ *
19
+ * This is a terminal node that signals the workflow executor
20
+ * that this execution path has completed successfully.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * // Simple end
25
+ * { message: 'Workflow completed successfully' }
26
+ * ```
27
+ */
28
+ export const endNode = defineNode({
29
+ type: 'end',
30
+ name: 'End',
31
+ description: 'Mark the end of a workflow branch',
32
+ category: 'logic',
33
+ inputSchema: EndInputSchema,
34
+ outputSchema: EndOutputSchema,
35
+ estimatedDuration: 0,
36
+ executor: async (input) => {
37
+ return {
38
+ success: true,
39
+ output: {
40
+ completed: true,
41
+ message: input.message,
42
+ },
43
+ };
44
+ },
45
+ });
46
+ //# sourceMappingURL=end.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end.js","sourceRoot":"","sources":["../../src/logic/end.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,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAIH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,mCAAmC;IAChD,QAAQ,EAAE,OAAO;IACjB,WAAW,EAAE,cAAc;IAC3B,YAAY,EAAE,eAAe;IAC7B,iBAAiB,EAAE,CAAC;IACpB,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACxB,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EAAE;gBACN,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,KAAK,CAAC,OAAO;aACvB;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export { conditionalNode } from './conditional.js';
2
+ export type { ConditionalInput, ConditionalOutput, Condition, ConditionType, } from './conditional.js';
3
+ export { ConditionalInputSchema, ConditionalOutputSchema, ConditionSchema, ConditionTypeSchema, } from './conditional.js';
4
+ export { endNode } from './end.js';
5
+ export type { EndInput, EndOutput } from './end.js';
6
+ export { EndInputSchema, EndOutputSchema } from './end.js';
7
+ export { delayNode } from './delay.js';
8
+ export type { DelayInput, DelayOutput } from './delay.js';
9
+ export { DelayInputSchema, DelayOutputSchema } from './delay.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { conditionalNode } from './conditional.js';
2
+ export { ConditionalInputSchema, ConditionalOutputSchema, ConditionSchema, ConditionTypeSchema, } from './conditional.js';
3
+ export { endNode } from './end.js';
4
+ export { EndInputSchema, EndOutputSchema } from './end.js';
5
+ export { delayNode } from './delay.js';
6
+ export { DelayInputSchema, DelayOutputSchema } from './delay.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOnD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Filter operator schema
4
+ */
5
+ export declare const FilterOperatorSchema: z.ZodEnum<["equals", "not_equals", "contains", "not_contains", "greater_than", "less_than", "exists", "not_exists"]>;
6
+ export type FilterOperator = z.infer<typeof FilterOperatorSchema>;
7
+ /**
8
+ * Input schema for filter node
9
+ */
10
+ export declare const FilterInputSchema: z.ZodObject<{
11
+ /** Array of items to filter */
12
+ items: z.ZodArray<z.ZodUnknown, "many">;
13
+ /** Property path to check (dot notation) */
14
+ path: z.ZodString;
15
+ /** Filter operator */
16
+ operator: z.ZodEnum<["equals", "not_equals", "contains", "not_contains", "greater_than", "less_than", "exists", "not_exists"]>;
17
+ /** Value to compare against */
18
+ value: z.ZodOptional<z.ZodUnknown>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ path: string;
21
+ items: unknown[];
22
+ operator: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists" | "not_contains" | "not_exists";
23
+ value?: unknown;
24
+ }, {
25
+ path: string;
26
+ items: unknown[];
27
+ operator: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists" | "not_contains" | "not_exists";
28
+ value?: unknown;
29
+ }>;
30
+ export type FilterInput = z.infer<typeof FilterInputSchema>;
31
+ /**
32
+ * Output schema for filter node
33
+ */
34
+ export declare const FilterOutputSchema: z.ZodObject<{
35
+ results: z.ZodArray<z.ZodUnknown, "many">;
36
+ count: z.ZodNumber;
37
+ originalCount: z.ZodNumber;
38
+ }, "strip", z.ZodTypeAny, {
39
+ results: unknown[];
40
+ count: number;
41
+ originalCount: number;
42
+ }, {
43
+ results: unknown[];
44
+ count: number;
45
+ originalCount: number;
46
+ }>;
47
+ export type FilterOutput = z.infer<typeof FilterOutputSchema>;
48
+ /**
49
+ * Filter node - filter items in an array based on a condition.
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * // Filter contacts with email
54
+ * {
55
+ * items: '{{contacts}}',
56
+ * path: 'email',
57
+ * operator: 'exists'
58
+ * }
59
+ *
60
+ * // Filter high-value items
61
+ * {
62
+ * items: '{{orders}}',
63
+ * path: 'total',
64
+ * operator: 'greater_than',
65
+ * value: 100
66
+ * }
67
+ * ```
68
+ */
69
+ export declare const filterNode: import("@jam-nodes/core").NodeDefinition<{
70
+ path: string;
71
+ items: unknown[];
72
+ operator: "equals" | "not_equals" | "greater_than" | "less_than" | "contains" | "exists" | "not_contains" | "not_exists";
73
+ value?: unknown;
74
+ }, {
75
+ results: unknown[];
76
+ count: number;
77
+ originalCount: number;
78
+ }>;
79
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/transform/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,oBAAoB,sHAS/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,iBAAiB;IAC5B,+BAA+B;;IAE/B,4CAA4C;;IAE5C,sBAAsB;;IAEtB,+BAA+B;;;;;;;;;;;;EAE/B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AA6D9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;EAiCrB,CAAC"}
@@ -0,0 +1,143 @@
1
+ import { z } from 'zod';
2
+ import { defineNode } from '@jam-nodes/core';
3
+ /**
4
+ * Filter operator schema
5
+ */
6
+ export const FilterOperatorSchema = z.enum([
7
+ 'equals',
8
+ 'not_equals',
9
+ 'contains',
10
+ 'not_contains',
11
+ 'greater_than',
12
+ 'less_than',
13
+ 'exists',
14
+ 'not_exists',
15
+ ]);
16
+ /**
17
+ * Input schema for filter node
18
+ */
19
+ export const FilterInputSchema = z.object({
20
+ /** Array of items to filter */
21
+ items: z.array(z.unknown()),
22
+ /** Property path to check (dot notation) */
23
+ path: z.string(),
24
+ /** Filter operator */
25
+ operator: FilterOperatorSchema,
26
+ /** Value to compare against */
27
+ value: z.unknown().optional(),
28
+ });
29
+ /**
30
+ * Output schema for filter node
31
+ */
32
+ export const FilterOutputSchema = z.object({
33
+ results: z.array(z.unknown()),
34
+ count: z.number(),
35
+ originalCount: z.number(),
36
+ });
37
+ /**
38
+ * Resolve a nested path on an object
39
+ */
40
+ function resolvePath(obj, path) {
41
+ const parts = path.split('.');
42
+ let current = obj;
43
+ for (const part of parts) {
44
+ if (current === null || current === undefined) {
45
+ return undefined;
46
+ }
47
+ current = current[part];
48
+ }
49
+ return current;
50
+ }
51
+ /**
52
+ * Evaluate filter condition
53
+ */
54
+ function evaluateFilter(operator, actual, expected) {
55
+ switch (operator) {
56
+ case 'equals':
57
+ return actual === expected;
58
+ case 'not_equals':
59
+ return actual !== expected;
60
+ case 'contains':
61
+ if (typeof actual === 'string' && typeof expected === 'string') {
62
+ return actual.includes(expected);
63
+ }
64
+ if (Array.isArray(actual)) {
65
+ return actual.includes(expected);
66
+ }
67
+ return false;
68
+ case 'not_contains':
69
+ if (typeof actual === 'string' && typeof expected === 'string') {
70
+ return !actual.includes(expected);
71
+ }
72
+ if (Array.isArray(actual)) {
73
+ return !actual.includes(expected);
74
+ }
75
+ return true;
76
+ case 'greater_than':
77
+ return typeof actual === 'number' && typeof expected === 'number' && actual > expected;
78
+ case 'less_than':
79
+ return typeof actual === 'number' && typeof expected === 'number' && actual < expected;
80
+ case 'exists':
81
+ return actual !== null && actual !== undefined;
82
+ case 'not_exists':
83
+ return actual === null || actual === undefined;
84
+ default:
85
+ return false;
86
+ }
87
+ }
88
+ /**
89
+ * Filter node - filter items in an array based on a condition.
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * // Filter contacts with email
94
+ * {
95
+ * items: '{{contacts}}',
96
+ * path: 'email',
97
+ * operator: 'exists'
98
+ * }
99
+ *
100
+ * // Filter high-value items
101
+ * {
102
+ * items: '{{orders}}',
103
+ * path: 'total',
104
+ * operator: 'greater_than',
105
+ * value: 100
106
+ * }
107
+ * ```
108
+ */
109
+ export const filterNode = defineNode({
110
+ type: 'filter',
111
+ name: 'Filter',
112
+ description: 'Filter items in an array based on a condition',
113
+ category: 'transform',
114
+ inputSchema: FilterInputSchema,
115
+ outputSchema: FilterOutputSchema,
116
+ estimatedDuration: 0,
117
+ capabilities: {
118
+ supportsRerun: true,
119
+ },
120
+ executor: async (input) => {
121
+ try {
122
+ const results = input.items.filter((item) => {
123
+ const value = resolvePath(item, input.path);
124
+ return evaluateFilter(input.operator, value, input.value);
125
+ });
126
+ return {
127
+ success: true,
128
+ output: {
129
+ results,
130
+ count: results.length,
131
+ originalCount: input.items.length,
132
+ },
133
+ };
134
+ }
135
+ catch (error) {
136
+ return {
137
+ success: false,
138
+ error: error instanceof Error ? error.message : 'Filter operation failed',
139
+ };
140
+ }
141
+ },
142
+ });
143
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/transform/filter.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,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC;IACzC,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,cAAc;IACd,cAAc;IACd,WAAW;IACX,QAAQ;IACR,YAAY;CACb,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,+BAA+B;IAC/B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3B,4CAA4C;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,sBAAsB;IACtB,QAAQ,EAAE,oBAAoB;IAC9B,+BAA+B;IAC/B,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QA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C1C,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC5C,OAAO,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC5D,CAAC,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE;oBACN,OAAO;oBACP,KAAK,EAAE,OAAO,CAAC,MAAM;oBACrB,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM;iBAClC;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,yBAAyB;aAC1E,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { mapNode } from './map.js';
2
+ export type { MapInput, MapOutput } from './map.js';
3
+ export { MapInputSchema, MapOutputSchema } from './map.js';
4
+ export { filterNode } from './filter.js';
5
+ export type { FilterInput, FilterOutput, FilterOperator } from './filter.js';
6
+ export { FilterInputSchema, FilterOutputSchema, FilterOperatorSchema } from './filter.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transform/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { mapNode } from './map.js';
2
+ export { MapInputSchema, MapOutputSchema } from './map.js';
3
+ export { filterNode } from './filter.js';
4
+ export { FilterInputSchema, FilterOutputSchema, FilterOperatorSchema } from './filter.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transform/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Input schema for map node
4
+ */
5
+ export declare const MapInputSchema: z.ZodObject<{
6
+ /** Array of items to transform */
7
+ items: z.ZodArray<z.ZodUnknown, "many">;
8
+ /** Property path to extract from each item (dot notation) */
9
+ path: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ path: string;
12
+ items: unknown[];
13
+ }, {
14
+ path: string;
15
+ items: unknown[];
16
+ }>;
17
+ export type MapInput = z.infer<typeof MapInputSchema>;
18
+ /**
19
+ * Output schema for map node
20
+ */
21
+ export declare const MapOutputSchema: z.ZodObject<{
22
+ results: z.ZodArray<z.ZodUnknown, "many">;
23
+ count: z.ZodNumber;
24
+ }, "strip", z.ZodTypeAny, {
25
+ results: unknown[];
26
+ count: number;
27
+ }, {
28
+ results: unknown[];
29
+ count: number;
30
+ }>;
31
+ export type MapOutput = z.infer<typeof MapOutputSchema>;
32
+ /**
33
+ * Map node - extract a property from each item in an array.
34
+ *
35
+ * Useful for transforming data between nodes.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * // Extract emails from contacts
40
+ * {
41
+ * items: '{{contacts}}',
42
+ * path: 'email'
43
+ * }
44
+ * // Returns: { results: ['a@example.com', 'b@example.com'], count: 2 }
45
+ * ```
46
+ */
47
+ export declare const mapNode: import("@jam-nodes/core").NodeDefinition<{
48
+ path: string;
49
+ items: unknown[];
50
+ }, {
51
+ results: unknown[];
52
+ count: number;
53
+ }>;
54
+ //# sourceMappingURL=map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/transform/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,cAAc;IACzB,kCAAkC;;IAElC,6DAA6D;;;;;;;;EAE7D,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;EAG1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AA8BxD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,OAAO;;;;;;EA6BlB,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { z } from 'zod';
2
+ import { defineNode } from '@jam-nodes/core';
3
+ /**
4
+ * Input schema for map node
5
+ */
6
+ export const MapInputSchema = z.object({
7
+ /** Array of items to transform */
8
+ items: z.array(z.unknown()),
9
+ /** Property path to extract from each item (dot notation) */
10
+ path: z.string(),
11
+ });
12
+ /**
13
+ * Output schema for map node
14
+ */
15
+ export const MapOutputSchema = z.object({
16
+ results: z.array(z.unknown()),
17
+ count: z.number(),
18
+ });
19
+ /**
20
+ * Resolve a nested path on an object
21
+ */
22
+ function resolvePath(obj, path) {
23
+ const parts = path.split('.');
24
+ let current = obj;
25
+ for (const part of parts) {
26
+ if (current === null || current === undefined) {
27
+ return undefined;
28
+ }
29
+ // Handle array access like "[0]"
30
+ const arrayMatch = part.match(/^\[(\d+)\]$/);
31
+ if (arrayMatch) {
32
+ if (Array.isArray(current)) {
33
+ current = current[parseInt(arrayMatch[1], 10)];
34
+ }
35
+ else {
36
+ return undefined;
37
+ }
38
+ }
39
+ else {
40
+ current = current[part];
41
+ }
42
+ }
43
+ return current;
44
+ }
45
+ /**
46
+ * Map node - extract a property from each item in an array.
47
+ *
48
+ * Useful for transforming data between nodes.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * // Extract emails from contacts
53
+ * {
54
+ * items: '{{contacts}}',
55
+ * path: 'email'
56
+ * }
57
+ * // Returns: { results: ['a@example.com', 'b@example.com'], count: 2 }
58
+ * ```
59
+ */
60
+ export const mapNode = defineNode({
61
+ type: 'map',
62
+ name: 'Map',
63
+ description: 'Extract a property from each item in an array',
64
+ category: 'transform',
65
+ inputSchema: MapInputSchema,
66
+ outputSchema: MapOutputSchema,
67
+ estimatedDuration: 0,
68
+ capabilities: {
69
+ supportsRerun: true,
70
+ },
71
+ executor: async (input) => {
72
+ try {
73
+ const results = input.items.map((item) => resolvePath(item, input.path));
74
+ return {
75
+ success: true,
76
+ output: {
77
+ results,
78
+ count: results.length,
79
+ },
80
+ };
81
+ }
82
+ catch (error) {
83
+ return {
84
+ success: false,
85
+ error: error instanceof Error ? error.message : 'Map operation failed',
86
+ };
87
+ }
88
+ },
89
+ });
90
+ //# sourceMappingURL=map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.js","sourceRoot":"","sources":["../../src/transform/map.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,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,kCAAkC;IAClC,KAAK,EAAE,CAAC,CA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AAE,+CAA+C;IAC5D,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,cAAc;IAC3B,YAAY,EAAE,eAAe;IAC7B,iBAAiB,EAAE,CAAC;IACpB,YAAY,EAAE;QACZ,aAAa,EAAE,IAAI;KACpB;IACD,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAEzE,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE;oBACN,OAAO;oBACP,KAAK,EAAE,OAAO,CAAC,MAAM;iBACtB;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB;aACvE,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@jam-nodes/nodes",
3
+ "version": "0.1.0",
4
+ "description": "Built-in workflow nodes for jam-nodes framework",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./logic": {
14
+ "types": "./dist/logic/index.d.ts",
15
+ "import": "./dist/logic/index.js"
16
+ },
17
+ "./transform": {
18
+ "types": "./dist/transform/index.d.ts",
19
+ "import": "./dist/transform/index.js"
20
+ },
21
+ "./examples": {
22
+ "types": "./dist/examples/index.d.ts",
23
+ "import": "./dist/examples/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "README.md"
29
+ ],
30
+ "scripts": {
31
+ "build": "tsc",
32
+ "clean": "rm -rf dist",
33
+ "typecheck": "tsc --noEmit",
34
+ "prepublishOnly": "npm run build"
35
+ },
36
+ "dependencies": {
37
+ "@jam-nodes/core": "^0.1.0"
38
+ },
39
+ "peerDependencies": {
40
+ "zod": "^3.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "typescript": "^5.7.0",
44
+ "zod": "^3.24.0"
45
+ },
46
+ "keywords": [
47
+ "workflow",
48
+ "nodes",
49
+ "conditional",
50
+ "automation"
51
+ ],
52
+ "author": "Jam",
53
+ "license": "MIT",
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+https://github.com/wespreadjam/jam-nodes.git",
57
+ "directory": "packages/nodes"
58
+ }
59
+ }