@forklaunch/core 0.3.1 → 0.3.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/lib/services/index.d.mts
CHANGED
@@ -22,9 +22,6 @@ type ConfigValidator<SV extends AnySchemaValidator> = Record<string, Function |
|
|
22
22
|
type ResolvedConfigValidator<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>> = {
|
23
23
|
[M in keyof CV]: CV[M] extends SchemaConstructor<SV> ? Schema<InstanceType<CV[M]>, SV> : CV[M] extends SchemaFunction<SV> ? Schema<ReturnType<CV[M]>, SV> : CV[M] extends Function ? ReturnType<CV[M]> : CV[M] extends Constructor ? InstanceType<CV[M]> : Schema<CV[M], SV>;
|
24
24
|
};
|
25
|
-
type ValidResolvedConfigValidator<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>> = ResolvedConfigValidator<SV, CV> & {
|
26
|
-
validResolvedConfigValidator: void;
|
27
|
-
};
|
28
25
|
type ScopedDependencyFactory<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>, M extends keyof CV> = (scope?: ConfigInjector<SV, CV>) => ResolvedConfigValidator<SV, CV>[M];
|
29
26
|
|
30
27
|
declare class ConfigInjector<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>> {
|
@@ -39,12 +36,15 @@ declare class ConfigInjector<SV extends AnySchemaValidator, CV extends ConfigVal
|
|
39
36
|
constructor(schemaValidator: SV, configShapes: CV, dependenciesDefinition: {
|
40
37
|
[K in keyof CV]: Singleton<ResolvedConfigValidator<SV, CV>[K]> | Constructed<Omit<ResolvedConfigValidator<SV, CV>, K>, ResolvedConfigValidator<SV, CV>[K]>;
|
41
38
|
});
|
42
|
-
validateConfigSingletons(): ParseResult<
|
39
|
+
validateConfigSingletons(): ParseResult<ValidConfigInjector<SV, CV>>;
|
43
40
|
resolve<T extends keyof CV>(token: T, context?: Record<string, unknown>, resolutionPath?: (keyof CV)[]): ResolvedConfigValidator<SV, CV>[T];
|
44
41
|
scopedResolver<T extends keyof CV>(token: T, context?: Record<string, unknown>, resolutionPath?: (keyof CV)[]): (scope?: ConfigInjector<SV, CV>) => ResolvedConfigValidator<SV, CV>[T];
|
45
42
|
createScope(): ConfigInjector<SV, CV>;
|
46
43
|
dispose(): void;
|
47
44
|
}
|
45
|
+
declare class ValidConfigInjector<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>> extends ConfigInjector<SV, CV> {
|
46
|
+
validConfigInjector: void;
|
47
|
+
}
|
48
48
|
|
49
49
|
declare function getEnvVar(name: string): string;
|
50
50
|
|
@@ -66,4 +66,4 @@ type EntityManager = {
|
|
66
66
|
fork: <Options>(options?: Options) => EntityManager;
|
67
67
|
};
|
68
68
|
|
69
|
-
export { type BaseService, ConfigInjector, type ConfigValidator, type Constructed, type Constructor, type EntityManager, type Function, Lifetime, type ResolvedConfigValidator, type SchemaConstructor, type SchemaFunction, type ScopedDependencyFactory, type Singleton,
|
69
|
+
export { type BaseService, ConfigInjector, type ConfigValidator, type Constructed, type Constructor, type EntityManager, type Function, Lifetime, type ResolvedConfigValidator, type SchemaConstructor, type SchemaFunction, type ScopedDependencyFactory, type Singleton, ValidConfigInjector, getEnvVar };
|
package/lib/services/index.d.ts
CHANGED
@@ -22,9 +22,6 @@ type ConfigValidator<SV extends AnySchemaValidator> = Record<string, Function |
|
|
22
22
|
type ResolvedConfigValidator<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>> = {
|
23
23
|
[M in keyof CV]: CV[M] extends SchemaConstructor<SV> ? Schema<InstanceType<CV[M]>, SV> : CV[M] extends SchemaFunction<SV> ? Schema<ReturnType<CV[M]>, SV> : CV[M] extends Function ? ReturnType<CV[M]> : CV[M] extends Constructor ? InstanceType<CV[M]> : Schema<CV[M], SV>;
|
24
24
|
};
|
25
|
-
type ValidResolvedConfigValidator<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>> = ResolvedConfigValidator<SV, CV> & {
|
26
|
-
validResolvedConfigValidator: void;
|
27
|
-
};
|
28
25
|
type ScopedDependencyFactory<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>, M extends keyof CV> = (scope?: ConfigInjector<SV, CV>) => ResolvedConfigValidator<SV, CV>[M];
|
29
26
|
|
30
27
|
declare class ConfigInjector<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>> {
|
@@ -39,12 +36,15 @@ declare class ConfigInjector<SV extends AnySchemaValidator, CV extends ConfigVal
|
|
39
36
|
constructor(schemaValidator: SV, configShapes: CV, dependenciesDefinition: {
|
40
37
|
[K in keyof CV]: Singleton<ResolvedConfigValidator<SV, CV>[K]> | Constructed<Omit<ResolvedConfigValidator<SV, CV>, K>, ResolvedConfigValidator<SV, CV>[K]>;
|
41
38
|
});
|
42
|
-
validateConfigSingletons(): ParseResult<
|
39
|
+
validateConfigSingletons(): ParseResult<ValidConfigInjector<SV, CV>>;
|
43
40
|
resolve<T extends keyof CV>(token: T, context?: Record<string, unknown>, resolutionPath?: (keyof CV)[]): ResolvedConfigValidator<SV, CV>[T];
|
44
41
|
scopedResolver<T extends keyof CV>(token: T, context?: Record<string, unknown>, resolutionPath?: (keyof CV)[]): (scope?: ConfigInjector<SV, CV>) => ResolvedConfigValidator<SV, CV>[T];
|
45
42
|
createScope(): ConfigInjector<SV, CV>;
|
46
43
|
dispose(): void;
|
47
44
|
}
|
45
|
+
declare class ValidConfigInjector<SV extends AnySchemaValidator, CV extends ConfigValidator<SV>> extends ConfigInjector<SV, CV> {
|
46
|
+
validConfigInjector: void;
|
47
|
+
}
|
48
48
|
|
49
49
|
declare function getEnvVar(name: string): string;
|
50
50
|
|
@@ -66,4 +66,4 @@ type EntityManager = {
|
|
66
66
|
fork: <Options>(options?: Options) => EntityManager;
|
67
67
|
};
|
68
68
|
|
69
|
-
export { type BaseService, ConfigInjector, type ConfigValidator, type Constructed, type Constructor, type EntityManager, type Function, Lifetime, type ResolvedConfigValidator, type SchemaConstructor, type SchemaFunction, type ScopedDependencyFactory, type Singleton,
|
69
|
+
export { type BaseService, ConfigInjector, type ConfigValidator, type Constructed, type Constructor, type EntityManager, type Function, Lifetime, type ResolvedConfigValidator, type SchemaConstructor, type SchemaFunction, type ScopedDependencyFactory, type Singleton, ValidConfigInjector, getEnvVar };
|
package/lib/services/index.js
CHANGED
@@ -22,6 +22,7 @@ var services_exports = {};
|
|
22
22
|
__export(services_exports, {
|
23
23
|
ConfigInjector: () => ConfigInjector,
|
24
24
|
Lifetime: () => Lifetime,
|
25
|
+
ValidConfigInjector: () => ValidConfigInjector,
|
25
26
|
getEnvVar: () => getEnvVar
|
26
27
|
});
|
27
28
|
module.exports = __toCommonJS(services_exports);
|
@@ -158,11 +159,11 @@ var ConfigInjector = class _ConfigInjector {
|
|
158
159
|
const configKeys = Object.keys(this.configShapes);
|
159
160
|
return validNonSchemaSingletons.ok && schemaSingletonParseResult.ok ? {
|
160
161
|
ok: true,
|
161
|
-
value:
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
162
|
+
value: new ValidConfigInjector(
|
163
|
+
this.schemaValidator,
|
164
|
+
this.configShapes,
|
165
|
+
this.dependenciesDefinition
|
166
|
+
)
|
166
167
|
} : {
|
167
168
|
ok: false,
|
168
169
|
errors: [
|
@@ -230,6 +231,9 @@ var ConfigInjector = class _ConfigInjector {
|
|
230
231
|
this.loadSingletons();
|
231
232
|
}
|
232
233
|
};
|
234
|
+
var ValidConfigInjector = class extends ConfigInjector {
|
235
|
+
validConfigInjector;
|
236
|
+
};
|
233
237
|
|
234
238
|
// src/services/getEnvVar.ts
|
235
239
|
function getEnvVar(name) {
|
@@ -240,5 +244,6 @@ function getEnvVar(name) {
|
|
240
244
|
0 && (module.exports = {
|
241
245
|
ConfigInjector,
|
242
246
|
Lifetime,
|
247
|
+
ValidConfigInjector,
|
243
248
|
getEnvVar
|
244
249
|
});
|
package/lib/services/index.mjs
CHANGED
@@ -130,11 +130,11 @@ var ConfigInjector = class _ConfigInjector {
|
|
130
130
|
const configKeys = Object.keys(this.configShapes);
|
131
131
|
return validNonSchemaSingletons.ok && schemaSingletonParseResult.ok ? {
|
132
132
|
ok: true,
|
133
|
-
value:
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
133
|
+
value: new ValidConfigInjector(
|
134
|
+
this.schemaValidator,
|
135
|
+
this.configShapes,
|
136
|
+
this.dependenciesDefinition
|
137
|
+
)
|
138
138
|
} : {
|
139
139
|
ok: false,
|
140
140
|
errors: [
|
@@ -202,6 +202,9 @@ var ConfigInjector = class _ConfigInjector {
|
|
202
202
|
this.loadSingletons();
|
203
203
|
}
|
204
204
|
};
|
205
|
+
var ValidConfigInjector = class extends ConfigInjector {
|
206
|
+
validConfigInjector;
|
207
|
+
};
|
205
208
|
|
206
209
|
// src/services/getEnvVar.ts
|
207
210
|
function getEnvVar(name) {
|
@@ -211,5 +214,6 @@ function getEnvVar(name) {
|
|
211
214
|
export {
|
212
215
|
ConfigInjector,
|
213
216
|
Lifetime,
|
217
|
+
ValidConfigInjector,
|
214
218
|
getEnvVar
|
215
219
|
};
|