@google-cloud/kcmd 0.1.0 → 0.2.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.
Files changed (67) hide show
  1. package/README.md +18 -20
  2. package/build/ts/kcmd/cli.js +6164 -5631
  3. package/build/ts/kcmd/gcp/biglake.d.ts +2 -0
  4. package/build/ts/kcmd/gcp/biglake.js +13 -4
  5. package/build/ts/kcmd/gcp/spanner.d.ts +10 -0
  6. package/build/ts/kcmd/gcp/spanner.js +6 -3
  7. package/build/ts/kcmd/layouts/okf.js +49 -7
  8. package/build/ts/kcmd/layouts/semantic-model.d.ts +13 -0
  9. package/build/ts/kcmd/layouts/semantic-model.js +129 -50
  10. package/build/ts/kcmd/okf/concept.d.ts +1 -1
  11. package/build/ts/kcmd/okf/concept.js +6 -0
  12. package/build/ts/kcmd/okf/concept_to_entry.d.ts +2 -0
  13. package/build/ts/kcmd/okf/concept_to_entry.js +29 -2
  14. package/build/ts/kcmd/okf/init_okf_workspace.js +7 -9
  15. package/build/ts/kcmd/okf/okf_metadata.js +17 -0
  16. package/build/ts/kcmd/semantic/bigquery.js +139 -195
  17. package/build/ts/kcmd/semantic/binding.js +14 -19
  18. package/build/ts/kcmd/semantic/deploy_bigquery.js +6 -13
  19. package/build/ts/kcmd/semantic/deploy_knowledge_catalog.d.ts +10 -35
  20. package/build/ts/kcmd/semantic/deploy_knowledge_catalog.js +105 -162
  21. package/build/ts/kcmd/semantic/deploy_spanner.js +7 -14
  22. package/build/ts/kcmd/semantic/deployment_target.d.ts +1 -4
  23. package/build/ts/kcmd/semantic/deployment_target.js +6 -62
  24. package/build/ts/kcmd/semantic/graph_ddl.d.ts +10 -0
  25. package/build/ts/kcmd/semantic/graph_ddl.js +152 -59
  26. package/build/ts/kcmd/semantic/import_model.d.ts +26 -4
  27. package/build/ts/kcmd/semantic/import_model.js +531 -111
  28. package/build/ts/kcmd/semantic/ir.d.ts +2 -4
  29. package/build/ts/kcmd/semantic/kc_converter.d.ts +7 -1
  30. package/build/ts/kcmd/semantic/kc_converter.js +32 -27
  31. package/build/ts/kcmd/semantic/kc_custom_types.d.ts +5 -12
  32. package/build/ts/kcmd/semantic/kc_custom_types.js +43 -114
  33. package/build/ts/kcmd/semantic/kc_ids.d.ts +4 -5
  34. package/build/ts/kcmd/semantic/kc_ids.js +4 -7
  35. package/build/ts/kcmd/semantic/knowledge_catalog.d.ts +0 -3
  36. package/build/ts/kcmd/semantic/knowledge_catalog.js +3 -86
  37. package/build/ts/kcmd/semantic/loader.d.ts +7 -11
  38. package/build/ts/kcmd/semantic/loader.js +282 -171
  39. package/build/ts/kcmd/semantic/osi_converter.js +14 -65
  40. package/build/ts/kcmd/semantic/parameters.d.ts +1 -0
  41. package/build/ts/kcmd/semantic/parameters.js +22 -3
  42. package/build/ts/kcmd/semantic/pull_kc.d.ts +1 -5
  43. package/build/ts/kcmd/semantic/pull_kc.js +38 -112
  44. package/build/ts/kcmd/semantic/resolve_inheritance.d.ts +7 -2
  45. package/build/ts/kcmd/semantic/resolve_inheritance.js +37 -21
  46. package/build/ts/kcmd/semantic/resolve_profiles.d.ts +51 -10
  47. package/build/ts/kcmd/semantic/resolve_profiles.js +213 -32
  48. package/build/ts/kcmd/semantic/runtime/runtime.d.ts +4 -12
  49. package/build/ts/kcmd/semantic/runtime/runtime.js +4 -21
  50. package/build/ts/kcmd/semantic/runtime/store.d.ts +14 -19
  51. package/build/ts/kcmd/semantic/runtime/store.js +21 -37
  52. package/build/ts/kcmd/semantic/source_dialect.d.ts +9 -2
  53. package/build/ts/kcmd/semantic/source_dialect.js +83 -33
  54. package/build/ts/kcmd/semantic/source_entries.d.ts +1 -1
  55. package/build/ts/kcmd/semantic/source_entries.js +95 -36
  56. package/build/ts/kcmd/semantic/sql_expr_utils.d.ts +13 -7
  57. package/build/ts/kcmd/semantic/sql_expr_utils.js +240 -67
  58. package/build/ts/kcmd/semantic/sql_parser.d.ts +5 -2
  59. package/build/ts/kcmd/semantic/sql_parser.js +22 -0
  60. package/build/ts/kcmd/semantic/transpile.d.ts +12 -10
  61. package/build/ts/kcmd/semantic/transpile.js +79 -61
  62. package/build/ts/kcmd/semantic/validate.d.ts +37 -2
  63. package/build/ts/kcmd/semantic/validate.js +467 -126
  64. package/build/ts/kcmd/snapshot.d.ts +4 -0
  65. package/build/ts/kcmd/snapshot.js +7 -0
  66. package/build/ts/kcmd/sync.js +44 -7
  67. package/package.json +1 -1
