@eldrin-project/eldrin-app-core 0.0.3 → 0.0.5
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 +321 -131
- package/dist/index.cjs +0 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -258
- package/dist/index.d.ts +1 -258
- package/dist/index.js +1 -192
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +110 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +104 -0
- package/dist/node.d.ts +104 -0
- package/dist/node.js +107 -0
- package/dist/node.js.map +1 -0
- package/package.json +16 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* Core types for @eldrin-project/eldrin-app-core
|
|
6
3
|
*/
|
|
@@ -145,170 +142,6 @@ interface AppManifest {
|
|
|
145
142
|
*/
|
|
146
143
|
groups?: ManifestGroup[];
|
|
147
144
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Options for createApp factory
|
|
150
|
-
*/
|
|
151
|
-
interface CreateAppOptions {
|
|
152
|
-
/** Unique app identifier */
|
|
153
|
-
name: string;
|
|
154
|
-
/** Root React component */
|
|
155
|
-
root: React.ComponentType<unknown>;
|
|
156
|
-
/** App manifest (optional, can be loaded from file) */
|
|
157
|
-
manifest?: AppManifest;
|
|
158
|
-
/** Migration files (loaded at build time via Vite plugin) */
|
|
159
|
-
migrations?: MigrationFile[];
|
|
160
|
-
/** Called when migrations complete successfully */
|
|
161
|
-
onMigrationsComplete?: (result: MigrationResult) => void;
|
|
162
|
-
/** Called when migrations fail */
|
|
163
|
-
onMigrationError?: (error: Error) => void;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Database context passed to app components
|
|
167
|
-
*/
|
|
168
|
-
interface DatabaseContext {
|
|
169
|
-
/** D1 database instance (null if app has no database) */
|
|
170
|
-
db: D1Database | null;
|
|
171
|
-
/** Whether migrations have completed */
|
|
172
|
-
migrationsComplete: boolean;
|
|
173
|
-
/** Migration result (if migrations were run) */
|
|
174
|
-
migrationResult?: MigrationResult;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Eldrin context provided to apps
|
|
178
|
-
*/
|
|
179
|
-
interface EldrinContext {
|
|
180
|
-
/** App ID */
|
|
181
|
-
appId: string;
|
|
182
|
-
/** Database context */
|
|
183
|
-
database: DatabaseContext;
|
|
184
|
-
/** Environment variables */
|
|
185
|
-
env: Record<string, string>;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* App factory for creating Eldrin apps
|
|
190
|
-
*
|
|
191
|
-
* Returns single-spa compatible lifecycle functions with:
|
|
192
|
-
* - Automatic migration execution on bootstrap
|
|
193
|
-
* - Database provider wrapping
|
|
194
|
-
* - Error boundary integration
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Single-spa lifecycle props passed to lifecycle functions
|
|
199
|
-
*/
|
|
200
|
-
interface LifecycleProps {
|
|
201
|
-
/** DOM element to mount the app into */
|
|
202
|
-
domElement?: HTMLElement;
|
|
203
|
-
/** App name */
|
|
204
|
-
name?: string;
|
|
205
|
-
/** D1 Database instance (provided by shell) */
|
|
206
|
-
db?: D1Database;
|
|
207
|
-
/** Custom props from shell */
|
|
208
|
-
customProps?: Record<string, unknown>;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Single-spa compatible lifecycle object
|
|
212
|
-
*/
|
|
213
|
-
interface AppLifecycle {
|
|
214
|
-
bootstrap: (props: LifecycleProps) => Promise<void>;
|
|
215
|
-
mount: (props: LifecycleProps) => Promise<void>;
|
|
216
|
-
unmount: (props: LifecycleProps) => Promise<void>;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Create an Eldrin app with single-spa compatible lifecycle
|
|
220
|
-
*
|
|
221
|
-
* @param options - App configuration
|
|
222
|
-
* @returns Object with bootstrap, mount, and unmount lifecycle functions
|
|
223
|
-
*
|
|
224
|
-
* @example
|
|
225
|
-
* ```tsx
|
|
226
|
-
* // src/index.tsx
|
|
227
|
-
* import { createApp } from '@eldrin-project/eldrin-app-core';
|
|
228
|
-
* import App from './App';
|
|
229
|
-
*
|
|
230
|
-
* export const { bootstrap, mount, unmount } = createApp({
|
|
231
|
-
* name: 'invoicing',
|
|
232
|
-
* root: App,
|
|
233
|
-
* // Migrations loaded via Vite plugin
|
|
234
|
-
* });
|
|
235
|
-
* ```
|
|
236
|
-
*/
|
|
237
|
-
declare function createApp(options: CreateAppOptions): AppLifecycle;
|
|
238
|
-
/**
|
|
239
|
-
* Type helper for migration files loaded via Vite plugin
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* ```tsx
|
|
243
|
-
* // With Vite plugin
|
|
244
|
-
* import { createApp, type MigrationFiles } from '@eldrin-project/eldrin-app-core';
|
|
245
|
-
* import migrations from 'virtual:eldrin/migrations';
|
|
246
|
-
*
|
|
247
|
-
* export const { bootstrap, mount, unmount } = createApp({
|
|
248
|
-
* name: 'invoicing',
|
|
249
|
-
* root: App,
|
|
250
|
-
* migrations: migrations as MigrationFiles,
|
|
251
|
-
* });
|
|
252
|
-
* ```
|
|
253
|
-
*/
|
|
254
|
-
type MigrationFiles = MigrationFile[];
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Props for DatabaseProvider
|
|
258
|
-
*/
|
|
259
|
-
interface DatabaseProviderProps {
|
|
260
|
-
/** D1 database instance (null if app has no database) */
|
|
261
|
-
db: D1Database | null;
|
|
262
|
-
/** Whether migrations have completed */
|
|
263
|
-
migrationsComplete: boolean;
|
|
264
|
-
/** Migration result */
|
|
265
|
-
migrationResult?: MigrationResult;
|
|
266
|
-
/** Child components */
|
|
267
|
-
children: ReactNode;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Provider component for database context
|
|
271
|
-
*/
|
|
272
|
-
declare function DatabaseProvider({ db, migrationsComplete, migrationResult, children, }: DatabaseProviderProps): react_jsx_runtime.JSX.Element;
|
|
273
|
-
/**
|
|
274
|
-
* Hook to access the app's D1 database
|
|
275
|
-
*
|
|
276
|
-
* @returns D1Database instance or null if app has no database
|
|
277
|
-
* @throws Error if used outside of DatabaseProvider
|
|
278
|
-
*
|
|
279
|
-
* @example
|
|
280
|
-
* ```tsx
|
|
281
|
-
* function InvoiceList() {
|
|
282
|
-
* const db = useDatabase();
|
|
283
|
-
*
|
|
284
|
-
* if (!db) {
|
|
285
|
-
* return <div>No database configured</div>;
|
|
286
|
-
* }
|
|
287
|
-
*
|
|
288
|
-
* const { results } = await db.prepare(
|
|
289
|
-
* 'SELECT * FROM invoices ORDER BY created_at DESC'
|
|
290
|
-
* ).all();
|
|
291
|
-
*
|
|
292
|
-
* return <div>{results.map(invoice => ...)}</div>;
|
|
293
|
-
* }
|
|
294
|
-
* ```
|
|
295
|
-
*/
|
|
296
|
-
declare function useDatabase(): D1Database | null;
|
|
297
|
-
/**
|
|
298
|
-
* Hook to access full database context including migration status
|
|
299
|
-
*
|
|
300
|
-
* @returns DatabaseContext object
|
|
301
|
-
* @throws Error if used outside of DatabaseProvider
|
|
302
|
-
*/
|
|
303
|
-
declare function useDatabaseContext(): DatabaseContext;
|
|
304
|
-
/**
|
|
305
|
-
* Hook to check if migrations have completed
|
|
306
|
-
*
|
|
307
|
-
* Useful for showing loading states while migrations run
|
|
308
|
-
*
|
|
309
|
-
* @returns true if migrations are complete
|
|
310
|
-
*/
|
|
311
|
-
declare function useMigrationsComplete(): boolean;
|
|
312
145
|
|
|
313
146
|
/**
|
|
314
147
|
* Migration runner for Eldrin apps
|
|
@@ -466,96 +299,6 @@ declare function extractTimestamp(filename: string): string | null;
|
|
|
466
299
|
*/
|
|
467
300
|
declare function getRollbackFilename(migrationFilename: string): string;
|
|
468
301
|
|
|
469
|
-
/**
|
|
470
|
-
* Marketplace utilities for migration packaging
|
|
471
|
-
*
|
|
472
|
-
* Provides tools to generate migration manifests for marketplace distribution.
|
|
473
|
-
* This is used at build time to prepare apps for submission.
|
|
474
|
-
*/
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Migration entry in the marketplace manifest
|
|
478
|
-
*/
|
|
479
|
-
interface MigrationManifestEntry {
|
|
480
|
-
/** Migration ID (timestamp) */
|
|
481
|
-
id: string;
|
|
482
|
-
/** Full filename */
|
|
483
|
-
file: string;
|
|
484
|
-
/** SHA-256 checksum with prefix */
|
|
485
|
-
checksum: string;
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Marketplace migration manifest format
|
|
489
|
-
*/
|
|
490
|
-
interface MigrationManifest {
|
|
491
|
-
/** Logical database name (used for table prefixing) */
|
|
492
|
-
database: string;
|
|
493
|
-
/** List of migrations in order */
|
|
494
|
-
migrations: MigrationManifestEntry[];
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Options for generating migration manifest
|
|
498
|
-
*/
|
|
499
|
-
interface GenerateMigrationManifestOptions {
|
|
500
|
-
/** Directory containing migration SQL files */
|
|
501
|
-
migrationsDir: string;
|
|
502
|
-
/** Logical database name for the app */
|
|
503
|
-
database: string;
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Result of migration manifest generation
|
|
507
|
-
*/
|
|
508
|
-
interface GenerateMigrationManifestResult {
|
|
509
|
-
/** The generated manifest */
|
|
510
|
-
manifest: MigrationManifest;
|
|
511
|
-
/** Migration files with content (for copying to output) */
|
|
512
|
-
files: MigrationFile[];
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Generate a marketplace migration manifest from migration files
|
|
516
|
-
*
|
|
517
|
-
* Reads migration files from the specified directory and generates
|
|
518
|
-
* a manifest with checksums suitable for marketplace distribution.
|
|
519
|
-
*
|
|
520
|
-
* @param options - Generation options
|
|
521
|
-
* @returns Manifest and file contents
|
|
522
|
-
*
|
|
523
|
-
* @example
|
|
524
|
-
* ```typescript
|
|
525
|
-
* import { generateMigrationManifest } from '@eldrin-project/eldrin-app-core';
|
|
526
|
-
*
|
|
527
|
-
* const result = await generateMigrationManifest({
|
|
528
|
-
* migrationsDir: './migrations',
|
|
529
|
-
* database: 'invoicing',
|
|
530
|
-
* });
|
|
531
|
-
*
|
|
532
|
-
* // Write manifest to output directory
|
|
533
|
-
* await writeFile(
|
|
534
|
-
* 'dist/migrations/index.json',
|
|
535
|
-
* JSON.stringify(result.manifest, null, 2)
|
|
536
|
-
* );
|
|
537
|
-
*
|
|
538
|
-
* // Copy migration files
|
|
539
|
-
* for (const file of result.files) {
|
|
540
|
-
* await writeFile(`dist/migrations/${file.name}`, file.content);
|
|
541
|
-
* }
|
|
542
|
-
* ```
|
|
543
|
-
*/
|
|
544
|
-
declare function generateMigrationManifest(options: GenerateMigrationManifestOptions): Promise<GenerateMigrationManifestResult>;
|
|
545
|
-
/**
|
|
546
|
-
* Validate a migration manifest against actual files
|
|
547
|
-
*
|
|
548
|
-
* Useful for CI/CD validation in the marketplace-dist repository.
|
|
549
|
-
*
|
|
550
|
-
* @param manifest - The manifest to validate
|
|
551
|
-
* @param files - The actual migration files
|
|
552
|
-
* @returns Validation result with any errors
|
|
553
|
-
*/
|
|
554
|
-
declare function validateMigrationManifest(manifest: MigrationManifest, files: MigrationFile[]): Promise<{
|
|
555
|
-
valid: boolean;
|
|
556
|
-
errors: string[];
|
|
557
|
-
}>;
|
|
558
|
-
|
|
559
302
|
/**
|
|
560
303
|
* Event System Types
|
|
561
304
|
* Types for server-side inter-app event communication
|
|
@@ -1304,4 +1047,4 @@ declare function isPublicRoute(pathname: string, publicRoutes: string[], apiPref
|
|
|
1304
1047
|
*/
|
|
1305
1048
|
declare function createPermissionMiddleware<TEnv = unknown>(config: MiddlewareConfig<TEnv>): PermissionMiddleware<TEnv>;
|
|
1306
1049
|
|
|
1307
|
-
export { AUTH_HEADERS, type AppAuthContext, type
|
|
1050
|
+
export { AUTH_HEADERS, type AppAuthContext, type AppManifest, CHECKSUM_PREFIX, type CompiledRoute, type CorsConfig, type EldrinEnv, type EldrinEvent, EldrinEventClient, type EmitOptions, type EmitResult, type EventClientConfig, type EventDelivery, type EventHandler, type JWTPayload, type JWTVerifyOptions, type ManifestApi, type ManifestForMiddleware, type ManifestGroup, type ManifestPermission, type ManifestRoute, type MiddlewareAuthResult, type MiddlewareConfig, type MiddlewareError, type MiddlewareErrorType, type MiddlewareResponseResult, type MiddlewareResult, type MigrationFile, type MigrationOptions, type MigrationRecord, type MigrationResult, type PermissionMiddleware, type PollOptions, type PollResult, type RegisteredEventType, type RollbackResult, type SubscriptionInfo, calculateChecksum, calculatePrefixedChecksum, compileRoutes, createEventClient, createPermissionMiddleware, extractTimestamp, getAuthContext, getAuthContextFromJWT, getMigrationStatus, getRollbackFilename, hasPermission, hasPlatformRole, isPlatformAdmin, isPublicRoute, isValidMigrationFilename, isValidRollbackFilename, matchRoute, parseSQLStatements, requireAllPermissions, requireAnyPermission, requireAuth, requireJWTAuth, requireJWTPermission, requirePermission, rollbackMigrations, runMigrations, verifyChecksum, verifyJWT };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* Core types for @eldrin-project/eldrin-app-core
|
|
6
3
|
*/
|
|
@@ -145,170 +142,6 @@ interface AppManifest {
|
|
|
145
142
|
*/
|
|
146
143
|
groups?: ManifestGroup[];
|
|
147
144
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Options for createApp factory
|
|
150
|
-
*/
|
|
151
|
-
interface CreateAppOptions {
|
|
152
|
-
/** Unique app identifier */
|
|
153
|
-
name: string;
|
|
154
|
-
/** Root React component */
|
|
155
|
-
root: React.ComponentType<unknown>;
|
|
156
|
-
/** App manifest (optional, can be loaded from file) */
|
|
157
|
-
manifest?: AppManifest;
|
|
158
|
-
/** Migration files (loaded at build time via Vite plugin) */
|
|
159
|
-
migrations?: MigrationFile[];
|
|
160
|
-
/** Called when migrations complete successfully */
|
|
161
|
-
onMigrationsComplete?: (result: MigrationResult) => void;
|
|
162
|
-
/** Called when migrations fail */
|
|
163
|
-
onMigrationError?: (error: Error) => void;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Database context passed to app components
|
|
167
|
-
*/
|
|
168
|
-
interface DatabaseContext {
|
|
169
|
-
/** D1 database instance (null if app has no database) */
|
|
170
|
-
db: D1Database | null;
|
|
171
|
-
/** Whether migrations have completed */
|
|
172
|
-
migrationsComplete: boolean;
|
|
173
|
-
/** Migration result (if migrations were run) */
|
|
174
|
-
migrationResult?: MigrationResult;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Eldrin context provided to apps
|
|
178
|
-
*/
|
|
179
|
-
interface EldrinContext {
|
|
180
|
-
/** App ID */
|
|
181
|
-
appId: string;
|
|
182
|
-
/** Database context */
|
|
183
|
-
database: DatabaseContext;
|
|
184
|
-
/** Environment variables */
|
|
185
|
-
env: Record<string, string>;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* App factory for creating Eldrin apps
|
|
190
|
-
*
|
|
191
|
-
* Returns single-spa compatible lifecycle functions with:
|
|
192
|
-
* - Automatic migration execution on bootstrap
|
|
193
|
-
* - Database provider wrapping
|
|
194
|
-
* - Error boundary integration
|
|
195
|
-
*/
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Single-spa lifecycle props passed to lifecycle functions
|
|
199
|
-
*/
|
|
200
|
-
interface LifecycleProps {
|
|
201
|
-
/** DOM element to mount the app into */
|
|
202
|
-
domElement?: HTMLElement;
|
|
203
|
-
/** App name */
|
|
204
|
-
name?: string;
|
|
205
|
-
/** D1 Database instance (provided by shell) */
|
|
206
|
-
db?: D1Database;
|
|
207
|
-
/** Custom props from shell */
|
|
208
|
-
customProps?: Record<string, unknown>;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Single-spa compatible lifecycle object
|
|
212
|
-
*/
|
|
213
|
-
interface AppLifecycle {
|
|
214
|
-
bootstrap: (props: LifecycleProps) => Promise<void>;
|
|
215
|
-
mount: (props: LifecycleProps) => Promise<void>;
|
|
216
|
-
unmount: (props: LifecycleProps) => Promise<void>;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Create an Eldrin app with single-spa compatible lifecycle
|
|
220
|
-
*
|
|
221
|
-
* @param options - App configuration
|
|
222
|
-
* @returns Object with bootstrap, mount, and unmount lifecycle functions
|
|
223
|
-
*
|
|
224
|
-
* @example
|
|
225
|
-
* ```tsx
|
|
226
|
-
* // src/index.tsx
|
|
227
|
-
* import { createApp } from '@eldrin-project/eldrin-app-core';
|
|
228
|
-
* import App from './App';
|
|
229
|
-
*
|
|
230
|
-
* export const { bootstrap, mount, unmount } = createApp({
|
|
231
|
-
* name: 'invoicing',
|
|
232
|
-
* root: App,
|
|
233
|
-
* // Migrations loaded via Vite plugin
|
|
234
|
-
* });
|
|
235
|
-
* ```
|
|
236
|
-
*/
|
|
237
|
-
declare function createApp(options: CreateAppOptions): AppLifecycle;
|
|
238
|
-
/**
|
|
239
|
-
* Type helper for migration files loaded via Vite plugin
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* ```tsx
|
|
243
|
-
* // With Vite plugin
|
|
244
|
-
* import { createApp, type MigrationFiles } from '@eldrin-project/eldrin-app-core';
|
|
245
|
-
* import migrations from 'virtual:eldrin/migrations';
|
|
246
|
-
*
|
|
247
|
-
* export const { bootstrap, mount, unmount } = createApp({
|
|
248
|
-
* name: 'invoicing',
|
|
249
|
-
* root: App,
|
|
250
|
-
* migrations: migrations as MigrationFiles,
|
|
251
|
-
* });
|
|
252
|
-
* ```
|
|
253
|
-
*/
|
|
254
|
-
type MigrationFiles = MigrationFile[];
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Props for DatabaseProvider
|
|
258
|
-
*/
|
|
259
|
-
interface DatabaseProviderProps {
|
|
260
|
-
/** D1 database instance (null if app has no database) */
|
|
261
|
-
db: D1Database | null;
|
|
262
|
-
/** Whether migrations have completed */
|
|
263
|
-
migrationsComplete: boolean;
|
|
264
|
-
/** Migration result */
|
|
265
|
-
migrationResult?: MigrationResult;
|
|
266
|
-
/** Child components */
|
|
267
|
-
children: ReactNode;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Provider component for database context
|
|
271
|
-
*/
|
|
272
|
-
declare function DatabaseProvider({ db, migrationsComplete, migrationResult, children, }: DatabaseProviderProps): react_jsx_runtime.JSX.Element;
|
|
273
|
-
/**
|
|
274
|
-
* Hook to access the app's D1 database
|
|
275
|
-
*
|
|
276
|
-
* @returns D1Database instance or null if app has no database
|
|
277
|
-
* @throws Error if used outside of DatabaseProvider
|
|
278
|
-
*
|
|
279
|
-
* @example
|
|
280
|
-
* ```tsx
|
|
281
|
-
* function InvoiceList() {
|
|
282
|
-
* const db = useDatabase();
|
|
283
|
-
*
|
|
284
|
-
* if (!db) {
|
|
285
|
-
* return <div>No database configured</div>;
|
|
286
|
-
* }
|
|
287
|
-
*
|
|
288
|
-
* const { results } = await db.prepare(
|
|
289
|
-
* 'SELECT * FROM invoices ORDER BY created_at DESC'
|
|
290
|
-
* ).all();
|
|
291
|
-
*
|
|
292
|
-
* return <div>{results.map(invoice => ...)}</div>;
|
|
293
|
-
* }
|
|
294
|
-
* ```
|
|
295
|
-
*/
|
|
296
|
-
declare function useDatabase(): D1Database | null;
|
|
297
|
-
/**
|
|
298
|
-
* Hook to access full database context including migration status
|
|
299
|
-
*
|
|
300
|
-
* @returns DatabaseContext object
|
|
301
|
-
* @throws Error if used outside of DatabaseProvider
|
|
302
|
-
*/
|
|
303
|
-
declare function useDatabaseContext(): DatabaseContext;
|
|
304
|
-
/**
|
|
305
|
-
* Hook to check if migrations have completed
|
|
306
|
-
*
|
|
307
|
-
* Useful for showing loading states while migrations run
|
|
308
|
-
*
|
|
309
|
-
* @returns true if migrations are complete
|
|
310
|
-
*/
|
|
311
|
-
declare function useMigrationsComplete(): boolean;
|
|
312
145
|
|
|
313
146
|
/**
|
|
314
147
|
* Migration runner for Eldrin apps
|
|
@@ -466,96 +299,6 @@ declare function extractTimestamp(filename: string): string | null;
|
|
|
466
299
|
*/
|
|
467
300
|
declare function getRollbackFilename(migrationFilename: string): string;
|
|
468
301
|
|
|
469
|
-
/**
|
|
470
|
-
* Marketplace utilities for migration packaging
|
|
471
|
-
*
|
|
472
|
-
* Provides tools to generate migration manifests for marketplace distribution.
|
|
473
|
-
* This is used at build time to prepare apps for submission.
|
|
474
|
-
*/
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Migration entry in the marketplace manifest
|
|
478
|
-
*/
|
|
479
|
-
interface MigrationManifestEntry {
|
|
480
|
-
/** Migration ID (timestamp) */
|
|
481
|
-
id: string;
|
|
482
|
-
/** Full filename */
|
|
483
|
-
file: string;
|
|
484
|
-
/** SHA-256 checksum with prefix */
|
|
485
|
-
checksum: string;
|
|
486
|
-
}
|
|
487
|
-
/**
|
|
488
|
-
* Marketplace migration manifest format
|
|
489
|
-
*/
|
|
490
|
-
interface MigrationManifest {
|
|
491
|
-
/** Logical database name (used for table prefixing) */
|
|
492
|
-
database: string;
|
|
493
|
-
/** List of migrations in order */
|
|
494
|
-
migrations: MigrationManifestEntry[];
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Options for generating migration manifest
|
|
498
|
-
*/
|
|
499
|
-
interface GenerateMigrationManifestOptions {
|
|
500
|
-
/** Directory containing migration SQL files */
|
|
501
|
-
migrationsDir: string;
|
|
502
|
-
/** Logical database name for the app */
|
|
503
|
-
database: string;
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Result of migration manifest generation
|
|
507
|
-
*/
|
|
508
|
-
interface GenerateMigrationManifestResult {
|
|
509
|
-
/** The generated manifest */
|
|
510
|
-
manifest: MigrationManifest;
|
|
511
|
-
/** Migration files with content (for copying to output) */
|
|
512
|
-
files: MigrationFile[];
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Generate a marketplace migration manifest from migration files
|
|
516
|
-
*
|
|
517
|
-
* Reads migration files from the specified directory and generates
|
|
518
|
-
* a manifest with checksums suitable for marketplace distribution.
|
|
519
|
-
*
|
|
520
|
-
* @param options - Generation options
|
|
521
|
-
* @returns Manifest and file contents
|
|
522
|
-
*
|
|
523
|
-
* @example
|
|
524
|
-
* ```typescript
|
|
525
|
-
* import { generateMigrationManifest } from '@eldrin-project/eldrin-app-core';
|
|
526
|
-
*
|
|
527
|
-
* const result = await generateMigrationManifest({
|
|
528
|
-
* migrationsDir: './migrations',
|
|
529
|
-
* database: 'invoicing',
|
|
530
|
-
* });
|
|
531
|
-
*
|
|
532
|
-
* // Write manifest to output directory
|
|
533
|
-
* await writeFile(
|
|
534
|
-
* 'dist/migrations/index.json',
|
|
535
|
-
* JSON.stringify(result.manifest, null, 2)
|
|
536
|
-
* );
|
|
537
|
-
*
|
|
538
|
-
* // Copy migration files
|
|
539
|
-
* for (const file of result.files) {
|
|
540
|
-
* await writeFile(`dist/migrations/${file.name}`, file.content);
|
|
541
|
-
* }
|
|
542
|
-
* ```
|
|
543
|
-
*/
|
|
544
|
-
declare function generateMigrationManifest(options: GenerateMigrationManifestOptions): Promise<GenerateMigrationManifestResult>;
|
|
545
|
-
/**
|
|
546
|
-
* Validate a migration manifest against actual files
|
|
547
|
-
*
|
|
548
|
-
* Useful for CI/CD validation in the marketplace-dist repository.
|
|
549
|
-
*
|
|
550
|
-
* @param manifest - The manifest to validate
|
|
551
|
-
* @param files - The actual migration files
|
|
552
|
-
* @returns Validation result with any errors
|
|
553
|
-
*/
|
|
554
|
-
declare function validateMigrationManifest(manifest: MigrationManifest, files: MigrationFile[]): Promise<{
|
|
555
|
-
valid: boolean;
|
|
556
|
-
errors: string[];
|
|
557
|
-
}>;
|
|
558
|
-
|
|
559
302
|
/**
|
|
560
303
|
* Event System Types
|
|
561
304
|
* Types for server-side inter-app event communication
|
|
@@ -1304,4 +1047,4 @@ declare function isPublicRoute(pathname: string, publicRoutes: string[], apiPref
|
|
|
1304
1047
|
*/
|
|
1305
1048
|
declare function createPermissionMiddleware<TEnv = unknown>(config: MiddlewareConfig<TEnv>): PermissionMiddleware<TEnv>;
|
|
1306
1049
|
|
|
1307
|
-
export { AUTH_HEADERS, type AppAuthContext, type
|
|
1050
|
+
export { AUTH_HEADERS, type AppAuthContext, type AppManifest, CHECKSUM_PREFIX, type CompiledRoute, type CorsConfig, type EldrinEnv, type EldrinEvent, EldrinEventClient, type EmitOptions, type EmitResult, type EventClientConfig, type EventDelivery, type EventHandler, type JWTPayload, type JWTVerifyOptions, type ManifestApi, type ManifestForMiddleware, type ManifestGroup, type ManifestPermission, type ManifestRoute, type MiddlewareAuthResult, type MiddlewareConfig, type MiddlewareError, type MiddlewareErrorType, type MiddlewareResponseResult, type MiddlewareResult, type MigrationFile, type MigrationOptions, type MigrationRecord, type MigrationResult, type PermissionMiddleware, type PollOptions, type PollResult, type RegisteredEventType, type RollbackResult, type SubscriptionInfo, calculateChecksum, calculatePrefixedChecksum, compileRoutes, createEventClient, createPermissionMiddleware, extractTimestamp, getAuthContext, getAuthContextFromJWT, getMigrationStatus, getRollbackFilename, hasPermission, hasPlatformRole, isPlatformAdmin, isPublicRoute, isValidMigrationFilename, isValidRollbackFilename, matchRoute, parseSQLStatements, requireAllPermissions, requireAnyPermission, requireAuth, requireJWTAuth, requireJWTPermission, requirePermission, rollbackMigrations, runMigrations, verifyChecksum, verifyJWT };
|