@jam-nodes/nodes 0.2.4 → 0.2.6
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/ai/analyze-posts.d.ts +4 -2
- package/dist/ai/analyze-posts.d.ts.map +1 -1
- package/dist/ai/analyze-posts.js +48 -44
- package/dist/ai/analyze-posts.js.map +1 -1
- package/dist/ai/draft-emails.d.ts +4 -2
- package/dist/ai/draft-emails.d.ts.map +1 -1
- package/dist/ai/draft-emails.js +57 -42
- package/dist/ai/draft-emails.js.map +1 -1
- package/dist/ai/keyword-generator.d.ts +1 -1
- package/dist/ai/keyword-generator.d.ts.map +1 -1
- package/dist/ai/keyword-generator.js +45 -20
- package/dist/ai/keyword-generator.js.map +1 -1
- package/dist/index.d.ts +113 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/integrations/apollo/search-contacts.d.ts +8 -8
- package/dist/integrations/apollo/search-contacts.d.ts.map +1 -1
- package/dist/integrations/apollo/search-contacts.js +110 -26
- package/dist/integrations/apollo/search-contacts.js.map +1 -1
- package/dist/integrations/dataforseo/keyword-research.d.ts +1 -1
- package/dist/integrations/dataforseo/keyword-research.d.ts.map +1 -1
- package/dist/integrations/dataforseo/keyword-research.js +59 -9
- package/dist/integrations/dataforseo/keyword-research.js.map +1 -1
- package/dist/integrations/dataforseo/seo-audit.d.ts +1 -1
- package/dist/integrations/dataforseo/seo-audit.d.ts.map +1 -1
- package/dist/integrations/dataforseo/seo-audit.js +56 -24
- package/dist/integrations/dataforseo/seo-audit.js.map +1 -1
- package/dist/integrations/discord/create-thread.d.ts +13 -0
- package/dist/integrations/discord/create-thread.d.ts.map +1 -0
- package/dist/integrations/discord/create-thread.js +118 -0
- package/dist/integrations/discord/create-thread.js.map +1 -0
- package/dist/integrations/discord/credentials.d.ts +4 -0
- package/dist/integrations/discord/credentials.d.ts.map +1 -0
- package/dist/integrations/discord/credentials.js +26 -0
- package/dist/integrations/discord/credentials.js.map +1 -0
- package/dist/integrations/discord/index.d.ts +6 -0
- package/dist/integrations/discord/index.d.ts.map +1 -0
- package/dist/integrations/discord/index.js +6 -0
- package/dist/integrations/discord/index.js.map +1 -0
- package/dist/integrations/discord/schemas.d.ts +556 -0
- package/dist/integrations/discord/schemas.d.ts.map +1 -0
- package/dist/integrations/discord/schemas.js +77 -0
- package/dist/integrations/discord/schemas.js.map +1 -0
- package/dist/integrations/discord/send-message.d.ts +42 -0
- package/dist/integrations/discord/send-message.d.ts.map +1 -0
- package/dist/integrations/discord/send-message.js +79 -0
- package/dist/integrations/discord/send-message.js.map +1 -0
- package/dist/integrations/discord/send-webhook.d.ts +39 -0
- package/dist/integrations/discord/send-webhook.d.ts.map +1 -0
- package/dist/integrations/discord/send-webhook.js +77 -0
- package/dist/integrations/discord/send-webhook.js.map +1 -0
- package/dist/integrations/index.d.ts +1 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/openai/sora-video.d.ts +4 -4
- package/dist/integrations/openai/sora-video.d.ts.map +1 -1
- package/dist/integrations/openai/sora-video.js +82 -7
- package/dist/integrations/openai/sora-video.js.map +1 -1
- package/dist/integrations/social/linkedin-monitor.d.ts +1 -1
- package/dist/integrations/social/linkedin-monitor.d.ts.map +1 -1
- package/dist/integrations/social/linkedin-monitor.js +69 -36
- package/dist/integrations/social/linkedin-monitor.js.map +1 -1
- package/dist/integrations/social/reddit-monitor.d.ts.map +1 -1
- package/dist/integrations/social/reddit-monitor.js +5 -12
- package/dist/integrations/social/reddit-monitor.js.map +1 -1
- package/dist/integrations/social/twitter-monitor.d.ts +20 -3
- package/dist/integrations/social/twitter-monitor.d.ts.map +1 -1
- package/dist/integrations/social/twitter-monitor.js +44 -28
- package/dist/integrations/social/twitter-monitor.js.map +1 -1
- package/dist/transform/filter.d.ts.map +1 -1
- package/dist/transform/filter.js +1 -18
- package/dist/transform/filter.js.map +1 -1
- package/dist/transform/map.d.ts.map +1 -1
- package/dist/transform/map.js +1 -26
- package/dist/transform/map.js.map +1 -1
- package/dist/utils/http.d.ts +60 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/http.js +129 -0
- package/dist/utils/http.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/resolve-path.d.ts +20 -0
- package/dist/utils/resolve-path.d.ts.map +1 -0
- package/dist/utils/resolve-path.js +58 -0
- package/dist/utils/resolve-path.js.map +1 -0
- package/package.json +4 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { defineNode } from '@jam-nodes/core';
|
|
3
|
+
import { fetchWithRetry } from '../../utils/http.js';
|
|
3
4
|
// =============================================================================
|
|
4
5
|
// Schemas
|
|
5
6
|
// =============================================================================
|
|
@@ -53,13 +54,14 @@ async function searchReddit(query, options = {}) {
|
|
|
53
54
|
restrict_sr: 'off',
|
|
54
55
|
});
|
|
55
56
|
const url = `https://www.reddit.com/search.json?${params.toString()}`;
|
|
56
|
-
const response = await
|
|
57
|
+
const response = await fetchWithRetry(url, {
|
|
57
58
|
headers: {
|
|
58
59
|
'User-Agent': 'Mozilla/5.0 (compatible; JamNodes/1.0)',
|
|
59
60
|
},
|
|
60
|
-
});
|
|
61
|
+
}, { maxRetries: 3, backoffMs: 1000, timeoutMs: 30000 });
|
|
61
62
|
if (!response.ok) {
|
|
62
|
-
|
|
63
|
+
const errorText = await response.text();
|
|
64
|
+
throw new Error(`Reddit API error: ${response.status} - ${errorText}`);
|
|
63
65
|
}
|
|
64
66
|
return response.json();
|
|
65
67
|
}
|
|
@@ -133,15 +135,6 @@ export const redditMonitorNode = defineNode({
|
|
|
133
135
|
}
|
|
134
136
|
// Sort by recency
|
|
135
137
|
allPosts.sort((a, b) => new Date(b.postedAt).getTime() - new Date(a.postedAt).getTime());
|
|
136
|
-
// Optional: send notification if service available
|
|
137
|
-
if (context.services?.notifications && allPosts.length > 0) {
|
|
138
|
-
await context.services.notifications.send({
|
|
139
|
-
userId: context.userId,
|
|
140
|
-
title: 'Reddit Monitor Complete',
|
|
141
|
-
message: `Found ${allPosts.length} Reddit posts`,
|
|
142
|
-
data: { posts: allPosts.slice(0, 5) },
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
138
|
return {
|
|
146
139
|
success: true,
|
|
147
140
|
output: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reddit-monitor.js","sourceRoot":"","sources":["../../../src/integrations/social/reddit-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"reddit-monitor.js","sourceRoot":"","sources":["../../../src/integrations/social/reddit-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAsDrD,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,6BAA6B;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7B,qCAAqC;IACrC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC7F,6BAA6B;IAC7B,MAAM,EAAE,CAAC,CAAC,IAAI,CAA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putSchema>;
|
|
|
158
158
|
/**
|
|
159
159
|
* Twitter Monitor Node
|
|
160
160
|
*
|
|
161
|
-
* Searches Twitter/X for posts matching keywords.
|
|
162
|
-
* Requires `context.
|
|
161
|
+
* Searches Twitter/X for posts matching keywords using TwitterAPI.io.
|
|
162
|
+
* Requires `context.credentials.twitter.twitterApiIoKey` to be provided.
|
|
163
163
|
*
|
|
164
164
|
* @example
|
|
165
165
|
* ```typescript
|
|
@@ -179,8 +179,25 @@ export declare const twitterMonitorNode: import("@jam-nodes/core").NodeDefinitio
|
|
|
179
179
|
lang?: string | undefined;
|
|
180
180
|
sinceDays?: number | undefined;
|
|
181
181
|
}, {
|
|
182
|
-
posts:
|
|
182
|
+
posts: {
|
|
183
|
+
url: string;
|
|
184
|
+
id: string;
|
|
185
|
+
platform: "twitter";
|
|
186
|
+
text: string;
|
|
187
|
+
authorName: string;
|
|
188
|
+
authorHandle: string;
|
|
189
|
+
authorUrl: string;
|
|
190
|
+
engagement: {
|
|
191
|
+
comments: number;
|
|
192
|
+
likes: number;
|
|
193
|
+
shares: number;
|
|
194
|
+
views: number;
|
|
195
|
+
};
|
|
196
|
+
postedAt: string;
|
|
197
|
+
authorFollowers: number;
|
|
198
|
+
}[];
|
|
183
199
|
totalFound: number;
|
|
184
200
|
hasMore: boolean;
|
|
201
|
+
cursor?: string | undefined;
|
|
185
202
|
}>;
|
|
186
203
|
//# sourceMappingURL=twitter-monitor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twitter-monitor.d.ts","sourceRoot":"","sources":["../../../src/integrations/social/twitter-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"twitter-monitor.d.ts","sourceRoot":"","sources":["../../../src/integrations/social/twitter-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,SAAS,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAMD,eAAO,MAAM,yBAAyB;IACpC,6BAA6B;;IAE7B,oCAAoC;;IAEpC,2BAA2B;;IAE3B,gCAAgC;;IAEhC,mCAAmC;;IAEnC,qCAAqC;;;;;;;;;;;;;;;;EAErC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBrC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AA+E9E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoF7B,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { defineNode } from '@jam-nodes/core';
|
|
3
|
+
import { fetchWithRetry } from '../../utils/http.js';
|
|
4
|
+
// =============================================================================
|
|
5
|
+
// Constants
|
|
6
|
+
// =============================================================================
|
|
7
|
+
const TWITTERAPI_BASE_URL = 'https://api.twitterapi.io';
|
|
3
8
|
// =============================================================================
|
|
4
9
|
// Schemas
|
|
5
10
|
// =============================================================================
|
|
@@ -65,14 +70,33 @@ function buildTwitterSearchQuery(keywords, options = {}) {
|
|
|
65
70
|
}
|
|
66
71
|
return query;
|
|
67
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Search Twitter using TwitterAPI.io
|
|
75
|
+
*/
|
|
76
|
+
async function searchTwitter(apiKey, query, queryType = 'Latest') {
|
|
77
|
+
const url = new URL(`${TWITTERAPI_BASE_URL}/twitter/tweet/advanced_search`);
|
|
78
|
+
url.searchParams.set('query', query);
|
|
79
|
+
url.searchParams.set('queryType', queryType);
|
|
80
|
+
const response = await fetchWithRetry(url.toString(), {
|
|
81
|
+
method: 'GET',
|
|
82
|
+
headers: {
|
|
83
|
+
'X-API-Key': apiKey,
|
|
84
|
+
},
|
|
85
|
+
}, { maxRetries: 3, backoffMs: 1000, timeoutMs: 30000 });
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
const errorText = await response.text();
|
|
88
|
+
throw new Error(`Twitter API error: ${response.status} - ${errorText}`);
|
|
89
|
+
}
|
|
90
|
+
return response.json();
|
|
91
|
+
}
|
|
68
92
|
// =============================================================================
|
|
69
93
|
// Node Definition
|
|
70
94
|
// =============================================================================
|
|
71
95
|
/**
|
|
72
96
|
* Twitter Monitor Node
|
|
73
97
|
*
|
|
74
|
-
* Searches Twitter/X for posts matching keywords.
|
|
75
|
-
* Requires `context.
|
|
98
|
+
* Searches Twitter/X for posts matching keywords using TwitterAPI.io.
|
|
99
|
+
* Requires `context.credentials.twitter.twitterApiIoKey` to be provided.
|
|
76
100
|
*
|
|
77
101
|
* @example
|
|
78
102
|
* ```typescript
|
|
@@ -103,11 +127,12 @@ export const twitterMonitorNode = defineNode({
|
|
|
103
127
|
error: 'No keywords provided for Twitter search',
|
|
104
128
|
};
|
|
105
129
|
}
|
|
106
|
-
//
|
|
107
|
-
|
|
130
|
+
// Check for API key (prefer TwitterAPI.io key)
|
|
131
|
+
const apiKey = context.credentials?.twitter?.twitterApiIoKey;
|
|
132
|
+
if (!apiKey) {
|
|
108
133
|
return {
|
|
109
134
|
success: false,
|
|
110
|
-
error: 'Twitter
|
|
135
|
+
error: 'Twitter API key not configured. Please provide context.credentials.twitter.twitterApiIoKey.',
|
|
111
136
|
};
|
|
112
137
|
}
|
|
113
138
|
// Build the search query
|
|
@@ -123,43 +148,34 @@ export const twitterMonitorNode = defineNode({
|
|
|
123
148
|
lang: input.lang,
|
|
124
149
|
});
|
|
125
150
|
// Search tweets
|
|
126
|
-
const
|
|
127
|
-
maxResults: input.maxResults || 50,
|
|
128
|
-
sinceDays: input.sinceDays,
|
|
129
|
-
});
|
|
151
|
+
const response = await searchTwitter(apiKey, query, 'Latest');
|
|
130
152
|
// Transform to unified format
|
|
131
|
-
const posts = tweets
|
|
153
|
+
const posts = (response.tweets || [])
|
|
154
|
+
.slice(0, input.maxResults || 50)
|
|
155
|
+
.map((tweet) => ({
|
|
132
156
|
id: tweet.id,
|
|
133
157
|
platform: 'twitter',
|
|
134
158
|
url: tweet.url,
|
|
135
159
|
text: tweet.text,
|
|
136
|
-
authorName: tweet.
|
|
137
|
-
authorHandle: tweet.
|
|
138
|
-
authorUrl: `https://twitter.com/${tweet.
|
|
139
|
-
authorFollowers: tweet.
|
|
160
|
+
authorName: tweet.author.name,
|
|
161
|
+
authorHandle: tweet.author.userName,
|
|
162
|
+
authorUrl: `https://twitter.com/${tweet.author.userName}`,
|
|
163
|
+
authorFollowers: tweet.author.followers,
|
|
140
164
|
engagement: {
|
|
141
|
-
likes: tweet.
|
|
142
|
-
comments: tweet.
|
|
143
|
-
shares: tweet.
|
|
144
|
-
views: tweet.
|
|
165
|
+
likes: tweet.likeCount,
|
|
166
|
+
comments: tweet.replyCount,
|
|
167
|
+
shares: tweet.retweetCount,
|
|
168
|
+
views: tweet.viewCount || 0,
|
|
145
169
|
},
|
|
146
170
|
postedAt: tweet.createdAt,
|
|
147
171
|
}));
|
|
148
|
-
// Optional: send notification if service available
|
|
149
|
-
if (context.services?.notifications && posts.length > 0) {
|
|
150
|
-
await context.services.notifications.send({
|
|
151
|
-
userId: context.userId,
|
|
152
|
-
title: 'Twitter Monitor Complete',
|
|
153
|
-
message: `Found ${posts.length} tweets`,
|
|
154
|
-
data: { posts: posts.slice(0, 5) },
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
172
|
return {
|
|
158
173
|
success: true,
|
|
159
174
|
output: {
|
|
160
175
|
posts,
|
|
161
176
|
totalFound: posts.length,
|
|
162
|
-
hasMore:
|
|
177
|
+
hasMore: response.has_next_page,
|
|
178
|
+
cursor: response.next_cursor || undefined,
|
|
163
179
|
},
|
|
164
180
|
};
|
|
165
181
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twitter-monitor.js","sourceRoot":"","sources":["../../../src/integrations/social/twitter-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"twitter-monitor.js","sourceRoot":"","sources":["../../../src/integrations/social/twitter-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AAkExD,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,6BAA6B;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7B,oCAAoC;IACpC,eAAe,EAAE,CAAC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;gBACnC,SAAS,EAAE,uBAAuB,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACzD,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS;gBACvC,UAAU,EAAE;oBACV,KAAK,EAAE,KAAK,CAAC,SAAS;oBACtB,QAAQ,EAAE,KAAK,CAAC,UAAU;oBAC1B,MAAM,EAAE,KAAK,CAAC,YAAY;oBAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,IAAI,CAAC;iBAC5B;gBACD,QAAQ,EAAE,KAAK,CAAC,SAAS;aAC1B,CAAC,CAAC,CAAC;YAEN,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE;oBACN,KAAK;oBACL,UAAU,EAAE,KAAK,CAAC,MAAM;oBACxB,OAAO,EAAE,QAAQ,CAAC,aAAa;oBAC/B,MAAM,EAAE,QAAQ,CAAC,WAAW,IAAI,SAAS;iBAC1C;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,2BAA2B;aAC5E,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/transform/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/transform/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;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;AA4C9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,UAAU;;;;;;;;;EAiCrB,CAAC"}
|
package/dist/transform/filter.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { defineNode } from '@jam-nodes/core';
|
|
3
|
+
import { resolvePath } from '../utils/resolve-path.js';
|
|
3
4
|
/**
|
|
4
5
|
* Filter operator schema
|
|
5
6
|
*/
|
|
@@ -34,24 +35,6 @@ export const FilterOutputSchema = z.object({
|
|
|
34
35
|
count: z.number(),
|
|
35
36
|
originalCount: z.number(),
|
|
36
37
|
});
|
|
37
|
-
/**
|
|
38
|
-
* Resolve a nested path on an object
|
|
39
|
-
*/
|
|
40
|
-
function resolvePath(obj, path) {
|
|
41
|
-
// Empty path means use the item itself
|
|
42
|
-
if (!path) {
|
|
43
|
-
return obj;
|
|
44
|
-
}
|
|
45
|
-
const parts = path.split('.');
|
|
46
|
-
let current = obj;
|
|
47
|
-
for (const part of parts) {
|
|
48
|
-
if (current === null || current === undefined) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
current = current[part];
|
|
52
|
-
}
|
|
53
|
-
return current;
|
|
54
|
-
}
|
|
55
38
|
/**
|
|
56
39
|
* Evaluate filter condition
|
|
57
40
|
*/
|
|
@@ -1 +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;
|
|
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;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;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,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AAIH;;GAEG;AACH,SAAS,cAAc,CACrB,QAAwB,EACxB,MAAe,EACf,QAAiB;I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
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/transform/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;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;AAExD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,OAAO;;;;;;EA6BlB,CAAC"}
|
package/dist/transform/map.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { defineNode } from '@jam-nodes/core';
|
|
3
|
+
import { resolvePath } from '../utils/resolve-path.js';
|
|
3
4
|
/**
|
|
4
5
|
* Input schema for map node
|
|
5
6
|
*/
|
|
@@ -16,32 +17,6 @@ export const MapOutputSchema = z.object({
|
|
|
16
17
|
results: z.array(z.unknown()),
|
|
17
18
|
count: z.number(),
|
|
18
19
|
});
|
|
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
20
|
/**
|
|
46
21
|
* Map node - extract a property from each item in an array.
|
|
47
22
|
*
|
|
@@ -1 +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;
|
|
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;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,kCAAkC;IAClC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3B,6DAA6D;IAC7D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;IAChC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,+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"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP utilities for making API calls with retry logic, timeouts, and rate limiting.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Sleep for a specified duration
|
|
6
|
+
*/
|
|
7
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for fetch with retry
|
|
10
|
+
*/
|
|
11
|
+
export interface FetchWithRetryOptions {
|
|
12
|
+
/** Maximum number of retry attempts (default: 3) */
|
|
13
|
+
maxRetries?: number;
|
|
14
|
+
/** Base delay in milliseconds for exponential backoff (default: 1000) */
|
|
15
|
+
backoffMs?: number;
|
|
16
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Error thrown when all retry attempts are exhausted
|
|
21
|
+
*/
|
|
22
|
+
export declare class FetchRetryError extends Error {
|
|
23
|
+
readonly status?: number | undefined;
|
|
24
|
+
readonly body?: string | undefined;
|
|
25
|
+
constructor(message: string, status?: number | undefined, body?: string | undefined);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fetch with automatic retry, timeout, and rate limit handling.
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Exponential backoff on rate limits (429) and server errors (5xx)
|
|
32
|
+
* - Configurable timeout
|
|
33
|
+
* - Respects Retry-After header
|
|
34
|
+
* - Does not retry on auth errors (401, 403) or client errors (4xx)
|
|
35
|
+
*
|
|
36
|
+
* @param url - URL to fetch
|
|
37
|
+
* @param options - Fetch options (same as native fetch)
|
|
38
|
+
* @param config - Retry and timeout configuration
|
|
39
|
+
* @returns Promise resolving to Response
|
|
40
|
+
* @throws FetchRetryError if all retries exhausted or non-retryable error
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const response = await fetchWithRetry(
|
|
45
|
+
* 'https://api.example.com/data',
|
|
46
|
+
* {
|
|
47
|
+
* method: 'POST',
|
|
48
|
+
* headers: { 'Authorization': 'Bearer token' },
|
|
49
|
+
* body: JSON.stringify({ key: 'value' })
|
|
50
|
+
* },
|
|
51
|
+
* { maxRetries: 3, timeoutMs: 30000 }
|
|
52
|
+
* );
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function fetchWithRetry(url: string, options?: RequestInit, config?: FetchWithRetryOptions): Promise<Response>;
|
|
56
|
+
/**
|
|
57
|
+
* Parse JSON response with error handling
|
|
58
|
+
*/
|
|
59
|
+
export declare function parseJsonResponse<T>(response: Response): Promise<T>;
|
|
60
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;aAGtB,MAAM,CAAC,EAAE,MAAM;aACf,IAAI,CAAC,EAAE,MAAM;gBAF7B,OAAO,EAAE,MAAM,EACC,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,IAAI,CAAC,EAAE,MAAM,YAAA;CAKhC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,MAAM,GAAE,qBAA0B,GACjC,OAAO,CAAC,QAAQ,CAAC,CA4FnB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAWzE"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP utilities for making API calls with retry logic, timeouts, and rate limiting.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Sleep for a specified duration
|
|
6
|
+
*/
|
|
7
|
+
export function sleep(ms) {
|
|
8
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when all retry attempts are exhausted
|
|
12
|
+
*/
|
|
13
|
+
export class FetchRetryError extends Error {
|
|
14
|
+
status;
|
|
15
|
+
body;
|
|
16
|
+
constructor(message, status, body) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.status = status;
|
|
19
|
+
this.body = body;
|
|
20
|
+
this.name = 'FetchRetryError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fetch with automatic retry, timeout, and rate limit handling.
|
|
25
|
+
*
|
|
26
|
+
* Features:
|
|
27
|
+
* - Exponential backoff on rate limits (429) and server errors (5xx)
|
|
28
|
+
* - Configurable timeout
|
|
29
|
+
* - Respects Retry-After header
|
|
30
|
+
* - Does not retry on auth errors (401, 403) or client errors (4xx)
|
|
31
|
+
*
|
|
32
|
+
* @param url - URL to fetch
|
|
33
|
+
* @param options - Fetch options (same as native fetch)
|
|
34
|
+
* @param config - Retry and timeout configuration
|
|
35
|
+
* @returns Promise resolving to Response
|
|
36
|
+
* @throws FetchRetryError if all retries exhausted or non-retryable error
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const response = await fetchWithRetry(
|
|
41
|
+
* 'https://api.example.com/data',
|
|
42
|
+
* {
|
|
43
|
+
* method: 'POST',
|
|
44
|
+
* headers: { 'Authorization': 'Bearer token' },
|
|
45
|
+
* body: JSON.stringify({ key: 'value' })
|
|
46
|
+
* },
|
|
47
|
+
* { maxRetries: 3, timeoutMs: 30000 }
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export async function fetchWithRetry(url, options = {}, config = {}) {
|
|
52
|
+
const { maxRetries = 3, backoffMs = 1000, timeoutMs = 30000 } = config;
|
|
53
|
+
let lastError = null;
|
|
54
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
55
|
+
const controller = new AbortController();
|
|
56
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
57
|
+
try {
|
|
58
|
+
const response = await fetch(url, {
|
|
59
|
+
...options,
|
|
60
|
+
signal: controller.signal,
|
|
61
|
+
});
|
|
62
|
+
clearTimeout(timeout);
|
|
63
|
+
// Don't retry on auth errors
|
|
64
|
+
if (response.status === 401 || response.status === 403) {
|
|
65
|
+
const errorText = await response.text();
|
|
66
|
+
throw new FetchRetryError(`Authentication error: ${response.status} ${response.statusText}`, response.status, errorText);
|
|
67
|
+
}
|
|
68
|
+
// Handle rate limiting
|
|
69
|
+
if (response.status === 429) {
|
|
70
|
+
const retryAfter = response.headers.get('retry-after');
|
|
71
|
+
const delayMs = retryAfter
|
|
72
|
+
? parseInt(retryAfter, 10) * 1000
|
|
73
|
+
: backoffMs * Math.pow(2, attempt);
|
|
74
|
+
if (attempt < maxRetries - 1) {
|
|
75
|
+
await sleep(delayMs);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
// All retries exhausted — throw instead of returning the 429 response
|
|
79
|
+
const errorText = await response.text();
|
|
80
|
+
throw new FetchRetryError(`Rate limit exceeded after ${maxRetries} attempts`, 429, errorText);
|
|
81
|
+
}
|
|
82
|
+
// Retry on server errors
|
|
83
|
+
if (response.status >= 500 && response.status < 600) {
|
|
84
|
+
if (attempt < maxRetries - 1) {
|
|
85
|
+
await sleep(backoffMs * Math.pow(2, attempt));
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const errorText = await response.text();
|
|
89
|
+
throw new FetchRetryError(`Server error: ${response.status} ${response.statusText}`, response.status, errorText);
|
|
90
|
+
}
|
|
91
|
+
// Return response for success or client errors (let caller handle)
|
|
92
|
+
return response;
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
clearTimeout(timeout);
|
|
96
|
+
// Don't retry abort errors (timeout) on last attempt
|
|
97
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
98
|
+
lastError = new FetchRetryError('Request timed out');
|
|
99
|
+
if (attempt < maxRetries - 1) {
|
|
100
|
+
await sleep(backoffMs * Math.pow(2, attempt));
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
throw lastError;
|
|
104
|
+
}
|
|
105
|
+
// Re-throw FetchRetryError (auth errors, etc.)
|
|
106
|
+
if (error instanceof FetchRetryError) {
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
// Network errors - retry
|
|
110
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
111
|
+
if (attempt < maxRetries - 1) {
|
|
112
|
+
await sleep(backoffMs * Math.pow(2, attempt));
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
throw lastError || new FetchRetryError('Max retries exceeded');
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Parse JSON response with error handling
|
|
121
|
+
*/
|
|
122
|
+
export async function parseJsonResponse(response) {
|
|
123
|
+
if (!response.ok) {
|
|
124
|
+
const errorText = await response.text();
|
|
125
|
+
throw new FetchRetryError(`HTTP error: ${response.status} ${response.statusText}`, response.status, errorText);
|
|
126
|
+
}
|
|
127
|
+
return response.json();
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAcD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAGtB;IACA;IAHlB,YACE,OAAe,EACC,MAAe,EACf,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,WAAM,GAAN,MAAM,CAAS;QACf,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAW,EACX,UAAuB,EAAE,EAC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
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,eAAe,GAEhB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared path resolution utility for transform nodes.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a dot-notation path string against an arbitrary object.
|
|
5
|
+
* This mirrors the same logic as `ExecutionContext.resolveNestedPath`,
|
|
6
|
+
* but operates on any object rather than the workflow variable store.
|
|
7
|
+
*
|
|
8
|
+
* Supported syntax:
|
|
9
|
+
* - Dot notation: "contact.email"
|
|
10
|
+
* - Keyed array access: "contacts[0].name"
|
|
11
|
+
* - Standalone array index: "[0].name" (when current value is an array)
|
|
12
|
+
* - Empty path returns the object itself
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* resolvePath({ a: { b: [1, 2] } }, 'a.b[1]') // → 2
|
|
16
|
+
* resolvePath([{ id: 1 }, { id: 2 }], '[0].id') // → 1
|
|
17
|
+
* resolvePath({ score: 42 }, '') // → { score: 42 }
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolvePath(obj: unknown, path: string): unknown;
|
|
20
|
+
//# sourceMappingURL=resolve-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-path.d.ts","sourceRoot":"","sources":["../../src/utils/resolve-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CA0C/D"}
|