@kyro-cms/core 0.3.5 → 0.4.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.
Files changed (78) hide show
  1. package/README.md +3 -3
  2. package/dist/api-handler.cjs +5 -5
  3. package/dist/api-handler.js +4 -4
  4. package/dist/{chunk-X3CU27OO.cjs → chunk-3FW6WVVP.cjs} +2 -17
  5. package/dist/chunk-3FW6WVVP.cjs.map +1 -0
  6. package/dist/{chunk-R4C4O4SE.cjs → chunk-3ZZPZYCM.cjs} +36 -61
  7. package/dist/chunk-3ZZPZYCM.cjs.map +1 -0
  8. package/dist/{chunk-Y3TM7WH7.js → chunk-C4JJEE42.js} +36 -61
  9. package/dist/chunk-C4JJEE42.js.map +1 -0
  10. package/dist/{chunk-2UOI5MUC.cjs → chunk-FWGHXRRI.cjs} +4 -4
  11. package/dist/{chunk-2UOI5MUC.cjs.map → chunk-FWGHXRRI.cjs.map} +1 -1
  12. package/dist/{chunk-DE7OQOMD.cjs → chunk-M4GFA2UQ.cjs} +19 -19
  13. package/dist/chunk-M4GFA2UQ.cjs.map +1 -0
  14. package/dist/{chunk-4UD44U4Z.js → chunk-OJBK3JYF.js} +18 -18
  15. package/dist/chunk-OJBK3JYF.js.map +1 -0
  16. package/dist/{chunk-5FTY2DLG.js → chunk-SAMZQVC2.js} +3 -3
  17. package/dist/{chunk-5FTY2DLG.js.map → chunk-SAMZQVC2.js.map} +1 -1
  18. package/dist/{chunk-RGIQKTZ7.js → chunk-YMG55RSX.js} +4 -18
  19. package/dist/chunk-YMG55RSX.js.map +1 -0
  20. package/dist/drizzle/index.cjs +10 -10
  21. package/dist/drizzle/index.js +2 -2
  22. package/dist/index.cjs +48 -55
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +6 -13
  25. package/dist/index.js.map +1 -1
  26. package/dist/rest/index.cjs +4 -4
  27. package/dist/rest/index.js +2 -2
  28. package/package.json +2 -14
  29. package/dist/WebhookService-118ZTFis.d.ts +0 -112
  30. package/dist/WebhookService-AefJfqX0.d.cts +0 -112
  31. package/dist/api-handler.d.cts +0 -9
  32. package/dist/api-handler.d.ts +0 -9
  33. package/dist/base-DvvNqnM-.d.cts +0 -73
  34. package/dist/base-eVegJ_Pr.d.ts +0 -73
  35. package/dist/chunk-4UD44U4Z.js.map +0 -1
  36. package/dist/chunk-DE7OQOMD.cjs.map +0 -1
  37. package/dist/chunk-R4C4O4SE.cjs.map +0 -1
  38. package/dist/chunk-RGIQKTZ7.js.map +0 -1
  39. package/dist/chunk-X3CU27OO.cjs.map +0 -1
  40. package/dist/chunk-Y3TM7WH7.js.map +0 -1
  41. package/dist/cli/index.d.cts +0 -1
  42. package/dist/cli/index.d.ts +0 -1
  43. package/dist/client.d.cts +0 -12
  44. package/dist/client.d.ts +0 -12
  45. package/dist/drizzle/index.d.cts +0 -135
  46. package/dist/drizzle/index.d.ts +0 -135
  47. package/dist/fields/index.d.cts +0 -27
  48. package/dist/fields/index.d.ts +0 -27
  49. package/dist/graphql/index.d.cts +0 -22
  50. package/dist/graphql/index.d.ts +0 -22
  51. package/dist/index-Bz9JqRGI.d.cts +0 -86
  52. package/dist/index-Bz9JqRGI.d.ts +0 -86
  53. package/dist/index-CLp-DRKA.d.ts +0 -64
  54. package/dist/index-DfO7G4kN.d.cts +0 -64
  55. package/dist/index.d.cts +0 -1363
  56. package/dist/index.d.ts +0 -1363
  57. package/dist/integration.d.cts +0 -27
  58. package/dist/integration.d.ts +0 -27
  59. package/dist/mongodb/index.d.cts +0 -63
  60. package/dist/mongodb/index.d.ts +0 -63
  61. package/dist/mysql-media-AI6YK767.cjs +0 -48
  62. package/dist/mysql-media-AI6YK767.cjs.map +0 -1
  63. package/dist/mysql-media-CDZUS7YX.js +0 -45
  64. package/dist/mysql-media-CDZUS7YX.js.map +0 -1
  65. package/dist/rest/index.d.cts +0 -57
  66. package/dist/rest/index.d.ts +0 -57
  67. package/dist/templates/index.d.cts +0 -59
  68. package/dist/templates/index.d.ts +0 -59
  69. package/dist/trpc/index.d.cts +0 -136
  70. package/dist/trpc/index.d.ts +0 -136
  71. package/dist/types-BnTm7oJG.d.cts +0 -130
  72. package/dist/types-BnTm7oJG.d.ts +0 -130
  73. package/dist/types-Bs1up4yP.d.ts +0 -461
  74. package/dist/types-J3R9nVsZ.d.cts +0 -461
  75. package/dist/types-VtjUxIMp.d.cts +0 -246
  76. package/dist/types-VtjUxIMp.d.ts +0 -246
  77. package/dist/ws/index.d.cts +0 -88
  78. package/dist/ws/index.d.ts +0 -88
