@google-cloud/kcmd 0.0.0-stage → 0.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.
Files changed (150) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +266 -2
  3. package/build/ts/kcmd/cli.js +19578 -0
  4. package/build/ts/kcmd/gcp/alloydb.d.ts +12 -0
  5. package/build/ts/kcmd/gcp/alloydb.js +70 -0
  6. package/build/ts/kcmd/gcp/api.d.ts +29 -0
  7. package/build/ts/kcmd/gcp/api.js +162 -0
  8. package/build/ts/kcmd/gcp/biglake.d.ts +16 -0
  9. package/build/ts/kcmd/gcp/biglake.js +50 -0
  10. package/build/ts/kcmd/gcp/bigquery.d.ts +57 -0
  11. package/build/ts/kcmd/gcp/bigquery.js +134 -0
  12. package/build/ts/kcmd/gcp/context.d.ts +10 -0
  13. package/build/ts/kcmd/gcp/context.js +74 -0
  14. package/build/ts/kcmd/gcp/crm.d.ts +13 -0
  15. package/build/ts/kcmd/gcp/crm.js +91 -0
  16. package/build/ts/kcmd/gcp/dataplex.d.ts +147 -0
  17. package/build/ts/kcmd/gcp/dataplex.js +406 -0
  18. package/build/ts/kcmd/gcp/index.d.ts +3 -0
  19. package/build/ts/kcmd/gcp/index.js +21 -0
  20. package/build/ts/kcmd/gcp/spanner.d.ts +63 -0
  21. package/build/ts/kcmd/gcp/spanner.js +123 -0
  22. package/build/ts/kcmd/index.d.ts +7 -0
  23. package/build/ts/kcmd/index.js +46 -0
  24. package/build/ts/kcmd/layout.d.ts +16 -0
  25. package/build/ts/kcmd/layout.js +31 -0
  26. package/build/ts/kcmd/layouts/documents.d.ts +24 -0
  27. package/build/ts/kcmd/layouts/documents.js +264 -0
  28. package/build/ts/kcmd/layouts/okf.d.ts +31 -0
  29. package/build/ts/kcmd/layouts/okf.js +344 -0
  30. package/build/ts/kcmd/layouts/semantic-model.d.ts +61 -0
  31. package/build/ts/kcmd/layouts/semantic-model.js +542 -0
  32. package/build/ts/kcmd/layouts/standard.d.ts +13 -0
  33. package/build/ts/kcmd/layouts/standard.js +108 -0
  34. package/build/ts/kcmd/manifest.d.ts +34 -0
  35. package/build/ts/kcmd/manifest.js +262 -0
  36. package/build/ts/kcmd/metadata.d.ts +25 -0
  37. package/build/ts/kcmd/metadata.js +8 -0
  38. package/build/ts/kcmd/okf/catalog_residue.d.ts +14 -0
  39. package/build/ts/kcmd/okf/catalog_residue.js +124 -0
  40. package/build/ts/kcmd/okf/concept.d.ts +14 -0
  41. package/build/ts/kcmd/okf/concept.js +104 -0
  42. package/build/ts/kcmd/okf/concept_to_entry.d.ts +8 -0
  43. package/build/ts/kcmd/okf/concept_to_entry.js +254 -0
  44. package/build/ts/kcmd/okf/init_okf_workspace.d.ts +15 -0
  45. package/build/ts/kcmd/okf/init_okf_workspace.js +115 -0
  46. package/build/ts/kcmd/okf/links.d.ts +23 -0
  47. package/build/ts/kcmd/okf/links.js +468 -0
  48. package/build/ts/kcmd/okf/okf_metadata.d.ts +12 -0
  49. package/build/ts/kcmd/okf/okf_metadata.js +82 -0
  50. package/build/ts/kcmd/semantic/bigquery.d.ts +22 -0
  51. package/build/ts/kcmd/semantic/bigquery.js +525 -0
  52. package/build/ts/kcmd/semantic/binding.d.ts +3 -0
  53. package/build/ts/kcmd/semantic/binding.js +97 -0
  54. package/build/ts/kcmd/semantic/catalog_entry.d.ts +24 -0
  55. package/build/ts/kcmd/semantic/catalog_entry.js +35 -0
  56. package/build/ts/kcmd/semantic/converters/owl/convert.d.ts +26 -0
  57. package/build/ts/kcmd/semantic/converters/owl/convert.js +41 -0
  58. package/build/ts/kcmd/semantic/converters/owl/model.d.ts +98 -0
  59. package/build/ts/kcmd/semantic/converters/owl/model.js +30 -0
  60. package/build/ts/kcmd/semantic/converters/owl/parse.d.ts +11 -0
  61. package/build/ts/kcmd/semantic/converters/owl/parse.js +634 -0
  62. package/build/ts/kcmd/semantic/converters/owl/to_ir.d.ts +19 -0
  63. package/build/ts/kcmd/semantic/converters/owl/to_ir.js +390 -0
  64. package/build/ts/kcmd/semantic/deploy_bigquery.d.ts +20 -0
  65. package/build/ts/kcmd/semantic/deploy_bigquery.js +226 -0
  66. package/build/ts/kcmd/semantic/deploy_knowledge_catalog.d.ts +129 -0
  67. package/build/ts/kcmd/semantic/deploy_knowledge_catalog.js +1396 -0
  68. package/build/ts/kcmd/semantic/deploy_spanner.d.ts +15 -0
  69. package/build/ts/kcmd/semantic/deploy_spanner.js +150 -0
  70. package/build/ts/kcmd/semantic/deployment_target.d.ts +93 -0
  71. package/build/ts/kcmd/semantic/deployment_target.js +379 -0
  72. package/build/ts/kcmd/semantic/graph_ddl.d.ts +34 -0
  73. package/build/ts/kcmd/semantic/graph_ddl.js +563 -0
  74. package/build/ts/kcmd/semantic/import_model.d.ts +50 -0
  75. package/build/ts/kcmd/semantic/import_model.js +1275 -0
  76. package/build/ts/kcmd/semantic/ir.d.ts +589 -0
  77. package/build/ts/kcmd/semantic/ir.js +247 -0
  78. package/build/ts/kcmd/semantic/kc_actions.d.ts +45 -0
  79. package/build/ts/kcmd/semantic/kc_actions.js +531 -0
  80. package/build/ts/kcmd/semantic/kc_constraints.d.ts +44 -0
  81. package/build/ts/kcmd/semantic/kc_constraints.js +279 -0
  82. package/build/ts/kcmd/semantic/kc_converter.d.ts +31 -0
  83. package/build/ts/kcmd/semantic/kc_converter.js +824 -0
  84. package/build/ts/kcmd/semantic/kc_custom_types.d.ts +70 -0
  85. package/build/ts/kcmd/semantic/kc_custom_types.js +828 -0
  86. package/build/ts/kcmd/semantic/kc_entries.d.ts +155 -0
  87. package/build/ts/kcmd/semantic/kc_entries.js +284 -0
  88. package/build/ts/kcmd/semantic/kc_ids.d.ts +103 -0
  89. package/build/ts/kcmd/semantic/kc_ids.js +191 -0
  90. package/build/ts/kcmd/semantic/knowledge_catalog.d.ts +32 -0
  91. package/build/ts/kcmd/semantic/knowledge_catalog.js +1043 -0
  92. package/build/ts/kcmd/semantic/loader.d.ts +262 -0
  93. package/build/ts/kcmd/semantic/loader.js +3440 -0
  94. package/build/ts/kcmd/semantic/names.d.ts +10 -0
  95. package/build/ts/kcmd/semantic/names.js +85 -0
  96. package/build/ts/kcmd/semantic/osi_converter.d.ts +60 -0
  97. package/build/ts/kcmd/semantic/osi_converter.js +911 -0
  98. package/build/ts/kcmd/semantic/parameters.d.ts +18 -0
  99. package/build/ts/kcmd/semantic/parameters.js +152 -0
  100. package/build/ts/kcmd/semantic/pull_kc.d.ts +14 -0
  101. package/build/ts/kcmd/semantic/pull_kc.js +346 -0
  102. package/build/ts/kcmd/semantic/resolve_inheritance.d.ts +54 -0
  103. package/build/ts/kcmd/semantic/resolve_inheritance.js +330 -0
  104. package/build/ts/kcmd/semantic/resolve_profiles.d.ts +250 -0
  105. package/build/ts/kcmd/semantic/resolve_profiles.js +1822 -0
  106. package/build/ts/kcmd/semantic/runtime/agent_tools.d.ts +93 -0
  107. package/build/ts/kcmd/semantic/runtime/agent_tools.js +243 -0
  108. package/build/ts/kcmd/semantic/runtime/dialect.d.ts +13 -0
  109. package/build/ts/kcmd/semantic/runtime/dialect.js +39 -0
  110. package/build/ts/kcmd/semantic/runtime/runtime.d.ts +94 -0
  111. package/build/ts/kcmd/semantic/runtime/runtime.js +318 -0
  112. package/build/ts/kcmd/semantic/runtime/store.d.ts +112 -0
  113. package/build/ts/kcmd/semantic/runtime/store.js +344 -0
  114. package/build/ts/kcmd/semantic/skills.d.ts +110 -0
  115. package/build/ts/kcmd/semantic/skills.js +697 -0
  116. package/build/ts/kcmd/semantic/source_dialect.d.ts +10 -0
  117. package/build/ts/kcmd/semantic/source_dialect.js +261 -0
  118. package/build/ts/kcmd/semantic/source_entries.d.ts +12 -0
  119. package/build/ts/kcmd/semantic/source_entries.js +282 -0
  120. package/build/ts/kcmd/semantic/spanner.d.ts +18 -0
  121. package/build/ts/kcmd/semantic/spanner.js +60 -0
  122. package/build/ts/kcmd/semantic/sql_expr_utils.d.ts +17 -0
  123. package/build/ts/kcmd/semantic/sql_expr_utils.js +221 -0
  124. package/build/ts/kcmd/semantic/sql_identifiers.d.ts +6 -0
  125. package/build/ts/kcmd/semantic/sql_identifiers.js +267 -0
  126. package/build/ts/kcmd/semantic/sql_parser.d.ts +44 -0
  127. package/build/ts/kcmd/semantic/sql_parser.js +378 -0
  128. package/build/ts/kcmd/semantic/transpile.d.ts +74 -0
  129. package/build/ts/kcmd/semantic/transpile.js +563 -0
  130. package/build/ts/kcmd/semantic/validate.d.ts +35 -0
  131. package/build/ts/kcmd/semantic/validate.js +1899 -0
  132. package/build/ts/kcmd/semantic/yaml_options.d.ts +6 -0
  133. package/build/ts/kcmd/semantic/yaml_options.js +58 -0
  134. package/build/ts/kcmd/semantic/yaml_update.d.ts +26 -0
  135. package/build/ts/kcmd/semantic/yaml_update.js +782 -0
  136. package/build/ts/kcmd/snapshot.d.ts +33 -0
  137. package/build/ts/kcmd/snapshot.js +379 -0
  138. package/build/ts/kcmd/source.d.ts +31 -0
  139. package/build/ts/kcmd/source.js +119 -0
  140. package/build/ts/kcmd/sources/bq-dataset.d.ts +17 -0
  141. package/build/ts/kcmd/sources/bq-dataset.js +131 -0
  142. package/build/ts/kcmd/sources/entrygroup.d.ts +21 -0
  143. package/build/ts/kcmd/sources/entrygroup.js +83 -0
  144. package/build/ts/kcmd/sources/kb.d.ts +21 -0
  145. package/build/ts/kcmd/sources/kb.js +82 -0
  146. package/build/ts/kcmd/sources/semantic-model.d.ts +18 -0
  147. package/build/ts/kcmd/sources/semantic-model.js +48 -0
  148. package/build/ts/kcmd/sync.d.ts +35 -0
  149. package/build/ts/kcmd/sync.js +697 -0
  150. package/package.json +62 -4
