naystack 1.8.12 → 1.8.14
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/README.md +189 -31
- package/dist/auth/index.cjs.js +158 -18
- package/dist/auth/index.d.mts +3 -1
- package/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.esm.js +158 -18
- package/dist/auth/instagram/index.cjs.js +158 -18
- package/dist/auth/instagram/index.d.mts +6 -1
- package/dist/auth/instagram/index.d.ts +6 -1
- package/dist/auth/instagram/index.esm.js +158 -18
- package/dist/auth/instagram/route.cjs.js +158 -18
- package/dist/auth/instagram/route.d.mts +3 -1
- package/dist/auth/instagram/route.d.ts +3 -1
- package/dist/auth/instagram/route.esm.js +158 -18
- package/dist/auth/instagram/utils.cjs.js +2 -2
- package/dist/auth/instagram/utils.d.mts +13 -2
- package/dist/auth/instagram/utils.d.ts +13 -2
- package/dist/auth/instagram/utils.esm.js +2 -2
- package/dist/file/setup.d.mts +13 -5
- package/dist/file/setup.d.ts +13 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/socials/index.cjs.js +298 -72
- package/dist/socials/index.d.mts +6 -4
- package/dist/socials/index.d.ts +6 -4
- package/dist/socials/index.esm.js +296 -72
- package/dist/socials/instagram/getters.cjs.js +76 -25
- package/dist/socials/instagram/getters.d.mts +56 -6
- package/dist/socials/instagram/getters.d.ts +56 -6
- package/dist/socials/instagram/getters.esm.js +74 -25
- package/dist/socials/instagram/setters.cjs.js +192 -14
- package/dist/socials/instagram/setters.d.mts +43 -3
- package/dist/socials/instagram/setters.d.ts +43 -3
- package/dist/socials/instagram/setters.esm.js +191 -14
- package/dist/socials/instagram/types.d.mts +48 -11
- package/dist/socials/instagram/types.d.ts +48 -11
- package/dist/socials/instagram/utils.cjs.js +28 -15
- package/dist/socials/instagram/utils.d.mts +7 -18
- package/dist/socials/instagram/utils.d.ts +7 -18
- package/dist/socials/instagram/utils.esm.js +26 -14
- package/dist/socials/instagram/webhook.cjs.js +1 -1
- package/dist/socials/instagram/webhook.esm.js +1 -1
- package/dist/socials/meta/container.cjs.js +82 -0
- package/dist/socials/meta/container.d.mts +38 -0
- package/dist/socials/meta/container.d.ts +38 -0
- package/dist/socials/meta/container.esm.js +57 -0
- package/dist/socials/meta/request.cjs.js +60 -0
- package/dist/socials/meta/request.d.mts +50 -0
- package/dist/socials/meta/request.d.ts +50 -0
- package/dist/socials/meta/request.esm.js +34 -0
- package/dist/socials/meta/types.cjs.js +34 -0
- package/dist/socials/meta/types.d.mts +51 -0
- package/dist/socials/meta/types.d.ts +51 -0
- package/dist/socials/meta/types.esm.js +9 -0
- package/dist/socials/{meta-webhook.cjs.js → meta/webhook.cjs.js} +4 -4
- package/dist/socials/{meta-webhook.esm.js → meta/webhook.esm.js} +1 -1
- package/dist/socials/threads/getters.cjs.js +36 -11
- package/dist/socials/threads/getters.d.mts +23 -2
- package/dist/socials/threads/getters.d.ts +23 -2
- package/dist/socials/threads/getters.esm.js +35 -11
- package/dist/socials/threads/setters.cjs.js +150 -44
- package/dist/socials/threads/setters.d.mts +25 -34
- package/dist/socials/threads/setters.d.ts +25 -34
- package/dist/socials/threads/setters.esm.js +149 -41
- package/dist/socials/threads/types.d.mts +40 -1
- package/dist/socials/threads/types.d.ts +40 -1
- package/dist/socials/threads/utils.cjs.js +29 -11
- package/dist/socials/threads/utils.d.mts +8 -17
- package/dist/socials/threads/utils.d.ts +8 -17
- package/dist/socials/threads/utils.esm.js +27 -10
- package/dist/socials/threads/webhook.cjs.js +1 -1
- package/dist/socials/threads/webhook.esm.js +1 -1
- package/package.json +1 -1
- /package/dist/socials/{meta-webhook.d.mts → meta/webhook.d.mts} +0 -0
- /package/dist/socials/{meta-webhook.d.ts → meta/webhook.d.ts} +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { WaitForContainerOptions } from '../meta/container.mjs';
|
|
2
|
+
import { MetaMediaType } from '../meta/types.mjs';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Threads post (single post or reply).
|
|
3
6
|
*
|
|
@@ -12,5 +15,41 @@ type ThreadsPost = {
|
|
|
12
15
|
permalink: string;
|
|
13
16
|
username: string;
|
|
14
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* One image or video to publish. The URL must be publicly reachable — Threads
|
|
20
|
+
* downloads it server-side.
|
|
21
|
+
*
|
|
22
|
+
* @property url - Public URL. Images: JPEG/PNG, 8 MB max. Videos: MP4/MOV, 1 GB / 5 min max.
|
|
23
|
+
* @property type - `"image"` or `"video"`.
|
|
24
|
+
* @property altText - Accessibility description.
|
|
25
|
+
*
|
|
26
|
+
* @category Socials
|
|
27
|
+
*/
|
|
28
|
+
type ThreadsPostMedia = {
|
|
29
|
+
url: string;
|
|
30
|
+
type: MetaMediaType;
|
|
31
|
+
altText?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Input for {@link createThreadsPost}. What gets published follows from `media`:
|
|
35
|
+
* none is a text post, one is a single image or video, 2–20 is a carousel.
|
|
36
|
+
*
|
|
37
|
+
* @property text - Post text, 500 characters max.
|
|
38
|
+
* @property media - One item or an array.
|
|
39
|
+
* @property linkAttachment - URL to render as a preview card. Text-only posts.
|
|
40
|
+
* @property replyToID - Parent post id, to make this post a reply.
|
|
41
|
+
* @property replyControl - Who may reply.
|
|
42
|
+
* @property wait - Container polling settings.
|
|
43
|
+
*
|
|
44
|
+
* @category Socials
|
|
45
|
+
*/
|
|
46
|
+
type ThreadsPostInput = {
|
|
47
|
+
text?: string;
|
|
48
|
+
media?: ThreadsPostMedia | ThreadsPostMedia[];
|
|
49
|
+
linkAttachment?: string;
|
|
50
|
+
replyToID?: string;
|
|
51
|
+
replyControl?: "everyone" | "accounts_you_follow" | "mentioned_only";
|
|
52
|
+
wait?: WaitForContainerOptions;
|
|
53
|
+
};
|
|
15
54
|
|
|
16
|
-
export type { ThreadsPost };
|
|
55
|
+
export type { ThreadsPost, ThreadsPostInput, ThreadsPostMedia };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { WaitForContainerOptions } from '../meta/container.js';
|
|
2
|
+
import { MetaMediaType } from '../meta/types.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* Threads post (single post or reply).
|
|
3
6
|
*
|
|
@@ -12,5 +15,41 @@ type ThreadsPost = {
|
|
|
12
15
|
permalink: string;
|
|
13
16
|
username: string;
|
|
14
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* One image or video to publish. The URL must be publicly reachable — Threads
|
|
20
|
+
* downloads it server-side.
|
|
21
|
+
*
|
|
22
|
+
* @property url - Public URL. Images: JPEG/PNG, 8 MB max. Videos: MP4/MOV, 1 GB / 5 min max.
|
|
23
|
+
* @property type - `"image"` or `"video"`.
|
|
24
|
+
* @property altText - Accessibility description.
|
|
25
|
+
*
|
|
26
|
+
* @category Socials
|
|
27
|
+
*/
|
|
28
|
+
type ThreadsPostMedia = {
|
|
29
|
+
url: string;
|
|
30
|
+
type: MetaMediaType;
|
|
31
|
+
altText?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Input for {@link createThreadsPost}. What gets published follows from `media`:
|
|
35
|
+
* none is a text post, one is a single image or video, 2–20 is a carousel.
|
|
36
|
+
*
|
|
37
|
+
* @property text - Post text, 500 characters max.
|
|
38
|
+
* @property media - One item or an array.
|
|
39
|
+
* @property linkAttachment - URL to render as a preview card. Text-only posts.
|
|
40
|
+
* @property replyToID - Parent post id, to make this post a reply.
|
|
41
|
+
* @property replyControl - Who may reply.
|
|
42
|
+
* @property wait - Container polling settings.
|
|
43
|
+
*
|
|
44
|
+
* @category Socials
|
|
45
|
+
*/
|
|
46
|
+
type ThreadsPostInput = {
|
|
47
|
+
text?: string;
|
|
48
|
+
media?: ThreadsPostMedia | ThreadsPostMedia[];
|
|
49
|
+
linkAttachment?: string;
|
|
50
|
+
replyToID?: string;
|
|
51
|
+
replyControl?: "everyone" | "accounts_you_follow" | "mentioned_only";
|
|
52
|
+
wait?: WaitForContainerOptions;
|
|
53
|
+
};
|
|
15
54
|
|
|
16
|
-
export type { ThreadsPost };
|
|
55
|
+
export type { ThreadsPost, ThreadsPostInput, ThreadsPostMedia };
|
|
@@ -20,20 +20,38 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/socials/threads/utils.ts
|
|
21
21
|
var utils_exports = {};
|
|
22
22
|
__export(utils_exports, {
|
|
23
|
-
getThreadsData: () => getThreadsData
|
|
24
|
-
getThreadsURL: () => getThreadsURL
|
|
23
|
+
getThreadsData: () => getThreadsData
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(utils_exports);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
|
|
27
|
+
// src/socials/meta/request.ts
|
|
28
|
+
function createGraphClient(baseURL) {
|
|
29
|
+
const buildURL = (token, path, params = {}) => {
|
|
30
|
+
const search = new URLSearchParams();
|
|
31
|
+
for (const [key, value] of Object.entries(params)) {
|
|
32
|
+
if (value !== void 0) search.set(key, String(value));
|
|
33
|
+
}
|
|
34
|
+
search.set("access_token", token);
|
|
35
|
+
return `${baseURL}/${path}?${search.toString()}`;
|
|
36
|
+
};
|
|
37
|
+
const request = async (token, path, options = {}) => {
|
|
38
|
+
const response = await fetch(buildURL(token, path, options.params), {
|
|
39
|
+
method: options.method || (options.body ? "POST" : "GET"),
|
|
40
|
+
headers: {
|
|
41
|
+
Authorization: `Bearer ${token}`,
|
|
42
|
+
...options.body ? { "Content-Type": "application/json" } : {}
|
|
43
|
+
},
|
|
44
|
+
...options.body ? { body: JSON.stringify(options.body) } : {}
|
|
45
|
+
});
|
|
46
|
+
return response.json().catch(() => null);
|
|
47
|
+
};
|
|
48
|
+
return { buildURL, request };
|
|
34
49
|
}
|
|
50
|
+
|
|
51
|
+
// src/socials/threads/utils.ts
|
|
52
|
+
var client = createGraphClient("https://graph.threads.net/v1.0");
|
|
53
|
+
var getThreadsData = client.request;
|
|
35
54
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
55
|
0 && (module.exports = {
|
|
37
|
-
getThreadsData
|
|
38
|
-
getThreadsURL
|
|
56
|
+
getThreadsData
|
|
39
57
|
});
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
+
import { GraphError } from '../meta/types.mjs';
|
|
2
|
+
import { GraphRequestOptions } from '../meta/request.mjs';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @param token - Threads access token.
|
|
5
|
-
* @param path - API path (e.g. `"me/threads"`, `"me/threads_publish"`).
|
|
6
|
-
* @param params - Query parameters.
|
|
7
|
-
* @returns Full URL string.
|
|
8
|
-
* @category Socials
|
|
9
|
-
*/
|
|
10
|
-
declare function getThreadsURL(token: string, path: string, params: Record<string, string>): string;
|
|
11
|
-
/**
|
|
12
|
-
* Fetches JSON from the Threads Graph API (GET or POST).
|
|
5
|
+
* Fetches JSON from the Threads Graph API.
|
|
13
6
|
*
|
|
14
7
|
* @param token - Threads access token.
|
|
15
8
|
* @param path - API path.
|
|
16
|
-
* @param
|
|
17
|
-
* @
|
|
18
|
-
* @returns Promise of response data (typed as `T`) or `null`.
|
|
19
|
-
* @category Socials
|
|
9
|
+
* @param options - `params` (query), `method`, `body`.
|
|
10
|
+
* @returns Promise of `(T & GraphError) | null`.
|
|
20
11
|
*/
|
|
21
|
-
declare
|
|
12
|
+
declare const getThreadsData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
22
13
|
|
|
23
|
-
export { getThreadsData
|
|
14
|
+
export { getThreadsData };
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
+
import { GraphError } from '../meta/types.js';
|
|
2
|
+
import { GraphRequestOptions } from '../meta/request.js';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @param token - Threads access token.
|
|
5
|
-
* @param path - API path (e.g. `"me/threads"`, `"me/threads_publish"`).
|
|
6
|
-
* @param params - Query parameters.
|
|
7
|
-
* @returns Full URL string.
|
|
8
|
-
* @category Socials
|
|
9
|
-
*/
|
|
10
|
-
declare function getThreadsURL(token: string, path: string, params: Record<string, string>): string;
|
|
11
|
-
/**
|
|
12
|
-
* Fetches JSON from the Threads Graph API (GET or POST).
|
|
5
|
+
* Fetches JSON from the Threads Graph API.
|
|
13
6
|
*
|
|
14
7
|
* @param token - Threads access token.
|
|
15
8
|
* @param path - API path.
|
|
16
|
-
* @param
|
|
17
|
-
* @
|
|
18
|
-
* @returns Promise of response data (typed as `T`) or `null`.
|
|
19
|
-
* @category Socials
|
|
9
|
+
* @param options - `params` (query), `method`, `body`.
|
|
10
|
+
* @returns Promise of `(T & GraphError) | null`.
|
|
20
11
|
*/
|
|
21
|
-
declare
|
|
12
|
+
declare const getThreadsData: <T>(token: string, path: string, options?: GraphRequestOptions) => Promise<(T & GraphError) | null>;
|
|
22
13
|
|
|
23
|
-
export { getThreadsData
|
|
14
|
+
export { getThreadsData };
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
// src/socials/
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
// src/socials/meta/request.ts
|
|
2
|
+
function createGraphClient(baseURL) {
|
|
3
|
+
const buildURL = (token, path, params = {}) => {
|
|
4
|
+
const search = new URLSearchParams();
|
|
5
|
+
for (const [key, value] of Object.entries(params)) {
|
|
6
|
+
if (value !== void 0) search.set(key, String(value));
|
|
7
|
+
}
|
|
8
|
+
search.set("access_token", token);
|
|
9
|
+
return `${baseURL}/${path}?${search.toString()}`;
|
|
10
|
+
};
|
|
11
|
+
const request = async (token, path, options = {}) => {
|
|
12
|
+
const response = await fetch(buildURL(token, path, options.params), {
|
|
13
|
+
method: options.method || (options.body ? "POST" : "GET"),
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${token}`,
|
|
16
|
+
...options.body ? { "Content-Type": "application/json" } : {}
|
|
17
|
+
},
|
|
18
|
+
...options.body ? { body: JSON.stringify(options.body) } : {}
|
|
19
|
+
});
|
|
20
|
+
return response.json().catch(() => null);
|
|
21
|
+
};
|
|
22
|
+
return { buildURL, request };
|
|
9
23
|
}
|
|
24
|
+
|
|
25
|
+
// src/socials/threads/utils.ts
|
|
26
|
+
var client = createGraphClient("https://graph.threads.net/v1.0");
|
|
27
|
+
var getThreadsData = client.request;
|
|
10
28
|
export {
|
|
11
|
-
getThreadsData
|
|
12
|
-
getThreadsURL
|
|
29
|
+
getThreadsData
|
|
13
30
|
};
|
|
@@ -24,7 +24,7 @@ __export(webhook_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(webhook_exports);
|
|
26
26
|
|
|
27
|
-
// src/socials/meta
|
|
27
|
+
// src/socials/meta/webhook.ts
|
|
28
28
|
var import_server = require("next/server");
|
|
29
29
|
var verifyWebhook = (secret) => (req) => {
|
|
30
30
|
const params = req.nextUrl.searchParams;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|