@@ -1,24 +1,24 @@
1
1
  'use strict';
2
2
 
3
- var chunkDE7OQOMD_cjs = require('../chunk-DE7OQOMD.cjs');
3
+ var chunkM4GFA2UQ_cjs = require('../chunk-M4GFA2UQ.cjs');
4
4
  require('../chunk-DLHUQO25.cjs');
5
5
  require('../chunk-4PWRCMTQ.cjs');
6
6
  require('../chunk-ADLJSJSN.cjs');
7
7
  require('../chunk-IBG6V56E.cjs');
8
8
  require('../chunk-VJT6P4N6.cjs');
9
9
  require('../chunk-R3XIBBAW.cjs');
10
- require('../chunk-X3CU27OO.cjs');
10
+ require('../chunk-3FW6WVVP.cjs');
11
11
  require('../chunk-G7VZBCD6.cjs');
12
12
 
13
13
 
14
14
 
15
15
  Object.defineProperty(exports, "createHonoApp", {
16
16
  enumerable: true,
17
- get: function () { return chunkDE7OQOMD_cjs.createHonoApp; }
17
+ get: function () { return chunkM4GFA2UQ_cjs.createHonoApp; }
18
18
  });
19
19
  Object.defineProperty(exports, "createRESTAPI", {
20
20
  enumerable: true,
21
- get: function () { return chunkDE7OQOMD_cjs.createRESTAPI; }
21
+ get: function () { return chunkM4GFA2UQ_cjs.createRESTAPI; }
22
22
  });
23
23
  //# sourceMappingURL=index.cjs.map
24
24
  //# sourceMappingURL=index.cjs.map
@@ -1,11 +1,11 @@
1
- export { createHonoApp, createRESTAPI } from '../chunk-4UD44U4Z.js';
1
+ export { createHonoApp, createRESTAPI } from '../chunk-OJBK3JYF.js';
2
2
  import '../chunk-RYDGMBIG.js';
3
3
  import '../chunk-YT7HXXVN.js';
4
4
  import '../chunk-P2YW545G.js';
5
5
  import '../chunk-QXIQWPAP.js';
6
6
  import '../chunk-REK7AYOC.js';
7
7
  import '../chunk-SDMNUYVU.js';
8
- import '../chunk-RGIQKTZ7.js';
8
+ import '../chunk-YMG55RSX.js';
9
9
  import '../chunk-Z6ZWNWWR.js';
10
10
  //# sourceMappingURL=index.js.map
11
11
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kyro-cms/core",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Astro-native headless CMS with multi-database adapters, multi-protocol APIs, and multi-vendor support",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -151,30 +151,18 @@
151
151
  "@types/jsonwebtoken": "^9.0.9",
152
152
  "@types/node": "^22.13.0",
153
153
  "@types/nodemailer": "^7.0.11",
154
- "@types/pg": "^8.20.0",
155
154
  "@types/ssh2-sftp-client": "^9.0.6",
156
155
  "@types/ws": "^8.18.1",
157
156
  "@typescript-eslint/parser": "^8.59.1",
