@dxos/config 0.8.4-main.c85a9c8dae → 0.8.4-main.d05673bc65

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.
@@ -22,8 +22,7 @@ import * as Effect from "effect/Effect";
22
22
  import * as Layer from "effect/Layer";
23
23
  import * as Option from "effect/Option";
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 = `${getProfilePath(DX_CONFIG, args.profile)}.yml`;
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,10 +85,11 @@ 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
- yield* fs.makeDirectory(dirname(defaultConfigPath), {
88
+ const pathToCreate = Option.getOrElse(args.config, () => defaultConfigPath);
89
+ yield* fs.makeDirectory(dirname(pathToCreate), {
90
90
  recursive: true
91
91
  });
92
- yield* fs.writeFileString(defaultConfigPath, Yaml.stringify(configValues));
92
+ yield* fs.writeFileString(pathToCreate, Yaml.stringify(configValues));
93
93
  return _ConfigService.of(new Config(configValues));
94
94
  }))
95
95
  );
@@ -98,7 +98,7 @@ var ConfigService = class _ConfigService extends Context.Tag("ConfigService")()
98
98
  var profileBuiltinDefaults = (profile) => {
99
99
  invariant(!profile.endsWith(".yml"), void 0, {
100
100
  F: __dxlog_file,
101
- L: 100,
101
+ L: 99,
102
102
  S: void 0,
103
103
  A: [
104
104
  "!profile.endsWith('.yml')",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { dirname } from 'node:path';\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 * as Yaml from 'yaml';\n\nimport { DX_CONFIG, DX_DATA } from '@dxos/client-protocol';\nimport { 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 = `${getProfilePath(DX_CONFIG, args.profile)}.yml`;\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 yield* fs.makeDirectory(dirname(defaultConfigPath), { recursive: true });\n yield* fs.writeFileString(defaultConfigPath, Yaml.stringify(configValues));\n\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 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,SAASC,eAAe;AAExB,YAAYC,gBAAgB;AAC5B,YAAYC,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,UAAU;AAEtB,SAASC,WAAWC,eAAe;AACnC,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;;AAInB,IAAMC,eAAe,IAAIC,OAAO;EACrCC,SAAS;IACPC,QAAQ;MACNC,cAAc;QACZC,gBAAgB;QAChBC,gBAAgB;QAChBC,WAAW;QACXC,QAAQ;MACV;IACF;EACF;AACF,CAAA;AAEO,IAAMC,gBAAgB,IAAIR,OAAO;EACtCC,SAAS;IACPC,QAAQ;MACNC,cAAc;QACZC,gBAAgB;QAChBC,gBAAgB;QAChBC,WAAW;QACXC,QAAQ;MACV;MACAE,SAAS;QACPC,YAAY;MACd;IACF;IACAC,UAAU;MACRC,MAAM;QACJC,KAAK;MACP;MACAC,cAAc;QACZ;UACEC,MAAM;QACR;;MAEFC,IAAI;QACFC,QAAQ;MACV;MACAC,MAAM;QACJD,QAAQ;QACRE,SAAS;MACX;IACF;EACF;AACF,CAAA;AAEO,IAAMC,gBAAN,MAAMA,uBAA8BC,YAAI,eAAA,EAAA,EAAA;EAC7C,OAAOC,cAAoBC,aAAOH,gBAAsBI,eAAQzB,YAAAA,CAAAA;EAEhE,OAAO0B,aAAa,CAACC,WAAyBF,cAAQJ,gBAAeM,MAAAA;EAErE,OAAOC,OAAO,CAACC,S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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", "dirname", "FileSystem", "Context", "Effect", "Layer", "Option", "Yaml", "DX_CONFIG", "DX_DATA", "getProfilePath", "invariant", "memoryConfig", "Config", "runtime", "client", "edgeFeatures", "echoReplicator", "feedReplicator", "signaling", "agents", "defaultConfig", "storage", "persistent", "services", "edge", "url", "iceProviders", "urls", "ai", "server", "ipfs", "gateway", "ConfigService", "Tag", "layerMemory", "effect", "succeed", "fromConfig", "config", "load", "args", "defaultConfigPath", "getProfilePath", "DX_CONFIG", "profile", "gen", "fs", "FileSystem", "configPath", "getOrElse", "configContent", "readFileString", "configValues", "parse", "of", "profileBuiltinDefaults", "values", "pipe", "catchTag", "makeDirectory", "dirname", "recursive", "writeFileString", "stringify", "invariant", "endsWith", "dataRoot", "DX_DATA", "Match", "configPreset", "edge", "Config", "version", "runtime", "client", "edgeFeatures", "signaling", "echoReplicator", "feedReplicator", "services", "url", "value", "pipe", "when", "exhaustive"]
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 { dirname } from 'node:path';\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 * 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 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,SAASC,eAAe;AAExB,YAAYC,gBAAgB;AAC5B,YAAYC,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,UAAU;AAEtB,SAASC,WAAWC,SAASC,sBAAsBC,sBAAsB;AACzE,SAASC,iBAAiB;;AAInB,IAAMC,eAAe,IAAIC,OAAO;EACrCC,SAAS;IACPC,QAAQ;MACNC,cAAc;QACZC,gBAAgB;QAChBC,gBAAgB;QAChBC,WAAW;QACXC,QAAQ;MACV;IACF;EACF;AACF,CAAA;AAEO,IAAMC,gB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AG,IAAI1C,OAAOwC,YAAAA,CAAAA;MACrC,CAAA,CAAA;IAAA;EAGN;AACF;AAMA,IAAMG,yBAAyB,CAACX,YAAAA;AAC9BqB,YAAU,CAACrB,QAAQsB,SAAS,MAAA,GAAA,QAAA;;;;;;;;;AAE5B,SAAO,IAAItD,OAAO;IAChBC,SAAS;MACPC,QAAQ;QACNC,cAAc;UACZC,gBAAgB;UAChBC,gBAAgB;UAChBC,WAAW;UACXC,QAAQ;QACV;QACAE,SAAS;UACPC,YAAY;UACZ6C,UAAUC,eAAeC,SAASzB,OAAAA;QACpC;MACF;IACF;EACF,CAAA;AACF;;;ADzGA,cAAc;AACd,cAAc;AACd,cAAc;;;AETd,YAAY0B,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", "dirname", "FileSystem", "Context", "Effect", "Layer", "Option", "Yaml", "DX_CONFIG", "DX_DATA", "getProfileConfigPath", "getProfilePath", "invariant", "memoryConfig", "Config", "runtime", "client", "edgeFeatures", "echoReplicator", "feedReplicator", "signaling", "agents", "defaultConfig", "storage", "persistent", "services", "edge", "url", "iceProviders", "urls", "ai", "server", "ipfs", "gateway", "ConfigService", "Tag", "layerMemory", "effect", "succeed", "fromConfig", "config", "load", "args", "defaultConfigPath", "getProfileConfigPath", "DX_CONFIG", "profile", "gen", "fs", "FileSystem", "configPath", "getOrElse", "configContent", "readFileString", "configValues", "parse", "of", "profileBuiltinDefaults", "values", "pipe", "catchTag", "pathToCreate", "makeDirectory", "dirname", "recursive", "writeFileString", "stringify", "invariant", "endsWith", "dataRoot", "getProfilePath", "DX_DATA", "Match", "configPreset", "edge", "Config", "version", "runtime", "client", "edgeFeatures", "signaling", "echoReplicator", "feedReplicator", "services", "url", "value", "pipe", "when", "exhaustive"]
7
7
  }
@@ -44,7 +44,7 @@ var Defaults = (_basePath) => {
44
44
  };
45
45
  var Storage = async () => {
46
46
  try {
47
- const config = await localforage.getItem("dxos.org/settings/config");
47
+ const config = await localforage.getItem("org.dxos.settings.config");
48
48
  if (config) {
49
49
  return config;
50
50
  }
@@ -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.org/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"],
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
5
  "mappings": ";AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;AAJuD,IAAA,eAAA;AAY3E,IAAMC,kBAAkB;AAEjB,IAAMC,UAAU,CAACC,WAAW,eAAqC,CAAC;AAElE,IAAMC,QAAQ,MAAA;AACnB,SAAO,OAAOC,qBAAqB,cAAcA,mBAAmB,CAAC;AACvE;AAEO,IAAMC,WAAW,YAAA;AACtB,QAAM,EAAEC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"__CONFIG_LOCAL__", "Dynamics", "publicUrl", "dynamic", "__DXOS_CONFIG__", "fetch", "then", "res", "json", "catch", "error", "warn", "Envs", "_basePath", "__CONFIG_ENVS__", "Defaults", "__CONFIG_DEFAULTS__", "Storage", "config", "getItem", "err", "Remote", "target", "authenticationToken", "url", "URL", "protocol", "slice", "runtime", "client", "remoteSource", "origin", "startsWith", "remoteSourceAuthenticationToken"]
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":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-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/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-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":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}}}
@@ -15,7 +15,7 @@ var SaveConfig = async (config) => {
15
15
  }
16
16
  PERFORMING_CONFIG_SAVE = true;
17
17
  try {
18
- await localforage.setItem("dxos.org/settings/config", config);
18
+ await localforage.setItem("org.dxos.settings.config", config);
19
19
  } catch (err) {
20
20
  log.warn("Failed to save config", {
21
21
  err
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/savers/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\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('dxos.org/settings/config', config);\n } catch (err) {\n log.warn('Failed to save config', { err });\n } finally {\n PERFORMING_CONFIG_SAVE = false;\n }\n};\n"],
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
5
  "mappings": ";AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;AAJuD,IAAA,eAAA;AAO3E,IAAIC,yBAAyB;AAEtB,IAAMC,aAAa,OAAOC,WAAAA;AAC/B,MAAIF,wBAAwB;AAC1BD,QAAII,KAAK,kCAAA,QAAA;;;;;;AACT;EACF;AACAH,2BAAyB;AAEzB,MAAI;AACF,UAAMF,YAAYM,QAAQ,4BAA4BF,MAAAA;EACxD,SAASG,KAAK;AACZN,QAAII,KAAK,yBAAyB;MAAEE;IAAI,GAAA;;;;;;EAC1C,UAAA;AACEL,6BAAyB;EAC3B;AACF;",
6
6
  "names": ["localforage", "log", "PERFORMING_CONFIG_SAVE", "SaveConfig", "config", "warn", "setItem", "err"]
7
7
  }
@@ -23,8 +23,7 @@ import * as Effect from "effect/Effect";
23
23
  import * as Layer from "effect/Layer";
24
24
  import * as Option from "effect/Option";
25
25
  import * as Yaml from "yaml";
26
- import { DX_CONFIG, DX_DATA } from "@dxos/client-protocol";
27
- import { getProfilePath } from "@dxos/client-protocol";
26
+ import { DX_CONFIG, DX_DATA, getProfileConfigPath, getProfilePath } from "@dxos/client-protocol";
28
27
  import { invariant } from "@dxos/invariant";
29
28
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/config/src/config-service.ts";
30
29
  var memoryConfig = new Config({
@@ -75,7 +74,7 @@ var ConfigService = class _ConfigService extends Context.Tag("ConfigService")()
75
74
  static layerMemory = Layer.effect(_ConfigService, Effect.succeed(memoryConfig));
76
75
  static fromConfig = (config) => Layer.succeed(_ConfigService, config);
77
76
  static load = (args) => {
78
- const defaultConfigPath = `${getProfilePath(DX_CONFIG, args.profile)}.yml`;
77
+ const defaultConfigPath = getProfileConfigPath(DX_CONFIG, args.profile);
79
78
  return Effect.gen(function* () {
80
79
  const fs = yield* FileSystem.FileSystem;
81
80
  const configPath = Option.getOrElse(args.config, () => defaultConfigPath);
@@ -87,10 +86,11 @@ var ConfigService = class _ConfigService extends Context.Tag("ConfigService")()
87
86
  Effect.catchTag("SystemError", () => Effect.gen(function* () {
88
87
  const configValues = defaultConfig.values;
89
88
  const fs = yield* FileSystem.FileSystem;
90
- yield* fs.makeDirectory(dirname(defaultConfigPath), {
89
+ const pathToCreate = Option.getOrElse(args.config, () => defaultConfigPath);
90
+ yield* fs.makeDirectory(dirname(pathToCreate), {
91
91
  recursive: true
92
92
  });
93
- yield* fs.writeFileString(defaultConfigPath, Yaml.stringify(configValues));
93
+ yield* fs.writeFileString(pathToCreate, Yaml.stringify(configValues));
94
94
  return _ConfigService.of(new Config(configValues));
95
95
  }))
96
96
  );
@@ -99,7 +99,7 @@ var ConfigService = class _ConfigService extends Context.Tag("ConfigService")()
99
99
  var profileBuiltinDefaults = (profile) => {
100
100
  invariant(!profile.endsWith(".yml"), void 0, {
101
101
  F: __dxlog_file,
102
- L: 100,
102
+ L: 99,
103
103
  S: void 0,
104
104
  A: [
105
105
  "!profile.endsWith('.yml')",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { dirname } from 'node:path';\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 * as Yaml from 'yaml';\n\nimport { DX_CONFIG, DX_DATA } from '@dxos/client-protocol';\nimport { 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 = `${getProfilePath(DX_CONFIG, args.profile)}.yml`;\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 yield* fs.makeDirectory(dirname(defaultConfigPath), { recursive: true });\n yield* fs.writeFileString(defaultConfigPath, Yaml.stringify(configValues));\n\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 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,SAASC,eAAe;AAExB,YAAYC,gBAAgB;AAC5B,YAAYC,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,UAAU;AAEtB,SAASC,WAAWC,eAAe;AACnC,SAASC,sBAAsB;AAC/B,SAASC,iBAAiB;;AAInB,IAAMC,eAAe,IAAIC,OAAO;EACrCC,SAAS;IACPC,QAAQ;MACNC,cAAc;QACZC,gBAAgB;QAChBC,gBAAgB;QAChBC,WAAW;QACXC,QAAQ;MACV;IACF;EACF;AACF,CAAA;AAEO,IAAMC,gBAAgB,IAAIR,OAAO;EACtCC,SAAS;IACPC,QAAQ;MACNC,cAAc;QACZC,gBAAgB;QAChBC,gBAAgB;QAChBC,WAAW;QACXC,QAAQ;MACV;MACAE,SAAS;QACPC,YAAY;MACd;IACF;IACAC,UAAU;MACRC,MAAM;QACJC,KAAK;MACP;MACAC,cAAc;QACZ;UACEC,MAAM;QACR;;MAEFC,IAAI;QACFC,QAAQ;MACV;MACAC,MAAM;QACJD,QAAQ;QACRE,SAAS;MACX;IACF;EACF;AACF,CAAA;AAEO,IAAMC,gBAAN,MAAMA,uBAA8BC,YAAI,eAAA,EAAA,EAAA;EAC7C,OAAOC,cAAoBC,aAAOH,gBAAsBI,eAAQzB,YAAAA,CAAAA;EAEhE,OAAO0B,aAAa,CAACC,WAAyBF,cAAQ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C,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", "dirname", "FileSystem", "Context", "Effect", "Layer", "Option", "Yaml", "DX_CONFIG", "DX_DATA", "getProfilePath", "invariant", "memoryConfig", "Config", "runtime", "client", "edgeFeatures", "echoReplicator", "feedReplicator", "signaling", "agents", "defaultConfig", "storage", "persistent", "services", "edge", "url", "iceProviders", "urls", "ai", "server", "ipfs", "gateway", "ConfigService", "Tag", "layerMemory", "effect", "succeed", "fromConfig", "config", "load", "args", "defaultConfigPath", "getProfilePath", "DX_CONFIG", "profile", "gen", "fs", "FileSystem", "configPath", "getOrElse", "configContent", "readFileString", "configValues", "parse", "of", "profileBuiltinDefaults", "values", "pipe", "catchTag", "makeDirectory", "dirname", "recursive", "writeFileString", "stringify", "invariant", "endsWith", "dataRoot", "DX_DATA", "Match", "configPreset", "edge", "Config", "version", "runtime", "client", "edgeFeatures", "signaling", "echoReplicator", "feedReplicator", "services", "url", "value", "pipe", "when", "exhaustive"]
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 { dirname } from 'node:path';\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 * 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 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,SAASC,eAAe;AAExB,YAAYC,gBAAgB;AAC5B,YAAYC,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,UAAU;AAEtB,SAASC,WAAWC,SAASC,sBAAsBC,sBAAsB;AACzE,SAASC,iBAAiB;;AAInB,IAAMC,eAAe,IAAIC,OAAO;EACrCC,SAAS;IACPC,QAAQ;MACNC,cAAc;QACZC,gBAAgB;QAChBC,gBAAgB;QAChBC,WAAW;QACXC,Q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AAUZ,YAAAA,CAAAA;AACvD,eAAOpB,eAAcsB,GAAG,IAAI1C,OAAOwC,YAAAA,CAAAA;MACrC,CAAA,CAAA;IAAA;EAGN;AACF;AAMA,IAAMG,yBAAyB,CAACX,YAAAA;AAC9BqB,YAAU,CAACrB,QAAQsB,SAAS,MAAA,GAAA,QAAA;;;;;;;;;AAE5B,SAAO,IAAItD,OAAO;IAChBC,SAAS;MACPC,QAAQ;QACNC,cAAc;UACZC,gBAAgB;UAChBC,gBAAgB;UAChBC,WAAW;UACXC,QAAQ;QACV;QACAE,SAAS;UACPC,YAAY;UACZ6C,UAAUC,eAAeC,SAASzB,OAAAA;QACpC;MACF;IACF;EACF,CAAA;AACF;;;ADzGA,cAAc;AACd,cAAc;AACd,cAAc;;;AETd,YAAY0B,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", "dirname", "FileSystem", "Context", "Effect", "Layer", "Option", "Yaml", "DX_CONFIG", "DX_DATA", "getProfileConfigPath", "getProfilePath", "invariant", "memoryConfig", "Config", "runtime", "client", "edgeFeatures", "echoReplicator", "feedReplicator", "signaling", "agents", "defaultConfig", "storage", "persistent", "services", "edge", "url", "iceProviders", "urls", "ai", "server", "ipfs", "gateway", "ConfigService", "Tag", "layerMemory", "effect", "succeed", "fromConfig", "config", "load", "args", "defaultConfigPath", "getProfileConfigPath", "DX_CONFIG", "profile", "gen", "fs", "FileSystem", "configPath", "getOrElse", "configContent", "readFileString", "configValues", "parse", "of", "profileBuiltinDefaults", "values", "pipe", "catchTag", "pathToCreate", "makeDirectory", "dirname", "recursive", "writeFileString", "stringify", "invariant", "endsWith", "dataRoot", "getProfilePath", "DX_DATA", "Match", "configPreset", "edge", "Config", "version", "runtime", "client", "edgeFeatures", "signaling", "echoReplicator", "feedReplicator", "services", "url", "value", "pipe", "when", "exhaustive"]
7
7
  }
@@ -46,7 +46,7 @@ var Defaults = (_basePath) => {
46
46
  };
47
47
  var Storage = async () => {
48
48
  try {
49
- const config = await localforage.getItem("dxos.org/settings/config");
49
+ const config = await localforage.getItem("org.dxos.settings.config");
50
50
  if (config) {
51
51
  return config;
52
52
  }
@@ -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.org/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"],
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
5
  "mappings": ";;;AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;AAJuD,IAAA,eAAA;AAY3E,IAAMC,kBAAkB;AAEjB,IAAMC,UAAU,CAACC,WAAW,eAAqC,CAAC;AAElE,IAAMC,QAAQ,MAAA;AACnB,SAAO,OAAOC,qBAAqB,cAAcA,mBAAmB,CAAC;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"names": ["localforage", "log", "CONFIG_ENDPOINT", "Profile", "_profile", "Local", "__CONFIG_LOCAL__", "Dynamics", "publicUrl", "dynamic", "__DXOS_CONFIG__", "fetch", "then", "res", "json", "catch", "error", "warn", "Envs", "_basePath", "__CONFIG_ENVS__", "Defaults", "__CONFIG_DEFAULTS__", "Storage", "config", "getItem", "err", "Remote", "target", "authenticationToken", "url", "URL", "protocol", "slice", "runtime", "client", "remoteSource", "origin", "startsWith", "remoteSourceAuthenticationToken"]
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":12105,"imports":[{"path":"node: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":"node:fs","kind":"import-statement","external":true},{"path":"node: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":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node: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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8219},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ODEKAZ4J.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-YHGABJ7Y.mjs","kind":"import-statement"},{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"node: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":3206},"src/preset.ts":{"bytesInOutput":617}},"bytes":4588},"dist/lib/node-esm/loaders/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4122},"dist/lib/node-esm/loaders/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ODEKAZ4J.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-YHGABJ7Y.mjs","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node: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":1547}},"bytes":1913},"dist/lib/node-esm/chunk-ODEKAZ4J.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1815},"dist/lib/node-esm/chunk-ODEKAZ4J.mjs":{"imports":[],"exports":["FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS"],"inputs":{"src/types.ts":{"bytesInOutput":102}},"bytes":314},"dist/lib/node-esm/loaders/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4407},"dist/lib/node-esm/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":2388},"dist/lib/node-esm/savers/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":360},"dist/lib/node-esm/savers/index.mjs":{"imports":[],"exports":["SaveConfig"],"entryPoint":"src/savers/index.ts","inputs":{"src/savers/index.ts":{"bytesInOutput":35}},"bytes":211},"dist/lib/node-esm/savers/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1282},"dist/lib/node-esm/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":927},"dist/lib/node-esm/plugin/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5744},"dist/lib/node-esm/plugin/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-YHGABJ7Y.mjs","kind":"import-statement"},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node: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":3193},"src/plugin/index.ts":{"bytesInOutput":0}},"bytes":3436},"dist/lib/node-esm/chunk-YHGABJ7Y.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7891},"dist/lib/node-esm/chunk-YHGABJ7Y.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":4333},"dist/lib/node-esm/plugin/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":496},"dist/lib/node-esm/plugin/browser.mjs":{"imports":[],"exports":["definitions"],"entryPoint":"src/plugin/browser.ts","inputs":{"src/plugin/browser.ts":{"bytesInOutput":110}},"bytes":291}}}
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":"node: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":"node:fs","kind":"import-statement","external":true},{"path":"node: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":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node: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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8368},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ODEKAZ4J.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-YHGABJ7Y.mjs","kind":"import-statement"},{"path":"@dxos/protocols/proto/dxos/config","kind":"import-statement","external":true},{"path":"node: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":3259},"src/preset.ts":{"bytesInOutput":617}},"bytes":4641},"dist/lib/node-esm/loaders/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4122},"dist/lib/node-esm/loaders/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-ODEKAZ4J.mjs","kind":"import-statement"},{"path":"dist/lib/node-esm/chunk-YHGABJ7Y.mjs","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node: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":1547}},"bytes":1913},"dist/lib/node-esm/chunk-ODEKAZ4J.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1815},"dist/lib/node-esm/chunk-ODEKAZ4J.mjs":{"imports":[],"exports":["FILE_DEFAULTS","FILE_DYNAMICS","FILE_ENVS"],"inputs":{"src/types.ts":{"bytesInOutput":102}},"bytes":314},"dist/lib/node-esm/loaders/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":4407},"dist/lib/node-esm/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":2388},"dist/lib/node-esm/savers/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":360},"dist/lib/node-esm/savers/index.mjs":{"imports":[],"exports":["SaveConfig"],"entryPoint":"src/savers/index.ts","inputs":{"src/savers/index.ts":{"bytesInOutput":35}},"bytes":211},"dist/lib/node-esm/savers/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":1282},"dist/lib/node-esm/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":927},"dist/lib/node-esm/plugin/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":5744},"dist/lib/node-esm/plugin/index.mjs":{"imports":[{"path":"dist/lib/node-esm/chunk-YHGABJ7Y.mjs","kind":"import-statement"},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node: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":3193},"src/plugin/index.ts":{"bytesInOutput":0}},"bytes":3436},"dist/lib/node-esm/chunk-YHGABJ7Y.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7891},"dist/lib/node-esm/chunk-YHGABJ7Y.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":4333},"dist/lib/node-esm/plugin/browser.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":496},"dist/lib/node-esm/plugin/browser.mjs":{"imports":[],"exports":["definitions"],"entryPoint":"src/plugin/browser.ts","inputs":{"src/plugin/browser.ts":{"bytesInOutput":110}},"bytes":291}}}
@@ -17,7 +17,7 @@ var SaveConfig = async (config) => {
17
17
  }
