@narrative.io/data-collaboration-sdk-ts 3.8.0 → 4.0.0-beta.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/access-rules/index.d.ts +3 -3
- package/build/access-rules/index.js +1 -1
- package/build/access-rules/types.d.ts +17 -3
- package/build/access-tokens/index.d.ts +4 -4
- package/build/access-tokens/index.js +3 -2
- package/build/access-tokens/types.d.ts +5 -3
- package/build/agents/types.d.ts +22 -6
- package/build/apps/index.d.ts +19 -6
- package/build/apps/index.js +26 -10
- package/build/apps/types.d.ts +1 -1
- package/build/attributes/index.d.ts +15 -12
- package/build/attributes/index.js +16 -7
- package/build/attributes/types.d.ts +18 -2
- package/build/authentication/types.d.ts +3 -3
- package/build/companies/index.d.ts +7 -4
- package/build/companies/index.js +10 -5
- package/build/company-info/types.d.ts +10 -0
- package/build/compute-pools/types.d.ts +16 -1
- package/build/connections/index.d.ts +29 -25
- package/build/connections/index.js +48 -29
- package/build/connections/types.d.ts +69 -16
- package/build/contracts/index.d.ts +10 -19
- package/build/contracts/index.js +8 -22
- package/build/contracts/types.d.ts +6 -2
- package/build/data-planes/index.d.ts +5 -1
- package/build/data-planes/index.js +7 -1
- package/build/data-planes/types.d.ts +95 -15
- package/build/data-streams/types.d.ts +13 -11
- package/build/datasets/index.d.ts +15 -4
- package/build/datasets/index.js +5 -3
- package/build/datasets/types.d.ts +17 -11
- package/build/encryption-materials/index.d.ts +5 -3
- package/build/encryption-materials/index.js +3 -1
- package/build/encryption-materials/types.d.ts +17 -5
- package/build/forecast/types.d.ts +42 -18
- package/build/health/index.d.ts +5 -0
- package/build/health/index.js +5 -0
- package/build/health/types.d.ts +8 -2
- package/build/installations/index.d.ts +6 -0
- package/build/installations/index.js +2 -1
- package/build/installations/types.d.ts +7 -1
- package/build/jobs/index.d.ts +7 -3
- package/build/jobs/index.js +5 -3
- package/build/jobs/types.d.ts +14 -14
- package/build/mappings/index.d.ts +15 -5
- package/build/mappings/index.js +9 -4
- package/build/mappings/types.d.ts +5 -3
- package/build/model-inference/index.d.ts +2 -2
- package/build/model-inference/types.d.ts +23 -4
- package/build/model-training/types.d.ts +16 -1
- package/build/models/index.d.ts +13 -12
- package/build/models/index.js +29 -8
- package/build/models/types.d.ts +96 -10
- package/build/nql/types.d.ts +17 -7
- package/build/nql/types.js +5 -1
- package/build/ping/index.d.ts +5 -1
- package/build/ping/index.js +5 -1
- package/build/products/index.d.ts +4 -3
- package/build/products/index.js +2 -2
- package/build/products/types.d.ts +26 -23
- package/build/queries/index.d.ts +7 -6
- package/build/queries/index.js +34 -4
- package/build/queries/types.d.ts +15 -0
- package/build/resources/index.d.ts +2 -2
- package/build/resources/index.js +1 -1
- package/build/resources/types.d.ts +16 -8
- package/build/rosetta-stone/index.d.ts +8 -8
- package/build/rosetta-stone/index.js +16 -32
- package/build/subscriptions/types.d.ts +3 -3
- package/build/uploads/index.d.ts +4 -1
- package/build/uploads/index.js +5 -2
- package/build/views/index.d.ts +11 -10
- package/build/views/index.js +40 -7
- package/build/views/types.d.ts +25 -4
- package/build/whoami/types.d.ts +38 -9
- package/build/workflows/index.d.ts +6 -7
- package/build/workflows/index.js +3 -2
- package/build/workflows/types.d.ts +14 -3
- package/package.json +3 -3
|
@@ -2,6 +2,12 @@ import { BaseApi } from "../base-api";
|
|
|
2
2
|
import { CompanyInfoApi } from "../company-info";
|
|
3
3
|
import type { ApiRecords, Config } from "../types";
|
|
4
4
|
import type { CachedMapping, CreateMapping, Mapping, MappingDefinition, MappingExpressionDependencies, MappingTestResult, MappingTestResults, ObjectMapping, PropertyMapping, RawCachedMapping, RawMappingDefinition, RawObjectMapping, RawPropertyMapping, RawValueMapping, ValueMapping } from "./types";
|
|
5
|
+
interface GetMappingsParameters extends Record<string, string | number | boolean | number[] | undefined> {
|
|
6
|
+
/** Filter by attribute id. Can be repeated to match multiple attributes. */
|
|
7
|
+
attribute_id?: number | number[];
|
|
8
|
+
/** Filter by dataset id. Can be repeated to match multiple datasets. */
|
|
9
|
+
dataset_id?: number | number[];
|
|
10
|
+
}
|
|
5
11
|
/**
|
|
6
12
|
* Class representing the Mappings API.
|
|
7
13
|
* Extends the BaseApi to provide functionalities specific to mappings.
|
|
@@ -11,13 +17,14 @@ declare class MappingsApi extends BaseApi {
|
|
|
11
17
|
private readonly companyInfoApi?;
|
|
12
18
|
constructor(config: Config, companyInfoApi?: CompanyInfoApi | undefined);
|
|
13
19
|
/**
|
|
14
|
-
* Retrieves all mappings.
|
|
20
|
+
* Retrieves all mappings owned by the caller's company, optionally filtered by attribute and/or dataset.
|
|
15
21
|
*
|
|
22
|
+
* @param {GetMappingsParameters} [parameters] - Optional attribute/dataset filters.
|
|
16
23
|
* @returns {Promise<ApiRecords<Mapping>>} A promise that resolves to a collection of Mapping records.
|
|
17
24
|
* @public
|
|
18
25
|
* @async
|
|
19
26
|
*/
|
|
20
|
-
getMappings(): Promise<ApiRecords<Mapping>>;
|
|
27
|
+
getMappings(parameters?: GetMappingsParameters): Promise<ApiRecords<Mapping>>;
|
|
21
28
|
/**
|
|
22
29
|
* Creates a new mapping specific to a company.
|
|
23
30
|
*
|
|
@@ -89,18 +96,21 @@ declare class MappingsApi extends BaseApi {
|
|
|
89
96
|
* @returns {Promise<void>} A promise that resolves when the mapping is succesfully promoted.
|
|
90
97
|
* @public
|
|
91
98
|
* @async
|
|
99
|
+
* @deprecated No corresponding `POST /mappings/{id}/promote` route was found in the backend
|
|
100
|
+
* (narrative-marketplace-backend @ 6f3819c). Calling this will likely 404 — flagged for
|
|
101
|
+
* review rather than removed, since callers may already depend on this signature.
|
|
92
102
|
*/
|
|
93
103
|
promoteMapping(mappingId: string): Promise<void>;
|
|
94
104
|
/**
|
|
95
105
|
* Updates a mapping.
|
|
96
106
|
*
|
|
97
107
|
* @param {string} mappingId - The ID of the mapping to update.
|
|
98
|
-
* @param {CreateMapping} mapping - The mapping
|
|
108
|
+
* @param {Pick<CreateMapping, "mapping" | "tags">} mapping - The mapping definition (required) and tags (optional) to update.
|
|
99
109
|
* @returns {Promise<Mapping>} A promise that resolves to the updated mapping.
|
|
100
110
|
* @public
|
|
101
111
|
* @async
|
|
102
112
|
*/
|
|
103
|
-
updateMapping(mappingId: string, mapping: Pick<CreateMapping, "mapping">): Promise<Mapping>;
|
|
113
|
+
updateMapping(mappingId: string, mapping: Pick<CreateMapping, "mapping" | "tags">): Promise<Mapping>;
|
|
104
114
|
/**
|
|
105
115
|
* Retrieves a mapping.
|
|
106
116
|
*
|
|
@@ -111,4 +121,4 @@ declare class MappingsApi extends BaseApi {
|
|
|
111
121
|
*/
|
|
112
122
|
getMapping(mappingId: string): Promise<Mapping>;
|
|
113
123
|
}
|
|
114
|
-
export { type CachedMapping, type CreateMapping, type Mapping, type MappingDefinition, type MappingExpressionDependencies, MappingsApi, type MappingTestResult, type MappingTestResults, type ObjectMapping, type PropertyMapping, type RawCachedMapping, type RawMappingDefinition, type RawObjectMapping, type RawPropertyMapping, type RawValueMapping, type ValueMapping, };
|
|
124
|
+
export { type CachedMapping, type CreateMapping, type GetMappingsParameters, type Mapping, type MappingDefinition, type MappingExpressionDependencies, MappingsApi, type MappingTestResult, type MappingTestResults, type ObjectMapping, type PropertyMapping, type RawCachedMapping, type RawMappingDefinition, type RawObjectMapping, type RawPropertyMapping, type RawValueMapping, type ValueMapping, };
|
package/build/mappings/index.js
CHANGED
|
@@ -27,14 +27,16 @@ class MappingsApi extends BaseApi {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
* Retrieves all mappings.
|
|
30
|
+
* Retrieves all mappings owned by the caller's company, optionally filtered by attribute and/or dataset.
|
|
31
31
|
*
|
|
32
|
+
* @param {GetMappingsParameters} [parameters] - Optional attribute/dataset filters.
|
|
32
33
|
* @returns {Promise<ApiRecords<Mapping>>} A promise that resolves to a collection of Mapping records.
|
|
33
34
|
* @public
|
|
34
35
|
* @async
|
|
35
36
|
*/
|
|
36
|
-
async getMappings() {
|
|
37
|
-
|
|
37
|
+
async getMappings(parameters) {
|
|
38
|
+
const queryString = this.constructQueryString(parameters);
|
|
39
|
+
return await this.get(`${resourceName}${queryString}`);
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
42
|
* Creates a new mapping specific to a company.
|
|
@@ -125,6 +127,9 @@ class MappingsApi extends BaseApi {
|
|
|
125
127
|
* @returns {Promise<void>} A promise that resolves when the mapping is succesfully promoted.
|
|
126
128
|
* @public
|
|
127
129
|
* @async
|
|
130
|
+
* @deprecated No corresponding `POST /mappings/{id}/promote` route was found in the backend
|
|
131
|
+
* (narrative-marketplace-backend @ 6f3819c). Calling this will likely 404 — flagged for
|
|
132
|
+
* review rather than removed, since callers may already depend on this signature.
|
|
128
133
|
*/
|
|
129
134
|
async promoteMapping(mappingId) {
|
|
130
135
|
await this.post(`${resourceName}/${mappingId}/promote`);
|
|
@@ -133,7 +138,7 @@ class MappingsApi extends BaseApi {
|
|
|
133
138
|
* Updates a mapping.
|
|
134
139
|
*
|
|
135
140
|
* @param {string} mappingId - The ID of the mapping to update.
|
|
136
|
-
* @param {CreateMapping} mapping - The mapping
|
|
141
|
+
* @param {Pick<CreateMapping, "mapping" | "tags">} mapping - The mapping definition (required) and tags (optional) to update.
|
|
137
142
|
* @returns {Promise<Mapping>} A promise that resolves to the updated mapping.
|
|
138
143
|
* @public
|
|
139
144
|
* @async
|
|
@@ -8,16 +8,18 @@ export interface Mapping {
|
|
|
8
8
|
updated_at: string;
|
|
9
9
|
created_by: number;
|
|
10
10
|
updated_by: number;
|
|
11
|
-
company_id
|
|
11
|
+
company_id?: number;
|
|
12
12
|
scope: MappingScope;
|
|
13
13
|
source: MappingSource;
|
|
14
|
-
derived_from
|
|
14
|
+
derived_from?: string;
|
|
15
15
|
tags?: string[];
|
|
16
16
|
}
|
|
17
17
|
type MappingStatus = "active" | "archived" | "pending" | "rejected";
|
|
18
18
|
type MappingScope = "global" | "private";
|
|
19
19
|
type MappingSource = "system" | "admin" | "company" | "lineage" | "rosetta_stone";
|
|
20
20
|
type CreateMappingSource = "company" | "rosetta_stone";
|
|
21
|
+
/** Only `active` and `pending` are accepted when creating a new mapping. */
|
|
22
|
+
type CreateMappingStatus = "active" | "pending";
|
|
21
23
|
export interface MappingExpressionDependencies {
|
|
22
24
|
properties: string[];
|
|
23
25
|
}
|
|
@@ -73,7 +75,7 @@ export interface CreateMapping {
|
|
|
73
75
|
dataset_id: number;
|
|
74
76
|
mapping: RawMappingDefinition;
|
|
75
77
|
tags?: string[];
|
|
76
|
-
status?:
|
|
78
|
+
status?: CreateMappingStatus;
|
|
77
79
|
source?: CreateMappingSource;
|
|
78
80
|
}
|
|
79
81
|
export interface MappingTestResult {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
2
|
import type { ModelInferenceRunJob } from "../jobs";
|
|
3
|
-
import type { InferenceConfig, InferenceMessage, InferenceModel, InferenceUsage, MessageRole, ModelInferenceRunRequest, ModelInferenceRunResult } from "./types";
|
|
3
|
+
import type { InferenceConfig, InferenceContentMessage, InferenceMessage, InferenceModel, InferenceRequestMessage, InferenceUsage, MessageRole, ModelInferenceRunRequest, ModelInferenceRunResult } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* @module ModelInferenceApi
|
|
6
6
|
* @description This module provides methods for running model inference jobs.
|
|
@@ -15,4 +15,4 @@ declare class ModelInferenceApi extends BaseApi {
|
|
|
15
15
|
*/
|
|
16
16
|
runModelInference(request: ModelInferenceRunRequest): Promise<ModelInferenceRunJob>;
|
|
17
17
|
}
|
|
18
|
-
export { type InferenceConfig, type InferenceMessage, type InferenceModel, type InferenceUsage, type MessageRole, ModelInferenceApi, type ModelInferenceRunRequest, type ModelInferenceRunResult, };
|
|
18
|
+
export { type InferenceConfig, type InferenceContentMessage, type InferenceMessage, type InferenceModel, type InferenceRequestMessage, type InferenceUsage, type MessageRole, ModelInferenceApi, type ModelInferenceRunRequest, type ModelInferenceRunResult, };
|
|
@@ -1,21 +1,40 @@
|
|
|
1
|
+
import type { ContentBlock } from "../agents/types";
|
|
1
2
|
/**
|
|
2
3
|
* Model identifiers supported by the Narrative model inference API.
|
|
3
4
|
* Maps to Scala ModelInferenceRunJobInput.Model
|
|
4
5
|
*/
|
|
5
|
-
export type InferenceModel = "anthropic.claude-haiku-4.5" | "anthropic.claude-sonnet-4.5" | "anthropic.claude-sonnet-4.6" | "anthropic.claude-opus-4.5" | "anthropic.claude-opus-4.6" | "openai.gpt-oss-120b" | "openai.gpt-4.1" | "openai.o4-mini";
|
|
6
|
+
export type InferenceModel = "anthropic.claude-haiku-4.5" | "anthropic.claude-sonnet-4.5" | "anthropic.claude-sonnet-4.6" | "anthropic.claude-sonnet-5.0" | "anthropic.claude-opus-4.5" | "anthropic.claude-opus-4.6" | "anthropic.claude-opus-4.7" | "anthropic.claude-opus-4.8" | "openai.gpt-oss-120b" | "openai.gpt-4.1" | "openai.o4-mini";
|
|
6
7
|
/**
|
|
7
8
|
* Message role for inference requests.
|
|
8
9
|
* Maps to Scala ModelInferenceRunJobInput.Role
|
|
9
10
|
*/
|
|
10
11
|
export type MessageRole = "user" | "assistant" | "system";
|
|
11
12
|
/**
|
|
12
|
-
* A message in the inference conversation
|
|
13
|
-
*
|
|
13
|
+
* A message in the inference conversation using the current content-block
|
|
14
|
+
* wire shape (the same `ContentBlock` union used by the agents API).
|
|
15
|
+
* Responses always emit this shape; new integrations should send it too.
|
|
16
|
+
* Maps to Scala ModelInferenceRunJobInput.Message.
|
|
17
|
+
*/
|
|
18
|
+
export interface InferenceContentMessage {
|
|
19
|
+
role: MessageRole;
|
|
20
|
+
content: ContentBlock[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A message in the inference conversation using the legacy `{role, text}`
|
|
24
|
+
* shape. Still accepted on requests for backwards compatibility — the API
|
|
25
|
+
* auto-canonicalizes it into a single `text` content block — but new
|
|
26
|
+
* integrations should prefer {@link InferenceContentMessage}.
|
|
27
|
+
* Maps to Scala ModelInferenceRunJobInput.Message (legacy decoder).
|
|
14
28
|
*/
|
|
15
29
|
export interface InferenceMessage {
|
|
16
30
|
role: MessageRole;
|
|
17
31
|
text: string;
|
|
18
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Any message shape accepted by `POST /model-inference/run`: the current
|
|
35
|
+
* content-block shape or the legacy `{role, text}` shape.
|
|
36
|
+
*/
|
|
37
|
+
export type InferenceRequestMessage = InferenceContentMessage | InferenceMessage;
|
|
19
38
|
/**
|
|
20
39
|
* Configuration for the inference request.
|
|
21
40
|
* Maps to Scala ModelInferenceRunJobInput.InferenceConfig
|
|
@@ -42,7 +61,7 @@ export interface ModelInferenceRunRequest {
|
|
|
42
61
|
/** The model to use for inference */
|
|
43
62
|
model: InferenceModel;
|
|
44
63
|
/** The conversation messages */
|
|
45
|
-
messages:
|
|
64
|
+
messages: InferenceRequestMessage[];
|
|
46
65
|
/** Configuration for the inference */
|
|
47
66
|
inference_config: InferenceConfig;
|
|
48
67
|
/** Optional tags for the job */
|
|
@@ -6,18 +6,33 @@ export interface OutputModel {
|
|
|
6
6
|
tags?: string[];
|
|
7
7
|
license_id?: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* A destination connection to create for the model produced by a training run.
|
|
11
|
+
*/
|
|
12
|
+
export interface NewModelConnection {
|
|
13
|
+
/** Destination-specific quick settings; shape depends on the destination app. */
|
|
14
|
+
quick_settings?: Record<string, unknown>;
|
|
15
|
+
/** UUID of the app profile backing the connection. */
|
|
16
|
+
profile_id: string;
|
|
17
|
+
}
|
|
9
18
|
export interface TrainModelRequest {
|
|
10
19
|
base_model_id: number;
|
|
11
20
|
dataset_id: number;
|
|
12
21
|
training_config: ModelTrainingConfig;
|
|
13
22
|
output_model: OutputModel;
|
|
23
|
+
/**
|
|
24
|
+
* Connections to create for the trained model. Optional until the UI supports
|
|
25
|
+
* adding connections when kicking off training runs.
|
|
26
|
+
*/
|
|
27
|
+
connections?: NewModelConnection[];
|
|
14
28
|
}
|
|
15
29
|
export interface TrainModelResponse {
|
|
16
30
|
job_id: string;
|
|
17
31
|
}
|
|
18
32
|
export interface ModelTrainingConfig {
|
|
19
33
|
instance_type: string;
|
|
20
|
-
|
|
34
|
+
/** Free-form JSON override merged into the generated Axolotl config (Scala `Option[Json]`). */
|
|
35
|
+
custom_axolotl_config_override?: Record<string, unknown>;
|
|
21
36
|
}
|
|
22
37
|
export interface TrainClassifierRequest {
|
|
23
38
|
config: Record<string, unknown>;
|
package/build/models/index.d.ts
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
|
-
import type {
|
|
3
|
-
import type { CreateModelRequest, Model, ModelCollaborators, UpdateModelRequest } from "./types";
|
|
2
|
+
import type { ApiRecordsV2 } from "../types";
|
|
3
|
+
import type { CreateModelRequest, GetModelsParams, Model, ModelCollaborators, ModelOrderBy, ModelParticipants, ModelRepository, ModelRepositoryType, ModelStatus, UpdateModelRequest } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* A class for accessing the Models API.
|
|
6
6
|
* @extends BaseApi
|
|
7
7
|
*/
|
|
8
8
|
declare class ModelsApi extends BaseApi {
|
|
9
9
|
/**
|
|
10
|
-
* Gets a list of
|
|
10
|
+
* Gets a paginated list of models accessible to the authenticated company from the API.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
12
|
+
* @param {GetModelsParams} [params] - Optional pagination, repository type, and sort filters.
|
|
13
|
+
* @returns {Promise<ApiRecordsV2<Model>>} A promise that resolves with the paginated list of models.
|
|
13
14
|
*/
|
|
14
|
-
getModels(): Promise<
|
|
15
|
+
getModels(params?: GetModelsParams): Promise<ApiRecordsV2<Model>>;
|
|
15
16
|
/**
|
|
16
17
|
* Updates an existing model on the API.
|
|
17
18
|
*
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
19
|
+
* @param {number} modelId - The ID of the model to update.
|
|
20
|
+
* @param {UpdateModelRequest} data - The updated data for the model.
|
|
20
21
|
* @returns {Promise<Model>} A promise that resolves with the updated model.
|
|
21
22
|
*/
|
|
22
|
-
updateModel(modelId:
|
|
23
|
+
updateModel(modelId: number, data: UpdateModelRequest): Promise<Model>;
|
|
23
24
|
/**
|
|
24
|
-
* Deletes a model from the API.
|
|
25
|
+
* Deletes (archives) a model from the API.
|
|
25
26
|
*
|
|
26
|
-
* @param {
|
|
27
|
+
* @param {number} modelId - The ID of the model to delete.
|
|
27
28
|
* @returns {Promise<void>} A promise that resolves when the model is deleted.
|
|
28
29
|
*/
|
|
29
|
-
deleteModel(modelId:
|
|
30
|
+
deleteModel(modelId: number): Promise<void>;
|
|
30
31
|
}
|
|
31
|
-
export { type CreateModelRequest, type Model, type ModelCollaborators, ModelsApi, type UpdateModelRequest, };
|
|
32
|
+
export { type CreateModelRequest, type GetModelsParams, type Model, type ModelCollaborators, type ModelOrderBy, type ModelParticipants, type ModelRepository, type ModelRepositoryType, type ModelStatus, ModelsApi, type UpdateModelRequest, };
|
package/build/models/index.js
CHANGED
|
@@ -12,27 +12,48 @@ const resourceName = "models";
|
|
|
12
12
|
*/
|
|
13
13
|
class ModelsApi extends BaseApi {
|
|
14
14
|
/**
|
|
15
|
-
* Gets a list of
|
|
15
|
+
* Gets a paginated list of models accessible to the authenticated company from the API.
|
|
16
16
|
*
|
|
17
|
-
* @
|
|
17
|
+
* @param {GetModelsParams} [params] - Optional pagination, repository type, and sort filters.
|
|
18
|
+
* @returns {Promise<ApiRecordsV2<Model>>} A promise that resolves with the paginated list of models.
|
|
18
19
|
*/
|
|
19
|
-
async getModels() {
|
|
20
|
-
|
|
20
|
+
async getModels(params) {
|
|
21
|
+
const queryParams = new URLSearchParams();
|
|
22
|
+
if (params?.page) {
|
|
23
|
+
queryParams.append("page", params.page.toString());
|
|
24
|
+
}
|
|
25
|
+
if (params?.per_page) {
|
|
26
|
+
queryParams.append("per_page", params.per_page.toString());
|
|
27
|
+
}
|
|
28
|
+
if (params?.repository_type) {
|
|
29
|
+
const repositoryTypes = Array.isArray(params.repository_type)
|
|
30
|
+
? params.repository_type
|
|
31
|
+
: [params.repository_type];
|
|
32
|
+
for (const repositoryType of repositoryTypes) {
|
|
33
|
+
queryParams.append("repository_type", repositoryType);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (params?.order_by) {
|
|
37
|
+
queryParams.append("order_by", params.order_by);
|
|
38
|
+
}
|
|
39
|
+
const queryString = queryParams.toString();
|
|
40
|
+
const url = queryString ? `${resourceName}?${queryString}` : resourceName;
|
|
41
|
+
return await this.get(url);
|
|
21
42
|
}
|
|
22
43
|
/**
|
|
23
44
|
* Updates an existing model on the API.
|
|
24
45
|
*
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {
|
|
46
|
+
* @param {number} modelId - The ID of the model to update.
|
|
47
|
+
* @param {UpdateModelRequest} data - The updated data for the model.
|
|
27
48
|
* @returns {Promise<Model>} A promise that resolves with the updated model.
|
|
28
49
|
*/
|
|
29
50
|
async updateModel(modelId, data) {
|
|
30
51
|
return await this.put(`${resourceName}/${modelId}`, data);
|
|
31
52
|
}
|
|
32
53
|
/**
|
|
33
|
-
* Deletes a model from the API.
|
|
54
|
+
* Deletes (archives) a model from the API.
|
|
34
55
|
*
|
|
35
|
-
* @param {
|
|
56
|
+
* @param {number} modelId - The ID of the model to delete.
|
|
36
57
|
* @returns {Promise<void>} A promise that resolves when the model is deleted.
|
|
37
58
|
*/
|
|
38
59
|
async deleteModel(modelId) {
|
package/build/models/types.d.ts
CHANGED
|
@@ -1,18 +1,85 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Repository backed by a HuggingFace organization.
|
|
3
|
+
*/
|
|
4
|
+
export interface HuggingFaceRepository {
|
|
5
|
+
type: "hugging_face";
|
|
6
|
+
organization: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Repository backed by a Narrative company.
|
|
10
|
+
*/
|
|
11
|
+
export interface NarrativeRepository {
|
|
12
|
+
type: "narrative";
|
|
13
|
+
company_id: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Discriminated union describing where a model's artifacts are stored.
|
|
17
|
+
*/
|
|
18
|
+
export type ModelRepository = HuggingFaceRepository | NarrativeRepository;
|
|
19
|
+
/**
|
|
20
|
+
* No companies are allowed to participate.
|
|
21
|
+
*/
|
|
22
|
+
export interface ModelParticipantsNone {
|
|
23
|
+
type: "none";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* All companies are allowed to participate.
|
|
27
|
+
*/
|
|
28
|
+
export interface ModelParticipantsAll {
|
|
29
|
+
type: "all";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Anyone, including unauthenticated callers. `view` only.
|
|
33
|
+
*/
|
|
34
|
+
export interface ModelParticipantsAnonymous {
|
|
35
|
+
type: "anonymous";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Only the listed companies are allowed to participate. `company_ids` must be non-empty.
|
|
39
|
+
*/
|
|
40
|
+
export interface ModelParticipantsInclusion {
|
|
41
|
+
type: "inclusion";
|
|
42
|
+
company_ids: number[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Every company except the listed ones. `company_ids` must be non-empty.
|
|
46
|
+
*/
|
|
47
|
+
export interface ModelParticipantsExclusion {
|
|
48
|
+
type: "exclusion";
|
|
49
|
+
company_ids: number[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Who may view a model. Adds the `anonymous` variant the other two lack — see
|
|
53
|
+
* `ViewCollaborators` in `datashops-protocol`.
|
|
54
|
+
*/
|
|
55
|
+
export type ModelViewParticipants = ModelParticipantsAnonymous | ModelParticipantsAll | ModelParticipantsNone | ModelParticipantsInclusion | ModelParticipantsExclusion;
|
|
56
|
+
/**
|
|
57
|
+
* Who may train on, or deploy, a model — see `TrainCollaborators` /
|
|
58
|
+
* `DeployCollaborators` in `datashops-protocol`.
|
|
59
|
+
*/
|
|
60
|
+
export type ModelParticipants = ModelParticipantsAll | ModelParticipantsNone | ModelParticipantsInclusion | ModelParticipantsExclusion;
|
|
61
|
+
/**
|
|
62
|
+
* Defines which companies may view, train on, and deploy a model. Maps to Scala
|
|
63
|
+
* `ModelTrainingCollaborators`, which backs both `ModelResponse.collaborators` and
|
|
64
|
+
* `TrainRequest.OutputModel.collaborators`. All three keys are required.
|
|
65
|
+
*/
|
|
2
66
|
export interface ModelCollaborators {
|
|
3
|
-
view:
|
|
4
|
-
train:
|
|
5
|
-
deploy:
|
|
67
|
+
view: ModelViewParticipants;
|
|
68
|
+
train: ModelParticipants;
|
|
69
|
+
deploy: ModelParticipants;
|
|
6
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Current status of a model.
|
|
73
|
+
*/
|
|
74
|
+
export type ModelStatus = "active" | "archived";
|
|
7
75
|
export interface Model {
|
|
8
76
|
id: number;
|
|
9
77
|
company_id: number;
|
|
10
78
|
name: string;
|
|
79
|
+
/** A human readable name for the model. Always emitted (Scala non-Option). */
|
|
80
|
+
display_name: string;
|
|
11
81
|
license_id: string;
|
|
12
|
-
repository:
|
|
13
|
-
type: string;
|
|
14
|
-
organization: string;
|
|
15
|
-
};
|
|
82
|
+
repository: ModelRepository;
|
|
16
83
|
collaborators: ModelCollaborators;
|
|
17
84
|
description?: string;
|
|
18
85
|
tags: string[];
|
|
@@ -21,19 +88,38 @@ export interface Model {
|
|
|
21
88
|
updated_at: string | null;
|
|
22
89
|
archived_at: string | null;
|
|
23
90
|
version: number;
|
|
24
|
-
status:
|
|
91
|
+
status: ModelStatus;
|
|
25
92
|
}
|
|
26
93
|
export interface CreateModelRequest {
|
|
27
94
|
name: string;
|
|
28
95
|
license_id: string;
|
|
29
|
-
repository:
|
|
96
|
+
repository: ModelRepository;
|
|
30
97
|
collaborators: ModelCollaborators;
|
|
31
98
|
description?: string;
|
|
32
99
|
tags?: string[];
|
|
33
100
|
base_model_id?: number;
|
|
101
|
+
display_name?: string;
|
|
34
102
|
}
|
|
35
103
|
export interface UpdateModelRequest {
|
|
36
104
|
description?: string;
|
|
37
105
|
tags?: string[];
|
|
38
106
|
license_id?: string;
|
|
107
|
+
display_name?: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Repository type values usable to filter models via `GET /models`.
|
|
111
|
+
*/
|
|
112
|
+
export type ModelRepositoryType = "hugging_face" | "narrative";
|
|
113
|
+
/**
|
|
114
|
+
* Sort order values usable with `GET /models`.
|
|
115
|
+
*/
|
|
116
|
+
export type ModelOrderBy = "created_at_asc" | "created_at_desc";
|
|
117
|
+
/**
|
|
118
|
+
* Query parameters accepted by `GET /models`.
|
|
119
|
+
*/
|
|
120
|
+
export interface GetModelsParams {
|
|
121
|
+
page?: number;
|
|
122
|
+
per_page?: number;
|
|
123
|
+
repository_type?: ModelRepositoryType | ModelRepositoryType[];
|
|
124
|
+
order_by?: ModelOrderBy;
|
|
39
125
|
}
|
package/build/nql/types.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type NqlBudget = z.infer<typeof NqlBudgetObj>;
|
|
|
33
33
|
*/
|
|
34
34
|
export declare const NqlQueryInputObj: z.ZodObject<{
|
|
35
35
|
nql: z.ZodString;
|
|
36
|
-
data_plane_id: z.ZodNullable<z.ZodString
|
|
36
|
+
data_plane_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
37
|
execution_cluster: z.ZodOptional<z.ZodObject<{
|
|
38
38
|
type: z.ZodEnum<{
|
|
39
39
|
shared: "shared";
|
|
@@ -306,37 +306,47 @@ export interface BatchInfo {
|
|
|
306
306
|
batch_size: number;
|
|
307
307
|
related_jobs: RelatedJob[];
|
|
308
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Job state for an NQL run, as returned by `POST /nql/run` and `GET /nql/{id}`.
|
|
311
|
+
*/
|
|
312
|
+
export type NqlJobState = "failed" | "cancelled" | "completed" | "pending" | "scheduled" | "pending_cancellation" | "running";
|
|
309
313
|
export interface NqlResult {
|
|
310
314
|
id: string;
|
|
311
315
|
company_id: number;
|
|
312
|
-
|
|
316
|
+
/** `null` while the job hasn't completed yet. */
|
|
317
|
+
completed_at: string | null;
|
|
313
318
|
created_at: string;
|
|
314
319
|
failures: unknown[];
|
|
315
|
-
idempotency_key: string;
|
|
316
320
|
input: {
|
|
317
321
|
nql: string;
|
|
318
322
|
dataset?: Dataset;
|
|
323
|
+
/** Present on `EXPLAIN`/forecast runs. */
|
|
324
|
+
compiled_sql?: string;
|
|
325
|
+
/** Present on `CREATE MATERIALIZED VIEW` runs. */
|
|
319
326
|
compiled_select?: string;
|
|
327
|
+
/** Present on `CREATE MATERIALIZED VIEW` runs. */
|
|
328
|
+
create_as_view?: boolean;
|
|
320
329
|
};
|
|
330
|
+
idempotency_key: string;
|
|
321
331
|
request_source: {
|
|
322
332
|
type: string;
|
|
323
333
|
company_id: number;
|
|
324
334
|
user_id: number;
|
|
325
335
|
};
|
|
326
|
-
|
|
336
|
+
/** `null`/absent while the job hasn't completed yet. */
|
|
337
|
+
result?: {
|
|
327
338
|
type: string;
|
|
328
339
|
rows: number;
|
|
329
340
|
cost: number;
|
|
330
341
|
nql_type: string;
|
|
331
|
-
};
|
|
332
|
-
state:
|
|
342
|
+
} | null;
|
|
343
|
+
state: NqlJobState;
|
|
333
344
|
updated_at: string;
|
|
334
345
|
chunking_context?: BatchInfo;
|
|
335
346
|
}
|
|
336
347
|
export type NqlMappingErrors = Record<number, string>;
|
|
337
348
|
export interface NqlCompileResult {
|
|
338
349
|
sql: string;
|
|
339
|
-
mappingErrors?: NqlMappingErrors;
|
|
340
350
|
}
|
|
341
351
|
export interface ForecastBody {
|
|
342
352
|
as_of: string;
|
package/build/nql/types.js
CHANGED
|
@@ -38,7 +38,11 @@ export const NqlQueryInputObj = z.object({
|
|
|
38
38
|
message: "NQL query cannot contain a JOIN statement.",
|
|
39
39
|
})
|
|
40
40
|
.describe("A NQL query"),
|
|
41
|
-
data_plane_id: z
|
|
41
|
+
data_plane_id: z
|
|
42
|
+
.string()
|
|
43
|
+
.nullable()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Data plane identifier"),
|
|
42
46
|
execution_cluster: z
|
|
43
47
|
.object({
|
|
44
48
|
type: z.enum(["shared", "dedicated"]).describe("Execution cluster type"),
|
package/build/ping/index.d.ts
CHANGED
|
@@ -8,7 +8,11 @@ export declare class PingApi extends BaseApi {
|
|
|
8
8
|
/**
|
|
9
9
|
* Gets the result of a ping from the API.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Note: the backend's `/ping` route (`PingRoute` in `HealthCheckRoutes.scala`) responds with the
|
|
12
|
+
* literal plain-text body `"pong"`, not JSON. Parsing behavior therefore depends on how the
|
|
13
|
+
* underlying HTTP client handles non-JSON responses; the `PingStatus` type here is a placeholder.
|
|
14
|
+
*
|
|
15
|
+
* @returns {Promise<PingStatus>} A promise that resolves with the result of the ping.
|
|
12
16
|
*/
|
|
13
17
|
ping(): Promise<PingStatus>;
|
|
14
18
|
}
|
package/build/ping/index.js
CHANGED
|
@@ -14,7 +14,11 @@ export class PingApi extends BaseApi {
|
|
|
14
14
|
/**
|
|
15
15
|
* Gets the result of a ping from the API.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* Note: the backend's `/ping` route (`PingRoute` in `HealthCheckRoutes.scala`) responds with the
|
|
18
|
+
* literal plain-text body `"pong"`, not JSON. Parsing behavior therefore depends on how the
|
|
19
|
+
* underlying HTTP client handles non-JSON responses; the `PingStatus` type here is a placeholder.
|
|
20
|
+
*
|
|
21
|
+
* @returns {Promise<PingStatus>} A promise that resolves with the result of the ping.
|
|
18
22
|
*/
|
|
19
23
|
async ping() {
|
|
20
24
|
return await this.get(resourceName);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
|
+
import type { ApiRecords } from "../types";
|
|
2
3
|
import type { Product } from "./types";
|
|
3
4
|
/**
|
|
4
5
|
* A class for accessing the Products API.
|
|
@@ -6,10 +7,10 @@ import type { Product } from "./types";
|
|
|
6
7
|
*/
|
|
7
8
|
declare class ProductsApi extends BaseApi {
|
|
8
9
|
/**
|
|
9
|
-
* Gets
|
|
10
|
+
* Gets a paginated list of products from the API.
|
|
10
11
|
*
|
|
11
|
-
* @returns {Promise<Product
|
|
12
|
+
* @returns {Promise<ApiRecords<Product>>} A promise that resolves with the products.
|
|
12
13
|
*/
|
|
13
|
-
getHealthCheck(): Promise<Product
|
|
14
|
+
getHealthCheck(): Promise<ApiRecords<Product>>;
|
|
14
15
|
}
|
|
15
16
|
export { type Product, ProductsApi };
|
package/build/products/index.js
CHANGED
|
@@ -12,9 +12,9 @@ const resourceName = "admin/products";
|
|
|
12
12
|
*/
|
|
13
13
|
class ProductsApi extends BaseApi {
|
|
14
14
|
/**
|
|
15
|
-
* Gets
|
|
15
|
+
* Gets a paginated list of products from the API.
|
|
16
16
|
*
|
|
17
|
-
* @returns {Promise<Product
|
|
17
|
+
* @returns {Promise<ApiRecords<Product>>} A promise that resolves with the products.
|
|
18
18
|
*/
|
|
19
19
|
async getHealthCheck() {
|
|
20
20
|
return await this.get(resourceName);
|