@dxos/config 0.8.4-main.ef1bc66f44 → 0.8.4-main.f466a3d56e
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/{chunk-ZI5JXCYY.mjs → chunk-VQRJY4AQ.mjs} +1 -1
- package/dist/lib/browser/{chunk-WETPAQBA.mjs → chunk-ZY4D4E3Q.mjs} +3 -4
- package/dist/lib/browser/chunk-ZY4D4E3Q.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +16 -17
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/loaders/browser.mjs +6 -31
- package/dist/lib/browser/loaders/browser.mjs.map +3 -3
- package/dist/lib/browser/loaders/index.mjs +3 -8
- package/dist/lib/browser/loaders/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/plugin/index.mjs +4 -22
- package/dist/lib/browser/plugin/index.mjs.map +3 -3
- package/dist/lib/browser/savers/browser.mjs +3 -13
- package/dist/lib/browser/savers/browser.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-ODEKAZ4J.mjs → chunk-T6NFH3CC.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-FVCGIRXP.mjs → chunk-WIJROCKQ.mjs} +3 -4
- package/dist/lib/node-esm/chunk-WIJROCKQ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +16 -17
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/loaders/browser.mjs +6 -31
- package/dist/lib/node-esm/loaders/browser.mjs.map +3 -3
- package/dist/lib/node-esm/loaders/index.mjs +3 -8
- package/dist/lib/node-esm/loaders/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/plugin/index.mjs +4 -22
- package/dist/lib/node-esm/plugin/index.mjs.map +3 -3
- package/dist/lib/node-esm/savers/browser.mjs +3 -13
- package/dist/lib/node-esm/savers/browser.mjs.map +3 -3
- package/dist/plugin/node-esm/{chunk-QQKWALKX.mjs → chunk-XCZNYAQT.mjs} +6 -25
- package/dist/plugin/node-esm/chunk-XCZNYAQT.mjs.map +7 -0
- package/dist/plugin/node-esm/esbuild-plugin.mjs +1 -1
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/plugin/node-esm/rollup-plugin.mjs +1 -1
- package/dist/plugin/node-esm/vite-plugin.mjs +1 -1
- package/dist/plugin/node-esm/vite-plugin.mjs.map +2 -2
- package/dist/types/src/config-service.d.ts.map +1 -1
- package/dist/types/src/config.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/loaders/browser.d.ts.map +1 -1
- package/dist/types/src/loaders/index.d.ts.map +1 -1
- package/dist/types/src/plugin/definitions.d.ts.map +1 -1
- package/dist/types/src/plugin/esbuild-plugin.d.ts.map +1 -1
- package/dist/types/src/plugin/rollup-plugin.d.ts.map +1 -1
- package/dist/types/src/plugin/vite-plugin.d.ts.map +1 -1
- package/dist/types/src/preset.d.ts.map +1 -1
- package/dist/types/src/savers/browser.d.ts.map +1 -1
- package/dist/types/src/savers/index.d.ts.map +1 -1
- package/dist/types/src/telemetry.d.ts +17 -0
- package/dist/types/src/telemetry.d.ts.map +1 -0
- package/dist/types/src/testing/defaults.d.ts +6 -6
- package/dist/types/src/testing/defaults.d.ts.map +1 -1
- package/dist/types/src/testing/envs-map.d.ts +12 -14
- package/dist/types/src/testing/envs-map.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -26
- package/src/config-service.ts +6 -8
- package/src/config.ts +1 -2
- package/src/index.ts +1 -0
- package/src/loaders/browser.ts +1 -1
- package/src/loaders/index.ts +0 -1
- package/src/plugin/definitions.ts +0 -2
- package/src/plugin/vite-plugin.ts +0 -1
- package/src/savers/browser.ts +1 -1
- package/src/telemetry.ts +25 -0
- package/src/testing/build.js +2 -1
- package/dist/lib/browser/chunk-WETPAQBA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FVCGIRXP.mjs.map +0 -7
- package/dist/plugin/node-esm/chunk-QQKWALKX.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-ZI5JXCYY.mjs.map → chunk-VQRJY4AQ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-ODEKAZ4J.mjs.map → chunk-T6NFH3CC.mjs.map} +0 -0
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -22,4 +22,4 @@ pnpm i @dxos/config
|
|
|
22
22
|
|
|
23
23
|
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
24
24
|
|
|
25
|
-
License: [
|
|
25
|
+
License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2022 © DXOS
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// src/config.ts
|
|
2
|
-
import { boolean } from "boolean";
|
|
3
2
|
import defaultsDeep from "lodash.defaultsdeep";
|
|
4
3
|
import isMatch from "lodash.ismatch";
|
|
5
4
|
import { InvalidConfigError } from "@dxos/protocols";
|
|
@@ -21,7 +20,7 @@ var mapFromKeyValues = (spec, values) => {
|
|
|
21
20
|
if (type) {
|
|
22
21
|
switch (type) {
|
|
23
22
|
case "boolean": {
|
|
24
|
-
value =
|
|
23
|
+
value = String(value).toLowerCase() === "true" || value === "1";
|
|
25
24
|
break;
|
|
26
25
|
}
|
|
27
26
|
case "number": {
|
|
@@ -80,7 +79,7 @@ var validateConfig = (config) => {
|
|
|
80
79
|
}
|
|
81
80
|
return config;
|
|
82
81
|
};
|
|
83
|
-
var ConfigResource = Symbol.for("dxos.resource.Config");
|
|
82
|
+
var ConfigResource = /* @__PURE__ */ Symbol.for("dxos.resource.Config");
|
|
84
83
|
var Config = class {
|
|
85
84
|
_config;
|
|
86
85
|
/**
|
|
@@ -144,4 +143,4 @@ export {
|
|
|
144
143
|
ConfigResource,
|
|
145
144
|
Config
|
|
146
145
|
};
|
|
147
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-ZY4D4E3Q.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport isMatch from 'lodash.ismatch';\n\nimport { InvalidConfigError } from '@dxos/protocols';\nimport { schema } from '@dxos/protocols/proto';\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\nimport { trace } from '@dxos/tracing';\nimport { getDeep, setDeep } from '@dxos/util';\n\nimport { type ConfigKey, type DeepIndex, type ParseKey } from './types';\n\ntype MappingSpec = Record<string, { path: string; type?: string }>;\nconst configRootType = schema.getCodecForType('dxos.config.Config');\n\n/**\n * Maps the given objects onto a flattened set of (key x values).\n * Expects parsed yaml content of the form:\n *\n * ```\n * ENV_VAR:\n * path: config.selector.path\n * ```\n *\n * @param {object} spec\n * @param {object} values\n * @return {object}\n */\nexport const mapFromKeyValues = (spec: MappingSpec, values: Record<string, any>) => {\n const config = {};\n\n for (const [key, { path, type }] of Object.entries(spec)) {\n let value = values[key];\n if (value !== undefined) {\n if (type) {\n switch (type) {\n case 'boolean': {\n value = String(value).toLowerCase() === 'true' || value === '1';\n break;\n }\n\n case 'number': {\n value = Number(value);\n break;\n }\n\n case 'string': {\n break;\n }\n\n case 'json': {\n value = value ? JSON.parse(value) : null;\n break;\n }\n\n default: {\n throw new Error(`Invalid type: ${type}`);\n }\n }\n }\n\n setDeep(config, path.split('.'), value);\n }\n }\n\n return config;\n};\n\n/**\n * Maps the given flattend set of (key x values) onto a JSON object.\n * @param {object} spec\n * @param {object} values\n */\nexport const mapToKeyValues = (spec: MappingSpec, values: any) => {\n const config: Record<string, any> = {};\n\n for (const [key, { path, type }] of Object.entries(spec)) {\n const value = getDeep(values, path.split('.'));\n if (value !== undefined) {\n switch (type) {\n case 'json':\n config[key] = JSON.stringify(value);\n break;\n default:\n config[key] = value;\n }\n }\n }\n\n return config;\n};\n\n/**\n * Validate config object.\n */\nexport const validateConfig = (config: ConfigProto): ConfigProto => {\n if (!('version' in config)) {\n throw new InvalidConfigError({ message: 'Version not specified' });\n }\n\n if (config?.version !== 1) {\n throw new InvalidConfigError({ message: `Invalid config version: ${config.version}` });\n }\n\n const error = configRootType.protoType.verify(config);\n if (error) {\n throw new InvalidConfigError({ message: String(error) });\n }\n\n return config;\n};\n\nexport const ConfigResource = Symbol.for('dxos.resource.Config');\n\n/**\n * Global configuration object.\n * NOTE: Config objects are immutable.\n */\n@trace.resource({ annotation: ConfigResource })\nexport class Config {\n private readonly _config: any;\n\n /**\n * Creates an immutable instance.\n * @constructor\n */\n constructor(config: ConfigProto = {}, ...objects: ConfigProto[]) {\n this._config = validateConfig(defaultsDeep(config, ...objects, { version: 1 }));\n }\n\n /**\n * Returns an immutable config JSON object.\n */\n get values(): ConfigProto {\n return this._config;\n }\n\n /**\n * Returns the given config property.\n *\n * @param key A key in the config object. Can be a nested property with keys separated by dots: 'services.signal.server'.\n * @param defaultValue Default value to return if option is not present in the config.\n * @returns The config value or undefined if the option is not present.\n */\n get<K extends ConfigKey>(\n key: K,\n defaultValue?: DeepIndex<ConfigProto, ParseKey<K>>,\n ): DeepIndex<ConfigProto, ParseKey<K>> | undefined {\n return getDeep(this._config, key.split('.')) ?? defaultValue;\n }\n\n /**\n * Get unique key.\n */\n find<T = any>(path: string, test: object): T | undefined {\n const values = getDeep(this._config, path.split('.'));\n if (!Array.isArray(values)) {\n return;\n }\n\n return values.find((value) => isMatch(value, test));\n }\n\n /**\n * Returns the given config property or throw if it doesn't exist.\n *\n * @param key A key in the config object. Can be a nested property with keys separated by dots: 'services.signal.server'.\n */\n getOrThrow<K extends ConfigKey>(key: K): Exclude<DeepIndex<ConfigProto, ParseKey<K>>, undefined> {\n const value: DeepIndex<ConfigProto, ParseKey<K>> | undefined = getDeep(this._config, key.split('.'));\n if (!value) {\n throw new Error(`Config option not present: ${key}`);\n }\n return value;\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["defaultsDeep", "isMatch", "InvalidConfigError", "schema", "trace", "getDeep", "setDeep", "configRootType", "getCodecForType", "mapFromKeyValues", "spec", "values", "config", "key", "path", "type", "Object", "entries", "value", "undefined", "String", "toLowerCase", "Number", "JSON", "parse", "Error", "split", "mapToKeyValues", "stringify", "validateConfig", "message", "version", "error", "protoType", "verify", "ConfigResource", "Symbol", "for", "Config", "_config", "objects", "get", "defaultValue", "find", "test", "Array", "isArray", "getOrThrow", "resource", "annotation"]
|
|
7
|
+
}
|
|
@@ -2,28 +2,27 @@ import {
|
|
|
2
2
|
FILE_DEFAULTS,
|
|
3
3
|
FILE_DYNAMICS,
|
|
4
4
|
FILE_ENVS
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VQRJY4AQ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
Config,
|
|
8
8
|
ConfigResource,
|
|
9
9
|
mapFromKeyValues,
|
|
10
10
|
mapToKeyValues,
|
|
11
11
|
validateConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ZY4D4E3Q.mjs";
|
|
13
13
|
|
|
14
14
|
// src/index.ts
|
|
15
15
|
import * as defs from "@dxos/protocols/proto/dxos/config";
|
|
16
16
|
|
|
17
17
|
// src/config-service.ts
|
|
18
|
-
import { dirname } from "@dxos/node-std/path";
|
|
19
18
|
import * as FileSystem from "@effect/platform/FileSystem";
|
|
20
19
|
import * as Context from "effect/Context";
|
|
21
20
|
import * as Effect from "effect/Effect";
|
|
22
21
|
import * as Layer from "effect/Layer";
|
|
23
22
|
import * as Option from "effect/Option";
|
|
23
|
+
import { dirname } from "@dxos/node-std/path";
|
|
24
24
|
import * as Yaml from "yaml";
|
|
25
|
-
import { DX_CONFIG, DX_DATA } from "@dxos/client-protocol";
|
|
26
|
-
import { getProfilePath } from "@dxos/client-protocol";
|
|
25
|
+
import { DX_CONFIG, DX_DATA, getProfileConfigPath, getProfilePath } from "@dxos/client-protocol";
|
|
27
26
|
import { invariant } from "@dxos/invariant";
|
|
28
27
|
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/config/src/config-service.ts";
|
|
29
28
|
var memoryConfig = new Config({
|
|
@@ -74,7 +73,7 @@ var ConfigService = class _ConfigService extends Context.Tag("ConfigService")()
|
|
|
74
73
|
static layerMemory = Layer.effect(_ConfigService, Effect.succeed(memoryConfig));
|
|
75
74
|
static fromConfig = (config) => Layer.succeed(_ConfigService, config);
|
|
76
75
|
static load = (args) => {
|
|
77
|
-
const defaultConfigPath =
|
|
76
|
+
const defaultConfigPath = getProfileConfigPath(DX_CONFIG, args.profile);
|
|
78
77
|
return Effect.gen(function* () {
|
|
79
78
|
const fs = yield* FileSystem.FileSystem;
|
|
80
79
|
const configPath = Option.getOrElse(args.config, () => defaultConfigPath);
|
|
@@ -86,25 +85,18 @@ var ConfigService = class _ConfigService extends Context.Tag("ConfigService")()
|
|
|
86
85
|
Effect.catchTag("SystemError", () => Effect.gen(function* () {
|
|
87
86
|
const configValues = defaultConfig.values;
|
|
88
87
|
const fs = yield* FileSystem.FileSystem;
|
|
89
|
-
|
|
88
|
+
const pathToCreate = Option.getOrElse(args.config, () => defaultConfigPath);
|
|
89
|
+
yield* fs.makeDirectory(dirname(pathToCreate), {
|
|
90
90
|
recursive: true
|
|
91
91
|
});
|
|
92
|
-
yield* fs.writeFileString(
|
|
92
|
+
yield* fs.writeFileString(pathToCreate, Yaml.stringify(configValues));
|
|
93
93
|
return _ConfigService.of(new Config(configValues));
|
|
94
94
|
}))
|
|
95
95
|
);
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
var profileBuiltinDefaults = (profile) => {
|
|
99
|
-
invariant(!profile.endsWith(".yml"), void 0, {
|
|
100
|
-
F: __dxlog_file,
|
|
101
|
-
L: 100,
|
|
102
|
-
S: void 0,
|
|
103
|
-
A: [
|
|
104
|
-
"!profile.endsWith('.yml')",
|
|
105
|
-
""
|
|
106
|
-
]
|
|
107
|
-
});
|
|
99
|
+
invariant(!profile.endsWith(".yml"), void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 86, S: void 0, A: ["!profile.endsWith('.yml')", ""] });
|
|
108
100
|
return new Config({
|
|
109
101
|
runtime: {
|
|
110
102
|
client: {
|
|
@@ -128,6 +120,12 @@ export * from "#loaders";
|
|
|
128
120
|
export * from "#savers";
|
|
129
121
|
export * from "#plugin";
|
|
130
122
|
|
|
123
|
+
// src/telemetry.ts
|
|
124
|
+
import { isNode } from "@dxos/util";
|
|
125
|
+
var resolveTelemetryTag = (config) => {
|
|
126
|
+
return config?.get("runtime.app.env.DX_TELEMETRY_TAG") ?? (isNode() ? process.env.DX_TELEMETRY_TAG : void 0);
|
|
127
|
+
};
|
|
128
|
+
|
|
131
129
|
// src/preset.ts
|
|
132
130
|
import * as Match from "effect/Match";
|
|
133
131
|
var configPreset = ({ edge = "main" } = {}) => new Config({
|
|
@@ -160,6 +158,7 @@ export {
|
|
|
160
158
|
mapFromKeyValues,
|
|
161
159
|
mapToKeyValues,
|
|
162
160
|
memoryConfig,
|
|
161
|
+
resolveTelemetryTag,
|
|
163
162
|
validateConfig
|
|
164
163
|
};
|
|
165
164
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/index.ts", "../../../src/config-service.ts", "../../../src/preset.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\n// TODO(burdon): Why is this exported? (Rename).\nexport * as defs from '@dxos/protocols/proto/dxos/config';\n\nexport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\nexport * from './config';\nexport * from './config-service';\nexport * from '#loaders';\nexport * from '#savers';\nexport * from '#plugin';\nexport * from './types';\nexport * from './preset';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAKA,YAAYA,UAAU;;;ACDtB,
|
|
6
|
-
"names": ["defs", "
|
|
3
|
+
"sources": ["../../../src/index.ts", "../../../src/config-service.ts", "../../../src/telemetry.ts", "../../../src/preset.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\n// TODO(burdon): Why is this exported? (Rename).\nexport * as defs from '@dxos/protocols/proto/dxos/config';\n\nexport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\nexport * from './config';\nexport * from './config-service';\nexport * from '#loaders';\nexport * from '#savers';\nexport * from '#plugin';\nexport * from './telemetry';\nexport * from './types';\nexport * from './preset';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as FileSystem from '@effect/platform/FileSystem';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport { dirname } from 'node:path';\nimport * as Yaml from 'yaml';\n\nimport { DX_CONFIG, DX_DATA, getProfileConfigPath, getProfilePath } from '@dxos/client-protocol';\nimport { invariant } from '@dxos/invariant';\n\nimport { Config } from './config';\n\nexport const memoryConfig = new Config({\n runtime: {\n client: {\n edgeFeatures: {\n echoReplicator: true,\n feedReplicator: true,\n signaling: true,\n agents: true,\n },\n },\n },\n});\n\nexport const defaultConfig = new Config({\n runtime: {\n client: {\n edgeFeatures: {\n echoReplicator: true,\n feedReplicator: true,\n signaling: true,\n agents: true,\n },\n storage: {\n persistent: true,\n },\n },\n services: {\n edge: {\n url: 'wss://edge-production.dxos.workers.dev/',\n },\n iceProviders: [\n {\n urls: 'https://edge-production.dxos.workers.dev/ice',\n },\n ],\n ai: {\n server: 'https://ai-service.dxos.workers.dev',\n },\n ipfs: {\n server: 'https://api.ipfs.dxos.network/api/v0',\n gateway: 'https://gateway.ipfs.dxos.network/ipfs',\n },\n },\n },\n});\n\nexport class ConfigService extends Context.Tag('ConfigService')<ConfigService, Config>() {\n static layerMemory = Layer.effect(ConfigService, Effect.succeed(memoryConfig));\n\n static fromConfig = (config: Config) => Layer.succeed(ConfigService, config);\n\n static load = (args: { config: Option.Option<string>; profile: string }) => {\n const defaultConfigPath = getProfileConfigPath(DX_CONFIG, args.profile);\n return Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const configPath = Option.getOrElse(args.config, () => defaultConfigPath);\n const configContent = yield* fs.readFileString(configPath);\n const configValues = Yaml.parse(configContent);\n return ConfigService.of(new Config(configValues, profileBuiltinDefaults(args.profile).values));\n }).pipe(\n // If the config file doesn't exist, create it.\n Effect.catchTag('SystemError', () =>\n Effect.gen(function* () {\n const configValues = defaultConfig.values;\n const fs = yield* FileSystem.FileSystem;\n const pathToCreate = Option.getOrElse(args.config, () => defaultConfigPath);\n yield* fs.makeDirectory(dirname(pathToCreate), { recursive: true });\n yield* fs.writeFileString(pathToCreate, Yaml.stringify(configValues));\n return ConfigService.of(new Config(configValues));\n }),\n ),\n );\n };\n}\n\n/**\n * Default config for a profile.\n * Always merged with the default config.\n */\nconst profileBuiltinDefaults = (profile: string) => {\n invariant(!profile.endsWith('.yml'));\n\n return new Config({\n runtime: {\n client: {\n edgeFeatures: {\n echoReplicator: true,\n feedReplicator: true,\n signaling: true,\n agents: true,\n },\n storage: {\n persistent: true,\n dataRoot: getProfilePath(DX_DATA, profile),\n },\n },\n },\n });\n};\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport { isNode } from '@dxos/util';\n\nimport { type Config } from './config';\n\n/**\n * Resolves the telemetry tag used as the `X-DXOS-Client-Tag` header on edge\n * requests AND as the `ctx.tag` attribute / resource on observability traces.\n *\n * Keeping a single resolver ensures the same tag identifies a session across\n * edge and telemetry tiers. Precedence:\n *\n * 1. `config.runtime.app.env.DX_TELEMETRY_TAG` — the explicit, deterministic\n * path. Populated from `.env`/build-time by the app's config loaders.\n * 2. `process.env.DX_TELEMETRY_TAG` — Node-only, for dev/CI convenience.\n *\n * Returns `undefined` when unset; callers should no-op on undefined rather\n * than stamping empty strings.\n */\nexport const resolveTelemetryTag = (config?: Config): string | undefined => {\n return config?.get('runtime.app.env.DX_TELEMETRY_TAG') ?? (isNode() ? process.env.DX_TELEMETRY_TAG : undefined);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Match from 'effect/Match';\n\nimport { Config } from './config';\n\nexport type ConfigPresetOptions = {\n /**\n * Edge service.\n * @default main\n */\n edge?: 'local' | 'dev' | 'main' | 'production';\n};\n\nexport const configPreset = ({ edge = 'main' }: ConfigPresetOptions = {}) =>\n new Config({\n version: 1,\n runtime: {\n client: {\n edgeFeatures: {\n signaling: true,\n echoReplicator: true,\n feedReplicator: true,\n },\n },\n services: {\n edge: {\n url: Match.value(edge).pipe(\n Match.when('local', () => 'http://localhost:8787'),\n Match.when('dev', () => 'https://edge.dxos.workers.dev'),\n Match.when('main', () => 'https://edge-main.dxos.workers.dev'),\n Match.when('production', () => 'https://edge-production.dxos.workers.dev'),\n Match.exhaustive,\n ),\n },\n },\n },\n });\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["defs", "FileSystem", "Context", "Effect", "Layer", "Option", "dirname", "Yaml", "DX_CONFIG", "DX_DATA", "getProfileConfigPath", "getProfilePath", "invariant", "memoryConfig", "client", "edgeFeatures", "echoReplicator", "feedReplicator", "signaling", "agents", "storage", "services", "url", "iceProviders", "ipfs", "gateway", "fromConfig", "succeed", "ConfigService", "config", "load", "args", "defaultConfigPath", "getProfileConfigPath", "DX_CONFIG", "Effect", "FileSystem", "configPath", "getOrElse", "configContent", "fs", "configValues", "parse", "of", "Config", "profileBuiltinDefaults", "pipe", "catchTag", "pathToCreate", "Option", "makeDirectory", "dirname", "recursive", "writeFileString", "runtime", "dataRoot", "isNode", "resolveTelemetryTag", "config", "get", "process", "env", "DX_TELEMETRY_TAG", "undefined", "Match", "configPreset", "edge", "Config", "version", "runtime", "client", "edgeFeatures", "signaling", "echoReplicator", "feedReplicator", "services", "url", "value", "pipe", "when", "exhaustive"]
|
|
7
7
|
}
|
|
@@ -10,29 +10,14 @@ var Local = () => {
|
|
|
10
10
|
var Dynamics = async () => {
|
|
11
11
|
const { publicUrl = "", dynamic } = __DXOS_CONFIG__;
|
|
12
12
|
if (!dynamic) {
|
|
13
|
-
log("dynamics disabled", void 0, {
|
|
14
|
-
F: __dxlog_file,
|
|
15
|
-
L: 28,
|
|
16
|
-
S: void 0,
|
|
17
|
-
C: (f, a) => f(...a)
|
|
18
|
-
});
|
|
13
|
+
log("dynamics disabled", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 14, S: void 0 });
|
|
19
14
|
return {};
|
|
20
15
|
}
|
|
21
16
|
log("fetching config...", {
|
|
22
17
|
publicUrl
|
|
23
|
-
}, {
|
|
24
|
-
F: __dxlog_file,
|
|
25
|
-
L: 32,
|
|
26
|
-
S: void 0,
|
|
27
|
-
C: (f, a) => f(...a)
|
|
28
|
-
});
|
|
18
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 17, S: void 0 });
|
|
29
19
|
return await fetch(`${publicUrl}${CONFIG_ENDPOINT}`).then((res) => res.json()).catch((error) => {
|
|
30
|
-
log.warn("Failed to fetch dynamic config.", error, {
|
|
31
|
-
F: __dxlog_file,
|
|
32
|
-
L: 36,
|
|
33
|
-
S: void 0,
|
|
34
|
-
C: (f, a) => f(...a)
|
|
35
|
-
});
|
|
20
|
+
log.warn("Failed to fetch dynamic config.", error, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 21, S: void 0 });
|
|
36
21
|
return {};
|
|
37
22
|
});
|
|
38
23
|
};
|
|
@@ -44,19 +29,14 @@ var Defaults = (_basePath) => {
|
|
|
44
29
|
};
|
|
45
30
|
var Storage = async () => {
|
|
46
31
|
try {
|
|
47
|
-
const config = await localforage.getItem("dxos.
|
|
32
|
+
const config = await localforage.getItem("org.dxos.settings.config");
|
|
48
33
|
if (config) {
|
|
49
34
|
return config;
|
|
50
35
|
}
|
|
51
36
|
} catch (err) {
|
|
52
37
|
log.warn("Failed to load config", {
|
|
53
38
|
err
|
|
54
|
-
}, {
|
|
55
|
-
F: __dxlog_file,
|
|
56
|
-
L: 59,
|
|
57
|
-
S: void 0,
|
|
58
|
-
C: (f, a) => f(...a)
|
|
59
|
-
});
|
|
39
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 40, S: void 0 });
|
|
60
40
|
}
|
|
61
41
|
return {};
|
|
62
42
|
};
|
|
@@ -77,12 +57,7 @@ var Remote = (target, authenticationToken) => {
|
|
|
77
57
|
}
|
|
78
58
|
};
|
|
79
59
|
} catch (err) {
|
|
80
|
-
log.catch(err, void 0, {
|
|
81
|
-
F: __dxlog_file,
|
|
82
|
-
L: 83,
|
|
83
|
-
S: void 0,
|
|
84
|
-
C: (f, a) => f(...a)
|
|
85
|
-
});
|
|
60
|
+
log.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 63, S: void 0 });
|
|
86
61
|
return {};
|
|
87
62
|
}
|
|
88
63
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/loaders/browser.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\n/* THIS FILE WILL BE LOADED BY CONTEXT REPLACEMENT PLUGIN IN BROWSER ENVS. */\n\nimport localforage from 'localforage';\n\nimport { log } from '@dxos/log';\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\ndeclare const __DXOS_CONFIG__: { publicUrl?: string; dynamic?: boolean };\ndeclare const __CONFIG_ENVS__: Partial<ConfigProto> | undefined;\ndeclare const __CONFIG_DEFAULTS__: Partial<ConfigProto> | undefined;\ndeclare const __CONFIG_LOCAL__: Partial<ConfigProto> | undefined;\n\nconst CONFIG_ENDPOINT = '/.well-known/dx/config';\n\nexport const Profile = (_profile = 'default'): Partial<ConfigProto> => ({});\n\nexport const Local = (): Partial<ConfigProto> => {\n return typeof __CONFIG_LOCAL__ !== 'undefined' ? __CONFIG_LOCAL__ : {};\n};\n\nexport const Dynamics = async (): Promise<Partial<ConfigProto>> => {\n const { publicUrl = '', dynamic } = __DXOS_CONFIG__;\n if (!dynamic) {\n log('dynamics disabled');\n return {};\n }\n\n log('fetching config...', { publicUrl });\n return await fetch(`${publicUrl}${CONFIG_ENDPOINT}`)\n .then((res) => res.json())\n .catch((error) => {\n log.warn('Failed to fetch dynamic config.', error);\n return {};\n });\n};\n\nexport const Envs = (_basePath?: string): Partial<ConfigProto> => {\n return typeof __CONFIG_ENVS__ !== 'undefined' ? __CONFIG_ENVS__ : {};\n};\n\nexport const Defaults = (_basePath?: string): Partial<ConfigProto> => {\n return typeof __CONFIG_DEFAULTS__ !== 'undefined' ? __CONFIG_DEFAULTS__ : {};\n};\n\n/**\n * Settings config from browser storage.\n */\nexport const Storage = async (): Promise<Partial<ConfigProto>> => {\n try {\n const config = await localforage.getItem<Partial<ConfigProto>>('dxos.
|
|
5
|
-
"mappings": ";AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;
|
|
6
|
-
"names": ["localforage", "log", "CONFIG_ENDPOINT", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\n/* THIS FILE WILL BE LOADED BY CONTEXT REPLACEMENT PLUGIN IN BROWSER ENVS. */\n\nimport localforage from 'localforage';\n\nimport { log } from '@dxos/log';\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\ndeclare const __DXOS_CONFIG__: { publicUrl?: string; dynamic?: boolean };\ndeclare const __CONFIG_ENVS__: Partial<ConfigProto> | undefined;\ndeclare const __CONFIG_DEFAULTS__: Partial<ConfigProto> | undefined;\ndeclare const __CONFIG_LOCAL__: Partial<ConfigProto> | undefined;\n\nconst CONFIG_ENDPOINT = '/.well-known/dx/config';\n\nexport const Profile = (_profile = 'default'): Partial<ConfigProto> => ({});\n\nexport const Local = (): Partial<ConfigProto> => {\n return typeof __CONFIG_LOCAL__ !== 'undefined' ? __CONFIG_LOCAL__ : {};\n};\n\nexport const Dynamics = async (): Promise<Partial<ConfigProto>> => {\n const { publicUrl = '', dynamic } = __DXOS_CONFIG__;\n if (!dynamic) {\n log('dynamics disabled');\n return {};\n }\n\n log('fetching config...', { publicUrl });\n return await fetch(`${publicUrl}${CONFIG_ENDPOINT}`)\n .then((res) => res.json())\n .catch((error) => {\n log.warn('Failed to fetch dynamic config.', error);\n return {};\n });\n};\n\nexport const Envs = (_basePath?: string): Partial<ConfigProto> => {\n return typeof __CONFIG_ENVS__ !== 'undefined' ? __CONFIG_ENVS__ : {};\n};\n\nexport const Defaults = (_basePath?: string): Partial<ConfigProto> => {\n return typeof __CONFIG_DEFAULTS__ !== 'undefined' ? __CONFIG_DEFAULTS__ : {};\n};\n\n/**\n * Settings config from browser storage.\n */\nexport const Storage = async (): Promise<Partial<ConfigProto>> => {\n try {\n const config = await localforage.getItem<Partial<ConfigProto>>('org.dxos.settings.config');\n if (config) {\n return config;\n }\n } catch (err) {\n log.warn('Failed to load config', { err });\n }\n return {};\n};\n\nexport const Remote = (target: string | undefined, authenticationToken?: string): Partial<ConfigProto> => {\n if (!target) {\n return {};\n }\n\n try {\n const url = new URL(target);\n const protocol = url.protocol.slice(0, -1);\n\n return {\n runtime: {\n client: {\n // TODO(burdon): Remove vault.html.\n remoteSource: url.origin + (protocol.startsWith('http') ? '/vault.html' : ''),\n remoteSourceAuthenticationToken: authenticationToken,\n },\n },\n };\n } catch (err) {\n log.catch(err);\n return {};\n }\n};\n"],
|
|
5
|
+
"mappings": ";AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;AAQpB,IAAA,eAAMC;AAIN,IAAA,kBAAqB;AACnB,IAAO,UAAOC,CAAAA,WAAAA,eAAqB,CAAA;AACnC,IAAA,QAAA,MAAA;AAEF,SAAO,OAAMC,qBAAW,cAAA,mBAAA,CAAA;;AAEtB,IAAKC,WAAS,YAAA;QACZJ,EAAI,YAAA,IAAA,QAAA,IAAA;MACJ,CAAA,SAAQ;AACV,QAAA,qBAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;AAEI,WAAA,CAAA;;AAAkC,MAAA,sBAAA;IACtC;mBAGa,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAmCK,CAAAA;SAC5C,MAAQ,MAAA,GAAA,SAAA,GAAA,eAAA,EAAA,EAAA,KAAA,CAAA,QAAA,IAAA,KAAA,CAAA,EAAA,MAAA,CAAA,UAAA;AACV,QAAA,KAAA,mCAAA,OAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;AACF,WAAA,CAAA;EAEF,CAAA;;AAEE,IAAA,OAAA,CAAA,cAAA;AAEF,SAAO,OAAMC,oBAAYC,cAAAA,kBAAAA,CAAAA;;AAEvB,IAAA,WAAA,CAAA,cAAA;AAEF,SAAA,OAAA,wBAAA,cAAA,sBAAA,CAAA;;AAKI,IAAMC,UAAS,YAAMT;MACrB;UACE,SAAOS,MAAAA,YAAAA,QAAAA,0BAAAA;AACT,QAAA,QAAA;AACA,aAAY;IACZR;WAAoCS,KAAAA;AAAI,QAAA,KAAA,yBAAA;MAC1C;IACA,GAAA,EAAO,YAAC,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;EACR;AAEF,SAAO,CAAA;;IAEH,SAAQ,CAAA,QAAA,wBAAA;AACV,MAAA,CAAA,QAAA;AAEI,WAAA,CAAA;;MAEF;AAEA,UAAA,MAAO,IAAA,IAAA,MAAA;UACLC,WAAS,IAAA,SAAA,MAAA,GAAA,EAAA;;eAEL;gBACAC;;UAEF,cAAA,IAAA,UAAA,SAAA,WAAA,MAAA,IAAA,gBAAA;UACF,iCAAA;QACF;MACA;IACAX;WACA,KAAQ;AACV,QAAA,MAAA,KAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;AACA,WAAA,CAAA;;;",
|
|
6
|
+
"names": ["localforage", "log", "CONFIG_ENDPOINT", "__CONFIG_LOCAL__", "Dynamics", "dynamic", "error", "Defaults", "_basePath", "config", "err", "runtime", "remoteSource"]
|
|
7
7
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FILE_DEFAULTS,
|
|
3
3
|
FILE_ENVS
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-VQRJY4AQ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
mapFromKeyValues
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-ZY4D4E3Q.mjs";
|
|
8
8
|
|
|
9
9
|
// src/loaders/index.ts
|
|
10
10
|
import fs from "@dxos/node-std/fs";
|
|
@@ -50,12 +50,7 @@ var Remote = (target, authenticationToken) => {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
} catch (err) {
|
|
53
|
-
log.catch(err, void 0, {
|
|
54
|
-
F: __dxlog_file,
|
|
55
|
-
L: 88,
|
|
56
|
-
S: void 0,
|
|
57
|
-
C: (f, a) => f(...a)
|
|
58
|
-
});
|
|
53
|
+
log.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 66, S: void 0 });
|
|
59
54
|
return {};
|
|
60
55
|
}
|
|
61
56
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/loaders/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nimport fs from 'node:fs';\nimport path from 'node:path';\
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,OAAOA,QAAQ;AACf,OAAOC,UAAU;
|
|
6
|
-
"names": ["fs", "path", "parse", "log", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2021 DXOS.org\n//\n\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { parse } from 'yaml';\n\nimport { log } from '@dxos/log';\nimport { type Config as ConfigProto } from '@dxos/protocols/proto/dxos/config';\n\nimport { mapFromKeyValues } from '../config';\nimport { FILE_DEFAULTS, FILE_ENVS } from '../types';\n\n// TODO(burdon): Move code out of index file.\n\nconst DEFAULT_BASE_PATH = path.resolve(process.cwd(), 'config');\n\nconst maybeLoadFile = (file: string): any => {\n try {\n return parse(fs.readFileSync(file, { encoding: 'utf8' }));\n } catch (err: any) {\n // Ignored.\n }\n};\n\n//\n// NOTE: Export LocalStorage and Dynamics for typescript to typecheck browser code (see ConfigPlugin).\n//\n\n/**\n * Profile\n */\nexport const Profile = (profile = 'default') => {\n const configFile = path.join(process.env.HOME ?? '~', `.config/dx/profile/${profile}.yml`);\n return maybeLoadFile(configFile) as ConfigProto;\n};\n\n/**\n * Development config.\n */\n// TODO(burdon): Rename or reconcile with Profile above?\nexport const Local = (): Partial<ConfigProto> => ({});\n\n/**\n * Provided dynamically by server.\n */\nexport const Dynamics = (): Partial<ConfigProto> => ({});\n\n/**\n * ENV variable (key/value) map.\n */\nexport const Envs = (basePath = DEFAULT_BASE_PATH): Partial<ConfigProto> => {\n const content = maybeLoadFile(path.resolve(basePath, FILE_ENVS));\n return content ? mapFromKeyValues(content, process.env) : {};\n};\n\n/**\n * JSON config.\n */\nexport const Defaults = (basePath = DEFAULT_BASE_PATH): Partial<ConfigProto> =>\n maybeLoadFile(path.resolve(basePath, FILE_DEFAULTS)) ?? {};\n\n/**\n * Load config from storage.\n */\nexport const Storage = async (): Promise<Partial<ConfigProto>> => ({});\n\nexport const Remote = (target: string | undefined, authenticationToken?: string): Partial<ConfigProto> => {\n if (!target) {\n return {};\n }\n\n try {\n const url = new URL(target);\n const protocol = url.protocol.slice(0, -1);\n return {\n runtime: {\n client: {\n // TODO(burdon): Remove vault.html.\n remoteSource: url.origin + (protocol.startsWith('http') ? '/vault.html' : ''),\n remoteSourceAuthenticationToken: authenticationToken,\n },\n },\n };\n } catch (err) {\n log.catch(err);\n return {};\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,QAAQ;AACf,OAAOC,UAAU;AACjB,SAASC,aAAa;AAEtB,SAASC,WAAW;AAMpB,IAAA,eAAA;IAKE,oBAAI,KAAA,QAAA,QAAA,IAAA,GAAA,QAAA;oBACWC,CAAAA,SAAGC;;AAAsC,WAAA,MAAA,GAAA,aAAA,MAAA;MACtD,UAAiB;IACjB,CAAA,CAAA;EACF,SAAA,KAAA;EAGA;AACF;AAQSC,IAAAA,UAAcC,CAAAA,UAAAA,cAAAA;AACrB,QAAA,aAAA,KAAA,KAAA,QAAA,IAAA,QAAA,KAAA,sBAAA,OAAA,MAAA;AAEF,SAAA,cAAA,UAAA;;;;AAgBSC,IAAAA,OAAUC,CAAAA,WAAAA,sBAAkCC;AACnD,QAAA,UAAA,cAAA,KAAA,QAAA,UAAA,SAAA,CAAA;AAEF,SAAA,UAAA,iBAAA,SAAA,QAAA,GAAA,IAAA,CAAA;;;AAYOC,IAAQ,UAAA,aAAA,CAAA;IACX,SAAQ,CAAA,QAAA,wBAAA;AACV,MAAA,CAAA,QAAA;AAEI,WAAA,CAAA;;MAEF;AACA,UAAA,MAAO,IAAA,IAAA,MAAA;UACLC,WAAS,IAAA,SAAA,MAAA,GAAA,EAAA;;eAEL;gBACAC;;UAEF,cAAA,IAAA,UAAA,SAAA,WAAA,MAAA,IAAA,gBAAA;UACF,iCAAA;QACF;MACA;IACAC;WACA,KAAQ;AACV,QAAA,MAAA,KAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;AACA,WAAA,CAAA;;;",
|
|
6
|
+
"names": ["fs", "path", "parse", "log", "fs", "readFileSync", "maybeLoadFile", "configFile", "content", "mapFromKeyValues", "env", "target", "runtime", "remoteSource", "log"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/config.ts":{"bytes":15994,"imports":[{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/config-service.ts":{"bytes":12105,"imports":[{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@effect/platform/FileSystem","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/types.ts":{"bytes":2735,"imports":[],"format":"esm"},"src/preset.ts":{"bytes":3324,"imports":[{"path":"effect/Match","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/index.ts":{"bytes":1397,"imports":[{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/config-service.ts","kind":"import-statement","original":"./config-service"},{"path":"#loaders","kind":"import-statement","external":true},{"path":"#savers","kind":"import-statement","external":true},{"path":"#plugin","kind":"import-statement","external":true},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/preset.ts","kind":"import-statement","original":"./preset"}],"format":"esm"},"src/loaders/index.ts":{"bytes":8224,"imports":[{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/loaders/browser.ts":{"bytes":8612,"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/savers/index.ts":{"bytes":666,"imports":[],"format":"esm"},"src/savers/browser.ts":{"bytes":2707,"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/plugin/definitions.ts":{"bytes":12031,"imports":[{"path":"@dxos/node-std/child_process","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"}],"format":"esm"},"src/plugin/index.ts":{"bytes":504,"imports":[{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/plugin/browser.ts":{"bytes":1003,"imports":[],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8218},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-ZI5JXCYY.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-WETPAQBA.mjs","kind":"import-statement"},{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"@effect/platform/FileSystem","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"#loaders","kind":"import-statement","external":true},{"path":"#savers","kind":"import-statement","external":true},{"path":"#plugin","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true}],"exports":["Config","ConfigResource","ConfigService","FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS","configPreset","defaultConfig","defs","mapFromKeyValues","mapToKeyValues","memoryConfig","validateConfig"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":135},"src/config-service.ts":{"bytesInOutput":3216},"src/preset.ts":{"bytesInOutput":617}},"bytes":4506},"dist/lib/browser/loaders/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4121},"dist/lib/browser/loaders/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-ZI5JXCYY.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-WETPAQBA.mjs","kind":"import-statement"},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Defaults","Dynamics","Envs","Local","Profile","Remote","Storage"],"entryPoint":"src/loaders/index.ts","inputs":{"src/loaders/index.ts":{"bytesInOutput":1567}},"bytes":1841},"dist/lib/browser/chunk-ZI5JXCYY.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1813},"dist/lib/browser/chunk-ZI5JXCYY.mjs":{"imports":[],"exports":["FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS"],"inputs":{"src/types.ts":{"bytesInOutput":102}},"bytes":221},"dist/lib/browser/loaders/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4405},"dist/lib/browser/loaders/browser.mjs":{"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Defaults","Dynamics","Envs","Local","Profile","Remote","Storage"],"entryPoint":"src/loaders/browser.ts","inputs":{"src/loaders/browser.ts":{"bytesInOutput":2148}},"bytes":2295},"dist/lib/browser/savers/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":358},"dist/lib/browser/savers/index.mjs":{"imports":[],"exports":["SaveConfig"],"entryPoint":"src/savers/index.ts","inputs":{"src/savers/index.ts":{"bytesInOutput":35}},"bytes":118},"dist/lib/browser/savers/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1280},"dist/lib/browser/savers/browser.mjs":{"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["SaveConfig"],"entryPoint":"src/savers/browser.ts","inputs":{"src/savers/browser.ts":{"bytesInOutput":747}},"bytes":834},"dist/lib/browser/plugin/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5718},"dist/lib/browser/plugin/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-WETPAQBA.mjs","kind":"import-statement"},{"path":"@dxos/node-std/child_process","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["definitions"],"entryPoint":"src/plugin/index.ts","inputs":{"src/plugin/definitions.ts":{"bytesInOutput":3216},"src/plugin/index.ts":{"bytesInOutput":0}},"bytes":3367},"dist/lib/browser/chunk-WETPAQBA.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7879},"dist/lib/browser/chunk-WETPAQBA.mjs":{"imports":[{"path":"boolean","kind":"import-statement","external":true},{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["Config","ConfigResource","mapFromKeyValues","mapToKeyValues","validateConfig"],"inputs":{"src/config.ts":{"bytesInOutput":4061}},"bytes":4218},"dist/lib/browser/plugin/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":494},"dist/lib/browser/plugin/browser.mjs":{"imports":[],"exports":["definitions"],"entryPoint":"src/plugin/browser.ts","inputs":{"src/plugin/browser.ts":{"bytesInOutput":110}},"bytes":198}}}
|
|
1
|
+
{"inputs":{"src/config.ts":{"bytes":15941,"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/config-service.ts":{"bytes":12251,"imports":[{"path":"@effect/platform/FileSystem","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/telemetry.ts":{"bytes":2724,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/types.ts":{"bytes":2665,"imports":[],"format":"esm"},"src/preset.ts":{"bytes":3253,"imports":[{"path":"effect/Match","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"}],"format":"esm"},"src/index.ts":{"bytes":1416,"imports":[{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"./config"},{"path":"src/config-service.ts","kind":"import-statement","original":"./config-service"},{"path":"#loaders","kind":"import-statement","external":true},{"path":"#savers","kind":"import-statement","external":true},{"path":"#plugin","kind":"import-statement","external":true},{"path":"src/telemetry.ts","kind":"import-statement","original":"./telemetry"},{"path":"src/types.ts","kind":"import-statement","original":"./types"},{"path":"src/preset.ts","kind":"import-statement","original":"./preset"}],"format":"esm"},"src/loaders/index.ts":{"bytes":8152,"imports":[{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"},{"path":"src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"src/loaders/browser.ts":{"bytes":8287,"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/savers/index.ts":{"bytes":589,"imports":[],"format":"esm"},"src/savers/browser.ts":{"bytes":2564,"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/plugin/definitions.ts":{"bytes":11702,"imports":[{"path":"@dxos/node-std/child_process","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/config.ts","kind":"import-statement","original":"../config"}],"format":"esm"},"src/plugin/index.ts":{"bytes":427,"imports":[{"path":"src/plugin/definitions.ts","kind":"import-statement","original":"./definitions"}],"format":"esm"},"src/plugin/browser.ts":{"bytes":924,"imports":[],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9238},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-VQRJY4AQ.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-ZY4D4E3Q.mjs","kind":"import-statement"},{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"@effect/platform/FileSystem","kind":"import-statement","external":true},{"path":"effect/Context","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Layer","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/client-protocol","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"#loaders","kind":"import-statement","external":true},{"path":"#savers","kind":"import-statement","external":true},{"path":"#plugin","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"effect/Match","kind":"import-statement","external":true}],"exports":["Config","ConfigResource","ConfigService","FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS","configPreset","defaultConfig","defs","mapFromKeyValues","mapToKeyValues","memoryConfig","resolveTelemetryTag","validateConfig"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":135},"src/config-service.ts":{"bytesInOutput":3257},"src/telemetry.ts":{"bytesInOutput":192},"src/preset.ts":{"bytesInOutput":617}},"bytes":4783},"dist/lib/browser/loaders/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3507},"dist/lib/browser/loaders/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-VQRJY4AQ.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-ZY4D4E3Q.mjs","kind":"import-statement"},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Defaults","Dynamics","Envs","Local","Profile","Remote","Storage"],"entryPoint":"src/loaders/index.ts","inputs":{"src/loaders/index.ts":{"bytesInOutput":1541}},"bytes":1815},"dist/lib/browser/chunk-VQRJY4AQ.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1813},"dist/lib/browser/chunk-VQRJY4AQ.mjs":{"imports":[],"exports":["FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS"],"inputs":{"src/types.ts":{"bytesInOutput":102}},"bytes":221},"dist/lib/browser/loaders/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4097},"dist/lib/browser/loaders/browser.mjs":{"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["Defaults","Dynamics","Envs","Local","Profile","Remote","Storage"],"entryPoint":"src/loaders/browser.ts","inputs":{"src/loaders/browser.ts":{"bytesInOutput":2028}},"bytes":2175},"dist/lib/browser/savers/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":358},"dist/lib/browser/savers/index.mjs":{"imports":[],"exports":["SaveConfig"],"entryPoint":"src/savers/index.ts","inputs":{"src/savers/index.ts":{"bytesInOutput":35}},"bytes":118},"dist/lib/browser/savers/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1302},"dist/lib/browser/savers/browser.mjs":{"imports":[{"path":"localforage","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["SaveConfig"],"entryPoint":"src/savers/browser.ts","inputs":{"src/savers/browser.ts":{"bytesInOutput":694}},"bytes":781},"dist/lib/browser/plugin/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5396},"dist/lib/browser/plugin/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-ZY4D4E3Q.mjs","kind":"import-statement"},{"path":"@dxos/node-std/child_process","kind":"import-statement","external":true},{"path":"@dxos/node-std/fs","kind":"import-statement","external":true},{"path":"@dxos/node-std/path","kind":"import-statement","external":true},{"path":"pkg-up","kind":"import-statement","external":true},{"path":"yaml","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["definitions"],"entryPoint":"src/plugin/index.ts","inputs":{"src/plugin/definitions.ts":{"bytesInOutput":3096},"src/plugin/index.ts":{"bytesInOutput":0}},"bytes":3247},"dist/lib/browser/chunk-ZY4D4E3Q.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7811},"dist/lib/browser/chunk-ZY4D4E3Q.mjs":{"imports":[{"path":"lodash.defaultsdeep","kind":"import-statement","external":true},{"path":"lodash.ismatch","kind":"import-statement","external":true},{"path":"@dxos/protocols","kind":"import-statement","external":true},{"path":"@dxos/protocols/proto","kind":"import-statement","external":true},{"path":"@dxos/tracing","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["Config","ConfigResource","mapFromKeyValues","mapToKeyValues","validateConfig"],"inputs":{"src/config.ts":{"bytesInOutput":4083}},"bytes":4240},"dist/lib/browser/plugin/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":494},"dist/lib/browser/plugin/browser.mjs":{"imports":[],"exports":["definitions"],"entryPoint":"src/plugin/browser.ts","inputs":{"src/plugin/browser.ts":{"bytesInOutput":110}},"bytes":198}}}
|