alepha 0.10.4 → 0.10.6
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 +7 -19
- package/api/files.d.ts +200 -125
- package/api/jobs.d.ts +170 -172
- package/api/users.d.ts +216 -215
- package/bucket.d.ts +81 -4
- package/command.d.ts +1 -1
- package/email.d.ts +5 -5
- package/package.json +48 -48
- package/postgres.d.ts +48 -5
- package/react/auth.d.ts +5 -0
- package/react.d.ts +28 -28
- package/security.d.ts +4 -7
- package/server/cache.d.ts +16 -7
- package/server/links.d.ts +2 -2
- package/server/security.d.ts +4 -6
- package/server.d.ts +20 -20
package/bucket.d.ts
CHANGED
|
@@ -561,11 +561,88 @@ declare class FileNotFoundError extends AlephaError {
|
|
|
561
561
|
readonly status = 404;
|
|
562
562
|
}
|
|
563
563
|
//#endregion
|
|
564
|
+
//#region src/services/FileMetadataService.d.ts
|
|
565
|
+
interface FileMetadata {
|
|
566
|
+
name: string;
|
|
567
|
+
type: string;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Service for encoding/decoding file metadata in storage streams.
|
|
571
|
+
*
|
|
572
|
+
* The metadata is stored at the beginning of the file with the following structure:
|
|
573
|
+
* - 4-byte header: UInt32BE containing the metadata length
|
|
574
|
+
* - N-byte metadata: JSON object containing file metadata (name, type)
|
|
575
|
+
* - Remaining bytes: Actual file content
|
|
576
|
+
*
|
|
577
|
+
* @example
|
|
578
|
+
* ```typescript
|
|
579
|
+
* const service = new FileMetadataService();
|
|
580
|
+
*
|
|
581
|
+
* // Encode metadata and content for storage
|
|
582
|
+
* const { header, metadata } = service.encodeMetadata({
|
|
583
|
+
* name: "document.pdf",
|
|
584
|
+
* type: "application/pdf"
|
|
585
|
+
* });
|
|
586
|
+
*
|
|
587
|
+
* // Decode metadata from stored file
|
|
588
|
+
* const fileHandle = await open(filePath, 'r');
|
|
589
|
+
* const { metadata, contentStart } = await service.decodeMetadata(fileHandle);
|
|
590
|
+
* ```
|
|
591
|
+
*/
|
|
592
|
+
declare class FileMetadataService {
|
|
593
|
+
/**
|
|
594
|
+
* Length of the header containing metadata size (4 bytes for UInt32BE)
|
|
595
|
+
*/
|
|
596
|
+
static readonly METADATA_HEADER_LENGTH = 4;
|
|
597
|
+
/**
|
|
598
|
+
* Encodes file metadata into header and metadata buffers.
|
|
599
|
+
*
|
|
600
|
+
* @param file - The file or metadata to encode
|
|
601
|
+
* @returns Object containing the header buffer and metadata buffer
|
|
602
|
+
*/
|
|
603
|
+
encodeMetadata(file: FileLike | FileMetadata): {
|
|
604
|
+
header: Buffer;
|
|
605
|
+
metadata: Buffer;
|
|
606
|
+
};
|
|
607
|
+
/**
|
|
608
|
+
* Decodes file metadata from a file handle.
|
|
609
|
+
*
|
|
610
|
+
* @param fileHandle - File handle opened for reading
|
|
611
|
+
* @returns Object containing the decoded metadata and content start position
|
|
612
|
+
*/
|
|
613
|
+
decodeMetadata(fileHandle: {
|
|
614
|
+
read: (buffer: Buffer, offset: number, length: number, position: number) => Promise<{
|
|
615
|
+
bytesRead: number;
|
|
616
|
+
}>;
|
|
617
|
+
}): Promise<{
|
|
618
|
+
metadata: FileMetadata;
|
|
619
|
+
contentStart: number;
|
|
620
|
+
}>;
|
|
621
|
+
/**
|
|
622
|
+
* Decodes file metadata from a buffer.
|
|
623
|
+
*
|
|
624
|
+
* @param buffer - Buffer containing the file with metadata
|
|
625
|
+
* @returns Object containing the decoded metadata and content start position
|
|
626
|
+
*/
|
|
627
|
+
decodeMetadataFromBuffer(buffer: Buffer): {
|
|
628
|
+
metadata: FileMetadata;
|
|
629
|
+
contentStart: number;
|
|
630
|
+
};
|
|
631
|
+
/**
|
|
632
|
+
* Creates a complete buffer with metadata header, metadata, and content.
|
|
633
|
+
*
|
|
634
|
+
* @param file - The file to encode
|
|
635
|
+
* @param content - The file content as a buffer
|
|
636
|
+
* @returns Complete buffer ready for storage
|
|
637
|
+
*/
|
|
638
|
+
createFileBuffer(file: FileLike | FileMetadata, content: Buffer): Buffer;
|
|
639
|
+
}
|
|
640
|
+
//#endregion
|
|
564
641
|
//#region src/providers/LocalFileStorageProvider.d.ts
|
|
565
642
|
declare class LocalFileStorageProvider implements FileStorageProvider {
|
|
566
|
-
static METADATA_HEADER_LENGTH: number;
|
|
567
643
|
protected readonly alepha: Alepha;
|
|
568
644
|
protected readonly log: _alepha_logger0.Logger;
|
|
645
|
+
protected readonly metadataService: FileMetadataService;
|
|
569
646
|
options: {
|
|
570
647
|
storagePath: string;
|
|
571
648
|
};
|
|
@@ -574,9 +651,9 @@ declare class LocalFileStorageProvider implements FileStorageProvider {
|
|
|
574
651
|
download(bucketName: string, fileId: string): Promise<FileLike>;
|
|
575
652
|
exists(bucketName: string, fileId: string): Promise<boolean>;
|
|
576
653
|
delete(bucketName: string, fileId: string): Promise<void>;
|
|
577
|
-
protected stat(
|
|
654
|
+
protected stat(bucket: string, fileId: string): Promise<fs.Stats>;
|
|
578
655
|
protected createId(): string;
|
|
579
|
-
protected path(
|
|
656
|
+
protected path(bucket: string, fileId?: string): string;
|
|
580
657
|
protected isErrorNoEntry(error: unknown): boolean;
|
|
581
658
|
}
|
|
582
659
|
declare const fileMetadataSchema: typebox0.TObject<{
|
|
@@ -620,5 +697,5 @@ declare module "alepha" {
|
|
|
620
697
|
*/
|
|
621
698
|
declare const AlephaBucket: _alepha_core1.Service<_alepha_core1.Module<{}>>;
|
|
622
699
|
//#endregion
|
|
623
|
-
export { $bucket, AlephaBucket, BucketDescriptor, BucketDescriptorOptions, BucketFileOptions, FileNotFoundError, FileStorageProvider, LocalFileStorageProvider, MemoryFileStorageProvider, fileMetadataSchema };
|
|
700
|
+
export { $bucket, AlephaBucket, BucketDescriptor, BucketDescriptorOptions, BucketFileOptions, FileMetadata, FileMetadataService, FileNotFoundError, FileStorageProvider, LocalFileStorageProvider, MemoryFileStorageProvider, fileMetadataSchema };
|
|
624
701
|
//# sourceMappingURL=index.d.ts.map
|
package/command.d.ts
CHANGED
|
@@ -151,7 +151,7 @@ declare class CommandDescriptor<T extends TObject = TObject, A extends TSchema =
|
|
|
151
151
|
}
|
|
152
152
|
interface CommandHandlerArgs<T extends TObject, A extends TSchema = TSchema> {
|
|
153
153
|
flags: Static<T>;
|
|
154
|
-
args: A extends TSchema ? Static<A> :
|
|
154
|
+
args: A extends TSchema ? Static<A> : Array<string>;
|
|
155
155
|
run: RunnerMethod;
|
|
156
156
|
ask: AskMethod;
|
|
157
157
|
glob: typeof glob;
|
package/email.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _alepha_core1 from "alepha";
|
|
2
2
|
import { Descriptor, KIND, Service, Static, TSchema } from "alepha";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alepha_logger0 from "alepha/logger";
|
|
4
4
|
import { Transporter } from "nodemailer";
|
|
5
5
|
|
|
6
6
|
//#region src/providers/EmailProvider.d.ts
|
|
@@ -30,7 +30,7 @@ interface EmailRecord {
|
|
|
30
30
|
sentAt: Date;
|
|
31
31
|
}
|
|
32
32
|
declare class MemoryEmailProvider implements EmailProvider {
|
|
33
|
-
protected readonly log:
|
|
33
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
34
34
|
protected emails: EmailRecord[];
|
|
35
35
|
send(to: string, subject: string, body: string): Promise<void>;
|
|
36
36
|
/**
|
|
@@ -224,7 +224,7 @@ interface EmailDescriptorOptions<T extends TSchema> {
|
|
|
224
224
|
provider?: Service<EmailProvider> | "memory";
|
|
225
225
|
}
|
|
226
226
|
declare class EmailDescriptor<T extends TSchema> extends Descriptor<EmailDescriptorOptions<T>> {
|
|
227
|
-
protected readonly log:
|
|
227
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
228
228
|
protected readonly templateService: TemplateService;
|
|
229
229
|
readonly provider: EmailProvider | MemoryEmailProvider;
|
|
230
230
|
get name(): string;
|
|
@@ -252,7 +252,7 @@ interface LocalEmailProviderOptions {
|
|
|
252
252
|
directory?: string;
|
|
253
253
|
}
|
|
254
254
|
declare class LocalEmailProvider implements EmailProvider {
|
|
255
|
-
protected readonly log:
|
|
255
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
256
256
|
protected readonly directory: string;
|
|
257
257
|
constructor(options?: LocalEmailProviderOptions);
|
|
258
258
|
send(to: string, subject: string, body: string): Promise<void>;
|
|
@@ -292,7 +292,7 @@ declare class NodemailerEmailProvider implements EmailProvider {
|
|
|
292
292
|
EMAIL_FROM: string;
|
|
293
293
|
EMAIL_SECURE: boolean;
|
|
294
294
|
};
|
|
295
|
-
protected readonly log:
|
|
295
|
+
protected readonly log: _alepha_logger0.Logger;
|
|
296
296
|
protected transporter: Transporter;
|
|
297
297
|
protected fromAddress: string;
|
|
298
298
|
readonly options: NodemailerEmailProviderOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alepha",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -15,55 +15,55 @@
|
|
|
15
15
|
"main": "./core.js",
|
|
16
16
|
"types": "./core.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alepha/api-files": "0.10.
|
|
19
|
-
"@alepha/api-jobs": "0.10.
|
|
20
|
-
"@alepha/api-users": "0.10.
|
|
21
|
-
"@alepha/batch": "0.10.
|
|
22
|
-
"@alepha/bucket": "0.10.
|
|
23
|
-
"@alepha/cache": "0.10.
|
|
24
|
-
"@alepha/cache-redis": "0.10.
|
|
25
|
-
"@alepha/command": "0.10.
|
|
26
|
-
"@alepha/core": "0.10.
|
|
27
|
-
"@alepha/datetime": "0.10.
|
|
28
|
-
"@alepha/devtools": "0.10.
|
|
29
|
-
"@alepha/email": "0.10.
|
|
30
|
-
"@alepha/file": "0.10.
|
|
31
|
-
"@alepha/lock": "0.10.
|
|
32
|
-
"@alepha/lock-redis": "0.10.
|
|
33
|
-
"@alepha/logger": "0.10.
|
|
34
|
-
"@alepha/postgres": "0.10.
|
|
35
|
-
"@alepha/queue": "0.10.
|
|
36
|
-
"@alepha/queue-redis": "0.10.
|
|
37
|
-
"@alepha/react": "0.10.
|
|
38
|
-
"@alepha/react-auth": "0.10.
|
|
39
|
-
"@alepha/react-form": "0.10.
|
|
40
|
-
"@alepha/react-head": "0.10.
|
|
41
|
-
"@alepha/react-i18n": "0.10.
|
|
42
|
-
"@alepha/redis": "0.10.
|
|
43
|
-
"@alepha/retry": "0.10.
|
|
44
|
-
"@alepha/router": "0.10.
|
|
45
|
-
"@alepha/scheduler": "0.10.
|
|
46
|
-
"@alepha/security": "0.10.
|
|
47
|
-
"@alepha/server": "0.10.
|
|
48
|
-
"@alepha/server-cache": "0.10.
|
|
49
|
-
"@alepha/server-compress": "0.10.
|
|
50
|
-
"@alepha/server-cookies": "0.10.
|
|
51
|
-
"@alepha/server-cors": "0.10.
|
|
52
|
-
"@alepha/server-health": "0.10.
|
|
53
|
-
"@alepha/server-helmet": "0.10.
|
|
54
|
-
"@alepha/server-links": "0.10.
|
|
55
|
-
"@alepha/server-metrics": "0.10.
|
|
56
|
-
"@alepha/server-multipart": "0.10.
|
|
57
|
-
"@alepha/server-proxy": "0.10.
|
|
58
|
-
"@alepha/server-security": "0.10.
|
|
59
|
-
"@alepha/server-static": "0.10.
|
|
60
|
-
"@alepha/server-swagger": "0.10.
|
|
61
|
-
"@alepha/topic": "0.10.
|
|
62
|
-
"@alepha/topic-redis": "0.10.
|
|
63
|
-
"@alepha/vite": "0.10.
|
|
18
|
+
"@alepha/api-files": "0.10.6",
|
|
19
|
+
"@alepha/api-jobs": "0.10.6",
|
|
20
|
+
"@alepha/api-users": "0.10.6",
|
|
21
|
+
"@alepha/batch": "0.10.6",
|
|
22
|
+
"@alepha/bucket": "0.10.6",
|
|
23
|
+
"@alepha/cache": "0.10.6",
|
|
24
|
+
"@alepha/cache-redis": "0.10.6",
|
|
25
|
+
"@alepha/command": "0.10.6",
|
|
26
|
+
"@alepha/core": "0.10.6",
|
|
27
|
+
"@alepha/datetime": "0.10.6",
|
|
28
|
+
"@alepha/devtools": "0.10.6",
|
|
29
|
+
"@alepha/email": "0.10.6",
|
|
30
|
+
"@alepha/file": "0.10.6",
|
|
31
|
+
"@alepha/lock": "0.10.6",
|
|
32
|
+
"@alepha/lock-redis": "0.10.6",
|
|
33
|
+
"@alepha/logger": "0.10.6",
|
|
34
|
+
"@alepha/postgres": "0.10.6",
|
|
35
|
+
"@alepha/queue": "0.10.6",
|
|
36
|
+
"@alepha/queue-redis": "0.10.6",
|
|
37
|
+
"@alepha/react": "0.10.6",
|
|
38
|
+
"@alepha/react-auth": "0.10.6",
|
|
39
|
+
"@alepha/react-form": "0.10.6",
|
|
40
|
+
"@alepha/react-head": "0.10.6",
|
|
41
|
+
"@alepha/react-i18n": "0.10.6",
|
|
42
|
+
"@alepha/redis": "0.10.6",
|
|
43
|
+
"@alepha/retry": "0.10.6",
|
|
44
|
+
"@alepha/router": "0.10.6",
|
|
45
|
+
"@alepha/scheduler": "0.10.6",
|
|
46
|
+
"@alepha/security": "0.10.6",
|
|
47
|
+
"@alepha/server": "0.10.6",
|
|
48
|
+
"@alepha/server-cache": "0.10.6",
|
|
49
|
+
"@alepha/server-compress": "0.10.6",
|
|
50
|
+
"@alepha/server-cookies": "0.10.6",
|
|
51
|
+
"@alepha/server-cors": "0.10.6",
|
|
52
|
+
"@alepha/server-health": "0.10.6",
|
|
53
|
+
"@alepha/server-helmet": "0.10.6",
|
|
54
|
+
"@alepha/server-links": "0.10.6",
|
|
55
|
+
"@alepha/server-metrics": "0.10.6",
|
|
56
|
+
"@alepha/server-multipart": "0.10.6",
|
|
57
|
+
"@alepha/server-proxy": "0.10.6",
|
|
58
|
+
"@alepha/server-security": "0.10.6",
|
|
59
|
+
"@alepha/server-static": "0.10.6",
|
|
60
|
+
"@alepha/server-swagger": "0.10.6",
|
|
61
|
+
"@alepha/topic": "0.10.6",
|
|
62
|
+
"@alepha/topic-redis": "0.10.6",
|
|
63
|
+
"@alepha/vite": "0.10.6"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"tsdown": "^0.15.
|
|
66
|
+
"tsdown": "^0.15.7"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"build": "node build.ts"
|
package/postgres.d.ts
CHANGED
|
@@ -116,14 +116,14 @@ declare const schemaToPgColumns: <T extends TObject>(schema: T) => FromSchema<T>
|
|
|
116
116
|
* @param value The value of the field.
|
|
117
117
|
* @returns The PG column.
|
|
118
118
|
*/
|
|
119
|
-
declare const mapFieldToColumn: (name: string, value: TSchema$1) => pg$1.PgSerialBuilderInitial<string> | pg$1.PgIntegerBuilderInitial<string> | drizzle_orm6.IsIdentity<pg$1.PgBigInt64BuilderInitial<"">, "byDefault"> | drizzle_orm6.IsIdentity<pg$1.PgBigInt64BuilderInitial<"">, "always"> | pg$1.PgBigInt53BuilderInitial<string> | pg$1.PgNumericBuilderInitial<string> | pg$1.
|
|
119
|
+
declare const mapFieldToColumn: (name: string, value: TSchema$1) => pg$1.PgSerialBuilderInitial<string> | pg$1.PgIntegerBuilderInitial<string> | drizzle_orm6.IsIdentity<pg$1.PgBigInt64BuilderInitial<"">, "byDefault"> | drizzle_orm6.IsIdentity<pg$1.PgBigInt64BuilderInitial<"">, "always"> | pg$1.PgBigInt53BuilderInitial<string> | pg$1.PgNumericBuilderInitial<string> | pg$1.PgDateStringBuilderInitial<string> | pg$1.PgUUIDBuilderInitial<string> | pg$1.PgCustomColumnBuilder<{
|
|
120
120
|
name: string;
|
|
121
121
|
dataType: "custom";
|
|
122
122
|
columnType: "PgCustomColumn";
|
|
123
123
|
data: Buffer<ArrayBufferLike>;
|
|
124
124
|
driverParam: unknown;
|
|
125
125
|
enumValues: undefined;
|
|
126
|
-
}> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.
|
|
126
|
+
}> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.PgTextBuilderInitial<string, [string, ...string[]]> | pg$1.PgBooleanBuilderInitial<string> | drizzle_orm6.$Type<pg$1.PgCustomColumnBuilder<{
|
|
127
127
|
name: string;
|
|
128
128
|
dataType: "custom";
|
|
129
129
|
columnType: "PgCustomColumn";
|
|
@@ -251,14 +251,14 @@ declare const mapFieldToColumn: (name: string, value: TSchema$1) => pg$1.PgSeria
|
|
|
251
251
|
* @param key The key of the field.
|
|
252
252
|
* @param value The value of the field.
|
|
253
253
|
*/
|
|
254
|
-
declare const mapStringToColumn: (key: string, value: TSchema$1) => pg$1.PgUUIDBuilderInitial<string> | pg$1.PgCustomColumnBuilder<{
|
|
254
|
+
declare const mapStringToColumn: (key: string, value: TSchema$1) => pg$1.PgDateStringBuilderInitial<string> | pg$1.PgUUIDBuilderInitial<string> | pg$1.PgCustomColumnBuilder<{
|
|
255
255
|
name: string;
|
|
256
256
|
dataType: "custom";
|
|
257
257
|
columnType: "PgCustomColumn";
|
|
258
258
|
data: Buffer<ArrayBufferLike>;
|
|
259
259
|
driverParam: unknown;
|
|
260
260
|
enumValues: undefined;
|
|
261
|
-
}> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.
|
|
261
|
+
}> | pg$1.PgTimestampStringBuilderInitial<string> | pg$1.PgTextBuilderInitial<string, [string, ...string[]]>;
|
|
262
262
|
declare const camelToSnakeCase: (str: string) => string;
|
|
263
263
|
/**
|
|
264
264
|
* Convert a schema to columns.
|
|
@@ -767,6 +767,26 @@ declare class PgError extends AlephaError {
|
|
|
767
767
|
}
|
|
768
768
|
//#endregion
|
|
769
769
|
//#region src/helpers/pgAttr.d.ts
|
|
770
|
+
/**
|
|
771
|
+
* Decorates a typebox schema with a Postgres attribute.
|
|
772
|
+
*
|
|
773
|
+
* > It's just a fancy way to add Symbols to a field.
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```ts
|
|
777
|
+
* import { t } from "alepha";
|
|
778
|
+
* import { PG_UPDATED_AT } from "../constants/PG_SYMBOLS";
|
|
779
|
+
*
|
|
780
|
+
* export const updatedAtSchema = pgAttr(
|
|
781
|
+
* t.datetime(), PG_UPDATED_AT,
|
|
782
|
+
* );
|
|
783
|
+
* ```
|
|
784
|
+
*/
|
|
785
|
+
declare const pgAttr: <T extends TSchema$1, Attr extends PgSymbolKeys>(type: T, attr: Attr, value?: PgSymbols[Attr]) => PgAttr<T, Attr>;
|
|
786
|
+
/**
|
|
787
|
+
* Retrieves the fields of a schema that have a specific attribute.
|
|
788
|
+
*/
|
|
789
|
+
declare const getAttrFields: (schema: TObject, name: PgSymbolKeys) => PgAttrField[];
|
|
770
790
|
/**
|
|
771
791
|
* Type representation.
|
|
772
792
|
*/
|
|
@@ -2248,6 +2268,12 @@ interface TransactionDescriptorOptions<T extends any[], R> {
|
|
|
2248
2268
|
}
|
|
2249
2269
|
type TransactionContext = PgTransaction<any, any, any>;
|
|
2250
2270
|
//#endregion
|
|
2271
|
+
//#region src/errors/PgConflictError.d.ts
|
|
2272
|
+
declare class PgConflictError extends PgError {
|
|
2273
|
+
readonly name = "PgConflictError";
|
|
2274
|
+
readonly status = 409;
|
|
2275
|
+
}
|
|
2276
|
+
//#endregion
|
|
2251
2277
|
//#region src/errors/PgEntityNotFoundError.d.ts
|
|
2252
2278
|
declare class PgEntityNotFoundError extends PgError {
|
|
2253
2279
|
readonly name = "EntityNotFoundError";
|
|
@@ -2255,6 +2281,23 @@ declare class PgEntityNotFoundError extends PgError {
|
|
|
2255
2281
|
constructor(entityName: string);
|
|
2256
2282
|
}
|
|
2257
2283
|
//#endregion
|
|
2284
|
+
//#region src/errors/PgMigrationError.d.ts
|
|
2285
|
+
declare class PgMigrationError extends PgError {
|
|
2286
|
+
readonly name = "PgMigrationError";
|
|
2287
|
+
constructor(cause?: unknown);
|
|
2288
|
+
}
|
|
2289
|
+
//#endregion
|
|
2290
|
+
//#region src/errors/PgVersionMismatchError.d.ts
|
|
2291
|
+
/**
|
|
2292
|
+
* Error thrown when there is a version mismatch.
|
|
2293
|
+
* It's thrown by {@link RepositoryDescriptor#save} when the updated entity version does not match the one in the database.
|
|
2294
|
+
* This is used for optimistic concurrency control.
|
|
2295
|
+
*/
|
|
2296
|
+
declare class PgVersionMismatchError extends PgError {
|
|
2297
|
+
readonly name = "PgVersionMismatchError";
|
|
2298
|
+
constructor(table: string, id: any);
|
|
2299
|
+
}
|
|
2300
|
+
//#endregion
|
|
2258
2301
|
//#region src/providers/RepositoryProvider.d.ts
|
|
2259
2302
|
declare class RepositoryProvider {
|
|
2260
2303
|
protected readonly log: _alepha_logger1.Logger;
|
|
@@ -2540,5 +2583,5 @@ declare const schema: <TDocument extends TSchema$1>(name: string, document: TDoc
|
|
|
2540
2583
|
*/
|
|
2541
2584
|
declare const AlephaPostgres: _alepha_core1.Service<_alepha_core1.Module<{}>>;
|
|
2542
2585
|
//#endregion
|
|
2543
|
-
export { $entity, $repository, $sequence, $transaction, AlephaPostgres, DrizzleKitProvider, Entity, EntityDescriptorOptions, ExtractManyRelations, FilterOperators, FromSchema, NodePostgresProvider, NodePostgresProviderOptions, OrderBy, OrderByClause, OrderDirection, PG_CREATED_AT, PG_DEFAULT, PG_DELETED_AT, PG_IDENTITY, PG_MANY, PG_ONE, PG_PRIMARY_KEY, PG_REF, PG_SCHEMA, PG_SERIAL, PG_UPDATED_AT, PG_VERSION, Page, PageQuery, PgDefault, PgEntityNotFoundError, PgIdentityOptions, PgMany, PgManyOptions, PgOne, PgPrimaryKey, PgQuery, PgQueryWhere, PgQueryWhereOrSQL, PgQueryWhereWithMany, PgQueryWhereWithManyOrSQL, PgQueryWithMany, PgQueryWithMap, PgQueryWithOne, PgRef, PgRefOptions, PgSymbolKeys, PgSymbols, PgTableConfig, PgTableWithColumnsAndSchema, PostgresProvider, PostgresTypeProvider, RelField, RemoveManyRelations, RepositoryDescriptor, RepositoryDescriptorOptions, RepositoryProvider, SQLLike, SequenceDescriptor, SequenceDescriptorOptions, StatementOptions, TObjectInsert, TObjectUpdate, TPage, TransactionContext, TransactionDescriptorOptions, camelToSnakeCase, drizzle_orm6 as drizzle, insertSchema, legacyIdSchema, mapFieldToColumn, mapStringToColumn, pageQuerySchema, pageSchema, pg, schema, schemaToPgColumns, sql, updateSchema };
|
|
2586
|
+
export { $entity, $repository, $sequence, $transaction, AlephaPostgres, DrizzleKitProvider, Entity, EntityDescriptorOptions, ExtractManyRelations, FilterOperators, FromSchema, NodePostgresProvider, NodePostgresProviderOptions, OrderBy, OrderByClause, OrderDirection, PG_CREATED_AT, PG_DEFAULT, PG_DELETED_AT, PG_IDENTITY, PG_MANY, PG_ONE, PG_PRIMARY_KEY, PG_REF, PG_SCHEMA, PG_SERIAL, PG_UPDATED_AT, PG_VERSION, Page, PageQuery, PgAttr, PgAttrField, PgConflictError, PgDefault, PgEntityNotFoundError, PgError, PgIdentityOptions, PgMany, PgManyOptions, PgMigrationError, PgOne, PgPrimaryKey, PgQuery, PgQueryWhere, PgQueryWhereOrSQL, PgQueryWhereWithMany, PgQueryWhereWithManyOrSQL, PgQueryWithMany, PgQueryWithMap, PgQueryWithOne, PgRef, PgRefOptions, PgSymbolKeys, PgSymbols, PgTableConfig, PgTableWithColumnsAndSchema, PgVersionMismatchError, PostgresProvider, PostgresTypeProvider, RelField, RemoveManyRelations, RepositoryDescriptor, RepositoryDescriptorOptions, RepositoryProvider, SQLLike, SequenceDescriptor, SequenceDescriptorOptions, StatementOptions, TObjectInsert, TObjectUpdate, TPage, TransactionContext, TransactionDescriptorOptions, camelToSnakeCase, drizzle_orm6 as drizzle, getAttrFields, insertSchema, legacyIdSchema, mapFieldToColumn, mapStringToColumn, pageQuerySchema, pageSchema, pg, pgAttr, schema, schemaToPgColumns, sql, updateSchema };
|
|
2544
2587
|
//# sourceMappingURL=index.d.ts.map
|
package/react/auth.d.ts
CHANGED
|
@@ -43,6 +43,11 @@ declare class ReactAuth {
|
|
|
43
43
|
};
|
|
44
44
|
protected readonly onBeginTransition: _alepha_core4.HookDescriptor<"react:transition:begin">;
|
|
45
45
|
protected readonly onFetchRequest: _alepha_core4.HookDescriptor<"client:onRequest">;
|
|
46
|
+
/**
|
|
47
|
+
* Get the current authenticated user.
|
|
48
|
+
*
|
|
49
|
+
* Alias for `alepha.state.get("user")`
|
|
50
|
+
*/
|
|
46
51
|
get user(): UserAccountToken | undefined;
|
|
47
52
|
ping(): Promise<{
|
|
48
53
|
name?: string | undefined;
|
package/react.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _alepha_core14 from "alepha";
|
|
2
2
|
import { Alepha, Async, Descriptor, Hooks, KIND, Service, State, Static, TObject, TSchema } from "alepha";
|
|
3
3
|
import { RequestConfigSchema, ServerHandler, ServerProvider, ServerRequest, ServerRouterProvider, ServerTimingProvider } from "alepha/server";
|
|
4
4
|
import { ServerRouteCache } from "alepha/server/cache";
|
|
5
5
|
import { ClientScope, HttpVirtualClient, LinkProvider, VirtualAction } from "alepha/server/links";
|
|
6
|
-
import * as
|
|
6
|
+
import * as _alepha_logger1 from "alepha/logger";
|
|
7
7
|
import * as react0 from "react";
|
|
8
8
|
import React, { AnchorHTMLAttributes, CSSProperties, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
|
|
9
|
-
import * as
|
|
9
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
10
10
|
import { ServerStaticProvider } from "alepha/server/static";
|
|
11
11
|
import { DateTimeProvider } from "alepha/datetime";
|
|
12
12
|
import { Route, RouterProvider } from "alepha/router";
|
|
@@ -40,14 +40,14 @@ declare class Redirection extends Error {
|
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/providers/ReactPageProvider.d.ts
|
|
43
|
-
declare const envSchema$2:
|
|
44
|
-
REACT_STRICT_MODE:
|
|
43
|
+
declare const envSchema$2: _alepha_core14.TObject<{
|
|
44
|
+
REACT_STRICT_MODE: _alepha_core14.TBoolean;
|
|
45
45
|
}>;
|
|
46
46
|
declare module "alepha" {
|
|
47
47
|
interface Env extends Partial<Static<typeof envSchema$2>> {}
|
|
48
48
|
}
|
|
49
49
|
declare class ReactPageProvider {
|
|
50
|
-
protected readonly log:
|
|
50
|
+
protected readonly log: _alepha_logger1.Logger;
|
|
51
51
|
protected readonly env: {
|
|
52
52
|
REACT_STRICT_MODE: boolean;
|
|
53
53
|
};
|
|
@@ -83,7 +83,7 @@ declare class ReactPageProvider {
|
|
|
83
83
|
}, params?: Record<string, any>): string;
|
|
84
84
|
compile(path: string, params?: Record<string, string>): string;
|
|
85
85
|
protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
|
|
86
|
-
protected readonly configure:
|
|
86
|
+
protected readonly configure: _alepha_core14.HookDescriptor<"configure">;
|
|
87
87
|
protected map(pages: Array<PageDescriptor>, target: PageDescriptor): PageRouteEntry;
|
|
88
88
|
add(entry: PageRouteEntry): void;
|
|
89
89
|
protected createMatch(page: PageRoute): string;
|
|
@@ -489,18 +489,18 @@ interface BrowserRoute extends Route {
|
|
|
489
489
|
page: PageRoute;
|
|
490
490
|
}
|
|
491
491
|
declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
492
|
-
protected readonly log:
|
|
492
|
+
protected readonly log: _alepha_logger1.Logger;
|
|
493
493
|
protected readonly alepha: Alepha;
|
|
494
494
|
protected readonly pageApi: ReactPageProvider;
|
|
495
495
|
add(entry: PageRouteEntry): void;
|
|
496
|
-
protected readonly configure:
|
|
496
|
+
protected readonly configure: _alepha_core14.HookDescriptor<"configure">;
|
|
497
497
|
transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
|
|
498
498
|
root(state: ReactRouterState): ReactNode;
|
|
499
499
|
}
|
|
500
500
|
//#endregion
|
|
501
501
|
//#region src/providers/ReactBrowserProvider.d.ts
|
|
502
|
-
declare const envSchema$1:
|
|
503
|
-
REACT_ROOT_ID:
|
|
502
|
+
declare const envSchema$1: _alepha_core14.TObject<{
|
|
503
|
+
REACT_ROOT_ID: _alepha_core14.TString;
|
|
504
504
|
}>;
|
|
505
505
|
declare module "alepha" {
|
|
506
506
|
interface Env extends Partial<Static<typeof envSchema$1>> {}
|
|
@@ -512,7 +512,7 @@ declare class ReactBrowserProvider {
|
|
|
512
512
|
protected readonly env: {
|
|
513
513
|
REACT_ROOT_ID: string;
|
|
514
514
|
};
|
|
515
|
-
protected readonly log:
|
|
515
|
+
protected readonly log: _alepha_logger1.Logger;
|
|
516
516
|
protected readonly client: LinkProvider;
|
|
517
517
|
protected readonly alepha: Alepha;
|
|
518
518
|
protected readonly router: ReactBrowserRouterProvider;
|
|
@@ -546,8 +546,8 @@ declare class ReactBrowserProvider {
|
|
|
546
546
|
* Get embedded layers from the server.
|
|
547
547
|
*/
|
|
548
548
|
protected getHydrationState(): ReactHydrationState | undefined;
|
|
549
|
-
protected readonly onTransitionEnd:
|
|
550
|
-
readonly ready:
|
|
549
|
+
protected readonly onTransitionEnd: _alepha_core14.HookDescriptor<"react:transition:end">;
|
|
550
|
+
readonly ready: _alepha_core14.HookDescriptor<"ready">;
|
|
551
551
|
}
|
|
552
552
|
interface RouterGoOptions {
|
|
553
553
|
replace?: boolean;
|
|
@@ -619,25 +619,25 @@ interface ErrorViewerProps {
|
|
|
619
619
|
declare const ErrorViewer: ({
|
|
620
620
|
error,
|
|
621
621
|
alepha
|
|
622
|
-
}: ErrorViewerProps) =>
|
|
622
|
+
}: ErrorViewerProps) => react_jsx_runtime0.JSX.Element;
|
|
623
623
|
//#endregion
|
|
624
624
|
//#region src/components/Link.d.ts
|
|
625
625
|
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
626
626
|
href: string;
|
|
627
627
|
}
|
|
628
|
-
declare const Link: (props: LinkProps) =>
|
|
628
|
+
declare const Link: (props: LinkProps) => react_jsx_runtime0.JSX.Element;
|
|
629
629
|
//#endregion
|
|
630
630
|
//#region src/components/NestedView.d.ts
|
|
631
631
|
interface NestedViewProps {
|
|
632
632
|
children?: ReactNode;
|
|
633
633
|
errorBoundary?: false | ((error: Error) => ReactNode);
|
|
634
634
|
}
|
|
635
|
-
declare const _default: react0.MemoExoticComponent<(props: NestedViewProps) =>
|
|
635
|
+
declare const _default: react0.MemoExoticComponent<(props: NestedViewProps) => react_jsx_runtime0.JSX.Element>;
|
|
636
636
|
//#endregion
|
|
637
637
|
//#region src/components/NotFound.d.ts
|
|
638
638
|
declare function NotFoundPage(props: {
|
|
639
639
|
style?: CSSProperties;
|
|
640
|
-
}):
|
|
640
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
641
641
|
//#endregion
|
|
642
642
|
//#region src/contexts/AlephaContext.d.ts
|
|
643
643
|
declare const AlephaContext: react0.Context<Alepha | undefined>;
|
|
@@ -800,12 +800,12 @@ declare const ssrSchemaLoading: (alepha: Alepha, name: string) => RequestConfigS
|
|
|
800
800
|
declare const useStore: <Key extends keyof State>(key: Key, defaultValue?: State[Key]) => [State[Key], (value: State[Key]) => void];
|
|
801
801
|
//#endregion
|
|
802
802
|
//#region src/providers/ReactServerProvider.d.ts
|
|
803
|
-
declare const envSchema:
|
|
804
|
-
REACT_SERVER_DIST:
|
|
805
|
-
REACT_SERVER_PREFIX:
|
|
806
|
-
REACT_SSR_ENABLED:
|
|
807
|
-
REACT_ROOT_ID:
|
|
808
|
-
REACT_SERVER_TEMPLATE:
|
|
803
|
+
declare const envSchema: _alepha_core14.TObject<{
|
|
804
|
+
REACT_SERVER_DIST: _alepha_core14.TString;
|
|
805
|
+
REACT_SERVER_PREFIX: _alepha_core14.TString;
|
|
806
|
+
REACT_SSR_ENABLED: _alepha_core14.TOptional<_alepha_core14.TBoolean>;
|
|
807
|
+
REACT_ROOT_ID: _alepha_core14.TString;
|
|
808
|
+
REACT_SERVER_TEMPLATE: _alepha_core14.TOptional<_alepha_core14.TString>;
|
|
809
809
|
}>;
|
|
810
810
|
declare module "alepha" {
|
|
811
811
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
@@ -814,7 +814,7 @@ declare module "alepha" {
|
|
|
814
814
|
}
|
|
815
815
|
}
|
|
816
816
|
declare class ReactServerProvider {
|
|
817
|
-
protected readonly log:
|
|
817
|
+
protected readonly log: _alepha_logger1.Logger;
|
|
818
818
|
protected readonly alepha: Alepha;
|
|
819
819
|
protected readonly pageApi: ReactPageProvider;
|
|
820
820
|
protected readonly serverProvider: ServerProvider;
|
|
@@ -824,13 +824,13 @@ declare class ReactServerProvider {
|
|
|
824
824
|
protected readonly env: {
|
|
825
825
|
REACT_SSR_ENABLED?: boolean | undefined;
|
|
826
826
|
REACT_SERVER_TEMPLATE?: string | undefined;
|
|
827
|
-
REACT_ROOT_ID: string;
|
|
828
827
|
REACT_SERVER_DIST: string;
|
|
829
828
|
REACT_SERVER_PREFIX: string;
|
|
829
|
+
REACT_ROOT_ID: string;
|
|
830
830
|
};
|
|
831
831
|
protected readonly ROOT_DIV_REGEX: RegExp;
|
|
832
832
|
protected preprocessedTemplate: PreprocessedTemplate | null;
|
|
833
|
-
readonly onConfigure:
|
|
833
|
+
readonly onConfigure: _alepha_core14.HookDescriptor<"configure">;
|
|
834
834
|
get template(): string;
|
|
835
835
|
protected registerPages(templateLoader: TemplateLoader): Promise<void>;
|
|
836
836
|
protected getPublicDirectory(): string;
|
|
@@ -903,7 +903,7 @@ declare module "alepha" {
|
|
|
903
903
|
* @see {@link $page}
|
|
904
904
|
* @module alepha.react
|
|
905
905
|
*/
|
|
906
|
-
declare const AlephaReact:
|
|
906
|
+
declare const AlephaReact: _alepha_core14.Service<_alepha_core14.Module<{}>>;
|
|
907
907
|
//#endregion
|
|
908
908
|
export { $page, AlephaContext, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, VirtualRouter, isPageRoute, ssrSchemaLoading, useActive, useAlepha, useClient, useInject, useQueryParams, useRouter, useRouterEvents, useRouterState, useSchema, useStore };
|
|
909
909
|
//# sourceMappingURL=index.d.ts.map
|
package/security.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _alepha_core1 from "alepha";
|
|
2
2
|
import { Alepha, Descriptor, KIND, Static } from "alepha";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _alepha_logger1 from "alepha/logger";
|
|
4
4
|
import { DateTimeProvider, Duration, DurationLike } from "alepha/datetime";
|
|
5
5
|
import { CryptoKey, FlattenedJWSInput, JSONWebKeySet, JWSHeaderParameters, JWTHeaderParameters, JWTPayload, JWTVerifyResult, KeyObject } from "jose";
|
|
6
6
|
import * as typebox0 from "typebox";
|
|
@@ -68,7 +68,7 @@ type Role = Static<typeof roleSchema>;
|
|
|
68
68
|
* Provides utilities for working with JSON Web Tokens (JWT).
|
|
69
69
|
*/
|
|
70
70
|
declare class JwtProvider {
|
|
71
|
-
protected readonly log:
|
|
71
|
+
protected readonly log: _alepha_logger1.Logger;
|
|
72
72
|
protected readonly keystore: KeyLoaderHolder[];
|
|
73
73
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
74
74
|
protected readonly encoder: TextEncoder;
|
|
@@ -140,7 +140,7 @@ declare class SecurityProvider {
|
|
|
140
140
|
protected readonly UNKNOWN_USER_NAME = "Anonymous User";
|
|
141
141
|
protected readonly PERMISSION_REGEXP: RegExp;
|
|
142
142
|
protected readonly PERMISSION_REGEXP_WILDCARD: RegExp;
|
|
143
|
-
protected readonly log:
|
|
143
|
+
protected readonly log: _alepha_logger1.Logger;
|
|
144
144
|
protected readonly jwt: JwtProvider;
|
|
145
145
|
protected readonly env: {
|
|
146
146
|
APP_SECRET: string;
|
|
@@ -199,9 +199,6 @@ declare class SecurityProvider {
|
|
|
199
199
|
checkPermission(permissionLike: string | Permission, ...roleEntries: string[]): SecurityCheckResult;
|
|
200
200
|
/**
|
|
201
201
|
* Creates a user account from the provided payload.
|
|
202
|
-
*
|
|
203
|
-
* @param headerOrToken
|
|
204
|
-
* @param permissionLike
|
|
205
202
|
*/
|
|
206
203
|
createUserFromToken(headerOrToken?: string, options?: {
|
|
207
204
|
permission?: Permission | string;
|
|
@@ -402,7 +399,7 @@ declare class RealmDescriptor extends Descriptor<RealmDescriptorOptions> {
|
|
|
402
399
|
protected readonly securityProvider: SecurityProvider;
|
|
403
400
|
protected readonly dateTimeProvider: DateTimeProvider;
|
|
404
401
|
protected readonly jwt: JwtProvider;
|
|
405
|
-
protected readonly log:
|
|
402
|
+
protected readonly log: _alepha_logger1.Logger;
|
|
406
403
|
get name(): string;
|
|
407
404
|
get accessTokenExpiration(): Duration;
|
|
408
405
|
get refreshTokenExpiration(): Duration;
|
package/server/cache.d.ts
CHANGED
|
@@ -9,8 +9,22 @@ import { RequestConfigSchema, ServerRequest, ServerRoute } from "alepha/server";
|
|
|
9
9
|
//#region src/providers/ServerCacheProvider.d.ts
|
|
10
10
|
declare module "alepha/server" {
|
|
11
11
|
interface ServerRoute {
|
|
12
|
+
/**
|
|
13
|
+
* Enable caching for this route.
|
|
14
|
+
* If set to true, a default cache configuration will be applied (5 minutes TTL).
|
|
15
|
+
* If a DurationLike is provided, it will be used as the TTL for the cache.
|
|
16
|
+
*
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
12
19
|
cache?: ServerRouteCache;
|
|
13
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Enable ETag support for this route.
|
|
22
|
+
* If set to true, the server will generate and manage ETags automatically.
|
|
23
|
+
* If a string is provided, it will be used as a static ETag value.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
etag?: boolean | string;
|
|
14
28
|
}
|
|
15
29
|
interface ActionDescriptor<TConfig extends RequestConfigSchema> {
|
|
16
30
|
invalidate: () => Promise<void>;
|
|
@@ -26,13 +40,8 @@ declare class ServerCacheProvider {
|
|
|
26
40
|
protected readonly onActionRequest: _alepha_core1.HookDescriptor<"action:onRequest">;
|
|
27
41
|
protected readonly onActionResponse: _alepha_core1.HookDescriptor<"action:onResponse">;
|
|
28
42
|
protected readonly onRequest: _alepha_core1.HookDescriptor<"server:onRequest">;
|
|
43
|
+
protected readonly onSend: _alepha_core1.HookDescriptor<"server:onSend">;
|
|
29
44
|
protected readonly onResponse: _alepha_core1.HookDescriptor<"server:onResponse">;
|
|
30
|
-
protected getCacheOptions(cache: ServerRouteCache): {
|
|
31
|
-
provider?: (_alepha_core1.InstantiableClass<_alepha_cache0.CacheProvider> | "memory") | undefined;
|
|
32
|
-
name?: string | undefined;
|
|
33
|
-
ttl?: DurationLike | undefined;
|
|
34
|
-
disabled?: boolean | undefined;
|
|
35
|
-
};
|
|
36
45
|
protected createCacheKey(route: ServerRoute, config?: ServerRequest): string;
|
|
37
46
|
}
|
|
38
47
|
type ServerRouteCache = boolean | DurationLike | Omit<CacheDescriptorOptions<any>, "handler" | "key">;
|