@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
@@ -3,10 +3,7 @@ import { DialectExpression, Entity, Executor, Field, Metric, ProfileSpec, Semant
3
3
  import { DeclaredConcept } from './resolve_inheritance';
4
4
  export interface LoadOptions {
5
5
  dialect?: string;
6
- defaultProject?: string;
7
- defaultDataset?: string;
8
6
  bindingOptional?: boolean;
9
- allowLegacyBareSource?: boolean;
10
7
  sourceDialects?: ReadonlyMap<string, string>;
11
8
  warnUnacceptedSource?: boolean;
12
9
  fieldTextChecked?: boolean;
@@ -63,7 +60,8 @@ declare const expressionSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
63
60
  }, z.core.$strict>>;
64
61
  }, z.core.$strict>]>;
65
62
  export declare function noSqlReason(text: string, dialect: string, entity?: string): string | undefined;
66
- export declare function listed(problems: string[]): string | undefined;
63
+ export declare function listed(problems: string[], conjunction?: string): string | undefined;
64
+ export declare function plural(n: number, one: string, many: string): string;
67
65
  export declare function expressionDocOf(f: Pick<Field, 'expression' | 'dialects' | 'stringForm' | 'importedExpression' | 'importedDialect'>): string | {
68
66
  dialects: DialectExpression[];
69
67
  } | undefined;
@@ -143,7 +141,7 @@ export declare function loadModels(text: string, opts?: LoadOptions): LoadResult
143
141
  * `warnings` rather than thrown.
144
142
  */
145
143
  export declare function fromDocument(doc: unknown, opts?: LoadOptions): LoadResult;
146
- export declare function inferMetricEntities(metric: Pick<Metric, 'name' | 'authoredEntity' | 'expression' | 'importedExpression' | 'importedDialect' | 'dialects'>, entityNames: string[], preferred?: string, impliedDialect?: string, version?: FormatVersion): {
144
+ export declare function inferMetricEntities(metric: Pick<Metric, 'name' | 'authoredEntity' | 'expression' | 'importedExpression' | 'importedDialect' | 'dialects'>, entityNames: string[], preferred?: string, impliedDialect?: string | null, version?: FormatVersion): {
147
145
  referenced: string[];
148
146
  warning?: string;
149
147
  };
@@ -176,6 +174,7 @@ export type SourceTable = {
176
174
  } | {
177
175
  system: 'biglake';
178
176
  catalog: string;
177
+ hive: boolean;
179
178
  } | {
180
179
  system: 'spanner';
181
180
  instance: string;
@@ -196,6 +195,7 @@ export declare const TABLE_FORMS: {
196
195
  cloudsql: string;
197
196
  cloudsqlSchema: string;
198
197
  biglake: string;
198
+ biglakeHive: string;
199
199
  };
200
200
  export declare function fillForm(form: string, parts: string[]): string | undefined;
201
201
  export declare function dottedPartProblem(parts: string[], form: string, service?: boolean): string | undefined;
@@ -222,9 +222,9 @@ export declare function bindsThirdPartyTable(entity: {
222
222
  authoredSource?: string;
223
223
  }): boolean;
224
224
  export declare function dialectLookupKey(source: string): string | undefined;
225
+ export declare function spannerDatabaseOf(source: string): string | undefined;
225
226
  export declare function isGoogleCloudForm(source: string): boolean;
226
- export declare function parseSource(source: string, opts: LoadOptions, ctx: string, warnings?: string[], importHint?: boolean): ParsedSource;
227
- export declare function unquote(part: string): string;
227
+ export declare function parseSource(source: string, opts: LoadOptions, ctx: string, warnings?: string[], importVersion?: FormatVersion): ParsedSource;
228
228
  export declare function bareNameSegments(name: string, bigQuery: boolean): string[];
229
229
  export declare function bareNameParts(name: string, bigQuery: boolean): Array<{
230
230
  text: string;
@@ -248,15 +248,11 @@ export interface LoadedModels {
248
248
  * thrown, mirroring how the deploy legs previously reported it; loader warnings
249
249
  * are prefixed with their document name.
250
250
  *
251
- * A document's `allowLegacyBareSource` sets that load option for that document
252
- * alone.
253
- *
254
251
  * Each document needs the SQL parser as loadModels does, so call
255
252
  * `loadSqlEngine()` first. Without it, this throws the parser's plain Error.
256
253
  */
257
254
  export declare function loadSemanticModels(docs: {
258
255
  name: string;
259
256
  text: string;
260
- allowLegacyBareSource?: boolean;
261
257
  }[], opts?: LoadOptions): LoadedModels;
262
258
  export {};