@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/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1246 @@
|
|
|
1
|
+
import * as hono from 'hono';
|
|
2
|
+
import * as hono_types from 'hono/types';
|
|
3
|
+
import { S as StorageProvider, R as Registry } from './index-DNy8jbA2.cjs';
|
|
4
|
+
export { C as ConfigService, E as EmailConfig, a as StorageConfig, c as createRegistry, g as getRegistry, r as resetRegistry, b as resolveProvider } from './index-DNy8jbA2.cjs';
|
|
5
|
+
import { B as BaseAdapter, P as PluginManager, K as KyroConfig, j as User, R as Request$1, 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 } from './types-BcZiluXL.cjs';
|
|
6
|
+
export { k as AccessArgs, l as AccessControl, m as AdapterConfig, A as AdminConfig, n as AnalyticsPlugin, a as AuthConfig, o as CollectionAccess, p as CollectionHooks, q as CommentsPlugin, r as CreateResult, s as FieldAccess, t as FieldHooks, u as GlobalAccess, v as GlobalHooks, H as Hook, w as HookArgs, I as ImageSize, i as KyroPlugin, x as PluginAPI, y as PluginHooks, z as ReviewsPlugin, S as SEOPlugin, U as UploadConfig, V as VersionConfig, W as WhereClause, E as WishlistPlugin, J as evaluateAccess, L as getWhereClause, M as mergeWhereClauses, N as presetPlugins, O as runFieldHooks, Q as runHooks } from './types-BcZiluXL.cjs';
|
|
7
|
+
import { KyroPubSub, KyroWSServer } from './ws/index.cjs';
|
|
8
|
+
export { PubSub, createWSServer } from './ws/index.cjs';
|
|
9
|
+
import { W as WebhookPayload, D as DeliveryResult, a as WebhookDelivery, b as WebhookConfig, c as DeliveryOptions, d as WebhookService } from './WebhookService-i-Kl3dvf.cjs';
|
|
10
|
+
export { A as ALL_WEBHOOK_EVENTS, C as CreateWebhookData, U as UpdateWebhookData, e as WEBHOOK_COLLECTION, f as WEBHOOK_DELIVERY_COLLECTION, g as WEBHOOK_EVENTS, h as WebhookEvent, i as WebhookTriggerResult, j as createWebhookService } from './WebhookService-i-Kl3dvf.cjs';
|
|
11
|
+
import { F as Field } from './types-euTszc-1.cjs';
|
|
12
|
+
export { A as ALL_FIELD_TYPES, a as ArrayField, B as BaseField, b as Block, e as BlocksField, v as COMPLEX_FIELD_TYPES, C as CheckboxField, f as CodeField, g as CollapsibleField, h as ColorField, D as DateField, E as EmailField, j as FieldAdmin, k as FieldType, G as GroupField, l as ImageField, J as JSONField, L as LAYOUT_FIELD_TYPES, M as MarkdownField, N as NumberField, x as PRIMITIVE_FIELD_TYPES, P as PasswordField, y as RELATIONAL_FIELD_TYPES, R as RadioField, m as RelationshipField, n as RichTextBlock, o as RichTextField, p as RowField, q as SelectField, T as TabsField, r as TextField, s as TextareaField, U as UploadField, V as ValidateOptions, O as isArrayField, Q as isBlocksField, W as isGroupField, Y as isImageField, Z as isLayoutField, _ as isNumberField, $ as isRelationshipField, a0 as isRichTextField, a1 as isSelectField, a2 as isTextField, a3 as isUploadField } from './types-euTszc-1.cjs';
|
|
13
|
+
import { ZodTypeAny } from 'zod';
|
|
14
|
+
export { z } from 'zod';
|
|
15
|
+
export { n as normalizeRichTextValue, r as renderRichText, a as richTextStyles } from './richtext-DrhORshE.cjs';
|
|
16
|
+
import { A as AbstractBaseAdapter } from './base-iyJTfH-3.cjs';
|
|
17
|
+
import { Dialect } from './drizzle/index.cjs';
|
|
18
|
+
export { DrizzleAdapter, PostgresAuthAdapter, collectionToDrizzleSchema, createDatabase, createDrizzleAdapter, fieldToDrizzleType, runMigrations, seedDefaultRoles } from './drizzle/index.cjs';
|
|
19
|
+
export { MongoDBAdapter, MongoDBAuthAdapter, createMongoDBAdapter } from './mongodb/index.cjs';
|
|
20
|
+
export { createContext, createCountProcedure, createCreateProcedure, createDeleteProcedure, createDynamicRouter, createFindByIDProcedure, createFindProcedure, createKyroServer, createUpdateProcedure } from './trpc/index.cjs';
|
|
21
|
+
export { buildGraphQLSchema, createGraphQLSchema } from './graphql/index.cjs';
|
|
22
|
+
export { createHonoApp, createRESTAPI } from './rest/index.cjs';
|
|
23
|
+
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';
|
|
24
|
+
import { d as AuditLog, e as AuditLogFilter, A as AuthAdapter, U as UserRole, c as AuthUser, S as Session, b as AuthTokenConfig, R as RegisterData, a as AuthResult, L as LoginCredentials, J as JWTPayload } from './types-CpjuXbe7.cjs';
|
|
25
|
+
export { f as AuditAction } from './types-CpjuXbe7.cjs';
|
|
26
|
+
export { TemplateConfig, allSettingsGlobals, blogCollections, blogGlobals, coreSettingsGlobals, createTemplateConfig, ecommerceCollections, ecommerceGlobals, kitchenSinkCollections, mediaCollections, minimalCollections, templateCollections } from './templates/index.cjs';
|
|
27
|
+
export { default as kyro } from './integration.cjs';
|
|
28
|
+
import { Redis } from 'ioredis';
|
|
29
|
+
import 'ws';
|
|
30
|
+
import 'drizzle-orm/postgres-js';
|
|
31
|
+
import 'graphql';
|
|
32
|
+
import 'astro';
|
|
33
|
+
|
|
34
|
+
interface LocalStorageConfig {
|
|
35
|
+
uploadDir: string;
|
|
36
|
+
baseUrl?: string;
|
|
37
|
+
}
|
|
38
|
+
declare function createLocalStorage(config: LocalStorageConfig): StorageProvider;
|
|
39
|
+
|
|
40
|
+
declare function signPayload(payload: string, secret: string): string;
|
|
41
|
+
declare function generateWebhookSecret(): string;
|
|
42
|
+
declare function deliverWebhook(webhook: WebhookConfig, payload: WebhookPayload, options?: DeliveryOptions): Promise<DeliveryResult>;
|
|
43
|
+
declare function deliverWithRetry(webhook: WebhookConfig, payload: WebhookPayload, deliveryId: string, options?: DeliveryOptions): Promise<DeliveryResult>;
|
|
44
|
+
declare function buildDeliveryRecord(deliveryId: string, webhookId: string, event: string, payload: WebhookPayload, attempt: number, result: DeliveryResult): WebhookDelivery;
|
|
45
|
+
declare function createTestPayload(): WebhookPayload;
|
|
46
|
+
|
|
47
|
+
declare class AuditLogger {
|
|
48
|
+
private redis;
|
|
49
|
+
private prefix;
|
|
50
|
+
private retentionDays;
|
|
51
|
+
constructor(redis: Redis, retentionDays?: number, prefix?: string);
|
|
52
|
+
log(data: Omit<AuditLog, "id" | "timestamp">): Promise<string>;
|
|
53
|
+
get(id: string): Promise<AuditLog | null>;
|
|
54
|
+
query(filter?: AuditLogFilter): Promise<{
|
|
55
|
+
logs: AuditLog[];
|
|
56
|
+
total: number;
|
|
57
|
+
}>;
|
|
58
|
+
getRecent(limit?: number): Promise<AuditLog[]>;
|
|
59
|
+
getUserActivity(userId: string, limit?: number): Promise<AuditLog[]>;
|
|
60
|
+
getStats(startDate?: Date, endDate?: Date): Promise<{
|
|
61
|
+
totalEvents: number;
|
|
62
|
+
byAction: Record<string, number>;
|
|
63
|
+
successRate: number;
|
|
64
|
+
failedLogins: number;
|
|
65
|
+
uniqueUsers: Set<string>;
|
|
66
|
+
}>;
|
|
67
|
+
cleanup(): Promise<number>;
|
|
68
|
+
private getKeyForDate;
|
|
69
|
+
private getKeysForDateRange;
|
|
70
|
+
private matchesFilter;
|
|
71
|
+
private serializeLog;
|
|
72
|
+
private deserializeLog;
|
|
73
|
+
}
|
|
74
|
+
declare function createAuditContext(req: Request): {
|
|
75
|
+
ipAddress: string;
|
|
76
|
+
userAgent: string;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
declare function applyCollectionOverrides(collections: CollectionConfig[], overrides?: Record<string, any>): void;
|
|
80
|
+
declare class Kyro {
|
|
81
|
+
registry: Registry;
|
|
82
|
+
db: BaseAdapter;
|
|
83
|
+
pubsub: KyroPubSub;
|
|
84
|
+
webhookService: WebhookService;
|
|
85
|
+
settings?: Record<string, any>;
|
|
86
|
+
pluginManager: PluginManager;
|
|
87
|
+
private wsServer?;
|
|
88
|
+
private config;
|
|
89
|
+
constructor(config: KyroConfig);
|
|
90
|
+
init(): Promise<void>;
|
|
91
|
+
loadSettings(): Promise<Record<string, any>>;
|
|
92
|
+
loadPluginState(): Promise<void>;
|
|
93
|
+
getREST(options?: {
|
|
94
|
+
user?: User;
|
|
95
|
+
req?: Request$1;
|
|
96
|
+
tenantId?: string;
|
|
97
|
+
}): hono.Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
98
|
+
getGraphQL(options?: {
|
|
99
|
+
user?: User;
|
|
100
|
+
req?: Request$1;
|
|
101
|
+
tenantId?: string;
|
|
102
|
+
}): {
|
|
103
|
+
fetch: (request: any, locals?: any) => Promise<Response>;
|
|
104
|
+
schema: any;
|
|
105
|
+
};
|
|
106
|
+
getTRPC(options?: {
|
|
107
|
+
user?: User;
|
|
108
|
+
req?: Request$1;
|
|
109
|
+
tenantId?: string;
|
|
110
|
+
}): {
|
|
111
|
+
fetch: (request: any, locals?: any) => Promise<Response>;
|
|
112
|
+
router: any;
|
|
113
|
+
};
|
|
114
|
+
getWS(): KyroWSServer | undefined;
|
|
115
|
+
startWebSocket(options?: {
|
|
116
|
+
port?: number;
|
|
117
|
+
requireAuth?: boolean;
|
|
118
|
+
verifyToken?: (token: string) => Promise<any>;
|
|
119
|
+
}): Promise<KyroWSServer | null>;
|
|
120
|
+
shutdown(): Promise<void>;
|
|
121
|
+
}
|
|
122
|
+
declare function createKyro(config: KyroConfig): Kyro;
|
|
123
|
+
|
|
124
|
+
declare class ConfigValidationError extends Error {
|
|
125
|
+
errors: string[];
|
|
126
|
+
constructor(errors: string[]);
|
|
127
|
+
}
|
|
128
|
+
declare function validateCollection(config: CollectionConfig): string[];
|
|
129
|
+
declare function validateGlobal(config: GlobalConfig): string[];
|
|
130
|
+
declare function validateFields(fields: Field[], context: string): string[];
|
|
131
|
+
declare function validateConfig(collections: CollectionConfig[], globals?: GlobalConfig[]): void;
|
|
132
|
+
|
|
133
|
+
declare function fieldToZod(field: Field): ZodTypeAny;
|
|
134
|
+
declare function collectionToZod(collection: CollectionConfig): ZodTypeAny;
|
|
135
|
+
declare function collectionToCreateZod(collection: CollectionConfig): ZodTypeAny;
|
|
136
|
+
declare function collectionToUpdateZod(collection: CollectionConfig): ZodTypeAny;
|
|
137
|
+
declare function collectionToWhereZod(collection: CollectionConfig): ZodTypeAny;
|
|
138
|
+
declare function globalToZod(global: GlobalConfig): ZodTypeAny;
|
|
139
|
+
|
|
140
|
+
type DatabaseType$1 = 'postgres' | 'sqlite' | 'mongodb';
|
|
141
|
+
interface DatabaseConnectionOptions {
|
|
142
|
+
type: DatabaseType$1;
|
|
143
|
+
host?: string;
|
|
144
|
+
port?: number;
|
|
145
|
+
database?: string;
|
|
146
|
+
user?: string;
|
|
147
|
+
password?: string;
|
|
148
|
+
url?: string;
|
|
149
|
+
ssl?: boolean | Record<string, any>;
|
|
150
|
+
maxConnections?: number;
|
|
151
|
+
connectionTimeout?: number;
|
|
152
|
+
}
|
|
153
|
+
interface DrizzleAdapterOptions {
|
|
154
|
+
type?: 'postgres' | 'sqlite';
|
|
155
|
+
client?: any;
|
|
156
|
+
schema?: any;
|
|
157
|
+
connectionString?: string;
|
|
158
|
+
connectionOptions?: DatabaseConnectionOptions;
|
|
159
|
+
}
|
|
160
|
+
interface MongoDBAdapterOptions {
|
|
161
|
+
type: 'mongodb';
|
|
162
|
+
client?: any;
|
|
163
|
+
database?: string;
|
|
164
|
+
connectionString?: string;
|
|
165
|
+
connectionOptions?: DatabaseConnectionOptions;
|
|
166
|
+
}
|
|
167
|
+
type AdapterOptions = DrizzleAdapterOptions | MongoDBAdapterOptions;
|
|
168
|
+
|
|
169
|
+
declare class LocalAdapter extends AbstractBaseAdapter {
|
|
170
|
+
private db;
|
|
171
|
+
private path?;
|
|
172
|
+
private migrations;
|
|
173
|
+
private readonly versionsTableName;
|
|
174
|
+
constructor(options: {
|
|
175
|
+
db?: any;
|
|
176
|
+
path?: string;
|
|
177
|
+
});
|
|
178
|
+
connect(): Promise<void>;
|
|
179
|
+
disconnect(): Promise<void>;
|
|
180
|
+
private ensureTable;
|
|
181
|
+
private ensureVersionsTable;
|
|
182
|
+
private col;
|
|
183
|
+
private fieldToSQL;
|
|
184
|
+
private parseGlobalsSlug;
|
|
185
|
+
find<T>(args: FindArgs): Promise<FindResult<T>>;
|
|
186
|
+
findByID<T>(args: FindByIDArgs): Promise<T | null>;
|
|
187
|
+
create<T>(args: CreateArgs): Promise<T>;
|
|
188
|
+
update<T>(args: UpdateArgs): Promise<T>;
|
|
189
|
+
delete<T>(args: DeleteArgs): Promise<T>;
|
|
190
|
+
count(args: {
|
|
191
|
+
collection: string;
|
|
192
|
+
where?: Record<string, any>;
|
|
193
|
+
tenantId?: string;
|
|
194
|
+
}): Promise<number>;
|
|
195
|
+
findOne(args: {
|
|
196
|
+
collection: string;
|
|
197
|
+
where: Record<string, any>;
|
|
198
|
+
tenantId?: string;
|
|
199
|
+
draft?: boolean;
|
|
200
|
+
}): Promise<any>;
|
|
201
|
+
findVersions(args: FindVersionsArgs): Promise<FindResult<VersionRecord>>;
|
|
202
|
+
findVersionByID(args: {
|
|
203
|
+
collection: string;
|
|
204
|
+
versionId: string;
|
|
205
|
+
tenantId?: string;
|
|
206
|
+
}): Promise<VersionRecord | null>;
|
|
207
|
+
createVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
|
|
208
|
+
updateLatestVersion<T = Record<string, any>>(args: CreateVersionArgs<T>): Promise<VersionRecord<T>>;
|
|
209
|
+
deleteVersions(args: {
|
|
210
|
+
collection: string;
|
|
211
|
+
documentId: string;
|
|
212
|
+
keepLatest?: number;
|
|
213
|
+
tenantId?: string;
|
|
214
|
+
}): Promise<void>;
|
|
215
|
+
private rowToVersion;
|
|
216
|
+
protected prepareData(data: Record<string, any>, config: CollectionConfig | GlobalConfig): Record<string, any>;
|
|
217
|
+
private rowToDoc;
|
|
218
|
+
private generateId;
|
|
219
|
+
private getMediaById;
|
|
220
|
+
private getTableNameFor;
|
|
221
|
+
migrate(): Promise<void>;
|
|
222
|
+
rollback(): Promise<void>;
|
|
223
|
+
transaction<T>(fn: (tx: any) => Promise<T>): Promise<T>;
|
|
224
|
+
getDatabase(): any;
|
|
225
|
+
exec(sql: string): void;
|
|
226
|
+
prepare(sql: string): any;
|
|
227
|
+
}
|
|
228
|
+
declare function createLocalAdapter(options?: {
|
|
229
|
+
db?: any;
|
|
230
|
+
path?: string;
|
|
231
|
+
}): LocalAdapter;
|
|
232
|
+
|
|
233
|
+
interface RedisAuthAdapterOptions {
|
|
234
|
+
url?: string;
|
|
235
|
+
host?: string;
|
|
236
|
+
port?: number;
|
|
237
|
+
password?: string;
|
|
238
|
+
db?: number;
|
|
239
|
+
keyPrefix?: string;
|
|
240
|
+
tokenExpiration?: number;
|
|
241
|
+
refreshTokenExpiration?: number;
|
|
242
|
+
tls?: boolean;
|
|
243
|
+
}
|
|
244
|
+
declare class RedisAuthAdapter implements AuthAdapter {
|
|
245
|
+
private _redis;
|
|
246
|
+
private prefix;
|
|
247
|
+
private tokenExpiration;
|
|
248
|
+
private refreshExpiration;
|
|
249
|
+
private options;
|
|
250
|
+
constructor(options?: RedisAuthAdapterOptions);
|
|
251
|
+
private getRedis;
|
|
252
|
+
connect(): Promise<void>;
|
|
253
|
+
disconnect(): Promise<void>;
|
|
254
|
+
private userKey;
|
|
255
|
+
private sessionKey;
|
|
256
|
+
private refreshKey;
|
|
257
|
+
private userByEmailKey;
|
|
258
|
+
private passwordHistoryKey;
|
|
259
|
+
createUser(data: {
|
|
260
|
+
email: string;
|
|
261
|
+
password: string;
|
|
262
|
+
role?: UserRole;
|
|
263
|
+
tenantId?: string;
|
|
264
|
+
}): Promise<AuthUser>;
|
|
265
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
266
|
+
findUserById(userId: string): Promise<AuthUser | null>;
|
|
267
|
+
updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
268
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
269
|
+
hashPassword(password: string): Promise<string>;
|
|
270
|
+
verifyPassword(email: string, password: string): Promise<AuthUser | null>;
|
|
271
|
+
createSession(userId: string, data?: {
|
|
272
|
+
ipAddress?: string;
|
|
273
|
+
userAgent?: string;
|
|
274
|
+
}): Promise<Session>;
|
|
275
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
276
|
+
findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
|
|
277
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
278
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
279
|
+
addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
|
|
280
|
+
getPasswordHistory(userId: string, count?: number): Promise<string[]>;
|
|
281
|
+
isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
|
|
282
|
+
private userToHash;
|
|
283
|
+
private hashToUser;
|
|
284
|
+
private sessionToHash;
|
|
285
|
+
private hashToSession;
|
|
286
|
+
private tokenKey;
|
|
287
|
+
createEmailVerificationToken(userId: string): Promise<{
|
|
288
|
+
token: string;
|
|
289
|
+
expiresAt: Date;
|
|
290
|
+
}>;
|
|
291
|
+
verifyEmailToken(token: string): Promise<{
|
|
292
|
+
success: boolean;
|
|
293
|
+
userId?: string;
|
|
294
|
+
error?: string;
|
|
295
|
+
}>;
|
|
296
|
+
createPasswordResetToken(email: string): Promise<{
|
|
297
|
+
token: string;
|
|
298
|
+
expiresAt: Date;
|
|
299
|
+
error?: string;
|
|
300
|
+
}>;
|
|
301
|
+
resetPasswordWithToken(token: string, newPassword: string): Promise<{
|
|
302
|
+
success: boolean;
|
|
303
|
+
error?: string;
|
|
304
|
+
}>;
|
|
305
|
+
private auditLogKey;
|
|
306
|
+
private auditLogIndexKey;
|
|
307
|
+
findAuditLogs(filter: {
|
|
308
|
+
userId?: string;
|
|
309
|
+
action?: string | string[];
|
|
310
|
+
resource?: string;
|
|
311
|
+
success?: boolean;
|
|
312
|
+
limit?: number;
|
|
313
|
+
offset?: number;
|
|
314
|
+
}): Promise<{
|
|
315
|
+
logs: any[];
|
|
316
|
+
total: number;
|
|
317
|
+
}>;
|
|
318
|
+
createAuditLog(data: any): Promise<any>;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
interface EmailConfig {
|
|
322
|
+
provider: "smtp" | "resend" | "sendgrid" | "mailgun" | "ses";
|
|
323
|
+
from: string;
|
|
324
|
+
fromName?: string;
|
|
325
|
+
replyTo?: string;
|
|
326
|
+
smtp?: {
|
|
327
|
+
host: string;
|
|
328
|
+
port: number;
|
|
329
|
+
secure: boolean;
|
|
330
|
+
auth: {
|
|
331
|
+
user: string;
|
|
332
|
+
pass: string;
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
resend?: {
|
|
336
|
+
apiKey: string;
|
|
337
|
+
};
|
|
338
|
+
sendgrid?: {
|
|
339
|
+
apiKey: string;
|
|
340
|
+
};
|
|
341
|
+
mailgun?: {
|
|
342
|
+
apiKey: string;
|
|
343
|
+
domain: string;
|
|
344
|
+
region?: "us" | "eu";
|
|
345
|
+
};
|
|
346
|
+
ses?: {
|
|
347
|
+
accessKeyId: string;
|
|
348
|
+
secretAccessKey: string;
|
|
349
|
+
region: string;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
interface EmailOptions {
|
|
353
|
+
to: string | string[];
|
|
354
|
+
subject: string;
|
|
355
|
+
html: string;
|
|
356
|
+
text?: string;
|
|
357
|
+
replyTo?: string;
|
|
358
|
+
}
|
|
359
|
+
interface EmailTemplates {
|
|
360
|
+
verifyEmail: (link: string, userName?: string) => {
|
|
361
|
+
subject: string;
|
|
362
|
+
html: string;
|
|
363
|
+
text: string;
|
|
364
|
+
};
|
|
365
|
+
resetPassword: (link: string, userName?: string) => {
|
|
366
|
+
subject: string;
|
|
367
|
+
html: string;
|
|
368
|
+
text: string;
|
|
369
|
+
};
|
|
370
|
+
welcome: (userName?: string) => {
|
|
371
|
+
subject: string;
|
|
372
|
+
html: string;
|
|
373
|
+
text: string;
|
|
374
|
+
};
|
|
375
|
+
accountLocked: (attempts: number, duration: number, userName?: string) => {
|
|
376
|
+
subject: string;
|
|
377
|
+
html: string;
|
|
378
|
+
text: string;
|
|
379
|
+
};
|
|
380
|
+
passwordChanged: (userName?: string) => {
|
|
381
|
+
subject: string;
|
|
382
|
+
html: string;
|
|
383
|
+
text: string;
|
|
384
|
+
};
|
|
385
|
+
newLogin: (location: string, time: string, userName?: string) => {
|
|
386
|
+
subject: string;
|
|
387
|
+
html: string;
|
|
388
|
+
text: string;
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
declare class EmailTransport {
|
|
392
|
+
private transporter?;
|
|
393
|
+
private config;
|
|
394
|
+
private templates;
|
|
395
|
+
private transporterInitialized;
|
|
396
|
+
constructor(config: EmailConfig, templates?: Partial<EmailTemplates>);
|
|
397
|
+
private ensureTransporter;
|
|
398
|
+
send(options: EmailOptions): Promise<any>;
|
|
399
|
+
private sendViaResend;
|
|
400
|
+
private sendViaSendGrid;
|
|
401
|
+
private sendViaMailgun;
|
|
402
|
+
getTemplates(): EmailTemplates;
|
|
403
|
+
verifyConnection(): Promise<boolean>;
|
|
404
|
+
static fromConfig(db: any): Promise<EmailTransport | null>;
|
|
405
|
+
static fromEnv(): EmailTransport | null;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
interface BootstrapConfig {
|
|
409
|
+
authAdapter?: AuthAdapter;
|
|
410
|
+
authDbPath?: string;
|
|
411
|
+
adminEmail: string;
|
|
412
|
+
adminPassword: string;
|
|
413
|
+
adminRole?: string;
|
|
414
|
+
tenantId?: string;
|
|
415
|
+
emailConfig?: EmailConfig;
|
|
416
|
+
sendWelcomeEmail?: boolean;
|
|
417
|
+
}
|
|
418
|
+
interface BootstrapResult {
|
|
419
|
+
success: boolean;
|
|
420
|
+
user?: AuthUser;
|
|
421
|
+
error?: string;
|
|
422
|
+
}
|
|
423
|
+
declare function bootstrapAdmin(config: BootstrapConfig): Promise<BootstrapResult>;
|
|
424
|
+
declare function getBootstrapFromEnv(): BootstrapConfig | null;
|
|
425
|
+
declare function autoBootstrap(authAdapter?: AuthAdapter): Promise<BootstrapResult | null>;
|
|
426
|
+
declare function bootstrapWithRetry(config: BootstrapConfig, maxRetries?: number, retryDelayMs?: number): Promise<BootstrapResult>;
|
|
427
|
+
|
|
428
|
+
interface PasswordPolicyConfig {
|
|
429
|
+
minLength: number;
|
|
430
|
+
requireUppercase: boolean;
|
|
431
|
+
requireLowercase: boolean;
|
|
432
|
+
requireNumbers: boolean;
|
|
433
|
+
requireSpecialChars: boolean;
|
|
434
|
+
preventReuse: number;
|
|
435
|
+
maxLength?: number;
|
|
436
|
+
}
|
|
437
|
+
interface ValidationResult {
|
|
438
|
+
valid: boolean;
|
|
439
|
+
errors: string[];
|
|
440
|
+
}
|
|
441
|
+
declare class PasswordPolicy {
|
|
442
|
+
private config;
|
|
443
|
+
constructor(config?: Partial<PasswordPolicyConfig>);
|
|
444
|
+
validate(password: string): ValidationResult;
|
|
445
|
+
checkReuse(passwordHash: string, history: string[], verifyFn: (password: string, hash: string) => Promise<boolean>): Promise<ValidationResult>;
|
|
446
|
+
isInHistory(password: string, history: string[], verifyFn: (password: string, hash: string) => Promise<boolean>): Promise<boolean>;
|
|
447
|
+
generatePassword(length?: number): string;
|
|
448
|
+
getStrength(password: string): {
|
|
449
|
+
score: number;
|
|
450
|
+
label: string;
|
|
451
|
+
feedback: string[];
|
|
452
|
+
};
|
|
453
|
+
setConfig(config: Partial<PasswordPolicyConfig>): void;
|
|
454
|
+
getConfig(): PasswordPolicyConfig;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
interface LockoutConfig {
|
|
458
|
+
maxAttempts: number;
|
|
459
|
+
lockDuration: number;
|
|
460
|
+
notifyUser: boolean;
|
|
461
|
+
notifyAdmin: boolean;
|
|
462
|
+
adminNotifyAfter: number;
|
|
463
|
+
}
|
|
464
|
+
interface LockoutStatus {
|
|
465
|
+
locked: boolean;
|
|
466
|
+
attemptsRemaining: number;
|
|
467
|
+
lockedUntil?: Date;
|
|
468
|
+
totalAttempts: number;
|
|
469
|
+
}
|
|
470
|
+
declare class AccountLockout {
|
|
471
|
+
private redis;
|
|
472
|
+
private prefix;
|
|
473
|
+
private config;
|
|
474
|
+
constructor(redis: Redis, config?: Partial<LockoutConfig>, prefix?: string);
|
|
475
|
+
private lockKey;
|
|
476
|
+
private historyKey;
|
|
477
|
+
checkLockout(userId: string): Promise<LockoutStatus>;
|
|
478
|
+
recordFailedAttempt(userId: string): Promise<LockoutStatus>;
|
|
479
|
+
lockAccount(userId: string, duration?: number): Promise<void>;
|
|
480
|
+
unlockAccount(userId: string): Promise<void>;
|
|
481
|
+
resetAttempts(userId: string): Promise<void>;
|
|
482
|
+
getLockoutHistory(userId: string, limit?: number): Promise<Date[]>;
|
|
483
|
+
getLockoutStats(userId: string): Promise<{
|
|
484
|
+
totalFailedAttempts: number;
|
|
485
|
+
lockoutCount: number;
|
|
486
|
+
lastLockout: Date | null;
|
|
487
|
+
averageAttemptsBeforeLockout: number;
|
|
488
|
+
}>;
|
|
489
|
+
shouldNotifyAdmin(currentAttempts: number): boolean;
|
|
490
|
+
getConfig(): LockoutConfig;
|
|
491
|
+
setConfig(config: Partial<LockoutConfig>): void;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
interface RateLimitConfig {
|
|
495
|
+
window: number;
|
|
496
|
+
max: number;
|
|
497
|
+
}
|
|
498
|
+
interface RateLimitResult {
|
|
499
|
+
allowed: boolean;
|
|
500
|
+
remaining: number;
|
|
501
|
+
resetAt: number;
|
|
502
|
+
retryAfter?: number;
|
|
503
|
+
}
|
|
504
|
+
declare class RateLimiter {
|
|
505
|
+
private redis;
|
|
506
|
+
private prefix;
|
|
507
|
+
private limits;
|
|
508
|
+
private userLimits;
|
|
509
|
+
constructor(redis: Redis, limits?: Record<string, RateLimitConfig>, userLimits?: Record<string, RateLimitConfig>, prefix?: string);
|
|
510
|
+
private getKey;
|
|
511
|
+
check(type: string, identifier: string): Promise<RateLimitResult>;
|
|
512
|
+
checkUser(type: string, userId: string, identifier: string): Promise<RateLimitResult>;
|
|
513
|
+
reset(type: string, identifier: string): Promise<void>;
|
|
514
|
+
resetUser(type: string, userId: string, identifier: string): Promise<void>;
|
|
515
|
+
getStatus(type: string, identifier: string): Promise<{
|
|
516
|
+
count: number;
|
|
517
|
+
limit: number;
|
|
518
|
+
remaining: number;
|
|
519
|
+
resetAt: number;
|
|
520
|
+
}>;
|
|
521
|
+
setLimit(type: string, config: RateLimitConfig): void;
|
|
522
|
+
setUserLimit(type: string, config: RateLimitConfig): void;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
declare class InMemoryRateLimiter {
|
|
526
|
+
private storage;
|
|
527
|
+
private userStorage;
|
|
528
|
+
private limits;
|
|
529
|
+
private userLimits;
|
|
530
|
+
constructor(limits?: Record<string, RateLimitConfig>, userLimits?: Record<string, RateLimitConfig>);
|
|
531
|
+
private getKey;
|
|
532
|
+
private getUserKey;
|
|
533
|
+
private cleanupOldEntries;
|
|
534
|
+
check(type: string, identifier: string): Promise<RateLimitResult>;
|
|
535
|
+
checkUser(type: string, userId: string, identifier: string): Promise<RateLimitResult>;
|
|
536
|
+
reset(type: string, identifier: string): Promise<void>;
|
|
537
|
+
resetUser(type: string, userId: string, identifier: string): Promise<void>;
|
|
538
|
+
getStatus(type: string, identifier: string): Promise<{
|
|
539
|
+
count: number;
|
|
540
|
+
limit: number;
|
|
541
|
+
remaining: number;
|
|
542
|
+
resetAt: number;
|
|
543
|
+
}>;
|
|
544
|
+
setLimit(type: string, config: RateLimitConfig): void;
|
|
545
|
+
setUserLimit(type: string, config: RateLimitConfig): void;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
declare class InMemoryAccountLockout {
|
|
549
|
+
private storage;
|
|
550
|
+
private history;
|
|
551
|
+
private config;
|
|
552
|
+
constructor(config?: Partial<LockoutConfig>);
|
|
553
|
+
checkLockout(userId: string): Promise<LockoutStatus>;
|
|
554
|
+
recordFailedAttempt(userId: string): Promise<LockoutStatus>;
|
|
555
|
+
lockAccount(userId: string, duration?: number): Promise<void>;
|
|
556
|
+
unlockAccount(userId: string): Promise<void>;
|
|
557
|
+
resetAttempts(userId: string): Promise<void>;
|
|
558
|
+
getLockoutHistory(userId: string, limit?: number): Promise<Date[]>;
|
|
559
|
+
getLockoutStats(userId: string): Promise<{
|
|
560
|
+
totalFailedAttempts: number;
|
|
561
|
+
lockoutCount: number;
|
|
562
|
+
lastLockout: Date | null;
|
|
563
|
+
averageAttemptsBeforeLockout: number;
|
|
564
|
+
}>;
|
|
565
|
+
shouldNotifyAdmin(currentAttempts: number): boolean;
|
|
566
|
+
getConfig(): LockoutConfig;
|
|
567
|
+
setConfig(config: Partial<LockoutConfig>): void;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
declare class InMemoryAuditLogger {
|
|
571
|
+
private logs;
|
|
572
|
+
private retentionDays;
|
|
573
|
+
constructor(retentionDays?: number);
|
|
574
|
+
log(data: Omit<AuditLog, "id" | "timestamp">): Promise<string>;
|
|
575
|
+
get(id: string): Promise<AuditLog | null>;
|
|
576
|
+
query(filter?: AuditLogFilter): Promise<{
|
|
577
|
+
logs: AuditLog[];
|
|
578
|
+
total: number;
|
|
579
|
+
}>;
|
|
580
|
+
getRecent(limit?: number): Promise<AuditLog[]>;
|
|
581
|
+
getUserActivity(userId: string, limit?: number): Promise<AuditLog[]>;
|
|
582
|
+
getStats(startDate?: Date, endDate?: Date): Promise<{
|
|
583
|
+
totalEvents: number;
|
|
584
|
+
byAction: Record<string, number>;
|
|
585
|
+
successRate: number;
|
|
586
|
+
failedLogins: number;
|
|
587
|
+
uniqueUsers: Set<string>;
|
|
588
|
+
}>;
|
|
589
|
+
cleanup(): Promise<number>;
|
|
590
|
+
private cleanupOldLogs;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
interface AuthRoutesConfig {
|
|
594
|
+
redis: AuthAdapter;
|
|
595
|
+
jwtSecret?: string;
|
|
596
|
+
jwtExpiresIn?: string;
|
|
597
|
+
jwtIssuer?: string;
|
|
598
|
+
jwtAudience?: string;
|
|
599
|
+
email?: EmailTransport;
|
|
600
|
+
passwordPolicy?: PasswordPolicy;
|
|
601
|
+
lockout?: InMemoryAccountLockout;
|
|
602
|
+
rateLimiter?: InMemoryRateLimiter;
|
|
603
|
+
auditLogger?: InMemoryAuditLogger;
|
|
604
|
+
baseUrl?: string;
|
|
605
|
+
emailVerificationRequired?: boolean;
|
|
606
|
+
}
|
|
607
|
+
declare class AuthRoutes {
|
|
608
|
+
private authAdapter;
|
|
609
|
+
private email?;
|
|
610
|
+
private passwordPolicy;
|
|
611
|
+
private lockout?;
|
|
612
|
+
private rateLimiter?;
|
|
613
|
+
private auditLogger?;
|
|
614
|
+
private baseUrl;
|
|
615
|
+
private emailVerificationRequired;
|
|
616
|
+
constructor(config: AuthRoutesConfig);
|
|
617
|
+
register(req: Request): Promise<Response>;
|
|
618
|
+
login(req: Request): Promise<Response>;
|
|
619
|
+
logout(req: Request): Promise<Response>;
|
|
620
|
+
refresh(req: Request): Promise<Response>;
|
|
621
|
+
me(req: Request): Promise<Response>;
|
|
622
|
+
changePassword(req: Request): Promise<Response>;
|
|
623
|
+
forgotPassword(req: Request): Promise<Response>;
|
|
624
|
+
verifyEmail(req: Request): Promise<Response>;
|
|
625
|
+
private recordFailedLogin;
|
|
626
|
+
private sanitizeUser;
|
|
627
|
+
private jsonResponse;
|
|
628
|
+
listSessions(req: Request): Promise<Response>;
|
|
629
|
+
revokeSession(req: Request, sessionId: string): Promise<Response>;
|
|
630
|
+
revokeOtherSessions(req: Request): Promise<Response>;
|
|
631
|
+
renameSession(req: Request, sessionId: string): Promise<Response>;
|
|
632
|
+
refreshSession(req: Request): Promise<Response>;
|
|
633
|
+
private errorResponse;
|
|
634
|
+
private rateLimitResponse;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
type DatabaseType = "sqlite" | "postgres" | "mongodb" | "memory";
|
|
638
|
+
interface KyroAuthConfig {
|
|
639
|
+
authAdapter: AuthAdapter;
|
|
640
|
+
databaseType?: string;
|
|
641
|
+
email?: EmailTransport;
|
|
642
|
+
passwordPolicy: PasswordPolicy;
|
|
643
|
+
lockout?: InMemoryAccountLockout;
|
|
644
|
+
rateLimiter?: InMemoryRateLimiter;
|
|
645
|
+
auditLogger?: InMemoryAuditLogger;
|
|
646
|
+
routes: AuthRoutes;
|
|
647
|
+
}
|
|
648
|
+
declare function createAuthConfig(databaseType?: string, db?: any): Promise<KyroAuthConfig>;
|
|
649
|
+
declare const authConfig: Promise<any>;
|
|
650
|
+
|
|
651
|
+
declare class InMemoryAuthAdapter implements AuthAdapter {
|
|
652
|
+
private users;
|
|
653
|
+
private sessions;
|
|
654
|
+
private refreshTokens;
|
|
655
|
+
private emailToUserId;
|
|
656
|
+
private passwordHistory;
|
|
657
|
+
private emailVerificationTokens;
|
|
658
|
+
private passwordResetTokens;
|
|
659
|
+
private auditLogs;
|
|
660
|
+
private externalDb;
|
|
661
|
+
constructor();
|
|
662
|
+
connect(): Promise<void>;
|
|
663
|
+
disconnect(): Promise<void>;
|
|
664
|
+
createUser(data: {
|
|
665
|
+
email: string;
|
|
666
|
+
password: string;
|
|
667
|
+
role?: UserRole;
|
|
668
|
+
tenantId?: string;
|
|
669
|
+
}): Promise<AuthUser>;
|
|
670
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
671
|
+
findUserById(userId: string): Promise<AuthUser | null>;
|
|
672
|
+
updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
673
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
674
|
+
hashPassword(password: string): Promise<string>;
|
|
675
|
+
verifyPassword(email: string, password: string): Promise<AuthUser | null>;
|
|
676
|
+
createSession(userId: string, data?: {
|
|
677
|
+
ipAddress?: string;
|
|
678
|
+
userAgent?: string;
|
|
679
|
+
}): Promise<Session>;
|
|
680
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
681
|
+
findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
|
|
682
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
683
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
684
|
+
addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
|
|
685
|
+
getPasswordHistory(userId: string, count?: number): Promise<string[]>;
|
|
686
|
+
isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
|
|
687
|
+
createEmailVerificationToken(userId: string): Promise<{
|
|
688
|
+
token: string;
|
|
689
|
+
expiresAt: Date;
|
|
690
|
+
}>;
|
|
691
|
+
verifyEmailToken(token: string): Promise<{
|
|
692
|
+
success: boolean;
|
|
693
|
+
userId?: string;
|
|
694
|
+
error?: string;
|
|
695
|
+
}>;
|
|
696
|
+
createPasswordResetToken(email: string): Promise<{
|
|
697
|
+
token: string;
|
|
698
|
+
expiresAt: Date;
|
|
699
|
+
error?: string;
|
|
700
|
+
}>;
|
|
701
|
+
resetPasswordWithToken(token: string, newPassword: string): Promise<{
|
|
702
|
+
success: boolean;
|
|
703
|
+
error?: string;
|
|
704
|
+
}>;
|
|
705
|
+
hasAnyUsers(): Promise<boolean>;
|
|
706
|
+
findAuditLogs(filter: {
|
|
707
|
+
userId?: string;
|
|
708
|
+
action?: string | string[];
|
|
709
|
+
resource?: string;
|
|
710
|
+
success?: boolean;
|
|
711
|
+
limit?: number;
|
|
712
|
+
offset?: number;
|
|
713
|
+
}): Promise<{
|
|
714
|
+
logs: any[];
|
|
715
|
+
total: number;
|
|
716
|
+
}>;
|
|
717
|
+
createAuditLog(data: any): Promise<any>;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
declare class Auth {
|
|
721
|
+
private adapter;
|
|
722
|
+
private config;
|
|
723
|
+
constructor(adapter: AuthAdapter, config: AuthTokenConfig);
|
|
724
|
+
register(data: RegisterData): Promise<AuthResult>;
|
|
725
|
+
login(credentials: LoginCredentials): Promise<AuthResult>;
|
|
726
|
+
logout(token: string): Promise<void>;
|
|
727
|
+
refreshToken(refreshToken: string): Promise<AuthResult>;
|
|
728
|
+
verifyToken(token: string): Promise<JWTPayload | null>;
|
|
729
|
+
getUserFromToken(token: string): Promise<AuthUser | null>;
|
|
730
|
+
changePassword(userId: string, currentPassword: string, newPassword: string): Promise<AuthResult>;
|
|
731
|
+
resetPassword(email: string, newPassword: string): Promise<AuthResult>;
|
|
732
|
+
sendEmailVerification(userId: string): Promise<{
|
|
733
|
+
success: boolean;
|
|
734
|
+
error?: string;
|
|
735
|
+
}>;
|
|
736
|
+
verifyEmail(token: string): Promise<{
|
|
737
|
+
success: boolean;
|
|
738
|
+
userId?: string;
|
|
739
|
+
error?: string;
|
|
740
|
+
}>;
|
|
741
|
+
requestPasswordReset(email: string): Promise<{
|
|
742
|
+
success: boolean;
|
|
743
|
+
error?: string;
|
|
744
|
+
}>;
|
|
745
|
+
resetPasswordWithToken(token: string, newPassword: string): Promise<{
|
|
746
|
+
success: boolean;
|
|
747
|
+
error?: string;
|
|
748
|
+
}>;
|
|
749
|
+
deleteAccount(userId: string): Promise<AuthResult>;
|
|
750
|
+
private createSessionForUser;
|
|
751
|
+
private generateToken;
|
|
752
|
+
private hashPassword;
|
|
753
|
+
private parseExpiresIn;
|
|
754
|
+
}
|
|
755
|
+
declare function createAuth(adapter: AuthAdapter, config: AuthTokenConfig): Auth;
|
|
756
|
+
|
|
757
|
+
interface SQLiteAuthAdapterOptions {
|
|
758
|
+
path?: string;
|
|
759
|
+
db?: any;
|
|
760
|
+
saltRounds?: number;
|
|
761
|
+
busyTimeout?: number;
|
|
762
|
+
walAutoCheckpoint?: number;
|
|
763
|
+
cacheSize?: number;
|
|
764
|
+
mmapSize?: number;
|
|
765
|
+
}
|
|
766
|
+
declare class SQLiteAuthAdapter implements AuthAdapter {
|
|
767
|
+
private db;
|
|
768
|
+
private path;
|
|
769
|
+
private saltRounds;
|
|
770
|
+
private externalDb;
|
|
771
|
+
private busyTimeout;
|
|
772
|
+
private walAutoCheckpoint;
|
|
773
|
+
private cacheSize;
|
|
774
|
+
private mmapSize;
|
|
775
|
+
private preparedStatements;
|
|
776
|
+
constructor(options?: SQLiteAuthAdapterOptions);
|
|
777
|
+
connect(): Promise<void>;
|
|
778
|
+
disconnect(): Promise<void>;
|
|
779
|
+
private ensureConnected;
|
|
780
|
+
private ensureTables;
|
|
781
|
+
private prepareStatements;
|
|
782
|
+
private stmt;
|
|
783
|
+
cleanupExpiredSessions(): Promise<number>;
|
|
784
|
+
cleanupOldAuditLogs(retentionDays?: number): Promise<number>;
|
|
785
|
+
getStats(): Promise<{
|
|
786
|
+
userCount: number;
|
|
787
|
+
activeSessionCount: number;
|
|
788
|
+
auditLogCount: number;
|
|
789
|
+
}>;
|
|
790
|
+
createUser(data: {
|
|
791
|
+
email: string;
|
|
792
|
+
password: string;
|
|
793
|
+
name?: string;
|
|
794
|
+
role?: UserRole;
|
|
795
|
+
avatar?: string;
|
|
796
|
+
tenantId?: string;
|
|
797
|
+
}): Promise<AuthUser>;
|
|
798
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
799
|
+
findUserById(userId: string): Promise<AuthUser | null>;
|
|
800
|
+
updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
801
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
802
|
+
hashPassword(password: string): Promise<string>;
|
|
803
|
+
verifyPassword(email: string, password: string): Promise<AuthUser | null>;
|
|
804
|
+
createSession(userId: string, data?: {
|
|
805
|
+
ipAddress?: string;
|
|
806
|
+
userAgent?: string;
|
|
807
|
+
}): Promise<Session>;
|
|
808
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
809
|
+
findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
|
|
810
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
811
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
812
|
+
hasAnyUsers(): Promise<boolean>;
|
|
813
|
+
findUsers(options?: {
|
|
814
|
+
page?: number;
|
|
815
|
+
limit?: number;
|
|
816
|
+
search?: string;
|
|
817
|
+
}): Promise<{
|
|
818
|
+
users: AuthUser[];
|
|
819
|
+
total: number;
|
|
820
|
+
}>;
|
|
821
|
+
addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
|
|
822
|
+
getPasswordHistory(userId: string, count?: number): Promise<string[]>;
|
|
823
|
+
isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
|
|
824
|
+
recordFailedAttempt(userId: string): Promise<void>;
|
|
825
|
+
resetAttempts(userId: string): Promise<void>;
|
|
826
|
+
checkLockout(userId: string): Promise<{
|
|
827
|
+
locked: boolean;
|
|
828
|
+
attemptsRemaining: number;
|
|
829
|
+
lockedUntil?: Date;
|
|
830
|
+
totalAttempts: number;
|
|
831
|
+
}>;
|
|
832
|
+
logAudit(data: {
|
|
833
|
+
action: string;
|
|
834
|
+
userId?: string;
|
|
835
|
+
userEmail?: string;
|
|
836
|
+
role?: string;
|
|
837
|
+
resource: string;
|
|
838
|
+
resourceId?: string;
|
|
839
|
+
ipAddress?: string;
|
|
840
|
+
userAgent?: string;
|
|
841
|
+
success: boolean;
|
|
842
|
+
error?: string;
|
|
843
|
+
metadata?: Record<string, unknown>;
|
|
844
|
+
}): Promise<string>;
|
|
845
|
+
queryAuditLogs(options?: {
|
|
846
|
+
action?: string;
|
|
847
|
+
userId?: string;
|
|
848
|
+
resource?: string;
|
|
849
|
+
success?: boolean;
|
|
850
|
+
startDate?: Date;
|
|
851
|
+
endDate?: Date;
|
|
852
|
+
limit?: number;
|
|
853
|
+
offset?: number;
|
|
854
|
+
}): Promise<{
|
|
855
|
+
logs: Array<{
|
|
856
|
+
id: string;
|
|
857
|
+
timestamp: Date;
|
|
858
|
+
action: string;
|
|
859
|
+
userId?: string;
|
|
860
|
+
userEmail?: string;
|
|
861
|
+
resource: string;
|
|
862
|
+
resourceId?: string;
|
|
863
|
+
ipAddress?: string;
|
|
864
|
+
userAgent?: string;
|
|
865
|
+
success: boolean;
|
|
866
|
+
error?: string;
|
|
867
|
+
metadata?: Record<string, unknown>;
|
|
868
|
+
}>;
|
|
869
|
+
total: number;
|
|
870
|
+
}>;
|
|
871
|
+
private rowToUser;
|
|
872
|
+
private rowToSession;
|
|
873
|
+
findAuditLogs(filter: AuditLogFilter): Promise<{
|
|
874
|
+
logs: AuditLog[];
|
|
875
|
+
total: number;
|
|
876
|
+
}>;
|
|
877
|
+
createAuditLog(data: Omit<AuditLog, "id" | "timestamp">): Promise<AuditLog>;
|
|
878
|
+
createEmailVerificationToken(userId: string): Promise<{
|
|
879
|
+
token: string;
|
|
880
|
+
expiresAt: Date;
|
|
881
|
+
}>;
|
|
882
|
+
verifyEmailToken(token: string): Promise<{
|
|
883
|
+
success: boolean;
|
|
884
|
+
userId?: string;
|
|
885
|
+
error?: string;
|
|
886
|
+
}>;
|
|
887
|
+
createPasswordResetToken(email: string): Promise<{
|
|
888
|
+
token: string;
|
|
889
|
+
expiresAt: Date;
|
|
890
|
+
error?: string;
|
|
891
|
+
}>;
|
|
892
|
+
resetPasswordWithToken(token: string, newPassword: string): Promise<{
|
|
893
|
+
success: boolean;
|
|
894
|
+
error?: string;
|
|
895
|
+
}>;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
type VersionStatus = 'draft' | 'published' | 'archived';
|
|
899
|
+
interface Version<T = Record<string, unknown>> {
|
|
900
|
+
id: string;
|
|
901
|
+
collection: string;
|
|
902
|
+
documentId: string;
|
|
903
|
+
version: number;
|
|
904
|
+
status: VersionStatus;
|
|
905
|
+
data: T;
|
|
906
|
+
createdBy: string;
|
|
907
|
+
createdAt: Date;
|
|
908
|
+
publishedAt?: Date;
|
|
909
|
+
changeDescription?: string;
|
|
910
|
+
}
|
|
911
|
+
interface VersionDiff {
|
|
912
|
+
field: string;
|
|
913
|
+
oldValue: unknown;
|
|
914
|
+
newValue: unknown;
|
|
915
|
+
}
|
|
916
|
+
interface VersionHistoryOptions {
|
|
917
|
+
collection: string;
|
|
918
|
+
documentId: string;
|
|
919
|
+
limit?: number;
|
|
920
|
+
offset?: number;
|
|
921
|
+
}
|
|
922
|
+
interface CreateVersionOptions<T = Record<string, unknown>> {
|
|
923
|
+
collection: string;
|
|
924
|
+
documentId: string;
|
|
925
|
+
data: T;
|
|
926
|
+
status?: VersionStatus;
|
|
927
|
+
createdBy: string;
|
|
928
|
+
changeDescription?: string;
|
|
929
|
+
}
|
|
930
|
+
interface PublishVersionOptions {
|
|
931
|
+
collection: string;
|
|
932
|
+
documentId: string;
|
|
933
|
+
versionId: string;
|
|
934
|
+
publishedBy: string;
|
|
935
|
+
}
|
|
936
|
+
interface CompareVersionsOptions {
|
|
937
|
+
collection: string;
|
|
938
|
+
documentId: string;
|
|
939
|
+
versionA: string | number;
|
|
940
|
+
versionB: string | number;
|
|
941
|
+
}
|
|
942
|
+
interface VersionAdapter {
|
|
943
|
+
createVersion<T>(options: CreateVersionOptions<T>): Promise<Version<T>>;
|
|
944
|
+
getVersion<T>(collection: string, versionId: string): Promise<Version<T> | null>;
|
|
945
|
+
getVersions<T>(options: VersionHistoryOptions): Promise<Version<T>[]>;
|
|
946
|
+
getLatestVersion<T>(collection: string, documentId: string): Promise<Version<T> | null>;
|
|
947
|
+
getPublishedVersion<T>(collection: string, documentId: string): Promise<Version<T> | null>;
|
|
948
|
+
publishVersion(options: PublishVersionOptions): Promise<void>;
|
|
949
|
+
revertToVersion<T>(options: {
|
|
950
|
+
collection: string;
|
|
951
|
+
documentId: string;
|
|
952
|
+
versionId: string;
|
|
953
|
+
userId: string;
|
|
954
|
+
}): Promise<Version<T>>;
|
|
955
|
+
compareVersions<T>(options: CompareVersionsOptions): Promise<VersionDiff[]>;
|
|
956
|
+
deleteVersions(collection: string, documentId: string): Promise<void>;
|
|
957
|
+
}
|
|
958
|
+
interface DraftPublishConfig {
|
|
959
|
+
enabled?: boolean;
|
|
960
|
+
draftsEnabled?: boolean;
|
|
961
|
+
publishEnabled?: boolean;
|
|
962
|
+
scheduleEnabled?: boolean;
|
|
963
|
+
versioningEnabled?: boolean;
|
|
964
|
+
maxVersionsPerDocument?: number;
|
|
965
|
+
autoPublish?: boolean;
|
|
966
|
+
requirePublishPermission?: boolean;
|
|
967
|
+
}
|
|
968
|
+
interface VersionPublishSchedule {
|
|
969
|
+
versionId: string;
|
|
970
|
+
scheduledFor: Date;
|
|
971
|
+
status: 'pending' | 'published' | 'cancelled';
|
|
972
|
+
}
|
|
973
|
+
declare function getDefaultDraftPublishConfig(): Required<DraftPublishConfig>;
|
|
974
|
+
|
|
975
|
+
declare class VersionManager<T = Record<string, unknown>> {
|
|
976
|
+
private adapter;
|
|
977
|
+
private config;
|
|
978
|
+
constructor(adapter: VersionAdapter, config?: DraftPublishConfig);
|
|
979
|
+
createVersion(options: Omit<CreateVersionOptions<T>, 'version'>): Promise<Version<T>>;
|
|
980
|
+
publishVersion(options: PublishVersionOptions): Promise<void>;
|
|
981
|
+
unpublishDocument(collection: string, documentId: string): Promise<void>;
|
|
982
|
+
revertToVersion(collection: string, documentId: string, versionId: string, userId: string): Promise<Version<T>>;
|
|
983
|
+
getVersionHistory(collection: string, documentId: string, limit?: number, offset?: number): Promise<Version<T>[]>;
|
|
984
|
+
compareTwoVersions(collection: string, documentId: string, versionA: string | number, versionB: string | number): Promise<VersionDiff[]>;
|
|
985
|
+
getLatestDraft(collection: string, documentId: string): Promise<Version<T> | null>;
|
|
986
|
+
getPublishedVersion(collection: string, documentId: string): Promise<Version<T> | null>;
|
|
987
|
+
getVersion(collection: string, versionId: string): Promise<Version<T> | null>;
|
|
988
|
+
schedulePublish(collection: string, documentId: string, versionId: string, scheduledFor: Date): Promise<void>;
|
|
989
|
+
deleteVersionHistory(collection: string, documentId: string): Promise<void>;
|
|
990
|
+
private pruneOldVersions;
|
|
991
|
+
}
|
|
992
|
+
declare function createVersionManager<T>(adapter: VersionAdapter, config?: DraftPublishConfig): VersionManager<T>;
|
|
993
|
+
declare function isPublished(status: VersionStatus): boolean;
|
|
994
|
+
declare function isDraft(status: VersionStatus): boolean;
|
|
995
|
+
declare function isArchived(status: VersionStatus): boolean;
|
|
996
|
+
|
|
997
|
+
type ExtendedDialect = Dialect | "mongodb";
|
|
998
|
+
interface MediaSearchParams {
|
|
999
|
+
page?: number;
|
|
1000
|
+
limit?: number;
|
|
1001
|
+
search?: string;
|
|
1002
|
+
type?: string;
|
|
1003
|
+
folder?: string;
|
|
1004
|
+
sortBy?: string;
|
|
1005
|
+
sortDir?: "asc" | "desc";
|
|
1006
|
+
}
|
|
1007
|
+
interface MediaRow {
|
|
1008
|
+
id: string;
|
|
1009
|
+
filename: string;
|
|
1010
|
+
title: string | null;
|
|
1011
|
+
originalName: string;
|
|
1012
|
+
mimeType: string;
|
|
1013
|
+
fileSize: number;
|
|
1014
|
+
width: number | null;
|
|
1015
|
+
height: number | null;
|
|
1016
|
+
url: string;
|
|
1017
|
+
thumbnailUrl: string | null;
|
|
1018
|
+
folder: string | null;
|
|
1019
|
+
provider: string;
|
|
1020
|
+
alt: string | null;
|
|
1021
|
+
caption: string | null;
|
|
1022
|
+
metadata: string | null;
|
|
1023
|
+
createdAt: string;
|
|
1024
|
+
updatedAt: string;
|
|
1025
|
+
}
|
|
1026
|
+
declare class MediaService {
|
|
1027
|
+
private db;
|
|
1028
|
+
private storage;
|
|
1029
|
+
private dialect;
|
|
1030
|
+
private genId;
|
|
1031
|
+
private mediaTable;
|
|
1032
|
+
private foldersTable;
|
|
1033
|
+
constructor(db: any, storage: StorageProvider, options?: {
|
|
1034
|
+
dialect?: ExtendedDialect;
|
|
1035
|
+
genId?: () => string;
|
|
1036
|
+
});
|
|
1037
|
+
static init(db: any, options?: {
|
|
1038
|
+
dialect?: ExtendedDialect;
|
|
1039
|
+
genId?: () => string;
|
|
1040
|
+
storageConfig?: any;
|
|
1041
|
+
}): Promise<MediaService>;
|
|
1042
|
+
private ensureTables;
|
|
1043
|
+
private now;
|
|
1044
|
+
private buildFindConditions;
|
|
1045
|
+
private rowToMedia;
|
|
1046
|
+
static resolveMediaUrl(url: string | null | undefined, origin?: string): string | null;
|
|
1047
|
+
private sqliteRun;
|
|
1048
|
+
private sqliteGet;
|
|
1049
|
+
upload(file: File, folder?: string, origin?: string): Promise<MediaRow>;
|
|
1050
|
+
uploadFromUrl(url: string, folder?: string, origin?: string): Promise<MediaRow>;
|
|
1051
|
+
delete(id: string, origin?: string): Promise<void>;
|
|
1052
|
+
deleteFile(url: string): Promise<void>;
|
|
1053
|
+
rename(id: string, newKey: string, origin?: string): Promise<MediaRow | null>;
|
|
1054
|
+
findById(id: string, origin?: string): Promise<MediaRow | null>;
|
|
1055
|
+
find(params?: MediaSearchParams, origin?: string): Promise<{
|
|
1056
|
+
docs: MediaRow[];
|
|
1057
|
+
totalDocs: number;
|
|
1058
|
+
page: number;
|
|
1059
|
+
limit: number;
|
|
1060
|
+
totalPages: number;
|
|
1061
|
+
}>;
|
|
1062
|
+
update(id: string, data: {
|
|
1063
|
+
title?: string;
|
|
1064
|
+
alt?: string;
|
|
1065
|
+
caption?: string;
|
|
1066
|
+
folder?: string;
|
|
1067
|
+
metadata?: any;
|
|
1068
|
+
originalName?: string;
|
|
1069
|
+
}, origin?: string): Promise<MediaRow | null>;
|
|
1070
|
+
updateMany(ids: string[], data: {
|
|
1071
|
+
folder?: string;
|
|
1072
|
+
}): Promise<void>;
|
|
1073
|
+
listFolders(): Promise<string[]>;
|
|
1074
|
+
createFolder(name: string, parentPath?: string): Promise<void>;
|
|
1075
|
+
deleteFolder(folder: string): Promise<void>;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
declare function defineConfig(config: {
|
|
1079
|
+
collections?: CollectionConfig[] | Record<string, CollectionConfig>;
|
|
1080
|
+
globals?: GlobalConfig[] | Record<string, GlobalConfig>;
|
|
1081
|
+
adapter: KyroConfig["adapter"];
|
|
1082
|
+
plugins?: KyroConfig["plugins"];
|
|
1083
|
+
auth?: KyroConfig["auth"];
|
|
1084
|
+
cors?: KyroConfig["cors"];
|
|
1085
|
+
admin?: KyroConfig["admin"];
|
|
1086
|
+
upload?: KyroConfig["upload"];
|
|
1087
|
+
graphQL?: KyroConfig["graphQL"];
|
|
1088
|
+
typescript?: KyroConfig["typescript"];
|
|
1089
|
+
localization?: KyroConfig["localization"];
|
|
1090
|
+
rateLimit?: KyroConfig["rateLimit"];
|
|
1091
|
+
debug?: KyroConfig["debug"];
|
|
1092
|
+
}): KyroConfig;
|
|
1093
|
+
declare const defineKyroConfig: typeof defineConfig;
|
|
1094
|
+
|
|
1095
|
+
interface SeoTagsOptions {
|
|
1096
|
+
siteSettings: any;
|
|
1097
|
+
seoSettings?: any;
|
|
1098
|
+
title?: string;
|
|
1099
|
+
description?: string;
|
|
1100
|
+
image?: string;
|
|
1101
|
+
url?: string;
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Generates standard SEO meta tags based on global site settings and page overrides.
|
|
1105
|
+
*/
|
|
1106
|
+
declare function generateSeoTags(options: SeoTagsOptions): string;
|
|
1107
|
+
/**
|
|
1108
|
+
* Generates analytics script tags based on global site settings.
|
|
1109
|
+
*/
|
|
1110
|
+
declare function generateAnalyticsTags(siteSettings: any): string;
|
|
1111
|
+
|
|
1112
|
+
interface SocialLink {
|
|
1113
|
+
platform: string;
|
|
1114
|
+
url: string;
|
|
1115
|
+
label: string;
|
|
1116
|
+
}
|
|
1117
|
+
declare function getSocialLinksFromSettings(socialSettings: any): SocialLink[];
|
|
1118
|
+
declare function getSocialLinks(db: BaseAdapter, options?: {
|
|
1119
|
+
draft?: boolean;
|
|
1120
|
+
}): Promise<SocialLink[]>;
|
|
1121
|
+
|
|
1122
|
+
interface StoreConfig {
|
|
1123
|
+
storeName?: string;
|
|
1124
|
+
storeEmail?: string;
|
|
1125
|
+
storePhone?: string;
|
|
1126
|
+
address?: {
|
|
1127
|
+
street?: string;
|
|
1128
|
+
city?: string;
|
|
1129
|
+
state?: string;
|
|
1130
|
+
postalCode?: string;
|
|
1131
|
+
country?: string;
|
|
1132
|
+
};
|
|
1133
|
+
currency?: {
|
|
1134
|
+
code?: string;
|
|
1135
|
+
symbol?: string;
|
|
1136
|
+
position?: "before" | "after";
|
|
1137
|
+
decimals?: number;
|
|
1138
|
+
};
|
|
1139
|
+
tax?: {
|
|
1140
|
+
enabled?: boolean;
|
|
1141
|
+
rate?: number;
|
|
1142
|
+
includedInPrice?: boolean;
|
|
1143
|
+
taxId?: string;
|
|
1144
|
+
};
|
|
1145
|
+
shipping?: {
|
|
1146
|
+
enableLocalPickup?: boolean;
|
|
1147
|
+
flatRate?: number;
|
|
1148
|
+
freeShippingThreshold?: number;
|
|
1149
|
+
};
|
|
1150
|
+
orders?: {
|
|
1151
|
+
orderNumberPrefix?: string;
|
|
1152
|
+
allowGuestCheckout?: boolean;
|
|
1153
|
+
requirePhone?: boolean;
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
declare function getStoreConfigFromSettings(settings: any): StoreConfig;
|
|
1157
|
+
declare function getStoreConfig(db: BaseAdapter, options?: {
|
|
1158
|
+
draft?: boolean;
|
|
1159
|
+
}): Promise<StoreConfig>;
|
|
1160
|
+
|
|
1161
|
+
interface PaymentConfig {
|
|
1162
|
+
testMode?: boolean;
|
|
1163
|
+
provider?: "stripe" | "paypal" | "square" | "manual";
|
|
1164
|
+
stripe?: {
|
|
1165
|
+
enabled?: boolean;
|
|
1166
|
+
publishableKey?: string;
|
|
1167
|
+
secretKey?: string;
|
|
1168
|
+
webhookSecret?: string;
|
|
1169
|
+
};
|
|
1170
|
+
paypal?: {
|
|
1171
|
+
enabled?: boolean;
|
|
1172
|
+
clientId?: string;
|
|
1173
|
+
clientSecret?: string;
|
|
1174
|
+
mode?: "sandbox" | "live";
|
|
1175
|
+
};
|
|
1176
|
+
square?: {
|
|
1177
|
+
enabled?: boolean;
|
|
1178
|
+
applicationId?: string;
|
|
1179
|
+
accessToken?: string;
|
|
1180
|
+
locationId?: string;
|
|
1181
|
+
};
|
|
1182
|
+
methods?: {
|
|
1183
|
+
cod?: boolean;
|
|
1184
|
+
bankTransfer?: boolean;
|
|
1185
|
+
cash?: boolean;
|
|
1186
|
+
check?: boolean;
|
|
1187
|
+
};
|
|
1188
|
+
bankTransfer?: {
|
|
1189
|
+
bankName?: string;
|
|
1190
|
+
accountName?: string;
|
|
1191
|
+
accountNumber?: string;
|
|
1192
|
+
routingNumber?: string;
|
|
1193
|
+
iban?: string;
|
|
1194
|
+
swift?: string;
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
declare function getPaymentConfigFromSettings(settings: any): PaymentConfig;
|
|
1198
|
+
declare function getPaymentConfig(db: BaseAdapter, options?: {
|
|
1199
|
+
draft?: boolean;
|
|
1200
|
+
}): Promise<PaymentConfig>;
|
|
1201
|
+
|
|
1202
|
+
type StorageAdapter = 'indexeddb' | 'fs' | 'redis' | 'sqlite' | 'postgres';
|
|
1203
|
+
type Environment = 'browser' | 'node';
|
|
1204
|
+
interface EncryptionConfig {
|
|
1205
|
+
enabled: boolean;
|
|
1206
|
+
algorithm?: 'AES-256-GCM' | 'ChaCha20-Poly1305';
|
|
1207
|
+
}
|
|
1208
|
+
interface StorageConfig {
|
|
1209
|
+
environment: Environment;
|
|
1210
|
+
adapter?: StorageAdapter;
|
|
1211
|
+
connectionString?: string;
|
|
1212
|
+
encryption?: EncryptionConfig;
|
|
1213
|
+
}
|
|
1214
|
+
interface StorageOptions {
|
|
1215
|
+
namespace?: string;
|
|
1216
|
+
ttl?: number;
|
|
1217
|
+
}
|
|
1218
|
+
type CreateStorageResult = {
|
|
1219
|
+
storage: {
|
|
1220
|
+
getItem: (name: string) => string | null | Promise<string | null>;
|
|
1221
|
+
setItem: (name: string, value: string) => void | Promise<void>;
|
|
1222
|
+
removeItem: (name: string) => void | Promise<void>;
|
|
1223
|
+
};
|
|
1224
|
+
cleanup?: () => Promise<void>;
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
declare function createStorage(config: StorageConfig): Promise<CreateStorageResult & {
|
|
1228
|
+
storage: _StateStorage;
|
|
1229
|
+
}>;
|
|
1230
|
+
type _StateStorage = {
|
|
1231
|
+
getItem: (name: string) => string | null | Promise<string | null>;
|
|
1232
|
+
setItem: (name: string, value: string) => void | Promise<void>;
|
|
1233
|
+
removeItem: (name: string) => void | Promise<void>;
|
|
1234
|
+
};
|
|
1235
|
+
declare function createAuthStorage(config: StorageConfig): Promise<CreateStorageResult>;
|
|
1236
|
+
|
|
1237
|
+
declare function setDbAdapter(adapter: any): void;
|
|
1238
|
+
declare function loadSecrets(): Promise<void>;
|
|
1239
|
+
declare function getAppSecret(): string;
|
|
1240
|
+
declare function getEncryptionKey(): string;
|
|
1241
|
+
declare function getSessionConfig(): {
|
|
1242
|
+
maxAge: number;
|
|
1243
|
+
maxSessionsPerUser: number;
|
|
1244
|
+
};
|
|
1245
|
+
|
|
1246
|
+
export { AbstractBaseAdapter, AccountLockout, type AdapterOptions, AuditLog, AuditLogFilter, AuditLogger, Auth, AuthAdapter, AuthResult, Session as AuthSession, AuthTokenConfig, AuthUser, BaseAdapter, CollectionConfig, type CompareVersionsOptions, ConfigValidationError, CreateArgs, type CreateStorageResult, type CreateVersionOptions, type DatabaseConnectionOptions, type DatabaseType, type DatabaseType$1 as DbAdapterType, DeleteArgs, DeliveryOptions, DeliveryResult, Dialect, type DraftPublishConfig, type DrizzleAdapterOptions, EmailTransport, type EncryptionConfig, type Environment, Field, FindArgs, FindByIDArgs, FindResult, GlobalConfig, InMemoryAccountLockout, InMemoryAuditLogger, InMemoryAuthAdapter, InMemoryRateLimiter, JWTPayload, Kyro, type KyroAuthConfig, KyroConfig, KyroPubSub, KyroWSServer, LocalAdapter, LoginCredentials, MediaService, type MongoDBAdapterOptions, PasswordPolicy, type PaymentConfig, PluginManager, type PublishVersionOptions, RateLimiter, RedisAuthAdapter, RegisterData, Registry, Request$1 as Request, SQLiteAuthAdapter, type SeoTagsOptions, Session, type SocialLink, type StorageAdapter, type StorageOptions, type StoreConfig, UpdateArgs, User, UserRole, type Version, type VersionAdapter, type VersionDiff, type VersionHistoryOptions, VersionManager, type VersionPublishSchedule, type VersionStatus, WebhookConfig, WebhookDelivery, WebhookPayload, WebhookService, applyCollectionOverrides, authConfig, autoBootstrap, bootstrapAdmin, bootstrapWithRetry, buildDeliveryRecord, collectionToCreateZod, collectionToUpdateZod, collectionToWhereZod, collectionToZod, createAuditContext, createAuth, createAuthConfig, createAuthStorage, createKyro, createLocalAdapter, createLocalStorage, createStorage, createTestPayload, createVersionManager, defineConfig, defineKyroConfig, deliverWebhook, deliverWithRetry, fieldToZod, generateAnalyticsTags, generateSeoTags, generateWebhookSecret, getAppSecret, getBootstrapFromEnv, getDefaultDraftPublishConfig, getEncryptionKey, getPaymentConfig, getPaymentConfigFromSettings, getSessionConfig, getSocialLinks, getSocialLinksFromSettings, getStoreConfig, getStoreConfigFromSettings, globalToZod, isArchived, isDraft, isPublished, loadSecrets, setDbAdapter, signPayload, validateCollection, validateConfig, validateFields, validateGlobal };
|