asfur 1.0.1 → 1.0.2
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 +5 -29
- package/dist/types.d.ts +12 -12
- package/dist/types.js +4 -4
- package/package.json +1 -1
- package/types.ts +4 -4
package/README.md
CHANGED
|
@@ -1,40 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Asfur SDK
|
|
2
2
|
|
|
3
|
-
A simple SDK for interacting with the
|
|
3
|
+
A simple SDK for interacting with the Asfur API.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install asfur
|
|
9
9
|
# or
|
|
10
|
-
yarn add
|
|
10
|
+
yarn add asfur
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
const Taqila = new Taqila({
|
|
19
|
-
apiKey: 'your_api_key',
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
// Make API calls
|
|
23
|
-
async function main() {
|
|
24
|
-
// Create a new Thread
|
|
25
|
-
const newThread = await Taqila.createThread();
|
|
26
|
-
|
|
27
|
-
// Get the Thread with all the messages
|
|
28
|
-
const getThread = await Taqila.getThread(newThread.id, {
|
|
29
|
-
limit: 20
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// Add a message or messages to the thread
|
|
33
|
-
const addMessages = await Taqila.addMessages(newThread.id, [
|
|
34
|
-
{
|
|
35
|
-
role: 'user',
|
|
36
|
-
content: 'Hello, how are you?',
|
|
37
|
-
},
|
|
38
|
-
]);
|
|
39
|
-
}
|
|
40
|
-
```
|
|
16
|
+
import { SourceType, TextType, QueryType } from 'asfur';
|
package/dist/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare const platformsList: readonly ["telegram", "facebook", "instagram
|
|
|
3
3
|
export declare const sourceSchema: z.ZodObject<{
|
|
4
4
|
_id: z.ZodOptional<z.ZodString>;
|
|
5
5
|
platform: z.ZodEnum<["telegram", "facebook", "instagram", "tiktok", "website", "other"]>;
|
|
6
|
-
source_id: z.ZodString
|
|
6
|
+
source_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
7
7
|
source_public_id: z.ZodOptional<z.ZodString>;
|
|
8
8
|
source_name: z.ZodString;
|
|
9
9
|
last_text_id: z.ZodOptional<z.ZodNumber>;
|
|
@@ -19,7 +19,7 @@ export declare const sourceSchema: z.ZodObject<{
|
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "other";
|
|
21
21
|
status: "approved" | "pending" | "rejected";
|
|
22
|
-
source_id: string;
|
|
22
|
+
source_id: string | number;
|
|
23
23
|
source_name: string;
|
|
24
24
|
created_at: Date;
|
|
25
25
|
_id?: string | undefined;
|
|
@@ -35,7 +35,7 @@ export declare const sourceSchema: z.ZodObject<{
|
|
|
35
35
|
}, {
|
|
36
36
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "other";
|
|
37
37
|
status: "approved" | "pending" | "rejected";
|
|
38
|
-
source_id: string;
|
|
38
|
+
source_id: string | number;
|
|
39
39
|
source_name: string;
|
|
40
40
|
created_at: Date;
|
|
41
41
|
_id?: string | undefined;
|
|
@@ -63,11 +63,11 @@ export declare const sourceSchema: z.ZodObject<{
|
|
|
63
63
|
*/
|
|
64
64
|
export declare const textSchema: z.ZodObject<{
|
|
65
65
|
_id: z.ZodOptional<z.ZodString>;
|
|
66
|
-
source_id: z.ZodString
|
|
66
|
+
source_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
67
67
|
source_name: z.ZodString;
|
|
68
|
-
platform_id: z.ZodString
|
|
68
|
+
platform_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
69
69
|
platform: z.ZodEnum<["telegram", "facebook", "instagram", "tiktok", "website", "other"]>;
|
|
70
|
-
original_text_id: z.ZodString
|
|
70
|
+
original_text_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
71
71
|
original_text: z.ZodOptional<z.ZodString>;
|
|
72
72
|
translated_text: z.ZodOptional<z.ZodString>;
|
|
73
73
|
timestamp: z.ZodDate;
|
|
@@ -93,11 +93,11 @@ export declare const textSchema: z.ZodObject<{
|
|
|
93
93
|
}>, "many">>;
|
|
94
94
|
}, "strip", z.ZodTypeAny, {
|
|
95
95
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "other";
|
|
96
|
-
source_id: string;
|
|
96
|
+
source_id: string | number;
|
|
97
97
|
source_name: string;
|
|
98
98
|
created_at: Date;
|
|
99
|
-
platform_id: string;
|
|
100
|
-
original_text_id: string;
|
|
99
|
+
platform_id: string | number;
|
|
100
|
+
original_text_id: string | number;
|
|
101
101
|
timestamp: Date;
|
|
102
102
|
text_geo: string[];
|
|
103
103
|
_id?: string | undefined;
|
|
@@ -115,11 +115,11 @@ export declare const textSchema: z.ZodObject<{
|
|
|
115
115
|
}[] | undefined;
|
|
116
116
|
}, {
|
|
117
117
|
platform: "telegram" | "facebook" | "instagram" | "tiktok" | "website" | "other";
|
|
118
|
-
source_id: string;
|
|
118
|
+
source_id: string | number;
|
|
119
119
|
source_name: string;
|
|
120
120
|
created_at: Date;
|
|
121
|
-
platform_id: string;
|
|
122
|
-
original_text_id: string;
|
|
121
|
+
platform_id: string | number;
|
|
122
|
+
original_text_id: string | number;
|
|
123
123
|
timestamp: Date;
|
|
124
124
|
text_geo: string[];
|
|
125
125
|
_id?: string | undefined;
|
package/dist/types.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.platformsList = [
|
|
|
13
13
|
exports.sourceSchema = zod_1.z.object({
|
|
14
14
|
_id: zod_1.z.string().optional(),
|
|
15
15
|
platform: zod_1.z.enum(exports.platformsList),
|
|
16
|
-
source_id: zod_1.z.string(),
|
|
16
|
+
source_id: zod_1.z.string().or(zod_1.z.number()),
|
|
17
17
|
source_public_id: zod_1.z.string().optional(),
|
|
18
18
|
source_name: zod_1.z.string(),
|
|
19
19
|
last_text_id: zod_1.z.number().optional(),
|
|
@@ -41,11 +41,11 @@ exports.sourceSchema = zod_1.z.object({
|
|
|
41
41
|
*/
|
|
42
42
|
exports.textSchema = zod_1.z.object({
|
|
43
43
|
_id: zod_1.z.string().optional(),
|
|
44
|
-
source_id: zod_1.z.string(),
|
|
44
|
+
source_id: zod_1.z.string().or(zod_1.z.number()),
|
|
45
45
|
source_name: zod_1.z.string(),
|
|
46
|
-
platform_id: zod_1.z.string(),
|
|
46
|
+
platform_id: zod_1.z.string().or(zod_1.z.number()),
|
|
47
47
|
platform: zod_1.z.enum(exports.platformsList),
|
|
48
|
-
original_text_id: zod_1.z.string(),
|
|
48
|
+
original_text_id: zod_1.z.string().or(zod_1.z.number()),
|
|
49
49
|
original_text: zod_1.z.string().optional(),
|
|
50
50
|
translated_text: zod_1.z.string().optional(),
|
|
51
51
|
timestamp: zod_1.z.coerce.date(),
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const platformsList = [
|
|
|
12
12
|
export const sourceSchema = z.object({
|
|
13
13
|
_id: z.string().optional(),
|
|
14
14
|
platform: z.enum(platformsList), // e.g., 'telegram', 'facebook'
|
|
15
|
-
source_id: z.string(), // original channel_id
|
|
15
|
+
source_id: z.string().or(z.number()), // original channel_id
|
|
16
16
|
source_public_id: z.string().optional(), // e.g., '@telegram_channel_id'
|
|
17
17
|
source_name: z.string(), // e.g., 'Telegram Channel Name'
|
|
18
18
|
last_text_id: z.number().optional(), // last processed text ID
|
|
@@ -42,11 +42,11 @@ export const sourceSchema = z.object({
|
|
|
42
42
|
|
|
43
43
|
export const textSchema = z.object({
|
|
44
44
|
_id: z.string().optional(),
|
|
45
|
-
source_id: z.string(), // INDEX - reference to Source _id (e.g., '60c72b2f9b1e8d3f4c8b4567')
|
|
45
|
+
source_id: z.string().or(z.number()), // INDEX - reference to Source _id (e.g., '60c72b2f9b1e8d3f4c8b4567')
|
|
46
46
|
source_name: z.string(), // e.g., 'Telegram Channel Name'
|
|
47
|
-
platform_id: z.string(), // channel_id reference to Source source_id
|
|
47
|
+
platform_id: z.string().or(z.number()), // channel_id reference to Source source_id
|
|
48
48
|
platform: z.enum(platformsList), // e.g., 'telegram', 'facebook'
|
|
49
|
-
original_text_id: z.string(), // message_id
|
|
49
|
+
original_text_id: z.string().or(z.number()), // message_id
|
|
50
50
|
original_text: z.string().optional(), // original text content
|
|
51
51
|
translated_text: z.string().optional(), // translated text if available - most of the time it will be translated to English
|
|
52
52
|
timestamp: z.coerce.date(), // INDEX - date in milliseconds - e.g., 1751210833000
|