everything-dev 1.28.3 → 1.28.4
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/config.cjs +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.mjs +1 -1
- package/dist/config.mjs.map +1 -1
- package/dist/contract.d.cts +2 -2
- package/dist/contract.d.mts +2 -2
- package/dist/plugin.d.cts +2 -2
- package/dist/plugin.d.mts +2 -2
- package/dist/types.cjs +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/types.mjs +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/dist/config.cjs
CHANGED
|
@@ -347,7 +347,7 @@ function buildRuntimeConfig(config, baseDir, env, options) {
|
|
|
347
347
|
},
|
|
348
348
|
shared: config.shared,
|
|
349
349
|
ui: {
|
|
350
|
-
name: uiConfig.name,
|
|
350
|
+
name: resolvePluginRuntimeName(uiConfig.name, uiRuntime.localPath, "ui"),
|
|
351
351
|
url: uiRuntime.url,
|
|
352
352
|
entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : "/mf-manifest.json",
|
|
353
353
|
localPath: uiRuntime.localPath,
|
package/dist/config.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","names":["BosConfigSchema","isPlainObject","bosConfigMerger","rebuildOrderedConfig","resolveExtendsRef","getNetworkIdForAccount","fetchBosConfigFromFastKv","mergeBosConfigWithExtends"],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fetchBosConfigFromFastKv } from \"./fastkv\";\nimport {\n type BosEnv,\n bosConfigMerger,\n isPlainObject,\n mergeBosConfigWithExtends,\n type ResolvedConfigMeta,\n rebuildOrderedConfig,\n resolveExtendsRef,\n} from \"./merge\";\nimport { getNetworkIdForAccount } from \"./network\";\nimport type {\n BosConfig,\n BosConfigInput,\n BosPluginRef,\n ExtendsConfig,\n PluginEntryValue,\n RuntimeConfig,\n RuntimePluginConfig,\n} from \"./types\";\nimport { BosConfigSchema } from \"./types\";\n\nconst LOCAL_PREFIX = \"local:\";\nconst DEFAULT_HOST_PORT = 3000;\nconst RESOLVED_CONFIG_FILENAME = \"bos.resolved-config.json\";\n\ntype RuntimeOverrideTarget = \"ui\" | \"api\" | \"plugins\" | `plugins.${string}`;\n\ninterface RuntimeTarget {\n source: \"local\" | \"remote\";\n url: string;\n localPath?: string;\n port?: number;\n}\n\nlet cachedConfig: BosConfig | null = null;\nlet projectRoot: string | null = null;\nlet configWarnings: string[] = [];\nlet suppressConfigWarnings = false;\n\nexport function clearConfigCache(): void {\n cachedConfig = null;\n projectRoot = null;\n configWarnings = [];\n}\n\nexport function suppressWarnings(): void {\n suppressConfigWarnings = true;\n}\n\nexport function resumeWarnings(): void {\n suppressConfigWarnings = false;\n}\n\nexport function drainConfigWarnings(): string[] {\n const warnings = [...configWarnings];\n configWarnings = [];\n return warnings;\n}\n\nfunction emitConfigWarning(message: string): void {\n if (suppressConfigWarnings) {\n configWarnings.push(message);\n } else {\n console.warn(message);\n }\n}\n\nexport function findConfigPath(cwd?: string): string | null {\n let dir = cwd ?? process.cwd();\n while (dir !== \"/\") {\n const configPath = join(dir, \"bos.config.json\");\n if (existsSync(configPath)) {\n return configPath;\n }\n dir = dirname(dir);\n }\n return null;\n}\n\nexport function getConfig(): BosConfig | null {\n return cachedConfig;\n}\n\nexport function getProjectRoot(): string {\n if (!projectRoot) {\n throw new Error(\"Config not loaded. Call loadConfig() first.\");\n }\n return projectRoot;\n}\n\nexport interface ConfigResult {\n config: BosConfig;\n runtime: RuntimeConfig;\n source: {\n path: string;\n extended?: string[];\n remote?: boolean;\n };\n warnings?: string[];\n}\n\nexport interface RemoteConfigResult {\n rawConfig: BosConfigInput;\n config: BosConfig;\n source: string;\n extendsChain: string[];\n}\n\nexport interface ResolvedComposableReference {\n entry: BosPluginRef;\n providerBaseDir: string;\n targetPath: string;\n associatedUi?: Record<string, unknown>;\n}\n\ninterface ParsedExtendsTarget {\n configPath: string;\n targetPath?: string;\n}\n\nexport async function loadConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<ConfigResult | null> {\n const configPath = options?.path ?? findConfigPath(options?.cwd);\n if (!configPath) {\n projectRoot = options?.cwd ?? process.cwd();\n return null;\n }\n\n const baseDir = dirname(configPath);\n const env = options?.env ?? \"development\";\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n\n try {\n suppressWarnings();\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n configPath,\n baseDir,\n new Set(),\n extendedChain,\n env,\n );\n const config = await resolveConfigComposableEntries(\n BosConfigSchema.parse(parsed),\n baseDir,\n runtimeEnv,\n );\n\n cachedConfig = config;\n projectRoot = baseDir;\n\n const pluginRuntime = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv);\n const runtime = buildRuntimeConfig(config, baseDir, runtimeEnv, {\n plugins: pluginRuntime,\n });\n const warnings = drainConfigWarnings();\n resumeWarnings();\n\n return {\n config,\n runtime,\n source: {\n path: configPath,\n extended: extendedChain.length > 0 ? extendedChain : undefined,\n remote: extendedChain.some((entry) => entry.startsWith(\"bos://\")),\n },\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n } catch (error) {\n resumeWarnings();\n throw new Error(`Failed to load config from ${configPath}: ${error}`);\n }\n}\n\nexport async function loadBosConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<RuntimeConfig> {\n const result = await loadConfig(options);\n if (!result) {\n throw new Error(\"No bos.config.json found\");\n }\n\n return result.runtime;\n}\n\nexport async function loadRemoteConfig(\n bosUrl: string,\n env: BosEnv = \"production\",\n): Promise<RemoteConfigResult> {\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n bosUrl,\n process.cwd(),\n new Set(),\n extendedChain,\n env,\n );\n const config = await resolveConfigComposableEntries(\n BosConfigSchema.parse(parsed),\n process.cwd(),\n runtimeEnv,\n );\n\n return {\n rawConfig: await loadConfigFile(bosUrl, process.cwd()),\n config,\n source: bosUrl,\n extendsChain: extendedChain,\n };\n}\n\nexport function parseRuntimeOverrideTargets(value?: string | null): RuntimeOverrideTarget[] {\n if (!value) {\n return [];\n }\n\n return [\n ...new Set(\n value\n .split(\",\")\n .map((entry) => entry.trim())\n .filter(Boolean),\n ),\n ].map((entry) => {\n if (entry === \"ui\" || entry === \"api\" || entry === \"plugins\") {\n return entry;\n }\n\n if (entry.startsWith(\"plugins.\") && entry.length > \"plugins.\".length) {\n return entry as RuntimeOverrideTarget;\n }\n\n throw new Error(`Invalid runtime override target: ${entry}`);\n });\n}\n\nexport function isRuntimeOverrideAllowed(\n allowedTargets: ReadonlyArray<RuntimeOverrideTarget>,\n target: \"ui\" | \"api\" | \"plugins\" | `plugins.${string}`,\n): boolean {\n if (allowedTargets.includes(target as RuntimeOverrideTarget)) {\n return true;\n }\n\n if (target.startsWith(\"plugins.\")) {\n return allowedTargets.includes(\"plugins.*\");\n }\n\n return false;\n}\n\nexport async function buildRuntimePluginsForConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig> | undefined> {\n const plugins = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, env);\n return Object.keys(plugins).length > 0 ? plugins : undefined;\n}\n\nfunction getEntryAssociatedUi(entry: Partial<BosPluginRef>): Record<string, unknown> | undefined {\n if (!isPlainObject(entry.app)) {\n return undefined;\n }\n\n const app = entry.app as Record<string, unknown>;\n return isPlainObject(app.ui) ? (app.ui as Record<string, unknown>) : undefined;\n}\n\nfunction mergeAssociatedUi(\n parentUi: Record<string, unknown> | undefined,\n childUi: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n if (!parentUi) {\n return childUi ? { ...childUi } : undefined;\n }\n\n if (!childUi) {\n return { ...parentUi };\n }\n\n return bosConfigMerger({ ...childUi }, parentUi) as Record<string, unknown>;\n}\n\nfunction withAssociatedUi(\n entry: BosPluginRef,\n associatedUi?: Record<string, unknown>,\n): BosPluginRef {\n if (!associatedUi) {\n return entry;\n }\n\n const app = isPlainObject(entry.app)\n ? ({ ...(entry.app as Record<string, unknown>) } as Record<string, unknown>)\n : {};\n app.ui = mergeAssociatedUi(getEntryAssociatedUi(entry), associatedUi);\n\n return {\n ...entry,\n app,\n };\n}\n\nasync function resolveConfigComposableEntries(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<BosConfig> {\n const resolvedApi = await resolveComposableReference(\n config.app.api as BosPluginRef,\n baseDir,\n env,\n \"app.api\",\n );\n const resolvedAuth = config.app.auth\n ? await resolveComposableReference(config.app.auth as BosPluginRef, baseDir, env, \"app.auth\")\n : undefined;\n\n const resolvedPlugins = config.plugins\n ? Object.fromEntries(\n await Promise.all(\n Object.entries(config.plugins).map(async ([pluginId, pluginValue]) => {\n const resolvedPlugin = await resolveComposableReference(\n asComposableEntry(pluginValue),\n baseDir,\n env,\n `plugins.${pluginId}`,\n );\n\n return [\n pluginId,\n withAssociatedUi(resolvedPlugin.entry, resolvedPlugin.associatedUi),\n ] as const;\n }),\n ),\n )\n : undefined;\n\n return {\n ...config,\n app: {\n ...config.app,\n api: resolvedApi.entry,\n auth: resolvedAuth?.entry,\n },\n plugins: resolvedPlugins,\n };\n}\n\nexport function getResolvedConfigPath(configDir: string): string {\n return join(configDir, \".bos\", RESOLVED_CONFIG_FILENAME);\n}\n\nexport function loadResolvedConfig(configDir: string): BosConfig | null {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (!existsSync(resolvedPath)) return null;\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (!isPlainObject(raw)) return null;\n const { _resolved, ...configData } = raw;\n return BosConfigSchema.parse(configData);\n } catch {\n return null;\n }\n}\n\nexport function writeResolvedConfig(\n configDir: string,\n config: BosConfig,\n env: BosEnv,\n extendsChain?: string[],\n source?: string,\n): void {\n const resolvedPath = getResolvedConfigPath(configDir);\n const resolvedDir = dirname(resolvedPath);\n if (!existsSync(resolvedDir)) {\n mkdirSync(resolvedDir, { recursive: true });\n }\n\n const ordered = rebuildOrderedConfig(config);\n const meta: ResolvedConfigMeta = {\n env,\n resolvedAt: new Date().toISOString(),\n extendsChain: extendsChain ?? [],\n ...(source ? { source } : {}),\n };\n const output = {\n _resolved: meta,\n ...ordered,\n };\n\n const content = `${JSON.stringify(output, null, 2)}\\n`;\n try {\n if (readFileSync(resolvedPath, \"utf-8\") === content) return;\n } catch {\n // file doesn't exist yet\n }\n writeFileSync(resolvedPath, content);\n}\n\nexport function resolveBosConfigPath(configDir: string): string {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) return resolvedPath;\n return join(configDir, \"bos.config.json\");\n}\n\nexport function readBosConfigForBuild(configDir: string): Record<string, unknown> {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) {\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (isPlainObject(raw)) {\n const { _resolved, ...configData } = raw;\n return configData as Record<string, unknown>;\n }\n } catch {}\n }\n const bosConfigPath = join(configDir, \"bos.config.json\");\n return JSON.parse(readFileSync(bosConfigPath, \"utf-8\")) as Record<string, unknown>;\n}\n\nfunction parseExtendsTarget(ref: string): ParsedExtendsTarget {\n const hashIndex = ref.indexOf(\"#\");\n if (hashIndex === -1) {\n return { configPath: ref };\n }\n\n const configPath = ref.slice(0, hashIndex);\n const targetPath = ref.slice(hashIndex + 1);\n return {\n configPath,\n targetPath: targetPath.length > 0 ? targetPath : undefined,\n };\n}\n\nfunction getConfigBaseDir(configPath: string, baseDir: string): string {\n if (configPath.startsWith(\"bos://\")) return baseDir;\n return dirname(isAbsolute(configPath) ? configPath : resolve(baseDir, configPath));\n}\n\nfunction asComposableEntry(value: unknown): BosPluginRef {\n if (typeof value === \"string\") {\n return { extends: value };\n }\n if (!isPlainObject(value)) {\n throw new Error(`Expected config entry object, received ${typeof value}`);\n }\n return value as BosPluginRef;\n}\n\nfunction getTargetedEntry(config: BosConfigInput, targetPath: string): BosPluginRef {\n if (targetPath === \"app.api\") {\n return asComposableEntry(config.app?.api);\n }\n\n if (targetPath === \"app.auth\") {\n return asComposableEntry(config.app?.auth);\n }\n\n if (targetPath.startsWith(\"plugins.\")) {\n const pluginId = targetPath.slice(\"plugins.\".length);\n if (pluginId.length === 0) {\n throw new Error(`Invalid plugin target path: ${targetPath}`);\n }\n return asComposableEntry(config.plugins?.[pluginId]);\n }\n\n throw new Error(`Unsupported extends target path: ${targetPath}`);\n}\n\nfunction getAssociatedUi(\n config: BosConfigInput,\n _targetPath: string,\n): Record<string, unknown> | undefined {\n return isPlainObject(config.app?.ui) ? (config.app.ui as Record<string, unknown>) : undefined;\n}\n\nfunction mergeComposableEntries(\n parent: Partial<BosPluginRef>,\n child: Partial<BosPluginRef>,\n): BosPluginRef {\n return bosConfigMerger({ ...child }, parent) as BosPluginRef;\n}\n\nfunction stripUnsafeLocalDevelopment<T extends Record<string, unknown> | undefined>(\n entry: T,\n allowLocalPaths: boolean,\n): T {\n if (!entry || allowLocalPaths) {\n return entry;\n }\n\n if (typeof entry.development === \"string\" && entry.development.startsWith(LOCAL_PREFIX)) {\n const { development: _ignored, ...rest } = entry;\n return rest as T;\n }\n\n return entry;\n}\n\nexport async function resolveComposableReference(\n source: BosPluginRef,\n baseDir: string,\n env: BosEnv,\n defaultTargetPath: string,\n): Promise<ResolvedComposableReference> {\n let resolvedEntry: BosPluginRef = {};\n let providerBaseDir = baseDir;\n let targetPath = defaultTargetPath;\n let associatedUi = getEntryAssociatedUi(source);\n let allowLocalPaths = false;\n let extendsError: unknown;\n\n const extendsRef = source.extends ? resolveExtendsRef(source.extends, env) : undefined;\n if (extendsRef) {\n const parsed = parseExtendsTarget(extendsRef);\n targetPath = parsed.targetPath ?? defaultTargetPath;\n const extendsBaseDir = getConfigBaseDir(parsed.configPath, baseDir);\n try {\n const extendedConfig = await resolveConfigWithExtends(\n parsed.configPath,\n extendsBaseDir,\n new Set(),\n [],\n env,\n );\n resolvedEntry = mergeComposableEntries(\n resolvedEntry,\n getTargetedEntry(extendedConfig, targetPath),\n );\n providerBaseDir = extendsBaseDir;\n associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(extendedConfig, targetPath));\n } catch (error) {\n extendsError = error;\n }\n }\n\n const localDevelopment =\n typeof source.development === \"string\" && source.development.startsWith(LOCAL_PREFIX)\n ? source.development\n : undefined;\n const localDevelopmentPath = localDevelopment\n ? resolve(baseDir, localDevelopment.slice(LOCAL_PREFIX.length).trim())\n : undefined;\n const hasUsableLocalDevelopment = Boolean(\n localDevelopmentPath && existsSync(localDevelopmentPath),\n );\n\n if (localDevelopmentPath) {\n const localPath = localDevelopmentPath;\n const localConfigPath = join(localPath, \"bos.config.json\");\n if (existsSync(localConfigPath)) {\n const localConfig = await resolveConfigWithExtends(\n localConfigPath,\n localPath,\n new Set(),\n [],\n env,\n );\n resolvedEntry = mergeComposableEntries(\n resolvedEntry,\n getTargetedEntry(localConfig, targetPath),\n );\n providerBaseDir = localPath;\n associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(localConfig, targetPath));\n allowLocalPaths = true;\n }\n }\n\n const sourceOverrides = { ...source };\n if (allowLocalPaths && localDevelopment) {\n delete sourceOverrides.development;\n }\n\n resolvedEntry = mergeComposableEntries(resolvedEntry, sourceOverrides);\n associatedUi = mergeAssociatedUi(associatedUi, getEntryAssociatedUi(sourceOverrides));\n\n if (extendsError && !allowLocalPaths && !hasUsableLocalDevelopment) {\n throw extendsError;\n }\n\n return {\n entry: stripUnsafeLocalDevelopment(resolvedEntry, allowLocalPaths || Boolean(localDevelopment)),\n providerBaseDir,\n targetPath,\n associatedUi: stripUnsafeLocalDevelopment(associatedUi, allowLocalPaths),\n };\n}\n\nfunction resolveDevelopmentTarget(\n development: string | undefined,\n production: string | undefined,\n baseDir: string,\n forceSource?: \"local\" | \"remote\",\n target?: string,\n extendsRef?: string,\n): RuntimeTarget {\n if (forceSource === \"remote\") {\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n if (!development) {\n if (production && target) {\n if (extendsRef) {\n emitConfigWarning(`[Config] Resolving \"${target}\" from ${extendsRef}`);\n } else {\n emitConfigWarning(`[Config] No development target for \"${target}\", using production`);\n }\n }\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n const devTarget = resolveRuntimeTarget(development, baseDir);\n if (devTarget.source === \"local\" && (!devTarget.localPath || !existsSync(devTarget.localPath))) {\n if (production && target) {\n emitConfigWarning(`[Config] Could not load local target for \"${target}\", using production`);\n }\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n return devTarget;\n}\n\nexport interface BuildRuntimeConfigOptions {\n plugins?: Record<string, RuntimePluginConfig>;\n hostSource?: \"local\" | \"remote\";\n uiSource?: \"local\" | \"remote\";\n apiSource?: \"local\" | \"remote\";\n authSource?: \"local\" | \"remote\";\n proxy?: string;\n}\n\nexport function buildRuntimeConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n options?: BuildRuntimeConfigOptions,\n): RuntimeConfig {\n const uiConfig = config.app.ui;\n const apiConfig = config.app.api;\n const authConfig = config.app.auth;\n const uiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n uiConfig.development,\n uiConfig.production,\n baseDir,\n options?.uiSource,\n \"app.ui\",\n )\n : resolveRuntimeTarget(uiConfig.production, baseDir, \"remote\");\n const apiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n apiConfig.development,\n apiConfig.production,\n baseDir,\n options?.apiSource,\n \"app.api\",\n )\n : resolveRuntimeTarget(apiConfig.production, baseDir, \"remote\");\n const authExtendsRef = authConfig?.extends\n ? resolveExtendsRef(authConfig.extends, env)\n : undefined;\n const authRuntime = authConfig\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n authConfig.development,\n authConfig.production,\n baseDir,\n options?.authSource,\n \"app.auth\",\n authExtendsRef,\n )\n : resolveRuntimeTarget(authConfig.production, baseDir, \"remote\")\n : undefined;\n\n const hostConfig = config.app.host;\n const hostRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n hostConfig.development,\n hostConfig.production,\n baseDir,\n options?.hostSource,\n \"app.host\",\n )\n : resolveRuntimeTarget(hostConfig.production, baseDir, \"remote\");\n\n const hostListeningUrl =\n env === \"development\"\n ? resolveDevelopmentHostUrl(hostConfig.development)\n : `http://localhost:${hostRuntime.port ?? DEFAULT_HOST_PORT}`;\n\n const hostIsRemote = hostRuntime.source === \"remote\";\n const uiIsRemote = uiRuntime.source === \"remote\";\n const apiIsRemote = apiRuntime.source === \"remote\";\n const resolvedApiName = resolvePluginRuntimeName(apiConfig.name, apiRuntime.localPath, \"api\");\n\n return {\n env,\n account: config.account,\n domain: config.domain,\n title: config.title,\n description: config.description,\n networkId: getNetworkIdForAccount(config.account),\n repository: config.repository,\n host: {\n name: \"host\",\n url: hostListeningUrl,\n entry: `${hostListeningUrl}/mf-manifest.json`,\n localPath: hostRuntime.localPath,\n port: hostRuntime.port ?? DEFAULT_HOST_PORT,\n secrets: hostConfig.secrets,\n integrity: hostIsRemote ? hostConfig.integrity : undefined,\n source: hostRuntime.source,\n remoteUrl: hostIsRemote ? hostRuntime.url : undefined,\n },\n shared: config.shared,\n ui: {\n name: uiConfig.name,\n url: uiRuntime.url,\n entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n ssrUrl: uiIsRemote ? uiConfig.ssr : undefined,\n ssrIntegrity: uiIsRemote ? uiConfig.ssrIntegrity : undefined,\n integrity: uiIsRemote ? uiConfig.integrity : undefined,\n source: uiRuntime.source,\n },\n api: {\n name: resolvedApiName,\n url: apiRuntime.url,\n entry: apiRuntime.url ? `${apiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: apiRuntime.localPath,\n port: apiRuntime.port,\n source: apiRuntime.source,\n proxy: options?.proxy ?? apiConfig.proxy,\n variables: apiConfig.variables,\n secrets: apiConfig.secrets,\n integrity: apiIsRemote ? apiConfig.integrity : undefined,\n },\n auth: (() => {\n if (!authConfig || !authRuntime) return undefined;\n return {\n name: resolvePluginRuntimeName(authConfig.name, authRuntime.localPath, \"auth\"),\n url: authRuntime.url,\n entry: authRuntime.url ? `${authRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: authRuntime.localPath,\n port: authRuntime.port,\n source: authRuntime.source,\n proxy: authConfig.proxy,\n variables: authConfig.variables,\n secrets: authConfig.secrets,\n integrity: authRuntime.source === \"remote\" ? authConfig.integrity : undefined,\n sidebar: authConfig.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? \"/auth\",\n roleRequired: item.roleRequired ?? (\"member\" as const),\n })),\n };\n })(),\n plugins:\n options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : undefined,\n };\n}\n\nasync function loadConfigFile(configPath: string, baseDir: string): Promise<BosConfigInput> {\n if (configPath.startsWith(\"bos://\")) {\n return fetchBosConfigFromFastKv<BosConfigInput>(configPath);\n }\n\n const resolvedPath = isAbsolute(configPath) ? configPath : resolve(baseDir, configPath);\n return JSON.parse(readFileSync(resolvedPath, \"utf-8\")) as BosConfigInput;\n}\n\nasync function resolveConfigWithExtends(\n configPath: string,\n baseDir: string,\n visited: Set<string>,\n chain: string[],\n env: BosEnv = \"development\",\n): Promise<BosConfigInput> {\n if (visited.has(configPath)) {\n throw new Error(`Circular extends detected: ${[...visited, configPath].join(\" -> \")}`);\n }\n\n const config = await loadConfigFile(configPath, baseDir);\n chain.push(configPath);\n\n if (!config.extends) {\n return config;\n }\n\n const extendsRef = resolveExtendsRef(config.extends as string | ExtendsConfig, env);\n if (!extendsRef) {\n return config;\n }\n\n const parsedParentRef = parseExtendsTarget(extendsRef);\n\n const nextVisited = new Set(visited);\n nextVisited.add(configPath);\n const parentBaseDir = getConfigBaseDir(parsedParentRef.configPath, baseDir);\n const parent = await resolveConfigWithExtends(\n parsedParentRef.configPath,\n parentBaseDir,\n nextVisited,\n chain,\n env,\n );\n\n return mergeBosConfigWithExtends(parent, config);\n}\n\ntype PluginOverrideValue = PluginEntryValue | null | false;\n\nfunction normalizePluginEntry(raw: PluginOverrideValue): BosPluginRef | null | false {\n if (raw === null || raw === false) return raw;\n if (typeof raw === \"string\") {\n return { extends: raw };\n }\n return raw;\n}\n\nasync function resolveRuntimePlugins(\n plugins: Record<string, PluginOverrideValue>,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig>> {\n const out: Record<string, RuntimePluginConfig> = {};\n\n for (const [pluginId, rawInput] of Object.entries(plugins)) {\n const normalized = normalizePluginEntry(rawInput);\n if (normalized === null || normalized === false) continue;\n\n const resolvedReference = await resolveComposableReference(\n normalized,\n baseDir,\n env,\n `plugins.${pluginId}`,\n );\n\n const pluginRuntime = buildRuntimePluginConfig(pluginId, env, resolvedReference);\n\n if (!pluginRuntime.localPath && !pluginRuntime.url) {\n continue;\n }\n\n if (\n pluginRuntime.source === \"remote\" &&\n pluginRuntime.url &&\n !pluginRuntime.localPath &&\n typeof resolvedReference.entry.name !== \"string\"\n ) {\n pluginRuntime.name = await resolveRemotePluginRuntimeName(\n pluginRuntime.url,\n pluginRuntime.name,\n );\n }\n\n out[pluginId] = pluginRuntime;\n }\n\n return out;\n}\n\nasync function resolveRemotePluginRuntimeName(baseUrl: string, fallback: string): Promise<string> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000);\n const response = await fetch(`${baseUrl.replace(/\\/$/, \"\")}/plugin.manifest.json`, {\n signal: controller.signal,\n });\n clearTimeout(timeout);\n\n if (!response.ok) {\n return fallback;\n }\n\n const manifest = (await response.json()) as {\n plugin?: { name?: unknown };\n };\n\n return typeof manifest.plugin?.name === \"string\" && manifest.plugin.name.length > 0\n ? manifest.plugin.name\n : fallback;\n } catch {\n return fallback;\n }\n}\n\nfunction buildRuntimePluginConfig(\n pluginId: string,\n env: BosEnv,\n resolved: ResolvedComposableReference,\n): RuntimePluginConfig {\n const source = resolved.entry;\n const development = typeof source.development === \"string\" ? source.development : undefined;\n const production = typeof source.production === \"string\" ? source.production : undefined;\n\n if (production?.startsWith(\"bos://\")) {\n throw new Error(\n `Plugin \"${pluginId}\" has unsupported production target \"${production}\". Use extends: \"bos://account/domain\" for plugin configs or a CDN URL for production.`,\n );\n }\n\n const pluginExtendsRef = source.extends ? resolveExtendsRef(source.extends, env) : undefined;\n\n const runtimeTarget =\n env === \"development\"\n ? resolveDevelopmentTarget(\n development,\n production,\n resolved.providerBaseDir,\n undefined,\n `plugins.${pluginId}`,\n pluginExtendsRef,\n )\n : resolveRuntimeTarget(production, resolved.providerBaseDir, \"remote\");\n const apiName = resolvePluginRuntimeName(source.name, runtimeTarget.localPath, pluginId);\n\n const uiConfig = resolved.associatedUi;\n const uiDevelopment =\n typeof uiConfig?.development === \"string\" ? uiConfig.development : undefined;\n const uiProduction = typeof uiConfig?.production === \"string\" ? uiConfig.production : undefined;\n const uiRuntime =\n uiConfig && (uiDevelopment || uiProduction)\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n uiDevelopment,\n uiProduction,\n resolved.providerBaseDir,\n undefined,\n `plugins.${pluginId}.ui`,\n )\n : resolveRuntimeTarget(uiProduction, resolved.providerBaseDir, \"remote\")\n : undefined;\n\n const sidebar = source.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? `/${pluginId}`,\n roleRequired: item.roleRequired ?? (\"member\" as const),\n }));\n\n const routes = source.routes;\n\n return {\n name: apiName,\n url: runtimeTarget.url,\n entry: runtimeTarget.url\n ? `${runtimeTarget.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: runtimeTarget.source,\n localPath: runtimeTarget.localPath,\n port: runtimeTarget.port,\n proxy: typeof source.proxy === \"string\" ? source.proxy : undefined,\n variables: normalizeStringRecord(source.variables),\n secrets: normalizeStringArray(source.secrets),\n integrity: runtimeTarget.source === \"remote\" ? source.integrity : undefined,\n ui: uiRuntime\n ? {\n name: typeof uiConfig?.name === \"string\" ? uiConfig.name : `${apiName}-ui`,\n url: uiRuntime.url,\n entry: uiRuntime.url\n ? `${uiRuntime.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: uiRuntime.source,\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n integrity:\n uiRuntime.source === \"remote\" && typeof uiConfig?.integrity === \"string\"\n ? uiConfig.integrity\n : undefined,\n }\n : undefined,\n sidebar,\n routes,\n };\n}\n\nexport function resolvePluginRuntimeName(\n explicitName: string | undefined,\n localPath: string | undefined,\n fallback: string,\n): string {\n if (explicitName) {\n return explicitName;\n }\n\n if (!localPath) {\n return fallback;\n }\n\n try {\n const packageJsonPath = join(localPath, \"package.json\");\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { name?: unknown };\n if (typeof packageJson.name === \"string\" && packageJson.name.length > 0) {\n return packageJson.name;\n }\n } catch {}\n\n return fallback;\n}\n\nfunction normalizeStringRecord(value: unknown): Record<string, string> | undefined {\n if (!isPlainObject(value)) return undefined;\n const out: Record<string, string> = {};\n for (const [key, raw] of Object.entries(value)) {\n if (typeof raw === \"string\") {\n out[key] = raw;\n }\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction normalizeStringArray(value: unknown): string[] | undefined {\n if (!Array.isArray(value)) return undefined;\n const out = value.filter((item): item is string => typeof item === \"string\" && item.length > 0);\n return out.length > 0 ? out : undefined;\n}\n\nfunction resolveRuntimeTarget(\n value: string | undefined,\n baseDir: string,\n defaultSource: \"local\" | \"remote\" = \"remote\",\n): RuntimeTarget {\n if (!value) {\n return { source: defaultSource, url: \"\" };\n }\n\n if (value.startsWith(LOCAL_PREFIX)) {\n const localTarget = value?.slice(LOCAL_PREFIX.length).trim();\n if (!localTarget) {\n throw new Error(`Invalid local development target: ${value}`);\n }\n\n const localPath = resolve(baseDir, localTarget);\n if (!existsSync(localPath)) {\n return { source: \"local\", url: \"\" };\n }\n\n return {\n source: \"local\",\n url: \"\",\n localPath,\n };\n }\n\n return {\n source: defaultSource,\n url: value.replace(/\\/$/, \"\"),\n port: parsePort(value),\n };\n}\n\nexport function isLocalDevelopmentTarget(\n value: string | undefined,\n): value is `${typeof LOCAL_PREFIX}${string}` {\n return typeof value === \"string\" && value.startsWith(LOCAL_PREFIX);\n}\n\nexport function resolveLocalDevelopmentPath(\n value: string | undefined,\n baseDir: string,\n): string | null {\n if (!isLocalDevelopmentTarget(value)) {\n return null;\n }\n\n const localTarget = value.slice(LOCAL_PREFIX.length).trim();\n return localTarget ? resolve(baseDir, localTarget) : null;\n}\n\nexport function resolveDevelopmentHostUrl(value: string | undefined): string {\n if (!value || isLocalDevelopmentTarget(value)) {\n return `http://localhost:${DEFAULT_HOST_PORT}`;\n }\n\n return value.replace(/\\/$/, \"\");\n}\n\nexport function getHostDevelopmentPort(value: string | undefined): number {\n return parsePort(resolveDevelopmentHostUrl(value));\n}\n\nexport function parsePort(url: string): number {\n try {\n const parsed = new URL(url);\n return parsed.port ? parseInt(parsed.port, 10) : parsed.protocol === \"https:\" ? 443 : 80;\n } catch {\n return 3000;\n }\n}\n\nexport { BOS_CONFIG_ORDER, rebuildOrderedConfig } from \"./merge\";\nexport type { BosConfig, RuntimeConfig } from \"./types\";\nexport { BosConfigSchema } from \"./types\";\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AAWjC,IAAI,eAAiC;AACrC,IAAI,cAA6B;AACjC,IAAI,iBAA2B,EAAE;AACjC,IAAI,yBAAyB;AAE7B,SAAgB,mBAAyB;AACvC,gBAAe;AACf,eAAc;AACd,kBAAiB,EAAE;;AAGrB,SAAgB,mBAAyB;AACvC,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AAW,MAAM;SAChF;AACN,SAAO"}
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["BosConfigSchema","isPlainObject","bosConfigMerger","rebuildOrderedConfig","resolveExtendsRef","getNetworkIdForAccount","fetchBosConfigFromFastKv","mergeBosConfigWithExtends"],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fetchBosConfigFromFastKv } from \"./fastkv\";\nimport {\n type BosEnv,\n bosConfigMerger,\n isPlainObject,\n mergeBosConfigWithExtends,\n type ResolvedConfigMeta,\n rebuildOrderedConfig,\n resolveExtendsRef,\n} from \"./merge\";\nimport { getNetworkIdForAccount } from \"./network\";\nimport type {\n BosConfig,\n BosConfigInput,\n BosPluginRef,\n ExtendsConfig,\n PluginEntryValue,\n RuntimeConfig,\n RuntimePluginConfig,\n} from \"./types\";\nimport { BosConfigSchema } from \"./types\";\n\nconst LOCAL_PREFIX = \"local:\";\nconst DEFAULT_HOST_PORT = 3000;\nconst RESOLVED_CONFIG_FILENAME = \"bos.resolved-config.json\";\n\ntype RuntimeOverrideTarget = \"ui\" | \"api\" | \"plugins\" | `plugins.${string}`;\n\ninterface RuntimeTarget {\n source: \"local\" | \"remote\";\n url: string;\n localPath?: string;\n port?: number;\n}\n\nlet cachedConfig: BosConfig | null = null;\nlet projectRoot: string | null = null;\nlet configWarnings: string[] = [];\nlet suppressConfigWarnings = false;\n\nexport function clearConfigCache(): void {\n cachedConfig = null;\n projectRoot = null;\n configWarnings = [];\n}\n\nexport function suppressWarnings(): void {\n suppressConfigWarnings = true;\n}\n\nexport function resumeWarnings(): void {\n suppressConfigWarnings = false;\n}\n\nexport function drainConfigWarnings(): string[] {\n const warnings = [...configWarnings];\n configWarnings = [];\n return warnings;\n}\n\nfunction emitConfigWarning(message: string): void {\n if (suppressConfigWarnings) {\n configWarnings.push(message);\n } else {\n console.warn(message);\n }\n}\n\nexport function findConfigPath(cwd?: string): string | null {\n let dir = cwd ?? process.cwd();\n while (dir !== \"/\") {\n const configPath = join(dir, \"bos.config.json\");\n if (existsSync(configPath)) {\n return configPath;\n }\n dir = dirname(dir);\n }\n return null;\n}\n\nexport function getConfig(): BosConfig | null {\n return cachedConfig;\n}\n\nexport function getProjectRoot(): string {\n if (!projectRoot) {\n throw new Error(\"Config not loaded. Call loadConfig() first.\");\n }\n return projectRoot;\n}\n\nexport interface ConfigResult {\n config: BosConfig;\n runtime: RuntimeConfig;\n source: {\n path: string;\n extended?: string[];\n remote?: boolean;\n };\n warnings?: string[];\n}\n\nexport interface RemoteConfigResult {\n rawConfig: BosConfigInput;\n config: BosConfig;\n source: string;\n extendsChain: string[];\n}\n\nexport interface ResolvedComposableReference {\n entry: BosPluginRef;\n providerBaseDir: string;\n targetPath: string;\n associatedUi?: Record<string, unknown>;\n}\n\ninterface ParsedExtendsTarget {\n configPath: string;\n targetPath?: string;\n}\n\nexport async function loadConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<ConfigResult | null> {\n const configPath = options?.path ?? findConfigPath(options?.cwd);\n if (!configPath) {\n projectRoot = options?.cwd ?? process.cwd();\n return null;\n }\n\n const baseDir = dirname(configPath);\n const env = options?.env ?? \"development\";\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n\n try {\n suppressWarnings();\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n configPath,\n baseDir,\n new Set(),\n extendedChain,\n env,\n );\n const config = await resolveConfigComposableEntries(\n BosConfigSchema.parse(parsed),\n baseDir,\n runtimeEnv,\n );\n\n cachedConfig = config;\n projectRoot = baseDir;\n\n const pluginRuntime = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv);\n const runtime = buildRuntimeConfig(config, baseDir, runtimeEnv, {\n plugins: pluginRuntime,\n });\n const warnings = drainConfigWarnings();\n resumeWarnings();\n\n return {\n config,\n runtime,\n source: {\n path: configPath,\n extended: extendedChain.length > 0 ? extendedChain : undefined,\n remote: extendedChain.some((entry) => entry.startsWith(\"bos://\")),\n },\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n } catch (error) {\n resumeWarnings();\n throw new Error(`Failed to load config from ${configPath}: ${error}`);\n }\n}\n\nexport async function loadBosConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<RuntimeConfig> {\n const result = await loadConfig(options);\n if (!result) {\n throw new Error(\"No bos.config.json found\");\n }\n\n return result.runtime;\n}\n\nexport async function loadRemoteConfig(\n bosUrl: string,\n env: BosEnv = \"production\",\n): Promise<RemoteConfigResult> {\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n bosUrl,\n process.cwd(),\n new Set(),\n extendedChain,\n env,\n );\n const config = await resolveConfigComposableEntries(\n BosConfigSchema.parse(parsed),\n process.cwd(),\n runtimeEnv,\n );\n\n return {\n rawConfig: await loadConfigFile(bosUrl, process.cwd()),\n config,\n source: bosUrl,\n extendsChain: extendedChain,\n };\n}\n\nexport function parseRuntimeOverrideTargets(value?: string | null): RuntimeOverrideTarget[] {\n if (!value) {\n return [];\n }\n\n return [\n ...new Set(\n value\n .split(\",\")\n .map((entry) => entry.trim())\n .filter(Boolean),\n ),\n ].map((entry) => {\n if (entry === \"ui\" || entry === \"api\" || entry === \"plugins\") {\n return entry;\n }\n\n if (entry.startsWith(\"plugins.\") && entry.length > \"plugins.\".length) {\n return entry as RuntimeOverrideTarget;\n }\n\n throw new Error(`Invalid runtime override target: ${entry}`);\n });\n}\n\nexport function isRuntimeOverrideAllowed(\n allowedTargets: ReadonlyArray<RuntimeOverrideTarget>,\n target: \"ui\" | \"api\" | \"plugins\" | `plugins.${string}`,\n): boolean {\n if (allowedTargets.includes(target as RuntimeOverrideTarget)) {\n return true;\n }\n\n if (target.startsWith(\"plugins.\")) {\n return allowedTargets.includes(\"plugins.*\");\n }\n\n return false;\n}\n\nexport async function buildRuntimePluginsForConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig> | undefined> {\n const plugins = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, env);\n return Object.keys(plugins).length > 0 ? plugins : undefined;\n}\n\nfunction getEntryAssociatedUi(entry: Partial<BosPluginRef>): Record<string, unknown> | undefined {\n if (!isPlainObject(entry.app)) {\n return undefined;\n }\n\n const app = entry.app as Record<string, unknown>;\n return isPlainObject(app.ui) ? (app.ui as Record<string, unknown>) : undefined;\n}\n\nfunction mergeAssociatedUi(\n parentUi: Record<string, unknown> | undefined,\n childUi: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n if (!parentUi) {\n return childUi ? { ...childUi } : undefined;\n }\n\n if (!childUi) {\n return { ...parentUi };\n }\n\n return bosConfigMerger({ ...childUi }, parentUi) as Record<string, unknown>;\n}\n\nfunction withAssociatedUi(\n entry: BosPluginRef,\n associatedUi?: Record<string, unknown>,\n): BosPluginRef {\n if (!associatedUi) {\n return entry;\n }\n\n const app = isPlainObject(entry.app)\n ? ({ ...(entry.app as Record<string, unknown>) } as Record<string, unknown>)\n : {};\n app.ui = mergeAssociatedUi(getEntryAssociatedUi(entry), associatedUi);\n\n return {\n ...entry,\n app,\n };\n}\n\nasync function resolveConfigComposableEntries(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<BosConfig> {\n const resolvedApi = await resolveComposableReference(\n config.app.api as BosPluginRef,\n baseDir,\n env,\n \"app.api\",\n );\n const resolvedAuth = config.app.auth\n ? await resolveComposableReference(config.app.auth as BosPluginRef, baseDir, env, \"app.auth\")\n : undefined;\n\n const resolvedPlugins = config.plugins\n ? Object.fromEntries(\n await Promise.all(\n Object.entries(config.plugins).map(async ([pluginId, pluginValue]) => {\n const resolvedPlugin = await resolveComposableReference(\n asComposableEntry(pluginValue),\n baseDir,\n env,\n `plugins.${pluginId}`,\n );\n\n return [\n pluginId,\n withAssociatedUi(resolvedPlugin.entry, resolvedPlugin.associatedUi),\n ] as const;\n }),\n ),\n )\n : undefined;\n\n return {\n ...config,\n app: {\n ...config.app,\n api: resolvedApi.entry,\n auth: resolvedAuth?.entry,\n },\n plugins: resolvedPlugins,\n };\n}\n\nexport function getResolvedConfigPath(configDir: string): string {\n return join(configDir, \".bos\", RESOLVED_CONFIG_FILENAME);\n}\n\nexport function loadResolvedConfig(configDir: string): BosConfig | null {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (!existsSync(resolvedPath)) return null;\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (!isPlainObject(raw)) return null;\n const { _resolved, ...configData } = raw;\n return BosConfigSchema.parse(configData);\n } catch {\n return null;\n }\n}\n\nexport function writeResolvedConfig(\n configDir: string,\n config: BosConfig,\n env: BosEnv,\n extendsChain?: string[],\n source?: string,\n): void {\n const resolvedPath = getResolvedConfigPath(configDir);\n const resolvedDir = dirname(resolvedPath);\n if (!existsSync(resolvedDir)) {\n mkdirSync(resolvedDir, { recursive: true });\n }\n\n const ordered = rebuildOrderedConfig(config);\n const meta: ResolvedConfigMeta = {\n env,\n resolvedAt: new Date().toISOString(),\n extendsChain: extendsChain ?? [],\n ...(source ? { source } : {}),\n };\n const output = {\n _resolved: meta,\n ...ordered,\n };\n\n const content = `${JSON.stringify(output, null, 2)}\\n`;\n try {\n if (readFileSync(resolvedPath, \"utf-8\") === content) return;\n } catch {\n // file doesn't exist yet\n }\n writeFileSync(resolvedPath, content);\n}\n\nexport function resolveBosConfigPath(configDir: string): string {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) return resolvedPath;\n return join(configDir, \"bos.config.json\");\n}\n\nexport function readBosConfigForBuild(configDir: string): Record<string, unknown> {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) {\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (isPlainObject(raw)) {\n const { _resolved, ...configData } = raw;\n return configData as Record<string, unknown>;\n }\n } catch {}\n }\n const bosConfigPath = join(configDir, \"bos.config.json\");\n return JSON.parse(readFileSync(bosConfigPath, \"utf-8\")) as Record<string, unknown>;\n}\n\nfunction parseExtendsTarget(ref: string): ParsedExtendsTarget {\n const hashIndex = ref.indexOf(\"#\");\n if (hashIndex === -1) {\n return { configPath: ref };\n }\n\n const configPath = ref.slice(0, hashIndex);\n const targetPath = ref.slice(hashIndex + 1);\n return {\n configPath,\n targetPath: targetPath.length > 0 ? targetPath : undefined,\n };\n}\n\nfunction getConfigBaseDir(configPath: string, baseDir: string): string {\n if (configPath.startsWith(\"bos://\")) return baseDir;\n return dirname(isAbsolute(configPath) ? configPath : resolve(baseDir, configPath));\n}\n\nfunction asComposableEntry(value: unknown): BosPluginRef {\n if (typeof value === \"string\") {\n return { extends: value };\n }\n if (!isPlainObject(value)) {\n throw new Error(`Expected config entry object, received ${typeof value}`);\n }\n return value as BosPluginRef;\n}\n\nfunction getTargetedEntry(config: BosConfigInput, targetPath: string): BosPluginRef {\n if (targetPath === \"app.api\") {\n return asComposableEntry(config.app?.api);\n }\n\n if (targetPath === \"app.auth\") {\n return asComposableEntry(config.app?.auth);\n }\n\n if (targetPath.startsWith(\"plugins.\")) {\n const pluginId = targetPath.slice(\"plugins.\".length);\n if (pluginId.length === 0) {\n throw new Error(`Invalid plugin target path: ${targetPath}`);\n }\n return asComposableEntry(config.plugins?.[pluginId]);\n }\n\n throw new Error(`Unsupported extends target path: ${targetPath}`);\n}\n\nfunction getAssociatedUi(\n config: BosConfigInput,\n _targetPath: string,\n): Record<string, unknown> | undefined {\n return isPlainObject(config.app?.ui) ? (config.app.ui as Record<string, unknown>) : undefined;\n}\n\nfunction mergeComposableEntries(\n parent: Partial<BosPluginRef>,\n child: Partial<BosPluginRef>,\n): BosPluginRef {\n return bosConfigMerger({ ...child }, parent) as BosPluginRef;\n}\n\nfunction stripUnsafeLocalDevelopment<T extends Record<string, unknown> | undefined>(\n entry: T,\n allowLocalPaths: boolean,\n): T {\n if (!entry || allowLocalPaths) {\n return entry;\n }\n\n if (typeof entry.development === \"string\" && entry.development.startsWith(LOCAL_PREFIX)) {\n const { development: _ignored, ...rest } = entry;\n return rest as T;\n }\n\n return entry;\n}\n\nexport async function resolveComposableReference(\n source: BosPluginRef,\n baseDir: string,\n env: BosEnv,\n defaultTargetPath: string,\n): Promise<ResolvedComposableReference> {\n let resolvedEntry: BosPluginRef = {};\n let providerBaseDir = baseDir;\n let targetPath = defaultTargetPath;\n let associatedUi = getEntryAssociatedUi(source);\n let allowLocalPaths = false;\n let extendsError: unknown;\n\n const extendsRef = source.extends ? resolveExtendsRef(source.extends, env) : undefined;\n if (extendsRef) {\n const parsed = parseExtendsTarget(extendsRef);\n targetPath = parsed.targetPath ?? defaultTargetPath;\n const extendsBaseDir = getConfigBaseDir(parsed.configPath, baseDir);\n try {\n const extendedConfig = await resolveConfigWithExtends(\n parsed.configPath,\n extendsBaseDir,\n new Set(),\n [],\n env,\n );\n resolvedEntry = mergeComposableEntries(\n resolvedEntry,\n getTargetedEntry(extendedConfig, targetPath),\n );\n providerBaseDir = extendsBaseDir;\n associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(extendedConfig, targetPath));\n } catch (error) {\n extendsError = error;\n }\n }\n\n const localDevelopment =\n typeof source.development === \"string\" && source.development.startsWith(LOCAL_PREFIX)\n ? source.development\n : undefined;\n const localDevelopmentPath = localDevelopment\n ? resolve(baseDir, localDevelopment.slice(LOCAL_PREFIX.length).trim())\n : undefined;\n const hasUsableLocalDevelopment = Boolean(\n localDevelopmentPath && existsSync(localDevelopmentPath),\n );\n\n if (localDevelopmentPath) {\n const localPath = localDevelopmentPath;\n const localConfigPath = join(localPath, \"bos.config.json\");\n if (existsSync(localConfigPath)) {\n const localConfig = await resolveConfigWithExtends(\n localConfigPath,\n localPath,\n new Set(),\n [],\n env,\n );\n resolvedEntry = mergeComposableEntries(\n resolvedEntry,\n getTargetedEntry(localConfig, targetPath),\n );\n providerBaseDir = localPath;\n associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(localConfig, targetPath));\n allowLocalPaths = true;\n }\n }\n\n const sourceOverrides = { ...source };\n if (allowLocalPaths && localDevelopment) {\n delete sourceOverrides.development;\n }\n\n resolvedEntry = mergeComposableEntries(resolvedEntry, sourceOverrides);\n associatedUi = mergeAssociatedUi(associatedUi, getEntryAssociatedUi(sourceOverrides));\n\n if (extendsError && !allowLocalPaths && !hasUsableLocalDevelopment) {\n throw extendsError;\n }\n\n return {\n entry: stripUnsafeLocalDevelopment(resolvedEntry, allowLocalPaths || Boolean(localDevelopment)),\n providerBaseDir,\n targetPath,\n associatedUi: stripUnsafeLocalDevelopment(associatedUi, allowLocalPaths),\n };\n}\n\nfunction resolveDevelopmentTarget(\n development: string | undefined,\n production: string | undefined,\n baseDir: string,\n forceSource?: \"local\" | \"remote\",\n target?: string,\n extendsRef?: string,\n): RuntimeTarget {\n if (forceSource === \"remote\") {\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n if (!development) {\n if (production && target) {\n if (extendsRef) {\n emitConfigWarning(`[Config] Resolving \"${target}\" from ${extendsRef}`);\n } else {\n emitConfigWarning(`[Config] No development target for \"${target}\", using production`);\n }\n }\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n const devTarget = resolveRuntimeTarget(development, baseDir);\n if (devTarget.source === \"local\" && (!devTarget.localPath || !existsSync(devTarget.localPath))) {\n if (production && target) {\n emitConfigWarning(`[Config] Could not load local target for \"${target}\", using production`);\n }\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n return devTarget;\n}\n\nexport interface BuildRuntimeConfigOptions {\n plugins?: Record<string, RuntimePluginConfig>;\n hostSource?: \"local\" | \"remote\";\n uiSource?: \"local\" | \"remote\";\n apiSource?: \"local\" | \"remote\";\n authSource?: \"local\" | \"remote\";\n proxy?: string;\n}\n\nexport function buildRuntimeConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n options?: BuildRuntimeConfigOptions,\n): RuntimeConfig {\n const uiConfig = config.app.ui;\n const apiConfig = config.app.api;\n const authConfig = config.app.auth;\n const uiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n uiConfig.development,\n uiConfig.production,\n baseDir,\n options?.uiSource,\n \"app.ui\",\n )\n : resolveRuntimeTarget(uiConfig.production, baseDir, \"remote\");\n const apiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n apiConfig.development,\n apiConfig.production,\n baseDir,\n options?.apiSource,\n \"app.api\",\n )\n : resolveRuntimeTarget(apiConfig.production, baseDir, \"remote\");\n const authExtendsRef = authConfig?.extends\n ? resolveExtendsRef(authConfig.extends, env)\n : undefined;\n const authRuntime = authConfig\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n authConfig.development,\n authConfig.production,\n baseDir,\n options?.authSource,\n \"app.auth\",\n authExtendsRef,\n )\n : resolveRuntimeTarget(authConfig.production, baseDir, \"remote\")\n : undefined;\n\n const hostConfig = config.app.host;\n const hostRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n hostConfig.development,\n hostConfig.production,\n baseDir,\n options?.hostSource,\n \"app.host\",\n )\n : resolveRuntimeTarget(hostConfig.production, baseDir, \"remote\");\n\n const hostListeningUrl =\n env === \"development\"\n ? resolveDevelopmentHostUrl(hostConfig.development)\n : `http://localhost:${hostRuntime.port ?? DEFAULT_HOST_PORT}`;\n\n const hostIsRemote = hostRuntime.source === \"remote\";\n const uiIsRemote = uiRuntime.source === \"remote\";\n const apiIsRemote = apiRuntime.source === \"remote\";\n const resolvedApiName = resolvePluginRuntimeName(apiConfig.name, apiRuntime.localPath, \"api\");\n\n return {\n env,\n account: config.account,\n domain: config.domain,\n title: config.title,\n description: config.description,\n networkId: getNetworkIdForAccount(config.account),\n repository: config.repository,\n host: {\n name: \"host\",\n url: hostListeningUrl,\n entry: `${hostListeningUrl}/mf-manifest.json`,\n localPath: hostRuntime.localPath,\n port: hostRuntime.port ?? DEFAULT_HOST_PORT,\n secrets: hostConfig.secrets,\n integrity: hostIsRemote ? hostConfig.integrity : undefined,\n source: hostRuntime.source,\n remoteUrl: hostIsRemote ? hostRuntime.url : undefined,\n },\n shared: config.shared,\n ui: {\n name: resolvePluginRuntimeName(uiConfig.name, uiRuntime.localPath, \"ui\"),\n url: uiRuntime.url,\n entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n ssrUrl: uiIsRemote ? uiConfig.ssr : undefined,\n ssrIntegrity: uiIsRemote ? uiConfig.ssrIntegrity : undefined,\n integrity: uiIsRemote ? uiConfig.integrity : undefined,\n source: uiRuntime.source,\n },\n api: {\n name: resolvedApiName,\n url: apiRuntime.url,\n entry: apiRuntime.url ? `${apiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: apiRuntime.localPath,\n port: apiRuntime.port,\n source: apiRuntime.source,\n proxy: options?.proxy ?? apiConfig.proxy,\n variables: apiConfig.variables,\n secrets: apiConfig.secrets,\n integrity: apiIsRemote ? apiConfig.integrity : undefined,\n },\n auth: (() => {\n if (!authConfig || !authRuntime) return undefined;\n return {\n name: resolvePluginRuntimeName(authConfig.name, authRuntime.localPath, \"auth\"),\n url: authRuntime.url,\n entry: authRuntime.url ? `${authRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: authRuntime.localPath,\n port: authRuntime.port,\n source: authRuntime.source,\n proxy: authConfig.proxy,\n variables: authConfig.variables,\n secrets: authConfig.secrets,\n integrity: authRuntime.source === \"remote\" ? authConfig.integrity : undefined,\n sidebar: authConfig.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? \"/auth\",\n roleRequired: item.roleRequired ?? (\"member\" as const),\n })),\n };\n })(),\n plugins:\n options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : undefined,\n };\n}\n\nasync function loadConfigFile(configPath: string, baseDir: string): Promise<BosConfigInput> {\n if (configPath.startsWith(\"bos://\")) {\n return fetchBosConfigFromFastKv<BosConfigInput>(configPath);\n }\n\n const resolvedPath = isAbsolute(configPath) ? configPath : resolve(baseDir, configPath);\n return JSON.parse(readFileSync(resolvedPath, \"utf-8\")) as BosConfigInput;\n}\n\nasync function resolveConfigWithExtends(\n configPath: string,\n baseDir: string,\n visited: Set<string>,\n chain: string[],\n env: BosEnv = \"development\",\n): Promise<BosConfigInput> {\n if (visited.has(configPath)) {\n throw new Error(`Circular extends detected: ${[...visited, configPath].join(\" -> \")}`);\n }\n\n const config = await loadConfigFile(configPath, baseDir);\n chain.push(configPath);\n\n if (!config.extends) {\n return config;\n }\n\n const extendsRef = resolveExtendsRef(config.extends as string | ExtendsConfig, env);\n if (!extendsRef) {\n return config;\n }\n\n const parsedParentRef = parseExtendsTarget(extendsRef);\n\n const nextVisited = new Set(visited);\n nextVisited.add(configPath);\n const parentBaseDir = getConfigBaseDir(parsedParentRef.configPath, baseDir);\n const parent = await resolveConfigWithExtends(\n parsedParentRef.configPath,\n parentBaseDir,\n nextVisited,\n chain,\n env,\n );\n\n return mergeBosConfigWithExtends(parent, config);\n}\n\ntype PluginOverrideValue = PluginEntryValue | null | false;\n\nfunction normalizePluginEntry(raw: PluginOverrideValue): BosPluginRef | null | false {\n if (raw === null || raw === false) return raw;\n if (typeof raw === \"string\") {\n return { extends: raw };\n }\n return raw;\n}\n\nasync function resolveRuntimePlugins(\n plugins: Record<string, PluginOverrideValue>,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig>> {\n const out: Record<string, RuntimePluginConfig> = {};\n\n for (const [pluginId, rawInput] of Object.entries(plugins)) {\n const normalized = normalizePluginEntry(rawInput);\n if (normalized === null || normalized === false) continue;\n\n const resolvedReference = await resolveComposableReference(\n normalized,\n baseDir,\n env,\n `plugins.${pluginId}`,\n );\n\n const pluginRuntime = buildRuntimePluginConfig(pluginId, env, resolvedReference);\n\n if (!pluginRuntime.localPath && !pluginRuntime.url) {\n continue;\n }\n\n if (\n pluginRuntime.source === \"remote\" &&\n pluginRuntime.url &&\n !pluginRuntime.localPath &&\n typeof resolvedReference.entry.name !== \"string\"\n ) {\n pluginRuntime.name = await resolveRemotePluginRuntimeName(\n pluginRuntime.url,\n pluginRuntime.name,\n );\n }\n\n out[pluginId] = pluginRuntime;\n }\n\n return out;\n}\n\nasync function resolveRemotePluginRuntimeName(baseUrl: string, fallback: string): Promise<string> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000);\n const response = await fetch(`${baseUrl.replace(/\\/$/, \"\")}/plugin.manifest.json`, {\n signal: controller.signal,\n });\n clearTimeout(timeout);\n\n if (!response.ok) {\n return fallback;\n }\n\n const manifest = (await response.json()) as {\n plugin?: { name?: unknown };\n };\n\n return typeof manifest.plugin?.name === \"string\" && manifest.plugin.name.length > 0\n ? manifest.plugin.name\n : fallback;\n } catch {\n return fallback;\n }\n}\n\nfunction buildRuntimePluginConfig(\n pluginId: string,\n env: BosEnv,\n resolved: ResolvedComposableReference,\n): RuntimePluginConfig {\n const source = resolved.entry;\n const development = typeof source.development === \"string\" ? source.development : undefined;\n const production = typeof source.production === \"string\" ? source.production : undefined;\n\n if (production?.startsWith(\"bos://\")) {\n throw new Error(\n `Plugin \"${pluginId}\" has unsupported production target \"${production}\". Use extends: \"bos://account/domain\" for plugin configs or a CDN URL for production.`,\n );\n }\n\n const pluginExtendsRef = source.extends ? resolveExtendsRef(source.extends, env) : undefined;\n\n const runtimeTarget =\n env === \"development\"\n ? resolveDevelopmentTarget(\n development,\n production,\n resolved.providerBaseDir,\n undefined,\n `plugins.${pluginId}`,\n pluginExtendsRef,\n )\n : resolveRuntimeTarget(production, resolved.providerBaseDir, \"remote\");\n const apiName = resolvePluginRuntimeName(source.name, runtimeTarget.localPath, pluginId);\n\n const uiConfig = resolved.associatedUi;\n const uiDevelopment =\n typeof uiConfig?.development === \"string\" ? uiConfig.development : undefined;\n const uiProduction = typeof uiConfig?.production === \"string\" ? uiConfig.production : undefined;\n const uiRuntime =\n uiConfig && (uiDevelopment || uiProduction)\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n uiDevelopment,\n uiProduction,\n resolved.providerBaseDir,\n undefined,\n `plugins.${pluginId}.ui`,\n )\n : resolveRuntimeTarget(uiProduction, resolved.providerBaseDir, \"remote\")\n : undefined;\n\n const sidebar = source.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? `/${pluginId}`,\n roleRequired: item.roleRequired ?? (\"member\" as const),\n }));\n\n const routes = source.routes;\n\n return {\n name: apiName,\n url: runtimeTarget.url,\n entry: runtimeTarget.url\n ? `${runtimeTarget.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: runtimeTarget.source,\n localPath: runtimeTarget.localPath,\n port: runtimeTarget.port,\n proxy: typeof source.proxy === \"string\" ? source.proxy : undefined,\n variables: normalizeStringRecord(source.variables),\n secrets: normalizeStringArray(source.secrets),\n integrity: runtimeTarget.source === \"remote\" ? source.integrity : undefined,\n ui: uiRuntime\n ? {\n name: typeof uiConfig?.name === \"string\" ? uiConfig.name : `${apiName}-ui`,\n url: uiRuntime.url,\n entry: uiRuntime.url\n ? `${uiRuntime.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: uiRuntime.source,\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n integrity:\n uiRuntime.source === \"remote\" && typeof uiConfig?.integrity === \"string\"\n ? uiConfig.integrity\n : undefined,\n }\n : undefined,\n sidebar,\n routes,\n };\n}\n\nexport function resolvePluginRuntimeName(\n explicitName: string | undefined,\n localPath: string | undefined,\n fallback: string,\n): string {\n if (explicitName) {\n return explicitName;\n }\n\n if (!localPath) {\n return fallback;\n }\n\n try {\n const packageJsonPath = join(localPath, \"package.json\");\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { name?: unknown };\n if (typeof packageJson.name === \"string\" && packageJson.name.length > 0) {\n return packageJson.name;\n }\n } catch {}\n\n return fallback;\n}\n\nfunction normalizeStringRecord(value: unknown): Record<string, string> | undefined {\n if (!isPlainObject(value)) return undefined;\n const out: Record<string, string> = {};\n for (const [key, raw] of Object.entries(value)) {\n if (typeof raw === \"string\") {\n out[key] = raw;\n }\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction normalizeStringArray(value: unknown): string[] | undefined {\n if (!Array.isArray(value)) return undefined;\n const out = value.filter((item): item is string => typeof item === \"string\" && item.length > 0);\n return out.length > 0 ? out : undefined;\n}\n\nfunction resolveRuntimeTarget(\n value: string | undefined,\n baseDir: string,\n defaultSource: \"local\" | \"remote\" = \"remote\",\n): RuntimeTarget {\n if (!value) {\n return { source: defaultSource, url: \"\" };\n }\n\n if (value.startsWith(LOCAL_PREFIX)) {\n const localTarget = value?.slice(LOCAL_PREFIX.length).trim();\n if (!localTarget) {\n throw new Error(`Invalid local development target: ${value}`);\n }\n\n const localPath = resolve(baseDir, localTarget);\n if (!existsSync(localPath)) {\n return { source: \"local\", url: \"\" };\n }\n\n return {\n source: \"local\",\n url: \"\",\n localPath,\n };\n }\n\n return {\n source: defaultSource,\n url: value.replace(/\\/$/, \"\"),\n port: parsePort(value),\n };\n}\n\nexport function isLocalDevelopmentTarget(\n value: string | undefined,\n): value is `${typeof LOCAL_PREFIX}${string}` {\n return typeof value === \"string\" && value.startsWith(LOCAL_PREFIX);\n}\n\nexport function resolveLocalDevelopmentPath(\n value: string | undefined,\n baseDir: string,\n): string | null {\n if (!isLocalDevelopmentTarget(value)) {\n return null;\n }\n\n const localTarget = value.slice(LOCAL_PREFIX.length).trim();\n return localTarget ? resolve(baseDir, localTarget) : null;\n}\n\nexport function resolveDevelopmentHostUrl(value: string | undefined): string {\n if (!value || isLocalDevelopmentTarget(value)) {\n return `http://localhost:${DEFAULT_HOST_PORT}`;\n }\n\n return value.replace(/\\/$/, \"\");\n}\n\nexport function getHostDevelopmentPort(value: string | undefined): number {\n return parsePort(resolveDevelopmentHostUrl(value));\n}\n\nexport function parsePort(url: string): number {\n try {\n const parsed = new URL(url);\n return parsed.port ? parseInt(parsed.port, 10) : parsed.protocol === \"https:\" ? 443 : 80;\n } catch {\n return 3000;\n }\n}\n\nexport { BOS_CONFIG_ORDER, rebuildOrderedConfig } from \"./merge\";\nexport type { BosConfig, RuntimeConfig } from \"./types\";\nexport { BosConfigSchema } from \"./types\";\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AAWjC,IAAI,eAAiC;AACrC,IAAI,cAA6B;AACjC,IAAI,iBAA2B,EAAE;AACjC,IAAI,yBAAyB;AAE7B,SAAgB,mBAAyB;AACvC,gBAAe;AACf,eAAc;AACd,kBAAiB,EAAE;;AAGrB,SAAgB,mBAAyB;AACvC,0BAAyB;;AAG3B,SAAgB,iBAAuB;AACrC,0BAAyB;;AAG3B,SAAgB,sBAAgC;CAC9C,MAAM,WAAW,CAAC,GAAG,eAAe;AACpC,kBAAiB,EAAE;AACnB,QAAO;;AAGT,SAAS,kBAAkB,SAAuB;AAChD,KAAI,uBACF,gBAAe,KAAK,QAAQ;KAE5B,SAAQ,KAAK,QAAQ;;AAIzB,SAAgB,eAAe,KAA6B;CAC1D,IAAI,MAAM,OAAO,QAAQ,KAAK;AAC9B,QAAO,QAAQ,KAAK;EAClB,MAAM,iCAAkB,KAAK,kBAAkB;AAC/C,8BAAe,WAAW,CACxB,QAAO;AAET,+BAAc,IAAI;;AAEpB,QAAO;;AAGT,SAAgB,YAA8B;AAC5C,QAAO;;AAGT,SAAgB,iBAAyB;AACvC,KAAI,CAAC,YACH,OAAM,IAAI,MAAM,8CAA8C;AAEhE,QAAO;;AAiCT,eAAsB,WAAW,SAIA;CAC/B,MAAM,aAAa,SAAS,QAAQ,eAAe,SAAS,IAAI;AAChE,KAAI,CAAC,YAAY;AACf,gBAAc,SAAS,OAAO,QAAQ,KAAK;AAC3C,SAAO;;CAGT,MAAM,iCAAkB,WAAW;CACnC,MAAM,MAAM,SA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AAa;;AAGpE,SAAgB,4BACd,OACA,SACe;AACf,KAAI,CAAC,yBAAyB,MAAM,CAClC,QAAO;CAGT,MAAM,cAAc,MAAM,MAAM,EAAoB,CAAC,MAAM;AAC3D,QAAO,qCAAsB,SAAS,YAAY,GAAG;;AAGvD,SAAgB,0BAA0B,OAAmC;AAC3E,KAAI,CAAC,SAAS,yBAAyB,MAAM,CAC3C,QAAO,oBAAoB;AAG7B,QAAO,MAAM,QAAQ,OAAO,GAAG;;AAGjC,SAAgB,uBAAuB,OAAmC;AACxE,QAAO,UAAU,0BAA0B,MAAM,CAAC;;AAGpD,SAAgB,UAAU,KAAqB;AAC7C,KAAI;EACF,MAAM,SAAS,IAAI,IAAI,IAAI;AAC3B,SAAO,OAAO,OAAO,SAAS,OAAO,MAAM,GAAG,GAAG,OAAO,aAAa,WAAW,MAAM;SAChF;AACN,SAAO"}
|
package/dist/config.mjs
CHANGED
|
@@ -345,7 +345,7 @@ function buildRuntimeConfig(config, baseDir, env, options) {
|
|
|
345
345
|
},
|
|
346
346
|
shared: config.shared,
|
|
347
347
|
ui: {
|
|
348
|
-
name: uiConfig.name,
|
|
348
|
+
name: resolvePluginRuntimeName(uiConfig.name, uiRuntime.localPath, "ui"),
|
|
349
349
|
url: uiRuntime.url,
|
|
350
350
|
entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : "/mf-manifest.json",
|
|
351
351
|
localPath: uiRuntime.localPath,
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fetchBosConfigFromFastKv } from \"./fastkv\";\nimport {\n type BosEnv,\n bosConfigMerger,\n isPlainObject,\n mergeBosConfigWithExtends,\n type ResolvedConfigMeta,\n rebuildOrderedConfig,\n resolveExtendsRef,\n} from \"./merge\";\nimport { getNetworkIdForAccount } from \"./network\";\nimport type {\n BosConfig,\n BosConfigInput,\n BosPluginRef,\n ExtendsConfig,\n PluginEntryValue,\n RuntimeConfig,\n RuntimePluginConfig,\n} from \"./types\";\nimport { BosConfigSchema } from \"./types\";\n\nconst LOCAL_PREFIX = \"local:\";\nconst DEFAULT_HOST_PORT = 3000;\nconst RESOLVED_CONFIG_FILENAME = \"bos.resolved-config.json\";\n\ntype RuntimeOverrideTarget = \"ui\" | \"api\" | \"plugins\" | `plugins.${string}`;\n\ninterface RuntimeTarget {\n source: \"local\" | \"remote\";\n url: string;\n localPath?: string;\n port?: number;\n}\n\nlet cachedConfig: BosConfig | null = null;\nlet projectRoot: string | null = null;\nlet configWarnings: string[] = [];\nlet suppressConfigWarnings = false;\n\nexport function clearConfigCache(): void {\n cachedConfig = null;\n projectRoot = null;\n configWarnings = [];\n}\n\nexport function suppressWarnings(): void {\n suppressConfigWarnings = true;\n}\n\nexport function resumeWarnings(): void {\n suppressConfigWarnings = false;\n}\n\nexport function drainConfigWarnings(): string[] {\n const warnings = [...configWarnings];\n configWarnings = [];\n return warnings;\n}\n\nfunction emitConfigWarning(message: string): void {\n if (suppressConfigWarnings) {\n configWarnings.push(message);\n } else {\n console.warn(message);\n }\n}\n\nexport function findConfigPath(cwd?: string): string | null {\n let dir = cwd ?? process.cwd();\n while (dir !== \"/\") {\n const configPath = join(dir, \"bos.config.json\");\n if (existsSync(configPath)) {\n return configPath;\n }\n dir = dirname(dir);\n }\n return null;\n}\n\nexport function getConfig(): BosConfig | null {\n return cachedConfig;\n}\n\nexport function getProjectRoot(): string {\n if (!projectRoot) {\n throw new Error(\"Config not loaded. Call loadConfig() first.\");\n }\n return projectRoot;\n}\n\nexport interface ConfigResult {\n config: BosConfig;\n runtime: RuntimeConfig;\n source: {\n path: string;\n extended?: string[];\n remote?: boolean;\n };\n warnings?: string[];\n}\n\nexport interface RemoteConfigResult {\n rawConfig: BosConfigInput;\n config: BosConfig;\n source: string;\n extendsChain: string[];\n}\n\nexport interface ResolvedComposableReference {\n entry: BosPluginRef;\n providerBaseDir: string;\n targetPath: string;\n associatedUi?: Record<string, unknown>;\n}\n\ninterface ParsedExtendsTarget {\n configPath: string;\n targetPath?: string;\n}\n\nexport async function loadConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<ConfigResult | null> {\n const configPath = options?.path ?? findConfigPath(options?.cwd);\n if (!configPath) {\n projectRoot = options?.cwd ?? process.cwd();\n return null;\n }\n\n const baseDir = dirname(configPath);\n const env = options?.env ?? \"development\";\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n\n try {\n suppressWarnings();\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n configPath,\n baseDir,\n new Set(),\n extendedChain,\n env,\n );\n const config = await resolveConfigComposableEntries(\n BosConfigSchema.parse(parsed),\n baseDir,\n runtimeEnv,\n );\n\n cachedConfig = config;\n projectRoot = baseDir;\n\n const pluginRuntime = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv);\n const runtime = buildRuntimeConfig(config, baseDir, runtimeEnv, {\n plugins: pluginRuntime,\n });\n const warnings = drainConfigWarnings();\n resumeWarnings();\n\n return {\n config,\n runtime,\n source: {\n path: configPath,\n extended: extendedChain.length > 0 ? extendedChain : undefined,\n remote: extendedChain.some((entry) => entry.startsWith(\"bos://\")),\n },\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n } catch (error) {\n resumeWarnings();\n throw new Error(`Failed to load config from ${configPath}: ${error}`);\n }\n}\n\nexport async function loadBosConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<RuntimeConfig> {\n const result = await loadConfig(options);\n if (!result) {\n throw new Error(\"No bos.config.json found\");\n }\n\n return result.runtime;\n}\n\nexport async function loadRemoteConfig(\n bosUrl: string,\n env: BosEnv = \"production\",\n): Promise<RemoteConfigResult> {\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n bosUrl,\n process.cwd(),\n new Set(),\n extendedChain,\n env,\n );\n const config = await resolveConfigComposableEntries(\n BosConfigSchema.parse(parsed),\n process.cwd(),\n runtimeEnv,\n );\n\n return {\n rawConfig: await loadConfigFile(bosUrl, process.cwd()),\n config,\n source: bosUrl,\n extendsChain: extendedChain,\n };\n}\n\nexport function parseRuntimeOverrideTargets(value?: string | null): RuntimeOverrideTarget[] {\n if (!value) {\n return [];\n }\n\n return [\n ...new Set(\n value\n .split(\",\")\n .map((entry) => entry.trim())\n .filter(Boolean),\n ),\n ].map((entry) => {\n if (entry === \"ui\" || entry === \"api\" || entry === \"plugins\") {\n return entry;\n }\n\n if (entry.startsWith(\"plugins.\") && entry.length > \"plugins.\".length) {\n return entry as RuntimeOverrideTarget;\n }\n\n throw new Error(`Invalid runtime override target: ${entry}`);\n });\n}\n\nexport function isRuntimeOverrideAllowed(\n allowedTargets: ReadonlyArray<RuntimeOverrideTarget>,\n target: \"ui\" | \"api\" | \"plugins\" | `plugins.${string}`,\n): boolean {\n if (allowedTargets.includes(target as RuntimeOverrideTarget)) {\n return true;\n }\n\n if (target.startsWith(\"plugins.\")) {\n return allowedTargets.includes(\"plugins.*\");\n }\n\n return false;\n}\n\nexport async function buildRuntimePluginsForConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig> | undefined> {\n const plugins = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, env);\n return Object.keys(plugins).length > 0 ? plugins : undefined;\n}\n\nfunction getEntryAssociatedUi(entry: Partial<BosPluginRef>): Record<string, unknown> | undefined {\n if (!isPlainObject(entry.app)) {\n return undefined;\n }\n\n const app = entry.app as Record<string, unknown>;\n return isPlainObject(app.ui) ? (app.ui as Record<string, unknown>) : undefined;\n}\n\nfunction mergeAssociatedUi(\n parentUi: Record<string, unknown> | undefined,\n childUi: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n if (!parentUi) {\n return childUi ? { ...childUi } : undefined;\n }\n\n if (!childUi) {\n return { ...parentUi };\n }\n\n return bosConfigMerger({ ...childUi }, parentUi) as Record<string, unknown>;\n}\n\nfunction withAssociatedUi(\n entry: BosPluginRef,\n associatedUi?: Record<string, unknown>,\n): BosPluginRef {\n if (!associatedUi) {\n return entry;\n }\n\n const app = isPlainObject(entry.app)\n ? ({ ...(entry.app as Record<string, unknown>) } as Record<string, unknown>)\n : {};\n app.ui = mergeAssociatedUi(getEntryAssociatedUi(entry), associatedUi);\n\n return {\n ...entry,\n app,\n };\n}\n\nasync function resolveConfigComposableEntries(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<BosConfig> {\n const resolvedApi = await resolveComposableReference(\n config.app.api as BosPluginRef,\n baseDir,\n env,\n \"app.api\",\n );\n const resolvedAuth = config.app.auth\n ? await resolveComposableReference(config.app.auth as BosPluginRef, baseDir, env, \"app.auth\")\n : undefined;\n\n const resolvedPlugins = config.plugins\n ? Object.fromEntries(\n await Promise.all(\n Object.entries(config.plugins).map(async ([pluginId, pluginValue]) => {\n const resolvedPlugin = await resolveComposableReference(\n asComposableEntry(pluginValue),\n baseDir,\n env,\n `plugins.${pluginId}`,\n );\n\n return [\n pluginId,\n withAssociatedUi(resolvedPlugin.entry, resolvedPlugin.associatedUi),\n ] as const;\n }),\n ),\n )\n : undefined;\n\n return {\n ...config,\n app: {\n ...config.app,\n api: resolvedApi.entry,\n auth: resolvedAuth?.entry,\n },\n plugins: resolvedPlugins,\n };\n}\n\nexport function getResolvedConfigPath(configDir: string): string {\n return join(configDir, \".bos\", RESOLVED_CONFIG_FILENAME);\n}\n\nexport function loadResolvedConfig(configDir: string): BosConfig | null {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (!existsSync(resolvedPath)) return null;\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (!isPlainObject(raw)) return null;\n const { _resolved, ...configData } = raw;\n return BosConfigSchema.parse(configData);\n } catch {\n return null;\n }\n}\n\nexport function writeResolvedConfig(\n configDir: string,\n config: BosConfig,\n env: BosEnv,\n extendsChain?: string[],\n source?: string,\n): void {\n const resolvedPath = getResolvedConfigPath(configDir);\n const resolvedDir = dirname(resolvedPath);\n if (!existsSync(resolvedDir)) {\n mkdirSync(resolvedDir, { recursive: true });\n }\n\n const ordered = rebuildOrderedConfig(config);\n const meta: ResolvedConfigMeta = {\n env,\n resolvedAt: new Date().toISOString(),\n extendsChain: extendsChain ?? [],\n ...(source ? { source } : {}),\n };\n const output = {\n _resolved: meta,\n ...ordered,\n };\n\n const content = `${JSON.stringify(output, null, 2)}\\n`;\n try {\n if (readFileSync(resolvedPath, \"utf-8\") === content) return;\n } catch {\n // file doesn't exist yet\n }\n writeFileSync(resolvedPath, content);\n}\n\nexport function resolveBosConfigPath(configDir: string): string {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) return resolvedPath;\n return join(configDir, \"bos.config.json\");\n}\n\nexport function readBosConfigForBuild(configDir: string): Record<string, unknown> {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) {\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (isPlainObject(raw)) {\n const { _resolved, ...configData } = raw;\n return configData as Record<string, unknown>;\n }\n } catch {}\n }\n const bosConfigPath = join(configDir, \"bos.config.json\");\n return JSON.parse(readFileSync(bosConfigPath, \"utf-8\")) as Record<string, unknown>;\n}\n\nfunction parseExtendsTarget(ref: string): ParsedExtendsTarget {\n const hashIndex = ref.indexOf(\"#\");\n if (hashIndex === -1) {\n return { configPath: ref };\n }\n\n const configPath = ref.slice(0, hashIndex);\n const targetPath = ref.slice(hashIndex + 1);\n return {\n configPath,\n targetPath: targetPath.length > 0 ? targetPath : undefined,\n };\n}\n\nfunction getConfigBaseDir(configPath: string, baseDir: string): string {\n if (configPath.startsWith(\"bos://\")) return baseDir;\n return dirname(isAbsolute(configPath) ? configPath : resolve(baseDir, configPath));\n}\n\nfunction asComposableEntry(value: unknown): BosPluginRef {\n if (typeof value === \"string\") {\n return { extends: value };\n }\n if (!isPlainObject(value)) {\n throw new Error(`Expected config entry object, received ${typeof value}`);\n }\n return value as BosPluginRef;\n}\n\nfunction getTargetedEntry(config: BosConfigInput, targetPath: string): BosPluginRef {\n if (targetPath === \"app.api\") {\n return asComposableEntry(config.app?.api);\n }\n\n if (targetPath === \"app.auth\") {\n return asComposableEntry(config.app?.auth);\n }\n\n if (targetPath.startsWith(\"plugins.\")) {\n const pluginId = targetPath.slice(\"plugins.\".length);\n if (pluginId.length === 0) {\n throw new Error(`Invalid plugin target path: ${targetPath}`);\n }\n return asComposableEntry(config.plugins?.[pluginId]);\n }\n\n throw new Error(`Unsupported extends target path: ${targetPath}`);\n}\n\nfunction getAssociatedUi(\n config: BosConfigInput,\n _targetPath: string,\n): Record<string, unknown> | undefined {\n return isPlainObject(config.app?.ui) ? (config.app.ui as Record<string, unknown>) : undefined;\n}\n\nfunction mergeComposableEntries(\n parent: Partial<BosPluginRef>,\n child: Partial<BosPluginRef>,\n): BosPluginRef {\n return bosConfigMerger({ ...child }, parent) as BosPluginRef;\n}\n\nfunction stripUnsafeLocalDevelopment<T extends Record<string, unknown> | undefined>(\n entry: T,\n allowLocalPaths: boolean,\n): T {\n if (!entry || allowLocalPaths) {\n return entry;\n }\n\n if (typeof entry.development === \"string\" && entry.development.startsWith(LOCAL_PREFIX)) {\n const { development: _ignored, ...rest } = entry;\n return rest as T;\n }\n\n return entry;\n}\n\nexport async function resolveComposableReference(\n source: BosPluginRef,\n baseDir: string,\n env: BosEnv,\n defaultTargetPath: string,\n): Promise<ResolvedComposableReference> {\n let resolvedEntry: BosPluginRef = {};\n let providerBaseDir = baseDir;\n let targetPath = defaultTargetPath;\n let associatedUi = getEntryAssociatedUi(source);\n let allowLocalPaths = false;\n let extendsError: unknown;\n\n const extendsRef = source.extends ? resolveExtendsRef(source.extends, env) : undefined;\n if (extendsRef) {\n const parsed = parseExtendsTarget(extendsRef);\n targetPath = parsed.targetPath ?? defaultTargetPath;\n const extendsBaseDir = getConfigBaseDir(parsed.configPath, baseDir);\n try {\n const extendedConfig = await resolveConfigWithExtends(\n parsed.configPath,\n extendsBaseDir,\n new Set(),\n [],\n env,\n );\n resolvedEntry = mergeComposableEntries(\n resolvedEntry,\n getTargetedEntry(extendedConfig, targetPath),\n );\n providerBaseDir = extendsBaseDir;\n associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(extendedConfig, targetPath));\n } catch (error) {\n extendsError = error;\n }\n }\n\n const localDevelopment =\n typeof source.development === \"string\" && source.development.startsWith(LOCAL_PREFIX)\n ? source.development\n : undefined;\n const localDevelopmentPath = localDevelopment\n ? resolve(baseDir, localDevelopment.slice(LOCAL_PREFIX.length).trim())\n : undefined;\n const hasUsableLocalDevelopment = Boolean(\n localDevelopmentPath && existsSync(localDevelopmentPath),\n );\n\n if (localDevelopmentPath) {\n const localPath = localDevelopmentPath;\n const localConfigPath = join(localPath, \"bos.config.json\");\n if (existsSync(localConfigPath)) {\n const localConfig = await resolveConfigWithExtends(\n localConfigPath,\n localPath,\n new Set(),\n [],\n env,\n );\n resolvedEntry = mergeComposableEntries(\n resolvedEntry,\n getTargetedEntry(localConfig, targetPath),\n );\n providerBaseDir = localPath;\n associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(localConfig, targetPath));\n allowLocalPaths = true;\n }\n }\n\n const sourceOverrides = { ...source };\n if (allowLocalPaths && localDevelopment) {\n delete sourceOverrides.development;\n }\n\n resolvedEntry = mergeComposableEntries(resolvedEntry, sourceOverrides);\n associatedUi = mergeAssociatedUi(associatedUi, getEntryAssociatedUi(sourceOverrides));\n\n if (extendsError && !allowLocalPaths && !hasUsableLocalDevelopment) {\n throw extendsError;\n }\n\n return {\n entry: stripUnsafeLocalDevelopment(resolvedEntry, allowLocalPaths || Boolean(localDevelopment)),\n providerBaseDir,\n targetPath,\n associatedUi: stripUnsafeLocalDevelopment(associatedUi, allowLocalPaths),\n };\n}\n\nfunction resolveDevelopmentTarget(\n development: string | undefined,\n production: string | undefined,\n baseDir: string,\n forceSource?: \"local\" | \"remote\",\n target?: string,\n extendsRef?: string,\n): RuntimeTarget {\n if (forceSource === \"remote\") {\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n if (!development) {\n if (production && target) {\n if (extendsRef) {\n emitConfigWarning(`[Config] Resolving \"${target}\" from ${extendsRef}`);\n } else {\n emitConfigWarning(`[Config] No development target for \"${target}\", using production`);\n }\n }\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n const devTarget = resolveRuntimeTarget(development, baseDir);\n if (devTarget.source === \"local\" && (!devTarget.localPath || !existsSync(devTarget.localPath))) {\n if (production && target) {\n emitConfigWarning(`[Config] Could not load local target for \"${target}\", using production`);\n }\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n return devTarget;\n}\n\nexport interface BuildRuntimeConfigOptions {\n plugins?: Record<string, RuntimePluginConfig>;\n hostSource?: \"local\" | \"remote\";\n uiSource?: \"local\" | \"remote\";\n apiSource?: \"local\" | \"remote\";\n authSource?: \"local\" | \"remote\";\n proxy?: string;\n}\n\nexport function buildRuntimeConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n options?: BuildRuntimeConfigOptions,\n): RuntimeConfig {\n const uiConfig = config.app.ui;\n const apiConfig = config.app.api;\n const authConfig = config.app.auth;\n const uiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n uiConfig.development,\n uiConfig.production,\n baseDir,\n options?.uiSource,\n \"app.ui\",\n )\n : resolveRuntimeTarget(uiConfig.production, baseDir, \"remote\");\n const apiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n apiConfig.development,\n apiConfig.production,\n baseDir,\n options?.apiSource,\n \"app.api\",\n )\n : resolveRuntimeTarget(apiConfig.production, baseDir, \"remote\");\n const authExtendsRef = authConfig?.extends\n ? resolveExtendsRef(authConfig.extends, env)\n : undefined;\n const authRuntime = authConfig\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n authConfig.development,\n authConfig.production,\n baseDir,\n options?.authSource,\n \"app.auth\",\n authExtendsRef,\n )\n : resolveRuntimeTarget(authConfig.production, baseDir, \"remote\")\n : undefined;\n\n const hostConfig = config.app.host;\n const hostRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n hostConfig.development,\n hostConfig.production,\n baseDir,\n options?.hostSource,\n \"app.host\",\n )\n : resolveRuntimeTarget(hostConfig.production, baseDir, \"remote\");\n\n const hostListeningUrl =\n env === \"development\"\n ? resolveDevelopmentHostUrl(hostConfig.development)\n : `http://localhost:${hostRuntime.port ?? DEFAULT_HOST_PORT}`;\n\n const hostIsRemote = hostRuntime.source === \"remote\";\n const uiIsRemote = uiRuntime.source === \"remote\";\n const apiIsRemote = apiRuntime.source === \"remote\";\n const resolvedApiName = resolvePluginRuntimeName(apiConfig.name, apiRuntime.localPath, \"api\");\n\n return {\n env,\n account: config.account,\n domain: config.domain,\n title: config.title,\n description: config.description,\n networkId: getNetworkIdForAccount(config.account),\n repository: config.repository,\n host: {\n name: \"host\",\n url: hostListeningUrl,\n entry: `${hostListeningUrl}/mf-manifest.json`,\n localPath: hostRuntime.localPath,\n port: hostRuntime.port ?? DEFAULT_HOST_PORT,\n secrets: hostConfig.secrets,\n integrity: hostIsRemote ? hostConfig.integrity : undefined,\n source: hostRuntime.source,\n remoteUrl: hostIsRemote ? hostRuntime.url : undefined,\n },\n shared: config.shared,\n ui: {\n name: uiConfig.name,\n url: uiRuntime.url,\n entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n ssrUrl: uiIsRemote ? uiConfig.ssr : undefined,\n ssrIntegrity: uiIsRemote ? uiConfig.ssrIntegrity : undefined,\n integrity: uiIsRemote ? uiConfig.integrity : undefined,\n source: uiRuntime.source,\n },\n api: {\n name: resolvedApiName,\n url: apiRuntime.url,\n entry: apiRuntime.url ? `${apiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: apiRuntime.localPath,\n port: apiRuntime.port,\n source: apiRuntime.source,\n proxy: options?.proxy ?? apiConfig.proxy,\n variables: apiConfig.variables,\n secrets: apiConfig.secrets,\n integrity: apiIsRemote ? apiConfig.integrity : undefined,\n },\n auth: (() => {\n if (!authConfig || !authRuntime) return undefined;\n return {\n name: resolvePluginRuntimeName(authConfig.name, authRuntime.localPath, \"auth\"),\n url: authRuntime.url,\n entry: authRuntime.url ? `${authRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: authRuntime.localPath,\n port: authRuntime.port,\n source: authRuntime.source,\n proxy: authConfig.proxy,\n variables: authConfig.variables,\n secrets: authConfig.secrets,\n integrity: authRuntime.source === \"remote\" ? authConfig.integrity : undefined,\n sidebar: authConfig.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? \"/auth\",\n roleRequired: item.roleRequired ?? (\"member\" as const),\n })),\n };\n })(),\n plugins:\n options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : undefined,\n };\n}\n\nasync function loadConfigFile(configPath: string, baseDir: string): Promise<BosConfigInput> {\n if (configPath.startsWith(\"bos://\")) {\n return fetchBosConfigFromFastKv<BosConfigInput>(configPath);\n }\n\n const resolvedPath = isAbsolute(configPath) ? configPath : resolve(baseDir, configPath);\n return JSON.parse(readFileSync(resolvedPath, \"utf-8\")) as BosConfigInput;\n}\n\nasync function resolveConfigWithExtends(\n configPath: string,\n baseDir: string,\n visited: Set<string>,\n chain: string[],\n env: BosEnv = \"development\",\n): Promise<BosConfigInput> {\n if (visited.has(configPath)) {\n throw new Error(`Circular extends detected: ${[...visited, configPath].join(\" -> \")}`);\n }\n\n const config = await loadConfigFile(configPath, baseDir);\n chain.push(configPath);\n\n if (!config.extends) {\n return config;\n }\n\n const extendsRef = resolveExtendsRef(config.extends as string | ExtendsConfig, env);\n if (!extendsRef) {\n return config;\n }\n\n const parsedParentRef = parseExtendsTarget(extendsRef);\n\n const nextVisited = new Set(visited);\n nextVisited.add(configPath);\n const parentBaseDir = getConfigBaseDir(parsedParentRef.configPath, baseDir);\n const parent = await resolveConfigWithExtends(\n parsedParentRef.configPath,\n parentBaseDir,\n nextVisited,\n chain,\n env,\n );\n\n return mergeBosConfigWithExtends(parent, config);\n}\n\ntype PluginOverrideValue = PluginEntryValue | null | false;\n\nfunction normalizePluginEntry(raw: PluginOverrideValue): BosPluginRef | null | false {\n if (raw === null || raw === false) return raw;\n if (typeof raw === \"string\") {\n return { extends: raw };\n }\n return raw;\n}\n\nasync function resolveRuntimePlugins(\n plugins: Record<string, PluginOverrideValue>,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig>> {\n const out: Record<string, RuntimePluginConfig> = {};\n\n for (const [pluginId, rawInput] of Object.entries(plugins)) {\n const normalized = normalizePluginEntry(rawInput);\n if (normalized === null || normalized === false) continue;\n\n const resolvedReference = await resolveComposableReference(\n normalized,\n baseDir,\n env,\n `plugins.${pluginId}`,\n );\n\n const pluginRuntime = buildRuntimePluginConfig(pluginId, env, resolvedReference);\n\n if (!pluginRuntime.localPath && !pluginRuntime.url) {\n continue;\n }\n\n if (\n pluginRuntime.source === \"remote\" &&\n pluginRuntime.url &&\n !pluginRuntime.localPath &&\n typeof resolvedReference.entry.name !== \"string\"\n ) {\n pluginRuntime.name = await resolveRemotePluginRuntimeName(\n pluginRuntime.url,\n pluginRuntime.name,\n );\n }\n\n out[pluginId] = pluginRuntime;\n }\n\n return out;\n}\n\nasync function resolveRemotePluginRuntimeName(baseUrl: string, fallback: string): Promise<string> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000);\n const response = await fetch(`${baseUrl.replace(/\\/$/, \"\")}/plugin.manifest.json`, {\n signal: controller.signal,\n });\n clearTimeout(timeout);\n\n if (!response.ok) {\n return fallback;\n }\n\n const manifest = (await response.json()) as {\n plugin?: { name?: unknown };\n };\n\n return typeof manifest.plugin?.name === \"string\" && manifest.plugin.name.length > 0\n ? manifest.plugin.name\n : fallback;\n } catch {\n return fallback;\n }\n}\n\nfunction buildRuntimePluginConfig(\n pluginId: string,\n env: BosEnv,\n resolved: ResolvedComposableReference,\n): RuntimePluginConfig {\n const source = resolved.entry;\n const development = typeof source.development === \"string\" ? source.development : undefined;\n const production = typeof source.production === \"string\" ? source.production : undefined;\n\n if (production?.startsWith(\"bos://\")) {\n throw new Error(\n `Plugin \"${pluginId}\" has unsupported production target \"${production}\". Use extends: \"bos://account/domain\" for plugin configs or a CDN URL for production.`,\n );\n }\n\n const pluginExtendsRef = source.extends ? resolveExtendsRef(source.extends, env) : undefined;\n\n const runtimeTarget =\n env === \"development\"\n ? resolveDevelopmentTarget(\n development,\n production,\n resolved.providerBaseDir,\n undefined,\n `plugins.${pluginId}`,\n pluginExtendsRef,\n )\n : resolveRuntimeTarget(production, resolved.providerBaseDir, \"remote\");\n const apiName = resolvePluginRuntimeName(source.name, runtimeTarget.localPath, pluginId);\n\n const uiConfig = resolved.associatedUi;\n const uiDevelopment =\n typeof uiConfig?.development === \"string\" ? uiConfig.development : undefined;\n const uiProduction = typeof uiConfig?.production === \"string\" ? uiConfig.production : undefined;\n const uiRuntime =\n uiConfig && (uiDevelopment || uiProduction)\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n uiDevelopment,\n uiProduction,\n resolved.providerBaseDir,\n undefined,\n `plugins.${pluginId}.ui`,\n )\n : resolveRuntimeTarget(uiProduction, resolved.providerBaseDir, \"remote\")\n : undefined;\n\n const sidebar = source.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? `/${pluginId}`,\n roleRequired: item.roleRequired ?? (\"member\" as const),\n }));\n\n const routes = source.routes;\n\n return {\n name: apiName,\n url: runtimeTarget.url,\n entry: runtimeTarget.url\n ? `${runtimeTarget.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: runtimeTarget.source,\n localPath: runtimeTarget.localPath,\n port: runtimeTarget.port,\n proxy: typeof source.proxy === \"string\" ? source.proxy : undefined,\n variables: normalizeStringRecord(source.variables),\n secrets: normalizeStringArray(source.secrets),\n integrity: runtimeTarget.source === \"remote\" ? source.integrity : undefined,\n ui: uiRuntime\n ? {\n name: typeof uiConfig?.name === \"string\" ? uiConfig.name : `${apiName}-ui`,\n url: uiRuntime.url,\n entry: uiRuntime.url\n ? `${uiRuntime.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: uiRuntime.source,\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n integrity:\n uiRuntime.source === \"remote\" && typeof uiConfig?.integrity === \"string\"\n ? uiConfig.integrity\n : undefined,\n }\n : undefined,\n sidebar,\n routes,\n };\n}\n\nexport function resolvePluginRuntimeName(\n explicitName: string | undefined,\n localPath: string | undefined,\n fallback: string,\n): string {\n if (explicitName) {\n return explicitName;\n }\n\n if (!localPath) {\n return fallback;\n }\n\n try {\n const packageJsonPath = join(localPath, \"package.json\");\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { name?: unknown };\n if (typeof packageJson.name === \"string\" && packageJson.name.length > 0) {\n return packageJson.name;\n }\n } catch {}\n\n return fallback;\n}\n\nfunction normalizeStringRecord(value: unknown): Record<string, string> | undefined {\n if (!isPlainObject(value)) return undefined;\n const out: Record<string, string> = {};\n for (const [key, raw] of Object.entries(value)) {\n if (typeof raw === \"string\") {\n out[key] = raw;\n }\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction normalizeStringArray(value: unknown): string[] | undefined {\n if (!Array.isArray(value)) return undefined;\n const out = value.filter((item): item is string => typeof item === \"string\" && item.length > 0);\n return out.length > 0 ? out : undefined;\n}\n\nfunction resolveRuntimeTarget(\n value: string | undefined,\n baseDir: string,\n defaultSource: \"local\" | \"remote\" = \"remote\",\n): RuntimeTarget {\n if (!value) {\n return { source: defaultSource, url: \"\" };\n }\n\n if (value.startsWith(LOCAL_PREFIX)) {\n const localTarget = value?.slice(LOCAL_PREFIX.length).trim();\n if (!localTarget) {\n throw new Error(`Invalid local development target: ${value}`);\n }\n\n const localPath = resolve(baseDir, localTarget);\n if (!existsSync(localPath)) {\n return { source: \"local\", url: \"\" };\n }\n\n return {\n source: \"local\",\n url: \"\",\n localPath,\n };\n }\n\n return {\n source: defaultSource,\n url: value.replace(/\\/$/, \"\"),\n port: parsePort(value),\n };\n}\n\nexport function isLocalDevelopmentTarget(\n value: string | undefined,\n): value is `${typeof LOCAL_PREFIX}${string}` {\n return typeof value === \"string\" && value.startsWith(LOCAL_PREFIX);\n}\n\nexport function resolveLocalDevelopmentPath(\n value: string | undefined,\n baseDir: string,\n): string | null {\n if (!isLocalDevelopmentTarget(value)) {\n return null;\n }\n\n const localTarget = value.slice(LOCAL_PREFIX.length).trim();\n return localTarget ? resolve(baseDir, localTarget) : null;\n}\n\nexport function resolveDevelopmentHostUrl(value: string | undefined): string {\n if (!value || isLocalDevelopmentTarget(value)) {\n return `http://localhost:${DEFAULT_HOST_PORT}`;\n }\n\n return value.replace(/\\/$/, \"\");\n}\n\nexport function getHostDevelopmentPort(value: string | undefined): number {\n return parsePort(resolveDevelopmentHostUrl(value));\n}\n\nexport function parsePort(url: string): number {\n try {\n const parsed = new URL(url);\n return parsed.port ? parseInt(parsed.port, 10) : parsed.protocol === \"https:\" ? 443 : 80;\n } catch {\n return 3000;\n }\n}\n\nexport { BOS_CONFIG_ORDER, rebuildOrderedConfig } from \"./merge\";\nexport type { BosConfig, RuntimeConfig } from \"./types\";\nexport { BosConfigSchema } from \"./types\";\n"],"mappings":";;;;;;;;AAwBA,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AAWjC,IAAI,eAAiC;AACrC,IAAI,cAA6B;AACjC,IAAI,iBAA2B,EAAE;AACjC,IAAI,yBAAyB;AAE7B,SAAgB,mBAAyB;AACvC,gBAAe;AACf,eAAc;AACd,kBAAiB,EAAE;;AAGrB,SAAgB,mBAAyB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AAU,KAAqB;AAC7C,KAAI;EACF,MAAM,SAAS,IAAI,IAAI,IAAI;AAC3B,SAAO,OAAO,OAAO,SAAS,OAAO,MAAM,GAAG,GAAG,OAAO,aAAa,WAAW,MAAM;SAChF;AACN,SAAO"}
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, isAbsolute, join, resolve } from \"node:path\";\nimport { fetchBosConfigFromFastKv } from \"./fastkv\";\nimport {\n type BosEnv,\n bosConfigMerger,\n isPlainObject,\n mergeBosConfigWithExtends,\n type ResolvedConfigMeta,\n rebuildOrderedConfig,\n resolveExtendsRef,\n} from \"./merge\";\nimport { getNetworkIdForAccount } from \"./network\";\nimport type {\n BosConfig,\n BosConfigInput,\n BosPluginRef,\n ExtendsConfig,\n PluginEntryValue,\n RuntimeConfig,\n RuntimePluginConfig,\n} from \"./types\";\nimport { BosConfigSchema } from \"./types\";\n\nconst LOCAL_PREFIX = \"local:\";\nconst DEFAULT_HOST_PORT = 3000;\nconst RESOLVED_CONFIG_FILENAME = \"bos.resolved-config.json\";\n\ntype RuntimeOverrideTarget = \"ui\" | \"api\" | \"plugins\" | `plugins.${string}`;\n\ninterface RuntimeTarget {\n source: \"local\" | \"remote\";\n url: string;\n localPath?: string;\n port?: number;\n}\n\nlet cachedConfig: BosConfig | null = null;\nlet projectRoot: string | null = null;\nlet configWarnings: string[] = [];\nlet suppressConfigWarnings = false;\n\nexport function clearConfigCache(): void {\n cachedConfig = null;\n projectRoot = null;\n configWarnings = [];\n}\n\nexport function suppressWarnings(): void {\n suppressConfigWarnings = true;\n}\n\nexport function resumeWarnings(): void {\n suppressConfigWarnings = false;\n}\n\nexport function drainConfigWarnings(): string[] {\n const warnings = [...configWarnings];\n configWarnings = [];\n return warnings;\n}\n\nfunction emitConfigWarning(message: string): void {\n if (suppressConfigWarnings) {\n configWarnings.push(message);\n } else {\n console.warn(message);\n }\n}\n\nexport function findConfigPath(cwd?: string): string | null {\n let dir = cwd ?? process.cwd();\n while (dir !== \"/\") {\n const configPath = join(dir, \"bos.config.json\");\n if (existsSync(configPath)) {\n return configPath;\n }\n dir = dirname(dir);\n }\n return null;\n}\n\nexport function getConfig(): BosConfig | null {\n return cachedConfig;\n}\n\nexport function getProjectRoot(): string {\n if (!projectRoot) {\n throw new Error(\"Config not loaded. Call loadConfig() first.\");\n }\n return projectRoot;\n}\n\nexport interface ConfigResult {\n config: BosConfig;\n runtime: RuntimeConfig;\n source: {\n path: string;\n extended?: string[];\n remote?: boolean;\n };\n warnings?: string[];\n}\n\nexport interface RemoteConfigResult {\n rawConfig: BosConfigInput;\n config: BosConfig;\n source: string;\n extendsChain: string[];\n}\n\nexport interface ResolvedComposableReference {\n entry: BosPluginRef;\n providerBaseDir: string;\n targetPath: string;\n associatedUi?: Record<string, unknown>;\n}\n\ninterface ParsedExtendsTarget {\n configPath: string;\n targetPath?: string;\n}\n\nexport async function loadConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<ConfigResult | null> {\n const configPath = options?.path ?? findConfigPath(options?.cwd);\n if (!configPath) {\n projectRoot = options?.cwd ?? process.cwd();\n return null;\n }\n\n const baseDir = dirname(configPath);\n const env = options?.env ?? \"development\";\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n\n try {\n suppressWarnings();\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n configPath,\n baseDir,\n new Set(),\n extendedChain,\n env,\n );\n const config = await resolveConfigComposableEntries(\n BosConfigSchema.parse(parsed),\n baseDir,\n runtimeEnv,\n );\n\n cachedConfig = config;\n projectRoot = baseDir;\n\n const pluginRuntime = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, runtimeEnv);\n const runtime = buildRuntimeConfig(config, baseDir, runtimeEnv, {\n plugins: pluginRuntime,\n });\n const warnings = drainConfigWarnings();\n resumeWarnings();\n\n return {\n config,\n runtime,\n source: {\n path: configPath,\n extended: extendedChain.length > 0 ? extendedChain : undefined,\n remote: extendedChain.some((entry) => entry.startsWith(\"bos://\")),\n },\n warnings: warnings.length > 0 ? warnings : undefined,\n };\n } catch (error) {\n resumeWarnings();\n throw new Error(`Failed to load config from ${configPath}: ${error}`);\n }\n}\n\nexport async function loadBosConfig(options?: {\n cwd?: string;\n path?: string;\n env?: BosEnv;\n}): Promise<RuntimeConfig> {\n const result = await loadConfig(options);\n if (!result) {\n throw new Error(\"No bos.config.json found\");\n }\n\n return result.runtime;\n}\n\nexport async function loadRemoteConfig(\n bosUrl: string,\n env: BosEnv = \"production\",\n): Promise<RemoteConfigResult> {\n const runtimeEnv: BosEnv = env === \"staging\" ? \"production\" : env;\n const extendedChain: string[] = [];\n const parsed = await resolveConfigWithExtends(\n bosUrl,\n process.cwd(),\n new Set(),\n extendedChain,\n env,\n );\n const config = await resolveConfigComposableEntries(\n BosConfigSchema.parse(parsed),\n process.cwd(),\n runtimeEnv,\n );\n\n return {\n rawConfig: await loadConfigFile(bosUrl, process.cwd()),\n config,\n source: bosUrl,\n extendsChain: extendedChain,\n };\n}\n\nexport function parseRuntimeOverrideTargets(value?: string | null): RuntimeOverrideTarget[] {\n if (!value) {\n return [];\n }\n\n return [\n ...new Set(\n value\n .split(\",\")\n .map((entry) => entry.trim())\n .filter(Boolean),\n ),\n ].map((entry) => {\n if (entry === \"ui\" || entry === \"api\" || entry === \"plugins\") {\n return entry;\n }\n\n if (entry.startsWith(\"plugins.\") && entry.length > \"plugins.\".length) {\n return entry as RuntimeOverrideTarget;\n }\n\n throw new Error(`Invalid runtime override target: ${entry}`);\n });\n}\n\nexport function isRuntimeOverrideAllowed(\n allowedTargets: ReadonlyArray<RuntimeOverrideTarget>,\n target: \"ui\" | \"api\" | \"plugins\" | `plugins.${string}`,\n): boolean {\n if (allowedTargets.includes(target as RuntimeOverrideTarget)) {\n return true;\n }\n\n if (target.startsWith(\"plugins.\")) {\n return allowedTargets.includes(\"plugins.*\");\n }\n\n return false;\n}\n\nexport async function buildRuntimePluginsForConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig> | undefined> {\n const plugins = await resolveRuntimePlugins(config.plugins ?? {}, baseDir, env);\n return Object.keys(plugins).length > 0 ? plugins : undefined;\n}\n\nfunction getEntryAssociatedUi(entry: Partial<BosPluginRef>): Record<string, unknown> | undefined {\n if (!isPlainObject(entry.app)) {\n return undefined;\n }\n\n const app = entry.app as Record<string, unknown>;\n return isPlainObject(app.ui) ? (app.ui as Record<string, unknown>) : undefined;\n}\n\nfunction mergeAssociatedUi(\n parentUi: Record<string, unknown> | undefined,\n childUi: Record<string, unknown> | undefined,\n): Record<string, unknown> | undefined {\n if (!parentUi) {\n return childUi ? { ...childUi } : undefined;\n }\n\n if (!childUi) {\n return { ...parentUi };\n }\n\n return bosConfigMerger({ ...childUi }, parentUi) as Record<string, unknown>;\n}\n\nfunction withAssociatedUi(\n entry: BosPluginRef,\n associatedUi?: Record<string, unknown>,\n): BosPluginRef {\n if (!associatedUi) {\n return entry;\n }\n\n const app = isPlainObject(entry.app)\n ? ({ ...(entry.app as Record<string, unknown>) } as Record<string, unknown>)\n : {};\n app.ui = mergeAssociatedUi(getEntryAssociatedUi(entry), associatedUi);\n\n return {\n ...entry,\n app,\n };\n}\n\nasync function resolveConfigComposableEntries(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n): Promise<BosConfig> {\n const resolvedApi = await resolveComposableReference(\n config.app.api as BosPluginRef,\n baseDir,\n env,\n \"app.api\",\n );\n const resolvedAuth = config.app.auth\n ? await resolveComposableReference(config.app.auth as BosPluginRef, baseDir, env, \"app.auth\")\n : undefined;\n\n const resolvedPlugins = config.plugins\n ? Object.fromEntries(\n await Promise.all(\n Object.entries(config.plugins).map(async ([pluginId, pluginValue]) => {\n const resolvedPlugin = await resolveComposableReference(\n asComposableEntry(pluginValue),\n baseDir,\n env,\n `plugins.${pluginId}`,\n );\n\n return [\n pluginId,\n withAssociatedUi(resolvedPlugin.entry, resolvedPlugin.associatedUi),\n ] as const;\n }),\n ),\n )\n : undefined;\n\n return {\n ...config,\n app: {\n ...config.app,\n api: resolvedApi.entry,\n auth: resolvedAuth?.entry,\n },\n plugins: resolvedPlugins,\n };\n}\n\nexport function getResolvedConfigPath(configDir: string): string {\n return join(configDir, \".bos\", RESOLVED_CONFIG_FILENAME);\n}\n\nexport function loadResolvedConfig(configDir: string): BosConfig | null {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (!existsSync(resolvedPath)) return null;\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (!isPlainObject(raw)) return null;\n const { _resolved, ...configData } = raw;\n return BosConfigSchema.parse(configData);\n } catch {\n return null;\n }\n}\n\nexport function writeResolvedConfig(\n configDir: string,\n config: BosConfig,\n env: BosEnv,\n extendsChain?: string[],\n source?: string,\n): void {\n const resolvedPath = getResolvedConfigPath(configDir);\n const resolvedDir = dirname(resolvedPath);\n if (!existsSync(resolvedDir)) {\n mkdirSync(resolvedDir, { recursive: true });\n }\n\n const ordered = rebuildOrderedConfig(config);\n const meta: ResolvedConfigMeta = {\n env,\n resolvedAt: new Date().toISOString(),\n extendsChain: extendsChain ?? [],\n ...(source ? { source } : {}),\n };\n const output = {\n _resolved: meta,\n ...ordered,\n };\n\n const content = `${JSON.stringify(output, null, 2)}\\n`;\n try {\n if (readFileSync(resolvedPath, \"utf-8\") === content) return;\n } catch {\n // file doesn't exist yet\n }\n writeFileSync(resolvedPath, content);\n}\n\nexport function resolveBosConfigPath(configDir: string): string {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) return resolvedPath;\n return join(configDir, \"bos.config.json\");\n}\n\nexport function readBosConfigForBuild(configDir: string): Record<string, unknown> {\n const resolvedPath = getResolvedConfigPath(configDir);\n if (existsSync(resolvedPath)) {\n try {\n const raw = JSON.parse(readFileSync(resolvedPath, \"utf-8\"));\n if (isPlainObject(raw)) {\n const { _resolved, ...configData } = raw;\n return configData as Record<string, unknown>;\n }\n } catch {}\n }\n const bosConfigPath = join(configDir, \"bos.config.json\");\n return JSON.parse(readFileSync(bosConfigPath, \"utf-8\")) as Record<string, unknown>;\n}\n\nfunction parseExtendsTarget(ref: string): ParsedExtendsTarget {\n const hashIndex = ref.indexOf(\"#\");\n if (hashIndex === -1) {\n return { configPath: ref };\n }\n\n const configPath = ref.slice(0, hashIndex);\n const targetPath = ref.slice(hashIndex + 1);\n return {\n configPath,\n targetPath: targetPath.length > 0 ? targetPath : undefined,\n };\n}\n\nfunction getConfigBaseDir(configPath: string, baseDir: string): string {\n if (configPath.startsWith(\"bos://\")) return baseDir;\n return dirname(isAbsolute(configPath) ? configPath : resolve(baseDir, configPath));\n}\n\nfunction asComposableEntry(value: unknown): BosPluginRef {\n if (typeof value === \"string\") {\n return { extends: value };\n }\n if (!isPlainObject(value)) {\n throw new Error(`Expected config entry object, received ${typeof value}`);\n }\n return value as BosPluginRef;\n}\n\nfunction getTargetedEntry(config: BosConfigInput, targetPath: string): BosPluginRef {\n if (targetPath === \"app.api\") {\n return asComposableEntry(config.app?.api);\n }\n\n if (targetPath === \"app.auth\") {\n return asComposableEntry(config.app?.auth);\n }\n\n if (targetPath.startsWith(\"plugins.\")) {\n const pluginId = targetPath.slice(\"plugins.\".length);\n if (pluginId.length === 0) {\n throw new Error(`Invalid plugin target path: ${targetPath}`);\n }\n return asComposableEntry(config.plugins?.[pluginId]);\n }\n\n throw new Error(`Unsupported extends target path: ${targetPath}`);\n}\n\nfunction getAssociatedUi(\n config: BosConfigInput,\n _targetPath: string,\n): Record<string, unknown> | undefined {\n return isPlainObject(config.app?.ui) ? (config.app.ui as Record<string, unknown>) : undefined;\n}\n\nfunction mergeComposableEntries(\n parent: Partial<BosPluginRef>,\n child: Partial<BosPluginRef>,\n): BosPluginRef {\n return bosConfigMerger({ ...child }, parent) as BosPluginRef;\n}\n\nfunction stripUnsafeLocalDevelopment<T extends Record<string, unknown> | undefined>(\n entry: T,\n allowLocalPaths: boolean,\n): T {\n if (!entry || allowLocalPaths) {\n return entry;\n }\n\n if (typeof entry.development === \"string\" && entry.development.startsWith(LOCAL_PREFIX)) {\n const { development: _ignored, ...rest } = entry;\n return rest as T;\n }\n\n return entry;\n}\n\nexport async function resolveComposableReference(\n source: BosPluginRef,\n baseDir: string,\n env: BosEnv,\n defaultTargetPath: string,\n): Promise<ResolvedComposableReference> {\n let resolvedEntry: BosPluginRef = {};\n let providerBaseDir = baseDir;\n let targetPath = defaultTargetPath;\n let associatedUi = getEntryAssociatedUi(source);\n let allowLocalPaths = false;\n let extendsError: unknown;\n\n const extendsRef = source.extends ? resolveExtendsRef(source.extends, env) : undefined;\n if (extendsRef) {\n const parsed = parseExtendsTarget(extendsRef);\n targetPath = parsed.targetPath ?? defaultTargetPath;\n const extendsBaseDir = getConfigBaseDir(parsed.configPath, baseDir);\n try {\n const extendedConfig = await resolveConfigWithExtends(\n parsed.configPath,\n extendsBaseDir,\n new Set(),\n [],\n env,\n );\n resolvedEntry = mergeComposableEntries(\n resolvedEntry,\n getTargetedEntry(extendedConfig, targetPath),\n );\n providerBaseDir = extendsBaseDir;\n associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(extendedConfig, targetPath));\n } catch (error) {\n extendsError = error;\n }\n }\n\n const localDevelopment =\n typeof source.development === \"string\" && source.development.startsWith(LOCAL_PREFIX)\n ? source.development\n : undefined;\n const localDevelopmentPath = localDevelopment\n ? resolve(baseDir, localDevelopment.slice(LOCAL_PREFIX.length).trim())\n : undefined;\n const hasUsableLocalDevelopment = Boolean(\n localDevelopmentPath && existsSync(localDevelopmentPath),\n );\n\n if (localDevelopmentPath) {\n const localPath = localDevelopmentPath;\n const localConfigPath = join(localPath, \"bos.config.json\");\n if (existsSync(localConfigPath)) {\n const localConfig = await resolveConfigWithExtends(\n localConfigPath,\n localPath,\n new Set(),\n [],\n env,\n );\n resolvedEntry = mergeComposableEntries(\n resolvedEntry,\n getTargetedEntry(localConfig, targetPath),\n );\n providerBaseDir = localPath;\n associatedUi = mergeAssociatedUi(associatedUi, getAssociatedUi(localConfig, targetPath));\n allowLocalPaths = true;\n }\n }\n\n const sourceOverrides = { ...source };\n if (allowLocalPaths && localDevelopment) {\n delete sourceOverrides.development;\n }\n\n resolvedEntry = mergeComposableEntries(resolvedEntry, sourceOverrides);\n associatedUi = mergeAssociatedUi(associatedUi, getEntryAssociatedUi(sourceOverrides));\n\n if (extendsError && !allowLocalPaths && !hasUsableLocalDevelopment) {\n throw extendsError;\n }\n\n return {\n entry: stripUnsafeLocalDevelopment(resolvedEntry, allowLocalPaths || Boolean(localDevelopment)),\n providerBaseDir,\n targetPath,\n associatedUi: stripUnsafeLocalDevelopment(associatedUi, allowLocalPaths),\n };\n}\n\nfunction resolveDevelopmentTarget(\n development: string | undefined,\n production: string | undefined,\n baseDir: string,\n forceSource?: \"local\" | \"remote\",\n target?: string,\n extendsRef?: string,\n): RuntimeTarget {\n if (forceSource === \"remote\") {\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n if (!development) {\n if (production && target) {\n if (extendsRef) {\n emitConfigWarning(`[Config] Resolving \"${target}\" from ${extendsRef}`);\n } else {\n emitConfigWarning(`[Config] No development target for \"${target}\", using production`);\n }\n }\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n const devTarget = resolveRuntimeTarget(development, baseDir);\n if (devTarget.source === \"local\" && (!devTarget.localPath || !existsSync(devTarget.localPath))) {\n if (production && target) {\n emitConfigWarning(`[Config] Could not load local target for \"${target}\", using production`);\n }\n return resolveRuntimeTarget(production, baseDir, \"remote\");\n }\n return devTarget;\n}\n\nexport interface BuildRuntimeConfigOptions {\n plugins?: Record<string, RuntimePluginConfig>;\n hostSource?: \"local\" | \"remote\";\n uiSource?: \"local\" | \"remote\";\n apiSource?: \"local\" | \"remote\";\n authSource?: \"local\" | \"remote\";\n proxy?: string;\n}\n\nexport function buildRuntimeConfig(\n config: BosConfig,\n baseDir: string,\n env: BosEnv,\n options?: BuildRuntimeConfigOptions,\n): RuntimeConfig {\n const uiConfig = config.app.ui;\n const apiConfig = config.app.api;\n const authConfig = config.app.auth;\n const uiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n uiConfig.development,\n uiConfig.production,\n baseDir,\n options?.uiSource,\n \"app.ui\",\n )\n : resolveRuntimeTarget(uiConfig.production, baseDir, \"remote\");\n const apiRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n apiConfig.development,\n apiConfig.production,\n baseDir,\n options?.apiSource,\n \"app.api\",\n )\n : resolveRuntimeTarget(apiConfig.production, baseDir, \"remote\");\n const authExtendsRef = authConfig?.extends\n ? resolveExtendsRef(authConfig.extends, env)\n : undefined;\n const authRuntime = authConfig\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n authConfig.development,\n authConfig.production,\n baseDir,\n options?.authSource,\n \"app.auth\",\n authExtendsRef,\n )\n : resolveRuntimeTarget(authConfig.production, baseDir, \"remote\")\n : undefined;\n\n const hostConfig = config.app.host;\n const hostRuntime =\n env === \"development\"\n ? resolveDevelopmentTarget(\n hostConfig.development,\n hostConfig.production,\n baseDir,\n options?.hostSource,\n \"app.host\",\n )\n : resolveRuntimeTarget(hostConfig.production, baseDir, \"remote\");\n\n const hostListeningUrl =\n env === \"development\"\n ? resolveDevelopmentHostUrl(hostConfig.development)\n : `http://localhost:${hostRuntime.port ?? DEFAULT_HOST_PORT}`;\n\n const hostIsRemote = hostRuntime.source === \"remote\";\n const uiIsRemote = uiRuntime.source === \"remote\";\n const apiIsRemote = apiRuntime.source === \"remote\";\n const resolvedApiName = resolvePluginRuntimeName(apiConfig.name, apiRuntime.localPath, \"api\");\n\n return {\n env,\n account: config.account,\n domain: config.domain,\n title: config.title,\n description: config.description,\n networkId: getNetworkIdForAccount(config.account),\n repository: config.repository,\n host: {\n name: \"host\",\n url: hostListeningUrl,\n entry: `${hostListeningUrl}/mf-manifest.json`,\n localPath: hostRuntime.localPath,\n port: hostRuntime.port ?? DEFAULT_HOST_PORT,\n secrets: hostConfig.secrets,\n integrity: hostIsRemote ? hostConfig.integrity : undefined,\n source: hostRuntime.source,\n remoteUrl: hostIsRemote ? hostRuntime.url : undefined,\n },\n shared: config.shared,\n ui: {\n name: resolvePluginRuntimeName(uiConfig.name, uiRuntime.localPath, \"ui\"),\n url: uiRuntime.url,\n entry: uiRuntime.url ? `${uiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n ssrUrl: uiIsRemote ? uiConfig.ssr : undefined,\n ssrIntegrity: uiIsRemote ? uiConfig.ssrIntegrity : undefined,\n integrity: uiIsRemote ? uiConfig.integrity : undefined,\n source: uiRuntime.source,\n },\n api: {\n name: resolvedApiName,\n url: apiRuntime.url,\n entry: apiRuntime.url ? `${apiRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: apiRuntime.localPath,\n port: apiRuntime.port,\n source: apiRuntime.source,\n proxy: options?.proxy ?? apiConfig.proxy,\n variables: apiConfig.variables,\n secrets: apiConfig.secrets,\n integrity: apiIsRemote ? apiConfig.integrity : undefined,\n },\n auth: (() => {\n if (!authConfig || !authRuntime) return undefined;\n return {\n name: resolvePluginRuntimeName(authConfig.name, authRuntime.localPath, \"auth\"),\n url: authRuntime.url,\n entry: authRuntime.url ? `${authRuntime.url}/mf-manifest.json` : \"/mf-manifest.json\",\n localPath: authRuntime.localPath,\n port: authRuntime.port,\n source: authRuntime.source,\n proxy: authConfig.proxy,\n variables: authConfig.variables,\n secrets: authConfig.secrets,\n integrity: authRuntime.source === \"remote\" ? authConfig.integrity : undefined,\n sidebar: authConfig.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? \"/auth\",\n roleRequired: item.roleRequired ?? (\"member\" as const),\n })),\n };\n })(),\n plugins:\n options?.plugins && Object.keys(options.plugins).length > 0 ? options.plugins : undefined,\n };\n}\n\nasync function loadConfigFile(configPath: string, baseDir: string): Promise<BosConfigInput> {\n if (configPath.startsWith(\"bos://\")) {\n return fetchBosConfigFromFastKv<BosConfigInput>(configPath);\n }\n\n const resolvedPath = isAbsolute(configPath) ? configPath : resolve(baseDir, configPath);\n return JSON.parse(readFileSync(resolvedPath, \"utf-8\")) as BosConfigInput;\n}\n\nasync function resolveConfigWithExtends(\n configPath: string,\n baseDir: string,\n visited: Set<string>,\n chain: string[],\n env: BosEnv = \"development\",\n): Promise<BosConfigInput> {\n if (visited.has(configPath)) {\n throw new Error(`Circular extends detected: ${[...visited, configPath].join(\" -> \")}`);\n }\n\n const config = await loadConfigFile(configPath, baseDir);\n chain.push(configPath);\n\n if (!config.extends) {\n return config;\n }\n\n const extendsRef = resolveExtendsRef(config.extends as string | ExtendsConfig, env);\n if (!extendsRef) {\n return config;\n }\n\n const parsedParentRef = parseExtendsTarget(extendsRef);\n\n const nextVisited = new Set(visited);\n nextVisited.add(configPath);\n const parentBaseDir = getConfigBaseDir(parsedParentRef.configPath, baseDir);\n const parent = await resolveConfigWithExtends(\n parsedParentRef.configPath,\n parentBaseDir,\n nextVisited,\n chain,\n env,\n );\n\n return mergeBosConfigWithExtends(parent, config);\n}\n\ntype PluginOverrideValue = PluginEntryValue | null | false;\n\nfunction normalizePluginEntry(raw: PluginOverrideValue): BosPluginRef | null | false {\n if (raw === null || raw === false) return raw;\n if (typeof raw === \"string\") {\n return { extends: raw };\n }\n return raw;\n}\n\nasync function resolveRuntimePlugins(\n plugins: Record<string, PluginOverrideValue>,\n baseDir: string,\n env: BosEnv,\n): Promise<Record<string, RuntimePluginConfig>> {\n const out: Record<string, RuntimePluginConfig> = {};\n\n for (const [pluginId, rawInput] of Object.entries(plugins)) {\n const normalized = normalizePluginEntry(rawInput);\n if (normalized === null || normalized === false) continue;\n\n const resolvedReference = await resolveComposableReference(\n normalized,\n baseDir,\n env,\n `plugins.${pluginId}`,\n );\n\n const pluginRuntime = buildRuntimePluginConfig(pluginId, env, resolvedReference);\n\n if (!pluginRuntime.localPath && !pluginRuntime.url) {\n continue;\n }\n\n if (\n pluginRuntime.source === \"remote\" &&\n pluginRuntime.url &&\n !pluginRuntime.localPath &&\n typeof resolvedReference.entry.name !== \"string\"\n ) {\n pluginRuntime.name = await resolveRemotePluginRuntimeName(\n pluginRuntime.url,\n pluginRuntime.name,\n );\n }\n\n out[pluginId] = pluginRuntime;\n }\n\n return out;\n}\n\nasync function resolveRemotePluginRuntimeName(baseUrl: string, fallback: string): Promise<string> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000);\n const response = await fetch(`${baseUrl.replace(/\\/$/, \"\")}/plugin.manifest.json`, {\n signal: controller.signal,\n });\n clearTimeout(timeout);\n\n if (!response.ok) {\n return fallback;\n }\n\n const manifest = (await response.json()) as {\n plugin?: { name?: unknown };\n };\n\n return typeof manifest.plugin?.name === \"string\" && manifest.plugin.name.length > 0\n ? manifest.plugin.name\n : fallback;\n } catch {\n return fallback;\n }\n}\n\nfunction buildRuntimePluginConfig(\n pluginId: string,\n env: BosEnv,\n resolved: ResolvedComposableReference,\n): RuntimePluginConfig {\n const source = resolved.entry;\n const development = typeof source.development === \"string\" ? source.development : undefined;\n const production = typeof source.production === \"string\" ? source.production : undefined;\n\n if (production?.startsWith(\"bos://\")) {\n throw new Error(\n `Plugin \"${pluginId}\" has unsupported production target \"${production}\". Use extends: \"bos://account/domain\" for plugin configs or a CDN URL for production.`,\n );\n }\n\n const pluginExtendsRef = source.extends ? resolveExtendsRef(source.extends, env) : undefined;\n\n const runtimeTarget =\n env === \"development\"\n ? resolveDevelopmentTarget(\n development,\n production,\n resolved.providerBaseDir,\n undefined,\n `plugins.${pluginId}`,\n pluginExtendsRef,\n )\n : resolveRuntimeTarget(production, resolved.providerBaseDir, \"remote\");\n const apiName = resolvePluginRuntimeName(source.name, runtimeTarget.localPath, pluginId);\n\n const uiConfig = resolved.associatedUi;\n const uiDevelopment =\n typeof uiConfig?.development === \"string\" ? uiConfig.development : undefined;\n const uiProduction = typeof uiConfig?.production === \"string\" ? uiConfig.production : undefined;\n const uiRuntime =\n uiConfig && (uiDevelopment || uiProduction)\n ? env === \"development\"\n ? resolveDevelopmentTarget(\n uiDevelopment,\n uiProduction,\n resolved.providerBaseDir,\n undefined,\n `plugins.${pluginId}.ui`,\n )\n : resolveRuntimeTarget(uiProduction, resolved.providerBaseDir, \"remote\")\n : undefined;\n\n const sidebar = source.sidebar?.map((item) => ({\n ...item,\n to: item.to ?? `/${pluginId}`,\n roleRequired: item.roleRequired ?? (\"member\" as const),\n }));\n\n const routes = source.routes;\n\n return {\n name: apiName,\n url: runtimeTarget.url,\n entry: runtimeTarget.url\n ? `${runtimeTarget.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: runtimeTarget.source,\n localPath: runtimeTarget.localPath,\n port: runtimeTarget.port,\n proxy: typeof source.proxy === \"string\" ? source.proxy : undefined,\n variables: normalizeStringRecord(source.variables),\n secrets: normalizeStringArray(source.secrets),\n integrity: runtimeTarget.source === \"remote\" ? source.integrity : undefined,\n ui: uiRuntime\n ? {\n name: typeof uiConfig?.name === \"string\" ? uiConfig.name : `${apiName}-ui`,\n url: uiRuntime.url,\n entry: uiRuntime.url\n ? `${uiRuntime.url.replace(/\\/$/, \"\")}/mf-manifest.json`\n : \"/mf-manifest.json\",\n source: uiRuntime.source,\n localPath: uiRuntime.localPath,\n port: uiRuntime.port,\n integrity:\n uiRuntime.source === \"remote\" && typeof uiConfig?.integrity === \"string\"\n ? uiConfig.integrity\n : undefined,\n }\n : undefined,\n sidebar,\n routes,\n };\n}\n\nexport function resolvePluginRuntimeName(\n explicitName: string | undefined,\n localPath: string | undefined,\n fallback: string,\n): string {\n if (explicitName) {\n return explicitName;\n }\n\n if (!localPath) {\n return fallback;\n }\n\n try {\n const packageJsonPath = join(localPath, \"package.json\");\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\")) as { name?: unknown };\n if (typeof packageJson.name === \"string\" && packageJson.name.length > 0) {\n return packageJson.name;\n }\n } catch {}\n\n return fallback;\n}\n\nfunction normalizeStringRecord(value: unknown): Record<string, string> | undefined {\n if (!isPlainObject(value)) return undefined;\n const out: Record<string, string> = {};\n for (const [key, raw] of Object.entries(value)) {\n if (typeof raw === \"string\") {\n out[key] = raw;\n }\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction normalizeStringArray(value: unknown): string[] | undefined {\n if (!Array.isArray(value)) return undefined;\n const out = value.filter((item): item is string => typeof item === \"string\" && item.length > 0);\n return out.length > 0 ? out : undefined;\n}\n\nfunction resolveRuntimeTarget(\n value: string | undefined,\n baseDir: string,\n defaultSource: \"local\" | \"remote\" = \"remote\",\n): RuntimeTarget {\n if (!value) {\n return { source: defaultSource, url: \"\" };\n }\n\n if (value.startsWith(LOCAL_PREFIX)) {\n const localTarget = value?.slice(LOCAL_PREFIX.length).trim();\n if (!localTarget) {\n throw new Error(`Invalid local development target: ${value}`);\n }\n\n const localPath = resolve(baseDir, localTarget);\n if (!existsSync(localPath)) {\n return { source: \"local\", url: \"\" };\n }\n\n return {\n source: \"local\",\n url: \"\",\n localPath,\n };\n }\n\n return {\n source: defaultSource,\n url: value.replace(/\\/$/, \"\"),\n port: parsePort(value),\n };\n}\n\nexport function isLocalDevelopmentTarget(\n value: string | undefined,\n): value is `${typeof LOCAL_PREFIX}${string}` {\n return typeof value === \"string\" && value.startsWith(LOCAL_PREFIX);\n}\n\nexport function resolveLocalDevelopmentPath(\n value: string | undefined,\n baseDir: string,\n): string | null {\n if (!isLocalDevelopmentTarget(value)) {\n return null;\n }\n\n const localTarget = value.slice(LOCAL_PREFIX.length).trim();\n return localTarget ? resolve(baseDir, localTarget) : null;\n}\n\nexport function resolveDevelopmentHostUrl(value: string | undefined): string {\n if (!value || isLocalDevelopmentTarget(value)) {\n return `http://localhost:${DEFAULT_HOST_PORT}`;\n }\n\n return value.replace(/\\/$/, \"\");\n}\n\nexport function getHostDevelopmentPort(value: string | undefined): number {\n return parsePort(resolveDevelopmentHostUrl(value));\n}\n\nexport function parsePort(url: string): number {\n try {\n const parsed = new URL(url);\n return parsed.port ? parseInt(parsed.port, 10) : parsed.protocol === \"https:\" ? 443 : 80;\n } catch {\n return 3000;\n }\n}\n\nexport { BOS_CONFIG_ORDER, rebuildOrderedConfig } from \"./merge\";\nexport type { BosConfig, RuntimeConfig } from \"./types\";\nexport { BosConfigSchema } from \"./types\";\n"],"mappings":";;;;;;;;AAwBA,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AAWjC,IAAI,eAAiC;AACrC,IAAI,cAA6B;AACjC,IAAI,iBAA2B,EAAE;AACjC,IAAI,yBAAyB;AAE7B,SAAgB,mBAAyB;AACvC,gBAAe;AACf,eAAc;AACd,kBAAiB,EAAE;;AAGrB,SAAgB,mBAAyB;AACvC,0BAAyB;;AAG3B,SAAgB,iBAAuB;AACrC,0BAAyB;;AAG3B,SAAgB,sBAAgC;CAC9C,MAAM,WAAW,CAAC,GAAG,eAAe;AACpC,kBAAiB,EAAE;AACnB,QAAO;;AAGT,SAAS,kBAAkB,SAAuB;AAChD,KAAI,uBACF,gBAAe,KAAK,QAAQ;KAE5B,SAAQ,KAAK,QAAQ;;AAIzB,SAAgB,eAAe,KAA6B;CAC1D,IAAI,MAAM,OAAO,QAAQ,KAAK;AAC9B,QAAO,QAAQ,KAAK;EAClB,MAAM,aAAa,KAAK,KAAK,kBAAkB;AAC/C,MAAI,WAAW,WAAW,CACxB,QAAO;AAET,QAAM,QAAQ,IAAI;;AAEpB,QAAO;;AAGT,SAAgB,YAA8B;AAC5C,QAAO;;AAGT,SAAgB,iBAAyB;AACvC,KAAI,CAAC,YACH,OAAM,IAAI,MAAM,8CAA8C;AAEhE,QAAO;;AAiCT,eAAsB,WAAW,SAIA;CAC/B,MAAM,aAAa,SAAS,QAAQ,eAAe,SAAS,IAAI;AAChE,KAAI,CAAC,YAAY;AACf,gBAAc,SAAS,OAAO,QAAQ,KAAK;AAC3C,SAAO;;CAGT,MAAM,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R,KAAK,MAAM,QAAQ,OAAO,GAAG;EAC7B,MAAM,UAAU,MAAM;EACvB;;AAGH,SAAgB,yBACd,OAC4C;AAC5C,QAAO,OAAO,UAAU,YAAY,MAAM,WAAW,aAAa;;AAGpE,SAAgB,4BACd,OACA,SACe;AACf,KAAI,CAAC,yBAAyB,MAAM,CAClC,QAAO;CAGT,MAAM,cAAc,MAAM,MAAM,EAAoB,CAAC,MAAM;AAC3D,QAAO,cAAc,QAAQ,SAAS,YAAY,GAAG;;AAGvD,SAAgB,0BAA0B,OAAmC;AAC3E,KAAI,CAAC,SAAS,yBAAyB,MAAM,CAC3C,QAAO,oBAAoB;AAG7B,QAAO,MAAM,QAAQ,OAAO,GAAG;;AAGjC,SAAgB,uBAAuB,OAAmC;AACxE,QAAO,UAAU,0BAA0B,MAAM,CAAC;;AAGpD,SAAgB,UAAU,KAAqB;AAC7C,KAAI;EACF,MAAM,SAAS,IAAI,IAAI,IAAI;AAC3B,SAAO,OAAO,OAAO,SAAS,OAAO,MAAM,GAAG,GAAG,OAAO,aAAa,WAAW,MAAM;SAChF;AACN,SAAO"}
|
package/dist/contract.d.cts
CHANGED
|
@@ -132,7 +132,7 @@ declare const ConfigResultSchema: z.ZodObject<{
|
|
|
132
132
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
133
|
}, z.core.$strip>;
|
|
134
134
|
ui: z.ZodObject<{
|
|
135
|
-
name: z.ZodString
|
|
135
|
+
name: z.ZodOptional<z.ZodString>;
|
|
136
136
|
development: z.ZodOptional<z.ZodString>;
|
|
137
137
|
production: z.ZodOptional<z.ZodString>;
|
|
138
138
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -577,7 +577,7 @@ declare const bosContract: {
|
|
|
577
577
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
578
578
|
}, z.core.$strip>;
|
|
579
579
|
ui: z.ZodObject<{
|
|
580
|
-
name: z.ZodString
|
|
580
|
+
name: z.ZodOptional<z.ZodString>;
|
|
581
581
|
development: z.ZodOptional<z.ZodString>;
|
|
582
582
|
production: z.ZodOptional<z.ZodString>;
|
|
583
583
|
integrity: z.ZodOptional<z.ZodString>;
|
package/dist/contract.d.mts
CHANGED
|
@@ -132,7 +132,7 @@ declare const ConfigResultSchema: z.ZodObject<{
|
|
|
132
132
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
133
|
}, z.core.$strip>;
|
|
134
134
|
ui: z.ZodObject<{
|
|
135
|
-
name: z.ZodString
|
|
135
|
+
name: z.ZodOptional<z.ZodString>;
|
|
136
136
|
development: z.ZodOptional<z.ZodString>;
|
|
137
137
|
production: z.ZodOptional<z.ZodString>;
|
|
138
138
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -577,7 +577,7 @@ declare const bosContract: {
|
|
|
577
577
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
578
578
|
}, z.core.$strip>;
|
|
579
579
|
ui: z.ZodObject<{
|
|
580
|
-
name: z.ZodString
|
|
580
|
+
name: z.ZodOptional<z.ZodString>;
|
|
581
581
|
development: z.ZodOptional<z.ZodString>;
|
|
582
582
|
production: z.ZodOptional<z.ZodString>;
|
|
583
583
|
integrity: z.ZodOptional<z.ZodString>;
|
package/dist/plugin.d.cts
CHANGED
|
@@ -162,7 +162,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
162
162
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
163
163
|
}, z.core.$strip>;
|
|
164
164
|
ui: z.ZodObject<{
|
|
165
|
-
name: z.ZodString
|
|
165
|
+
name: z.ZodOptional<z.ZodString>;
|
|
166
166
|
development: z.ZodOptional<z.ZodString>;
|
|
167
167
|
production: z.ZodOptional<z.ZodString>;
|
|
168
168
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -473,7 +473,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
473
473
|
secrets?: string[] | undefined;
|
|
474
474
|
};
|
|
475
475
|
ui: {
|
|
476
|
-
name
|
|
476
|
+
name?: string | undefined;
|
|
477
477
|
development?: string | undefined;
|
|
478
478
|
production?: string | undefined;
|
|
479
479
|
integrity?: string | undefined;
|
package/dist/plugin.d.mts
CHANGED
|
@@ -162,7 +162,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
162
162
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
163
163
|
}, z.core.$strip>;
|
|
164
164
|
ui: z.ZodObject<{
|
|
165
|
-
name: z.ZodString
|
|
165
|
+
name: z.ZodOptional<z.ZodString>;
|
|
166
166
|
development: z.ZodOptional<z.ZodString>;
|
|
167
167
|
production: z.ZodOptional<z.ZodString>;
|
|
168
168
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -473,7 +473,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
473
473
|
secrets?: string[] | undefined;
|
|
474
474
|
};
|
|
475
475
|
ui: {
|
|
476
|
-
name
|
|
476
|
+
name?: string | undefined;
|
|
477
477
|
development?: string | undefined;
|
|
478
478
|
production?: string | undefined;
|
|
479
479
|
integrity?: string | undefined;
|
package/dist/types.cjs
CHANGED
|
@@ -87,7 +87,7 @@ const RuntimePluginConfigSchema = zod.object({
|
|
|
87
87
|
routes: zod.array(zod.string()).optional()
|
|
88
88
|
});
|
|
89
89
|
const UiConfigSchema = zod.object({
|
|
90
|
-
name: zod.string(),
|
|
90
|
+
name: zod.string().optional(),
|
|
91
91
|
development: zod.string().optional(),
|
|
92
92
|
production: zod.string().optional(),
|
|
93
93
|
integrity: zod.string().optional(),
|
package/dist/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":["z"],"sources":["../src/types.ts"],"sourcesContent":["import * as z from \"zod\";\n\nexport const ExtendsSchema = z.union([\n z.string(),\n z.object({\n development: z.string().optional(),\n production: z.string().optional(),\n staging: z.string().optional(),\n }),\n]);\nexport type Extends = z.infer<typeof ExtendsSchema>;\nexport type ExtendsConfig = Extract<Extends, Record<string, string | undefined>>;\n\nexport const SourceModeSchema = z.enum([\"local\", \"remote\"]);\nexport type SourceMode = z.infer<typeof SourceModeSchema>;\n\nexport const SharedConfigSchema = z.object({\n version: z.string(),\n requiredVersion: z.string().optional(),\n singleton: z.boolean().optional(),\n eager: z.boolean().optional(),\n strictVersion: z.boolean().optional(),\n shareScope: z.string().optional(),\n});\nexport type SharedConfig = z.infer<typeof SharedConfigSchema>;\nexport type SharedDepConfig = SharedConfig;\nexport const SharedDepConfigSchema = SharedConfigSchema;\n\nexport const FederationEntrySchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n integrity: z.string().optional(),\n});\nexport type FederationEntry = z.infer<typeof FederationEntrySchema>;\n\nexport const SidebarRoleSchema = z.enum([\"anon\", \"member\", \"admin\"]);\nexport type SidebarRole = z.infer<typeof SidebarRoleSchema>;\n\nexport const SidebarItemSchema = z.object({\n icon: z.string(),\n label: z.string(),\n to: z.string().optional(),\n roleRequired: SidebarRoleSchema.optional(),\n});\nexport type SidebarItem = z.infer<typeof SidebarItemSchema>;\n\nexport const ComposableAppEntrySchema = z.object({\n extends: ExtendsSchema.optional(),\n name: z.string().optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n routes: z.array(z.string()).optional(),\n});\nexport type ComposableAppEntry = z.infer<typeof ComposableAppEntrySchema>;\n\nexport const ApiPluginConfigSchema = ComposableAppEntrySchema;\nexport type ApiPluginConfig = z.infer<typeof ApiPluginConfigSchema>;\n\nexport const PluginUiConfigSchema = z.object({\n name: z.string(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n});\nexport type PluginUiConfig = z.infer<typeof PluginUiConfigSchema>;\n\nexport const BosPluginRefSchema = ComposableAppEntrySchema.extend({\n version: z.string().optional(),\n app: z.record(z.string(), z.unknown()).optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.unknown()).optional(),\n});\nexport type BosPluginRef = z.infer<typeof BosPluginRefSchema>;\nexport type PluginEntryValue = string | BosPluginRef;\nexport type PluginEntries = Record<string, PluginEntryValue>;\n\nconst PluginRuntimeUiSchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n localPath: z.string().optional(),\n port: z.number().optional(),\n integrity: z.string().optional(),\n});\nexport type PluginRuntimeUi = z.infer<typeof PluginRuntimeUiSchema>;\n\nexport const RuntimePluginConfigSchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n integrity: z.string().optional(),\n ui: PluginRuntimeUiSchema.optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n routes: z.array(z.string()).optional(),\n});\nexport type RuntimePluginConfig = z.infer<typeof RuntimePluginConfigSchema>;\n\nexport const UiConfigSchema = z.object({\n name: z.string(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n ssr: z.string().optional(),\n ssrIntegrity: z.string().optional(),\n});\nexport type UiConfig = z.infer<typeof UiConfigSchema>;\n\nexport const HostConfigSchema = z.object({\n development: z.string(),\n production: z.string(),\n integrity: z.string().optional(),\n secrets: z.array(z.string()).optional(),\n});\nexport type HostConfig = z.infer<typeof HostConfigSchema>;\n\nexport const ClientRuntimeInfoSchema = z.object({\n accountId: z.string(),\n gatewayId: z.string(),\n runtimeBasePath: z.string(),\n title: z.string().nullable(),\n description: z.string().nullable(),\n hostUrl: z.string().nullable(),\n});\nexport type ClientRuntimeInfo = z.infer<typeof ClientRuntimeInfoSchema>;\n\nexport const BosStagingSchema = z.object({\n domain: z.string(),\n});\nexport type BosStaging = z.infer<typeof BosStagingSchema>;\n\nconst BosConfigInputAppEntrySchema = z.record(z.string(), z.unknown());\nexport type BosConfigInputAppEntry = z.infer<typeof BosConfigInputAppEntrySchema>;\n\nexport const BosConfigInputSchema: z.ZodType<BosConfigInput> = z.lazy(() =>\n z.object({\n extends: ExtendsSchema.optional(),\n account: z.string().optional(),\n domain: z.string().optional(),\n testnet: z.string().optional(),\n template: z.string().optional(),\n gateway: z\n .object({\n development: z.string().optional(),\n production: z.string().optional(),\n account: z.string().optional(),\n })\n .optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n name: z.string().optional(),\n version: z.string().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n routes: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n app: z.record(z.string(), BosConfigInputAppEntrySchema).optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.union([z.string(), BosConfigInputSchema])).optional(),\n }),\n);\n\nexport interface BosConfigInput {\n extends?: string | ExtendsConfig;\n account?: string;\n domain?: string;\n title?: string;\n description?: string;\n testnet?: string;\n template?: string;\n gateway?: {\n development?: string;\n production?: string;\n account?: string;\n };\n development?: string;\n production?: string;\n integrity?: string;\n name?: string;\n version?: string;\n proxy?: string;\n variables?: Record<string, string>;\n secrets?: string[];\n routes?: string[];\n sidebar?: SidebarItem[];\n app?: Record<string, BosConfigInputAppEntry>;\n shared?: Record<string, Record<string, SharedDepConfig>>;\n plugins?: Record<string, string | BosConfigInput>;\n}\n\nexport const BosConfigSchema = z.object({\n account: z.string(),\n extends: ExtendsSchema.optional(),\n domain: z.string().optional(),\n title: z.string().optional(),\n description: z.string().optional(),\n testnet: z.string().optional(),\n staging: BosStagingSchema.optional(),\n repository: z.string().optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.union([z.string(), BosPluginRefSchema])).optional(),\n app: z.object({\n host: HostConfigSchema,\n ui: UiConfigSchema,\n api: ComposableAppEntrySchema,\n auth: ComposableAppEntrySchema.optional(),\n }),\n});\nexport type BosConfig = z.infer<typeof BosConfigSchema>;\n\nexport const RuntimeConfigSchema = z.object({\n env: z.enum([\"development\", \"production\", \"staging\"]),\n account: z.string(),\n domain: z.string().optional(),\n networkId: z.enum([\"mainnet\", \"testnet\"]),\n title: z.string().optional(),\n description: z.string().optional(),\n repository: z.string().optional(),\n host: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n secrets: z.array(z.string()).optional(),\n remoteUrl: z.string().optional(),\n }),\n shared: z\n .object({\n ui: z.record(z.string(), SharedConfigSchema).optional(),\n plugins: z.record(z.string(), SharedConfigSchema).optional(),\n })\n .optional(),\n ui: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n ssrUrl: z.string().optional(),\n ssrIntegrity: z.string().optional(),\n }),\n api: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n }),\n auth: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n }).optional(),\n plugins: z.record(z.string(), RuntimePluginConfigSchema).optional(),\n});\nexport type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;\n\nexport const ClientRuntimeConfigSchema = z.object({\n cspNonce: z.string().optional(),\n env: z.enum([\"development\", \"production\", \"staging\"]),\n account: z.string(),\n networkId: z.enum([\"mainnet\", \"testnet\"]),\n hostUrl: z.string().optional(),\n assetsUrl: z.string(),\n apiBase: z.string(),\n rpcBase: z.string(),\n repository: z.string().optional(),\n authAvailable: z.boolean().optional(),\n runtime: ClientRuntimeInfoSchema.optional(),\n ui: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n })\n .optional(),\n api: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n })\n .optional(),\n auth: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n })\n .optional(),\n plugins: z\n .record(\n z.string(),\n z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n ui: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n integrity: z.string().optional(),\n })\n .optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n }),\n )\n .optional(),\n});\nexport type ClientRuntimeConfig = z.infer<typeof ClientRuntimeConfigSchema>;\n"],"mappings":";;;;;;AAEA,MAAa,gBAAgBA,IAAE,MAAM,CACnCA,IAAE,QAAQ,EACVA,IAAE,OAAO;CACP,aAAaA,IAAE,QAAQ,CAAC,UAAU;CAClC,YAAYA,IAAE,QAAQ,CAAC,UAAU;CACjC,SAASA,IAAE,QAAQ,CAAC,UAAU;CAC/B,CAAC,CACH,CAAC;AAIF,MAAa,mBAAmBA,IAAE,KAAK,CAAC,SAAS,SAAS,CAAC;AAG3D,MAAa,qBAAqBA,IAAE,OAAO;CACzC,SAASA,IAAE,QAAQ;CACnB,iBAAiBA,IAAE,QAAQ,CAAC,UAAU;CACtC,WAAWA,IAAE,SAAS,CAAC,UAAU;CACjC,OAAOA,IAAE,SAAS,CAAC,UAAU;CAC7B,eAAeA,IAAE,SAAS,CAAC,UAAU;CACrC,YAAYA,IAAE,QAAQ,CAAC,UAAU;CAClC,CAAC;AAGF,MAAa,wBAAwB;AAErC,MAAa,wBAAwBA,IAAE,OAAO;CAC5C,MAAMA,IAAE,QAAQ;C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kBAAkB,CAAC,UAAU;EAC/C,CAAC,CACD,UAAU;CACb,SAASA,IACN,OACCA,IAAE,QAAQ,EACVA,IAAE,OAAO;EACP,MAAMA,IAAE,QAAQ;EAChB,KAAKA,IAAE,QAAQ;EACf,OAAOA,IAAE,QAAQ;EACjB,WAAWA,IAAE,QAAQ,CAAC,UAAU;EAChC,IAAIA,IACD,OAAO;GACN,MAAMA,IAAE,QAAQ;GAChB,KAAKA,IAAE,QAAQ;GACf,OAAOA,IAAE,QAAQ;GACjB,QAAQ;GACR,WAAWA,IAAE,QAAQ,CAAC,UAAU;GACjC,CAAC,CACD,UAAU;EACb,SAASA,IAAE,MAAM,kBAAkB,CAAC,UAAU;EAC/C,CAAC,CACH,CACA,UAAU;CACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.cjs","names":["z"],"sources":["../src/types.ts"],"sourcesContent":["import * as z from \"zod\";\n\nexport const ExtendsSchema = z.union([\n z.string(),\n z.object({\n development: z.string().optional(),\n production: z.string().optional(),\n staging: z.string().optional(),\n }),\n]);\nexport type Extends = z.infer<typeof ExtendsSchema>;\nexport type ExtendsConfig = Extract<Extends, Record<string, string | undefined>>;\n\nexport const SourceModeSchema = z.enum([\"local\", \"remote\"]);\nexport type SourceMode = z.infer<typeof SourceModeSchema>;\n\nexport const SharedConfigSchema = z.object({\n version: z.string(),\n requiredVersion: z.string().optional(),\n singleton: z.boolean().optional(),\n eager: z.boolean().optional(),\n strictVersion: z.boolean().optional(),\n shareScope: z.string().optional(),\n});\nexport type SharedConfig = z.infer<typeof SharedConfigSchema>;\nexport type SharedDepConfig = SharedConfig;\nexport const SharedDepConfigSchema = SharedConfigSchema;\n\nexport const FederationEntrySchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n integrity: z.string().optional(),\n});\nexport type FederationEntry = z.infer<typeof FederationEntrySchema>;\n\nexport const SidebarRoleSchema = z.enum([\"anon\", \"member\", \"admin\"]);\nexport type SidebarRole = z.infer<typeof SidebarRoleSchema>;\n\nexport const SidebarItemSchema = z.object({\n icon: z.string(),\n label: z.string(),\n to: z.string().optional(),\n roleRequired: SidebarRoleSchema.optional(),\n});\nexport type SidebarItem = z.infer<typeof SidebarItemSchema>;\n\nexport const ComposableAppEntrySchema = z.object({\n extends: ExtendsSchema.optional(),\n name: z.string().optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n routes: z.array(z.string()).optional(),\n});\nexport type ComposableAppEntry = z.infer<typeof ComposableAppEntrySchema>;\n\nexport const ApiPluginConfigSchema = ComposableAppEntrySchema;\nexport type ApiPluginConfig = z.infer<typeof ApiPluginConfigSchema>;\n\nexport const PluginUiConfigSchema = z.object({\n name: z.string(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n});\nexport type PluginUiConfig = z.infer<typeof PluginUiConfigSchema>;\n\nexport const BosPluginRefSchema = ComposableAppEntrySchema.extend({\n version: z.string().optional(),\n app: z.record(z.string(), z.unknown()).optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.unknown()).optional(),\n});\nexport type BosPluginRef = z.infer<typeof BosPluginRefSchema>;\nexport type PluginEntryValue = string | BosPluginRef;\nexport type PluginEntries = Record<string, PluginEntryValue>;\n\nconst PluginRuntimeUiSchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n localPath: z.string().optional(),\n port: z.number().optional(),\n integrity: z.string().optional(),\n});\nexport type PluginRuntimeUi = z.infer<typeof PluginRuntimeUiSchema>;\n\nexport const RuntimePluginConfigSchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n integrity: z.string().optional(),\n ui: PluginRuntimeUiSchema.optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n routes: z.array(z.string()).optional(),\n});\nexport type RuntimePluginConfig = z.infer<typeof RuntimePluginConfigSchema>;\n\nexport const UiConfigSchema = z.object({\n name: z.string().optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n ssr: z.string().optional(),\n ssrIntegrity: z.string().optional(),\n});\nexport type UiConfig = z.infer<typeof UiConfigSchema>;\n\nexport const HostConfigSchema = z.object({\n development: z.string(),\n production: z.string(),\n integrity: z.string().optional(),\n secrets: z.array(z.string()).optional(),\n});\nexport type HostConfig = z.infer<typeof HostConfigSchema>;\n\nexport const ClientRuntimeInfoSchema = z.object({\n accountId: z.string(),\n gatewayId: z.string(),\n runtimeBasePath: z.string(),\n title: z.string().nullable(),\n description: z.string().nullable(),\n hostUrl: z.string().nullable(),\n});\nexport type ClientRuntimeInfo = z.infer<typeof ClientRuntimeInfoSchema>;\n\nexport const BosStagingSchema = z.object({\n domain: z.string(),\n});\nexport type BosStaging = z.infer<typeof BosStagingSchema>;\n\nconst BosConfigInputAppEntrySchema = z.record(z.string(), z.unknown());\nexport type BosConfigInputAppEntry = z.infer<typeof BosConfigInputAppEntrySchema>;\n\nexport const BosConfigInputSchema: z.ZodType<BosConfigInput> = z.lazy(() =>\n z.object({\n extends: ExtendsSchema.optional(),\n account: z.string().optional(),\n domain: z.string().optional(),\n testnet: z.string().optional(),\n template: z.string().optional(),\n gateway: z\n .object({\n development: z.string().optional(),\n production: z.string().optional(),\n account: z.string().optional(),\n })\n .optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n name: z.string().optional(),\n version: z.string().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n routes: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n app: z.record(z.string(), BosConfigInputAppEntrySchema).optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.union([z.string(), BosConfigInputSchema])).optional(),\n }),\n);\n\nexport interface BosConfigInput {\n extends?: string | ExtendsConfig;\n account?: string;\n domain?: string;\n title?: string;\n description?: string;\n testnet?: string;\n template?: string;\n gateway?: {\n development?: string;\n production?: string;\n account?: string;\n };\n development?: string;\n production?: string;\n integrity?: string;\n name?: string;\n version?: string;\n proxy?: string;\n variables?: Record<string, string>;\n secrets?: string[];\n routes?: string[];\n sidebar?: SidebarItem[];\n app?: Record<string, BosConfigInputAppEntry>;\n shared?: Record<string, Record<string, SharedDepConfig>>;\n plugins?: Record<string, string | BosConfigInput>;\n}\n\nexport const BosConfigSchema = z.object({\n account: z.string(),\n extends: ExtendsSchema.optional(),\n domain: z.string().optional(),\n title: z.string().optional(),\n description: z.string().optional(),\n testnet: z.string().optional(),\n staging: BosStagingSchema.optional(),\n repository: z.string().optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.union([z.string(), BosPluginRefSchema])).optional(),\n app: z.object({\n host: HostConfigSchema,\n ui: UiConfigSchema,\n api: ComposableAppEntrySchema,\n auth: ComposableAppEntrySchema.optional(),\n }),\n});\nexport type BosConfig = z.infer<typeof BosConfigSchema>;\n\nexport const RuntimeConfigSchema = z.object({\n env: z.enum([\"development\", \"production\", \"staging\"]),\n account: z.string(),\n domain: z.string().optional(),\n networkId: z.enum([\"mainnet\", \"testnet\"]),\n title: z.string().optional(),\n description: z.string().optional(),\n repository: z.string().optional(),\n host: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n secrets: z.array(z.string()).optional(),\n remoteUrl: z.string().optional(),\n }),\n shared: z\n .object({\n ui: z.record(z.string(), SharedConfigSchema).optional(),\n plugins: z.record(z.string(), SharedConfigSchema).optional(),\n })\n .optional(),\n ui: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n ssrUrl: z.string().optional(),\n ssrIntegrity: z.string().optional(),\n }),\n api: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n }),\n auth: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n }).optional(),\n plugins: z.record(z.string(), RuntimePluginConfigSchema).optional(),\n});\nexport type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;\n\nexport const ClientRuntimeConfigSchema = z.object({\n cspNonce: z.string().optional(),\n env: z.enum([\"development\", \"production\", \"staging\"]),\n account: z.string(),\n networkId: z.enum([\"mainnet\", \"testnet\"]),\n hostUrl: z.string().optional(),\n assetsUrl: z.string(),\n apiBase: z.string(),\n rpcBase: z.string(),\n repository: z.string().optional(),\n authAvailable: z.boolean().optional(),\n runtime: ClientRuntimeInfoSchema.optional(),\n ui: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n })\n .optional(),\n api: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n })\n .optional(),\n auth: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n })\n .optional(),\n plugins: z\n .record(\n z.string(),\n z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n ui: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n integrity: z.string().optional(),\n })\n .optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n }),\n )\n .optional(),\n});\nexport type ClientRuntimeConfig = z.infer<typeof ClientRuntimeCon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;
|
|
211
211
|
type RuntimePluginConfig = z.infer<typeof RuntimePluginConfigSchema>;
|
|
212
212
|
declare const UiConfigSchema: z.ZodObject<{
|
|
213
|
-
name: z.ZodString
|
|
213
|
+
name: z.ZodOptional<z.ZodString>;
|
|
214
214
|
development: z.ZodOptional<z.ZodString>;
|
|
215
215
|
production: z.ZodOptional<z.ZodString>;
|
|
216
216
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -335,7 +335,7 @@ declare const BosConfigSchema: z.ZodObject<{
|
|
|
335
335
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
336
336
|
}, z.core.$strip>;
|
|
337
337
|
ui: z.ZodObject<{
|
|
338
|
-
name: z.ZodString
|
|
338
|
+
name: z.ZodOptional<z.ZodString>;
|
|
339
339
|
development: z.ZodOptional<z.ZodString>;
|
|
340
340
|
production: z.ZodOptional<z.ZodString>;
|
|
341
341
|
integrity: z.ZodOptional<z.ZodString>;
|
package/dist/types.d.mts
CHANGED
|
@@ -210,7 +210,7 @@ declare const RuntimePluginConfigSchema: z.ZodObject<{
|
|
|
210
210
|
}, z.core.$strip>;
|
|
211
211
|
type RuntimePluginConfig = z.infer<typeof RuntimePluginConfigSchema>;
|
|
212
212
|
declare const UiConfigSchema: z.ZodObject<{
|
|
213
|
-
name: z.ZodString
|
|
213
|
+
name: z.ZodOptional<z.ZodString>;
|
|
214
214
|
development: z.ZodOptional<z.ZodString>;
|
|
215
215
|
production: z.ZodOptional<z.ZodString>;
|
|
216
216
|
integrity: z.ZodOptional<z.ZodString>;
|
|
@@ -335,7 +335,7 @@ declare const BosConfigSchema: z.ZodObject<{
|
|
|
335
335
|
secrets: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
336
336
|
}, z.core.$strip>;
|
|
337
337
|
ui: z.ZodObject<{
|
|
338
|
-
name: z.ZodString
|
|
338
|
+
name: z.ZodOptional<z.ZodString>;
|
|
339
339
|
development: z.ZodOptional<z.ZodString>;
|
|
340
340
|
production: z.ZodOptional<z.ZodString>;
|
|
341
341
|
integrity: z.ZodOptional<z.ZodString>;
|
package/dist/types.mjs
CHANGED
|
@@ -84,7 +84,7 @@ const RuntimePluginConfigSchema = z.object({
|
|
|
84
84
|
routes: z.array(z.string()).optional()
|
|
85
85
|
});
|
|
86
86
|
const UiConfigSchema = z.object({
|
|
87
|
-
name: z.string(),
|
|
87
|
+
name: z.string().optional(),
|
|
88
88
|
development: z.string().optional(),
|
|
89
89
|
production: z.string().optional(),
|
|
90
90
|
integrity: z.string().optional(),
|
package/dist/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import * as z from \"zod\";\n\nexport const ExtendsSchema = z.union([\n z.string(),\n z.object({\n development: z.string().optional(),\n production: z.string().optional(),\n staging: z.string().optional(),\n }),\n]);\nexport type Extends = z.infer<typeof ExtendsSchema>;\nexport type ExtendsConfig = Extract<Extends, Record<string, string | undefined>>;\n\nexport const SourceModeSchema = z.enum([\"local\", \"remote\"]);\nexport type SourceMode = z.infer<typeof SourceModeSchema>;\n\nexport const SharedConfigSchema = z.object({\n version: z.string(),\n requiredVersion: z.string().optional(),\n singleton: z.boolean().optional(),\n eager: z.boolean().optional(),\n strictVersion: z.boolean().optional(),\n shareScope: z.string().optional(),\n});\nexport type SharedConfig = z.infer<typeof SharedConfigSchema>;\nexport type SharedDepConfig = SharedConfig;\nexport const SharedDepConfigSchema = SharedConfigSchema;\n\nexport const FederationEntrySchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n integrity: z.string().optional(),\n});\nexport type FederationEntry = z.infer<typeof FederationEntrySchema>;\n\nexport const SidebarRoleSchema = z.enum([\"anon\", \"member\", \"admin\"]);\nexport type SidebarRole = z.infer<typeof SidebarRoleSchema>;\n\nexport const SidebarItemSchema = z.object({\n icon: z.string(),\n label: z.string(),\n to: z.string().optional(),\n roleRequired: SidebarRoleSchema.optional(),\n});\nexport type SidebarItem = z.infer<typeof SidebarItemSchema>;\n\nexport const ComposableAppEntrySchema = z.object({\n extends: ExtendsSchema.optional(),\n name: z.string().optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n routes: z.array(z.string()).optional(),\n});\nexport type ComposableAppEntry = z.infer<typeof ComposableAppEntrySchema>;\n\nexport const ApiPluginConfigSchema = ComposableAppEntrySchema;\nexport type ApiPluginConfig = z.infer<typeof ApiPluginConfigSchema>;\n\nexport const PluginUiConfigSchema = z.object({\n name: z.string(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n});\nexport type PluginUiConfig = z.infer<typeof PluginUiConfigSchema>;\n\nexport const BosPluginRefSchema = ComposableAppEntrySchema.extend({\n version: z.string().optional(),\n app: z.record(z.string(), z.unknown()).optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.unknown()).optional(),\n});\nexport type BosPluginRef = z.infer<typeof BosPluginRefSchema>;\nexport type PluginEntryValue = string | BosPluginRef;\nexport type PluginEntries = Record<string, PluginEntryValue>;\n\nconst PluginRuntimeUiSchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n localPath: z.string().optional(),\n port: z.number().optional(),\n integrity: z.string().optional(),\n});\nexport type PluginRuntimeUi = z.infer<typeof PluginRuntimeUiSchema>;\n\nexport const RuntimePluginConfigSchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n integrity: z.string().optional(),\n ui: PluginRuntimeUiSchema.optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n routes: z.array(z.string()).optional(),\n});\nexport type RuntimePluginConfig = z.infer<typeof RuntimePluginConfigSchema>;\n\nexport const UiConfigSchema = z.object({\n name: z.string(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n ssr: z.string().optional(),\n ssrIntegrity: z.string().optional(),\n});\nexport type UiConfig = z.infer<typeof UiConfigSchema>;\n\nexport const HostConfigSchema = z.object({\n development: z.string(),\n production: z.string(),\n integrity: z.string().optional(),\n secrets: z.array(z.string()).optional(),\n});\nexport type HostConfig = z.infer<typeof HostConfigSchema>;\n\nexport const ClientRuntimeInfoSchema = z.object({\n accountId: z.string(),\n gatewayId: z.string(),\n runtimeBasePath: z.string(),\n title: z.string().nullable(),\n description: z.string().nullable(),\n hostUrl: z.string().nullable(),\n});\nexport type ClientRuntimeInfo = z.infer<typeof ClientRuntimeInfoSchema>;\n\nexport const BosStagingSchema = z.object({\n domain: z.string(),\n});\nexport type BosStaging = z.infer<typeof BosStagingSchema>;\n\nconst BosConfigInputAppEntrySchema = z.record(z.string(), z.unknown());\nexport type BosConfigInputAppEntry = z.infer<typeof BosConfigInputAppEntrySchema>;\n\nexport const BosConfigInputSchema: z.ZodType<BosConfigInput> = z.lazy(() =>\n z.object({\n extends: ExtendsSchema.optional(),\n account: z.string().optional(),\n domain: z.string().optional(),\n testnet: z.string().optional(),\n template: z.string().optional(),\n gateway: z\n .object({\n development: z.string().optional(),\n production: z.string().optional(),\n account: z.string().optional(),\n })\n .optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n name: z.string().optional(),\n version: z.string().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n routes: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n app: z.record(z.string(), BosConfigInputAppEntrySchema).optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.union([z.string(), BosConfigInputSchema])).optional(),\n }),\n);\n\nexport interface BosConfigInput {\n extends?: string | ExtendsConfig;\n account?: string;\n domain?: string;\n title?: string;\n description?: string;\n testnet?: string;\n template?: string;\n gateway?: {\n development?: string;\n production?: string;\n account?: string;\n };\n development?: string;\n production?: string;\n integrity?: string;\n name?: string;\n version?: string;\n proxy?: string;\n variables?: Record<string, string>;\n secrets?: string[];\n routes?: string[];\n sidebar?: SidebarItem[];\n app?: Record<string, BosConfigInputAppEntry>;\n shared?: Record<string, Record<string, SharedDepConfig>>;\n plugins?: Record<string, string | BosConfigInput>;\n}\n\nexport const BosConfigSchema = z.object({\n account: z.string(),\n extends: ExtendsSchema.optional(),\n domain: z.string().optional(),\n title: z.string().optional(),\n description: z.string().optional(),\n testnet: z.string().optional(),\n staging: BosStagingSchema.optional(),\n repository: z.string().optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.union([z.string(), BosPluginRefSchema])).optional(),\n app: z.object({\n host: HostConfigSchema,\n ui: UiConfigSchema,\n api: ComposableAppEntrySchema,\n auth: ComposableAppEntrySchema.optional(),\n }),\n});\nexport type BosConfig = z.infer<typeof BosConfigSchema>;\n\nexport const RuntimeConfigSchema = z.object({\n env: z.enum([\"development\", \"production\", \"staging\"]),\n account: z.string(),\n domain: z.string().optional(),\n networkId: z.enum([\"mainnet\", \"testnet\"]),\n title: z.string().optional(),\n description: z.string().optional(),\n repository: z.string().optional(),\n host: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n secrets: z.array(z.string()).optional(),\n remoteUrl: z.string().optional(),\n }),\n shared: z\n .object({\n ui: z.record(z.string(), SharedConfigSchema).optional(),\n plugins: z.record(z.string(), SharedConfigSchema).optional(),\n })\n .optional(),\n ui: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n ssrUrl: z.string().optional(),\n ssrIntegrity: z.string().optional(),\n }),\n api: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n }),\n auth: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n }).optional(),\n plugins: z.record(z.string(), RuntimePluginConfigSchema).optional(),\n});\nexport type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;\n\nexport const ClientRuntimeConfigSchema = z.object({\n cspNonce: z.string().optional(),\n env: z.enum([\"development\", \"production\", \"staging\"]),\n account: z.string(),\n networkId: z.enum([\"mainnet\", \"testnet\"]),\n hostUrl: z.string().optional(),\n assetsUrl: z.string(),\n apiBase: z.string(),\n rpcBase: z.string(),\n repository: z.string().optional(),\n authAvailable: z.boolean().optional(),\n runtime: ClientRuntimeInfoSchema.optional(),\n ui: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n })\n .optional(),\n api: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n })\n .optional(),\n auth: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n })\n .optional(),\n plugins: z\n .record(\n z.string(),\n z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n ui: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n integrity: z.string().optional(),\n })\n .optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n }),\n )\n .optional(),\n});\nexport type ClientRuntimeConfig = z.infer<typeof ClientRuntimeConfigSchema>;\n"],"mappings":";;;AAEA,MAAa,gBAAgB,EAAE,MAAM,CACnC,EAAE,QAAQ,EACV,EAAE,OAAO;CACP,aAAa,EAA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,CACD,UAAU;CACb,KAAK,EACF,OAAO;EACN,MAAM,EAAE,QAAQ;EAChB,KAAK,EAAE,QAAQ;EACf,OAAO,EAAE,QAAQ;EACjB,WAAW,EAAE,QAAQ,CAAC,UAAU;EACjC,CAAC,CACD,UAAU;CACb,MAAM,EACH,OAAO;EACN,MAAM,EAAE,QAAQ;EAChB,KAAK,EAAE,QAAQ;EACf,OAAO,EAAE,QAAQ;EACjB,WAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,SAAS,EAAE,MAAM,kBAAkB,CAAC,UAAU;EAC/C,CAAC,CACD,UAAU;CACb,SAAS,EACN,OACC,EAAE,QAAQ,EACV,EAAE,OAAO;EACP,MAAM,EAAE,QAAQ;EAChB,KAAK,EAAE,QAAQ;EACf,OAAO,EAAE,QAAQ;EACjB,WAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,IAAI,EACD,OAAO;GACN,MAAM,EAAE,QAAQ;GAChB,KAAK,EAAE,QAAQ;GACf,OAAO,EAAE,QAAQ;GACjB,QAAQ;GACR,WAAW,EAAE,QAAQ,CAAC,UAAU;GACjC,CAAC,CACD,UAAU;EACb,SAAS,EAAE,MAAM,kBAAkB,CAAC,UAAU;EAC/C,CAAC,CACH,CACA,UAAU;CACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["import * as z from \"zod\";\n\nexport const ExtendsSchema = z.union([\n z.string(),\n z.object({\n development: z.string().optional(),\n production: z.string().optional(),\n staging: z.string().optional(),\n }),\n]);\nexport type Extends = z.infer<typeof ExtendsSchema>;\nexport type ExtendsConfig = Extract<Extends, Record<string, string | undefined>>;\n\nexport const SourceModeSchema = z.enum([\"local\", \"remote\"]);\nexport type SourceMode = z.infer<typeof SourceModeSchema>;\n\nexport const SharedConfigSchema = z.object({\n version: z.string(),\n requiredVersion: z.string().optional(),\n singleton: z.boolean().optional(),\n eager: z.boolean().optional(),\n strictVersion: z.boolean().optional(),\n shareScope: z.string().optional(),\n});\nexport type SharedConfig = z.infer<typeof SharedConfigSchema>;\nexport type SharedDepConfig = SharedConfig;\nexport const SharedDepConfigSchema = SharedConfigSchema;\n\nexport const FederationEntrySchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n integrity: z.string().optional(),\n});\nexport type FederationEntry = z.infer<typeof FederationEntrySchema>;\n\nexport const SidebarRoleSchema = z.enum([\"anon\", \"member\", \"admin\"]);\nexport type SidebarRole = z.infer<typeof SidebarRoleSchema>;\n\nexport const SidebarItemSchema = z.object({\n icon: z.string(),\n label: z.string(),\n to: z.string().optional(),\n roleRequired: SidebarRoleSchema.optional(),\n});\nexport type SidebarItem = z.infer<typeof SidebarItemSchema>;\n\nexport const ComposableAppEntrySchema = z.object({\n extends: ExtendsSchema.optional(),\n name: z.string().optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n routes: z.array(z.string()).optional(),\n});\nexport type ComposableAppEntry = z.infer<typeof ComposableAppEntrySchema>;\n\nexport const ApiPluginConfigSchema = ComposableAppEntrySchema;\nexport type ApiPluginConfig = z.infer<typeof ApiPluginConfigSchema>;\n\nexport const PluginUiConfigSchema = z.object({\n name: z.string(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n});\nexport type PluginUiConfig = z.infer<typeof PluginUiConfigSchema>;\n\nexport const BosPluginRefSchema = ComposableAppEntrySchema.extend({\n version: z.string().optional(),\n app: z.record(z.string(), z.unknown()).optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.unknown()).optional(),\n});\nexport type BosPluginRef = z.infer<typeof BosPluginRefSchema>;\nexport type PluginEntryValue = string | BosPluginRef;\nexport type PluginEntries = Record<string, PluginEntryValue>;\n\nconst PluginRuntimeUiSchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n localPath: z.string().optional(),\n port: z.number().optional(),\n integrity: z.string().optional(),\n});\nexport type PluginRuntimeUi = z.infer<typeof PluginRuntimeUiSchema>;\n\nexport const RuntimePluginConfigSchema = z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n integrity: z.string().optional(),\n ui: PluginRuntimeUiSchema.optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n routes: z.array(z.string()).optional(),\n});\nexport type RuntimePluginConfig = z.infer<typeof RuntimePluginConfigSchema>;\n\nexport const UiConfigSchema = z.object({\n name: z.string().optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n ssr: z.string().optional(),\n ssrIntegrity: z.string().optional(),\n});\nexport type UiConfig = z.infer<typeof UiConfigSchema>;\n\nexport const HostConfigSchema = z.object({\n development: z.string(),\n production: z.string(),\n integrity: z.string().optional(),\n secrets: z.array(z.string()).optional(),\n});\nexport type HostConfig = z.infer<typeof HostConfigSchema>;\n\nexport const ClientRuntimeInfoSchema = z.object({\n accountId: z.string(),\n gatewayId: z.string(),\n runtimeBasePath: z.string(),\n title: z.string().nullable(),\n description: z.string().nullable(),\n hostUrl: z.string().nullable(),\n});\nexport type ClientRuntimeInfo = z.infer<typeof ClientRuntimeInfoSchema>;\n\nexport const BosStagingSchema = z.object({\n domain: z.string(),\n});\nexport type BosStaging = z.infer<typeof BosStagingSchema>;\n\nconst BosConfigInputAppEntrySchema = z.record(z.string(), z.unknown());\nexport type BosConfigInputAppEntry = z.infer<typeof BosConfigInputAppEntrySchema>;\n\nexport const BosConfigInputSchema: z.ZodType<BosConfigInput> = z.lazy(() =>\n z.object({\n extends: ExtendsSchema.optional(),\n account: z.string().optional(),\n domain: z.string().optional(),\n testnet: z.string().optional(),\n template: z.string().optional(),\n gateway: z\n .object({\n development: z.string().optional(),\n production: z.string().optional(),\n account: z.string().optional(),\n })\n .optional(),\n development: z.string().optional(),\n production: z.string().optional(),\n integrity: z.string().optional(),\n name: z.string().optional(),\n version: z.string().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n routes: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n app: z.record(z.string(), BosConfigInputAppEntrySchema).optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.union([z.string(), BosConfigInputSchema])).optional(),\n }),\n);\n\nexport interface BosConfigInput {\n extends?: string | ExtendsConfig;\n account?: string;\n domain?: string;\n title?: string;\n description?: string;\n testnet?: string;\n template?: string;\n gateway?: {\n development?: string;\n production?: string;\n account?: string;\n };\n development?: string;\n production?: string;\n integrity?: string;\n name?: string;\n version?: string;\n proxy?: string;\n variables?: Record<string, string>;\n secrets?: string[];\n routes?: string[];\n sidebar?: SidebarItem[];\n app?: Record<string, BosConfigInputAppEntry>;\n shared?: Record<string, Record<string, SharedDepConfig>>;\n plugins?: Record<string, string | BosConfigInput>;\n}\n\nexport const BosConfigSchema = z.object({\n account: z.string(),\n extends: ExtendsSchema.optional(),\n domain: z.string().optional(),\n title: z.string().optional(),\n description: z.string().optional(),\n testnet: z.string().optional(),\n staging: BosStagingSchema.optional(),\n repository: z.string().optional(),\n shared: z.record(z.string(), z.record(z.string(), SharedConfigSchema)).optional(),\n plugins: z.record(z.string(), z.union([z.string(), BosPluginRefSchema])).optional(),\n app: z.object({\n host: HostConfigSchema,\n ui: UiConfigSchema,\n api: ComposableAppEntrySchema,\n auth: ComposableAppEntrySchema.optional(),\n }),\n});\nexport type BosConfig = z.infer<typeof BosConfigSchema>;\n\nexport const RuntimeConfigSchema = z.object({\n env: z.enum([\"development\", \"production\", \"staging\"]),\n account: z.string(),\n domain: z.string().optional(),\n networkId: z.enum([\"mainnet\", \"testnet\"]),\n title: z.string().optional(),\n description: z.string().optional(),\n repository: z.string().optional(),\n host: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n secrets: z.array(z.string()).optional(),\n remoteUrl: z.string().optional(),\n }),\n shared: z\n .object({\n ui: z.record(z.string(), SharedConfigSchema).optional(),\n plugins: z.record(z.string(), SharedConfigSchema).optional(),\n })\n .optional(),\n ui: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n ssrUrl: z.string().optional(),\n ssrIntegrity: z.string().optional(),\n }),\n api: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n }),\n auth: FederationEntrySchema.extend({\n localPath: z.string().optional(),\n port: z.number().optional(),\n proxy: z.string().optional(),\n variables: z.record(z.string(), z.string()).optional(),\n secrets: z.array(z.string()).optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n }).optional(),\n plugins: z.record(z.string(), RuntimePluginConfigSchema).optional(),\n});\nexport type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;\n\nexport const ClientRuntimeConfigSchema = z.object({\n cspNonce: z.string().optional(),\n env: z.enum([\"development\", \"production\", \"staging\"]),\n account: z.string(),\n networkId: z.enum([\"mainnet\", \"testnet\"]),\n hostUrl: z.string().optional(),\n assetsUrl: z.string(),\n apiBase: z.string(),\n rpcBase: z.string(),\n repository: z.string().optional(),\n authAvailable: z.boolean().optional(),\n runtime: ClientRuntimeInfoSchema.optional(),\n ui: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n })\n .optional(),\n api: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n })\n .optional(),\n auth: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n })\n .optional(),\n plugins: z\n .record(\n z.string(),\n z.object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n integrity: z.string().optional(),\n ui: z\n .object({\n name: z.string(),\n url: z.string(),\n entry: z.string(),\n source: SourceModeSchema,\n integrity: z.string().optional(),\n })\n .optional(),\n sidebar: z.array(SidebarItemSchema).optional(),\n }),\n )\n .optional(),\n});\nexport type ClientRuntimeConfig = z.infer<typeof ClientRuntimeConfigSchema>;\n"],"mappings":";;;AAEA,MAAa,gBAAgB,EAAE,MAAM,CACnC,EAAE,QAAQ,EACV,EAAE,OAAO;CACP,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,YAAY,EAAE,QAAQ,CAAC,UAAU;CACjC,SAAS,EAAE,QAAQ,CAAC,UAAU;CAC/B,CAAC,CACH,CAAC;AAIF,MAAa,mBAAmB,EAAE,KAAK,CAAC,SAAS,SAAS,CAAC;AAG3D,MAAa,qBAAqB,EAAE,OAAO;CACzC,SAAS,EAAE,QAAQ;CACnB,iBAAiB,EAAE,QAAQ,CAAC,UAAU;CACtC,WAAW,EAAE,SAAS,CAAC,UAAU;CACjC,OAAO,EAAE,SAAS,CAAC,UAAU;CAC7B,eAAe,EAAE,SAAS,CAAC,UAAU;CACrC,YAAY,EAAE,QAAQ,CAAC,UAAU;CAClC,CAAC;AAGF,MAAa,wBAAwB;AAErC,MAAa,wBAAwB,EAAE,OAAO;CAC5C,MAAM,EAAE,QAAQ;CAChB,KAAK,EAAE,QAAQ;CACf,OAAO,EAAE,QAAQ;CACjB,QAAQ;CACR,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC;AAGF,MAAa,oBAAoB,EAAE,KAAK;CAAC;CAAQ;CAAU;CAAQ,CAAC;AAGpE,MAAa,oBAAoB,EAAE,OAAO;CACxC,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,QAAQ;CACjB,IAAI,EAAE,QAAQ,CAAC,UAAU;CACzB,c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