@askdb/config 1.0.0-beta.12 → 1.0.0-beta.13
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/README.md +19 -17
- package/dist/bootstrap.d.ts +3 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +16 -0
- package/dist/bootstrap.js.map +1 -1
- package/dist/constants.d.ts +15 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +15 -4
- package/dist/constants.js.map +1 -1
- package/dist/defaults.d.ts +33 -1
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +46 -10
- package/dist/defaults.js.map +1 -1
- package/dist/diagnostics.d.ts +10 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +13 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/flatten.d.ts +8 -1
- package/dist/flatten.d.ts.map +1 -1
- package/dist/flatten.js +100 -116
- package/dist/flatten.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/normalize.d.ts +53 -0
- package/dist/normalize.d.ts.map +1 -0
- package/dist/normalize.js +398 -0
- package/dist/normalize.js.map +1 -0
- package/dist/projection.d.ts +12 -1
- package/dist/projection.d.ts.map +1 -1
- package/dist/projection.js +12 -3
- package/dist/projection.js.map +1 -1
- package/dist/runtime-config.d.ts +43 -3
- package/dist/runtime-config.d.ts.map +1 -1
- package/dist/runtime-config.js +57 -12
- package/dist/runtime-config.js.map +1 -1
- package/dist/scaffold/ai.d.ts +30 -0
- package/dist/scaffold/ai.d.ts.map +1 -0
- package/dist/scaffold/ai.js +54 -0
- package/dist/scaffold/ai.js.map +1 -0
- package/dist/scaffold/index.d.ts +8 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/index.js +7 -0
- package/dist/scaffold/index.js.map +1 -0
- package/dist/types.d.ts +174 -106
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -4
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Prisma-style helpers for AskDB: `env()`, `defineConfig()`, plus discovery and loading of `askdb.config.*` / `.config/askdb.*` files used by first-party apps (`askdb` CLI, `@askdb/http-api`, `@askdb/studio`).
|
|
4
4
|
|
|
5
|
-
**`@askdb/config` is the single package that reads `process.env` directly** (during dotenv load, while `askdb.config.*` evaluates,
|
|
5
|
+
**`@askdb/config` is the single package that reads `process.env` directly** (during dotenv load, while `askdb.config.*` evaluates, for a tiny bootstrap-time overlay allowlist, and for the `ASKDB_DEBUG` diagnostics switch). All other packages obtain configuration through **`getAskDbRuntimeConfig()`**.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -31,29 +31,25 @@ export default defineConfig({
|
|
|
31
31
|
providerConfig: {
|
|
32
32
|
openai: {
|
|
33
33
|
apiKey: env("MY_OPENAI_API_KEY"),
|
|
34
|
-
model: env("MY_CHAT_MODEL"),
|
|
35
34
|
},
|
|
36
35
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
providerConfig: { postgres: { databaseUrl: env("MY_DATABASE_URL") } },
|
|
36
|
+
language: {
|
|
37
|
+
model: env("MY_LANGUAGE_MODEL"),
|
|
38
|
+
},
|
|
41
39
|
},
|
|
42
40
|
introspection: {
|
|
43
41
|
provider: "postgres",
|
|
44
|
-
providerConfig: { postgres: {} },
|
|
42
|
+
providerConfig: { postgres: { databaseUrl: env("MY_DATABASE_URL") } },
|
|
45
43
|
outputDir: env("MY_INTROSPECT_OUTPUT_DIR"),
|
|
46
44
|
},
|
|
47
|
-
rag: {
|
|
48
|
-
embedder: "mock",
|
|
49
|
-
embedderConfig: {},
|
|
50
|
-
store: "memory",
|
|
51
|
-
storeConfig: { memory: {} },
|
|
52
|
-
},
|
|
53
45
|
} satisfies AskDbConfig);
|
|
54
46
|
```
|
|
55
47
|
|
|
56
|
-
Your `.env` can use friendly names (`MY_OPENAI_API_KEY`, …). `defineConfig` runs `flattenAskDbConfig`, which maps the nested object onto the canonical environment variable names used in the **runtime flat map** (and in `aiEnv` for `@askdb/ai`). **Unset optional fields get defaults inside `flattenAskDbConfig`** (
|
|
48
|
+
Your `.env` can use friendly names (`MY_OPENAI_API_KEY`, …). `defineConfig` runs `flattenAskDbConfig`, which maps the nested object onto the canonical environment variable names used in the **runtime flat map** (and in `aiEnv` for `@askdb/ai`). **Unset optional fields get defaults inside `flattenAskDbConfig`** (language model, introspection output dir, database URL fallbacks, the mock embedder's vector width, file-store base path, pgvector index strategy, etc. — see `packages/config/src/defaults.ts`).
|
|
49
|
+
|
|
50
|
+
The `rag` block is optional. Omit it when you don't use retrieval: AskDB then uses the mock embedder and the in-memory store, as if `rag: { embedder: "mock", store: "memory", storeConfig: {} }` were set. Setting `ai.embedding` without the block is an error, since nothing would use that model.
|
|
51
|
+
|
|
52
|
+
`ai.providerConfig` holds provider connections only (one per provider, or a named list). The model choice lives in `ai.language` (the language model) and `ai.embedding` (the embedding model behind `rag.embedder: "ai"`), each with an optional `provider` and `connection`. Configs written in the older shape (`providerConfig.<provider>.model`, `ai.reasoning`, `rag.embedder: "openai" | "ai-sdk"`, `rag.embedderConfig`) still load: AskDB translates them at load, and `bootstrapAskDbEnv` emits one `DeprecationWarning` (code `ASKDB_CONFIG_DEPRECATED`) per old key. The old keys are removed at 1.0. See the [configuration reference](https://askdb.tools/reference/config/#the-ai-block).
|
|
57
53
|
|
|
58
54
|
## Architectural rule — `@askdb/config` is the sole `process.env` reader
|
|
59
55
|
|
|
@@ -67,11 +63,16 @@ const apiKey = opts.apiKey ?? config.rag.embedder.apiKey;
|
|
|
67
63
|
const level = config.logging.level;
|
|
68
64
|
// For @askdb/ai registry methods that accept an env-map argument:
|
|
69
65
|
const model = await aiRegistry.createLanguageModelFromEnv(config.ai.aiEnv, { ... });
|
|
66
|
+
// The embedding model, built from the ai.embedding connection only (ai.embedding is undefined unless
|
|
67
|
+
// rag.embedder is "ai"). The env map doesn't carry the width, so pass it as an option:
|
|
68
|
+
const embeddingModel = config.ai.embedding
|
|
69
|
+
? await aiRegistry.createEmbeddingModelFromEnv(config.ai.embedding.env, { dimensions: config.ai.embedding.dimensions })
|
|
70
|
+
: undefined;
|
|
70
71
|
```
|
|
71
72
|
|
|
72
73
|
**Rules:**
|
|
73
74
|
|
|
74
|
-
- Library packages
|
|
75
|
+
- Library packages that read AskDB settings must call `getAskDbRuntimeConfig()`, or take the runtime snapshot from their host as `@askdb/client` does, and use the returned typed fields. They must **not** call `env()`, `requiredEnv()`, or access `process.env` directly.
|
|
75
76
|
- `env(name)` is only for use inside `askdb.config.*` files authored by end users — it maps friendly `.env` names onto values that become part of the structured config and flat map.
|
|
76
77
|
- First-party app entry points call `bootstrapAskDbEnv()` at start-up. That loads dotenv, evaluates `askdb.config.*`, and installs an **in-memory runtime snapshot** (structured config + flat map + derived `aiEnv`). It does **not** copy AskDB settings into `process.env`.
|
|
77
78
|
|
|
@@ -81,10 +82,11 @@ const model = await aiRegistry.createLanguageModelFromEnv(config.ai.aiEnv, { ...
|
|
|
81
82
|
|
|
82
83
|
## API
|
|
83
84
|
|
|
84
|
-
- `getAskDbRuntimeConfig()` — **primary API for library packages**. Returns a typed `AskDbRuntimeConfig` from the bootstrapped snapshot (`structured`, `flat`-derived fields,
|
|
85
|
+
- `getAskDbRuntimeConfig()` — **primary API for library packages**. Returns a typed `AskDbRuntimeConfig` from the bootstrapped snapshot (`structured`, `flat`-derived fields, `ai.aiEnv` for `@askdb/core`, the resolved `ai.language` and `ai.embedding` sections, `rag.store` and `rag.storeConfig` (the vector store, `"memory"` when `rag` is omitted), and `deprecations`, the config's deprecation messages).
|
|
85
86
|
- `env(name)` / `requiredEnv(name)` — read `process.env` while authoring `askdb.config.*` only.
|
|
87
|
+
- `isAskDbDebugEnabled()` — `true` when the `ASKDB_DEBUG` shell variable is `1` or `true`. Binaries use it to print stack traces; it reads `process.env` directly so it works even when the config fails to load.
|
|
86
88
|
- `defineConfig(config)` — returns an `AskDbEnvProjection` with `config` (structured) and `entries` (flattened canonical map).
|
|
87
|
-
- `flattenAskDbConfig(config)` — nested config → flat canonical map (applies defaults for optional values).
|
|
89
|
+
- `flattenAskDbConfig(config)` — nested config → flat canonical map (translates deprecated keys, applies defaults for optional values).
|
|
88
90
|
- `bootstrapAskDbEnv(options?)` / `bootstrapAskDbRuntime` — load dotenv, load config, install the runtime snapshot.
|
|
89
91
|
- `loadAskDbConfigProjection(cwd)` / `loadAskDbConfigProjectionSync(cwd)` — load projection without installing the singleton (advanced / tests).
|
|
90
92
|
- `discoverAskDbConfigPath(cwd)` — returns the resolved config path, if any.
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ export type BootstrapAskDbEnvOptions = {
|
|
|
20
20
|
*
|
|
21
21
|
* `askdb.config.*` is the sole source of truth — use `env("VAR")` in the config file to read
|
|
22
22
|
* from the environment at load time.
|
|
23
|
+
*
|
|
24
|
+
* Each deprecated config key in use is reported once per process as a `DeprecationWarning`
|
|
25
|
+
* (code `ASKDB_CONFIG_DEPRECATED`); `getAskDbRuntimeConfig().deprecations` lists them for UIs.
|
|
23
26
|
*/
|
|
24
27
|
export declare function bootstrapAskDbEnv(options?: BootstrapAskDbEnvOptions): {
|
|
25
28
|
dotenvPath?: string;
|
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,wBAAwB,GAAG;IACrC,mGAAmG;IACnG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAeF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,wBAA6B,GAAG;IACzE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAmDA;AAED,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB,0BAAoB,CAAC"}
|
package/dist/bootstrap.js
CHANGED
|
@@ -5,6 +5,18 @@ import { loadAskDbConfigProjectionSync } from "./load-merge.js";
|
|
|
5
5
|
import { setAskDbRuntime } from "./runtime-store.js";
|
|
6
6
|
/** dotenv v17 logs injected keys by default; keep bootstrap silent like v16. */
|
|
7
7
|
const DOTENV_LOAD_OPTIONS = { quiet: true };
|
|
8
|
+
/** `process.emitWarning` code for a deprecated `askdb.config` key. */
|
|
9
|
+
const CONFIG_DEPRECATION_CODE = "ASKDB_CONFIG_DEPRECATED";
|
|
10
|
+
/** Deprecation messages already emitted: a process that bootstraps twice warns once. */
|
|
11
|
+
const emittedDeprecations = new Set();
|
|
12
|
+
function emitConfigDeprecations(deprecations) {
|
|
13
|
+
for (const message of deprecations ?? []) {
|
|
14
|
+
if (emittedDeprecations.has(message))
|
|
15
|
+
continue;
|
|
16
|
+
emittedDeprecations.add(message);
|
|
17
|
+
process.emitWarning(message, { type: "DeprecationWarning", code: CONFIG_DEPRECATION_CODE });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
8
20
|
function handleDotenvError(error, nonFatal) {
|
|
9
21
|
const err = error;
|
|
10
22
|
const code = typeof err.code === "string" ? err.code : undefined;
|
|
@@ -26,6 +38,9 @@ function handleDotenvError(error, nonFatal) {
|
|
|
26
38
|
*
|
|
27
39
|
* `askdb.config.*` is the sole source of truth — use `env("VAR")` in the config file to read
|
|
28
40
|
* from the environment at load time.
|
|
41
|
+
*
|
|
42
|
+
* Each deprecated config key in use is reported once per process as a `DeprecationWarning`
|
|
43
|
+
* (code `ASKDB_CONFIG_DEPRECATED`); `getAskDbRuntimeConfig().deprecations` lists them for UIs.
|
|
29
44
|
*/
|
|
30
45
|
export function bootstrapAskDbEnv(options = {}) {
|
|
31
46
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -75,6 +90,7 @@ export function bootstrapAskDbEnv(options = {}) {
|
|
|
75
90
|
structured: projection.config,
|
|
76
91
|
flat: { ...projection.entries },
|
|
77
92
|
});
|
|
93
|
+
emitConfigDeprecations(projection.deprecations);
|
|
78
94
|
return { dotenvPath, configPath };
|
|
79
95
|
}
|
|
80
96
|
/** Alias for {@link bootstrapAskDbEnv} (explicit naming). */
|
package/dist/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,gFAAgF;AAChF,MAAM,mBAAmB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,gFAAgF;AAChF,MAAM,mBAAmB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAW,CAAC;AA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gBACtB,4BAA4B;YAC9B,CAAC;iBAAM,CAAC;gBACN,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;IACH,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC;IAC5E,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,oDAAoD,GAAG,IAAI;YACzD,kFAAkF,CACrF,CAAC;IACJ,CAAC;IAED,eAAe,CAAC;QACd,UAAU,EAAE,UAAU,CAAC,MAAM;QAC7B,IAAI,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE;KAChC,CAAC,CAAC;IACH,sBAAsB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAEhD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AACpC,CAAC;AAED,6DAA6D;AAC7D,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -8,16 +8,27 @@ export type AskDbModeV1 = (typeof ASKDB_MODES_V1)[number];
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const ASKDB_LOG_LEVELS: readonly ["fatal", "error", "warn", "info", "debug", "trace", "silent"];
|
|
10
10
|
export type AskDbLogLevel = (typeof ASKDB_LOG_LEVELS)[number];
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* `rag.embedder` values: `"mock"` (a local lexical embedder) or `"ai"` (the `ai.embedding`
|
|
13
|
+
* model). `"openai"` and `"ai-sdk"` are deprecated: they're translated to `"ai"` at load,
|
|
14
|
+
* with a warning, and removed at 1.0.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ASKDB_RAG_EMBEDDERS: readonly ["mock", "ai", "openai", "ai-sdk"];
|
|
13
17
|
export type AskDbRagEmbedder = (typeof ASKDB_RAG_EMBEDDERS)[number];
|
|
14
18
|
export declare const ASKDB_RAG_STORES: readonly ["file", "memory", "pgvector"];
|
|
15
19
|
export type AskDbRagStore = (typeof ASKDB_RAG_STORES)[number];
|
|
16
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Provider ids with a dedicated `ai.providerConfig.<id>` branch in `askdb.config.*`.
|
|
22
|
+
* Mirrors the built-in provider table in `@askdb/ai` (`BUILTIN_AI_PROVIDERS`: every
|
|
23
|
+
* built-in plus the `foundry` alias). `@askdb/config` must not depend on `@askdb/ai`,
|
|
24
|
+
* so the list is duplicated here; `packages/client/src/provider-config-drift.test.ts`
|
|
25
|
+
* fails if the two drift.
|
|
26
|
+
*/
|
|
27
|
+
export declare const ASKDB_AI_PROVIDERS: readonly ["openai", "azure", "foundry", "anthropic", "google", "gateway"];
|
|
17
28
|
export type AskDbAiProviderId = (typeof ASKDB_AI_PROVIDERS)[number];
|
|
18
29
|
/**
|
|
19
30
|
* Provider-portable reasoning/latency effort for AskDB model calls. Maps to
|
|
20
|
-
* each provider's native knob by the
|
|
31
|
+
* each provider's native knob by the provider adapter (see `@askdb/ai`'s
|
|
21
32
|
* `resolveProviderOptions`). Keep aligned with `REASONING_EFFORTS` in
|
|
22
33
|
* `@askdb/ai` (`packages/ai/src/reasoning.ts`).
|
|
23
34
|
*/
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,cAAc,6CAA8C,CAAC;AAC1E,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,gBAAgB,yEAQnB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB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;AACX,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -14,13 +14,24 @@ export const ASKDB_LOG_LEVELS = [
|
|
|
14
14
|
"trace",
|
|
15
15
|
"silent",
|
|
16
16
|
];
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `rag.embedder` values: `"mock"` (a local lexical embedder) or `"ai"` (the `ai.embedding`
|
|
19
|
+
* model). `"openai"` and `"ai-sdk"` are deprecated: they're translated to `"ai"` at load,
|
|
20
|
+
* with a warning, and removed at 1.0.
|
|
21
|
+
*/
|
|
22
|
+
export const ASKDB_RAG_EMBEDDERS = ["mock", "ai", "openai", "ai-sdk"];
|
|
19
23
|
export const ASKDB_RAG_STORES = ["file", "memory", "pgvector"];
|
|
20
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Provider ids with a dedicated `ai.providerConfig.<id>` branch in `askdb.config.*`.
|
|
26
|
+
* Mirrors the built-in provider table in `@askdb/ai` (`BUILTIN_AI_PROVIDERS`: every
|
|
27
|
+
* built-in plus the `foundry` alias). `@askdb/config` must not depend on `@askdb/ai`,
|
|
28
|
+
* so the list is duplicated here; `packages/client/src/provider-config-drift.test.ts`
|
|
29
|
+
* fails if the two drift.
|
|
30
|
+
*/
|
|
31
|
+
export const ASKDB_AI_PROVIDERS = ["openai", "azure", "foundry", "anthropic", "google", "gateway"];
|
|
21
32
|
/**
|
|
22
33
|
* Provider-portable reasoning/latency effort for AskDB model calls. Maps to
|
|
23
|
-
* each provider's native knob by the
|
|
34
|
+
* each provider's native knob by the provider adapter (see `@askdb/ai`'s
|
|
24
35
|
* `resolveProviderOptions`). Keep aligned with `REASONING_EFFORTS` in
|
|
25
36
|
* `@askdb/ai` (`packages/ai/src/reasoning.ts`).
|
|
26
37
|
*/
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAU,CAAC;AAG1E;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;CACA,CAAC;AAGX
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAU,CAAC;AAG1E;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;CACA,CAAC;AAGX;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAG/E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AAGxE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAG5G;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAGrF,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;CACH,CAAC;AAGX;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU;IACV,aAAa;IACb,OAAO;IACP,SAAS;IACT,QAAQ;IACR,WAAW;CACH,CAAC;AAGX;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,UAAU;IACV,OAAO;IACP,QAAQ;IACR,WAAW;CACH,CAAC"}
|
package/dist/defaults.d.ts
CHANGED
|
@@ -2,12 +2,32 @@
|
|
|
2
2
|
* Canonical defaults applied in {@link flattenAskDbConfig} when optional env-backed
|
|
3
3
|
* fields are unset (missing, blank, or invalid after trim).
|
|
4
4
|
*/
|
|
5
|
+
export declare const DEFAULT_OPENAI_LANGUAGE_MODEL = "gpt-4o-mini";
|
|
6
|
+
/** @deprecated Use DEFAULT_OPENAI_LANGUAGE_MODEL. Removed at 1.0. */
|
|
5
7
|
export declare const DEFAULT_OPENAI_CHAT_MODEL = "gpt-4o-mini";
|
|
6
8
|
export declare const DEFAULT_AZURE_OPENAI_DEPLOYMENT = "gpt-4o-mini";
|
|
9
|
+
export declare const DEFAULT_ANTHROPIC_LANGUAGE_MODEL = "claude-sonnet-4-6";
|
|
10
|
+
/** @deprecated Use DEFAULT_ANTHROPIC_LANGUAGE_MODEL. Removed at 1.0. */
|
|
7
11
|
export declare const DEFAULT_ANTHROPIC_CHAT_MODEL = "claude-sonnet-4-6";
|
|
12
|
+
export declare const DEFAULT_GOOGLE_LANGUAGE_MODEL = "gemini-2.0-flash";
|
|
13
|
+
/** @deprecated Use DEFAULT_GOOGLE_LANGUAGE_MODEL. Removed at 1.0. */
|
|
8
14
|
export declare const DEFAULT_GOOGLE_CHAT_MODEL = "gemini-2.0-flash";
|
|
15
|
+
export declare const DEFAULT_GATEWAY_LANGUAGE_MODEL = "openai/gpt-4o-mini";
|
|
16
|
+
/** @deprecated Use DEFAULT_GATEWAY_LANGUAGE_MODEL. Removed at 1.0. */
|
|
17
|
+
export declare const DEFAULT_GATEWAY_CHAT_MODEL = "openai/gpt-4o-mini";
|
|
9
18
|
export declare const DEFAULT_INTROSPECT_OUTPUT_DIR = "./askdb/";
|
|
19
|
+
/** Default model-call timeout for `@askdb/http-api` `POST /ask` (`httpApi.requestTimeoutMs`). */
|
|
20
|
+
export declare const DEFAULT_HTTP_API_REQUEST_TIMEOUT_MS = 60000;
|
|
21
|
+
/**
|
|
22
|
+
* Largest `httpApi.requestTimeoutMs`: the Node timer maximum (2^31 - 1 ms, about 24.8 days).
|
|
23
|
+
* A larger `AbortSignal.timeout()` fires after 1 ms, or throws `ERR_OUT_OF_RANGE` past 2^32 - 1.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MAX_HTTP_API_REQUEST_TIMEOUT_MS = 2147483647;
|
|
10
26
|
export declare const DEFAULT_LOCAL_POSTGRES_URL = "postgres://postgres:postgres@127.0.0.1:5432/postgres";
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated AskDB has no default embedding model: set `ai.embedding.model`. This is only the
|
|
29
|
+
* model a legacy `rag.embedder: "openai"` config translates to. Removed at 1.0.
|
|
30
|
+
*/
|
|
11
31
|
export declare const DEFAULT_RAG_EMBEDDING_MODEL = "text-embedding-3-small";
|
|
12
32
|
/** Under the same visible tree as {@link DEFAULT_INTROSPECT_OUTPUT_DIR} (`./askdb/…`). */
|
|
13
33
|
export declare const DEFAULT_RAG_FILE_BASE_PATH = "./askdb/rag";
|
|
@@ -19,8 +39,20 @@ export declare const DEFAULT_STUDIO_EXECUTE_TIMEOUT_MS = 30000;
|
|
|
19
39
|
export declare const DEFAULT_STUDIO_EXECUTE_MAX_ROWS = 500;
|
|
20
40
|
export declare const PGVECTOR_INDEX_STRATEGIES: readonly ["ivfflat", "hnsw", "none"];
|
|
21
41
|
export type PgvectorIndexStrategyId = (typeof PGVECTOR_INDEX_STRATEGIES)[number];
|
|
22
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The width earlier versions assumed for an embedding model: 3072 for `text-embedding-3-large`,
|
|
44
|
+
* else 1536, whatever the provider.
|
|
45
|
+
*
|
|
46
|
+
* @deprecated AskDB no longer assumes a width: it learns it from the embedding model
|
|
47
|
+
* (`detectEmbeddingDimensions` in `@askdb/rag`). Removed at 1.0.
|
|
48
|
+
*/
|
|
23
49
|
export declare function defaultRagEmbeddingDimensions(model: string): number;
|
|
24
50
|
export declare function parsePositiveInteger(value: string | number | undefined): number | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Parse `httpApi.requestTimeoutMs` (or its flat key `ASKDB_HTTP_REQUEST_TIMEOUT_MS`).
|
|
53
|
+
* Returns `undefined` when unset; throws naming `source` unless the value is a positive
|
|
54
|
+
* integer no larger than {@link MAX_HTTP_API_REQUEST_TIMEOUT_MS}.
|
|
55
|
+
*/
|
|
56
|
+
export declare function parseHttpApiRequestTimeoutMs(value: string | number | undefined, source: string): number | undefined;
|
|
25
57
|
export declare function normalizePgvectorIndexStrategy(raw: string | undefined): PgvectorIndexStrategyId;
|
|
26
58
|
//# sourceMappingURL=defaults.d.ts.map
|
package/dist/defaults.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,6BAA6B,gBAAgB,CAAC;AAC3D,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,gBAAgC,CAAC;AACvE,eAAO,MAAM,+BAA+B,gBAAgB,CAAC;AAC7D,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AACpE,wEAAwE;AACxE,eAAO,MAAM,4BAA4B,sBAAmC,CAAC;AAC7E,eAAO,MAAM,6BAA6B,qBAAqB,CAAC;AAChE,qEAAqE;AACrE,eAAO,MAAM,yBAAyB,qBAAgC,CAAC;AACvE,eAAO,MAAM,8BAA8B,uBAAuB,CAAC;AACnE,sEAAsE;AACtE,eAAO,MAAM,0BAA0B,uBAAiC,CAAC;AACzE,eAAO,MAAM,6BAA6B,aAAa,CAAC;AACxD,iGAAiG;AACjG,eAAO,MAAM,mCAAmC,QAAS,CAAC;AAC1D;;;GAGG;AACH,eAAO,MAAM,+BAA+B,aAAgB,CAAC;AAC7D,eAAO,MAAM,0BAA0B,yDAAyD,CAAC;AACjG;;;GAGG;AACH,eAAO,MAAM,2BAA2B,2BAA2B,CAAC;AACpE,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B,gBAAgB,CAAC;AACxD,eAAO,MAAM,qCAAqC,KAAK,CAAC;AACxD,eAAO,MAAM,+BAA+B,EAAG,MAAe,CAAC;AAC/D,2FAA2F;AAC3F,eAAO,MAAM,iCAAiC,QAAS,CAAC;AACxD,6EAA6E;AAC7E,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,eAAO,MAAM,yBAAyB,sCAAuC,CAAC;AAC9E,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAU3F;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUnH;AAED,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,uBAAuB,CAK/F"}
|
package/dist/defaults.js
CHANGED
|
@@ -2,12 +2,32 @@
|
|
|
2
2
|
* Canonical defaults applied in {@link flattenAskDbConfig} when optional env-backed
|
|
3
3
|
* fields are unset (missing, blank, or invalid after trim).
|
|
4
4
|
*/
|
|
5
|
-
export const
|
|
5
|
+
export const DEFAULT_OPENAI_LANGUAGE_MODEL = "gpt-4o-mini";
|
|
6
|
+
/** @deprecated Use DEFAULT_OPENAI_LANGUAGE_MODEL. Removed at 1.0. */
|
|
7
|
+
export const DEFAULT_OPENAI_CHAT_MODEL = DEFAULT_OPENAI_LANGUAGE_MODEL;
|
|
6
8
|
export const DEFAULT_AZURE_OPENAI_DEPLOYMENT = "gpt-4o-mini";
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
+
export const DEFAULT_ANTHROPIC_LANGUAGE_MODEL = "claude-sonnet-4-6";
|
|
10
|
+
/** @deprecated Use DEFAULT_ANTHROPIC_LANGUAGE_MODEL. Removed at 1.0. */
|
|
11
|
+
export const DEFAULT_ANTHROPIC_CHAT_MODEL = DEFAULT_ANTHROPIC_LANGUAGE_MODEL;
|
|
12
|
+
export const DEFAULT_GOOGLE_LANGUAGE_MODEL = "gemini-2.0-flash";
|
|
13
|
+
/** @deprecated Use DEFAULT_GOOGLE_LANGUAGE_MODEL. Removed at 1.0. */
|
|
14
|
+
export const DEFAULT_GOOGLE_CHAT_MODEL = DEFAULT_GOOGLE_LANGUAGE_MODEL;
|
|
15
|
+
export const DEFAULT_GATEWAY_LANGUAGE_MODEL = "openai/gpt-4o-mini";
|
|
16
|
+
/** @deprecated Use DEFAULT_GATEWAY_LANGUAGE_MODEL. Removed at 1.0. */
|
|
17
|
+
export const DEFAULT_GATEWAY_CHAT_MODEL = DEFAULT_GATEWAY_LANGUAGE_MODEL;
|
|
9
18
|
export const DEFAULT_INTROSPECT_OUTPUT_DIR = "./askdb/";
|
|
19
|
+
/** Default model-call timeout for `@askdb/http-api` `POST /ask` (`httpApi.requestTimeoutMs`). */
|
|
20
|
+
export const DEFAULT_HTTP_API_REQUEST_TIMEOUT_MS = 60_000;
|
|
21
|
+
/**
|
|
22
|
+
* Largest `httpApi.requestTimeoutMs`: the Node timer maximum (2^31 - 1 ms, about 24.8 days).
|
|
23
|
+
* A larger `AbortSignal.timeout()` fires after 1 ms, or throws `ERR_OUT_OF_RANGE` past 2^32 - 1.
|
|
24
|
+
*/
|
|
25
|
+
export const MAX_HTTP_API_REQUEST_TIMEOUT_MS = 2_147_483_647;
|
|
10
26
|
export const DEFAULT_LOCAL_POSTGRES_URL = "postgres://postgres:postgres@127.0.0.1:5432/postgres";
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated AskDB has no default embedding model: set `ai.embedding.model`. This is only the
|
|
29
|
+
* model a legacy `rag.embedder: "openai"` config translates to. Removed at 1.0.
|
|
30
|
+
*/
|
|
11
31
|
export const DEFAULT_RAG_EMBEDDING_MODEL = "text-embedding-3-small";
|
|
12
32
|
/** Under the same visible tree as {@link DEFAULT_INTROSPECT_OUTPUT_DIR} (`./askdb/…`). */
|
|
13
33
|
export const DEFAULT_RAG_FILE_BASE_PATH = "./askdb/rag";
|
|
@@ -18,14 +38,15 @@ export const DEFAULT_STUDIO_EXECUTE_TIMEOUT_MS = 30_000;
|
|
|
18
38
|
/** Default row cap for Studio execute results (`studio.execute.maxRows`). */
|
|
19
39
|
export const DEFAULT_STUDIO_EXECUTE_MAX_ROWS = 500;
|
|
20
40
|
export const PGVECTOR_INDEX_STRATEGIES = ["ivfflat", "hnsw", "none"];
|
|
21
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* The width earlier versions assumed for an embedding model: 3072 for `text-embedding-3-large`,
|
|
43
|
+
* else 1536, whatever the provider.
|
|
44
|
+
*
|
|
45
|
+
* @deprecated AskDB no longer assumes a width: it learns it from the embedding model
|
|
46
|
+
* (`detectEmbeddingDimensions` in `@askdb/rag`). Removed at 1.0.
|
|
47
|
+
*/
|
|
22
48
|
export function defaultRagEmbeddingDimensions(model) {
|
|
23
|
-
|
|
24
|
-
if (m === "text-embedding-3-large")
|
|
25
|
-
return 3072;
|
|
26
|
-
if (m === "text-embedding-ada-002")
|
|
27
|
-
return 1536;
|
|
28
|
-
return 1536;
|
|
49
|
+
return model.trim() === "text-embedding-3-large" ? 3072 : 1536;
|
|
29
50
|
}
|
|
30
51
|
export function parsePositiveInteger(value) {
|
|
31
52
|
if (value === undefined)
|
|
@@ -41,6 +62,21 @@ export function parsePositiveInteger(value) {
|
|
|
41
62
|
return undefined;
|
|
42
63
|
return n;
|
|
43
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Parse `httpApi.requestTimeoutMs` (or its flat key `ASKDB_HTTP_REQUEST_TIMEOUT_MS`).
|
|
67
|
+
* Returns `undefined` when unset; throws naming `source` unless the value is a positive
|
|
68
|
+
* integer no larger than {@link MAX_HTTP_API_REQUEST_TIMEOUT_MS}.
|
|
69
|
+
*/
|
|
70
|
+
export function parseHttpApiRequestTimeoutMs(value, source) {
|
|
71
|
+
if (value === undefined)
|
|
72
|
+
return undefined;
|
|
73
|
+
// A JavaScript config can pass any type; only numbers and numeric strings are parsed.
|
|
74
|
+
const n = typeof value === "number" || typeof value === "string" ? parsePositiveInteger(value) : undefined;
|
|
75
|
+
if (n === undefined || n > MAX_HTTP_API_REQUEST_TIMEOUT_MS) {
|
|
76
|
+
throw new Error(`askdb.config: invalid ${source} ${JSON.stringify(value)} (expected a positive integer number of milliseconds, at most ${MAX_HTTP_API_REQUEST_TIMEOUT_MS}).`);
|
|
77
|
+
}
|
|
78
|
+
return n;
|
|
79
|
+
}
|
|
44
80
|
export function normalizePgvectorIndexStrategy(raw) {
|
|
45
81
|
if (raw === undefined || raw.trim() === "")
|
|
46
82
|
return DEFAULT_PGVECTOR_INDEX_STRATEGY;
|
package/dist/defaults.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,aAAa,CAAC;AAC3D,qEAAqE;AACrE,MAAM,CAAC,MAAM,yBAAyB,GAAG,6BA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AS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,+BAA+B,CAAC;IACnF,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,qCAAqC,CAAC,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the `ASKDB_DEBUG` shell variable asks first-party binaries for debug diagnostics,
|
|
3
|
+
* such as the stack trace of an unexpected error.
|
|
4
|
+
*
|
|
5
|
+
* Reads `process.env` directly rather than the runtime snapshot, because it must work when
|
|
6
|
+
* `askdb.config.*` is missing or fails to load. Only `1` or `true` (case-insensitive) turn it on;
|
|
7
|
+
* `0`, `false`, and any other value leave it off.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isAskDbDebugEnabled(): boolean;
|
|
10
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAG7C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the `ASKDB_DEBUG` shell variable asks first-party binaries for debug diagnostics,
|
|
3
|
+
* such as the stack trace of an unexpected error.
|
|
4
|
+
*
|
|
5
|
+
* Reads `process.env` directly rather than the runtime snapshot, because it must work when
|
|
6
|
+
* `askdb.config.*` is missing or fails to load. Only `1` or `true` (case-insensitive) turn it on;
|
|
7
|
+
* `0`, `false`, and any other value leave it off.
|
|
8
|
+
*/
|
|
9
|
+
export function isAskDbDebugEnabled() {
|
|
10
|
+
const raw = process.env.ASKDB_DEBUG?.trim().toLowerCase();
|
|
11
|
+
return raw === "1" || raw === "true";
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1D,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,MAAM,CAAC;AACvC,CAAC"}
|
package/dist/flatten.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { type NormalizedAiEmbeddingSection, type NormalizedAiLanguageSection, type NormalizedAskDbConfig } from "./normalize.js";
|
|
1
2
|
import type { AskDbConfig } from "./types.js";
|
|
3
|
+
/** The env view of `ai.language`: its provider, its connection only, its model and reasoning. */
|
|
4
|
+
export declare function aiLanguageEnv(section: NormalizedAiLanguageSection): Record<string, string>;
|
|
5
|
+
/** The env view of `ai.embedding`: its provider, its connection only, and its model. Nothing from the language side. */
|
|
6
|
+
export declare function aiEmbeddingEnv(section: NormalizedAiEmbeddingSection): Record<string, string>;
|
|
2
7
|
/**
|
|
3
8
|
* Flattens a nested {@link AskDbConfig} into canonical env keys for the runtime snapshot
|
|
4
|
-
* (`AskDbEnvProjection.entries`).
|
|
9
|
+
* (`AskDbEnvProjection.entries`). Deprecated keys are translated first (see
|
|
10
|
+
* `normalizeAskDbConfig`); the AI keys come from the `ai.language` section's connection.
|
|
5
11
|
*/
|
|
6
12
|
export declare function flattenAskDbConfig(config: AskDbConfig): Record<string, string>;
|
|
13
|
+
export declare function flattenNormalizedAskDbConfig(config: NormalizedAskDbConfig): Record<string, string>;
|
|
7
14
|
//# sourceMappingURL=flatten.d.ts.map
|
package/dist/flatten.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../src/flatten.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../src/flatten.ts"],"names":[],"mappings":"AAaA,OAAO,EAIL,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,YAAY,CAAC;AAoEtE,iGAAiG;AACjG,wBAAgB,aAAa,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO1F;AAED,wHAAwH;AACxH,wBAAgB,cAAc,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAM5F;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE9E;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4KlG"}
|