@kyro-cms/core 0.12.15 → 0.12.16
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 +1 -1
- package/dist/WebhookService-ByrpAI4d.d.ts +143 -0
- package/dist/WebhookService-i-Kl3dvf.d.cts +143 -0
- package/dist/api-handler-graphql.d.cts +6 -0
- package/dist/api-handler-graphql.d.ts +6 -0
- package/dist/api-handler-trpc.d.cts +5 -0
- package/dist/api-handler-trpc.d.ts +5 -0
- package/dist/api-handler.d.cts +7 -0
- package/dist/api-handler.d.ts +7 -0
- package/dist/base-iyJTfH-3.d.cts +74 -0
- package/dist/base-oUSURe4_.d.ts +74 -0
- package/dist/cli/index.cjs +0 -0
- package/dist/cli/index.d.cts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/client.d.cts +12 -0
- package/dist/client.d.ts +12 -0
- package/dist/drizzle/index.d.cts +169 -0
- package/dist/drizzle/index.d.ts +169 -0
- package/dist/fields/index.d.cts +7 -0
- package/dist/fields/index.d.ts +7 -0
- package/dist/graphql/index.d.cts +57 -0
- package/dist/graphql/index.d.ts +57 -0
- package/dist/index-Bz9JqRGI.d.cts +86 -0
- package/dist/index-Bz9JqRGI.d.ts +86 -0
- package/dist/index-DNy8jbA2.d.cts +282 -0
- package/dist/index-DVDMEql7.d.ts +282 -0
- package/dist/index.d.cts +1246 -0
- package/dist/index.d.ts +1246 -0
- package/dist/integration.d.cts +14 -0
- package/dist/integration.d.ts +14 -0
- package/dist/mongodb/index.d.cts +134 -0
- package/dist/mongodb/index.d.ts +134 -0
- package/dist/rest/index.d.cts +56 -0
- package/dist/rest/index.d.ts +56 -0
- package/dist/richtext-DrhORshE.d.cts +5 -0
- package/dist/richtext-DrhORshE.d.ts +5 -0
- package/dist/templates/index.d.cts +107 -0
- package/dist/templates/index.d.ts +107 -0
- package/dist/trpc/index.d.cts +142 -0
- package/dist/trpc/index.d.ts +142 -0
- package/dist/types-BcZiluXL.d.cts +569 -0
- package/dist/types-CpjuXbe7.d.cts +150 -0
- package/dist/types-CpjuXbe7.d.ts +150 -0
- package/dist/types-Dc8VAPhF.d.ts +569 -0
- package/dist/types-euTszc-1.d.cts +294 -0
- package/dist/types-euTszc-1.d.ts +294 -0
- package/dist/ws/index.d.cts +88 -0
- package/dist/ws/index.d.ts +88 -0
- package/package.json +22 -25
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ Kyro preserves Astro compatibility with two entrypoints:
|
|
|
111
111
|
|
|
112
112
|
Kyro is designed as a modular ecosystem:
|
|
113
113
|
- `kyro-connect` — Universal, type-safe API client and codegen for any framework.
|
|
114
|
-
- `kyro-rich-text-react` — A headless React component for rendering Kyro's
|
|
114
|
+
- `kyro-rich-text-react` — A headless React component for rendering Kyro's Richtext JSON content.
|
|
115
115
|
---
|
|
116
116
|
|
|
117
117
|
## Example usage
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { B as BaseAdapter } from './types-Dc8VAPhF.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-BcZiluXL.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 };
|
|
@@ -0,0 +1,74 @@
|
|
|
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, e as UpdateArgs, D as DeleteArgs, f as FindVersionsArgs, g as VersionRecord, h as CreateVersionArgs } from './types-BcZiluXL.cjs';
|
|
2
|
+
import { F as Field, m as RelationshipField, U as UploadField } from './types-euTszc-1.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
|
+
protected tenantContext?: TenantContext;
|
|
9
|
+
abstract connect(): Promise<void>;
|
|
10
|
+
abstract disconnect(): Promise<void>;
|
|
11
|
+
setTenantContext(context: TenantContext | undefined): void;
|
|
12
|
+
getTenantContext(): TenantContext | undefined;
|
|
13
|
+
init(collections: CollectionConfig[], globals?: GlobalConfig[]): Promise<void>;
|
|
14
|
+
abstract find<T>(args: FindArgs): Promise<FindResult<T>>;
|
|
15
|
+
abstract findByID<T>(args: FindByIDArgs): Promise<T | null>;
|
|
16
|
+
abstract create<T>(args: CreateArgs): Promise<T>;
|
|
17
|
+
abstract update<T>(args: UpdateArgs): Promise<T>;
|
|
18
|
+
abstract delete<T>(args: DeleteArgs): Promise<T>;
|
|
19
|
+
abstract count(args: {
|
|
20
|
+
collection: string;
|
|
21
|
+
where?: Record<string, any>;
|
|
22
|
+
tenantId?: string;
|
|
23
|
+
}): Promise<number>;
|
|
24
|
+
abstract findOne(args: {
|
|
25
|
+
collection: string;
|
|
26
|
+
where: Record<string, any>;
|
|
27
|
+
tenantId?: string;
|
|
28
|
+
draft?: boolean;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
abstract findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
|
|
31
|
+
abstract findVersionByID(args: {
|
|
32
|
+
collection: string;
|
|
33
|
+
versionId: string;
|
|
34
|
+
tenantId?: string;
|
|
35
|
+
}): Promise<VersionRecord | null>;
|
|
36
|
+
abstract createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
|
|
37
|
+
abstract updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
|
|
38
|
+
abstract deleteVersions(args: {
|
|
39
|
+
collection: string;
|
|
40
|
+
documentId: string;
|
|
41
|
+
keepLatest?: number;
|
|
42
|
+
tenantId?: string;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
migrate?(): Promise<void>;
|
|
45
|
+
rollback?(): Promise<void>;
|
|
46
|
+
transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
|
|
47
|
+
protected getCollection(slug: string): CollectionConfig;
|
|
48
|
+
protected applyTenantFilter(where?: Record<string, any>, tenantId?: string): Record<string, any>;
|
|
49
|
+
protected getTableName(slug: string): string;
|
|
50
|
+
protected prepareData(data: Record<string, any>, collection: CollectionConfig): Record<string, any>;
|
|
51
|
+
protected processRelationships(data: Record<string, any>, fields: Field[], depth: number): Record<string, any>;
|
|
52
|
+
protected parseSort(sort?: string): {
|
|
53
|
+
field: string;
|
|
54
|
+
direction: 'asc' | 'desc';
|
|
55
|
+
};
|
|
56
|
+
protected calculatePagination(page: number, limit: number, totalDocs: number): {
|
|
57
|
+
totalDocs: number;
|
|
58
|
+
limit: number;
|
|
59
|
+
totalPages: number;
|
|
60
|
+
page: number;
|
|
61
|
+
pagingCounter: number;
|
|
62
|
+
hasPrevPage: boolean;
|
|
63
|
+
hasNextPage: boolean;
|
|
64
|
+
prevPage: number | null;
|
|
65
|
+
nextPage: number | null;
|
|
66
|
+
};
|
|
67
|
+
protected selectFields(data: Record<string, any>, select?: string[]): Record<string, any>;
|
|
68
|
+
protected isRelationshipField(field: Field): field is RelationshipField;
|
|
69
|
+
protected isUploadField(field: Field): field is UploadField;
|
|
70
|
+
protected getRelationshipFields(fields: Field[]): RelationshipField[];
|
|
71
|
+
protected getUploadFields(fields: Field[]): UploadField[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { AbstractBaseAdapter as A };
|
|
@@ -0,0 +1,74 @@
|
|
|
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, e as UpdateArgs, D as DeleteArgs, f as FindVersionsArgs, g as VersionRecord, h as CreateVersionArgs } from './types-Dc8VAPhF.js';
|
|
2
|
+
import { F as Field, m as RelationshipField, U as UploadField } from './types-euTszc-1.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
|
+
protected tenantContext?: TenantContext;
|
|
9
|
+
abstract connect(): Promise<void>;
|
|
10
|
+
abstract disconnect(): Promise<void>;
|
|
11
|
+
setTenantContext(context: TenantContext | undefined): void;
|
|
12
|
+
getTenantContext(): TenantContext | undefined;
|
|
13
|
+
init(collections: CollectionConfig[], globals?: GlobalConfig[]): Promise<void>;
|
|
14
|
+
abstract find<T>(args: FindArgs): Promise<FindResult<T>>;
|
|
15
|
+
abstract findByID<T>(args: FindByIDArgs): Promise<T | null>;
|
|
16
|
+
abstract create<T>(args: CreateArgs): Promise<T>;
|
|
17
|
+
abstract update<T>(args: UpdateArgs): Promise<T>;
|
|
18
|
+
abstract delete<T>(args: DeleteArgs): Promise<T>;
|
|
19
|
+
abstract count(args: {
|
|
20
|
+
collection: string;
|
|
21
|
+
where?: Record<string, any>;
|
|
22
|
+
tenantId?: string;
|
|
23
|
+
}): Promise<number>;
|
|
24
|
+
abstract findOne(args: {
|
|
25
|
+
collection: string;
|
|
26
|
+
where: Record<string, any>;
|
|
27
|
+
tenantId?: string;
|
|
28
|
+
draft?: boolean;
|
|
29
|
+
}): Promise<any>;
|
|
30
|
+
abstract findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
|
|
31
|
+
abstract findVersionByID(args: {
|
|
32
|
+
collection: string;
|
|
33
|
+
versionId: string;
|
|
34
|
+
tenantId?: string;
|
|
35
|
+
}): Promise<VersionRecord | null>;
|
|
36
|
+
abstract createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
|
|
37
|
+
abstract updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
|
|
38
|
+
abstract deleteVersions(args: {
|
|
39
|
+
collection: string;
|
|
40
|
+
documentId: string;
|
|
41
|
+
keepLatest?: number;
|
|
42
|
+
tenantId?: string;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
migrate?(): Promise<void>;
|
|
45
|
+
rollback?(): Promise<void>;
|
|
46
|
+
transaction?<T>(fn: (tx: any) => Promise<T>): Promise<T>;
|
|
47
|
+
protected getCollection(slug: string): CollectionConfig;
|
|
48
|
+
protected applyTenantFilter(where?: Record<string, any>, tenantId?: string): Record<string, any>;
|
|
49
|
+
protected getTableName(slug: string): string;
|
|
50
|
+
protected prepareData(data: Record<string, any>, collection: CollectionConfig): Record<string, any>;
|
|
51
|
+
protected processRelationships(data: Record<string, any>, fields: Field[], depth: number): Record<string, any>;
|
|
52
|
+
protected parseSort(sort?: string): {
|
|
53
|
+
field: string;
|
|
54
|
+
direction: 'asc' | 'desc';
|
|
55
|
+
};
|
|
56
|
+
protected calculatePagination(page: number, limit: number, totalDocs: number): {
|
|
57
|
+
totalDocs: number;
|
|
58
|
+
limit: number;
|
|
59
|
+
totalPages: number;
|
|
60
|
+
page: number;
|
|
61
|
+
pagingCounter: number;
|
|
62
|
+
hasPrevPage: boolean;
|
|
63
|
+
hasNextPage: boolean;
|
|
64
|
+
prevPage: number | null;
|
|
65
|
+
nextPage: number | null;
|
|
66
|
+
};
|
|
67
|
+
protected selectFields(data: Record<string, any>, select?: string[]): Record<string, any>;
|
|
68
|
+
protected isRelationshipField(field: Field): field is RelationshipField;
|
|
69
|
+
protected isUploadField(field: Field): field is UploadField;
|
|
70
|
+
protected getRelationshipFields(fields: Field[]): RelationshipField[];
|
|
71
|
+
protected getUploadFields(fields: Field[]): UploadField[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { AbstractBaseAdapter as A };
|
package/dist/cli/index.cjs
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { A as AdminConfig, a as AuthConfig, C as CollectionConfig, G as GlobalConfig, I as ImageSize, K as KyroConfig, U as UploadConfig, V as VersionConfig } from './types-BcZiluXL.cjs';
|
|
2
|
+
export { A as ALL_FIELD_TYPES, a as ArrayField, B as BaseField, b as Block, c as BlockAdmin, d as BlockImage, e as BlocksField, C as CheckboxField, f as CodeField, g as CollapsibleField, h as ColorField, D as DateField, i as DeclarativeCondition, E as EmailField, F as Field, j as FieldAdmin, k as FieldType, G as GroupField, I as IconField, l as ImageField, J as JSONField, M as MarkdownField, N as NumberField, P as PasswordField, R as RadioField, m as RelationshipField, n as RichTextBlock, o as RichTextField, p as RowField, S as SecretField, q as SelectField, T as TabsField, r as TextField, s as TextareaField, U as UploadField } from './types-euTszc-1.cjs';
|
|
3
|
+
export { r as renderRichText, a as richTextStyles } from './richtext-DrhORshE.cjs';
|
|
4
|
+
export { A as AuthAdapter, a as AuthResult, S as AuthSession, b as AuthTokenConfig, c as AuthUser, J as JWTPayload, L as LoginCredentials, R as RegisterData, S as Session, U as UserRole } from './types-CpjuXbe7.cjs';
|
|
5
|
+
export { A as AdminStylingConfig, C as CSSGenerator, F as FieldStyling, S as StylingConfig, a as StylingMode, T as ThemeBorderRadius, b as ThemeColors, c as ThemeConfig, d as ThemeFonts, e as ThemeShadows, f as ThemeSpacing, g as createAdminStyling, h as defaultDarkTheme, i as defaultFieldStyling, j as defaultLightTheme, k as ecommerce2026Theme, l as generateCSSVariables, m as generateTailwindConfig } from './index-Bz9JqRGI.cjs';
|
|
6
|
+
|
|
7
|
+
declare function createAuditContext(req: Request): {
|
|
8
|
+
ipAddress: string;
|
|
9
|
+
userAgent: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { createAuditContext };
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { A as AdminConfig, a as AuthConfig, C as CollectionConfig, G as GlobalConfig, I as ImageSize, K as KyroConfig, U as UploadConfig, V as VersionConfig } from './types-Dc8VAPhF.js';
|
|
2
|
+
export { A as ALL_FIELD_TYPES, a as ArrayField, B as BaseField, b as Block, c as BlockAdmin, d as BlockImage, e as BlocksField, C as CheckboxField, f as CodeField, g as CollapsibleField, h as ColorField, D as DateField, i as DeclarativeCondition, E as EmailField, F as Field, j as FieldAdmin, k as FieldType, G as GroupField, I as IconField, l as ImageField, J as JSONField, M as MarkdownField, N as NumberField, P as PasswordField, R as RadioField, m as RelationshipField, n as RichTextBlock, o as RichTextField, p as RowField, S as SecretField, q as SelectField, T as TabsField, r as TextField, s as TextareaField, U as UploadField } from './types-euTszc-1.js';
|
|
3
|
+
export { r as renderRichText, a as richTextStyles } from './richtext-DrhORshE.js';
|
|
4
|
+
export { A as AuthAdapter, a as AuthResult, S as AuthSession, b as AuthTokenConfig, c as AuthUser, J as JWTPayload, L as LoginCredentials, R as RegisterData, S as Session, U as UserRole } from './types-CpjuXbe7.js';
|
|
5
|
+
export { A as AdminStylingConfig, C as CSSGenerator, F as FieldStyling, S as StylingConfig, a as StylingMode, T as ThemeBorderRadius, b as ThemeColors, c as ThemeConfig, d as ThemeFonts, e as ThemeShadows, f as ThemeSpacing, g as createAdminStyling, h as defaultDarkTheme, i as defaultFieldStyling, j as defaultLightTheme, k as ecommerce2026Theme, l as generateCSSVariables, m as generateTailwindConfig } from './index-Bz9JqRGI.js';
|
|
6
|
+
|
|
7
|
+
declare function createAuditContext(req: Request): {
|
|
8
|
+
ipAddress: string;
|
|
9
|
+
userAgent: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { createAuditContext };
|