@alepha/protobuf 0.13.1 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +43 -43
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import "dayjs";
|
|
|
7
7
|
|
|
8
8
|
//#region ../alepha/src/core/constants/KIND.d.ts
|
|
9
9
|
/**
|
|
10
|
-
* Used for identifying
|
|
10
|
+
* Used for identifying primitives.
|
|
11
11
|
*
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
@@ -60,34 +60,49 @@ interface ServiceSubstitution<T extends object = any> {
|
|
|
60
60
|
*/
|
|
61
61
|
type ServiceEntry<T extends object = any> = Service<T> | ServiceSubstitution<T>;
|
|
62
62
|
//#endregion
|
|
63
|
-
//#region ../alepha/src/core/helpers/
|
|
64
|
-
interface
|
|
63
|
+
//#region ../alepha/src/core/helpers/primitive.d.ts
|
|
64
|
+
interface PrimitiveArgs<T extends object = {}> {
|
|
65
65
|
options: T;
|
|
66
66
|
alepha: Alepha;
|
|
67
67
|
service: InstantiableClass<Service>;
|
|
68
68
|
module?: Service;
|
|
69
69
|
}
|
|
70
|
-
interface
|
|
70
|
+
interface PrimitiveConfig {
|
|
71
71
|
propertyKey: string;
|
|
72
72
|
service: InstantiableClass<Service>;
|
|
73
73
|
module?: Service;
|
|
74
74
|
}
|
|
75
|
-
declare abstract class
|
|
75
|
+
declare abstract class Primitive<T extends object = {}> {
|
|
76
76
|
protected readonly alepha: Alepha;
|
|
77
77
|
readonly options: T;
|
|
78
|
-
readonly config:
|
|
79
|
-
constructor(args:
|
|
78
|
+
readonly config: PrimitiveConfig;
|
|
79
|
+
constructor(args: PrimitiveArgs<T>);
|
|
80
80
|
/**
|
|
81
|
-
* Called automatically by Alepha after the
|
|
81
|
+
* Called automatically by Alepha after the primitive is created.
|
|
82
82
|
*/
|
|
83
83
|
protected onInit(): void;
|
|
84
84
|
}
|
|
85
|
-
type
|
|
85
|
+
type PrimitiveFactoryLike<T extends object = any> = {
|
|
86
86
|
(options: T): any;
|
|
87
87
|
[KIND]: any;
|
|
88
88
|
};
|
|
89
89
|
//#endregion
|
|
90
|
-
//#region ../alepha/src/core/
|
|
90
|
+
//#region ../alepha/src/core/interfaces/Async.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* Represents a value that can be either a value or a promise of value.
|
|
93
|
+
*/
|
|
94
|
+
type Async<T> = T | Promise<T>;
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region ../alepha/src/core/interfaces/LoggerInterface.d.ts
|
|
97
|
+
interface LoggerInterface {
|
|
98
|
+
trace(message: string, data?: unknown): void;
|
|
99
|
+
debug(message: string, data?: unknown): void;
|
|
100
|
+
info(message: string, data?: unknown): void;
|
|
101
|
+
warn(message: string, data?: unknown): void;
|
|
102
|
+
error(message: string, data?: unknown): void;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region ../alepha/src/core/primitives/$inject.d.ts
|
|
91
106
|
interface InjectOptions<T extends object = any> {
|
|
92
107
|
/**
|
|
93
108
|
* - 'transient' → Always a new instance on every inject. Zero caching.
|
|
@@ -112,8 +127,8 @@ interface InjectOptions<T extends object = any> {
|
|
|
112
127
|
parent?: Service | null;
|
|
113
128
|
}
|
|
114
129
|
//#endregion
|
|
115
|
-
//#region ../alepha/src/core/
|
|
116
|
-
interface
|
|
130
|
+
//#region ../alepha/src/core/primitives/$module.d.ts
|
|
131
|
+
interface ModulePrimitiveOptions {
|
|
117
132
|
/**
|
|
118
133
|
* Name of the module.
|
|
119
134
|
*
|
|
@@ -128,9 +143,9 @@ interface ModuleDescriptorOptions {
|
|
|
128
143
|
*/
|
|
129
144
|
services?: Array<Service>;
|
|
130
145
|
/**
|
|
131
|
-
* List of $
|
|
146
|
+
* List of $primitives to register in the module.
|
|
132
147
|
*/
|
|
133
|
-
|
|
148
|
+
primitives?: Array<PrimitiveFactoryLike>;
|
|
134
149
|
/**
|
|
135
150
|
* By default, module will register ALL services.
|
|
136
151
|
* You can override this behavior by providing a register function.
|
|
@@ -144,7 +159,7 @@ interface ModuleDescriptorOptions {
|
|
|
144
159
|
* Base class for all modules.
|
|
145
160
|
*/
|
|
146
161
|
declare abstract class Module {
|
|
147
|
-
abstract readonly options:
|
|
162
|
+
abstract readonly options: ModulePrimitiveOptions;
|
|
148
163
|
abstract register(alepha: Alepha): void;
|
|
149
164
|
static NAME_REGEX: RegExp;
|
|
150
165
|
/**
|
|
@@ -159,21 +174,6 @@ declare abstract class Module {
|
|
|
159
174
|
static of(ctor: Service): Service<Module> | undefined;
|
|
160
175
|
}
|
|
161
176
|
//#endregion
|
|
162
|
-
//#region ../alepha/src/core/interfaces/Async.d.ts
|
|
163
|
-
/**
|
|
164
|
-
* Represents a value that can be either a value or a promise of value.
|
|
165
|
-
*/
|
|
166
|
-
type Async<T> = T | Promise<T>;
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region ../alepha/src/core/interfaces/LoggerInterface.d.ts
|
|
169
|
-
interface LoggerInterface {
|
|
170
|
-
trace(message: string, data?: unknown): void;
|
|
171
|
-
debug(message: string, data?: unknown): void;
|
|
172
|
-
info(message: string, data?: unknown): void;
|
|
173
|
-
warn(message: string, data?: unknown): void;
|
|
174
|
-
error(message: string, data?: unknown): void;
|
|
175
|
-
}
|
|
176
|
-
//#endregion
|
|
177
177
|
//#region ../alepha/src/core/providers/AlsProvider.d.ts
|
|
178
178
|
type AsyncLocalStorageData = any;
|
|
179
179
|
declare class AlsProvider {
|
|
@@ -379,7 +379,7 @@ declare class EventManager {
|
|
|
379
379
|
}): Promise<void>;
|
|
380
380
|
}
|
|
381
381
|
//#endregion
|
|
382
|
-
//#region ../alepha/src/core/
|
|
382
|
+
//#region ../alepha/src/core/primitives/$atom.d.ts
|
|
383
383
|
type AtomOptions<T extends TAtomObject, N extends string> = {
|
|
384
384
|
name: N;
|
|
385
385
|
schema: T;
|
|
@@ -508,7 +508,7 @@ type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends A
|
|
|
508
508
|
* // You can access the environment variables using alepha.env
|
|
509
509
|
* console.log(alepha.env.MY_VAR); // "value"
|
|
510
510
|
*
|
|
511
|
-
* // But you should use $env()
|
|
511
|
+
* // But you should use $env() primitive to get typed values from the environment.
|
|
512
512
|
* class App {
|
|
513
513
|
* env = $env(
|
|
514
514
|
* t.object({
|
|
@@ -521,7 +521,7 @@ type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends A
|
|
|
521
521
|
* ### Modules
|
|
522
522
|
*
|
|
523
523
|
* Modules are a way to group services together.
|
|
524
|
-
* You can register a module using the `$module`
|
|
524
|
+
* You can register a module using the `$module` primitive.
|
|
525
525
|
*
|
|
526
526
|
* ```ts
|
|
527
527
|
* import { $module } from "alepha";
|
|
@@ -539,7 +539,7 @@ type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends A
|
|
|
539
539
|
* ### Hooks
|
|
540
540
|
*
|
|
541
541
|
* Hooks are a way to run async functions from all registered providers/services.
|
|
542
|
-
* You can register a hook using the `$hook`
|
|
542
|
+
* You can register a hook using the `$hook` primitive.
|
|
543
543
|
*
|
|
544
544
|
* ```ts
|
|
545
545
|
* import { $hook } from "alepha";
|
|
@@ -636,9 +636,9 @@ declare class Alepha {
|
|
|
636
636
|
use: Service;
|
|
637
637
|
}>;
|
|
638
638
|
/**
|
|
639
|
-
* Registry of
|
|
639
|
+
* Registry of primitives.
|
|
640
640
|
*/
|
|
641
|
-
protected
|
|
641
|
+
protected primitiveRegistry: Map<Service<Primitive<{}>>, Primitive<{}>[]>;
|
|
642
642
|
/**
|
|
643
643
|
* List of all services + how they are provided.
|
|
644
644
|
*/
|
|
@@ -658,7 +658,7 @@ declare class Alepha {
|
|
|
658
658
|
/**
|
|
659
659
|
* State manager to store arbitrary values.
|
|
660
660
|
*/
|
|
661
|
-
get
|
|
661
|
+
get store(): StateManager<State>;
|
|
662
662
|
/**
|
|
663
663
|
* Codec manager for encoding and decoding data with different formats.
|
|
664
664
|
*
|
|
@@ -731,7 +731,7 @@ declare class Alepha {
|
|
|
731
731
|
* Starts the App.
|
|
732
732
|
*
|
|
733
733
|
* - Lock any further changes to the container.
|
|
734
|
-
* - Run "configure" hook for all services.
|
|
734
|
+
* - Run "configure" hook for all services. Primitives will be processed.
|
|
735
735
|
* - Run "start" hook for all services. Providers will connect/listen/...
|
|
736
736
|
* - Run "ready" hook for all services. This is the point where the App is ready to serve requests.
|
|
737
737
|
*
|
|
@@ -836,13 +836,13 @@ declare class Alepha {
|
|
|
836
836
|
}>;
|
|
837
837
|
services<T extends object>(base: Service<T>): Array<T>;
|
|
838
838
|
/**
|
|
839
|
-
* Get all
|
|
839
|
+
* Get all primitives of the specified type.
|
|
840
840
|
*/
|
|
841
|
-
|
|
842
|
-
[KIND]: InstantiableClass<
|
|
843
|
-
} | string): Array<
|
|
841
|
+
primitives<TPrimitive extends Primitive>(factory: {
|
|
842
|
+
[KIND]: InstantiableClass<TPrimitive>;
|
|
843
|
+
} | string): Array<TPrimitive>;
|
|
844
844
|
protected new<T extends object>(service: Service<T>, args?: any[]): T;
|
|
845
|
-
protected
|
|
845
|
+
protected processPrimitive(value: Primitive, propertyKey?: string): void;
|
|
846
846
|
}
|
|
847
847
|
interface Hook<T extends keyof Hooks = any> {
|
|
848
848
|
caller?: Service;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@alepha/protobuf",
|
|
3
3
|
"description": "Protocol Buffers (Protobuf) codec support for Alepha framework.",
|
|
4
4
|
"author": "Nicolas Foures",
|
|
5
|
-
"version": "0.13.
|
|
5
|
+
"version": "0.13.3",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=22.0.0"
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"protobufjs": "^7.5.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"alepha": "0.13.
|
|
22
|
-
"tsdown": "^0.16.
|
|
21
|
+
"alepha": "0.13.3",
|
|
22
|
+
"tsdown": "^0.16.8",
|
|
23
23
|
"typescript": "^5.9.3",
|
|
24
|
-
"vitest": "^4.0.
|
|
24
|
+
"vitest": "^4.0.15"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"alepha": "0.13.
|
|
27
|
+
"alepha": "0.13.3"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"lint": "alepha lint",
|