@digilogiclabs/platform-core 1.26.0 → 1.27.1
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 +12 -6
- package/dist/{ConsoleEmail-iJO7Cb_v.d.ts → ConsoleEmail-BRa76Bfm.d.ts} +3 -106
- package/dist/{ConsoleEmail-CgSIvRdj.d.mts → ConsoleEmail-DSmK5jbu.d.mts} +3 -106
- package/dist/IDatabase-yOhemn5C.d.mts +49 -0
- package/dist/IDatabase-yOhemn5C.d.ts +49 -0
- package/dist/IStorage-CcFAvKDp.d.mts +58 -0
- package/dist/IStorage-CcFAvKDp.d.ts +58 -0
- package/dist/adapters/supabase-auth.d.mts +2 -0
- package/dist/adapters/supabase-auth.d.ts +2 -0
- package/dist/adapters/supabase-auth.js +714 -0
- package/dist/adapters/supabase-auth.js.map +1 -0
- package/dist/adapters/supabase-auth.mjs +687 -0
- package/dist/adapters/supabase-auth.mjs.map +1 -0
- package/dist/adapters/supabase-storage.d.mts +93 -0
- package/dist/adapters/supabase-storage.d.ts +93 -0
- package/dist/adapters/supabase-storage.js +249 -0
- package/dist/adapters/supabase-storage.js.map +1 -0
- package/dist/adapters/supabase-storage.mjs +222 -0
- package/dist/adapters/supabase-storage.mjs.map +1 -0
- package/dist/adapters/supabase.d.mts +24 -0
- package/dist/adapters/supabase.d.ts +24 -0
- package/dist/adapters/supabase.js +218 -0
- package/dist/adapters/supabase.js.map +1 -0
- package/dist/adapters/supabase.mjs +191 -0
- package/dist/adapters/supabase.mjs.map +1 -0
- package/dist/auth.d.mts +2 -2
- package/dist/auth.d.ts +2 -2
- package/dist/auth.js +3 -2
- package/dist/auth.js.map +1 -1
- package/dist/auth.mjs +3 -2
- package/dist/auth.mjs.map +1 -1
- package/dist/{env-BJWliXSO.d.mts → env-Cgwf8ZG2.d.mts} +2 -1
- package/dist/{env-BJWliXSO.d.ts → env-Cgwf8ZG2.d.ts} +2 -1
- package/dist/index-cN9dgBsn.d.mts +612 -0
- package/dist/index-cN9dgBsn.d.ts +612 -0
- package/dist/index.d.mts +12 -719
- package/dist/index.d.ts +12 -719
- package/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -7
- package/dist/index.mjs.map +1 -1
- package/dist/migrate.js +0 -0
- package/dist/testing.d.mts +5 -2
- package/dist/testing.d.ts +5 -2
- package/dist/testing.js +1 -0
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +1 -0
- package/dist/testing.mjs.map +1 -1
- package/package.json +26 -11
package/README.md
CHANGED
|
@@ -14,9 +14,9 @@ Platform Core provides a unified API for common infrastructure services, allowin
|
|
|
14
14
|
|
|
15
15
|
### Core Infrastructure
|
|
16
16
|
|
|
17
|
-
- **Database** - Query builder abstraction (PostgreSQL,
|
|
17
|
+
- **Database** - Query builder abstraction (PostgreSQL, Memory, optional hosted-provider adapter)
|
|
18
18
|
- **Cache** - Key-value caching (Redis, Upstash, Memory)
|
|
19
|
-
- **Storage** - File storage (S3/MinIO/R2,
|
|
19
|
+
- **Storage** - File storage (S3/MinIO/R2, Memory, optional hosted-provider adapter)
|
|
20
20
|
- **Email** - Transactional email (SMTP, Resend, Console, Memory)
|
|
21
21
|
- **Queue** - Background jobs (BullMQ, Memory)
|
|
22
22
|
- **Tracing** - Distributed tracing (OpenTelemetry, Memory, Noop)
|
|
@@ -44,7 +44,7 @@ pnpm add @digilogiclabs/platform-core
|
|
|
44
44
|
Install only the providers you need:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
# For
|
|
47
|
+
# For hosted-provider database/auth/storage adapter subpaths
|
|
48
48
|
pnpm add @supabase/supabase-js
|
|
49
49
|
|
|
50
50
|
# For Upstash cache
|
|
@@ -90,7 +90,7 @@ const platform = await createPlatformAsync();
|
|
|
90
90
|
|
|
91
91
|
// Or configure explicitly
|
|
92
92
|
const platform = await createPlatformAsync({
|
|
93
|
-
database: { provider: "
|
|
93
|
+
database: { provider: "postgres" },
|
|
94
94
|
cache: { provider: "upstash" },
|
|
95
95
|
storage: { provider: "s3" },
|
|
96
96
|
email: { provider: "resend" },
|
|
@@ -101,7 +101,7 @@ const platform = await createPlatformAsync({
|
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
103
|
# Provider selection
|
|
104
|
-
PLATFORM_DB_PROVIDER=memory|supabase
|
|
104
|
+
PLATFORM_DB_PROVIDER=memory|postgres|supabase
|
|
105
105
|
PLATFORM_CACHE_PROVIDER=memory|upstash
|
|
106
106
|
PLATFORM_STORAGE_PROVIDER=memory|s3|minio|r2
|
|
107
107
|
PLATFORM_EMAIL_PROVIDER=memory|console|resend
|
|
@@ -316,7 +316,6 @@ You can also use adapters directly:
|
|
|
316
316
|
import {
|
|
317
317
|
MemoryDatabase,
|
|
318
318
|
MemoryCache,
|
|
319
|
-
SupabaseDatabase,
|
|
320
319
|
UpstashCache,
|
|
321
320
|
S3Storage,
|
|
322
321
|
ResendEmail,
|
|
@@ -329,6 +328,13 @@ const cache = new MemoryCache();
|
|
|
329
328
|
const email = new ConsoleEmail(); // Logs to console
|
|
330
329
|
```
|
|
331
330
|
|
|
331
|
+
Hosted-provider adapters are also available as explicit subpath exports.
|
|
332
|
+
Prefer these in new code so provider-specific imports are clear:
|
|
333
|
+
|
|
334
|
+
```typescript
|
|
335
|
+
import { SupabaseDatabase } from "@digilogiclabs/platform-core/adapters/supabase";
|
|
336
|
+
```
|
|
337
|
+
|
|
332
338
|
## Migration from Direct Provider Usage
|
|
333
339
|
|
|
334
340
|
### Before (Direct Supabase)
|
|
@@ -1,114 +1,11 @@
|
|
|
1
|
+
import { I as IDatabase, a as IQueryBuilder, Q as QueryResult } from './IDatabase-yOhemn5C.js';
|
|
1
2
|
import { I as ICache } from './ICache-BWSuTuhz.js';
|
|
3
|
+
import { I as IStorage, U as UploadOptions, S as StorageFile } from './IStorage-CcFAvKDp.js';
|
|
2
4
|
import { I as IEmail, E as EmailMessage, a as EmailResult } from './IEmail-CsOcaQcb.js';
|
|
3
5
|
import { I as ILogger } from './ILogger-DLDBZaH4.js';
|
|
4
6
|
import { I as ITracing, a as IAI } from './IAI-B7pp322X.js';
|
|
5
7
|
import { z } from 'zod';
|
|
6
8
|
|
|
7
|
-
/**
|
|
8
|
-
* Database abstraction interface
|
|
9
|
-
* Provides a vendor-agnostic way to interact with SQL databases
|
|
10
|
-
*/
|
|
11
|
-
interface QueryResult<T = unknown> {
|
|
12
|
-
data: T[];
|
|
13
|
-
count?: number;
|
|
14
|
-
error?: Error;
|
|
15
|
-
}
|
|
16
|
-
interface IDatabase {
|
|
17
|
-
/**
|
|
18
|
-
* Query data from a table
|
|
19
|
-
*/
|
|
20
|
-
from<T = unknown>(table: string): IQueryBuilder<T>;
|
|
21
|
-
/**
|
|
22
|
-
* Execute a raw SQL query
|
|
23
|
-
*/
|
|
24
|
-
raw<T = unknown>(sql: string, params?: unknown[]): Promise<QueryResult<T>>;
|
|
25
|
-
/**
|
|
26
|
-
* Begin a transaction
|
|
27
|
-
*/
|
|
28
|
-
transaction<T>(fn: (tx: IDatabase) => Promise<T>): Promise<T>;
|
|
29
|
-
/**
|
|
30
|
-
* Check database connectivity
|
|
31
|
-
*/
|
|
32
|
-
healthCheck(): Promise<boolean>;
|
|
33
|
-
/**
|
|
34
|
-
* Close database connection
|
|
35
|
-
*/
|
|
36
|
-
close(): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
interface IQueryBuilder<T = unknown> {
|
|
39
|
-
select(columns?: string | string[]): IQueryBuilder<T>;
|
|
40
|
-
insert(data: Partial<T> | Partial<T>[]): IQueryBuilder<T>;
|
|
41
|
-
update(data: Partial<T>): IQueryBuilder<T>;
|
|
42
|
-
delete(): IQueryBuilder<T>;
|
|
43
|
-
where(column: string, operator: string, value: unknown): IQueryBuilder<T>;
|
|
44
|
-
whereIn(column: string, values: unknown[]): IQueryBuilder<T>;
|
|
45
|
-
orderBy(column: string, direction?: "asc" | "desc"): IQueryBuilder<T>;
|
|
46
|
-
limit(count: number): IQueryBuilder<T>;
|
|
47
|
-
offset(count: number): IQueryBuilder<T>;
|
|
48
|
-
single(): Promise<{
|
|
49
|
-
data: T | null;
|
|
50
|
-
error?: Error;
|
|
51
|
-
}>;
|
|
52
|
-
execute(): Promise<QueryResult<T>>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Storage abstraction interface
|
|
57
|
-
* Provides a vendor-agnostic way to interact with file/blob storage
|
|
58
|
-
*/
|
|
59
|
-
interface StorageFile {
|
|
60
|
-
key: string;
|
|
61
|
-
size: number;
|
|
62
|
-
contentType?: string;
|
|
63
|
-
lastModified?: Date;
|
|
64
|
-
etag?: string;
|
|
65
|
-
}
|
|
66
|
-
interface UploadOptions {
|
|
67
|
-
contentType?: string;
|
|
68
|
-
metadata?: Record<string, string>;
|
|
69
|
-
public?: boolean;
|
|
70
|
-
}
|
|
71
|
-
interface IStorage {
|
|
72
|
-
/**
|
|
73
|
-
* Upload a file
|
|
74
|
-
*/
|
|
75
|
-
upload(key: string, data: Buffer | Blob | ReadableStream, options?: UploadOptions): Promise<{
|
|
76
|
-
url: string;
|
|
77
|
-
}>;
|
|
78
|
-
/**
|
|
79
|
-
* Download a file
|
|
80
|
-
*/
|
|
81
|
-
download(key: string): Promise<Buffer>;
|
|
82
|
-
/**
|
|
83
|
-
* Get a signed URL for download
|
|
84
|
-
*/
|
|
85
|
-
getSignedUrl(key: string, expiresIn?: number): Promise<string>;
|
|
86
|
-
/**
|
|
87
|
-
* Delete a file
|
|
88
|
-
*/
|
|
89
|
-
delete(key: string): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Delete multiple files
|
|
92
|
-
*/
|
|
93
|
-
deleteMany(keys: string[]): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* List files in a path
|
|
96
|
-
*/
|
|
97
|
-
list(prefix?: string): Promise<StorageFile[]>;
|
|
98
|
-
/**
|
|
99
|
-
* Check if file exists
|
|
100
|
-
*/
|
|
101
|
-
exists(key: string): Promise<boolean>;
|
|
102
|
-
/**
|
|
103
|
-
* Get file metadata
|
|
104
|
-
*/
|
|
105
|
-
getMetadata(key: string): Promise<StorageFile | null>;
|
|
106
|
-
/**
|
|
107
|
-
* Check storage connectivity
|
|
108
|
-
*/
|
|
109
|
-
healthCheck(): Promise<boolean>;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
9
|
/**
|
|
113
10
|
* Queue abstraction interface
|
|
114
11
|
* Provides a vendor-agnostic way to work with job queues
|
|
@@ -2105,4 +2002,4 @@ declare class ConsoleEmail implements IEmail {
|
|
|
2105
2002
|
private formatAddresses;
|
|
2106
2003
|
}
|
|
2107
2004
|
|
|
2108
|
-
export { type
|
|
2005
|
+
export { type Secret as $, type DocumentStatus as A, type BulkIngestionResult as B, ConsoleEmail as C, type DeterministicEncryptedField as D, EnvSecrets as E, type RAGChunk as F, type RAGSearchQuery as G, type RAGSearchResponse as H, type IPlatform as I, type Job as J, type KeyRotationResult as K, type RAGSearchResult as L, MemoryDatabase as M, NoopMetrics as N, type ContextAssemblyConfig as O, type PlatformHealthStatus as P, type AssembledContext as Q, type RepeatOptions as R, type RAGPipeline as S, type JobResult as T, type JobContext as U, type JobEvent as V, type QueueStats as W, type BackoffOptions as X, type MetricTags as Y, type HistogramStats as Z, type TimingStats as _, MemoryCache as a, type SecretMetadata as a0, type GetSecretOptions as a1, type SetSecretOptions as a2, type RotateSecretOptions as a3, type RotationResult as a4, MemoryRAG as a5, ChunkingPresets as a6, type ChunkingStrategy as a7, type ChunkingConfig as a8, type SearchMode as a9, RetryConfigSchema as aA, CircuitBreakerConfigSchema as aB, TimeoutConfigSchema as aC, BulkheadConfigSchema as aD, ResilienceConfigSchema as aE, LoggingConfigSchema as aF, MetricsConfigSchema as aG, TracingConfigSchema as aH, ObservabilityConfigSchema as aI, MiddlewareConfigSchema as aJ, PlatformConfigSchema as aK, type PlatformConfig as aL, type DatabaseConfig as aM, type CacheConfig as aN, type StorageConfig as aO, type EmailConfig as aP, type QueueConfig as aQ, type ResilienceConfig as aR, type ObservabilityConfig as aS, type MiddlewareConfig as aT, type CryptoConfig as aU, type SecurityConfig as aV, loadConfig as aW, validateConfig as aX, safeValidateConfig as aY, getDefaultConfig as aZ, type RAGFilter as aa, type RAGPipelineStep as ab, type CryptoKeyStatus as ac, type CryptoAlgorithm as ad, createPlatformAsync as ae, createScopedMetrics as af, calculateBackoff as ag, generateJobId as ah, DatabaseProviderSchema as ai, CacheProviderSchema as aj, StorageProviderSchema as ak, EmailProviderSchema as al, QueueProviderSchema as am, TracingProviderSchema as an, LogLevelSchema as ao, AIProviderSchema as ap, RAGProviderSchema as aq, DatabaseConfigSchema as ar, CacheConfigSchema as as, StorageConfigSchema as at, EmailConfigSchema as au, QueueConfigSchema as av, AIConfigSchema as aw, RAGConfigSchema as ax, CryptoConfigSchema as ay, SecurityConfigSchema as az, MemoryStorage as b, MemoryEmail as c, MemoryQueue as d, MemorySecrets as e, createPlatform as f, MemoryMetrics as g, type IQueue as h, type IMetrics as i, type ISecrets as j, type JobOptions as k, type MetricsSummary as l, type ICrypto as m, type EncryptOptions as n, type EncryptedField as o, type CryptoKeyMetadata as p, type JobState as q, type JobEventType as r, type JobEventHandler as s, type IRAG as t, type RAGConfig as u, type CreateCollectionOptions as v, type RAGCollection as w, type RAGDocument as x, type IngestionOptions as y, type IngestionResult as z };
|
|
@@ -1,114 +1,11 @@
|
|
|
1
|
+
import { I as IDatabase, a as IQueryBuilder, Q as QueryResult } from './IDatabase-yOhemn5C.mjs';
|
|
1
2
|
import { I as ICache } from './ICache-BWSuTuhz.mjs';
|
|
3
|
+
import { I as IStorage, U as UploadOptions, S as StorageFile } from './IStorage-CcFAvKDp.mjs';
|
|
2
4
|
import { I as IEmail, E as EmailMessage, a as EmailResult } from './IEmail-CsOcaQcb.mjs';
|
|
3
5
|
import { I as ILogger } from './ILogger-DLDBZaH4.mjs';
|
|
4
6
|
import { I as ITracing, a as IAI } from './IAI-B7pp322X.mjs';
|
|
5
7
|
import { z } from 'zod';
|
|
6
8
|
|
|
7
|
-
/**
|
|
8
|
-
* Database abstraction interface
|
|
9
|
-
* Provides a vendor-agnostic way to interact with SQL databases
|
|
10
|
-
*/
|
|
11
|
-
interface QueryResult<T = unknown> {
|
|
12
|
-
data: T[];
|
|
13
|
-
count?: number;
|
|
14
|
-
error?: Error;
|
|
15
|
-
}
|
|
16
|
-
interface IDatabase {
|
|
17
|
-
/**
|
|
18
|
-
* Query data from a table
|
|
19
|
-
*/
|
|
20
|
-
from<T = unknown>(table: string): IQueryBuilder<T>;
|
|
21
|
-
/**
|
|
22
|
-
* Execute a raw SQL query
|
|
23
|
-
*/
|
|
24
|
-
raw<T = unknown>(sql: string, params?: unknown[]): Promise<QueryResult<T>>;
|
|
25
|
-
/**
|
|
26
|
-
* Begin a transaction
|
|
27
|
-
*/
|
|
28
|
-
transaction<T>(fn: (tx: IDatabase) => Promise<T>): Promise<T>;
|
|
29
|
-
/**
|
|
30
|
-
* Check database connectivity
|
|
31
|
-
*/
|
|
32
|
-
healthCheck(): Promise<boolean>;
|
|
33
|
-
/**
|
|
34
|
-
* Close database connection
|
|
35
|
-
*/
|
|
36
|
-
close(): Promise<void>;
|
|
37
|
-
}
|
|
38
|
-
interface IQueryBuilder<T = unknown> {
|
|
39
|
-
select(columns?: string | string[]): IQueryBuilder<T>;
|
|
40
|
-
insert(data: Partial<T> | Partial<T>[]): IQueryBuilder<T>;
|
|
41
|
-
update(data: Partial<T>): IQueryBuilder<T>;
|
|
42
|
-
delete(): IQueryBuilder<T>;
|
|
43
|
-
where(column: string, operator: string, value: unknown): IQueryBuilder<T>;
|
|
44
|
-
whereIn(column: string, values: unknown[]): IQueryBuilder<T>;
|
|
45
|
-
orderBy(column: string, direction?: "asc" | "desc"): IQueryBuilder<T>;
|
|
46
|
-
limit(count: number): IQueryBuilder<T>;
|
|
47
|
-
offset(count: number): IQueryBuilder<T>;
|
|
48
|
-
single(): Promise<{
|
|
49
|
-
data: T | null;
|
|
50
|
-
error?: Error;
|
|
51
|
-
}>;
|
|
52
|
-
execute(): Promise<QueryResult<T>>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Storage abstraction interface
|
|
57
|
-
* Provides a vendor-agnostic way to interact with file/blob storage
|
|
58
|
-
*/
|
|
59
|
-
interface StorageFile {
|
|
60
|
-
key: string;
|
|
61
|
-
size: number;
|
|
62
|
-
contentType?: string;
|
|
63
|
-
lastModified?: Date;
|
|
64
|
-
etag?: string;
|
|
65
|
-
}
|
|
66
|
-
interface UploadOptions {
|
|
67
|
-
contentType?: string;
|
|
68
|
-
metadata?: Record<string, string>;
|
|
69
|
-
public?: boolean;
|
|
70
|
-
}
|
|
71
|
-
interface IStorage {
|
|
72
|
-
/**
|
|
73
|
-
* Upload a file
|
|
74
|
-
*/
|
|
75
|
-
upload(key: string, data: Buffer | Blob | ReadableStream, options?: UploadOptions): Promise<{
|
|
76
|
-
url: string;
|
|
77
|
-
}>;
|
|
78
|
-
/**
|
|
79
|
-
* Download a file
|
|
80
|
-
*/
|
|
81
|
-
download(key: string): Promise<Buffer>;
|
|
82
|
-
/**
|
|
83
|
-
* Get a signed URL for download
|
|
84
|
-
*/
|
|
85
|
-
getSignedUrl(key: string, expiresIn?: number): Promise<string>;
|
|
86
|
-
/**
|
|
87
|
-
* Delete a file
|
|
88
|
-
*/
|
|
89
|
-
delete(key: string): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Delete multiple files
|
|
92
|
-
*/
|
|
93
|
-
deleteMany(keys: string[]): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* List files in a path
|
|
96
|
-
*/
|
|
97
|
-
list(prefix?: string): Promise<StorageFile[]>;
|
|
98
|
-
/**
|
|
99
|
-
* Check if file exists
|
|
100
|
-
*/
|
|
101
|
-
exists(key: string): Promise<boolean>;
|
|
102
|
-
/**
|
|
103
|
-
* Get file metadata
|
|
104
|
-
*/
|
|
105
|
-
getMetadata(key: string): Promise<StorageFile | null>;
|
|
106
|
-
/**
|
|
107
|
-
* Check storage connectivity
|
|
108
|
-
*/
|
|
109
|
-
healthCheck(): Promise<boolean>;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
9
|
/**
|
|
113
10
|
* Queue abstraction interface
|
|
114
11
|
* Provides a vendor-agnostic way to work with job queues
|
|
@@ -2105,4 +2002,4 @@ declare class ConsoleEmail implements IEmail {
|
|
|
2105
2002
|
private formatAddresses;
|
|
2106
2003
|
}
|
|
2107
2004
|
|
|
2108
|
-
export { type
|
|
2005
|
+
export { type Secret as $, type DocumentStatus as A, type BulkIngestionResult as B, ConsoleEmail as C, type DeterministicEncryptedField as D, EnvSecrets as E, type RAGChunk as F, type RAGSearchQuery as G, type RAGSearchResponse as H, type IPlatform as I, type Job as J, type KeyRotationResult as K, type RAGSearchResult as L, MemoryDatabase as M, NoopMetrics as N, type ContextAssemblyConfig as O, type PlatformHealthStatus as P, type AssembledContext as Q, type RepeatOptions as R, type RAGPipeline as S, type JobResult as T, type JobContext as U, type JobEvent as V, type QueueStats as W, type BackoffOptions as X, type MetricTags as Y, type HistogramStats as Z, type TimingStats as _, MemoryCache as a, type SecretMetadata as a0, type GetSecretOptions as a1, type SetSecretOptions as a2, type RotateSecretOptions as a3, type RotationResult as a4, MemoryRAG as a5, ChunkingPresets as a6, type ChunkingStrategy as a7, type ChunkingConfig as a8, type SearchMode as a9, RetryConfigSchema as aA, CircuitBreakerConfigSchema as aB, TimeoutConfigSchema as aC, BulkheadConfigSchema as aD, ResilienceConfigSchema as aE, LoggingConfigSchema as aF, MetricsConfigSchema as aG, TracingConfigSchema as aH, ObservabilityConfigSchema as aI, MiddlewareConfigSchema as aJ, PlatformConfigSchema as aK, type PlatformConfig as aL, type DatabaseConfig as aM, type CacheConfig as aN, type StorageConfig as aO, type EmailConfig as aP, type QueueConfig as aQ, type ResilienceConfig as aR, type ObservabilityConfig as aS, type MiddlewareConfig as aT, type CryptoConfig as aU, type SecurityConfig as aV, loadConfig as aW, validateConfig as aX, safeValidateConfig as aY, getDefaultConfig as aZ, type RAGFilter as aa, type RAGPipelineStep as ab, type CryptoKeyStatus as ac, type CryptoAlgorithm as ad, createPlatformAsync as ae, createScopedMetrics as af, calculateBackoff as ag, generateJobId as ah, DatabaseProviderSchema as ai, CacheProviderSchema as aj, StorageProviderSchema as ak, EmailProviderSchema as al, QueueProviderSchema as am, TracingProviderSchema as an, LogLevelSchema as ao, AIProviderSchema as ap, RAGProviderSchema as aq, DatabaseConfigSchema as ar, CacheConfigSchema as as, StorageConfigSchema as at, EmailConfigSchema as au, QueueConfigSchema as av, AIConfigSchema as aw, RAGConfigSchema as ax, CryptoConfigSchema as ay, SecurityConfigSchema as az, MemoryStorage as b, MemoryEmail as c, MemoryQueue as d, MemorySecrets as e, createPlatform as f, MemoryMetrics as g, type IQueue as h, type IMetrics as i, type ISecrets as j, type JobOptions as k, type MetricsSummary as l, type ICrypto as m, type EncryptOptions as n, type EncryptedField as o, type CryptoKeyMetadata as p, type JobState as q, type JobEventType as r, type JobEventHandler as s, type IRAG as t, type RAGConfig as u, type CreateCollectionOptions as v, type RAGCollection as w, type RAGDocument as x, type IngestionOptions as y, type IngestionResult as z };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database abstraction interface
|
|
3
|
+
* Provides a vendor-agnostic way to interact with SQL databases
|
|
4
|
+
*/
|
|
5
|
+
interface QueryResult<T = unknown> {
|
|
6
|
+
data: T[];
|
|
7
|
+
count?: number;
|
|
8
|
+
error?: Error;
|
|
9
|
+
}
|
|
10
|
+
interface IDatabase {
|
|
11
|
+
/**
|
|
12
|
+
* Query data from a table
|
|
13
|
+
*/
|
|
14
|
+
from<T = unknown>(table: string): IQueryBuilder<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Execute a raw SQL query
|
|
17
|
+
*/
|
|
18
|
+
raw<T = unknown>(sql: string, params?: unknown[]): Promise<QueryResult<T>>;
|
|
19
|
+
/**
|
|
20
|
+
* Begin a transaction
|
|
21
|
+
*/
|
|
22
|
+
transaction<T>(fn: (tx: IDatabase) => Promise<T>): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Check database connectivity
|
|
25
|
+
*/
|
|
26
|
+
healthCheck(): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Close database connection
|
|
29
|
+
*/
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
interface IQueryBuilder<T = unknown> {
|
|
33
|
+
select(columns?: string | string[]): IQueryBuilder<T>;
|
|
34
|
+
insert(data: Partial<T> | Partial<T>[]): IQueryBuilder<T>;
|
|
35
|
+
update(data: Partial<T>): IQueryBuilder<T>;
|
|
36
|
+
delete(): IQueryBuilder<T>;
|
|
37
|
+
where(column: string, operator: string, value: unknown): IQueryBuilder<T>;
|
|
38
|
+
whereIn(column: string, values: unknown[]): IQueryBuilder<T>;
|
|
39
|
+
orderBy(column: string, direction?: "asc" | "desc"): IQueryBuilder<T>;
|
|
40
|
+
limit(count: number): IQueryBuilder<T>;
|
|
41
|
+
offset(count: number): IQueryBuilder<T>;
|
|
42
|
+
single(): Promise<{
|
|
43
|
+
data: T | null;
|
|
44
|
+
error?: Error;
|
|
45
|
+
}>;
|
|
46
|
+
execute(): Promise<QueryResult<T>>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type { IDatabase as I, QueryResult as Q, IQueryBuilder as a };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database abstraction interface
|
|
3
|
+
* Provides a vendor-agnostic way to interact with SQL databases
|
|
4
|
+
*/
|
|
5
|
+
interface QueryResult<T = unknown> {
|
|
6
|
+
data: T[];
|
|
7
|
+
count?: number;
|
|
8
|
+
error?: Error;
|
|
9
|
+
}
|
|
10
|
+
interface IDatabase {
|
|
11
|
+
/**
|
|
12
|
+
* Query data from a table
|
|
13
|
+
*/
|
|
14
|
+
from<T = unknown>(table: string): IQueryBuilder<T>;
|
|
15
|
+
/**
|
|
16
|
+
* Execute a raw SQL query
|
|
17
|
+
*/
|
|
18
|
+
raw<T = unknown>(sql: string, params?: unknown[]): Promise<QueryResult<T>>;
|
|
19
|
+
/**
|
|
20
|
+
* Begin a transaction
|
|
21
|
+
*/
|
|
22
|
+
transaction<T>(fn: (tx: IDatabase) => Promise<T>): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Check database connectivity
|
|
25
|
+
*/
|
|
26
|
+
healthCheck(): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Close database connection
|
|
29
|
+
*/
|
|
30
|
+
close(): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
interface IQueryBuilder<T = unknown> {
|
|
33
|
+
select(columns?: string | string[]): IQueryBuilder<T>;
|
|
34
|
+
insert(data: Partial<T> | Partial<T>[]): IQueryBuilder<T>;
|
|
35
|
+
update(data: Partial<T>): IQueryBuilder<T>;
|
|
36
|
+
delete(): IQueryBuilder<T>;
|
|
37
|
+
where(column: string, operator: string, value: unknown): IQueryBuilder<T>;
|
|
38
|
+
whereIn(column: string, values: unknown[]): IQueryBuilder<T>;
|
|
39
|
+
orderBy(column: string, direction?: "asc" | "desc"): IQueryBuilder<T>;
|
|
40
|
+
limit(count: number): IQueryBuilder<T>;
|
|
41
|
+
offset(count: number): IQueryBuilder<T>;
|
|
42
|
+
single(): Promise<{
|
|
43
|
+
data: T | null;
|
|
44
|
+
error?: Error;
|
|
45
|
+
}>;
|
|
46
|
+
execute(): Promise<QueryResult<T>>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type { IDatabase as I, QueryResult as Q, IQueryBuilder as a };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage abstraction interface
|
|
3
|
+
* Provides a vendor-agnostic way to interact with file/blob storage
|
|
4
|
+
*/
|
|
5
|
+
interface StorageFile {
|
|
6
|
+
key: string;
|
|
7
|
+
size: number;
|
|
8
|
+
contentType?: string;
|
|
9
|
+
lastModified?: Date;
|
|
10
|
+
etag?: string;
|
|
11
|
+
}
|
|
12
|
+
interface UploadOptions {
|
|
13
|
+
contentType?: string;
|
|
14
|
+
metadata?: Record<string, string>;
|
|
15
|
+
public?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface IStorage {
|
|
18
|
+
/**
|
|
19
|
+
* Upload a file
|
|
20
|
+
*/
|
|
21
|
+
upload(key: string, data: Buffer | Blob | ReadableStream, options?: UploadOptions): Promise<{
|
|
22
|
+
url: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Download a file
|
|
26
|
+
*/
|
|
27
|
+
download(key: string): Promise<Buffer>;
|
|
28
|
+
/**
|
|
29
|
+
* Get a signed URL for download
|
|
30
|
+
*/
|
|
31
|
+
getSignedUrl(key: string, expiresIn?: number): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete a file
|
|
34
|
+
*/
|
|
35
|
+
delete(key: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete multiple files
|
|
38
|
+
*/
|
|
39
|
+
deleteMany(keys: string[]): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* List files in a path
|
|
42
|
+
*/
|
|
43
|
+
list(prefix?: string): Promise<StorageFile[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Check if file exists
|
|
46
|
+
*/
|
|
47
|
+
exists(key: string): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Get file metadata
|
|
50
|
+
*/
|
|
51
|
+
getMetadata(key: string): Promise<StorageFile | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Check storage connectivity
|
|
54
|
+
*/
|
|
55
|
+
healthCheck(): Promise<boolean>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type { IStorage as I, StorageFile as S, UploadOptions as U };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage abstraction interface
|
|
3
|
+
* Provides a vendor-agnostic way to interact with file/blob storage
|
|
4
|
+
*/
|
|
5
|
+
interface StorageFile {
|
|
6
|
+
key: string;
|
|
7
|
+
size: number;
|
|
8
|
+
contentType?: string;
|
|
9
|
+
lastModified?: Date;
|
|
10
|
+
etag?: string;
|
|
11
|
+
}
|
|
12
|
+
interface UploadOptions {
|
|
13
|
+
contentType?: string;
|
|
14
|
+
metadata?: Record<string, string>;
|
|
15
|
+
public?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface IStorage {
|
|
18
|
+
/**
|
|
19
|
+
* Upload a file
|
|
20
|
+
*/
|
|
21
|
+
upload(key: string, data: Buffer | Blob | ReadableStream, options?: UploadOptions): Promise<{
|
|
22
|
+
url: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Download a file
|
|
26
|
+
*/
|
|
27
|
+
download(key: string): Promise<Buffer>;
|
|
28
|
+
/**
|
|
29
|
+
* Get a signed URL for download
|
|
30
|
+
*/
|
|
31
|
+
getSignedUrl(key: string, expiresIn?: number): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete a file
|
|
34
|
+
*/
|
|
35
|
+
delete(key: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete multiple files
|
|
38
|
+
*/
|
|
39
|
+
deleteMany(keys: string[]): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* List files in a path
|
|
42
|
+
*/
|
|
43
|
+
list(prefix?: string): Promise<StorageFile[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Check if file exists
|
|
46
|
+
*/
|
|
47
|
+
exists(key: string): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Get file metadata
|
|
50
|
+
*/
|
|
51
|
+
getMetadata(key: string): Promise<StorageFile | null>;
|
|
52
|
+
/**
|
|
53
|
+
* Check storage connectivity
|
|
54
|
+
*/
|
|
55
|
+
healthCheck(): Promise<boolean>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export type { IStorage as I, StorageFile as S, UploadOptions as U };
|