@dxos/config 0.8.4-main.d05673bc65 → 0.8.4-main.dfabb4ec29
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/dist/lib/browser/{chunk-ZI5JXCYY.mjs → chunk-VQRJY4AQ.mjs} +1 -1
- package/dist/lib/browser/{chunk-54W4ZP5U.mjs → chunk-ZY4D4E3Q.mjs} +1 -1
- package/dist/lib/browser/{chunk-54W4ZP5U.mjs.map → chunk-ZY4D4E3Q.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +11 -12
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/loaders/browser.mjs +5 -30
- package/dist/lib/browser/loaders/browser.mjs.map +2 -2
- 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 +2 -12
- package/dist/lib/browser/savers/browser.mjs.map +2 -2
- package/dist/lib/node-esm/{chunk-ODEKAZ4J.mjs → chunk-T6NFH3CC.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-YHGABJ7Y.mjs → chunk-WIJROCKQ.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-YHGABJ7Y.mjs.map → chunk-WIJROCKQ.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +11 -12
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/loaders/browser.mjs +5 -30
- package/dist/lib/node-esm/loaders/browser.mjs.map +2 -2
- 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 +2 -12
- package/dist/lib/node-esm/savers/browser.mjs.map +2 -2
- package/dist/plugin/node-esm/{chunk-4OOW7ZFE.mjs → chunk-XCZNYAQT.mjs} +4 -22
- 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 +10 -23
- package/src/config-service.ts +1 -2
- package/src/index.ts +1 -0
- package/src/loaders/index.ts +0 -1
- package/src/plugin/definitions.ts +0 -2
- package/src/plugin/vite-plugin.ts +0 -1
- package/src/telemetry.ts +25 -0
- package/src/testing/build.js +2 -1
- package/dist/plugin/node-esm/chunk-4OOW7ZFE.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
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config.ts"],
|
|
4
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": ";AAIA,OAAOA,kBAAkB;AACzB,OAAOC,aAAa;AAEpB,SAASC,0BAA0B;AACnC,SAASC,cAAc;AAEvB,SAASC,aAAa;AACtB,SAASC,SAASC,eAAe;;;;;;;AAKjC,IAAMC,
|
|
6
|
-
"names": ["defaultsDeep", "isMatch", "InvalidConfigError", "schema", "trace", "getDeep", "setDeep", "configRootType", "
|
|
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
7
|
}
|
|
@@ -2,25 +2,25 @@ 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
25
|
import { DX_CONFIG, DX_DATA, getProfileConfigPath, getProfilePath } from "@dxos/client-protocol";
|
|
26
26
|
import { invariant } from "@dxos/invariant";
|
|
@@ -96,15 +96,7 @@ var ConfigService = class _ConfigService extends Context.Tag("ConfigService")()
|
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
98
|
var profileBuiltinDefaults = (profile) => {
|
|
99
|
-
invariant(!profile.endsWith(".yml"), void 0, {
|
|
100
|
-
F: __dxlog_file,
|
|
101
|
-
L: 99,
|
|
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": ";;;;;;;;;;;;;;AAKA,YAAYA,UAAU;;;ACDtB,YAAYC,gBAAgB;AAC5B,YAAYC,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,SAASC,eAAe;AACxB,YAAYC,UAAU;AAEtB,SAASC,WAAWC,SAASC,sBAAsBC,sBAAsB;AACzE,SAASC,iBAAiB;AAI1B,IAAA,eAAaC;IAETC,eAAQ,IAAA,OAAA;WACNC;YACEC;oBACAC;QACAC,gBAAW;QACXC,gBAAQ;QACV,WAAA;QACF,QAAA;MACF;IACC;EAEH;;IAEIL,gBAAQ,IAAA,OAAA;WACNC;YACEC;oBACAC;QACAC,gBAAW;QACXC,gBAAQ;QACV,WAAA;QACAC,QAAS;;MAET,SAAA;QACF,YAAA;MACAC;;cAEIC;MACF,MAAA;QACAC,KAAAA;;oBAEU;QACR;UACD,MAAA;QACG;;MAEJ,IAAA;QACAC,QAAM;;YAEJC;QACF,QAAA;QACF,SAAA;MACF;IACC;EAEH;;AAGE,IAAOC,gBAAP,MAAOA,uBAAuCC,YAAO,eAACC,EAAeC,EAAAA;EAErE,OAAOC,cAAQC,aAAAA,gBAAAA,eAAAA,YAAAA,CAAAA;SACb,aAAMC,CAAAA,WAAoBC,cAAAA,gBAAqBC,MAAWH;SAC1D,OAAOI,CAAAA,SAAW;UAChB,oBAAkBC,qBAAqB,WAAA,KAAA,OAAA;WACjCC,WAAAA,aAAoBC;AAC1B,YAAMC,KAAAA,OAAuBC;AAC7B,YAAMC,aAAoBC,iBAAMH,KAAAA,QAAAA,MAAAA,iBAAAA;AAChC,YAAA,gBAAqBI,OAAOC,GAAAA,eAAOH,UAAcI;AAChDC,YACD,eAAA,WAAA,aAAA;AACAX,aAAOY,eAAS,GAAA,IAAe,OAC7BZ,cAAW,uBAAA,KAAA,OAAA,EAAA,MAAA,CAAA;;;sBAEHK,eAAYJ,MAAWA,WAAAA,aAAU;AACvC,cAAMY,eAAeC,cAAOX;AAC5B,cAAA,KAAUY,OAAcC;cAAyBC,eAAW,iBAAA,KAAA,QAAA,MAAA,iBAAA;AAAK,eAAA,GAAA,cAAA,QAAA,YAAA,GAAA;UACjE,WAAUC;QACV,CAAA;AACF,eAAA,GAAA,gBAAA,cAAA,eAAA,YAAA,CAAA;AAGJ,eAAA,eAAA,GAAA,IAAA,OAAA,YAAA,CAAA;MACJ,CAAA,CAAA;IAAA;EAEA;;AAOE,IAAA,yBAAkB,CAAA,YAAA;YAChBC,CAAAA,QAAS,SAAA,MAAA,GAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,QAAA,GAAA,CAAA,6BAAA,EAAA,EAAA,CAAA;aACPxC,OAAQ;aACNC;cACEC;sBACAC;UACAC,gBAAW;UACXC,gBAAQ;UACV,WAAA;UACAC,QAAS;;iBAEPmC;UACF,YAAA;UACF,UAAA,eAAA,SAAA,OAAA;QACF;MACF;IACF;;;;;ADxGA,cAAc;AACd,cAAc;AACd,cAAc;;;AETd,SAASC,cAAc;AAkBhB,IAAMC,sBAAsB,CAACC,WAAAA;AAClC,SAAOA,QAAQC,IAAI,kCAAA,MAAwCH,OAAAA,IAAWI,QAAQC,IAAIC,mBAAmBC;AACvG;;;ACpBA,YAAYC,WAAW;AAYhB,IAAMC,eAAe,CAAC,EAAEC,OAAO,OAAM,IAA0B,CAAC,MACrE,IAAIC,OAAO;EACTC,SAAS;EACTC,SAAS;IACPC,QAAQ;MACNC,cAAc;QACZC,WAAW;QACXC,gBAAgB;QAChBC,gBAAgB;MAClB;IACF;IACAC,UAAU;MACRT,MAAM;QACJU,KAAWC,YAAMX,IAAAA,EAAMY,KACfC,WAAK,SAAS,MAAM,uBAAA,GACpBA,WAAK,OAAO,MAAM,+BAAA,GAClBA,WAAK,QAAQ,MAAM,oCAAA,GACnBA,WAAK,cAAc,MAAM,0CAAA,GACzBC,gBAAU;MAEpB;IACF;EACF;AACF,CAAA;",
|
|
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
|
};
|
|
@@ -51,12 +36,7 @@ var Storage = async () => {
|
|
|
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
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/loaders/browser.ts"],
|
|
4
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;
|
|
6
|
-
"names": ["localforage", "log", "CONFIG_ENDPOINT", "
|
|
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":16016,"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":12328,"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/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":8367},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-ZI5JXCYY.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-54W4ZP5U.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/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":3269},"src/preset.ts":{"bytesInOutput":617}},"bytes":4559},"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-54W4ZP5U.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-54W4ZP5U.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-54W4ZP5U.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7889},"dist/lib/browser/chunk-54W4ZP5U.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}}}
|
|
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}}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mapFromKeyValues
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-ZY4D4E3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/plugin/definitions.ts
|
|
6
6
|
import { execSync } from "@dxos/node-std/child_process";
|
|
@@ -22,15 +22,7 @@ var definitions = ({ configPath, envPath, devPath, mode = "development", publicU
|
|
|
22
22
|
KEYS_TO_FILE.__CONFIG_LOCAL__ = devPath ?? resolve(CWD, "dx-local.yml");
|
|
23
23
|
}
|
|
24
24
|
return Object.entries(KEYS_TO_FILE).reduce((prev, [key, value]) => {
|
|
25
|
-
invariant(key, void 0, {
|
|
26
|
-
F: __dxlog_file,
|
|
27
|
-
L: 40,
|
|
28
|
-
S: void 0,
|
|
29
|
-
A: [
|
|
30
|
-
"key",
|
|
31
|
-
""
|
|
32
|
-
]
|
|
33
|
-
});
|
|
25
|
+
invariant(key, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 23, S: void 0, A: ["key", ""] });
|
|
34
26
|
let content = {};
|
|
35
27
|
try {
|
|
36
28
|
content = parse(readFileSync(value, "utf-8"));
|
|
@@ -78,19 +70,9 @@ var definitions = ({ configPath, envPath, devPath, mode = "development", publicU
|
|
|
78
70
|
}
|
|
79
71
|
} catch (err) {
|
|
80
72
|
if (err.message.includes("YAMLException")) {
|
|
81
|
-
log.error(`Failed to parse file ${value}:`, err, {
|
|
82
|
-
F: __dxlog_file,
|
|
83
|
-
L: 73,
|
|
84
|
-
S: void 0,
|
|
85
|
-
C: (f, a) => f(...a)
|
|
86
|
-
});
|
|
73
|
+
log.error(`Failed to parse file ${value}:`, err, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 73, S: void 0 });
|
|
87
74
|
} else {
|
|
88
|
-
log(`Failed to load file ${value}:`, err, {
|
|
89
|
-
F: __dxlog_file,
|
|
90
|
-
L: 75,
|
|
91
|
-
S: void 0,
|
|
92
|
-
C: (f, a) => f(...a)
|
|
93
|
-
});
|
|
75
|
+
log(`Failed to load file ${value}:`, err, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 75, S: void 0 });
|
|
94
76
|
}
|
|
95
77
|
if (key === "__CONFIG_DEFAULTS__") {
|
|
96
78
|
throw new Error(`Failed to load default config file from ${value}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/plugin/definitions.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { execSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,gBAAgB;AACzB,SAASC,oBAAoB;AAC7B,SAASC,eAAe;
|
|
6
|
-
"names": ["execSync", "readFileSync", "resolve", "pkgUp", "parse", "invariant", "log", "setDeep", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport { execSync } from 'node:child_process';\nimport { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport pkgUp from 'pkg-up';\nimport { parse } from 'yaml';\n\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { setDeep } from '@dxos/util';\n\nimport { mapFromKeyValues } from '../config';\nimport { type ConfigPluginOpts } from './types';\n\nconst CWD = process.cwd();\n\nexport const definitions = ({\n configPath,\n envPath,\n devPath,\n mode = process.env.NODE_ENV,\n publicUrl = '',\n env,\n}: ConfigPluginOpts) => {\n const KEYS_TO_FILE = {\n __CONFIG_DEFAULTS__: configPath?.length ? configPath : resolve(CWD, 'dx.yml'),\n __CONFIG_ENVS__: envPath?.length ? envPath : resolve(CWD, 'dx-env.yml'),\n } as { [key: string]: string };\n if (mode !== 'production') {\n KEYS_TO_FILE.__CONFIG_LOCAL__ = devPath ?? resolve(CWD, 'dx-local.yml');\n }\n\n return Object.entries(KEYS_TO_FILE).reduce(\n (prev, [key, value]) => {\n invariant(key);\n let content = {};\n try {\n content = parse(readFileSync(value, 'utf-8')) as any;\n\n // Map environment variables to config values.\n if (key === '__CONFIG_ENVS__') {\n content = mapFromKeyValues(content, process.env);\n }\n\n if (key === '__CONFIG_DEFAULTS__') {\n // Load app environment variables into default config.\n Object.entries(process.env).forEach(([key, value]) => {\n if (key.startsWith('DX_') || env?.includes(key)) {\n setDeep(content, ['runtime', 'app', 'env', key], value);\n }\n });\n\n // Set build info automatically if available.\n try {\n const timestamp = new Date().toISOString();\n const commitHash =\n process.env.DX_COMMIT_HASH ??\n execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).replace('\\n', '');\n const packagePath = pkgUp.sync();\n const packageJson = packagePath && JSON.parse(readFileSync(packagePath, 'utf-8'));\n setDeep(content, ['runtime', 'app', 'build', 'timestamp'], timestamp);\n setDeep(content, ['runtime', 'app', 'build', 'commitHash'], commitHash);\n setDeep(content, ['runtime', 'app', 'build', 'version'], packageJson?.version);\n } catch {}\n }\n } catch (err: any) {\n if (err.message.includes('YAMLException')) {\n log.error(`Failed to parse file ${value}:`, err);\n } else {\n log(`Failed to load file ${value}:`, err);\n }\n\n if (key === '__CONFIG_DEFAULTS__') {\n // Default config is required.\n throw new Error(`Failed to load default config file from ${value}`);\n }\n }\n\n return {\n ...prev,\n [key]: content,\n };\n },\n {\n __CONFIG_DEFAULTS__: {},\n __CONFIG_ENVS__: {},\n __CONFIG_LOCAL__: {},\n __DXOS_CONFIG__: { dynamic: mode === 'production', publicUrl },\n },\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAASA,gBAAgB;AACzB,SAASC,oBAAoB;AAC7B,SAASC,eAAe;AACxB,OAAOC,WAAW;AAClB,SAASC,aAAa;AAEtB,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,eAAe;AAKxB,IAAA,eAAYC;IAUV,MAAMC,QAAAA,IAAAA;IACJC,cAAAA,CAAAA,EAAqBC,YAAYC,SAASD,SAAAA,OAAaE,eAAa,YAAA,IAAA,IAAA,MAAA;QACpEC,eAAiBC;IACnB,qBAAA,YAAA,SAAA,aAAA,QAAA,KAAA,QAAA;IACIC,iBAAS,SAAc,SAAA,UAAA,QAAA,KAAA,YAAA;;AAE3B,MAAA,SAAA,cAAA;AAEA,iBAAcC,mBAAsBC,WACjCC,QAAOC,KAAKC,cAAM;;SAEjB,OAAIC,QAAW,YAAA,EAAA,OAAA,CAAA,MAAA,CAAA,KAAA,KAAA,MAAA;AACf,cAAI,KAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,QAAA,GAAA,CAAA,OAAA,EAAA,EAAA,CAAA;QACFA,UAAUC,CAAAA;QAEV;AACA,gBAAIH,MAAQ,aAAA,OAAmB,OAAA,CAAA;AAE/B,UAAA,QAAA,mBAAA;AAEIA,kBAAQ,iBAAA,SAAuB,QAAA,GAAA;;UAEjCI,QAAOP,uBAAqBQ;uBAExBC,QAAQJ,GAAS,EAAA,QAAA,CAAA,CAAAF,MAAAC,MAAA,MAAA;mBAAC,WAAA,KAAA,KAAA,KAAA,SAAAD,IAAA,GAAA;oBAAW,SAAA;cAAO;cAAOA;cAAMC;cACnDD;YACF,GAAAC,MAAA;UAEA;QACA,CAAA;YAEE;gBAE2CM,aAAU,oBAAA,KAAA,GAAA,YAAA;AAAQ,gBAAGC,aAAc,QAAA,IAAA,kBAAA,SAAA,8BAAA;YAC9E,UAAMC;UACN,CAAA,EAAA,QAAMC,MAAAA,EAAAA;AACNJ,gBAAAA,cAAiB,MAAA,KAAA;gBAAC,cAAA,eAAA,KAAA,MAAA,aAAA,aAAA,OAAA,CAAA;kBAAW,SAAA;YAAO;YAAS;YAAcK;YAC3DL;sBAAkB;kBAAW,SAAA;YAAO;YAAS;YAAeM;YAC5DN;uBAAkB;kBAAW,SAAA;YAAO;YAAS;YAAYI;YACzD;UACJ,GAAA,aAAA,OAAA;QACA,QAAiB;QAAA;MACjB;aACEG,KAAIC;AACN,UAAA,IAAO,QAAA,SAAA,eAAA,GAAA;AACLD,YAAI,MAAC,wBAA6B,KAAGE,KAAAA,KAAAA,EAAAA,YAAAA,YAAAA,GAAAA,cAAAA,GAAAA,IAAAA,GAAAA,OAAAA,CAAAA;MACvC,OAAA;AAEIf,YAAAA,uBAAQ,KAAuB,KAAA,KAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;;UAEjC,QAAM,uBAAW;AAErB,cAAA,IAAA,MAAA,2CAAA,KAAA,EAAA;MAEA;;WAEGA;MACH,GAAA;MAEF,CAAA,GAAA,GAAA;IACEV;;IAEA0B,qBAAmB,CAAA;IACnBC,iBAAiB,CAAA;sBAAWrB,CAAAA;qBAAuBsB;MAAU,SAAA,SAAA;MAC/D;IAEF;;;",
|
|
6
|
+
"names": ["execSync", "readFileSync", "resolve", "pkgUp", "parse", "invariant", "log", "setDeep", "process", "KEYS_TO_FILE", "__CONFIG_DEFAULTS__", "configPath", "length", "resolve", "__CONFIG_ENVS__", "envPath", "mode", "entries", "reduce", "prev", "key", "value", "content", "parse", "Object", "forEach", "setDeep", "encoding", "replace", "packagePath", "packageJson", "timestamp", "commitHash", "log", "error", "err", "__CONFIG_LOCAL__", "__DXOS_CONFIG__", "publicUrl"]
|
|
7
7
|
}
|
|
@@ -5,12 +5,7 @@ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/config/src/savers/browser.ts";
|
|
|
5
5
|
var PERFORMING_CONFIG_SAVE = false;
|
|
6
6
|
var SaveConfig = async (config) => {
|
|
7
7
|
if (PERFORMING_CONFIG_SAVE) {
|
|
8
|
-
log.warn("Already performing config save", void 0, {
|
|
9
|
-
F: __dxlog_file,
|
|
10
|
-
L: 16,
|
|
11
|
-
S: void 0,
|
|
12
|
-
C: (f, a) => f(...a)
|
|
13
|
-
});
|
|
8
|
+
log.warn("Already performing config save", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 9, S: void 0 });
|
|
14
9
|
return;
|
|
15
10
|
}
|
|
16
11
|
PERFORMING_CONFIG_SAVE = true;
|
|
@@ -19,12 +14,7 @@ var SaveConfig = async (config) => {
|
|
|
19
14
|
} catch (err) {
|
|
20
15
|
log.warn("Failed to save config", {
|
|
21
16
|
err
|
|
22
|
-
}, {
|
|
23
|
-
F: __dxlog_file,
|
|
24
|
-
L: 24,
|
|
25
|
-
S: void 0,
|
|
26
|
-
C: (f, a) => f(...a)
|
|
27
|
-
});
|
|
17
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 16, S: void 0 });
|
|
28
18
|
} finally {
|
|
29
19
|
PERFORMING_CONFIG_SAVE = false;
|
|
30
20
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/savers/browser.ts"],
|
|
4
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\nlet PERFORMING_CONFIG_SAVE = false;\n\nexport const SaveConfig = async (config: ConfigProto): Promise<void> => {\n if (PERFORMING_CONFIG_SAVE) {\n log.warn('Already performing config save');\n return;\n }\n PERFORMING_CONFIG_SAVE = true;\n\n try {\n await localforage.setItem('org.dxos.settings.config', config);\n } catch (err) {\n log.warn('Failed to save config', { err });\n } finally {\n PERFORMING_CONFIG_SAVE = false;\n }\n};\n"],
|
|
5
|
-
"mappings": ";AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;
|
|
6
|
-
"names": ["localforage", "log", "PERFORMING_CONFIG_SAVE", "
|
|
5
|
+
"mappings": ";AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;AAGpB,IAAIC,eAAAA;IAGF,yBAAIA;IACEC,aAAK,OAAA,WAAA;MACT,wBAAA;AACF,QAAA,KAAA,kCAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,GAAA,GAAA,OAAA,CAAA;AACAD;EAEA;2BACoBE;AACpB,MAAE;AACAH,UAAIE,YAAK,QAAA,4BAAyB,MAAA;WAAEE,KAAAA;AAAI,QAAA,KAAA,yBAAA;MAC1C;IACEH,GAAAA,EAAAA,YAAAA,YAAyB,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;EAC3B,UAAA;AACA,6BAAA;;;",
|
|
6
|
+
"names": ["localforage", "log", "PERFORMING_CONFIG_SAVE", "warn", "setItem", "err"]
|
|
7
7
|
}
|