@google-cloud/kcmd 0.0.0-stage → 0.2.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/LICENSE +203 -0
- package/README.md +264 -2
- package/build/ts/kcmd/cli.js +20252 -0
- package/build/ts/kcmd/gcp/alloydb.d.ts +12 -0
- package/build/ts/kcmd/gcp/alloydb.js +70 -0
- package/build/ts/kcmd/gcp/api.d.ts +29 -0
- package/build/ts/kcmd/gcp/api.js +162 -0
- package/build/ts/kcmd/gcp/biglake.d.ts +18 -0
- package/build/ts/kcmd/gcp/biglake.js +59 -0
- package/build/ts/kcmd/gcp/bigquery.d.ts +57 -0
- package/build/ts/kcmd/gcp/bigquery.js +134 -0
- package/build/ts/kcmd/gcp/context.d.ts +10 -0
- package/build/ts/kcmd/gcp/context.js +74 -0
- package/build/ts/kcmd/gcp/crm.d.ts +13 -0
- package/build/ts/kcmd/gcp/crm.js +91 -0
- package/build/ts/kcmd/gcp/dataplex.d.ts +147 -0
- package/build/ts/kcmd/gcp/dataplex.js +406 -0
- package/build/ts/kcmd/gcp/index.d.ts +3 -0
- package/build/ts/kcmd/gcp/index.js +21 -0
- package/build/ts/kcmd/gcp/spanner.d.ts +73 -0
- package/build/ts/kcmd/gcp/spanner.js +126 -0
- package/build/ts/kcmd/index.d.ts +7 -0
- package/build/ts/kcmd/index.js +46 -0
- package/build/ts/kcmd/layout.d.ts +16 -0
- package/build/ts/kcmd/layout.js +31 -0
- package/build/ts/kcmd/layouts/documents.d.ts +24 -0
- package/build/ts/kcmd/layouts/documents.js +264 -0
- package/build/ts/kcmd/layouts/okf.d.ts +31 -0
- package/build/ts/kcmd/layouts/okf.js +386 -0
- package/build/ts/kcmd/layouts/semantic-model.d.ts +74 -0
- package/build/ts/kcmd/layouts/semantic-model.js +621 -0
- package/build/ts/kcmd/layouts/standard.d.ts +13 -0
- package/build/ts/kcmd/layouts/standard.js +108 -0
- package/build/ts/kcmd/manifest.d.ts +34 -0
- package/build/ts/kcmd/manifest.js +262 -0
- package/build/ts/kcmd/metadata.d.ts +25 -0
- package/build/ts/kcmd/metadata.js +8 -0
- package/build/ts/kcmd/okf/catalog_residue.d.ts +14 -0
- package/build/ts/kcmd/okf/catalog_residue.js +124 -0
- package/build/ts/kcmd/okf/concept.d.ts +14 -0
- package/build/ts/kcmd/okf/concept.js +110 -0
- package/build/ts/kcmd/okf/concept_to_entry.d.ts +10 -0
- package/build/ts/kcmd/okf/concept_to_entry.js +281 -0
- package/build/ts/kcmd/okf/init_okf_workspace.d.ts +15 -0
- package/build/ts/kcmd/okf/init_okf_workspace.js +113 -0
- package/build/ts/kcmd/okf/links.d.ts +23 -0
- package/build/ts/kcmd/okf/links.js +468 -0
- package/build/ts/kcmd/okf/okf_metadata.d.ts +12 -0
- package/build/ts/kcmd/okf/okf_metadata.js +99 -0
- package/build/ts/kcmd/semantic/bigquery.d.ts +22 -0
- package/build/ts/kcmd/semantic/bigquery.js +469 -0
- package/build/ts/kcmd/semantic/binding.d.ts +3 -0
- package/build/ts/kcmd/semantic/binding.js +92 -0
- package/build/ts/kcmd/semantic/catalog_entry.d.ts +24 -0
- package/build/ts/kcmd/semantic/catalog_entry.js +35 -0
- package/build/ts/kcmd/semantic/converters/owl/convert.d.ts +26 -0
- package/build/ts/kcmd/semantic/converters/owl/convert.js +41 -0
- package/build/ts/kcmd/semantic/converters/owl/model.d.ts +98 -0
- package/build/ts/kcmd/semantic/converters/owl/model.js +30 -0
- package/build/ts/kcmd/semantic/converters/owl/parse.d.ts +11 -0
- package/build/ts/kcmd/semantic/converters/owl/parse.js +634 -0
- package/build/ts/kcmd/semantic/converters/owl/to_ir.d.ts +19 -0
- package/build/ts/kcmd/semantic/converters/owl/to_ir.js +390 -0
- package/build/ts/kcmd/semantic/deploy_bigquery.d.ts +20 -0
- package/build/ts/kcmd/semantic/deploy_bigquery.js +226 -0
- package/build/ts/kcmd/semantic/deploy_knowledge_catalog.d.ts +104 -0
- package/build/ts/kcmd/semantic/deploy_knowledge_catalog.js +1367 -0
- package/build/ts/kcmd/semantic/deploy_spanner.d.ts +15 -0
- package/build/ts/kcmd/semantic/deploy_spanner.js +150 -0
- package/build/ts/kcmd/semantic/deployment_target.d.ts +93 -0
- package/build/ts/kcmd/semantic/deployment_target.js +379 -0
- package/build/ts/kcmd/semantic/graph_ddl.d.ts +44 -0
- package/build/ts/kcmd/semantic/graph_ddl.js +656 -0
- package/build/ts/kcmd/semantic/import_model.d.ts +72 -0
- package/build/ts/kcmd/semantic/import_model.js +1698 -0
- package/build/ts/kcmd/semantic/ir.d.ts +589 -0
- package/build/ts/kcmd/semantic/ir.js +247 -0
- package/build/ts/kcmd/semantic/kc_actions.d.ts +45 -0
- package/build/ts/kcmd/semantic/kc_actions.js +531 -0
- package/build/ts/kcmd/semantic/kc_constraints.d.ts +44 -0
- package/build/ts/kcmd/semantic/kc_constraints.js +279 -0
- package/build/ts/kcmd/semantic/kc_converter.d.ts +37 -0
- package/build/ts/kcmd/semantic/kc_converter.js +839 -0
- package/build/ts/kcmd/semantic/kc_custom_types.d.ts +63 -0
- package/build/ts/kcmd/semantic/kc_custom_types.js +751 -0
- package/build/ts/kcmd/semantic/kc_entries.d.ts +155 -0
- package/build/ts/kcmd/semantic/kc_entries.js +284 -0
- package/build/ts/kcmd/semantic/kc_ids.d.ts +102 -0
- package/build/ts/kcmd/semantic/kc_ids.js +188 -0
- package/build/ts/kcmd/semantic/knowledge_catalog.d.ts +29 -0
- package/build/ts/kcmd/semantic/knowledge_catalog.js +960 -0
- package/build/ts/kcmd/semantic/loader.d.ts +258 -0
- package/build/ts/kcmd/semantic/loader.js +3576 -0
- package/build/ts/kcmd/semantic/names.d.ts +10 -0
- package/build/ts/kcmd/semantic/names.js +85 -0
- package/build/ts/kcmd/semantic/osi_converter.d.ts +60 -0
- package/build/ts/kcmd/semantic/osi_converter.js +910 -0
- package/build/ts/kcmd/semantic/parameters.d.ts +19 -0
- package/build/ts/kcmd/semantic/parameters.js +171 -0
- package/build/ts/kcmd/semantic/pull_kc.d.ts +10 -0
- package/build/ts/kcmd/semantic/pull_kc.js +272 -0
- package/build/ts/kcmd/semantic/resolve_inheritance.d.ts +59 -0
- package/build/ts/kcmd/semantic/resolve_inheritance.js +346 -0
- package/build/ts/kcmd/semantic/resolve_profiles.d.ts +291 -0
- package/build/ts/kcmd/semantic/resolve_profiles.js +2003 -0
- package/build/ts/kcmd/semantic/runtime/agent_tools.d.ts +93 -0
- package/build/ts/kcmd/semantic/runtime/agent_tools.js +243 -0
- package/build/ts/kcmd/semantic/runtime/dialect.d.ts +13 -0
- package/build/ts/kcmd/semantic/runtime/dialect.js +39 -0
- package/build/ts/kcmd/semantic/runtime/runtime.d.ts +88 -0
- package/build/ts/kcmd/semantic/runtime/runtime.js +301 -0
- package/build/ts/kcmd/semantic/runtime/store.d.ts +112 -0
- package/build/ts/kcmd/semantic/runtime/store.js +344 -0
- package/build/ts/kcmd/semantic/skills.d.ts +110 -0
- package/build/ts/kcmd/semantic/skills.js +697 -0
- package/build/ts/kcmd/semantic/source_dialect.d.ts +17 -0
- package/build/ts/kcmd/semantic/source_dialect.js +311 -0
- package/build/ts/kcmd/semantic/source_entries.d.ts +12 -0
- package/build/ts/kcmd/semantic/source_entries.js +341 -0
- package/build/ts/kcmd/semantic/spanner.d.ts +18 -0
- package/build/ts/kcmd/semantic/spanner.js +60 -0
- package/build/ts/kcmd/semantic/sql_expr_utils.d.ts +23 -0
- package/build/ts/kcmd/semantic/sql_expr_utils.js +394 -0
- package/build/ts/kcmd/semantic/sql_identifiers.d.ts +6 -0
- package/build/ts/kcmd/semantic/sql_identifiers.js +267 -0
- package/build/ts/kcmd/semantic/sql_parser.d.ts +47 -0
- package/build/ts/kcmd/semantic/sql_parser.js +400 -0
- package/build/ts/kcmd/semantic/transpile.d.ts +76 -0
- package/build/ts/kcmd/semantic/transpile.js +581 -0
- package/build/ts/kcmd/semantic/validate.d.ts +70 -0
- package/build/ts/kcmd/semantic/validate.js +2266 -0
- package/build/ts/kcmd/semantic/yaml_options.d.ts +6 -0
- package/build/ts/kcmd/semantic/yaml_options.js +58 -0
- package/build/ts/kcmd/semantic/yaml_update.d.ts +26 -0
- package/build/ts/kcmd/semantic/yaml_update.js +782 -0
- package/build/ts/kcmd/snapshot.d.ts +37 -0
- package/build/ts/kcmd/snapshot.js +386 -0
- package/build/ts/kcmd/source.d.ts +31 -0
- package/build/ts/kcmd/source.js +119 -0
- package/build/ts/kcmd/sources/bq-dataset.d.ts +17 -0
- package/build/ts/kcmd/sources/bq-dataset.js +131 -0
- package/build/ts/kcmd/sources/entrygroup.d.ts +21 -0
- package/build/ts/kcmd/sources/entrygroup.js +83 -0
- package/build/ts/kcmd/sources/kb.d.ts +21 -0
- package/build/ts/kcmd/sources/kb.js +82 -0
- package/build/ts/kcmd/sources/semantic-model.d.ts +18 -0
- package/build/ts/kcmd/sources/semantic-model.js +48 -0
- package/build/ts/kcmd/sync.d.ts +35 -0
- package/build/ts/kcmd/sync.js +734 -0
- package/package.json +62 -4
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import { DialectExpression, Entity, Executor, Field, Metric, ProfileSpec, SemanticModel } from './ir';
|
|
3
|
+
import { DeclaredConcept } from './resolve_inheritance';
|
|
4
|
+
export interface LoadOptions {
|
|
5
|
+
dialect?: string;
|
|
6
|
+
bindingOptional?: boolean;
|
|
7
|
+
sourceDialects?: ReadonlyMap<string, string>;
|
|
8
|
+
warnUnacceptedSource?: boolean;
|
|
9
|
+
fieldTextChecked?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface LoadResult {
|
|
12
|
+
models: SemanticModel[];
|
|
13
|
+
warnings: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare class SemanticModelError extends Error {
|
|
16
|
+
}
|
|
17
|
+
export declare const HALF_BOUND_JOIN_PROBLEM: string;
|
|
18
|
+
export declare function joinLengthProblem(from: number, to: number): string;
|
|
19
|
+
export declare function joinLengthMessage(relationship: string, from: number, to: number): string;
|
|
20
|
+
export declare function undefinedEndpointProblem(side: 'from' | 'to', dataset: string): string;
|
|
21
|
+
export declare const DEFAULT_DIALECT = "BIGQUERY";
|
|
22
|
+
export declare const OSSIE_VERSION = "0.2.0.dev0";
|
|
23
|
+
export declare const GOOGLE_VERSION = "0.2.0.dev0/google";
|
|
24
|
+
/**
|
|
25
|
+
* The declared format version, as stored on the IR
|
|
26
|
+
* (`SemanticModel.version`).
|
|
27
|
+
*/
|
|
28
|
+
export type FormatVersion = NonNullable<SemanticModel['version']>;
|
|
29
|
+
export declare function isFormatVersion(v: string): v is FormatVersion;
|
|
30
|
+
/**
|
|
31
|
+
* The location of an IR construct in documents of a given format version:
|
|
32
|
+
* - `'native'`: a direct key on the YAML object (`deployments:`, `extends:`)
|
|
33
|
+
* - `'file'`: a `<model>.profile.<name>.yaml` sidecar file (`profiles`)
|
|
34
|
+
* - `'block'`: a `GOOGLE` `custom_extensions` block on the owning YAML object
|
|
35
|
+
* - `'none'`: unsupported in this format version (rejected on load, warned and
|
|
36
|
+
* omitted on write)
|
|
37
|
+
*/
|
|
38
|
+
export type ConstructPlacement = 'native' | 'file' | 'block' | 'none';
|
|
39
|
+
type Placements<K extends string> = Readonly<Record<K, ConstructPlacement>>;
|
|
40
|
+
/**
|
|
41
|
+
* The construct placements for a single format version, grouped by owning YAML
|
|
42
|
+
* object level.
|
|
43
|
+
*/
|
|
44
|
+
export interface ConstructPlacements {
|
|
45
|
+
readonly model: Placements<'profiles' | 'deployments' | 'actions' | 'constraints'>;
|
|
46
|
+
readonly dataset: Placements<'extends' | 'abstract'>;
|
|
47
|
+
readonly relationship: Placements<'description'>;
|
|
48
|
+
readonly metric: Placements<'entity'>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Where each format version places each Google extension construct. Other
|
|
52
|
+
* differences between the versions, such as required bindings and datatype
|
|
53
|
+
* casing, are checked where they are read.
|
|
54
|
+
*/
|
|
55
|
+
export declare const FORMAT_VERSION_PLACEMENT: Readonly<Record<FormatVersion, ConstructPlacements>>;
|
|
56
|
+
declare const expressionSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
57
|
+
dialects: z.ZodArray<z.ZodObject<{
|
|
58
|
+
dialect: z.ZodString;
|
|
59
|
+
expression: z.ZodString;
|
|
60
|
+
}, z.core.$strict>>;
|
|
61
|
+
}, z.core.$strict>]>;
|
|
62
|
+
export declare function noSqlReason(text: string, dialect: string, entity?: 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;
|
|
65
|
+
export declare function expressionDocOf(f: Pick<Field, 'expression' | 'dialects' | 'stringForm' | 'importedExpression' | 'importedDialect'>): string | {
|
|
66
|
+
dialects: DialectExpression[];
|
|
67
|
+
} | undefined;
|
|
68
|
+
export declare function noSqlProblemOf(x: Pick<Field, 'expression' | 'dialects' | 'stringForm' | 'importedExpression' | 'importedDialect'>, entity?: string): string | undefined;
|
|
69
|
+
export declare function inheritedNoSqlProblems(entities: Entity[], concepts: Map<string, DeclaredConcept>, problemOf?: (f: Field, entity?: string) => string | undefined): string[];
|
|
70
|
+
type ExpressionDoc = z.infer<typeof expressionSchema>;
|
|
71
|
+
export declare const GOOGLE_VENDOR = "GOOGLE";
|
|
72
|
+
export declare function isGoogleVendor(vendorName: unknown): boolean;
|
|
73
|
+
export declare function hasGoogleBlock(exts: ReadonlyArray<{
|
|
74
|
+
vendor_name?: unknown;
|
|
75
|
+
}> | undefined): boolean;
|
|
76
|
+
export declare function setsAKeyTwice(data: string): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* The profiles the model in a vanilla document carries in its GOOGLE blocks,
|
|
79
|
+
* read as a load reads them, without loading the rest of the model. So a
|
|
80
|
+
* caller finds a profile even in a model that does not load, as it finds a
|
|
81
|
+
* profile file. Only the profiles in the model's GOOGLE blocks are read, and
|
|
82
|
+
* the load reports a problem with any other key. Empty for a document that is
|
|
83
|
+
* not a vanilla model.
|
|
84
|
+
*
|
|
85
|
+
* A profile's field binding that is not blank needs the SQL parser, so call
|
|
86
|
+
* `loadSqlEngine()` first. Without it, this throws the parser's plain Error.
|
|
87
|
+
*
|
|
88
|
+
* A GOOGLE block whose shape the load rejects is read too, and the load
|
|
89
|
+
* reports its shape. Its profiles may be in data written as a JSON string or
|
|
90
|
+
* as a YAML mapping, or listed beside `vendor_name` with no data. Throws
|
|
91
|
+
* SemanticModelError on profiles a load rejects, on data that sets `profiles`
|
|
92
|
+
* twice or a key twice inside them, and on data that is not a JSON object in
|
|
93
|
+
* a block whose shape the load accepts.
|
|
94
|
+
*
|
|
95
|
+
* Text that is not valid YAML is read as far as it parses. A document whose
|
|
96
|
+
* root keys are all strings, and that sets `version` once, to a string other
|
|
97
|
+
* than the vanilla one, gives none when each YAML error is a key set twice, an
|
|
98
|
+
* alias whose anchor is not set, or more aliases than a load expands. Otherwise
|
|
99
|
+
* its profiles are read as in text that parses, and only when that reading is
|
|
100
|
+
* unambiguous. Each YAML error is a key set twice or an alias whose anchor is
|
|
101
|
+
* not set, since any other error, such as a bad indent, can move the blocks,
|
|
102
|
+
* cut them short or change the version. The document sets `version` once, to
|
|
103
|
+
* the vanilla one, and `semantic_model` at most once. Its model sets
|
|
104
|
+
* `custom_extensions` at most once, and each block that is a mapping sets
|
|
105
|
+
* `vendor_name` once, to a string. A GOOGLE block sets `data` and `profiles` at
|
|
106
|
+
* most once each, and holds no alias. Every key of a mapping on that path is a
|
|
107
|
+
* string, so not an alias or a merge key, and no value on it is an alias. No
|
|
108
|
+
* key is set twice inside `custom_extensions`. When any of these fails, when a
|
|
109
|
+
* GOOGLE block cannot be read, or when a load rejects its profiles, it throws
|
|
110
|
+
* the error a load reports for the text. So does a vanilla model whose text has
|
|
111
|
+
* more aliases than a load expands, or a merge key whose value is not a
|
|
112
|
+
* mapping.
|
|
113
|
+
*/
|
|
114
|
+
export declare function googleBlockProfiles(text: string): ProfileSpec[];
|
|
115
|
+
/**
|
|
116
|
+
* The `version` the model document `text` sets, as googleBlockProfiles reads
|
|
117
|
+
* it. Valid YAML gives its version. Past a YAML error, the version is read
|
|
118
|
+
* only when every root key is a string and the root sets `version` once, to a
|
|
119
|
+
* string. Each error must be a key set twice, an alias whose anchor is not
|
|
120
|
+
* set, or more aliases than a load expands. Undefined otherwise, and when the
|
|
121
|
+
* text sets no string version.
|
|
122
|
+
*/
|
|
123
|
+
export declare function modelDocumentVersion(text: string): string | undefined;
|
|
124
|
+
export declare function isRecord(v: unknown): v is Record<string, any>;
|
|
125
|
+
export declare function modelAiContexts(doc: unknown): Generator<{
|
|
126
|
+
ai: Record<string, unknown>;
|
|
127
|
+
label: string;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Loads YAML or JSON text (a document in the AI-first semantics format) into
|
|
131
|
+
* the Semantic Model IR. `yaml.parse` accepts JSON too, so both are supported.
|
|
132
|
+
*
|
|
133
|
+
* A document with a field or metric expression that is not blank needs the SQL
|
|
134
|
+
* parser, so call `loadSqlEngine()` first. Without it, this throws a plain
|
|
135
|
+
* Error instead of a SemanticModelError.
|
|
136
|
+
*/
|
|
137
|
+
export declare function loadModels(text: string, opts?: LoadOptions): LoadResult;
|
|
138
|
+
/**
|
|
139
|
+
* Converts an already-parsed document object into the Semantic Model IR. Throws
|
|
140
|
+
* on a structurally invalid document; softer, lossy conversions are reported in
|
|
141
|
+
* `warnings` rather than thrown.
|
|
142
|
+
*/
|
|
143
|
+
export declare function fromDocument(doc: unknown, opts?: LoadOptions): LoadResult;
|
|
144
|
+
export declare function inferMetricEntities(metric: Pick<Metric, 'name' | 'authoredEntity' | 'expression' | 'importedExpression' | 'importedDialect' | 'dialects'>, entityNames: string[], preferred?: string, impliedDialect?: string | null, version?: FormatVersion): {
|
|
145
|
+
referenced: string[];
|
|
146
|
+
warning?: string;
|
|
147
|
+
};
|
|
148
|
+
export declare function entityAndMetricWarnings(model: SemanticModel, preferred?: string, profiled?: boolean): string[];
|
|
149
|
+
type FieldExpression = Pick<Field, 'expression' | 'dialects' | 'stringForm' | 'importedExpression' | 'importedDialect'>;
|
|
150
|
+
export declare function parseFieldExpression(raw: unknown, where: string, dialect: string, entity: string): FieldExpression;
|
|
151
|
+
export declare function readFieldExpression(raw: unknown, where: string, dialect: string, problemOf: (doc: ExpressionDoc) => string | undefined): FieldExpression;
|
|
152
|
+
export declare function parseFieldBinding(binding: Pick<Field, 'expression' | 'dialects' | 'stringForm' | 'importedExpression' | 'importedDialect'>, where: string, dialect: string, entity: string): FieldExpression;
|
|
153
|
+
export declare function parseExecutor(raw: unknown, where: string): Executor;
|
|
154
|
+
interface ParsedSource {
|
|
155
|
+
dataSource: string;
|
|
156
|
+
authoredSource: string;
|
|
157
|
+
sourceDialect?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface CloudSqlTable {
|
|
160
|
+
project: string;
|
|
161
|
+
location: string;
|
|
162
|
+
instance: string;
|
|
163
|
+
resourceName: string;
|
|
164
|
+
inSchema: boolean;
|
|
165
|
+
}
|
|
166
|
+
export declare function cloudSqlTableOf(source: string): CloudSqlTable | undefined;
|
|
167
|
+
export type SourceTable = {
|
|
168
|
+
resourceName: string;
|
|
169
|
+
project: string;
|
|
170
|
+
} & ({
|
|
171
|
+
system: 'bigquery';
|
|
172
|
+
dataset: string;
|
|
173
|
+
table: string;
|
|
174
|
+
} | {
|
|
175
|
+
system: 'biglake';
|
|
176
|
+
catalog: string;
|
|
177
|
+
hive: boolean;
|
|
178
|
+
} | {
|
|
179
|
+
system: 'spanner';
|
|
180
|
+
instance: string;
|
|
181
|
+
} | {
|
|
182
|
+
system: 'alloydb';
|
|
183
|
+
location: string;
|
|
184
|
+
});
|
|
185
|
+
export declare function sourceTableOf(source: string): SourceTable | undefined;
|
|
186
|
+
export declare function asResourceUri(value: string): string;
|
|
187
|
+
export declare function asResourceName(value: string): string;
|
|
188
|
+
export declare function resourceUriFix(uri: string): string;
|
|
189
|
+
export declare function oldSourceForm(source: string): string | undefined;
|
|
190
|
+
export declare const NO_SPACE = "kcmd cannot name a table whose name holds a space";
|
|
191
|
+
export declare const TABLE_FORMS: {
|
|
192
|
+
bigquery: string;
|
|
193
|
+
spanner: string;
|
|
194
|
+
alloydb: string;
|
|
195
|
+
cloudsql: string;
|
|
196
|
+
cloudsqlSchema: string;
|
|
197
|
+
biglake: string;
|
|
198
|
+
biglakeHive: string;
|
|
199
|
+
};
|
|
200
|
+
export declare function fillForm(form: string, parts: string[]): string | undefined;
|
|
201
|
+
export declare function dottedPartProblem(parts: string[], form: string, service?: boolean): string | undefined;
|
|
202
|
+
export declare function catalogNameSegments(path: string, colons?: boolean): string[];
|
|
203
|
+
export declare function hasUnquotedWhitespace(source: string): boolean;
|
|
204
|
+
export declare function databaseOf(written: string): string | undefined;
|
|
205
|
+
export declare function isAcceptedSource(source: string | undefined): boolean;
|
|
206
|
+
export declare function writtenSource(entity: {
|
|
207
|
+
authoredSource?: string;
|
|
208
|
+
dataSource?: string;
|
|
209
|
+
}): string;
|
|
210
|
+
export declare function sourceToDataSource(source: string): string;
|
|
211
|
+
export declare const DIALECT_OF_ENTRY_TYPE: Record<string, string>;
|
|
212
|
+
export declare const DIALECT_OF_FQN_PREFIX: Map<string, string>;
|
|
213
|
+
export declare const ENTRY_NAME_FORM = "projects/<p>/locations/<l>/entryGroups/<g>/entries/<id>";
|
|
214
|
+
export declare const THIRD_PARTY_SOURCE: string;
|
|
215
|
+
export interface ThirdPartyEntry {
|
|
216
|
+
project: string;
|
|
217
|
+
location: string;
|
|
218
|
+
name: string;
|
|
219
|
+
}
|
|
220
|
+
export declare function thirdPartyEntryOf(source: string): ThirdPartyEntry | undefined;
|
|
221
|
+
export declare function bindsThirdPartyTable(entity: {
|
|
222
|
+
authoredSource?: string;
|
|
223
|
+
}): boolean;
|
|
224
|
+
export declare function dialectLookupKey(source: string): string | undefined;
|
|
225
|
+
export declare function spannerDatabaseOf(source: string): string | undefined;
|
|
226
|
+
export declare function isGoogleCloudForm(source: string): boolean;
|
|
227
|
+
export declare function parseSource(source: string, opts: LoadOptions, ctx: string, warnings?: string[], importVersion?: FormatVersion): ParsedSource;
|
|
228
|
+
export declare function bareNameSegments(name: string, bigQuery: boolean): string[];
|
|
229
|
+
export declare function bareNameParts(name: string, bigQuery: boolean): Array<{
|
|
230
|
+
text: string;
|
|
231
|
+
quoted: boolean;
|
|
232
|
+
}>;
|
|
233
|
+
export interface LoadedModel {
|
|
234
|
+
document: string;
|
|
235
|
+
model: SemanticModel;
|
|
236
|
+
}
|
|
237
|
+
export interface LoadedModels {
|
|
238
|
+
models: LoadedModel[];
|
|
239
|
+
warnings: string[];
|
|
240
|
+
error?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Loads every authored document into the IR once, so a multi-destination push
|
|
244
|
+
* parses and validates each model a single time and fans the result out to each
|
|
245
|
+
* deploy leg (BigQuery, Knowledge Catalog) rather than re-parsing per leg.
|
|
246
|
+
*
|
|
247
|
+
* A parse/schema error is returned as `error` (naming the document) rather than
|
|
248
|
+
* thrown, mirroring how the deploy legs previously reported it; loader warnings
|
|
249
|
+
* are prefixed with their document name.
|
|
250
|
+
*
|
|
251
|
+
* Each document needs the SQL parser as loadModels does, so call
|
|
252
|
+
* `loadSqlEngine()` first. Without it, this throws the parser's plain Error.
|
|
253
|
+
*/
|
|
254
|
+
export declare function loadSemanticModels(docs: {
|
|
255
|
+
name: string;
|
|
256
|
+
text: string;
|
|
257
|
+
}[], opts?: LoadOptions): LoadedModels;
|
|
258
|
+
export {};
|