ingestron 1.0.0 → 1.1.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/README.md +1 -1
- package/dist/main.js +1447 -927
- package/package.json +3 -3
- package/schemas/flow.schema.yaml +2 -1
- package/schemas/standard.schema.yaml +1 -1
- /package/{project-recipes/adf → recipes}/connections/adls-gen2.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/amazon-rds-oracle.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/amazon-rds-sqlserver.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/amazon-redshift.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/amazon-s3.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-blob.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-cosmos-db-mongodb.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-cosmos-db-nosql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-cosmos-postgresql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-data-explorer.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-databricks-delta.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-files.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-mysql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-postgresql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-sql-database.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-sql-managed-instance.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-synapse.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/azure-table-storage.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/cassandra.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/dataverse.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/db2.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/dynamics-365.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/dynamics-ax.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/dynamics-crm.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/fabric-lakehouse.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/fabric-warehouse.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/files.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/ftp.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/google-ads.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/google-bigquery.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/google-cloud-storage.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/greenplum.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/hdfs.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/hive.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/http.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/hubspot.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/impala.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/informix.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/jira.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/mariadb.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/microsoft-365.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/microsoft-access.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/mongodb-atlas.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/mongodb.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/mysql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/netezza.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/odata.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/odbc.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/oracle-cloud-storage.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/oracle.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/postgresql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/presto.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/quickbooks.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/rest.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/s3-compatible.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/salesforce-service-cloud.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/salesforce.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sap-bw-mdx.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sap-bw-open-hub.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sap-c4c.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sap-ecc.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sap-hana.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sap-table.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/servicenow.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sftp.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sharepoint-online-list.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/shopify.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/snowflake.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/spark.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sqlserver.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/square.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/sybase.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/teradata.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/vertica.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/web-table.yaml +0 -0
- /package/{project-recipes/adf → recipes}/connections/xero.yaml +0 -0
- /package/{project-recipes/adf → recipes}/contracts/records.yaml +0 -0
- /package/{project-recipes/adf → recipes}/contracts/salesforce-account.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/adls-gen2.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/amazon-rds-oracle.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/amazon-rds-sqlserver.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/amazon-redshift.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/amazon-s3.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-blob.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-cosmos-db-mongodb.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-cosmos-db-nosql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-cosmos-postgresql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-data-explorer.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-databricks-delta.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-files.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-mysql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-postgresql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-sql-database.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-sql-managed-instance.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-synapse.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/azure-table-storage.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/cassandra.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/dataverse.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/db2.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/dynamics-365.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/dynamics-ax.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/dynamics-crm.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/fabric-lakehouse.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/fabric-warehouse.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/files.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/ftp.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/google-ads.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/google-bigquery.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/google-cloud-storage.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/greenplum.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/hdfs.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/hive.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/http.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/hubspot.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/impala.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/informix.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/jira.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/mariadb.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/microsoft-365.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/microsoft-access.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/mongodb-atlas.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/mongodb.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/mysql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/netezza.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/odata.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/odbc.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/oracle-cloud-storage.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/oracle.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/postgresql.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/presto.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/quickbooks.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/rest.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/s3-compatible.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/salesforce-service-cloud.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/salesforce.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sap-bw-mdx.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sap-bw-open-hub.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sap-c4c.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sap-ecc.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sap-hana.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sap-table.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/servicenow.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sftp.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sharepoint-online-list.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/shopify.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/snowflake.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/spark.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sqlserver.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/square.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/sybase.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/teradata.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/vertica.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/web-table.yaml +0 -0
- /package/{project-recipes/adf → recipes}/flows/xero.yaml +0 -0
- /package/{project-recipes/adf → recipes}/platform.yaml +0 -0
- /package/{project-recipes/adf → recipes}/project.yaml +0 -0
- /package/{project-recipes/adf → recipes}/sample.yaml +0 -0
- /package/{project-recipes/adf → recipes}/standard.yaml +0 -0
package/dist/main.js
CHANGED
|
@@ -3775,7 +3775,7 @@ ${pointer}
|
|
|
3775
3775
|
var require_resolve_props = __commonJS({
|
|
3776
3776
|
"node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-props.js"(exports) {
|
|
3777
3777
|
"use strict";
|
|
3778
|
-
function resolveProps(
|
|
3778
|
+
function resolveProps(tokens2, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
3779
3779
|
let spaceBefore = false;
|
|
3780
3780
|
let atNewline = startOnNewline;
|
|
3781
3781
|
let hasSpace = startOnNewline;
|
|
@@ -3790,7 +3790,7 @@ var require_resolve_props = __commonJS({
|
|
|
3790
3790
|
let comma = null;
|
|
3791
3791
|
let found = null;
|
|
3792
3792
|
let start = null;
|
|
3793
|
-
for (const token2 of
|
|
3793
|
+
for (const token2 of tokens2) {
|
|
3794
3794
|
if (reqSpace) {
|
|
3795
3795
|
if (token2.type !== "space" && token2.type !== "newline" && token2.type !== "comma")
|
|
3796
3796
|
onError(token2.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space");
|
|
@@ -3881,7 +3881,7 @@ var require_resolve_props = __commonJS({
|
|
|
3881
3881
|
hasSpace = false;
|
|
3882
3882
|
}
|
|
3883
3883
|
}
|
|
3884
|
-
const last =
|
|
3884
|
+
const last = tokens2[tokens2.length - 1];
|
|
3885
3885
|
const end = last ? last.offset + last.source.length : offset;
|
|
3886
3886
|
if (reqSpace && next && next.type !== "space" && next.type !== "newline" && next.type !== "comma" && (next.type !== "scalar" || next.source !== "")) {
|
|
3887
3887
|
onError(next.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space");
|
|
@@ -5221,8 +5221,8 @@ ${cb}` : comment;
|
|
|
5221
5221
|
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
|
5222
5222
|
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
|
5223
5223
|
*/
|
|
5224
|
-
*compose(
|
|
5225
|
-
for (const token2 of
|
|
5224
|
+
*compose(tokens2, forceDoc = false, endOffset = -1) {
|
|
5225
|
+
for (const token2 of tokens2)
|
|
5226
5226
|
yield* this.next(token2);
|
|
5227
5227
|
yield* this.end(forceDoc, endOffset);
|
|
5228
5228
|
}
|
|
@@ -10814,7 +10814,7 @@ var require_utils = __commonJS({
|
|
|
10814
10814
|
}
|
|
10815
10815
|
return output;
|
|
10816
10816
|
}
|
|
10817
|
-
function encodeComponent(input,
|
|
10817
|
+
function encodeComponent(input, isAllowed2) {
|
|
10818
10818
|
let output = "";
|
|
10819
10819
|
for (let i = 0; i < input.length; i++) {
|
|
10820
10820
|
const ch = input[i];
|
|
@@ -10826,7 +10826,7 @@ var require_utils = __commonJS({
|
|
|
10826
10826
|
continue;
|
|
10827
10827
|
}
|
|
10828
10828
|
}
|
|
10829
|
-
if (
|
|
10829
|
+
if (isAllowed2(ch)) {
|
|
10830
10830
|
output += ch;
|
|
10831
10831
|
} else {
|
|
10832
10832
|
const code = input.charCodeAt(i);
|
|
@@ -16750,8 +16750,8 @@ var require_liquid_node = __commonJS({
|
|
|
16750
16750
|
}
|
|
16751
16751
|
};
|
|
16752
16752
|
var Expression = class {
|
|
16753
|
-
constructor(
|
|
16754
|
-
this.postfix = [...toPostfix(
|
|
16753
|
+
constructor(tokens2) {
|
|
16754
|
+
this.postfix = [...toPostfix(tokens2)];
|
|
16755
16755
|
}
|
|
16756
16756
|
*evaluate(ctx, lenient) {
|
|
16757
16757
|
assert(ctx, "unable to evaluate: context not defined");
|
|
@@ -16831,9 +16831,9 @@ var require_liquid_node = __commonJS({
|
|
|
16831
16831
|
ctx.memoryLimit.use(high - low + 1);
|
|
16832
16832
|
return range(+low, +high + 1);
|
|
16833
16833
|
}
|
|
16834
|
-
function* toPostfix(
|
|
16834
|
+
function* toPostfix(tokens2) {
|
|
16835
16835
|
const ops = [];
|
|
16836
|
-
for (const token2 of
|
|
16836
|
+
for (const token2 of tokens2) {
|
|
16837
16837
|
if (isOperatorToken(token2)) {
|
|
16838
16838
|
while (ops.length && ops[ops.length - 1].getPrecedence() > token2.getPrecedence()) {
|
|
16839
16839
|
yield ops.pop();
|
|
@@ -17008,7 +17008,7 @@ var require_liquid_node = __commonJS({
|
|
|
17008
17008
|
function readFile(filepath) {
|
|
17009
17009
|
return readFileAsync(filepath, "utf8");
|
|
17010
17010
|
}
|
|
17011
|
-
function
|
|
17011
|
+
function existsSync6(filepath) {
|
|
17012
17012
|
try {
|
|
17013
17013
|
fs$1.statSync(filepath);
|
|
17014
17014
|
return true;
|
|
@@ -17016,7 +17016,7 @@ var require_liquid_node = __commonJS({
|
|
|
17016
17016
|
return false;
|
|
17017
17017
|
}
|
|
17018
17018
|
}
|
|
17019
|
-
function
|
|
17019
|
+
function readFileSync9(filepath) {
|
|
17020
17020
|
return fs$1.readFileSync(filepath, "utf8");
|
|
17021
17021
|
}
|
|
17022
17022
|
function resolve8(root, file, ext) {
|
|
@@ -17030,7 +17030,7 @@ var require_liquid_node = __commonJS({
|
|
|
17030
17030
|
} catch (e) {
|
|
17031
17031
|
}
|
|
17032
17032
|
}
|
|
17033
|
-
function
|
|
17033
|
+
function dirname8(filepath) {
|
|
17034
17034
|
return path.dirname(filepath);
|
|
17035
17035
|
}
|
|
17036
17036
|
var realpathAsync = promisify(fs$1.realpath);
|
|
@@ -17058,11 +17058,11 @@ var require_liquid_node = __commonJS({
|
|
|
17058
17058
|
__proto__: null,
|
|
17059
17059
|
exists,
|
|
17060
17060
|
readFile,
|
|
17061
|
-
existsSync:
|
|
17062
|
-
readFileSync:
|
|
17061
|
+
existsSync: existsSync6,
|
|
17062
|
+
readFileSync: readFileSync9,
|
|
17063
17063
|
resolve: resolve8,
|
|
17064
17064
|
fallback,
|
|
17065
|
-
dirname:
|
|
17065
|
+
dirname: dirname8,
|
|
17066
17066
|
contains,
|
|
17067
17067
|
containsSync,
|
|
17068
17068
|
sep: path.sep
|
|
@@ -17326,14 +17326,14 @@ var require_liquid_node = __commonJS({
|
|
|
17326
17326
|
list2 = [value];
|
|
17327
17327
|
return list2;
|
|
17328
17328
|
}
|
|
17329
|
-
function whiteSpaceCtrl(
|
|
17329
|
+
function whiteSpaceCtrl(tokens2, options2) {
|
|
17330
17330
|
let inRaw = false;
|
|
17331
|
-
for (let i = 0; i <
|
|
17332
|
-
const token2 =
|
|
17331
|
+
for (let i = 0; i < tokens2.length; i++) {
|
|
17332
|
+
const token2 = tokens2[i];
|
|
17333
17333
|
if (!isDelimitedToken(token2))
|
|
17334
17334
|
continue;
|
|
17335
17335
|
if (!inRaw && token2.trimLeft) {
|
|
17336
|
-
trimLeft(
|
|
17336
|
+
trimLeft(tokens2[i - 1], options2.greedy);
|
|
17337
17337
|
}
|
|
17338
17338
|
if (isTagToken(token2)) {
|
|
17339
17339
|
if (token2.name === "raw")
|
|
@@ -17342,7 +17342,7 @@ var require_liquid_node = __commonJS({
|
|
|
17342
17342
|
inRaw = false;
|
|
17343
17343
|
}
|
|
17344
17344
|
if (!inRaw && token2.trimRight) {
|
|
17345
|
-
trimRight(
|
|
17345
|
+
trimRight(tokens2[i + 1], options2.greedy);
|
|
17346
17346
|
}
|
|
17347
17347
|
}
|
|
17348
17348
|
}
|
|
@@ -17469,13 +17469,13 @@ var require_liquid_node = __commonJS({
|
|
|
17469
17469
|
return [key.getText(), value];
|
|
17470
17470
|
}
|
|
17471
17471
|
readTopLevelTokens(options2 = defaultOptions) {
|
|
17472
|
-
const
|
|
17472
|
+
const tokens2 = [];
|
|
17473
17473
|
while (this.p < this.N) {
|
|
17474
17474
|
const token2 = this.readTopLevelToken(options2);
|
|
17475
|
-
|
|
17475
|
+
tokens2.push(token2);
|
|
17476
17476
|
}
|
|
17477
|
-
whiteSpaceCtrl(
|
|
17478
|
-
return
|
|
17477
|
+
whiteSpaceCtrl(tokens2, options2);
|
|
17478
|
+
return tokens2;
|
|
17479
17479
|
}
|
|
17480
17480
|
readTopLevelToken(options2) {
|
|
17481
17481
|
const { tagDelimiterLeft, outputDelimiterLeft } = options2;
|
|
@@ -17557,12 +17557,12 @@ var require_liquid_node = __commonJS({
|
|
|
17557
17557
|
throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, begin);
|
|
17558
17558
|
}
|
|
17559
17559
|
readLiquidTagTokens(options2 = defaultOptions) {
|
|
17560
|
-
const
|
|
17560
|
+
const tokens2 = [];
|
|
17561
17561
|
while (this.p < this.N) {
|
|
17562
17562
|
const token2 = this.readLiquidTagToken(options2);
|
|
17563
|
-
token2 &&
|
|
17563
|
+
token2 && tokens2.push(token2);
|
|
17564
17564
|
}
|
|
17565
|
-
return
|
|
17565
|
+
return tokens2;
|
|
17566
17566
|
}
|
|
17567
17567
|
readLiquidTagToken(options2) {
|
|
17568
17568
|
this.skipBlank();
|
|
@@ -17817,10 +17817,10 @@ var require_liquid_node = __commonJS({
|
|
|
17817
17817
|
}
|
|
17818
17818
|
};
|
|
17819
17819
|
var ParseStream = class {
|
|
17820
|
-
constructor(
|
|
17820
|
+
constructor(tokens2, parseToken) {
|
|
17821
17821
|
this.handlers = {};
|
|
17822
17822
|
this.stopRequested = false;
|
|
17823
|
-
this.tokens =
|
|
17823
|
+
this.tokens = tokens2;
|
|
17824
17824
|
this.parseToken = parseToken;
|
|
17825
17825
|
}
|
|
17826
17826
|
on(name, cb) {
|
|
@@ -17883,10 +17883,10 @@ var require_liquid_node = __commonJS({
|
|
|
17883
17883
|
};
|
|
17884
17884
|
function createTagClass(options2) {
|
|
17885
17885
|
return class extends Tag {
|
|
17886
|
-
constructor(token2,
|
|
17887
|
-
super(token2,
|
|
17886
|
+
constructor(token2, tokens2, liquid) {
|
|
17887
|
+
super(token2, tokens2, liquid);
|
|
17888
17888
|
if (isFunction(options2.parse)) {
|
|
17889
|
-
options2.parse.call(this, token2,
|
|
17889
|
+
options2.parse.call(this, token2, tokens2);
|
|
17890
17890
|
}
|
|
17891
17891
|
}
|
|
17892
17892
|
*render(ctx, emitter) {
|
|
@@ -18331,16 +18331,16 @@ var require_liquid_node = __commonJS({
|
|
|
18331
18331
|
html = String(html);
|
|
18332
18332
|
this.parseLimit.use(html.length);
|
|
18333
18333
|
const tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath, void 0, this.liquid.options.groupedExpressions);
|
|
18334
|
-
const
|
|
18335
|
-
return this.parseTokens(
|
|
18334
|
+
const tokens2 = tokenizer.readTopLevelTokens(this.liquid.options);
|
|
18335
|
+
return this.parseTokens(tokens2);
|
|
18336
18336
|
}
|
|
18337
|
-
parseTokens(
|
|
18337
|
+
parseTokens(tokens2) {
|
|
18338
18338
|
let token2;
|
|
18339
18339
|
const templates = [];
|
|
18340
18340
|
const errors = [];
|
|
18341
|
-
while (token2 =
|
|
18341
|
+
while (token2 = tokens2.shift()) {
|
|
18342
18342
|
try {
|
|
18343
|
-
templates.push(this.parseToken(token2,
|
|
18343
|
+
templates.push(this.parseToken(token2, tokens2));
|
|
18344
18344
|
} catch (err) {
|
|
18345
18345
|
if (this.liquid.options.catchAllErrors)
|
|
18346
18346
|
errors.push(err);
|
|
@@ -18369,8 +18369,8 @@ var require_liquid_node = __commonJS({
|
|
|
18369
18369
|
throw new ParseError(e, token2);
|
|
18370
18370
|
}
|
|
18371
18371
|
}
|
|
18372
|
-
parseStream(
|
|
18373
|
-
return new ParseStream(
|
|
18372
|
+
parseStream(tokens2) {
|
|
18373
|
+
return new ParseStream(tokens2, (token2, tokens3) => this.parseToken(token2, tokens3));
|
|
18374
18374
|
}
|
|
18375
18375
|
*_parseFileCached(file, sync, type = exports.LookupType.Root, currentFile) {
|
|
18376
18376
|
const cache = this.cache;
|
|
@@ -18690,7 +18690,7 @@ var require_liquid_node = __commonJS({
|
|
|
18690
18690
|
uri_escape,
|
|
18691
18691
|
slugify
|
|
18692
18692
|
});
|
|
18693
|
-
var
|
|
18693
|
+
var join17 = argumentsToValue(function(v, arg) {
|
|
18694
18694
|
const array = toArray(v);
|
|
18695
18695
|
const sep5 = isNil(arg) ? " " : stringify7(arg);
|
|
18696
18696
|
let outputSize = sep5.length * Math.max(array.length - 1, 0);
|
|
@@ -18935,7 +18935,7 @@ var require_liquid_node = __commonJS({
|
|
|
18935
18935
|
}
|
|
18936
18936
|
var arrayFilters = /* @__PURE__ */ Object.freeze({
|
|
18937
18937
|
__proto__: null,
|
|
18938
|
-
join:
|
|
18938
|
+
join: join17,
|
|
18939
18939
|
last,
|
|
18940
18940
|
first,
|
|
18941
18941
|
reverse,
|
|
@@ -19670,8 +19670,8 @@ var require_liquid_node = __commonJS({
|
|
|
19670
19670
|
}
|
|
19671
19671
|
return file;
|
|
19672
19672
|
}
|
|
19673
|
-
const
|
|
19674
|
-
const templates = optimize(parser.parseTokens(
|
|
19673
|
+
const tokens2 = [...tokenizer.readFileNameTemplate(liquid.options)];
|
|
19674
|
+
const templates = optimize(parser.parseTokens(tokens2));
|
|
19675
19675
|
return templates === "none" ? void 0 : templates;
|
|
19676
19676
|
}
|
|
19677
19677
|
function optimize(templates) {
|
|
@@ -20161,8 +20161,8 @@ var require_liquid_node = __commonJS({
|
|
|
20161
20161
|
var LiquidTag = class extends Tag {
|
|
20162
20162
|
constructor(token2, remainTokens, liquid, parser) {
|
|
20163
20163
|
super(token2, remainTokens, liquid);
|
|
20164
|
-
const
|
|
20165
|
-
this.templates = parser.parseTokens(
|
|
20164
|
+
const tokens2 = this.tokenizer.readLiquidTagTokens(this.liquid.options);
|
|
20165
|
+
this.templates = parser.parseTokens(tokens2);
|
|
20166
20166
|
}
|
|
20167
20167
|
*render(ctx, emitter) {
|
|
20168
20168
|
yield this.liquid.renderer.renderTemplates(this.templates, ctx, emitter);
|
|
@@ -20606,9 +20606,9 @@ function answersOf(pairs) {
|
|
|
20606
20606
|
}
|
|
20607
20607
|
|
|
20608
20608
|
// packages/cli/src/generate.ts
|
|
20609
|
-
import { join as
|
|
20609
|
+
import { join as join8, relative as relative4, resolve, sep as sep4 } from "node:path";
|
|
20610
20610
|
|
|
20611
|
-
// packages/config/
|
|
20611
|
+
// packages/config/src/diagnostics.ts
|
|
20612
20612
|
function error(code, message, location, hint) {
|
|
20613
20613
|
return { code, severity: "error", message, location, hint };
|
|
20614
20614
|
}
|
|
@@ -20624,18 +20624,16 @@ function formatDiagnostics(diagnostics) {
|
|
|
20624
20624
|
function formatDiagnostic(diagnostic) {
|
|
20625
20625
|
const where = diagnostic.location ? `${diagnostic.location.file}:${diagnostic.location.line}:${diagnostic.location.column}` : "(project)";
|
|
20626
20626
|
const lines = [`${where} ${diagnostic.severity} ${diagnostic.code}`, diagnostic.message];
|
|
20627
|
-
if (diagnostic.hint)
|
|
20628
|
-
lines.push(diagnostic.hint);
|
|
20627
|
+
if (diagnostic.hint) lines.push(diagnostic.hint);
|
|
20629
20628
|
const [fix] = diagnostic.fixes ?? [];
|
|
20630
|
-
if (fix)
|
|
20631
|
-
lines.push(`Fix: ${fix.title}.`);
|
|
20629
|
+
if (fix) lines.push(`Fix: ${fix.title}.`);
|
|
20632
20630
|
return [
|
|
20633
20631
|
lines[0],
|
|
20634
20632
|
...lines.slice(1).flatMap((text2) => text2.split("\n").map((line2) => ` ${line2}`))
|
|
20635
20633
|
].join("\n");
|
|
20636
20634
|
}
|
|
20637
20635
|
|
|
20638
|
-
// packages/config/
|
|
20636
|
+
// packages/config/src/yaml-file.ts
|
|
20639
20637
|
var import_yaml = __toESM(require_dist(), 1);
|
|
20640
20638
|
function isYamlPath(path) {
|
|
20641
20639
|
return path.endsWith(".yaml") || path.endsWith(".yml");
|
|
@@ -20664,22 +20662,18 @@ function nodeAtKeys(file, keys2) {
|
|
|
20664
20662
|
let node = file.document.contents;
|
|
20665
20663
|
for (const key of keys2) {
|
|
20666
20664
|
node = childNode(node, key);
|
|
20667
|
-
if ((0, import_yaml.isAlias)(node))
|
|
20668
|
-
|
|
20669
|
-
if (!(0, import_yaml.isNode)(node))
|
|
20670
|
-
return void 0;
|
|
20665
|
+
if ((0, import_yaml.isAlias)(node)) node = node.resolve(file.document);
|
|
20666
|
+
if (!(0, import_yaml.isNode)(node)) return void 0;
|
|
20671
20667
|
}
|
|
20672
20668
|
return (0, import_yaml.isNode)(node) ? node : void 0;
|
|
20673
20669
|
}
|
|
20674
20670
|
function childNode(node, key) {
|
|
20675
|
-
if ((0, import_yaml.isMap)(node))
|
|
20676
|
-
|
|
20677
|
-
if ((0, import_yaml.isSeq)(node) && /^(0|[1-9]\d*)$/.test(key))
|
|
20678
|
-
return node.get(Number(key), true);
|
|
20671
|
+
if ((0, import_yaml.isMap)(node)) return node.get(key, true);
|
|
20672
|
+
if ((0, import_yaml.isSeq)(node) && /^(0|[1-9]\d*)$/.test(key)) return node.get(Number(key), true);
|
|
20679
20673
|
return void 0;
|
|
20680
20674
|
}
|
|
20681
20675
|
|
|
20682
|
-
// packages/config/
|
|
20676
|
+
// packages/config/src/context.ts
|
|
20683
20677
|
function errorCount(context2) {
|
|
20684
20678
|
return context2.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
20685
20679
|
}
|
|
@@ -20691,7 +20685,14 @@ function readProjectFile(context2, path, referredFrom) {
|
|
|
20691
20685
|
}
|
|
20692
20686
|
const text2 = context2.files.read(path);
|
|
20693
20687
|
if (text2 === void 0) {
|
|
20694
|
-
context2.diagnostics.push(
|
|
20688
|
+
context2.diagnostics.push(
|
|
20689
|
+
error(
|
|
20690
|
+
"MISSING_FILE",
|
|
20691
|
+
`File not found inside the project: ${path}.`,
|
|
20692
|
+
referredFrom,
|
|
20693
|
+
"Check the path. It is relative to the file that mentions it."
|
|
20694
|
+
)
|
|
20695
|
+
);
|
|
20695
20696
|
return void 0;
|
|
20696
20697
|
}
|
|
20697
20698
|
const bytes = new TextEncoder().encode(text2).length;
|
|
@@ -20702,30 +20703,32 @@ function readProjectFile(context2, path, referredFrom) {
|
|
|
20702
20703
|
return text2;
|
|
20703
20704
|
}
|
|
20704
20705
|
function tooLarge(context2, path, bytes, referredFrom) {
|
|
20705
|
-
return error(
|
|
20706
|
+
return error(
|
|
20707
|
+
"FILE_TOO_LARGE",
|
|
20708
|
+
`${path} is ${bytes} bytes; the limit is ${context2.limits.maxFileBytes}.`,
|
|
20709
|
+
referredFrom,
|
|
20710
|
+
"Split the file, or raise limits.maxFileBytes."
|
|
20711
|
+
);
|
|
20706
20712
|
}
|
|
20707
20713
|
function readYaml(context2, path, referredFrom) {
|
|
20708
20714
|
const cached = context2.parsedFiles.get(path);
|
|
20709
|
-
if (cached)
|
|
20710
|
-
return cached;
|
|
20715
|
+
if (cached) return cached;
|
|
20711
20716
|
const text2 = readProjectFile(context2, path, referredFrom);
|
|
20712
20717
|
const parsed = text2 === void 0 ? void 0 : parseYamlFile(path, text2, context2.diagnostics);
|
|
20713
|
-
if (parsed)
|
|
20714
|
-
context2.parsedFiles.set(path, parsed);
|
|
20718
|
+
if (parsed) context2.parsedFiles.set(path, parsed);
|
|
20715
20719
|
return parsed;
|
|
20716
20720
|
}
|
|
20717
20721
|
function uniqueDiagnostics(diagnostics) {
|
|
20718
20722
|
const seen = /* @__PURE__ */ new Set();
|
|
20719
20723
|
return diagnostics.filter((diagnostic) => {
|
|
20720
20724
|
const key = JSON.stringify(diagnostic);
|
|
20721
|
-
if (seen.has(key))
|
|
20722
|
-
return false;
|
|
20725
|
+
if (seen.has(key)) return false;
|
|
20723
20726
|
seen.add(key);
|
|
20724
20727
|
return true;
|
|
20725
20728
|
});
|
|
20726
20729
|
}
|
|
20727
20730
|
|
|
20728
|
-
// packages/config/
|
|
20731
|
+
// packages/config/src/data.ts
|
|
20729
20732
|
function isRecord(value) {
|
|
20730
20733
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20731
20734
|
}
|
|
@@ -20734,8 +20737,7 @@ function isSafeKey(key) {
|
|
|
20734
20737
|
return !unsafeKeys.has(key);
|
|
20735
20738
|
}
|
|
20736
20739
|
function mergeValues(base, override) {
|
|
20737
|
-
if (!isRecord(base) || !isRecord(override))
|
|
20738
|
-
return override;
|
|
20740
|
+
if (!isRecord(base) || !isRecord(override)) return override;
|
|
20739
20741
|
const merged = { ...base };
|
|
20740
20742
|
for (const [key, value] of Object.entries(override)) {
|
|
20741
20743
|
merged[key] = Object.hasOwn(merged, key) ? mergeValues(merged[key], value) : value;
|
|
@@ -20743,17 +20745,14 @@ function mergeValues(base, override) {
|
|
|
20743
20745
|
return merged;
|
|
20744
20746
|
}
|
|
20745
20747
|
|
|
20746
|
-
// packages/config/
|
|
20748
|
+
// packages/config/src/resolve.ts
|
|
20747
20749
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
20748
20750
|
|
|
20749
|
-
// packages/config/
|
|
20751
|
+
// packages/config/src/json-pointer.ts
|
|
20750
20752
|
function parsePointer(pointer) {
|
|
20751
|
-
if (pointer === "")
|
|
20752
|
-
|
|
20753
|
-
if (
|
|
20754
|
-
return void 0;
|
|
20755
|
-
if (/~[^01]|~$/.test(pointer))
|
|
20756
|
-
return void 0;
|
|
20753
|
+
if (pointer === "") return [];
|
|
20754
|
+
if (!pointer.startsWith("/")) return void 0;
|
|
20755
|
+
if (/~[^01]|~$/.test(pointer)) return void 0;
|
|
20757
20756
|
return pointer.slice(1).split("/").map((key) => key.replaceAll("~1", "/").replaceAll("~0", "~"));
|
|
20758
20757
|
}
|
|
20759
20758
|
function appendPointer(pointer, key) {
|
|
@@ -20761,7 +20760,7 @@ function appendPointer(pointer, key) {
|
|
|
20761
20760
|
return `${pointer}/${escaped}`;
|
|
20762
20761
|
}
|
|
20763
20762
|
|
|
20764
|
-
// packages/config/
|
|
20763
|
+
// packages/config/src/distance.ts
|
|
20765
20764
|
function nearNames(text2, candidates) {
|
|
20766
20765
|
return candidates.map((name) => ({ name, edits: distance(name, text2) })).filter(({ edits }) => edits <= 2 && edits < text2.length).sort((a, b) => a.edits - b.edits).map(({ name }) => name);
|
|
20767
20766
|
}
|
|
@@ -20770,13 +20769,17 @@ function distance(a, b) {
|
|
|
20770
20769
|
for (let i = 1; i <= a.length; i += 1) {
|
|
20771
20770
|
const next = [i];
|
|
20772
20771
|
for (let j = 1; j <= b.length; j += 1)
|
|
20773
|
-
next[j] = Math.min(
|
|
20772
|
+
next[j] = Math.min(
|
|
20773
|
+
row[j] + 1,
|
|
20774
|
+
next[j - 1] + 1,
|
|
20775
|
+
row[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1)
|
|
20776
|
+
);
|
|
20774
20777
|
row = next;
|
|
20775
20778
|
}
|
|
20776
20779
|
return row[b.length];
|
|
20777
20780
|
}
|
|
20778
20781
|
|
|
20779
|
-
// packages/config/
|
|
20782
|
+
// packages/config/src/references.ts
|
|
20780
20783
|
var referenceRoots = ["values", "environment", "project"];
|
|
20781
20784
|
var resolverNames = ["file", "envvar", "secret"];
|
|
20782
20785
|
function parseDefinitionString(text2) {
|
|
@@ -20795,22 +20798,23 @@ function parseDefinitionString(text2) {
|
|
|
20795
20798
|
continue;
|
|
20796
20799
|
}
|
|
20797
20800
|
const reference3 = readReference(text2, index);
|
|
20798
|
-
if (!reference3.ok)
|
|
20799
|
-
|
|
20800
|
-
if (literal2)
|
|
20801
|
-
segments.push({ type: "text", text: literal2 });
|
|
20801
|
+
if (!reference3.ok) return reference3;
|
|
20802
|
+
if (literal2) segments.push({ type: "text", text: literal2 });
|
|
20802
20803
|
literal2 = "";
|
|
20803
20804
|
segments.push(reference3.segment);
|
|
20804
20805
|
index = reference3.end;
|
|
20805
20806
|
}
|
|
20806
|
-
if (literal2 || segments.length === 0)
|
|
20807
|
-
segments.push({ type: "text", text: literal2 });
|
|
20807
|
+
if (literal2 || segments.length === 0) segments.push({ type: "text", text: literal2 });
|
|
20808
20808
|
return { ok: true, segments };
|
|
20809
20809
|
}
|
|
20810
20810
|
function readReference(text2, start) {
|
|
20811
20811
|
const close = text2.indexOf("}", start + 2);
|
|
20812
20812
|
if (close < 0) {
|
|
20813
|
-
return refusal(
|
|
20813
|
+
return refusal(
|
|
20814
|
+
"UNCLOSED_REFERENCE",
|
|
20815
|
+
`"${text2.slice(start)}" has no closing "}".`,
|
|
20816
|
+
text2.slice(start)
|
|
20817
|
+
);
|
|
20814
20818
|
}
|
|
20815
20819
|
const source = text2.slice(start, close + 1);
|
|
20816
20820
|
const expression = parseExpression(text2.slice(start + 2, close).trim());
|
|
@@ -20835,8 +20839,7 @@ function nearReference(body) {
|
|
|
20835
20839
|
return fixed && parseExpression(fixed) ? `\${${fixed}}` : void 0;
|
|
20836
20840
|
}
|
|
20837
20841
|
function placeholderSnippet(text2, start, source) {
|
|
20838
|
-
if (text2[start + 2] !== "{")
|
|
20839
|
-
return source;
|
|
20842
|
+
if (text2[start + 2] !== "{") return source;
|
|
20840
20843
|
const doubleClose = text2.indexOf("}}", start);
|
|
20841
20844
|
return doubleClose < 0 ? source : text2.slice(start, doubleClose + 2);
|
|
20842
20845
|
}
|
|
@@ -20846,15 +20849,12 @@ function parseExpression(body) {
|
|
|
20846
20849
|
if (colon >= 0) {
|
|
20847
20850
|
const resolver = body.slice(0, colon);
|
|
20848
20851
|
const argument = body.slice(colon + 1).trim();
|
|
20849
|
-
if (!isResolverName(resolver) || argument === "")
|
|
20850
|
-
return void 0;
|
|
20852
|
+
if (!isResolverName(resolver) || argument === "") return void 0;
|
|
20851
20853
|
return { type: "resolver", resolver, argument };
|
|
20852
20854
|
}
|
|
20853
20855
|
const [root, ...path] = body.split(".");
|
|
20854
|
-
if (!isReferenceRoot(root) || path.length === 0)
|
|
20855
|
-
|
|
20856
|
-
if (!path.every((part) => segmentPattern.test(part)))
|
|
20857
|
-
return void 0;
|
|
20856
|
+
if (!isReferenceRoot(root) || path.length === 0) return void 0;
|
|
20857
|
+
if (!path.every((part) => segmentPattern.test(part))) return void 0;
|
|
20858
20858
|
return { type: "path", root, path };
|
|
20859
20859
|
}
|
|
20860
20860
|
function isResolverName(name) {
|
|
@@ -20864,18 +20864,14 @@ function isReferenceRoot(name) {
|
|
|
20864
20864
|
return referenceRoots.includes(name ?? "");
|
|
20865
20865
|
}
|
|
20866
20866
|
|
|
20867
|
-
// packages/config/
|
|
20867
|
+
// packages/config/src/paths.ts
|
|
20868
20868
|
function resolveProjectPath(fromFile, target) {
|
|
20869
|
-
if (target.startsWith("/"))
|
|
20870
|
-
|
|
20871
|
-
if (
|
|
20872
|
-
return void 0;
|
|
20873
|
-
if (target.includes("\\"))
|
|
20874
|
-
return void 0;
|
|
20869
|
+
if (target.startsWith("/")) return void 0;
|
|
20870
|
+
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(target)) return void 0;
|
|
20871
|
+
if (target.includes("\\")) return void 0;
|
|
20875
20872
|
const parts = fromFile.split("/").slice(0, -1);
|
|
20876
20873
|
for (const part of target.split("/")) {
|
|
20877
|
-
if (part === "" || part === ".")
|
|
20878
|
-
continue;
|
|
20874
|
+
if (part === "" || part === ".") continue;
|
|
20879
20875
|
if (part !== "..") {
|
|
20880
20876
|
parts.push(part);
|
|
20881
20877
|
} else if (parts.length > 0) {
|
|
@@ -20887,16 +20883,22 @@ function resolveProjectPath(fromFile, target) {
|
|
|
20887
20883
|
return parts.join("/");
|
|
20888
20884
|
}
|
|
20889
20885
|
|
|
20890
|
-
// packages/config/
|
|
20886
|
+
// packages/config/src/resolve-file.ts
|
|
20891
20887
|
function resolveFileReference(argument, source, location, file, pointer, walk2) {
|
|
20892
|
-
if (!countInclude(source, location, walk2))
|
|
20893
|
-
return void 0;
|
|
20888
|
+
if (!countInclude(source, location, walk2)) return void 0;
|
|
20894
20889
|
const hash = argument.indexOf("#");
|
|
20895
20890
|
const pathText2 = hash < 0 ? argument : argument.slice(0, hash);
|
|
20896
20891
|
const fragment = hash < 0 ? void 0 : argument.slice(hash + 1);
|
|
20897
20892
|
const path = resolveProjectPath(file.path, pathText2);
|
|
20898
20893
|
if (path === void 0) {
|
|
20899
|
-
walk2.context.diagnostics.push(
|
|
20894
|
+
walk2.context.diagnostics.push(
|
|
20895
|
+
error(
|
|
20896
|
+
"PATH_OUTSIDE_PROJECT",
|
|
20897
|
+
`"${source}" points outside the project.`,
|
|
20898
|
+
location,
|
|
20899
|
+
"File references must stay inside the project folder."
|
|
20900
|
+
)
|
|
20901
|
+
);
|
|
20900
20902
|
return void 0;
|
|
20901
20903
|
}
|
|
20902
20904
|
if (isYamlPath(path)) {
|
|
@@ -20907,15 +20909,27 @@ function resolveFileReference(argument, source, location, file, pointer, walk2)
|
|
|
20907
20909
|
function countInclude(source, location, walk2) {
|
|
20908
20910
|
const { context: context2 } = walk2;
|
|
20909
20911
|
context2.includeCount += 1;
|
|
20910
|
-
if (context2.includeCount <= context2.limits.maxIncludes)
|
|
20911
|
-
|
|
20912
|
-
|
|
20912
|
+
if (context2.includeCount <= context2.limits.maxIncludes) return true;
|
|
20913
|
+
context2.diagnostics.push(
|
|
20914
|
+
error(
|
|
20915
|
+
"INCLUDE_LIMIT",
|
|
20916
|
+
`"${source}" would exceed ${context2.limits.maxIncludes} file includes in one load.`,
|
|
20917
|
+
location,
|
|
20918
|
+
"Include shared files fewer times, or raise limits.maxIncludes."
|
|
20919
|
+
)
|
|
20920
|
+
);
|
|
20913
20921
|
return false;
|
|
20914
20922
|
}
|
|
20915
20923
|
function readTextInclude(path, fragment, source, location, walk2) {
|
|
20916
|
-
if (fragment === void 0)
|
|
20917
|
-
|
|
20918
|
-
|
|
20924
|
+
if (fragment === void 0) return readProjectFile(walk2.context, path, location);
|
|
20925
|
+
walk2.context.diagnostics.push(
|
|
20926
|
+
error(
|
|
20927
|
+
"BAD_POINTER",
|
|
20928
|
+
`"${source}": a pointer only applies to YAML files.`,
|
|
20929
|
+
location,
|
|
20930
|
+
`Remove "#${fragment}".`
|
|
20931
|
+
)
|
|
20932
|
+
);
|
|
20919
20933
|
return void 0;
|
|
20920
20934
|
}
|
|
20921
20935
|
function resolveYamlInclude(path, fragment, source, location, pointer, walk2) {
|
|
@@ -20923,7 +20937,9 @@ function resolveYamlInclude(path, fragment, source, location, pointer, walk2) {
|
|
|
20923
20937
|
const keys2 = parsePointer(fragment);
|
|
20924
20938
|
if (keys2 === void 0) {
|
|
20925
20939
|
const hint = 'A pointer starts with "/", for example #/columns/0.';
|
|
20926
|
-
diagnostics.push(
|
|
20940
|
+
diagnostics.push(
|
|
20941
|
+
error("BAD_POINTER", `"${source}": "${fragment}" is not a JSON Pointer.`, location, hint)
|
|
20942
|
+
);
|
|
20927
20943
|
return void 0;
|
|
20928
20944
|
}
|
|
20929
20945
|
const includeKey = `${path}#${fragment}`;
|
|
@@ -20933,11 +20949,17 @@ function resolveYamlInclude(path, fragment, source, location, pointer, walk2) {
|
|
|
20933
20949
|
return void 0;
|
|
20934
20950
|
}
|
|
20935
20951
|
const target = readYaml(walk2.context, path, location);
|
|
20936
|
-
if (!target)
|
|
20937
|
-
return void 0;
|
|
20952
|
+
if (!target) return void 0;
|
|
20938
20953
|
const node = nodeAtKeys(target, keys2);
|
|
20939
20954
|
if (!node) {
|
|
20940
|
-
walk2.context.diagnostics.push(
|
|
20955
|
+
walk2.context.diagnostics.push(
|
|
20956
|
+
error(
|
|
20957
|
+
"BAD_POINTER",
|
|
20958
|
+
`"${source}": ${path} has no value at "${fragment || "/"}".`,
|
|
20959
|
+
location,
|
|
20960
|
+
"Check the pointer against the target file."
|
|
20961
|
+
)
|
|
20962
|
+
);
|
|
20941
20963
|
return void 0;
|
|
20942
20964
|
}
|
|
20943
20965
|
const includeStack = [...walk2.includeStack, includeKey];
|
|
@@ -20946,22 +20968,38 @@ function resolveYamlInclude(path, fragment, source, location, pointer, walk2) {
|
|
|
20946
20968
|
function includeProblem(includeKey, source, location, walk2) {
|
|
20947
20969
|
const { includeStack, context: context2 } = walk2;
|
|
20948
20970
|
if (includeStack.includes(includeKey)) {
|
|
20949
|
-
return error(
|
|
20971
|
+
return error(
|
|
20972
|
+
"INCLUDE_CYCLE",
|
|
20973
|
+
`"${source}" leads back to itself: ${[...includeStack, includeKey].join(" \u2192 ")}.`,
|
|
20974
|
+
location,
|
|
20975
|
+
"Remove one of the references in the chain."
|
|
20976
|
+
);
|
|
20950
20977
|
}
|
|
20951
20978
|
if (includeStack.length > context2.limits.maxIncludeDepth) {
|
|
20952
|
-
return error(
|
|
20979
|
+
return error(
|
|
20980
|
+
"INCLUDE_TOO_DEEP",
|
|
20981
|
+
`"${source}" is nested more than ${context2.limits.maxIncludeDepth} includes deep.`,
|
|
20982
|
+
location,
|
|
20983
|
+
"Flatten the chain of includes, or raise limits.maxIncludeDepth."
|
|
20984
|
+
);
|
|
20953
20985
|
}
|
|
20954
20986
|
return void 0;
|
|
20955
20987
|
}
|
|
20956
20988
|
|
|
20957
|
-
// packages/config/
|
|
20989
|
+
// packages/config/src/scope.ts
|
|
20958
20990
|
function lookupPath(expression, source, location, walk2) {
|
|
20959
20991
|
let current = rootValue(expression, source, location, walk2);
|
|
20960
|
-
if (current === void 0)
|
|
20961
|
-
return void 0;
|
|
20992
|
+
if (current === void 0) return void 0;
|
|
20962
20993
|
for (const key of expression.path) {
|
|
20963
20994
|
if (!hasChild(current, key)) {
|
|
20964
|
-
walk2.context.diagnostics.push(
|
|
20995
|
+
walk2.context.diagnostics.push(
|
|
20996
|
+
error(
|
|
20997
|
+
"UNKNOWN_VALUE",
|
|
20998
|
+
`"${source}" has no value: "${key}" is not defined.`,
|
|
20999
|
+
location,
|
|
21000
|
+
availableKeys(current)
|
|
21001
|
+
)
|
|
21002
|
+
);
|
|
20965
21003
|
return void 0;
|
|
20966
21004
|
}
|
|
20967
21005
|
current = childOf(current, key);
|
|
@@ -20971,18 +21009,31 @@ function lookupPath(expression, source, location, walk2) {
|
|
|
20971
21009
|
function rootValue(expression, source, location, walk2) {
|
|
20972
21010
|
const { scope, context: context2 } = walk2;
|
|
20973
21011
|
if (expression.root === "values" && scope.values === void 0) {
|
|
20974
|
-
context2.diagnostics.push(
|
|
21012
|
+
context2.diagnostics.push(
|
|
21013
|
+
error(
|
|
21014
|
+
"VALUES_SELF_REFERENCE",
|
|
21015
|
+
`"${source}" refers to values, but values cannot refer to other values.`,
|
|
21016
|
+
location,
|
|
21017
|
+
"Write the value out in full, or build the combined text in the document that uses it."
|
|
21018
|
+
)
|
|
21019
|
+
);
|
|
20975
21020
|
return void 0;
|
|
20976
21021
|
}
|
|
20977
21022
|
if (expression.root === "environment" && scope.environment === void 0) {
|
|
20978
|
-
context2.diagnostics.push(
|
|
21023
|
+
context2.diagnostics.push(
|
|
21024
|
+
error(
|
|
21025
|
+
"NO_ENVIRONMENT",
|
|
21026
|
+
`"${source}" needs an environment, but none was selected.`,
|
|
21027
|
+
location,
|
|
21028
|
+
'Choose one with the "environment" load option.'
|
|
21029
|
+
)
|
|
21030
|
+
);
|
|
20979
21031
|
return void 0;
|
|
20980
21032
|
}
|
|
20981
21033
|
return scope[expression.root];
|
|
20982
21034
|
}
|
|
20983
21035
|
function hasChild(value, key) {
|
|
20984
|
-
if (Array.isArray(value))
|
|
20985
|
-
return /^(0|[1-9]\d*)$/.test(key) && Number(key) < value.length;
|
|
21036
|
+
if (Array.isArray(value)) return /^(0|[1-9]\d*)$/.test(key) && Number(key) < value.length;
|
|
20986
21037
|
return isRecord(value) && isSafeKey(key) && Object.hasOwn(value, key);
|
|
20987
21038
|
}
|
|
20988
21039
|
function childOf(value, key) {
|
|
@@ -20993,7 +21044,7 @@ function availableKeys(value) {
|
|
|
20993
21044
|
return keys2.length > 0 ? `Available here: ${keys2.join(", ")}.` : "There are no named values here.";
|
|
20994
21045
|
}
|
|
20995
21046
|
|
|
20996
|
-
// packages/config/
|
|
21047
|
+
// packages/config/src/resolve-string.ts
|
|
20997
21048
|
function isSecretReference(value) {
|
|
20998
21049
|
return isRecord(value) && Object.keys(value).length === 1 && typeof value.$secret === "string";
|
|
20999
21050
|
}
|
|
@@ -21004,8 +21055,7 @@ function resolveString(text2, location, file, pointer, walk2) {
|
|
|
21004
21055
|
return void 0;
|
|
21005
21056
|
}
|
|
21006
21057
|
const [first] = parsed.segments;
|
|
21007
|
-
if (parsed.segments.length === 1 && first?.type === "text")
|
|
21008
|
-
return first.text;
|
|
21058
|
+
if (parsed.segments.length === 1 && first?.type === "text") return first.text;
|
|
21009
21059
|
if (parsed.segments.length === 1 && first?.type === "reference") {
|
|
21010
21060
|
return resolveReference(first, location, file, pointer, walk2);
|
|
21011
21061
|
}
|
|
@@ -21016,38 +21066,44 @@ function joinSegments(segments, location, file, pointer, walk2) {
|
|
|
21016
21066
|
let failed2 = false;
|
|
21017
21067
|
const embeddedWalk = { ...walk2, sourceMap: /* @__PURE__ */ new Map() };
|
|
21018
21068
|
for (const segment of segments) {
|
|
21019
|
-
const text2 = segment.type === "text" ? segment.text : asText(
|
|
21020
|
-
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
|
|
21069
|
+
const text2 = segment.type === "text" ? segment.text : asText(
|
|
21070
|
+
resolveReference(segment, location, file, pointer, embeddedWalk),
|
|
21071
|
+
segment.source,
|
|
21072
|
+
location,
|
|
21073
|
+
walk2
|
|
21074
|
+
);
|
|
21075
|
+
if (text2 === void 0) failed2 = true;
|
|
21076
|
+
else result += text2;
|
|
21024
21077
|
}
|
|
21025
21078
|
return failed2 ? void 0 : result;
|
|
21026
21079
|
}
|
|
21027
21080
|
function asText(value, source, location, walk2) {
|
|
21028
|
-
if (value === void 0)
|
|
21029
|
-
|
|
21030
|
-
if (typeof value === "
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21081
|
+
if (value === void 0) return void 0;
|
|
21082
|
+
if (typeof value === "string" || typeof value === "boolean") return String(value);
|
|
21083
|
+
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
|
21084
|
+
const diagnostic = isSecretReference(value) ? error(
|
|
21085
|
+
"SECRET_IN_TEXT",
|
|
21086
|
+
`"${source}" is a secret and cannot be part of text.`,
|
|
21087
|
+
location,
|
|
21088
|
+
"Use the secret as a whole value, for example: password: ${secret:scope/key}"
|
|
21089
|
+
) : error(
|
|
21090
|
+
"NOT_TEXT",
|
|
21091
|
+
`"${source}" is ${describeNonText(value)} and cannot be part of text.`,
|
|
21092
|
+
location,
|
|
21093
|
+
"Use it as a whole value, or refer to one item inside it."
|
|
21094
|
+
);
|
|
21035
21095
|
walk2.context.diagnostics.push(diagnostic);
|
|
21036
21096
|
return void 0;
|
|
21037
21097
|
}
|
|
21038
21098
|
function describeNonText(value) {
|
|
21039
|
-
if (Array.isArray(value))
|
|
21040
|
-
|
|
21041
|
-
if (value ===
|
|
21042
|
-
return "empty (null)";
|
|
21043
|
-
if (typeof value === "number")
|
|
21044
|
-
return "not a finite number";
|
|
21099
|
+
if (Array.isArray(value)) return "a list";
|
|
21100
|
+
if (value === null) return "empty (null)";
|
|
21101
|
+
if (typeof value === "number") return "not a finite number";
|
|
21045
21102
|
return "a mapping";
|
|
21046
21103
|
}
|
|
21047
21104
|
function resolveReference(segment, location, file, pointer, walk2) {
|
|
21048
21105
|
const { expression, source } = segment;
|
|
21049
|
-
if (expression.type === "path")
|
|
21050
|
-
return lookupPath(expression, source, location, walk2);
|
|
21106
|
+
if (expression.type === "path") return lookupPath(expression, source, location, walk2);
|
|
21051
21107
|
switch (expression.resolver) {
|
|
21052
21108
|
case "file":
|
|
21053
21109
|
return resolveFileReference(expression.argument, source, location, file, pointer, walk2);
|
|
@@ -21059,40 +21115,47 @@ function resolveReference(segment, location, file, pointer, walk2) {
|
|
|
21059
21115
|
}
|
|
21060
21116
|
function readEnvironmentVariable(name, source, location, walk2) {
|
|
21061
21117
|
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
|
21062
|
-
walk2.context.diagnostics.push(
|
|
21118
|
+
walk2.context.diagnostics.push(
|
|
21119
|
+
error(
|
|
21120
|
+
"BAD_ARGUMENT",
|
|
21121
|
+
`"${source}": "${name}" is not a valid environment variable name.`,
|
|
21122
|
+
location,
|
|
21123
|
+
"Names use letters, digits and _, and do not start with a digit."
|
|
21124
|
+
)
|
|
21125
|
+
);
|
|
21063
21126
|
return void 0;
|
|
21064
21127
|
}
|
|
21065
21128
|
const value = walk2.context.envvars[name];
|
|
21066
21129
|
if (value === void 0 || value === "") {
|
|
21067
|
-
walk2.context.diagnostics.push(
|
|
21130
|
+
walk2.context.diagnostics.push(
|
|
21131
|
+
error(
|
|
21132
|
+
"ENVVAR_MISSING",
|
|
21133
|
+
`Environment variable ${name} is not set.`,
|
|
21134
|
+
location,
|
|
21135
|
+
`Set ${name} before loading, or remove "${source}".`
|
|
21136
|
+
)
|
|
21137
|
+
);
|
|
21068
21138
|
return void 0;
|
|
21069
21139
|
}
|
|
21070
21140
|
return value;
|
|
21071
21141
|
}
|
|
21072
21142
|
|
|
21073
|
-
// packages/config/
|
|
21143
|
+
// packages/config/src/resolve.ts
|
|
21074
21144
|
function resolveNode(node, file, pointer, walk2) {
|
|
21075
|
-
if (!node)
|
|
21076
|
-
return null;
|
|
21145
|
+
if (!node) return null;
|
|
21077
21146
|
walk2.sourceMap.set(pointer, locationOf(file, node));
|
|
21078
|
-
if ((0, import_yaml2.isAlias)(node))
|
|
21079
|
-
|
|
21080
|
-
if ((0, import_yaml2.
|
|
21081
|
-
|
|
21082
|
-
if (
|
|
21083
|
-
return resolveSeq(node, file, pointer, walk2);
|
|
21084
|
-
if (!(0, import_yaml2.isScalar)(node))
|
|
21085
|
-
return null;
|
|
21086
|
-
if (typeof node.value !== "string")
|
|
21087
|
-
return node.value;
|
|
21147
|
+
if ((0, import_yaml2.isAlias)(node)) return resolveAlias(node, file, pointer, walk2);
|
|
21148
|
+
if ((0, import_yaml2.isMap)(node)) return resolveMap(node, file, pointer, walk2);
|
|
21149
|
+
if ((0, import_yaml2.isSeq)(node)) return resolveSeq(node, file, pointer, walk2);
|
|
21150
|
+
if (!(0, import_yaml2.isScalar)(node)) return null;
|
|
21151
|
+
if (typeof node.value !== "string") return node.value;
|
|
21088
21152
|
return resolveString(node.value, locationOf(file, node), file, pointer, walk2);
|
|
21089
21153
|
}
|
|
21090
21154
|
function resolveMap(node, file, pointer, walk2) {
|
|
21091
21155
|
const result = {};
|
|
21092
21156
|
for (const pair of node.items) {
|
|
21093
21157
|
const key = keyText(pair.key, file, walk2);
|
|
21094
|
-
if (key === void 0)
|
|
21095
|
-
continue;
|
|
21158
|
+
if (key === void 0) continue;
|
|
21096
21159
|
if (Object.hasOwn(result, key)) {
|
|
21097
21160
|
reportDuplicateKey(key, pair.key, file, walk2);
|
|
21098
21161
|
continue;
|
|
@@ -21103,29 +21166,51 @@ function resolveMap(node, file, pointer, walk2) {
|
|
|
21103
21166
|
return result;
|
|
21104
21167
|
}
|
|
21105
21168
|
function resolveSeq(node, file, pointer, walk2) {
|
|
21106
|
-
return node.items.map(
|
|
21169
|
+
return node.items.map(
|
|
21170
|
+
(item, index) => resolveNode((0, import_yaml2.isNode)(item) ? item : null, file, appendPointer(pointer, index), walk2)
|
|
21171
|
+
);
|
|
21107
21172
|
}
|
|
21108
21173
|
function reportDuplicateKey(key, keyNode, file, walk2) {
|
|
21109
|
-
walk2.context.diagnostics.push(
|
|
21174
|
+
walk2.context.diagnostics.push(
|
|
21175
|
+
error(
|
|
21176
|
+
"YAML_SYNTAX",
|
|
21177
|
+
`Duplicate key "${key}". Keys are compared as text, so 1 and '1' are the same key.`,
|
|
21178
|
+
locationOf(file, (0, import_yaml2.isNode)(keyNode) ? keyNode : void 0),
|
|
21179
|
+
"Remove or rename one of the keys."
|
|
21180
|
+
)
|
|
21181
|
+
);
|
|
21110
21182
|
}
|
|
21111
21183
|
function keyText(key, file, walk2) {
|
|
21112
21184
|
const text2 = (0, import_yaml2.isScalar)(key) ? String(key.value) : void 0;
|
|
21113
|
-
if (text2 !== void 0 && isSafeKey(text2))
|
|
21114
|
-
|
|
21115
|
-
|
|
21185
|
+
if (text2 !== void 0 && isSafeKey(text2)) return text2;
|
|
21186
|
+
walk2.context.diagnostics.push(
|
|
21187
|
+
error(
|
|
21188
|
+
"UNSAFE_KEY",
|
|
21189
|
+
`The key ${text2 === void 0 ? "here" : `"${text2}"`} is not allowed.`,
|
|
21190
|
+
locationOf(file, (0, import_yaml2.isNode)(key) ? key : void 0),
|
|
21191
|
+
"Keys must be plain text other than __proto__, constructor or prototype."
|
|
21192
|
+
)
|
|
21193
|
+
);
|
|
21116
21194
|
return void 0;
|
|
21117
21195
|
}
|
|
21118
21196
|
function resolveAlias(node, file, pointer, walk2) {
|
|
21119
21197
|
walk2.context.aliasCount += 1;
|
|
21120
21198
|
if (walk2.context.aliasCount > walk2.context.limits.maxAliases) {
|
|
21121
|
-
walk2.context.diagnostics.push(
|
|
21199
|
+
walk2.context.diagnostics.push(
|
|
21200
|
+
error(
|
|
21201
|
+
"ALIAS_LIMIT",
|
|
21202
|
+
`More than ${walk2.context.limits.maxAliases} YAML aliases were expanded.`,
|
|
21203
|
+
locationOf(file, node),
|
|
21204
|
+
"Use fewer aliases, or raise limits.maxAliases."
|
|
21205
|
+
)
|
|
21206
|
+
);
|
|
21122
21207
|
return void 0;
|
|
21123
21208
|
}
|
|
21124
21209
|
const target = node.resolve(file.document);
|
|
21125
21210
|
return resolveNode(target ?? null, file, pointer, walk2);
|
|
21126
21211
|
}
|
|
21127
21212
|
|
|
21128
|
-
// packages/config/
|
|
21213
|
+
// packages/config/src/dialects.ts
|
|
21129
21214
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
21130
21215
|
var import__ = __toESM(require__(), 1);
|
|
21131
21216
|
var import__2 = __toESM(require__2(), 1);
|
|
@@ -21137,26 +21222,21 @@ var dialectsByUri = {
|
|
|
21137
21222
|
};
|
|
21138
21223
|
var supportedDialects = Object.values(dialectsByUri).join(", ");
|
|
21139
21224
|
function dialectOf(schema) {
|
|
21140
|
-
if (typeof schema === "boolean" || schema.$schema === void 0)
|
|
21141
|
-
|
|
21142
|
-
if (typeof schema.$schema !== "string")
|
|
21143
|
-
return void 0;
|
|
21225
|
+
if (typeof schema === "boolean" || schema.$schema === void 0) return defaultDialect;
|
|
21226
|
+
if (typeof schema.$schema !== "string") return void 0;
|
|
21144
21227
|
const uri = schema.$schema.replace(/^https?:\/\//, "").replace(/#$/, "");
|
|
21145
21228
|
return dialectsByUri[uri];
|
|
21146
21229
|
}
|
|
21147
21230
|
function createAjv(dialect, options2) {
|
|
21148
|
-
if (dialect === "draft-07")
|
|
21149
|
-
|
|
21150
|
-
if (dialect === "2019-09")
|
|
21151
|
-
return new import__.Ajv2019(options2);
|
|
21231
|
+
if (dialect === "draft-07") return new import_ajv.Ajv(options2);
|
|
21232
|
+
if (dialect === "2019-09") return new import__.Ajv2019(options2);
|
|
21152
21233
|
return new import__2.Ajv2020(options2);
|
|
21153
21234
|
}
|
|
21154
21235
|
|
|
21155
|
-
// packages/config/
|
|
21236
|
+
// packages/config/src/schema-messages.ts
|
|
21156
21237
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
21157
21238
|
function describeFailure(failure2, all, root) {
|
|
21158
|
-
if (repeats(failure2, all))
|
|
21159
|
-
return void 0;
|
|
21239
|
+
if (repeats(failure2, all)) return void 0;
|
|
21160
21240
|
const keys2 = parsePointer(failure2.instancePath) ?? [];
|
|
21161
21241
|
const path = pathText(keys2);
|
|
21162
21242
|
const message = messageFor(failure2, path, keys2.length === 0);
|
|
@@ -21168,16 +21248,17 @@ function repeats(failure2, all) {
|
|
|
21168
21248
|
const at = failure2.instancePath;
|
|
21169
21249
|
if (failure2.keyword === "minProperties")
|
|
21170
21250
|
return all.some((other) => other.keyword === "required" && other.instancePath === at);
|
|
21171
|
-
if (inAlternative(failure2))
|
|
21172
|
-
|
|
21173
|
-
|
|
21174
|
-
|
|
21175
|
-
|
|
21251
|
+
if (inAlternative(failure2)) return true;
|
|
21252
|
+
if (!branching.has(failure2.keyword)) return false;
|
|
21253
|
+
return all.some(
|
|
21254
|
+
(other) => other !== failure2 && !branching.has(other.keyword) && !inAlternative(other) && (other.instancePath === at || other.instancePath.startsWith(`${at}/`))
|
|
21255
|
+
);
|
|
21176
21256
|
}
|
|
21177
21257
|
function pathText(keys2) {
|
|
21178
|
-
if (keys2.length === 0)
|
|
21179
|
-
|
|
21180
|
-
|
|
21258
|
+
if (keys2.length === 0) return "The document";
|
|
21259
|
+
return keys2.map(
|
|
21260
|
+
(key, index) => /^\d+$/.test(key) ? `[${key}]` : /^[\w-]+$/.test(key) ? `${index === 0 ? "" : "."}${key}` : `["${key}"]`
|
|
21261
|
+
).join("");
|
|
21181
21262
|
}
|
|
21182
21263
|
var phrases = {
|
|
21183
21264
|
type: ({ data, params }, path) => data === null || data === void 0 ? `${path} is empty; it must be ${expected(String(params.type))}.` : `${path} is ${actual(data)}; it must be ${expected(String(params.type))}.`,
|
|
@@ -21191,8 +21272,7 @@ var phrases = {
|
|
|
21191
21272
|
};
|
|
21192
21273
|
function messageFor(failure2, path, atRoot) {
|
|
21193
21274
|
const phrase = phrases[failure2.keyword];
|
|
21194
|
-
if (phrase)
|
|
21195
|
-
return phrase(failure2, path, atRoot);
|
|
21275
|
+
if (phrase) return phrase(failure2, path, atRoot);
|
|
21196
21276
|
return limits(failure2, path) ?? `${path} ${failure2.message ?? "is not valid"}.`;
|
|
21197
21277
|
}
|
|
21198
21278
|
function limits(failure2, path) {
|
|
@@ -21220,10 +21300,8 @@ function expected(types) {
|
|
|
21220
21300
|
return types.split(",").map((type) => typeWords[type] ?? type).join(" or ");
|
|
21221
21301
|
}
|
|
21222
21302
|
function actual(value) {
|
|
21223
|
-
if (Array.isArray(value))
|
|
21224
|
-
|
|
21225
|
-
if (isRecord(value))
|
|
21226
|
-
return "a mapping";
|
|
21303
|
+
if (Array.isArray(value)) return "a list";
|
|
21304
|
+
if (isRecord(value)) return "a mapping";
|
|
21227
21305
|
return JSON.stringify(value);
|
|
21228
21306
|
}
|
|
21229
21307
|
function plain(value) {
|
|
@@ -21235,10 +21313,11 @@ function unknownField(field, where, parent) {
|
|
|
21235
21313
|
return `"${field}" is not a field of ${where}.${near ? ` Did you mean "${near}"?` : ""}`;
|
|
21236
21314
|
}
|
|
21237
21315
|
function hintFor(failure2, keys2, root) {
|
|
21238
|
-
if (failure2.keyword === "oneOf" || failure2.keyword === "anyOf")
|
|
21239
|
-
return formsHint(failure2);
|
|
21316
|
+
if (failure2.keyword === "oneOf" || failure2.keyword === "anyOf") return formsHint(failure2);
|
|
21240
21317
|
if (failure2.keyword === "additionalProperties") {
|
|
21241
|
-
const known3 = Object.keys(
|
|
21318
|
+
const known3 = Object.keys(
|
|
21319
|
+
failure2.parentSchema?.properties ?? {}
|
|
21320
|
+
);
|
|
21242
21321
|
return known3.length > 0 ? { hint: `Fields: ${known3.join(", ")}.` } : {};
|
|
21243
21322
|
}
|
|
21244
21323
|
const field = failure2.keyword === "required" ? [...keys2, String(failure2.params.missingProperty)] : [...keys2];
|
|
@@ -21284,7 +21363,7 @@ function lookup(root, reference3) {
|
|
|
21284
21363
|
return name ? defs?.[name] : void 0;
|
|
21285
21364
|
}
|
|
21286
21365
|
|
|
21287
|
-
// packages/config/
|
|
21366
|
+
// packages/config/src/schema-fixes.ts
|
|
21288
21367
|
var maxValues = 8;
|
|
21289
21368
|
function schemaFixes(failure2, file, root) {
|
|
21290
21369
|
const { instancePath: pointer, params } = failure2;
|
|
@@ -21296,16 +21375,13 @@ function schemaFixes(failure2, file, root) {
|
|
|
21296
21375
|
edits: [{ file, pointer: appendPointer(pointer, field), rename: name }]
|
|
21297
21376
|
}));
|
|
21298
21377
|
}
|
|
21299
|
-
if (failure2.keyword === "enum")
|
|
21300
|
-
|
|
21301
|
-
if (failure2.keyword === "required")
|
|
21302
|
-
return requiredFixes(failure2, file, root);
|
|
21378
|
+
if (failure2.keyword === "enum") return valueFixes(failure2, file);
|
|
21379
|
+
if (failure2.keyword === "required") return requiredFixes(failure2, file, root);
|
|
21303
21380
|
return [];
|
|
21304
21381
|
}
|
|
21305
21382
|
function valueFixes({ instancePath: pointer, params, data }, file) {
|
|
21306
21383
|
const values2 = params.allowedValues;
|
|
21307
|
-
if (values2.length > maxValues)
|
|
21308
|
-
return [];
|
|
21384
|
+
if (values2.length > maxValues) return [];
|
|
21309
21385
|
const [closest] = nearNames(String(data), values2.map(String));
|
|
21310
21386
|
const ordered = [
|
|
21311
21387
|
...values2.filter((value) => String(value) === closest),
|
|
@@ -21321,8 +21397,7 @@ function requiredFixes({ instancePath, params }, file, root) {
|
|
|
21321
21397
|
const keys2 = [...parsePointer(instancePath) ?? [], field];
|
|
21322
21398
|
const schemas = schemasAt(root, keys2);
|
|
21323
21399
|
const known3 = schemas.find((schema) => "default" in schema)?.default ?? schemas.map((schema) => schema.examples).find(Array.isArray)?.[0];
|
|
21324
|
-
if (known3 === void 0)
|
|
21325
|
-
return [];
|
|
21400
|
+
if (known3 === void 0) return [];
|
|
21326
21401
|
return [
|
|
21327
21402
|
{
|
|
21328
21403
|
title: `Add "${field}"`,
|
|
@@ -21331,7 +21406,7 @@ function requiredFixes({ instancePath, params }, file, root) {
|
|
|
21331
21406
|
];
|
|
21332
21407
|
}
|
|
21333
21408
|
|
|
21334
|
-
// packages/config/
|
|
21409
|
+
// packages/config/src/validate.ts
|
|
21335
21410
|
function createSchemaChecker() {
|
|
21336
21411
|
const engines = /* @__PURE__ */ new Map();
|
|
21337
21412
|
const compiled = /* @__PURE__ */ new Map();
|
|
@@ -21356,16 +21431,14 @@ function createSchemaChecker() {
|
|
|
21356
21431
|
validate = engineFor(schema).compile(schema);
|
|
21357
21432
|
compiled.set(schema, validate);
|
|
21358
21433
|
}
|
|
21359
|
-
if (validate(value))
|
|
21360
|
-
return [];
|
|
21434
|
+
if (validate(value)) return [];
|
|
21361
21435
|
const failures = validate.errors ?? [];
|
|
21362
21436
|
return failures.flatMap((failure2) => problemFor(failure2, failures, schema, locate, file)).sort(byLocation);
|
|
21363
21437
|
};
|
|
21364
21438
|
}
|
|
21365
21439
|
function problemFor(failure2, failures, schema, locate, file) {
|
|
21366
21440
|
const described = describeFailure(failure2, failures, schema);
|
|
21367
|
-
if (!described)
|
|
21368
|
-
return [];
|
|
21441
|
+
if (!described) return [];
|
|
21369
21442
|
const location = locate(failingPointer(failure2));
|
|
21370
21443
|
const problem2 = error("SCHEMA", described.message, location, described.hint);
|
|
21371
21444
|
const fixes = file && location?.file === file ? schemaFixes(failure2, file, schema) : [];
|
|
@@ -21373,13 +21446,11 @@ function problemFor(failure2, failures, schema, locate, file) {
|
|
|
21373
21446
|
}
|
|
21374
21447
|
function byLocation(a, b) {
|
|
21375
21448
|
const [x, y] = [a.location, b.location];
|
|
21376
|
-
if (!x || !y)
|
|
21377
|
-
return 0;
|
|
21449
|
+
if (!x || !y) return 0;
|
|
21378
21450
|
return x.file.localeCompare(y.file) || x.line - y.line || x.column - y.column;
|
|
21379
21451
|
}
|
|
21380
21452
|
function failingPointer(failure2) {
|
|
21381
|
-
if (failure2.keyword !== "additionalProperties")
|
|
21382
|
-
return failure2.instancePath;
|
|
21453
|
+
if (failure2.keyword !== "additionalProperties") return failure2.instancePath;
|
|
21383
21454
|
return appendPointer(failure2.instancePath, String(failure2.params.additionalProperty));
|
|
21384
21455
|
}
|
|
21385
21456
|
function locateIn(sourceMap) {
|
|
@@ -21392,11 +21463,10 @@ function locateIn(sourceMap) {
|
|
|
21392
21463
|
};
|
|
21393
21464
|
}
|
|
21394
21465
|
|
|
21395
|
-
// packages/config/
|
|
21466
|
+
// packages/config/src/documents.ts
|
|
21396
21467
|
function loadDocument(context2, path, scope, kinds2, checkSchema3) {
|
|
21397
21468
|
const file = readYaml(context2, path);
|
|
21398
|
-
if (!file)
|
|
21399
|
-
return void 0;
|
|
21469
|
+
if (!file) return void 0;
|
|
21400
21470
|
const errorsBefore = errorCount(context2);
|
|
21401
21471
|
const walk2 = {
|
|
21402
21472
|
context: context2,
|
|
@@ -21405,15 +21475,12 @@ function loadDocument(context2, path, scope, kinds2, checkSchema3) {
|
|
|
21405
21475
|
includeStack: [`${path}#`]
|
|
21406
21476
|
};
|
|
21407
21477
|
const value = resolveNode(file.document.contents, file, "", walk2);
|
|
21408
|
-
if (errorCount(context2) > errorsBefore)
|
|
21409
|
-
return void 0;
|
|
21478
|
+
if (errorCount(context2) > errorsBefore) return void 0;
|
|
21410
21479
|
const root = walk2.sourceMap.get("") ?? { file: path, line: 1, column: 1 };
|
|
21411
21480
|
const header = readHeader(value, path, root, context2.diagnostics);
|
|
21412
|
-
if (!header)
|
|
21413
|
-
return unloaded(context2, value);
|
|
21481
|
+
if (!header) return unloaded(context2, value);
|
|
21414
21482
|
const definition = findKind(kinds2, header, root, context2.diagnostics);
|
|
21415
|
-
if (!definition)
|
|
21416
|
-
return unloaded(context2, value);
|
|
21483
|
+
if (!definition) return unloaded(context2, value);
|
|
21417
21484
|
const problems = checkSchema3(definition.schema, value, locateIn(walk2.sourceMap), path);
|
|
21418
21485
|
context2.diagnostics.push(...problems);
|
|
21419
21486
|
const locate = locateIn(walk2.sourceMap);
|
|
@@ -21443,15 +21510,30 @@ function readHeader(value, path, root, diagnostics) {
|
|
|
21443
21510
|
id: value.id
|
|
21444
21511
|
};
|
|
21445
21512
|
}
|
|
21446
|
-
diagnostics.push(
|
|
21513
|
+
diagnostics.push(
|
|
21514
|
+
error(
|
|
21515
|
+
"MISSING_HEADER",
|
|
21516
|
+
`${path} needs text fields apiVersion, kind and id; missing: ${missing.join(", ")}.`,
|
|
21517
|
+
root,
|
|
21518
|
+
"Add the missing fields at the top of the file."
|
|
21519
|
+
)
|
|
21520
|
+
);
|
|
21447
21521
|
return void 0;
|
|
21448
21522
|
}
|
|
21449
21523
|
function findKind(kinds2, header, root, diagnostics) {
|
|
21450
|
-
const found = kinds2.find(
|
|
21451
|
-
|
|
21452
|
-
|
|
21524
|
+
const found = kinds2.find(
|
|
21525
|
+
(kind) => kind.apiVersion === header.apiVersion && kind.kind === header.kind
|
|
21526
|
+
);
|
|
21527
|
+
if (found) return found;
|
|
21453
21528
|
const known3 = kinds2.map((kind) => `${kind.apiVersion} ${kind.kind}`).join(", ") || "none";
|
|
21454
|
-
diagnostics.push(
|
|
21529
|
+
diagnostics.push(
|
|
21530
|
+
error(
|
|
21531
|
+
"UNKNOWN_KIND",
|
|
21532
|
+
`No kind "${header.kind}" with apiVersion "${header.apiVersion}" is registered.`,
|
|
21533
|
+
root,
|
|
21534
|
+
`Registered kinds: ${known3}.`
|
|
21535
|
+
)
|
|
21536
|
+
);
|
|
21455
21537
|
return void 0;
|
|
21456
21538
|
}
|
|
21457
21539
|
function checkDuplicateIds(loaded, diagnostics) {
|
|
@@ -21463,11 +21545,18 @@ function checkDuplicateIds(loaded, diagnostics) {
|
|
|
21463
21545
|
firstFile.set(key, document.file);
|
|
21464
21546
|
continue;
|
|
21465
21547
|
}
|
|
21466
|
-
diagnostics.push(
|
|
21548
|
+
diagnostics.push(
|
|
21549
|
+
error(
|
|
21550
|
+
"DUPLICATE_ID",
|
|
21551
|
+
`Another ${document.kind} document already has id "${document.id}" (${earlier}).`,
|
|
21552
|
+
sourceMap.get(""),
|
|
21553
|
+
"Give each document of a kind its own id."
|
|
21554
|
+
)
|
|
21555
|
+
);
|
|
21467
21556
|
}
|
|
21468
21557
|
}
|
|
21469
21558
|
|
|
21470
|
-
// packages/config/
|
|
21559
|
+
// packages/config/src/limits.ts
|
|
21471
21560
|
var defaultLimits = Object.freeze({
|
|
21472
21561
|
maxFileBytes: 10 * 1024 * 1024,
|
|
21473
21562
|
maxIncludeDepth: 32,
|
|
@@ -21475,7 +21564,7 @@ var defaultLimits = Object.freeze({
|
|
|
21475
21564
|
maxIncludes: 1e3
|
|
21476
21565
|
});
|
|
21477
21566
|
|
|
21478
|
-
// packages/config/
|
|
21567
|
+
// packages/config/src/links.ts
|
|
21479
21568
|
function checkLinks(loaded, diagnostics, unloaded2 = []) {
|
|
21480
21569
|
for (const source of loaded.filter(({ valid }) => valid)) {
|
|
21481
21570
|
for (const [pattern3, targetKind] of Object.entries(source.definition.links)) {
|
|
@@ -21487,10 +21576,14 @@ function checkLinks(loaded, diagnostics, unloaded2 = []) {
|
|
|
21487
21576
|
}
|
|
21488
21577
|
function checkPattern({ document, sourceMap }, pattern3, accepted, ids, targetKind, diagnostics) {
|
|
21489
21578
|
for (const link of valuesAt(document.value, parsePointer(pattern3) ?? [], "")) {
|
|
21490
|
-
if (typeof link.value === "string" && accepted.includes(link.value))
|
|
21491
|
-
continue;
|
|
21579
|
+
if (typeof link.value === "string" && accepted.includes(link.value)) continue;
|
|
21492
21580
|
const location = locateIn(sourceMap)(link.pointer);
|
|
21493
|
-
const problem2 = error(
|
|
21581
|
+
const problem2 = error(
|
|
21582
|
+
"BROKEN_LINK",
|
|
21583
|
+
`${JSON.stringify(link.value)} is not the id of a ${targetKind} document.`,
|
|
21584
|
+
location,
|
|
21585
|
+
ids.length > 0 ? `Known ${targetKind} ids: ${ids.join(", ")}.` : `There are no ${targetKind} documents.`
|
|
21586
|
+
);
|
|
21494
21587
|
const fixes = location?.file === document.file ? linkFixes(link, document.file, ids) : [];
|
|
21495
21588
|
diagnostics.push(fixes.length > 0 ? { ...problem2, fixes } : problem2);
|
|
21496
21589
|
}
|
|
@@ -21506,23 +21599,22 @@ function idsOfKind(loaded, kind) {
|
|
|
21506
21599
|
}
|
|
21507
21600
|
function valuesAt(value, keys2, pointer) {
|
|
21508
21601
|
const [key, ...rest] = keys2;
|
|
21509
|
-
if (key === void 0)
|
|
21510
|
-
|
|
21511
|
-
|
|
21602
|
+
if (key === void 0) return [{ pointer, value }];
|
|
21603
|
+
return childrenOf(value, key).flatMap(
|
|
21604
|
+
([childKey, child]) => valuesAt(child, rest, appendPointer(pointer, childKey))
|
|
21605
|
+
);
|
|
21512
21606
|
}
|
|
21513
21607
|
function childrenOf(value, key) {
|
|
21514
21608
|
if (Array.isArray(value)) {
|
|
21515
21609
|
const entries = value.map((child, index) => [String(index), child]);
|
|
21516
21610
|
return key === "*" ? entries : entries.filter(([index]) => index === key);
|
|
21517
21611
|
}
|
|
21518
|
-
if (!isRecord(value))
|
|
21519
|
-
|
|
21520
|
-
if (key === "*")
|
|
21521
|
-
return Object.entries(value);
|
|
21612
|
+
if (!isRecord(value)) return [];
|
|
21613
|
+
if (key === "*") return Object.entries(value);
|
|
21522
21614
|
return Object.hasOwn(value, key) ? [[key, value[key]]] : [];
|
|
21523
21615
|
}
|
|
21524
21616
|
|
|
21525
|
-
// packages/config/
|
|
21617
|
+
// packages/config/src/glob.ts
|
|
21526
21618
|
function matchesGlob(path, pattern3) {
|
|
21527
21619
|
return globToRegExp(pattern3).test(path);
|
|
21528
21620
|
}
|
|
@@ -21544,14 +21636,12 @@ function globToRegExp(pattern3) {
|
|
|
21544
21636
|
return new RegExp(`^${source}$`);
|
|
21545
21637
|
}
|
|
21546
21638
|
function translateCharacter(character) {
|
|
21547
|
-
if (character === "*")
|
|
21548
|
-
|
|
21549
|
-
if (character === "?")
|
|
21550
|
-
return "[^/]";
|
|
21639
|
+
if (character === "*") return "[^/]*";
|
|
21640
|
+
if (character === "?") return "[^/]";
|
|
21551
21641
|
return character.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
21552
21642
|
}
|
|
21553
21643
|
|
|
21554
|
-
// packages/config/
|
|
21644
|
+
// packages/config/src/manifest.ts
|
|
21555
21645
|
var idPattern = "^[A-Za-z][A-Za-z0-9_-]*$";
|
|
21556
21646
|
var manifestSchema = {
|
|
21557
21647
|
type: "object",
|
|
@@ -21596,16 +21686,18 @@ var manifestSchema = {
|
|
|
21596
21686
|
};
|
|
21597
21687
|
function readManifest(context2, path, environment2) {
|
|
21598
21688
|
const file = readYaml(context2, path);
|
|
21599
|
-
if (!file)
|
|
21600
|
-
return void 0;
|
|
21689
|
+
if (!file) return void 0;
|
|
21601
21690
|
const fields = manifestFields(context2, file);
|
|
21602
|
-
if (fields === void 0)
|
|
21603
|
-
return void 0;
|
|
21691
|
+
if (fields === void 0) return void 0;
|
|
21604
21692
|
const check2 = createSchemaChecker();
|
|
21605
|
-
const problems = check2(
|
|
21693
|
+
const problems = check2(
|
|
21694
|
+
manifestSchema,
|
|
21695
|
+
fields,
|
|
21696
|
+
(pointer) => locationOf(file, nodeAtKeys(file, parsePointer(pointer) ?? [])),
|
|
21697
|
+
path
|
|
21698
|
+
);
|
|
21606
21699
|
context2.diagnostics.push(...problems);
|
|
21607
|
-
if (problems.length > 0 || !isRecord(fields))
|
|
21608
|
-
return void 0;
|
|
21700
|
+
if (problems.length > 0 || !isRecord(fields)) return void 0;
|
|
21609
21701
|
const manifest = fields;
|
|
21610
21702
|
const scope = {
|
|
21611
21703
|
project: { id: manifest.id, ...manifest.name === void 0 ? {} : { name: manifest.name } },
|
|
@@ -21618,24 +21710,35 @@ function manifestFields(context2, file) {
|
|
|
21618
21710
|
try {
|
|
21619
21711
|
return file.document.toJS({ maxAliasCount: context2.limits.maxAliases });
|
|
21620
21712
|
} catch {
|
|
21621
|
-
context2.diagnostics.push(
|
|
21713
|
+
context2.diagnostics.push(
|
|
21714
|
+
error(
|
|
21715
|
+
"ALIAS_LIMIT",
|
|
21716
|
+
`${file.path} expands YAML aliases more than ${context2.limits.maxAliases} times.`,
|
|
21717
|
+
locationOf(file, void 0),
|
|
21718
|
+
"Use fewer aliases, or raise limits.maxAliases."
|
|
21719
|
+
)
|
|
21720
|
+
);
|
|
21622
21721
|
return void 0;
|
|
21623
21722
|
}
|
|
21624
21723
|
}
|
|
21625
21724
|
function selectEnvironment(context2, file, manifest, environment2) {
|
|
21626
|
-
if (environment2 === void 0)
|
|
21627
|
-
return void 0;
|
|
21725
|
+
if (environment2 === void 0) return void 0;
|
|
21628
21726
|
const declared = Object.keys(manifest.environments ?? {});
|
|
21629
|
-
if (declared.includes(environment2))
|
|
21630
|
-
|
|
21631
|
-
|
|
21727
|
+
if (declared.includes(environment2)) return { name: environment2 };
|
|
21728
|
+
context2.diagnostics.push(
|
|
21729
|
+
error(
|
|
21730
|
+
"UNKNOWN_ENVIRONMENT",
|
|
21731
|
+
`Environment "${environment2}" is not declared in ${file.path}.`,
|
|
21732
|
+
locationOf(file, nodeAtKeys(file, ["environments"])),
|
|
21733
|
+
declared.length > 0 ? `Declared environments: ${declared.join(", ")}.` : "Declare it under environments:."
|
|
21734
|
+
)
|
|
21735
|
+
);
|
|
21632
21736
|
return void 0;
|
|
21633
21737
|
}
|
|
21634
21738
|
function resolveValues(context2, file, scope) {
|
|
21635
21739
|
const walk2 = { context: context2, scope, sourceMap: /* @__PURE__ */ new Map(), includeStack: [`${file.path}#`] };
|
|
21636
21740
|
const base = resolveNode(nodeAtKeys(file, ["values"]), file, "/values", walk2);
|
|
21637
|
-
if (!scope.environment)
|
|
21638
|
-
return base ?? {};
|
|
21741
|
+
if (!scope.environment) return base ?? {};
|
|
21639
21742
|
const keys2 = ["environments", scope.environment.name, "values"];
|
|
21640
21743
|
const override = resolveNode(nodeAtKeys(file, keys2), file, "/values", walk2);
|
|
21641
21744
|
return mergeValues(base ?? {}, override ?? {});
|
|
@@ -21644,24 +21747,43 @@ function importedPaths(context2, manifest) {
|
|
|
21644
21747
|
const allPaths = context2.files.list().filter((path) => path !== manifest.file.path);
|
|
21645
21748
|
const found = /* @__PURE__ */ new Set();
|
|
21646
21749
|
manifest.imports.forEach((pattern3, index) => {
|
|
21647
|
-
const location = locationOf(
|
|
21750
|
+
const location = locationOf(
|
|
21751
|
+
manifest.file,
|
|
21752
|
+
nodeAtKeys(manifest.file, ["imports", String(index)])
|
|
21753
|
+
);
|
|
21648
21754
|
const fullPattern = resolveProjectPath(manifest.file.path, pattern3);
|
|
21649
21755
|
if (fullPattern === void 0) {
|
|
21650
|
-
context2.diagnostics.push(
|
|
21756
|
+
context2.diagnostics.push(
|
|
21757
|
+
error(
|
|
21758
|
+
"PATH_OUTSIDE_PROJECT",
|
|
21759
|
+
`Import "${pattern3}" points outside the project.`,
|
|
21760
|
+
location,
|
|
21761
|
+
"Imports are relative to the manifest's folder and must stay inside it."
|
|
21762
|
+
)
|
|
21763
|
+
);
|
|
21651
21764
|
return;
|
|
21652
21765
|
}
|
|
21653
21766
|
const matches2 = allPaths.filter((path) => matchesGlob(path, fullPattern));
|
|
21654
21767
|
if (matches2.length === 0) {
|
|
21655
|
-
context2.diagnostics.push(
|
|
21768
|
+
context2.diagnostics.push(
|
|
21769
|
+
warning(
|
|
21770
|
+
"NO_MATCH",
|
|
21771
|
+
`No files match the import "${pattern3}".`,
|
|
21772
|
+
location,
|
|
21773
|
+
"Check the pattern. It is relative to the manifest's folder."
|
|
21774
|
+
)
|
|
21775
|
+
);
|
|
21656
21776
|
}
|
|
21657
21777
|
matches2.forEach((path) => found.add(path));
|
|
21658
21778
|
});
|
|
21659
21779
|
return [...found].sort();
|
|
21660
21780
|
}
|
|
21661
21781
|
|
|
21662
|
-
// packages/config/
|
|
21782
|
+
// packages/config/src/project.ts
|
|
21663
21783
|
function createProject(scope, documents) {
|
|
21664
|
-
const all = (kind) => documents.filter(
|
|
21784
|
+
const all = (kind) => documents.filter(
|
|
21785
|
+
(document) => document.apiVersion === kind.apiVersion && document.kind === kind.kind
|
|
21786
|
+
);
|
|
21665
21787
|
return {
|
|
21666
21788
|
id: scope.project.id,
|
|
21667
21789
|
name: scope.project.name,
|
|
@@ -21673,7 +21795,7 @@ function createProject(scope, documents) {
|
|
|
21673
21795
|
};
|
|
21674
21796
|
}
|
|
21675
21797
|
|
|
21676
|
-
// packages/config/
|
|
21798
|
+
// packages/config/src/load.ts
|
|
21677
21799
|
function resolveProject(files2, options2) {
|
|
21678
21800
|
const context2 = {
|
|
21679
21801
|
files: files2,
|
|
@@ -21686,22 +21808,23 @@ function resolveProject(files2, options2) {
|
|
|
21686
21808
|
unloaded: []
|
|
21687
21809
|
};
|
|
21688
21810
|
const manifest = readManifest(context2, options2.manifest ?? "project.yaml", options2.environment);
|
|
21689
|
-
if (!manifest)
|
|
21690
|
-
return failure(context2);
|
|
21811
|
+
if (!manifest) return failure(context2);
|
|
21691
21812
|
const checkSchema3 = createSchemaChecker();
|
|
21692
21813
|
const loaded = importedPaths(context2, manifest).map((path) => loadDocument(context2, path, manifest.scope, options2.kinds, checkSchema3)).filter((document) => document !== void 0);
|
|
21693
21814
|
checkDuplicateIds(loaded, context2.diagnostics);
|
|
21694
21815
|
checkLinks(loaded, context2.diagnostics, context2.unloaded);
|
|
21695
|
-
if (hasErrors(context2.diagnostics))
|
|
21696
|
-
|
|
21697
|
-
|
|
21816
|
+
if (hasErrors(context2.diagnostics)) return failure(context2);
|
|
21817
|
+
const project = createProject(
|
|
21818
|
+
manifest.scope,
|
|
21819
|
+
loaded.map(({ document }) => document)
|
|
21820
|
+
);
|
|
21698
21821
|
return { ok: true, project, diagnostics: uniqueDiagnostics(context2.diagnostics) };
|
|
21699
21822
|
}
|
|
21700
21823
|
function failure(context2) {
|
|
21701
21824
|
return { ok: false, diagnostics: uniqueDiagnostics(context2.diagnostics) };
|
|
21702
21825
|
}
|
|
21703
21826
|
|
|
21704
|
-
// packages/config/
|
|
21827
|
+
// packages/config/src/node-files.ts
|
|
21705
21828
|
import { readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
21706
21829
|
import { isAbsolute, join, relative, sep } from "node:path";
|
|
21707
21830
|
var skippedFolders = /* @__PURE__ */ new Set([".git", "node_modules"]);
|
|
@@ -21743,13 +21866,15 @@ function fileInsideRoot(root, path) {
|
|
|
21743
21866
|
return leavesRoot || !statSync(realPath).isFile() ? void 0 : realPath;
|
|
21744
21867
|
}
|
|
21745
21868
|
|
|
21746
|
-
// packages/config/
|
|
21869
|
+
// packages/config/src/kinds.ts
|
|
21747
21870
|
function defineKind(options2) {
|
|
21748
21871
|
const name = `${options2.apiVersion} ${options2.kind}`;
|
|
21749
21872
|
checkSchema(options2.schema, name);
|
|
21750
21873
|
for (const pattern3 of Object.keys(options2.links ?? {})) {
|
|
21751
21874
|
if (pattern3 === "" || parsePointer(pattern3) === void 0) {
|
|
21752
|
-
throw new TypeError(
|
|
21875
|
+
throw new TypeError(
|
|
21876
|
+
`Link "${pattern3}" is not a JSON Pointer such as "/source" (kind ${name}).`
|
|
21877
|
+
);
|
|
21753
21878
|
}
|
|
21754
21879
|
}
|
|
21755
21880
|
return Object.freeze({
|
|
@@ -21763,7 +21888,9 @@ function checkSchema(schema, name) {
|
|
|
21763
21888
|
const dialect = dialectOf(schema);
|
|
21764
21889
|
if (!dialect) {
|
|
21765
21890
|
const declared = typeof schema === "object" ? String(schema.$schema) : "";
|
|
21766
|
-
throw new TypeError(
|
|
21891
|
+
throw new TypeError(
|
|
21892
|
+
`The schema for ${name} declares ${declared}. Supported: ${supportedDialects}.`
|
|
21893
|
+
);
|
|
21767
21894
|
}
|
|
21768
21895
|
const validator = schemaValidators(dialect);
|
|
21769
21896
|
if (!validator.validateSchema(schema)) {
|
|
@@ -21781,7 +21908,7 @@ function schemaValidators(dialect) {
|
|
|
21781
21908
|
return validator;
|
|
21782
21909
|
}
|
|
21783
21910
|
|
|
21784
|
-
// packages/config/
|
|
21911
|
+
// packages/config/src/files.ts
|
|
21785
21912
|
function memoryFiles(files2) {
|
|
21786
21913
|
return {
|
|
21787
21914
|
list: () => Object.keys(files2).sort(),
|
|
@@ -21789,13 +21916,13 @@ function memoryFiles(files2) {
|
|
|
21789
21916
|
};
|
|
21790
21917
|
}
|
|
21791
21918
|
|
|
21792
|
-
// packages/config/
|
|
21919
|
+
// packages/config/src/fixes.ts
|
|
21793
21920
|
var import_yaml5 = __toESM(require_dist(), 1);
|
|
21794
21921
|
|
|
21795
|
-
// packages/config/
|
|
21922
|
+
// packages/config/src/remove-edit.ts
|
|
21796
21923
|
var import_yaml4 = __toESM(require_dist(), 1);
|
|
21797
21924
|
|
|
21798
|
-
// packages/config/
|
|
21925
|
+
// packages/config/src/editor-schema.ts
|
|
21799
21926
|
var reference = String.raw`(?:(?:values|environment|project)(?:\.[A-Za-z0-9_-]+)+|(?:file|envvar|secret):\s*[^}\s][^}]*)`;
|
|
21800
21927
|
var wholeReferencePattern = String.raw`^\$\{\s*${reference}\s*\}$`;
|
|
21801
21928
|
var safeTextPattern = String.raw`^(?:[^$]|\$(?!\{)|\$\$\{|\$\{\s*${reference}\s*\})*$`;
|
|
@@ -21823,25 +21950,24 @@ function toEditorSchema(schema) {
|
|
|
21823
21950
|
return typeof schema === "boolean" ? schema : transformChildren(schema);
|
|
21824
21951
|
}
|
|
21825
21952
|
function transform(schema) {
|
|
21826
|
-
if (typeof schema === "boolean")
|
|
21827
|
-
return schema;
|
|
21953
|
+
if (typeof schema === "boolean") return schema;
|
|
21828
21954
|
const copy = transformChildren(schema);
|
|
21829
21955
|
if (isPlainText(copy)) {
|
|
21830
21956
|
return { ...annotationsOf(copy), allOf: [copy, { pattern: safeTextPattern }] };
|
|
21831
21957
|
}
|
|
21832
|
-
if (hasValueConstraint(copy))
|
|
21833
|
-
return { ...annotationsOf(copy), anyOf: [copy, referenceString] };
|
|
21958
|
+
if (hasValueConstraint(copy)) return { ...annotationsOf(copy), anyOf: [copy, referenceString] };
|
|
21834
21959
|
return copy;
|
|
21835
21960
|
}
|
|
21836
21961
|
var annotationKeys = ["title", "description", "markdownDescription", "default", "examples"];
|
|
21837
21962
|
function annotationsOf(schema) {
|
|
21838
|
-
return Object.fromEntries(
|
|
21963
|
+
return Object.fromEntries(
|
|
21964
|
+
annotationKeys.filter((key) => key in schema).map((key) => [key, schema[key]])
|
|
21965
|
+
);
|
|
21839
21966
|
}
|
|
21840
21967
|
function transformChildren(schema) {
|
|
21841
21968
|
const copy = { ...schema };
|
|
21842
21969
|
for (const key of singleSchemaKeys) {
|
|
21843
|
-
if (isSchema(copy[key]))
|
|
21844
|
-
copy[key] = transform(copy[key]);
|
|
21970
|
+
if (isSchema(copy[key])) copy[key] = transform(copy[key]);
|
|
21845
21971
|
}
|
|
21846
21972
|
for (const key of schemaListKeys) {
|
|
21847
21973
|
if (Array.isArray(copy[key]))
|
|
@@ -21849,12 +21975,13 @@ function transformChildren(schema) {
|
|
|
21849
21975
|
}
|
|
21850
21976
|
for (const key of schemaMapKeys) {
|
|
21851
21977
|
const children = copy[key];
|
|
21852
|
-
if (typeof children !== "object" || children === null)
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21978
|
+
if (typeof children !== "object" || children === null) continue;
|
|
21979
|
+
copy[key] = Object.fromEntries(
|
|
21980
|
+
Object.entries(children).map(([name, child]) => [
|
|
21981
|
+
name,
|
|
21982
|
+
transform(child)
|
|
21983
|
+
])
|
|
21984
|
+
);
|
|
21858
21985
|
}
|
|
21859
21986
|
return copy;
|
|
21860
21987
|
}
|
|
@@ -21869,12 +21996,226 @@ function hasValueConstraint(schema) {
|
|
|
21869
21996
|
return "type" in schema || "enum" in schema || "const" in schema;
|
|
21870
21997
|
}
|
|
21871
21998
|
|
|
21872
|
-
// packages/config/
|
|
21999
|
+
// packages/config/src/index.ts
|
|
21873
22000
|
function loadProject(folder, options2) {
|
|
21874
22001
|
return resolveProject(nodeFiles(folder), { ...options2, envvars: options2.envvars ?? process.env });
|
|
21875
22002
|
}
|
|
21876
22003
|
|
|
21877
|
-
// packages/definitions/
|
|
22004
|
+
// packages/definitions/src/documents.ts
|
|
22005
|
+
import { readFileSync as readFileSync2 } from "node:fs";
|
|
22006
|
+
import { dirname, join as join2 } from "node:path";
|
|
22007
|
+
import { fileURLToPath } from "node:url";
|
|
22008
|
+
var import_yaml6 = __toESM(require_dist(), 1);
|
|
22009
|
+
function packageSchema(file) {
|
|
22010
|
+
const text2 = readFileSync2(
|
|
22011
|
+
join2(dirname(fileURLToPath(import.meta.url)), "../schemas", file),
|
|
22012
|
+
"utf8"
|
|
22013
|
+
);
|
|
22014
|
+
return file.endsWith(".json") ? JSON.parse(text2) : (0, import_yaml6.parse)(text2);
|
|
22015
|
+
}
|
|
22016
|
+
var apiVersion = "ingestron.io/v1";
|
|
22017
|
+
var kinds = {
|
|
22018
|
+
standard: defineKind({
|
|
22019
|
+
apiVersion,
|
|
22020
|
+
kind: "Standard",
|
|
22021
|
+
schema: packageSchema("standard.schema.yaml")
|
|
22022
|
+
}),
|
|
22023
|
+
platform: defineKind({
|
|
22024
|
+
apiVersion,
|
|
22025
|
+
kind: "Platform",
|
|
22026
|
+
schema: packageSchema("platform.schema.yaml")
|
|
22027
|
+
}),
|
|
22028
|
+
connection: defineKind({
|
|
22029
|
+
apiVersion,
|
|
22030
|
+
kind: "Connection",
|
|
22031
|
+
schema: packageSchema("connection.schema.yaml")
|
|
22032
|
+
}),
|
|
22033
|
+
flow: defineKind({
|
|
22034
|
+
apiVersion,
|
|
22035
|
+
kind: "Flow",
|
|
22036
|
+
schema: packageSchema("flow.schema.yaml"),
|
|
22037
|
+
links: { "/source": "Connection", "/tables/*/contract": "DataContract" }
|
|
22038
|
+
}),
|
|
22039
|
+
transform: defineKind({
|
|
22040
|
+
apiVersion,
|
|
22041
|
+
kind: "Transform",
|
|
22042
|
+
schema: packageSchema("transform.schema.yaml"),
|
|
22043
|
+
links: { "/contract": "DataContract" }
|
|
22044
|
+
}),
|
|
22045
|
+
contract: defineKind({
|
|
22046
|
+
apiVersion: "v3.1.0",
|
|
22047
|
+
kind: "DataContract",
|
|
22048
|
+
schema: packageSchema("odcs-v3.1.0.schema.json")
|
|
22049
|
+
})
|
|
22050
|
+
};
|
|
22051
|
+
|
|
22052
|
+
// packages/definitions/src/store-fixes.ts
|
|
22053
|
+
function storeFixes(context2, named2) {
|
|
22054
|
+
const standard = context2.standard.file;
|
|
22055
|
+
const ends = [
|
|
22056
|
+
{
|
|
22057
|
+
title: "End this flow at the landed files",
|
|
22058
|
+
edits: [{ file: named2.owner.file, pointer: "/store/uses", set: NO_STORE }]
|
|
22059
|
+
},
|
|
22060
|
+
{
|
|
22061
|
+
title: "End every flow at the landed files",
|
|
22062
|
+
edits: [{ file: standard, pointer: "/store/default", set: NO_STORE }]
|
|
22063
|
+
}
|
|
22064
|
+
];
|
|
22065
|
+
const packs2 = context2.available.filter((pack) => !context2.packs.some((own) => own.id === pack.id) && storesFiles(pack)).map((pack) => ({
|
|
22066
|
+
title: `Add the "${pack.id}" pack`,
|
|
22067
|
+
edits: [{ file: standard, pointer: "/packs/-", set: `${pack.id}@${pack.version}` }]
|
|
22068
|
+
}));
|
|
22069
|
+
return [...ends, ...packs2];
|
|
22070
|
+
}
|
|
22071
|
+
function storesFiles(pack) {
|
|
22072
|
+
return Object.values(pack.methods).some(
|
|
22073
|
+
(method) => method.action === "store" && method.accepts?.includes("files")
|
|
22074
|
+
);
|
|
22075
|
+
}
|
|
22076
|
+
|
|
22077
|
+
// packages/definitions/src/choose.ts
|
|
22078
|
+
var NO_STORE = "none";
|
|
22079
|
+
function chooseMethod(context2, action, named2, facts) {
|
|
22080
|
+
const pick = pickMethod(context2, action, named2, facts);
|
|
22081
|
+
if (!pick) return void 0;
|
|
22082
|
+
const method = context2.pack.methods[pick.id];
|
|
22083
|
+
const report = context2.reporter;
|
|
22084
|
+
if (!method) {
|
|
22085
|
+
report.error(
|
|
22086
|
+
"UNKNOWN_METHOD",
|
|
22087
|
+
`The pack ${context2.pack.id} has no method "${pick.id}".`,
|
|
22088
|
+
pick.origin,
|
|
22089
|
+
`Methods: ${Object.keys(context2.pack.methods).join(", ")}.`
|
|
22090
|
+
);
|
|
22091
|
+
return void 0;
|
|
22092
|
+
}
|
|
22093
|
+
if (method.action !== action) {
|
|
22094
|
+
report.error(
|
|
22095
|
+
"WRONG_ACTION",
|
|
22096
|
+
`"${pick.id}" is a ${method.action} method, not ${action}.`,
|
|
22097
|
+
pick.origin
|
|
22098
|
+
);
|
|
22099
|
+
return void 0;
|
|
22100
|
+
}
|
|
22101
|
+
return isAllowed(context2, action, named2, pick) ? { ...pick, method } : void 0;
|
|
22102
|
+
}
|
|
22103
|
+
function endsAtFiles(context2, named2, facts) {
|
|
22104
|
+
const pick = findPick(context2, "store", named2, facts);
|
|
22105
|
+
if (pick?.id !== NO_STORE) return void 0;
|
|
22106
|
+
return isAllowed(context2, "store", named2, pick) && located(pick.chosenBy);
|
|
22107
|
+
}
|
|
22108
|
+
function located({ at, ...rest }) {
|
|
22109
|
+
const location = at?.document.locate(at.pointer);
|
|
22110
|
+
return { ...rest, ...location && { file: location.file, line: location.line } };
|
|
22111
|
+
}
|
|
22112
|
+
function isAllowed(context2, action, named2, pick) {
|
|
22113
|
+
const allowed2 = context2.standard.value[action]?.allowed;
|
|
22114
|
+
if (!named2.doc?.uses || !allowed2 || allowed2.includes(pick.id)) return true;
|
|
22115
|
+
context2.reporter.error(
|
|
22116
|
+
"METHOD_NOT_ALLOWED",
|
|
22117
|
+
`The standard does not allow "${pick.id}" for ${action}.`,
|
|
22118
|
+
pick.origin,
|
|
22119
|
+
`Allowed: ${allowed2.join(", ")}.`
|
|
22120
|
+
);
|
|
22121
|
+
return false;
|
|
22122
|
+
}
|
|
22123
|
+
var pickers = [
|
|
22124
|
+
(_context, action, named2) => {
|
|
22125
|
+
if (!named2.doc?.uses) return void 0;
|
|
22126
|
+
const origin = { document: named2.owner, pointer: `/${action}/uses` };
|
|
22127
|
+
return { id: named2.doc.uses, origin, chosenBy: { by: "definition", at: origin } };
|
|
22128
|
+
},
|
|
22129
|
+
(context2, action, _named, facts) => {
|
|
22130
|
+
const rules = context2.standard.value[action]?.when ?? [];
|
|
22131
|
+
const index = rules.findIndex(
|
|
22132
|
+
(rule2) => matches(rule2, facts) && applies(action, rule2.use, facts)
|
|
22133
|
+
);
|
|
22134
|
+
const rule = rules[index];
|
|
22135
|
+
const at = { document: context2.standard, pointer: `/${action}/when/${index}` };
|
|
22136
|
+
return rule && { ...fromRule(rule, at), chosenBy: { by: "standard-rule", when: factsOf(rule), at } };
|
|
22137
|
+
},
|
|
22138
|
+
(context2, action, _named, facts) => {
|
|
22139
|
+
const rule = context2.pack.rules[action]?.when?.find(
|
|
22140
|
+
(candidate) => matches(candidate, facts) && canServe(context2.pack.methods[candidate.use], facts)
|
|
22141
|
+
);
|
|
22142
|
+
const pack = rule && context2.owner.get(rule.use);
|
|
22143
|
+
return rule && {
|
|
22144
|
+
...fromRule(rule),
|
|
22145
|
+
chosenBy: { by: "pack-rule", when: factsOf(rule), ...pack && { pack } }
|
|
22146
|
+
};
|
|
22147
|
+
},
|
|
22148
|
+
(context2, action) => {
|
|
22149
|
+
const id = context2.standard.value[action]?.default;
|
|
22150
|
+
const origin = { document: context2.standard, pointer: `/${action}/default` };
|
|
22151
|
+
return id ? { id, origin, chosenBy: { by: "standard-default", at: origin } } : void 0;
|
|
22152
|
+
},
|
|
22153
|
+
(context2, action) => {
|
|
22154
|
+
const id = context2.pack.rules[action]?.default;
|
|
22155
|
+
const pack = id && context2.owner.get(id);
|
|
22156
|
+
return id ? { id, chosenBy: { by: "pack-default", ...pack && { pack } } } : void 0;
|
|
22157
|
+
}
|
|
22158
|
+
];
|
|
22159
|
+
function findPick(context2, action, named2, facts) {
|
|
22160
|
+
for (const picker of pickers) {
|
|
22161
|
+
const pick = picker(context2, action, named2, facts);
|
|
22162
|
+
const written = pick?.chosenBy.by === "definition";
|
|
22163
|
+
if (pick && (written || applies(action, pick.id, facts))) return pick;
|
|
22164
|
+
}
|
|
22165
|
+
return void 0;
|
|
22166
|
+
}
|
|
22167
|
+
function applies(action, id, facts) {
|
|
22168
|
+
if (action !== "store" || id !== NO_STORE) return true;
|
|
22169
|
+
return facts.input === void 0 || facts.input === "files";
|
|
22170
|
+
}
|
|
22171
|
+
function pickMethod(context2, action, named2, facts) {
|
|
22172
|
+
const pick = findPick(context2, action, named2, facts);
|
|
22173
|
+
if (pick) return pick;
|
|
22174
|
+
if (action === "store" && named2.owner.kind === kinds.flow.kind) {
|
|
22175
|
+
context2.reporter.error(
|
|
22176
|
+
"UNKNOWN_METHOD",
|
|
22177
|
+
"Nothing chooses a store method, so nothing keeps the files ingest lands.",
|
|
22178
|
+
{ document: named2.owner, pointer: "" },
|
|
22179
|
+
"Add a store pack, or end the flow at the landed files with store: none.",
|
|
22180
|
+
storeFixes(context2, named2)
|
|
22181
|
+
);
|
|
22182
|
+
return void 0;
|
|
22183
|
+
}
|
|
22184
|
+
context2.reporter.error(
|
|
22185
|
+
"UNKNOWN_METHOD",
|
|
22186
|
+
`Neither the standard nor the pack chooses a ${action} method.`,
|
|
22187
|
+
{ document: named2.owner, pointer: "" }
|
|
22188
|
+
);
|
|
22189
|
+
return void 0;
|
|
22190
|
+
}
|
|
22191
|
+
function factsOf(rule) {
|
|
22192
|
+
return Object.fromEntries(
|
|
22193
|
+
Object.entries(rule).filter(
|
|
22194
|
+
([key]) => key !== "use" && key !== "with"
|
|
22195
|
+
)
|
|
22196
|
+
);
|
|
22197
|
+
}
|
|
22198
|
+
function fromRule(rule, at) {
|
|
22199
|
+
const origin = at && { document: at.document, pointer: `${at.pointer}/use` };
|
|
22200
|
+
const ruleWith = rule.with && {
|
|
22201
|
+
value: rule.with,
|
|
22202
|
+
at: at && { document: at.document, pointer: `${at.pointer}/with` }
|
|
22203
|
+
};
|
|
22204
|
+
return { id: rule.use, ...origin && { origin }, ...ruleWith && { ruleWith } };
|
|
22205
|
+
}
|
|
22206
|
+
function matches(rule, facts) {
|
|
22207
|
+
return Object.entries(rule).every(
|
|
22208
|
+
([key, value]) => key === "use" || key === "with" || facts[key] === value
|
|
22209
|
+
);
|
|
22210
|
+
}
|
|
22211
|
+
function canServe(method, facts) {
|
|
22212
|
+
if (!method) return false;
|
|
22213
|
+
const { connectors: connectors3, connectivity } = method;
|
|
22214
|
+
if (connectors3 && !connectors3.includes(facts.connector ?? "")) return false;
|
|
22215
|
+
return !connectivity || facts.connectivity === void 0 || connectivity.includes(facts.connectivity);
|
|
22216
|
+
}
|
|
22217
|
+
|
|
22218
|
+
// packages/definitions/src/contract-notes.ts
|
|
21878
22219
|
var column = "schema.*.properties.*";
|
|
21879
22220
|
var contractReads = [
|
|
21880
22221
|
"apiVersion",
|
|
@@ -21968,52 +22309,7 @@ var contractNotes = {
|
|
|
21968
22309
|
}
|
|
21969
22310
|
};
|
|
21970
22311
|
|
|
21971
|
-
// packages/definitions/
|
|
21972
|
-
import { readFileSync as readFileSync2 } from "node:fs";
|
|
21973
|
-
import { dirname, join as join2 } from "node:path";
|
|
21974
|
-
import { fileURLToPath } from "node:url";
|
|
21975
|
-
var import_yaml6 = __toESM(require_dist(), 1);
|
|
21976
|
-
function packageSchema(file) {
|
|
21977
|
-
const text2 = readFileSync2(join2(dirname(fileURLToPath(import.meta.url)), "../schemas", file), "utf8");
|
|
21978
|
-
return file.endsWith(".json") ? JSON.parse(text2) : (0, import_yaml6.parse)(text2);
|
|
21979
|
-
}
|
|
21980
|
-
var apiVersion = "ingestron.io/v1";
|
|
21981
|
-
var kinds = {
|
|
21982
|
-
standard: defineKind({
|
|
21983
|
-
apiVersion,
|
|
21984
|
-
kind: "Standard",
|
|
21985
|
-
schema: packageSchema("standard.schema.yaml")
|
|
21986
|
-
}),
|
|
21987
|
-
platform: defineKind({
|
|
21988
|
-
apiVersion,
|
|
21989
|
-
kind: "Platform",
|
|
21990
|
-
schema: packageSchema("platform.schema.yaml")
|
|
21991
|
-
}),
|
|
21992
|
-
connection: defineKind({
|
|
21993
|
-
apiVersion,
|
|
21994
|
-
kind: "Connection",
|
|
21995
|
-
schema: packageSchema("connection.schema.yaml")
|
|
21996
|
-
}),
|
|
21997
|
-
flow: defineKind({
|
|
21998
|
-
apiVersion,
|
|
21999
|
-
kind: "Flow",
|
|
22000
|
-
schema: packageSchema("flow.schema.yaml"),
|
|
22001
|
-
links: { "/source": "Connection", "/tables/*/contract": "DataContract" }
|
|
22002
|
-
}),
|
|
22003
|
-
transform: defineKind({
|
|
22004
|
-
apiVersion,
|
|
22005
|
-
kind: "Transform",
|
|
22006
|
-
schema: packageSchema("transform.schema.yaml"),
|
|
22007
|
-
links: { "/contract": "DataContract" }
|
|
22008
|
-
}),
|
|
22009
|
-
contract: defineKind({
|
|
22010
|
-
apiVersion: "v3.1.0",
|
|
22011
|
-
kind: "DataContract",
|
|
22012
|
-
schema: packageSchema("odcs-v3.1.0.schema.json")
|
|
22013
|
-
})
|
|
22014
|
-
};
|
|
22015
|
-
|
|
22016
|
-
// packages/definitions/dist/merge.js
|
|
22312
|
+
// packages/definitions/src/merge.ts
|
|
22017
22313
|
function isRecord2(value) {
|
|
22018
22314
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22019
22315
|
}
|
|
@@ -22029,14 +22325,14 @@ function sameValue(a, b) {
|
|
|
22029
22325
|
return JSON.stringify(sorted(a)) === JSON.stringify(sorted(b));
|
|
22030
22326
|
}
|
|
22031
22327
|
function sorted(value) {
|
|
22032
|
-
if (Array.isArray(value))
|
|
22033
|
-
|
|
22034
|
-
|
|
22035
|
-
|
|
22036
|
-
|
|
22328
|
+
if (Array.isArray(value)) return value.map(sorted);
|
|
22329
|
+
if (!isRecord2(value)) return value;
|
|
22330
|
+
return Object.fromEntries(
|
|
22331
|
+
Object.keys(value).sort().map((key) => [key, sorted(value[key])])
|
|
22332
|
+
);
|
|
22037
22333
|
}
|
|
22038
22334
|
|
|
22039
|
-
// packages/definitions/
|
|
22335
|
+
// packages/definitions/src/capabilities.ts
|
|
22040
22336
|
function isOn(context2, id) {
|
|
22041
22337
|
return context2.platform?.value.manage?.[id] === true;
|
|
22042
22338
|
}
|
|
@@ -22050,17 +22346,22 @@ function warnOff(context2, id, message, document, pointer) {
|
|
|
22050
22346
|
edits: [{ file: platform.file, pointer: `/manage/${id}`, set: true }]
|
|
22051
22347
|
}
|
|
22052
22348
|
] : [];
|
|
22053
|
-
context2.reporter.warning(
|
|
22349
|
+
context2.reporter.warning(
|
|
22350
|
+
"CAPABILITY_OFF",
|
|
22351
|
+
`${message}: the platform has ${capability?.title ?? id} off.`,
|
|
22352
|
+
{ document, pointer },
|
|
22353
|
+
`Turn it on with manage.${id} in platform.yaml.${needs2}`,
|
|
22354
|
+
fixes
|
|
22355
|
+
);
|
|
22054
22356
|
}
|
|
22055
22357
|
function checkGrants(context2) {
|
|
22056
22358
|
const platform = context2.platform;
|
|
22057
22359
|
const grants = platform?.value.grants ?? {};
|
|
22058
|
-
if (!platform || Object.keys(grants).length === 0 || isOn(context2, "schemas"))
|
|
22059
|
-
return;
|
|
22360
|
+
if (!platform || Object.keys(grants).length === 0 || isOn(context2, "schemas")) return;
|
|
22060
22361
|
warnOff(context2, "schemas", "The grants are not applied", platform, "/grants");
|
|
22061
22362
|
}
|
|
22062
22363
|
|
|
22063
|
-
// packages/definitions/
|
|
22364
|
+
// packages/definitions/src/contract-use.ts
|
|
22064
22365
|
var documentation = { use: "documentation" };
|
|
22065
22366
|
var object = "schema.*";
|
|
22066
22367
|
var column2 = "schema.*.properties.*";
|
|
@@ -22122,23 +22423,22 @@ function contractDocumentationOnly() {
|
|
|
22122
22423
|
}
|
|
22123
22424
|
function checkContractFields(context2, contracts) {
|
|
22124
22425
|
for (const document of context2.project.all(kinds.contract)) {
|
|
22125
|
-
if (!contracts.has(document.id))
|
|
22126
|
-
continue;
|
|
22426
|
+
if (!contracts.has(document.id)) continue;
|
|
22127
22427
|
walkContract(context2, document, document.value, []);
|
|
22128
22428
|
}
|
|
22129
22429
|
}
|
|
22130
22430
|
function walkContract(context2, document, value, pointer) {
|
|
22131
22431
|
if (Array.isArray(value)) {
|
|
22132
|
-
value.forEach(
|
|
22432
|
+
value.forEach(
|
|
22433
|
+
(item, index) => walkContract(context2, document, item, [...pointer, String(index)])
|
|
22434
|
+
);
|
|
22133
22435
|
return;
|
|
22134
22436
|
}
|
|
22135
|
-
if (!isRecord2(value))
|
|
22136
|
-
return;
|
|
22437
|
+
if (!isRecord2(value)) return;
|
|
22137
22438
|
for (const [key, child] of Object.entries(value)) {
|
|
22138
22439
|
const at = [...pointer, key];
|
|
22139
22440
|
const path = at.map((part) => /^\d+$/.test(part) ? "*" : part).join(".");
|
|
22140
|
-
if (!warnUnused(context2, document, at, path, value))
|
|
22141
|
-
walkContract(context2, document, child, at);
|
|
22441
|
+
if (!warnUnused(context2, document, at, path, value)) walkContract(context2, document, child, at);
|
|
22142
22442
|
}
|
|
22143
22443
|
}
|
|
22144
22444
|
function offCapability(context2, document, at, path, uses) {
|
|
@@ -22146,7 +22446,13 @@ function offCapability(context2, document, at, path, uses) {
|
|
|
22146
22446
|
const needed = used3.map((use) => use.needs).find((id) => id && !isOn(context2, id));
|
|
22147
22447
|
if (used3.length === 0 || !needed || used3.some((use) => !use.needs || isOn(context2, use.needs)))
|
|
22148
22448
|
return false;
|
|
22149
|
-
warnOff(
|
|
22449
|
+
warnOff(
|
|
22450
|
+
context2,
|
|
22451
|
+
needed,
|
|
22452
|
+
`${at.at(-1)} in contract "${document.id}" is not applied`,
|
|
22453
|
+
document,
|
|
22454
|
+
`/${at.join("/")}`
|
|
22455
|
+
);
|
|
22150
22456
|
return true;
|
|
22151
22457
|
}
|
|
22152
22458
|
function warnUnused(context2, document, at, path, parent) {
|
|
@@ -22154,17 +22460,20 @@ function warnUnused(context2, document, at, path, parent) {
|
|
|
22154
22460
|
const use = pack.contract?.[path];
|
|
22155
22461
|
return use ? [{ pack: pack.id, use }] : [];
|
|
22156
22462
|
});
|
|
22157
|
-
if (offCapability(context2, document, at, path, uses))
|
|
22158
|
-
return true;
|
|
22463
|
+
if (offCapability(context2, document, at, path, uses)) return true;
|
|
22159
22464
|
const notYet2 = uses.filter(({ use }) => use.use === "not-yet");
|
|
22160
|
-
if (notYet2.length === 0 || uses.some(({ use }) => use.use === "used"))
|
|
22161
|
-
return false;
|
|
22465
|
+
if (notYet2.length === 0 || uses.some(({ use }) => use.use === "used")) return false;
|
|
22162
22466
|
const owner2 = typeof parent.name === "string" ? ` of "${parent.name}"` : "";
|
|
22163
|
-
context2.reporter.warning(
|
|
22467
|
+
context2.reporter.warning(
|
|
22468
|
+
"CONTRACT_FIELD_UNUSED",
|
|
22469
|
+
`${at.at(-1)}${owner2} in contract "${document.id}" is not used yet, so it changes nothing.`,
|
|
22470
|
+
{ document, pointer: `/${at.join("/")}` },
|
|
22471
|
+
notYet2.map(({ pack, use }) => `${pack}: ${use.reason}`).join("\n")
|
|
22472
|
+
);
|
|
22164
22473
|
return true;
|
|
22165
22474
|
}
|
|
22166
22475
|
|
|
22167
|
-
// packages/definitions/
|
|
22476
|
+
// packages/definitions/src/naming.ts
|
|
22168
22477
|
var import_liquidjs = __toESM(require_liquid_node(), 1);
|
|
22169
22478
|
var nameVariables = {
|
|
22170
22479
|
project: "The project's id, such as sales.",
|
|
@@ -22204,13 +22513,18 @@ function renderName(context2, pattern3, variables) {
|
|
|
22204
22513
|
}
|
|
22205
22514
|
if (!validName.test(name)) {
|
|
22206
22515
|
const hint = `Names use lower-case letters, digits and "_"; filters such as "| downcase" and "| replace: '-', '_'" help.`;
|
|
22207
|
-
context2.reporter.error(
|
|
22516
|
+
context2.reporter.error(
|
|
22517
|
+
"BAD_NAME",
|
|
22518
|
+
`Name pattern "${pattern3.text}" gives "${name}", which is not a valid name.`,
|
|
22519
|
+
pattern3.at,
|
|
22520
|
+
hint
|
|
22521
|
+
);
|
|
22208
22522
|
return void 0;
|
|
22209
22523
|
}
|
|
22210
22524
|
return name;
|
|
22211
22525
|
}
|
|
22212
22526
|
|
|
22213
|
-
// packages/definitions/
|
|
22527
|
+
// packages/definitions/src/reference.ts
|
|
22214
22528
|
var referenceKinds = {
|
|
22215
22529
|
Project: { schema: withExamples(manifestSchema, { id: "retail", name: "Retail sales" }) },
|
|
22216
22530
|
Standard: kinds.standard,
|
|
@@ -22230,7 +22544,7 @@ function withExamples(schema, examples) {
|
|
|
22230
22544
|
return { ...node, properties: { ...properties2, ...Object.fromEntries(added) } };
|
|
22231
22545
|
}
|
|
22232
22546
|
|
|
22233
|
-
// packages/definitions/
|
|
22547
|
+
// packages/definitions/src/settings-keys.ts
|
|
22234
22548
|
var actions = ["ingest", "transform", "store"];
|
|
22235
22549
|
function checkSettingsKeys(context2) {
|
|
22236
22550
|
const { standard, platform, pack } = context2;
|
|
@@ -22244,8 +22558,7 @@ function checkSettingsKeys(context2) {
|
|
|
22244
22558
|
checkKeys(context2, platform, "/settings", platform.value.settings, Object.keys(pack.methods));
|
|
22245
22559
|
}
|
|
22246
22560
|
function checkKeys(context2, document, pointer, value, methods) {
|
|
22247
|
-
if (!isRecord2(value))
|
|
22248
|
-
return;
|
|
22561
|
+
if (!isRecord2(value)) return;
|
|
22249
22562
|
for (const key of Object.keys(value).filter((name) => !methods.includes(name))) {
|
|
22250
22563
|
const near = methods.find((method) => distance2(method, key) <= 2);
|
|
22251
22564
|
const fixes = near ? [
|
|
@@ -22254,7 +22567,13 @@ function checkKeys(context2, document, pointer, value, methods) {
|
|
|
22254
22567
|
edits: [{ file: document.file, pointer: `${pointer}/${key}`, rename: near }]
|
|
22255
22568
|
}
|
|
22256
22569
|
] : [];
|
|
22257
|
-
context2.reporter.error(
|
|
22570
|
+
context2.reporter.error(
|
|
22571
|
+
"UNKNOWN_METHOD",
|
|
22572
|
+
`"${key}" is not a method of the standard's packs, so these settings would apply to nothing.`,
|
|
22573
|
+
{ document, pointer: `${pointer}/${key}` },
|
|
22574
|
+
`Methods: ${methods.join(", ")}.`,
|
|
22575
|
+
fixes
|
|
22576
|
+
);
|
|
22258
22577
|
}
|
|
22259
22578
|
}
|
|
22260
22579
|
function distance2(a, b) {
|
|
@@ -22262,13 +22581,17 @@ function distance2(a, b) {
|
|
|
22262
22581
|
for (let i = 1; i <= a.length; i += 1) {
|
|
22263
22582
|
const next = [i];
|
|
22264
22583
|
for (let j = 1; j <= b.length; j += 1)
|
|
22265
|
-
next[j] = Math.min(
|
|
22584
|
+
next[j] = Math.min(
|
|
22585
|
+
row[j] + 1,
|
|
22586
|
+
next[j - 1] + 1,
|
|
22587
|
+
row[j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1)
|
|
22588
|
+
);
|
|
22266
22589
|
row = next;
|
|
22267
22590
|
}
|
|
22268
22591
|
return row[b.length];
|
|
22269
22592
|
}
|
|
22270
22593
|
|
|
22271
|
-
// packages/definitions/
|
|
22594
|
+
// packages/definitions/src/context.ts
|
|
22272
22595
|
function createContext(project, available, reporter) {
|
|
22273
22596
|
const standard = oneStandard(project, available, reporter);
|
|
22274
22597
|
const packs2 = standard ? selectPacks(standard, available, reporter) : [];
|
|
@@ -22278,8 +22601,7 @@ function createContext(project, available, reporter) {
|
|
|
22278
22601
|
const message = `A project has at most one Platform; "${platforms[1].id}" is a second.`;
|
|
22279
22602
|
reporter.error("MANY_PLATFORMS", message, { document: platforms[1], pointer: "" });
|
|
22280
22603
|
}
|
|
22281
|
-
if (reporter.failed() || !standard)
|
|
22282
|
-
return void 0;
|
|
22604
|
+
if (reporter.failed() || !standard) return void 0;
|
|
22283
22605
|
const environment2 = project.environment ?? "default";
|
|
22284
22606
|
return {
|
|
22285
22607
|
project,
|
|
@@ -22297,7 +22619,12 @@ function oneStandard(project, available, reporter) {
|
|
|
22297
22619
|
const [standard, extra] = project.all(kinds.standard);
|
|
22298
22620
|
if (!standard) {
|
|
22299
22621
|
const names = available.map((pack) => `${pack.id}@${pack.version}`).join(", ");
|
|
22300
|
-
reporter.error(
|
|
22622
|
+
reporter.error(
|
|
22623
|
+
"NO_STANDARD",
|
|
22624
|
+
"The project has no Standard document.",
|
|
22625
|
+
void 0,
|
|
22626
|
+
`Add one with "packs" from: ${names}.`
|
|
22627
|
+
);
|
|
22301
22628
|
} else if (extra) {
|
|
22302
22629
|
reporter.error("MANY_STANDARDS", `A project has one Standard; "${extra.id}" is a second.`, {
|
|
22303
22630
|
document: extra,
|
|
@@ -22312,11 +22639,20 @@ function selectPacks(standard, available, reporter) {
|
|
|
22312
22639
|
const at = { document: standard, pointer: `/packs/${index}` };
|
|
22313
22640
|
const pack = available.find((candidate) => candidate.id === id);
|
|
22314
22641
|
if (!pack) {
|
|
22315
|
-
reporter.error(
|
|
22642
|
+
reporter.error(
|
|
22643
|
+
"UNKNOWN_PACK",
|
|
22644
|
+
`There is no pack "${id}".`,
|
|
22645
|
+
at,
|
|
22646
|
+
`Available: ${available.map((item) => `${item.id}@${item.version}`).join(", ")}.`
|
|
22647
|
+
);
|
|
22316
22648
|
return [];
|
|
22317
22649
|
}
|
|
22318
22650
|
if (String(pack.version) !== version) {
|
|
22319
|
-
reporter.error(
|
|
22651
|
+
reporter.error(
|
|
22652
|
+
"WRONG_PACK",
|
|
22653
|
+
`This standard is for "${reference3}", but the pack is ${pack.id}@${pack.version}.`,
|
|
22654
|
+
at
|
|
22655
|
+
);
|
|
22320
22656
|
return [];
|
|
22321
22657
|
}
|
|
22322
22658
|
return [pack];
|
|
@@ -22328,9 +22664,12 @@ function methodOwners(standard, packs2, reporter) {
|
|
|
22328
22664
|
for (const method of Object.keys(pack.methods)) {
|
|
22329
22665
|
const earlier = owner2.get(method);
|
|
22330
22666
|
if (earlier)
|
|
22331
|
-
reporter.error(
|
|
22332
|
-
|
|
22333
|
-
|
|
22667
|
+
reporter.error(
|
|
22668
|
+
"METHOD_CONFLICT",
|
|
22669
|
+
`Packs ${earlier} and ${pack.id} both have a method "${method}".`,
|
|
22670
|
+
{ document: standard, pointer: "/packs" }
|
|
22671
|
+
);
|
|
22672
|
+
else owner2.set(method, pack.id);
|
|
22334
22673
|
}
|
|
22335
22674
|
}
|
|
22336
22675
|
return owner2;
|
|
@@ -22338,11 +22677,13 @@ function methodOwners(standard, packs2, reporter) {
|
|
|
22338
22677
|
var actions2 = ["ingest", "transform", "store"];
|
|
22339
22678
|
function combine(packs2) {
|
|
22340
22679
|
const [first] = packs2;
|
|
22341
|
-
const rules = Object.fromEntries(
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
|
|
22345
|
-
|
|
22680
|
+
const rules = Object.fromEntries(
|
|
22681
|
+
actions2.map((action) => {
|
|
22682
|
+
const fallback = packs2.map((pack) => pack.rules[action]?.default).find((id) => id !== void 0);
|
|
22683
|
+
const when = packs2.flatMap((pack) => pack.rules[action]?.when ?? []);
|
|
22684
|
+
return [action, { ...fallback && { default: fallback }, when }];
|
|
22685
|
+
})
|
|
22686
|
+
);
|
|
22346
22687
|
const methods = Object.assign({}, ...packs2.map((pack) => pack.methods));
|
|
22347
22688
|
return {
|
|
22348
22689
|
id: packs2.map((pack) => pack.id).join("+"),
|
|
@@ -22353,7 +22694,7 @@ function combine(packs2) {
|
|
|
22353
22694
|
};
|
|
22354
22695
|
}
|
|
22355
22696
|
|
|
22356
|
-
// packages/definitions/
|
|
22697
|
+
// packages/definitions/src/diagnostics.ts
|
|
22357
22698
|
function createReporter(start = []) {
|
|
22358
22699
|
const diagnostics = [...start];
|
|
22359
22700
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -22368,8 +22709,7 @@ function createReporter(start = []) {
|
|
|
22368
22709
|
...fixes && fixes.length > 0 && { fixes }
|
|
22369
22710
|
};
|
|
22370
22711
|
const key = JSON.stringify(diagnostic);
|
|
22371
|
-
if (seen.has(key))
|
|
22372
|
-
return;
|
|
22712
|
+
if (seen.has(key)) return;
|
|
22373
22713
|
seen.add(key);
|
|
22374
22714
|
diagnostics.push(diagnostic);
|
|
22375
22715
|
};
|
|
@@ -22381,7 +22721,7 @@ function createReporter(start = []) {
|
|
|
22381
22721
|
};
|
|
22382
22722
|
}
|
|
22383
22723
|
|
|
22384
|
-
// packages/definitions/
|
|
22724
|
+
// packages/definitions/src/table-checks.ts
|
|
22385
22725
|
var operators = [
|
|
22386
22726
|
"mustBe",
|
|
22387
22727
|
"mustNotBe",
|
|
@@ -22396,8 +22736,7 @@ var metrics = ["nullValues", "missingValues", "invalidValues", "duplicateValues"
|
|
|
22396
22736
|
function tableCheckOf(rule, name, column5, action) {
|
|
22397
22737
|
const operator = operators.find((key) => key in rule);
|
|
22398
22738
|
const metric = metricOf(rule);
|
|
22399
|
-
if (!operator || !metric)
|
|
22400
|
-
return void 0;
|
|
22739
|
+
if (!operator || !metric) return void 0;
|
|
22401
22740
|
const args = isRecord2(rule.arguments) ? rule.arguments : {};
|
|
22402
22741
|
const combination = Array.isArray(args.properties) ? args.properties.map(String) : [];
|
|
22403
22742
|
return {
|
|
@@ -22414,13 +22753,12 @@ function tableCheckOf(rule, name, column5, action) {
|
|
|
22414
22753
|
}
|
|
22415
22754
|
function metricOf(rule) {
|
|
22416
22755
|
const type = rule.type ?? "library";
|
|
22417
|
-
if (type === "sql")
|
|
22418
|
-
return typeof rule.query === "string" ? "sql" : void 0;
|
|
22756
|
+
if (type === "sql") return typeof rule.query === "string" ? "sql" : void 0;
|
|
22419
22757
|
const metric = String(rule.metric);
|
|
22420
22758
|
return type === "library" && metrics.includes(metric) ? metric : void 0;
|
|
22421
22759
|
}
|
|
22422
22760
|
|
|
22423
|
-
// packages/definitions/
|
|
22761
|
+
// packages/definitions/src/type-options.ts
|
|
22424
22762
|
var options = {
|
|
22425
22763
|
minLength: (name, value) => `length(${name}) >= ${literal(value)}`,
|
|
22426
22764
|
maxLength: (name, value) => `length(${name}) <= ${literal(value)}`,
|
|
@@ -22435,24 +22773,21 @@ var options = {
|
|
|
22435
22773
|
uniqueItems: (name, value) => value === true ? `size(array_distinct(${name})) = size(${name})` : ""
|
|
22436
22774
|
};
|
|
22437
22775
|
function optionChecks(column5, value) {
|
|
22438
|
-
if (!isRecord2(value))
|
|
22439
|
-
return [];
|
|
22776
|
+
if (!isRecord2(value)) return [];
|
|
22440
22777
|
const name = `\`${column5}\``;
|
|
22441
22778
|
return Object.entries(value).flatMap(([option, limit]) => {
|
|
22442
22779
|
const check2 = options[option]?.(name, limit);
|
|
22443
|
-
if (!check2)
|
|
22444
|
-
return [];
|
|
22780
|
+
if (!check2) return [];
|
|
22445
22781
|
const suffix = option.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
22446
22782
|
return [{ name: `${column5}_${suffix}`.toLowerCase(), check: `${name} IS NULL OR ${check2}` }];
|
|
22447
22783
|
});
|
|
22448
22784
|
}
|
|
22449
22785
|
function literal(value) {
|
|
22450
|
-
if (typeof value === "number")
|
|
22451
|
-
return String(value);
|
|
22786
|
+
if (typeof value === "number") return String(value);
|
|
22452
22787
|
return `'${String(value).replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
22453
22788
|
}
|
|
22454
22789
|
|
|
22455
|
-
// packages/definitions/
|
|
22790
|
+
// packages/definitions/src/quality-rules.ts
|
|
22456
22791
|
function ruleChecks(context2, entry, at) {
|
|
22457
22792
|
const names = /* @__PURE__ */ new Set();
|
|
22458
22793
|
const found = { rows: [], table: [] };
|
|
@@ -22469,21 +22804,19 @@ function ruleChecks(context2, entry, at) {
|
|
|
22469
22804
|
const name = unique(names, nameOf(property.name, rule));
|
|
22470
22805
|
const where = { ...at, pointer: `${at.pointer}/properties/${column5}/quality/${index}` };
|
|
22471
22806
|
const check2 = rowCheck(property.name, rule);
|
|
22472
|
-
if (check2)
|
|
22473
|
-
|
|
22474
|
-
else
|
|
22475
|
-
overTable(context2, found, tableCheckOf(rule, name, property.name, action), rule, where);
|
|
22807
|
+
if (check2) found.rows.push({ name, check: check2 });
|
|
22808
|
+
else overTable(context2, found, tableCheckOf(rule, name, property.name, action), rule, where);
|
|
22476
22809
|
});
|
|
22477
22810
|
if (property.unique === true && isOn(context2, "checks"))
|
|
22478
|
-
found.table.push(
|
|
22811
|
+
found.table.push(
|
|
22812
|
+
uniqueCheck(unique(names, `${property.name}_unique`), property.name, action)
|
|
22813
|
+
);
|
|
22479
22814
|
});
|
|
22480
22815
|
return found;
|
|
22481
22816
|
}
|
|
22482
22817
|
function overTable(context2, found, check2, rule, at) {
|
|
22483
|
-
if (check2 && isOn(context2, "checks"))
|
|
22484
|
-
|
|
22485
|
-
else
|
|
22486
|
-
notChecked(context2, rule, at, check2 !== void 0);
|
|
22818
|
+
if (check2 && isOn(context2, "checks")) found.table.push(check2);
|
|
22819
|
+
else notChecked(context2, rule, at, check2 !== void 0);
|
|
22487
22820
|
}
|
|
22488
22821
|
function uniqueCheck(name, column5, action) {
|
|
22489
22822
|
const base = { name, metric: "duplicateValues", columns: [column5], arguments: {} };
|
|
@@ -22502,8 +22835,7 @@ function nameOf(column5, rule) {
|
|
|
22502
22835
|
}
|
|
22503
22836
|
function unique(names, name) {
|
|
22504
22837
|
let candidate = name;
|
|
22505
|
-
for (let n = 2; names.has(candidate); n += 1)
|
|
22506
|
-
candidate = `${name}_${n}`;
|
|
22838
|
+
for (let n = 2; names.has(candidate); n += 1) candidate = `${name}_${n}`;
|
|
22507
22839
|
names.add(candidate);
|
|
22508
22840
|
return candidate;
|
|
22509
22841
|
}
|
|
@@ -22512,16 +22844,14 @@ function allowsNone(rule) {
|
|
|
22512
22844
|
return rule.mustBe === 0 || rule.mustBeLessOrEqualTo === 0 || rows && rule.mustBeLessThan === 1;
|
|
22513
22845
|
}
|
|
22514
22846
|
function rowCheck(column5, rule) {
|
|
22515
|
-
if ((rule.type ?? "library") !== "library" || !allowsNone(rule))
|
|
22516
|
-
return void 0;
|
|
22847
|
+
if ((rule.type ?? "library") !== "library" || !allowsNone(rule)) return void 0;
|
|
22517
22848
|
const args = isRecord2(rule.arguments) ? rule.arguments : {};
|
|
22518
22849
|
return metrics2[String(rule.metric)]?.(`\`${column5}\``, args);
|
|
22519
22850
|
}
|
|
22520
22851
|
var metrics2 = {
|
|
22521
22852
|
nullValues: (name) => `${name} IS NOT NULL`,
|
|
22522
22853
|
missingValues: (name, { missingValues: listed }) => {
|
|
22523
|
-
if (!Array.isArray(listed))
|
|
22524
|
-
return void 0;
|
|
22854
|
+
if (!Array.isArray(listed)) return void 0;
|
|
22525
22855
|
const values2 = listed.filter((value) => value !== null);
|
|
22526
22856
|
const notIn = values2.length > 0 ? `${name} NOT IN (${values2.map(literal).join(", ")})` : "";
|
|
22527
22857
|
if (values2.length < listed.length)
|
|
@@ -22534,34 +22864,69 @@ var metrics2 = {
|
|
|
22534
22864
|
return typeof pattern3 === "string" ? `${name} IS NULL OR ${name} RLIKE ${literal(pattern3)}` : void 0;
|
|
22535
22865
|
}
|
|
22536
22866
|
};
|
|
22867
|
+
function notCheckedAtFiles(context2, entry, at) {
|
|
22868
|
+
const warn = (rule, pointer) => {
|
|
22869
|
+
if (rule.type === "text") return;
|
|
22870
|
+
context2.reporter.warning(
|
|
22871
|
+
"QUALITY_RULE_NOT_CHECKED",
|
|
22872
|
+
`${labelOf(rule)} rule is not checked: ${AT_FILES}`,
|
|
22873
|
+
{ ...at, pointer },
|
|
22874
|
+
"Add a store step to have it checked."
|
|
22875
|
+
);
|
|
22876
|
+
};
|
|
22877
|
+
rulesOf(entry.quality).forEach((rule, index) => warn(rule, `${at.pointer}/quality/${index}`));
|
|
22878
|
+
(entry.properties ?? []).forEach(
|
|
22879
|
+
(property, column5) => rulesOf(property.quality).forEach(
|
|
22880
|
+
(rule, index) => warn(rule, `${at.pointer}/properties/${column5}/quality/${index}`)
|
|
22881
|
+
)
|
|
22882
|
+
);
|
|
22883
|
+
}
|
|
22884
|
+
var AT_FILES = "the table ends at the landed files, and nothing checks them.";
|
|
22885
|
+
function labelOf(rule) {
|
|
22886
|
+
return typeof rule.metric === "string" ? `"${rule.metric}"` : `A ${String(rule.type ?? "library")}`;
|
|
22887
|
+
}
|
|
22537
22888
|
function notChecked(context2, rule, at, countable) {
|
|
22538
|
-
if (rule.type === "text")
|
|
22539
|
-
|
|
22540
|
-
const what = typeof rule.metric === "string" ? `"${rule.metric}"` : `A ${String(rule.type ?? "library")}`;
|
|
22889
|
+
if (rule.type === "text") return;
|
|
22890
|
+
const what = labelOf(rule);
|
|
22541
22891
|
if (!countable) {
|
|
22542
22892
|
const why = rule.type === "custom" ? "Ingestron does not run other engines' checks" : "it has no comparison, such as mustBe: 0";
|
|
22543
|
-
context2.reporter.warning(
|
|
22893
|
+
context2.reporter.warning(
|
|
22894
|
+
"QUALITY_RULE_NOT_CHECKED",
|
|
22895
|
+
`${what} rule is not checked: ${why}.`,
|
|
22896
|
+
at,
|
|
22897
|
+
"Write it as a library or sql rule with a comparison, such as mustBe: 0, to have it checked."
|
|
22898
|
+
);
|
|
22544
22899
|
return;
|
|
22545
22900
|
}
|
|
22546
22901
|
const platform = context2.platform;
|
|
22547
|
-
context2.reporter.warning(
|
|
22548
|
-
|
|
22549
|
-
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22902
|
+
context2.reporter.warning(
|
|
22903
|
+
"QUALITY_RULE_NOT_CHECKED",
|
|
22904
|
+
`${what} rule compares a count over all rows, which is checked after each refresh only when manage.checks is on.`,
|
|
22905
|
+
at,
|
|
22906
|
+
"Turn on manage.checks in platform.yaml to run it after each refresh.",
|
|
22907
|
+
platform ? [
|
|
22908
|
+
{
|
|
22909
|
+
title: "Turn on manage.checks",
|
|
22910
|
+
edits: [{ file: platform.file, pointer: "/manage/checks", set: true }]
|
|
22911
|
+
}
|
|
22912
|
+
] : []
|
|
22913
|
+
);
|
|
22553
22914
|
}
|
|
22554
22915
|
|
|
22555
|
-
// packages/definitions/
|
|
22556
|
-
function contractFor(context2, table, id, at) {
|
|
22916
|
+
// packages/definitions/src/contract.ts
|
|
22917
|
+
function contractFor(context2, table, id, at, atFiles = false) {
|
|
22557
22918
|
const document = context2.project.get(kinds.contract, id);
|
|
22558
22919
|
const entries = document?.value.schema ?? [];
|
|
22559
|
-
const
|
|
22560
|
-
const index = named2 >= 0 ? named2 : entries.length === 1 ? 0 : -1;
|
|
22920
|
+
const index = entryIndex(entries, table);
|
|
22561
22921
|
const entry = entries[index];
|
|
22562
22922
|
if (!entry) {
|
|
22563
22923
|
const names = entries.map((candidate) => candidate.name).join(", ") || "none";
|
|
22564
|
-
context2.reporter.error(
|
|
22924
|
+
context2.reporter.error(
|
|
22925
|
+
"CONTRACT_TABLE",
|
|
22926
|
+
`Contract "${id}" has no schema entry named "${table}".`,
|
|
22927
|
+
at,
|
|
22928
|
+
`Its entries: ${names}.`
|
|
22929
|
+
);
|
|
22565
22930
|
return void 0;
|
|
22566
22931
|
}
|
|
22567
22932
|
const columns = (entry.properties ?? []).map((property) => columnOf(context2, property));
|
|
@@ -22570,11 +22935,19 @@ function contractFor(context2, table, id, at) {
|
|
|
22570
22935
|
...entry.description && { description: entry.description },
|
|
22571
22936
|
columns,
|
|
22572
22937
|
primaryKey: primaryKeyOf(entry),
|
|
22573
|
-
...checksOf(context2, entry, { document, pointer: `/schema/${index}` }),
|
|
22938
|
+
...checksOf(context2, entry, { document, pointer: `/schema/${index}` }, atFiles),
|
|
22574
22939
|
tags: (entry.tags ?? []).map(String)
|
|
22575
22940
|
};
|
|
22576
22941
|
}
|
|
22577
|
-
function
|
|
22942
|
+
function entryIndex(entries, table) {
|
|
22943
|
+
const named2 = entries.findIndex((candidate) => candidate.name === table);
|
|
22944
|
+
return named2 >= 0 ? named2 : entries.length === 1 ? 0 : -1;
|
|
22945
|
+
}
|
|
22946
|
+
function checksOf(context2, entry, at, atFiles) {
|
|
22947
|
+
if (atFiles) {
|
|
22948
|
+
notCheckedAtFiles(context2, entry, at);
|
|
22949
|
+
return { checks: [], tableChecks: [] };
|
|
22950
|
+
}
|
|
22578
22951
|
const { rows, table } = ruleChecks(context2, entry, at);
|
|
22579
22952
|
return { checks: rows, tableChecks: table };
|
|
22580
22953
|
}
|
|
@@ -22595,6 +22968,16 @@ function columnOf(context2, property) {
|
|
|
22595
22968
|
function primaryKeyOf(entry) {
|
|
22596
22969
|
return (entry.properties ?? []).filter((property) => property.primaryKey === true).sort((a, b) => (a.primaryKeyPosition ?? 0) - (b.primaryKeyPosition ?? 0)).map((property) => property.name);
|
|
22597
22970
|
}
|
|
22971
|
+
function expectationsNotChecked(context2, own, at) {
|
|
22972
|
+
own.forEach(
|
|
22973
|
+
(expectation, index) => context2.reporter.warning(
|
|
22974
|
+
"QUALITY_RULE_NOT_CHECKED",
|
|
22975
|
+
`Expectation "${expectation.name}" is not checked: ${AT_FILES}`,
|
|
22976
|
+
{ ...at, pointer: `${at.pointer}/${index}` },
|
|
22977
|
+
"Add a store step to have it checked."
|
|
22978
|
+
)
|
|
22979
|
+
);
|
|
22980
|
+
}
|
|
22598
22981
|
function expectationsFor(context2, contract3, own = []) {
|
|
22599
22982
|
const quality = { ...context2.pack.defaults.quality, ...context2.standard.value.quality };
|
|
22600
22983
|
const required = contract3.columns.filter((column5) => !column5.nullable).map((column5) => ({
|
|
@@ -22620,107 +23003,22 @@ function expectationsFor(context2, contract3, own = []) {
|
|
|
22620
23003
|
];
|
|
22621
23004
|
}
|
|
22622
23005
|
|
|
22623
|
-
// packages/definitions/
|
|
22624
|
-
function chooseMethod(context2, action, named2, facts) {
|
|
22625
|
-
const pick = pickMethod(context2, action, named2, facts);
|
|
22626
|
-
if (!pick)
|
|
22627
|
-
return void 0;
|
|
22628
|
-
const method = context2.pack.methods[pick.id];
|
|
22629
|
-
const report = context2.reporter;
|
|
22630
|
-
if (!method) {
|
|
22631
|
-
report.error("UNKNOWN_METHOD", `The pack ${context2.pack.id} has no method "${pick.id}".`, pick.origin, `Methods: ${Object.keys(context2.pack.methods).join(", ")}.`);
|
|
22632
|
-
return void 0;
|
|
22633
|
-
}
|
|
22634
|
-
if (method.action !== action) {
|
|
22635
|
-
report.error("WRONG_ACTION", `"${pick.id}" is a ${method.action} method, not ${action}.`, pick.origin);
|
|
22636
|
-
return void 0;
|
|
22637
|
-
}
|
|
22638
|
-
const allowed2 = context2.standard.value[action]?.allowed;
|
|
22639
|
-
if (named2.doc?.uses && allowed2 && !allowed2.includes(pick.id)) {
|
|
22640
|
-
report.error("METHOD_NOT_ALLOWED", `The standard does not allow "${pick.id}" for ${action}.`, pick.origin, `Allowed: ${allowed2.join(", ")}.`);
|
|
22641
|
-
return void 0;
|
|
22642
|
-
}
|
|
22643
|
-
return { ...pick, method };
|
|
22644
|
-
}
|
|
22645
|
-
var pickers = [
|
|
22646
|
-
(_context, action, named2) => {
|
|
22647
|
-
if (!named2.doc?.uses)
|
|
22648
|
-
return void 0;
|
|
22649
|
-
const origin = { document: named2.owner, pointer: `/${action}/uses` };
|
|
22650
|
-
return { id: named2.doc.uses, origin, chosenBy: { by: "definition", at: origin } };
|
|
22651
|
-
},
|
|
22652
|
-
(context2, action, _named, facts) => {
|
|
22653
|
-
const rules = context2.standard.value[action]?.when ?? [];
|
|
22654
|
-
const index = rules.findIndex((rule2) => matches(rule2, facts));
|
|
22655
|
-
const rule = rules[index];
|
|
22656
|
-
const at = { document: context2.standard, pointer: `/${action}/when/${index}` };
|
|
22657
|
-
return rule && { ...fromRule(rule, at), chosenBy: { by: "standard-rule", when: factsOf(rule), at } };
|
|
22658
|
-
},
|
|
22659
|
-
(context2, action, _named, facts) => {
|
|
22660
|
-
const rule = context2.pack.rules[action]?.when?.find((candidate) => matches(candidate, facts) && canServe(context2.pack.methods[candidate.use], facts));
|
|
22661
|
-
const pack = rule && context2.owner.get(rule.use);
|
|
22662
|
-
return rule && {
|
|
22663
|
-
...fromRule(rule),
|
|
22664
|
-
chosenBy: { by: "pack-rule", when: factsOf(rule), ...pack && { pack } }
|
|
22665
|
-
};
|
|
22666
|
-
},
|
|
22667
|
-
(context2, action) => {
|
|
22668
|
-
const id = context2.standard.value[action]?.default;
|
|
22669
|
-
const origin = { document: context2.standard, pointer: `/${action}/default` };
|
|
22670
|
-
return id ? { id, origin, chosenBy: { by: "standard-default", at: origin } } : void 0;
|
|
22671
|
-
},
|
|
22672
|
-
(context2, action) => {
|
|
22673
|
-
const id = context2.pack.rules[action]?.default;
|
|
22674
|
-
const pack = id && context2.owner.get(id);
|
|
22675
|
-
return id ? { id, chosenBy: { by: "pack-default", ...pack && { pack } } } : void 0;
|
|
22676
|
-
}
|
|
22677
|
-
];
|
|
22678
|
-
function pickMethod(context2, action, named2, facts) {
|
|
22679
|
-
for (const picker of pickers) {
|
|
22680
|
-
const pick = picker(context2, action, named2, facts);
|
|
22681
|
-
if (pick)
|
|
22682
|
-
return pick;
|
|
22683
|
-
}
|
|
22684
|
-
context2.reporter.error("UNKNOWN_METHOD", `Neither the standard nor the pack chooses a ${action} method.`, { document: named2.owner, pointer: "" });
|
|
22685
|
-
return void 0;
|
|
22686
|
-
}
|
|
22687
|
-
function factsOf(rule) {
|
|
22688
|
-
return Object.fromEntries(Object.entries(rule).filter(([key]) => key !== "use" && key !== "with"));
|
|
22689
|
-
}
|
|
22690
|
-
function fromRule(rule, at) {
|
|
22691
|
-
const origin = at && { document: at.document, pointer: `${at.pointer}/use` };
|
|
22692
|
-
const ruleWith = rule.with && {
|
|
22693
|
-
value: rule.with,
|
|
22694
|
-
at: at && { document: at.document, pointer: `${at.pointer}/with` }
|
|
22695
|
-
};
|
|
22696
|
-
return { id: rule.use, ...origin && { origin }, ...ruleWith && { ruleWith } };
|
|
22697
|
-
}
|
|
22698
|
-
function matches(rule, facts) {
|
|
22699
|
-
return Object.entries(rule).every(([key, value]) => key === "use" || key === "with" || facts[key] === value);
|
|
22700
|
-
}
|
|
22701
|
-
function canServe(method, facts) {
|
|
22702
|
-
if (!method)
|
|
22703
|
-
return false;
|
|
22704
|
-
const { connectors: connectors3, connectivity } = method;
|
|
22705
|
-
if (connectors3 && !connectors3.includes(facts.connector ?? ""))
|
|
22706
|
-
return false;
|
|
22707
|
-
return !connectivity || facts.connectivity === void 0 || connectivity.includes(facts.connectivity);
|
|
22708
|
-
}
|
|
22709
|
-
|
|
22710
|
-
// packages/definitions/dist/method-fixes.js
|
|
23006
|
+
// packages/definitions/src/method-fixes.ts
|
|
22711
23007
|
function methodFixes(context2, choice, facts, named2, code) {
|
|
22712
23008
|
const flow = (id) => ({ file: named2.owner.file, pointer: "/ingest/uses", set: id });
|
|
22713
23009
|
const own = readers(context2.pack, facts).filter((id) => id !== choice.id).flatMap((id) => [
|
|
22714
23010
|
{ title: `Use "${id}" for this flow`, edits: [flow(id)] },
|
|
22715
23011
|
standardFix(context2, choice, facts, id, code)
|
|
22716
23012
|
]);
|
|
22717
|
-
const others = context2.available.filter((pack) => !context2.packs.some((own2) => own2.id === pack.id)).flatMap(
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22721
|
-
|
|
22722
|
-
|
|
22723
|
-
|
|
23013
|
+
const others = context2.available.filter((pack) => !context2.packs.some((own2) => own2.id === pack.id)).flatMap(
|
|
23014
|
+
(pack) => readers(pack, facts).map((id) => ({
|
|
23015
|
+
title: `Add the "${pack.id}" pack and use "${id}" for this flow`,
|
|
23016
|
+
edits: [
|
|
23017
|
+
{ file: context2.standard.file, pointer: "/packs/-", set: `${pack.id}@${pack.version}` },
|
|
23018
|
+
flow(id)
|
|
23019
|
+
]
|
|
23020
|
+
}))
|
|
23021
|
+
);
|
|
22724
23022
|
return [...own, ...others];
|
|
22725
23023
|
}
|
|
22726
23024
|
function readers(pack, facts) {
|
|
@@ -22746,21 +23044,25 @@ function standardFix(context2, choice, facts, id, code) {
|
|
|
22746
23044
|
};
|
|
22747
23045
|
}
|
|
22748
23046
|
|
|
22749
|
-
// packages/definitions/
|
|
23047
|
+
// packages/definitions/src/settings.ts
|
|
22750
23048
|
var import__3 = __toESM(require__2(), 1);
|
|
22751
23049
|
|
|
22752
|
-
// packages/definitions/
|
|
23050
|
+
// packages/definitions/src/missing-settings.ts
|
|
22753
23051
|
function reportMissing(context2, use, missing) {
|
|
22754
23052
|
const properties2 = use.method.settings.properties ?? {};
|
|
22755
23053
|
const hint = missing.map((key) => `${key}: ${properties2[key]?.description ?? "required."}`).join("\n");
|
|
22756
|
-
context2.reporter.error(
|
|
23054
|
+
context2.reporter.error(
|
|
23055
|
+
"BAD_SETTING",
|
|
23056
|
+
`"${use.id}" needs settings: ${missing.join(", ")}.`,
|
|
23057
|
+
{ document: use.user.owner, pointer: use.user.at },
|
|
23058
|
+
hint,
|
|
23059
|
+
[{ title: "Add the missing settings", edits: missingEdits(context2, use, missing) }]
|
|
23060
|
+
);
|
|
22757
23061
|
}
|
|
22758
23062
|
function homeOf(context2, use, key) {
|
|
22759
23063
|
const { platform = [], standard = [] } = use.method.placement ?? {};
|
|
22760
|
-
if (platform.includes(key) && context2.platform)
|
|
22761
|
-
|
|
22762
|
-
if (platform.includes(key) || standard.includes(key))
|
|
22763
|
-
return standardHome(context2, use);
|
|
23064
|
+
if (platform.includes(key) && context2.platform) return platformHome(context2, use);
|
|
23065
|
+
if (platform.includes(key) || standard.includes(key)) return standardHome(context2, use);
|
|
22764
23066
|
const own = use.user.owner.value[use.action];
|
|
22765
23067
|
return { document: use.user.owner, pointer: `/${use.action}/with`, existing: own?.with };
|
|
22766
23068
|
}
|
|
@@ -22782,20 +23084,22 @@ function missingEdits(context2, use, missing) {
|
|
|
22782
23084
|
entry.keys.push(key);
|
|
22783
23085
|
homes.set(name, entry);
|
|
22784
23086
|
}
|
|
22785
|
-
return [...homes.values()].flatMap(
|
|
22786
|
-
|
|
22787
|
-
pointer: `${home.pointer}/${key}`,
|
|
22788
|
-
set: null
|
|
22789
|
-
})) : [
|
|
22790
|
-
{
|
|
23087
|
+
return [...homes.values()].flatMap(
|
|
23088
|
+
({ home, keys: keys2 }) => isRecord2(home.existing) ? keys2.map((key) => ({
|
|
22791
23089
|
file: home.document.file,
|
|
22792
|
-
pointer: home.pointer
|
|
22793
|
-
set:
|
|
22794
|
-
}
|
|
22795
|
-
|
|
23090
|
+
pointer: `${home.pointer}/${key}`,
|
|
23091
|
+
set: null
|
|
23092
|
+
})) : [
|
|
23093
|
+
{
|
|
23094
|
+
file: home.document.file,
|
|
23095
|
+
pointer: home.pointer,
|
|
23096
|
+
set: Object.fromEntries(keys2.map((key) => [key, null]))
|
|
23097
|
+
}
|
|
23098
|
+
]
|
|
23099
|
+
);
|
|
22796
23100
|
}
|
|
22797
23101
|
|
|
22798
|
-
// packages/definitions/
|
|
23102
|
+
// packages/definitions/src/settings.ts
|
|
22799
23103
|
var ajv = new import__3.Ajv2020({ allErrors: true, strict: false });
|
|
22800
23104
|
var validators2 = /* @__PURE__ */ new WeakMap();
|
|
22801
23105
|
function mergeSettings(context2, action, id, method, layers, user) {
|
|
@@ -22807,11 +23111,12 @@ function mergeSettings(context2, action, id, method, layers, user) {
|
|
|
22807
23111
|
...layers,
|
|
22808
23112
|
fixed
|
|
22809
23113
|
];
|
|
22810
|
-
if (!fixedRespected(context2, layers, fixed.value))
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
23114
|
+
if (!fixedRespected(context2, layers, fixed.value)) return void 0;
|
|
23115
|
+
const settings = all.reduce(
|
|
23116
|
+
(result, layer) => merge(result, layer.value),
|
|
23117
|
+
{}
|
|
23118
|
+
);
|
|
23119
|
+
if (!checkSchema2(context2, { action, id, method, user }, settings, all)) return void 0;
|
|
22815
23120
|
return { settings, origins: originsOf(all) };
|
|
22816
23121
|
}
|
|
22817
23122
|
function organisationLayers(context2, action, id) {
|
|
@@ -22863,7 +23168,13 @@ function fixedRespected(context2, layers, fixed) {
|
|
|
22863
23168
|
title: "Remove this setting",
|
|
22864
23169
|
edits: [{ file: at.document.file, pointer: at.pointer, remove: true }]
|
|
22865
23170
|
};
|
|
22866
|
-
context2.reporter.error(
|
|
23171
|
+
context2.reporter.error(
|
|
23172
|
+
"FIXED_SETTING",
|
|
23173
|
+
`The standard fixes "${path.join(".")}" to ${JSON.stringify(value)}.`,
|
|
23174
|
+
at,
|
|
23175
|
+
"Remove this setting, or change the standard.",
|
|
23176
|
+
remove ? [remove] : []
|
|
23177
|
+
);
|
|
22867
23178
|
respected = false;
|
|
22868
23179
|
}
|
|
22869
23180
|
}
|
|
@@ -22871,11 +23182,9 @@ function fixedRespected(context2, layers, fixed) {
|
|
|
22871
23182
|
}
|
|
22872
23183
|
function changedFixed(fixed, value, path) {
|
|
22873
23184
|
return Object.entries(value).flatMap(([key, given]) => {
|
|
22874
|
-
if (!(key in fixed))
|
|
22875
|
-
return [];
|
|
23185
|
+
if (!(key in fixed)) return [];
|
|
22876
23186
|
const wanted = fixed[key];
|
|
22877
|
-
if (isRecord2(wanted) && isRecord2(given))
|
|
22878
|
-
return changedFixed(wanted, given, [...path, key]);
|
|
23187
|
+
if (isRecord2(wanted) && isRecord2(given)) return changedFixed(wanted, given, [...path, key]);
|
|
22879
23188
|
return sameValue(wanted, given) ? [] : [{ path: [...path, key], value: wanted }];
|
|
22880
23189
|
});
|
|
22881
23190
|
}
|
|
@@ -22886,15 +23195,18 @@ function checkSchema2(context2, use, settings, layers) {
|
|
|
22886
23195
|
validate = ajv.compile(method.settings);
|
|
22887
23196
|
validators2.set(method, validate);
|
|
22888
23197
|
}
|
|
22889
|
-
if (validate(settings))
|
|
22890
|
-
return true;
|
|
23198
|
+
if (validate(settings)) return true;
|
|
22891
23199
|
const failures = validate.errors ?? [];
|
|
22892
23200
|
const missing = failures.filter((failure2) => failure2.keyword === "required" && failure2.instancePath === "").map((failure2) => String(failure2.params.missingProperty));
|
|
22893
|
-
if (missing.length > 0)
|
|
22894
|
-
reportMissing(context2, use, missing);
|
|
23201
|
+
if (missing.length > 0) reportMissing(context2, use, missing);
|
|
22895
23202
|
for (const failure2 of failures.filter((item) => !missing.includes(missingOf(item)))) {
|
|
22896
23203
|
const { message, at } = describe(failure2, layers);
|
|
22897
|
-
context2.reporter.error(
|
|
23204
|
+
context2.reporter.error(
|
|
23205
|
+
"BAD_SETTING",
|
|
23206
|
+
`Settings for "${id}": ${message}.`,
|
|
23207
|
+
at,
|
|
23208
|
+
knownSettings(method)
|
|
23209
|
+
);
|
|
22898
23210
|
}
|
|
22899
23211
|
return false;
|
|
22900
23212
|
}
|
|
@@ -22931,11 +23243,10 @@ function whereSet(layers, path) {
|
|
|
22931
23243
|
return layer?.at && { document: layer.at.document, pointer: `${layer.at.pointer}${path}` };
|
|
22932
23244
|
}
|
|
22933
23245
|
|
|
22934
|
-
// packages/definitions/
|
|
23246
|
+
// packages/definitions/src/steps.ts
|
|
22935
23247
|
function resolveStep(context2, action, named2, facts, tableLayers = [], previous) {
|
|
22936
23248
|
const choice = chooseMethod(context2, action, named2, facts);
|
|
22937
|
-
if (!choice || !canRead(context2, action, choice, facts, previous, named2))
|
|
22938
|
-
return void 0;
|
|
23249
|
+
if (!choice || !canRead(context2, action, choice, facts, previous, named2)) return void 0;
|
|
22939
23250
|
const own = named2.doc?.with && {
|
|
22940
23251
|
value: named2.doc.with,
|
|
22941
23252
|
at: { document: named2.owner, pointer: `/${action}/with` },
|
|
@@ -22943,7 +23254,9 @@ function resolveStep(context2, action, named2, facts, tableLayers = [], previous
|
|
|
22943
23254
|
origin: "definition"
|
|
22944
23255
|
};
|
|
22945
23256
|
const rule = choice.ruleWith && { ...choice.ruleWith, origin: "rule" };
|
|
22946
|
-
const layers = [rule, own, ...tableLayers].filter(
|
|
23257
|
+
const layers = [rule, own, ...tableLayers].filter(
|
|
23258
|
+
(layer) => layer !== void 0
|
|
23259
|
+
);
|
|
22947
23260
|
const user = { owner: named2.owner, at: named2.at ?? "" };
|
|
22948
23261
|
const merged = mergeSettings(context2, action, choice.id, choice.method, layers, user);
|
|
22949
23262
|
const pack = context2.owner.get(choice.id) ?? "";
|
|
@@ -22951,19 +23264,14 @@ function resolveStep(context2, action, named2, facts, tableLayers = [], previous
|
|
|
22951
23264
|
method: choice.id,
|
|
22952
23265
|
pack,
|
|
22953
23266
|
...merged,
|
|
22954
|
-
chosenBy:
|
|
23267
|
+
chosenBy: located(choice.chosenBy),
|
|
22955
23268
|
produces: choice.method.produces,
|
|
22956
23269
|
renames: choice.method.renames === true
|
|
22957
23270
|
};
|
|
22958
23271
|
}
|
|
22959
|
-
function chosenBy({ chosenBy: { at, ...rest } }) {
|
|
22960
|
-
const location = at?.document.locate(at.pointer);
|
|
22961
|
-
return { ...rest, ...location && { file: location.file, line: location.line } };
|
|
22962
|
-
}
|
|
22963
23272
|
function canRead(context2, action, choice, facts, previous, named2) {
|
|
22964
23273
|
const problem2 = readProblem(action, choice, facts, previous, context2.pack.methods);
|
|
22965
|
-
if (!problem2)
|
|
22966
|
-
return true;
|
|
23274
|
+
if (!problem2) return true;
|
|
22967
23275
|
const { code } = problem2;
|
|
22968
23276
|
const fixes = code === "CONNECTOR_NOT_SUPPORTED" || code === "CONNECTIVITY_NOT_SUPPORTED" ? methodFixes(context2, choice, facts, named2, code) : [];
|
|
22969
23277
|
const at = choice.origin ?? { document: named2.owner, pointer: named2.at ?? "" };
|
|
@@ -22976,9 +23284,12 @@ function readProblem(action, choice, facts, previous, methods) {
|
|
|
22976
23284
|
return sourceProblem ?? handoverProblem(choice, previous);
|
|
22977
23285
|
}
|
|
22978
23286
|
function connectorProblem({ id, method }, facts, methods) {
|
|
22979
|
-
if (!method.connectors || method.connectors.includes(facts.connector ?? ""))
|
|
22980
|
-
|
|
22981
|
-
|
|
23287
|
+
if (!method.connectors || method.connectors.includes(facts.connector ?? "")) return void 0;
|
|
23288
|
+
const readers2 = Object.entries(methods).filter(
|
|
23289
|
+
([, candidate]) => candidate.action === "ingest" && candidate.connectors?.includes(facts.connector ?? "")
|
|
23290
|
+
).map(
|
|
23291
|
+
([name, candidate]) => `${name} (${candidate.connectivity?.join(", ") ?? "any connectivity"})`
|
|
23292
|
+
);
|
|
22982
23293
|
const hint = readers2.length > 0 ? `Methods that read ${facts.connector}: ${readers2.join("; ")}.` : `No pack in the standard reads ${facts.connector}.`;
|
|
22983
23294
|
return {
|
|
22984
23295
|
code: "CONNECTOR_NOT_SUPPORTED",
|
|
@@ -22997,30 +23308,32 @@ function connectivityProblem({ id, method }, facts) {
|
|
|
22997
23308
|
};
|
|
22998
23309
|
}
|
|
22999
23310
|
function handoverProblem({ id, method }, previous) {
|
|
23000
|
-
if (!previous || !method.accepts || method.accepts.includes(previous.produces))
|
|
23001
|
-
return void 0;
|
|
23311
|
+
if (!previous || !method.accepts || method.accepts.includes(previous.produces)) return void 0;
|
|
23002
23312
|
return {
|
|
23003
23313
|
code: "HANDOVER",
|
|
23004
23314
|
message: `"${id}" accepts ${method.accepts.join(" or ")}, but "${previous.method}" hands over ${previous.produces}.`
|
|
23005
23315
|
};
|
|
23006
23316
|
}
|
|
23007
23317
|
function stepOf(result) {
|
|
23008
|
-
const { method, pack, settings, origins, chosenBy
|
|
23009
|
-
return { method, pack, settings, origins, chosenBy
|
|
23318
|
+
const { method, pack, settings, origins, chosenBy } = result;
|
|
23319
|
+
return { method, pack, settings, origins, chosenBy };
|
|
23010
23320
|
}
|
|
23011
23321
|
|
|
23012
|
-
// packages/definitions/
|
|
23322
|
+
// packages/definitions/src/tables.ts
|
|
23013
23323
|
function createNamer(context2) {
|
|
23014
23324
|
const layers = context2.standard.value.layers ?? context2.pack.defaults.layers;
|
|
23015
23325
|
return {
|
|
23016
23326
|
layers,
|
|
23017
23327
|
patterns: namePatterns(context2),
|
|
23018
23328
|
layerOf(named2, position, at) {
|
|
23019
|
-
if (named2 === void 0)
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
|
|
23023
|
-
|
|
23329
|
+
if (named2 === void 0) return layers[Math.min(position, layers.length - 1)];
|
|
23330
|
+
if (layers.includes(named2)) return named2;
|
|
23331
|
+
context2.reporter.error(
|
|
23332
|
+
"UNKNOWN_LAYER",
|
|
23333
|
+
`"${named2}" is not one of the standard's layers.`,
|
|
23334
|
+
at,
|
|
23335
|
+
`Layers: ${layers.join(", ")}.`
|
|
23336
|
+
);
|
|
23024
23337
|
return void 0;
|
|
23025
23338
|
}
|
|
23026
23339
|
};
|
|
@@ -23041,51 +23354,58 @@ function checkDuplicateNames(context2, tables, atOf) {
|
|
|
23041
23354
|
const text2 = fullNameText(table.fullName);
|
|
23042
23355
|
const earlier = seen.get(text2);
|
|
23043
23356
|
if (earlier) {
|
|
23044
|
-
context2.reporter.error(
|
|
23357
|
+
context2.reporter.error(
|
|
23358
|
+
"DUPLICATE_NAME",
|
|
23359
|
+
`"${table.name}" and "${earlier.name}" would both be ${text2}.`,
|
|
23360
|
+
atOf(table),
|
|
23361
|
+
"Change a name pattern or a table name."
|
|
23362
|
+
);
|
|
23045
23363
|
}
|
|
23046
23364
|
seen.set(text2, table);
|
|
23047
23365
|
}
|
|
23048
23366
|
}
|
|
23049
23367
|
|
|
23050
|
-
// packages/definitions/
|
|
23368
|
+
// packages/definitions/src/flows.ts
|
|
23051
23369
|
function flowTables(context2, namer) {
|
|
23052
23370
|
const seen = /* @__PURE__ */ new Set();
|
|
23053
|
-
return context2.project.all(kinds.flow).flatMap(
|
|
23054
|
-
|
|
23055
|
-
|
|
23056
|
-
|
|
23057
|
-
|
|
23058
|
-
|
|
23059
|
-
|
|
23060
|
-
|
|
23061
|
-
|
|
23371
|
+
return context2.project.all(kinds.flow).flatMap(
|
|
23372
|
+
(flow) => Object.keys(flow.value.tables).flatMap((name) => {
|
|
23373
|
+
if (seen.has(name)) {
|
|
23374
|
+
reportDuplicate(context2, flow, name);
|
|
23375
|
+
return [];
|
|
23376
|
+
}
|
|
23377
|
+
seen.add(name);
|
|
23378
|
+
const table = flowTable(context2, flow, name, namer);
|
|
23379
|
+
return table ? [table] : [];
|
|
23380
|
+
})
|
|
23381
|
+
);
|
|
23062
23382
|
}
|
|
23063
23383
|
function flowTableNames(context2) {
|
|
23064
23384
|
return new Set(context2.project.all(kinds.flow).flatMap((flow) => Object.keys(flow.value.tables)));
|
|
23065
23385
|
}
|
|
23066
23386
|
function reportDuplicate(context2, flow, name) {
|
|
23067
|
-
context2.reporter.error(
|
|
23387
|
+
context2.reporter.error(
|
|
23388
|
+
"DUPLICATE_TABLE",
|
|
23389
|
+
`Another flow already produces a table named "${name}".`,
|
|
23390
|
+
{ document: flow, pointer: `/tables/${name}` },
|
|
23391
|
+
"Transforms refer to tables by name, so each name has one producer."
|
|
23392
|
+
);
|
|
23068
23393
|
}
|
|
23069
23394
|
function flowTable(context2, flow, name, namer) {
|
|
23070
23395
|
const doc = flow.value.tables[name];
|
|
23071
23396
|
const layer = namer.layerOf(flow.value.layer, 0, { document: flow, pointer: "/layer" });
|
|
23072
23397
|
const connection = context2.project.get(kinds.connection, flow.value.source)?.value;
|
|
23073
|
-
if (!doc || !layer || !connection)
|
|
23074
|
-
return void 0;
|
|
23398
|
+
if (!doc || !layer || !connection) return void 0;
|
|
23075
23399
|
const facts = { connectivity: connection.connectivity, connector: connection.connector, layer };
|
|
23076
23400
|
const steps = flowSteps(context2, flow, name, facts);
|
|
23077
|
-
const contract3 =
|
|
23078
|
-
document: flow,
|
|
23079
|
-
pointer: `/tables/${name}/contract`
|
|
23080
|
-
});
|
|
23401
|
+
const contract3 = flowContract(context2, flow, name, steps?.endsAtFiles !== void 0);
|
|
23081
23402
|
const fullName = renderTableName(context2, namer, {
|
|
23082
23403
|
layer,
|
|
23083
23404
|
table: name,
|
|
23084
23405
|
flow: flow.value.id,
|
|
23085
23406
|
source: flow.value.source
|
|
23086
23407
|
});
|
|
23087
|
-
if (!steps || !contract3 || !fullName)
|
|
23088
|
-
return void 0;
|
|
23408
|
+
if (!steps || !contract3 || !fullName) return void 0;
|
|
23089
23409
|
return {
|
|
23090
23410
|
name,
|
|
23091
23411
|
layer,
|
|
@@ -23093,32 +23413,66 @@ function flowTable(context2, flow, name, namer) {
|
|
|
23093
23413
|
origin: { kind: "Flow", id: flow.value.id, file: flow.file },
|
|
23094
23414
|
contract: contract3,
|
|
23095
23415
|
expectations: expectationsFor(context2, contract3, doc.expectations),
|
|
23416
|
+
...tableSteps(steps, connection, doc.object)
|
|
23417
|
+
};
|
|
23418
|
+
}
|
|
23419
|
+
function tableSteps(steps, connection, object4) {
|
|
23420
|
+
return {
|
|
23096
23421
|
ingest: {
|
|
23097
23422
|
...stepOf(steps.ingest),
|
|
23098
23423
|
connection: connectionOf(connection),
|
|
23099
|
-
object:
|
|
23424
|
+
object: object4,
|
|
23100
23425
|
renamed: steps.ingest.renames
|
|
23101
23426
|
},
|
|
23102
|
-
...steps.store && { store: stepOf(steps.store) }
|
|
23427
|
+
...steps.store && { store: stepOf(steps.store) },
|
|
23428
|
+
...steps.endsAtFiles && { endsAtFiles: steps.endsAtFiles }
|
|
23103
23429
|
};
|
|
23104
23430
|
}
|
|
23431
|
+
function flowContract(context2, flow, name, atFiles) {
|
|
23432
|
+
const doc = flow.value.tables[name];
|
|
23433
|
+
const at = (field) => ({ document: flow, pointer: `/tables/${name}/${field}` });
|
|
23434
|
+
if (atFiles) expectationsNotChecked(context2, doc.expectations ?? [], at("expectations"));
|
|
23435
|
+
return contractFor(context2, name, doc.contract, at("contract"), atFiles);
|
|
23436
|
+
}
|
|
23105
23437
|
function flowSteps(context2, flow, name, facts) {
|
|
23106
|
-
const ingest = resolveStep(
|
|
23107
|
-
|
|
23108
|
-
|
|
23109
|
-
|
|
23110
|
-
|
|
23111
|
-
|
|
23438
|
+
const ingest = resolveStep(
|
|
23439
|
+
context2,
|
|
23440
|
+
"ingest",
|
|
23441
|
+
named(flow, "ingest"),
|
|
23442
|
+
facts,
|
|
23443
|
+
tableLayer(flow, name, "ingest")
|
|
23444
|
+
);
|
|
23445
|
+
if (ingest?.produces === "table") return afterTable(context2, flow, ingest);
|
|
23112
23446
|
const storeFacts = ingest ? { ...facts, input: ingest.produces } : facts;
|
|
23113
|
-
const
|
|
23447
|
+
const none = endsAtFiles(context2, named(flow, "store"), storeFacts);
|
|
23448
|
+
if (none !== void 0) return none && ingest ? { ingest, endsAtFiles: none } : void 0;
|
|
23449
|
+
const store = resolveStep(
|
|
23450
|
+
context2,
|
|
23451
|
+
"store",
|
|
23452
|
+
named(flow, "store"),
|
|
23453
|
+
storeFacts,
|
|
23454
|
+
tableLayer(flow, name, "store"),
|
|
23455
|
+
ingest
|
|
23456
|
+
);
|
|
23114
23457
|
return ingest && store ? { ingest, store } : void 0;
|
|
23115
23458
|
}
|
|
23459
|
+
function afterTable(context2, flow, ingest) {
|
|
23460
|
+
const uses = flow.value.store?.uses;
|
|
23461
|
+
if (uses === void 0 || uses === NO_STORE) return { ingest };
|
|
23462
|
+
reportStoreAfterTable(context2, flow, ingest.method);
|
|
23463
|
+
return void 0;
|
|
23464
|
+
}
|
|
23116
23465
|
function named(flow, action) {
|
|
23117
23466
|
const doc = flow.value[action];
|
|
23118
23467
|
return { owner: flow, doc, at: action === "store" && doc ? "/store" : "/source" };
|
|
23119
23468
|
}
|
|
23120
23469
|
function reportStoreAfterTable(context2, flow, method) {
|
|
23121
|
-
context2.reporter.error(
|
|
23470
|
+
context2.reporter.error(
|
|
23471
|
+
"HANDOVER",
|
|
23472
|
+
`"${method}" writes the table itself, so the flow has no store step.`,
|
|
23473
|
+
{ document: flow, pointer: "/store/uses" },
|
|
23474
|
+
"Remove store.uses, or build another table from it with a transform."
|
|
23475
|
+
);
|
|
23122
23476
|
}
|
|
23123
23477
|
function tableLayer(flow, name, action) {
|
|
23124
23478
|
const value = flow.value.tables[name]?.[action]?.with;
|
|
@@ -23136,7 +23490,7 @@ function connectionOf(connection) {
|
|
|
23136
23490
|
return { id, connector, connectivity, settings: { ...connection.settings } };
|
|
23137
23491
|
}
|
|
23138
23492
|
|
|
23139
|
-
// packages/definitions/
|
|
23493
|
+
// packages/definitions/src/placeholders.ts
|
|
23140
23494
|
var import_yaml7 = __toESM(require_dist(), 1);
|
|
23141
23495
|
var forms2 = {
|
|
23142
23496
|
environment: "${environment.name}",
|
|
@@ -23154,8 +23508,7 @@ function inFile(file, text2) {
|
|
|
23154
23508
|
const lines = new import_yaml7.LineCounter();
|
|
23155
23509
|
const document = (0, import_yaml7.parseDocument)(text2, { lineCounter: lines });
|
|
23156
23510
|
const kind = document.toJS()?.kind;
|
|
23157
|
-
if (kind === "DataContract" || !document.contents)
|
|
23158
|
-
return [];
|
|
23511
|
+
if (kind === "DataContract" || !document.contents) return [];
|
|
23159
23512
|
const found = [];
|
|
23160
23513
|
walk(document.contents, [], (path, value, offset) => {
|
|
23161
23514
|
if (!replaced(kind, path) && value.match(pattern))
|
|
@@ -23164,19 +23517,19 @@ function inFile(file, text2) {
|
|
|
23164
23517
|
return found;
|
|
23165
23518
|
}
|
|
23166
23519
|
function replaced(kind, [first]) {
|
|
23167
|
-
if (kind === "Standard" || kind === "Platform")
|
|
23168
|
-
return first === "naming";
|
|
23520
|
+
if (kind === "Standard" || kind === "Platform") return first === "naming";
|
|
23169
23521
|
return kind === "Transform" && first === "code";
|
|
23170
23522
|
}
|
|
23171
23523
|
function walk(node, path, visit2) {
|
|
23172
23524
|
if ((0, import_yaml7.isMap)(node))
|
|
23173
23525
|
for (const pair of node.items) {
|
|
23174
23526
|
const key = (0, import_yaml7.isScalar)(pair.key) ? String(pair.key.value) : "";
|
|
23175
|
-
if (pair.value)
|
|
23176
|
-
walk(pair.value, [...path, key], visit2);
|
|
23527
|
+
if (pair.value) walk(pair.value, [...path, key], visit2);
|
|
23177
23528
|
}
|
|
23178
23529
|
else if ((0, import_yaml7.isSeq)(node))
|
|
23179
|
-
node.items.forEach(
|
|
23530
|
+
node.items.forEach(
|
|
23531
|
+
(item, index) => item && walk(item, [...path, String(index)], visit2)
|
|
23532
|
+
);
|
|
23180
23533
|
else if ((0, import_yaml7.isScalar)(node) && typeof node.value === "string" && node.range)
|
|
23181
23534
|
visit2(path, node.value, node.range[0]);
|
|
23182
23535
|
}
|
|
@@ -23196,7 +23549,7 @@ function warning2(file, path, value, { line: line2, col }) {
|
|
|
23196
23549
|
};
|
|
23197
23550
|
}
|
|
23198
23551
|
|
|
23199
|
-
// packages/definitions/
|
|
23552
|
+
// packages/definitions/src/platform.ts
|
|
23200
23553
|
var productionNames = /* @__PURE__ */ new Set(["prod", "production"]);
|
|
23201
23554
|
function resolvePlatform(context2) {
|
|
23202
23555
|
const doc = context2.platform?.value ?? { id: "default" };
|
|
@@ -23221,34 +23574,36 @@ function collectionsOf(doc) {
|
|
|
23221
23574
|
};
|
|
23222
23575
|
}
|
|
23223
23576
|
function scheduleOf(doc, mode) {
|
|
23224
|
-
if (!doc.schedule)
|
|
23225
|
-
return void 0;
|
|
23577
|
+
if (!doc.schedule) return void 0;
|
|
23226
23578
|
const { cron, timezone = "UTC", paused: paused2 = mode !== "production" } = doc.schedule;
|
|
23227
23579
|
return { cron, timezone, paused: paused2 };
|
|
23228
23580
|
}
|
|
23229
23581
|
|
|
23230
|
-
// packages/definitions/
|
|
23582
|
+
// packages/definitions/src/code-values.ts
|
|
23231
23583
|
function codeWithValues(context2, document, code) {
|
|
23232
23584
|
const values2 = context2.project.values;
|
|
23233
23585
|
let complete = true;
|
|
23234
23586
|
const replaced2 = code.replace(/\$\{values\.([A-Za-z_][\w.]*)\}/g, (written, name) => {
|
|
23235
23587
|
const value = valueAt(values2, name.split("."));
|
|
23236
|
-
if (value !== void 0 && !isRecord2(value))
|
|
23237
|
-
return String(value);
|
|
23588
|
+
if (value !== void 0 && !isRecord2(value)) return String(value);
|
|
23238
23589
|
complete = false;
|
|
23239
|
-
context2.reporter.error(
|
|
23590
|
+
context2.reporter.error(
|
|
23591
|
+
"UNKNOWN_CODE_VALUE",
|
|
23592
|
+
`"${written}" in the transform's code names no value.`,
|
|
23593
|
+
{ document, pointer: "/code" },
|
|
23594
|
+
`Values: ${isRecord2(values2) ? Object.keys(values2).join(", ") || "none" : "none"}.`
|
|
23595
|
+
);
|
|
23240
23596
|
return written;
|
|
23241
23597
|
});
|
|
23242
23598
|
return complete ? replaced2 : void 0;
|
|
23243
23599
|
}
|
|
23244
23600
|
function valueAt(values2, path) {
|
|
23245
23601
|
let found = values2;
|
|
23246
|
-
for (const key of path)
|
|
23247
|
-
found = isRecord2(found) ? found[key] : void 0;
|
|
23602
|
+
for (const key of path) found = isRecord2(found) ? found[key] : void 0;
|
|
23248
23603
|
return found;
|
|
23249
23604
|
}
|
|
23250
23605
|
|
|
23251
|
-
// packages/definitions/
|
|
23606
|
+
// packages/definitions/src/transforms.ts
|
|
23252
23607
|
function transformTables(context2, namer, flowTables2) {
|
|
23253
23608
|
const resolved = new Map(flowTables2.map((table) => [table.name, table]));
|
|
23254
23609
|
const declared = flowTableNames(context2);
|
|
@@ -23258,19 +23613,18 @@ function transformTables(context2, namer, flowTables2) {
|
|
|
23258
23613
|
while (pending.length > 0) {
|
|
23259
23614
|
const blocked = pending.filter((doc) => doc.value.inputs.some((input) => failed2.has(input)));
|
|
23260
23615
|
blocked.forEach((doc) => failed2.add(doc.value.id));
|
|
23261
|
-
const ready = pending.filter(
|
|
23616
|
+
const ready = pending.filter(
|
|
23617
|
+
(doc) => !blocked.includes(doc) && doc.value.inputs.every((input) => resolved.has(input))
|
|
23618
|
+
);
|
|
23262
23619
|
if (ready.length === 0 && blocked.length === 0) {
|
|
23263
23620
|
reportCycle(context2, pending);
|
|
23264
23621
|
break;
|
|
23265
23622
|
}
|
|
23266
23623
|
for (const doc of ready) {
|
|
23267
23624
|
const table = transformTable(context2, namer, doc, resolved);
|
|
23268
|
-
if (table)
|
|
23269
|
-
|
|
23270
|
-
|
|
23271
|
-
failed2.add(doc.value.id);
|
|
23272
|
-
if (table)
|
|
23273
|
-
result.push(table);
|
|
23625
|
+
if (table) resolved.set(table.name, table);
|
|
23626
|
+
else failed2.add(doc.value.id);
|
|
23627
|
+
if (table) result.push(table);
|
|
23274
23628
|
}
|
|
23275
23629
|
pending = pending.filter((doc) => !ready.includes(doc) && !blocked.includes(doc));
|
|
23276
23630
|
}
|
|
@@ -23283,7 +23637,11 @@ function checkTransforms(context2, flowNames, failed2) {
|
|
|
23283
23637
|
return documents.filter((doc) => {
|
|
23284
23638
|
const { id, inputs } = doc.value;
|
|
23285
23639
|
if (names.has(id)) {
|
|
23286
|
-
context2.reporter.error(
|
|
23640
|
+
context2.reporter.error(
|
|
23641
|
+
"DUPLICATE_TABLE",
|
|
23642
|
+
`Another flow or transform already produces a table named "${id}".`,
|
|
23643
|
+
{ document: doc, pointer: "/id" }
|
|
23644
|
+
);
|
|
23287
23645
|
failed2.add(id);
|
|
23288
23646
|
return false;
|
|
23289
23647
|
}
|
|
@@ -23295,23 +23653,24 @@ function checkTransforms(context2, flowNames, failed2) {
|
|
|
23295
23653
|
pointer: `/inputs/${index}`
|
|
23296
23654
|
});
|
|
23297
23655
|
}
|
|
23298
|
-
if (unknown.length > 0)
|
|
23299
|
-
failed2.add(id);
|
|
23656
|
+
if (unknown.length > 0) failed2.add(id);
|
|
23300
23657
|
return unknown.length === 0;
|
|
23301
23658
|
});
|
|
23302
23659
|
}
|
|
23303
23660
|
function reportCycle(context2, pending) {
|
|
23304
23661
|
const [first] = pending;
|
|
23305
|
-
if (!first)
|
|
23306
|
-
return;
|
|
23662
|
+
if (!first) return;
|
|
23307
23663
|
const ids = pending.map((doc) => doc.value.id).join(", ");
|
|
23308
|
-
context2.reporter.error(
|
|
23664
|
+
context2.reporter.error(
|
|
23665
|
+
"INPUT_CYCLE",
|
|
23666
|
+
`These transforms read each other's results in a loop: ${ids}.`,
|
|
23667
|
+
{ document: first, pointer: "/inputs" }
|
|
23668
|
+
);
|
|
23309
23669
|
}
|
|
23310
23670
|
function transformTable(context2, namer, doc, resolved) {
|
|
23311
23671
|
const value = doc.value;
|
|
23312
23672
|
const layer = namer.layerOf(value.layer, 1, { document: doc, pointer: "/layer" });
|
|
23313
|
-
if (!layer)
|
|
23314
|
-
return void 0;
|
|
23673
|
+
if (!layer) return void 0;
|
|
23315
23674
|
const steps = transformSteps(context2, doc, layer);
|
|
23316
23675
|
const contract3 = contractFor(context2, value.id, value.contract, {
|
|
23317
23676
|
document: doc,
|
|
@@ -23319,9 +23678,11 @@ function transformTable(context2, namer, doc, resolved) {
|
|
|
23319
23678
|
});
|
|
23320
23679
|
const fullName = renderTableName(context2, namer, { layer, table: value.id });
|
|
23321
23680
|
const code = codeWithValues(context2, doc, value.code);
|
|
23322
|
-
if (!steps || !contract3 || !fullName || code === void 0)
|
|
23323
|
-
|
|
23324
|
-
const inputs = Object.fromEntries(
|
|
23681
|
+
if (!steps || !contract3 || !fullName || code === void 0) return void 0;
|
|
23682
|
+
if (!readsTables(context2, doc, resolved)) return void 0;
|
|
23683
|
+
const inputs = Object.fromEntries(
|
|
23684
|
+
value.inputs.map((input) => [input, inputName(resolved, input)])
|
|
23685
|
+
);
|
|
23325
23686
|
return {
|
|
23326
23687
|
name: value.id,
|
|
23327
23688
|
layer,
|
|
@@ -23344,15 +23705,45 @@ function transformSteps(context2, doc, layer) {
|
|
|
23344
23705
|
produces: "table"
|
|
23345
23706
|
});
|
|
23346
23707
|
const storeFacts = { layer, input: transform2?.produces ?? "query" };
|
|
23347
|
-
const store =
|
|
23708
|
+
const store = doc.value.store?.uses === NO_STORE ? refuseNoStore(context2, doc) : resolveStep(
|
|
23709
|
+
context2,
|
|
23710
|
+
"store",
|
|
23711
|
+
{ owner: doc, doc: doc.value.store },
|
|
23712
|
+
storeFacts,
|
|
23713
|
+
[],
|
|
23714
|
+
transform2
|
|
23715
|
+
);
|
|
23348
23716
|
return transform2 && store ? { transform: transform2, store } : void 0;
|
|
23349
23717
|
}
|
|
23718
|
+
function readsTables(context2, doc, resolved) {
|
|
23719
|
+
let tables = true;
|
|
23720
|
+
doc.value.inputs.forEach((input, index) => {
|
|
23721
|
+
if (!resolved.get(input)?.endsAtFiles) return;
|
|
23722
|
+
tables = false;
|
|
23723
|
+
context2.reporter.error(
|
|
23724
|
+
"HANDOVER",
|
|
23725
|
+
`"${input}" ends at the landed files, so there is no table to read.`,
|
|
23726
|
+
{ document: doc, pointer: `/inputs/${index}` },
|
|
23727
|
+
"Give its flow a store step."
|
|
23728
|
+
);
|
|
23729
|
+
});
|
|
23730
|
+
return tables;
|
|
23731
|
+
}
|
|
23732
|
+
function refuseNoStore(context2, doc) {
|
|
23733
|
+
context2.reporter.error(
|
|
23734
|
+
"HANDOVER",
|
|
23735
|
+
`A transform's query needs a store step, so its store cannot be "${NO_STORE}".`,
|
|
23736
|
+
{ document: doc, pointer: "/store/uses" },
|
|
23737
|
+
"Name a store method, or leave store out to let the standard choose."
|
|
23738
|
+
);
|
|
23739
|
+
return void 0;
|
|
23740
|
+
}
|
|
23350
23741
|
function inputName(resolved, input) {
|
|
23351
23742
|
const table = resolved.get(input);
|
|
23352
23743
|
return table ? fullNameText(table.fullName) : input;
|
|
23353
23744
|
}
|
|
23354
23745
|
|
|
23355
|
-
// packages/definitions/
|
|
23746
|
+
// packages/definitions/src/resolve.ts
|
|
23356
23747
|
var allKinds = Object.values(kinds);
|
|
23357
23748
|
function resolveDefinitions(files2, options2) {
|
|
23358
23749
|
const loaded = resolveProject(files2, {
|
|
@@ -23360,11 +23751,14 @@ function resolveDefinitions(files2, options2) {
|
|
|
23360
23751
|
environment: options2.environment,
|
|
23361
23752
|
envvars: options2.envvars ?? {}
|
|
23362
23753
|
});
|
|
23363
|
-
return withPlaceholders(
|
|
23754
|
+
return withPlaceholders(
|
|
23755
|
+
files2,
|
|
23756
|
+
loaded.ok ? resolveLoaded(loaded.project, options2.packs, loaded.diagnostics) : { ok: false, diagnostics: loaded.diagnostics },
|
|
23757
|
+
documentFiles(files2, loaded.project?.documents)
|
|
23758
|
+
);
|
|
23364
23759
|
}
|
|
23365
23760
|
function documentFiles(files2, documents) {
|
|
23366
|
-
if (documents)
|
|
23367
|
-
return documents.map((document) => document.file);
|
|
23761
|
+
if (documents) return documents.map((document) => document.file);
|
|
23368
23762
|
return files2.list().filter((path) => /\.ya?ml$/.test(path) && !path.startsWith("build/"));
|
|
23369
23763
|
}
|
|
23370
23764
|
function withPlaceholders(files2, result, documents) {
|
|
@@ -23377,24 +23771,27 @@ function loadDefinitions(folder, options2) {
|
|
|
23377
23771
|
environment: options2.environment,
|
|
23378
23772
|
envvars: options2.envvars
|
|
23379
23773
|
});
|
|
23380
|
-
return withPlaceholders(
|
|
23774
|
+
return withPlaceholders(
|
|
23775
|
+
nodeFiles(folder),
|
|
23776
|
+
loaded.ok ? resolveLoaded(loaded.project, options2.packs, loaded.diagnostics) : { ok: false, diagnostics: loaded.diagnostics },
|
|
23777
|
+
documentFiles(nodeFiles(folder), loaded.project?.documents)
|
|
23778
|
+
);
|
|
23381
23779
|
}
|
|
23382
23780
|
function resolveLoaded(project, packs2, warnings) {
|
|
23383
23781
|
const reporter = createReporter(warnings);
|
|
23384
23782
|
const context2 = createContext(project, packs2, reporter);
|
|
23385
|
-
if (!context2)
|
|
23386
|
-
return { ok: false, diagnostics: reporter.diagnostics };
|
|
23783
|
+
if (!context2) return { ok: false, diagnostics: reporter.diagnostics };
|
|
23387
23784
|
checkSettingsKeys(context2);
|
|
23388
23785
|
checkGrants(context2);
|
|
23389
23786
|
const namer = createNamer(context2);
|
|
23390
23787
|
const flows = flowTables(context2, namer);
|
|
23391
23788
|
const tables = [...flows, ...transformTables(context2, namer, flows)];
|
|
23392
23789
|
checkDuplicateNames(context2, tables, (table) => originOf(context2, table));
|
|
23790
|
+
recordOutputs(context2, tables);
|
|
23393
23791
|
runMethodChecks(context2, tables);
|
|
23394
23792
|
checkContractFields(context2, new Set(tables.map((table) => table.contract.id)));
|
|
23395
23793
|
const model = reporter.failed() ? void 0 : buildModel(context2, namer, tables);
|
|
23396
|
-
if (model)
|
|
23397
|
-
runPackCheck(context2, model);
|
|
23794
|
+
if (model) runPackCheck(context2, model);
|
|
23398
23795
|
return model && !reporter.failed() ? { ok: true, model, diagnostics: reporter.diagnostics } : { ok: false, diagnostics: reporter.diagnostics };
|
|
23399
23796
|
}
|
|
23400
23797
|
function buildModel(context2, namer, tables) {
|
|
@@ -23402,8 +23799,7 @@ function buildModel(context2, namer, tables) {
|
|
|
23402
23799
|
const base = { project: project.id, environment: context2.environment };
|
|
23403
23800
|
const pipeline = renderName(context2, namer.patterns.pipeline, base);
|
|
23404
23801
|
const job = renderName(context2, namer.patterns.job, base);
|
|
23405
|
-
if (!pipeline || !job)
|
|
23406
|
-
return void 0;
|
|
23802
|
+
if (!pipeline || !job) return void 0;
|
|
23407
23803
|
return {
|
|
23408
23804
|
project: {
|
|
23409
23805
|
id: project.id,
|
|
@@ -23422,12 +23818,24 @@ function runPackCheck(context2, model) {
|
|
|
23422
23818
|
for (const message of context2.packs.flatMap((pack) => pack.check?.(model) ?? []))
|
|
23423
23819
|
context2.reporter.error("PACK_CHECK", `${message}.`, at);
|
|
23424
23820
|
}
|
|
23821
|
+
function recordOutputs(context2, tables) {
|
|
23822
|
+
for (const table of tables) {
|
|
23823
|
+
for (const step of [table.ingest, table.transform, table.store]) {
|
|
23824
|
+
const output = step && context2.pack.methods[step.method]?.output?.(table);
|
|
23825
|
+
if (step && output) step.output = output;
|
|
23826
|
+
}
|
|
23827
|
+
}
|
|
23828
|
+
}
|
|
23425
23829
|
function runMethodChecks(context2, tables) {
|
|
23426
23830
|
for (const table of tables) {
|
|
23427
23831
|
for (const step of [table.ingest, table.transform, table.store]) {
|
|
23428
23832
|
const method = step && context2.pack.methods[step.method];
|
|
23429
23833
|
for (const message of method?.check?.(table) ?? []) {
|
|
23430
|
-
context2.reporter.error(
|
|
23834
|
+
context2.reporter.error(
|
|
23835
|
+
"METHOD_CHECK",
|
|
23836
|
+
`"${step?.method}" for table "${table.name}": ${message}.`,
|
|
23837
|
+
originOf(context2, table)
|
|
23838
|
+
);
|
|
23431
23839
|
}
|
|
23432
23840
|
}
|
|
23433
23841
|
}
|
|
@@ -23441,33 +23849,29 @@ function originOf(context2, table) {
|
|
|
23441
23849
|
return transform2 && { document: transform2, pointer: "/id" };
|
|
23442
23850
|
}
|
|
23443
23851
|
|
|
23444
|
-
// packages/generate/
|
|
23852
|
+
// packages/generate/src/digest.ts
|
|
23445
23853
|
import { createHash } from "node:crypto";
|
|
23446
23854
|
function digestOf(content) {
|
|
23447
23855
|
return `sha256:${createHash("sha256").update(content, "utf8").digest("hex")}`;
|
|
23448
23856
|
}
|
|
23449
23857
|
|
|
23450
|
-
// packages/generate/
|
|
23858
|
+
// packages/generate/src/problems.ts
|
|
23451
23859
|
function problem(code, message, path) {
|
|
23452
23860
|
return path === void 0 ? { code, message } : { code, path, message };
|
|
23453
23861
|
}
|
|
23454
23862
|
|
|
23455
|
-
// packages/generate/
|
|
23863
|
+
// packages/generate/src/paths.ts
|
|
23456
23864
|
var manifestFile = ".generated.json";
|
|
23457
23865
|
var lockFile = ".generated.lock";
|
|
23458
23866
|
function pathProblem(path) {
|
|
23459
|
-
if (path === "" || path.startsWith("/"))
|
|
23460
|
-
|
|
23461
|
-
if (/[\\:\0]/.test(path))
|
|
23462
|
-
return 'contains "\\", ":" or a NUL character';
|
|
23867
|
+
if (path === "" || path.startsWith("/")) return "is not a relative path";
|
|
23868
|
+
if (/[\\:\0]/.test(path)) return 'contains "\\", ":" or a NUL character';
|
|
23463
23869
|
const segments = path.split("/");
|
|
23464
23870
|
if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
|
|
23465
23871
|
return 'has an empty, "." or ".." part';
|
|
23466
23872
|
}
|
|
23467
|
-
if (path === manifestFile || path === lockFile)
|
|
23468
|
-
|
|
23469
|
-
if (segments.includes(".git"))
|
|
23470
|
-
return "is inside a .git folder";
|
|
23873
|
+
if (path === manifestFile || path === lockFile) return "is reserved for the manifest and lock";
|
|
23874
|
+
if (segments.includes(".git")) return "is inside a .git folder";
|
|
23471
23875
|
return void 0;
|
|
23472
23876
|
}
|
|
23473
23877
|
function checkWantedPaths(paths) {
|
|
@@ -23489,13 +23893,11 @@ function checkWantedPaths(paths) {
|
|
|
23489
23893
|
return problems;
|
|
23490
23894
|
}
|
|
23491
23895
|
|
|
23492
|
-
// packages/generate/
|
|
23896
|
+
// packages/generate/src/manifest.ts
|
|
23493
23897
|
function readManifest2(folder) {
|
|
23494
23898
|
const entry = folder.read(manifestFile);
|
|
23495
|
-
if (entry.kind === "absent")
|
|
23496
|
-
|
|
23497
|
-
if (entry.kind === "other")
|
|
23498
|
-
return damaged("is not a file");
|
|
23899
|
+
if (entry.kind === "absent") return { files: /* @__PURE__ */ new Map() };
|
|
23900
|
+
if (entry.kind === "other") return damaged("is not a file");
|
|
23499
23901
|
let data;
|
|
23500
23902
|
try {
|
|
23501
23903
|
data = JSON.parse(entry.content);
|
|
@@ -23510,10 +23912,8 @@ function checkManifest(data) {
|
|
|
23510
23912
|
}
|
|
23511
23913
|
for (const [path, digest] of Object.entries(data.files)) {
|
|
23512
23914
|
const reason = pathProblem(path);
|
|
23513
|
-
if (reason)
|
|
23514
|
-
|
|
23515
|
-
if (typeof digest !== "string")
|
|
23516
|
-
return damaged(`has no digest for "${path}"`);
|
|
23915
|
+
if (reason) return damaged(`lists "${path}", which ${reason}`);
|
|
23916
|
+
if (typeof digest !== "string") return damaged(`has no digest for "${path}"`);
|
|
23517
23917
|
}
|
|
23518
23918
|
return { files: new Map(Object.entries(data.files)) };
|
|
23519
23919
|
}
|
|
@@ -23531,7 +23931,7 @@ function isRecord3(value) {
|
|
|
23531
23931
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23532
23932
|
}
|
|
23533
23933
|
|
|
23534
|
-
// packages/generate/
|
|
23934
|
+
// packages/generate/src/diff.ts
|
|
23535
23935
|
var maxComparisons = 4e6;
|
|
23536
23936
|
var context = 2;
|
|
23537
23937
|
function lineDiff(before, after) {
|
|
@@ -23545,8 +23945,7 @@ function lineDiff(before, after) {
|
|
|
23545
23945
|
}
|
|
23546
23946
|
function splitLines(text2) {
|
|
23547
23947
|
const lines = text2.split("\n");
|
|
23548
|
-
if (lines.at(-1) === "")
|
|
23549
|
-
lines.pop();
|
|
23948
|
+
if (lines.at(-1) === "") lines.pop();
|
|
23550
23949
|
return lines;
|
|
23551
23950
|
}
|
|
23552
23951
|
function compare(oldLines, newLines) {
|
|
@@ -23558,22 +23957,17 @@ function compare(oldLines, newLines) {
|
|
|
23558
23957
|
const mark = nextMark(oldLines, newLines, table, i, j);
|
|
23559
23958
|
const text2 = (mark === "+" ? newLines[j] : oldLines[i]) ?? "";
|
|
23560
23959
|
lines.push({ mark, text: text2, oldAt: i, newAt: j });
|
|
23561
|
-
if (mark !== "+")
|
|
23562
|
-
|
|
23563
|
-
if (mark !== "-")
|
|
23564
|
-
j += 1;
|
|
23960
|
+
if (mark !== "+") i += 1;
|
|
23961
|
+
if (mark !== "-") j += 1;
|
|
23565
23962
|
}
|
|
23566
23963
|
return lines;
|
|
23567
23964
|
}
|
|
23568
23965
|
function nextMark(oldLines, newLines, table, i, j) {
|
|
23569
23966
|
const oldLeft = i < oldLines.length;
|
|
23570
23967
|
const newLeft = j < newLines.length;
|
|
23571
|
-
if (oldLeft && newLeft && oldLines[i] === newLines[j])
|
|
23572
|
-
|
|
23573
|
-
if (!
|
|
23574
|
-
return "-";
|
|
23575
|
-
if (!oldLeft)
|
|
23576
|
-
return "+";
|
|
23968
|
+
if (oldLeft && newLeft && oldLines[i] === newLines[j]) return " ";
|
|
23969
|
+
if (!newLeft) return "-";
|
|
23970
|
+
if (!oldLeft) return "+";
|
|
23577
23971
|
const width = newLines.length + 1;
|
|
23578
23972
|
const withoutOld = table[(i + 1) * width + j] ?? 0;
|
|
23579
23973
|
const withoutNew = table[i * width + j + 1] ?? 0;
|
|
@@ -23592,15 +23986,12 @@ function commonLengths(oldLines, newLines) {
|
|
|
23592
23986
|
function hunks(lines) {
|
|
23593
23987
|
const ranges = [];
|
|
23594
23988
|
lines.forEach((line2, index) => {
|
|
23595
|
-
if (line2.mark === " ")
|
|
23596
|
-
return;
|
|
23989
|
+
if (line2.mark === " ") return;
|
|
23597
23990
|
const first = Math.max(0, index - context);
|
|
23598
23991
|
const last = Math.min(lines.length - 1, index + context);
|
|
23599
23992
|
const previous = ranges.at(-1);
|
|
23600
|
-
if (previous && first <= previous[1] + 1)
|
|
23601
|
-
|
|
23602
|
-
else
|
|
23603
|
-
ranges.push([first, last]);
|
|
23993
|
+
if (previous && first <= previous[1] + 1) previous[1] = last;
|
|
23994
|
+
else ranges.push([first, last]);
|
|
23604
23995
|
});
|
|
23605
23996
|
return ranges;
|
|
23606
23997
|
}
|
|
@@ -23613,7 +24004,7 @@ function formatHunk(lines) {
|
|
|
23613
24004
|
return [header, ...lines.map((line2) => `${line2.mark}${line2.text}`)].join("\n");
|
|
23614
24005
|
}
|
|
23615
24006
|
|
|
23616
|
-
// packages/generate/
|
|
24007
|
+
// packages/generate/src/plan.ts
|
|
23617
24008
|
function planGeneration(folder, wanted) {
|
|
23618
24009
|
const files2 = new Map(Object.entries(wanted));
|
|
23619
24010
|
const problems = checkWantedPaths([...files2.keys()]);
|
|
@@ -23637,25 +24028,19 @@ function seenOf(entry) {
|
|
|
23637
24028
|
function changeFor(path, wanted, generated, entry) {
|
|
23638
24029
|
const seen = seenOf(entry);
|
|
23639
24030
|
const result = (change, reason) => reason ? { path, change, reason, seen } : { path, change, seen };
|
|
23640
|
-
if (entry.kind === "other")
|
|
23641
|
-
return result("conflict", "NOT_A_FILE");
|
|
24031
|
+
if (entry.kind === "other") return result("conflict", "NOT_A_FILE");
|
|
23642
24032
|
if (wanted === void 0) {
|
|
23643
|
-
if (entry.kind === "absent")
|
|
23644
|
-
return result("forget");
|
|
24033
|
+
if (entry.kind === "absent") return result("forget");
|
|
23645
24034
|
return seen === generated ? result("delete") : result("conflict", "EDITED");
|
|
23646
24035
|
}
|
|
23647
|
-
if (entry.kind === "absent")
|
|
23648
|
-
|
|
23649
|
-
if (
|
|
23650
|
-
|
|
23651
|
-
if (generated === void 0)
|
|
23652
|
-
return result("conflict", "NOT_GENERATED");
|
|
23653
|
-
if (seen !== generated)
|
|
23654
|
-
return result("conflict", "EDITED");
|
|
24036
|
+
if (entry.kind === "absent") return result("create");
|
|
24037
|
+
if (entry.content === wanted) return result(generated === void 0 ? "adopt" : "unchanged");
|
|
24038
|
+
if (generated === void 0) return result("conflict", "NOT_GENERATED");
|
|
24039
|
+
if (seen !== generated) return result("conflict", "EDITED");
|
|
23655
24040
|
return { ...result("update"), diff: lineDiff(entry.content, wanted) };
|
|
23656
24041
|
}
|
|
23657
24042
|
|
|
23658
|
-
// packages/generate/
|
|
24043
|
+
// packages/generate/src/apply.ts
|
|
23659
24044
|
function applyPlan(folder, plan) {
|
|
23660
24045
|
if (!plan.clean) {
|
|
23661
24046
|
const message = "The plan has conflicts or problems; resolve them and plan again.";
|
|
@@ -23678,7 +24063,9 @@ function failed(problems) {
|
|
|
23678
24063
|
function changedSincePlan(folder, plan) {
|
|
23679
24064
|
const expected2 = [...plan.changes.map(({ path, seen }) => ({ path, seen }))];
|
|
23680
24065
|
expected2.push({ path: manifestFile, seen: plan.manifestSeen });
|
|
23681
|
-
return expected2.filter(({ path, seen }) => seenOf(folder.read(path)) !== seen).map(
|
|
24066
|
+
return expected2.filter(({ path, seen }) => seenOf(folder.read(path)) !== seen).map(
|
|
24067
|
+
({ path }) => problem("CHANGED_SINCE_PLAN", `"${path}" changed after planning; plan again.`, path)
|
|
24068
|
+
);
|
|
23682
24069
|
}
|
|
23683
24070
|
function writeAll(folder, plan) {
|
|
23684
24071
|
const undo = [];
|
|
@@ -23693,8 +24080,7 @@ function writeAll(folder, plan) {
|
|
|
23693
24080
|
current = path;
|
|
23694
24081
|
if (change === "create" || change === "update")
|
|
23695
24082
|
step(path, () => folder.write(path, plan.wanted.get(path) ?? ""));
|
|
23696
|
-
if (change === "delete")
|
|
23697
|
-
step(path, () => folder.remove(path));
|
|
24083
|
+
if (change === "delete") step(path, () => folder.remove(path));
|
|
23698
24084
|
}
|
|
23699
24085
|
current = manifestFile;
|
|
23700
24086
|
step(manifestFile, () => folder.write(manifestFile, manifestText(plan.wanted)));
|
|
@@ -23720,24 +24106,20 @@ function messageOf(cause) {
|
|
|
23720
24106
|
return cause instanceof Error ? cause.message : String(cause);
|
|
23721
24107
|
}
|
|
23722
24108
|
function restore(folder, path, before) {
|
|
23723
|
-
if (before.kind === "file")
|
|
23724
|
-
|
|
23725
|
-
else
|
|
23726
|
-
folder.remove(path);
|
|
24109
|
+
if (before.kind === "file") folder.write(path, before.content);
|
|
24110
|
+
else folder.remove(path);
|
|
23727
24111
|
}
|
|
23728
24112
|
|
|
23729
|
-
// packages/generate/
|
|
24113
|
+
// packages/generate/src/format.ts
|
|
23730
24114
|
var indent = " ".repeat(10);
|
|
23731
24115
|
var order = ["create", "update", "delete", "adopt", "forget", "unchanged", "conflict"];
|
|
23732
24116
|
function formatPlan(plan, options2 = {}) {
|
|
23733
24117
|
const lines = [];
|
|
23734
24118
|
for (const change of plan.changes) {
|
|
23735
|
-
if (change.change === "unchanged")
|
|
23736
|
-
continue;
|
|
24119
|
+
if (change.change === "unchanged") continue;
|
|
23737
24120
|
lines.push(`${change.change.padEnd(10)}${change.path}`);
|
|
23738
24121
|
const detail = change.change === "conflict" ? explain(change, plan) : diffOf(change, options2);
|
|
23739
|
-
if (detail)
|
|
23740
|
-
lines.push(...detail.split("\n").map((line2) => indent + line2));
|
|
24122
|
+
if (detail) lines.push(...detail.split("\n").map((line2) => indent + line2));
|
|
23741
24123
|
}
|
|
23742
24124
|
for (const { code, path, message } of plan.problems) {
|
|
23743
24125
|
lines.push(`${"problem".padEnd(10)}${path ?? ""}${path ? " " : ""}${code}`, indent + message);
|
|
@@ -23766,16 +24148,24 @@ function summary(plan) {
|
|
|
23766
24148
|
return `${head} ${verdict(plan)}`;
|
|
23767
24149
|
}
|
|
23768
24150
|
function verdict(plan) {
|
|
23769
|
-
if (plan.problems.length > 0)
|
|
23770
|
-
|
|
23771
|
-
if (!plan.clean)
|
|
23772
|
-
return "Resolve the conflicts before applying.";
|
|
24151
|
+
if (plan.problems.length > 0) return "Fix the problems before applying.";
|
|
24152
|
+
if (!plan.clean) return "Resolve the conflicts before applying.";
|
|
23773
24153
|
return plan.upToDate ? "Up to date." : "Ready to apply.";
|
|
23774
24154
|
}
|
|
23775
24155
|
|
|
23776
|
-
// packages/generate/
|
|
24156
|
+
// packages/generate/src/node-folder.ts
|
|
23777
24157
|
import { randomUUID } from "node:crypto";
|
|
23778
|
-
import {
|
|
24158
|
+
import {
|
|
24159
|
+
lstatSync,
|
|
24160
|
+
mkdirSync,
|
|
24161
|
+
readFileSync as readFileSync3,
|
|
24162
|
+
realpathSync as realpathSync2,
|
|
24163
|
+
renameSync,
|
|
24164
|
+
rmdirSync,
|
|
24165
|
+
rmSync,
|
|
24166
|
+
unlinkSync,
|
|
24167
|
+
writeFileSync
|
|
24168
|
+
} from "node:fs";
|
|
23779
24169
|
import { dirname as dirname2, isAbsolute as isAbsolute2, join as join3, relative as relative2, sep as sep2 } from "node:path";
|
|
23780
24170
|
function nodeFolder(root) {
|
|
23781
24171
|
const full = (path) => join3(root, path);
|
|
@@ -23800,12 +24190,10 @@ function nodeFolder(root) {
|
|
|
23800
24190
|
}
|
|
23801
24191
|
function readEntry(root, target) {
|
|
23802
24192
|
try {
|
|
23803
|
-
if (!lstatSync(target).isFile() || !isInside(root, dirname2(target)))
|
|
23804
|
-
return { kind: "other" };
|
|
24193
|
+
if (!lstatSync(target).isFile() || !isInside(root, dirname2(target))) return { kind: "other" };
|
|
23805
24194
|
return { kind: "file", content: readFileSync3(target, "utf8") };
|
|
23806
24195
|
} catch (error2) {
|
|
23807
|
-
if (codeOf(error2) === "ENOENT" || codeOf(error2) === "ENOTDIR")
|
|
23808
|
-
return { kind: "absent" };
|
|
24196
|
+
if (codeOf(error2) === "ENOENT" || codeOf(error2) === "ENOTDIR") return { kind: "absent" };
|
|
23809
24197
|
throw error2;
|
|
23810
24198
|
}
|
|
23811
24199
|
}
|
|
@@ -23818,8 +24206,7 @@ function makeFolders(root, folder) {
|
|
|
23818
24206
|
if (!lstatSync(current).isDirectory())
|
|
23819
24207
|
throw new Error("its folder leads outside the output folder");
|
|
23820
24208
|
} catch (error2) {
|
|
23821
|
-
if (codeOf(error2) !== "ENOENT")
|
|
23822
|
-
throw error2;
|
|
24209
|
+
if (codeOf(error2) !== "ENOENT") throw error2;
|
|
23823
24210
|
mkdirSync(current);
|
|
23824
24211
|
}
|
|
23825
24212
|
}
|
|
@@ -23835,8 +24222,7 @@ function takeLock(path) {
|
|
|
23835
24222
|
`, { flag: "wx" });
|
|
23836
24223
|
return true;
|
|
23837
24224
|
} catch (error2) {
|
|
23838
|
-
if (codeOf(error2) === "EEXIST")
|
|
23839
|
-
return false;
|
|
24225
|
+
if (codeOf(error2) === "EEXIST") return false;
|
|
23840
24226
|
throw error2;
|
|
23841
24227
|
}
|
|
23842
24228
|
}
|
|
@@ -23855,7 +24241,7 @@ function codeOf(error2) {
|
|
|
23855
24241
|
return error2 instanceof Error && "code" in error2 ? String(error2.code) : void 0;
|
|
23856
24242
|
}
|
|
23857
24243
|
|
|
23858
|
-
// packages/pack-adf/dist/resource-names.js
|
|
24244
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/resource-names.js
|
|
23859
24245
|
var descriptions = {
|
|
23860
24246
|
key_vault_linked_service: "Shared Key Vault linked service. Default: ls_<project>_keyvault.",
|
|
23861
24247
|
landing_linked_service: "Shared managed-identity landing linked service. Default: ls_<project>_landing.",
|
|
@@ -23902,7 +24288,7 @@ function resourceName(tables, role, fallback) {
|
|
|
23902
24288
|
return name;
|
|
23903
24289
|
}
|
|
23904
24290
|
|
|
23905
|
-
// packages/pack-adf/dist/sql-types.js
|
|
24291
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/sql-types.js
|
|
23906
24292
|
var sqlTypes = {
|
|
23907
24293
|
sqlserver: {
|
|
23908
24294
|
title: "SQL Server",
|
|
@@ -23941,7 +24327,7 @@ var sqlTypes = {
|
|
|
23941
24327
|
}
|
|
23942
24328
|
};
|
|
23943
24329
|
|
|
23944
|
-
// packages/pack-adf/dist/sql-auth.js
|
|
24330
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/sql-auth.js
|
|
23945
24331
|
var modeFields = {
|
|
23946
24332
|
SQL: ["user", "password"],
|
|
23947
24333
|
Windows: ["user", "password"],
|
|
@@ -24033,7 +24419,141 @@ function credentialFields(settings, fields) {
|
|
|
24033
24419
|
return problems;
|
|
24034
24420
|
}
|
|
24035
24421
|
|
|
24036
|
-
// packages/pack-adf/dist/
|
|
24422
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/landing.js
|
|
24423
|
+
function parseLanding(text2) {
|
|
24424
|
+
const match = /^abfss:\/\/([^@/]+)@([^/]+)(\/.*)?$/.exec(text2);
|
|
24425
|
+
return {
|
|
24426
|
+
url: `https://${match?.[2] ?? ""}`,
|
|
24427
|
+
fileSystem: match?.[1] ?? "",
|
|
24428
|
+
path: (match?.[3] ?? "").replace(/^\/+|\/+$/g, "")
|
|
24429
|
+
};
|
|
24430
|
+
}
|
|
24431
|
+
|
|
24432
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/layout.js
|
|
24433
|
+
var windowParts = ["yyyy", "MM", "dd", "HH"];
|
|
24434
|
+
var windowTokens = {
|
|
24435
|
+
Hour: ["yyyy", "MM", "dd", "HH"],
|
|
24436
|
+
Month: ["yyyy", "MM"]
|
|
24437
|
+
};
|
|
24438
|
+
var tokens = ["object", "connection", ...windowParts, "run"];
|
|
24439
|
+
var tokenPattern = /\{([^{}]*)\}/g;
|
|
24440
|
+
function layoutOf(table) {
|
|
24441
|
+
const { layout, path } = table.ingest.settings;
|
|
24442
|
+
if (typeof path === "string")
|
|
24443
|
+
return "path";
|
|
24444
|
+
if (layout === "snapshot" || layout === "increments")
|
|
24445
|
+
return layout;
|
|
24446
|
+
return table.endsAtFiles && !windowed(table) ? "snapshot" : "increments";
|
|
24447
|
+
}
|
|
24448
|
+
function windowed(table) {
|
|
24449
|
+
const { mode, source_options: options2 } = table.ingest.settings;
|
|
24450
|
+
const filter = options2?.date_filter_column;
|
|
24451
|
+
return mode === "incremental" || typeof filter === "string" && filter !== "";
|
|
24452
|
+
}
|
|
24453
|
+
function namesFiles(tables) {
|
|
24454
|
+
return tables.some((table) => layoutOf(table) !== "increments");
|
|
24455
|
+
}
|
|
24456
|
+
function landedFile(table, extension) {
|
|
24457
|
+
const ingest = table.ingest;
|
|
24458
|
+
const { path } = parseLanding(String(ingest.settings.landing));
|
|
24459
|
+
const relative10 = layoutOf(table) === "increments" ? `${ingest.object}/${incrementName(extension)}` : relativePath(table, extension, (part) => expressionOf(table, part));
|
|
24460
|
+
const slash = relative10.lastIndexOf("/");
|
|
24461
|
+
const folder = [path, relative10.slice(0, Math.max(slash, 0))].filter(Boolean).join("/");
|
|
24462
|
+
return { folder, file: relative10.slice(slash + 1) };
|
|
24463
|
+
}
|
|
24464
|
+
function landedLocation(table, extension) {
|
|
24465
|
+
const landing = String(table.ingest.settings.landing).replace(/\/+$/, "");
|
|
24466
|
+
const relative10 = relativePath(table, extension, (part) => part === "object" || part === "connection" ? expressionOf(table, part) : "*");
|
|
24467
|
+
return `${landing}/${relative10.replace(/\*+/g, "*")}`;
|
|
24468
|
+
}
|
|
24469
|
+
function replacesFile(table) {
|
|
24470
|
+
const layout = layoutOf(table);
|
|
24471
|
+
if (layout !== "path")
|
|
24472
|
+
return layout === "snapshot";
|
|
24473
|
+
const used3 = [...String(table.ingest.settings.path).matchAll(tokenPattern)].map((match) => match[1]);
|
|
24474
|
+
if (used3.includes("run"))
|
|
24475
|
+
return false;
|
|
24476
|
+
const frequency = table.ingest.settings.every?.frequency;
|
|
24477
|
+
const needed = windowTokens[frequency ?? ""];
|
|
24478
|
+
return !needed || !needed.every((token2) => used3.includes(token2));
|
|
24479
|
+
}
|
|
24480
|
+
function pathProblems(path, extension) {
|
|
24481
|
+
const quoted = `the path pattern "${path}"`;
|
|
24482
|
+
if (path.endsWith("/") || path.split("/").at(-1) === "")
|
|
24483
|
+
return [`${quoted} must end in a file name`];
|
|
24484
|
+
const unknown = [...path.matchAll(tokenPattern)].map((match) => match[1] ?? "").filter((name) => !tokens.includes(name)).map((name) => `${quoted} uses an unknown token {${name}}; tokens: ${tokens.join(", ")}`);
|
|
24485
|
+
const object4 = path.includes("{object}") ? [] : [`${quoted} must include {object}`];
|
|
24486
|
+
const suffix = path.endsWith(`.${extension}`) ? [] : [`${quoted} must end in .${extension}`];
|
|
24487
|
+
return [...unknown, ...object4, ...suffix];
|
|
24488
|
+
}
|
|
24489
|
+
function relativePath(table, extension, replace) {
|
|
24490
|
+
const object4 = table.ingest.object;
|
|
24491
|
+
const layout = layoutOf(table);
|
|
24492
|
+
if (layout === "snapshot")
|
|
24493
|
+
return `${object4}/${object4}.${extension}`;
|
|
24494
|
+
if (layout === "increments")
|
|
24495
|
+
return `${object4}/*.${extension}`;
|
|
24496
|
+
return String(table.ingest.settings.path).replace(tokenPattern, (_match, name) => replace(name));
|
|
24497
|
+
}
|
|
24498
|
+
function expressionOf(table, token2) {
|
|
24499
|
+
if (token2 === "object")
|
|
24500
|
+
return table.ingest.object;
|
|
24501
|
+
if (token2 === "connection")
|
|
24502
|
+
return table.ingest.connection.id;
|
|
24503
|
+
if (token2 === "run")
|
|
24504
|
+
return "@{pipeline().RunId}";
|
|
24505
|
+
return `@{formatDateTime(pipeline().parameters.windowStart, '${token2}')}`;
|
|
24506
|
+
}
|
|
24507
|
+
function incrementName(extension) {
|
|
24508
|
+
return `@{concat(formatDateTime(pipeline().parameters.windowStart, 'yyyyMMddHHmmss'), '_', pipeline().RunId, '.${extension}')}`;
|
|
24509
|
+
}
|
|
24510
|
+
|
|
24511
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/landing-output.js
|
|
24512
|
+
function extensionOf(table) {
|
|
24513
|
+
return table.ingest.connection.connector === "microsoft-365" ? "json" : "parquet";
|
|
24514
|
+
}
|
|
24515
|
+
function tableOutput(table) {
|
|
24516
|
+
const extension = extensionOf(table);
|
|
24517
|
+
return {
|
|
24518
|
+
location: landedLocation(table, extension),
|
|
24519
|
+
format: extension,
|
|
24520
|
+
loads: replacesFile(table) ? "replace" : "add"
|
|
24521
|
+
};
|
|
24522
|
+
}
|
|
24523
|
+
function filesOutput(table) {
|
|
24524
|
+
const { format, landing } = table.ingest.settings;
|
|
24525
|
+
if (format !== "csv" && format !== "parquet" && format !== "json")
|
|
24526
|
+
return void 0;
|
|
24527
|
+
const root = String(landing).replace(/\/+$/, "");
|
|
24528
|
+
return { location: `${root}/${table.ingest.object}/**`, format, loads: "add" };
|
|
24529
|
+
}
|
|
24530
|
+
function layoutProblems(table) {
|
|
24531
|
+
const { layout, path } = table.ingest.settings;
|
|
24532
|
+
if (layout !== void 0 && path !== void 0)
|
|
24533
|
+
return ["set layout or path, not both"];
|
|
24534
|
+
if (layoutOf(table) === "path") {
|
|
24535
|
+
const problems = pathProblems(String(path), extensionOf(table));
|
|
24536
|
+
if (problems.length > 0)
|
|
24537
|
+
return problems;
|
|
24538
|
+
}
|
|
24539
|
+
if (windowed(table) && replacesFile(table) && !table.store)
|
|
24540
|
+
return [
|
|
24541
|
+
"each run holds only the window's changes and replaces the last file, so changes would be lost; keep a file per run (layout: increments, or a path with {run}), or add a store step"
|
|
24542
|
+
];
|
|
24543
|
+
return [];
|
|
24544
|
+
}
|
|
24545
|
+
function samePathProblems(tables) {
|
|
24546
|
+
const problems = [];
|
|
24547
|
+
tables.forEach((table, index) => {
|
|
24548
|
+
const location = tableOutput(table).location;
|
|
24549
|
+
const other = tables.slice(0, index).find((earlier) => (layoutOf(table) === "path" || layoutOf(earlier) === "path") && tableOutput(earlier).location === location);
|
|
24550
|
+
if (other)
|
|
24551
|
+
problems.push(`tables "${other.name}" and "${table.name}" land at the same files ${location}`);
|
|
24552
|
+
});
|
|
24553
|
+
return problems;
|
|
24554
|
+
}
|
|
24555
|
+
|
|
24556
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/method.js
|
|
24037
24557
|
var abfss = "^abfss://[^@/]+@[^/]+\\.dfs\\.core\\.windows\\.net(/.*)?$";
|
|
24038
24558
|
var windowSettings = {
|
|
24039
24559
|
resource_names: resourceNamesSchema,
|
|
@@ -24095,6 +24615,25 @@ var placement = {
|
|
|
24095
24615
|
platform: ["landing", "integration_runtime", "runtime_kind", "key_vault", "paused"],
|
|
24096
24616
|
standard: ["every", "start", "retries", "resource_names"]
|
|
24097
24617
|
};
|
|
24618
|
+
var tablePlacement = {
|
|
24619
|
+
platform: placement.platform,
|
|
24620
|
+
standard: [...placement.standard, "layout", "path"]
|
|
24621
|
+
};
|
|
24622
|
+
var layoutSettings = {
|
|
24623
|
+
layout: {
|
|
24624
|
+
enum: ["snapshot", "increments"],
|
|
24625
|
+
enumDescriptions: [
|
|
24626
|
+
"One file per table, <object>/<object>.parquet, replaced by each run. The default when the flow ends at the landed files.",
|
|
24627
|
+
"A new file per run under <object>/. The default when a store reads the files."
|
|
24628
|
+
],
|
|
24629
|
+
description: "How each table's files are laid out in the landing folder."
|
|
24630
|
+
},
|
|
24631
|
+
path: {
|
|
24632
|
+
type: "string",
|
|
24633
|
+
description: "A path under the landing folder for each table's file, with tokens {object}, {connection}, the window start's {yyyy}, {MM}, {dd}, {HH}, and {run}. With a date or run token each run adds a file; without, each run replaces it. Replaces layout.",
|
|
24634
|
+
examples: ["{object}/{yyyy}/{MM}/{dd}/{object}_{run}.parquet"]
|
|
24635
|
+
}
|
|
24636
|
+
};
|
|
24098
24637
|
function credentialProblems(table, keys2) {
|
|
24099
24638
|
const settings = table.ingest?.connection.settings ?? {};
|
|
24100
24639
|
const password = settings.password;
|
|
@@ -24111,7 +24650,7 @@ var adfCopy = {
|
|
|
24111
24650
|
connectivity: ["private", "workspace", "public"],
|
|
24112
24651
|
produces: "files",
|
|
24113
24652
|
renames: true,
|
|
24114
|
-
placement,
|
|
24653
|
+
placement: tablePlacement,
|
|
24115
24654
|
defaults: {
|
|
24116
24655
|
format: "parquet",
|
|
24117
24656
|
runtime_kind: "self-hosted",
|
|
@@ -24126,6 +24665,7 @@ var adfCopy = {
|
|
|
24126
24665
|
required: ["landing", "integration_runtime", "runtime_kind", "key_vault", "start"],
|
|
24127
24666
|
properties: {
|
|
24128
24667
|
...windowSettings,
|
|
24668
|
+
...layoutSettings,
|
|
24129
24669
|
runtime_kind: {
|
|
24130
24670
|
enum: ["azure", "self-hosted"],
|
|
24131
24671
|
enumDescriptions: [
|
|
@@ -24162,13 +24702,14 @@ var adfCopy = {
|
|
|
24162
24702
|
}
|
|
24163
24703
|
}
|
|
24164
24704
|
},
|
|
24165
|
-
check: checkCopy
|
|
24705
|
+
check: checkCopy,
|
|
24706
|
+
output: tableOutput
|
|
24166
24707
|
};
|
|
24167
24708
|
function checkCopy(table) {
|
|
24168
24709
|
const ingest = table.ingest;
|
|
24169
24710
|
if (!ingest)
|
|
24170
24711
|
return [];
|
|
24171
|
-
const problems = sqlConnectionProblems(table);
|
|
24712
|
+
const problems = [...sqlConnectionProblems(table), ...layoutProblems(table)];
|
|
24172
24713
|
if (ingest.object.split(".").length !== 3 || !ingest.object.split(".").every(nonEmpty))
|
|
24173
24714
|
problems.push(`a ${ingest.connection.connector} object is written database.schema.table, not "${ingest.object}"`);
|
|
24174
24715
|
if (ingest.settings.mode === "incremental" && typeof ingest.settings.watermark_column !== "string") {
|
|
@@ -24177,7 +24718,7 @@ function checkCopy(table) {
|
|
|
24177
24718
|
return problems;
|
|
24178
24719
|
}
|
|
24179
24720
|
|
|
24180
|
-
// packages/pack-adf/dist/table-source.js
|
|
24721
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-source.js
|
|
24181
24722
|
function textField(native, description) {
|
|
24182
24723
|
return { native, description };
|
|
24183
24724
|
}
|
|
@@ -24197,7 +24738,7 @@ var portField = {
|
|
|
24197
24738
|
optional: true
|
|
24198
24739
|
};
|
|
24199
24740
|
|
|
24200
|
-
// packages/pack-adf/dist/web-auth.js
|
|
24741
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/web-auth.js
|
|
24201
24742
|
var webFields = {
|
|
24202
24743
|
auth_headers: {
|
|
24203
24744
|
native: "authHeaders",
|
|
@@ -24259,7 +24800,7 @@ function validCredential(field, value) {
|
|
|
24259
24800
|
return field === "password" || field === "client_secret" ? isSecret(value) : nonEmpty(value);
|
|
24260
24801
|
}
|
|
24261
24802
|
|
|
24262
|
-
// packages/pack-adf/dist/connection-check.js
|
|
24803
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/connection-check.js
|
|
24263
24804
|
function connectionProblems(source, settings) {
|
|
24264
24805
|
const problems = source.id === "rest" || source.id === "http" ? webAuthProblems(source.id, settings) : [];
|
|
24265
24806
|
for (const key of Object.keys(settings))
|
|
@@ -24297,7 +24838,7 @@ function validSecrets(value) {
|
|
|
24297
24838
|
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.entries(value).every(([key, secret]) => /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/.test(key) && isSecret(secret));
|
|
24298
24839
|
}
|
|
24299
24840
|
|
|
24300
|
-
// packages/pack-adf/dist/table-cloud.js
|
|
24841
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-cloud.js
|
|
24301
24842
|
var mongoFields = {
|
|
24302
24843
|
connection_string: secretField("connectionString", "Key Vault secret containing the complete MongoDB connection string."),
|
|
24303
24844
|
database: textField("database", "Database to read.")
|
|
@@ -24459,7 +25000,7 @@ var tableCloud = [
|
|
|
24459
25000
|
}
|
|
24460
25001
|
];
|
|
24461
25002
|
|
|
24462
|
-
// packages/pack-adf/dist/table-exports.js
|
|
25003
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-exports.js
|
|
24463
25004
|
var tableExports = [
|
|
24464
25005
|
{
|
|
24465
25006
|
id: "snowflake",
|
|
@@ -24522,7 +25063,7 @@ var tableExports = [
|
|
|
24522
25063
|
}
|
|
24523
25064
|
];
|
|
24524
25065
|
|
|
24525
|
-
// packages/pack-adf/dist/web-options.js
|
|
25066
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/web-options.js
|
|
24526
25067
|
var webRequestSettings = {
|
|
24527
25068
|
request_method: {
|
|
24528
25069
|
enum: ["GET", "POST"],
|
|
@@ -24551,7 +25092,7 @@ function httpOptionProblems(table) {
|
|
|
24551
25092
|
return webRequestProblems(options2);
|
|
24552
25093
|
}
|
|
24553
25094
|
|
|
24554
|
-
// packages/pack-adf/dist/table-options.js
|
|
25095
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-options.js
|
|
24555
25096
|
var text = { type: "string", minLength: 1 };
|
|
24556
25097
|
var sourceOptionsSchema = {
|
|
24557
25098
|
type: "object",
|
|
@@ -24715,7 +25256,7 @@ function mappingProblems(table, options2) {
|
|
|
24715
25256
|
return problems;
|
|
24716
25257
|
}
|
|
24717
25258
|
|
|
24718
|
-
// packages/pack-adf/dist/table-apps.js
|
|
25259
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-apps.js
|
|
24719
25260
|
var client = {
|
|
24720
25261
|
client_id: textField("clientId", "OAuth application ID."),
|
|
24721
25262
|
client_secret: secretField("clientSecret", "Key Vault secret holding the OAuth application secret.")
|
|
@@ -24831,7 +25372,7 @@ var tableApps = [
|
|
|
24831
25372
|
}
|
|
24832
25373
|
];
|
|
24833
25374
|
|
|
24834
|
-
// packages/pack-adf/dist/table-crm.js
|
|
25375
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-crm.js
|
|
24835
25376
|
var dynamicsFields = {
|
|
24836
25377
|
url: textField("serviceUri", "Dynamics organisation service URL."),
|
|
24837
25378
|
client_id: textField("servicePrincipalId", "Entra application ID."),
|
|
@@ -24964,7 +25505,7 @@ var tableCrm = [
|
|
|
24964
25505
|
}
|
|
24965
25506
|
];
|
|
24966
25507
|
|
|
24967
|
-
// packages/pack-adf/dist/table-sap.js
|
|
25508
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-sap.js
|
|
24968
25509
|
var rfcFields = {
|
|
24969
25510
|
server: databaseFields.server,
|
|
24970
25511
|
system_number: textField("systemNumber", "Two-digit SAP system number."),
|
|
@@ -25056,7 +25597,7 @@ var tableSap = [
|
|
|
25056
25597
|
}
|
|
25057
25598
|
];
|
|
25058
25599
|
|
|
25059
|
-
// packages/pack-adf/dist/table-protocols.js
|
|
25600
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-protocols.js
|
|
25060
25601
|
var tableProtocols = [
|
|
25061
25602
|
{
|
|
25062
25603
|
id: "rest",
|
|
@@ -25105,7 +25646,7 @@ var tableProtocols = [
|
|
|
25105
25646
|
}
|
|
25106
25647
|
];
|
|
25107
25648
|
|
|
25108
|
-
// packages/pack-adf/dist/table-databases.js
|
|
25649
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-databases.js
|
|
25109
25650
|
var oracleFields = { server: databaseFields.server, user: databaseFields.user, password: databaseFields.password };
|
|
25110
25651
|
var connectionString = secretField("connectionString", "Key Vault secret holding the complete native connection string.");
|
|
25111
25652
|
var tableDatabases = [
|
|
@@ -25288,7 +25829,7 @@ var tableDatabases = [
|
|
|
25288
25829
|
}
|
|
25289
25830
|
];
|
|
25290
25831
|
|
|
25291
|
-
// packages/pack-adf/dist/table-analytics.js
|
|
25832
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-analytics.js
|
|
25292
25833
|
var thriftFields = {
|
|
25293
25834
|
host: textField("host", "Source host name as reached by the runtime."),
|
|
25294
25835
|
port: { ...portField, optional: false },
|
|
@@ -25442,7 +25983,7 @@ var tableAnalytics = [
|
|
|
25442
25983
|
}
|
|
25443
25984
|
];
|
|
25444
25985
|
|
|
25445
|
-
// packages/pack-adf/dist/table-method.js
|
|
25986
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-method.js
|
|
25446
25987
|
var tableSources = [
|
|
25447
25988
|
...tableDatabases,
|
|
25448
25989
|
...tableAnalytics,
|
|
@@ -25460,7 +26001,7 @@ var adfTable = {
|
|
|
25460
26001
|
connectivity: ["private", "workspace", "public"],
|
|
25461
26002
|
produces: "files",
|
|
25462
26003
|
renames: true,
|
|
25463
|
-
placement,
|
|
26004
|
+
placement: tablePlacement,
|
|
25464
26005
|
defaults: {
|
|
25465
26006
|
runtime_kind: "self-hosted",
|
|
25466
26007
|
format: "parquet",
|
|
@@ -25474,6 +26015,7 @@ var adfTable = {
|
|
|
25474
26015
|
required: ["landing", "integration_runtime", "key_vault", "start"],
|
|
25475
26016
|
properties: {
|
|
25476
26017
|
...windowSettings,
|
|
26018
|
+
...layoutSettings,
|
|
25477
26019
|
runtime_kind: {
|
|
25478
26020
|
enum: ["azure", "self-hosted"],
|
|
25479
26021
|
enumDescriptions: [
|
|
@@ -25500,7 +26042,8 @@ var adfTable = {
|
|
|
25500
26042
|
}
|
|
25501
26043
|
}
|
|
25502
26044
|
},
|
|
25503
|
-
check: checkTable
|
|
26045
|
+
check: checkTable,
|
|
26046
|
+
output: tableOutput
|
|
25504
26047
|
};
|
|
25505
26048
|
var tableConnectors = tableSources.map((source) => ({
|
|
25506
26049
|
id: source.id,
|
|
@@ -25530,7 +26073,10 @@ var tableConnectors = tableSources.map((source) => ({
|
|
|
25530
26073
|
function checkTable(table) {
|
|
25531
26074
|
const ingest = table.ingest;
|
|
25532
26075
|
const source = tableSources.find((item) => item.id === ingest.connection.connector);
|
|
25533
|
-
const problems =
|
|
26076
|
+
const problems = [
|
|
26077
|
+
...connectionProblems(source, ingest.connection.settings),
|
|
26078
|
+
...layoutProblems(table)
|
|
26079
|
+
];
|
|
25534
26080
|
const parts = source.object.length > 1 ? ingest.object.split(".") : [ingest.object];
|
|
25535
26081
|
if (invalidParts(parts, source))
|
|
25536
26082
|
problems.push(`the source object must be ${source.object.join(".") || "a non-empty result name"}`);
|
|
@@ -25556,7 +26102,7 @@ function sourceCategory(source) {
|
|
|
25556
26102
|
return "Databases and analytics";
|
|
25557
26103
|
}
|
|
25558
26104
|
|
|
25559
|
-
// packages/pack-adf/dist/resource-files.js
|
|
26105
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/resource-files.js
|
|
25560
26106
|
function addResource(files2, folder, resource) {
|
|
25561
26107
|
const path = `${folder}/${String(resource.name)}.json`;
|
|
25562
26108
|
assertUnused(files2, path);
|
|
@@ -25578,17 +26124,7 @@ function assertUnused(files2, path) {
|
|
|
25578
26124
|
throw new Error(`ADF resource path ${path} is generated more than once (names are case-insensitive); choose distinct resource_names or connection and object names`);
|
|
25579
26125
|
}
|
|
25580
26126
|
|
|
25581
|
-
// packages/pack-adf/dist/
|
|
25582
|
-
function parseLanding(text2) {
|
|
25583
|
-
const match = /^abfss:\/\/([^@/]+)@([^/]+)(\/.*)?$/.exec(text2);
|
|
25584
|
-
return {
|
|
25585
|
-
url: `https://${match?.[2] ?? ""}`,
|
|
25586
|
-
fileSystem: match?.[1] ?? "",
|
|
25587
|
-
path: (match?.[3] ?? "").replace(/^\/+|\/+$/g, "")
|
|
25588
|
-
};
|
|
25589
|
-
}
|
|
25590
|
-
|
|
25591
|
-
// packages/pack-adf/dist/query.js
|
|
26127
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/query.js
|
|
25592
26128
|
var bracket = (name) => `[${name.replaceAll("]", "]]")}]`;
|
|
25593
26129
|
function query(table) {
|
|
25594
26130
|
const ingest = table.ingest;
|
|
@@ -25603,7 +26139,7 @@ function query(table) {
|
|
|
25603
26139
|
return { value: `${select} WHERE ${window2}`, type: "Expression" };
|
|
25604
26140
|
}
|
|
25605
26141
|
|
|
25606
|
-
// packages/pack-adf/dist/resources.js
|
|
26142
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/resources.js
|
|
25607
26143
|
var reference2 = (name, type) => ({ referenceName: name, type });
|
|
25608
26144
|
function keyVaultService(shared, baseUrl) {
|
|
25609
26145
|
return {
|
|
@@ -25667,7 +26203,6 @@ function landingDataset(shared, landing) {
|
|
|
25667
26203
|
}
|
|
25668
26204
|
};
|
|
25669
26205
|
}
|
|
25670
|
-
var fileName = "@{concat(formatDateTime(pipeline().parameters.windowStart, 'yyyyMMddHHmmss'), '_', pipeline().RunId, '.parquet')}";
|
|
25671
26206
|
function copyPipeline(model, group, shared, name) {
|
|
25672
26207
|
const activities = group.tables.map((table) => copyActivity(table, group, shared));
|
|
25673
26208
|
const parameters = { windowStart: { type: "string" }, windowEnd: { type: "string" } };
|
|
@@ -25681,9 +26216,6 @@ function copyPipeline(model, group, shared, name) {
|
|
|
25681
26216
|
};
|
|
25682
26217
|
}
|
|
25683
26218
|
function copyActivity(table, group, shared) {
|
|
25684
|
-
const ingest = table.ingest;
|
|
25685
|
-
const { path } = parseLanding(String(ingest.settings.landing));
|
|
25686
|
-
const folder = [path, ingest.object].filter((part) => part !== "").join("/");
|
|
25687
26219
|
return {
|
|
25688
26220
|
name: resourceName(table, "copy_activity", `copy_${table.name}`),
|
|
25689
26221
|
type: "Copy",
|
|
@@ -25691,7 +26223,7 @@ function copyActivity(table, group, shared) {
|
|
|
25691
26223
|
outputs: [
|
|
25692
26224
|
{
|
|
25693
26225
|
...reference2(shared.landingDataset, "DatasetReference"),
|
|
25694
|
-
parameters:
|
|
26226
|
+
parameters: landedFile(table, "parquet")
|
|
25695
26227
|
}
|
|
25696
26228
|
],
|
|
25697
26229
|
typeProperties: {
|
|
@@ -25735,7 +26267,7 @@ function paused(model, settings) {
|
|
|
25735
26267
|
return model.platform.schedule?.paused ?? model.platform.mode !== "production";
|
|
25736
26268
|
}
|
|
25737
26269
|
|
|
25738
|
-
// packages/pack-adf/dist/table-copy-options.js
|
|
26270
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-copy-options.js
|
|
25739
26271
|
function nativeSource(table, source) {
|
|
25740
26272
|
const settings = table.ingest.settings;
|
|
25741
26273
|
const options2 = settings.source_options ?? {};
|
|
@@ -25799,7 +26331,7 @@ function tableTranslator(table, source) {
|
|
|
25799
26331
|
};
|
|
25800
26332
|
}
|
|
25801
26333
|
|
|
25802
|
-
// packages/pack-adf/dist/export-resources.js
|
|
26334
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/export-resources.js
|
|
25803
26335
|
function exportResources(tables, source, shared, name) {
|
|
25804
26336
|
const table = tables[0];
|
|
25805
26337
|
const ingest = table.ingest;
|
|
@@ -25848,24 +26380,26 @@ function officeResources(tables, shared, name) {
|
|
|
25848
26380
|
}
|
|
25849
26381
|
function officeDataset(tables, name, fileSystem) {
|
|
25850
26382
|
const service = resourceName(tables, "json_landing_linked_service", `ls_${name}_json`);
|
|
26383
|
+
const named2 = namesFiles(tables);
|
|
25851
26384
|
return {
|
|
25852
26385
|
name: resourceName(tables, "json_landing_dataset", `ds_${name}_json`),
|
|
25853
26386
|
properties: {
|
|
25854
26387
|
type: "Json",
|
|
25855
26388
|
linkedServiceName: reference2(service, "LinkedServiceReference"),
|
|
25856
|
-
parameters: { folder: { type: "string" } },
|
|
26389
|
+
parameters: named2 ? { folder: { type: "string" }, file: { type: "string" } } : { folder: { type: "string" } },
|
|
25857
26390
|
typeProperties: {
|
|
25858
26391
|
location: {
|
|
25859
26392
|
type: "AzureBlobFSLocation",
|
|
25860
26393
|
fileSystem,
|
|
25861
|
-
folderPath: { value: "@dataset().folder", type: "Expression" }
|
|
26394
|
+
folderPath: { value: "@dataset().folder", type: "Expression" },
|
|
26395
|
+
...named2 && { fileName: { value: "@dataset().file", type: "Expression" } }
|
|
25862
26396
|
}
|
|
25863
26397
|
}
|
|
25864
26398
|
}
|
|
25865
26399
|
};
|
|
25866
26400
|
}
|
|
25867
26401
|
|
|
25868
|
-
// packages/pack-adf/dist/table-resources.js
|
|
26402
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/table-resources.js
|
|
25869
26403
|
function tableResources(model, shared) {
|
|
25870
26404
|
const files2 = {};
|
|
25871
26405
|
for (const tables of tableGroups(model)) {
|
|
@@ -25885,7 +26419,7 @@ function tableResources(model, shared) {
|
|
|
25885
26419
|
name: pipeline,
|
|
25886
26420
|
properties: {
|
|
25887
26421
|
parameters: { windowStart: { type: "string" }, windowEnd: { type: "string" } },
|
|
25888
|
-
activities: tables.map((table) => tableActivity(table, source, shared, dataset(table), name))
|
|
26422
|
+
activities: tables.map((table) => tableActivity(table, source, shared, dataset(table), name, namesFiles(tables)))
|
|
25889
26423
|
}
|
|
25890
26424
|
});
|
|
25891
26425
|
add("trigger", windowTrigger(model, { tables }, pipeline, resourceName(tables, "trigger", `tr_${name}`)));
|
|
@@ -25937,13 +26471,13 @@ function tableDataset(table, source, service, name) {
|
|
|
25937
26471
|
}
|
|
25938
26472
|
};
|
|
25939
26473
|
}
|
|
25940
|
-
function tableActivity(table, source, shared, dataset, name) {
|
|
26474
|
+
function tableActivity(table, source, shared, dataset, name, named2) {
|
|
25941
26475
|
const options2 = table.ingest.settings.source_options ?? {};
|
|
25942
26476
|
return {
|
|
25943
26477
|
name: resourceName(table, "copy_activity", `copy_${table.name}`),
|
|
25944
26478
|
type: "Copy",
|
|
25945
26479
|
inputs: [reference2(dataset, "DatasetReference")],
|
|
25946
|
-
outputs: [
|
|
26480
|
+
outputs: [tableOutput2(table, source, shared, name, named2)],
|
|
25947
26481
|
typeProperties: {
|
|
25948
26482
|
source: nativeSource(table, source),
|
|
25949
26483
|
sink: tableSink(source),
|
|
@@ -25952,20 +26486,16 @@ function tableActivity(table, source, shared, dataset, name) {
|
|
|
25952
26486
|
}
|
|
25953
26487
|
};
|
|
25954
26488
|
}
|
|
25955
|
-
function
|
|
25956
|
-
|
|
25957
|
-
|
|
25958
|
-
|
|
25959
|
-
|
|
25960
|
-
|
|
26489
|
+
function tableOutput2(table, source, shared, name, named2) {
|
|
26490
|
+
if (source.id !== "microsoft-365")
|
|
26491
|
+
return {
|
|
26492
|
+
...reference2(shared.landingDataset, "DatasetReference"),
|
|
26493
|
+
parameters: landedFile(table, "parquet")
|
|
26494
|
+
};
|
|
26495
|
+
const { folder, file } = landedFile(table, "json");
|
|
26496
|
+
return {
|
|
25961
26497
|
...reference2(resourceName(table, "json_landing_dataset", `ds_${name}_json`), "DatasetReference"),
|
|
25962
|
-
parameters: { folder }
|
|
25963
|
-
} : {
|
|
25964
|
-
...reference2(shared.landingDataset, "DatasetReference"),
|
|
25965
|
-
parameters: {
|
|
25966
|
-
folder,
|
|
25967
|
-
file: "@{concat(formatDateTime(pipeline().parameters.windowStart, 'yyyyMMddHHmmss'), '_', pipeline().RunId, '.parquet')}"
|
|
25968
|
-
}
|
|
26498
|
+
parameters: named2 ? { folder, file } : { folder }
|
|
25969
26499
|
};
|
|
25970
26500
|
}
|
|
25971
26501
|
function tableSink(source) {
|
|
@@ -25983,7 +26513,7 @@ function tableSink(source) {
|
|
|
25983
26513
|
};
|
|
25984
26514
|
}
|
|
25985
26515
|
|
|
25986
|
-
// packages/pack-adf/dist/contract.js
|
|
26516
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/contract.js
|
|
25987
26517
|
var used = (does) => ({ use: "used", does });
|
|
25988
26518
|
var stored = { use: "elsewhere", reason: "Handled where the table is stored." };
|
|
25989
26519
|
var object2 = "schema.*";
|
|
@@ -26032,7 +26562,7 @@ var contract = {
|
|
|
26032
26562
|
].map((key) => [`${column3}.${key}`, stored]))
|
|
26033
26563
|
};
|
|
26034
26564
|
|
|
26035
|
-
// packages/pack-adf/dist/file-sources.js
|
|
26565
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/file-sources.js
|
|
26036
26566
|
var keys = {
|
|
26037
26567
|
access_key: textField("accessKeyId", "Object storage access key ID."),
|
|
26038
26568
|
secret_key: secretField("secretAccessKey", "Key Vault secret holding the storage secret access key.")
|
|
@@ -26184,7 +26714,7 @@ var fileStores = [
|
|
|
26184
26714
|
}
|
|
26185
26715
|
];
|
|
26186
26716
|
|
|
26187
|
-
// packages/pack-adf/dist/native-file-resources.js
|
|
26717
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/native-file-resources.js
|
|
26188
26718
|
var nativeFileConnectors = fileStores.map((source) => ({
|
|
26189
26719
|
id: source.id,
|
|
26190
26720
|
title: source.title,
|
|
@@ -26244,7 +26774,7 @@ function nativeFileParameters(connector, object4) {
|
|
|
26244
26774
|
return { root, folder: parts.join("/") };
|
|
26245
26775
|
}
|
|
26246
26776
|
|
|
26247
|
-
// packages/pack-adf/dist/connectors.js
|
|
26777
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/connectors.js
|
|
26248
26778
|
var sqlSettings = [
|
|
26249
26779
|
{ name: "server", description: "The host name the integration runtime reaches." },
|
|
26250
26780
|
{
|
|
@@ -26319,7 +26849,7 @@ var connectors = [
|
|
|
26319
26849
|
}))
|
|
26320
26850
|
];
|
|
26321
26851
|
|
|
26322
|
-
// packages/pack-adf/dist/files-resources.js
|
|
26852
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/files-resources.js
|
|
26323
26853
|
var folderParameter = { value: "@dataset().folder", type: "Expression" };
|
|
26324
26854
|
function fileServerService(group, shared, settings) {
|
|
26325
26855
|
if (group.connection.connector !== "files")
|
|
@@ -26443,7 +26973,7 @@ function binarySource(table) {
|
|
|
26443
26973
|
};
|
|
26444
26974
|
}
|
|
26445
26975
|
|
|
26446
|
-
// packages/pack-adf/dist/build.js
|
|
26976
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/build.js
|
|
26447
26977
|
function build(model) {
|
|
26448
26978
|
const copies = copyGroups(model);
|
|
26449
26979
|
const shares = filesGroups(model);
|
|
@@ -26546,7 +27076,7 @@ function sharedNames(project, tables) {
|
|
|
26546
27076
|
};
|
|
26547
27077
|
}
|
|
26548
27078
|
|
|
26549
|
-
// packages/pack-adf/dist/vault.js
|
|
27079
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/vault.js
|
|
26550
27080
|
function needsVault(value) {
|
|
26551
27081
|
if (!value || typeof value !== "object")
|
|
26552
27082
|
return false;
|
|
@@ -26555,7 +27085,7 @@ function needsVault(value) {
|
|
|
26555
27085
|
return Object.values(value).some(needsVault);
|
|
26556
27086
|
}
|
|
26557
27087
|
|
|
26558
|
-
// packages/pack-adf/dist/files-method.js
|
|
27088
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/files-method.js
|
|
26559
27089
|
var adfFiles = {
|
|
26560
27090
|
action: "ingest",
|
|
26561
27091
|
description: "Azure Data Factory copies files from a share through a self-hosted integration runtime into a landing folder as they are.",
|
|
@@ -26625,7 +27155,8 @@ var adfFiles = {
|
|
|
26625
27155
|
}
|
|
26626
27156
|
}
|
|
26627
27157
|
},
|
|
26628
|
-
check: checkFiles
|
|
27158
|
+
check: checkFiles,
|
|
27159
|
+
output: filesOutput
|
|
26629
27160
|
};
|
|
26630
27161
|
function checkFiles(table) {
|
|
26631
27162
|
const connection = table.ingest.connection;
|
|
@@ -26656,7 +27187,7 @@ function fileOptionsProblems(table) {
|
|
|
26656
27187
|
return problems;
|
|
26657
27188
|
}
|
|
26658
27189
|
|
|
26659
|
-
// packages/pack-adf/dist/prerequisites.js
|
|
27190
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/prerequisites.js
|
|
26660
27191
|
function prerequisites(model) {
|
|
26661
27192
|
const tables = model.tables.filter((table) => table.ingest?.pack === "adf");
|
|
26662
27193
|
const infrastructure2 = /* @__PURE__ */ new Set();
|
|
@@ -26681,7 +27212,7 @@ function prerequisites(model) {
|
|
|
26681
27212
|
];
|
|
26682
27213
|
}
|
|
26683
27214
|
|
|
26684
|
-
// packages/pack-adf/dist/request.js
|
|
27215
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/request.js
|
|
26685
27216
|
function request(model) {
|
|
26686
27217
|
const triggers = Object.entries(build(model)).filter(([path]) => path.startsWith("trigger/")).map(([, text2]) => JSON.parse(text2));
|
|
26687
27218
|
if (triggers.length === 0)
|
|
@@ -26696,7 +27227,7 @@ function line({ name, properties: properties2 }) {
|
|
|
26696
27227
|
return `Data Factory trigger \`${name}\`: every ${every}, ${state}.`;
|
|
26697
27228
|
}
|
|
26698
27229
|
|
|
26699
|
-
// packages/pack-adf/dist/pack.js
|
|
27230
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/pack.js
|
|
26700
27231
|
var adf = {
|
|
26701
27232
|
id: "adf",
|
|
26702
27233
|
version: 1,
|
|
@@ -26754,7 +27285,8 @@ function checkShared(model) {
|
|
|
26754
27285
|
problems.push(`the adf-files tables of ${group.connection.id} share one linked service, pipeline and trigger, so ${shareKeys.slice(0, -1).join(", ")} and ${shareKeys.at(-1)} must be the same; ${different}`);
|
|
26755
27286
|
}
|
|
26756
27287
|
problems.push(...nativeGroupProblems(model));
|
|
26757
|
-
problems.push(...landingConflicts(tables));
|
|
27288
|
+
problems.push(...landingConflicts(tables.filter((table) => !table.ingest?.settings.path)));
|
|
27289
|
+
problems.push(...samePathProblems(tables.filter((table) => table.ingest?.method !== "adf-files")));
|
|
26758
27290
|
return problems;
|
|
26759
27291
|
}
|
|
26760
27292
|
var shareKeys = ["integration_runtime", "runtime_kind", "every", "start", "retries", "paused"];
|
|
@@ -26799,7 +27331,12 @@ function nativeGroupProblems(model) {
|
|
|
26799
27331
|
return problems;
|
|
26800
27332
|
}
|
|
26801
27333
|
|
|
26802
|
-
// packages/pack-
|
|
27334
|
+
// node_modules/.pnpm/@ingestron+pack-adf@1.1.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-adf/dist/recipes.js
|
|
27335
|
+
import { dirname as dirname3, join as join4 } from "node:path";
|
|
27336
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
27337
|
+
var recipesFolder = join4(dirname3(fileURLToPath2(import.meta.url)), "../recipes");
|
|
27338
|
+
|
|
27339
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/contract.js
|
|
26803
27340
|
var used2 = (does) => ({ use: "used", does });
|
|
26804
27341
|
var needs = (id, does) => ({ use: "used", does, needs: id });
|
|
26805
27342
|
var whole = (does) => ({ use: "used", does, whole: true });
|
|
@@ -26847,7 +27384,7 @@ var contract2 = {
|
|
|
26847
27384
|
[`${column4}.items`]: notYet("The element of an array column is not read yet; give the column's physicalType, such as ARRAY<STRING>.")
|
|
26848
27385
|
};
|
|
26849
27386
|
|
|
26850
|
-
// packages/pack-databricks/dist/connectors.js
|
|
27387
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/connectors.js
|
|
26851
27388
|
var lakeflow = "https://docs.databricks.com/aws/en/ingestion/lakeflow-connect";
|
|
26852
27389
|
var connectors2 = [
|
|
26853
27390
|
{
|
|
@@ -26903,7 +27440,7 @@ var connectors2 = [
|
|
|
26903
27440
|
}
|
|
26904
27441
|
];
|
|
26905
27442
|
|
|
26906
|
-
// packages/pack-databricks/dist/bundle.js
|
|
27443
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/bundle.js
|
|
26907
27444
|
var import_yaml8 = __toESM(require_dist(), 1);
|
|
26908
27445
|
function bundleFile(model) {
|
|
26909
27446
|
const { platform } = model;
|
|
@@ -27028,7 +27565,7 @@ function yamlText(headers, data) {
|
|
|
27028
27565
|
return `${comments}${(0, import_yaml8.stringify)(data, { lineWidth: 0 })}`;
|
|
27029
27566
|
}
|
|
27030
27567
|
|
|
27031
|
-
// packages/pack-databricks/dist/connect-method.js
|
|
27568
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/connect-method.js
|
|
27032
27569
|
var gatewayConnectors = /* @__PURE__ */ new Set(["sqlserver"]);
|
|
27033
27570
|
var managedConnectors = ["sqlserver", "salesforce", "kafka"];
|
|
27034
27571
|
var lakeflowConnect = {
|
|
@@ -27110,7 +27647,7 @@ function checkConnect(table) {
|
|
|
27110
27647
|
return problems;
|
|
27111
27648
|
}
|
|
27112
27649
|
|
|
27113
|
-
// packages/pack-databricks/dist/query.js
|
|
27650
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/query.js
|
|
27114
27651
|
var import_liquidjs2 = __toESM(require_liquid_node(), 1);
|
|
27115
27652
|
var engine2 = new import_liquidjs2.Liquid({ strictVariables: true, strictFilters: true });
|
|
27116
27653
|
function renderQuery(code, inputs) {
|
|
@@ -27129,7 +27666,7 @@ function quoteName(fullName) {
|
|
|
27129
27666
|
return fullName.split(".").map((part) => `\`${part.replaceAll("`", "``")}\``).join(".");
|
|
27130
27667
|
}
|
|
27131
27668
|
|
|
27132
|
-
// packages/pack-databricks/dist/connect.js
|
|
27669
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/connect.js
|
|
27133
27670
|
function connectGroups(model) {
|
|
27134
27671
|
const groups = /* @__PURE__ */ new Map();
|
|
27135
27672
|
for (const table of model.tables.filter((candidate) => candidate.ingest?.method === "lakeflow-connect")) {
|
|
@@ -27263,7 +27800,7 @@ function previewNote(group) {
|
|
|
27263
27800
|
return "Lakeflow Connect fields used here are marked Preview in the Databricks CLI v1.22.1 bundle schema (checked 2026-10-25).";
|
|
27264
27801
|
}
|
|
27265
27802
|
|
|
27266
|
-
// packages/pack-databricks/dist/sql-data.js
|
|
27803
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/sql-data.js
|
|
27267
27804
|
var onViolation = { warn: "", drop: " ON VIOLATION DROP ROW", fail: " ON VIOLATION FAIL UPDATE" };
|
|
27268
27805
|
function sqlString(text2) {
|
|
27269
27806
|
return `'${text2.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
@@ -27358,7 +27895,7 @@ function changeData(table) {
|
|
|
27358
27895
|
};
|
|
27359
27896
|
}
|
|
27360
27897
|
|
|
27361
|
-
// packages/pack-databricks/dist/apply-contract.js
|
|
27898
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/apply-contract.js
|
|
27362
27899
|
function applyContract(model) {
|
|
27363
27900
|
const { manage } = model.platform;
|
|
27364
27901
|
return {
|
|
@@ -27441,7 +27978,7 @@ function valuesOf(values2) {
|
|
|
27441
27978
|
return list2.map((value) => typeof value === "number" ? String(value) : sqlString(String(value))).join(", ");
|
|
27442
27979
|
}
|
|
27443
27980
|
|
|
27444
|
-
// packages/pack-databricks/dist/capabilities.js
|
|
27981
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/capabilities.js
|
|
27445
27982
|
var owner = "The run_as identity owns the tables the pipelines create, so it may change them; any other identity needs MODIFY on each table";
|
|
27446
27983
|
var capabilities = [
|
|
27447
27984
|
{
|
|
@@ -27510,12 +28047,12 @@ function prerequisites2(model, header) {
|
|
|
27510
28047
|
`;
|
|
27511
28048
|
}
|
|
27512
28049
|
|
|
27513
|
-
// packages/pack-databricks/dist/sql.js
|
|
28050
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/sql.js
|
|
27514
28051
|
var import_liquidjs3 = __toESM(require_liquid_node(), 1);
|
|
27515
|
-
import { dirname as
|
|
27516
|
-
import { fileURLToPath as
|
|
28052
|
+
import { dirname as dirname4, join as join5 } from "node:path";
|
|
28053
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
27517
28054
|
|
|
27518
|
-
// packages/pack-databricks/dist/python-data.js
|
|
28055
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/python-data.js
|
|
27519
28056
|
var decorators = {
|
|
27520
28057
|
warn: "expect_all",
|
|
27521
28058
|
drop: "expect_all_or_drop",
|
|
@@ -27559,8 +28096,8 @@ function pythonDict(entries) {
|
|
|
27559
28096
|
return `{${entries.map(([key, value]) => `${JSON.stringify(key)}: ${JSON.stringify(value)}`).join(", ")}}`;
|
|
27560
28097
|
}
|
|
27561
28098
|
|
|
27562
|
-
// packages/pack-databricks/dist/sql.js
|
|
27563
|
-
var templatesFolder =
|
|
28099
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/sql.js
|
|
28100
|
+
var templatesFolder = join5(dirname4(fileURLToPath3(import.meta.url)), "../templates/");
|
|
27564
28101
|
var engine3 = new import_liquidjs3.Liquid({
|
|
27565
28102
|
root: templatesFolder,
|
|
27566
28103
|
extname: ".liquid",
|
|
@@ -27622,7 +28159,7 @@ function materialisedView(table, header) {
|
|
|
27622
28159
|
};
|
|
27623
28160
|
}
|
|
27624
28161
|
|
|
27625
|
-
// packages/pack-databricks/dist/build.js
|
|
28162
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/build.js
|
|
27626
28163
|
var doNotEdit = "Do not edit: change the definitions and generate again.";
|
|
27627
28164
|
function build2(model) {
|
|
27628
28165
|
const header = `Generated by Ingestron from the ${model.project.id} definitions (${model.project.environment}). ${doNotEdit}`;
|
|
@@ -27685,7 +28222,7 @@ function applyFiles(model, refreshes, output) {
|
|
|
27685
28222
|
];
|
|
27686
28223
|
}
|
|
27687
28224
|
|
|
27688
|
-
// packages/pack-databricks/dist/request.js
|
|
28225
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/request.js
|
|
27689
28226
|
function request2(model) {
|
|
27690
28227
|
return [
|
|
27691
28228
|
{
|
|
@@ -27726,7 +28263,7 @@ function unique2(values2) {
|
|
|
27726
28263
|
return [...new Set(values2)];
|
|
27727
28264
|
}
|
|
27728
28265
|
|
|
27729
|
-
// packages/pack-databricks/dist/methods.js
|
|
28266
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/methods.js
|
|
27730
28267
|
var clusterBy = {
|
|
27731
28268
|
description: "How the table is clustered: auto, none, or a list of columns.",
|
|
27732
28269
|
anyOf: [
|
|
@@ -27886,7 +28423,7 @@ function checkChangeData(table) {
|
|
|
27886
28423
|
return problems;
|
|
27887
28424
|
}
|
|
27888
28425
|
|
|
27889
|
-
// packages/pack-databricks/dist/pyspark-method.js
|
|
28426
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/pyspark-method.js
|
|
27890
28427
|
var pyspark = {
|
|
27891
28428
|
action: "transform",
|
|
27892
28429
|
description: "Calls a function in the transform's Python code with a dict of input DataFrames; it returns one DataFrame.",
|
|
@@ -27921,7 +28458,7 @@ function unknownInputs(code, inputs) {
|
|
|
27921
28458
|
return [...new Set(read)].filter((key) => !inputs.includes(key)).map((key) => `the code reads tables["${key}"], which is not an input; the inputs are ${inputs.map((input) => `"${input}"`).join(", ") || "none"}`);
|
|
27922
28459
|
}
|
|
27923
28460
|
|
|
27924
|
-
// packages/pack-databricks/dist/pack.js
|
|
28461
|
+
// node_modules/.pnpm/@ingestron+pack-databricks@1.0.0_@ingestron+definitions@packages+definitions/node_modules/@ingestron/pack-databricks/dist/pack.js
|
|
27925
28462
|
var databricks = {
|
|
27926
28463
|
id: "databricks",
|
|
27927
28464
|
version: 1,
|
|
@@ -27985,10 +28522,10 @@ var packs = [databricks, adf];
|
|
|
27985
28522
|
// packages/cli/src/environments.ts
|
|
27986
28523
|
var import_yaml9 = __toESM(require_dist(), 1);
|
|
27987
28524
|
import { existsSync, readFileSync as readFileSync4 } from "node:fs";
|
|
27988
|
-
import { join as
|
|
28525
|
+
import { join as join6 } from "node:path";
|
|
27989
28526
|
function environmentsToGenerate(definitions, requested) {
|
|
27990
28527
|
if (requested.length > 0) return requested;
|
|
27991
|
-
const manifest =
|
|
28528
|
+
const manifest = join6(definitions, "project.yaml");
|
|
27992
28529
|
if (!existsSync(manifest)) return [void 0];
|
|
27993
28530
|
try {
|
|
27994
28531
|
const data = (0, import_yaml9.parse)(readFileSync4(manifest, "utf8"));
|
|
@@ -28001,11 +28538,11 @@ function environmentsToGenerate(definitions, requested) {
|
|
|
28001
28538
|
|
|
28002
28539
|
// packages/cli/src/outputs.ts
|
|
28003
28540
|
import { existsSync as existsSync2, lstatSync as lstatSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
28004
|
-
import { join as
|
|
28541
|
+
import { join as join7, relative as relative3, sep as sep3 } from "node:path";
|
|
28005
28542
|
function generatedFolders(root) {
|
|
28006
28543
|
if (!isFolder(root)) return [];
|
|
28007
|
-
const found = existsSync2(
|
|
28008
|
-
for (const name of readdirSync2(root).sort()) found.push(...generatedFolders(
|
|
28544
|
+
const found = existsSync2(join7(root, manifestFile)) ? [root] : [];
|
|
28545
|
+
for (const name of readdirSync2(root).sort()) found.push(...generatedFolders(join7(root, name)));
|
|
28009
28546
|
return found;
|
|
28010
28547
|
}
|
|
28011
28548
|
function extraFiles(root, known3, others) {
|
|
@@ -28013,13 +28550,13 @@ function extraFiles(root, known3, others) {
|
|
|
28013
28550
|
const extra = [];
|
|
28014
28551
|
const walk2 = (folder) => {
|
|
28015
28552
|
for (const name of readdirSync2(folder).sort()) {
|
|
28016
|
-
const path =
|
|
28553
|
+
const path = join7(folder, name);
|
|
28017
28554
|
if (isFolder(path)) {
|
|
28018
|
-
if (!skip.has(path) && !existsSync2(
|
|
28555
|
+
if (!skip.has(path) && !existsSync2(join7(path, manifestFile))) walk2(path);
|
|
28019
28556
|
continue;
|
|
28020
28557
|
}
|
|
28021
|
-
const
|
|
28022
|
-
if (!known3.has(
|
|
28558
|
+
const relativePath2 = relative3(root, path).split(sep3).join("/");
|
|
28559
|
+
if (!known3.has(relativePath2) && !ignored.has(name)) extra.push(relativePath2);
|
|
28023
28560
|
}
|
|
28024
28561
|
};
|
|
28025
28562
|
if (isFolder(root)) walk2(root);
|
|
@@ -28066,8 +28603,8 @@ function summarise(io, done, notDone) {
|
|
|
28066
28603
|
}
|
|
28067
28604
|
function retiredFolders(options2, out, current, unresolved) {
|
|
28068
28605
|
const within = (folder, root) => folder === root || folder.startsWith(root + sep4);
|
|
28069
|
-
const looked = options2.environments.length > 0 ? options2.environments.map((environment2) =>
|
|
28070
|
-
const skipped2 = unresolved.map((environment2) =>
|
|
28606
|
+
const looked = options2.environments.length > 0 ? options2.environments.map((environment2) => join8(out, environment2)) : [out];
|
|
28607
|
+
const skipped2 = unresolved.map((environment2) => join8(out, environment2));
|
|
28071
28608
|
return looked.flatMap(generatedFolders).filter((folder) => !current.includes(folder)).filter((folder) => !skipped2.some((root) => within(folder, root)));
|
|
28072
28609
|
}
|
|
28073
28610
|
function planEnvironment(options2, io, definitions, environment2) {
|
|
@@ -28134,8 +28671,8 @@ ${formatPlan(plan)}
|
|
|
28134
28671
|
|
|
28135
28672
|
// packages/cli/src/init.ts
|
|
28136
28673
|
var import_yaml16 = __toESM(require_dist(), 1);
|
|
28137
|
-
import { readFileSync as
|
|
28138
|
-
import { basename as basename2, join as
|
|
28674
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
28675
|
+
import { basename as basename2, join as join14, relative as relative7, resolve as resolve3 } from "node:path";
|
|
28139
28676
|
|
|
28140
28677
|
// packages/cli/src/project-choices.ts
|
|
28141
28678
|
function projectSources() {
|
|
@@ -28175,15 +28712,13 @@ function supported(method, connector, connectivity) {
|
|
|
28175
28712
|
}
|
|
28176
28713
|
|
|
28177
28714
|
// packages/cli/src/project-recipes.ts
|
|
28715
|
+
import { join as join12 } from "node:path";
|
|
28178
28716
|
var import_yaml14 = __toESM(require_dist(), 1);
|
|
28179
|
-
import { existsSync as existsSync5 } from "node:fs";
|
|
28180
|
-
import { dirname as dirname7, join as join11 } from "node:path";
|
|
28181
|
-
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
28182
28717
|
|
|
28183
28718
|
// packages/cli/src/scaffold.ts
|
|
28184
28719
|
var import_yaml10 = __toESM(require_dist(), 1);
|
|
28185
28720
|
import { lstatSync as lstatSync3, mkdirSync as mkdirSync2, readdirSync as readdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
28186
|
-
import { dirname as
|
|
28721
|
+
import { dirname as dirname5, join as join9, relative as relative5 } from "node:path";
|
|
28187
28722
|
var skipped = /* @__PURE__ */ new Set([
|
|
28188
28723
|
"template.yaml",
|
|
28189
28724
|
"README.md",
|
|
@@ -28196,7 +28731,7 @@ function scaffoldFiles(template, answers, prepared) {
|
|
|
28196
28731
|
const files2 = { ...prepared };
|
|
28197
28732
|
if (!prepared)
|
|
28198
28733
|
for (const path of templateFiles(template, template.folder))
|
|
28199
|
-
files2[path] = readFileSync5(
|
|
28734
|
+
files2[path] = readFileSync5(join9(template.folder, path));
|
|
28200
28735
|
files2["project.yaml"] = projectText(files2["project.yaml"]?.toString() ?? "", answers);
|
|
28201
28736
|
if (answers.standard) {
|
|
28202
28737
|
const text2 = readFileSync5(answers.standard.file, "utf8");
|
|
@@ -28210,8 +28745,8 @@ function writeScaffold(target, files2) {
|
|
|
28210
28745
|
const clashes = [...new Set(paths.flatMap((path) => inTheWay(target, path)))].sort();
|
|
28211
28746
|
if (clashes.length > 0) return { clashes };
|
|
28212
28747
|
for (const path of paths) {
|
|
28213
|
-
mkdirSync2(
|
|
28214
|
-
writeFileSync2(
|
|
28748
|
+
mkdirSync2(dirname5(join9(target, path)), { recursive: true });
|
|
28749
|
+
writeFileSync2(join9(target, path), files2[path], { flag: "wx" });
|
|
28215
28750
|
}
|
|
28216
28751
|
return { written: paths };
|
|
28217
28752
|
}
|
|
@@ -28219,7 +28754,7 @@ function inTheWay(target, path) {
|
|
|
28219
28754
|
const parts = path.split("/");
|
|
28220
28755
|
for (let index = 1; index <= parts.length; index += 1) {
|
|
28221
28756
|
const prefix = parts.slice(0, index).join("/");
|
|
28222
|
-
const stat = lstatSync3(
|
|
28757
|
+
const stat = lstatSync3(join9(target, prefix), { throwIfNoEntry: false });
|
|
28223
28758
|
if (!stat) return [];
|
|
28224
28759
|
if (index === parts.length || !stat.isDirectory()) return [prefix];
|
|
28225
28760
|
}
|
|
@@ -28236,7 +28771,7 @@ function projectId(text2) {
|
|
|
28236
28771
|
function templateFiles(template, folder) {
|
|
28237
28772
|
return readdirSync3(folder).flatMap((entry) => {
|
|
28238
28773
|
if (skipped.has(entry)) return [];
|
|
28239
|
-
const path =
|
|
28774
|
+
const path = join9(folder, entry);
|
|
28240
28775
|
const stat = lstatSync3(path);
|
|
28241
28776
|
if (stat.isSymbolicLink())
|
|
28242
28777
|
throw new Error(
|
|
@@ -28263,28 +28798,15 @@ function projectText(text2, answers) {
|
|
|
28263
28798
|
|
|
28264
28799
|
// packages/cli/src/templates.ts
|
|
28265
28800
|
var import_yaml12 = __toESM(require_dist(), 1);
|
|
28266
|
-
import { existsSync as
|
|
28267
|
-
import {
|
|
28268
|
-
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
28801
|
+
import { existsSync as existsSync3, lstatSync as lstatSync4, readdirSync as readdirSync4, readFileSync as readFileSync6 } from "node:fs";
|
|
28802
|
+
import { join as join11 } from "node:path";
|
|
28269
28803
|
|
|
28270
28804
|
// packages/cli/src/samples.ts
|
|
28271
|
-
import {
|
|
28272
|
-
import {
|
|
28273
|
-
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
28805
|
+
import { dirname as dirname6, join as join10 } from "node:path";
|
|
28806
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
28274
28807
|
var import_yaml11 = __toESM(require_dist(), 1);
|
|
28275
|
-
var packageRoot =
|
|
28276
|
-
|
|
28277
|
-
const repository = join9(root, "../..");
|
|
28278
|
-
const packaged = join9(root, "project-templates");
|
|
28279
|
-
if (!inRepository(repository) && existsSync3(packaged)) return { starters: packaged };
|
|
28280
|
-
const samples = join9(repository, "samples");
|
|
28281
|
-
return { starters: join9(samples, "starters"), guides: join9(samples, "guides") };
|
|
28282
|
-
}
|
|
28283
|
-
function inRepository(folder) {
|
|
28284
|
-
const manifest = join9(folder, "packages/cli/package.json");
|
|
28285
|
-
if (!existsSync3(manifest)) return false;
|
|
28286
|
-
return JSON.parse(readFileSync6(manifest, "utf8")).name === "@ingestron/cli";
|
|
28287
|
-
}
|
|
28808
|
+
var packageRoot = join10(dirname6(fileURLToPath4(import.meta.url)), "..");
|
|
28809
|
+
var templatesFolder2 = join10(packageRoot, "project-templates");
|
|
28288
28810
|
|
|
28289
28811
|
// packages/cli/src/templates.ts
|
|
28290
28812
|
var templateSchema = {
|
|
@@ -28318,21 +28840,17 @@ var templateSchema = {
|
|
|
28318
28840
|
}
|
|
28319
28841
|
}
|
|
28320
28842
|
};
|
|
28321
|
-
var
|
|
28322
|
-
function builtInFolderFor(root) {
|
|
28323
|
-
return samplesFoldersFor(root).starters;
|
|
28324
|
-
}
|
|
28325
|
-
var builtInFolder = builtInFolderFor(packageRoot2);
|
|
28843
|
+
var builtInFolder = templatesFolder2;
|
|
28326
28844
|
function builtInTemplates() {
|
|
28327
|
-
return
|
|
28845
|
+
return readdirSync4(builtInFolder, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => existsSync3(join11(builtInFolder, entry.name, "template.yaml"))).map((entry) => readTemplate(join11(builtInFolder, entry.name), entry.name)).sort((a, b) => a.name.localeCompare(b.name));
|
|
28328
28846
|
}
|
|
28329
28847
|
function readTemplate(folder, name) {
|
|
28330
28848
|
for (const required of ["template.yaml", "project.yaml"]) {
|
|
28331
|
-
const stat = lstatSync4(
|
|
28849
|
+
const stat = lstatSync4(join11(folder, required), { throwIfNoEntry: false });
|
|
28332
28850
|
if (!stat) throw new Error(`Template "${name}" has no ${required}.`);
|
|
28333
28851
|
if (!stat.isFile()) throw new Error(`Template "${name}": ${required} is not a regular file.`);
|
|
28334
28852
|
}
|
|
28335
|
-
return parseTemplate(
|
|
28853
|
+
return parseTemplate(readFileSync6(join11(folder, "template.yaml"), "utf8"), name, folder);
|
|
28336
28854
|
}
|
|
28337
28855
|
function parseTemplate(text2, name, folder) {
|
|
28338
28856
|
const data = (0, import_yaml12.parse)(text2);
|
|
@@ -28409,7 +28927,6 @@ function infrastructureQuestions(files2, method, ask) {
|
|
|
28409
28927
|
}
|
|
28410
28928
|
|
|
28411
28929
|
// packages/cli/src/project-recipes.ts
|
|
28412
|
-
var packageRoot3 = join11(dirname7(fileURLToPath5(import.meta.url)), "..");
|
|
28413
28930
|
var directExamples = {
|
|
28414
28931
|
files: "minimal",
|
|
28415
28932
|
sqlserver: "sql-server",
|
|
@@ -28438,10 +28955,9 @@ function recipeTemplate(connector, via) {
|
|
|
28438
28955
|
if (via === "databricks") {
|
|
28439
28956
|
const example = directExamples[connector];
|
|
28440
28957
|
if (!example) throw new Error(`No tested project recipe for ${connector} via Databricks.`);
|
|
28441
|
-
return readTemplate(
|
|
28958
|
+
return readTemplate(join12(builtInFolder, example), example);
|
|
28442
28959
|
}
|
|
28443
|
-
const
|
|
28444
|
-
const folder = existsSync5(packaged) ? packaged : join11(packageRoot3, "../../samples/guides/adf-native-connectors");
|
|
28960
|
+
const folder = recipesFolder;
|
|
28445
28961
|
return {
|
|
28446
28962
|
name: connector,
|
|
28447
28963
|
title: connector,
|
|
@@ -28573,9 +29089,9 @@ ${formatDiagnostics(result.diagnostics)}`;
|
|
|
28573
29089
|
|
|
28574
29090
|
// packages/cli/src/sources.ts
|
|
28575
29091
|
import { execFileSync } from "node:child_process";
|
|
28576
|
-
import { existsSync as
|
|
29092
|
+
import { existsSync as existsSync4, lstatSync as lstatSync5, mkdtempSync, realpathSync as realpathSync3, rmSync as rmSync2 } from "node:fs";
|
|
28577
29093
|
import { tmpdir } from "node:os";
|
|
28578
|
-
import { basename, join as
|
|
29094
|
+
import { basename, join as join13, relative as relative6, resolve as resolve2 } from "node:path";
|
|
28579
29095
|
function withoutCredentials(text2) {
|
|
28580
29096
|
return text2.replace(/(\/\/)[^/@\s]+@/g, "$1");
|
|
28581
29097
|
}
|
|
@@ -28599,7 +29115,7 @@ function templateSource(spec2, cwd) {
|
|
|
28599
29115
|
}
|
|
28600
29116
|
const folder = resolve2(cwd, spec2);
|
|
28601
29117
|
if (spec2.includes("/") || spec2.startsWith(".")) {
|
|
28602
|
-
if (!
|
|
29118
|
+
if (!existsSync4(folder)) throw new Error(`No template folder ${spec2}.`);
|
|
28603
29119
|
return { template: readTemplate(folder, basename(folder)), done: () => void 0 };
|
|
28604
29120
|
}
|
|
28605
29121
|
const builtIns = builtInTemplates();
|
|
@@ -28613,7 +29129,7 @@ function templateSource(spec2, cwd) {
|
|
|
28613
29129
|
function standardSource(spec2, cwd) {
|
|
28614
29130
|
if (!isGitUrl(spec2)) {
|
|
28615
29131
|
const file = resolve2(cwd, spec2);
|
|
28616
|
-
if (!
|
|
29132
|
+
if (!existsSync4(file)) throw new Error(`No standard file ${spec2}.`);
|
|
28617
29133
|
return { file, source: spec2, done: () => void 0 };
|
|
28618
29134
|
}
|
|
28619
29135
|
const { path, done } = cloned(spec2, "file");
|
|
@@ -28623,7 +29139,7 @@ function cloned(spec2, kind) {
|
|
|
28623
29139
|
const [url = "", inside = ""] = spec2.split("#");
|
|
28624
29140
|
if (inside.split("/").includes("..") || inside.startsWith("/"))
|
|
28625
29141
|
throw new Error(`The part after "#" must stay inside the repository: ${inside}.`);
|
|
28626
|
-
const folder = mkdtempSync(
|
|
29142
|
+
const folder = mkdtempSync(join13(tmpdir(), "ingestron-template-"));
|
|
28627
29143
|
const done = () => rmSync2(folder, { recursive: true, force: true });
|
|
28628
29144
|
try {
|
|
28629
29145
|
clone(url, folder);
|
|
@@ -28643,7 +29159,7 @@ function clone(url, folder) {
|
|
|
28643
29159
|
}
|
|
28644
29160
|
}
|
|
28645
29161
|
function checkedEntry(folder, inside, kind) {
|
|
28646
|
-
const path =
|
|
29162
|
+
const path = join13(folder, inside);
|
|
28647
29163
|
const stat = lstatSync5(path, { throwIfNoEntry: false });
|
|
28648
29164
|
if (!stat) throw new Error(`The repository has no "${inside}".`);
|
|
28649
29165
|
const real = relative6(realpathSync3(folder), realpathSync3(path));
|
|
@@ -28753,7 +29269,7 @@ ${listed}`);
|
|
|
28753
29269
|
command: "plan",
|
|
28754
29270
|
environments: [],
|
|
28755
29271
|
definitions: target,
|
|
28756
|
-
out:
|
|
29272
|
+
out: join14(target, "build"),
|
|
28757
29273
|
diffs: false
|
|
28758
29274
|
};
|
|
28759
29275
|
return generate({ ...options2, ...plan }, io);
|
|
@@ -28768,7 +29284,7 @@ function environmentsProblem(answer) {
|
|
|
28768
29284
|
return list(answer).map((name) => nameProblem(name, "environment")).find(Boolean);
|
|
28769
29285
|
}
|
|
28770
29286
|
function templateEnvironments(template) {
|
|
28771
|
-
const project = (0, import_yaml16.parse)(
|
|
29287
|
+
const project = (0, import_yaml16.parse)(readFileSync7(join14(template.folder, "project.yaml"), "utf8"));
|
|
28772
29288
|
return Object.keys(project.environments ?? { dev: {} });
|
|
28773
29289
|
}
|
|
28774
29290
|
function list(text2) {
|
|
@@ -28828,7 +29344,7 @@ function sectionsOf(model) {
|
|
|
28828
29344
|
function tableFacts(table) {
|
|
28829
29345
|
const step = (found) => found && { method: found.method, settings: found.settings };
|
|
28830
29346
|
return {
|
|
28831
|
-
"full name": Object.values(table.fullName).join("."),
|
|
29347
|
+
...table.endsAtFiles ? { "lands at": table.ingest?.output?.location ?? "the landed files" } : { "full name": Object.values(table.fullName).join(".") },
|
|
28832
29348
|
...flat({
|
|
28833
29349
|
ingest: table.ingest && {
|
|
28834
29350
|
...step(table.ingest),
|
|
@@ -28894,6 +29410,10 @@ The definitions have problems; fix them first.
|
|
|
28894
29410
|
}
|
|
28895
29411
|
function identity2(model) {
|
|
28896
29412
|
const { run_as: runAs, workspace } = model.platform;
|
|
29413
|
+
const platform = model.tables.some(
|
|
29414
|
+
(table) => [table.ingest, table.transform, table.store].some((step) => step?.pack === "databricks")
|
|
29415
|
+
);
|
|
29416
|
+
if (!runAs && !platform) return void 0;
|
|
28897
29417
|
const who = runAs ? `\`${Object.values(runAs)[0]}\`` : "the identity that deploys the bundle";
|
|
28898
29418
|
return `Pipelines and jobs run as ${who}${workspace.host ? ` in ${workspace.host}` : ""}.`;
|
|
28899
29419
|
}
|
|
@@ -28970,8 +29490,8 @@ ${text2}\`\`\``;
|
|
|
28970
29490
|
|
|
28971
29491
|
// packages/cli/src/sample-contract.ts
|
|
28972
29492
|
var import_yaml17 = __toESM(require_dist(), 1);
|
|
28973
|
-
import { existsSync as
|
|
28974
|
-
import { basename as basename3, dirname as
|
|
29493
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "node:fs";
|
|
29494
|
+
import { basename as basename3, dirname as dirname7, join as join15, relative as relative8, resolve as resolve6 } from "node:path";
|
|
28975
29495
|
|
|
28976
29496
|
// packages/cli/src/sample-read.ts
|
|
28977
29497
|
function readSample(text2, file, limit = 1e3) {
|
|
@@ -29046,21 +29566,21 @@ var CsvReader = class {
|
|
|
29046
29566
|
// packages/cli/src/sample-contract.ts
|
|
29047
29567
|
function draftContract(options2, io) {
|
|
29048
29568
|
const sample = resolve6(io.cwd, options2.sample ?? "");
|
|
29049
|
-
if (!options2.sample || !
|
|
29569
|
+
if (!options2.sample || !existsSync5(sample)) {
|
|
29050
29570
|
io.write(`contract needs a sample file: ingestron contract <file.csv|file.json>
|
|
29051
29571
|
`);
|
|
29052
29572
|
return 2;
|
|
29053
29573
|
}
|
|
29054
29574
|
const name = options2.init.name ?? objectName(sample);
|
|
29055
|
-
const target =
|
|
29575
|
+
const target = join15(resolve6(io.cwd, options2.definitions), "contracts", `${name}.yaml`);
|
|
29056
29576
|
const shown3 = relative8(io.cwd, target);
|
|
29057
|
-
if (
|
|
29577
|
+
if (existsSync5(target)) {
|
|
29058
29578
|
io.write(`${shown3} already exists; nothing written.
|
|
29059
29579
|
`);
|
|
29060
29580
|
return 1;
|
|
29061
29581
|
}
|
|
29062
|
-
mkdirSync3(
|
|
29063
|
-
writeFileSync3(target, contractFromSample(
|
|
29582
|
+
mkdirSync3(dirname7(target), { recursive: true });
|
|
29583
|
+
writeFileSync3(target, contractFromSample(readFileSync8(sample, "utf8"), basename3(sample), name));
|
|
29064
29584
|
io.write(`Wrote ${shown3}. Review the types, then add keys, required columns and descriptions.
|
|
29065
29585
|
`);
|
|
29066
29586
|
return 0;
|
|
@@ -29116,11 +29636,11 @@ function typeOfValue(value) {
|
|
|
29116
29636
|
|
|
29117
29637
|
// packages/cli/src/schemas.ts
|
|
29118
29638
|
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "node:fs";
|
|
29119
|
-
import { join as
|
|
29639
|
+
import { join as join16, relative as relative9, resolve as resolve7 } from "node:path";
|
|
29120
29640
|
function writeSchemas(options2, io) {
|
|
29121
|
-
const folder =
|
|
29641
|
+
const folder = join16(io.cwd, ".ingestron", "schemas");
|
|
29122
29642
|
mkdirSync4(folder, { recursive: true });
|
|
29123
|
-
const write = (name, schema) => writeFileSync4(
|
|
29643
|
+
const write = (name, schema) => writeFileSync4(join16(folder, name), `${JSON.stringify(schema, null, 2)}
|
|
29124
29644
|
`);
|
|
29125
29645
|
write("project.json", manifestSchema);
|
|
29126
29646
|
const branches = Object.values(kinds).map((kind) => {
|
|
@@ -29143,12 +29663,12 @@ function writeSchemas(options2, io) {
|
|
|
29143
29663
|
}
|
|
29144
29664
|
);
|
|
29145
29665
|
write("definitions.json", { title: "Ingestron definitions", allOf: branches });
|
|
29146
|
-
const files2 =
|
|
29666
|
+
const files2 = join16(
|
|
29147
29667
|
relative9(io.cwd, resolve7(io.cwd, options2.definitions)) || ".",
|
|
29148
29668
|
"**/*.yaml"
|
|
29149
29669
|
).replace(/^\.\//, "");
|
|
29150
29670
|
const setting = {
|
|
29151
|
-
"yaml.schemas": { [relative9(io.cwd,
|
|
29671
|
+
"yaml.schemas": { [relative9(io.cwd, join16(folder, "definitions.json"))]: files2 }
|
|
29152
29672
|
};
|
|
29153
29673
|
io.write(
|
|
29154
29674
|
`Wrote editor schemas to ${relative9(io.cwd, folder)}.
|