@@ -0,0 +1,129 @@
1
+ import * as context from '../gcp/context';
2
+ import { CatalogClient, Entry } from '../gcp/dataplex';
3
+ import type { OverviewSidecar } from '../layouts/semantic-model';
4
+ import { FileCopy } from './kc_custom_types';
5
+ import * as kcEmit from './knowledge_catalog';
6
+ import { LoadedModel } from './loader';
7
+ export interface KcDeployOptions {
8
+ project: string;
9
+ location: string;
10
+ entryGroup: string;
11
+ systemTypeProject?: string;
12
+ systemTypeLocation?: string;
13
+ emitExpressions?: boolean;
14
+ v2Aspects?: boolean;
15
+ sourceFiles?: FileCopy[];
16
+ overviews?: ReadonlyMap<string, OverviewSidecar>;
17
+ fileCopyTypeChecked?: boolean;
18
+ onWarnings?: (warnings: readonly string[]) => void;
19
+ validateOnly?: boolean;
20
+ forceRemove?: boolean;
21
+ entryCreateTries?: number;
22
+ entryCreateRetryMs?: number;
23
+ }
24
+ export interface KcDeployResult {
25
+ success: boolean;
26
+ details?: string;
27
+ warnings: string[];
28
+ created: number;
29
+ updated: number;
30
+ deleted: number;
31
+ linked: number;
32
+ unlinked: number;
33
+ plan: string[];
34
+ }
35
+ /** One authored model paired with the catalog resources it emitted. */
36
+ export interface EmittedModel {
37
+ model: string;
38
+ resources: kcEmit.KcResources;
39
+ }
40
+ /**
41
+ * The read-only preflight output handed to `applyKnowledgeCatalog`. Holds the
42
+ * emitted catalog resources, the pre-write entry-group snapshot, any emitter
43
+ * warnings, and the human-readable plan so `applyKnowledgeCatalog` can write
44
+ * without repeating generation or listing.
45
+ */
46
+ export interface KcPreparedDeploy {
47
+ emitted: EmittedModel[];
48
+ existing: Entry[];
49
+ warnings: string[];
50
+ plan: string[];
51
+ }
52
+ /**
53
+ * Runs every read-only check for a Knowledge Catalog push without writing to
54
+ * the catalog.
55
+ *
56
+ * The method performs the following actions:
57
+ * 1. Translates the IR models into catalog resources.
58
+ * 2. Verifies that exactly one model is being deployed and that each file
59
+ * copy fits in one aspect, builds the dry-run plan, and returns early
60
+ * when `opts.validateOnly` is set.
61
+ * 3. Lists the destination entry group and fails if an unrecognized model's
62
+ * anchor entry is present without `--force-remove`.
63
+ * 4. Verifies that every custom entry type and aspect type required by the
64
+ * model exists in the target project. Skips the file-copy type when
65
+ * `opts.fileCopyTypeChecked` is set.
66
+ * 5. Returns the emitted resources, entry-group listing, warnings, and plan
67
+ * as `prepared` for `applyKnowledgeCatalog`.
68
+ * With `opts.v2Aspects` set, step 2 also checks every aspect's size.
69
+ */
70
+ export declare function preflightKnowledgeCatalog(models: LoadedModel[], ctx: context.ApiContext, opts: KcDeployOptions): Promise<{
71
+ prepared?: KcPreparedDeploy;
72
+ result?: KcDeployResult;
73
+ }>;
74
+ /**
75
+ * Writes a preflight-checked Knowledge Catalog deployment.
76
+ *
77
+ * The method performs the following actions:
78
+ * 1. Removes foreign models when `--force-remove` is set.
79
+ * 2. Writes each emitted model's entries and relationship links and deletes
80
+ * any orphaned links and entries.
81
+ */
82
+ export declare function applyKnowledgeCatalog(prepared: KcPreparedDeploy, ctx: context.ApiContext, opts: KcDeployOptions): Promise<KcDeployResult>;
83
+ /**
84
+ * Deploys every authored model's Knowledge Catalog resources.
85
+ *
86
+ * Runs `preflightKnowledgeCatalog` followed by `applyKnowledgeCatalog`, and
87
+ * passes the warnings to `opts.onWarnings` between the two.
88
+ */
89
+ export declare function deployKnowledgeCatalog(models: LoadedModel[], ctx: context.ApiContext, opts: KcDeployOptions): Promise<KcDeployResult>;
90
+ /**
91
+ * Publishes models that are already mapped to catalog resources.
92
+ *
93
+ * Origin-agnostic wrapper over `preflightEmittedModels` and
94
+ * `applyKnowledgeCatalog` for callers with their own emitter (such as LookML).
95
+ */
96
+ export declare function deployEmittedModels(emitted: EmittedModel[], emitWarnings: string[], ctx: context.ApiContext, opts: KcDeployOptions): Promise<KcDeployResult>;
97
+ /** The error for an entry group that would receive more than one model. */
98
+ export declare function oneModelPerEntryGroupMessage(entryGroup: string, models: number): string;
99
+ export declare const MAX_ASPECT_DATA_BYTES: number;
100
+ /**
101
+ * Checks a push's file copies before anything is written. Returns the error
102
+ * to report, or undefined when every copy fits in one aspect and no two file
103
+ * names map to one entry id.
104
+ *
105
+ * Push calls it before any graph deploys. Every copy of a model shares the
106
+ * model's part of the entry id, so two file names collide when their slugs
107
+ * do.
108
+ */
109
+ export declare function checkFileCopies(files: readonly FileCopy[]): string | undefined;
110
+ /**
111
+ * The emitter's warnings for `models` with v2Aspects on, and why push's
112
+ * catalog leg cannot write them: an emit error or an aspect too large to
113
+ * store. Calls no service.
114
+ */
115
+ export declare function checkCatalogAspects(models: LoadedModel[], opts: KcDeployOptions): {
116
+ error?: string;
117
+ warnings: string[];
118
+ };
119
+ /**
120
+ * Checks that each custom type in `typeIds` exists in the destination
121
+ * project. Returns the error to report, or undefined when every one exists.
122
+ *
123
+ * Push also calls it before any graph deploys, for the file-copy type every
124
+ * push with v2Aspects off needs. Push then sets `fileCopyTypeChecked`, so the
125
+ * catalog preflight looks up only the other custom types.
126
+ */
127
+ export declare function checkCustomTypes(cat: CatalogClient, dest: {
128
+ project: string;
129
+ }, typeIds: readonly string[]): Promise<string | undefined>;