158
157
  "drizzle-kit": "^0.31.10",
159
158
  "eslint": "^9.20.0",
160
- "mysql2": "^3.12.0",
161
- "pg": "^8.13.1",
162
159
  "prettier": "^3.5.0",
163
160
  "tsup": "^8.4.0",
164
161
  "typescript": "^5.7.3",
165
162
  "typescript-eslint": "^8.59.1",
166
163
  "vitest": "^3.0.0"
167
164
  },
168
- "peerDependencies": {
169
- "mysql2": ">=3.0.0",
165
+ "optionalDependencies": {
170
166
  "pg": ">=8.0.0"
171
- },
172
- "peerDependenciesMeta": {
173
- "pg": {
174
- "optional": true
175
- },
176
- "mysql2": {
177
- "optional": true
178
- }
179
167
  }
180
168
  }
@@ -1,112 +0,0 @@
1
- import { B as BaseAdapter } from './types-Bs1up4yP.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
- interface WebhookConfig {
20
- id: string;
21
- name: string;
22
- url: string;
23
- events: WebhookEvent[];
24
- status: "active" | "inactive" | "error";
25
- secret?: string;
26
- headers?: Record<string, string>;
27
- lastTriggered?: string;
28
- lastError?: string;
29
- createdAt: string;
30
- updatedAt: string;
31
- }
32
- interface CreateWebhookData {
33
- name: string;
34
- url: string;
35
- events: WebhookEvent[];
36
- status?: "active" | "inactive";
37
- secret?: string;
38
- headers?: Record<string, string>;
39
- }
40
- interface UpdateWebhookData {
41
- name?: string;
42
- url?: string;
43
- events?: WebhookEvent[];
44
- status?: "active" | "inactive" | "error";
45
- secret?: string;
46
- headers?: Record<string, string>;
47
- lastTriggered?: string | null;
48
- lastError?: string | null;
49
- }
50
- interface WebhookPayload {
51
- id: string;
52
- event: WebhookEvent;
53
- timestamp: string;
54
- collection?: string;
55
- operation?: "create" | "update" | "delete";
56
- data?: unknown;
57
- previousData?: unknown;
58
- user?: {
59
- id: string;
60
- email?: string;
61
- role?: string;
62
- };
63
- tenantId?: string;
64
- metadata?: Record<string, unknown>;
65
- }
66
- interface WebhookDelivery {
67
- id: string;
68
- webhookId: string;
69
- event: WebhookEvent;
70
- payload: WebhookPayload;
71
- attempt: number;
72
- status: "pending" | "success" | "failed" | "retrying";
73
- responseStatus?: number;
74
- responseBody?: string;
75
- error?: string;
76
- duration?: number;
77
- createdAt: string;
78
- deliveredAt?: string;
79
- nextRetryAt?: string;
80
- }
81
- interface WebhookTriggerResult {
82
- deliveryId: string;
83
- webhookId: string;
84
- event: WebhookEvent;
85
- status: "queued" | "success" | "failed";
86
- responseStatus?: number;
87
- duration?: number;
88
- error?: string;
89
- }
90
- declare const WEBHOOK_COLLECTION = "_webhooks";
91
- declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
92
-
93
- declare class WebhookService {
94
- private db;
95
- constructor(db: BaseAdapter);
96
- getWebhooks(filters?: {
97
- status?: string;
98
- event?: WebhookEvent;
99
- }): Promise<WebhookConfig[]>;
100
- getWebhookById(id: string): Promise<WebhookConfig | null>;
101
- createWebhook(data: CreateWebhookData): Promise<WebhookConfig>;
102
- updateWebhook(id: string, data: UpdateWebhookData): Promise<WebhookConfig | null>;
103
- deleteWebhook(id: string): Promise<void>;
104
- trigger(event: WebhookEvent, payloadData: Omit<WebhookPayload, "id" | "event" | "timestamp">): Promise<WebhookTriggerResult[]>;
105
- triggerWebhook(webhook: WebhookConfig, payload: WebhookPayload): Promise<WebhookTriggerResult>;
106
- testWebhook(webhookId: string): Promise<WebhookTriggerResult | null>;
107
- getDeliveryHistory(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
108
- retryDelivery(deliveryId: string): Promise<WebhookTriggerResult | null>;
109
- }
110
- declare function createWebhookService(db: BaseAdapter): WebhookService;
111
-
112
- export { ALL_WEBHOOK_EVENTS as A, type CreateWebhookData as C, type UpdateWebhookData as U, type WebhookPayload as W, type WebhookDelivery as a, type WebhookConfig as b, WebhookService as c, WEBHOOK_COLLECTION as d, WEBHOOK_DELIVERY_COLLECTION as e, WEBHOOK_EVENTS as f, type WebhookEvent as g, type WebhookTriggerResult as h, createWebhookService as i };
@@ -1,112 +0,0 @@
1
- import { B as BaseAdapter } from './types-J3R9nVsZ.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
- interface WebhookConfig {
20
- id: string;
21
- name: string;
22
- url: string;
23
- events: WebhookEvent[];
24
- status: "active" | "inactive" | "error";
25
- secret?: string;
26
- headers?: Record<string, string>;
27
- lastTriggered?: string;
28
- lastError?: string;
29
- createdAt: string;
30
- updatedAt: string;
31
- }
32
- interface CreateWebhookData {
33
- name: string;
34
- url: string;
35
- events: WebhookEvent[];
36
- status?: "active" | "inactive";
37
- secret?: string;
38
- headers?: Record<string, string>;
39
- }
40
- interface UpdateWebhookData {
41
- name?: string;
42
- url?: string;
43
- events?: WebhookEvent[];
44
- status?: "active" | "inactive" | "error";
45
- secret?: string;
46
- headers?: Record<string, string>;
47
- lastTriggered?: string | null;
48
- lastError?: string | null;
49
- }
50
- interface WebhookPayload {
51
- id: string;
52
- event: WebhookEvent;
53
- timestamp: string;
54
- collection?: string;
55
- operation?: "create" | "update" | "delete";
56
- data?: unknown;
57
- previousData?: unknown;
58
- user?: {
59
- id: string;
60
- email?: string;
61
- role?: string;
62
- };
63
- tenantId?: string;
64
- metadata?: Record<string, unknown>;
65
- }
66
- interface WebhookDelivery {
67
- id: string;
68
- webhookId: string;
69
- event: WebhookEvent;
70
- payload: WebhookPayload;
71
- attempt: number;
72
- status: "pending" | "success" | "failed" | "retrying";
73
- responseStatus?: number;
74
- responseBody?: string;
75
- error?: string;
76
- duration?: number;
77
- createdAt: string;
78
- deliveredAt?: string;
79
- nextRetryAt?: string;
80
- }
81
- interface WebhookTriggerResult {
82
- deliveryId: string;
83
- webhookId: string;
84
- event: WebhookEvent;
85
- status: "queued" | "success" | "failed";
86
- responseStatus?: number;
87
- duration?: number;
88
- error?: string;
89
- }
90
- declare const WEBHOOK_COLLECTION = "_webhooks";
91
- declare const WEBHOOK_DELIVERY_COLLECTION = "_webhook_deliveries";
92
-
93
- declare class WebhookService {
94
- private db;
95
- constructor(db: BaseAdapter);
96
- getWebhooks(filters?: {
97
- status?: string;
98
- event?: WebhookEvent;
99
- }): Promise<WebhookConfig[]>;
100
- getWebhookById(id: string): Promise<WebhookConfig | null>;
101
- createWebhook(data: CreateWebhookData): Promise<WebhookConfig>;
102
- updateWebhook(id: string, data: UpdateWebhookData): Promise<WebhookConfig | null>;
103
- deleteWebhook(id: string): Promise<void>;
104
- trigger(event: WebhookEvent, payloadData: Omit<WebhookPayload, "id" | "event" | "timestamp">): Promise<WebhookTriggerResult[]>;
105
- triggerWebhook(webhook: WebhookConfig, payload: WebhookPayload): Promise<WebhookTriggerResult>;
106
- testWebhook(webhookId: string): Promise<WebhookTriggerResult | null>;
107
- getDeliveryHistory(webhookId: string, limit?: number): Promise<WebhookDelivery[]>;
108
- retryDelivery(deliveryId: string): Promise<WebhookTriggerResult | null>;
109
- }
110
- declare function createWebhookService(db: BaseAdapter): WebhookService;
111
-
112
- export { ALL_WEBHOOK_EVENTS as A, type CreateWebhookData as C, type UpdateWebhookData as U, type WebhookPayload as W, type WebhookDelivery as a, type WebhookConfig as b, WebhookService as c, WEBHOOK_COLLECTION as d, WEBHOOK_DELIVERY_COLLECTION as e, WEBHOOK_EVENTS as f, type WebhookEvent as g, type WebhookTriggerResult as h, createWebhookService as i };
@@ -1,9 +0,0 @@
1
- import { APIRoute } from 'astro';
2
-
3
- /**
4
- * Global API Handler for Astro
5
- * This file is injected into the host project at /api/kyro/[...path]
6
- */
7
- declare const ALL: APIRoute;
8
-
9
- export { ALL };
@@ -1,9 +0,0 @@
1
- import { APIRoute } from 'astro';
2
-
3
- /**
4
- * Global API Handler for Astro
5
- * This file is injected into the host project at /api/kyro/[...path]
6
- */
7
- declare const ALL: APIRoute;
8
-
9
- export { ALL };
@@ -1,73 +0,0 @@
1
- import { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, e as UpdateArgs, D as DeleteArgs, f as FindVersionsArgs, g as VersionRecord, h as CreateVersionArgs, i as DraftFindArgs, j as DraftSnapshot, k as DraftUpsertArgs, l as DraftDeleteArgs } from './types-J3R9nVsZ.cjs';
2
- import { F as Field, j as RelationshipField, U as UploadField } from './types-VtjUxIMp.cjs';
3
-
4
- declare abstract class AbstractBaseAdapter implements BaseAdapter {
5
- protected collections: Map<string, CollectionConfig>;
6
- protected globals: Map<string, GlobalConfig>;
7
- protected connected: boolean;
8
- abstract connect(): Promise<void>;
9
- abstract disconnect(): Promise<void>;
10
- init(collections: CollectionConfig[], globals?: GlobalConfig[]): Promise<void>;
11
- abstract find<T>(args: FindArgs): Promise<FindResult<T>>;
12
- abstract findByID<T>(args: FindByIDArgs): Promise<T | null>;
13
- abstract create<T>(args: CreateArgs): Promise<T>;
14
- abstract update<T>(args: UpdateArgs): Promise<T>;
15
- abstract delete<T>(args: DeleteArgs): Promise<T>;
16
- abstract count(args: {
17
- collection: string;
18
- where?: Record<string, any>;
19
- tenantID?: string;
20
- }): Promise<number>;
21
- abstract findOne(args: {
22
- collection: string;
23
- where: Record<string, any>;
24
- tenantID?: string;
25
- draft?: boolean;
26
- }): Promise<any>;
27
- abstract findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
28
- abstract findVersionByID(args: {
29
- collection: string;
30
- versionId: string;
31
- tenantID?: string;
32
- }): Promise<VersionRecord | null>;
33
- abstract createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
34
- abstract deleteVersions(args: {
35
- collection: string;
36
- documentId: string;
37
- keepLatest?: number;
38
- tenantID?: string;
39
- }): Promise<void>;
40
- abstract findDraft<T>(args: DraftFindArgs): Promise<DraftSnapshot<T> | null>;
41
- abstract upsertDraft<T>(args: DraftUpsertArgs<T>): Promise<DraftSnapshot<T>>;
42
- abstract deleteDraft(args: DraftDeleteArgs): Promise<void>;
43
- migrate?(): Promise<void>;
44
- rollback?(): Promise<void>;
45
- transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
46
- protected getCollection(slug: string): CollectionConfig;
47
- protected applyTenantFilter(where?: Record<string, any>, tenantID?: string): Record<string, any>;
48
- protected getTableName(slug: string): string;
49
- protected prepareData(data: Record<string, any>, collection: CollectionConfig): Record<string, any>;
50
- protected processRelationships(data: Record<string, any>, fields: Field[], depth: number): Record<string, any>;
51
- protected parseSort(sort?: string): {
52
- field: string;
53
- direction: 'asc' | 'desc';
54
- };
55
- protected calculatePagination(page: number, limit: number, totalDocs: number): {
56
- totalDocs: number;
57
- limit: number;
58
- totalPages: number;
59
- page: number;
60
- pagingCounter: number;
61
- hasPrevPage: boolean;
62
- hasNextPage: boolean;
63
- prevPage: number | null;
64
- nextPage: number | null;
65
- };
66
- protected selectFields(data: Record<string, any>, select?: string[]): Record<string, any>;
67
- protected isRelationshipField(field: Field): field is RelationshipField;
68
- protected isUploadField(field: Field): field is UploadField;
69
- protected getRelationshipFields(fields: Field[]): RelationshipField[];
70
- protected getUploadFields(fields: Field[]): UploadField[];
71
- }
72
-
73
- export { AbstractBaseAdapter as A };
@@ -1,73 +0,0 @@
1
- import { B as BaseAdapter, C as CollectionConfig, G as GlobalConfig, F as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, e as UpdateArgs, D as DeleteArgs, f as FindVersionsArgs, g as VersionRecord, h as CreateVersionArgs, i as DraftFindArgs, j as DraftSnapshot, k as DraftUpsertArgs, l as DraftDeleteArgs } from './types-Bs1up4yP.js';
2
- import { F as Field, j as RelationshipField, U as UploadField } from './types-VtjUxIMp.js';
3
-
4
- declare abstract class AbstractBaseAdapter implements BaseAdapter {
5
- protected collections: Map<string, CollectionConfig>;
6
- protected globals: Map<string, GlobalConfig>;
7
- protected connected: boolean;
8
- abstract connect(): Promise<void>;
9
- abstract disconnect(): Promise<void>;
10
- init(collections: CollectionConfig[], globals?: GlobalConfig[]): Promise<void>;
11
- abstract find<T>(args: FindArgs): Promise<FindResult<T>>;
12
- abstract findByID<T>(args: FindByIDArgs): Promise<T | null>;
13
- abstract create<T>(args: CreateArgs): Promise<T>;
14
- abstract update<T>(args: UpdateArgs): Promise<T>;
15
- abstract delete<T>(args: DeleteArgs): Promise<T>;
16
- abstract count(args: {
17
- collection: string;
18
- where?: Record<string, any>;
19
- tenantID?: string;
20
- }): Promise<number>;
21
- abstract findOne(args: {
22
- collection: string;
23
- where: Record<string, any>;
24
- tenantID?: string;
25
- draft?: boolean;
26
- }): Promise<any>;
27
- abstract findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
28
- abstract findVersionByID(args: {
29
- collection: string;
30
- versionId: string;
31
- tenantID?: string;
32
- }): Promise<VersionRecord | null>;
33
- abstract createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
34
- abstract deleteVersions(args: {
35
- collection: string;
36
- documentId: string;
37
- keepLatest?: number;
38
- tenantID?: string;
39
- }): Promise<void>;
40
- abstract findDraft<T>(args: DraftFindArgs): Promise<DraftSnapshot<T> | null>;
41
- abstract upsertDraft<T>(args: DraftUpsertArgs<T>): Promise<DraftSnapshot<T>>;
42
- abstract deleteDraft(args: DraftDeleteArgs): Promise<void>;
43
- migrate?(): Promise<void>;
44
- rollback?(): Promise<void>;
45
- transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
46
- protected getCollection(slug: string): CollectionConfig;
47
- protected applyTenantFilter(where?: Record<string, any>, tenantID?: string): Record<string, any>;
48
- protected getTableName(slug: string): string;
49
- protected prepareData(data: Record<string, any>, collection: CollectionConfig): Record<string, any>;
50
- protected processRelationships(data: Record<string, any>, fields: Field[], depth: number): Record<string, any>;
51
- protected parseSort(sort?: string): {
52
- field: string;
53
- direction: 'asc' | 'desc';
54
- };
55
- protected calculatePagination(page: number, limit: number, totalDocs: number): {
56
- totalDocs: number;
57
- limit: number;
58
- totalPages: number;
59
- page: number;
60
- pagingCounter: number;
61
- hasPrevPage: boolean;
62
- hasNextPage: boolean;
63
- prevPage: number | null;
64
- nextPage: number | null;
65
- };
66
- protected selectFields(data: Record<string, any>, select?: string[]): Record<string, any>;
67
- protected isRelationshipField(field: Field): field is RelationshipField;
68
- protected isUploadField(field: Field): field is UploadField;
69
- protected getRelationshipFields(fields: Field[]): RelationshipField[];
70
- protected getUploadFields(fields: Field[]): UploadField[];
71
- }
72
-
73
- export { AbstractBaseAdapter as A };