@luanxdd/socialkit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -0
- package/README.md +65 -0
- package/dist/client.d.ts +8 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +61 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +7 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/resolutions.d.ts +14 -0
- package/dist/resolutions.d.ts.map +1 -0
- package/dist/resolutions.js +148 -0
- package/dist/resolutions.js.map +1 -0
- package/dist/transport.d.ts +7 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/transport.js +69 -0
- package/dist/transport.js.map +1 -0
- package/dist/types/index.d.ts +54 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +37 -0
package/LICENSE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MIT License
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @luanxdd/socialkit
|
|
2
|
+
|
|
3
|
+
A SDK oficial do SocialKit para TypeScript e JavaScript.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add @luanxdd/socialkit
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Uso
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { SocialKit } from "@luanxdd/socialkit"
|
|
13
|
+
|
|
14
|
+
const social = new SocialKit({
|
|
15
|
+
endpoint: "https://social.example.com",
|
|
16
|
+
token: process.env.SOCIALKIT_TOKEN!,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const post = await social.resolve("https://x.com/user/status/123456789", {
|
|
20
|
+
timeout: 30_000,
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
post.platform // "x"
|
|
24
|
+
post.caption // string | undefined
|
|
25
|
+
post.author?.avatar // URL privada e temporária
|
|
26
|
+
post.media[0]?.url // URL pronta para consumo
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`resolve` espera o necessário e devolve um `Post`; filas, polling e campos internos não vazam para o caminho comum.
|
|
30
|
+
|
|
31
|
+
## Cancelamento
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
const controller = new AbortController()
|
|
35
|
+
|
|
36
|
+
const post = await social.resolve(url, {
|
|
37
|
+
timeout: 15_000,
|
|
38
|
+
signal: controller.signal,
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Resoluções avançadas
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
const resolution = await social.resolutions.create(url, { wait: 0 })
|
|
46
|
+
const current = await social.resolutions.get(resolution.id)
|
|
47
|
+
const recent = await social.resolutions.list({ limit: 20 })
|
|
48
|
+
await social.resolutions.cancel(resolution.id)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Erros
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { SocialKitError } from "@luanxdd/socialkit"
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
await social.resolve(url)
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (error instanceof SocialKitError) {
|
|
60
|
+
console.error(error.status, error.code, error.requestId)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
O endpoint precisa usar HTTPS, exceto em `localhost`. Tokens têm o prefixo `so_live_` e nunca devem ir para código client-side.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Resolutions } from "./resolutions.js";
|
|
2
|
+
import type { Post, ResolveOptions, SocialKitOptions } from "./types/index.js";
|
|
3
|
+
export declare class SocialKit {
|
|
4
|
+
readonly resolutions: Resolutions;
|
|
5
|
+
constructor(options: SocialKitOptions);
|
|
6
|
+
resolve(url: string, options?: ResolveOptions): Promise<Post>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAEzB,qBAAa,SAAS;IACpB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IAEjC,YACE,OAAO,EAAE,gBAAgB,EAK1B;IAEK,OAAO,CACX,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAyFf;CACF"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { SocialKitError } from "./errors.js";
|
|
2
|
+
import { Resolutions } from "./resolutions.js";
|
|
3
|
+
import { Transport } from "./transport.js";
|
|
4
|
+
export class SocialKit {
|
|
5
|
+
resolutions;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.resolutions = new Resolutions(new Transport(options));
|
|
8
|
+
}
|
|
9
|
+
async resolve(url, options = {}) {
|
|
10
|
+
const timeout = options.timeout ?? 30_000;
|
|
11
|
+
const deadline = Date.now() + timeout;
|
|
12
|
+
let resolution = await this.resolutions.create(url, {
|
|
13
|
+
wait: Math.min(20, Math.max(0, Math.floor(timeout / 1_000))),
|
|
14
|
+
...(options.signal
|
|
15
|
+
? {
|
|
16
|
+
signal: options.signal,
|
|
17
|
+
}
|
|
18
|
+
: {}),
|
|
19
|
+
});
|
|
20
|
+
while ([
|
|
21
|
+
"queued",
|
|
22
|
+
"processing",
|
|
23
|
+
].includes(resolution.status) &&
|
|
24
|
+
Date.now() < deadline) {
|
|
25
|
+
await pause(Math.min(400, Math.max(0, deadline - Date.now())), options.signal);
|
|
26
|
+
resolution =
|
|
27
|
+
await this.resolutions.get(resolution.id, options.signal);
|
|
28
|
+
}
|
|
29
|
+
if (resolution.status === "completed" &&
|
|
30
|
+
resolution.post) {
|
|
31
|
+
return resolution.post;
|
|
32
|
+
}
|
|
33
|
+
if (resolution.status === "failed") {
|
|
34
|
+
throw new SocialKitError(422, resolution.error ??
|
|
35
|
+
"resolution_failed", "The post could not be resolved.", null);
|
|
36
|
+
}
|
|
37
|
+
if (resolution.status === "cancelled") {
|
|
38
|
+
throw new SocialKitError(409, "resolution_cancelled", "The resolution was cancelled.", null);
|
|
39
|
+
}
|
|
40
|
+
throw new SocialKitError(408, "resolution_timeout", "The post is still being resolved.", null);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const pause = async (duration, signal) => {
|
|
44
|
+
if (duration <= 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
await new Promise((resolve, reject) => {
|
|
48
|
+
const onAbort = () => {
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
reject(signal?.reason);
|
|
51
|
+
};
|
|
52
|
+
const timer = setTimeout(() => {
|
|
53
|
+
signal?.removeEventListener("abort", onAbort);
|
|
54
|
+
resolve();
|
|
55
|
+
}, duration);
|
|
56
|
+
signal?.addEventListener("abort", onAbort, {
|
|
57
|
+
once: true,
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAO1C,MAAM,OAAO,SAAS;IAC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,CAAC;QAED,IACE,UAAU,CAAC,MAAM,KAAK,QAAQ,EAC9B,CAAC;YACD,MAAM,IAAI,cAAc,CACtB,GAAG,EACH,UAAU,CAAC,KAAK;gBACd,mBAAmB,EACrB,iCAAiC,EACjC,IAAI,CACL,CAAA;QACH,CAAC;QAED,IACE,UAAU,CAAC,MAAM,KAAK,WAAW,EACjC,CAAC;YACD,MAAM,IAAI,cAAc,CACtB,GAAG,EACH,sBAAsB,EACtB,+BAA+B,EAC/B,IAAI,CACL,CAAA;QACH,CAAC;QAED,MAAM,IAAI,cAAc,CACtB,GAAG,EACH,oBAAoB,EACpB,mCAAmC,EACnC,IAAI,CACL,CAAA;IACH,CAAC;CACF;AAED,MAAM,KAAK,GAAG,KAAK,EACjB,QAAgB,EAChB,MAAoB,EACL,EAAE;IACjB,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAClB,OAAM;IACR,CAAC;IAED,MAAM,IAAI,OAAO,CACf,CACE,OAAO,EACP,MAAM,EACN,EAAE;QACF,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,YAAY,CAAC,KAAK,CAAC,CAAA;YAEnB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QACxB,CAAC,CAAA;QAED,MAAM,KAAK,GAAG,UAAU,CACtB,GAAG,EAAE;YACH,MAAM,EAAE,mBAAmB,CACzB,OAAO,EACP,OAAO,CACR,CAAA;YAED,OAAO,EAAE,CAAA;QACX,CAAC,EACD,QAAQ,CACT,CAAA;QAED,MAAM,EAAE,gBAAgB,CACtB,OAAO,EACP,OAAO,EACP;YACE,IAAI,EAAE,IAAI;SACX,CACF,CAAA;IACH,CAAC,CACF,CAAA;AACH,CAAC,CAAA"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare class SocialKitError extends Error {
|
|
2
|
+
readonly status: number;
|
|
3
|
+
readonly code: string;
|
|
4
|
+
readonly requestId: string | null;
|
|
5
|
+
constructor(status: number, code: string, message: string, requestId: string | null);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAe,SAAQ,KAAK;IAErC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAErB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAJnC,YACW,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,EACN,SAAS,EAAE,MAAM,GAAG,IAAI,EAKlC;CACF"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class SocialKitError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
code;
|
|
4
|
+
requestId;
|
|
5
|
+
constructor(status, code, message, requestId) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.requestId = requestId;
|
|
10
|
+
this.name = "SocialKitError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAe,SAAQ,KAAK;IAE5B,MAAM;IACN,IAAI;IAEJ,SAAS;IAJpB,YACW,MAAc,EACd,IAAY,EACrB,OAAe,EACN,SAAwB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAA;sBALL,MAAM;oBACN,IAAI;yBAEJ,SAAS;QAIlB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;IAC9B,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,mBAAmB,kBAAkB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Transport } from "./transport.js";
|
|
2
|
+
import type { CreateResolutionOptions, Resolution } from "./types/index.js";
|
|
3
|
+
export declare class Resolutions {
|
|
4
|
+
private readonly transport;
|
|
5
|
+
constructor(transport: Transport);
|
|
6
|
+
create(url: string, options?: CreateResolutionOptions): Promise<Resolution>;
|
|
7
|
+
get(id: string, signal?: AbortSignal): Promise<Resolution>;
|
|
8
|
+
list(options?: Readonly<{
|
|
9
|
+
limit?: number;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}>): Promise<readonly Resolution[]>;
|
|
12
|
+
cancel(id: string, signal?: AbortSignal): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=resolutions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolutions.d.ts","sourceRoot":"","sources":["../src/resolutions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EACV,uBAAuB,EAGvB,UAAU,EAEX,MAAM,kBAAkB,CAAA;AAkDzB,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAD5B,YACmB,SAAS,EAAE,SAAS,EACnC;IAEE,MAAM,CACV,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,UAAU,CAAC,CA2BrB;IAEK,GAAG,CACP,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAgBrB;IAEK,IAAI,CACR,OAAO,GAAE,QAAQ,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,WAAW,CAAA;KACrB,CAAM,GACN,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAqBhC;IAEK,MAAM,CACV,EAAE,EAAE,MAAM,EACV,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CAYf;CACF"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export class Resolutions {
|
|
2
|
+
transport;
|
|
3
|
+
constructor(transport) {
|
|
4
|
+
this.transport = transport;
|
|
5
|
+
}
|
|
6
|
+
async create(url, options = {}) {
|
|
7
|
+
const response = await this.transport.request("/v1/resolutions", {
|
|
8
|
+
method: "POST",
|
|
9
|
+
body: JSON.stringify({
|
|
10
|
+
url,
|
|
11
|
+
...(options.wait !== undefined
|
|
12
|
+
? {
|
|
13
|
+
wait: options.wait,
|
|
14
|
+
}
|
|
15
|
+
: {}),
|
|
16
|
+
}),
|
|
17
|
+
...(options.signal
|
|
18
|
+
? {
|
|
19
|
+
signal: options.signal,
|
|
20
|
+
}
|
|
21
|
+
: {}),
|
|
22
|
+
});
|
|
23
|
+
return mapResolution(response.data);
|
|
24
|
+
}
|
|
25
|
+
async get(id, signal) {
|
|
26
|
+
const response = await this.transport.request(`/v1/resolutions/${encodeURIComponent(id)}`, signal
|
|
27
|
+
? {
|
|
28
|
+
signal,
|
|
29
|
+
}
|
|
30
|
+
: {});
|
|
31
|
+
return mapResolution(response.data);
|
|
32
|
+
}
|
|
33
|
+
async list(options = {}) {
|
|
34
|
+
const limit = options.limit ?? 20;
|
|
35
|
+
const response = await this.transport.request(`/v1/resolutions?limit=${limit}`, options.signal
|
|
36
|
+
? {
|
|
37
|
+
signal: options.signal,
|
|
38
|
+
}
|
|
39
|
+
: {});
|
|
40
|
+
return response.data.map(mapResolution);
|
|
41
|
+
}
|
|
42
|
+
async cancel(id, signal) {
|
|
43
|
+
await this.transport.request(`/v1/resolutions/${encodeURIComponent(id)}`, {
|
|
44
|
+
method: "DELETE",
|
|
45
|
+
...(signal
|
|
46
|
+
? {
|
|
47
|
+
signal,
|
|
48
|
+
}
|
|
49
|
+
: {}),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const mapResolution = (value) => ({
|
|
54
|
+
id: value.id,
|
|
55
|
+
status: value.status,
|
|
56
|
+
platform: value.platform,
|
|
57
|
+
url: value.source_url,
|
|
58
|
+
progress: value.progress,
|
|
59
|
+
...(value.result
|
|
60
|
+
? {
|
|
61
|
+
post: mapPost(value.result),
|
|
62
|
+
}
|
|
63
|
+
: {}),
|
|
64
|
+
...(value.error_code
|
|
65
|
+
? {
|
|
66
|
+
error: value.error_code,
|
|
67
|
+
}
|
|
68
|
+
: {}),
|
|
69
|
+
attempts: value.attempt_count,
|
|
70
|
+
createdAt: new Date(value.created_at),
|
|
71
|
+
updatedAt: new Date(value.updated_at),
|
|
72
|
+
...(value.completed_at
|
|
73
|
+
? {
|
|
74
|
+
completedAt: new Date(value.completed_at),
|
|
75
|
+
}
|
|
76
|
+
: {}),
|
|
77
|
+
...(value.expires_at
|
|
78
|
+
? {
|
|
79
|
+
expiresAt: new Date(value.expires_at),
|
|
80
|
+
}
|
|
81
|
+
: {}),
|
|
82
|
+
});
|
|
83
|
+
const mapPost = (value) => ({
|
|
84
|
+
platform: value.platform,
|
|
85
|
+
id: value.id,
|
|
86
|
+
url: value.source_url,
|
|
87
|
+
kind: value.type,
|
|
88
|
+
...(value.text
|
|
89
|
+
? {
|
|
90
|
+
caption: value.text,
|
|
91
|
+
}
|
|
92
|
+
: {}),
|
|
93
|
+
...(value.author
|
|
94
|
+
? {
|
|
95
|
+
author: {
|
|
96
|
+
...(value.author.name
|
|
97
|
+
? {
|
|
98
|
+
name: value.author.name,
|
|
99
|
+
}
|
|
100
|
+
: {}),
|
|
101
|
+
...(value.author.username
|
|
102
|
+
? {
|
|
103
|
+
username: value.author.username,
|
|
104
|
+
}
|
|
105
|
+
: {}),
|
|
106
|
+
...(value.author.avatar_url
|
|
107
|
+
? {
|
|
108
|
+
avatar: value.author.avatar_url,
|
|
109
|
+
}
|
|
110
|
+
: {}),
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
: {}),
|
|
114
|
+
media: value.media.flatMap((item) => item.url
|
|
115
|
+
? [
|
|
116
|
+
{
|
|
117
|
+
kind: item.type,
|
|
118
|
+
url: item.url,
|
|
119
|
+
...(item.thumbnail_url
|
|
120
|
+
? {
|
|
121
|
+
preview: item.thumbnail_url,
|
|
122
|
+
}
|
|
123
|
+
: {}),
|
|
124
|
+
...(item.width !== undefined
|
|
125
|
+
? {
|
|
126
|
+
width: item.width,
|
|
127
|
+
}
|
|
128
|
+
: {}),
|
|
129
|
+
...(item.height !== undefined
|
|
130
|
+
? {
|
|
131
|
+
height: item.height,
|
|
132
|
+
}
|
|
133
|
+
: {}),
|
|
134
|
+
...(item.duration !== undefined
|
|
135
|
+
? {
|
|
136
|
+
duration: item.duration,
|
|
137
|
+
}
|
|
138
|
+
: {}),
|
|
139
|
+
},
|
|
140
|
+
]
|
|
141
|
+
: []),
|
|
142
|
+
...(value.metrics
|
|
143
|
+
? {
|
|
144
|
+
stats: value.metrics,
|
|
145
|
+
}
|
|
146
|
+
: {}),
|
|
147
|
+
});
|
|
148
|
+
//# sourceMappingURL=resolutions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolutions.js","sourceRoot":"","sources":["../src/resolutions.ts"],"names":[],"mappings":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C,GAAG;gBACb,GAAG,CAAC,IAAI,CAAC,aAAa;oBACpB,CAAC,CAAC;wBACE,OAAO,EACL,IAAI,CAAC,aAAa;qBACrB;oBACH,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS;oBAC1B,CAAC,CAAC;wBACE,KAAK,EAAE,IAAI,CAAC,KAAK;qBAClB;oBACH,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS;oBAC3B,CAAC,CAAC;wBACE,MAAM,EACJ,IAAI,CAAC,MAAM;qBACd;oBACH,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS;oBAC7B,CAAC,CAAC;wBACE,QAAQ,EACN,IAAI,CAAC,QAAQ;qBAChB;oBACH,CAAC,CAAC,EAAE,CAAC;aACR;SACF;QACH,CAAC,CAAC,EAAE,CACT;IACD,GAAG,CAAC,KAAK,CAAC,OAAO;QACf,CAAC,CAAC;YACE,KAAK,EAAE,KAAK,CAAC,OAAO;SACrB;QACH,CAAC,CAAC,EAAE,CAAC;CACR,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAExD,qBAAa,SAAS;;IAMpB,YACE,OAAO,EAAE,gBAAgB,EA2C1B;IAEK,OAAO,CAAC,CAAC,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,WAAgB,GACrB,OAAO,CAAC,CAAC,CAAC,CAkFZ;CACF"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { SocialKitError } from "./errors.js";
|
|
2
|
+
export class Transport {
|
|
3
|
+
#endpoint;
|
|
4
|
+
#token;
|
|
5
|
+
#timeout;
|
|
6
|
+
#fetch;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
const endpoint = new URL(options.endpoint);
|
|
9
|
+
const local = [
|
|
10
|
+
"localhost",
|
|
11
|
+
"127.0.0.1",
|
|
12
|
+
"::1",
|
|
13
|
+
].includes(endpoint.hostname);
|
|
14
|
+
if (endpoint.protocol !== "https:" &&
|
|
15
|
+
!local) {
|
|
16
|
+
throw new Error("SocialKit requires HTTPS outside localhost.");
|
|
17
|
+
}
|
|
18
|
+
if (!/^so_live_[A-Za-z0-9_-]{43}$/.test(options.token)) {
|
|
19
|
+
throw new Error("Invalid SocialKit token.");
|
|
20
|
+
}
|
|
21
|
+
this.#endpoint =
|
|
22
|
+
options.endpoint.replace(/\/$/, "");
|
|
23
|
+
this.#token = options.token;
|
|
24
|
+
this.#timeout =
|
|
25
|
+
options.timeout ?? 30_000;
|
|
26
|
+
this.#fetch =
|
|
27
|
+
options.fetch ?? globalThis.fetch;
|
|
28
|
+
}
|
|
29
|
+
async request(path, init = {}) {
|
|
30
|
+
const headers = new Headers(init.headers);
|
|
31
|
+
headers.set("authorization", `Bearer ${this.#token}`);
|
|
32
|
+
if (init.body !== undefined) {
|
|
33
|
+
headers.set("content-type", "application/json");
|
|
34
|
+
}
|
|
35
|
+
const timeout = AbortSignal.timeout(this.#timeout);
|
|
36
|
+
const signal = init.signal
|
|
37
|
+
? AbortSignal.any([
|
|
38
|
+
init.signal,
|
|
39
|
+
timeout,
|
|
40
|
+
])
|
|
41
|
+
: timeout;
|
|
42
|
+
const response = await this.#fetch(`${this.#endpoint}${path}`, {
|
|
43
|
+
...init,
|
|
44
|
+
headers,
|
|
45
|
+
signal,
|
|
46
|
+
});
|
|
47
|
+
if (response.status === 204) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const body = (await response
|
|
51
|
+
.json()
|
|
52
|
+
.catch(() => null));
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
const value = typeof body?.error === "object" &&
|
|
55
|
+
body.error
|
|
56
|
+
? body.error
|
|
57
|
+
: body;
|
|
58
|
+
throw new SocialKitError(response.status, typeof value?.code === "string"
|
|
59
|
+
? value.code
|
|
60
|
+
: "request_failed", typeof value?.message === "string"
|
|
61
|
+
? value.message
|
|
62
|
+
: "SocialKit request failed.", typeof value?.request_id === "string"
|
|
63
|
+
? value.request_id
|
|
64
|
+
: null);
|
|
65
|
+
}
|
|
66
|
+
return body;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAG5C,MAAM,OAAO,SAAS;IACX,SAAS,CAAQ;IACjB,MAAM,CAAQ;IACd,QAAQ,CAAQ;IAChB,MAAM,CAAyB;IAExC,YACE,OAAyB;QAEzB,MAAM,QAAQ,GACZ,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAE3B,MAAM,KAAK,GAAG;YACZ,WAAW;YACX,WAAW;YACX,KAAK;SACN,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAE7B,IACE,QAAQ,CAAC,QAAQ,KAAK,QAAQ;YAC9B,CAAC,KAAK,EACN,CAAC;YACD,MAAM,IAAI,KAAK,CACb,6CAA6C,CAC9C,CAAA;QACH,CAAC;QAED,IACE,CAAC,6BAA6B,CAAC,IAAI,CACjC,OAAO,CAAC,KAAK,CACd,EACD,CAAC;YACD,MAAM,IAAI,KAAK,CACb,0BAA0B,CAC3B,CAAA;QACH,CAAC;QAED,IAAI,CAAC,SAAS;YACZ,OAAO,CAAC,QAAQ,CAAC,OAAO,CACtB,KAAK,EACL,EAAE,CACH,CAAA;QAEH,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAA;QAE3B,IAAI,CAAC,QAAQ;YACX,OAAO,CAAC,OAAO,I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I,CAAA;YAEV,MAAM,IAAI,cAAc,CACtB,QAAQ,CAAC,MAAM,EACf,OAAO,KAAK,EAAE,IAAI,KAAK,QAAQ;gBAC7B,CAAC,CAAC,KAAK,CAAC,IAAI;gBACZ,CAAC,CAAC,gBAAgB,EACpB,OAAO,KAAK,EAAE,OAAO,KAAK,QAAQ;gBAChC,CAAC,CAAC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,2BAA2B,EAC/B,OAAO,KAAK,EAAE,UAAU,KAAK,QAAQ;gBACnC,CAAC,CAAC,KAAK,CAAC,UAAU;gBAClB,CAAC,CAAC,IAAI,CACT,CAAA;QACH,CAAC;QAED,OAAO,IAAS,CAAA;IAClB,CAAC;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type Platform = "instagram" | "tiktok" | "x" | "pinterest";
|
|
2
|
+
export type ResolutionStatus = "queued" | "processing" | "completed" | "failed" | "cancelled";
|
|
3
|
+
export type Media = Readonly<{
|
|
4
|
+
kind: "photo" | "video" | "gif";
|
|
5
|
+
url: string;
|
|
6
|
+
preview?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
}>;
|
|
11
|
+
export type Author = Readonly<{
|
|
12
|
+
name?: string;
|
|
13
|
+
username?: string;
|
|
14
|
+
avatar?: string;
|
|
15
|
+
}>;
|
|
16
|
+
export type Post = Readonly<{
|
|
17
|
+
platform: Platform;
|
|
18
|
+
id: string;
|
|
19
|
+
url: string;
|
|
20
|
+
kind: string;
|
|
21
|
+
caption?: string;
|
|
22
|
+
author?: Author;
|
|
23
|
+
media: readonly Media[];
|
|
24
|
+
stats?: Readonly<Record<string, number>>;
|
|
25
|
+
}>;
|
|
26
|
+
export type Resolution = Readonly<{
|
|
27
|
+
id: string;
|
|
28
|
+
status: ResolutionStatus;
|
|
29
|
+
platform: Platform;
|
|
30
|
+
url: string;
|
|
31
|
+
progress: number;
|
|
32
|
+
post?: Post;
|
|
33
|
+
error?: string;
|
|
34
|
+
attempts: number;
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
completedAt?: Date;
|
|
38
|
+
expiresAt?: Date;
|
|
39
|
+
}>;
|
|
40
|
+
export type SocialKitOptions = Readonly<{
|
|
41
|
+
endpoint: string;
|
|
42
|
+
token: string;
|
|
43
|
+
timeout?: number;
|
|
44
|
+
fetch?: typeof globalThis.fetch;
|
|
45
|
+
}>;
|
|
46
|
+
export type ResolveOptions = Readonly<{
|
|
47
|
+
timeout?: number;
|
|
48
|
+
signal?: AbortSignal;
|
|
49
|
+
}>;
|
|
50
|
+
export type CreateResolutionOptions = Readonly<{
|
|
51
|
+
wait?: number;
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
}>;
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAChB,WAAW,GACX,QAAQ,GACR,GAAG,GACH,WAAW,CAAA;AAEf,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,WAAW,CAAA;AAEf,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC;IAC3B,IAAI,EACA,OAAO,GACP,OAAO,GACP,KAAK,CAAA;IACT,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAC,CAAA;AAEF,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;C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AC;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@luanxdd/socialkit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.json",
|
|
20
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"check": "pnpm typecheck && pnpm test && pnpm build",
|
|
23
|
+
"pack:check": "pnpm build && npm pack --dry-run"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "24.13.3",
|
|
30
|
+
"typescript": "7.0.2",
|
|
31
|
+
"vitest": "4.1.10"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
}
|
|
37
|
+
}
|