@zenith-open/zenithcms-types 0.1.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/dist/database.d.ts +111 -0
- package/dist/database.js +2 -0
- package/dist/database.js.map +1 -0
- package/dist/generated.d.ts +138 -0
- package/dist/generated.js +7 -0
- package/dist/generated.js.map +1 -0
- package/dist/index.d.ts +353 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/package.json +16 -0
- package/src/database.d.ts +84 -0
- package/src/database.js +1 -0
- package/src/database.js.map +1 -0
- package/src/database.ts +164 -0
- package/src/generated.d.ts +274 -0
- package/src/generated.js +7 -0
- package/src/generated.js.map +1 -0
- package/src/generated.ts +143 -0
- package/src/index.d.ts +193 -0
- package/src/index.js +9 -0
- package/src/index.js.map +1 -0
- package/src/index.ts +378 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { CollectionConfig } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* Zenith Database Adapter Contract
|
|
4
|
+
* ────────────────────────────────
|
|
5
|
+
* Hardened interface for database agnostic operations.
|
|
6
|
+
* Use generics <T> to ensure type safety in higher level services.
|
|
7
|
+
*/
|
|
8
|
+
export interface DatabaseAdapter {
|
|
9
|
+
name: string;
|
|
10
|
+
connect(): Promise<void>;
|
|
11
|
+
disconnect(): Promise<void>;
|
|
12
|
+
getHealth(): 'ok' | 'connecting' | 'disconnected' | 'error';
|
|
13
|
+
/** Syncs the provided collection config with the physical DB schema */
|
|
14
|
+
registerCollection(config: CollectionConfig): Promise<void>;
|
|
15
|
+
/** Lists all existing collections/tables in the database */
|
|
16
|
+
getExistingCollections(): Promise<string[]>;
|
|
17
|
+
find<T = unknown>(collection: string, query: Record<string, unknown>, options?: FindOptions): Promise<T[]>;
|
|
18
|
+
findOne<T = unknown>(collection: string, query: Record<string, unknown>, options?: BaseOptions): Promise<T | null>;
|
|
19
|
+
create<T = unknown>(collection: string, data: Partial<T>, options?: BaseOptions): Promise<T>;
|
|
20
|
+
update<T = unknown>(collection: string, id: string, data: Partial<T>, options?: BaseOptions): Promise<T | null>;
|
|
21
|
+
updateMany(collection: string, query: Record<string, unknown>, data: unknown, options?: BaseOptions): Promise<number>;
|
|
22
|
+
delete(collection: string, id: string, options?: BaseOptions): Promise<boolean>;
|
|
23
|
+
deleteMany(collection: string, query: Record<string, unknown>, options?: BaseOptions): Promise<number>;
|
|
24
|
+
count(collection: string, query: Record<string, unknown>): Promise<number>;
|
|
25
|
+
aggregate<T = unknown>(collection: string, pipeline: unknown[]): Promise<T[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Executes multiple operations in a transaction.
|
|
28
|
+
* If the adapter does not support transactions (e.g. standalone Mongo),
|
|
29
|
+
* this will execute the function without a transaction context.
|
|
30
|
+
*/
|
|
31
|
+
transaction<T>(fn: (session: unknown) => Promise<T>): Promise<T>;
|
|
32
|
+
createAuditLog(data: AuditLogData): Promise<void>;
|
|
33
|
+
createVersion(data: VersionData): Promise<void>;
|
|
34
|
+
getVersions(collection: string, documentId: string): Promise<VersionData[]>;
|
|
35
|
+
createWebhookDelivery(data: WebhookDeliveryData): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Full-text / pattern search across specified fields in a collection.
|
|
38
|
+
* Each adapter translates this into its native search primitive
|
|
39
|
+
* (MongoDB $regex/$text, Postgres ILIKE/pg_trgm).
|
|
40
|
+
*/
|
|
41
|
+
search<T = unknown>(collection: string, query: string, fields: string[], limit?: number, options?: BaseOptions): Promise<T[]>;
|
|
42
|
+
}
|
|
43
|
+
export interface BaseOptions {
|
|
44
|
+
session?: unknown;
|
|
45
|
+
tenantId?: string;
|
|
46
|
+
siteId?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface FindOptions extends BaseOptions {
|
|
49
|
+
sort?: string | Record<string, unknown>;
|
|
50
|
+
skip?: number;
|
|
51
|
+
limit?: number;
|
|
52
|
+
select?: string | string[];
|
|
53
|
+
populate?: string | string[];
|
|
54
|
+
}
|
|
55
|
+
export interface AuditLogData {
|
|
56
|
+
userId: string;
|
|
57
|
+
userEmail: string;
|
|
58
|
+
action: string;
|
|
59
|
+
collectionName: string;
|
|
60
|
+
documentId?: string;
|
|
61
|
+
changes?: unknown;
|
|
62
|
+
ip?: string;
|
|
63
|
+
userAgent?: string;
|
|
64
|
+
timestamp?: Date;
|
|
65
|
+
}
|
|
66
|
+
export interface VersionData {
|
|
67
|
+
collectionName: string;
|
|
68
|
+
collectionSlug: string;
|
|
69
|
+
documentId: string;
|
|
70
|
+
snapshot: unknown;
|
|
71
|
+
delta?: unknown;
|
|
72
|
+
createdBy: string;
|
|
73
|
+
timestamp: Date;
|
|
74
|
+
}
|
|
75
|
+
export interface WebhookDeliveryData {
|
|
76
|
+
collectionSlug?: string;
|
|
77
|
+
event: string;
|
|
78
|
+
url: string;
|
|
79
|
+
payload?: unknown;
|
|
80
|
+
success: boolean;
|
|
81
|
+
responseStatus?: number;
|
|
82
|
+
timestamp?: Date;
|
|
83
|
+
}
|
|
84
|
+
|
package/src/database.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// Database types module (interfaces only)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["database.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAA;AAgIvB,MAAM,OAAO,mBAAmB;IAGV;IAFZ,YAAY,CAAS;IAE7B,YAAoB,cAA+B;QAA/B,mBAAc,GAAd,cAAc,CAAiB;QACjD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAA;IAC3D,CAAC;IAEM,KAAK,CAAC,IAAI,CACf,UAAkB,EAClB,KAA8B,EAC9B,OAAqB;QAErB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBAC5E,oEAAoE;gBACpE,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAA;gBAC/E,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,WAAW,UAAU,CAAC,CAAA;gBAC5D,IAAI,MAAM,EAAE,CAAC;oBACX,MAAM,cAAc,GAAG,IAAI,CAAC,cAAqB,CAAA;oBACjD,MAAM,QAAQ,GAAG,CAAC,OAAO,cAAc,CAAC,WAAW,KAAK,UAAU,CAAC;wBACjE,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC;wBACrC,CAAC,CAAC,cAAc,CAAC,EAAE,CAAA;oBACrB,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,CAAA;oBACvD,OAAO,MAAM,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;gBAC5D,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,2CAA2C;YAC7C,CAAC;QACH,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAI,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAc,UAAkB,EAAE,IAAgB,EAAE,OAAqB;QAC1F,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;gBAC5E,oEAAoE;gBACpE,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAA;gBAC/E,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,WAAW,UAAU,CAAC,CAAA;gBAC/D,IAAI,OAAO,EAAE,CAAC;oBACZ,MAAM,cAAc,GAAG,IAAI,CAAC,cAAqB,CAAA;oBACjD,MAAM,QAAQ,GAAG,CAAC,OAAO,cAAc,CAAC,WAAW,KAAK,UAAU,CAAC;wBACjE,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC;wBACrC,CAAC,CAAC,cAAc,CAAC,EAAE,CAAA;oBACrB,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,UAAU,CAAC,CAAA;oBACvD,OAAO,MAAM,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;gBAC5D,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,2CAA2C;YAC7C,CAAC;QACH,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAI,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACvE,CAAC;CACF"}
|
package/src/database.ts
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { CollectionConfig } from './index'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Zenith Database Adapter Contract
|
|
5
|
+
* ────────────────────────────────
|
|
6
|
+
* Hardened interface for database agnostic operations.
|
|
7
|
+
* Use generics <T> to ensure type safety in higher level services.
|
|
8
|
+
*/
|
|
9
|
+
export interface DatabaseAdapter {
|
|
10
|
+
name: string
|
|
11
|
+
|
|
12
|
+
// ── Initialization ────────────────────────────────────────────────────────
|
|
13
|
+
connect(): Promise<void>
|
|
14
|
+
disconnect(): Promise<void>
|
|
15
|
+
getHealth(): 'ok' | 'connecting' | 'disconnected' | 'error'
|
|
16
|
+
|
|
17
|
+
// ── Schema Management ─────────────────────────────────────────────────────
|
|
18
|
+
/** Syncs the provided collection config with the physical DB schema */
|
|
19
|
+
registerCollection(config: CollectionConfig): Promise<void>
|
|
20
|
+
|
|
21
|
+
/** Lists all existing collections/tables in the database */
|
|
22
|
+
getExistingCollections(): Promise<string[]>
|
|
23
|
+
|
|
24
|
+
// ── CRUD Operations ───────────────────────────────────────────────────────
|
|
25
|
+
find<T = unknown>(
|
|
26
|
+
collection: string,
|
|
27
|
+
query: Record<string, unknown>,
|
|
28
|
+
options?: FindOptions
|
|
29
|
+
): Promise<T[]>
|
|
30
|
+
findOne<T = unknown>(
|
|
31
|
+
collection: string,
|
|
32
|
+
query: Record<string, unknown>,
|
|
33
|
+
options?: BaseOptions
|
|
34
|
+
): Promise<T | null>
|
|
35
|
+
create<T = unknown>(collection: string, data: Partial<T>, options?: BaseOptions): Promise<T>
|
|
36
|
+
update<T = unknown>(
|
|
37
|
+
collection: string,
|
|
38
|
+
id: string,
|
|
39
|
+
data: Partial<T>,
|
|
40
|
+
options?: BaseOptions
|
|
41
|
+
): Promise<T | null>
|
|
42
|
+
updateMany(
|
|
43
|
+
collection: string,
|
|
44
|
+
query: Record<string, unknown>,
|
|
45
|
+
data: unknown,
|
|
46
|
+
options?: BaseOptions
|
|
47
|
+
): Promise<number>
|
|
48
|
+
delete(collection: string, id: string, options?: BaseOptions): Promise<boolean>
|
|
49
|
+
deleteMany(
|
|
50
|
+
collection: string,
|
|
51
|
+
query: Record<string, unknown>,
|
|
52
|
+
options?: BaseOptions
|
|
53
|
+
): Promise<number>
|
|
54
|
+
|
|
55
|
+
// ── Advanced Operations ───────────────────────────────────────────────────
|
|
56
|
+
count(collection: string, query: Record<string, unknown>): Promise<number>
|
|
57
|
+
aggregate<T = unknown>(collection: string, pipeline: unknown[], options?: BaseOptions): Promise<T[]>
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Atomically finds a single document and updates it, returning either
|
|
61
|
+
* the original (returnDocument: 'before') or updated (returnDocument: 'after') document.
|
|
62
|
+
* Returns null if no document matches the query.
|
|
63
|
+
*/
|
|
64
|
+
findOneAndUpdate<T = unknown>(
|
|
65
|
+
collection: string,
|
|
66
|
+
query: Record<string, unknown>,
|
|
67
|
+
update: Record<string, unknown>,
|
|
68
|
+
options?: BaseOptions & { returnDocument?: 'before' | 'after' }
|
|
69
|
+
): Promise<T | null>
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Executes multiple operations in a transaction.
|
|
73
|
+
* If the adapter does not support transactions (e.g. standalone Mongo),
|
|
74
|
+
* this will execute the function without a transaction context.
|
|
75
|
+
*/
|
|
76
|
+
transaction<T>(fn: (session: unknown) => Promise<T>): Promise<T>
|
|
77
|
+
|
|
78
|
+
// ── Zenith Engine Features ────────────────────────────────────────────────
|
|
79
|
+
createAuditLog(data: AuditLogData, options?: BaseOptions): Promise<void>
|
|
80
|
+
createVersion(data: VersionData, options?: BaseOptions): Promise<void>
|
|
81
|
+
getVersions(collection: string, documentId: string): Promise<VersionData[]>
|
|
82
|
+
createWebhookDelivery(data: WebhookDeliveryData): Promise<void>
|
|
83
|
+
getWebhookDeliveries(webhookId: string, limit?: number): Promise<WebhookDeliveryRecord[]>
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Full-text / pattern search across specified fields in a collection.
|
|
87
|
+
* Each adapter translates this into its native search primitive
|
|
88
|
+
* (MongoDB $regex/$text, Postgres ILIKE/pg_trgm).
|
|
89
|
+
*/
|
|
90
|
+
search<T = unknown>(
|
|
91
|
+
collection: string,
|
|
92
|
+
query: string,
|
|
93
|
+
fields: string[],
|
|
94
|
+
limit?: number,
|
|
95
|
+
options?: BaseOptions
|
|
96
|
+
): Promise<T[]>
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface BaseOptions {
|
|
100
|
+
session?: unknown
|
|
101
|
+
tenantId?: string
|
|
102
|
+
siteId?: string
|
|
103
|
+
expectedVersion?: number
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface FindOptions extends BaseOptions {
|
|
107
|
+
sort?: string | Record<string, unknown>
|
|
108
|
+
skip?: number
|
|
109
|
+
limit?: number
|
|
110
|
+
select?: string | string[]
|
|
111
|
+
populate?: string | string[]
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface AuditLogData {
|
|
115
|
+
userId: string
|
|
116
|
+
userEmail: string
|
|
117
|
+
userName?: string
|
|
118
|
+
action: string
|
|
119
|
+
collectionName: string
|
|
120
|
+
documentId?: string
|
|
121
|
+
changes?: unknown
|
|
122
|
+
ip?: string
|
|
123
|
+
userAgent?: string
|
|
124
|
+
timestamp?: Date
|
|
125
|
+
status?: 'success' | 'failed'
|
|
126
|
+
resource?: string
|
|
127
|
+
siteId?: string
|
|
128
|
+
hash?: string
|
|
129
|
+
previousHash?: string
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface VersionData {
|
|
133
|
+
collectionName: string
|
|
134
|
+
collectionSlug: string
|
|
135
|
+
documentId: string
|
|
136
|
+
snapshot: unknown
|
|
137
|
+
delta?: unknown
|
|
138
|
+
createdBy: string
|
|
139
|
+
timestamp: Date
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface WebhookDeliveryData {
|
|
143
|
+
webhookId?: string
|
|
144
|
+
collectionSlug?: string
|
|
145
|
+
event: string
|
|
146
|
+
url: string
|
|
147
|
+
payload?: unknown
|
|
148
|
+
success: boolean
|
|
149
|
+
responseStatus?: number
|
|
150
|
+
timestamp?: Date
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface WebhookDeliveryRecord {
|
|
154
|
+
id: string
|
|
155
|
+
webhookId?: string
|
|
156
|
+
collectionSlug?: string
|
|
157
|
+
event: string
|
|
158
|
+
url: string
|
|
159
|
+
payload?: unknown
|
|
160
|
+
success: boolean
|
|
161
|
+
responseStatus?: number
|
|
162
|
+
timestamp: Date | string
|
|
163
|
+
}
|
|
164
|
+
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zenith Auto-Generated TypeScript Definitions
|
|
3
|
+
* This file is automatically re-compiled on database register & boot.
|
|
4
|
+
* DO NOT MODIFY MANUALLY.
|
|
5
|
+
*/
|
|
6
|
+
export interface ZenithDocument {
|
|
7
|
+
_id: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
updatedAt: string;
|
|
10
|
+
status?: 'draft' | 'published';
|
|
11
|
+
}
|
|
12
|
+
export interface Posts extends ZenithDocument {
|
|
13
|
+
title: string;
|
|
14
|
+
slug: string;
|
|
15
|
+
content?: any;
|
|
16
|
+
coverImage?: any;
|
|
17
|
+
tags?: any;
|
|
18
|
+
publishedAt?: string | Date;
|
|
19
|
+
sections?: ({
|
|
20
|
+
blockType: 'hero';
|
|
21
|
+
headline?: string;
|
|
22
|
+
subheadline?: string;
|
|
23
|
+
callToAction?: string;
|
|
24
|
+
backgroundImage?: any;
|
|
25
|
+
} | {
|
|
26
|
+
blockType: 'features';
|
|
27
|
+
heading?: string;
|
|
28
|
+
featureList?: {
|
|
29
|
+
title?: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
icon?: any;
|
|
32
|
+
}[];
|
|
33
|
+
} | {
|
|
34
|
+
blockType: 'testimonials';
|
|
35
|
+
heading?: string;
|
|
36
|
+
items?: {
|
|
37
|
+
quote?: string;
|
|
38
|
+
author?: string;
|
|
39
|
+
role?: string;
|
|
40
|
+
avatar?: any;
|
|
41
|
+
}[];
|
|
42
|
+
} | {
|
|
43
|
+
blockType: 'pricing';
|
|
44
|
+
heading?: string;
|
|
45
|
+
plans?: {
|
|
46
|
+
name?: string;
|
|
47
|
+
price?: string;
|
|
48
|
+
features?: string;
|
|
49
|
+
buttonText?: string;
|
|
50
|
+
isPopular?: boolean;
|
|
51
|
+
}[];
|
|
52
|
+
} | {
|
|
53
|
+
blockType: 'faq';
|
|
54
|
+
heading?: string;
|
|
55
|
+
questions?: {
|
|
56
|
+
question?: string;
|
|
57
|
+
answer?: string;
|
|
58
|
+
}[];
|
|
59
|
+
} | {
|
|
60
|
+
blockType: 'cta';
|
|
61
|
+
title?: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
buttonText?: string;
|
|
64
|
+
link?: string;
|
|
65
|
+
} | {
|
|
66
|
+
blockType: 'stats';
|
|
67
|
+
items?: {
|
|
68
|
+
value?: string;
|
|
69
|
+
label?: string;
|
|
70
|
+
}[];
|
|
71
|
+
} | {
|
|
72
|
+
blockType: 'richTextSection';
|
|
73
|
+
content?: any;
|
|
74
|
+
})[];
|
|
75
|
+
seoTitle?: string;
|
|
76
|
+
seoDescription?: string;
|
|
77
|
+
ogImage?: any;
|
|
78
|
+
}
|
|
79
|
+
export interface Authors extends ZenithDocument {
|
|
80
|
+
name: string;
|
|
81
|
+
email: string;
|
|
82
|
+
bio?: string;
|
|
83
|
+
avatar?: any;
|
|
84
|
+
}
|
|
85
|
+
export interface Products extends ZenithDocument {
|
|
86
|
+
title: string;
|
|
87
|
+
price: number;
|
|
88
|
+
description?: any;
|
|
89
|
+
gallery?: any;
|
|
90
|
+
inStock?: boolean;
|
|
91
|
+
specs?: {
|
|
92
|
+
weight?: number;
|
|
93
|
+
color?: string;
|
|
94
|
+
sku?: string;
|
|
95
|
+
};
|
|
96
|
+
category: any;
|
|
97
|
+
layout?: ({
|
|
98
|
+
blockType: 'hero';
|
|
99
|
+
headline?: string;
|
|
100
|
+
} | {
|
|
101
|
+
blockType: 'features';
|
|
102
|
+
items?: {
|
|
103
|
+
title?: string;
|
|
104
|
+
}[];
|
|
105
|
+
} | {
|
|
106
|
+
blockType: 'stats';
|
|
107
|
+
items?: {
|
|
108
|
+
value?: string;
|
|
109
|
+
}[];
|
|
110
|
+
})[];
|
|
111
|
+
slug?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface Pages extends ZenithDocument {
|
|
114
|
+
meta?: any;
|
|
115
|
+
title: string;
|
|
116
|
+
slug: string;
|
|
117
|
+
sections?: ({
|
|
118
|
+
blockType: 'hero';
|
|
119
|
+
headline?: string;
|
|
120
|
+
subheadline?: string;
|
|
121
|
+
callToAction?: string;
|
|
122
|
+
backgroundImage?: any;
|
|
123
|
+
} | {
|
|
124
|
+
blockType: 'features';
|
|
125
|
+
heading?: string;
|
|
126
|
+
featureList?: {
|
|
127
|
+
title?: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
icon?: any;
|
|
130
|
+
}[];
|
|
131
|
+
} | {
|
|
132
|
+
blockType: 'testimonials';
|
|
133
|
+
heading?: string;
|
|
134
|
+
items?: {
|
|
135
|
+
quote?: string;
|
|
136
|
+
author?: string;
|
|
137
|
+
role?: string;
|
|
138
|
+
avatar?: any;
|
|
139
|
+
}[];
|
|
140
|
+
} | {
|
|
141
|
+
blockType: 'pricing';
|
|
142
|
+
heading?: string;
|
|
143
|
+
plans?: {
|
|
144
|
+
name?: string;
|
|
145
|
+
price?: string;
|
|
146
|
+
features?: string;
|
|
147
|
+
buttonText?: string;
|
|
148
|
+
isPopular?: boolean;
|
|
149
|
+
}[];
|
|
150
|
+
} | {
|
|
151
|
+
blockType: 'faq';
|
|
152
|
+
heading?: string;
|
|
153
|
+
questions?: {
|
|
154
|
+
question?: string;
|
|
155
|
+
answer?: string;
|
|
156
|
+
}[];
|
|
157
|
+
} | {
|
|
158
|
+
blockType: 'cta';
|
|
159
|
+
title?: string;
|
|
160
|
+
description?: string;
|
|
161
|
+
buttonText?: string;
|
|
162
|
+
link?: string;
|
|
163
|
+
} | {
|
|
164
|
+
blockType: 'stats';
|
|
165
|
+
items?: {
|
|
166
|
+
value?: string;
|
|
167
|
+
label?: string;
|
|
168
|
+
}[];
|
|
169
|
+
} | {
|
|
170
|
+
blockType: 'richTextSection';
|
|
171
|
+
content?: any;
|
|
172
|
+
})[];
|
|
173
|
+
seoTitle?: string;
|
|
174
|
+
seoDescription?: string;
|
|
175
|
+
ogImage?: any;
|
|
176
|
+
}
|
|
177
|
+
export interface Members extends ZenithDocument {
|
|
178
|
+
email: string;
|
|
179
|
+
name?: string;
|
|
180
|
+
subscriptionStatus?: any;
|
|
181
|
+
isSubscribed?: boolean;
|
|
182
|
+
activity?: any;
|
|
183
|
+
avatar?: any;
|
|
184
|
+
bio?: string;
|
|
185
|
+
}
|
|
186
|
+
export interface Media extends ZenithDocument {
|
|
187
|
+
name?: string;
|
|
188
|
+
url?: string;
|
|
189
|
+
alt?: string;
|
|
190
|
+
folder?: string;
|
|
191
|
+
mimetype?: string;
|
|
192
|
+
size?: number;
|
|
193
|
+
}
|
|
194
|
+
export interface LandingPage extends ZenithDocument {
|
|
195
|
+
title: string;
|
|
196
|
+
heroDescription?: any;
|
|
197
|
+
sections?: ({
|
|
198
|
+
blockType: 'hero';
|
|
199
|
+
headline?: string;
|
|
200
|
+
subheadline?: string;
|
|
201
|
+
callToAction?: string;
|
|
202
|
+
backgroundImage?: any;
|
|
203
|
+
} | {
|
|
204
|
+
blockType: 'features';
|
|
205
|
+
heading?: string;
|
|
206
|
+
featureList?: {
|
|
207
|
+
title?: string;
|
|
208
|
+
description?: string;
|
|
209
|
+
icon?: any;
|
|
210
|
+
}[];
|
|
211
|
+
} | {
|
|
212
|
+
blockType: 'testimonials';
|
|
213
|
+
heading?: string;
|
|
214
|
+
items?: {
|
|
215
|
+
quote?: string;
|
|
216
|
+
author?: string;
|
|
217
|
+
role?: string;
|
|
218
|
+
avatar?: any;
|
|
219
|
+
}[];
|
|
220
|
+
} | {
|
|
221
|
+
blockType: 'pricing';
|
|
222
|
+
heading?: string;
|
|
223
|
+
plans?: {
|
|
224
|
+
name?: string;
|
|
225
|
+
price?: string;
|
|
226
|
+
features?: string;
|
|
227
|
+
buttonText?: string;
|
|
228
|
+
isPopular?: boolean;
|
|
229
|
+
}[];
|
|
230
|
+
} | {
|
|
231
|
+
blockType: 'faq';
|
|
232
|
+
heading?: string;
|
|
233
|
+
questions?: {
|
|
234
|
+
question?: string;
|
|
235
|
+
answer?: string;
|
|
236
|
+
}[];
|
|
237
|
+
} | {
|
|
238
|
+
blockType: 'cta';
|
|
239
|
+
title?: string;
|
|
240
|
+
description?: string;
|
|
241
|
+
buttonText?: string;
|
|
242
|
+
link?: string;
|
|
243
|
+
} | {
|
|
244
|
+
blockType: 'stats';
|
|
245
|
+
items?: {
|
|
246
|
+
value?: string;
|
|
247
|
+
label?: string;
|
|
248
|
+
}[];
|
|
249
|
+
} | {
|
|
250
|
+
blockType: 'richTextSection';
|
|
251
|
+
content?: any;
|
|
252
|
+
})[];
|
|
253
|
+
}
|
|
254
|
+
export interface ZenithCollections {
|
|
255
|
+
posts: Posts;
|
|
256
|
+
authors: Authors;
|
|
257
|
+
products: Products;
|
|
258
|
+
pages: Pages;
|
|
259
|
+
members: Members;
|
|
260
|
+
media: Media;
|
|
261
|
+
'landing-page': LandingPage;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Fully Typed React SDK Data Hook Mappings
|
|
265
|
+
*/
|
|
266
|
+
export type ZenithQuery<T> = {
|
|
267
|
+
where?: Record<string, any>;
|
|
268
|
+
sort?: string | Record<string, any>;
|
|
269
|
+
limit?: number;
|
|
270
|
+
skip?: number;
|
|
271
|
+
select?: string[];
|
|
272
|
+
populate?: string[];
|
|
273
|
+
locale?: string;
|
|
274
|
+
};
|
package/src/generated.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated.js","sourceRoot":"","sources":["generated.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/src/generated.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zenith Auto-Generated TypeScript Definitions
|
|
3
|
+
* This file is automatically re-compiled on database register & boot.
|
|
4
|
+
* DO NOT MODIFY MANUALLY.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface ZenithDocument {
|
|
8
|
+
_id: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
updatedAt: string;
|
|
11
|
+
status?: 'draft' | 'published' | 'archived' | string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Authors extends ZenithDocument {
|
|
15
|
+
name: string;
|
|
16
|
+
avatar?: { url: string; alt?: string };
|
|
17
|
+
bio?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Posts extends ZenithDocument {
|
|
21
|
+
title: string;
|
|
22
|
+
coverImage?: { url: string; alt?: string };
|
|
23
|
+
content?: string;
|
|
24
|
+
publishedAt?: string | Date;
|
|
25
|
+
author?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Categories extends ZenithDocument {
|
|
29
|
+
title: string;
|
|
30
|
+
slug: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface Products extends ZenithDocument {
|
|
34
|
+
name: string;
|
|
35
|
+
slug: string;
|
|
36
|
+
price: number;
|
|
37
|
+
description?: string;
|
|
38
|
+
gallery?: {
|
|
39
|
+
image?: { url: string; alt?: string };
|
|
40
|
+
}[];
|
|
41
|
+
inStock?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface Pages extends ZenithDocument {
|
|
45
|
+
title: string;
|
|
46
|
+
slug: string;
|
|
47
|
+
layout?: ({
|
|
48
|
+
blockType: 'undefined';
|
|
49
|
+
|
|
50
|
+
} | {
|
|
51
|
+
blockType: 'undefined';
|
|
52
|
+
|
|
53
|
+
} | {
|
|
54
|
+
blockType: 'undefined';
|
|
55
|
+
|
|
56
|
+
} | {
|
|
57
|
+
blockType: 'undefined';
|
|
58
|
+
|
|
59
|
+
} | {
|
|
60
|
+
blockType: 'undefined';
|
|
61
|
+
|
|
62
|
+
} | {
|
|
63
|
+
blockType: 'undefined';
|
|
64
|
+
|
|
65
|
+
} | {
|
|
66
|
+
blockType: 'undefined';
|
|
67
|
+
|
|
68
|
+
} | {
|
|
69
|
+
blockType: 'undefined';
|
|
70
|
+
|
|
71
|
+
} | {
|
|
72
|
+
blockType: 'undefined';
|
|
73
|
+
|
|
74
|
+
} | {
|
|
75
|
+
blockType: 'undefined';
|
|
76
|
+
|
|
77
|
+
} | {
|
|
78
|
+
blockType: 'undefined';
|
|
79
|
+
|
|
80
|
+
})[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface AuditTarget1781217670604 extends ZenithDocument {
|
|
84
|
+
title: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface Media extends ZenithDocument {
|
|
88
|
+
name?: string;
|
|
89
|
+
url?: string;
|
|
90
|
+
alt?: string;
|
|
91
|
+
folder?: string;
|
|
92
|
+
mimetype?: string;
|
|
93
|
+
size?: number;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface SiteSettings extends ZenithDocument {
|
|
97
|
+
siteName: string;
|
|
98
|
+
supportEmail?: string;
|
|
99
|
+
logo?: { url: string; alt?: string };
|
|
100
|
+
favicon?: { url: string; alt?: string };
|
|
101
|
+
primaryColor?: string;
|
|
102
|
+
metaTitle?: string;
|
|
103
|
+
metaDescription?: string;
|
|
104
|
+
ogImage?: { url: string; alt?: string };
|
|
105
|
+
socialLinks?: {
|
|
106
|
+
platform?: ('Twitter' | 'Instagram' | 'Facebook' | 'LinkedIn' | 'GitHub' | 'YouTube');
|
|
107
|
+
url?: string;
|
|
108
|
+
}[];
|
|
109
|
+
copyrightText?: string;
|
|
110
|
+
headerLinks?: {
|
|
111
|
+
label: string;
|
|
112
|
+
url: string;
|
|
113
|
+
}[];
|
|
114
|
+
footerLinks?: {
|
|
115
|
+
label: string;
|
|
116
|
+
url: string;
|
|
117
|
+
}[];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface ZenithCollections {
|
|
121
|
+
'authors': Authors;
|
|
122
|
+
'posts': Posts;
|
|
123
|
+
'categories': Categories;
|
|
124
|
+
'products': Products;
|
|
125
|
+
'pages': Pages;
|
|
126
|
+
'audit-target-1781217670604': AuditTarget1781217670604;
|
|
127
|
+
'media': Media;
|
|
128
|
+
'site-settings': SiteSettings;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Fully Typed React SDK Data Hook Mappings
|
|
133
|
+
*/
|
|
134
|
+
export type ZenithQuery<T> = {
|
|
135
|
+
where?: Record<string, any>;
|
|
136
|
+
sort?: string | Record<string, any>;
|
|
137
|
+
limit?: number;
|
|
138
|
+
skip?: number;
|
|
139
|
+
select?: string[];
|
|
140
|
+
populate?: string[];
|
|
141
|
+
locale?: string;
|
|
142
|
+
};
|
|
143
|
+
|