@alepha/protobuf 0.13.6 → 0.13.8
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 +25 -18
- package/package.json +7 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import protobufjs, { Type } from "protobufjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as typebox3 from "typebox";
|
|
3
3
|
import { Static, StaticDecode as Static$1, StaticEncode, TArray, TArray as TArray$1, TBoolean, TInteger, TObject, TObject as TObject$1, TOptional, TOptionalAdd, TRecord, TSchema, TSchema as TSchema$1, TString, TUnsafe } from "typebox";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { Validator } from "typebox/compile";
|
|
@@ -257,7 +257,7 @@ declare class JsonSchemaCodec extends SchemaCodec {
|
|
|
257
257
|
//#endregion
|
|
258
258
|
//#region ../alepha/src/core/providers/SchemaValidator.d.ts
|
|
259
259
|
declare class SchemaValidator {
|
|
260
|
-
protected cache: Map<TSchema, Validator<
|
|
260
|
+
protected cache: Map<TSchema, Validator<typebox3.TProperties, TSchema, unknown, unknown>>;
|
|
261
261
|
/**
|
|
262
262
|
* Validate the value against the provided schema.
|
|
263
263
|
*
|
|
@@ -361,7 +361,7 @@ declare class CodecManager {
|
|
|
361
361
|
//#endregion
|
|
362
362
|
//#region ../alepha/src/core/providers/EventManager.d.ts
|
|
363
363
|
declare class EventManager {
|
|
364
|
-
|
|
364
|
+
logFn?: () => LoggerInterface | undefined;
|
|
365
365
|
/**
|
|
366
366
|
* List of events that can be triggered. Powered by $hook().
|
|
367
367
|
*/
|
|
@@ -407,7 +407,7 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
407
407
|
protected readonly als: AlsProvider;
|
|
408
408
|
protected readonly events: EventManager;
|
|
409
409
|
protected readonly codec: JsonSchemaCodec;
|
|
410
|
-
protected readonly atoms: Map<keyof State$1, Atom<TObject<
|
|
410
|
+
protected readonly atoms: Map<keyof State$1, Atom<TObject<typebox3.TProperties>, string>>;
|
|
411
411
|
protected store: Partial<State$1>;
|
|
412
412
|
constructor(store?: Partial<State$1>);
|
|
413
413
|
getAtoms(context?: boolean): Array<AtomWithValue>;
|
|
@@ -420,8 +420,8 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
420
420
|
/**
|
|
421
421
|
* Set a value in the state
|
|
422
422
|
*/
|
|
423
|
-
set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T
|
|
424
|
-
set<Key extends keyof State$1>(target: Key, value: State$1[Key] | undefined): this;
|
|
423
|
+
set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>, options?: SetStateOptions): this;
|
|
424
|
+
set<Key extends keyof State$1>(target: Key, value: State$1[Key] | undefined, options?: SetStateOptions): this;
|
|
425
425
|
/**
|
|
426
426
|
* Mutate a value in the state.
|
|
427
427
|
*/
|
|
@@ -438,7 +438,7 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
438
438
|
/**
|
|
439
439
|
* Push a value to an array in the state
|
|
440
440
|
*/
|
|
441
|
-
push<Key extends keyof OnlyArray<State$1>>(key: Key, value: NonNullable<State$1[Key]> extends Array<infer U> ? U : never): this;
|
|
441
|
+
push<Key extends keyof OnlyArray<State$1>>(key: Key, ...value: Array<NonNullable<State$1[Key]> extends Array<infer U> ? U : never>): this;
|
|
442
442
|
/**
|
|
443
443
|
* Clear all state
|
|
444
444
|
*/
|
|
@@ -449,6 +449,10 @@ declare class StateManager<State$1 extends object = State> {
|
|
|
449
449
|
keys(): (keyof State$1)[];
|
|
450
450
|
}
|
|
451
451
|
type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends Array<any> ? K : never };
|
|
452
|
+
interface SetStateOptions {
|
|
453
|
+
skipContext?: boolean;
|
|
454
|
+
skipEvents?: boolean;
|
|
455
|
+
}
|
|
452
456
|
//#endregion
|
|
453
457
|
//#region ../alepha/src/core/Alepha.d.ts
|
|
454
458
|
/**
|
|
@@ -605,12 +609,6 @@ declare class Alepha {
|
|
|
605
609
|
* A promise that resolves when the App has started.
|
|
606
610
|
*/
|
|
607
611
|
protected starting?: PromiseWithResolvers<this>;
|
|
608
|
-
/**
|
|
609
|
-
* Initial state of the container.
|
|
610
|
-
*
|
|
611
|
-
* > Used to initialize the StateManager.
|
|
612
|
-
*/
|
|
613
|
-
protected init: Partial<State>;
|
|
614
612
|
/**
|
|
615
613
|
* During the instantiation process, we keep a list of pending instantiations.
|
|
616
614
|
* > It allows us to detect circular dependencies.
|
|
@@ -650,21 +648,21 @@ declare class Alepha {
|
|
|
650
648
|
*
|
|
651
649
|
* Mocked for browser environments.
|
|
652
650
|
*/
|
|
653
|
-
|
|
651
|
+
context: AlsProvider;
|
|
654
652
|
/**
|
|
655
653
|
* Event manager to handle lifecycle events and custom events.
|
|
656
654
|
*/
|
|
657
|
-
|
|
655
|
+
events: EventManager;
|
|
658
656
|
/**
|
|
659
657
|
* State manager to store arbitrary values.
|
|
660
658
|
*/
|
|
661
|
-
|
|
659
|
+
store: StateManager<State>;
|
|
662
660
|
/**
|
|
663
661
|
* Codec manager for encoding and decoding data with different formats.
|
|
664
662
|
*
|
|
665
663
|
* Supports multiple codec formats (JSON, Protobuf, etc.) with a unified interface.
|
|
666
664
|
*/
|
|
667
|
-
|
|
665
|
+
codec: CodecManager;
|
|
668
666
|
/**
|
|
669
667
|
* Get logger instance.
|
|
670
668
|
*/
|
|
@@ -673,7 +671,7 @@ declare class Alepha {
|
|
|
673
671
|
* The environment variables for the App.
|
|
674
672
|
*/
|
|
675
673
|
get env(): Readonly<Env>;
|
|
676
|
-
constructor(
|
|
674
|
+
constructor(state?: Partial<State>);
|
|
677
675
|
set<T extends TAtomObject>(target: Atom<T>, value: AtomStatic<T>): this;
|
|
678
676
|
set<Key extends keyof State>(target: Key, value: State[Key] | undefined): this;
|
|
679
677
|
/**
|
|
@@ -826,6 +824,15 @@ declare class Alepha {
|
|
|
826
824
|
* @return The schema object with environment variables applied.
|
|
827
825
|
*/
|
|
828
826
|
parseEnv<T extends TObject>(schema: T): Static<T>;
|
|
827
|
+
/**
|
|
828
|
+
* Get all environment variable schemas and their parsed values.
|
|
829
|
+
*
|
|
830
|
+
* This is useful for DevTools to display all expected environment variables.
|
|
831
|
+
*/
|
|
832
|
+
getEnvSchemas(): Array<{
|
|
833
|
+
schema: TSchema$1;
|
|
834
|
+
values: Record<string, any>;
|
|
835
|
+
}>;
|
|
829
836
|
/**
|
|
830
837
|
* Dump the current dependency graph of the App.
|
|
831
838
|
*
|
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.8",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=22.0.0"
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"src"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"protobufjs": "^
|
|
18
|
+
"protobufjs": "^8.0.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"alepha": "0.13.
|
|
22
|
-
"tsdown": "^0.
|
|
21
|
+
"alepha": "0.13.8",
|
|
22
|
+
"tsdown": "^0.18.1",
|
|
23
23
|
"typescript": "^5.9.3",
|
|
24
|
-
"vitest": "^4.0.
|
|
24
|
+
"vitest": "^4.0.16"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"alepha": "0.13.
|
|
27
|
+
"alepha": "0.13.8"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"lint": "alepha lint",
|
|
@@ -41,6 +41,5 @@
|
|
|
41
41
|
"alepha",
|
|
42
42
|
"protobuf",
|
|
43
43
|
"typebox"
|
|
44
|
-
]
|
|
45
|
-
"module": "./dist/index.js"
|
|
44
|
+
]
|
|
46
45
|
}
|