@sqlanvil/cli 1.24.0 → 1.25.1

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/._LICENSE ADDED
Binary file
package/._NOTICE ADDED
Binary file
package/._README.md ADDED
Binary file
package/._bundle.js ADDED
Binary file
package/._package.json ADDED
Binary file
Binary file
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  SQLAnvil is an open-source fork of [Dataform OSS](https://github.com/dataform-co/dataform) (Apache 2.0), extended with first-class PostgreSQL, Supabase, and MySQL/MariaDB support. Define your data transformations in SQLX, have SQLAnvil compile them to idiomatic SQL for your warehouse, and run, validate, and document the whole DAG from one CLI.
6
6
 
7
- > **SQLAnvil is not affiliated with or endorsed by Google.** The Dataform name and related marks are trademarks of Google LLC. See [NOTICE](NOTICE) for attribution.
7
+ > **SQLAnvil is not affiliated with or endorsed by Google.** The Dataform name and related marks are trademarks of Google LLC. See [NOTICE](https://github.com/SQLAnvil/sqlanvil/blob/main/NOTICE) for attribution.
8
8
 
9
9
  ---
10
10
 
@@ -86,7 +86,7 @@ Full documentation at **[sqlanvil.com/docs](https://sqlanvil.com/docs/)**.
86
86
  - [Validate](https://sqlanvil.com/docs/guides/validate/) · [Named Environments](https://sqlanvil.com/docs/guides/environments/) · [Artifacts & Catalog](https://sqlanvil.com/docs/guides/artifacts/)
87
87
  - [Configs Reference](https://sqlanvil.com/docs/reference/configs/) · [What's New](https://sqlanvil.com/docs/whats-new/)
88
88
 
89
- Writing sqlanvil projects with an AI agent? Point it at [`AGENTS.md`](AGENTS.md) — it corrects
89
+ Writing sqlanvil projects with an AI agent? Point it at [`AGENTS.md`](https://github.com/SQLAnvil/sqlanvil/blob/main/AGENTS.md) — it corrects
90
90
  the Dataform/BigQuery priors that otherwise produce broken sqlanvil code. Contributor/design
91
91
  docs live in the separate [`sqlanvil/docs`](https://github.com/sqlanvil/docs) repo.
92
92
 
@@ -123,12 +123,12 @@ bazel test //core/... //cli/...
123
123
  ```
124
124
 
125
125
  A Docker-based build container (`./scripts/docker-bazel`) remains available as an optional
126
- hermetic environment. See [contributing.md](contributing.md) for full instructions.
126
+ hermetic environment. See [contributing.md](https://github.com/SQLAnvil/sqlanvil/blob/main/contributing.md) for full instructions.
127
127
 
128
128
  ---
129
129
 
130
130
  ## License
131
131
 
132
- Apache License 2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
132
+ Apache License 2.0. See [LICENSE](https://github.com/SQLAnvil/sqlanvil/blob/main/LICENSE) and [NOTICE](https://github.com/SQLAnvil/sqlanvil/blob/main/NOTICE).
133
133
 
134
134
  SQLAnvil is a derivative of Dataform OSS (originally developed by Dataform Co and contributed to by Google LLC). It has been fully renamed and extended with first-class PostgreSQL/Supabase/MySQL support. Licensed under Apache License 2.0.
package/bundle.js CHANGED
@@ -49219,7 +49219,15 @@ function verifyObjectMatchesProto(protoType, object, errorBehaviour = VerifyProt
49219
49219
  if (Array.isArray(object)) {
49220
49220
  throw ReferenceError(`Expected a top-level object, but found an array`);
49221
49221
  }
49222
- protoType.verify(object);
49222
+ const verificationError = protoType.verify(object);
49223
+ if (verificationError && verifyErrorIsNonPrimitiveInScalarField(verificationError, object)) {
49224
+ if (errorBehaviour === VerifyProtoErrorBehaviour.SUGGEST_REPORTING_TO_DATAFORM_TEAM) {
49225
+ throw ReferenceError(`Invalid property value: ${verificationError}, please report this to the sqlanvil team ` +
49226
+ `at ${REPORT_ISSUE_URL}.`);
49227
+ }
49228
+ throw ReferenceError(`Invalid property value: ${verificationError}.` +
49229
+ maybeGetDocsLinkPrefix(errorBehaviour, protoType));
49230
+ }
49223
49231
  const proto = protoType.create(object);
49224
49232
  const protoCastObject = protoType.toObject(proto);
49225
49233
  function checkFields(present, desired) {
@@ -49254,6 +49262,23 @@ function verifyObjectMatchesProto(protoType, object, errorBehaviour = VerifyProt
49254
49262
  checkFields(object, protoCastObject);
49255
49263
  return proto;
49256
49264
  }
49265
+ function verifyErrorIsNonPrimitiveInScalarField(message, root) {
49266
+ if (/object expected|array expected|\{k:/.test(message)) {
49267
+ return false;
49268
+ }
49269
+ const path = message.split(":")[0].trim().split(".");
49270
+ let value = root;
49271
+ for (const segment of path) {
49272
+ if (Array.isArray(value)) {
49273
+ value = value.find(element => element !== null && typeof element === "object" && segment in element);
49274
+ }
49275
+ if (value === null || typeof value !== "object" || !(segment in value)) {
49276
+ return false;
49277
+ }
49278
+ value = value[segment];
49279
+ }
49280
+ return value !== null && typeof value === "object";
49281
+ }
49257
49282
  function maybeGetDocsLinkPrefix(errorBehaviour, protoType) {
49258
49283
  return errorBehaviour === VerifyProtoErrorBehaviour.SHOW_DOCS_LINK
49259
49284
  ? ` See ${CONFIGS_PROTO_DOCUMENTATION_URL}#${protoType
@@ -50621,7 +50646,7 @@ function collectEvaluationQueries(queryOrAction, concatenate, queryModifier = (q
50621
50646
  .filter(validationQuery => !!validationQuery.query);
50622
50647
  }
50623
50648
 
50624
- const version = "1.24.0";
50649
+ const version = "1.25.1";
50625
50650
  const dataformVersion = "3.0.61";
50626
50651
 
50627
50652
  async function build(compiledGraph, runConfig, dbadapter) {
@@ -51102,6 +51127,25 @@ it gitignored.`);
51102
51127
  - A mysql warehouse cannot read cross-warehouse \`connections:\` (single write warehouse;
51103
51128
  MySQL works as a SOURCE for a Postgres/Supabase project, not the other way).`);
51104
51129
  }
51130
+ const commentMechanics = isPostgresLike
51131
+ ? "`COMMENT ON TABLE|VIEW|MATERIALIZED VIEW|COLUMN`"
51132
+ : isMysql
51133
+ ? "table/column comments (tables + incrementals only — MySQL views can't carry comments)"
51134
+ : "table + column descriptions (nested fields included)";
51135
+ const constraintNote = warehouse === "bigquery"
51136
+ ? "append `NOT ENFORCED` (BigQuery stores them as catalog metadata for query engines)"
51137
+ : "real enforced constraints";
51138
+ sections.push(`## Metadata for AI/BI engines
51139
+
51140
+ - \`description:\` + \`columns: {}\` persist into the warehouse catalog on every run as
51141
+ ${commentMechanics} — BI copilots and text-to-SQL agents read them back from there. Name
51142
+ join targets in column descriptions (\`customer_id: "Foreign key to
51143
+ public.customers.customer_id."\`).
51144
+ - PK/FK constraints go in \`post_operations\` (no config field for them) — ${constraintNote};
51145
+ on an incremental, wrap the \`ALTER\` in \`\${when(!incremental(), \\\`…\\\`)}\`.
51146
+ - \`assertions: { uniqueKey | uniqueKeys: [[…],[…]], nonNull, rowConditions }\` make key
51147
+ claims TESTED on every run (\`uniqueKey\` and \`uniqueKeys\` are mutually exclusive).
51148
+ - Guide: https://sqlanvil.com/docs/guides/metadata/`);
51105
51149
  if (converted) {
51106
51150
  sections.push(`## This project was converted from Dataform
51107
51151
 
package/package.json CHANGED
@@ -46,7 +46,14 @@
46
46
  "**/wrap-ansi": "7.0.0",
47
47
  "**/string-width": "4.1.0"
48
48
  },
49
- "homepage": "https://github.com/sqlanvil/sqlanvil",
49
+ "homepage": "https://sqlanvil.com",
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://github.com/sqlanvil/sqlanvil.git"
53
+ },
54
+ "bugs": {
55
+ "url": "https://github.com/sqlanvil/sqlanvil/issues"
56
+ },
50
57
  "license": "Apache-2.0",
51
58
  "keywords": [
52
59
  "sqlanvil",
@@ -64,7 +71,7 @@
64
71
  "bin": {
65
72
  "sqlanvil": "bundle.js"
66
73
  },
67
- "version": "1.24.0",
74
+ "version": "1.25.1",
68
75
  "name": "@sqlanvil/cli",
69
76
  "description": "sqlanvil command line interface.",
70
77
  "main": "bundle.js"