alepha 0.13.1 → 0.13.2
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 +1 -1
- package/dist/api-files/index.d.ts +28 -91
- package/dist/api-files/index.js +10 -755
- package/dist/api-files/index.js.map +1 -1
- package/dist/api-jobs/index.d.ts +46 -46
- package/dist/api-jobs/index.js +13 -13
- package/dist/api-jobs/index.js.map +1 -1
- package/dist/api-notifications/index.d.ts +129 -146
- package/dist/api-notifications/index.js +17 -39
- package/dist/api-notifications/index.js.map +1 -1
- package/dist/api-parameters/index.d.ts +21 -22
- package/dist/api-parameters/index.js +22 -22
- package/dist/api-parameters/index.js.map +1 -1
- package/dist/api-users/index.d.ts +223 -2000
- package/dist/api-users/index.js +914 -4787
- package/dist/api-users/index.js.map +1 -1
- package/dist/api-verifications/index.d.ts +96 -96
- package/dist/batch/index.d.ts +13 -13
- package/dist/batch/index.js +8 -8
- package/dist/batch/index.js.map +1 -1
- package/dist/bucket/index.d.ts +14 -14
- package/dist/bucket/index.js +12 -12
- package/dist/bucket/index.js.map +1 -1
- package/dist/cache/index.d.ts +11 -11
- package/dist/cache/index.js +9 -9
- package/dist/cache/index.js.map +1 -1
- package/dist/cli/index.d.ts +28 -26
- package/dist/cli/index.js +50 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/command/index.d.ts +19 -19
- package/dist/command/index.js +25 -25
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +218 -218
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +232 -232
- package/dist/core/index.js +218 -218
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +2113 -0
- package/dist/core/index.native.js.map +1 -0
- package/dist/datetime/index.d.ts +9 -9
- package/dist/datetime/index.js +7 -7
- package/dist/datetime/index.js.map +1 -1
- package/dist/email/index.d.ts +16 -16
- package/dist/email/index.js +9 -9
- package/dist/email/index.js.map +1 -1
- package/dist/file/index.js +1 -1
- package/dist/file/index.js.map +1 -1
- package/dist/lock/index.d.ts +9 -9
- package/dist/lock/index.js +8 -8
- package/dist/lock/index.js.map +1 -1
- package/dist/lock-redis/index.js +3 -66
- package/dist/lock-redis/index.js.map +1 -1
- package/dist/logger/index.d.ts +5 -5
- package/dist/logger/index.js +8 -8
- package/dist/logger/index.js.map +1 -1
- package/dist/orm/index.browser.js +114 -114
- package/dist/orm/index.browser.js.map +1 -1
- package/dist/orm/index.d.ts +218 -218
- package/dist/orm/index.js +46 -46
- package/dist/orm/index.js.map +1 -1
- package/dist/queue/index.d.ts +29 -29
- package/dist/queue/index.js +20 -20
- package/dist/queue/index.js.map +1 -1
- package/dist/queue-redis/index.d.ts +2 -2
- package/dist/redis/index.d.ts +10 -10
- package/dist/retry/index.d.ts +19 -19
- package/dist/retry/index.js +7 -7
- package/dist/retry/index.js.map +1 -1
- package/dist/scheduler/index.d.ts +16 -16
- package/dist/scheduler/index.js +9 -9
- package/dist/scheduler/index.js.map +1 -1
- package/dist/security/index.d.ts +80 -80
- package/dist/security/index.js +32 -32
- package/dist/security/index.js.map +1 -1
- package/dist/server/index.browser.js +1 -1
- package/dist/server/index.browser.js.map +1 -1
- package/dist/server/index.d.ts +101 -101
- package/dist/server/index.js +16 -16
- package/dist/server/index.js.map +1 -1
- package/dist/server-auth/index.browser.js +4 -982
- package/dist/server-auth/index.browser.js.map +1 -1
- package/dist/server-auth/index.d.ts +204 -785
- package/dist/server-auth/index.js +47 -1239
- package/dist/server-auth/index.js.map +1 -1
- package/dist/server-cache/index.d.ts +10 -10
- package/dist/server-cache/index.js +2 -2
- package/dist/server-cache/index.js.map +1 -1
- package/dist/server-compress/index.d.ts +4 -4
- package/dist/server-compress/index.js +1 -1
- package/dist/server-compress/index.js.map +1 -1
- package/dist/server-cookies/index.browser.js +8 -8
- package/dist/server-cookies/index.browser.js.map +1 -1
- package/dist/server-cookies/index.d.ts +17 -17
- package/dist/server-cookies/index.js +10 -10
- package/dist/server-cookies/index.js.map +1 -1
- package/dist/server-cors/index.d.ts +17 -17
- package/dist/server-cors/index.js +9 -9
- package/dist/server-cors/index.js.map +1 -1
- package/dist/server-health/index.d.ts +19 -19
- package/dist/server-helmet/index.d.ts +1 -1
- package/dist/server-links/index.browser.js +12 -12
- package/dist/server-links/index.browser.js.map +1 -1
- package/dist/server-links/index.d.ts +59 -251
- package/dist/server-links/index.js +23 -502
- package/dist/server-links/index.js.map +1 -1
- package/dist/server-metrics/index.d.ts +4 -4
- package/dist/server-multipart/index.d.ts +2 -2
- package/dist/server-proxy/index.d.ts +12 -12
- package/dist/server-proxy/index.js +10 -10
- package/dist/server-proxy/index.js.map +1 -1
- package/dist/server-rate-limit/index.d.ts +22 -22
- package/dist/server-rate-limit/index.js +12 -12
- package/dist/server-rate-limit/index.js.map +1 -1
- package/dist/server-security/index.d.ts +22 -22
- package/dist/server-security/index.js +15 -15
- package/dist/server-security/index.js.map +1 -1
- package/dist/server-static/index.d.ts +14 -14
- package/dist/server-static/index.js +8 -8
- package/dist/server-static/index.js.map +1 -1
- package/dist/server-swagger/index.d.ts +25 -184
- package/dist/server-swagger/index.js +21 -724
- package/dist/server-swagger/index.js.map +1 -1
- package/dist/sms/index.d.ts +14 -14
- package/dist/sms/index.js +9 -9
- package/dist/sms/index.js.map +1 -1
- package/dist/thread/index.d.ts +11 -11
- package/dist/thread/index.js +17 -17
- package/dist/thread/index.js.map +1 -1
- package/dist/topic/index.d.ts +26 -26
- package/dist/topic/index.js +16 -16
- package/dist/topic/index.js.map +1 -1
- package/dist/topic-redis/index.d.ts +1 -1
- package/dist/vite/index.d.ts +3 -3
- package/dist/vite/index.js +8 -8
- package/dist/vite/index.js.map +1 -1
- package/dist/websocket/index.browser.js +11 -11
- package/dist/websocket/index.browser.js.map +1 -1
- package/dist/websocket/index.d.ts +58 -58
- package/dist/websocket/index.js +13 -13
- package/dist/websocket/index.js.map +1 -1
- package/package.json +113 -52
- package/src/api-files/services/FileService.ts +5 -7
- package/src/api-jobs/index.ts +1 -1
- package/src/api-jobs/{descriptors → primitives}/$job.ts +8 -8
- package/src/api-jobs/providers/JobProvider.ts +9 -9
- package/src/api-jobs/services/JobService.ts +5 -5
- package/src/api-notifications/index.ts +5 -15
- package/src/api-notifications/{descriptors → primitives}/$notification.ts +10 -10
- package/src/api-notifications/services/NotificationSenderService.ts +3 -3
- package/src/api-parameters/index.ts +1 -1
- package/src/api-parameters/{descriptors → primitives}/$config.ts +7 -12
- package/src/api-users/index.ts +1 -1
- package/src/api-users/{descriptors → primitives}/$userRealm.ts +8 -8
- package/src/api-users/providers/UserRealmProvider.ts +1 -1
- package/src/batch/index.ts +3 -3
- package/src/batch/{descriptors → primitives}/$batch.ts +13 -16
- package/src/bucket/index.ts +8 -8
- package/src/bucket/{descriptors → primitives}/$bucket.ts +8 -8
- package/src/bucket/providers/LocalFileStorageProvider.ts +3 -3
- package/src/cache/index.ts +4 -4
- package/src/cache/{descriptors → primitives}/$cache.ts +15 -15
- package/src/cli/apps/AlephaPackageBuilderCli.ts +24 -2
- package/src/cli/commands/DrizzleCommands.ts +6 -6
- package/src/cli/commands/VerifyCommands.ts +1 -1
- package/src/cli/commands/ViteCommands.ts +6 -1
- package/src/cli/services/ProjectUtils.ts +34 -3
- package/src/command/index.ts +5 -5
- package/src/command/{descriptors → primitives}/$command.ts +9 -12
- package/src/command/providers/CliProvider.ts +10 -10
- package/src/core/Alepha.ts +30 -33
- package/src/core/constants/KIND.ts +1 -1
- package/src/core/constants/OPTIONS.ts +1 -1
- package/src/core/helpers/{descriptor.ts → primitive.ts} +18 -18
- package/src/core/helpers/ref.ts +1 -1
- package/src/core/index.shared.ts +8 -8
- package/src/core/{descriptors → primitives}/$context.ts +5 -5
- package/src/core/{descriptors → primitives}/$hook.ts +4 -4
- package/src/core/{descriptors → primitives}/$inject.ts +2 -2
- package/src/core/{descriptors → primitives}/$module.ts +9 -9
- package/src/core/{descriptors → primitives}/$use.ts +2 -2
- package/src/core/providers/CodecManager.ts +1 -1
- package/src/core/providers/JsonSchemaCodec.ts +1 -1
- package/src/core/providers/StateManager.ts +2 -2
- package/src/datetime/index.ts +3 -3
- package/src/datetime/{descriptors → primitives}/$interval.ts +6 -6
- package/src/email/index.ts +4 -4
- package/src/email/{descriptors → primitives}/$email.ts +8 -8
- package/src/file/index.ts +1 -1
- package/src/lock/index.ts +3 -3
- package/src/lock/{descriptors → primitives}/$lock.ts +10 -10
- package/src/logger/index.ts +8 -8
- package/src/logger/{descriptors → primitives}/$logger.ts +2 -2
- package/src/logger/services/Logger.ts +1 -1
- package/src/orm/constants/PG_SYMBOLS.ts +2 -2
- package/src/orm/index.browser.ts +2 -2
- package/src/orm/index.ts +8 -8
- package/src/orm/{descriptors → primitives}/$entity.ts +11 -11
- package/src/orm/{descriptors → primitives}/$repository.ts +2 -2
- package/src/orm/{descriptors → primitives}/$sequence.ts +8 -8
- package/src/orm/{descriptors → primitives}/$transaction.ts +4 -4
- package/src/orm/providers/PostgresTypeProvider.ts +3 -3
- package/src/orm/providers/RepositoryProvider.ts +4 -4
- package/src/orm/providers/drivers/DatabaseProvider.ts +7 -7
- package/src/orm/services/ModelBuilder.ts +9 -9
- package/src/orm/services/PgRelationManager.ts +2 -2
- package/src/orm/services/PostgresModelBuilder.ts +5 -5
- package/src/orm/services/Repository.ts +7 -7
- package/src/orm/services/SqliteModelBuilder.ts +5 -5
- package/src/queue/index.ts +7 -7
- package/src/queue/{descriptors → primitives}/$consumer.ts +15 -15
- package/src/queue/{descriptors → primitives}/$queue.ts +12 -12
- package/src/queue/providers/WorkerProvider.ts +7 -7
- package/src/retry/index.ts +3 -3
- package/src/retry/{descriptors → primitives}/$retry.ts +14 -14
- package/src/scheduler/index.ts +3 -3
- package/src/scheduler/{descriptors → primitives}/$scheduler.ts +9 -9
- package/src/scheduler/providers/CronProvider.ts +1 -1
- package/src/security/index.ts +9 -9
- package/src/security/{descriptors → primitives}/$permission.ts +7 -7
- package/src/security/{descriptors → primitives}/$realm.ts +6 -12
- package/src/security/{descriptors → primitives}/$role.ts +12 -12
- package/src/security/{descriptors → primitives}/$serviceAccount.ts +8 -8
- package/src/server/index.browser.ts +1 -1
- package/src/server/index.ts +14 -14
- package/src/server/{descriptors → primitives}/$action.ts +13 -13
- package/src/server/{descriptors → primitives}/$route.ts +9 -9
- package/src/server/providers/NodeHttpServerProvider.ts +1 -1
- package/src/server/services/HttpClient.ts +1 -1
- package/src/server-auth/index.browser.ts +1 -1
- package/src/server-auth/index.ts +6 -6
- package/src/server-auth/{descriptors → primitives}/$auth.ts +10 -10
- package/src/server-auth/{descriptors → primitives}/$authCredentials.ts +4 -4
- package/src/server-auth/{descriptors → primitives}/$authGithub.ts +4 -4
- package/src/server-auth/{descriptors → primitives}/$authGoogle.ts +4 -4
- package/src/server-auth/providers/ServerAuthProvider.ts +4 -4
- package/src/server-cache/providers/ServerCacheProvider.ts +7 -7
- package/src/server-compress/providers/ServerCompressProvider.ts +3 -3
- package/src/server-cookies/index.browser.ts +2 -2
- package/src/server-cookies/index.ts +5 -5
- package/src/server-cookies/{descriptors → primitives}/$cookie.browser.ts +12 -12
- package/src/server-cookies/{descriptors → primitives}/$cookie.ts +13 -13
- package/src/server-cookies/providers/ServerCookiesProvider.ts +4 -4
- package/src/server-cookies/services/CookieParser.ts +1 -1
- package/src/server-cors/index.ts +3 -3
- package/src/server-cors/{descriptors → primitives}/$cors.ts +11 -13
- package/src/server-cors/providers/ServerCorsProvider.ts +5 -5
- package/src/server-links/index.browser.ts +5 -5
- package/src/server-links/index.ts +9 -9
- package/src/server-links/{descriptors → primitives}/$remote.ts +11 -11
- package/src/server-links/providers/LinkProvider.ts +7 -7
- package/src/server-links/providers/{RemoteDescriptorProvider.ts → RemotePrimitiveProvider.ts} +6 -6
- package/src/server-links/providers/ServerLinksProvider.ts +3 -3
- package/src/server-proxy/index.ts +3 -3
- package/src/server-proxy/{descriptors → primitives}/$proxy.ts +8 -8
- package/src/server-proxy/providers/ServerProxyProvider.ts +4 -4
- package/src/server-rate-limit/index.ts +6 -6
- package/src/server-rate-limit/{descriptors → primitives}/$rateLimit.ts +13 -13
- package/src/server-rate-limit/providers/ServerRateLimitProvider.ts +5 -5
- package/src/server-security/index.ts +3 -3
- package/src/server-security/{descriptors → primitives}/$basicAuth.ts +13 -13
- package/src/server-security/providers/ServerBasicAuthProvider.ts +5 -5
- package/src/server-security/providers/ServerSecurityProvider.ts +4 -4
- package/src/server-static/index.ts +3 -3
- package/src/server-static/{descriptors → primitives}/$serve.ts +8 -10
- package/src/server-static/providers/ServerStaticProvider.ts +6 -6
- package/src/server-swagger/index.ts +5 -5
- package/src/server-swagger/{descriptors → primitives}/$swagger.ts +9 -9
- package/src/server-swagger/providers/ServerSwaggerProvider.ts +11 -10
- package/src/sms/index.ts +4 -4
- package/src/sms/{descriptors → primitives}/$sms.ts +8 -8
- package/src/thread/index.ts +3 -3
- package/src/thread/{descriptors → primitives}/$thread.ts +13 -13
- package/src/thread/providers/ThreadProvider.ts +7 -9
- package/src/topic/index.ts +5 -5
- package/src/topic/{descriptors → primitives}/$subscriber.ts +14 -14
- package/src/topic/{descriptors → primitives}/$topic.ts +10 -10
- package/src/topic/providers/TopicProvider.ts +4 -4
- package/src/vite/tasks/copyAssets.ts +1 -1
- package/src/vite/tasks/generateSitemap.ts +3 -3
- package/src/vite/tasks/prerenderPages.ts +2 -2
- package/src/vite/tasks/runAlepha.ts +2 -2
- package/src/websocket/index.browser.ts +3 -3
- package/src/websocket/index.shared.ts +2 -2
- package/src/websocket/index.ts +4 -4
- package/src/websocket/interfaces/WebSocketInterfaces.ts +3 -3
- package/src/websocket/{descriptors → primitives}/$channel.ts +10 -10
- package/src/websocket/{descriptors → primitives}/$websocket.ts +8 -8
- package/src/websocket/providers/NodeWebSocketServerProvider.ts +7 -7
- package/src/websocket/providers/WebSocketServerProvider.ts +3 -3
- package/src/websocket/services/WebSocketClient.ts +5 -5
- package/src/api-notifications/providers/MemorySmsProvider.ts +0 -20
- package/src/api-notifications/providers/SmsProvider.ts +0 -8
- /package/src/core/{descriptors → primitives}/$atom.ts +0 -0
- /package/src/core/{descriptors → primitives}/$env.ts +0 -0
- /package/src/server-auth/{descriptors → primitives}/$authApple.ts +0 -0
- /package/src/server-links/{descriptors → primitives}/$client.ts +0 -0
package/dist/core/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { ReadableStream as ReadableStream$1 } from "node:stream/web";
|
|
|
10
10
|
|
|
11
11
|
//#region src/core/constants/KIND.d.ts
|
|
12
12
|
/**
|
|
13
|
-
* Used for identifying
|
|
13
|
+
* Used for identifying primitives.
|
|
14
14
|
*
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
@@ -72,41 +72,65 @@ interface ServiceSubstitution<T extends object = any> {
|
|
|
72
72
|
type ServiceEntry<T extends object = any> = Service<T> | ServiceSubstitution<T>;
|
|
73
73
|
declare function isClass(func: any): func is InstantiableClass;
|
|
74
74
|
//#endregion
|
|
75
|
-
//#region src/core/helpers/
|
|
76
|
-
interface
|
|
75
|
+
//#region src/core/helpers/primitive.d.ts
|
|
76
|
+
interface PrimitiveArgs<T extends object = {}> {
|
|
77
77
|
options: T;
|
|
78
78
|
alepha: Alepha;
|
|
79
79
|
service: InstantiableClass<Service>;
|
|
80
80
|
module?: Service;
|
|
81
81
|
}
|
|
82
|
-
interface
|
|
82
|
+
interface PrimitiveConfig {
|
|
83
83
|
propertyKey: string;
|
|
84
84
|
service: InstantiableClass<Service>;
|
|
85
85
|
module?: Service;
|
|
86
86
|
}
|
|
87
|
-
declare abstract class
|
|
87
|
+
declare abstract class Primitive<T extends object = {}> {
|
|
88
88
|
protected readonly alepha: Alepha;
|
|
89
89
|
readonly options: T;
|
|
90
|
-
readonly config:
|
|
91
|
-
constructor(args:
|
|
90
|
+
readonly config: PrimitiveConfig;
|
|
91
|
+
constructor(args: PrimitiveArgs<T>);
|
|
92
92
|
/**
|
|
93
|
-
* Called automatically by Alepha after the
|
|
93
|
+
* Called automatically by Alepha after the primitive is created.
|
|
94
94
|
*/
|
|
95
95
|
protected onInit(): void;
|
|
96
96
|
}
|
|
97
|
-
type
|
|
98
|
-
(options:
|
|
99
|
-
[KIND]: InstantiableClass<
|
|
97
|
+
type PrimitiveFactory<TPrimitive extends Primitive = Primitive> = {
|
|
98
|
+
(options: TPrimitive["options"]): TPrimitive;
|
|
99
|
+
[KIND]: InstantiableClass<TPrimitive>;
|
|
100
100
|
};
|
|
101
|
-
type
|
|
101
|
+
type PrimitiveFactoryLike<T extends object = any> = {
|
|
102
102
|
(options: T): any;
|
|
103
103
|
[KIND]: any;
|
|
104
104
|
};
|
|
105
|
-
declare const
|
|
105
|
+
declare const createPrimitive: <TPrimitive extends Primitive>(primitive: InstantiableClass<TPrimitive> & {
|
|
106
106
|
[MODULE]?: Service;
|
|
107
|
-
}, options:
|
|
107
|
+
}, options: TPrimitive["options"]) => TPrimitive;
|
|
108
108
|
//#endregion
|
|
109
|
-
//#region src/core/
|
|
109
|
+
//#region src/core/interfaces/Async.d.ts
|
|
110
|
+
/**
|
|
111
|
+
* Represents a value that can be either a value or a promise of value.
|
|
112
|
+
*/
|
|
113
|
+
type Async<T> = T | Promise<T>;
|
|
114
|
+
/**
|
|
115
|
+
* Represents a function that returns an async value.
|
|
116
|
+
*/
|
|
117
|
+
type AsyncFn = (...args: any[]) => Async<any>;
|
|
118
|
+
/**
|
|
119
|
+
* Transforms a type T into a promise if it is not already a promise.
|
|
120
|
+
*/
|
|
121
|
+
type MaybePromise<T> = T extends Promise<any> ? T : Promise<T>;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/core/interfaces/LoggerInterface.d.ts
|
|
124
|
+
type LogLevel = "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE" | "SILENT";
|
|
125
|
+
interface LoggerInterface {
|
|
126
|
+
trace(message: string, data?: unknown): void;
|
|
127
|
+
debug(message: string, data?: unknown): void;
|
|
128
|
+
info(message: string, data?: unknown): void;
|
|
129
|
+
warn(message: string, data?: unknown): void;
|
|
130
|
+
error(message: string, data?: unknown): void;
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/core/primitives/$inject.d.ts
|
|
110
134
|
/**
|
|
111
135
|
* Get the instance of the specified type from the context.
|
|
112
136
|
*
|
|
@@ -118,7 +142,7 @@ declare const createDescriptor: <TDescriptor extends Descriptor>(descriptor: Ins
|
|
|
118
142
|
* ```
|
|
119
143
|
*/
|
|
120
144
|
declare const $inject: <T extends object>(type: Service<T>, opts?: InjectOptions<T>) => T;
|
|
121
|
-
declare class
|
|
145
|
+
declare class InjectPrimitive extends Primitive {}
|
|
122
146
|
interface InjectOptions<T extends object = any> {
|
|
123
147
|
/**
|
|
124
148
|
* - 'transient' → Always a new instance on every inject. Zero caching.
|
|
@@ -143,9 +167,9 @@ interface InjectOptions<T extends object = any> {
|
|
|
143
167
|
parent?: Service | null;
|
|
144
168
|
}
|
|
145
169
|
//#endregion
|
|
146
|
-
//#region src/core/
|
|
170
|
+
//#region src/core/primitives/$module.d.ts
|
|
147
171
|
/**
|
|
148
|
-
* Wrap Services and
|
|
172
|
+
* Wrap Services and Primitives into a Module.
|
|
149
173
|
*
|
|
150
174
|
* - A module is just a Service with some extra {@link Module}.
|
|
151
175
|
* - You must attach a `name` to it.
|
|
@@ -192,8 +216,8 @@ interface InjectOptions<T extends object = any> {
|
|
|
192
216
|
* If we speak with number of `$actions`, a module should be used when you have more than 30 actions in a single module.
|
|
193
217
|
* Meaning that if you have 100 actions, you should have at least 3 modules.
|
|
194
218
|
*/
|
|
195
|
-
declare const $module: <T extends object = {}>(options:
|
|
196
|
-
interface
|
|
219
|
+
declare const $module: <T extends object = {}>(options: ModulePrimitiveOptions) => Service<Module>;
|
|
220
|
+
interface ModulePrimitiveOptions {
|
|
197
221
|
/**
|
|
198
222
|
* Name of the module.
|
|
199
223
|
*
|
|
@@ -208,9 +232,9 @@ interface ModuleDescriptorOptions {
|
|
|
208
232
|
*/
|
|
209
233
|
services?: Array<Service>;
|
|
210
234
|
/**
|
|
211
|
-
* List of $
|
|
235
|
+
* List of $primitives to register in the module.
|
|
212
236
|
*/
|
|
213
|
-
|
|
237
|
+
primitives?: Array<PrimitiveFactoryLike>;
|
|
214
238
|
/**
|
|
215
239
|
* By default, module will register ALL services.
|
|
216
240
|
* You can override this behavior by providing a register function.
|
|
@@ -224,7 +248,7 @@ interface ModuleDescriptorOptions {
|
|
|
224
248
|
* Base class for all modules.
|
|
225
249
|
*/
|
|
226
250
|
declare abstract class Module {
|
|
227
|
-
abstract readonly options:
|
|
251
|
+
abstract readonly options: ModulePrimitiveOptions;
|
|
228
252
|
abstract register(alepha: Alepha): void;
|
|
229
253
|
static NAME_REGEX: RegExp;
|
|
230
254
|
/**
|
|
@@ -245,30 +269,6 @@ type WithModule<T extends object = any> = T & {
|
|
|
245
269
|
[MODULE]?: Service;
|
|
246
270
|
};
|
|
247
271
|
//#endregion
|
|
248
|
-
//#region src/core/interfaces/Async.d.ts
|
|
249
|
-
/**
|
|
250
|
-
* Represents a value that can be either a value or a promise of value.
|
|
251
|
-
*/
|
|
252
|
-
type Async<T> = T | Promise<T>;
|
|
253
|
-
/**
|
|
254
|
-
* Represents a function that returns an async value.
|
|
255
|
-
*/
|
|
256
|
-
type AsyncFn = (...args: any[]) => Async<any>;
|
|
257
|
-
/**
|
|
258
|
-
* Transforms a type T into a promise if it is not already a promise.
|
|
259
|
-
*/
|
|
260
|
-
type MaybePromise<T> = T extends Promise<any> ? T : Promise<T>;
|
|
261
|
-
//#endregion
|
|
262
|
-
//#region src/core/interfaces/LoggerInterface.d.ts
|
|
263
|
-
type LogLevel = "ERROR" | "WARN" | "INFO" | "DEBUG" | "TRACE" | "SILENT";
|
|
264
|
-
interface LoggerInterface {
|
|
265
|
-
trace(message: string, data?: unknown): void;
|
|
266
|
-
debug(message: string, data?: unknown): void;
|
|
267
|
-
info(message: string, data?: unknown): void;
|
|
268
|
-
warn(message: string, data?: unknown): void;
|
|
269
|
-
error(message: string, data?: unknown): void;
|
|
270
|
-
}
|
|
271
|
-
//#endregion
|
|
272
272
|
//#region src/core/providers/AlsProvider.d.ts
|
|
273
273
|
type AsyncLocalStorageData = any;
|
|
274
274
|
declare class AlsProvider {
|
|
@@ -844,7 +844,7 @@ declare class EventManager {
|
|
|
844
844
|
}): Promise<void>;
|
|
845
845
|
}
|
|
846
846
|
//#endregion
|
|
847
|
-
//#region src/core/
|
|
847
|
+
//#region src/core/primitives/$atom.d.ts
|
|
848
848
|
/**
|
|
849
849
|
* Define an atom for state management.
|
|
850
850
|
*
|
|
@@ -1010,7 +1010,7 @@ type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends A
|
|
|
1010
1010
|
* // You can access the environment variables using alepha.env
|
|
1011
1011
|
* console.log(alepha.env.MY_VAR); // "value"
|
|
1012
1012
|
*
|
|
1013
|
-
* // But you should use $env()
|
|
1013
|
+
* // But you should use $env() primitive to get typed values from the environment.
|
|
1014
1014
|
* class App {
|
|
1015
1015
|
* env = $env(
|
|
1016
1016
|
* t.object({
|
|
@@ -1023,7 +1023,7 @@ type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends A
|
|
|
1023
1023
|
* ### Modules
|
|
1024
1024
|
*
|
|
1025
1025
|
* Modules are a way to group services together.
|
|
1026
|
-
* You can register a module using the `$module`
|
|
1026
|
+
* You can register a module using the `$module` primitive.
|
|
1027
1027
|
*
|
|
1028
1028
|
* ```ts
|
|
1029
1029
|
* import { $module } from "alepha";
|
|
@@ -1041,7 +1041,7 @@ type OnlyArray<T extends object> = { [K in keyof T]: NonNullable<T[K]> extends A
|
|
|
1041
1041
|
* ### Hooks
|
|
1042
1042
|
*
|
|
1043
1043
|
* Hooks are a way to run async functions from all registered providers/services.
|
|
1044
|
-
* You can register a hook using the `$hook`
|
|
1044
|
+
* You can register a hook using the `$hook` primitive.
|
|
1045
1045
|
*
|
|
1046
1046
|
* ```ts
|
|
1047
1047
|
* import { $hook } from "alepha";
|
|
@@ -1138,9 +1138,9 @@ declare class Alepha {
|
|
|
1138
1138
|
use: Service;
|
|
1139
1139
|
}>;
|
|
1140
1140
|
/**
|
|
1141
|
-
* Registry of
|
|
1141
|
+
* Registry of primitives.
|
|
1142
1142
|
*/
|
|
1143
|
-
protected
|
|
1143
|
+
protected primitiveRegistry: Map<Service<Primitive<{}>>, Primitive<{}>[]>;
|
|
1144
1144
|
/**
|
|
1145
1145
|
* List of all services + how they are provided.
|
|
1146
1146
|
*/
|
|
@@ -1160,7 +1160,7 @@ declare class Alepha {
|
|
|
1160
1160
|
/**
|
|
1161
1161
|
* State manager to store arbitrary values.
|
|
1162
1162
|
*/
|
|
1163
|
-
get
|
|
1163
|
+
get store(): StateManager<State>;
|
|
1164
1164
|
/**
|
|
1165
1165
|
* Codec manager for encoding and decoding data with different formats.
|
|
1166
1166
|
*
|
|
@@ -1233,7 +1233,7 @@ declare class Alepha {
|
|
|
1233
1233
|
* Starts the App.
|
|
1234
1234
|
*
|
|
1235
1235
|
* - Lock any further changes to the container.
|
|
1236
|
-
* - Run "configure" hook for all services.
|
|
1236
|
+
* - Run "configure" hook for all services. Primitives will be processed.
|
|
1237
1237
|
* - Run "start" hook for all services. Providers will connect/listen/...
|
|
1238
1238
|
* - Run "ready" hook for all services. This is the point where the App is ready to serve requests.
|
|
1239
1239
|
*
|
|
@@ -1338,13 +1338,13 @@ declare class Alepha {
|
|
|
1338
1338
|
}>;
|
|
1339
1339
|
services<T extends object>(base: Service<T>): Array<T>;
|
|
1340
1340
|
/**
|
|
1341
|
-
* Get all
|
|
1341
|
+
* Get all primitives of the specified type.
|
|
1342
1342
|
*/
|
|
1343
|
-
|
|
1344
|
-
[KIND]: InstantiableClass<
|
|
1345
|
-
} | string): Array<
|
|
1343
|
+
primitives<TPrimitive extends Primitive>(factory: {
|
|
1344
|
+
[KIND]: InstantiableClass<TPrimitive>;
|
|
1345
|
+
} | string): Array<TPrimitive>;
|
|
1346
1346
|
protected new<T extends object>(service: Service<T>, args?: any[]): T;
|
|
1347
|
-
protected
|
|
1347
|
+
protected processPrimitive(value: Primitive, propertyKey?: string): void;
|
|
1348
1348
|
}
|
|
1349
1349
|
interface Hook<T extends keyof Hooks = any> {
|
|
1350
1350
|
caller?: Service;
|
|
@@ -1500,182 +1500,12 @@ interface RunOptions {
|
|
|
1500
1500
|
//#endregion
|
|
1501
1501
|
//#region src/core/constants/OPTIONS.d.ts
|
|
1502
1502
|
/**
|
|
1503
|
-
* Used for
|
|
1503
|
+
* Used for primitives options.
|
|
1504
1504
|
*
|
|
1505
1505
|
* @internal
|
|
1506
1506
|
*/
|
|
1507
1507
|
declare const OPTIONS: unique symbol;
|
|
1508
1508
|
//#endregion
|
|
1509
|
-
//#region src/core/descriptors/$context.d.ts
|
|
1510
|
-
/**
|
|
1511
|
-
* Get Alepha instance and current service from the current context.
|
|
1512
|
-
*
|
|
1513
|
-
* It can only be used inside $descriptor functions.
|
|
1514
|
-
*
|
|
1515
|
-
* ```ts
|
|
1516
|
-
* import { $context } from "alepha";
|
|
1517
|
-
*
|
|
1518
|
-
* const $hello = () => {
|
|
1519
|
-
* const { alepha, service, module } = $context();
|
|
1520
|
-
*
|
|
1521
|
-
* // alepha - alepha instance
|
|
1522
|
-
* // service - class which is creating this descriptor, this is NOT the instance but the service definition
|
|
1523
|
-
* // module - module definition, if any
|
|
1524
|
-
*
|
|
1525
|
-
* return {};
|
|
1526
|
-
* }
|
|
1527
|
-
*
|
|
1528
|
-
* class MyService {
|
|
1529
|
-
* hello = $hello();
|
|
1530
|
-
* }
|
|
1531
|
-
*
|
|
1532
|
-
* const alepha = new Alepha().with(MyService);
|
|
1533
|
-
* ```
|
|
1534
|
-
*
|
|
1535
|
-
* @internal
|
|
1536
|
-
*/
|
|
1537
|
-
declare const $context: () => ContextDescriptor;
|
|
1538
|
-
interface ContextDescriptor {
|
|
1539
|
-
/**
|
|
1540
|
-
* Alepha instance.
|
|
1541
|
-
*/
|
|
1542
|
-
alepha: Alepha;
|
|
1543
|
-
/**
|
|
1544
|
-
* Service definition which is creating this descriptor.
|
|
1545
|
-
* This is NOT the instance but the service definition.
|
|
1546
|
-
*/
|
|
1547
|
-
service?: Service;
|
|
1548
|
-
/**
|
|
1549
|
-
* Module definition, if any.
|
|
1550
|
-
*/
|
|
1551
|
-
module?: Service;
|
|
1552
|
-
}
|
|
1553
|
-
//#endregion
|
|
1554
|
-
//#region src/core/descriptors/$env.d.ts
|
|
1555
|
-
/**
|
|
1556
|
-
* Get typed values from environment variables.
|
|
1557
|
-
*
|
|
1558
|
-
* @example
|
|
1559
|
-
* ```ts
|
|
1560
|
-
* const alepha = Alepha.create({
|
|
1561
|
-
* env: {
|
|
1562
|
-
* // Alepha.create() will also use process.env when running on Node.js
|
|
1563
|
-
* HELLO: "world",
|
|
1564
|
-
* }
|
|
1565
|
-
* });
|
|
1566
|
-
*
|
|
1567
|
-
* class App {
|
|
1568
|
-
* log = $logger();
|
|
1569
|
-
*
|
|
1570
|
-
* // program expect a var env "HELLO" as string to works
|
|
1571
|
-
* env = $env(t.object({
|
|
1572
|
-
* HELLO: t.text()
|
|
1573
|
-
* }));
|
|
1574
|
-
*
|
|
1575
|
-
* sayHello = () => this.log.info("Hello ${this.env.HELLO}")
|
|
1576
|
-
* }
|
|
1577
|
-
*
|
|
1578
|
-
* run(alepha.with(App));
|
|
1579
|
-
* ```
|
|
1580
|
-
*/
|
|
1581
|
-
declare const $env: <T extends TObject$1>(type: T) => Static$1<T>;
|
|
1582
|
-
//#endregion
|
|
1583
|
-
//#region src/core/descriptors/$hook.d.ts
|
|
1584
|
-
/**
|
|
1585
|
-
* Registers a new hook.
|
|
1586
|
-
*
|
|
1587
|
-
* ```ts
|
|
1588
|
-
* import { $hook } from "alepha";
|
|
1589
|
-
*
|
|
1590
|
-
* class MyProvider {
|
|
1591
|
-
* onStart = $hook({
|
|
1592
|
-
* name: "start", // or "configure", "ready", "stop", ...
|
|
1593
|
-
* handler: async (app) => {
|
|
1594
|
-
* // await db.connect(); ...
|
|
1595
|
-
* }
|
|
1596
|
-
* });
|
|
1597
|
-
* }
|
|
1598
|
-
* ```
|
|
1599
|
-
*
|
|
1600
|
-
* Hooks are used to run async functions from all registered providers/services.
|
|
1601
|
-
*
|
|
1602
|
-
* You can't register a hook after the App has started.
|
|
1603
|
-
*
|
|
1604
|
-
* It's used under the hood by the `configure`, `start`, and `stop` methods.
|
|
1605
|
-
* Some modules also use hooks to run their own logic. (e.g. `alepha/server`).
|
|
1606
|
-
*
|
|
1607
|
-
* You can create your own hooks by using module augmentation:
|
|
1608
|
-
*
|
|
1609
|
-
* ```ts
|
|
1610
|
-
* declare module "alepha" {
|
|
1611
|
-
*
|
|
1612
|
-
* interface Hooks {
|
|
1613
|
-
* "my:custom:hook": {
|
|
1614
|
-
* arg1: string;
|
|
1615
|
-
* }
|
|
1616
|
-
* }
|
|
1617
|
-
* }
|
|
1618
|
-
*
|
|
1619
|
-
* await alepha.events.emit("my:custom:hook", { arg1: "value" });
|
|
1620
|
-
* ```
|
|
1621
|
-
*
|
|
1622
|
-
*/
|
|
1623
|
-
declare const $hook: {
|
|
1624
|
-
<T extends keyof Hooks>(options: HookOptions<T>): HookDescriptor<T>;
|
|
1625
|
-
[KIND]: typeof HookDescriptor;
|
|
1626
|
-
};
|
|
1627
|
-
interface HookOptions<T extends keyof Hooks> {
|
|
1628
|
-
/**
|
|
1629
|
-
* The name of the hook. "configure", "start", "ready", "stop", ...
|
|
1630
|
-
*/
|
|
1631
|
-
on: T;
|
|
1632
|
-
/**
|
|
1633
|
-
* The handler to run when the hook is triggered.
|
|
1634
|
-
*/
|
|
1635
|
-
handler: (args: Hooks[T]) => Async<any>;
|
|
1636
|
-
/**
|
|
1637
|
-
* Force the hook to run first or last on the list of hooks.
|
|
1638
|
-
*/
|
|
1639
|
-
priority?: "first" | "last";
|
|
1640
|
-
/**
|
|
1641
|
-
* Empty placeholder, not implemented yet. :-)
|
|
1642
|
-
*/
|
|
1643
|
-
before?: object | Array<object>;
|
|
1644
|
-
/**
|
|
1645
|
-
* Empty placeholder, not implemented yet. :-)
|
|
1646
|
-
*/
|
|
1647
|
-
after?: object | Array<object>;
|
|
1648
|
-
}
|
|
1649
|
-
declare class HookDescriptor<T extends keyof Hooks> extends Descriptor<HookOptions<T>> {
|
|
1650
|
-
called: number;
|
|
1651
|
-
protected onInit(): void;
|
|
1652
|
-
}
|
|
1653
|
-
//#endregion
|
|
1654
|
-
//#region src/core/descriptors/$use.d.ts
|
|
1655
|
-
/**
|
|
1656
|
-
* Subscribes to an atom's state and returns its current value for use in components.
|
|
1657
|
-
*
|
|
1658
|
-
* Creates a reactive connection between an atom and a component, automatically registering
|
|
1659
|
-
* the atom in the application state if not already registered. The returned value is reactive
|
|
1660
|
-
* and will update when the atom's state changes.
|
|
1661
|
-
*
|
|
1662
|
-
* **Use Cases**: Accessing global state, sharing data between components, reactive UI updates
|
|
1663
|
-
*
|
|
1664
|
-
* @example
|
|
1665
|
-
* ```ts
|
|
1666
|
-
* const userState = $atom({ schema: t.object({ name: t.text(), role: t.text() }) });
|
|
1667
|
-
*
|
|
1668
|
-
* class UserComponent {
|
|
1669
|
-
* user = $use(userState); // Reactive reference to atom state
|
|
1670
|
-
*
|
|
1671
|
-
* render() {
|
|
1672
|
-
* return <div>Hello {this.user.name}!</div>;
|
|
1673
|
-
* }
|
|
1674
|
-
* }
|
|
1675
|
-
* ```
|
|
1676
|
-
*/
|
|
1677
|
-
declare const $use: <T extends TObject, N extends string>(atom: Atom<T, N>) => Readonly<Static<T>>;
|
|
1678
|
-
//#endregion
|
|
1679
1509
|
//#region src/core/errors/AppNotStartedError.d.ts
|
|
1680
1510
|
declare class AppNotStartedError extends AlephaError {
|
|
1681
1511
|
readonly name = "AppNotStartedError";
|
|
@@ -1898,6 +1728,176 @@ interface SortField {
|
|
|
1898
1728
|
direction: SortDirection;
|
|
1899
1729
|
}
|
|
1900
1730
|
//#endregion
|
|
1731
|
+
//#region src/core/primitives/$context.d.ts
|
|
1732
|
+
/**
|
|
1733
|
+
* Get Alepha instance and current service from the current context.
|
|
1734
|
+
*
|
|
1735
|
+
* It can only be used inside $primitive functions.
|
|
1736
|
+
*
|
|
1737
|
+
* ```ts
|
|
1738
|
+
* import { $context } from "alepha";
|
|
1739
|
+
*
|
|
1740
|
+
* const $hello = () => {
|
|
1741
|
+
* const { alepha, service, module } = $context();
|
|
1742
|
+
*
|
|
1743
|
+
* // alepha - alepha instance
|
|
1744
|
+
* // service - class which is creating this primitive, this is NOT the instance but the service definition
|
|
1745
|
+
* // module - module definition, if any
|
|
1746
|
+
*
|
|
1747
|
+
* return {};
|
|
1748
|
+
* }
|
|
1749
|
+
*
|
|
1750
|
+
* class MyService {
|
|
1751
|
+
* hello = $hello();
|
|
1752
|
+
* }
|
|
1753
|
+
*
|
|
1754
|
+
* const alepha = new Alepha().with(MyService);
|
|
1755
|
+
* ```
|
|
1756
|
+
*
|
|
1757
|
+
* @internal
|
|
1758
|
+
*/
|
|
1759
|
+
declare const $context: () => ContextPrimitive;
|
|
1760
|
+
interface ContextPrimitive {
|
|
1761
|
+
/**
|
|
1762
|
+
* Alepha instance.
|
|
1763
|
+
*/
|
|
1764
|
+
alepha: Alepha;
|
|
1765
|
+
/**
|
|
1766
|
+
* Service definition which is creating this primitive.
|
|
1767
|
+
* This is NOT the instance but the service definition.
|
|
1768
|
+
*/
|
|
1769
|
+
service?: Service;
|
|
1770
|
+
/**
|
|
1771
|
+
* Module definition, if any.
|
|
1772
|
+
*/
|
|
1773
|
+
module?: Service;
|
|
1774
|
+
}
|
|
1775
|
+
//#endregion
|
|
1776
|
+
//#region src/core/primitives/$env.d.ts
|
|
1777
|
+
/**
|
|
1778
|
+
* Get typed values from environment variables.
|
|
1779
|
+
*
|
|
1780
|
+
* @example
|
|
1781
|
+
* ```ts
|
|
1782
|
+
* const alepha = Alepha.create({
|
|
1783
|
+
* env: {
|
|
1784
|
+
* // Alepha.create() will also use process.env when running on Node.js
|
|
1785
|
+
* HELLO: "world",
|
|
1786
|
+
* }
|
|
1787
|
+
* });
|
|
1788
|
+
*
|
|
1789
|
+
* class App {
|
|
1790
|
+
* log = $logger();
|
|
1791
|
+
*
|
|
1792
|
+
* // program expect a var env "HELLO" as string to works
|
|
1793
|
+
* env = $env(t.object({
|
|
1794
|
+
* HELLO: t.text()
|
|
1795
|
+
* }));
|
|
1796
|
+
*
|
|
1797
|
+
* sayHello = () => this.log.info("Hello ${this.env.HELLO}")
|
|
1798
|
+
* }
|
|
1799
|
+
*
|
|
1800
|
+
* run(alepha.with(App));
|
|
1801
|
+
* ```
|
|
1802
|
+
*/
|
|
1803
|
+
declare const $env: <T extends TObject$1>(type: T) => Static$1<T>;
|
|
1804
|
+
//#endregion
|
|
1805
|
+
//#region src/core/primitives/$hook.d.ts
|
|
1806
|
+
/**
|
|
1807
|
+
* Registers a new hook.
|
|
1808
|
+
*
|
|
1809
|
+
* ```ts
|
|
1810
|
+
* import { $hook } from "alepha";
|
|
1811
|
+
*
|
|
1812
|
+
* class MyProvider {
|
|
1813
|
+
* onStart = $hook({
|
|
1814
|
+
* name: "start", // or "configure", "ready", "stop", ...
|
|
1815
|
+
* handler: async (app) => {
|
|
1816
|
+
* // await db.connect(); ...
|
|
1817
|
+
* }
|
|
1818
|
+
* });
|
|
1819
|
+
* }
|
|
1820
|
+
* ```
|
|
1821
|
+
*
|
|
1822
|
+
* Hooks are used to run async functions from all registered providers/services.
|
|
1823
|
+
*
|
|
1824
|
+
* You can't register a hook after the App has started.
|
|
1825
|
+
*
|
|
1826
|
+
* It's used under the hood by the `configure`, `start`, and `stop` methods.
|
|
1827
|
+
* Some modules also use hooks to run their own logic. (e.g. `alepha/server`).
|
|
1828
|
+
*
|
|
1829
|
+
* You can create your own hooks by using module augmentation:
|
|
1830
|
+
*
|
|
1831
|
+
* ```ts
|
|
1832
|
+
* declare module "alepha" {
|
|
1833
|
+
*
|
|
1834
|
+
* interface Hooks {
|
|
1835
|
+
* "my:custom:hook": {
|
|
1836
|
+
* arg1: string;
|
|
1837
|
+
* }
|
|
1838
|
+
* }
|
|
1839
|
+
* }
|
|
1840
|
+
*
|
|
1841
|
+
* await alepha.events.emit("my:custom:hook", { arg1: "value" });
|
|
1842
|
+
* ```
|
|
1843
|
+
*
|
|
1844
|
+
*/
|
|
1845
|
+
declare const $hook: {
|
|
1846
|
+
<T extends keyof Hooks>(options: HookOptions<T>): HookPrimitive<T>;
|
|
1847
|
+
[KIND]: typeof HookPrimitive;
|
|
1848
|
+
};
|
|
1849
|
+
interface HookOptions<T extends keyof Hooks> {
|
|
1850
|
+
/**
|
|
1851
|
+
* The name of the hook. "configure", "start", "ready", "stop", ...
|
|
1852
|
+
*/
|
|
1853
|
+
on: T;
|
|
1854
|
+
/**
|
|
1855
|
+
* The handler to run when the hook is triggered.
|
|
1856
|
+
*/
|
|
1857
|
+
handler: (args: Hooks[T]) => Async<any>;
|
|
1858
|
+
/**
|
|
1859
|
+
* Force the hook to run first or last on the list of hooks.
|
|
1860
|
+
*/
|
|
1861
|
+
priority?: "first" | "last";
|
|
1862
|
+
/**
|
|
1863
|
+
* Empty placeholder, not implemented yet. :-)
|
|
1864
|
+
*/
|
|
1865
|
+
before?: object | Array<object>;
|
|
1866
|
+
/**
|
|
1867
|
+
* Empty placeholder, not implemented yet. :-)
|
|
1868
|
+
*/
|
|
1869
|
+
after?: object | Array<object>;
|
|
1870
|
+
}
|
|
1871
|
+
declare class HookPrimitive<T extends keyof Hooks> extends Primitive<HookOptions<T>> {
|
|
1872
|
+
called: number;
|
|
1873
|
+
protected onInit(): void;
|
|
1874
|
+
}
|
|
1875
|
+
//#endregion
|
|
1876
|
+
//#region src/core/primitives/$use.d.ts
|
|
1877
|
+
/**
|
|
1878
|
+
* Subscribes to an atom's state and returns its current value for use in components.
|
|
1879
|
+
*
|
|
1880
|
+
* Creates a reactive connection between an atom and a component, automatically registering
|
|
1881
|
+
* the atom in the application state if not already registered. The returned value is reactive
|
|
1882
|
+
* and will update when the atom's state changes.
|
|
1883
|
+
*
|
|
1884
|
+
* **Use Cases**: Accessing global state, sharing data between components, reactive UI updates
|
|
1885
|
+
*
|
|
1886
|
+
* @example
|
|
1887
|
+
* ```ts
|
|
1888
|
+
* const userState = $atom({ schema: t.object({ name: t.text(), role: t.text() }) });
|
|
1889
|
+
*
|
|
1890
|
+
* class UserComponent {
|
|
1891
|
+
* user = $use(userState); // Reactive reference to atom state
|
|
1892
|
+
*
|
|
1893
|
+
* render() {
|
|
1894
|
+
* return <div>Hello {this.user.name}!</div>;
|
|
1895
|
+
* }
|
|
1896
|
+
* }
|
|
1897
|
+
* ```
|
|
1898
|
+
*/
|
|
1899
|
+
declare const $use: <T extends TObject, N extends string>(atom: Atom<T, N>) => Readonly<Static<T>>;
|
|
1900
|
+
//#endregion
|
|
1901
1901
|
//#region src/core/schemas/pageQuerySchema.d.ts
|
|
1902
1902
|
declare const pageQuerySchema: TObject<{
|
|
1903
1903
|
page: TOptional<TInteger>;
|
|
@@ -1923,5 +1923,5 @@ type PageQuery = Static<typeof pageQuerySchema>;
|
|
|
1923
1923
|
*/
|
|
1924
1924
|
declare const run: (entry: Alepha | Service | Array<Service>, opts?: RunOptions) => Alepha;
|
|
1925
1925
|
//#endregion
|
|
1926
|
-
export { $atom, $context, $env, $hook, $inject, $module, $use, AbstractClass, Alepha, AlephaError, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, Atom, AtomOptions, AtomStatic, AtomWithValue, CircularDependencyError, CodecManager, ContainerLockedError,
|
|
1926
|
+
export { $atom, $context, $env, $hook, $inject, $module, $use, AbstractClass, Alepha, AlephaError, AlsProvider, AppNotStartedError, Async, AsyncFn, AsyncLocalStorageData, Atom, AtomOptions, AtomStatic, AtomWithValue, CircularDependencyError, CodecManager, ContainerLockedError, ContextPrimitive, DecodeOptions, EncodeOptions, EncodeResult, Encoding, Env, EventManager, FileLike, Hook, HookOptions, HookPrimitive, Hooks, InjectOptions, InjectPrimitive, InstantiableClass, JsonSchemaCodec, KIND, LogLevel, LoggerInterface, MaybePromise, Module, ModulePrimitiveOptions, OPTIONS, Page, PageMetadata, PageQuery, PageRequest, Primitive, PrimitiveArgs, PrimitiveConfig, PrimitiveFactory, PrimitiveFactoryLike, RunFunction, SchemaCodec, Service, ServiceEntry, ServiceSubstitution, SortDirection, SortField, State, StateManager, type Static, type StaticDecode, type StaticEncode, StreamLike, type TAny, type TArray, TAtomObject, type TBigInt, type TBoolean, TFile, type TInteger, type TKeysToIndexer, type TNull, type TNumber, type TNumberOptions, type TObject, type TObjectOptions, type TOptional, type TOptionalAdd, TPage, type TPick, type TProperties, type TRecord, type TSchema, TStream, type TString, type TStringOptions, TTextOptions, type TTuple, type TUnion, type TUnsafe, type TVoid, TextLength, TooLateSubstitutionError, TypeBox, TypeBoxError, TypeBoxErrorParams, TypeBoxFormat, TypeBoxValue, TypeGuard, TypeProvider, WithModule, createPagination, createPrimitive, isClass, isDate, isDateTime, isDuration, isEmail, isFileLike, isTime, isTypeFile, isURL, isUUID, pageMetadataSchema, pageQuerySchema, pageSchema, run, t };
|
|
1927
1927
|
//# sourceMappingURL=index.d.ts.map
|