@narrative.io/data-collaboration-sdk-ts 4.3.1 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/base-api.d.ts +11 -0
- package/build/base-api.js +15 -0
- package/build/data-planes/types.d.ts +52 -115
- package/build/derivations/index.d.ts +84 -0
- package/build/derivations/index.js +93 -0
- package/build/derivations/types.d.ts +56 -0
- package/build/derivations/types.js +1 -0
- package/build/generated/api-types.d.ts +7112 -5185
- package/build/generated/api-types.js +1 -1
- package/build/http-client.d.ts +1 -0
- package/build/http-client.js +3 -0
- package/build/index.d.ts +4 -1
- package/build/index.js +4 -0
- package/build/jobs/types.d.ts +137 -337
- package/build/jobs/types.js +3 -3
- package/build/model-training/index.d.ts +21 -5
- package/build/model-training/index.js +20 -4
- package/build/model-training/types.d.ts +69 -6
- package/build/nql/index.d.ts +28 -2
- package/build/nql/index.js +28 -0
- package/build/nql/types.d.ts +16 -4
- package/build/rosetta/types.d.ts +1 -1
- package/build/testing/fixtures/data-planes.d.ts +22 -3
- package/build/testing/fixtures/data-planes.js +52 -7
- package/build/testing/fixtures/derivations.d.ts +18 -0
- package/build/testing/fixtures/derivations.js +43 -0
- package/build/testing/fixtures/index.d.ts +5 -1
- package/build/testing/fixtures/index.js +5 -1
- package/build/testing/fixtures/jobs.d.ts +75 -0
- package/build/testing/fixtures/jobs.js +433 -0
- package/build/testing/fixtures/model-training.d.ts +8 -0
- package/build/testing/fixtures/model-training.js +12 -0
- package/build/testing/fixtures/nql.d.ts +10 -0
- package/build/testing/fixtures/nql.js +37 -0
- package/build/testing/handlers/data-planes.js +5 -3
- package/build/testing/index.d.ts +24 -4
- package/build/testing/index.js +23 -3
- package/build/testing/types.d.ts +70 -1
- package/package.json +3 -2
|
@@ -21,13 +21,29 @@ class ModelTrainingApi extends BaseApi {
|
|
|
21
21
|
return await this.post(`${resourceName}/run`, data);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Trains a classifier
|
|
24
|
+
* Trains a text classifier on a dataset. Only datasets on Snowflake data
|
|
25
|
+
* planes are supported.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
27
|
+
* The training data is named by `dataset_id` and the backing table resolved
|
|
28
|
+
* server-side, so the caller never handles it. Every column reference —
|
|
29
|
+
* `label_column`, `id_column`, and each feature's `field_path` — is checked
|
|
30
|
+
* against the dataset's schema before the job is created.
|
|
31
|
+
*
|
|
32
|
+
* This posts to `v1/model-training/train-classifier`. The unversioned
|
|
33
|
+
* endpoint still exists but is deprecated: it took the training table as an
|
|
34
|
+
* opaque `config` blob and validated none of it.
|
|
35
|
+
*
|
|
36
|
+
* @param {TrainClassifierRequest} data - The dataset, features and classifier
|
|
37
|
+
* settings to train with.
|
|
38
|
+
* @returns {Promise<TrainClassifierResponse>} The id of the created job. Poll
|
|
39
|
+
* the jobs API for status and results. Rejects with 400 if a name is not a
|
|
40
|
+
* valid identifier, a column reference is not in the dataset's schema, or the
|
|
41
|
+
* dataset is not materialized on a Snowflake data plane; 403 if the dataset
|
|
42
|
+
* is reachable but owned by another company.
|
|
43
|
+
* @see https://docs.narrative.io/api-reference/model-training/train-a-classifier
|
|
28
44
|
*/
|
|
29
45
|
async trainClassifier(data) {
|
|
30
|
-
return await this.post(
|
|
46
|
+
return await this.post(`v1/${resourceName}/train-classifier`, data);
|
|
31
47
|
}
|
|
32
48
|
}
|
|
33
49
|
export { ModelTrainingApi, };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { components } from "../generated/api-types";
|
|
1
2
|
import type { ModelCollaborators } from "../models/types";
|
|
2
3
|
export interface OutputModel {
|
|
3
4
|
name: string;
|
|
@@ -34,11 +35,73 @@ export interface ModelTrainingConfig {
|
|
|
34
35
|
/** Free-form JSON override merged into the generated Axolotl config (Scala `Option[Json]`). */
|
|
35
36
|
custom_axolotl_config_override?: Record<string, unknown>;
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Free-form settings passed straight through to the training procedure, which
|
|
40
|
+
* validates them.
|
|
41
|
+
*
|
|
42
|
+
* The backend types every one of these as a bare `Json`, which the spec writes
|
|
43
|
+
* as `type: object` and the generator renders as `Record<string, never>` — a
|
|
44
|
+
* type no object literal satisfies, so a caller could not fill one in. Widened
|
|
45
|
+
* here so `{ type: "random_forest", n_estimators: 200 }` compiles.
|
|
46
|
+
*/
|
|
47
|
+
export type ClassifierSettings = Record<string, unknown>;
|
|
48
|
+
/** Fields every feature shares. */
|
|
49
|
+
interface FeatureInputBase {
|
|
50
|
+
/**
|
|
51
|
+
* Column the feature is read from: either a plain column name or a path into
|
|
52
|
+
* a variant column, e.g. `data['merchant']`. Must exist in the dataset's
|
|
53
|
+
* schema, spelled exactly as it appears there.
|
|
54
|
+
*/
|
|
55
|
+
field_path: string;
|
|
56
|
+
/** Unique within the request. Alphanumerics and underscores only. */
|
|
57
|
+
name: string;
|
|
41
58
|
}
|
|
42
|
-
export interface
|
|
43
|
-
|
|
59
|
+
export interface CategoricalFeatureInput extends FeatureInputBase {
|
|
60
|
+
feature_type: "categorical";
|
|
61
|
+
/** The only variant that reads `field_type` — the others fix it themselves. */
|
|
62
|
+
field_type: "boolean" | "number" | "string";
|
|
63
|
+
/** Encoding settings, e.g. `{ max_categories: 100 }`. */
|
|
64
|
+
categorical?: ClassifierSettings;
|
|
65
|
+
/** Preprocessing applied before encoding. */
|
|
66
|
+
preprocess?: ClassifierSettings[];
|
|
67
|
+
}
|
|
68
|
+
export interface EmbeddingFeatureInput extends FeatureInputBase {
|
|
69
|
+
feature_type: "embedding";
|
|
70
|
+
/** e.g. `{ model: "e5-base-v2" }`. */
|
|
71
|
+
embedding?: ClassifierSettings;
|
|
44
72
|
}
|
|
73
|
+
export interface NumericFeatureInput extends FeatureInputBase {
|
|
74
|
+
feature_type: "numeric";
|
|
75
|
+
/** e.g. `{ scaler: "standard" }`. */
|
|
76
|
+
numeric?: ClassifierSettings;
|
|
77
|
+
}
|
|
78
|
+
export interface TextFeatureInput extends FeatureInputBase {
|
|
79
|
+
feature_type: "text";
|
|
80
|
+
/** e.g. `{ max_features: 10000 }`. */
|
|
81
|
+
tfidf?: ClassifierSettings;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* How one column is encoded for training, discriminated on `feature_type`.
|
|
85
|
+
*
|
|
86
|
+
* Hand-written rather than aliased. The backend models this as a sealed trait
|
|
87
|
+
* with four variants, each carrying its own settings key, and only
|
|
88
|
+
* `categorical` reads `field_type` — the other three fix it (`array`, `number`,
|
|
89
|
+
* `string`) and ignore whatever is sent. The spec flattens all four into one
|
|
90
|
+
* object with every key optional, which describes none of them: it would accept
|
|
91
|
+
* a `text` feature carrying `numeric` settings, and reject nothing that matters.
|
|
92
|
+
*/
|
|
93
|
+
export type FeatureInput = CategoricalFeatureInput | EmbeddingFeatureInput | NumericFeatureInput | TextFeatureInput;
|
|
94
|
+
/**
|
|
95
|
+
* Body of `POST /v1/model-training/train-classifier`.
|
|
96
|
+
*
|
|
97
|
+
* Aliased from the generated schema except for `feature_inputs` and `model`.
|
|
98
|
+
* The backend takes a `NonEmptyList[FeatureInput]`, so the tuple below turns an
|
|
99
|
+
* empty array into a compile error rather than a 400.
|
|
100
|
+
*/
|
|
101
|
+
export type TrainClassifierRequest = Omit<components["schemas"]["TrainClassifierRequest"], "feature_inputs" | "model"> & {
|
|
102
|
+
feature_inputs: [FeatureInput, ...FeatureInput[]];
|
|
103
|
+
/** Classifier hyperparameters. Defaults to logistic regression. */
|
|
104
|
+
model?: ClassifierSettings;
|
|
105
|
+
};
|
|
106
|
+
export type TrainClassifierResponse = components["schemas"]["TrainClassifierResponse"];
|
|
107
|
+
export {};
|
package/build/nql/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
2
|
import type { NqlAst } from "./Ast";
|
|
3
|
-
import type { Nql, NqlBooleanExpression, NqlCompileResult, NqlExpression, NqlField, NqlFilterBinaryExpression, NqlFilterExpression, NqlFilterUnaryExpression, NqlQueryInput, NqlResult, NqlWhere } from "./types";
|
|
3
|
+
import type { Nql, NqlBooleanExpression, NqlCompileResult, NqlExecuteRequest, NqlExecuteResponse, NqlExpression, NqlField, NqlFilterBinaryExpression, NqlFilterExpression, NqlFilterUnaryExpression, NqlQueryInput, NqlResult, NqlWhere } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* A class for accessing the NQL API.
|
|
6
6
|
* @extends BaseApi
|
|
@@ -9,10 +9,36 @@ declare class NqlApi extends BaseApi {
|
|
|
9
9
|
/**
|
|
10
10
|
* Executes an NQL query and returns the result.
|
|
11
11
|
*
|
|
12
|
+
* @deprecated The API deprecates `POST nql/run` in favour of
|
|
13
|
+
* {@link NqlApi.executeNqlStatement}, which posts to `v1/nql/execute`. The
|
|
14
|
+
* two are not drop-in equivalents: the replacement returns a workflow and a
|
|
15
|
+
* run id rather than a query result, so callers poll the run instead of
|
|
16
|
+
* reading rows off the response. `nql/run` still works, and the API will
|
|
17
|
+
* announce its removal separately.
|
|
18
|
+
*
|
|
12
19
|
* @param {string} nqlQuery - The NQL query to execute.
|
|
13
20
|
* @returns {Promise<NqlResult>} A promise that resolves with the result of the NQL query.
|
|
21
|
+
* @see https://docs.narrative.io/reference/deprecations/nql-run
|
|
22
|
+
* @see https://docs.narrative.io/api-reference/nql/run-a-nql-query
|
|
14
23
|
*/
|
|
15
24
|
executeNql(payload: NqlQueryInput): Promise<NqlResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Runs a mutating NQL statement as a workflow.
|
|
27
|
+
*
|
|
28
|
+
* Distinct from {@link NqlApi.executeNql}, which posts to `nql/run` and hands
|
|
29
|
+
* back a query result. This one accepts `INSERT`, `UPDATE`, `DELETE`,
|
|
30
|
+
* `EXPLAIN` and `CREATE MATERIALIZED VIEW`, compiles the statement into a
|
|
31
|
+
* workflow, starts a run, and returns both. Nothing here says the statement
|
|
32
|
+
* succeeded — poll the run for that.
|
|
33
|
+
*
|
|
34
|
+
* @param {NqlExecuteRequest} payload - The statement, and optionally the data
|
|
35
|
+
* plane, compute pool, and `create_as_view` flag.
|
|
36
|
+
* @returns {Promise<NqlExecuteResponse>} The created workflow and its run id.
|
|
37
|
+
* Rejects with 400 if the statement fails to compile or is a kind this
|
|
38
|
+
* endpoint cannot run.
|
|
39
|
+
* @see https://docs.narrative.io/api-reference/nql/execute-an-nql-statement
|
|
40
|
+
*/
|
|
41
|
+
executeNqlStatement(payload: NqlExecuteRequest): Promise<NqlExecuteResponse>;
|
|
16
42
|
/**
|
|
17
43
|
* Compiles an NQL query and returns the result, including any errors.
|
|
18
44
|
*
|
|
@@ -46,4 +72,4 @@ declare class NqlApi extends BaseApi {
|
|
|
46
72
|
export * from "./Ast";
|
|
47
73
|
export * from "./AstParser";
|
|
48
74
|
export * from "./NqlBuilder";
|
|
49
|
-
export { type Nql, NqlApi, type NqlBooleanExpression, type NqlCompileResult, type NqlExpression, type NqlField, type NqlFilterBinaryExpression, type NqlFilterExpression, type NqlFilterUnaryExpression, type NqlQueryInput, type NqlResult, type NqlWhere, };
|
|
75
|
+
export { type Nql, NqlApi, type NqlBooleanExpression, type NqlCompileResult, type NqlExecuteRequest, type NqlExecuteResponse, type NqlExpression, type NqlField, type NqlFilterBinaryExpression, type NqlFilterExpression, type NqlFilterUnaryExpression, type NqlQueryInput, type NqlResult, type NqlWhere, };
|
package/build/nql/index.js
CHANGED
|
@@ -15,13 +15,41 @@ class NqlApi extends BaseApi {
|
|
|
15
15
|
/**
|
|
16
16
|
* Executes an NQL query and returns the result.
|
|
17
17
|
*
|
|
18
|
+
* @deprecated The API deprecates `POST nql/run` in favour of
|
|
19
|
+
* {@link NqlApi.executeNqlStatement}, which posts to `v1/nql/execute`. The
|
|
20
|
+
* two are not drop-in equivalents: the replacement returns a workflow and a
|
|
21
|
+
* run id rather than a query result, so callers poll the run instead of
|
|
22
|
+
* reading rows off the response. `nql/run` still works, and the API will
|
|
23
|
+
* announce its removal separately.
|
|
24
|
+
*
|
|
18
25
|
* @param {string} nqlQuery - The NQL query to execute.
|
|
19
26
|
* @returns {Promise<NqlResult>} A promise that resolves with the result of the NQL query.
|
|
27
|
+
* @see https://docs.narrative.io/reference/deprecations/nql-run
|
|
28
|
+
* @see https://docs.narrative.io/api-reference/nql/run-a-nql-query
|
|
20
29
|
*/
|
|
21
30
|
async executeNql(payload) {
|
|
22
31
|
const response = await this.post(`${resourceName}/run`, payload);
|
|
23
32
|
return response;
|
|
24
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Runs a mutating NQL statement as a workflow.
|
|
36
|
+
*
|
|
37
|
+
* Distinct from {@link NqlApi.executeNql}, which posts to `nql/run` and hands
|
|
38
|
+
* back a query result. This one accepts `INSERT`, `UPDATE`, `DELETE`,
|
|
39
|
+
* `EXPLAIN` and `CREATE MATERIALIZED VIEW`, compiles the statement into a
|
|
40
|
+
* workflow, starts a run, and returns both. Nothing here says the statement
|
|
41
|
+
* succeeded — poll the run for that.
|
|
42
|
+
*
|
|
43
|
+
* @param {NqlExecuteRequest} payload - The statement, and optionally the data
|
|
44
|
+
* plane, compute pool, and `create_as_view` flag.
|
|
45
|
+
* @returns {Promise<NqlExecuteResponse>} The created workflow and its run id.
|
|
46
|
+
* Rejects with 400 if the statement fails to compile or is a kind this
|
|
47
|
+
* endpoint cannot run.
|
|
48
|
+
* @see https://docs.narrative.io/api-reference/nql/execute-an-nql-statement
|
|
49
|
+
*/
|
|
50
|
+
async executeNqlStatement(payload) {
|
|
51
|
+
return await this.post("v1/nql/execute", payload);
|
|
52
|
+
}
|
|
25
53
|
/**
|
|
26
54
|
* Compiles an NQL query and returns the result, including any errors.
|
|
27
55
|
*
|
package/build/nql/types.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import type { Dataset } from "../datasets/types";
|
|
9
|
+
import type { components } from "../generated/api-types";
|
|
9
10
|
/**
|
|
10
11
|
* Defines the structure for a budget object.
|
|
11
12
|
*
|
|
@@ -109,9 +110,9 @@ export declare const NqlFilterBinaryExpressionObj: z.ZodObject<{
|
|
|
109
110
|
">=": ">=";
|
|
110
111
|
"<=": "<=";
|
|
111
112
|
"=": "=";
|
|
112
|
-
"!=": "!=";
|
|
113
113
|
IN: "IN";
|
|
114
114
|
"NOT IN": "NOT IN";
|
|
115
|
+
"!=": "!=";
|
|
115
116
|
LIKE: "LIKE";
|
|
116
117
|
"NOT LIKE": "NOT LIKE";
|
|
117
118
|
}>;
|
|
@@ -149,9 +150,9 @@ export declare const NqlFilterExpressionObj: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
149
150
|
">=": ">=";
|
|
150
151
|
"<=": "<=";
|
|
151
152
|
"=": "=";
|
|
152
|
-
"!=": "!=";
|
|
153
153
|
IN: "IN";
|
|
154
154
|
"NOT IN": "NOT IN";
|
|
155
|
+
"!=": "!=";
|
|
155
156
|
LIKE: "LIKE";
|
|
156
157
|
"NOT LIKE": "NOT LIKE";
|
|
157
158
|
}>;
|
|
@@ -200,9 +201,9 @@ export declare const NqlWhereObj: z.ZodObject<{
|
|
|
200
201
|
">=": ">=";
|
|
201
202
|
"<=": "<=";
|
|
202
203
|
"=": "=";
|
|
203
|
-
"!=": "!=";
|
|
204
204
|
IN: "IN";
|
|
205
205
|
"NOT IN": "NOT IN";
|
|
206
|
+
"!=": "!=";
|
|
206
207
|
LIKE: "LIKE";
|
|
207
208
|
"NOT LIKE": "NOT LIKE";
|
|
208
209
|
}>;
|
|
@@ -263,9 +264,9 @@ export declare const NqlObj: z.ZodObject<{
|
|
|
263
264
|
">=": ">=";
|
|
264
265
|
"<=": "<=";
|
|
265
266
|
"=": "=";
|
|
266
|
-
"!=": "!=";
|
|
267
267
|
IN: "IN";
|
|
268
268
|
"NOT IN": "NOT IN";
|
|
269
|
+
"!=": "!=";
|
|
269
270
|
LIKE: "LIKE";
|
|
270
271
|
"NOT LIKE": "NOT LIKE";
|
|
271
272
|
}>;
|
|
@@ -405,4 +406,15 @@ export interface AstNodeMetadata {
|
|
|
405
406
|
node_type: AstNodeType;
|
|
406
407
|
version?: string;
|
|
407
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* Body of `POST /v1/nql/execute`. `create_as_view` applies only to
|
|
411
|
+
* `CREATE MATERIALIZED VIEW` and is ignored for every other statement.
|
|
412
|
+
*/
|
|
413
|
+
export type NqlExecuteRequest = components["schemas"]["ExecuteRequest"];
|
|
414
|
+
/**
|
|
415
|
+
* What `POST /v1/nql/execute` returns: the workflow the statement was compiled
|
|
416
|
+
* into, plus the id of the run started for it. Poll the run to find out whether
|
|
417
|
+
* the statement succeeded — the response only says the work was accepted.
|
|
418
|
+
*/
|
|
419
|
+
export type NqlExecuteResponse = components["schemas"]["CreateWorkflowResponseWithRunId"];
|
|
408
420
|
export {};
|
package/build/rosetta/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
2
|
declare const ChatCompletionRequestMessageRoleEnum: z.ZodEnum<{
|
|
3
3
|
function: "function";
|
|
4
|
-
system: "system";
|
|
5
4
|
user: "user";
|
|
6
5
|
assistant: "assistant";
|
|
6
|
+
system: "system";
|
|
7
7
|
}>;
|
|
8
8
|
type ConversationMessageRole = z.infer<typeof ChatCompletionRequestMessageRoleEnum>;
|
|
9
9
|
declare const isConversationMessageRole: (input: unknown) => input is ConversationMessageRole;
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
import type { DataPlaneOwnedResponse, JobResponse } from "../types";
|
|
1
|
+
import type { DataPlaneOwnedResponse, DataPlaneSharedResponse, JobResponse } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* An owned, active data plane. Every field the spec requires is filled in, so a
|
|
4
4
|
* caller only overrides what its assertion is about. The optional fields are
|
|
5
5
|
* present and `null`, which is what the API sends for an absent value — a mock
|
|
6
6
|
* that omitted them would let a consumer assert `undefined` and still pass.
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
9
|
-
/**
|
|
8
|
+
export declare function createOwnedDataPlane(overrides?: Partial<DataPlaneOwnedResponse>): DataPlaneOwnedResponse;
|
|
9
|
+
/**
|
|
10
|
+
* A data plane shared with the calling company, active, on AWS. Shared planes
|
|
11
|
+
* belong to someone else, so this one carries a different `company_id` and id
|
|
12
|
+
* than {@link createOwnedDataPlane} — seeding both gives you two records.
|
|
13
|
+
*
|
|
14
|
+
* Optional fields are present and `null` for the same reason as on the owned
|
|
15
|
+
* factory. For the other platform the API serves, override it:
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* createSharedDataPlane({
|
|
19
|
+
* platform: { type: "platform_shared_snowflake", region: null },
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function createSharedDataPlane(overrides?: Partial<DataPlaneSharedResponse>): DataPlaneSharedResponse;
|
|
24
|
+
/**
|
|
25
|
+
* The job a health check enqueues, still pending. A pending job has no result
|
|
26
|
+
* and no end timestamp, so both are `null` here — the same thing the API sends
|
|
27
|
+
* before the job reaches a terminal state.
|
|
28
|
+
*/
|
|
10
29
|
export declare function createHealthCheckJob(overrides?: Partial<JobResponse>): JobResponse;
|
|
@@ -5,7 +5,7 @@ const TIMESTAMP = "2026-01-01T00:00:00Z";
|
|
|
5
5
|
* present and `null`, which is what the API sends for an absent value — a mock
|
|
6
6
|
* that omitted them would let a consumer assert `undefined` and still pass.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export function createOwnedDataPlane(overrides = {}) {
|
|
9
9
|
return {
|
|
10
10
|
type: "owned",
|
|
11
11
|
id: "5f9d1a4e-0000-4000-8000-000000000001",
|
|
@@ -32,25 +32,70 @@ export function createDataPlane(overrides = {}) {
|
|
|
32
32
|
...overrides,
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* A data plane shared with the calling company, active, on AWS. Shared planes
|
|
37
|
+
* belong to someone else, so this one carries a different `company_id` and id
|
|
38
|
+
* than {@link createOwnedDataPlane} — seeding both gives you two records.
|
|
39
|
+
*
|
|
40
|
+
* Optional fields are present and `null` for the same reason as on the owned
|
|
41
|
+
* factory. For the other platform the API serves, override it:
|
|
42
|
+
*
|
|
43
|
+
* ```ts
|
|
44
|
+
* createSharedDataPlane({
|
|
45
|
+
* platform: { type: "platform_shared_snowflake", region: null },
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export function createSharedDataPlane(overrides = {}) {
|
|
50
|
+
return {
|
|
51
|
+
type: "shared",
|
|
52
|
+
id: "5f9d1a4e-0000-4000-8000-000000000002",
|
|
53
|
+
company_id: 2,
|
|
54
|
+
created_at: TIMESTAMP,
|
|
55
|
+
display_name: "Test Shared Data Plane",
|
|
56
|
+
platform: {
|
|
57
|
+
type: "platform_shared_aws",
|
|
58
|
+
region: { type: "region_aws", id: "us-east-1" },
|
|
59
|
+
},
|
|
60
|
+
status: "active",
|
|
61
|
+
updated_at: TIMESTAMP,
|
|
62
|
+
compute_pools: [],
|
|
63
|
+
description: null,
|
|
64
|
+
tags: null,
|
|
65
|
+
last_heartbeat_at: null,
|
|
66
|
+
default_compute_pool_id: null,
|
|
67
|
+
...overrides,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The job a health check enqueues, still pending. A pending job has no result
|
|
72
|
+
* and no end timestamp, so both are `null` here — the same thing the API sends
|
|
73
|
+
* before the job reaches a terminal state.
|
|
74
|
+
*/
|
|
36
75
|
export function createHealthCheckJob(overrides = {}) {
|
|
37
76
|
return {
|
|
38
77
|
job_id: "5f9d1a4e-0000-4000-8000-00000000000a",
|
|
78
|
+
company_id: 1,
|
|
39
79
|
data_plane_id: "5f9d1a4e-0000-4000-8000-000000000001",
|
|
80
|
+
compute_pool_id: null,
|
|
40
81
|
request_source: { type: "api_user", company_id: 1, user_id: 1 },
|
|
41
82
|
state: "pending",
|
|
42
|
-
type: "
|
|
83
|
+
type: "health_check",
|
|
84
|
+
operator_type: "health-check",
|
|
85
|
+
tags: [],
|
|
43
86
|
input: {},
|
|
44
|
-
executor:
|
|
87
|
+
executor: null,
|
|
45
88
|
execution_cluster: "dedicated",
|
|
46
|
-
failures: [],
|
|
47
89
|
idempotency_key: "test-idempotency-key",
|
|
48
|
-
result:
|
|
90
|
+
result: null,
|
|
91
|
+
dequeued_at: null,
|
|
49
92
|
created_at: TIMESTAMP,
|
|
50
93
|
updated_at: TIMESTAMP,
|
|
51
94
|
attempted_at: TIMESTAMP,
|
|
52
95
|
attempt_version: 1,
|
|
53
|
-
ended_at:
|
|
96
|
+
ended_at: null,
|
|
97
|
+
workflow_id: null,
|
|
98
|
+
workflow_run_id: null,
|
|
54
99
|
...overrides,
|
|
55
100
|
};
|
|
56
101
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DerivationResponse } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* An active derivation rule hashing a raw email into a hashed one — the
|
|
4
|
+
* worked example the spec uses. Every field the spec requires is filled in, so
|
|
5
|
+
* a caller only overrides what its assertion is about.
|
|
6
|
+
*
|
|
7
|
+
* `warnings` is empty and `fidelity_note` is `null`, which is what a read
|
|
8
|
+
* returns: list and get do not compute warnings, and an absent note arrives as
|
|
9
|
+
* an explicit `null` rather than being omitted. For a create or update
|
|
10
|
+
* response, override `warnings`:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* createDerivation({
|
|
14
|
+
* warnings: [{ type: "cyclic_derivation", cycle: [1, 2] }],
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function createDerivation(overrides?: Partial<DerivationResponse>): DerivationResponse;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const TIMESTAMP = "2026-01-01T00:00:00Z";
|
|
2
|
+
/**
|
|
3
|
+
* An active derivation rule hashing a raw email into a hashed one — the
|
|
4
|
+
* worked example the spec uses. Every field the spec requires is filled in, so
|
|
5
|
+
* a caller only overrides what its assertion is about.
|
|
6
|
+
*
|
|
7
|
+
* `warnings` is empty and `fidelity_note` is `null`, which is what a read
|
|
8
|
+
* returns: list and get do not compute warnings, and an absent note arrives as
|
|
9
|
+
* an explicit `null` rather than being omitted. For a create or update
|
|
10
|
+
* response, override `warnings`:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* createDerivation({
|
|
14
|
+
* warnings: [{ type: "cyclic_derivation", cycle: [1, 2] }],
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export function createDerivation(overrides = {}) {
|
|
19
|
+
return {
|
|
20
|
+
id: 1,
|
|
21
|
+
name: "raw_email_to_sha256_hashed_email",
|
|
22
|
+
description: "Hashes a raw email address with SHA-256.",
|
|
23
|
+
source_attribute_id: 10,
|
|
24
|
+
target_attribute_id: 11,
|
|
25
|
+
company_id: 1,
|
|
26
|
+
collaborators: { use: { type: "none" } },
|
|
27
|
+
mapping: {
|
|
28
|
+
type: "value_mapping",
|
|
29
|
+
expression: "SHA2(NORMALIZE_EMAIL($source.value), 256)",
|
|
30
|
+
},
|
|
31
|
+
lossy: true,
|
|
32
|
+
imprecise: false,
|
|
33
|
+
fidelity_note: null,
|
|
34
|
+
cost: 1,
|
|
35
|
+
active: true,
|
|
36
|
+
created_at: TIMESTAMP,
|
|
37
|
+
created_by: 1,
|
|
38
|
+
updated_at: TIMESTAMP,
|
|
39
|
+
updated_by: 1,
|
|
40
|
+
warnings: [],
|
|
41
|
+
...overrides,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createHealthCheckJob, createOwnedDataPlane, createSharedDataPlane, } from "./data-planes";
|
|
2
|
+
export { createDerivation } from "./derivations";
|
|
3
|
+
export { createCollectAccessRulesBillingDataJob, createDatasetsCalculateAffectedRowsJob, createDatasetsCalculateColumnStatsJob, createDatasetsCreateTableJob, createDatasetsDeleteTableJob, createDatasetsDeliverDataJob, createDatasetsEnforceRowTtlRetentionPolicyJob, createDatasetsEnforceTableTtlRetentionPolicyJob, createDatasetsExecuteDmlJob, createDatasetsSampleJob, createDatasetsTruncateTableJob, createMaterializeViewJob, createModelInferenceRunJob, createModelsDeliverModelJob, createModelsTrainClassifierJob, createModelTrainingRunJob, createNqlForecastJob, createOtherJob, } from "./jobs";
|
|
4
|
+
export { createTrainClassifierResponse } from "./model-training";
|
|
5
|
+
export { createNqlExecutionResponse } from "./nql";
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { createHealthCheckJob, createOwnedDataPlane, createSharedDataPlane, } from "./data-planes";
|
|
2
|
+
export { createDerivation } from "./derivations";
|
|
3
|
+
export { createCollectAccessRulesBillingDataJob, createDatasetsCalculateAffectedRowsJob, createDatasetsCalculateColumnStatsJob, createDatasetsCreateTableJob, createDatasetsDeleteTableJob, createDatasetsDeliverDataJob, createDatasetsEnforceRowTtlRetentionPolicyJob, createDatasetsEnforceTableTtlRetentionPolicyJob, createDatasetsExecuteDmlJob, createDatasetsSampleJob, createDatasetsTruncateTableJob, createMaterializeViewJob, createModelInferenceRunJob, createModelsDeliverModelJob, createModelsTrainClassifierJob, createModelTrainingRunJob, createNqlForecastJob, createOtherJob, } from "./jobs";
|
|
4
|
+
export { createTrainClassifierResponse } from "./model-training";
|
|
5
|
+
export { createNqlExecutionResponse } from "./nql";
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { CollectAccessRulesBillingDataJobResponse, DatasetsCalculateAffectedRowsJobResponse, DatasetsCalculateColumnStatsJobResponse, DatasetsCreateTableJobResponse, DatasetsDeleteTableJobResponse, DatasetsDeliverDataJobResponse, DatasetsEnforceRowTtlRetentionPolicyJobResponse, DatasetsEnforceTableTtlRetentionPolicyJobResponse, DatasetsExecuteDmlJobResponse, DatasetsSampleJobResponse, DatasetsTruncateTableJobResponse, MaterializeViewJobResponse, ModelInferenceRunJobResponse, ModelsDeliverModelJobResponse, ModelsTrainClassifierJobResponse, ModelTrainingRunJobResponse, NqlForecastJobResponse, OtherJobResponse } from "../types";
|
|
2
|
+
/** Refreshes a materialized view into its target dataset. */
|
|
3
|
+
export declare function createMaterializeViewJob(overrides?: Partial<MaterializeViewJobResponse>): MaterializeViewJobResponse;
|
|
4
|
+
/**
|
|
5
|
+
* Estimates what a query would return and what it would cost. The result is a
|
|
6
|
+
* sum type: this one succeeds, and the failure branch is
|
|
7
|
+
* `{ failure: { msg: "…" } }`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createNqlForecastJob(overrides?: Partial<NqlForecastJobResponse>): NqlForecastJobResponse;
|
|
10
|
+
/** Reads a sample of rows. The rows are stored separately, so only the count comes back. */
|
|
11
|
+
export declare function createDatasetsSampleJob(overrides?: Partial<DatasetsSampleJobResponse>): DatasetsSampleJobResponse;
|
|
12
|
+
/**
|
|
13
|
+
* Computes per-column statistics. This one carries the V1 input, which names
|
|
14
|
+
* the columns and the statistics to collect for each. The V2 input hands the
|
|
15
|
+
* operator pre-compiled SQL instead: `{ dataset_id, compiled_sql }`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createDatasetsCalculateColumnStatsJob(overrides?: Partial<DatasetsCalculateColumnStatsJobResponse>): DatasetsCalculateColumnStatsJobResponse;
|
|
18
|
+
/** Bills a materialized-view refresh, per access rule it read from. */
|
|
19
|
+
export declare function createCollectAccessRulesBillingDataJob(overrides?: Partial<CollectAccessRulesBillingDataJobResponse>): CollectAccessRulesBillingDataJobResponse;
|
|
20
|
+
/** Delivers a dataset snapshot to a connected app. One job per connection. */
|
|
21
|
+
export declare function createDatasetsDeliverDataJob(overrides?: Partial<DatasetsDeliverDataJobResponse>): DatasetsDeliverDataJobResponse;
|
|
22
|
+
/**
|
|
23
|
+
* Runs one inference call against a model on the data plane.
|
|
24
|
+
*
|
|
25
|
+
* `structured_output`, `output_format_schema`, and the tool argument fields are
|
|
26
|
+
* empty here rather than carrying a payload: the spec types them as an object
|
|
27
|
+
* with no properties, so no value satisfies them.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createModelInferenceRunJob(overrides?: Partial<ModelInferenceRunJobResponse>): ModelInferenceRunJobResponse;
|
|
30
|
+
/** Drops a dataset's underlying table. */
|
|
31
|
+
export declare function createDatasetsDeleteTableJob(overrides?: Partial<DatasetsDeleteTableJobResponse>): DatasetsDeleteTableJobResponse;
|
|
32
|
+
/** Runs an NQL `DELETE` or `UPDATE` against a dataset. */
|
|
33
|
+
export declare function createDatasetsExecuteDmlJob(overrides?: Partial<DatasetsExecuteDmlJobResponse>): DatasetsExecuteDmlJobResponse;
|
|
34
|
+
/** Creates a dataset's underlying table. */
|
|
35
|
+
export declare function createDatasetsCreateTableJob(overrides?: Partial<DatasetsCreateTableJobResponse>): DatasetsCreateTableJobResponse;
|
|
36
|
+
/** Empties a dataset's table, leaving the table itself in place. */
|
|
37
|
+
export declare function createDatasetsTruncateTableJob(overrides?: Partial<DatasetsTruncateTableJobResponse>): DatasetsTruncateTableJobResponse;
|
|
38
|
+
/** Drops a table that has outlived its TTL retention policy. */
|
|
39
|
+
export declare function createDatasetsEnforceTableTtlRetentionPolicyJob(overrides?: Partial<DatasetsEnforceTableTtlRetentionPolicyJobResponse>): DatasetsEnforceTableTtlRetentionPolicyJobResponse;
|
|
40
|
+
/** Deletes rows that have outlived their TTL retention policy. */
|
|
41
|
+
export declare function createDatasetsEnforceRowTtlRetentionPolicyJob(overrides?: Partial<DatasetsEnforceRowTtlRetentionPolicyJobResponse>): DatasetsEnforceRowTtlRetentionPolicyJobResponse;
|
|
42
|
+
/**
|
|
43
|
+
* Counts how many rows a pending statement would touch. The result carries the
|
|
44
|
+
* type of the operator that produced it rather than the job's own.
|
|
45
|
+
*
|
|
46
|
+
* The API returns the count at `rows[0].values.affected_rows`, which this
|
|
47
|
+
* fixture cannot express: the spec types `values` as an object with no
|
|
48
|
+
* properties, so `{}` is the only value that satisfies it. A test asserting on
|
|
49
|
+
* a count needs to cast the row.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createDatasetsCalculateAffectedRowsJob(overrides?: Partial<DatasetsCalculateAffectedRowsJobResponse>): DatasetsCalculateAffectedRowsJobResponse;
|
|
52
|
+
/**
|
|
53
|
+
* Fine-tunes a base model and publishes the result. The API stores this job's
|
|
54
|
+
* result exactly as the training operator posted it, so the spec gives it no
|
|
55
|
+
* shape and the fixture leaves it null.
|
|
56
|
+
*/
|
|
57
|
+
export declare function createModelTrainingRunJob(overrides?: Partial<ModelTrainingRunJobResponse>): ModelTrainingRunJobResponse;
|
|
58
|
+
/** Delivers a trained model to a connected app. */
|
|
59
|
+
export declare function createModelsDeliverModelJob(overrides?: Partial<ModelsDeliverModelJobResponse>): ModelsDeliverModelJobResponse;
|
|
60
|
+
/**
|
|
61
|
+
* Trains a classifier. Both `input` and `result` are free-form on the wire, so
|
|
62
|
+
* the defaults here are illustrative rather than a contract.
|
|
63
|
+
*/
|
|
64
|
+
export declare function createModelsTrainClassifierJob(overrides?: Partial<ModelsTrainClassifierJobResponse>): ModelsTrainClassifierJobResponse;
|
|
65
|
+
/**
|
|
66
|
+
* A job of a type the spec has no branch for, where `input` and `result` stay
|
|
67
|
+
* free-form. This is what a job type added after the spec was generated decodes
|
|
68
|
+
* as. The default is `datasets_execute_select`, a type the backend really runs
|
|
69
|
+
* and the spec does not describe.
|
|
70
|
+
*
|
|
71
|
+
* Undescribed by the spec is not the same as unknown to the SDK: the root entry
|
|
72
|
+
* point's `isKnownJob` still recognises this default. Override `type` to get a
|
|
73
|
+
* job neither one knows.
|
|
74
|
+
*/
|
|
75
|
+
export declare function createOtherJob(overrides?: Partial<OtherJobResponse>): OtherJobResponse;
|