naystack 1.8.17 → 1.8.19
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/auth/index.cjs.js +23 -14
- package/dist/auth/index.esm.js +23 -14
- package/dist/auth/instagram/index.cjs.js +23 -14
- package/dist/auth/instagram/index.esm.js +23 -14
- package/dist/auth/instagram/route.cjs.js +23 -14
- package/dist/auth/instagram/route.esm.js +23 -14
- package/dist/socials/index.cjs.js +38 -14
- package/dist/socials/index.d.mts +5 -2
- package/dist/socials/index.d.ts +5 -2
- package/dist/socials/index.esm.js +34 -14
- package/dist/socials/instagram/setters.cjs.js +32 -14
- package/dist/socials/instagram/setters.d.mts +23 -1
- package/dist/socials/instagram/setters.d.ts +23 -1
- package/dist/socials/instagram/setters.esm.js +31 -14
- package/dist/socials/instagram/utils.d.mts +25 -4
- package/dist/socials/instagram/utils.d.ts +25 -4
- package/dist/socials/meta/container.cjs.js +23 -14
- package/dist/socials/meta/container.d.mts +10 -1
- package/dist/socials/meta/container.d.ts +10 -1
- package/dist/socials/meta/container.esm.js +23 -14
- package/dist/socials/threads/setters.cjs.js +23 -14
- package/dist/socials/threads/setters.esm.js +23 -14
- package/dist/socials/threads/utils.d.mts +8 -4
- package/dist/socials/threads/utils.d.ts +8 -4
- package/package.json +1 -1
package/dist/auth/index.cjs.js
CHANGED
|
@@ -727,21 +727,30 @@ function createPublisher(platform) {
|
|
|
727
727
|
if (!containerID) return null;
|
|
728
728
|
return platform.publish(token, containerID);
|
|
729
729
|
},
|
|
730
|
-
/**
|
|
730
|
+
/**
|
|
731
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
732
|
+
* their ids in input order — or `null` if any failed.
|
|
733
|
+
*
|
|
734
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
735
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
736
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
737
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
738
|
+
* order depends on.
|
|
739
|
+
*/
|
|
731
740
|
createChildren: async (token, items, wait, retry) => {
|
|
732
|
-
const children =
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
return children;
|
|
741
|
+
const children = await Promise.all(
|
|
742
|
+
items.map(
|
|
743
|
+
(item) => createReady(
|
|
744
|
+
token,
|
|
745
|
+
{ ...item, is_carousel_item: true },
|
|
746
|
+
"carousel item",
|
|
747
|
+
wait,
|
|
748
|
+
retry
|
|
749
|
+
)
|
|
750
|
+
)
|
|
751
|
+
);
|
|
752
|
+
const created = children.filter((childID) => childID !== null);
|
|
753
|
+
return created.length === children.length ? created : null;
|
|
745
754
|
}
|
|
746
755
|
};
|
|
747
756
|
}
|
package/dist/auth/index.esm.js
CHANGED
|
@@ -685,21 +685,30 @@ function createPublisher(platform) {
|
|
|
685
685
|
if (!containerID) return null;
|
|
686
686
|
return platform.publish(token, containerID);
|
|
687
687
|
},
|
|
688
|
-
/**
|
|
688
|
+
/**
|
|
689
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
690
|
+
* their ids in input order — or `null` if any failed.
|
|
691
|
+
*
|
|
692
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
693
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
694
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
695
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
696
|
+
* order depends on.
|
|
697
|
+
*/
|
|
689
698
|
createChildren: async (token, items, wait, retry) => {
|
|
690
|
-
const children =
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
return children;
|
|
699
|
+
const children = await Promise.all(
|
|
700
|
+
items.map(
|
|
701
|
+
(item) => createReady(
|
|
702
|
+
token,
|
|
703
|
+
{ ...item, is_carousel_item: true },
|
|
704
|
+
"carousel item",
|
|
705
|
+
wait,
|
|
706
|
+
retry
|
|
707
|
+
)
|
|
708
|
+
)
|
|
709
|
+
);
|
|
710
|
+
const created = children.filter((childID) => childID !== null);
|
|
711
|
+
return created.length === children.length ? created : null;
|
|
703
712
|
}
|
|
704
713
|
};
|
|
705
714
|
}
|
|
@@ -250,21 +250,30 @@ function createPublisher(platform) {
|
|
|
250
250
|
if (!containerID) return null;
|
|
251
251
|
return platform.publish(token, containerID);
|
|
252
252
|
},
|
|
253
|
-
/**
|
|
253
|
+
/**
|
|
254
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
255
|
+
* their ids in input order — or `null` if any failed.
|
|
256
|
+
*
|
|
257
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
258
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
259
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
260
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
261
|
+
* order depends on.
|
|
262
|
+
*/
|
|
254
263
|
createChildren: async (token, items, wait, retry) => {
|
|
255
|
-
const children =
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
return children;
|
|
264
|
+
const children = await Promise.all(
|
|
265
|
+
items.map(
|
|
266
|
+
(item) => createReady(
|
|
267
|
+
token,
|
|
268
|
+
{ ...item, is_carousel_item: true },
|
|
269
|
+
"carousel item",
|
|
270
|
+
wait,
|
|
271
|
+
retry
|
|
272
|
+
)
|
|
273
|
+
)
|
|
274
|
+
);
|
|
275
|
+
const created = children.filter((childID) => childID !== null);
|
|
276
|
+
return created.length === children.length ? created : null;
|
|
268
277
|
}
|
|
269
278
|
};
|
|
270
279
|
}
|
|
@@ -222,21 +222,30 @@ function createPublisher(platform) {
|
|
|
222
222
|
if (!containerID) return null;
|
|
223
223
|
return platform.publish(token, containerID);
|
|
224
224
|
},
|
|
225
|
-
/**
|
|
225
|
+
/**
|
|
226
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
227
|
+
* their ids in input order — or `null` if any failed.
|
|
228
|
+
*
|
|
229
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
230
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
231
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
232
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
233
|
+
* order depends on.
|
|
234
|
+
*/
|
|
226
235
|
createChildren: async (token, items, wait, retry) => {
|
|
227
|
-
const children =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return children;
|
|
236
|
+
const children = await Promise.all(
|
|
237
|
+
items.map(
|
|
238
|
+
(item) => createReady(
|
|
239
|
+
token,
|
|
240
|
+
{ ...item, is_carousel_item: true },
|
|
241
|
+
"carousel item",
|
|
242
|
+
wait,
|
|
243
|
+
retry
|
|
244
|
+
)
|
|
245
|
+
)
|
|
246
|
+
);
|
|
247
|
+
const created = children.filter((childID) => childID !== null);
|
|
248
|
+
return created.length === children.length ? created : null;
|
|
240
249
|
}
|
|
241
250
|
};
|
|
242
251
|
}
|
|
@@ -239,21 +239,30 @@ function createPublisher(platform) {
|
|
|
239
239
|
if (!containerID) return null;
|
|
240
240
|
return platform.publish(token, containerID);
|
|
241
241
|
},
|
|
242
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
244
|
+
* their ids in input order — or `null` if any failed.
|
|
245
|
+
*
|
|
246
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
247
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
248
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
249
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
250
|
+
* order depends on.
|
|
251
|
+
*/
|
|
243
252
|
createChildren: async (token, items, wait, retry) => {
|
|
244
|
-
const children =
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
return children;
|
|
253
|
+
const children = await Promise.all(
|
|
254
|
+
items.map(
|
|
255
|
+
(item) => createReady(
|
|
256
|
+
token,
|
|
257
|
+
{ ...item, is_carousel_item: true },
|
|
258
|
+
"carousel item",
|
|
259
|
+
wait,
|
|
260
|
+
retry
|
|
261
|
+
)
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
const created = children.filter((childID) => childID !== null);
|
|
265
|
+
return created.length === children.length ? created : null;
|
|
257
266
|
}
|
|
258
267
|
};
|
|
259
268
|
}
|
|
@@ -215,21 +215,30 @@ function createPublisher(platform) {
|
|
|
215
215
|
if (!containerID) return null;
|
|
216
216
|
return platform.publish(token, containerID);
|
|
217
217
|
},
|
|
218
|
-
/**
|
|
218
|
+
/**
|
|
219
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
220
|
+
* their ids in input order — or `null` if any failed.
|
|
221
|
+
*
|
|
222
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
223
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
224
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
225
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
226
|
+
* order depends on.
|
|
227
|
+
*/
|
|
219
228
|
createChildren: async (token, items, wait, retry) => {
|
|
220
|
-
const children =
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return children;
|
|
229
|
+
const children = await Promise.all(
|
|
230
|
+
items.map(
|
|
231
|
+
(item) => createReady(
|
|
232
|
+
token,
|
|
233
|
+
{ ...item, is_carousel_item: true },
|
|
234
|
+
"carousel item",
|
|
235
|
+
wait,
|
|
236
|
+
retry
|
|
237
|
+
)
|
|
238
|
+
)
|
|
239
|
+
);
|
|
240
|
+
const created = children.filter((childID) => childID !== null);
|
|
241
|
+
return created.length === children.length ? created : null;
|
|
233
242
|
}
|
|
234
243
|
};
|
|
235
244
|
}
|
|
@@ -29,12 +29,16 @@ __export(socials_exports, {
|
|
|
29
29
|
getInstagramConversationByUser: () => getInstagramConversationByUser,
|
|
30
30
|
getInstagramConversations: () => getInstagramConversations,
|
|
31
31
|
getInstagramConversationsByUser: () => getInstagramConversationsByUser,
|
|
32
|
+
getInstagramData: () => getInstagramData,
|
|
32
33
|
getInstagramMedia: () => getInstagramMedia,
|
|
33
34
|
getInstagramMessage: () => getInstagramMessage,
|
|
34
35
|
getInstagramUser: () => getInstagramUser,
|
|
35
36
|
getThread: () => getThread,
|
|
36
37
|
getThreads: () => getThreads,
|
|
38
|
+
getThreadsData: () => getThreadsData,
|
|
37
39
|
getThreadsReplies: () => getThreadsReplies,
|
|
40
|
+
readGraphID: () => readGraphID,
|
|
41
|
+
replyToInstagramComment: () => replyToInstagramComment,
|
|
38
42
|
sendInstagramMessage: () => sendInstagramMessage,
|
|
39
43
|
setupInstagramWebhook: () => setupInstagramWebhook,
|
|
40
44
|
setupThreadsWebhook: () => setupThreadsWebhook
|
|
@@ -231,21 +235,30 @@ function createPublisher(platform) {
|
|
|
231
235
|
if (!containerID) return null;
|
|
232
236
|
return platform.publish(token, containerID);
|
|
233
237
|
},
|
|
234
|
-
/**
|
|
238
|
+
/**
|
|
239
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
240
|
+
* their ids in input order — or `null` if any failed.
|
|
241
|
+
*
|
|
242
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
243
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
244
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
245
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
246
|
+
* order depends on.
|
|
247
|
+
*/
|
|
235
248
|
createChildren: async (token, items, wait, retry) => {
|
|
236
|
-
const children =
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
return children;
|
|
249
|
+
const children = await Promise.all(
|
|
250
|
+
items.map(
|
|
251
|
+
(item) => createReady(
|
|
252
|
+
token,
|
|
253
|
+
{ ...item, is_carousel_item: true },
|
|
254
|
+
"carousel item",
|
|
255
|
+
wait,
|
|
256
|
+
retry
|
|
257
|
+
)
|
|
258
|
+
)
|
|
259
|
+
);
|
|
260
|
+
const created = children.filter((childID) => childID !== null);
|
|
261
|
+
return created.length === children.length ? created : null;
|
|
249
262
|
}
|
|
250
263
|
};
|
|
251
264
|
}
|
|
@@ -352,6 +365,13 @@ var createInstagramPost = async (token, input) => {
|
|
|
352
365
|
input.retry
|
|
353
366
|
);
|
|
354
367
|
};
|
|
368
|
+
var replyToInstagramComment = async (token, commentID, text) => readGraphID(
|
|
369
|
+
"Instagram comment reply",
|
|
370
|
+
await getInstagramData(token, `${commentID}/replies`, {
|
|
371
|
+
params: { message: text },
|
|
372
|
+
method: "POST"
|
|
373
|
+
})
|
|
374
|
+
);
|
|
355
375
|
var sendInstagramMessage = (token, to, text) => {
|
|
356
376
|
return getInstagramData(token, "me/messages", {
|
|
357
377
|
body: {
|
|
@@ -511,12 +531,16 @@ var setupThreadsWebhook = (options) => {
|
|
|
511
531
|
getInstagramConversationByUser,
|
|
512
532
|
getInstagramConversations,
|
|
513
533
|
getInstagramConversationsByUser,
|
|
534
|
+
getInstagramData,
|
|
514
535
|
getInstagramMedia,
|
|
515
536
|
getInstagramMessage,
|
|
516
537
|
getInstagramUser,
|
|
517
538
|
getThread,
|
|
518
539
|
getThreads,
|
|
540
|
+
getThreadsData,
|
|
519
541
|
getThreadsReplies,
|
|
542
|
+
readGraphID,
|
|
543
|
+
replyToInstagramComment,
|
|
520
544
|
sendInstagramMessage,
|
|
521
545
|
setupInstagramWebhook,
|
|
522
546
|
setupThreadsWebhook
|
package/dist/socials/index.d.mts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { canPublishToInstagram, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramConversationsByUser, getInstagramMedia, getInstagramMessage, getInstagramUser } from './instagram/getters.mjs';
|
|
2
|
-
export { createInstagramPost, sendInstagramMessage } from './instagram/setters.mjs';
|
|
2
|
+
export { createInstagramPost, replyToInstagramComment, sendInstagramMessage } from './instagram/setters.mjs';
|
|
3
3
|
export { InstagramConversation, InstagramMedia, InstagramMessage, InstagramPostInput, InstagramPostMedia, InstagramUser } from './instagram/types.mjs';
|
|
4
|
+
export { getInstagramData } from './instagram/utils.mjs';
|
|
4
5
|
export { setupInstagramWebhook } from './instagram/webhook.mjs';
|
|
5
6
|
export { RetryOptions, WaitForContainerOptions } from './meta/container.mjs';
|
|
6
|
-
export {
|
|
7
|
+
export { GraphClient, GraphRequestOptions, readGraphID } from './meta/request.mjs';
|
|
8
|
+
export { GraphError, GraphParams, MetaMediaType } from './meta/types.mjs';
|
|
7
9
|
export { getThread, getThreads, getThreadsReplies } from './threads/getters.mjs';
|
|
8
10
|
export { createThread, createThreadsPost } from './threads/setters.mjs';
|
|
11
|
+
export { getThreadsData } from './threads/utils.mjs';
|
|
9
12
|
export { ThreadsPost, ThreadsPostInput, ThreadsPostMedia } from './threads/types.mjs';
|
|
10
13
|
export { setupThreadsWebhook } from './threads/webhook.mjs';
|
|
11
14
|
import 'next/server';
|
package/dist/socials/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { canPublishToInstagram, getInstagramConversation, getInstagramConversationByUser, getInstagramConversations, getInstagramConversationsByUser, getInstagramMedia, getInstagramMessage, getInstagramUser } from './instagram/getters.js';
|
|
2
|
-
export { createInstagramPost, sendInstagramMessage } from './instagram/setters.js';
|
|
2
|
+
export { createInstagramPost, replyToInstagramComment, sendInstagramMessage } from './instagram/setters.js';
|
|
3
3
|
export { InstagramConversation, InstagramMedia, InstagramMessage, InstagramPostInput, InstagramPostMedia, InstagramUser } from './instagram/types.js';
|
|
4
|
+
export { getInstagramData } from './instagram/utils.js';
|
|
4
5
|
export { setupInstagramWebhook } from './instagram/webhook.js';
|
|
5
6
|
export { RetryOptions, WaitForContainerOptions } from './meta/container.js';
|
|
6
|
-
export {
|
|
7
|
+
export { GraphClient, GraphRequestOptions, readGraphID } from './meta/request.js';
|
|
8
|
+
export { GraphError, GraphParams, MetaMediaType } from './meta/types.js';
|
|
7
9
|
export { getThread, getThreads, getThreadsReplies } from './threads/getters.js';
|
|
8
10
|
export { createThread, createThreadsPost } from './threads/setters.js';
|
|
11
|
+
export { getThreadsData } from './threads/utils.js';
|
|
9
12
|
export { ThreadsPost, ThreadsPostInput, ThreadsPostMedia } from './threads/types.js';
|
|
10
13
|
export { setupThreadsWebhook } from './threads/webhook.js';
|
|
11
14
|
import 'next/server';
|
|
@@ -188,21 +188,30 @@ function createPublisher(platform) {
|
|
|
188
188
|
if (!containerID) return null;
|
|
189
189
|
return platform.publish(token, containerID);
|
|
190
190
|
},
|
|
191
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
193
|
+
* their ids in input order — or `null` if any failed.
|
|
194
|
+
*
|
|
195
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
196
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
197
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
198
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
199
|
+
* order depends on.
|
|
200
|
+
*/
|
|
192
201
|
createChildren: async (token, items, wait, retry) => {
|
|
193
|
-
const children =
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return children;
|
|
202
|
+
const children = await Promise.all(
|
|
203
|
+
items.map(
|
|
204
|
+
(item) => createReady(
|
|
205
|
+
token,
|
|
206
|
+
{ ...item, is_carousel_item: true },
|
|
207
|
+
"carousel item",
|
|
208
|
+
wait,
|
|
209
|
+
retry
|
|
210
|
+
)
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
const created = children.filter((childID) => childID !== null);
|
|
214
|
+
return created.length === children.length ? created : null;
|
|
206
215
|
}
|
|
207
216
|
};
|
|
208
217
|
}
|
|
@@ -309,6 +318,13 @@ var createInstagramPost = async (token, input) => {
|
|
|
309
318
|
input.retry
|
|
310
319
|
);
|
|
311
320
|
};
|
|
321
|
+
var replyToInstagramComment = async (token, commentID, text) => readGraphID(
|
|
322
|
+
"Instagram comment reply",
|
|
323
|
+
await getInstagramData(token, `${commentID}/replies`, {
|
|
324
|
+
params: { message: text },
|
|
325
|
+
method: "POST"
|
|
326
|
+
})
|
|
327
|
+
);
|
|
312
328
|
var sendInstagramMessage = (token, to, text) => {
|
|
313
329
|
return getInstagramData(token, "me/messages", {
|
|
314
330
|
body: {
|
|
@@ -467,12 +483,16 @@ export {
|
|
|
467
483
|
getInstagramConversationByUser,
|
|
468
484
|
getInstagramConversations,
|
|
469
485
|
getInstagramConversationsByUser,
|
|
486
|
+
getInstagramData,
|
|
470
487
|
getInstagramMedia,
|
|
471
488
|
getInstagramMessage,
|
|
472
489
|
getInstagramUser,
|
|
473
490
|
getThread,
|
|
474
491
|
getThreads,
|
|
492
|
+
getThreadsData,
|
|
475
493
|
getThreadsReplies,
|
|
494
|
+
readGraphID,
|
|
495
|
+
replyToInstagramComment,
|
|
476
496
|
sendInstagramMessage,
|
|
477
497
|
setupInstagramWebhook,
|
|
478
498
|
setupThreadsWebhook
|
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var setters_exports = {};
|
|
22
22
|
__export(setters_exports, {
|
|
23
23
|
createInstagramPost: () => createInstagramPost,
|
|
24
|
+
replyToInstagramComment: () => replyToInstagramComment,
|
|
24
25
|
sendInstagramMessage: () => sendInstagramMessage
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(setters_exports);
|
|
@@ -128,21 +129,30 @@ function createPublisher(platform) {
|
|
|
128
129
|
if (!containerID) return null;
|
|
129
130
|
return platform.publish(token, containerID);
|
|
130
131
|
},
|
|
131
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
134
|
+
* their ids in input order — or `null` if any failed.
|
|
135
|
+
*
|
|
136
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
137
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
138
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
139
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
140
|
+
* order depends on.
|
|
141
|
+
*/
|
|
132
142
|
createChildren: async (token, items, wait, retry) => {
|
|
133
|
-
const children =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return children;
|
|
143
|
+
const children = await Promise.all(
|
|
144
|
+
items.map(
|
|
145
|
+
(item) => createReady(
|
|
146
|
+
token,
|
|
147
|
+
{ ...item, is_carousel_item: true },
|
|
148
|
+
"carousel item",
|
|
149
|
+
wait,
|
|
150
|
+
retry
|
|
151
|
+
)
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
const created = children.filter((childID) => childID !== null);
|
|
155
|
+
return created.length === children.length ? created : null;
|
|
146
156
|
}
|
|
147
157
|
};
|
|
148
158
|
}
|
|
@@ -242,6 +252,13 @@ var createInstagramPost = async (token, input) => {
|
|
|
242
252
|
input.retry
|
|
243
253
|
);
|
|
244
254
|
};
|
|
255
|
+
var replyToInstagramComment = async (token, commentID, text) => readGraphID(
|
|
256
|
+
"Instagram comment reply",
|
|
257
|
+
await getInstagramData(token, `${commentID}/replies`, {
|
|
258
|
+
params: { message: text },
|
|
259
|
+
method: "POST"
|
|
260
|
+
})
|
|
261
|
+
);
|
|
245
262
|
var sendInstagramMessage = (token, to, text) => {
|
|
246
263
|
return getInstagramData(token, "me/messages", {
|
|
247
264
|
body: {
|
|
@@ -255,5 +272,6 @@ var sendInstagramMessage = (token, to, text) => {
|
|
|
255
272
|
// Annotate the CommonJS export names for ESM import in node:
|
|
256
273
|
0 && (module.exports = {
|
|
257
274
|
createInstagramPost,
|
|
275
|
+
replyToInstagramComment,
|
|
258
276
|
sendInstagramMessage
|
|
259
277
|
});
|
|
@@ -40,6 +40,28 @@ import '../meta/container.mjs';
|
|
|
40
40
|
* @category Socials
|
|
41
41
|
*/
|
|
42
42
|
declare const createInstagramPost: (token: string, input: InstagramPostInput) => Promise<string | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Replies to a comment on one of your Instagram posts, as your account.
|
|
45
|
+
*
|
|
46
|
+
* Needs the `instagram_business_manage_comments` scope. The reply lands in the
|
|
47
|
+
* comment's own thread — Instagram nests one level, so replying to a reply
|
|
48
|
+
* attaches to the same top-level comment.
|
|
49
|
+
*
|
|
50
|
+
* @param token - Instagram access token.
|
|
51
|
+
* @param commentID - The comment being replied to.
|
|
52
|
+
* @param text - Reply text.
|
|
53
|
+
* @returns Promise of the new comment's id, or `null` if the call failed (the API's error is logged).
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { replyToInstagramComment } from "naystack/socials";
|
|
58
|
+
*
|
|
59
|
+
* await replyToInstagramComment(accessToken, commentId, "Applications are open in our bio!");
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @category Socials
|
|
63
|
+
*/
|
|
64
|
+
declare const replyToInstagramComment: (token: string, commentID: string, text: string) => Promise<string | null>;
|
|
43
65
|
/**
|
|
44
66
|
* Sends a text message to an Instagram user via the Instagram Messaging API.
|
|
45
67
|
*
|
|
@@ -63,4 +85,4 @@ declare const sendInstagramMessage: (token: string, to: string, text: string) =>
|
|
|
63
85
|
message_id?: string;
|
|
64
86
|
} & GraphError) | null>;
|
|
65
87
|
|
|
66
|
-
export { createInstagramPost, sendInstagramMessage };
|
|
88
|
+
export { createInstagramPost, replyToInstagramComment, sendInstagramMessage };
|
|
@@ -40,6 +40,28 @@ import '../meta/container.js';
|
|
|
40
40
|
* @category Socials
|
|
41
41
|
*/
|
|
42
42
|
declare const createInstagramPost: (token: string, input: InstagramPostInput) => Promise<string | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Replies to a comment on one of your Instagram posts, as your account.
|
|
45
|
+
*
|
|
46
|
+
* Needs the `instagram_business_manage_comments` scope. The reply lands in the
|
|
47
|
+
* comment's own thread — Instagram nests one level, so replying to a reply
|
|
48
|
+
* attaches to the same top-level comment.
|
|
49
|
+
*
|
|
50
|
+
* @param token - Instagram access token.
|
|
51
|
+
* @param commentID - The comment being replied to.
|
|
52
|
+
* @param text - Reply text.
|
|
53
|
+
* @returns Promise of the new comment's id, or `null` if the call failed (the API's error is logged).
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { replyToInstagramComment } from "naystack/socials";
|
|
58
|
+
*
|
|
59
|
+
* await replyToInstagramComment(accessToken, commentId, "Applications are open in our bio!");
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @category Socials
|
|
63
|
+
*/
|
|
64
|
+
declare const replyToInstagramComment: (token: string, commentID: string, text: string) => Promise<string | null>;
|
|
43
65
|
/**
|
|
44
66
|
* Sends a text message to an Instagram user via the Instagram Messaging API.
|
|
45
67
|
*
|
|
@@ -63,4 +85,4 @@ declare const sendInstagramMessage: (token: string, to: string, text: string) =>
|
|
|
63
85
|
message_id?: string;
|
|
64
86
|
} & GraphError) | null>;
|
|
65
87
|
|
|
66
|
-
export { createInstagramPost, sendInstagramMessage };
|
|
88
|
+
export { createInstagramPost, replyToInstagramComment, sendInstagramMessage };
|
|
@@ -101,21 +101,30 @@ function createPublisher(platform) {
|
|
|
101
101
|
if (!containerID) return null;
|
|
102
102
|
return platform.publish(token, containerID);
|
|
103
103
|
},
|
|
104
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
106
|
+
* their ids in input order — or `null` if any failed.
|
|
107
|
+
*
|
|
108
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
109
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
110
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
111
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
112
|
+
* order depends on.
|
|
113
|
+
*/
|
|
105
114
|
createChildren: async (token, items, wait, retry) => {
|
|
106
|
-
const children =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return children;
|
|
115
|
+
const children = await Promise.all(
|
|
116
|
+
items.map(
|
|
117
|
+
(item) => createReady(
|
|
118
|
+
token,
|
|
119
|
+
{ ...item, is_carousel_item: true },
|
|
120
|
+
"carousel item",
|
|
121
|
+
wait,
|
|
122
|
+
retry
|
|
123
|
+
)
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
const created = children.filter((childID) => childID !== null);
|
|
127
|
+
return created.length === children.length ? created : null;
|
|
119
128
|
}
|
|
120
129
|
};
|
|
121
130
|
}
|
|
@@ -215,6 +224,13 @@ var createInstagramPost = async (token, input) => {
|
|
|
215
224
|
input.retry
|
|
216
225
|
);
|
|
217
226
|
};
|
|
227
|
+
var replyToInstagramComment = async (token, commentID, text) => readGraphID(
|
|
228
|
+
"Instagram comment reply",
|
|
229
|
+
await getInstagramData(token, `${commentID}/replies`, {
|
|
230
|
+
params: { message: text },
|
|
231
|
+
method: "POST"
|
|
232
|
+
})
|
|
233
|
+
);
|
|
218
234
|
var sendInstagramMessage = (token, to, text) => {
|
|
219
235
|
return getInstagramData(token, "me/messages", {
|
|
220
236
|
body: {
|
|
@@ -227,5 +243,6 @@ var sendInstagramMessage = (token, to, text) => {
|
|
|
227
243
|
};
|
|
228
244
|
export {
|
|
229
245
|
createInstagramPost,
|
|
246
|
+
replyToInstagramComment,
|
|
230
247
|
sendInstagramMessage
|
|
231
248
|
};
|
|
@@ -2,12 +2,33 @@ import { GraphError } from '../meta/types.mjs';
|
|
|
2
2
|
import { GraphRequestOptions } from '../meta/request.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the Instagram Graph API directly — the escape hatch for endpoints this
|
|
6
|
+
* module doesn't wrap. Despite the name it does POSTs too: Graph mutations take
|
|
7
|
+
* their arguments as query `params`, so pass `method: "POST"` with `params`.
|
|
8
|
+
*
|
|
9
|
+
* The base URL and API version stay pinned here, so callers never hardcode either.
|
|
10
|
+
* Pair it with {@link readGraphID} to unwrap an `id` and log the API's own error.
|
|
6
11
|
*
|
|
7
12
|
* @param token - Instagram access token.
|
|
8
|
-
* @param path - API path.
|
|
9
|
-
* @param options - `params` (query), `method`, `body`.
|
|
10
|
-
* @returns Promise of `(T & GraphError) | null`.
|
|
13
|
+
* @param path - API path, relative to the versioned root (e.g. `"me/media"`).
|
|
14
|
+
* @param options - See {@link GraphRequestOptions} — `params` (query), `method`, `body`.
|
|
15
|
+
* @returns Promise of `(T & GraphError) | null` — check `.error` before reading `T`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { getInstagramData, readGraphID } from "naystack/socials";
|
|
20
|
+
*
|
|
21
|
+
* // An endpoint with no dedicated helper.
|
|
22
|
+
* const id = readGraphID(
|
|
23
|
+
* "Instagram comment reply",
|
|
24
|
+
* await getInstagramData<{ id: string }>(token, `${commentID}/replies`, {
|
|
25
|
+
* params: { message: "thanks!" },
|
|
26
|
+
* method: "POST",
|
|
27
|
+
* }),
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @category Socials
|
|
11
32
|
*/
|
|
12
33
|
declare const getInstagramData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
13
34
|
|
|
@@ -2,12 +2,33 @@ import { GraphError } from '../meta/types.js';
|
|
|
2
2
|
import { GraphRequestOptions } from '../meta/request.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the Instagram Graph API directly — the escape hatch for endpoints this
|
|
6
|
+
* module doesn't wrap. Despite the name it does POSTs too: Graph mutations take
|
|
7
|
+
* their arguments as query `params`, so pass `method: "POST"` with `params`.
|
|
8
|
+
*
|
|
9
|
+
* The base URL and API version stay pinned here, so callers never hardcode either.
|
|
10
|
+
* Pair it with {@link readGraphID} to unwrap an `id` and log the API's own error.
|
|
6
11
|
*
|
|
7
12
|
* @param token - Instagram access token.
|
|
8
|
-
* @param path - API path.
|
|
9
|
-
* @param options - `params` (query), `method`, `body`.
|
|
10
|
-
* @returns Promise of `(T & GraphError) | null`.
|
|
13
|
+
* @param path - API path, relative to the versioned root (e.g. `"me/media"`).
|
|
14
|
+
* @param options - See {@link GraphRequestOptions} — `params` (query), `method`, `body`.
|
|
15
|
+
* @returns Promise of `(T & GraphError) | null` — check `.error` before reading `T`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { getInstagramData, readGraphID } from "naystack/socials";
|
|
20
|
+
*
|
|
21
|
+
* // An endpoint with no dedicated helper.
|
|
22
|
+
* const id = readGraphID(
|
|
23
|
+
* "Instagram comment reply",
|
|
24
|
+
* await getInstagramData<{ id: string }>(token, `${commentID}/replies`, {
|
|
25
|
+
* params: { message: "thanks!" },
|
|
26
|
+
* method: "POST",
|
|
27
|
+
* }),
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @category Socials
|
|
11
32
|
*/
|
|
12
33
|
declare const getInstagramData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
13
34
|
|
|
@@ -80,21 +80,30 @@ function createPublisher(platform) {
|
|
|
80
80
|
if (!containerID) return null;
|
|
81
81
|
return platform.publish(token, containerID);
|
|
82
82
|
},
|
|
83
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
85
|
+
* their ids in input order — or `null` if any failed.
|
|
86
|
+
*
|
|
87
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
88
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
89
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
90
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
91
|
+
* order depends on.
|
|
92
|
+
*/
|
|
84
93
|
createChildren: async (token, items, wait, retry) => {
|
|
85
|
-
const children =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return children;
|
|
94
|
+
const children = await Promise.all(
|
|
95
|
+
items.map(
|
|
96
|
+
(item) => createReady(
|
|
97
|
+
token,
|
|
98
|
+
{ ...item, is_carousel_item: true },
|
|
99
|
+
"carousel item",
|
|
100
|
+
wait,
|
|
101
|
+
retry
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
);
|
|
105
|
+
const created = children.filter((childID) => childID !== null);
|
|
106
|
+
return created.length === children.length ? created : null;
|
|
98
107
|
}
|
|
99
108
|
};
|
|
100
109
|
}
|
|
@@ -49,7 +49,16 @@ declare function createPublisher(platform: {
|
|
|
49
49
|
}): {
|
|
50
50
|
/** Creates a container, waits for it to finish processing, then publishes it. */
|
|
51
51
|
publish: (token: string, params: GraphParams, wait?: WaitForContainerOptions, retry?: RetryOptions) => Promise<string | null>;
|
|
52
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
54
|
+
* their ids in input order — or `null` if any failed.
|
|
55
|
+
*
|
|
56
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
57
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
58
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
59
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
60
|
+
* order depends on.
|
|
61
|
+
*/
|
|
53
62
|
createChildren: (token: string, items: GraphParams[], wait?: WaitForContainerOptions, retry?: RetryOptions) => Promise<string[] | null>;
|
|
54
63
|
};
|
|
55
64
|
|
|
@@ -49,7 +49,16 @@ declare function createPublisher(platform: {
|
|
|
49
49
|
}): {
|
|
50
50
|
/** Creates a container, waits for it to finish processing, then publishes it. */
|
|
51
51
|
publish: (token: string, params: GraphParams, wait?: WaitForContainerOptions, retry?: RetryOptions) => Promise<string | null>;
|
|
52
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
54
|
+
* their ids in input order — or `null` if any failed.
|
|
55
|
+
*
|
|
56
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
57
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
58
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
59
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
60
|
+
* order depends on.
|
|
61
|
+
*/
|
|
53
62
|
createChildren: (token: string, items: GraphParams[], wait?: WaitForContainerOptions, retry?: RetryOptions) => Promise<string[] | null>;
|
|
54
63
|
};
|
|
55
64
|
|
|
@@ -56,21 +56,30 @@ function createPublisher(platform) {
|
|
|
56
56
|
if (!containerID) return null;
|
|
57
57
|
return platform.publish(token, containerID);
|
|
58
58
|
},
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
61
|
+
* their ids in input order — or `null` if any failed.
|
|
62
|
+
*
|
|
63
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
64
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
65
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
66
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
67
|
+
* order depends on.
|
|
68
|
+
*/
|
|
60
69
|
createChildren: async (token, items, wait, retry) => {
|
|
61
|
-
const children =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return children;
|
|
70
|
+
const children = await Promise.all(
|
|
71
|
+
items.map(
|
|
72
|
+
(item) => createReady(
|
|
73
|
+
token,
|
|
74
|
+
{ ...item, is_carousel_item: true },
|
|
75
|
+
"carousel item",
|
|
76
|
+
wait,
|
|
77
|
+
retry
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
const created = children.filter((childID) => childID !== null);
|
|
82
|
+
return created.length === children.length ? created : null;
|
|
74
83
|
}
|
|
75
84
|
};
|
|
76
85
|
}
|
|
@@ -83,21 +83,30 @@ function createPublisher(platform) {
|
|
|
83
83
|
if (!containerID) return null;
|
|
84
84
|
return platform.publish(token, containerID);
|
|
85
85
|
},
|
|
86
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
88
|
+
* their ids in input order — or `null` if any failed.
|
|
89
|
+
*
|
|
90
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
91
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
92
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
93
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
94
|
+
* order depends on.
|
|
95
|
+
*/
|
|
87
96
|
createChildren: async (token, items, wait, retry) => {
|
|
88
|
-
const children =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return children;
|
|
97
|
+
const children = await Promise.all(
|
|
98
|
+
items.map(
|
|
99
|
+
(item) => createReady(
|
|
100
|
+
token,
|
|
101
|
+
{ ...item, is_carousel_item: true },
|
|
102
|
+
"carousel item",
|
|
103
|
+
wait,
|
|
104
|
+
retry
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
);
|
|
108
|
+
const created = children.filter((childID) => childID !== null);
|
|
109
|
+
return created.length === children.length ? created : null;
|
|
101
110
|
}
|
|
102
111
|
};
|
|
103
112
|
}
|
|
@@ -56,21 +56,30 @@ function createPublisher(platform) {
|
|
|
56
56
|
if (!containerID) return null;
|
|
57
57
|
return platform.publish(token, containerID);
|
|
58
58
|
},
|
|
59
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Creates and awaits every carousel child **in parallel**, resolving to
|
|
61
|
+
* their ids in input order — or `null` if any failed.
|
|
62
|
+
*
|
|
63
|
+
* Parallel because each child is an independent create-then-poll and Meta
|
|
64
|
+
* spends ~5s accepting a single container, so ten sequential children cost
|
|
65
|
+
* ~50s of mostly waiting — past what a serverless caller can fit in its
|
|
66
|
+
* timeout. `Promise.all` preserves input order, which the carousel's slide
|
|
67
|
+
* order depends on.
|
|
68
|
+
*/
|
|
60
69
|
createChildren: async (token, items, wait, retry) => {
|
|
61
|
-
const children =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return children;
|
|
70
|
+
const children = await Promise.all(
|
|
71
|
+
items.map(
|
|
72
|
+
(item) => createReady(
|
|
73
|
+
token,
|
|
74
|
+
{ ...item, is_carousel_item: true },
|
|
75
|
+
"carousel item",
|
|
76
|
+
wait,
|
|
77
|
+
retry
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
const created = children.filter((childID) => childID !== null);
|
|
82
|
+
return created.length === children.length ? created : null;
|
|
74
83
|
}
|
|
75
84
|
};
|
|
76
85
|
}
|
|
@@ -2,12 +2,16 @@ import { GraphError } from '../meta/types.mjs';
|
|
|
2
2
|
import { GraphRequestOptions } from '../meta/request.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the Threads Graph API directly — the escape hatch for endpoints this
|
|
6
|
+
* module doesn't wrap. The Instagram counterpart is {@link getInstagramData};
|
|
7
|
+
* see it for the POST-via-`params` convention and an example.
|
|
6
8
|
*
|
|
7
9
|
* @param token - Threads access token.
|
|
8
|
-
* @param path - API path.
|
|
9
|
-
* @param options - `params` (query), `method`, `body`.
|
|
10
|
-
* @returns Promise of `(T & GraphError) | null`.
|
|
10
|
+
* @param path - API path, relative to the versioned root (e.g. `"me/threads"`).
|
|
11
|
+
* @param options - See {@link GraphRequestOptions} — `params` (query), `method`, `body`.
|
|
12
|
+
* @returns Promise of `(T & GraphError) | null` — check `.error` before reading `T`.
|
|
13
|
+
*
|
|
14
|
+
* @category Socials
|
|
11
15
|
*/
|
|
12
16
|
declare const getThreadsData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
13
17
|
|
|
@@ -2,12 +2,16 @@ import { GraphError } from '../meta/types.js';
|
|
|
2
2
|
import { GraphRequestOptions } from '../meta/request.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Calls the Threads Graph API directly — the escape hatch for endpoints this
|
|
6
|
+
* module doesn't wrap. The Instagram counterpart is {@link getInstagramData};
|
|
7
|
+
* see it for the POST-via-`params` convention and an example.
|
|
6
8
|
*
|
|
7
9
|
* @param token - Threads access token.
|
|
8
|
-
* @param path - API path.
|
|
9
|
-
* @param options - `params` (query), `method`, `body`.
|
|
10
|
-
* @returns Promise of `(T & GraphError) | null`.
|
|
10
|
+
* @param path - API path, relative to the versioned root (e.g. `"me/threads"`).
|
|
11
|
+
* @param options - See {@link GraphRequestOptions} — `params` (query), `method`, `body`.
|
|
12
|
+
* @returns Promise of `(T & GraphError) | null` — check `.error` before reading `T`.
|
|
13
|
+
*
|
|
14
|
+
* @category Socials
|
|
11
15
|
*/
|
|
12
16
|
declare const getThreadsData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
13
17
|
|