@_linked/core 2.12.0 → 2.13.0
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/CHANGELOG.md +6 -0
- package/lib/esm/queries/IRPipeline.d.ts +7 -1
- package/lib/esm/queries/IRPipeline.js +20 -6
- package/lib/esm/queries/IRPipeline.js.map +1 -1
- package/lib/esm/queries/queryDispatch.js +12 -2
- package/lib/esm/queries/queryDispatch.js.map +1 -1
- package/package.json +10 -13
- package/lib/cjs/collections/CoreSet.d.ts +0 -47
- package/lib/cjs/collections/CoreSet.js +0 -136
- package/lib/cjs/collections/CoreSet.js.map +0 -1
- package/lib/cjs/collections/ShapeSet.d.ts +0 -6
- package/lib/cjs/collections/ShapeSet.js +0 -20
- package/lib/cjs/collections/ShapeSet.js.map +0 -1
- package/lib/cjs/expressions/Expr.d.ts +0 -29
- package/lib/cjs/expressions/Expr.js +0 -80
- package/lib/cjs/expressions/Expr.js.map +0 -1
- package/lib/cjs/expressions/ExpressionMethods.d.ts +0 -85
- package/lib/cjs/expressions/ExpressionMethods.js +0 -3
- package/lib/cjs/expressions/ExpressionMethods.js.map +0 -1
- package/lib/cjs/expressions/ExpressionNode.d.ts +0 -144
- package/lib/cjs/expressions/ExpressionNode.js +0 -432
- package/lib/cjs/expressions/ExpressionNode.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -29
- package/lib/cjs/index.js +0 -65
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/ICoreIterable.d.ts +0 -14
- package/lib/cjs/interfaces/ICoreIterable.js +0 -3
- package/lib/cjs/interfaces/ICoreIterable.js.map +0 -1
- package/lib/cjs/interfaces/IDataset.d.ts +0 -26
- package/lib/cjs/interfaces/IDataset.js +0 -3
- package/lib/cjs/interfaces/IDataset.js.map +0 -1
- package/lib/cjs/interfaces/IFileStore.d.ts +0 -16
- package/lib/cjs/interfaces/IFileStore.js +0 -3
- package/lib/cjs/interfaces/IFileStore.js.map +0 -1
- package/lib/cjs/ontologies/linked-core.d.ts +0 -15
- package/lib/cjs/ontologies/linked-core.js +0 -38
- package/lib/cjs/ontologies/linked-core.js.map +0 -1
- package/lib/cjs/ontologies/npm.d.ts +0 -6
- package/lib/cjs/ontologies/npm.js +0 -15
- package/lib/cjs/ontologies/npm.js.map +0 -1
- package/lib/cjs/ontologies/owl.d.ts +0 -14
- package/lib/cjs/ontologies/owl.js +0 -21
- package/lib/cjs/ontologies/owl.js.map +0 -1
- package/lib/cjs/ontologies/rdf.d.ts +0 -13
- package/lib/cjs/ontologies/rdf.js +0 -27
- package/lib/cjs/ontologies/rdf.js.map +0 -1
- package/lib/cjs/ontologies/rdfs.d.ts +0 -16
- package/lib/cjs/ontologies/rdfs.js +0 -33
- package/lib/cjs/ontologies/rdfs.js.map +0 -1
- package/lib/cjs/ontologies/shacl.d.ts +0 -103
- package/lib/cjs/ontologies/shacl.js +0 -152
- package/lib/cjs/ontologies/shacl.js.map +0 -1
- package/lib/cjs/ontologies/xsd.d.ts +0 -19
- package/lib/cjs/ontologies/xsd.js +0 -41
- package/lib/cjs/ontologies/xsd.js.map +0 -1
- package/lib/cjs/package.d.ts +0 -4
- package/lib/cjs/package.js +0 -6
- package/lib/cjs/package.js.map +0 -1
- package/lib/cjs/package.json +0 -9
- package/lib/cjs/paths/PropertyPathExpr.d.ts +0 -38
- package/lib/cjs/paths/PropertyPathExpr.js +0 -221
- package/lib/cjs/paths/PropertyPathExpr.js.map +0 -1
- package/lib/cjs/paths/normalizePropertyPath.d.ts +0 -23
- package/lib/cjs/paths/normalizePropertyPath.js +0 -75
- package/lib/cjs/paths/normalizePropertyPath.js.map +0 -1
- package/lib/cjs/paths/pathExprToSparql.d.ts +0 -14
- package/lib/cjs/paths/pathExprToSparql.js +0 -136
- package/lib/cjs/paths/pathExprToSparql.js.map +0 -1
- package/lib/cjs/queries/ContextRef.d.ts +0 -32
- package/lib/cjs/queries/ContextRef.js +0 -69
- package/lib/cjs/queries/ContextRef.js.map +0 -1
- package/lib/cjs/queries/CreateBuilder.d.ts +0 -59
- package/lib/cjs/queries/CreateBuilder.js +0 -138
- package/lib/cjs/queries/CreateBuilder.js.map +0 -1
- package/lib/cjs/queries/CreateQuery.d.ts +0 -20
- package/lib/cjs/queries/CreateQuery.js +0 -3
- package/lib/cjs/queries/CreateQuery.js.map +0 -1
- package/lib/cjs/queries/DeleteBuilder.d.ts +0 -56
- package/lib/cjs/queries/DeleteBuilder.js +0 -172
- package/lib/cjs/queries/DeleteBuilder.js.map +0 -1
- package/lib/cjs/queries/DeleteQuery.d.ts +0 -37
- package/lib/cjs/queries/DeleteQuery.js +0 -3
- package/lib/cjs/queries/DeleteQuery.js.map +0 -1
- package/lib/cjs/queries/DslJsonExpression.d.ts +0 -68
- package/lib/cjs/queries/DslJsonExpression.js +0 -427
- package/lib/cjs/queries/DslJsonExpression.js.map +0 -1
- package/lib/cjs/queries/FieldSet.d.ts +0 -310
- package/lib/cjs/queries/FieldSet.js +0 -802
- package/lib/cjs/queries/FieldSet.js.map +0 -1
- package/lib/cjs/queries/IRAliasScope.d.ts +0 -20
- package/lib/cjs/queries/IRAliasScope.js +0 -52
- package/lib/cjs/queries/IRAliasScope.js.map +0 -1
- package/lib/cjs/queries/IRCanonicalize.d.ts +0 -19
- package/lib/cjs/queries/IRCanonicalize.js +0 -19
- package/lib/cjs/queries/IRCanonicalize.js.map +0 -1
- package/lib/cjs/queries/IRDesugar.d.ts +0 -123
- package/lib/cjs/queries/IRDesugar.js +0 -261
- package/lib/cjs/queries/IRDesugar.js.map +0 -1
- package/lib/cjs/queries/IRLower.d.ts +0 -25
- package/lib/cjs/queries/IRLower.js +0 -398
- package/lib/cjs/queries/IRLower.js.map +0 -1
- package/lib/cjs/queries/IRMutation.d.ts +0 -53
- package/lib/cjs/queries/IRMutation.js +0 -130
- package/lib/cjs/queries/IRMutation.js.map +0 -1
- package/lib/cjs/queries/IRPipeline.d.ts +0 -8
- package/lib/cjs/queries/IRPipeline.js +0 -25
- package/lib/cjs/queries/IRPipeline.js.map +0 -1
- package/lib/cjs/queries/IRProjection.d.ts +0 -39
- package/lib/cjs/queries/IRProjection.js +0 -105
- package/lib/cjs/queries/IRProjection.js.map +0 -1
- package/lib/cjs/queries/IntermediateRepresentation.d.ts +0 -282
- package/lib/cjs/queries/IntermediateRepresentation.js +0 -3
- package/lib/cjs/queries/IntermediateRepresentation.js.map +0 -1
- package/lib/cjs/queries/MutationQuery.d.ts +0 -50
- package/lib/cjs/queries/MutationQuery.js +0 -334
- package/lib/cjs/queries/MutationQuery.js.map +0 -1
- package/lib/cjs/queries/MutationSerialization.d.ts +0 -102
- package/lib/cjs/queries/MutationSerialization.js +0 -207
- package/lib/cjs/queries/MutationSerialization.js.map +0 -1
- package/lib/cjs/queries/MutationThenable.d.ts +0 -18
- package/lib/cjs/queries/MutationThenable.js +0 -32
- package/lib/cjs/queries/MutationThenable.js.map +0 -1
- package/lib/cjs/queries/PropertyPath.d.ts +0 -38
- package/lib/cjs/queries/PropertyPath.js +0 -82
- package/lib/cjs/queries/PropertyPath.js.map +0 -1
- package/lib/cjs/queries/ProxiedPathBuilder.d.ts +0 -14
- package/lib/cjs/queries/ProxiedPathBuilder.js +0 -29
- package/lib/cjs/queries/ProxiedPathBuilder.js.map +0 -1
- package/lib/cjs/queries/QueryBuilder.d.ts +0 -193
- package/lib/cjs/queries/QueryBuilder.js +0 -519
- package/lib/cjs/queries/QueryBuilder.js.map +0 -1
- package/lib/cjs/queries/QueryBuilderSerialization.d.ts +0 -31
- package/lib/cjs/queries/QueryBuilderSerialization.js +0 -68
- package/lib/cjs/queries/QueryBuilderSerialization.js.map +0 -1
- package/lib/cjs/queries/QueryContext.d.ts +0 -50
- package/lib/cjs/queries/QueryContext.js +0 -147
- package/lib/cjs/queries/QueryContext.js.map +0 -1
- package/lib/cjs/queries/QueryFactory.d.ts +0 -80
- package/lib/cjs/queries/QueryFactory.js +0 -21
- package/lib/cjs/queries/QueryFactory.js.map +0 -1
- package/lib/cjs/queries/SelectQuery.d.ts +0 -302
- package/lib/cjs/queries/SelectQuery.js +0 -761
- package/lib/cjs/queries/SelectQuery.js.map +0 -1
- package/lib/cjs/queries/UpdateBuilder.d.ts +0 -69
- package/lib/cjs/queries/UpdateBuilder.js +0 -199
- package/lib/cjs/queries/UpdateBuilder.js.map +0 -1
- package/lib/cjs/queries/UpdateQuery.d.ts +0 -18
- package/lib/cjs/queries/UpdateQuery.js +0 -3
- package/lib/cjs/queries/UpdateQuery.js.map +0 -1
- package/lib/cjs/queries/fromJSON.d.ts +0 -16
- package/lib/cjs/queries/fromJSON.js +0 -41
- package/lib/cjs/queries/fromJSON.js.map +0 -1
- package/lib/cjs/queries/lower.d.ts +0 -28
- package/lib/cjs/queries/lower.js +0 -114
- package/lib/cjs/queries/lower.js.map +0 -1
- package/lib/cjs/queries/lowerMutationJSON.d.ts +0 -25
- package/lib/cjs/queries/lowerMutationJSON.js +0 -173
- package/lib/cjs/queries/lowerMutationJSON.js.map +0 -1
- package/lib/cjs/queries/mutationLowerSpec.d.ts +0 -32
- package/lib/cjs/queries/mutationLowerSpec.js +0 -8
- package/lib/cjs/queries/mutationLowerSpec.js.map +0 -1
- package/lib/cjs/queries/queryDispatch.d.ts +0 -33
- package/lib/cjs/queries/queryDispatch.js +0 -33
- package/lib/cjs/queries/queryDispatch.js.map +0 -1
- package/lib/cjs/queries/resolveShape.d.ts +0 -10
- package/lib/cjs/queries/resolveShape.js +0 -23
- package/lib/cjs/queries/resolveShape.js.map +0 -1
- package/lib/cjs/queries/wireVersion.d.ts +0 -7
- package/lib/cjs/queries/wireVersion.js +0 -25
- package/lib/cjs/queries/wireVersion.js.map +0 -1
- package/lib/cjs/shapes/List.d.ts +0 -35
- package/lib/cjs/shapes/List.js +0 -72
- package/lib/cjs/shapes/List.js.map +0 -1
- package/lib/cjs/shapes/PathNode.d.ts +0 -20
- package/lib/cjs/shapes/PathNode.js +0 -68
- package/lib/cjs/shapes/PathNode.js.map +0 -1
- package/lib/cjs/shapes/SHACL.d.ts +0 -300
- package/lib/cjs/shapes/SHACL.js +0 -612
- package/lib/cjs/shapes/SHACL.js.map +0 -1
- package/lib/cjs/shapes/Shape.d.ts +0 -74
- package/lib/cjs/shapes/Shape.js +0 -124
- package/lib/cjs/shapes/Shape.js.map +0 -1
- package/lib/cjs/shapes/serializePathToNodeData.d.ts +0 -24
- package/lib/cjs/shapes/serializePathToNodeData.js +0 -67
- package/lib/cjs/shapes/serializePathToNodeData.js.map +0 -1
- package/lib/cjs/shapes/syncShapes.d.ts +0 -38
- package/lib/cjs/shapes/syncShapes.js +0 -214
- package/lib/cjs/shapes/syncShapes.js.map +0 -1
- package/lib/cjs/sparql/SparqlAlgebra.d.ts +0 -190
- package/lib/cjs/sparql/SparqlAlgebra.js +0 -4
- package/lib/cjs/sparql/SparqlAlgebra.js.map +0 -1
- package/lib/cjs/sparql/SparqlDataset.d.ts +0 -60
- package/lib/cjs/sparql/SparqlDataset.js +0 -117
- package/lib/cjs/sparql/SparqlDataset.js.map +0 -1
- package/lib/cjs/sparql/algebraToString.d.ts +0 -13
- package/lib/cjs/sparql/algebraToString.js +0 -385
- package/lib/cjs/sparql/algebraToString.js.map +0 -1
- package/lib/cjs/sparql/index.d.ts +0 -9
- package/lib/cjs/sparql/index.js +0 -41
- package/lib/cjs/sparql/index.js.map +0 -1
- package/lib/cjs/sparql/irToAlgebra.d.ts +0 -79
- package/lib/cjs/sparql/irToAlgebra.js +0 -2042
- package/lib/cjs/sparql/irToAlgebra.js.map +0 -1
- package/lib/cjs/sparql/resultMapping.d.ts +0 -36
- package/lib/cjs/sparql/resultMapping.js +0 -563
- package/lib/cjs/sparql/resultMapping.js.map +0 -1
- package/lib/cjs/sparql/sparqlUtils.d.ts +0 -53
- package/lib/cjs/sparql/sparqlUtils.js +0 -154
- package/lib/cjs/sparql/sparqlUtils.js.map +0 -1
- package/lib/cjs/utils/LinkedErrorLogging.d.ts +0 -13
- package/lib/cjs/utils/LinkedErrorLogging.js +0 -22
- package/lib/cjs/utils/LinkedErrorLogging.js.map +0 -1
- package/lib/cjs/utils/LinkedFileStorage.d.ts +0 -23
- package/lib/cjs/utils/LinkedFileStorage.js +0 -62
- package/lib/cjs/utils/LinkedFileStorage.js.map +0 -1
- package/lib/cjs/utils/LinkedStorage.d.ts +0 -40
- package/lib/cjs/utils/LinkedStorage.js +0 -148
- package/lib/cjs/utils/LinkedStorage.js.map +0 -1
- package/lib/cjs/utils/NameSpace.d.ts +0 -2
- package/lib/cjs/utils/NameSpace.js +0 -8
- package/lib/cjs/utils/NameSpace.js.map +0 -1
- package/lib/cjs/utils/NodeReference.d.ts +0 -30
- package/lib/cjs/utils/NodeReference.js +0 -54
- package/lib/cjs/utils/NodeReference.js.map +0 -1
- package/lib/cjs/utils/Package.d.ts +0 -153
- package/lib/cjs/utils/Package.js +0 -419
- package/lib/cjs/utils/Package.js.map +0 -1
- package/lib/cjs/utils/Prefix.d.ts +0 -22
- package/lib/cjs/utils/Prefix.js +0 -104
- package/lib/cjs/utils/Prefix.js.map +0 -1
- package/lib/cjs/utils/ShapeClass.d.ts +0 -30
- package/lib/cjs/utils/ShapeClass.js +0 -180
- package/lib/cjs/utils/ShapeClass.js.map +0 -1
- package/lib/cjs/utils/URI.d.ts +0 -18
- package/lib/cjs/utils/URI.js +0 -42
- package/lib/cjs/utils/URI.js.map +0 -1
- package/lib/cjs/utils/cached.d.ts +0 -14
- package/lib/cjs/utils/cached.js +0 -71
- package/lib/cjs/utils/cached.js.map +0 -1
- package/lib/cjs/utils/loadStores.d.ts +0 -34
- package/lib/cjs/utils/loadStores.js +0 -105
- package/lib/cjs/utils/loadStores.js.map +0 -1
- package/lib/cjs/utils/parseDatasetsConfig.d.ts +0 -49
- package/lib/cjs/utils/parseDatasetsConfig.js +0 -110
- package/lib/cjs/utils/parseDatasetsConfig.js.map +0 -1
- package/lib/esm/package.json +0 -9
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/** One entry under `datasets`. Keyed by alias name in the parent object. */
|
|
2
|
-
export interface DatasetEntry {
|
|
3
|
-
/** npm import path to the IDataset class — e.g. "@_linked/fuseki/shapes/FusekiStore". */
|
|
4
|
-
store: string;
|
|
5
|
-
/** Constructor argument forwarded to the store class. Shape is store-specific. */
|
|
6
|
-
config: Record<string, unknown>;
|
|
7
|
-
}
|
|
8
|
-
/** Top-level structure of linked.{backend,frontend}.datasets.json. */
|
|
9
|
-
export interface DatasetsConfig {
|
|
10
|
-
/** Alias → store entry. */
|
|
11
|
-
datasets: Record<string, DatasetEntry>;
|
|
12
|
-
/** Reserved for future top-level sections (fileStorage, services, etc.). */
|
|
13
|
-
[section: string]: unknown;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Parse + env-resolve a raw datasets config object.
|
|
17
|
-
*
|
|
18
|
-
* - Requires a top-level `datasets` object (other top-level sections are passed
|
|
19
|
-
* through unchanged for future extension).
|
|
20
|
-
* - Resolves `${VAR}` and `${VAR:-default}` placeholders against `env` recursively
|
|
21
|
-
* across all string leaves.
|
|
22
|
-
* - Strips keys starting with `_` (treated as comments / `_note` fields).
|
|
23
|
-
* - Throws on a referenced env var with no default that is unset or empty.
|
|
24
|
-
*
|
|
25
|
-
* Pure + browser-safe — no file I/O, no dynamic imports. Use this on both
|
|
26
|
-
* backend and frontend. The companion `loadStores` (separate file) does the
|
|
27
|
-
* runtime dynamic-import dispatch for the backend.
|
|
28
|
-
*
|
|
29
|
-
* @example Backend
|
|
30
|
-
* ```ts
|
|
31
|
-
* import rawConfig from './linked.backend.datasets.json' assert { type: 'json' };
|
|
32
|
-
* const config = parseDatasetsConfig(rawConfig, process.env);
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @example Frontend
|
|
36
|
-
* ```ts
|
|
37
|
-
* import rawConfig from './linked.frontend.datasets.json' assert { type: 'json' };
|
|
38
|
-
* // No runtime env in the browser; pass empty {}
|
|
39
|
-
* const config = parseDatasetsConfig(rawConfig, {});
|
|
40
|
-
* const appData = new BackendAPIStore(config.datasets.appData.config);
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @param raw Parsed JSON object (or anything object-shaped). Throws otherwise.
|
|
44
|
-
* @param env Env map. Defaults to {} (no interpolation).
|
|
45
|
-
* @returns Typed, env-resolved {@link DatasetsConfig}.
|
|
46
|
-
* @throws On missing/malformed `datasets`, on malformed alias entry, or
|
|
47
|
-
* on an unresolved `${VAR}` with no default.
|
|
48
|
-
*/
|
|
49
|
-
export declare function parseDatasetsConfig(raw: unknown, env?: Record<string, string | undefined>): DatasetsConfig;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Pure parser + dispatcher for linked.{backend,frontend}.datasets.json.
|
|
3
|
-
//
|
|
4
|
-
// Per the spec in docs/backlog/016-ejection-export-flow.md:
|
|
5
|
-
//
|
|
6
|
-
// {
|
|
7
|
-
// "datasets": {
|
|
8
|
-
// "<alias>": {
|
|
9
|
-
// "store": "<npm-import-path>",
|
|
10
|
-
// "config": { /* passed verbatim to the store's constructor */ }
|
|
11
|
-
// }
|
|
12
|
-
// }
|
|
13
|
-
// }
|
|
14
|
-
//
|
|
15
|
-
// `store` is an npm import path string (e.g. "@_linked/fuseki/shapes/FusekiStore").
|
|
16
|
-
// `config` is the store class's own concern — the runtime never inspects it.
|
|
17
|
-
// `${VAR}` / `${VAR:-default}` placeholders inside string values are resolved
|
|
18
|
-
// against an env map at parse time.
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.parseDatasetsConfig = parseDatasetsConfig;
|
|
21
|
-
/**
|
|
22
|
-
* Parse + env-resolve a raw datasets config object.
|
|
23
|
-
*
|
|
24
|
-
* - Requires a top-level `datasets` object (other top-level sections are passed
|
|
25
|
-
* through unchanged for future extension).
|
|
26
|
-
* - Resolves `${VAR}` and `${VAR:-default}` placeholders against `env` recursively
|
|
27
|
-
* across all string leaves.
|
|
28
|
-
* - Strips keys starting with `_` (treated as comments / `_note` fields).
|
|
29
|
-
* - Throws on a referenced env var with no default that is unset or empty.
|
|
30
|
-
*
|
|
31
|
-
* Pure + browser-safe — no file I/O, no dynamic imports. Use this on both
|
|
32
|
-
* backend and frontend. The companion `loadStores` (separate file) does the
|
|
33
|
-
* runtime dynamic-import dispatch for the backend.
|
|
34
|
-
*
|
|
35
|
-
* @example Backend
|
|
36
|
-
* ```ts
|
|
37
|
-
* import rawConfig from './linked.backend.datasets.json' assert { type: 'json' };
|
|
38
|
-
* const config = parseDatasetsConfig(rawConfig, process.env);
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example Frontend
|
|
42
|
-
* ```ts
|
|
43
|
-
* import rawConfig from './linked.frontend.datasets.json' assert { type: 'json' };
|
|
44
|
-
* // No runtime env in the browser; pass empty {}
|
|
45
|
-
* const config = parseDatasetsConfig(rawConfig, {});
|
|
46
|
-
* const appData = new BackendAPIStore(config.datasets.appData.config);
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @param raw Parsed JSON object (or anything object-shaped). Throws otherwise.
|
|
50
|
-
* @param env Env map. Defaults to {} (no interpolation).
|
|
51
|
-
* @returns Typed, env-resolved {@link DatasetsConfig}.
|
|
52
|
-
* @throws On missing/malformed `datasets`, on malformed alias entry, or
|
|
53
|
-
* on an unresolved `${VAR}` with no default.
|
|
54
|
-
*/
|
|
55
|
-
function parseDatasetsConfig(raw, env = {}) {
|
|
56
|
-
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
57
|
-
throw new Error('Invalid datasets config: expected a top-level JSON object');
|
|
58
|
-
}
|
|
59
|
-
const resolved = resolveInterpolations(raw, env);
|
|
60
|
-
const datasets = resolved.datasets;
|
|
61
|
-
if (!datasets || typeof datasets !== 'object' || Array.isArray(datasets)) {
|
|
62
|
-
throw new Error('Invalid datasets config: missing or malformed "datasets" section');
|
|
63
|
-
}
|
|
64
|
-
for (const [alias, entry] of Object.entries(datasets)) {
|
|
65
|
-
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
66
|
-
throw new Error(`Invalid datasets config: alias "${alias}" must be an object`);
|
|
67
|
-
}
|
|
68
|
-
const e = entry;
|
|
69
|
-
if (typeof e.store !== 'string' || !e.store) {
|
|
70
|
-
throw new Error(`Invalid datasets config: alias "${alias}" is missing a string "store" (npm import path)`);
|
|
71
|
-
}
|
|
72
|
-
if (e.config !== undefined && (typeof e.config !== 'object' || Array.isArray(e.config))) {
|
|
73
|
-
throw new Error(`Invalid datasets config: alias "${alias}" "config" must be an object if present`);
|
|
74
|
-
}
|
|
75
|
-
if (e.config === undefined)
|
|
76
|
-
e.config = {};
|
|
77
|
-
}
|
|
78
|
-
return resolved;
|
|
79
|
-
}
|
|
80
|
-
function resolveInterpolations(value, env) {
|
|
81
|
-
if (typeof value === 'string')
|
|
82
|
-
return resolveString(value, env);
|
|
83
|
-
if (Array.isArray(value)) {
|
|
84
|
-
return value.map((v) => resolveInterpolations(v, env));
|
|
85
|
-
}
|
|
86
|
-
if (value && typeof value === 'object') {
|
|
87
|
-
const out = {};
|
|
88
|
-
for (const key of Object.keys(value)) {
|
|
89
|
-
if (key.startsWith('_'))
|
|
90
|
-
continue; // _note, _comment, ...
|
|
91
|
-
out[key] = resolveInterpolations(value[key], env);
|
|
92
|
-
}
|
|
93
|
-
return out;
|
|
94
|
-
}
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
// Matches ${VAR} or ${VAR:-default}. VAR is uppercase alphanum + underscore.
|
|
98
|
-
// Default text may contain anything except `}`.
|
|
99
|
-
const INTERP_RE = /\$\{([A-Z0-9_]+)(?::-([^}]*))?\}/g;
|
|
100
|
-
function resolveString(input, env) {
|
|
101
|
-
return input.replace(INTERP_RE, (_full, varName, defaultValue) => {
|
|
102
|
-
const v = env[varName];
|
|
103
|
-
if (v !== undefined && v !== '')
|
|
104
|
-
return v;
|
|
105
|
-
if (defaultValue !== undefined)
|
|
106
|
-
return defaultValue;
|
|
107
|
-
throw new Error(`Required env var "${varName}" is not set and has no default (referenced in datasets config)`);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=parseDatasetsConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseDatasetsConfig.js","sourceRoot":"","sources":["../../../src/utils/parseDatasetsConfig.ts"],"names":[],"mappings":";AAAA,wEAAwE;AACxE,EAAE;AACF,4DAA4D;AAC5D,EAAE;AACF,MAAM;AACN,oBAAoB;AACpB,qBAAqB;AACrB,yCAAyC;AACzC,yEAAyE;AACzE,UAAU;AACV,QAAQ;AACR,MAAM;AACN,EAAE;AACF,oFAAoF;AACpF,6EAA6E;AAC7E,8EAA8E;AAC9E,oCAAoC;;AAoDpC,kDAoCC;AAtED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,mBAAmB,CACjC,GAAY,EACZ,MAA0C,EAAE;IAE5C,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAA4B,CAAC;IAC5E,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACnC,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,KAAK,CACb,kEAAkE,CACnE,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,K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