@effected/config-file 0.14.0 → 0.14.1
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/ConfigFile.js +11 -0
- package/index.d.ts +13 -2
- package/package.json +1 -1
package/ConfigFile.js
CHANGED
|
@@ -466,6 +466,14 @@ var ConfigFile = class {
|
|
|
466
466
|
* and provide that const — do not call `ConfigFile.layer(...)` inline at each
|
|
467
467
|
* provide site.
|
|
468
468
|
*
|
|
469
|
+
* `tag` is a {@link ConfigFile.Service} key — its service type
|
|
470
|
+
* `ConfigFileShape<A>` for the schema's `A`. A key whose shape adds members
|
|
471
|
+
* (`ConfigFileShape<A> & { … }`) is a compile error, reported as an argument
|
|
472
|
+
* "not assignable to parameter of type 'never'", because this layer could not
|
|
473
|
+
* supply them. The check cannot see through method-syntax parameter
|
|
474
|
+
* bivariance: a member redeclared as a method with a wider parameter still
|
|
475
|
+
* compiles.
|
|
476
|
+
*
|
|
469
477
|
* @example
|
|
470
478
|
* ```ts
|
|
471
479
|
* import { ConfigFile, ConfigResolver, JsonCodec, MergeStrategy } from "@effected/config-file";
|
|
@@ -503,6 +511,9 @@ var ConfigFile = class {
|
|
|
503
511
|
* so cleanup runs on release without surfacing `Scope` in the layer's
|
|
504
512
|
* requirements.
|
|
505
513
|
*
|
|
514
|
+
* `tag` takes the same `ConfigFileShape<A>` key as {@link ConfigFile.layer},
|
|
515
|
+
* with the same check: a shape that adds members is a compile error.
|
|
516
|
+
*
|
|
506
517
|
* @example
|
|
507
518
|
* ```ts
|
|
508
519
|
* const TestConfig = ConfigFile.testLayer(AppConfig, {
|
package/index.d.ts
CHANGED
|
@@ -950,6 +950,14 @@ export declare class ConfigFile {
|
|
|
950
950
|
* and provide that const — do not call `ConfigFile.layer(...)` inline at each
|
|
951
951
|
* provide site.
|
|
952
952
|
*
|
|
953
|
+
* `tag` is a {@link ConfigFile.Service} key — its service type
|
|
954
|
+
* `ConfigFileShape<A>` for the schema's `A`. A key whose shape adds members
|
|
955
|
+
* (`ConfigFileShape<A> & { … }`) is a compile error, reported as an argument
|
|
956
|
+
* "not assignable to parameter of type 'never'", because this layer could not
|
|
957
|
+
* supply them. The check cannot see through method-syntax parameter
|
|
958
|
+
* bivariance: a member redeclared as a method with a wider parameter still
|
|
959
|
+
* compiles.
|
|
960
|
+
*
|
|
953
961
|
* @example
|
|
954
962
|
* ```ts
|
|
955
963
|
* import { ConfigFile, ConfigResolver, JsonCodec, MergeStrategy } from "@effected/config-file";
|
|
@@ -966,7 +974,7 @@ export declare class ConfigFile {
|
|
|
966
974
|
* });
|
|
967
975
|
* ```
|
|
968
976
|
*/
|
|
969
|
-
static readonly layer: <Self, A, I, RR = never>(tag: Context.Key<Self, ConfigFileShape<A
|
|
977
|
+
static readonly layer: <Self, A, I, RR = never, S extends ConfigFileShape<A> = ConfigFileShape<A>>(tag: Context.Key<Self, S> & ([ConfigFileShape<A>] extends [S] ? unknown : never), options: ConfigFileOptions<A, I, RR>) => Layer.Layer<Self, never, FileSystem.FileSystem | Path.Path | RR>;
|
|
970
978
|
/**
|
|
971
979
|
* A scoped layer that seeds `files` into a temp directory, wires the **real**
|
|
972
980
|
* live implementation over them, and removes the directory when the scope
|
|
@@ -987,6 +995,9 @@ export declare class ConfigFile {
|
|
|
987
995
|
* so cleanup runs on release without surfacing `Scope` in the layer's
|
|
988
996
|
* requirements.
|
|
989
997
|
*
|
|
998
|
+
* `tag` takes the same `ConfigFileShape<A>` key as {@link ConfigFile.layer},
|
|
999
|
+
* with the same check: a shape that adds members is a compile error.
|
|
1000
|
+
*
|
|
990
1001
|
* @example
|
|
991
1002
|
* ```ts
|
|
992
1003
|
* const TestConfig = ConfigFile.testLayer(AppConfig, {
|
|
@@ -997,7 +1008,7 @@ export declare class ConfigFile {
|
|
|
997
1008
|
* }).pipe(Layer.provide(NodeServices.layer));
|
|
998
1009
|
* ```
|
|
999
1010
|
*/
|
|
1000
|
-
static readonly testLayer: <Self, A, I>(tag: Context.Key<Self, ConfigFileShape<A
|
|
1011
|
+
static readonly testLayer: <Self, A, I, S extends ConfigFileShape<A> = ConfigFileShape<A>>(tag: Context.Key<Self, S> & ([ConfigFileShape<A>] extends [S] ? unknown : never), options: ConfigFileTestOptions<A, I>) => Layer.Layer<Self, never, FileSystem.FileSystem | Path.Path>;
|
|
1001
1012
|
/**
|
|
1002
1013
|
* Read, decode and validate one explicit path — no service, no layer, no tag.
|
|
1003
1014
|
*
|
package/package.json
CHANGED