@jsdev_ninja/core 0.14.3 → 0.14.5
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/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.es.js +641 -593
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/lib/entities/Chatbot/index.d.ts +96 -0
- package/dist/lib/entities/Chatbot/index.d.ts.map +1 -0
- package/dist/lib/entities/Chatbot/index.js +37 -0
- package/dist/lib/entities/index.d.ts +1 -0
- package/dist/lib/entities/index.d.ts.map +1 -1
- package/dist/lib/entities/index.js +1 -0
- package/dist/lib/firebase-api/index.d.ts +27 -0
- package/dist/lib/firebase-api/index.d.ts.map +1 -1
- package/dist/lib/firebase-api/index.js +9 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ChatSessionSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"ChatSession">;
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
storeId: z.ZodString;
|
|
6
|
+
companyId: z.ZodString;
|
|
7
|
+
tenantId: z.ZodString;
|
|
8
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
9
|
+
userType: z.ZodEnum<["anonymous", "client", "admin", "superAdmin"]>;
|
|
10
|
+
createdAt: z.ZodNumber;
|
|
11
|
+
updatedAt: z.ZodNumber;
|
|
12
|
+
messageCount: z.ZodNumber;
|
|
13
|
+
status: z.ZodEnum<["active", "archived"]>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
type: "ChatSession";
|
|
16
|
+
status: "active" | "archived";
|
|
17
|
+
id: string;
|
|
18
|
+
companyId: string;
|
|
19
|
+
storeId: string;
|
|
20
|
+
userId: string | null;
|
|
21
|
+
tenantId: string;
|
|
22
|
+
createdAt: number;
|
|
23
|
+
userType: "admin" | "client" | "anonymous" | "superAdmin";
|
|
24
|
+
updatedAt: number;
|
|
25
|
+
messageCount: number;
|
|
26
|
+
}, {
|
|
27
|
+
type: "ChatSession";
|
|
28
|
+
status: "active" | "archived";
|
|
29
|
+
id: string;
|
|
30
|
+
companyId: string;
|
|
31
|
+
storeId: string;
|
|
32
|
+
userId: string | null;
|
|
33
|
+
tenantId: string;
|
|
34
|
+
createdAt: number;
|
|
35
|
+
userType: "admin" | "client" | "anonymous" | "superAdmin";
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
messageCount: number;
|
|
38
|
+
}>;
|
|
39
|
+
export type TChatSession = z.infer<typeof ChatSessionSchema>;
|
|
40
|
+
export declare const ChatSessionMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"message">;
|
|
42
|
+
id: z.ZodString;
|
|
43
|
+
role: z.ZodEnum<["user", "assistant", "system"]>;
|
|
44
|
+
content: z.ZodString;
|
|
45
|
+
timestamp: z.ZodNumber;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
type: "message";
|
|
48
|
+
id: string;
|
|
49
|
+
role: "user" | "assistant" | "system";
|
|
50
|
+
content: string;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
}, {
|
|
53
|
+
type: "message";
|
|
54
|
+
id: string;
|
|
55
|
+
role: "user" | "assistant" | "system";
|
|
56
|
+
content: string;
|
|
57
|
+
timestamp: number;
|
|
58
|
+
}>, z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"function_call">;
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
63
|
+
timestamp: z.ZodNumber;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
type: "function_call";
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
timestamp: number;
|
|
69
|
+
arguments: Record<string, any>;
|
|
70
|
+
}, {
|
|
71
|
+
type: "function_call";
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
timestamp: number;
|
|
75
|
+
arguments: Record<string, any>;
|
|
76
|
+
}>, z.ZodObject<{
|
|
77
|
+
type: z.ZodLiteral<"tool_result">;
|
|
78
|
+
id: z.ZodString;
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
result: z.ZodAny;
|
|
81
|
+
timestamp: z.ZodNumber;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
type: "tool_result";
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
timestamp: number;
|
|
87
|
+
result?: any;
|
|
88
|
+
}, {
|
|
89
|
+
type: "tool_result";
|
|
90
|
+
id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
timestamp: number;
|
|
93
|
+
result?: any;
|
|
94
|
+
}>]>;
|
|
95
|
+
export type TChatSessionMessage = z.infer<typeof ChatSessionMessageSchema>;
|
|
96
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/entities/Chatbot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY5B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsBnC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ChatSessionSchema = z.object({
|
|
3
|
+
type: z.literal("ChatSession"),
|
|
4
|
+
id: z.string(),
|
|
5
|
+
storeId: z.string(),
|
|
6
|
+
companyId: z.string(),
|
|
7
|
+
tenantId: z.string(),
|
|
8
|
+
userId: z.string().nullable(),
|
|
9
|
+
userType: z.enum(["anonymous", "client", "admin", "superAdmin"]),
|
|
10
|
+
createdAt: z.number(),
|
|
11
|
+
updatedAt: z.number(),
|
|
12
|
+
messageCount: z.number(),
|
|
13
|
+
status: z.enum(["active", "archived"]),
|
|
14
|
+
});
|
|
15
|
+
export const ChatSessionMessageSchema = z.discriminatedUnion("type", [
|
|
16
|
+
z.object({
|
|
17
|
+
type: z.literal("message"),
|
|
18
|
+
id: z.string(),
|
|
19
|
+
role: z.enum(["user", "assistant", "system"]),
|
|
20
|
+
content: z.string(),
|
|
21
|
+
timestamp: z.number(),
|
|
22
|
+
}),
|
|
23
|
+
z.object({
|
|
24
|
+
type: z.literal("function_call"),
|
|
25
|
+
id: z.string(),
|
|
26
|
+
name: z.string(),
|
|
27
|
+
arguments: z.record(z.string(), z.any()),
|
|
28
|
+
timestamp: z.number(),
|
|
29
|
+
}),
|
|
30
|
+
z.object({
|
|
31
|
+
type: z.literal("tool_result"),
|
|
32
|
+
id: z.string(),
|
|
33
|
+
name: z.string(),
|
|
34
|
+
result: z.any(),
|
|
35
|
+
timestamp: z.number(),
|
|
36
|
+
}),
|
|
37
|
+
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC"}
|
|
@@ -18,6 +18,9 @@ export declare const storeCollections: {
|
|
|
18
18
|
readonly invoices: "invoices";
|
|
19
19
|
readonly suppliers: "suppliers";
|
|
20
20
|
readonly supplierInvoices: "supplierInvoices";
|
|
21
|
+
readonly chatSessions: "chatSessions";
|
|
22
|
+
readonly chatSessionMessages: "chatSessionMessages";
|
|
23
|
+
readonly contactSubmissions: "contactSubmissions";
|
|
21
24
|
};
|
|
22
25
|
export declare const FirestoreApi: {
|
|
23
26
|
systemCollections: {
|
|
@@ -40,6 +43,9 @@ export declare const FirestoreApi: {
|
|
|
40
43
|
readonly invoices: "invoices";
|
|
41
44
|
readonly suppliers: "suppliers";
|
|
42
45
|
readonly supplierInvoices: "supplierInvoices";
|
|
46
|
+
readonly chatSessions: "chatSessions";
|
|
47
|
+
readonly chatSessionMessages: "chatSessionMessages";
|
|
48
|
+
readonly contactSubmissions: "contactSubmissions";
|
|
43
49
|
};
|
|
44
50
|
getPath: ({ companyId, storeId, collectionName, id, }: {
|
|
45
51
|
companyId: string;
|
|
@@ -47,7 +53,16 @@ export declare const FirestoreApi: {
|
|
|
47
53
|
collectionName: keyof typeof storeCollections;
|
|
48
54
|
id?: string;
|
|
49
55
|
}) => string;
|
|
56
|
+
getSubPath: ({ companyId, storeId, collectionName, subCollectionName, id, subId, }: {
|
|
57
|
+
companyId: string;
|
|
58
|
+
storeId: string;
|
|
59
|
+
collectionName: keyof typeof storeCollections;
|
|
60
|
+
subCollectionName: keyof typeof storeCollections;
|
|
61
|
+
id: string;
|
|
62
|
+
subId?: string;
|
|
63
|
+
}) => string;
|
|
50
64
|
getDocPath: (collectionName: keyof typeof storeCollections) => string;
|
|
65
|
+
getSubDocPath: (collectionName: keyof typeof storeCollections, id: string, subCollectionName: keyof typeof storeCollections) => string;
|
|
51
66
|
};
|
|
52
67
|
export declare const FirebaseAPI: {
|
|
53
68
|
firestore: {
|
|
@@ -71,6 +86,9 @@ export declare const FirebaseAPI: {
|
|
|
71
86
|
readonly invoices: "invoices";
|
|
72
87
|
readonly suppliers: "suppliers";
|
|
73
88
|
readonly supplierInvoices: "supplierInvoices";
|
|
89
|
+
readonly chatSessions: "chatSessions";
|
|
90
|
+
readonly chatSessionMessages: "chatSessionMessages";
|
|
91
|
+
readonly contactSubmissions: "contactSubmissions";
|
|
74
92
|
};
|
|
75
93
|
getPath: ({ companyId, storeId, collectionName, id, }: {
|
|
76
94
|
companyId: string;
|
|
@@ -78,7 +96,16 @@ export declare const FirebaseAPI: {
|
|
|
78
96
|
collectionName: keyof typeof storeCollections;
|
|
79
97
|
id?: string;
|
|
80
98
|
}) => string;
|
|
99
|
+
getSubPath: ({ companyId, storeId, collectionName, subCollectionName, id, subId, }: {
|
|
100
|
+
companyId: string;
|
|
101
|
+
storeId: string;
|
|
102
|
+
collectionName: keyof typeof storeCollections;
|
|
103
|
+
subCollectionName: keyof typeof storeCollections;
|
|
104
|
+
id: string;
|
|
105
|
+
subId?: string;
|
|
106
|
+
}) => string;
|
|
81
107
|
getDocPath: (collectionName: keyof typeof storeCollections) => string;
|
|
108
|
+
getSubDocPath: (collectionName: keyof typeof storeCollections, id: string, subCollectionName: keyof typeof storeCollections) => string;
|
|
82
109
|
};
|
|
83
110
|
};
|
|
84
111
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/firebase-api/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/firebase-api/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;CAmBnB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;2DASrB;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;QAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;KACZ;wFAUE;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;QAC9C,iBAAiB,EAAE,MAAM,OAAO,gBAAgB,CAAC;QACjD,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;KACf;iCAI4B,MAAM,OAAO,gBAAgB;oCAIzC,MAAM,OAAO,gBAAgB,MACzC,MAAM,qBACS,MAAM,OAAO,gBAAgB;CAIjD,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;+DAtCpB;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;YAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;SACZ;4FAUE;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;YAC9C,iBAAiB,EAAE,MAAM,OAAO,gBAAgB,CAAC;YACjD,EAAE,EAAE,MAAM,CAAC;YACX,KAAK,CAAC,EAAE,MAAM,CAAC;SACf;qCAI4B,MAAM,OAAO,gBAAgB;wCAIzC,MAAM,OAAO,gBAAgB,MACzC,MAAM,qBACS,MAAM,OAAO,gBAAgB;;CAQjD,CAAC"}
|
|
@@ -18,6 +18,9 @@ export const storeCollections = {
|
|
|
18
18
|
invoices: "invoices",
|
|
19
19
|
suppliers: "suppliers",
|
|
20
20
|
supplierInvoices: "supplierInvoices",
|
|
21
|
+
chatSessions: "chatSessions",
|
|
22
|
+
chatSessionMessages: "chatSessionMessages",
|
|
23
|
+
contactSubmissions: "contactSubmissions",
|
|
21
24
|
};
|
|
22
25
|
export const FirestoreApi = {
|
|
23
26
|
systemCollections,
|
|
@@ -26,10 +29,16 @@ export const FirestoreApi = {
|
|
|
26
29
|
getPath: ({ companyId, storeId, collectionName, id, }) => {
|
|
27
30
|
return `${companyId}/${storeId}/${collectionName}${id ? `/${id}` : ""}`;
|
|
28
31
|
},
|
|
32
|
+
getSubPath: ({ companyId, storeId, collectionName, subCollectionName, id, subId, }) => {
|
|
33
|
+
return `${companyId}/${storeId}/${collectionName}/${id}/${subCollectionName}${subId ? `/${subId}` : ""}`;
|
|
34
|
+
},
|
|
29
35
|
// for firestore events
|
|
30
36
|
getDocPath: (collectionName) => {
|
|
31
37
|
return `{companyId}/{storeId}/${collectionName}/{id}`;
|
|
32
38
|
},
|
|
39
|
+
getSubDocPath: (collectionName, id, subCollectionName) => {
|
|
40
|
+
return `{companyId}/{storeId}/${collectionName}/${id}/${subCollectionName}/{id}`;
|
|
41
|
+
},
|
|
33
42
|
};
|
|
34
43
|
export const FirebaseAPI = {
|
|
35
44
|
firestore: FirestoreApi,
|