package/README.md CHANGED
@@ -179,43 +179,41 @@ kcmd push
179
179
  ```
180
180
 
181
181
  For the semantic-model scope, `kcmd push` deploys the model as a property graph
182
- (`CREATE OR REPLACE PROPERTY GRAPH`) to the backend named by the model's GOOGLE
183
- deployment target — **BigQuery Graph** or **Spanner Graph**; the same authored
184
- model deploys to either, and swapping the target switches backends. Pass
185
- `--validate-only` to print the generated DDL without executing it. For a BigQuery
182
+ (`CREATE OR REPLACE PROPERTY GRAPH`) to the backend each entry of the model's
183
+ `deployments` list names in its `target`: **BigQuery Graph** or **Spanner
184
+ Graph**. The same authored model deploys to either. Pass `--validate-only
185
+ --print` to print the generated DDL without executing it. For a BigQuery
186
186
  target this path additionally reads the target dataset's metadata
187
187
  (`bigquery.datasets.get`) to pin the query job's processing location; the call
188
188
  degrades gracefully when the permission is absent, so a narrower service account
189
189
  still works but falls back to BigQuery's own location inference. Each dataset
190
190
  `source` is the table's GCP resource name, such as
191
191
  `bigquery.googleapis.com/projects/<p>/datasets/<d>/tables/<t>`.
192
- (A Spanner target names its tables inside one database, so a `source` is reduced
193
- to its final segment, and Spanner Graph has no `MEASURE`, so metrics are dropped
194
- with a warning.)
195
-
196
- `kcmd push` also deploys the model to Knowledge Catalog (entries for the model,
197
- its entities and metrics, and `schema-join` links for its relationships). A push
198
- has two axes: the binding-profile axis picks how many binding profiles the graph
199
- deploys for (`--no-profile` for none, the default binding, `--profile <name>` for
200
- one, or `--all-profiles` for every one), and each profile's `deployment_target`
201
- selects its backend; `--no-kc` skips the Knowledge Catalog leg. Use `--print` to
202
- dump each destination's generated artifact, and `--force-remove` to delete models
203
- left in the entry group that the push no longer includes. See
204
- [docs/semantic-model/](docs/semantic-model/README.md) for the full guide,
205
- including how re-push reconciles removed entities, metrics, relationships, and
206
- models.
192
+ (A Spanner target names its tables inside one database. Spanner Graph has no
193
+ `MEASURE`, so a Spanner deployment uses a profile that excludes every metric.)
194
+ Spanner Graph needs an Enterprise or Enterprise Plus edition instance, or a free
195
+ trial instance. Push refuses a Spanner target on a Standard edition instance
196
+ before it writes anything.
197
+
198
+ `kcmd push` publishes the model and its sibling profile files to Knowledge
199
+ Catalog before deploying the selected `deployments` entries (see
200
+ [Reference — `kcmd push`](docs/semantic-model/reference.md#push) for
201
+ `--deployment`, `--no-deployment`, `--print`, and `--force-remove`, and
202
+ [docs/semantic-model/](docs/semantic-model/README.md) for the full guide).
207
203
 
208
204
  NOTE: The CLI uses `gcloud` to obtain authentication tokens, so ensure you are authenticated via `gcloud auth application-default login`.
209
205
 
210
206
  #### Environment variables
211
207
 
212
208
  Two optional variables override where `kcmd` talks to the catalog. Both default
213
- to production, so you normally leave them unset.
209
+ to production, so you normally leave them unset. A third, `KC_V2_ASPECTS`, is a
210
+ temporary escape hatch.
214
211
 
215
212
  | Variable | Effect |
216
213
  |----------|--------|
217
214
  | `DATAPLEX_ENDPOINT` | Base URL for the Knowledge Catalog (Dataplex) API. Defaults to `https://dataplex.googleapis.com`. Set it to reach a non-prod host. |
218
215
  | `KC_TYPE_PROJECT` | Project the built-in `semantic-*` system types are read from on a semantic-model push. Defaults to `dataplex-types`. |
216
+ | `KC_V2_ASPECTS` | Push and pull use the second-generation Knowledge Catalog types by default. `KC_V2_ASPECTS=0` temporarily restores the first-generation path, which will be removed; any other value has no effect. |
219
217
 
220
218
  ### MCP Server
221
219