@prismatic-io/components-google-cloud-bigquery 0.0.0-stage → 0.0.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/README.md +64 -2
- package/dist/icon.png +0 -0
- package/dist/index.js +813 -0
- package/dist/oauth-button.png +0 -0
- package/npm-dist/icon.png +0 -0
- package/npm-dist/index.cjs +3187 -0
- package/npm-dist/index.d.cts +3496 -0
- package/npm-dist/oauth-button.png +0 -0
- package/package.json +50 -4
|
@@ -0,0 +1,3187 @@
|
|
|
1
|
+
let _prismatic_io_spectral = require("@prismatic-io/spectral");
|
|
2
|
+
let googleapis = require("googleapis");
|
|
3
|
+
let _prismatic_io_spectral_http = require("@prismatic-io/spectral/http");
|
|
4
|
+
//#region src/connections/index.ts
|
|
5
|
+
const googleConnection = (0, _prismatic_io_spectral.oauth2Connection)({
|
|
6
|
+
key: "oauth2",
|
|
7
|
+
display: {
|
|
8
|
+
label: "OAuth 2.0",
|
|
9
|
+
description: "Authenticate using OAuth 2.0",
|
|
10
|
+
icons: { oauth2ConnectionIconPath: "oauth-button.png" }
|
|
11
|
+
},
|
|
12
|
+
oauth2Type: _prismatic_io_spectral.OAuth2Type.AuthorizationCode,
|
|
13
|
+
inputs: {
|
|
14
|
+
authorizeUrl: {
|
|
15
|
+
label: "Authorize URL",
|
|
16
|
+
placeholder: "Authorization URL",
|
|
17
|
+
type: "string",
|
|
18
|
+
required: true,
|
|
19
|
+
shown: false,
|
|
20
|
+
comments: "The Authorization URL for Google BigQuery.",
|
|
21
|
+
default: "https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=consent"
|
|
22
|
+
},
|
|
23
|
+
tokenUrl: {
|
|
24
|
+
label: "Token URL",
|
|
25
|
+
placeholder: "Token URL",
|
|
26
|
+
type: "string",
|
|
27
|
+
required: true,
|
|
28
|
+
shown: false,
|
|
29
|
+
comments: "The Token URL for Google BigQuery.",
|
|
30
|
+
default: "https://oauth2.googleapis.com/token"
|
|
31
|
+
},
|
|
32
|
+
scopes: {
|
|
33
|
+
label: "Scopes",
|
|
34
|
+
placeholder: "Scopes",
|
|
35
|
+
type: "string",
|
|
36
|
+
required: true,
|
|
37
|
+
comments: "Space delimited listing of scopes. https://developers.google.com/identity/protocols/oauth2/scopes#bigquery",
|
|
38
|
+
default: "https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/bigquery.insertdata https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloud-platform.read-only https://www.googleapis.com/auth/devstorage.full_control https://www.googleapis.com/auth/devstorage.read_only https://www.googleapis.com/auth/devstorage.read_write"
|
|
39
|
+
},
|
|
40
|
+
clientId: {
|
|
41
|
+
label: "Client ID",
|
|
42
|
+
placeholder: "Client Identifier",
|
|
43
|
+
type: "string",
|
|
44
|
+
required: true,
|
|
45
|
+
comments: "The Google BigQuery app's Client Identifier."
|
|
46
|
+
},
|
|
47
|
+
clientSecret: {
|
|
48
|
+
label: "Client Secret",
|
|
49
|
+
placeholder: "Client Secret",
|
|
50
|
+
type: "password",
|
|
51
|
+
required: true,
|
|
52
|
+
comments: "The Google BigQuery app's Client Secret."
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const googleServiceAccount = (0, _prismatic_io_spectral.connection)({
|
|
57
|
+
key: "googleServiceAccount",
|
|
58
|
+
display: {
|
|
59
|
+
label: "Private Key",
|
|
60
|
+
description: "Authenticate using a private key"
|
|
61
|
+
},
|
|
62
|
+
inputs: {
|
|
63
|
+
clientEmail: {
|
|
64
|
+
label: "Client Email",
|
|
65
|
+
placeholder: "Client Email",
|
|
66
|
+
type: "string",
|
|
67
|
+
required: true,
|
|
68
|
+
example: "someone@example.com",
|
|
69
|
+
shown: true,
|
|
70
|
+
comments: "The email address of the client to connect."
|
|
71
|
+
},
|
|
72
|
+
privateKey: {
|
|
73
|
+
label: "Private Key",
|
|
74
|
+
placeholder: "Private Key",
|
|
75
|
+
type: "text",
|
|
76
|
+
required: true,
|
|
77
|
+
shown: true,
|
|
78
|
+
comments: "The private key of the client to connect."
|
|
79
|
+
},
|
|
80
|
+
scopes: {
|
|
81
|
+
label: "Scopes",
|
|
82
|
+
placeholder: "Scopes",
|
|
83
|
+
type: "string",
|
|
84
|
+
required: true,
|
|
85
|
+
example: "https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloud-platform.read-only",
|
|
86
|
+
default: "https://www.googleapis.com/auth/bigquery https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloud-platform.read-only",
|
|
87
|
+
shown: false,
|
|
88
|
+
comments: "Space delimited listing of scopes. https://developers.google.com/identity/protocols/oauth2/scopes#bigquery"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
var connections_default = [googleConnection, googleServiceAccount];
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/client.ts
|
|
95
|
+
const validateConnection = (connection) => {
|
|
96
|
+
if (connection.key !== googleConnection.key && connection.key !== googleServiceAccount.key) throw new _prismatic_io_spectral.ConnectionError(connection, "Unknown Connection type provided.");
|
|
97
|
+
if (!connection.token?.access_token && !connection.fields.privateKey && !connection.fields.clientEmail && !connection.fields.scopes) throw new _prismatic_io_spectral.ConnectionError(connection, "Received valid Connection type but did not find valid access token.");
|
|
98
|
+
};
|
|
99
|
+
const generateAuthentication = (connection) => {
|
|
100
|
+
if (connection.key === googleServiceAccount.key) {
|
|
101
|
+
const { clientEmail, privateKey, scopes } = connection.fields;
|
|
102
|
+
const scopesArray = _prismatic_io_spectral.util.types.toString(scopes).split(" ");
|
|
103
|
+
return new googleapis.google.auth.GoogleAuth({
|
|
104
|
+
credentials: {
|
|
105
|
+
client_email: _prismatic_io_spectral.util.types.toString(clientEmail),
|
|
106
|
+
private_key: _prismatic_io_spectral.util.types.toString(privateKey).replace(/\\n/g, "\n")
|
|
107
|
+
},
|
|
108
|
+
scopes: scopesArray
|
|
109
|
+
});
|
|
110
|
+
} else if (connection.key === googleConnection.key) {
|
|
111
|
+
const oauth2Client = new googleapis.google.auth.OAuth2(_prismatic_io_spectral.util.types.toString(connection.fields.clientId), _prismatic_io_spectral.util.types.toString(connection.fields.clientSecret));
|
|
112
|
+
const token = _prismatic_io_spectral.util.types.toString(connection.token?.access_token);
|
|
113
|
+
oauth2Client.setCredentials({ access_token: token });
|
|
114
|
+
return oauth2Client;
|
|
115
|
+
}
|
|
116
|
+
throw new _prismatic_io_spectral.ConnectionError(connection, "Unknown Connection type provided.");
|
|
117
|
+
};
|
|
118
|
+
const createClient = (connection) => {
|
|
119
|
+
validateConnection(connection);
|
|
120
|
+
const auth = generateAuthentication(connection);
|
|
121
|
+
return googleapis.google.bigquery({
|
|
122
|
+
version: "v2",
|
|
123
|
+
auth
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/constants.ts
|
|
128
|
+
const LOOK_BACK_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/util/index.ts
|
|
131
|
+
const cleanString = (value) => {
|
|
132
|
+
const str = _prismatic_io_spectral.util.types.toString(value);
|
|
133
|
+
return str ? str : void 0;
|
|
134
|
+
};
|
|
135
|
+
const jsonInputClean = (value) => {
|
|
136
|
+
if (typeof value === "string") {
|
|
137
|
+
if (value.trim() !== "") return JSON.parse(value);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (value !== null && value !== void 0) return value;
|
|
141
|
+
};
|
|
142
|
+
const valueListInputClean = (value) => {
|
|
143
|
+
if (Array.isArray(value) && value.length >= 1 && value[0] !== "000xxx") return value;
|
|
144
|
+
};
|
|
145
|
+
const lookBackDateClean = (value) => {
|
|
146
|
+
if (value === void 0 || value === null || typeof value === "string" && value.trim() === "") return "";
|
|
147
|
+
const raw = typeof value === "string" ? value.trim() : String(value);
|
|
148
|
+
const match = typeof value === "string" ? raw.match(LOOK_BACK_DATE_PATTERN) : null;
|
|
149
|
+
if (!match) throw new Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${raw}`);
|
|
150
|
+
const [, yearStr, monthStr, dayStr] = match;
|
|
151
|
+
const year = Number(yearStr);
|
|
152
|
+
const month = Number(monthStr);
|
|
153
|
+
const day = Number(dayStr);
|
|
154
|
+
const parsed = new Date(Date.UTC(year, month - 1, day));
|
|
155
|
+
if (parsed.getUTCFullYear() !== year || parsed.getUTCMonth() !== month - 1 || parsed.getUTCDate() !== day) throw new Error(`Look-back Date must be a date in YYYY-MM-DD format. Received: ${raw}`);
|
|
156
|
+
if (parsed.getTime() > Date.now()) throw new Error(`Look-back Date cannot be a future date. Received: ${raw}`);
|
|
157
|
+
return parsed.toISOString();
|
|
158
|
+
};
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/inputs/common.ts
|
|
161
|
+
const connectionInput = (0, _prismatic_io_spectral.input)({
|
|
162
|
+
label: "Connection",
|
|
163
|
+
type: "connection",
|
|
164
|
+
required: true,
|
|
165
|
+
comments: "The Google Cloud BigQuery connection to use."
|
|
166
|
+
});
|
|
167
|
+
const projectId = (0, _prismatic_io_spectral.input)({
|
|
168
|
+
label: "Project ID",
|
|
169
|
+
type: "string",
|
|
170
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
171
|
+
comments: "The unique identifier for the Google Cloud project.",
|
|
172
|
+
example: "my-project-12345",
|
|
173
|
+
placeholder: "Enter project ID",
|
|
174
|
+
required: true,
|
|
175
|
+
dataSource: "projectsNames"
|
|
176
|
+
});
|
|
177
|
+
const datasetId = (0, _prismatic_io_spectral.input)({
|
|
178
|
+
label: "Dataset ID",
|
|
179
|
+
type: "string",
|
|
180
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
181
|
+
comments: "The unique identifier for the dataset.",
|
|
182
|
+
example: "my_dataset",
|
|
183
|
+
placeholder: "Enter dataset ID",
|
|
184
|
+
required: true,
|
|
185
|
+
dataSource: "selectDataset"
|
|
186
|
+
});
|
|
187
|
+
const tableId = (0, _prismatic_io_spectral.input)({
|
|
188
|
+
label: "Table ID",
|
|
189
|
+
type: "string",
|
|
190
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
191
|
+
comments: "The unique identifier for the table.",
|
|
192
|
+
example: "my_table",
|
|
193
|
+
placeholder: "Enter table ID",
|
|
194
|
+
required: true,
|
|
195
|
+
dataSource: "tablesNames"
|
|
196
|
+
});
|
|
197
|
+
const maxResults = (0, _prismatic_io_spectral.input)({
|
|
198
|
+
label: "Max Results",
|
|
199
|
+
type: "string",
|
|
200
|
+
clean: _prismatic_io_spectral.util.types.toNumber,
|
|
201
|
+
comments: "The maximum number of results to return in a single response page. Leverage the page tokens to iterate through the entire collection.",
|
|
202
|
+
example: "100",
|
|
203
|
+
placeholder: "Enter maximum results",
|
|
204
|
+
required: false
|
|
205
|
+
});
|
|
206
|
+
const pageToken = (0, _prismatic_io_spectral.input)({
|
|
207
|
+
label: "Page Token",
|
|
208
|
+
type: "string",
|
|
209
|
+
clean: cleanString,
|
|
210
|
+
comments: "Page token returned by a previous call to request the next page of results.",
|
|
211
|
+
example: "CAESBAgCIAE",
|
|
212
|
+
placeholder: "Enter page token",
|
|
213
|
+
required: false
|
|
214
|
+
});
|
|
215
|
+
const filter = (0, _prismatic_io_spectral.input)({
|
|
216
|
+
label: "Filter",
|
|
217
|
+
type: "string",
|
|
218
|
+
clean: cleanString,
|
|
219
|
+
comments: "An expression for filtering the results of the request by label. The syntax is 'labels.<name>[:<value>]'. Multiple filters can be ANDed together by connecting with a space. Example: 'labels.department:receiving labels.active'. See [Filtering datasets](https://cloud.google.com/bigquery/docs/labeling-datasets#filtering_datasets_using_labels) using labels for details.",
|
|
220
|
+
example: "labels.department:receiving labels.active",
|
|
221
|
+
placeholder: "Enter filter expression",
|
|
222
|
+
required: false
|
|
223
|
+
});
|
|
224
|
+
const selectedFields = (0, _prismatic_io_spectral.input)({
|
|
225
|
+
label: "Selected Fields",
|
|
226
|
+
type: "string",
|
|
227
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
228
|
+
comments: "tabledata.list of table schema fields to return (comma-separated). If unspecified, all fields are returned. A fieldMask cannot be used here because the fields will automatically be converted from camelCase to snake_case and the conversion will fail if there are underscores. Since these are fields in BigQuery table schemas, underscores are allowed.",
|
|
229
|
+
placeholder: "Enter selected fields",
|
|
230
|
+
required: false
|
|
231
|
+
});
|
|
232
|
+
const startIndex = (0, _prismatic_io_spectral.input)({
|
|
233
|
+
label: "Start Index",
|
|
234
|
+
type: "string",
|
|
235
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
236
|
+
comments: "Zero-based index of the starting row.",
|
|
237
|
+
example: "0",
|
|
238
|
+
placeholder: "Enter start index",
|
|
239
|
+
required: false
|
|
240
|
+
});
|
|
241
|
+
const kind = (0, _prismatic_io_spectral.input)({
|
|
242
|
+
label: "Kind",
|
|
243
|
+
type: "string",
|
|
244
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
245
|
+
comments: "Output only. The resource type.",
|
|
246
|
+
example: "bigquery#dataset",
|
|
247
|
+
placeholder: "Enter resource kind",
|
|
248
|
+
required: false
|
|
249
|
+
});
|
|
250
|
+
const etag = (0, _prismatic_io_spectral.input)({
|
|
251
|
+
label: "ETag",
|
|
252
|
+
type: "string",
|
|
253
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
254
|
+
comments: "Output only. A hash of the resource.",
|
|
255
|
+
example: "W/\"abc123def456\"",
|
|
256
|
+
placeholder: "Enter ETag",
|
|
257
|
+
required: false
|
|
258
|
+
});
|
|
259
|
+
const id = (0, _prismatic_io_spectral.input)({
|
|
260
|
+
label: "ID",
|
|
261
|
+
type: "string",
|
|
262
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
263
|
+
comments: "Output only. The fully-qualified unique name of the dataset in the format projectId:datasetId. The dataset name without the project name is given in the datasetId field. When creating a new dataset, leave this field blank, and instead specify the datasetId field.",
|
|
264
|
+
example: "my-project:my_dataset",
|
|
265
|
+
placeholder: "Enter ID",
|
|
266
|
+
required: false
|
|
267
|
+
});
|
|
268
|
+
const selfLink = (0, _prismatic_io_spectral.input)({
|
|
269
|
+
label: "Self Link",
|
|
270
|
+
type: "string",
|
|
271
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
272
|
+
comments: "Output only. A URL that can be used to access the resource again. You can use this URL in Get or Update requests to the resource.",
|
|
273
|
+
example: "https://bigquery.googleapis.com/bigquery/v2/projects/my-project/datasets/my_dataset",
|
|
274
|
+
placeholder: "Enter self link",
|
|
275
|
+
required: false
|
|
276
|
+
});
|
|
277
|
+
const friendlyName = (0, _prismatic_io_spectral.input)({
|
|
278
|
+
label: "Friendly Name",
|
|
279
|
+
type: "string",
|
|
280
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
281
|
+
comments: "Optional. A descriptive name for the dataset.",
|
|
282
|
+
example: "My Dataset",
|
|
283
|
+
placeholder: "Enter friendly name",
|
|
284
|
+
required: false
|
|
285
|
+
});
|
|
286
|
+
const description = (0, _prismatic_io_spectral.input)({
|
|
287
|
+
label: "Description",
|
|
288
|
+
type: "string",
|
|
289
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
290
|
+
comments: "Optional. A descriptive name for the dataset.",
|
|
291
|
+
example: "This dataset contains sales data",
|
|
292
|
+
placeholder: "Enter description",
|
|
293
|
+
required: false
|
|
294
|
+
});
|
|
295
|
+
const creationTime = (0, _prismatic_io_spectral.input)({
|
|
296
|
+
label: "Creation Time",
|
|
297
|
+
type: "string",
|
|
298
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
299
|
+
comments: "Output only. The time when this dataset was created, in milliseconds since the epoch.",
|
|
300
|
+
example: "1609459200000",
|
|
301
|
+
placeholder: "Enter creation time",
|
|
302
|
+
required: false
|
|
303
|
+
});
|
|
304
|
+
const lastModifiedTime = (0, _prismatic_io_spectral.input)({
|
|
305
|
+
label: "Last Modified Time",
|
|
306
|
+
type: "string",
|
|
307
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
308
|
+
comments: "Output only. The date when this dataset was last modified, in milliseconds since the epoch.",
|
|
309
|
+
example: "1640995200000",
|
|
310
|
+
placeholder: "Enter last modified time",
|
|
311
|
+
required: false
|
|
312
|
+
});
|
|
313
|
+
const location = (0, _prismatic_io_spectral.input)({
|
|
314
|
+
label: "Location",
|
|
315
|
+
type: "string",
|
|
316
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
317
|
+
comments: "The geographic location where the dataset should reside. See https://cloud.google.com/bigquery/docs/locations for supported locations.",
|
|
318
|
+
example: "US",
|
|
319
|
+
placeholder: "Enter location",
|
|
320
|
+
required: false
|
|
321
|
+
});
|
|
322
|
+
const defaultCollation = (0, _prismatic_io_spectral.input)({
|
|
323
|
+
label: "Default Collation",
|
|
324
|
+
type: "string",
|
|
325
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
326
|
+
comments: "Optional. Defines the default collation specification of future tables created in the dataset. If a table is created in this dataset without table-level default collation, then the table inherits the dataset default collation, which is applied to the string fields that do not have explicit collation specified. A change to this field affects only tables created afterwards, and does not alter the existing tables. The following values are supported: 'und:ci': undetermined locale, case insensitive.'' empty string. Default to case-sensitive behavior.",
|
|
327
|
+
example: "und:ci",
|
|
328
|
+
placeholder: "Enter default collation",
|
|
329
|
+
required: false
|
|
330
|
+
});
|
|
331
|
+
const defaultRoundingMode = (0, _prismatic_io_spectral.input)({
|
|
332
|
+
label: "Default Rounding Mode",
|
|
333
|
+
type: "string",
|
|
334
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
335
|
+
required: false,
|
|
336
|
+
comments: "Optional. Defines the default rounding mode specification of new tables created within this dataset. During table creation, if this field is specified, the table within this dataset will inherit the default rounding mode of the dataset. Setting the default rounding mode on a table overrides this option. Existing tables in the dataset are unaffected. If columns are defined during that table creation, they will immediately inherit the table's default rounding mode, unless otherwise specified.",
|
|
337
|
+
placeholder: "Select rounding mode",
|
|
338
|
+
model: [
|
|
339
|
+
{
|
|
340
|
+
label: "ROUNDING MODE UNSPECIFIED",
|
|
341
|
+
value: "ROUNDING_MODE_UNSPECIFIED"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
label: "ROUND HALF AWAY FROM ZERO",
|
|
345
|
+
value: "ROUND_HALF_AWAY_FROM_ZERO"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
label: "ROUND HALF EVEN",
|
|
349
|
+
value: "ROUND_HALF_EVEN"
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
});
|
|
353
|
+
const encryptionConfiguration = (0, _prismatic_io_spectral.input)({
|
|
354
|
+
label: "Encryption Configuration",
|
|
355
|
+
type: "code",
|
|
356
|
+
language: "json",
|
|
357
|
+
comments: "Custom encryption configuration (e.g., Cloud KMS keys). This shows the encryption configuration of the model data while stored in BigQuery storage. This field can be used with models.patch to update encryption key for an already encrypted model.",
|
|
358
|
+
example: JSON.stringify({ kmsKeyName: "string" }),
|
|
359
|
+
clean: jsonInputClean,
|
|
360
|
+
required: false
|
|
361
|
+
});
|
|
362
|
+
const expirationTime = (0, _prismatic_io_spectral.input)({
|
|
363
|
+
label: "Expiration Time",
|
|
364
|
+
type: "string",
|
|
365
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
366
|
+
comments: "Optional. The time when this model expires, in milliseconds since the epoch. If not present, the model will persist indefinitely. Expired models will be deleted and their storage reclaimed. The defaultTableExpirationMs property of the encapsulating dataset can be used to set a default expirationTime on newly created models.",
|
|
367
|
+
required: false
|
|
368
|
+
});
|
|
369
|
+
const fetchAll = (0, _prismatic_io_spectral.input)({
|
|
370
|
+
label: "Fetch All",
|
|
371
|
+
type: "boolean",
|
|
372
|
+
required: false,
|
|
373
|
+
default: "false",
|
|
374
|
+
comments: "When true, automatically fetches all pages of results using pagination.",
|
|
375
|
+
clean: _prismatic_io_spectral.util.types.toBool
|
|
376
|
+
});
|
|
377
|
+
const labels = (0, _prismatic_io_spectral.input)({
|
|
378
|
+
label: "Labels",
|
|
379
|
+
type: "code",
|
|
380
|
+
language: "json",
|
|
381
|
+
comments: "The labels associated with this dataset. You can use these to organize and group your datasets. You can set this property when inserting or updating a dataset. See Creating and Updating Dataset Labels for more information.",
|
|
382
|
+
example: JSON.stringify({
|
|
383
|
+
name: "wrench",
|
|
384
|
+
mass: "1.3kg",
|
|
385
|
+
count: "3"
|
|
386
|
+
}),
|
|
387
|
+
clean: jsonInputClean,
|
|
388
|
+
required: false
|
|
389
|
+
});
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/inputs/pagination.ts
|
|
392
|
+
const paginationFields = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
393
|
+
label: "Pagination",
|
|
394
|
+
required: false,
|
|
395
|
+
comments: "Page navigation controls for the results.",
|
|
396
|
+
inputs: {
|
|
397
|
+
pageToken,
|
|
398
|
+
maxResults
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
const paginationFieldsWithStartIndex = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
402
|
+
label: "Pagination",
|
|
403
|
+
required: false,
|
|
404
|
+
comments: "Page navigation controls for the results.",
|
|
405
|
+
inputs: {
|
|
406
|
+
pageToken,
|
|
407
|
+
maxResults,
|
|
408
|
+
startIndex
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
const tableListPaginationFields = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
412
|
+
label: "Pagination",
|
|
413
|
+
required: false,
|
|
414
|
+
comments: "Page navigation controls for the results.",
|
|
415
|
+
inputs: {
|
|
416
|
+
pageToken,
|
|
417
|
+
maxResults: (0, _prismatic_io_spectral.input)({
|
|
418
|
+
...maxResults,
|
|
419
|
+
required: false,
|
|
420
|
+
clean: _prismatic_io_spectral.util.types.toString
|
|
421
|
+
})
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/inputs/datasets.ts
|
|
426
|
+
const all = (0, _prismatic_io_spectral.input)({
|
|
427
|
+
label: "All",
|
|
428
|
+
type: "boolean",
|
|
429
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
430
|
+
comments: "When true, lists all datasets, including hidden ones.",
|
|
431
|
+
required: false
|
|
432
|
+
});
|
|
433
|
+
const storageBillingModel = (0, _prismatic_io_spectral.input)({
|
|
434
|
+
label: "Storage Billing Model",
|
|
435
|
+
type: "string",
|
|
436
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
437
|
+
comments: "Optional. Updates storageBillingModel for the dataset.",
|
|
438
|
+
placeholder: "Select storage billing model",
|
|
439
|
+
model: [
|
|
440
|
+
{
|
|
441
|
+
label: "STORAGE BILLING MODEL UNSPECIFIED",
|
|
442
|
+
value: "STORAGE_BILLING_MODEL_UNSPECIFIED"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
label: "LOGICAL",
|
|
446
|
+
value: "LOGICAL"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
label: "PHYSICAL",
|
|
450
|
+
value: "PHYSICAL"
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
});
|
|
454
|
+
const maxTimeTravelHours = (0, _prismatic_io_spectral.input)({
|
|
455
|
+
label: "Max Time Travel Hours",
|
|
456
|
+
type: "string",
|
|
457
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
458
|
+
comments: "Optional. Defines the time travel window in hours. The value can be from 48 to 168 hours (2 to 7 days). The default value is 168 hours if this is not set.",
|
|
459
|
+
example: "168",
|
|
460
|
+
placeholder: "Enter max time travel hours",
|
|
461
|
+
required: false
|
|
462
|
+
});
|
|
463
|
+
const defaultTableExpirationMs = (0, _prismatic_io_spectral.input)({
|
|
464
|
+
label: "Default Table Expiration (ms)",
|
|
465
|
+
type: "string",
|
|
466
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
467
|
+
comments: "Optional. The default lifetime of all tables in the dataset, in milliseconds. The minimum lifetime value is 3600000 milliseconds (one hour). To clear an existing default expiration with a PATCH request, set to 0. Once this property is set, all newly-created tables in the dataset will have an expirationTime property set to the creation time plus the value in this property, and changing the value will only affect new tables, not existing ones. When the expirationTime for a given table is reached, that table will be deleted automatically. If a table's expirationTime is modified or removed before the table expires, or if you provide an explicit expirationTime when creating a table, that value takes precedence over the default expiration time indicated by this property.",
|
|
468
|
+
example: "3600000",
|
|
469
|
+
placeholder: "Enter default table expiration in milliseconds",
|
|
470
|
+
required: false
|
|
471
|
+
});
|
|
472
|
+
const satisfiesPzs = (0, _prismatic_io_spectral.input)({
|
|
473
|
+
label: "Satisfies PZS",
|
|
474
|
+
type: "boolean",
|
|
475
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
476
|
+
comments: "Output only. Reserved for future use.",
|
|
477
|
+
required: false
|
|
478
|
+
});
|
|
479
|
+
const isCaseInsensitive = (0, _prismatic_io_spectral.input)({
|
|
480
|
+
label: "Is Case Insensitive",
|
|
481
|
+
type: "boolean",
|
|
482
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
483
|
+
comments: "Optional. TRUE if the dataset and its table names are case-insensitive, otherwise FALSE. By default, this is FALSE, which means the dataset and its table names are case-sensitive. This field does not affect routine references.",
|
|
484
|
+
required: false
|
|
485
|
+
});
|
|
486
|
+
const defaultPartitionExpirationMs = (0, _prismatic_io_spectral.input)({
|
|
487
|
+
label: "Default Partition Expiration (ms)",
|
|
488
|
+
type: "string",
|
|
489
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
490
|
+
comments: "This default partition expiration, expressed in milliseconds. \nWhen new time-partitioned tables are created in a dataset where this property is set, the table will inherit this value, propagated as the TimePartitioning.expirationMs property on the new table. If you set TimePartitioning.expirationMs explicitly when creating a table, the defaultPartitionExpirationMs of the containing dataset is ignored. \nWhen creating a partitioned table, if defaultPartitionExpirationMs is set, the defaultTableExpirationMs value is ignored and the table will not be inherit a table expiration deadline.",
|
|
491
|
+
example: "86400000",
|
|
492
|
+
placeholder: "Enter default partition expiration in milliseconds",
|
|
493
|
+
required: false
|
|
494
|
+
});
|
|
495
|
+
const datasetReference = (0, _prismatic_io_spectral.input)({
|
|
496
|
+
label: "Dataset Reference",
|
|
497
|
+
type: "code",
|
|
498
|
+
language: "json",
|
|
499
|
+
comments: "A reference that identifies the dataset.",
|
|
500
|
+
example: JSON.stringify({
|
|
501
|
+
datasetId: "string",
|
|
502
|
+
projectId: "string"
|
|
503
|
+
}),
|
|
504
|
+
clean: jsonInputClean,
|
|
505
|
+
required: true
|
|
506
|
+
});
|
|
507
|
+
const access = (0, _prismatic_io_spectral.input)({
|
|
508
|
+
label: "Access",
|
|
509
|
+
type: "code",
|
|
510
|
+
language: "json",
|
|
511
|
+
comments: "Optional. An array of objects that define dataset access for one or more entities. You can set this property when inserting or updating a dataset in order to control who is allowed to access the data. If unspecified at dataset creation time, BigQuery adds default dataset access for the following entities: access.specialGroup: projectReaders; access.role: READER; access.specialGroup: projectWriters; access.role: WRITER; access.specialGroup: projectOwners; access.role: OWNER; access.userByEmail: [dataset creator email]; access.role: OWNER.",
|
|
512
|
+
example: JSON.stringify([{
|
|
513
|
+
role: "string",
|
|
514
|
+
userByEmail: "string",
|
|
515
|
+
groupByEmail: "string",
|
|
516
|
+
domain: "string",
|
|
517
|
+
specialGroup: "string",
|
|
518
|
+
iamMember: "string",
|
|
519
|
+
view: {
|
|
520
|
+
projectId: "string",
|
|
521
|
+
datasetId: "string",
|
|
522
|
+
tableId: "string"
|
|
523
|
+
},
|
|
524
|
+
routine: {
|
|
525
|
+
projectId: "string",
|
|
526
|
+
datasetId: "string",
|
|
527
|
+
routineId: "string"
|
|
528
|
+
},
|
|
529
|
+
dataset: {
|
|
530
|
+
dataset: {
|
|
531
|
+
datasetId: "string",
|
|
532
|
+
projectId: "string"
|
|
533
|
+
},
|
|
534
|
+
targetTypes: ["TARGET_TYPE_UNSPECIFIED", "VIEWS"]
|
|
535
|
+
}
|
|
536
|
+
}]),
|
|
537
|
+
clean: jsonInputClean,
|
|
538
|
+
required: false
|
|
539
|
+
});
|
|
540
|
+
const defaultEncryptionConfiguration = (0, _prismatic_io_spectral.input)({
|
|
541
|
+
label: "Default Encryption Configuration",
|
|
542
|
+
type: "code",
|
|
543
|
+
language: "json",
|
|
544
|
+
comments: "The default encryption key for all tables in the dataset. Once this property is set, all newly-created partitioned tables in the dataset will have encryption key set to this value, unless table creation request (or query) overrides the key.",
|
|
545
|
+
example: JSON.stringify({ kmsKeyName: "string" }),
|
|
546
|
+
clean: jsonInputClean,
|
|
547
|
+
required: false
|
|
548
|
+
});
|
|
549
|
+
(0, _prismatic_io_spectral.input)({
|
|
550
|
+
label: "Linked Dataset Source",
|
|
551
|
+
type: "code",
|
|
552
|
+
language: "json",
|
|
553
|
+
comments: "Optional. The source dataset reference when the dataset is of type LINKED. For all other dataset types it is not set. This field cannot be updated once it is set. Any attempt to update this field using Update and Patch API Operations will be ignored.",
|
|
554
|
+
example: JSON.stringify({ sourceDataset: {
|
|
555
|
+
datasetId: "string",
|
|
556
|
+
projectId: "string"
|
|
557
|
+
} }),
|
|
558
|
+
clean: jsonInputClean,
|
|
559
|
+
required: false
|
|
560
|
+
});
|
|
561
|
+
const tags = (0, _prismatic_io_spectral.input)({
|
|
562
|
+
label: "Tags",
|
|
563
|
+
type: "code",
|
|
564
|
+
language: "json",
|
|
565
|
+
comments: "Output only. Tags for the Dataset.",
|
|
566
|
+
example: JSON.stringify([{
|
|
567
|
+
tagKey: "string",
|
|
568
|
+
tagValue: "string"
|
|
569
|
+
}]),
|
|
570
|
+
clean: jsonInputClean,
|
|
571
|
+
required: false
|
|
572
|
+
});
|
|
573
|
+
const datasetAdditionalFields = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
574
|
+
label: "Additional Fields",
|
|
575
|
+
required: false,
|
|
576
|
+
comments: "Additional optional fields.",
|
|
577
|
+
inputs: {
|
|
578
|
+
kind,
|
|
579
|
+
etag,
|
|
580
|
+
id,
|
|
581
|
+
selfLink,
|
|
582
|
+
friendlyName,
|
|
583
|
+
description,
|
|
584
|
+
defaultTableExpirationMs,
|
|
585
|
+
defaultPartitionExpirationMs,
|
|
586
|
+
labels,
|
|
587
|
+
access,
|
|
588
|
+
creationTime,
|
|
589
|
+
lastModifiedTime,
|
|
590
|
+
location,
|
|
591
|
+
defaultEncryptionConfiguration,
|
|
592
|
+
satisfiesPzs,
|
|
593
|
+
isCaseInsensitive,
|
|
594
|
+
defaultCollation,
|
|
595
|
+
defaultRoundingMode,
|
|
596
|
+
maxTimeTravelHours,
|
|
597
|
+
tags,
|
|
598
|
+
storageBillingModel
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
const createDatasetInputs = {
|
|
602
|
+
connectionInput,
|
|
603
|
+
projectId,
|
|
604
|
+
datasetReference,
|
|
605
|
+
additionalFields: datasetAdditionalFields
|
|
606
|
+
};
|
|
607
|
+
const deleteDatasetInputs = {
|
|
608
|
+
connectionInput,
|
|
609
|
+
projectId,
|
|
610
|
+
datasetId
|
|
611
|
+
};
|
|
612
|
+
const getDatasetInputs = {
|
|
613
|
+
connectionInput,
|
|
614
|
+
projectId,
|
|
615
|
+
datasetId
|
|
616
|
+
};
|
|
617
|
+
const listDatasetsInputs = {
|
|
618
|
+
connectionInput,
|
|
619
|
+
projectId,
|
|
620
|
+
fetchAll,
|
|
621
|
+
pagination: paginationFields,
|
|
622
|
+
all,
|
|
623
|
+
filter
|
|
624
|
+
};
|
|
625
|
+
const updateDatasetInputs = {
|
|
626
|
+
connectionInput,
|
|
627
|
+
projectId,
|
|
628
|
+
datasetId,
|
|
629
|
+
datasetReference,
|
|
630
|
+
additionalFields: datasetAdditionalFields
|
|
631
|
+
};
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/inputs/jobs.ts
|
|
634
|
+
const jobId = (0, _prismatic_io_spectral.input)({
|
|
635
|
+
label: "Job ID",
|
|
636
|
+
type: "string",
|
|
637
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
638
|
+
comments: "The unique identifier for the job.",
|
|
639
|
+
example: "job_abc123xyz",
|
|
640
|
+
placeholder: "Enter job ID",
|
|
641
|
+
required: true,
|
|
642
|
+
dataSource: "selectJob"
|
|
643
|
+
});
|
|
644
|
+
const allUsers = (0, _prismatic_io_spectral.input)({
|
|
645
|
+
label: "All Users",
|
|
646
|
+
type: "boolean",
|
|
647
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
648
|
+
comments: "When true, displays jobs owned by all users in the project. Default is false.",
|
|
649
|
+
required: false
|
|
650
|
+
});
|
|
651
|
+
const minCreationTime = (0, _prismatic_io_spectral.input)({
|
|
652
|
+
label: "Min Creation Time",
|
|
653
|
+
type: "string",
|
|
654
|
+
clean: cleanString,
|
|
655
|
+
comments: "Min value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created after or at this timestamp are returned.",
|
|
656
|
+
example: "1609459200000",
|
|
657
|
+
placeholder: "Enter minimum creation time (milliseconds)",
|
|
658
|
+
required: false
|
|
659
|
+
});
|
|
660
|
+
const maxCreationTime = (0, _prismatic_io_spectral.input)({
|
|
661
|
+
label: "Max Creation Time",
|
|
662
|
+
type: "string",
|
|
663
|
+
clean: cleanString,
|
|
664
|
+
comments: "Max value for job creation time, in milliseconds since the POSIX epoch. If set, only jobs created before or at this timestamp are returned.",
|
|
665
|
+
example: "1640995200000",
|
|
666
|
+
placeholder: "Enter maximum creation time (milliseconds)",
|
|
667
|
+
required: false
|
|
668
|
+
});
|
|
669
|
+
const parentJobId = (0, _prismatic_io_spectral.input)({
|
|
670
|
+
label: "Parent Job ID",
|
|
671
|
+
type: "string",
|
|
672
|
+
clean: cleanString,
|
|
673
|
+
comments: "If set, shows only child jobs of the specified parent. Otherwise, shows all top-level jobs.",
|
|
674
|
+
example: "parent_job_abc123",
|
|
675
|
+
placeholder: "Enter parent job ID",
|
|
676
|
+
required: false
|
|
677
|
+
});
|
|
678
|
+
const projection = (0, _prismatic_io_spectral.input)({
|
|
679
|
+
label: "Projection",
|
|
680
|
+
type: "string",
|
|
681
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
682
|
+
comments: "Restrict information returned to a set of selected fields",
|
|
683
|
+
placeholder: "Select projection",
|
|
684
|
+
model: [{
|
|
685
|
+
label: "MINIMAL",
|
|
686
|
+
value: "MINIMAL"
|
|
687
|
+
}, {
|
|
688
|
+
label: "FULL",
|
|
689
|
+
value: "FULL"
|
|
690
|
+
}]
|
|
691
|
+
});
|
|
692
|
+
const stateFilter = (0, _prismatic_io_spectral.input)({
|
|
693
|
+
label: "State Filter",
|
|
694
|
+
type: "string",
|
|
695
|
+
collection: "valuelist",
|
|
696
|
+
required: false,
|
|
697
|
+
comments: "Filter for job state. Valid values of this enum field are: DONE, PENDING, RUNNING.",
|
|
698
|
+
example: "[\"DONE\", \"RUNNING\"]",
|
|
699
|
+
placeholder: "Select job states",
|
|
700
|
+
clean: valueListInputClean
|
|
701
|
+
});
|
|
702
|
+
const timeoutMs = (0, _prismatic_io_spectral.input)({
|
|
703
|
+
label: "Timeout (ms)",
|
|
704
|
+
type: "string",
|
|
705
|
+
clean: _prismatic_io_spectral.util.types.toNumber,
|
|
706
|
+
comments: "Specifies the maximum amount of time, in milliseconds, that the client is willing to wait for the query to complete. By default, this limit is 10 seconds (10,000 milliseconds). If the query is complete, the jobComplete field in the response is true. If the query has not yet completed, jobComplete is false. You can request a longer timeout period in the timeoutMs field. However, the call is not guaranteed to wait for the specified timeout; it typically returns after around 200 seconds (200,000 milliseconds), even if the query is not complete. If jobComplete is false, you can continue to wait for the query to complete by calling the getQueryResults method until the jobComplete field in the getQueryResults response is true.",
|
|
707
|
+
example: "10000",
|
|
708
|
+
placeholder: "Enter timeout in milliseconds",
|
|
709
|
+
required: false
|
|
710
|
+
});
|
|
711
|
+
const dryRun = (0, _prismatic_io_spectral.input)({
|
|
712
|
+
label: "Dry Run",
|
|
713
|
+
type: "boolean",
|
|
714
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
715
|
+
comments: "When true, BigQuery doesn't run the job. Instead, if the query is valid, BigQuery returns statistics about the job such as how many bytes would be processed. If the query is invalid, an error returns. The default value is false.",
|
|
716
|
+
required: false
|
|
717
|
+
});
|
|
718
|
+
const useQueryCache = (0, _prismatic_io_spectral.input)({
|
|
719
|
+
label: "Use Query Cache",
|
|
720
|
+
type: "boolean",
|
|
721
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
722
|
+
default: "true",
|
|
723
|
+
comments: "When true, looks for the result in the query cache. The query cache is a best-effort cache that will be flushed whenever tables in the query are modified. The default value is true.",
|
|
724
|
+
required: false
|
|
725
|
+
});
|
|
726
|
+
const useLegacySql = (0, _prismatic_io_spectral.input)({
|
|
727
|
+
label: "Use Legacy SQL",
|
|
728
|
+
type: "boolean",
|
|
729
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
730
|
+
default: "false",
|
|
731
|
+
comments: "Specifies whether to use BigQuery's legacy SQL dialect for this query. [BigQuery's GoogleSQL](https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax)",
|
|
732
|
+
required: false
|
|
733
|
+
});
|
|
734
|
+
const parameterMode = (0, _prismatic_io_spectral.input)({
|
|
735
|
+
label: "Parameter Mode",
|
|
736
|
+
type: "string",
|
|
737
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
738
|
+
comments: "GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters or to NAMED to use named (@myparam) query parameters in this query.",
|
|
739
|
+
example: "NAMED",
|
|
740
|
+
placeholder: "Enter parameter mode",
|
|
741
|
+
required: false
|
|
742
|
+
});
|
|
743
|
+
const userEmail = (0, _prismatic_io_spectral.input)({
|
|
744
|
+
label: "User Email",
|
|
745
|
+
type: "string",
|
|
746
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
747
|
+
comments: "Output only. Email address of the user who ran the job.",
|
|
748
|
+
example: "user@example.com",
|
|
749
|
+
placeholder: "Enter user email",
|
|
750
|
+
required: false
|
|
751
|
+
});
|
|
752
|
+
(0, _prismatic_io_spectral.input)({
|
|
753
|
+
label: "Principal Subject",
|
|
754
|
+
type: "string",
|
|
755
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
756
|
+
comments: "Output only. [Full-projection-only] String representation of identity of requesting party. Populated for both first- and third-party identities. Only present for APIs that support third-party identities.",
|
|
757
|
+
example: "user:user@example.com",
|
|
758
|
+
placeholder: "Enter principal subject",
|
|
759
|
+
required: false
|
|
760
|
+
});
|
|
761
|
+
const maximumBytesBilled = (0, _prismatic_io_spectral.input)({
|
|
762
|
+
label: "Maximum Bytes Billed",
|
|
763
|
+
type: "string",
|
|
764
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
765
|
+
comments: "Optional. Limits the bytes billed for this query. Queries with bytes billed above this limit will fail (without incurring a charge). If unspecified, the project default is used.",
|
|
766
|
+
example: "1000000000",
|
|
767
|
+
placeholder: "Enter maximum bytes billed",
|
|
768
|
+
required: false
|
|
769
|
+
});
|
|
770
|
+
const requestId = (0, _prismatic_io_spectral.input)({
|
|
771
|
+
label: "Request ID",
|
|
772
|
+
type: "string",
|
|
773
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
774
|
+
comments: "Optional. A unique user provided identifier to ensure idempotent behavior for queries. Note that this is different from the jobId. It has the following properties: It is case-sensitive, limited to up to 36 ASCII characters. A UUID is recommended. Read only queries can ignore this token since they are nullipotent by definition. For the purposes of idempotency ensured by the requestId, a request is considered duplicate of another only if they have the same requestId and are actually duplicates. When determining whether a request is a duplicate of another request, all parameters in the request that may affect the result are considered. For example, query, connectionProperties, queryParameters, useLegacySql are parameters that affect the result and are considered when determining whether a request is a duplicate, but properties like timeoutMs don't affect the result and are thus not considered. Dry run query requests are never considered duplicate of another request. When a duplicate mutating query request is detected, it returns: a. the results of the mutation if it completes successfully within the timeout. b. the running operation if it is still in progress at the end of the timeout. Its lifetime is limited to 15 minutes. In other words, if two requests are sent with the same requestId, but more than 15 minutes apart, idempotency is not guaranteed.",
|
|
775
|
+
example: "550e8400-e29b-41d4-a716-446655440000",
|
|
776
|
+
placeholder: "Enter request ID",
|
|
777
|
+
required: false
|
|
778
|
+
});
|
|
779
|
+
const createSession = (0, _prismatic_io_spectral.input)({
|
|
780
|
+
label: "Create Session",
|
|
781
|
+
type: "boolean",
|
|
782
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
783
|
+
comments: "When true, creates a new session using a randomly generated sessionId. If false, runs query with an existing sessionId passed in ConnectionProperty, otherwise runs query in non-session mode. The session location will be set to QueryRequest.location if it is present, otherwise it's set to the default location based on existing routing logic.",
|
|
784
|
+
required: false
|
|
785
|
+
});
|
|
786
|
+
const query = (0, _prismatic_io_spectral.input)({
|
|
787
|
+
label: "Query",
|
|
788
|
+
type: "string",
|
|
789
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
790
|
+
comments: "Required. A query string to execute, using Google Standard SQL or legacy SQL syntax. Example: 'SELECT COUNT(f1) FROM myProjectId.myDatasetId.myTableId'.",
|
|
791
|
+
example: "SELECT COUNT(f1) FROM myProjectId.myDatasetId.myTableId",
|
|
792
|
+
placeholder: "Enter SQL query",
|
|
793
|
+
required: true
|
|
794
|
+
});
|
|
795
|
+
const configuration = (0, _prismatic_io_spectral.input)({
|
|
796
|
+
label: "Configuration",
|
|
797
|
+
type: "code",
|
|
798
|
+
language: "json",
|
|
799
|
+
comments: "Required. Describes the job configuration.",
|
|
800
|
+
example: "Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobconfiguration",
|
|
801
|
+
clean: jsonInputClean,
|
|
802
|
+
required: true
|
|
803
|
+
});
|
|
804
|
+
const jobReference = (0, _prismatic_io_spectral.input)({
|
|
805
|
+
label: "Job Reference",
|
|
806
|
+
type: "code",
|
|
807
|
+
language: "json",
|
|
808
|
+
comments: "Optional. Reference describing the unique-per-user name of the job.",
|
|
809
|
+
example: JSON.stringify({
|
|
810
|
+
projectId: "string",
|
|
811
|
+
jobId: "string",
|
|
812
|
+
location: "string"
|
|
813
|
+
}),
|
|
814
|
+
clean: jsonInputClean,
|
|
815
|
+
required: false
|
|
816
|
+
});
|
|
817
|
+
const statistics = (0, _prismatic_io_spectral.input)({
|
|
818
|
+
label: "Statistics",
|
|
819
|
+
type: "code",
|
|
820
|
+
language: "json",
|
|
821
|
+
comments: "Output only. Information about the job, including starting time and ending time of the job.",
|
|
822
|
+
example: "Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobstatistics",
|
|
823
|
+
clean: jsonInputClean,
|
|
824
|
+
required: false
|
|
825
|
+
});
|
|
826
|
+
const status = (0, _prismatic_io_spectral.input)({
|
|
827
|
+
label: "Status",
|
|
828
|
+
type: "code",
|
|
829
|
+
language: "json",
|
|
830
|
+
comments: "Output only. The status of this job. Examine this value when polling an asynchronous job to see if the job is complete.",
|
|
831
|
+
example: JSON.stringify({
|
|
832
|
+
errorResult: {
|
|
833
|
+
reason: "string",
|
|
834
|
+
location: "string",
|
|
835
|
+
debugInfo: "string",
|
|
836
|
+
message: "string"
|
|
837
|
+
},
|
|
838
|
+
errors: [{
|
|
839
|
+
reason: "string",
|
|
840
|
+
location: "string",
|
|
841
|
+
debugInfo: "string",
|
|
842
|
+
message: "string"
|
|
843
|
+
}],
|
|
844
|
+
state: "string"
|
|
845
|
+
}),
|
|
846
|
+
clean: jsonInputClean,
|
|
847
|
+
required: false
|
|
848
|
+
});
|
|
849
|
+
const defaultDataset = (0, _prismatic_io_spectral.input)({
|
|
850
|
+
label: "Default Dataset",
|
|
851
|
+
type: "code",
|
|
852
|
+
language: "json",
|
|
853
|
+
comments: "Optional. Specifies the default datasetId and projectId to assume for any unqualified table names in the query. If not set, all table names in the query string must be qualified in the format 'datasetId.tableId'.",
|
|
854
|
+
example: JSON.stringify({
|
|
855
|
+
datasetId: "string",
|
|
856
|
+
projectId: "string"
|
|
857
|
+
}),
|
|
858
|
+
clean: jsonInputClean,
|
|
859
|
+
required: false
|
|
860
|
+
});
|
|
861
|
+
const queryParameters = (0, _prismatic_io_spectral.input)({
|
|
862
|
+
label: "Query Parameters",
|
|
863
|
+
type: "code",
|
|
864
|
+
language: "json",
|
|
865
|
+
comments: "Optional. An array of query parameters for a query. Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/QueryParameter",
|
|
866
|
+
example: JSON.stringify([{
|
|
867
|
+
name: "name",
|
|
868
|
+
parameterType: { type: "STRING" },
|
|
869
|
+
parameterValue: { value: "value" }
|
|
870
|
+
}]),
|
|
871
|
+
clean: jsonInputClean,
|
|
872
|
+
required: false
|
|
873
|
+
});
|
|
874
|
+
const connectionProperties = (0, _prismatic_io_spectral.input)({
|
|
875
|
+
label: "Connection Properties",
|
|
876
|
+
type: "code",
|
|
877
|
+
language: "json",
|
|
878
|
+
comments: "Optional. Connection properties which can modify the query behavior.",
|
|
879
|
+
example: JSON.stringify([{
|
|
880
|
+
key: "string",
|
|
881
|
+
value: "string"
|
|
882
|
+
}]),
|
|
883
|
+
clean: jsonInputClean,
|
|
884
|
+
required: false
|
|
885
|
+
});
|
|
886
|
+
const listJobsFilters = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
887
|
+
label: "Filters",
|
|
888
|
+
required: false,
|
|
889
|
+
comments: "Optional query controls to sort and refine the results.",
|
|
890
|
+
inputs: {
|
|
891
|
+
allUsers,
|
|
892
|
+
minCreationTime,
|
|
893
|
+
maxCreationTime,
|
|
894
|
+
projection,
|
|
895
|
+
parentJobId
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
const createJobAdditionalFields = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
899
|
+
label: "Additional Fields",
|
|
900
|
+
required: false,
|
|
901
|
+
comments: "Additional optional fields.",
|
|
902
|
+
inputs: {
|
|
903
|
+
kind,
|
|
904
|
+
etag,
|
|
905
|
+
id,
|
|
906
|
+
selfLink,
|
|
907
|
+
userEmail,
|
|
908
|
+
statistics,
|
|
909
|
+
status
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
const queryJobAdditionalFields = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
913
|
+
label: "Additional Fields",
|
|
914
|
+
required: false,
|
|
915
|
+
comments: "Additional optional fields.",
|
|
916
|
+
inputs: {
|
|
917
|
+
kind,
|
|
918
|
+
defaultDataset,
|
|
919
|
+
timeoutMs,
|
|
920
|
+
dryRun,
|
|
921
|
+
useQueryCache,
|
|
922
|
+
useLegacySql,
|
|
923
|
+
parameterMode,
|
|
924
|
+
queryParameters,
|
|
925
|
+
location,
|
|
926
|
+
connectionProperties,
|
|
927
|
+
labels,
|
|
928
|
+
maximumBytesBilled,
|
|
929
|
+
requestId,
|
|
930
|
+
createSession
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
const cancelJobInputs = {
|
|
934
|
+
connectionInput,
|
|
935
|
+
projectId,
|
|
936
|
+
jobId,
|
|
937
|
+
location
|
|
938
|
+
};
|
|
939
|
+
const createJobInputs = {
|
|
940
|
+
connectionInput,
|
|
941
|
+
projectId,
|
|
942
|
+
configuration,
|
|
943
|
+
jobReference,
|
|
944
|
+
additionalFields: createJobAdditionalFields
|
|
945
|
+
};
|
|
946
|
+
const deleteJobInputs = {
|
|
947
|
+
connectionInput,
|
|
948
|
+
projectId,
|
|
949
|
+
jobId,
|
|
950
|
+
location
|
|
951
|
+
};
|
|
952
|
+
const getJobInputs = {
|
|
953
|
+
connectionInput,
|
|
954
|
+
projectId,
|
|
955
|
+
jobId,
|
|
956
|
+
location
|
|
957
|
+
};
|
|
958
|
+
const getQueryJobResultInputs = {
|
|
959
|
+
connectionInput,
|
|
960
|
+
projectId,
|
|
961
|
+
jobId,
|
|
962
|
+
timeoutMs,
|
|
963
|
+
location,
|
|
964
|
+
pagination: paginationFieldsWithStartIndex
|
|
965
|
+
};
|
|
966
|
+
const listJobsInputs = {
|
|
967
|
+
connectionInput,
|
|
968
|
+
projectId,
|
|
969
|
+
fetchAll,
|
|
970
|
+
pagination: paginationFields,
|
|
971
|
+
filters: listJobsFilters,
|
|
972
|
+
stateFilter
|
|
973
|
+
};
|
|
974
|
+
const queryJobInputs = {
|
|
975
|
+
connectionInput,
|
|
976
|
+
projectId,
|
|
977
|
+
query,
|
|
978
|
+
maxResults,
|
|
979
|
+
additionalFields: queryJobAdditionalFields
|
|
980
|
+
};
|
|
981
|
+
//#endregion
|
|
982
|
+
//#region src/inputs/misc.ts
|
|
983
|
+
const version = (0, _prismatic_io_spectral.input)({
|
|
984
|
+
label: "API Version",
|
|
985
|
+
type: "string",
|
|
986
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
987
|
+
default: "v2",
|
|
988
|
+
comments: "The API version to use. This is used to construct the base URL for the request.",
|
|
989
|
+
example: "v2",
|
|
990
|
+
placeholder: "Enter API version",
|
|
991
|
+
required: false
|
|
992
|
+
});
|
|
993
|
+
(0, _prismatic_io_spectral.input)({
|
|
994
|
+
label: "Format Options",
|
|
995
|
+
type: "boolean",
|
|
996
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
997
|
+
comments: "When true, applies output format adjustments.",
|
|
998
|
+
required: false
|
|
999
|
+
});
|
|
1000
|
+
//#endregion
|
|
1001
|
+
//#region src/inputs/models.ts
|
|
1002
|
+
const modelId = (0, _prismatic_io_spectral.input)({
|
|
1003
|
+
label: "Model ID",
|
|
1004
|
+
type: "string",
|
|
1005
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1006
|
+
comments: "The unique identifier for the model.",
|
|
1007
|
+
example: "my_model",
|
|
1008
|
+
placeholder: "Enter model ID",
|
|
1009
|
+
required: true,
|
|
1010
|
+
dataSource: "selectModel"
|
|
1011
|
+
});
|
|
1012
|
+
const defaultTrialId = (0, _prismatic_io_spectral.input)({
|
|
1013
|
+
label: "Default Trial ID",
|
|
1014
|
+
type: "string",
|
|
1015
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1016
|
+
comments: "Output only. The default trialId to use in TVFs when the trialId is not passed in. For single-objective hyperparameter tuning models, this is the best trial ID. For multi-objective hyperparameter tuning models, this is the smallest trial ID among all Pareto optimal trials.",
|
|
1017
|
+
required: false
|
|
1018
|
+
});
|
|
1019
|
+
const modelType = (0, _prismatic_io_spectral.input)({
|
|
1020
|
+
label: "Model Type",
|
|
1021
|
+
type: "string",
|
|
1022
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1023
|
+
comments: "Output only. Type of the model resource.",
|
|
1024
|
+
model: [
|
|
1025
|
+
{
|
|
1026
|
+
label: "MODEL_TYPE_UNSPECIFIED",
|
|
1027
|
+
value: "MODEL_TYPE_UNSPECIFIED"
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
label: "LINEAR_REGRESSION",
|
|
1031
|
+
value: "LINEAR_REGRESSION"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
label: "LOGISTIC_REGRESSION",
|
|
1035
|
+
value: "LOGISTIC_REGRESSION"
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
label: "KMEANS",
|
|
1039
|
+
value: "KMEANS"
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
label: "MATRIX_FACTORIZATION",
|
|
1043
|
+
value: "MATRIX_FACTORIZATION"
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
label: "DNN_CLASSIFIER",
|
|
1047
|
+
value: "DNN_CLASSIFIER"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
label: "TENSORFLOW",
|
|
1051
|
+
value: "TENSORFLOW"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
label: "DNN_REGRESSOR",
|
|
1055
|
+
value: "DNN_REGRESSOR"
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
label: "XGBOOST",
|
|
1059
|
+
value: "XGBOOST"
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
label: "BOOSTED_TREE_REGRESSOR",
|
|
1063
|
+
value: "BOOSTED_TREE_REGRESSOR"
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
label: "BOOSTED_TREE_CLASSIFIER",
|
|
1067
|
+
value: "BOOSTED_TREE_CLASSIFIER"
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
label: "ARIMA",
|
|
1071
|
+
value: "ARIMA"
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
label: "AUTOML_REGRESSOR",
|
|
1075
|
+
value: "AUTOML_REGRESSOR"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
label: "AUTOML_CLASSIFIER",
|
|
1079
|
+
value: "AUTOML_CLASSIFIER"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
label: "PCA",
|
|
1083
|
+
value: "PCA"
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
label: "DNN_LINEAR_COMBINED_CLASSIFIER",
|
|
1087
|
+
value: "DNN_LINEAR_COMBINED_CLASSIFIER"
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
label: "DNN_LINEAR_COMBINED_REGRESSOR",
|
|
1091
|
+
value: "DNN_LINEAR_COMBINED_REGRESSOR"
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
label: "AUTOENCODER",
|
|
1095
|
+
value: "AUTOENCODER"
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
label: "ARIMA_PLUS",
|
|
1099
|
+
value: "ARIMA_PLUS"
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
label: "ARIMA_PLUS_XREG",
|
|
1103
|
+
value: "ARIMA_PLUS_XREG"
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
label: "RANDOM_FOREST_REGRESSOR",
|
|
1107
|
+
value: "RANDOM_FOREST_REGRESSOR"
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
label: "RANDOM_FOREST_CLASSIFIER",
|
|
1111
|
+
value: "RANDOM_FOREST_CLASSIFIER"
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
label: "TENSORFLOW_LITE",
|
|
1115
|
+
value: "TENSORFLOW_LITE"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
label: "ONNX",
|
|
1119
|
+
value: "ONNX"
|
|
1120
|
+
}
|
|
1121
|
+
]
|
|
1122
|
+
});
|
|
1123
|
+
const optimalTrialIds = (0, _prismatic_io_spectral.input)({
|
|
1124
|
+
label: "Optimal Trial IDs",
|
|
1125
|
+
type: "string",
|
|
1126
|
+
collection: "valuelist",
|
|
1127
|
+
required: false,
|
|
1128
|
+
comments: "Output only. For single-objective hyperparameter tuning models, it only contains the best trial. For multi-objective hyperparameter tuning models, it contains all Pareto optimal trials sorted by trialId.",
|
|
1129
|
+
example: "[\"trial_1\", \"trial_2\"]",
|
|
1130
|
+
placeholder: "Enter trial IDs",
|
|
1131
|
+
clean: valueListInputClean
|
|
1132
|
+
});
|
|
1133
|
+
const modelReference = (0, _prismatic_io_spectral.input)({
|
|
1134
|
+
label: "Model Reference",
|
|
1135
|
+
type: "code",
|
|
1136
|
+
language: "json",
|
|
1137
|
+
comments: "Unique identifier for this model.",
|
|
1138
|
+
example: JSON.stringify({
|
|
1139
|
+
projectId: "string",
|
|
1140
|
+
datasetId: "string",
|
|
1141
|
+
modelId: "string"
|
|
1142
|
+
}),
|
|
1143
|
+
clean: jsonInputClean,
|
|
1144
|
+
required: true
|
|
1145
|
+
});
|
|
1146
|
+
const trainingRuns = (0, _prismatic_io_spectral.input)({
|
|
1147
|
+
label: "Training Runs",
|
|
1148
|
+
type: "code",
|
|
1149
|
+
language: "json",
|
|
1150
|
+
comments: "Information for all training runs in increasing order of startTime.",
|
|
1151
|
+
example: "Reference to the Google docs for this input. An array of https://cloud.google.com/bigquery/docs/reference/rest/v2/models#trainingrun",
|
|
1152
|
+
clean: jsonInputClean,
|
|
1153
|
+
required: false
|
|
1154
|
+
});
|
|
1155
|
+
const featureColumns = (0, _prismatic_io_spectral.input)({
|
|
1156
|
+
label: "Feature Columns",
|
|
1157
|
+
type: "code",
|
|
1158
|
+
language: "json",
|
|
1159
|
+
comments: "Output only. Input feature columns for the model inference. If the model is trained with TRANSFORM clause, these are the input of the TRANSFORM clause.",
|
|
1160
|
+
example: "Reference to the Google docs for this input. An array of https://cloud.google.com/bigquery/docs/reference/rest/v2/StandardSqlField",
|
|
1161
|
+
clean: jsonInputClean,
|
|
1162
|
+
required: false
|
|
1163
|
+
});
|
|
1164
|
+
const labelColumns = (0, _prismatic_io_spectral.input)({
|
|
1165
|
+
label: "Label Columns",
|
|
1166
|
+
type: "code",
|
|
1167
|
+
language: "json",
|
|
1168
|
+
comments: "Output only. Label columns that were used to train this model. The output of the model will have a 'predicted_' prefix to these columns.",
|
|
1169
|
+
example: "Reference to the Google docs for this input. An array of https://cloud.google.com/bigquery/docs/reference/rest/v2/StandardSqlField",
|
|
1170
|
+
clean: jsonInputClean,
|
|
1171
|
+
required: false
|
|
1172
|
+
});
|
|
1173
|
+
(0, _prismatic_io_spectral.input)({
|
|
1174
|
+
label: "Transform Columns",
|
|
1175
|
+
type: "code",
|
|
1176
|
+
language: "json",
|
|
1177
|
+
comments: "Output only. This field will be populated if a TRANSFORM clause was used to train a model. TRANSFORM clause (if used) takes featureColumns as input and outputs transformColumns. transformColumns then are used to train the model.",
|
|
1178
|
+
example: "Reference to the Google docs for this input. An array of https://cloud.google.com/bigquery/docs/reference/rest/v2/models#transformcolumn",
|
|
1179
|
+
clean: jsonInputClean,
|
|
1180
|
+
required: false
|
|
1181
|
+
});
|
|
1182
|
+
const hparamSearchSpaces = (0, _prismatic_io_spectral.input)({
|
|
1183
|
+
label: "Hparam Search Spaces",
|
|
1184
|
+
type: "code",
|
|
1185
|
+
language: "json",
|
|
1186
|
+
comments: "Output only. Trials of a hyperparameter tuning model sorted by trialId.",
|
|
1187
|
+
example: "Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/models#hparamsearchspaces",
|
|
1188
|
+
clean: jsonInputClean,
|
|
1189
|
+
required: false
|
|
1190
|
+
});
|
|
1191
|
+
const hparamTrials = (0, _prismatic_io_spectral.input)({
|
|
1192
|
+
label: "Hparam Trials",
|
|
1193
|
+
type: "code",
|
|
1194
|
+
language: "json",
|
|
1195
|
+
comments: "Output only. Trials of a hyperparameter tuning model sorted by trialId.",
|
|
1196
|
+
example: "Reference to the Google docs for this input. An array of https://cloud.google.com/bigquery/docs/reference/rest/v2/models#hparamtuningtrial",
|
|
1197
|
+
clean: jsonInputClean,
|
|
1198
|
+
required: false
|
|
1199
|
+
});
|
|
1200
|
+
(0, _prismatic_io_spectral.input)({
|
|
1201
|
+
label: "Remote Model Info",
|
|
1202
|
+
type: "code",
|
|
1203
|
+
language: "json",
|
|
1204
|
+
comments: "Output only. Remote model info",
|
|
1205
|
+
example: JSON.stringify({
|
|
1206
|
+
connection: "string",
|
|
1207
|
+
maxBatchingRows: "string",
|
|
1208
|
+
endpoint: "string",
|
|
1209
|
+
remoteServiceType: "One of REMOTE_SERVICE_TYPE_UNSPECIFIED / CLOUD_AI_TRANSLATE_V3 / CLOUD_AI_VISION_V1 / CLOUD_AI_NATURAL_LANGUAGE_V1"
|
|
1210
|
+
}),
|
|
1211
|
+
clean: jsonInputClean,
|
|
1212
|
+
required: false
|
|
1213
|
+
});
|
|
1214
|
+
const updateModelAdditionalFields = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
1215
|
+
label: "Additional Fields",
|
|
1216
|
+
required: false,
|
|
1217
|
+
comments: "Additional optional fields.",
|
|
1218
|
+
inputs: {
|
|
1219
|
+
etag,
|
|
1220
|
+
creationTime,
|
|
1221
|
+
lastModifiedTime,
|
|
1222
|
+
description,
|
|
1223
|
+
friendlyName,
|
|
1224
|
+
labels,
|
|
1225
|
+
expirationTime,
|
|
1226
|
+
location,
|
|
1227
|
+
encryptionConfiguration,
|
|
1228
|
+
modelType,
|
|
1229
|
+
trainingRuns,
|
|
1230
|
+
featureColumns,
|
|
1231
|
+
labelColumns,
|
|
1232
|
+
hparamSearchSpaces,
|
|
1233
|
+
defaultTrialId,
|
|
1234
|
+
hparamTrials,
|
|
1235
|
+
optimalTrialIds
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1238
|
+
const deleteModelInputs = {
|
|
1239
|
+
connectionInput,
|
|
1240
|
+
projectId,
|
|
1241
|
+
datasetId,
|
|
1242
|
+
modelId
|
|
1243
|
+
};
|
|
1244
|
+
const getModelInputs = {
|
|
1245
|
+
connectionInput,
|
|
1246
|
+
projectId,
|
|
1247
|
+
datasetId,
|
|
1248
|
+
modelId
|
|
1249
|
+
};
|
|
1250
|
+
const listModelsInputs = {
|
|
1251
|
+
connectionInput,
|
|
1252
|
+
projectId,
|
|
1253
|
+
datasetId,
|
|
1254
|
+
fetchAll,
|
|
1255
|
+
pagination: paginationFields
|
|
1256
|
+
};
|
|
1257
|
+
const updateModelInputs = {
|
|
1258
|
+
connectionInput,
|
|
1259
|
+
projectId,
|
|
1260
|
+
datasetId,
|
|
1261
|
+
modelId,
|
|
1262
|
+
modelReference,
|
|
1263
|
+
additionalFields: updateModelAdditionalFields
|
|
1264
|
+
};
|
|
1265
|
+
//#endregion
|
|
1266
|
+
//#region src/inputs/policies.ts
|
|
1267
|
+
const resource = (0, _prismatic_io_spectral.input)({
|
|
1268
|
+
label: "Resource",
|
|
1269
|
+
type: "string",
|
|
1270
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1271
|
+
comments: "The resource for which the policy is being requested. See [Resource names](https://cloud.google.com/apis/design/resource_names) for the appropriate value for this field.",
|
|
1272
|
+
example: "projects/my-project/datasets/my-dataset/tables/my-table",
|
|
1273
|
+
placeholder: "Enter resource name",
|
|
1274
|
+
required: true
|
|
1275
|
+
});
|
|
1276
|
+
const updateMask = (0, _prismatic_io_spectral.input)({
|
|
1277
|
+
label: "Update Mask",
|
|
1278
|
+
type: "string",
|
|
1279
|
+
clean: cleanString,
|
|
1280
|
+
comments: "OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used: paths: 'bindings, etag' \n This is a comma-separated list of fully qualified names of fields. Example: 'user.displayName,photo'.",
|
|
1281
|
+
example: "user.displayName,photo",
|
|
1282
|
+
placeholder: "Enter update mask",
|
|
1283
|
+
required: false
|
|
1284
|
+
});
|
|
1285
|
+
const options = (0, _prismatic_io_spectral.input)({
|
|
1286
|
+
label: "Options",
|
|
1287
|
+
type: "code",
|
|
1288
|
+
language: "json",
|
|
1289
|
+
comments: "OPTIONAL: A GetPolicyOptions object for specifying options to tables.getIamPolicy.",
|
|
1290
|
+
example: JSON.stringify({ requestedPolicyVersion: "integer" }),
|
|
1291
|
+
clean: jsonInputClean,
|
|
1292
|
+
required: false
|
|
1293
|
+
});
|
|
1294
|
+
const policy = (0, _prismatic_io_spectral.input)({
|
|
1295
|
+
label: "Policy",
|
|
1296
|
+
type: "code",
|
|
1297
|
+
language: "json",
|
|
1298
|
+
comments: "The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.",
|
|
1299
|
+
example: "Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/Policy",
|
|
1300
|
+
clean: jsonInputClean,
|
|
1301
|
+
required: false
|
|
1302
|
+
});
|
|
1303
|
+
const getPolicyInputs = {
|
|
1304
|
+
connectionInput,
|
|
1305
|
+
resource,
|
|
1306
|
+
options
|
|
1307
|
+
};
|
|
1308
|
+
const setPolicyInputs = {
|
|
1309
|
+
connectionInput,
|
|
1310
|
+
resource,
|
|
1311
|
+
policy,
|
|
1312
|
+
updateMask
|
|
1313
|
+
};
|
|
1314
|
+
const pollChangesInputs = {
|
|
1315
|
+
connectionInput,
|
|
1316
|
+
projectId,
|
|
1317
|
+
lookBackDate: (0, _prismatic_io_spectral.input)({
|
|
1318
|
+
label: "Look-back Date",
|
|
1319
|
+
placeholder: "Enter look-back date (YYYY-MM-DD)",
|
|
1320
|
+
type: "string",
|
|
1321
|
+
required: false,
|
|
1322
|
+
comments: "The date the initial sync starts from, in YYYY-MM-DD format. Cannot be a future date. Leave empty to start from the first recurrence with no backfill. When set, the initial sync seeds each job created on or after this date once.",
|
|
1323
|
+
example: "2026-01-01",
|
|
1324
|
+
clean: lookBackDateClean
|
|
1325
|
+
})
|
|
1326
|
+
};
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region src/inputs/projects.ts
|
|
1329
|
+
const getServiceAccountInputs = {
|
|
1330
|
+
connectionInput,
|
|
1331
|
+
projectId
|
|
1332
|
+
};
|
|
1333
|
+
const listProjectsInputs = {
|
|
1334
|
+
connectionInput,
|
|
1335
|
+
fetchAll,
|
|
1336
|
+
pagination: paginationFields
|
|
1337
|
+
};
|
|
1338
|
+
//#endregion
|
|
1339
|
+
//#region src/inputs/routines.ts
|
|
1340
|
+
const routineId = (0, _prismatic_io_spectral.input)({
|
|
1341
|
+
label: "Routine ID",
|
|
1342
|
+
type: "string",
|
|
1343
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1344
|
+
comments: "The unique identifier for the routine.",
|
|
1345
|
+
example: "my_routine",
|
|
1346
|
+
placeholder: "Enter routine ID",
|
|
1347
|
+
required: true,
|
|
1348
|
+
dataSource: "selectRoutine"
|
|
1349
|
+
});
|
|
1350
|
+
const readMask = (0, _prismatic_io_spectral.input)({
|
|
1351
|
+
label: "Read Mask",
|
|
1352
|
+
type: "string",
|
|
1353
|
+
clean: cleanString,
|
|
1354
|
+
comments: "If set, only the Routine fields in the field mask are returned in the response. If unset, all Routine fields are returned. This is a comma-separated list of fully qualified names of fields. Example: 'user.displayName,photo'.",
|
|
1355
|
+
example: "user.displayName,photo",
|
|
1356
|
+
placeholder: "Enter read mask",
|
|
1357
|
+
required: false
|
|
1358
|
+
});
|
|
1359
|
+
const routineType = (0, _prismatic_io_spectral.input)({
|
|
1360
|
+
label: "Routine Type",
|
|
1361
|
+
type: "string",
|
|
1362
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1363
|
+
comments: "The type of routine. One of ROUTINE_TYPE_UNSPECIFIED / SCALAR_FUNCTION / PROCEDURE / TABLE_VALUED_FUNCTION",
|
|
1364
|
+
example: "SCALAR_FUNCTION",
|
|
1365
|
+
placeholder: "Enter routine type",
|
|
1366
|
+
required: true
|
|
1367
|
+
});
|
|
1368
|
+
const definitionBody = (0, _prismatic_io_spectral.input)({
|
|
1369
|
+
label: "Definition Body",
|
|
1370
|
+
type: "string",
|
|
1371
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1372
|
+
comments: "Required. The body of the routine. For functions, this is the expression in the AS clause. If language=SQL, it is the substring inside (but excluding) the parentheses. For example, for the function created with the following statement: CREATE FUNCTION JoinLines(x string, y string) as (concat(x, '\\n', y)) The definitionBody is concat(x, '\\n', y) (\\n is not replaced with linebreak). If language=JAVASCRIPT, it is the evaluated string in the AS clause. For example, for the function created with the following statement: CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return '\\n';\\n'The definitionBody is return '\\n';\\n Note that both \\n are replaced with linebreaks.",
|
|
1373
|
+
example: "concat(x, '\\n', y)",
|
|
1374
|
+
placeholder: "Enter definition body",
|
|
1375
|
+
required: true
|
|
1376
|
+
});
|
|
1377
|
+
const determinismLevel = (0, _prismatic_io_spectral.input)({
|
|
1378
|
+
label: "Determinism Level",
|
|
1379
|
+
type: "string",
|
|
1380
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1381
|
+
comments: "Optional. The determinism level of the JavaScript UDF, if defined. One of DETERMINISM_LEVEL_UNSPECIFIED / DETERMINISTIC / NOT_DETERMINISTIC",
|
|
1382
|
+
example: "DETERMINISTIC",
|
|
1383
|
+
placeholder: "Enter determinism level",
|
|
1384
|
+
required: false
|
|
1385
|
+
});
|
|
1386
|
+
const language = (0, _prismatic_io_spectral.input)({
|
|
1387
|
+
label: "Language",
|
|
1388
|
+
type: "string",
|
|
1389
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1390
|
+
comments: "Optional. Defaults to 'SQL' if remoteFunctionOptions field is absent, not set otherwise. One of LANGUAGE_UNSPECIFIED / SQL / JAVASCRIPT / PYTHON / JAVA / SCALA",
|
|
1391
|
+
example: "SQL",
|
|
1392
|
+
placeholder: "Enter language",
|
|
1393
|
+
required: false
|
|
1394
|
+
});
|
|
1395
|
+
const importedLibraries = (0, _prismatic_io_spectral.input)({
|
|
1396
|
+
label: "Imported Libraries",
|
|
1397
|
+
type: "string",
|
|
1398
|
+
collection: "valuelist",
|
|
1399
|
+
required: false,
|
|
1400
|
+
comments: "Optional. If language = 'JAVASCRIPT', this field stores the path of the imported JAVASCRIPT libraries.",
|
|
1401
|
+
example: "[\"gs://bucket/path/lib.js\"]",
|
|
1402
|
+
placeholder: "Enter library paths",
|
|
1403
|
+
clean: valueListInputClean
|
|
1404
|
+
});
|
|
1405
|
+
const routineReference = (0, _prismatic_io_spectral.input)({
|
|
1406
|
+
label: "Routine Reference",
|
|
1407
|
+
type: "code",
|
|
1408
|
+
language: "json",
|
|
1409
|
+
comments: "Reference describing the ID of this routine.",
|
|
1410
|
+
example: JSON.stringify({
|
|
1411
|
+
projectId: "string",
|
|
1412
|
+
datasetId: "string",
|
|
1413
|
+
routineId: "string"
|
|
1414
|
+
}),
|
|
1415
|
+
clean: jsonInputClean,
|
|
1416
|
+
required: true
|
|
1417
|
+
});
|
|
1418
|
+
const argument = (0, _prismatic_io_spectral.input)({
|
|
1419
|
+
label: "Arguments",
|
|
1420
|
+
type: "code",
|
|
1421
|
+
language: "json",
|
|
1422
|
+
comments: "Input/output argument of a function or a stored procedure.",
|
|
1423
|
+
example: "Reference to the Google docs for this input. An array of https://cloud.google.com/bigquery/docs/reference/rest/v2/routines#argument",
|
|
1424
|
+
clean: jsonInputClean,
|
|
1425
|
+
required: false
|
|
1426
|
+
});
|
|
1427
|
+
const returnType = (0, _prismatic_io_spectral.input)({
|
|
1428
|
+
label: "Return Type",
|
|
1429
|
+
type: "code",
|
|
1430
|
+
language: "json",
|
|
1431
|
+
comments: "Optional if language = 'SQL'; required otherwise. Cannot be set if routineType = 'TABLE_VALUED_FUNCTION'. If absent, the return type is inferred from definitionBody at query time in each query that references this routine. If present, then the evaluated result will be cast to the specified returned type at query time.",
|
|
1432
|
+
example: "Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/StandardSqlDataType",
|
|
1433
|
+
clean: jsonInputClean,
|
|
1434
|
+
required: false
|
|
1435
|
+
});
|
|
1436
|
+
const returnTableType = (0, _prismatic_io_spectral.input)({
|
|
1437
|
+
label: "Return Table Type",
|
|
1438
|
+
type: "code",
|
|
1439
|
+
language: "json",
|
|
1440
|
+
comments: "Optional. Can be set only if routineType = 'TABLE_VALUED_FUNCTION'. If absent, the return table type is inferred from definitionBody at query time in each query that references this routine. If present, then the columns in the evaluated table result will be cast to match the column types specified in return table type, at query time.",
|
|
1441
|
+
example: "Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/StandardSqlDataType",
|
|
1442
|
+
clean: jsonInputClean,
|
|
1443
|
+
required: false
|
|
1444
|
+
});
|
|
1445
|
+
const remoteFunctionOptions = (0, _prismatic_io_spectral.input)({
|
|
1446
|
+
label: "Remote Function Options",
|
|
1447
|
+
type: "code",
|
|
1448
|
+
language: "json",
|
|
1449
|
+
comments: "Optional. Remote function specific options.",
|
|
1450
|
+
example: JSON.stringify({
|
|
1451
|
+
endpoint: "string",
|
|
1452
|
+
connection: "string",
|
|
1453
|
+
userDefinedContext: {
|
|
1454
|
+
string: "string",
|
|
1455
|
+
string2: "string",
|
|
1456
|
+
string3: "string"
|
|
1457
|
+
},
|
|
1458
|
+
maxBatchingRows: "string"
|
|
1459
|
+
}),
|
|
1460
|
+
clean: jsonInputClean,
|
|
1461
|
+
required: false
|
|
1462
|
+
});
|
|
1463
|
+
const sparkOptions = (0, _prismatic_io_spectral.input)({
|
|
1464
|
+
label: "Spark Options",
|
|
1465
|
+
type: "code",
|
|
1466
|
+
language: "json",
|
|
1467
|
+
comments: "Optional. Spark specific options.",
|
|
1468
|
+
example: JSON.stringify({
|
|
1469
|
+
connection: "string",
|
|
1470
|
+
runtimeVersion: "string",
|
|
1471
|
+
containerImage: "string",
|
|
1472
|
+
properties: {
|
|
1473
|
+
string: "string",
|
|
1474
|
+
string2: "string",
|
|
1475
|
+
string3: "string"
|
|
1476
|
+
},
|
|
1477
|
+
mainFileUri: "string",
|
|
1478
|
+
pyFileUris: ["string"],
|
|
1479
|
+
jarUris: ["string"],
|
|
1480
|
+
fileUris: ["string"],
|
|
1481
|
+
archiveUris: ["string"],
|
|
1482
|
+
mainClass: "string"
|
|
1483
|
+
}),
|
|
1484
|
+
clean: jsonInputClean,
|
|
1485
|
+
required: false
|
|
1486
|
+
});
|
|
1487
|
+
const routineAdditionalFields = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
1488
|
+
label: "Additional Fields",
|
|
1489
|
+
required: false,
|
|
1490
|
+
comments: "Additional optional fields.",
|
|
1491
|
+
inputs: {
|
|
1492
|
+
etag,
|
|
1493
|
+
argument,
|
|
1494
|
+
returnTableType,
|
|
1495
|
+
returnType,
|
|
1496
|
+
creationTime,
|
|
1497
|
+
lastModifiedTime,
|
|
1498
|
+
language,
|
|
1499
|
+
importedLibraries,
|
|
1500
|
+
description: {
|
|
1501
|
+
...description,
|
|
1502
|
+
comments: "Optional. The description of the routine, if defined."
|
|
1503
|
+
},
|
|
1504
|
+
determinismLevel,
|
|
1505
|
+
remoteFunctionOptions,
|
|
1506
|
+
sparkOptions
|
|
1507
|
+
}
|
|
1508
|
+
});
|
|
1509
|
+
const createRoutineInputs = {
|
|
1510
|
+
connectionInput,
|
|
1511
|
+
datasetId,
|
|
1512
|
+
projectId,
|
|
1513
|
+
routineReference,
|
|
1514
|
+
routineType,
|
|
1515
|
+
definitionBody,
|
|
1516
|
+
additionalFields: routineAdditionalFields
|
|
1517
|
+
};
|
|
1518
|
+
const deleteRoutineInputs = {
|
|
1519
|
+
connectionInput,
|
|
1520
|
+
datasetId,
|
|
1521
|
+
projectId,
|
|
1522
|
+
routineId
|
|
1523
|
+
};
|
|
1524
|
+
const getRoutineInputs = {
|
|
1525
|
+
connectionInput,
|
|
1526
|
+
datasetId,
|
|
1527
|
+
projectId,
|
|
1528
|
+
readMask,
|
|
1529
|
+
routineId
|
|
1530
|
+
};
|
|
1531
|
+
const listRoutinesInputs = {
|
|
1532
|
+
connectionInput,
|
|
1533
|
+
projectId,
|
|
1534
|
+
datasetId,
|
|
1535
|
+
fetchAll,
|
|
1536
|
+
pagination: paginationFields,
|
|
1537
|
+
filter,
|
|
1538
|
+
readMask
|
|
1539
|
+
};
|
|
1540
|
+
const updateRoutineInputs = {
|
|
1541
|
+
connectionInput,
|
|
1542
|
+
datasetId,
|
|
1543
|
+
projectId,
|
|
1544
|
+
routineReference,
|
|
1545
|
+
routineType,
|
|
1546
|
+
definitionBody,
|
|
1547
|
+
additionalFields: routineAdditionalFields
|
|
1548
|
+
};
|
|
1549
|
+
//#endregion
|
|
1550
|
+
//#region src/inputs/tableData.ts
|
|
1551
|
+
const skipInvalidRows = (0, _prismatic_io_spectral.input)({
|
|
1552
|
+
label: "Skip Invalid Rows",
|
|
1553
|
+
type: "boolean",
|
|
1554
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
1555
|
+
comments: "When true, inserts all valid rows of a request even if invalid rows exist. Default is false, which causes the entire request to fail if any invalid rows exist.",
|
|
1556
|
+
required: false
|
|
1557
|
+
});
|
|
1558
|
+
const ignoreUnknownValues = (0, _prismatic_io_spectral.input)({
|
|
1559
|
+
label: "Ignore Unknown Values",
|
|
1560
|
+
type: "boolean",
|
|
1561
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
1562
|
+
comments: "When true, accepts rows that contain values that do not match the schema. The unknown values are ignored. Default is false, which treats unknown values as errors.",
|
|
1563
|
+
required: false
|
|
1564
|
+
});
|
|
1565
|
+
const templateSuffix = (0, _prismatic_io_spectral.input)({
|
|
1566
|
+
label: "Template Suffix",
|
|
1567
|
+
type: "string",
|
|
1568
|
+
clean: cleanString,
|
|
1569
|
+
comments: "Optional. If specified, treats the destination table as a base template, and inserts the rows into an instance table named '{destination}{templateSuffix}'. BigQuery will manage creation of the instance table, using the schema of the base template table. \nSee https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables for considerations when working with templates tables.",
|
|
1570
|
+
example: "_20240101",
|
|
1571
|
+
placeholder: "Enter template suffix",
|
|
1572
|
+
required: false
|
|
1573
|
+
});
|
|
1574
|
+
(0, _prismatic_io_spectral.input)({
|
|
1575
|
+
label: "Trace ID",
|
|
1576
|
+
type: "string",
|
|
1577
|
+
clean: cleanString,
|
|
1578
|
+
comments: "Unique request trace ID. Used for debugging purposes only. It is case-sensitive, limited to up to 36 ASCII characters. A UUID is recommended.",
|
|
1579
|
+
example: "550e8400-e29b-41d4-a716-446655440000",
|
|
1580
|
+
placeholder: "Enter trace ID",
|
|
1581
|
+
required: false
|
|
1582
|
+
});
|
|
1583
|
+
const tableDataInsertAllInputs = {
|
|
1584
|
+
connectionInput,
|
|
1585
|
+
datasetId,
|
|
1586
|
+
projectId,
|
|
1587
|
+
tableId,
|
|
1588
|
+
rows: (0, _prismatic_io_spectral.input)({
|
|
1589
|
+
label: "Rows",
|
|
1590
|
+
type: "code",
|
|
1591
|
+
language: "json",
|
|
1592
|
+
comments: "The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Google Cloud services (such as Projects) might reject them.",
|
|
1593
|
+
example: JSON.stringify([{
|
|
1594
|
+
insertId: "string",
|
|
1595
|
+
json: "follow this structure: https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Struct"
|
|
1596
|
+
}]),
|
|
1597
|
+
clean: jsonInputClean,
|
|
1598
|
+
required: false
|
|
1599
|
+
}),
|
|
1600
|
+
additionalFields: (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
1601
|
+
label: "Additional Fields",
|
|
1602
|
+
required: false,
|
|
1603
|
+
comments: "Additional optional fields.",
|
|
1604
|
+
inputs: {
|
|
1605
|
+
kind,
|
|
1606
|
+
skipInvalidRows,
|
|
1607
|
+
ignoreUnknownValues,
|
|
1608
|
+
templateSuffix
|
|
1609
|
+
}
|
|
1610
|
+
})
|
|
1611
|
+
};
|
|
1612
|
+
//#endregion
|
|
1613
|
+
//#region src/inputs/tables.ts
|
|
1614
|
+
const requirePartitionFilter = (0, _prismatic_io_spectral.input)({
|
|
1615
|
+
label: "Require Partition Filter",
|
|
1616
|
+
type: "boolean",
|
|
1617
|
+
clean: _prismatic_io_spectral.util.types.toBool,
|
|
1618
|
+
comments: "When true, queries over this table require a partition filter that can be used for partition elimination to be specified.",
|
|
1619
|
+
required: false
|
|
1620
|
+
});
|
|
1621
|
+
(0, _prismatic_io_spectral.input)({
|
|
1622
|
+
label: "Num Bytes",
|
|
1623
|
+
type: "string",
|
|
1624
|
+
clean: cleanString,
|
|
1625
|
+
comments: "Output only. The size of this table in logical bytes, excluding any data in the streaming buffer.",
|
|
1626
|
+
example: "1234567890",
|
|
1627
|
+
placeholder: "Enter number of bytes",
|
|
1628
|
+
required: false
|
|
1629
|
+
});
|
|
1630
|
+
(0, _prismatic_io_spectral.input)({
|
|
1631
|
+
label: "Num Long Term Bytes",
|
|
1632
|
+
type: "string",
|
|
1633
|
+
clean: cleanString,
|
|
1634
|
+
comments: "Output only. The number of logical bytes in the table that are considered 'long-term storage'.",
|
|
1635
|
+
example: "9876543210",
|
|
1636
|
+
placeholder: "Enter number of long-term bytes",
|
|
1637
|
+
required: false
|
|
1638
|
+
});
|
|
1639
|
+
(0, _prismatic_io_spectral.input)({
|
|
1640
|
+
label: "Num Rows",
|
|
1641
|
+
type: "string",
|
|
1642
|
+
clean: cleanString,
|
|
1643
|
+
comments: "Output only. The number of rows of data in this table, excluding any data in the streaming buffer.",
|
|
1644
|
+
example: "1000000",
|
|
1645
|
+
placeholder: "Enter number of rows",
|
|
1646
|
+
required: false
|
|
1647
|
+
});
|
|
1648
|
+
(0, _prismatic_io_spectral.input)({
|
|
1649
|
+
label: "Type",
|
|
1650
|
+
type: "string",
|
|
1651
|
+
clean: cleanString,
|
|
1652
|
+
comments: "Output only. Describes the table type. The following values are supported:\n TABLE: A normal BigQuery table.\nVIEW: A virtual table defined by a SQL query. \nEXTERNAL: A table that references data stored in an external storage system, such as Google Cloud Storage. \nMATERIALIZED_VIEW: A precomputed view defined by a SQL query. \nSNAPSHOT: An immutable BigQuery table that preserves the contents of a base table at a particular time. See additional information on table snapshots. \nThe default value is TABLE.",
|
|
1653
|
+
example: "TABLE",
|
|
1654
|
+
placeholder: "Enter table type",
|
|
1655
|
+
required: false
|
|
1656
|
+
});
|
|
1657
|
+
const maxStaleness = (0, _prismatic_io_spectral.input)({
|
|
1658
|
+
label: "Max Staleness",
|
|
1659
|
+
type: "string",
|
|
1660
|
+
clean: _prismatic_io_spectral.util.types.toString,
|
|
1661
|
+
comments: "Optional. The maximum staleness of data that could be returned when the table (or stale MV) is queried. Staleness encoded as a string encoding of sql IntervalValue type.",
|
|
1662
|
+
example: "INTERVAL 1 DAY",
|
|
1663
|
+
placeholder: "Enter max staleness",
|
|
1664
|
+
required: false
|
|
1665
|
+
});
|
|
1666
|
+
const view = (0, _prismatic_io_spectral.input)({
|
|
1667
|
+
label: "View",
|
|
1668
|
+
type: "string",
|
|
1669
|
+
clean: cleanString,
|
|
1670
|
+
comments: "Optional. Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned. One of TABLE_METADATA_VIEW_UNSPECIFIED / BASIC / STORAGE_STATS / FULL",
|
|
1671
|
+
example: "FULL",
|
|
1672
|
+
placeholder: "Enter view type",
|
|
1673
|
+
required: false
|
|
1674
|
+
});
|
|
1675
|
+
const schema = (0, _prismatic_io_spectral.input)({
|
|
1676
|
+
label: "Schema",
|
|
1677
|
+
type: "code",
|
|
1678
|
+
language: "json",
|
|
1679
|
+
comments: "Optional. Describes the schema of this table.",
|
|
1680
|
+
example: "Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#tableschema",
|
|
1681
|
+
clean: jsonInputClean,
|
|
1682
|
+
required: false
|
|
1683
|
+
});
|
|
1684
|
+
const timePartitioning = (0, _prismatic_io_spectral.input)({
|
|
1685
|
+
label: "Time Partitioning",
|
|
1686
|
+
type: "code",
|
|
1687
|
+
language: "json",
|
|
1688
|
+
comments: "If specified, configures time-based partitioning for this table.",
|
|
1689
|
+
example: JSON.stringify({
|
|
1690
|
+
type: "string",
|
|
1691
|
+
expirationMs: "string",
|
|
1692
|
+
field: "string",
|
|
1693
|
+
requirePartitionFilter: false
|
|
1694
|
+
}),
|
|
1695
|
+
clean: jsonInputClean,
|
|
1696
|
+
required: false
|
|
1697
|
+
});
|
|
1698
|
+
const rangePartitioning = (0, _prismatic_io_spectral.input)({
|
|
1699
|
+
label: "Range Partitioning",
|
|
1700
|
+
type: "code",
|
|
1701
|
+
language: "json",
|
|
1702
|
+
comments: "If specified, configures range partitioning for this table.",
|
|
1703
|
+
example: JSON.stringify({
|
|
1704
|
+
field: "string",
|
|
1705
|
+
range: {
|
|
1706
|
+
start: "string",
|
|
1707
|
+
end: "string",
|
|
1708
|
+
interval: "string"
|
|
1709
|
+
}
|
|
1710
|
+
}),
|
|
1711
|
+
clean: jsonInputClean,
|
|
1712
|
+
required: false
|
|
1713
|
+
});
|
|
1714
|
+
const clustering = (0, _prismatic_io_spectral.input)({
|
|
1715
|
+
label: "Clustering",
|
|
1716
|
+
type: "code",
|
|
1717
|
+
language: "json",
|
|
1718
|
+
comments: "Clustering specification for the table. Must be specified with time-based partitioning, data in the table will be first partitioned and subsequently clustered.",
|
|
1719
|
+
example: JSON.stringify({ fields: [
|
|
1720
|
+
"string",
|
|
1721
|
+
"string",
|
|
1722
|
+
"string"
|
|
1723
|
+
] }),
|
|
1724
|
+
clean: jsonInputClean,
|
|
1725
|
+
required: false
|
|
1726
|
+
});
|
|
1727
|
+
const tableReference = (0, _prismatic_io_spectral.input)({
|
|
1728
|
+
label: "Table Reference",
|
|
1729
|
+
type: "code",
|
|
1730
|
+
language: "json",
|
|
1731
|
+
comments: "Reference describing the ID of this routine.",
|
|
1732
|
+
example: JSON.stringify({
|
|
1733
|
+
projectId: "string",
|
|
1734
|
+
datasetId: "string",
|
|
1735
|
+
tableId: "string"
|
|
1736
|
+
}),
|
|
1737
|
+
clean: jsonInputClean,
|
|
1738
|
+
required: true
|
|
1739
|
+
});
|
|
1740
|
+
const tableView = (0, _prismatic_io_spectral.input)({
|
|
1741
|
+
label: "View",
|
|
1742
|
+
type: "code",
|
|
1743
|
+
language: "json",
|
|
1744
|
+
comments: "Optional. The view definition.",
|
|
1745
|
+
example: JSON.stringify({
|
|
1746
|
+
query: "string",
|
|
1747
|
+
userDefinedFunctionResources: [{
|
|
1748
|
+
resourceUri: "string",
|
|
1749
|
+
inlineCode: "string"
|
|
1750
|
+
}],
|
|
1751
|
+
useLegacySql: false
|
|
1752
|
+
}),
|
|
1753
|
+
clean: jsonInputClean,
|
|
1754
|
+
required: false
|
|
1755
|
+
});
|
|
1756
|
+
const materializedView = (0, _prismatic_io_spectral.input)({
|
|
1757
|
+
label: "Materialized View",
|
|
1758
|
+
type: "code",
|
|
1759
|
+
language: "json",
|
|
1760
|
+
comments: "Optional. The materialized view definition.",
|
|
1761
|
+
example: JSON.stringify({
|
|
1762
|
+
refreshWatermark: "string",
|
|
1763
|
+
lastRefreshStatus: {
|
|
1764
|
+
reason: "string",
|
|
1765
|
+
location: "string",
|
|
1766
|
+
debugInfo: "string",
|
|
1767
|
+
message: "string"
|
|
1768
|
+
}
|
|
1769
|
+
}),
|
|
1770
|
+
clean: jsonInputClean,
|
|
1771
|
+
required: false
|
|
1772
|
+
});
|
|
1773
|
+
(0, _prismatic_io_spectral.input)({
|
|
1774
|
+
label: "Materialized View Status",
|
|
1775
|
+
type: "code",
|
|
1776
|
+
language: "json",
|
|
1777
|
+
comments: "Optional. The materialized view status.",
|
|
1778
|
+
example: JSON.stringify({
|
|
1779
|
+
refreshWatermark: "string",
|
|
1780
|
+
lastRefreshStatus: {
|
|
1781
|
+
reason: "string",
|
|
1782
|
+
location: "string",
|
|
1783
|
+
debugInfo: "string",
|
|
1784
|
+
message: "string"
|
|
1785
|
+
}
|
|
1786
|
+
}),
|
|
1787
|
+
clean: jsonInputClean,
|
|
1788
|
+
required: false
|
|
1789
|
+
});
|
|
1790
|
+
const externalDataConfiguration = (0, _prismatic_io_spectral.input)({
|
|
1791
|
+
label: "External Data Configuration",
|
|
1792
|
+
type: "code",
|
|
1793
|
+
language: "json",
|
|
1794
|
+
comments: "Optional. Describes the data format, location, and other properties of a table stored outside of BigQuery. By defining these properties, the data source can then be queried as if it were a standard BigQuery table.",
|
|
1795
|
+
example: "Reference to the Google docs for this input. https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#externaldataconfiguration",
|
|
1796
|
+
clean: jsonInputClean,
|
|
1797
|
+
required: false
|
|
1798
|
+
});
|
|
1799
|
+
(0, _prismatic_io_spectral.input)({
|
|
1800
|
+
label: "Streaming Buffer",
|
|
1801
|
+
type: "code",
|
|
1802
|
+
language: "json",
|
|
1803
|
+
comments: "Output only. Contains information regarding this table's streaming buffer, if one is present. This field will be absent if the table is not being streamed to or if there is no data in the streaming buffer.",
|
|
1804
|
+
example: JSON.stringify({
|
|
1805
|
+
estimatedBytes: "string",
|
|
1806
|
+
estimatedRows: "string",
|
|
1807
|
+
oldestEntryTime: "string"
|
|
1808
|
+
}),
|
|
1809
|
+
clean: jsonInputClean,
|
|
1810
|
+
required: false
|
|
1811
|
+
});
|
|
1812
|
+
(0, _prismatic_io_spectral.input)({
|
|
1813
|
+
label: "Snapshot Definition",
|
|
1814
|
+
type: "code",
|
|
1815
|
+
language: "json",
|
|
1816
|
+
comments: "Output only. Contains information about the snapshot. This value is set via snapshot creation.",
|
|
1817
|
+
example: JSON.stringify({
|
|
1818
|
+
baseTableReference: {
|
|
1819
|
+
projectId: "string",
|
|
1820
|
+
datasetId: "string",
|
|
1821
|
+
tableId: "string"
|
|
1822
|
+
},
|
|
1823
|
+
snapshotTime: "string"
|
|
1824
|
+
}),
|
|
1825
|
+
clean: jsonInputClean,
|
|
1826
|
+
required: false
|
|
1827
|
+
});
|
|
1828
|
+
(0, _prismatic_io_spectral.input)({
|
|
1829
|
+
label: "Clone Definition",
|
|
1830
|
+
type: "code",
|
|
1831
|
+
language: "json",
|
|
1832
|
+
comments: "Output only. Contains information about the clone. This value is set via the clone operation.",
|
|
1833
|
+
example: JSON.stringify({
|
|
1834
|
+
baseTableReference: {
|
|
1835
|
+
projectId: "string",
|
|
1836
|
+
datasetId: "string",
|
|
1837
|
+
tableId: "string"
|
|
1838
|
+
},
|
|
1839
|
+
cloneTime: "string"
|
|
1840
|
+
}),
|
|
1841
|
+
clean: jsonInputClean,
|
|
1842
|
+
required: false
|
|
1843
|
+
});
|
|
1844
|
+
(0, _prismatic_io_spectral.input)({
|
|
1845
|
+
label: "Table Constraints",
|
|
1846
|
+
type: "code",
|
|
1847
|
+
language: "json",
|
|
1848
|
+
comments: "Optional. Tables Primary Key and Foreign Key information",
|
|
1849
|
+
example: JSON.stringify({
|
|
1850
|
+
primaryKey: { columns: ["string"] },
|
|
1851
|
+
foreignKeys: [{
|
|
1852
|
+
name: "string",
|
|
1853
|
+
referencedTable: {
|
|
1854
|
+
projectId: "string",
|
|
1855
|
+
datasetId: "string",
|
|
1856
|
+
tableId: "string"
|
|
1857
|
+
},
|
|
1858
|
+
columnReferences: [{
|
|
1859
|
+
referencingColumn: "string",
|
|
1860
|
+
referencedColumn: "string"
|
|
1861
|
+
}]
|
|
1862
|
+
}]
|
|
1863
|
+
}),
|
|
1864
|
+
clean: jsonInputClean,
|
|
1865
|
+
required: false
|
|
1866
|
+
});
|
|
1867
|
+
const tableAdditionalFields = (0, _prismatic_io_spectral.structuredObjectInput)({
|
|
1868
|
+
label: "Additional Fields",
|
|
1869
|
+
required: false,
|
|
1870
|
+
comments: "Additional optional fields.",
|
|
1871
|
+
inputs: {
|
|
1872
|
+
kind,
|
|
1873
|
+
friendlyName,
|
|
1874
|
+
description,
|
|
1875
|
+
labels,
|
|
1876
|
+
schema,
|
|
1877
|
+
timePartitioning,
|
|
1878
|
+
rangePartitioning,
|
|
1879
|
+
clustering,
|
|
1880
|
+
requirePartitionFilter,
|
|
1881
|
+
expirationTime,
|
|
1882
|
+
view: tableView,
|
|
1883
|
+
materializedView,
|
|
1884
|
+
externalDataConfiguration,
|
|
1885
|
+
encryptionConfiguration,
|
|
1886
|
+
defaultCollation,
|
|
1887
|
+
defaultRoundingMode,
|
|
1888
|
+
maxStaleness
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
const createTableInputs = {
|
|
1892
|
+
connectionInput,
|
|
1893
|
+
tableReference,
|
|
1894
|
+
datasetId: (0, _prismatic_io_spectral.input)({
|
|
1895
|
+
...datasetId,
|
|
1896
|
+
required: true,
|
|
1897
|
+
comments: "Dataset ID of the table to update."
|
|
1898
|
+
}),
|
|
1899
|
+
projectId: (0, _prismatic_io_spectral.input)({
|
|
1900
|
+
...projectId,
|
|
1901
|
+
required: true,
|
|
1902
|
+
comments: "Project ID of the table to update."
|
|
1903
|
+
}),
|
|
1904
|
+
additionalFields: tableAdditionalFields
|
|
1905
|
+
};
|
|
1906
|
+
const deleteTableInputs = {
|
|
1907
|
+
connectionInput,
|
|
1908
|
+
datasetId: (0, _prismatic_io_spectral.input)({
|
|
1909
|
+
...datasetId,
|
|
1910
|
+
required: true,
|
|
1911
|
+
comments: "Dataset ID of the table to delete."
|
|
1912
|
+
}),
|
|
1913
|
+
projectId: (0, _prismatic_io_spectral.input)({
|
|
1914
|
+
...projectId,
|
|
1915
|
+
required: true,
|
|
1916
|
+
comments: "Project ID of the table to delete."
|
|
1917
|
+
}),
|
|
1918
|
+
tableId: (0, _prismatic_io_spectral.input)({
|
|
1919
|
+
...tableId,
|
|
1920
|
+
required: true,
|
|
1921
|
+
comments: "Table ID of the table to delete."
|
|
1922
|
+
})
|
|
1923
|
+
};
|
|
1924
|
+
const getTableInputs = {
|
|
1925
|
+
connectionInput,
|
|
1926
|
+
datasetId: (0, _prismatic_io_spectral.input)({
|
|
1927
|
+
...datasetId,
|
|
1928
|
+
required: true,
|
|
1929
|
+
comments: "Dataset ID of the requested table."
|
|
1930
|
+
}),
|
|
1931
|
+
projectId: (0, _prismatic_io_spectral.input)({
|
|
1932
|
+
...projectId,
|
|
1933
|
+
required: true,
|
|
1934
|
+
comments: "Project ID of the requested table."
|
|
1935
|
+
}),
|
|
1936
|
+
tableId: (0, _prismatic_io_spectral.input)({
|
|
1937
|
+
...tableId,
|
|
1938
|
+
required: true,
|
|
1939
|
+
comments: "Table ID of the requested table."
|
|
1940
|
+
}),
|
|
1941
|
+
selectedFields,
|
|
1942
|
+
view
|
|
1943
|
+
};
|
|
1944
|
+
const listTablesInputs = {
|
|
1945
|
+
connectionInput,
|
|
1946
|
+
projectId: (0, _prismatic_io_spectral.input)({
|
|
1947
|
+
...projectId,
|
|
1948
|
+
required: true,
|
|
1949
|
+
comments: "Project ID of the tables to list."
|
|
1950
|
+
}),
|
|
1951
|
+
datasetId: (0, _prismatic_io_spectral.input)({
|
|
1952
|
+
...datasetId,
|
|
1953
|
+
required: true,
|
|
1954
|
+
comments: "Dataset ID of the tables to list."
|
|
1955
|
+
}),
|
|
1956
|
+
fetchAll,
|
|
1957
|
+
pagination: tableListPaginationFields
|
|
1958
|
+
};
|
|
1959
|
+
const patchTableInputs = {
|
|
1960
|
+
connectionInput,
|
|
1961
|
+
datasetId: (0, _prismatic_io_spectral.input)({
|
|
1962
|
+
...datasetId,
|
|
1963
|
+
required: true,
|
|
1964
|
+
comments: "Dataset ID of the table to patch."
|
|
1965
|
+
}),
|
|
1966
|
+
projectId: (0, _prismatic_io_spectral.input)({
|
|
1967
|
+
...projectId,
|
|
1968
|
+
required: true,
|
|
1969
|
+
comments: "Project ID of the table to patch."
|
|
1970
|
+
}),
|
|
1971
|
+
tableId: (0, _prismatic_io_spectral.input)({
|
|
1972
|
+
...tableId,
|
|
1973
|
+
required: true,
|
|
1974
|
+
comments: "Table ID of the table to patch."
|
|
1975
|
+
}),
|
|
1976
|
+
tableReference,
|
|
1977
|
+
additionalFields: tableAdditionalFields
|
|
1978
|
+
};
|
|
1979
|
+
const updateTableInputs = {
|
|
1980
|
+
connectionInput,
|
|
1981
|
+
datasetId: (0, _prismatic_io_spectral.input)({
|
|
1982
|
+
...datasetId,
|
|
1983
|
+
required: true,
|
|
1984
|
+
comments: "Dataset ID of the table to update."
|
|
1985
|
+
}),
|
|
1986
|
+
projectId: (0, _prismatic_io_spectral.input)({
|
|
1987
|
+
...projectId,
|
|
1988
|
+
required: true,
|
|
1989
|
+
comments: "Project ID of the table to update."
|
|
1990
|
+
}),
|
|
1991
|
+
tableId: (0, _prismatic_io_spectral.input)({
|
|
1992
|
+
...tableId,
|
|
1993
|
+
required: true,
|
|
1994
|
+
comments: "Table ID of the table to update."
|
|
1995
|
+
}),
|
|
1996
|
+
tableReference,
|
|
1997
|
+
additionalFields: tableAdditionalFields
|
|
1998
|
+
};
|
|
1999
|
+
//#endregion
|
|
2000
|
+
//#region src/actions/datasets/createDataset.ts
|
|
2001
|
+
const createDataset = (0, _prismatic_io_spectral.action)({
|
|
2002
|
+
display: {
|
|
2003
|
+
description: "Creates a new empty dataset.",
|
|
2004
|
+
label: "Create Dataset"
|
|
2005
|
+
},
|
|
2006
|
+
inputs: createDatasetInputs,
|
|
2007
|
+
perform: async (_context, { connectionInput, projectId, datasetReference, additionalFields = {} }) => {
|
|
2008
|
+
const { data } = await createClient(connectionInput).datasets.insert({
|
|
2009
|
+
projectId: projectId || void 0,
|
|
2010
|
+
requestBody: {
|
|
2011
|
+
kind: additionalFields.kind || void 0,
|
|
2012
|
+
etag: additionalFields.etag || void 0,
|
|
2013
|
+
id: additionalFields.id || void 0,
|
|
2014
|
+
selfLink: additionalFields.selfLink || void 0,
|
|
2015
|
+
datasetReference: datasetReference || void 0,
|
|
2016
|
+
friendlyName: additionalFields.friendlyName || void 0,
|
|
2017
|
+
description: additionalFields.description || void 0,
|
|
2018
|
+
defaultTableExpirationMs: additionalFields.defaultTableExpirationMs || void 0,
|
|
2019
|
+
defaultPartitionExpirationMs: additionalFields.defaultPartitionExpirationMs || void 0,
|
|
2020
|
+
labels: additionalFields.labels || void 0,
|
|
2021
|
+
access: additionalFields.access || void 0,
|
|
2022
|
+
creationTime: additionalFields.creationTime || void 0,
|
|
2023
|
+
lastModifiedTime: additionalFields.lastModifiedTime || void 0,
|
|
2024
|
+
location: additionalFields.location || void 0,
|
|
2025
|
+
defaultEncryptionConfiguration: additionalFields.defaultEncryptionConfiguration || void 0,
|
|
2026
|
+
satisfiesPzs: additionalFields.satisfiesPzs,
|
|
2027
|
+
isCaseInsensitive: additionalFields.isCaseInsensitive,
|
|
2028
|
+
defaultCollation: additionalFields.defaultCollation || void 0,
|
|
2029
|
+
defaultRoundingMode: additionalFields.defaultRoundingMode || void 0,
|
|
2030
|
+
maxTimeTravelHours: additionalFields.maxTimeTravelHours || void 0,
|
|
2031
|
+
tags: additionalFields.tags || void 0,
|
|
2032
|
+
storageBillingModel: additionalFields.storageBillingModel || void 0
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
return { data };
|
|
2036
|
+
}
|
|
2037
|
+
});
|
|
2038
|
+
//#endregion
|
|
2039
|
+
//#region src/actions/datasets/deleteDataset.ts
|
|
2040
|
+
const deleteDataset = (0, _prismatic_io_spectral.action)({
|
|
2041
|
+
display: {
|
|
2042
|
+
description: "Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.",
|
|
2043
|
+
label: "Delete Dataset"
|
|
2044
|
+
},
|
|
2045
|
+
inputs: deleteDatasetInputs,
|
|
2046
|
+
perform: async (_context, { connectionInput, projectId, datasetId }) => {
|
|
2047
|
+
const { data } = await createClient(connectionInput).datasets.delete({
|
|
2048
|
+
datasetId: datasetId || void 0,
|
|
2049
|
+
projectId: projectId || void 0
|
|
2050
|
+
});
|
|
2051
|
+
return { data };
|
|
2052
|
+
}
|
|
2053
|
+
});
|
|
2054
|
+
//#endregion
|
|
2055
|
+
//#region src/actions/datasets/getDataset.ts
|
|
2056
|
+
const getDataset = (0, _prismatic_io_spectral.action)({
|
|
2057
|
+
display: {
|
|
2058
|
+
description: "Returns the dataset specified by datasetID.",
|
|
2059
|
+
label: "Get Dataset"
|
|
2060
|
+
},
|
|
2061
|
+
inputs: getDatasetInputs,
|
|
2062
|
+
perform: async (_context, { connectionInput, projectId, datasetId }) => {
|
|
2063
|
+
const { data } = await createClient(connectionInput).datasets.get({
|
|
2064
|
+
datasetId: datasetId || void 0,
|
|
2065
|
+
projectId: projectId || void 0
|
|
2066
|
+
});
|
|
2067
|
+
return { data };
|
|
2068
|
+
}
|
|
2069
|
+
});
|
|
2070
|
+
//#endregion
|
|
2071
|
+
//#region src/utils/pagination.ts
|
|
2072
|
+
const MAX_PAGES = 100;
|
|
2073
|
+
const paginateResults = async (listFn, params, fetchAll, dataField) => {
|
|
2074
|
+
if (!fetchAll) {
|
|
2075
|
+
const { data } = await listFn(params);
|
|
2076
|
+
return { data };
|
|
2077
|
+
}
|
|
2078
|
+
const allResults = [];
|
|
2079
|
+
let pagesFetched = 0;
|
|
2080
|
+
let currentPageToken;
|
|
2081
|
+
const { pageToken: _pt, ...otherParams } = params;
|
|
2082
|
+
let hasMore = true;
|
|
2083
|
+
while (hasMore && pagesFetched < MAX_PAGES) {
|
|
2084
|
+
const requestParams = { ...otherParams };
|
|
2085
|
+
if (currentPageToken) requestParams.pageToken = currentPageToken;
|
|
2086
|
+
const { data } = await listFn(requestParams);
|
|
2087
|
+
pagesFetched++;
|
|
2088
|
+
const results = data?.[dataField];
|
|
2089
|
+
if (Array.isArray(results)) allResults.push(...results);
|
|
2090
|
+
const nextToken = data?.nextPageToken || data?.pageToken;
|
|
2091
|
+
if (nextToken) currentPageToken = nextToken;
|
|
2092
|
+
else hasMore = false;
|
|
2093
|
+
}
|
|
2094
|
+
return { data: { [dataField]: allResults } };
|
|
2095
|
+
};
|
|
2096
|
+
//#endregion
|
|
2097
|
+
//#region src/actions/datasets/listDatasets.ts
|
|
2098
|
+
const listDatasets = (0, _prismatic_io_spectral.action)({
|
|
2099
|
+
display: {
|
|
2100
|
+
description: "Lists all datasets in the specified project to which the user has been granted the READER dataset role.",
|
|
2101
|
+
label: "List Datasets"
|
|
2102
|
+
},
|
|
2103
|
+
inputs: listDatasetsInputs,
|
|
2104
|
+
perform: async (_context, { connectionInput, projectId, all, filter, pagination = {}, fetchAll }) => {
|
|
2105
|
+
const client = createClient(connectionInput);
|
|
2106
|
+
return await paginateResults((params) => client.datasets.list(params), {
|
|
2107
|
+
projectId: projectId || void 0,
|
|
2108
|
+
pageToken: pagination.pageToken || void 0,
|
|
2109
|
+
all,
|
|
2110
|
+
filter: filter || void 0,
|
|
2111
|
+
maxResults: pagination.maxResults || void 0
|
|
2112
|
+
}, fetchAll, "datasets");
|
|
2113
|
+
}
|
|
2114
|
+
});
|
|
2115
|
+
//#endregion
|
|
2116
|
+
//#region src/actions/datasets/index.ts
|
|
2117
|
+
var datasets_default = {
|
|
2118
|
+
createDataset,
|
|
2119
|
+
updateDataset: (0, _prismatic_io_spectral.action)({
|
|
2120
|
+
display: {
|
|
2121
|
+
description: "Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.",
|
|
2122
|
+
label: "Update Dataset"
|
|
2123
|
+
},
|
|
2124
|
+
inputs: updateDatasetInputs,
|
|
2125
|
+
perform: async (_context, { connectionInput, projectId, datasetId, datasetReference, additionalFields = {} }) => {
|
|
2126
|
+
const { data } = await createClient(connectionInput).datasets.update({
|
|
2127
|
+
projectId: projectId || void 0,
|
|
2128
|
+
datasetId: datasetId || void 0,
|
|
2129
|
+
requestBody: {
|
|
2130
|
+
kind: additionalFields.kind || void 0,
|
|
2131
|
+
etag: additionalFields.etag || void 0,
|
|
2132
|
+
id: additionalFields.id || void 0,
|
|
2133
|
+
selfLink: additionalFields.selfLink || void 0,
|
|
2134
|
+
datasetReference: datasetReference || void 0,
|
|
2135
|
+
friendlyName: additionalFields.friendlyName || void 0,
|
|
2136
|
+
description: additionalFields.description || void 0,
|
|
2137
|
+
defaultTableExpirationMs: additionalFields.defaultTableExpirationMs || void 0,
|
|
2138
|
+
defaultPartitionExpirationMs: additionalFields.defaultPartitionExpirationMs || void 0,
|
|
2139
|
+
labels: additionalFields.labels || void 0,
|
|
2140
|
+
access: additionalFields.access || void 0,
|
|
2141
|
+
creationTime: additionalFields.creationTime || void 0,
|
|
2142
|
+
lastModifiedTime: additionalFields.lastModifiedTime || void 0,
|
|
2143
|
+
location: additionalFields.location || void 0,
|
|
2144
|
+
defaultEncryptionConfiguration: additionalFields.defaultEncryptionConfiguration || void 0,
|
|
2145
|
+
satisfiesPzs: additionalFields.satisfiesPzs,
|
|
2146
|
+
isCaseInsensitive: additionalFields.isCaseInsensitive,
|
|
2147
|
+
defaultCollation: additionalFields.defaultCollation || void 0,
|
|
2148
|
+
defaultRoundingMode: additionalFields.defaultRoundingMode || void 0,
|
|
2149
|
+
maxTimeTravelHours: additionalFields.maxTimeTravelHours || void 0,
|
|
2150
|
+
tags: additionalFields.tags || void 0,
|
|
2151
|
+
storageBillingModel: additionalFields.storageBillingModel || void 0
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2154
|
+
return { data };
|
|
2155
|
+
}
|
|
2156
|
+
}),
|
|
2157
|
+
getDataset,
|
|
2158
|
+
listDatasets,
|
|
2159
|
+
deleteDataset
|
|
2160
|
+
};
|
|
2161
|
+
//#endregion
|
|
2162
|
+
//#region src/actions/jobs/index.ts
|
|
2163
|
+
var jobs_default = {
|
|
2164
|
+
cancelJob: (0, _prismatic_io_spectral.action)({
|
|
2165
|
+
display: {
|
|
2166
|
+
description: "Requests that a job be cancelled.",
|
|
2167
|
+
label: "Cancel Job"
|
|
2168
|
+
},
|
|
2169
|
+
inputs: cancelJobInputs,
|
|
2170
|
+
perform: async (_context, { connectionInput, projectId, jobId, location }) => {
|
|
2171
|
+
const { data } = await createClient(connectionInput).jobs.cancel({
|
|
2172
|
+
projectId: projectId || void 0,
|
|
2173
|
+
jobId: jobId || void 0,
|
|
2174
|
+
location: location || void 0
|
|
2175
|
+
});
|
|
2176
|
+
return { data };
|
|
2177
|
+
}
|
|
2178
|
+
}),
|
|
2179
|
+
createJob: (0, _prismatic_io_spectral.action)({
|
|
2180
|
+
display: {
|
|
2181
|
+
description: "Starts a new asynchronous job.",
|
|
2182
|
+
label: "Create Job"
|
|
2183
|
+
},
|
|
2184
|
+
inputs: createJobInputs,
|
|
2185
|
+
perform: async (_context, { connectionInput, projectId, configuration, jobReference, additionalFields = {} }) => {
|
|
2186
|
+
const { data } = await createClient(connectionInput).jobs.insert({
|
|
2187
|
+
projectId: projectId || void 0,
|
|
2188
|
+
requestBody: {
|
|
2189
|
+
kind: additionalFields.kind || void 0,
|
|
2190
|
+
etag: additionalFields.etag || void 0,
|
|
2191
|
+
id: additionalFields.id || void 0,
|
|
2192
|
+
selfLink: additionalFields.selfLink || void 0,
|
|
2193
|
+
user_email: additionalFields.userEmail || void 0,
|
|
2194
|
+
configuration: configuration || void 0,
|
|
2195
|
+
jobReference: jobReference || void 0,
|
|
2196
|
+
statistics: additionalFields.statistics || void 0,
|
|
2197
|
+
status: additionalFields.status || void 0
|
|
2198
|
+
}
|
|
2199
|
+
});
|
|
2200
|
+
return { data };
|
|
2201
|
+
}
|
|
2202
|
+
}),
|
|
2203
|
+
deleteJob: (0, _prismatic_io_spectral.action)({
|
|
2204
|
+
display: {
|
|
2205
|
+
description: "Requests the deletion of the metadata of a job.",
|
|
2206
|
+
label: "Delete Job"
|
|
2207
|
+
},
|
|
2208
|
+
inputs: deleteJobInputs,
|
|
2209
|
+
perform: async (_context, { connectionInput, projectId, jobId, location }) => {
|
|
2210
|
+
const { data } = await createClient(connectionInput).jobs.delete({
|
|
2211
|
+
projectId: projectId || void 0,
|
|
2212
|
+
jobId: jobId || void 0,
|
|
2213
|
+
location: location || void 0
|
|
2214
|
+
});
|
|
2215
|
+
return { data };
|
|
2216
|
+
}
|
|
2217
|
+
}),
|
|
2218
|
+
getJob: (0, _prismatic_io_spectral.action)({
|
|
2219
|
+
display: {
|
|
2220
|
+
description: "Returns information about a specific job.",
|
|
2221
|
+
label: "Get Job"
|
|
2222
|
+
},
|
|
2223
|
+
inputs: getJobInputs,
|
|
2224
|
+
perform: async (_context, { connectionInput, projectId, jobId, location }) => {
|
|
2225
|
+
const { data } = await createClient(connectionInput).jobs.get({
|
|
2226
|
+
projectId: projectId || void 0,
|
|
2227
|
+
jobId: jobId || void 0,
|
|
2228
|
+
location: location || void 0
|
|
2229
|
+
});
|
|
2230
|
+
return { data };
|
|
2231
|
+
}
|
|
2232
|
+
}),
|
|
2233
|
+
getQueryJobResult: (0, _prismatic_io_spectral.action)({
|
|
2234
|
+
display: {
|
|
2235
|
+
description: "Receives the results of a query job.",
|
|
2236
|
+
label: "Get Query Job Results"
|
|
2237
|
+
},
|
|
2238
|
+
inputs: getQueryJobResultInputs,
|
|
2239
|
+
perform: async (_context, { connectionInput, projectId, jobId, timeoutMs, location, pagination = {} }) => {
|
|
2240
|
+
const { data } = await createClient(connectionInput).jobs.getQueryResults({
|
|
2241
|
+
projectId: projectId || void 0,
|
|
2242
|
+
jobId: jobId || void 0,
|
|
2243
|
+
startIndex: pagination.startIndex || void 0,
|
|
2244
|
+
pageToken: pagination.pageToken || void 0,
|
|
2245
|
+
maxResults: pagination.maxResults || void 0,
|
|
2246
|
+
timeoutMs: timeoutMs || void 0,
|
|
2247
|
+
location: location || void 0
|
|
2248
|
+
});
|
|
2249
|
+
return { data };
|
|
2250
|
+
}
|
|
2251
|
+
}),
|
|
2252
|
+
listJobs: (0, _prismatic_io_spectral.action)({
|
|
2253
|
+
display: {
|
|
2254
|
+
description: "Lists all jobs that you started in the specified project.",
|
|
2255
|
+
label: "List Jobs"
|
|
2256
|
+
},
|
|
2257
|
+
inputs: listJobsInputs,
|
|
2258
|
+
perform: async (_context, { connectionInput, projectId, filters = {}, stateFilter, pagination = {}, fetchAll }) => {
|
|
2259
|
+
const client = createClient(connectionInput);
|
|
2260
|
+
return await paginateResults((params) => client.jobs.list(params), {
|
|
2261
|
+
projectId: projectId || void 0,
|
|
2262
|
+
pageToken: pagination.pageToken || void 0,
|
|
2263
|
+
allUsers: filters.allUsers,
|
|
2264
|
+
maxResults: pagination.maxResults || void 0,
|
|
2265
|
+
minCreationTime: filters.minCreationTime || void 0,
|
|
2266
|
+
maxCreationTime: filters.maxCreationTime || void 0,
|
|
2267
|
+
projection: filters.projection || void 0,
|
|
2268
|
+
stateFilter: stateFilter || void 0,
|
|
2269
|
+
parentJobId: filters.parentJobId || void 0
|
|
2270
|
+
}, fetchAll, "jobs");
|
|
2271
|
+
}
|
|
2272
|
+
}),
|
|
2273
|
+
queryJob: (0, _prismatic_io_spectral.action)({
|
|
2274
|
+
display: {
|
|
2275
|
+
description: "Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.",
|
|
2276
|
+
label: "Query Job"
|
|
2277
|
+
},
|
|
2278
|
+
inputs: queryJobInputs,
|
|
2279
|
+
perform: async (_context, { connectionInput, projectId, query, maxResults, additionalFields = {} }) => {
|
|
2280
|
+
const { data } = await createClient(connectionInput).jobs.query({
|
|
2281
|
+
projectId: projectId || void 0,
|
|
2282
|
+
requestBody: {
|
|
2283
|
+
kind: additionalFields.kind || void 0,
|
|
2284
|
+
query: query || void 0,
|
|
2285
|
+
maxResults: maxResults || void 0,
|
|
2286
|
+
defaultDataset: additionalFields.defaultDataset || void 0,
|
|
2287
|
+
timeoutMs: additionalFields.timeoutMs || void 0,
|
|
2288
|
+
dryRun: additionalFields.dryRun,
|
|
2289
|
+
useQueryCache: additionalFields.useQueryCache,
|
|
2290
|
+
useLegacySql: additionalFields.useLegacySql,
|
|
2291
|
+
parameterMode: additionalFields.parameterMode || void 0,
|
|
2292
|
+
queryParameters: additionalFields.queryParameters || void 0,
|
|
2293
|
+
location: additionalFields.location || void 0,
|
|
2294
|
+
connectionProperties: additionalFields.connectionProperties || void 0,
|
|
2295
|
+
labels: additionalFields.labels || void 0,
|
|
2296
|
+
maximumBytesBilled: additionalFields.maximumBytesBilled || void 0,
|
|
2297
|
+
requestId: additionalFields.requestId || void 0,
|
|
2298
|
+
createSession: additionalFields.createSession
|
|
2299
|
+
}
|
|
2300
|
+
});
|
|
2301
|
+
return { data };
|
|
2302
|
+
}
|
|
2303
|
+
})
|
|
2304
|
+
};
|
|
2305
|
+
//#endregion
|
|
2306
|
+
//#region src/actions/misc/rawRequest.ts
|
|
2307
|
+
const { debugRequest: _, ...rawRequestInputs } = _prismatic_io_spectral_http.inputs;
|
|
2308
|
+
//#endregion
|
|
2309
|
+
//#region src/actions/misc/index.ts
|
|
2310
|
+
var misc_default = { rawRequest: (0, _prismatic_io_spectral.action)({
|
|
2311
|
+
display: {
|
|
2312
|
+
label: "Raw Request",
|
|
2313
|
+
description: "Send raw HTTP request to Google Cloud BigQuery"
|
|
2314
|
+
},
|
|
2315
|
+
inputs: {
|
|
2316
|
+
connection: connectionInput,
|
|
2317
|
+
version,
|
|
2318
|
+
...rawRequestInputs,
|
|
2319
|
+
url: {
|
|
2320
|
+
...rawRequestInputs.url,
|
|
2321
|
+
comments: "Input the path only (/projects/{projectId}/jobs), The base URL is already included (https://bigquery.googleapis.com/bigquery/{version}). For example, to connect to https://bigquery.googleapis.com/bigquery/v2/projects/{projectId}/jobs, only /projects/{projectId}/jobs is entered in this field.",
|
|
2322
|
+
example: "/projects/{projectId}/jobs"
|
|
2323
|
+
}
|
|
2324
|
+
},
|
|
2325
|
+
perform: async (context, { connection, version, ...rawRequestInputs }) => {
|
|
2326
|
+
const url = `https://bigquery.googleapis.com/bigquery/${version}`;
|
|
2327
|
+
const token = _prismatic_io_spectral.util.types.toString(connection.token?.access_token);
|
|
2328
|
+
const { data } = await (0, _prismatic_io_spectral_http.sendRawRequest)(url, {
|
|
2329
|
+
...rawRequestInputs,
|
|
2330
|
+
debugRequest: context.debug.enabled
|
|
2331
|
+
}, { Authorization: `Bearer ${token}` });
|
|
2332
|
+
return { data };
|
|
2333
|
+
}
|
|
2334
|
+
}) };
|
|
2335
|
+
//#endregion
|
|
2336
|
+
//#region src/actions/models/deleteModel.ts
|
|
2337
|
+
const deleteModel = (0, _prismatic_io_spectral.action)({
|
|
2338
|
+
display: {
|
|
2339
|
+
description: "Deletes the model specified by model ID from the dataset.",
|
|
2340
|
+
label: "Delete Model"
|
|
2341
|
+
},
|
|
2342
|
+
inputs: deleteModelInputs,
|
|
2343
|
+
perform: async (_context, { connectionInput, projectId, datasetId, modelId }) => {
|
|
2344
|
+
const { data } = await createClient(connectionInput).models.delete({
|
|
2345
|
+
datasetId: datasetId || void 0,
|
|
2346
|
+
projectId: projectId || void 0,
|
|
2347
|
+
modelId: modelId || void 0
|
|
2348
|
+
});
|
|
2349
|
+
return { data };
|
|
2350
|
+
}
|
|
2351
|
+
});
|
|
2352
|
+
//#endregion
|
|
2353
|
+
//#region src/actions/models/index.ts
|
|
2354
|
+
var models_default = {
|
|
2355
|
+
getModel: (0, _prismatic_io_spectral.action)({
|
|
2356
|
+
display: {
|
|
2357
|
+
description: "Gets the specified model resource by model ID.",
|
|
2358
|
+
label: "Get Model"
|
|
2359
|
+
},
|
|
2360
|
+
inputs: getModelInputs,
|
|
2361
|
+
perform: async (_context, { connectionInput, projectId, datasetId, modelId }) => {
|
|
2362
|
+
const { data } = await createClient(connectionInput).models.get({
|
|
2363
|
+
datasetId: datasetId || void 0,
|
|
2364
|
+
projectId: projectId || void 0,
|
|
2365
|
+
modelId: modelId || void 0
|
|
2366
|
+
});
|
|
2367
|
+
return { data };
|
|
2368
|
+
}
|
|
2369
|
+
}),
|
|
2370
|
+
listModels: (0, _prismatic_io_spectral.action)({
|
|
2371
|
+
display: {
|
|
2372
|
+
description: "Lists all models in the specified dataset. Requires the READER dataset role. After retrieving the list of models, you can get information about a particular model by calling the models.get method.",
|
|
2373
|
+
label: "List Models"
|
|
2374
|
+
},
|
|
2375
|
+
inputs: listModelsInputs,
|
|
2376
|
+
perform: async (_context, { connectionInput, projectId, datasetId, pagination = {}, fetchAll }) => {
|
|
2377
|
+
const client = createClient(connectionInput);
|
|
2378
|
+
return await paginateResults((params) => client.models.list(params), {
|
|
2379
|
+
projectId: projectId || void 0,
|
|
2380
|
+
datasetId: datasetId || void 0,
|
|
2381
|
+
maxResults: pagination.maxResults || void 0,
|
|
2382
|
+
pageToken: pagination.pageToken || void 0
|
|
2383
|
+
}, fetchAll, "models");
|
|
2384
|
+
}
|
|
2385
|
+
}),
|
|
2386
|
+
deleteModel,
|
|
2387
|
+
updateModel: (0, _prismatic_io_spectral.action)({
|
|
2388
|
+
display: {
|
|
2389
|
+
description: "Patch specific fields in the specified model.",
|
|
2390
|
+
label: "Update Model"
|
|
2391
|
+
},
|
|
2392
|
+
inputs: updateModelInputs,
|
|
2393
|
+
perform: async (_context, { connectionInput, projectId, datasetId, modelId, modelReference, additionalFields = {} }) => {
|
|
2394
|
+
const { data } = await createClient(connectionInput).models.patch({
|
|
2395
|
+
projectId: projectId || void 0,
|
|
2396
|
+
datasetId: datasetId || void 0,
|
|
2397
|
+
modelId: modelId || void 0,
|
|
2398
|
+
requestBody: {
|
|
2399
|
+
etag: additionalFields.etag || void 0,
|
|
2400
|
+
modelReference: modelReference || void 0,
|
|
2401
|
+
creationTime: additionalFields.creationTime || void 0,
|
|
2402
|
+
lastModifiedTime: additionalFields.lastModifiedTime || void 0,
|
|
2403
|
+
description: additionalFields.description || void 0,
|
|
2404
|
+
friendlyName: additionalFields.friendlyName || void 0,
|
|
2405
|
+
labels: additionalFields.labels || void 0,
|
|
2406
|
+
expirationTime: additionalFields.expirationTime || void 0,
|
|
2407
|
+
location: additionalFields.location || void 0,
|
|
2408
|
+
encryptionConfiguration: additionalFields.encryptionConfiguration || void 0,
|
|
2409
|
+
modelType: additionalFields.modelType || void 0,
|
|
2410
|
+
trainingRuns: additionalFields.trainingRuns || void 0,
|
|
2411
|
+
featureColumns: additionalFields.featureColumns || void 0,
|
|
2412
|
+
labelColumns: additionalFields.labelColumns || void 0,
|
|
2413
|
+
hparamSearchSpaces: additionalFields.hparamSearchSpaces || void 0,
|
|
2414
|
+
defaultTrialId: additionalFields.defaultTrialId || void 0,
|
|
2415
|
+
hparamTrials: additionalFields.hparamTrials || void 0,
|
|
2416
|
+
optimalTrialIds: additionalFields.optimalTrialIds || void 0
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
return { data };
|
|
2420
|
+
}
|
|
2421
|
+
})
|
|
2422
|
+
};
|
|
2423
|
+
//#endregion
|
|
2424
|
+
//#region src/actions/policies/getPolicy.ts
|
|
2425
|
+
const getPolicy = (0, _prismatic_io_spectral.action)({
|
|
2426
|
+
display: {
|
|
2427
|
+
description: "Gets the access control policy for a resource.",
|
|
2428
|
+
label: "Get Policy"
|
|
2429
|
+
},
|
|
2430
|
+
inputs: getPolicyInputs,
|
|
2431
|
+
perform: async (_context, { connectionInput, resource, options }) => {
|
|
2432
|
+
const { data } = await createClient(connectionInput).tables.getIamPolicy({
|
|
2433
|
+
resource,
|
|
2434
|
+
requestBody: { options }
|
|
2435
|
+
});
|
|
2436
|
+
return { data };
|
|
2437
|
+
}
|
|
2438
|
+
});
|
|
2439
|
+
//#endregion
|
|
2440
|
+
//#region src/actions/policies/index.ts
|
|
2441
|
+
var policies_default = {
|
|
2442
|
+
setPolicy: (0, _prismatic_io_spectral.action)({
|
|
2443
|
+
display: {
|
|
2444
|
+
description: "Sets the access control policy on the specified resource.",
|
|
2445
|
+
label: "Set Policy"
|
|
2446
|
+
},
|
|
2447
|
+
inputs: setPolicyInputs,
|
|
2448
|
+
perform: async (_context, { connectionInput, resource, policy, updateMask }) => {
|
|
2449
|
+
const { data } = await createClient(connectionInput).tables.setIamPolicy({
|
|
2450
|
+
resource,
|
|
2451
|
+
requestBody: {
|
|
2452
|
+
policy,
|
|
2453
|
+
updateMask
|
|
2454
|
+
}
|
|
2455
|
+
});
|
|
2456
|
+
return { data };
|
|
2457
|
+
}
|
|
2458
|
+
}),
|
|
2459
|
+
getPolicy
|
|
2460
|
+
};
|
|
2461
|
+
//#endregion
|
|
2462
|
+
//#region src/actions/projects/index.ts
|
|
2463
|
+
var projects_default = {
|
|
2464
|
+
getServiceAccount: (0, _prismatic_io_spectral.action)({
|
|
2465
|
+
display: {
|
|
2466
|
+
description: "Receives the service account for a project used for interactions with Google Cloud KMS",
|
|
2467
|
+
label: "Get Service Account"
|
|
2468
|
+
},
|
|
2469
|
+
inputs: getServiceAccountInputs,
|
|
2470
|
+
perform: async (_context, { connectionInput, projectId }) => {
|
|
2471
|
+
const { data } = await createClient(connectionInput).projects.getServiceAccount({ projectId: projectId || void 0 });
|
|
2472
|
+
return { data };
|
|
2473
|
+
}
|
|
2474
|
+
}),
|
|
2475
|
+
listProjects: (0, _prismatic_io_spectral.action)({
|
|
2476
|
+
display: {
|
|
2477
|
+
description: "Lists projects to which the user has been granted any project role.",
|
|
2478
|
+
label: "List Projects"
|
|
2479
|
+
},
|
|
2480
|
+
inputs: listProjectsInputs,
|
|
2481
|
+
perform: async (_context, { connectionInput, pagination = {}, fetchAll }) => {
|
|
2482
|
+
const client = createClient(connectionInput);
|
|
2483
|
+
return await paginateResults((params) => client.projects.list(params), {
|
|
2484
|
+
maxResults: pagination.maxResults || void 0,
|
|
2485
|
+
pageToken: pagination.pageToken || void 0
|
|
2486
|
+
}, fetchAll, "projects");
|
|
2487
|
+
}
|
|
2488
|
+
})
|
|
2489
|
+
};
|
|
2490
|
+
//#endregion
|
|
2491
|
+
//#region src/actions/routines/createRoutine.ts
|
|
2492
|
+
const createRoutine = (0, _prismatic_io_spectral.action)({
|
|
2493
|
+
display: {
|
|
2494
|
+
description: "Creates a new routine in the dataset.",
|
|
2495
|
+
label: "Create Routine"
|
|
2496
|
+
},
|
|
2497
|
+
inputs: createRoutineInputs,
|
|
2498
|
+
perform: async (_context, { connectionInput, datasetId, projectId, routineReference, routineType, definitionBody, additionalFields = {} }) => {
|
|
2499
|
+
const { data } = await createClient(connectionInput).routines.insert({
|
|
2500
|
+
datasetId: datasetId || void 0,
|
|
2501
|
+
projectId: projectId || void 0,
|
|
2502
|
+
requestBody: {
|
|
2503
|
+
routineReference: routineReference || void 0,
|
|
2504
|
+
routineType: routineType || void 0,
|
|
2505
|
+
definitionBody: definitionBody || void 0,
|
|
2506
|
+
etag: additionalFields.etag || void 0,
|
|
2507
|
+
arguments: additionalFields.argument || void 0,
|
|
2508
|
+
returnTableType: additionalFields.returnTableType || void 0,
|
|
2509
|
+
returnType: additionalFields.returnType || void 0,
|
|
2510
|
+
creationTime: additionalFields.creationTime || void 0,
|
|
2511
|
+
lastModifiedTime: additionalFields.lastModifiedTime || void 0,
|
|
2512
|
+
language: additionalFields.language || void 0,
|
|
2513
|
+
importedLibraries: additionalFields.importedLibraries || void 0,
|
|
2514
|
+
description: additionalFields.description || void 0,
|
|
2515
|
+
determinismLevel: additionalFields.determinismLevel || void 0,
|
|
2516
|
+
remoteFunctionOptions: additionalFields.remoteFunctionOptions || void 0,
|
|
2517
|
+
sparkOptions: additionalFields.sparkOptions || void 0
|
|
2518
|
+
}
|
|
2519
|
+
});
|
|
2520
|
+
return { data };
|
|
2521
|
+
}
|
|
2522
|
+
});
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region src/actions/routines/deleteRoutine.ts
|
|
2525
|
+
const deleteRoutine = (0, _prismatic_io_spectral.action)({
|
|
2526
|
+
display: {
|
|
2527
|
+
description: "Deletes the routine specified by routine ID from the dataset.",
|
|
2528
|
+
label: "Delete Routine"
|
|
2529
|
+
},
|
|
2530
|
+
inputs: deleteRoutineInputs,
|
|
2531
|
+
perform: async (_context, { connectionInput, datasetId, projectId, routineId }) => {
|
|
2532
|
+
const { data } = await createClient(connectionInput).routines.delete({
|
|
2533
|
+
datasetId: datasetId || void 0,
|
|
2534
|
+
projectId: projectId || void 0,
|
|
2535
|
+
routineId: routineId || void 0
|
|
2536
|
+
});
|
|
2537
|
+
return { data };
|
|
2538
|
+
}
|
|
2539
|
+
});
|
|
2540
|
+
//#endregion
|
|
2541
|
+
//#region src/actions/routines/getRoutine.ts
|
|
2542
|
+
const getRoutine = (0, _prismatic_io_spectral.action)({
|
|
2543
|
+
display: {
|
|
2544
|
+
description: "Gets the specified routine resource by routine ID.",
|
|
2545
|
+
label: "Get Routine"
|
|
2546
|
+
},
|
|
2547
|
+
inputs: getRoutineInputs,
|
|
2548
|
+
perform: async (_context, { connectionInput, datasetId, projectId, readMask, routineId }) => {
|
|
2549
|
+
const { data } = await createClient(connectionInput).routines.get({
|
|
2550
|
+
datasetId: datasetId || void 0,
|
|
2551
|
+
projectId: projectId || void 0,
|
|
2552
|
+
routineId: routineId || void 0,
|
|
2553
|
+
readMask: readMask || void 0
|
|
2554
|
+
});
|
|
2555
|
+
return { data };
|
|
2556
|
+
}
|
|
2557
|
+
});
|
|
2558
|
+
//#endregion
|
|
2559
|
+
//#region src/actions/routines/index.ts
|
|
2560
|
+
var routines_default = {
|
|
2561
|
+
createRoutine,
|
|
2562
|
+
listRoutines: (0, _prismatic_io_spectral.action)({
|
|
2563
|
+
display: {
|
|
2564
|
+
description: "Lists all routines in the specified dataset.",
|
|
2565
|
+
label: "List Routines"
|
|
2566
|
+
},
|
|
2567
|
+
inputs: listRoutinesInputs,
|
|
2568
|
+
perform: async (_context, { connectionInput, datasetId, projectId, filter, readMask, pagination = {}, fetchAll }) => {
|
|
2569
|
+
const client = createClient(connectionInput);
|
|
2570
|
+
return await paginateResults((params) => client.routines.list(params), {
|
|
2571
|
+
datasetId: datasetId || void 0,
|
|
2572
|
+
projectId: projectId || void 0,
|
|
2573
|
+
filter: filter || void 0,
|
|
2574
|
+
pageToken: pagination.pageToken || void 0,
|
|
2575
|
+
maxResults: pagination.maxResults || void 0,
|
|
2576
|
+
readMask: readMask || void 0
|
|
2577
|
+
}, fetchAll, "routines");
|
|
2578
|
+
}
|
|
2579
|
+
}),
|
|
2580
|
+
getRoutine,
|
|
2581
|
+
updateRoutine: (0, _prismatic_io_spectral.action)({
|
|
2582
|
+
display: {
|
|
2583
|
+
description: "Updates information in an existing routine.",
|
|
2584
|
+
label: "Update Routine"
|
|
2585
|
+
},
|
|
2586
|
+
inputs: updateRoutineInputs,
|
|
2587
|
+
perform: async (_context, { connectionInput, datasetId, projectId, routineReference, routineType, definitionBody, additionalFields = {} }) => {
|
|
2588
|
+
const { data } = await createClient(connectionInput).routines.update({
|
|
2589
|
+
datasetId: datasetId || void 0,
|
|
2590
|
+
projectId: projectId || void 0,
|
|
2591
|
+
requestBody: {
|
|
2592
|
+
routineReference: routineReference || void 0,
|
|
2593
|
+
routineType: routineType || void 0,
|
|
2594
|
+
definitionBody: definitionBody || void 0,
|
|
2595
|
+
etag: additionalFields.etag || void 0,
|
|
2596
|
+
arguments: additionalFields.argument || void 0,
|
|
2597
|
+
returnTableType: additionalFields.returnTableType || void 0,
|
|
2598
|
+
returnType: additionalFields.returnType || void 0,
|
|
2599
|
+
creationTime: additionalFields.creationTime || void 0,
|
|
2600
|
+
lastModifiedTime: additionalFields.lastModifiedTime || void 0,
|
|
2601
|
+
language: additionalFields.language || void 0,
|
|
2602
|
+
importedLibraries: additionalFields.importedLibraries || void 0,
|
|
2603
|
+
description: additionalFields.description || void 0,
|
|
2604
|
+
determinismLevel: additionalFields.determinismLevel || void 0,
|
|
2605
|
+
remoteFunctionOptions: additionalFields.remoteFunctionOptions || void 0,
|
|
2606
|
+
sparkOptions: additionalFields.sparkOptions || void 0
|
|
2607
|
+
}
|
|
2608
|
+
});
|
|
2609
|
+
return { data };
|
|
2610
|
+
}
|
|
2611
|
+
}),
|
|
2612
|
+
deleteRoutine
|
|
2613
|
+
};
|
|
2614
|
+
//#endregion
|
|
2615
|
+
//#region src/actions/tableData/index.ts
|
|
2616
|
+
var tableData_default = { tableDataInsertAll: (0, _prismatic_io_spectral.action)({
|
|
2617
|
+
display: {
|
|
2618
|
+
description: "Streams data into BigQuery one record at a time without needing to run a load job.",
|
|
2619
|
+
label: "Table Data Insert All"
|
|
2620
|
+
},
|
|
2621
|
+
inputs: tableDataInsertAllInputs,
|
|
2622
|
+
perform: async (_context, { connectionInput, datasetId, projectId, tableId, rows, additionalFields = {} }) => {
|
|
2623
|
+
const { data } = await createClient(connectionInput).tabledata.insertAll({
|
|
2624
|
+
datasetId: datasetId || void 0,
|
|
2625
|
+
projectId: projectId || void 0,
|
|
2626
|
+
tableId: tableId || void 0,
|
|
2627
|
+
requestBody: {
|
|
2628
|
+
kind: additionalFields.kind || void 0,
|
|
2629
|
+
skipInvalidRows: additionalFields.skipInvalidRows,
|
|
2630
|
+
ignoreUnknownValues: additionalFields.ignoreUnknownValues,
|
|
2631
|
+
templateSuffix: additionalFields.templateSuffix || void 0,
|
|
2632
|
+
rows: rows || void 0
|
|
2633
|
+
}
|
|
2634
|
+
});
|
|
2635
|
+
return { data };
|
|
2636
|
+
}
|
|
2637
|
+
}) };
|
|
2638
|
+
//#endregion
|
|
2639
|
+
//#region src/actions/tables/createTable.ts
|
|
2640
|
+
const createTable = (0, _prismatic_io_spectral.action)({
|
|
2641
|
+
display: {
|
|
2642
|
+
description: "Creates a new, empty table in the dataset.",
|
|
2643
|
+
label: "Create Table"
|
|
2644
|
+
},
|
|
2645
|
+
inputs: createTableInputs,
|
|
2646
|
+
perform: async (_context, { connectionInput, datasetId, projectId, tableReference, additionalFields = {} }) => {
|
|
2647
|
+
const { data } = await createClient(connectionInput).tables.insert({
|
|
2648
|
+
datasetId: datasetId || void 0,
|
|
2649
|
+
projectId: projectId || void 0,
|
|
2650
|
+
requestBody: {
|
|
2651
|
+
kind: additionalFields.kind || void 0,
|
|
2652
|
+
tableReference: tableReference || void 0,
|
|
2653
|
+
friendlyName: additionalFields.friendlyName || void 0,
|
|
2654
|
+
description: additionalFields.description || void 0,
|
|
2655
|
+
labels: additionalFields.labels || void 0,
|
|
2656
|
+
schema: additionalFields.schema || void 0,
|
|
2657
|
+
timePartitioning: additionalFields.timePartitioning || void 0,
|
|
2658
|
+
rangePartitioning: additionalFields.rangePartitioning || void 0,
|
|
2659
|
+
clustering: additionalFields.clustering || void 0,
|
|
2660
|
+
requirePartitionFilter: additionalFields.requirePartitionFilter,
|
|
2661
|
+
expirationTime: additionalFields.expirationTime || void 0,
|
|
2662
|
+
view: additionalFields.view || void 0,
|
|
2663
|
+
materializedView: additionalFields.materializedView || void 0,
|
|
2664
|
+
externalDataConfiguration: additionalFields.externalDataConfiguration || void 0,
|
|
2665
|
+
encryptionConfiguration: additionalFields.encryptionConfiguration || void 0,
|
|
2666
|
+
defaultCollation: additionalFields.defaultCollation || void 0,
|
|
2667
|
+
defaultRoundingMode: additionalFields.defaultRoundingMode || void 0,
|
|
2668
|
+
maxStaleness: additionalFields.maxStaleness || void 0
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2671
|
+
return { data };
|
|
2672
|
+
}
|
|
2673
|
+
});
|
|
2674
|
+
//#endregion
|
|
2675
|
+
//#region src/actions/tables/deleteTable.ts
|
|
2676
|
+
const deleteTable = (0, _prismatic_io_spectral.action)({
|
|
2677
|
+
display: {
|
|
2678
|
+
description: "Deletes the table specified by table ID from the dataset.",
|
|
2679
|
+
label: "Delete Table"
|
|
2680
|
+
},
|
|
2681
|
+
inputs: deleteTableInputs,
|
|
2682
|
+
perform: async (_context, { connectionInput, datasetId, projectId, tableId }) => {
|
|
2683
|
+
const { data } = await createClient(connectionInput).tables.delete({
|
|
2684
|
+
datasetId,
|
|
2685
|
+
projectId,
|
|
2686
|
+
tableId
|
|
2687
|
+
});
|
|
2688
|
+
return { data };
|
|
2689
|
+
}
|
|
2690
|
+
});
|
|
2691
|
+
//#endregion
|
|
2692
|
+
//#region src/actions/tables/getTable.ts
|
|
2693
|
+
const getTable = (0, _prismatic_io_spectral.action)({
|
|
2694
|
+
display: {
|
|
2695
|
+
description: "Gets the specified table resource by table ID.",
|
|
2696
|
+
label: "Get Table"
|
|
2697
|
+
},
|
|
2698
|
+
inputs: getTableInputs,
|
|
2699
|
+
perform: async (_context, { connectionInput, datasetId, projectId, tableId, selectedFields, view }) => {
|
|
2700
|
+
const { data } = await createClient(connectionInput).tables.get({
|
|
2701
|
+
datasetId,
|
|
2702
|
+
projectId,
|
|
2703
|
+
tableId,
|
|
2704
|
+
selectedFields: selectedFields || void 0,
|
|
2705
|
+
view: view || void 0
|
|
2706
|
+
});
|
|
2707
|
+
return { data };
|
|
2708
|
+
}
|
|
2709
|
+
});
|
|
2710
|
+
//#endregion
|
|
2711
|
+
//#region src/actions/tables/listTables.ts
|
|
2712
|
+
const listTables = (0, _prismatic_io_spectral.action)({
|
|
2713
|
+
display: {
|
|
2714
|
+
description: "Lists all tables in the specified dataset.",
|
|
2715
|
+
label: "List Tables"
|
|
2716
|
+
},
|
|
2717
|
+
inputs: listTablesInputs,
|
|
2718
|
+
perform: async (_context, { connectionInput, datasetId, projectId, pagination = {}, fetchAll }) => {
|
|
2719
|
+
const client = createClient(connectionInput);
|
|
2720
|
+
return await paginateResults((params) => client.tables.list(params), {
|
|
2721
|
+
datasetId,
|
|
2722
|
+
projectId,
|
|
2723
|
+
...pagination.maxResults && { maxResults: _prismatic_io_spectral.util.types.toNumber(pagination.maxResults) },
|
|
2724
|
+
...pagination.pageToken && { pageToken: pagination.pageToken }
|
|
2725
|
+
}, fetchAll, "tables");
|
|
2726
|
+
}
|
|
2727
|
+
});
|
|
2728
|
+
//#endregion
|
|
2729
|
+
//#region src/actions/tables/patchTable.ts
|
|
2730
|
+
const patchTable = (0, _prismatic_io_spectral.action)({
|
|
2731
|
+
display: {
|
|
2732
|
+
description: "Patch information in an existing table.",
|
|
2733
|
+
label: "Patch Table"
|
|
2734
|
+
},
|
|
2735
|
+
inputs: patchTableInputs,
|
|
2736
|
+
perform: async (_context, { connectionInput, datasetId, projectId, tableId, tableReference, additionalFields = {} }) => {
|
|
2737
|
+
const { data } = await createClient(connectionInput).tables.patch({
|
|
2738
|
+
datasetId,
|
|
2739
|
+
projectId,
|
|
2740
|
+
tableId,
|
|
2741
|
+
requestBody: {
|
|
2742
|
+
kind: additionalFields.kind || void 0,
|
|
2743
|
+
tableReference: tableReference || void 0,
|
|
2744
|
+
friendlyName: additionalFields.friendlyName || void 0,
|
|
2745
|
+
description: additionalFields.description || void 0,
|
|
2746
|
+
labels: additionalFields.labels || void 0,
|
|
2747
|
+
schema: additionalFields.schema || void 0,
|
|
2748
|
+
timePartitioning: additionalFields.timePartitioning || void 0,
|
|
2749
|
+
rangePartitioning: additionalFields.rangePartitioning || void 0,
|
|
2750
|
+
clustering: additionalFields.clustering || void 0,
|
|
2751
|
+
requirePartitionFilter: additionalFields.requirePartitionFilter,
|
|
2752
|
+
expirationTime: additionalFields.expirationTime || void 0,
|
|
2753
|
+
view: additionalFields.view || void 0,
|
|
2754
|
+
materializedView: additionalFields.materializedView || void 0,
|
|
2755
|
+
externalDataConfiguration: additionalFields.externalDataConfiguration || void 0,
|
|
2756
|
+
encryptionConfiguration: additionalFields.encryptionConfiguration || void 0,
|
|
2757
|
+
defaultCollation: additionalFields.defaultCollation || void 0,
|
|
2758
|
+
defaultRoundingMode: additionalFields.defaultRoundingMode || void 0,
|
|
2759
|
+
maxStaleness: additionalFields.maxStaleness || void 0
|
|
2760
|
+
}
|
|
2761
|
+
});
|
|
2762
|
+
return { data };
|
|
2763
|
+
}
|
|
2764
|
+
});
|
|
2765
|
+
//#endregion
|
|
2766
|
+
//#region src/actions/tables/index.ts
|
|
2767
|
+
var tables_default = {
|
|
2768
|
+
createTable,
|
|
2769
|
+
listTables,
|
|
2770
|
+
getTable,
|
|
2771
|
+
updateTable: (0, _prismatic_io_spectral.action)({
|
|
2772
|
+
display: {
|
|
2773
|
+
description: "Updates information in an existing table.",
|
|
2774
|
+
label: "Update Table"
|
|
2775
|
+
},
|
|
2776
|
+
inputs: updateTableInputs,
|
|
2777
|
+
perform: async (_context, { connectionInput, datasetId, projectId, tableId, tableReference, additionalFields = {} }) => {
|
|
2778
|
+
const { data } = await createClient(connectionInput).tables.update({
|
|
2779
|
+
datasetId,
|
|
2780
|
+
projectId,
|
|
2781
|
+
tableId,
|
|
2782
|
+
requestBody: {
|
|
2783
|
+
kind: additionalFields.kind || void 0,
|
|
2784
|
+
tableReference: tableReference || void 0,
|
|
2785
|
+
friendlyName: additionalFields.friendlyName || void 0,
|
|
2786
|
+
description: additionalFields.description || void 0,
|
|
2787
|
+
labels: additionalFields.labels || void 0,
|
|
2788
|
+
schema: additionalFields.schema || void 0,
|
|
2789
|
+
timePartitioning: additionalFields.timePartitioning || void 0,
|
|
2790
|
+
rangePartitioning: additionalFields.rangePartitioning || void 0,
|
|
2791
|
+
clustering: additionalFields.clustering || void 0,
|
|
2792
|
+
requirePartitionFilter: additionalFields.requirePartitionFilter,
|
|
2793
|
+
expirationTime: additionalFields.expirationTime || void 0,
|
|
2794
|
+
view: additionalFields.view || void 0,
|
|
2795
|
+
materializedView: additionalFields.materializedView || void 0,
|
|
2796
|
+
externalDataConfiguration: additionalFields.externalDataConfiguration || void 0,
|
|
2797
|
+
encryptionConfiguration: additionalFields.encryptionConfiguration || void 0,
|
|
2798
|
+
defaultCollation: additionalFields.defaultCollation || void 0,
|
|
2799
|
+
defaultRoundingMode: additionalFields.defaultRoundingMode || void 0,
|
|
2800
|
+
maxStaleness: additionalFields.maxStaleness || void 0
|
|
2801
|
+
}
|
|
2802
|
+
});
|
|
2803
|
+
return { data };
|
|
2804
|
+
}
|
|
2805
|
+
}),
|
|
2806
|
+
deleteTable,
|
|
2807
|
+
patchTable
|
|
2808
|
+
};
|
|
2809
|
+
//#endregion
|
|
2810
|
+
//#region src/actions/index.ts
|
|
2811
|
+
var actions_default = {
|
|
2812
|
+
...datasets_default,
|
|
2813
|
+
...jobs_default,
|
|
2814
|
+
...misc_default,
|
|
2815
|
+
...models_default,
|
|
2816
|
+
...policies_default,
|
|
2817
|
+
...projects_default,
|
|
2818
|
+
...routines_default,
|
|
2819
|
+
...tableData_default,
|
|
2820
|
+
...tables_default
|
|
2821
|
+
};
|
|
2822
|
+
//#endregion
|
|
2823
|
+
//#region src/datasources/index.ts
|
|
2824
|
+
var datasources_default = {
|
|
2825
|
+
projectsNames: (0, _prismatic_io_spectral.dataSource)({
|
|
2826
|
+
display: {
|
|
2827
|
+
label: "Select Project",
|
|
2828
|
+
description: "A picklist of projects in your Google Cloud account."
|
|
2829
|
+
},
|
|
2830
|
+
inputs: { connection: connectionInput },
|
|
2831
|
+
perform: async (_context, { connection }) => {
|
|
2832
|
+
const { data } = await createClient(connection).projects.list();
|
|
2833
|
+
if (data.projects) return { result: data.projects?.map((project) => ({
|
|
2834
|
+
label: project?.friendlyName || project?.projectReference?.projectId || project.id,
|
|
2835
|
+
key: project.id ? project.id.toString() : ""
|
|
2836
|
+
})) };
|
|
2837
|
+
return Promise.resolve({ result: [] });
|
|
2838
|
+
},
|
|
2839
|
+
dataSourceType: "picklist",
|
|
2840
|
+
examplePayload: { result: [{
|
|
2841
|
+
label: "John Locke",
|
|
2842
|
+
key: "650"
|
|
2843
|
+
}, {
|
|
2844
|
+
label: "John Doe",
|
|
2845
|
+
key: "47012"
|
|
2846
|
+
}] }
|
|
2847
|
+
}),
|
|
2848
|
+
selectDataset: (0, _prismatic_io_spectral.dataSource)({
|
|
2849
|
+
display: {
|
|
2850
|
+
label: "Select Dataset",
|
|
2851
|
+
description: "A picklist of datasets in the specified project."
|
|
2852
|
+
},
|
|
2853
|
+
inputs: {
|
|
2854
|
+
connection: connectionInput,
|
|
2855
|
+
projectId: {
|
|
2856
|
+
...projectId,
|
|
2857
|
+
dataSource: void 0
|
|
2858
|
+
}
|
|
2859
|
+
},
|
|
2860
|
+
perform: async (_context, { connection, projectId }) => {
|
|
2861
|
+
const { data } = await createClient(connection).datasets.list({ projectId: projectId || void 0 });
|
|
2862
|
+
if (data.datasets) return { result: data.datasets.map((dataset) => ({
|
|
2863
|
+
label: dataset?.friendlyName || dataset?.datasetReference?.datasetId || dataset.id,
|
|
2864
|
+
key: dataset.id ? dataset.id.toString() : ""
|
|
2865
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
2866
|
+
return Promise.resolve({ result: [] });
|
|
2867
|
+
},
|
|
2868
|
+
dataSourceType: "picklist",
|
|
2869
|
+
examplePayload: { result: [{
|
|
2870
|
+
label: "Analytics Dataset",
|
|
2871
|
+
key: "my-project:analytics_dataset"
|
|
2872
|
+
}, {
|
|
2873
|
+
label: "Sales Dataset",
|
|
2874
|
+
key: "my-project:sales_dataset"
|
|
2875
|
+
}] }
|
|
2876
|
+
}),
|
|
2877
|
+
selectJob: (0, _prismatic_io_spectral.dataSource)({
|
|
2878
|
+
display: {
|
|
2879
|
+
label: "Select Job",
|
|
2880
|
+
description: "A picklist of jobs in the specified project."
|
|
2881
|
+
},
|
|
2882
|
+
inputs: {
|
|
2883
|
+
connection: connectionInput,
|
|
2884
|
+
projectId: {
|
|
2885
|
+
...projectId,
|
|
2886
|
+
dataSource: void 0
|
|
2887
|
+
}
|
|
2888
|
+
},
|
|
2889
|
+
perform: async (_context, { connection, projectId }) => {
|
|
2890
|
+
const { data } = await createClient(connection).jobs.list({ projectId: projectId || void 0 });
|
|
2891
|
+
if (data.jobs) return { result: data.jobs.map((job) => ({
|
|
2892
|
+
label: job?.jobReference?.jobId ? `${job.jobReference.jobId} (${job?.status?.state || "Unknown"})` : job?.id || "Unknown Job",
|
|
2893
|
+
key: job?.jobReference?.jobId ? job.jobReference.jobId.toString() : ""
|
|
2894
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
2895
|
+
return Promise.resolve({ result: [] });
|
|
2896
|
+
},
|
|
2897
|
+
dataSourceType: "picklist",
|
|
2898
|
+
examplePayload: { result: [{
|
|
2899
|
+
label: "job_abc123 (DONE)",
|
|
2900
|
+
key: "job_abc123"
|
|
2901
|
+
}, {
|
|
2902
|
+
label: "job_xyz789 (RUNNING)",
|
|
2903
|
+
key: "job_xyz789"
|
|
2904
|
+
}] }
|
|
2905
|
+
}),
|
|
2906
|
+
selectModel: (0, _prismatic_io_spectral.dataSource)({
|
|
2907
|
+
display: {
|
|
2908
|
+
label: "Select Model",
|
|
2909
|
+
description: "A picklist of models in the specified dataset."
|
|
2910
|
+
},
|
|
2911
|
+
inputs: {
|
|
2912
|
+
connection: connectionInput,
|
|
2913
|
+
projectId: {
|
|
2914
|
+
...projectId,
|
|
2915
|
+
dataSource: void 0
|
|
2916
|
+
},
|
|
2917
|
+
datasetId: {
|
|
2918
|
+
...datasetId,
|
|
2919
|
+
dataSource: void 0
|
|
2920
|
+
}
|
|
2921
|
+
},
|
|
2922
|
+
perform: async (_context, { connection, projectId, datasetId }) => {
|
|
2923
|
+
const { data } = await createClient(connection).models.list({
|
|
2924
|
+
projectId: projectId || void 0,
|
|
2925
|
+
datasetId: datasetId || void 0
|
|
2926
|
+
});
|
|
2927
|
+
if (data.models) return { result: data.models.map((model) => ({
|
|
2928
|
+
label: model?.friendlyName || model?.modelReference?.modelId || model?.modelType || "Unknown Model",
|
|
2929
|
+
key: model?.modelReference?.modelId ? model.modelReference.modelId.toString() : ""
|
|
2930
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
2931
|
+
return Promise.resolve({ result: [] });
|
|
2932
|
+
},
|
|
2933
|
+
dataSourceType: "picklist",
|
|
2934
|
+
examplePayload: { result: [{
|
|
2935
|
+
label: "Prediction Model",
|
|
2936
|
+
key: "prediction_model"
|
|
2937
|
+
}, {
|
|
2938
|
+
label: "Recommendation Model",
|
|
2939
|
+
key: "recommendation_model"
|
|
2940
|
+
}] }
|
|
2941
|
+
}),
|
|
2942
|
+
selectRoutine: (0, _prismatic_io_spectral.dataSource)({
|
|
2943
|
+
display: {
|
|
2944
|
+
label: "Select Routine",
|
|
2945
|
+
description: "A picklist of routines in the specified dataset."
|
|
2946
|
+
},
|
|
2947
|
+
inputs: {
|
|
2948
|
+
connection: connectionInput,
|
|
2949
|
+
projectId: {
|
|
2950
|
+
...projectId,
|
|
2951
|
+
dataSource: void 0
|
|
2952
|
+
},
|
|
2953
|
+
datasetId: {
|
|
2954
|
+
...datasetId,
|
|
2955
|
+
dataSource: void 0
|
|
2956
|
+
}
|
|
2957
|
+
},
|
|
2958
|
+
perform: async (_context, { connection, projectId, datasetId }) => {
|
|
2959
|
+
const { data } = await createClient(connection).routines.list({
|
|
2960
|
+
projectId: projectId || void 0,
|
|
2961
|
+
datasetId: datasetId || void 0
|
|
2962
|
+
});
|
|
2963
|
+
if (data.routines) return { result: data.routines.map((routine) => ({
|
|
2964
|
+
label: routine?.routineReference?.routineId || routine?.routineType || "Unknown Routine",
|
|
2965
|
+
key: routine?.routineReference?.routineId ? routine.routineReference.routineId.toString() : ""
|
|
2966
|
+
})).sort((a, b) => (a.label ?? "") < (b.label ?? "") ? -1 : 1) };
|
|
2967
|
+
return Promise.resolve({ result: [] });
|
|
2968
|
+
},
|
|
2969
|
+
dataSourceType: "picklist",
|
|
2970
|
+
examplePayload: { result: [{
|
|
2971
|
+
label: "calculate_totals",
|
|
2972
|
+
key: "calculate_totals"
|
|
2973
|
+
}, {
|
|
2974
|
+
label: "transform_data",
|
|
2975
|
+
key: "transform_data"
|
|
2976
|
+
}] }
|
|
2977
|
+
}),
|
|
2978
|
+
tablesNames: (0, _prismatic_io_spectral.dataSource)({
|
|
2979
|
+
display: {
|
|
2980
|
+
label: "Select Table",
|
|
2981
|
+
description: "A picklist of tables in the specified dataset."
|
|
2982
|
+
},
|
|
2983
|
+
inputs: {
|
|
2984
|
+
connection: connectionInput,
|
|
2985
|
+
projectId: {
|
|
2986
|
+
...projectId,
|
|
2987
|
+
dataSource: void 0
|
|
2988
|
+
},
|
|
2989
|
+
datasetId: {
|
|
2990
|
+
...datasetId,
|
|
2991
|
+
dataSource: void 0
|
|
2992
|
+
}
|
|
2993
|
+
},
|
|
2994
|
+
perform: async (_context, { connection, projectId, datasetId }) => {
|
|
2995
|
+
const { data } = await createClient(connection).tables.list({
|
|
2996
|
+
projectId: projectId || void 0,
|
|
2997
|
+
datasetId: datasetId || void 0
|
|
2998
|
+
});
|
|
2999
|
+
if (data.tables) return { result: data.tables?.map((table) => ({
|
|
3000
|
+
label: table?.friendlyName || table?.tableReference?.tableId || table.id,
|
|
3001
|
+
key: table.id ? table.id.toString() : ""
|
|
3002
|
+
})) };
|
|
3003
|
+
return Promise.resolve({ result: [] });
|
|
3004
|
+
},
|
|
3005
|
+
dataSourceType: "picklist",
|
|
3006
|
+
examplePayload: { result: [{
|
|
3007
|
+
label: "John Locke",
|
|
3008
|
+
key: "650"
|
|
3009
|
+
}, {
|
|
3010
|
+
label: "John Doe",
|
|
3011
|
+
key: "47012"
|
|
3012
|
+
}] }
|
|
3013
|
+
})
|
|
3014
|
+
};
|
|
3015
|
+
//#endregion
|
|
3016
|
+
//#region src/examplePayloads.ts
|
|
3017
|
+
const pollChangesExamplePayload = {
|
|
3018
|
+
payload: {
|
|
3019
|
+
headers: {},
|
|
3020
|
+
queryParameters: {},
|
|
3021
|
+
rawBody: {
|
|
3022
|
+
data: "",
|
|
3023
|
+
contentType: "application/json"
|
|
3024
|
+
},
|
|
3025
|
+
body: { data: { created: [{
|
|
3026
|
+
kind: "bigquery#job",
|
|
3027
|
+
id: "my-project:US.job_abc123def456",
|
|
3028
|
+
jobReference: {
|
|
3029
|
+
projectId: "my-project",
|
|
3030
|
+
jobId: "job_abc123def456",
|
|
3031
|
+
location: "US"
|
|
3032
|
+
},
|
|
3033
|
+
status: { state: "DONE" },
|
|
3034
|
+
statistics: {
|
|
3035
|
+
creationTime: "1640995200000",
|
|
3036
|
+
startTime: "1640995205000",
|
|
3037
|
+
endTime: "1640995210000"
|
|
3038
|
+
},
|
|
3039
|
+
user_email: "user@example.com"
|
|
3040
|
+
}] } },
|
|
3041
|
+
pathFragment: "",
|
|
3042
|
+
webhookUrls: { "Polling Flow": "https://hooks.example.com/trigger/EXAMPLE" },
|
|
3043
|
+
webhookApiKeys: { "Polling Flow": ["example-api-key"] },
|
|
3044
|
+
invokeUrl: "https://hooks.example.com/trigger/EXAMPLE",
|
|
3045
|
+
executionId: "SW5zdGFuY2VFeGVjdXRpb246MTIzNDU=",
|
|
3046
|
+
customer: {
|
|
3047
|
+
id: "Q3VzdG9tZXI6MTIzNDU=",
|
|
3048
|
+
externalId: "example-customer-external-id",
|
|
3049
|
+
name: "Example Customer"
|
|
3050
|
+
},
|
|
3051
|
+
instance: {
|
|
3052
|
+
id: "SW5zdGFuY2U6MTIzNDU=",
|
|
3053
|
+
name: "Example Instance"
|
|
3054
|
+
},
|
|
3055
|
+
user: {
|
|
3056
|
+
id: "VXNlcjoxMjM0NQ==",
|
|
3057
|
+
externalId: "example-user-external-id",
|
|
3058
|
+
name: "Example User",
|
|
3059
|
+
email: "user@example.com"
|
|
3060
|
+
}
|
|
3061
|
+
},
|
|
3062
|
+
polledNoChanges: false
|
|
3063
|
+
};
|
|
3064
|
+
//#endregion
|
|
3065
|
+
//#region src/utils/polling.ts
|
|
3066
|
+
const fetchJobsSince = async (client, projectId, minCreationTime, maxCreationTime) => {
|
|
3067
|
+
const jobs = [];
|
|
3068
|
+
let pageToken;
|
|
3069
|
+
let page = 0;
|
|
3070
|
+
while (page < 100) {
|
|
3071
|
+
page += 1;
|
|
3072
|
+
const { data } = await client.jobs.list({
|
|
3073
|
+
projectId,
|
|
3074
|
+
allUsers: true,
|
|
3075
|
+
minCreationTime: String(minCreationTime),
|
|
3076
|
+
maxCreationTime: maxCreationTime !== void 0 ? String(maxCreationTime) : void 0,
|
|
3077
|
+
pageToken
|
|
3078
|
+
});
|
|
3079
|
+
jobs.push(...data?.jobs ?? []);
|
|
3080
|
+
const nextToken = data?.nextPageToken ?? void 0;
|
|
3081
|
+
if (!nextToken) return {
|
|
3082
|
+
jobs,
|
|
3083
|
+
truncated: false
|
|
3084
|
+
};
|
|
3085
|
+
pageToken = nextToken;
|
|
3086
|
+
}
|
|
3087
|
+
return {
|
|
3088
|
+
jobs,
|
|
3089
|
+
truncated: true
|
|
3090
|
+
};
|
|
3091
|
+
};
|
|
3092
|
+
const getJobCreationMs = (job) => {
|
|
3093
|
+
const raw = job.statistics?.creationTime;
|
|
3094
|
+
if (typeof raw !== "string") return null;
|
|
3095
|
+
const ms = Number(raw);
|
|
3096
|
+
return Number.isFinite(ms) ? ms : null;
|
|
3097
|
+
};
|
|
3098
|
+
const resolvePollingRecordChanges = (data) => {
|
|
3099
|
+
return [...((data ?? { created: [] }).created ?? []).map((record) => ({
|
|
3100
|
+
changeType: "created",
|
|
3101
|
+
record
|
|
3102
|
+
}))];
|
|
3103
|
+
};
|
|
3104
|
+
//#endregion
|
|
3105
|
+
//#region src/triggers/pollChangesTrigger.ts
|
|
3106
|
+
const pollChangesTrigger = (0, _prismatic_io_spectral.pollingTrigger)({
|
|
3107
|
+
display: {
|
|
3108
|
+
label: "New Jobs",
|
|
3109
|
+
description: "Retrieves existing and ongoing jobs in a specified BigQuery project. Load history once, check for new jobs on a schedule, or both."
|
|
3110
|
+
},
|
|
3111
|
+
inputs: pollChangesInputs,
|
|
3112
|
+
examplePayload: pollChangesExamplePayload,
|
|
3113
|
+
triggerResolverSupport: "valid",
|
|
3114
|
+
batchConfig: { batchSize: 50 },
|
|
3115
|
+
triggerResolver: { resolveItems: (_context, { payload }) => resolvePollingRecordChanges(payload.body.data) },
|
|
3116
|
+
perform: async (context, payload, params) => {
|
|
3117
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
3118
|
+
const state = context.polling.getState();
|
|
3119
|
+
const lookBackIso = params.lookBackDate;
|
|
3120
|
+
const seedTime = lookBackIso && lookBackIso !== "" ? new Date(lookBackIso).toISOString() : now;
|
|
3121
|
+
const lastPolledAt = state?.lastPolledAt ?? seedTime;
|
|
3122
|
+
const { jobs, truncated } = await fetchJobsSince(createClient(params.connectionInput), params.projectId, new Date(lastPolledAt).getTime(), state?.drainUntil);
|
|
3123
|
+
if (truncated) {
|
|
3124
|
+
const oldestMs = jobs.reduce((min, job) => {
|
|
3125
|
+
const ms = getJobCreationMs(job);
|
|
3126
|
+
return ms !== null && (min === null || ms < min) ? ms : min;
|
|
3127
|
+
}, null);
|
|
3128
|
+
context.polling.setState({
|
|
3129
|
+
lastPolledAt,
|
|
3130
|
+
drainUntil: oldestMs ?? state?.drainUntil,
|
|
3131
|
+
highWater: state?.highWater ?? now
|
|
3132
|
+
});
|
|
3133
|
+
context.logger.warn(`BigQuery jobs poll truncated at the page cap. Draining the backlog older than ${oldestMs} on the next poll.`);
|
|
3134
|
+
} else context.polling.setState({ lastPolledAt: state?.highWater ?? now });
|
|
3135
|
+
if (context.debug.enabled) context.logger.debug(`Polled BigQuery jobs: ${jobs.length} fetched, truncated=${truncated}`);
|
|
3136
|
+
return {
|
|
3137
|
+
payload: {
|
|
3138
|
+
...payload,
|
|
3139
|
+
body: { data: { created: jobs } }
|
|
3140
|
+
},
|
|
3141
|
+
polledNoChanges: jobs.length === 0
|
|
3142
|
+
};
|
|
3143
|
+
}
|
|
3144
|
+
});
|
|
3145
|
+
var triggers_default = {
|
|
3146
|
+
myTrigger: (0, _prismatic_io_spectral.trigger)({
|
|
3147
|
+
display: {
|
|
3148
|
+
label: "PubSub Notification",
|
|
3149
|
+
description: "Receive PubSub notifications from Google Cloud when events occur."
|
|
3150
|
+
},
|
|
3151
|
+
perform: async (_context, payload) => {
|
|
3152
|
+
return Promise.resolve({
|
|
3153
|
+
payload,
|
|
3154
|
+
response: {
|
|
3155
|
+
statusCode: 200,
|
|
3156
|
+
contentType: "application/json"
|
|
3157
|
+
}
|
|
3158
|
+
});
|
|
3159
|
+
},
|
|
3160
|
+
inputs: {},
|
|
3161
|
+
synchronousResponseSupport: "valid",
|
|
3162
|
+
scheduleSupport: "valid"
|
|
3163
|
+
}),
|
|
3164
|
+
pollChangesTrigger
|
|
3165
|
+
};
|
|
3166
|
+
//#endregion
|
|
3167
|
+
//#region src/index.ts
|
|
3168
|
+
var src_default = (0, _prismatic_io_spectral.component)({
|
|
3169
|
+
key: "google-cloud-bigquery",
|
|
3170
|
+
public: true,
|
|
3171
|
+
documentationUrl: "https://prismatic.io/docs/components/google-cloud-bigquery/",
|
|
3172
|
+
display: {
|
|
3173
|
+
label: "Google Cloud BigQuery",
|
|
3174
|
+
description: "BigQuery is Google Cloud's fully managed, petabyte-scale, and cost-effective analytics data warehouse that lets you run analytics over vast amounts of data in near real time.",
|
|
3175
|
+
iconPath: "icon.png",
|
|
3176
|
+
category: "Application Connectors"
|
|
3177
|
+
},
|
|
3178
|
+
actions: actions_default,
|
|
3179
|
+
triggers: triggers_default,
|
|
3180
|
+
connections: connections_default,
|
|
3181
|
+
dataSources: datasources_default
|
|
3182
|
+
});
|
|
3183
|
+
//#endregion
|
|
3184
|
+
//#region npm-dist/.entry.ts
|
|
3185
|
+
var _entry_default = (0, _prismatic_io_spectral.callableComponent)(src_default);
|
|
3186
|
+
//#endregion
|
|
3187
|
+
module.exports = _entry_default;
|