18
18
  PERFORMING_CONFIG_SAVE = true;
19
19
  try {
20
- await localforage.setItem("dxos.org/settings/config", config);
20
+ await localforage.setItem("org.dxos.settings.config", config);
21
21
  } catch (err) {
22
22
  log.warn("Failed to save config", {
23
23
  err
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/savers/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\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('dxos.org/settings/config', config);\n } catch (err) {\n log.warn('Failed to save config', { err });\n } finally {\n PERFORMING_CONFIG_SAVE = false;\n }\n};\n"],
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
5
  "mappings": ";;;AAMA,OAAOA,iBAAiB;AAExB,SAASC,WAAW;AAJuD,IAAA,eAAA;AAO3E,IAAIC,yBAAyB;AAEtB,IAAMC,aAAa,OAAOC,WAAAA;AAC/B,MAAIF,wBAAwB;AAC1BD,QAAII,KAAK,kCAAA,QAAA;;;;;;AACT;EACF;AACAH,2BAAyB;AAEzB,MAAI;AACF,UAAMF,YAAYM,QAAQ,4BAA4BF,MAAAA;EACxD,SAASG,KAAK;AACZN,QAAII,KAAK,yBAAyB;MAAEE;IAAI,GAAA;;;;;;EAC1C,UAAA;AACEL,6BAAyB;EAC3B;AACF;",
6
6
  "names": ["localforage", "log", "PERFORMING_CONFIG_SAVE", "SaveConfig", "config", "warn", "setItem", "err"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"config-service.d.ts","sourceRoot":"","sources":["../../../src/config-service.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAOxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,YAAY,QAWvB,CAAC;AAEH,eAAO,MAAM,aAAa,QA+BxB,CAAC;;AAEH,qBAAa,aAAc,SAAQ,kBAAqD;IACtF,MAAM,CAAC,WAAW,2CAA6D;IAE/E,MAAM,CAAC,UAAU,GAAI,QAAQ,MAAM,8CAA0C;IAE7E,MAAM,CAAC,IAAI,GAAI,MAAM;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,kGAqBrE;CACH"}
1
+ {"version":3,"file":"config-service.d.ts","sourceRoot":"","sources":["../../../src/config-service.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAMxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,YAAY,QAWvB,CAAC;AAEH,e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