@effected/config-file 0.16.0 → 0.18.0
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/ConfigCodec.js +1 -2
- package/ConfigEvent.js +1 -2
- package/ConfigFile.js +1 -2
- package/ConfigMigration.js +1 -2
- package/ConfigProvider.js +1 -2
- package/ConfigResolver.js +1 -2
- package/EncryptedCodec.js +1 -2
- package/JsonCodec.js +1 -2
- package/JsoncCodec.js +1 -2
- package/MergeStrategy.js +1 -2
- package/TomlCodec.js +1 -2
- package/YamlCodec.js +1 -2
- package/index.d.ts +0 -24
- package/internal/crypto.js +1 -2
- package/internal/deepMerge.js +1 -2
- package/package.json +6 -6
package/ConfigCodec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ConfigCodec.ts
|
|
4
4
|
/**
|
|
5
5
|
* Indicates that a codec failed to parse or stringify configuration content.
|
|
6
6
|
*
|
|
@@ -43,5 +43,4 @@ var ConfigCodecError = class extends Schema.TaggedError()("ConfigCodecError", {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
//#endregion
|
|
47
46
|
export { ConfigCodecError };
|
package/ConfigEvent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Effect, Layer, PubSub, Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ConfigEvent.ts
|
|
4
4
|
/**
|
|
5
5
|
* A reference to one configuration source that contributed to a load.
|
|
6
6
|
*
|
|
@@ -114,5 +114,4 @@ var ConfigEvents = class ConfigEvents extends Context.Service()("@effected/confi
|
|
|
114
114
|
}));
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
//#endregion
|
|
118
117
|
export { ConfigEvent, ConfigEventPayload, ConfigEvents, ConfigSourceRef };
|
package/ConfigFile.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ConfigEvent } from "./ConfigEvent.js";
|
|
|
3
3
|
import { ConfigResolver } from "./ConfigResolver.js";
|
|
4
4
|
import { Context, DateTime, Effect, FileSystem, Layer, Option, Path, PubSub, Schema, Semaphore } from "effect";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// src/ConfigFile.ts
|
|
7
7
|
/**
|
|
8
8
|
* Indicates that the resolver chain produced no configuration source.
|
|
9
9
|
*
|
|
@@ -565,5 +565,4 @@ var ConfigFile = class {
|
|
|
565
565
|
static read = read;
|
|
566
566
|
};
|
|
567
567
|
|
|
568
|
-
//#endregion
|
|
569
568
|
export { ConfigDefaultPathMissingError, ConfigFile, ConfigFileNotFoundError, ConfigFileReadError, ConfigFileWriteError, ConfigValidationError };
|
package/ConfigMigration.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ConfigMigration.ts
|
|
4
4
|
/**
|
|
5
5
|
* Indicates that a versioned config migration failed.
|
|
6
6
|
*
|
|
@@ -110,5 +110,4 @@ var ConfigMigration = class {
|
|
|
110
110
|
static make = make;
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
-
//#endregion
|
|
114
113
|
export { ConfigMigration, ConfigMigrationError, VersionAccess };
|
package/ConfigProvider.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigProvider, Effect } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/ConfigProvider.ts
|
|
4
4
|
/**
|
|
5
5
|
* Expose a loaded, merged, schema-validated document as a `ConfigProvider`,
|
|
6
6
|
* so it can be read through `Config.String("port")` and layered beneath other
|
|
@@ -87,5 +87,4 @@ const layerConfigProvider = (tag, options) => {
|
|
|
87
87
|
return ConfigProvider.layerAdd(provider, { asPrimary: options?.asPrimary });
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
//#endregion
|
|
91
90
|
export { asConfigProvider, layerConfigProvider };
|
package/ConfigResolver.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, FileSystem, Option, Path } from "effect";
|
|
2
2
|
import { Walker } from "@effected/walker";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/ConfigResolver.ts
|
|
5
5
|
/**
|
|
6
6
|
* Build a resolver from a probe-reporting lookup, deriving `resolveMatch` and
|
|
7
7
|
* `resolve` from it.
|
|
@@ -185,5 +185,4 @@ var ConfigResolver = class {
|
|
|
185
185
|
static systemEtc = systemEtc;
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
//#endregion
|
|
189
188
|
export { ConfigResolver };
|
package/EncryptedCodec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { decrypt, deriveKey, encrypt, fromBase64, randomIv, toBase64 } from "./internal/crypto.js";
|
|
2
2
|
import { Duration, Effect, Exit, Schema } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/EncryptedCodec.ts
|
|
5
5
|
/**
|
|
6
6
|
* Indicates that an encryption, decryption, key-derivation or base64 step
|
|
7
7
|
* failed.
|
|
@@ -126,5 +126,4 @@ function EncryptedCodec(inner, keySource) {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
//#endregion
|
|
130
129
|
export { ConfigEncryptionError, EncryptedCodec, EncryptedCodecKey };
|
package/JsonCodec.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConfigCodecError } from "./ConfigCodec.js";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/JsonCodec.ts
|
|
5
5
|
/**
|
|
6
6
|
* A `ConfigCodec` backed by the host `JSON` global: plain JSON as
|
|
7
7
|
* configuration file content.
|
|
@@ -34,5 +34,4 @@ const JsonCodec = {
|
|
|
34
34
|
})
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
//#endregion
|
|
38
37
|
export { JsonCodec };
|
package/JsoncCodec.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ConfigCodecError } from "./ConfigCodec.js";
|
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { Jsonc } from "@effected/jsonc";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/JsoncCodec.ts
|
|
6
6
|
/**
|
|
7
7
|
* A `ConfigCodec` backed by `@effected/jsonc`: JSON with comments and
|
|
8
8
|
* trailing commas.
|
|
@@ -34,5 +34,4 @@ const JsoncCodec = {
|
|
|
34
34
|
})
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
//#endregion
|
|
38
37
|
export { JsoncCodec };
|
package/MergeStrategy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { canMerge, deepMerge } from "./internal/deepMerge.js";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
// src/MergeStrategy.ts
|
|
5
5
|
const firstMatch = () => ({
|
|
6
6
|
name: "first-match",
|
|
7
7
|
resolve: (sources) => Effect.succeed(sources[0].value)
|
|
@@ -57,5 +57,4 @@ const MergeStrategy = {
|
|
|
57
57
|
layeredMerge
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
//#endregion
|
|
61
60
|
export { MergeStrategy };
|
package/TomlCodec.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ConfigCodecError } from "./ConfigCodec.js";
|
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { Toml } from "@effected/toml";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/TomlCodec.ts
|
|
6
6
|
/**
|
|
7
7
|
* A `ConfigCodec` backed by `@effected/toml`.
|
|
8
8
|
*
|
|
@@ -35,5 +35,4 @@ const TomlCodec = {
|
|
|
35
35
|
})))
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
//#endregion
|
|
39
38
|
export { TomlCodec };
|
package/YamlCodec.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ConfigCodecError } from "./ConfigCodec.js";
|
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { Yaml } from "@effected/yaml";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// src/YamlCodec.ts
|
|
6
6
|
/**
|
|
7
7
|
* A `ConfigCodec` backed by `@effected/yaml`.
|
|
8
8
|
*
|
|
@@ -30,5 +30,4 @@ const YamlCodec = {
|
|
|
30
30
|
})))
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
//#endregion
|
|
34
33
|
export { YamlCodec };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ConfigProvider, Context, Effect, FileSystem, Layer, Option, Path, PubSub, Schema, SchemaAST } from "effect";
|
|
2
|
-
//#region src/ConfigCodec.d.ts
|
|
3
2
|
declare const ConfigCodecError_base: Schema.Class<ConfigCodecError, Schema.TaggedStruct<"ConfigCodecError", {
|
|
4
3
|
/** The codec that failed, e.g. `"json"`. */
|
|
5
4
|
readonly codec: Schema.String;
|
|
@@ -67,8 +66,6 @@ interface ConfigCodec<E = ConfigCodecError> {
|
|
|
67
66
|
/** Turn a document back into file content. */
|
|
68
67
|
readonly stringify: (value: unknown) => Effect.Effect<string, E>;
|
|
69
68
|
}
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/ConfigEvent.d.ts
|
|
72
69
|
/**
|
|
73
70
|
* A reference to one configuration source that contributed to a load.
|
|
74
71
|
*
|
|
@@ -243,8 +240,6 @@ export declare class ConfigEvents extends ConfigEvents_base {
|
|
|
243
240
|
*/
|
|
244
241
|
static readonly layer: Layer.Layer<ConfigEvents>;
|
|
245
242
|
}
|
|
246
|
-
//#endregion
|
|
247
|
-
//#region src/ConfigResolver.d.ts
|
|
248
243
|
/**
|
|
249
244
|
* A composable config file resolver: one lookup strategy.
|
|
250
245
|
*
|
|
@@ -474,8 +469,6 @@ export declare class ConfigResolver {
|
|
|
474
469
|
readonly dir?: string;
|
|
475
470
|
}) => ConfigResolver<FileSystem.FileSystem | Path.Path>;
|
|
476
471
|
}
|
|
477
|
-
//#endregion
|
|
478
|
-
//#region src/MergeStrategy.d.ts
|
|
479
472
|
/**
|
|
480
473
|
* A single configuration source discovered during a resolver-chain pass.
|
|
481
474
|
*
|
|
@@ -541,8 +534,6 @@ export declare const MergeStrategy: {
|
|
|
541
534
|
readonly firstMatch: <A>() => MergeStrategy<A>;
|
|
542
535
|
readonly layeredMerge: <A>() => MergeStrategy<A>;
|
|
543
536
|
};
|
|
544
|
-
//#endregion
|
|
545
|
-
//#region src/ConfigFile.d.ts
|
|
546
537
|
declare const ConfigFileNotFoundError_base: Schema.Class<ConfigFileNotFoundError, Schema.TaggedStruct<"ConfigFileNotFoundError", {
|
|
547
538
|
/** The names of the resolvers that were probed, in order. */
|
|
548
539
|
readonly searched: Schema.$Array<Schema.String>;
|
|
@@ -1048,8 +1039,6 @@ export declare class ConfigFile {
|
|
|
1048
1039
|
*/
|
|
1049
1040
|
static readonly read: <A, I>(path: string, options: ConfigReadOptions<A, I>) => Effect.Effect<A, ConfigReadError, FileSystem.FileSystem>;
|
|
1050
1041
|
}
|
|
1051
|
-
//#endregion
|
|
1052
|
-
//#region src/ConfigMigration.d.ts
|
|
1053
1042
|
declare const ConfigMigrationError_base: Schema.Class<ConfigMigrationError, Schema.TaggedStruct<"ConfigMigrationError", {
|
|
1054
1043
|
/** The target version of the step that failed. `0` when reading the version failed. */
|
|
1055
1044
|
readonly version: Schema.Number;
|
|
@@ -1143,8 +1132,6 @@ export declare class ConfigMigration {
|
|
|
1143
1132
|
*/
|
|
1144
1133
|
static readonly make: (options: ConfigMigrationOptions) => ConfigCodec<ConfigCodecError | ConfigMigrationError>;
|
|
1145
1134
|
}
|
|
1146
|
-
//#endregion
|
|
1147
|
-
//#region src/ConfigProvider.d.ts
|
|
1148
1135
|
/**
|
|
1149
1136
|
* Expose a loaded, merged, schema-validated document as a `ConfigProvider`,
|
|
1150
1137
|
* so it can be read through `Config.String("port")` and layered beneath other
|
|
@@ -1243,8 +1230,6 @@ interface LayerConfigProviderOptions {
|
|
|
1243
1230
|
* @public
|
|
1244
1231
|
*/
|
|
1245
1232
|
export declare const layerConfigProvider: <Self, A>(tag: Context.Key<Self, ConfigFileShape<A>>, options?: LayerConfigProviderOptions) => Layer.Layer<never, ConfigLoadError, Self>;
|
|
1246
|
-
//#endregion
|
|
1247
|
-
//#region src/EncryptedCodec.d.ts
|
|
1248
1233
|
declare const ConfigEncryptionError_base: Schema.Class<ConfigEncryptionError, Schema.TaggedStruct<"ConfigEncryptionError", {
|
|
1249
1234
|
/** Which cryptographic stage failed. */
|
|
1250
1235
|
readonly phase: Schema.Literals<readonly ["key-derivation", "encrypt", "decrypt", "encoding"]>;
|
|
@@ -1339,8 +1324,6 @@ export declare const EncryptedCodecKey: {
|
|
|
1339
1324
|
* @public
|
|
1340
1325
|
*/
|
|
1341
1326
|
export declare function EncryptedCodec<E>(inner: ConfigCodec<E>, keySource: EncryptedCodecKey): ConfigCodec<E | ConfigEncryptionError>;
|
|
1342
|
-
//#endregion
|
|
1343
|
-
//#region src/JsonCodec.d.ts
|
|
1344
1327
|
/**
|
|
1345
1328
|
* A `ConfigCodec` backed by the host `JSON` global: plain JSON as
|
|
1346
1329
|
* configuration file content.
|
|
@@ -1354,8 +1337,6 @@ export declare function EncryptedCodec<E>(inner: ConfigCodec<E>, keySource: Encr
|
|
|
1354
1337
|
* @public
|
|
1355
1338
|
*/
|
|
1356
1339
|
export declare const JsonCodec: ConfigCodec;
|
|
1357
|
-
//#endregion
|
|
1358
|
-
//#region src/JsoncCodec.d.ts
|
|
1359
1340
|
/**
|
|
1360
1341
|
* A `ConfigCodec` backed by `@effected/jsonc`: JSON with comments and
|
|
1361
1342
|
* trailing commas.
|
|
@@ -1371,8 +1352,6 @@ export declare const JsonCodec: ConfigCodec;
|
|
|
1371
1352
|
* @public
|
|
1372
1353
|
*/
|
|
1373
1354
|
export declare const JsoncCodec: ConfigCodec;
|
|
1374
|
-
//#endregion
|
|
1375
|
-
//#region src/TomlCodec.d.ts
|
|
1376
1355
|
/**
|
|
1377
1356
|
* A `ConfigCodec` backed by `@effected/toml`.
|
|
1378
1357
|
*
|
|
@@ -1392,8 +1371,6 @@ export declare const JsoncCodec: ConfigCodec;
|
|
|
1392
1371
|
* @public
|
|
1393
1372
|
*/
|
|
1394
1373
|
export declare const TomlCodec: ConfigCodec;
|
|
1395
|
-
//#endregion
|
|
1396
|
-
//#region src/YamlCodec.d.ts
|
|
1397
1374
|
/**
|
|
1398
1375
|
* A `ConfigCodec` backed by `@effected/yaml`.
|
|
1399
1376
|
*
|
|
@@ -1408,6 +1385,5 @@ export declare const TomlCodec: ConfigCodec;
|
|
|
1408
1385
|
* @public
|
|
1409
1386
|
*/
|
|
1410
1387
|
export declare const YamlCodec: ConfigCodec;
|
|
1411
|
-
//#endregion
|
|
1412
1388
|
export type { ConfigCodec, ConfigEncodeError, ConfigEncodeOptions, ConfigEventsShape, ConfigFileMigration, ConfigFileOptions, ConfigFileShape, ConfigFileTestOptions, ConfigLoadError, ConfigMatch, ConfigMigrationOptions, ConfigProbe, ConfigReadError, ConfigReadOptions, ConfigSaveError, ConfigSource, ConfigUpdateError, ConfigWriteError, LayerConfigProviderOptions, NonEmptySources, UpwardWalkOptions };
|
|
1413
1389
|
//# sourceMappingURL=index.d.ts.map
|
package/internal/crypto.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// src/internal/crypto.ts
|
|
4
4
|
/**
|
|
5
5
|
* AES-GCM primitives over WebCrypto.
|
|
6
6
|
*
|
|
@@ -111,5 +111,4 @@ const encrypt = (key, iv, plaintext) => Effect.tryPromise({
|
|
|
111
111
|
/** A fresh cryptographically random 12-byte IV. @internal */
|
|
112
112
|
const randomIv = () => globalThis.crypto.getRandomValues(new Uint8Array(/* @__PURE__ */ new ArrayBuffer(12)));
|
|
113
113
|
|
|
114
|
-
//#endregion
|
|
115
114
|
export { decrypt, deriveKey, encrypt, fromBase64, randomIv, toArrayBufferView, toBase64 };
|
package/internal/deepMerge.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/internal/deepMerge.ts
|
|
2
2
|
/**
|
|
3
3
|
* A true plain object: `{}` or `Object.create(null)`. Class instances, `Date`,
|
|
4
4
|
* `Map`, `Set`, `RegExp` and arrays are values, not merge targets.
|
|
@@ -76,5 +76,4 @@ const define = (target, key, value) => {
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
//#endregion
|
|
80
79
|
export { canMerge, deepMerge, isPlainObject };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/config-file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Composable config file loading for Effect: JSON, JSONC, YAML and TOML codecs, resolution strategies, and merge behaviors.",
|
|
6
6
|
"keywords": [
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"./package.json": "./package.json"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@effected/glob": "^0.
|
|
47
|
-
"@effected/jsonc": "^0.
|
|
48
|
-
"@effected/toml": "^0.
|
|
49
|
-
"@effected/walker": "^0.
|
|
50
|
-
"@effected/yaml": "^0.
|
|
46
|
+
"@effected/glob": "^0.14.0",
|
|
47
|
+
"@effected/jsonc": "^0.19.0",
|
|
48
|
+
"@effected/toml": "^0.15.0",
|
|
49
|
+
"@effected/walker": "^0.19.0",
|
|
50
|
+
"@effected/yaml": "^0.23.0",
|
|
51
51
|
"effect": "^4.0.0"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|