@kyro-cms/core 0.12.71 → 0.13.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/README.md +6 -0
- package/dist/{WebhookService-DQyM9fVo.d.ts → WebhookService-BLi5Rz2m.d.ts} +1 -1
- package/dist/{WebhookService-bo1NrgBW.d.cts → WebhookService-BcuD8tnn.d.cts} +1 -1
- package/dist/WebhookService-D5PSI5t6.d.cts +143 -0
- package/dist/WebhookService-DPCCn_12.d.ts +143 -0
- package/dist/WebhookService-Dncnbgm9.d.cts +143 -0
- package/dist/WebhookService-UY5p89Bj.d.ts +143 -0
- package/dist/WebhookService-YZXBCRXA.d.ts +143 -0
- package/dist/WebhookService-zrDmAx7L.d.cts +143 -0
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +1 -1
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +1 -1
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/{base-urWvrsX8.d.cts → base-B--L0lCn.d.cts} +1 -1
- package/dist/base-BVoDPNjJ.d.cts +218 -0
- package/dist/base-CAb9EYQs.d.ts +218 -0
- package/dist/base-CyG7aF1e.d.cts +218 -0
- package/dist/{base-BcfNgOqZ.d.ts → base-DOImeJ-F.d.ts} +1 -1
- package/dist/base-DbnwE42-.d.cts +218 -0
- package/dist/base-NyiSsD-n.d.ts +218 -0
- package/dist/base-xflndGDO.d.ts +218 -0
- package/dist/bootstrap-QQ6D3OYG.js +1 -0
- package/dist/bootstrap-QVKSKXJF.cjs +1 -0
- package/dist/bootstrap-RILR44UM.cjs +1 -0
- package/dist/bootstrap-ZRRUPRUR.js +1 -0
- package/dist/chunk-262YP5XA.cjs +1 -0
- package/dist/chunk-2FSOHXOU.cjs +56 -0
- package/dist/chunk-2OS5Y4LE.cjs +1 -0
- package/dist/chunk-2PXXQKN3.cjs +3 -0
- package/dist/{chunk-K6ZW5M6S.cjs → chunk-355R4LS5.cjs} +3 -3
- package/dist/chunk-35IVNLMA.js +122 -0
- package/dist/{chunk-FSWDDVLA.js → chunk-3GXLOYM3.js} +1 -1
- package/dist/chunk-3KZXF4US.js +2 -0
- package/dist/{chunk-H7PC2ENZ.cjs → chunk-3LAWUINR.cjs} +1 -1
- package/dist/chunk-3O3AVMWM.cjs +1 -0
- package/dist/chunk-3U6MKWET.cjs +120 -0
- package/dist/chunk-4BMWWGJN.js +384 -0
- package/dist/chunk-5A7E7N4B.cjs +431 -0
- package/dist/chunk-6DD4J7LI.js +2 -0
- package/dist/chunk-6GGPY7U2.js +4 -0
- package/dist/chunk-6MNLRAKM.cjs +121 -0
- package/dist/chunk-6NBZDW53.js +133 -0
- package/dist/{chunk-2HATK4C5.js → chunk-73Y63IPP.js} +4 -4
- package/dist/chunk-7K6ZUNJM.js +4 -0
- package/dist/chunk-7NKNSRCB.cjs +448 -0
- package/dist/chunk-A3IOQOV6.js +2 -0
- package/dist/chunk-A3XVL6ED.cjs +3 -0
- package/dist/{chunk-LKQHIOPW.cjs → chunk-APDQ6ZTG.cjs} +1 -1
- package/dist/chunk-ATI2UZ7U.js +2 -0
- package/dist/chunk-B4AC23SG.js +122 -0
- package/dist/chunk-BD6XHMMM.cjs +2 -0
- package/dist/chunk-CH4TZZI5.js +449 -0
- package/dist/{chunk-26KFM3P6.js → chunk-CNHUCCQJ.js} +1 -1
- package/dist/chunk-CRP6PSCE.js +2 -0
- package/dist/chunk-DI6TCZSE.js +122 -0
- package/dist/chunk-DORUYZQV.cjs +1 -0
- package/dist/chunk-EFKEVWAD.js +4 -0
- package/dist/chunk-EI7FRSNY.js +57 -0
- package/dist/chunk-EON4XLKQ.cjs +1 -0
- package/dist/chunk-EUQAOYEO.cjs +121 -0
- package/dist/chunk-EVAUBT7H.js +57 -0
- package/dist/chunk-EYHD7HZE.cjs +1 -0
- package/dist/chunk-EYYIPA5N.js +432 -0
- package/dist/chunk-F2O4QO5N.cjs +383 -0
- package/dist/chunk-FBWLSWZ4.js +122 -0
- package/dist/chunk-FGN6IMPY.cjs +3 -0
- package/dist/chunk-FK2BG4HU.js +3 -0
- package/dist/chunk-GWIZT2P5.js +57 -0
- package/dist/chunk-H3FJ54KB.cjs +121 -0
- package/dist/chunk-HY3EAWB2.js +4 -0
- package/dist/chunk-I6UJVO2P.js +57 -0
- package/dist/chunk-IQSF6XRV.js +57 -0
- package/dist/chunk-IXGDTAES.js +4 -0
- package/dist/chunk-JA44K75G.js +2 -0
- package/dist/chunk-K5XGP57D.cjs +19 -0
- package/dist/chunk-KEITOXIP.js +2 -0
- package/dist/chunk-LPFRMQFQ.js +121 -0
- package/dist/chunk-LYU44UNN.cjs +56 -0
- package/dist/chunk-MDLJTZLV.cjs +1 -0
- package/dist/chunk-MJAODEFC.cjs +121 -0
- package/dist/chunk-MYHNTJLR.cjs +56 -0
- package/dist/chunk-N2YHO2WI.cjs +3 -0
- package/dist/chunk-N4FXLQE3.cjs +132 -0
- package/dist/chunk-NPBXLPOP.js +3 -0
- package/dist/chunk-ON5XJEPO.cjs +3 -0
- package/dist/chunk-OT2Z4XBD.cjs +1 -0
- package/dist/chunk-PFTBTWSC.cjs +1 -0
- package/dist/chunk-PTPVFLET.js +20 -0
- package/dist/chunk-PZDLPRJF.js +4 -0
- package/dist/chunk-Q5TFO66G.cjs +1 -0
- package/dist/chunk-QUTYCUST.js +4 -0
- package/dist/chunk-REKKBAQX.cjs +56 -0
- package/dist/chunk-REQ622YC.js +3 -0
- package/dist/chunk-RTNQP6BV.js +2 -0
- package/dist/chunk-RUJW47ZJ.js +2 -0
- package/dist/chunk-RXYCFZJC.cjs +121 -0
- package/dist/chunk-RYHOWZLK.js +2 -0
- package/dist/chunk-S2MZNEBQ.cjs +1 -0
- package/dist/chunk-S73YERS2.js +57 -0
- package/dist/chunk-SBNMXQNO.cjs +2 -0
- package/dist/chunk-T3DJ3UTP.cjs +121 -0
- package/dist/chunk-TJZO7ZSX.cjs +3 -0
- package/dist/chunk-TKUNRCRH.js +4 -0
- package/dist/chunk-TQLCOMKC.js +4 -0
- package/dist/chunk-TRXYDWGE.cjs +1 -0
- package/dist/chunk-TS55CUNJ.js +57 -0
- package/dist/chunk-UFBJ3WOZ.js +2 -0
- package/dist/chunk-UQRVQUVR.js +2 -0
- package/dist/chunk-UW5W35NP.js +122 -0
- package/dist/chunk-VI7WCO2J.cjs +3 -0
- package/dist/chunk-W2GPP6RB.js +122 -0
- package/dist/chunk-WHOA7YJU.cjs +1 -0
- package/dist/chunk-WNRUPL26.js +2 -0
- package/dist/chunk-WXT2XW7T.js +13 -0
- package/dist/chunk-XFYSADHV.cjs +2 -0
- package/dist/chunk-XIAJQLGS.js +2 -0
- package/dist/chunk-XK6UB77Q.js +4 -0
- package/dist/chunk-Y2VHO66Q.cjs +3 -0
- package/dist/chunk-Y5O2OD7J.cjs +3 -0
- package/dist/chunk-YARB43JG.cjs +56 -0
- package/dist/chunk-YLCEMVYY.cjs +56 -0
- package/dist/chunk-YSOM57GK.cjs +3 -0
- package/dist/chunk-Z3UVDGYS.cjs +56 -0
- package/dist/chunk-ZTLGK6R4.cjs +12 -0
- package/dist/chunk-ZUBJ6RLQ.cjs +1 -0
- package/dist/cli/index.cjs +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/client.cjs +8 -8
- package/dist/client.d.cts +1248 -0
- package/dist/client.d.ts +1248 -0
- package/dist/client.js +8 -8
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.d.cts +3 -3
- package/dist/drizzle/index.d.ts +3 -3
- package/dist/drizzle/index.js +1 -1
- package/dist/fields/index.cjs +1 -1
- package/dist/fields/index.d.cts +2 -2
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +1 -1
- package/dist/graphql/index.d.cts +3 -3
- package/dist/graphql/index.d.ts +3 -3
- package/dist/{index-d1m_oup7.d.cts → index-B9BFNOHd.d.cts} +1 -1
- package/dist/index-BMcYFpTv.d.cts +105 -0
- package/dist/index-BttsFZDa.d.ts +105 -0
- package/dist/index-CxA9uOv0.d.ts +105 -0
- package/dist/{index-4cH-BjtP.d.ts → index-D6AXbuPI.d.ts} +1 -1
- package/dist/index-DF0KDBaM.d.cts +105 -0
- package/dist/index-DG4Xu7gA.d.cts +105 -0
- package/dist/index-eHex8Iwj.d.ts +105 -0
- package/dist/index.cjs +32 -32
- package/dist/index.d.cts +73 -11
- package/dist/index.d.ts +73 -11
- package/dist/index.js +32 -32
- package/dist/lib-A2D63VXD.cjs +1 -0
- package/dist/lib-JQD2JAOO.js +2 -0
- package/dist/local-KR3AIGVA.cjs +1 -0
- package/dist/local-T7GISZBL.js +1 -0
- package/dist/mongo-auth-adapter-GR2CFFEA.js +1 -0
- package/dist/mongo-auth-adapter-UOO2LZUJ.cjs +1 -0
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.d.cts +4 -3
- package/dist/mongodb/index.d.ts +4 -3
- package/dist/mongodb/index.js +1 -1
- package/dist/nodemailer-transport-3VWVUBM5.cjs +1 -0
- package/dist/nodemailer-transport-7RHATUKL.js +1 -0
- package/dist/nodemailer-transport-CHO2WKIY.js +1 -0
- package/dist/nodemailer-transport-ED2IXNGW.cjs +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.d.cts +4 -4
- package/dist/rest/index.d.ts +4 -4
- package/dist/rest/index.js +1 -1
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.d.cts +2 -2
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.d.cts +3 -3
- package/dist/trpc/index.d.ts +3 -3
- package/dist/trpc/index.js +1 -1
- package/dist/types-B5Qz1svz.d.cts +822 -0
- package/dist/types-Bii0bhUV.d.cts +329 -0
- package/dist/types-Bii0bhUV.d.ts +329 -0
- package/dist/{types-BADIMVGF.d.ts → types-Bt2_ycUO.d.ts} +36 -1
- package/dist/types-C4wXHImf.d.ts +822 -0
- package/dist/types-DCWgPFmi.d.cts +822 -0
- package/dist/types-DROqAsr0.d.cts +330 -0
- package/dist/types-DROqAsr0.d.ts +330 -0
- package/dist/{types-YAVR0H9Z.d.cts → types-DsF64Wrc.d.cts} +36 -1
- package/dist/types-ZrjEVWfi.d.ts +811 -0
- package/dist/types-dEy5JxvN.d.ts +822 -0
- package/dist/types-tVJc9YbX.d.cts +811 -0
- package/dist/ws/index.cjs +1 -1
- package/dist/ws/index.d.cts +121 -1
- package/dist/ws/index.d.ts +121 -1
- package/dist/ws/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-5M3FKE2V.js +0 -2
- package/dist/chunk-WCFHS7EZ.cjs +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { B as BaseAdapter } from './types-Bt2_ycUO.js';
|
|
2
|
+
|
|
3
|
+
declare const WEBHOOK_EVENTS: {
|
|
4
|
+
readonly COLLECTION_CREATE: "collection.create";
|
|
5
|
+
readonly COLLECTION_UPDATE: "collection.update";
|
|
6
|
+
readonly COLLECTION_DELETE: "collection.delete";
|
|
7
|
+
readonly MEDIA_UPLOAD: "media.upload";
|
|
8
|
+
readonly MEDIA_DELETE: "media.delete";
|
|
9
|
+
readonly AUTH_LOGIN: "auth.login";
|
|
10
|
+
readonly AUTH_REGISTER: "auth.register";
|
|
11
|
+
readonly AUTH_LOGOUT: "auth.logout";
|
|
12
|
+
readonly ORDER_CREATED: "order.created";
|
|
13
|
+
readonly ORDER_PAID: "order.paid";
|
|
14
|
+
readonly ORDER_SHIPPED: "order.shipped";
|
|
15
|
+
readonly ORDER_DELIVERED: "order.delivered";
|
|
16
|
+
};
|
|
17
|
+
type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
|
|
18
|
+
declare const ALL_WEBHOOK_EVENTS: WebhookEvent[];
|
|
19
|
+
type WebhookActionType = "generic" | "github-push";
|
|
20
|
+
interface WebhookActionConfig {
|
|
21
|
+
githubOwner?: string;
|
|
22
|
+
githubRepo?: string;
|
|
23
|
+
githubBranch?: string;
|
|
24
|
+
}
|
|
25
|
+
interface WebhookConfig {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
url: string;
|
|
29
|
+
events: WebhookEvent[];
|
|
30
|
+
collections?: string[];
|
|
31
|
+
status: "active" | "inactive" | "error";
|
|
32
|
+
secret?: string;
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
action?: WebhookActionType;
|
|
35
|
+
config?: WebhookActionConfig;
|
|
36
|
+
lastTriggered?: string;
|
|
37
|
+
lastError?: string;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
}
|
|
41
|
+
interface CreateWebhookData {
|
|
42
|
+
name: string;
|
|
43
|
+
url: string;
|
|
44
|
+
events: (WebhookEvent | "create" | "update" | "delete")[];
|
|
45
|
+
collections?: string[];
|
|
46
|
+
status?: "active" | "inactive";
|
|
47
|
+
secret?: string;
|
|
48
|
+
headers?: Record<string, string>;
|
|
49
|
+
action?: WebhookActionType;
|
|
50
|
+
config?: WebhookActionConfig;
|
|
51
|
+
}
|
|
52
|
+
interface UpdateWebhookData {
|
|
53
|
+
name?: string;
|
|
54
|
+
url?: string;
|
|
55
|
+
events?: (WebhookEvent | "create" | "update" | "delete")[];
|
|
56
|
+
collections?: string[];
|
|
57
|
+
status?: "active" | "inactive" | "error";
|
|
58
|
+
secret?: string;
|
|
59
|
+
headers?: Record<string, string>;
|
|
60
|
+
action?: WebhookActionType;
|
|
61
|
+
config?: WebhookActionConfig;
|
|
62
|
+
lastTriggered?: string | null;
|
|
63
|
+
lastError?: string | null;
|
|
64
|
+
}
|
|
65
|
+
interface WebhookPayload {
|
|
66
|
+
id: string;
|
|
67
|
+
event: WebhookEvent;
|
|
68
|
+
timestamp: string;
|
|
69
|
+
collection?: string;
|
|
70
|
+
operation?: "create" | "update" | "delete";
|
|
71
|
+
data?: unknown;
|
|
72
|
+
previousData?: unknown;
|
|
73
|
+
user?: {
|
|
74
|
+
id: string;
|
|
75
|
+
email?: string;
|
|
76
|
+
role?: string;
|
|
77
|
+
};
|
|
78
|
+
tenantId?: string;
|
|
79
|
+
metadata?: Record<string, unknown>;
|
|
80
|
+
}
|
|
81
|
+
interface WebhookDelivery {
|
|
82
|
+
id: string;
|
|
83
|
+
webhookId: string;
|
|
84
|
+
event: WebhookEvent;
|
|
85
|
+
payload: WebhookPayload;
|
|
86
|
+
attempt: number;
|
|
87
|
+
status: "pending" | "success" | "failed" | "retrying";
|
|
88
|
+
responseStatus?: number;
|
|
89
|
+
responseBody?: string;
|
|
90
|
+
error?: string;
|
|
91
|
+
duration?: number;
|
|
92
|
+
createdAt: string;
|
|
93
|
+
deliveredAt?: string;
|
|
94
|
+
nextRetryAt?: string;
|
|
95
|
+
}
|
|
96
|
+
interface WebhookTriggerResult {
|
|
97
|
+
deliveryId: string;
|
|
98
|
+
webhookId: string;
|
|
99
|
+
event: WebhookEvent;
|
|
100
|
+
status: "queued" | "success" | "failed";
|
|
101
|
+
responseStatus?: number;
|
|
102
|
+
duration?: number;
|
|
103
|
+
error?: string;
|
|
104
|
+
}
|
|
105
|
+
declare const WEBHOOK_COLLECTION = "_webhooks";
|
|
106
|
+
declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
|
|
107
|
+
interface DeliveryResult {
|
|
108
|
+
success: boolean;
|
|
109
|
+
status: number;
|
|
110
|
+
statusText?: string;
|
|
111
|
+
body?: string;
|
|
112
|
+
duration: number;
|
|
113
|
+
error?: string;
|
|
114
|
+
}
|
|
115
|
+
interface DeliveryOptions {
|
|
116
|
+
timeout?: number;
|
|
117
|
+
maxRetries?: number;
|
|
118
|
+
retryDelay?: number;
|
|
119
|
+
onRetry?: (attempt: number, error: string) => void;
|
|
120
|
+
onSuccess?: (result: DeliveryResult) => void;
|
|
121
|
+
onFailure?: (error: string) => void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare class WebhookService {
|
|
125
|
+
private db;
|
|
126
|
+
constructor(db: BaseAdapter);
|
|
127
|
+
getWebhooks(filters?: {
|
|
128
|
+
status?: string;
|
|
129
|
+
event?: WebhookEvent;
|
|
130
|
+
}): Promise<WebhookConfig[]>;
|
|
131
|
+
getWebhookById(id: string): Promise<WebhookConfig | null>;
|
|
132
|
+
createWebhook(data: CreateWebhookData): Promise<WebhookConfig>;
|
|
133
|
+
updateWebhook(id: string, data: UpdateWebhookData): Promise<WebhookConfig | null>;
|
|
134
|
+
deleteWebhook(id: string): Promise<void>;
|
|
135
|
+
trigger(event: WebhookEvent, payloadData: Omit<WebhookPayload, "id" | "event" | "timestamp">): Promise<WebhookTriggerResult[]>;
|
|
136
|
+
triggerWebhook(webhook: WebhookConfig, payload: WebhookPayload): Promise<WebhookTriggerResult>;
|
|
137
|
+
testWebhook(webhookId: string): Promise<WebhookTriggerResult | null>;
|
|
138
|
+
getDeliveryHistory(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
|
|
139
|
+
retryDelivery(deliveryId: string): Promise<WebhookTriggerResult | null>;
|
|
140
|
+
}
|
|
141
|
+
declare function createWebhookService(db: BaseAdapter): WebhookService;
|
|
142
|
+
|
|
143
|
+
export { ALL_WEBHOOK_EVENTS as A, type CreateWebhookData as C, type DeliveryResult as D, type UpdateWebhookData as U, type WebhookPayload as W, type WebhookDelivery as a, type WebhookConfig as b, type DeliveryOptions as c, WebhookService as d, WEBHOOK_COLLECTION as e, WEBHOOK_DELIVERY_COLLECTION as f, WEBHOOK_EVENTS as g, type WebhookEvent as h, type WebhookTriggerResult as i, createWebhookService as j };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { B as BaseAdapter } from './types-tVJc9YbX.cjs';
|
|
2
|
+
|
|
3
|
+
declare const WEBHOOK_EVENTS: {
|
|
4
|
+
readonly COLLECTION_CREATE: "collection.create";
|
|
5
|
+
readonly COLLECTION_UPDATE: "collection.update";
|
|
6
|
+
readonly COLLECTION_DELETE: "collection.delete";
|
|
7
|
+
readonly MEDIA_UPLOAD: "media.upload";
|
|
8
|
+
readonly MEDIA_DELETE: "media.delete";
|
|
9
|
+
readonly AUTH_LOGIN: "auth.login";
|
|
10
|
+
readonly AUTH_REGISTER: "auth.register";
|
|
11
|
+
readonly AUTH_LOGOUT: "auth.logout";
|
|
12
|
+
readonly ORDER_CREATED: "order.created";
|
|
13
|
+
readonly ORDER_PAID: "order.paid";
|
|
14
|
+
readonly ORDER_SHIPPED: "order.shipped";
|
|
15
|
+
readonly ORDER_DELIVERED: "order.delivered";
|
|
16
|
+
};
|
|
17
|
+
type WebhookEvent = (typeof WEBHOOK_EVENTS)[keyof typeof WEBHOOK_EVENTS];
|
|
18
|
+
declare const ALL_WEBHOOK_EVENTS: WebhookEvent[];
|
|
19
|
+
type WebhookActionType = "generic" | "github-push";
|
|
20
|
+
interface WebhookActionConfig {
|
|
21
|
+
githubOwner?: string;
|
|
22
|
+
githubRepo?: string;
|
|
23
|
+
githubBranch?: string;
|
|
24
|
+
}
|
|
25
|
+
interface WebhookConfig {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
url: string;
|
|
29
|
+
events: WebhookEvent[];
|
|
30
|
+
collections?: string[];
|
|
31
|
+
status: "active" | "inactive" | "error";
|
|
32
|
+
secret?: string;
|
|
33
|
+
headers?: Record<string, string>;
|
|
34
|
+
action?: WebhookActionType;
|
|
35
|
+
config?: WebhookActionConfig;
|
|
36
|
+
lastTriggered?: string;
|
|
37
|
+
lastError?: string;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
}
|
|
41
|
+
interface CreateWebhookData {
|
|
42
|
+
name: string;
|
|
43
|
+
url: string;
|
|
44
|
+
events: (WebhookEvent | "create" | "update" | "delete")[];
|
|
45
|
+
collections?: string[];
|
|
46
|
+
status?: "active" | "inactive";
|
|
47
|
+
secret?: string;
|
|
48
|
+
headers?: Record<string, string>;
|
|
49
|
+
action?: WebhookActionType;
|
|
50
|
+
config?: WebhookActionConfig;
|
|
51
|
+
}
|
|
52
|
+
interface UpdateWebhookData {
|
|
53
|
+
name?: string;
|
|
54
|
+
url?: string;
|
|
55
|
+
events?: (WebhookEvent | "create" | "update" | "delete")[];
|
|
56
|
+
collections?: string[];
|
|
57
|
+
status?: "active" | "inactive" | "error";
|
|
58
|
+
secret?: string;
|
|
59
|
+
headers?: Record<string, string>;
|
|
60
|
+
action?: WebhookActionType;
|
|
61
|
+
config?: WebhookActionConfig;
|
|
62
|
+
lastTriggered?: string | null;
|
|
63
|
+
lastError?: string | null;
|
|
64
|
+
}
|
|
65
|
+
interface WebhookPayload {
|
|
66
|
+
id: string;
|
|
67
|
+
event: WebhookEvent;
|
|
68
|
+
timestamp: string;
|
|
69
|
+
collection?: string;
|
|
70
|
+
operation?: "create" | "update" | "delete";
|
|
71
|
+
data?: unknown;
|
|
72
|
+
previousData?: unknown;
|
|
73
|
+
user?: {
|
|
74
|
+
id: string;
|
|
75
|
+
email?: string;
|
|
76
|
+
role?: string;
|
|
77
|
+
};
|
|
78
|
+
tenantId?: string;
|
|
79
|
+
metadata?: Record<string, unknown>;
|
|
80
|
+
}
|
|
81
|
+
interface WebhookDelivery {
|
|
82
|
+
id: string;
|
|
83
|
+
webhookId: string;
|
|
84
|
+
event: WebhookEvent;
|
|
85
|
+
payload: WebhookPayload;
|
|
86
|
+
attempt: number;
|
|
87
|
+
status: "pending" | "success" | "failed" | "retrying";
|
|
88
|
+
responseStatus?: number;
|
|
89
|
+
responseBody?: string;
|
|
90
|
+
error?: string;
|
|
91
|
+
duration?: number;
|
|
92
|
+
createdAt: string;
|
|
93
|
+
deliveredAt?: string;
|
|
94
|
+
nextRetryAt?: string;
|
|
95
|
+
}
|
|
96
|
+
interface WebhookTriggerResult {
|
|
97
|
+
deliveryId: string;
|
|
98
|
+
webhookId: string;
|
|
99
|
+
event: WebhookEvent;
|
|
100
|
+
status: "queued" | "success" | "failed";
|
|
101
|
+
responseStatus?: number;
|
|
102
|
+
duration?: number;
|
|
103
|
+
error?: string;
|
|
104
|
+
}
|
|
105
|
+
declare const WEBHOOK_COLLECTION = "_webhooks";
|
|
106
|
+
declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
|
|
107
|
+
interface DeliveryResult {
|
|
108
|
+
success: boolean;
|
|
109
|
+
status: number;
|
|
110
|
+
statusText?: string;
|
|
111
|
+
body?: string;
|
|
112
|
+
duration: number;
|
|
113
|
+
error?: string;
|
|
114
|
+
}
|
|
115
|
+
interface DeliveryOptions {
|
|
116
|
+
timeout?: number;
|
|
117
|
+
maxRetries?: number;
|
|
118
|
+
retryDelay?: number;
|
|
119
|
+
onRetry?: (attempt: number, error: string) => void;
|
|
120
|
+
onSuccess?: (result: DeliveryResult) => void;
|
|
121
|
+
onFailure?: (error: string) => void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare class WebhookService {
|
|
125
|
+
private db;
|
|
126
|
+
constructor(db: BaseAdapter);
|
|
127
|
+
getWebhooks(filters?: {
|
|
128
|
+
status?: string;
|
|
129
|
+
event?: WebhookEvent;
|
|
130
|
+
}): Promise<WebhookConfig[]>;
|
|
131
|
+
getWebhookById(id: string): Promise<WebhookConfig | null>;
|
|
132
|
+
createWebhook(data: CreateWebhookData): Promise<WebhookConfig>;
|
|
133
|
+
updateWebhook(id: string, data: UpdateWebhookData): Promise<WebhookConfig | null>;
|
|
134
|
+
deleteWebhook(id: string): Promise<void>;
|
|
135
|
+
trigger(event: WebhookEvent, payloadData: Omit<WebhookPayload, "id" | "event" | "timestamp">): Promise<WebhookTriggerResult[]>;
|
|
136
|
+
triggerWebhook(webhook: WebhookConfig, payload: WebhookPayload): Promise<WebhookTriggerResult>;
|
|
137
|
+
testWebhook(webhookId: string): Promise<WebhookTriggerResult | null>;
|
|
138
|
+
getDeliveryHistory(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
|
|
139
|
+
retryDelivery(deliveryId: string): Promise<WebhookTriggerResult | null>;
|
|
140
|
+
}
|
|
141
|
+
declare function createWebhookService(db: BaseAdapter): WebhookService;
|
|
142
|
+
|
|
143
|
+
export { ALL_WEBHOOK_EVENTS as A, type CreateWebhookData as C, type DeliveryResult as D, type UpdateWebhookData as U, type WebhookPayload as W, type WebhookDelivery as a, type WebhookConfig as b, type DeliveryOptions as c, WebhookService as d, WEBHOOK_COLLECTION as e, WEBHOOK_DELIVERY_COLLECTION as f, WEBHOOK_EVENTS as g, type WebhookEvent as h, type WebhookTriggerResult as i, createWebhookService as j };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk2OS5Y4LE_cjs=require('./chunk-2OS5Y4LE.cjs');require('./chunk-Z3UVDGYS.cjs'),require('./chunk-3O3AVMWM.cjs'),require('./chunk-7GGZA5YU.cjs'),require('./chunk-KMFLHGD5.cjs'),require('./chunk-262YP5XA.cjs'),require('./chunk-QO5ZWQA3.cjs'),require('./chunk-6MNLRAKM.cjs'),require('./chunk-Q5TFO66G.cjs'),require('./chunk-7NKNSRCB.cjs'),require('./chunk-HPYH7GTS.cjs'),require('./chunk-OPTVCCQQ.cjs'),require('./chunk-O4YE57OS.cjs'),require('./chunk-MCIZG4A3.cjs'),require('./chunk-35PGCW3S.cjs'),require('./chunk-UNYXWPLZ.cjs'),require('./chunk-PITMDQYN.cjs'),require('./chunk-GIS6X43A.cjs'),require('./chunk-LEBM6ZSZ.cjs'),require('./chunk-GNEVCEJU.cjs'),require('./chunk-ZO3YB5DK.cjs'),require('./chunk-3VXEK5ZW.cjs'),require('./chunk-EZIDQBXI.cjs'),require('./chunk-LQ3YZTPU.cjs'),require('./chunk-SBNMXQNO.cjs'),require('./chunk-ZHA446FA.cjs'),require('./chunk-MDLJTZLV.cjs'),require('./chunk-73D2PNHD.cjs'),require('./chunk-N4FXLQE3.cjs'),require('./chunk-7ACHOBWY.cjs'),require('./chunk-TCFL3UWT.cjs'),require('./chunk-XBQ6HV3T.cjs'),require('./chunk-7JWQ2PZP.cjs'),require('./chunk-RVBSJ4UQ.cjs'),require('./chunk-GNOSG3PK.cjs'),require('./chunk-LY7N3UHH.cjs'),require('./chunk-BAVN7VDR.cjs'),require('./chunk-NGNJSUGL.cjs'),require('./chunk-BCEE4NBZ.cjs'),require('./chunk-VRZC4TTF.cjs'),require('./chunk-XFYSADHV.cjs'),require('./chunk-ZTLGK6R4.cjs'),require('./chunk-EYHD7HZE.cjs'),require('./chunk-VQ53TFYA.cjs'),require('./chunk-F4ITQ6XQ.cjs'),require('./chunk-HTYVI2HK.cjs'),require('./chunk-ZUBJ6RLQ.cjs'),require('./chunk-7WMMKGEO.cjs');var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();function n(e){return new Response(e.body,e)}var i={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function o(){return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}async function c(){try{return (await chunk2OS5Y4LE_cjs.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.graphqlEnabled??i.graphqlEnabled}catch{return true}}var d=async e=>{if(await chunk2OS5Y4LE_cjs.b(e),!await c())return o();let s=await chunk2OS5Y4LE_cjs.a.getGraphQL().fetch(e.request,e.locals);return n(s)},f=async e=>{if(await chunk2OS5Y4LE_cjs.b(e),!await c())return o();let s=await chunk2OS5Y4LE_cjs.a.getGraphQL().fetch(e.request,e.locals);return n(s)};exports.GET=f;exports.POST=d;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b,a}from'./chunk-
|
|
1
|
+
import {b,a}from'./chunk-CRP6PSCE.js';import'./chunk-IQSF6XRV.js';import'./chunk-ATI2UZ7U.js';import'./chunk-LWM4WABU.js';import'./chunk-D6SDGHY6.js';import'./chunk-RYHOWZLK.js';import'./chunk-X473JI7Z.js';import'./chunk-B4AC23SG.js';import'./chunk-3KZXF4US.js';import'./chunk-CH4TZZI5.js';import'./chunk-OLRCZ6E3.js';import'./chunk-N6MNQIQU.js';import'./chunk-6TPICJ2L.js';import'./chunk-YENNL5HG.js';import'./chunk-W45TLOOT.js';import'./chunk-IKGVPXMK.js';import'./chunk-YUUXFD73.js';import'./chunk-LVBHOZZF.js';import'./chunk-OBYAIJVU.js';import'./chunk-JRUQ5ABB.js';import'./chunk-CIVA6SKW.js';import'./chunk-WPM6LFCY.js';import'./chunk-U6KFONKM.js';import'./chunk-TYQYKKWJ.js';import'./chunk-REQ622YC.js';import'./chunk-GQGFNTDZ.js';import'./chunk-KEITOXIP.js';import'./chunk-7MNDQU6K.js';import'./chunk-6NBZDW53.js';import'./chunk-JV4HJBXW.js';import'./chunk-ZAKYTBEN.js';import'./chunk-ZWDBPEXL.js';import'./chunk-47CXBWMA.js';import'./chunk-3TAUNYEM.js';import'./chunk-N5POANYV.js';import'./chunk-2HA6EKXX.js';import'./chunk-FLMUMPDE.js';import'./chunk-EML5FDUU.js';import'./chunk-HRAY65XH.js';import'./chunk-3NSZZCOJ.js';import'./chunk-FK2BG4HU.js';import'./chunk-WXT2XW7T.js';import'./chunk-XIAJQLGS.js';import'./chunk-SLMIYECU.js';import'./chunk-P6JITOFF.js';import'./chunk-7NH7H3WA.js';import'./chunk-JA44K75G.js';import'./chunk-TBHNE4VV.js';import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();function n(e){return new Response(e.body,e)}var i={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};function o(){return new Response(JSON.stringify({error:"GraphQL is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}async function c(){try{return (await a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.graphqlEnabled??i.graphqlEnabled}catch{return true}}var f=async e=>{if(await b(e),!await c())return o();let s=await a.getGraphQL().fetch(e.request,e.locals);return n(s)},h=async e=>{if(await b(e),!await c())return o();let s=await a.getGraphQL().fetch(e.request,e.locals);return n(s)};export{h as GET,f as POST};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk2OS5Y4LE_cjs=require('./chunk-2OS5Y4LE.cjs');require('./chunk-Z3UVDGYS.cjs'),require('./chunk-3O3AVMWM.cjs'),require('./chunk-7GGZA5YU.cjs'),require('./chunk-KMFLHGD5.cjs'),require('./chunk-262YP5XA.cjs'),require('./chunk-QO5ZWQA3.cjs'),require('./chunk-6MNLRAKM.cjs'),require('./chunk-Q5TFO66G.cjs'),require('./chunk-7NKNSRCB.cjs'),require('./chunk-HPYH7GTS.cjs'),require('./chunk-OPTVCCQQ.cjs'),require('./chunk-O4YE57OS.cjs'),require('./chunk-MCIZG4A3.cjs'),require('./chunk-35PGCW3S.cjs'),require('./chunk-UNYXWPLZ.cjs'),require('./chunk-PITMDQYN.cjs'),require('./chunk-GIS6X43A.cjs'),require('./chunk-LEBM6ZSZ.cjs'),require('./chunk-GNEVCEJU.cjs'),require('./chunk-ZO3YB5DK.cjs'),require('./chunk-3VXEK5ZW.cjs'),require('./chunk-EZIDQBXI.cjs'),require('./chunk-LQ3YZTPU.cjs'),require('./chunk-SBNMXQNO.cjs'),require('./chunk-ZHA446FA.cjs'),require('./chunk-MDLJTZLV.cjs'),require('./chunk-73D2PNHD.cjs'),require('./chunk-N4FXLQE3.cjs'),require('./chunk-7ACHOBWY.cjs'),require('./chunk-TCFL3UWT.cjs'),require('./chunk-XBQ6HV3T.cjs'),require('./chunk-7JWQ2PZP.cjs'),require('./chunk-RVBSJ4UQ.cjs'),require('./chunk-GNOSG3PK.cjs'),require('./chunk-LY7N3UHH.cjs'),require('./chunk-BAVN7VDR.cjs'),require('./chunk-NGNJSUGL.cjs'),require('./chunk-BCEE4NBZ.cjs'),require('./chunk-VRZC4TTF.cjs'),require('./chunk-XFYSADHV.cjs'),require('./chunk-ZTLGK6R4.cjs'),require('./chunk-EYHD7HZE.cjs'),require('./chunk-VQ53TFYA.cjs'),require('./chunk-F4ITQ6XQ.cjs'),require('./chunk-HTYVI2HK.cjs'),require('./chunk-ZUBJ6RLQ.cjs'),require('./chunk-7WMMKGEO.cjs');var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');chunkBUNLC3II_cjs.h();function n(){return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}var s={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function o(){try{return (await chunk2OS5Y4LE_cjs.a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.trpcEnabled??s.trpcEnabled}catch{return true}}var p=async e=>(await chunk2OS5Y4LE_cjs.b(e),await o()?chunk2OS5Y4LE_cjs.a.getTRPC().fetch(e.request,e.locals):n());exports.ALL=p;
|
package/dist/api-handler-trpc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b,a}from'./chunk-
|
|
1
|
+
import {b,a}from'./chunk-CRP6PSCE.js';import'./chunk-IQSF6XRV.js';import'./chunk-ATI2UZ7U.js';import'./chunk-LWM4WABU.js';import'./chunk-D6SDGHY6.js';import'./chunk-RYHOWZLK.js';import'./chunk-X473JI7Z.js';import'./chunk-B4AC23SG.js';import'./chunk-3KZXF4US.js';import'./chunk-CH4TZZI5.js';import'./chunk-OLRCZ6E3.js';import'./chunk-N6MNQIQU.js';import'./chunk-6TPICJ2L.js';import'./chunk-YENNL5HG.js';import'./chunk-W45TLOOT.js';import'./chunk-IKGVPXMK.js';import'./chunk-YUUXFD73.js';import'./chunk-LVBHOZZF.js';import'./chunk-OBYAIJVU.js';import'./chunk-JRUQ5ABB.js';import'./chunk-CIVA6SKW.js';import'./chunk-WPM6LFCY.js';import'./chunk-U6KFONKM.js';import'./chunk-TYQYKKWJ.js';import'./chunk-REQ622YC.js';import'./chunk-GQGFNTDZ.js';import'./chunk-KEITOXIP.js';import'./chunk-7MNDQU6K.js';import'./chunk-6NBZDW53.js';import'./chunk-JV4HJBXW.js';import'./chunk-ZAKYTBEN.js';import'./chunk-ZWDBPEXL.js';import'./chunk-47CXBWMA.js';import'./chunk-3TAUNYEM.js';import'./chunk-N5POANYV.js';import'./chunk-2HA6EKXX.js';import'./chunk-FLMUMPDE.js';import'./chunk-EML5FDUU.js';import'./chunk-HRAY65XH.js';import'./chunk-3NSZZCOJ.js';import'./chunk-FK2BG4HU.js';import'./chunk-WXT2XW7T.js';import'./chunk-XIAJQLGS.js';import'./chunk-SLMIYECU.js';import'./chunk-P6JITOFF.js';import'./chunk-7NH7H3WA.js';import'./chunk-JA44K75G.js';import'./chunk-TBHNE4VV.js';import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
2
|
g();function n(){return new Response(JSON.stringify({error:"tRPC is disabled"}),{status:503,headers:{"Content-Type":"application/json"}})}var s={graphqlEnabled:false,trpcEnabled:false,wsEnabled:false,requireAuth:false};async function o(){try{return (await a.db.findOne({collection:"_globals_access-settings",where:{},draft:!0}))?.apiAccess?.trpcEnabled??s.trpcEnabled}catch{return true}}var d=async e=>(await b(e),await o()?a.getTRPC().fetch(e.request,e.locals):n());export{d as ALL};
|
package/dist/api-handler.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk2OS5Y4LE_cjs=require('./chunk-2OS5Y4LE.cjs');require('./chunk-Z3UVDGYS.cjs'),require('./chunk-3O3AVMWM.cjs'),require('./chunk-7GGZA5YU.cjs'),require('./chunk-KMFLHGD5.cjs'),require('./chunk-262YP5XA.cjs'),require('./chunk-QO5ZWQA3.cjs'),require('./chunk-6MNLRAKM.cjs'),require('./chunk-Q5TFO66G.cjs'),require('./chunk-7NKNSRCB.cjs'),require('./chunk-HPYH7GTS.cjs'),require('./chunk-OPTVCCQQ.cjs'),require('./chunk-O4YE57OS.cjs'),require('./chunk-MCIZG4A3.cjs'),require('./chunk-35PGCW3S.cjs'),require('./chunk-UNYXWPLZ.cjs'),require('./chunk-PITMDQYN.cjs'),require('./chunk-GIS6X43A.cjs'),require('./chunk-LEBM6ZSZ.cjs'),require('./chunk-GNEVCEJU.cjs'),require('./chunk-ZO3YB5DK.cjs'),require('./chunk-3VXEK5ZW.cjs'),require('./chunk-EZIDQBXI.cjs'),require('./chunk-LQ3YZTPU.cjs'),require('./chunk-SBNMXQNO.cjs'),require('./chunk-ZHA446FA.cjs'),require('./chunk-MDLJTZLV.cjs'),require('./chunk-73D2PNHD.cjs'),require('./chunk-N4FXLQE3.cjs'),require('./chunk-7ACHOBWY.cjs'),require('./chunk-TCFL3UWT.cjs'),require('./chunk-XBQ6HV3T.cjs'),require('./chunk-7JWQ2PZP.cjs'),require('./chunk-RVBSJ4UQ.cjs'),require('./chunk-GNOSG3PK.cjs'),require('./chunk-LY7N3UHH.cjs'),require('./chunk-BAVN7VDR.cjs'),require('./chunk-NGNJSUGL.cjs'),require('./chunk-BCEE4NBZ.cjs'),require('./chunk-VRZC4TTF.cjs'),require('./chunk-XFYSADHV.cjs'),require('./chunk-ZTLGK6R4.cjs'),require('./chunk-EYHD7HZE.cjs'),require('./chunk-VQ53TFYA.cjs'),require('./chunk-F4ITQ6XQ.cjs'),require('./chunk-HTYVI2HK.cjs'),require('./chunk-ZUBJ6RLQ.cjs'),require('./chunk-7WMMKGEO.cjs'),require('./chunk-BUNLC3II.cjs');Object.defineProperty(exports,"ALL",{enumerable:true,get:function(){return chunk2OS5Y4LE_cjs.c}});Object.defineProperty(exports,"createKyroHandler",{enumerable:true,get:function(){return chunk2OS5Y4LE_cjs.d}});Object.defineProperty(exports,"kyroInstance",{enumerable:true,get:function(){return chunk2OS5Y4LE_cjs.a}});Object.defineProperty(exports,"warmKyroInstance",{enumerable:true,get:function(){return chunk2OS5Y4LE_cjs.b}});
|
package/dist/api-handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as ALL,d as createKyroHandler,a as kyroInstance,b as warmKyroInstance}from'./chunk-
|
|
1
|
+
export{c as ALL,d as createKyroHandler,a as kyroInstance,b as warmKyroInstance}from'./chunk-CRP6PSCE.js';import'./chunk-IQSF6XRV.js';import'./chunk-ATI2UZ7U.js';import'./chunk-LWM4WABU.js';import'./chunk-D6SDGHY6.js';import'./chunk-RYHOWZLK.js';import'./chunk-X473JI7Z.js';import'./chunk-B4AC23SG.js';import'./chunk-3KZXF4US.js';import'./chunk-CH4TZZI5.js';import'./chunk-OLRCZ6E3.js';import'./chunk-N6MNQIQU.js';import'./chunk-6TPICJ2L.js';import'./chunk-YENNL5HG.js';import'./chunk-W45TLOOT.js';import'./chunk-IKGVPXMK.js';import'./chunk-YUUXFD73.js';import'./chunk-LVBHOZZF.js';import'./chunk-OBYAIJVU.js';import'./chunk-JRUQ5ABB.js';import'./chunk-CIVA6SKW.js';import'./chunk-WPM6LFCY.js';import'./chunk-U6KFONKM.js';import'./chunk-TYQYKKWJ.js';import'./chunk-REQ622YC.js';import'./chunk-GQGFNTDZ.js';import'./chunk-KEITOXIP.js';import'./chunk-7MNDQU6K.js';import'./chunk-6NBZDW53.js';import'./chunk-JV4HJBXW.js';import'./chunk-ZAKYTBEN.js';import'./chunk-ZWDBPEXL.js';import'./chunk-47CXBWMA.js';import'./chunk-3TAUNYEM.js';import'./chunk-N5POANYV.js';import'./chunk-2HA6EKXX.js';import'./chunk-FLMUMPDE.js';import'./chunk-EML5FDUU.js';import'./chunk-HRAY65XH.js';import'./chunk-3NSZZCOJ.js';import'./chunk-FK2BG4HU.js';import'./chunk-WXT2XW7T.js';import'./chunk-XIAJQLGS.js';import'./chunk-SLMIYECU.js';import'./chunk-P6JITOFF.js';import'./chunk-7NH7H3WA.js';import'./chunk-JA44K75G.js';import'./chunk-TBHNE4VV.js';import'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, T as TenantContext, F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs, e as FindOneArgs, f as FindVersionsArgs, V as VersionRecord, g as CreateVersionArgs } from './types-
|
|
1
|
+
import { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, T as TenantContext, F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs, e as FindOneArgs, f as FindVersionsArgs, V as VersionRecord, g as CreateVersionArgs } from './types-DsF64Wrc.cjs';
|
|
2
2
|
import { F as Field, s as RelationshipField, U as UploadField } from './types-DlGSbh7I.cjs';
|
|
3
3
|
|
|
4
4
|
type AuditAction = "login" | "logout" | "login_failed" | "register" | "verify_email" | "password_change" | "password_reset" | "password_reset_request" | "role_change" | "permission_change" | "document_create" | "document_update" | "document_delete" | "settings_change" | "user_lockout" | "user_unlock" | "user_create" | "user_update" | "user_delete" | "api_request" | "api_key_create" | "api_key_update" | "api_key_rotate" | "api_key_delete" | "tenant_create" | "tenant_delete";
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, T as TenantContext, F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs, e as FindOneArgs, f as FindVersionsArgs, V as VersionRecord, g as CreateVersionArgs } from './types-DCWgPFmi.cjs';
|
|
2
|
+
import { F as Field, u as RelationshipField, U as UploadField } from './types-Bii0bhUV.cjs';
|
|
3
|
+
|
|
4
|
+
type AuditAction = "login" | "logout" | "login_failed" | "register" | "verify_email" | "password_change" | "password_reset" | "password_reset_request" | "role_change" | "permission_change" | "document_create" | "document_update" | "document_delete" | "settings_change" | "user_lockout" | "user_unlock" | "user_create" | "user_update" | "user_delete" | "api_request" | "api_key_create" | "api_key_update" | "api_key_rotate" | "api_key_delete" | "tenant_create" | "tenant_delete";
|
|
5
|
+
interface AuditLog {
|
|
6
|
+
id: string;
|
|
7
|
+
timestamp: Date;
|
|
8
|
+
action: AuditAction;
|
|
9
|
+
userId?: string;
|
|
10
|
+
userEmail?: string;
|
|
11
|
+
role?: string;
|
|
12
|
+
resource: string;
|
|
13
|
+
resourceId?: string;
|
|
14
|
+
changes?: {
|
|
15
|
+
field: string;
|
|
16
|
+
old: any;
|
|
17
|
+
new: any;
|
|
18
|
+
}[];
|
|
19
|
+
ipAddress?: string;
|
|
20
|
+
userAgent?: string;
|
|
21
|
+
success: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
metadata?: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
interface AuditLogFilter {
|
|
26
|
+
userId?: string;
|
|
27
|
+
action?: AuditAction | AuditAction[];
|
|
28
|
+
resource?: string;
|
|
29
|
+
resourceId?: string;
|
|
30
|
+
success?: boolean;
|
|
31
|
+
startDate?: Date;
|
|
32
|
+
endDate?: Date;
|
|
33
|
+
limit?: number;
|
|
34
|
+
offset?: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface AuthUser {
|
|
38
|
+
id: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
email: string;
|
|
41
|
+
passwordHash?: string;
|
|
42
|
+
role: UserRole;
|
|
43
|
+
avatar?: string;
|
|
44
|
+
tenantId?: string;
|
|
45
|
+
emailVerified?: boolean;
|
|
46
|
+
locked?: boolean;
|
|
47
|
+
lastLogin?: string;
|
|
48
|
+
failedLoginAttempts?: number;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
}
|
|
52
|
+
type UserRole = "super_admin" | "admin" | "editor" | "author" | "customer" | "guest";
|
|
53
|
+
interface Session {
|
|
54
|
+
id: string;
|
|
55
|
+
userId: string;
|
|
56
|
+
token: string;
|
|
57
|
+
refreshToken?: string;
|
|
58
|
+
expiresAt: string;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
ipAddress?: string;
|
|
61
|
+
userAgent?: string;
|
|
62
|
+
}
|
|
63
|
+
interface JWTPayload {
|
|
64
|
+
sub: string;
|
|
65
|
+
email: string;
|
|
66
|
+
role: UserRole;
|
|
67
|
+
tenantId?: string;
|
|
68
|
+
iat?: number;
|
|
69
|
+
exp?: number;
|
|
70
|
+
sid?: string;
|
|
71
|
+
}
|
|
72
|
+
interface AuthTokenConfig {
|
|
73
|
+
secret: string;
|
|
74
|
+
expiresIn?: string | number;
|
|
75
|
+
refreshExpiresIn?: string | number;
|
|
76
|
+
issuer?: string;
|
|
77
|
+
audience?: string[];
|
|
78
|
+
saltRounds?: number;
|
|
79
|
+
}
|
|
80
|
+
interface LoginCredentials {
|
|
81
|
+
email: string;
|
|
82
|
+
password: string;
|
|
83
|
+
}
|
|
84
|
+
interface RegisterData {
|
|
85
|
+
email: string;
|
|
86
|
+
password: string;
|
|
87
|
+
role?: UserRole;
|
|
88
|
+
tenantId?: string;
|
|
89
|
+
}
|
|
90
|
+
interface AuthResult {
|
|
91
|
+
success: boolean;
|
|
92
|
+
user?: AuthUser;
|
|
93
|
+
session?: Session;
|
|
94
|
+
token?: string;
|
|
95
|
+
error?: string;
|
|
96
|
+
}
|
|
97
|
+
interface AuthAdapter {
|
|
98
|
+
createUser(data: {
|
|
99
|
+
email: string;
|
|
100
|
+
password: string;
|
|
101
|
+
name?: string;
|
|
102
|
+
role?: UserRole;
|
|
103
|
+
avatar?: string;
|
|
104
|
+
tenantId?: string;
|
|
105
|
+
}): Promise<AuthUser>;
|
|
106
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
107
|
+
findUserById(id: string): Promise<AuthUser | null>;
|
|
108
|
+
updateUser(id: string, data: Partial<AuthUser> & {
|
|
109
|
+
password?: string;
|
|
110
|
+
}): Promise<AuthUser | null>;
|
|
111
|
+
deleteUser(id: string): Promise<boolean>;
|
|
112
|
+
verifyPassword(email: string, password: string): Promise<AuthUser | null>;
|
|
113
|
+
hashPassword(password: string): Promise<string>;
|
|
114
|
+
createSession(userId: string, data?: {
|
|
115
|
+
ipAddress?: string;
|
|
116
|
+
userAgent?: string;
|
|
117
|
+
}): Promise<Session>;
|
|
118
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
119
|
+
findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
|
|
120
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
121
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
122
|
+
createEmailVerificationToken(userId: string): Promise<{
|
|
123
|
+
token: string;
|
|
124
|
+
expiresAt: Date;
|
|
125
|
+
}>;
|
|
126
|
+
verifyEmailToken(token: string): Promise<{
|
|
127
|
+
success: boolean;
|
|
128
|
+
userId?: string;
|
|
129
|
+
error?: string;
|
|
130
|
+
}>;
|
|
131
|
+
createPasswordResetToken(email: string): Promise<{
|
|
132
|
+
token: string;
|
|
133
|
+
expiresAt: Date;
|
|
134
|
+
error?: string;
|
|
135
|
+
}>;
|
|
136
|
+
resetPasswordWithToken(token: string, newPassword: string): Promise<{
|
|
137
|
+
success: boolean;
|
|
138
|
+
error?: string;
|
|
139
|
+
}>;
|
|
140
|
+
hasAnyUsers?(): Promise<boolean>;
|
|
141
|
+
connect?(): Promise<void>;
|
|
142
|
+
disconnect?(): Promise<void>;
|
|
143
|
+
addPasswordToHistory?(userId: string, passwordHash: string): Promise<void>;
|
|
144
|
+
getPasswordHistory?(userId: string, count?: number): Promise<string[]>;
|
|
145
|
+
isPasswordInHistory?(password: string, userId: string, historyCount?: number): Promise<boolean>;
|
|
146
|
+
findAuditLogs(filter: AuditLogFilter): Promise<{
|
|
147
|
+
logs: AuditLog[];
|
|
148
|
+
total: number;
|
|
149
|
+
}>;
|
|
150
|
+
createAuditLog(data: Omit<AuditLog, "id" | "timestamp">): Promise<AuditLog>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare abstract class AbstractBaseAdapter implements BaseAdapter {
|
|
154
|
+
protected collections: Map<string, CollectionConfig>;
|
|
155
|
+
protected globals: Map<string, GlobalConfig>;
|
|
156
|
+
protected connected: boolean;
|
|
157
|
+
protected tenantContext?: TenantContext;
|
|
158
|
+
abstract connect(): Promise<void>;
|
|
159
|
+
abstract disconnect(): Promise<void>;
|
|
160
|
+
setTenantContext(context: TenantContext | undefined): void;
|
|
161
|
+
getTenantContext(): TenantContext | undefined;
|
|
162
|
+
init(collections: CollectionConfig[], globals?: GlobalConfig[]): Promise<void>;
|
|
163
|
+
abstract find<T>(args: FindArgs): Promise<FindResult<T>>;
|
|
164
|
+
abstract findByID<T>(args: FindByIDArgs): Promise<T | null>;
|
|
165
|
+
abstract create<T>(args: CreateArgs): Promise<T>;
|
|
166
|
+
abstract update<T>(args: UpdateArgs): Promise<T>;
|
|
167
|
+
abstract delete<T>(args: DeleteArgs): Promise<T>;
|
|
168
|
+
abstract count(args: {
|
|
169
|
+
collection: string;
|
|
170
|
+
where?: Record<string, any>;
|
|
171
|
+
tenantId?: string;
|
|
172
|
+
}): Promise<number>;
|
|
173
|
+
abstract findOne(args: FindOneArgs): Promise<any>;
|
|
174
|
+
abstract findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
|
|
175
|
+
abstract findVersionByID(args: {
|
|
176
|
+
collection: string;
|
|
177
|
+
versionId: string;
|
|
178
|
+
tenantId?: string;
|
|
179
|
+
}): Promise<VersionRecord | null>;
|
|
180
|
+
abstract createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
|
|
181
|
+
abstract updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
|
|
182
|
+
abstract deleteVersions(args: {
|
|
183
|
+
collection: string;
|
|
184
|
+
documentId: string;
|
|
185
|
+
keepLatest?: number;
|
|
186
|
+
tenantId?: string;
|
|
187
|
+
}): Promise<void>;
|
|
188
|
+
migrate?(): Promise<void>;
|
|
189
|
+
rollback?(): Promise<void>;
|
|
190
|
+
transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
|
|
191
|
+
protected getCollection(slug: string): CollectionConfig;
|
|
192
|
+
protected applyTenantFilter(where?: Record<string, any>, tenantId?: string): Record<string, any>;
|
|
193
|
+
protected getTableName(slug: string): string;
|
|
194
|
+
protected prepareData(data: Record<string, any>, collection: CollectionConfig): Record<string, any>;
|
|
195
|
+
protected processRelationships(data: Record<string, any>, fields: Field[], depth: number): Record<string, any>;
|
|
196
|
+
protected parseSort(sort?: string): {
|
|
197
|
+
field: string;
|
|
198
|
+
direction: 'asc' | 'desc';
|
|
199
|
+
};
|
|
200
|
+
protected calculatePagination(page: number, limit: number, totalDocs: number): {
|
|
201
|
+
totalDocs: number;
|
|
202
|
+
limit: number;
|
|
203
|
+
totalPages: number;
|
|
204
|
+
page: number;
|
|
205
|
+
pagingCounter: number;
|
|
206
|
+
hasPrevPage: boolean;
|
|
207
|
+
hasNextPage: boolean;
|
|
208
|
+
prevPage: number | null;
|
|
209
|
+
nextPage: number | null;
|
|
210
|
+
};
|
|
211
|
+
protected selectFields(data: Record<string, any>, select?: string[]): Record<string, any>;
|
|
212
|
+
protected isRelationshipField(field: Field): field is RelationshipField;
|
|
213
|
+
protected isUploadField(field: Field): field is UploadField;
|
|
214
|
+
protected getRelationshipFields(fields: Field[]): RelationshipField[];
|
|
215
|
+
protected getUploadFields(fields: Field[]): UploadField[];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export { type AuditLog as A, type JWTPayload as J, type LoginCredentials as L, type RegisterData as R, type Session as S, type UserRole as U, type AuditLogFilter as a, AbstractBaseAdapter as b, type AuthAdapter as c, type AuthUser as d, type AuthTokenConfig as e, type AuthResult as f, type AuditAction as g };
|