@narrative.io/data-collaboration-sdk-ts 4.0.0-beta.0 → 4.0.0-beta.2
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 +2 -2
- package/build/agents/index.d.ts +2 -2
- package/build/agents/index.js +1 -1
- package/build/apps/index.js +1 -3
- package/build/base-api.d.ts +16 -3
- package/build/base-api.js +13 -0
- package/build/companies/index.js +1 -3
- package/build/compute-pools/types.d.ts +6 -2
- package/build/jobs/index.d.ts +2 -4
- package/build/types.d.ts +58 -1
- package/build/workflows/types.d.ts +10 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
|
-
import type { ApiRecords, ApiRecordsV2,
|
|
2
|
+
import type { ApiRecords, ApiRecordsV2, PagePagination } from "../types";
|
|
3
3
|
import type { AccessRule, AccessRuleMapping, AccessRuleMetadata, AccessRuleV2, CreateAccessRuleV2Request, OwnedAccessRule, SharedAccessRule, UpdateAccessRuleV2Request } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Represents the parameters used to retrieve access rules.
|
|
@@ -104,7 +104,7 @@ declare class AccessRulesApi extends BaseApi {
|
|
|
104
104
|
* @description This method fetches access rules based on the specified filters and pagination options provided in the parameters.
|
|
105
105
|
* It returns a promise that resolves to a list of access rules that match the criteria.
|
|
106
106
|
*/
|
|
107
|
-
getAccessableAccessRules(parameters: GetAccessRulesParameters &
|
|
107
|
+
getAccessableAccessRules(parameters: GetAccessRulesParameters & PagePagination): Promise<ApiRecordsV2<AccessRuleV2>>;
|
|
108
108
|
/**
|
|
109
109
|
* Creates a new access rule (version 2).
|
|
110
110
|
*
|
package/build/agents/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
|
-
import type { ApiRecordsV2,
|
|
2
|
+
import type { ApiRecordsV2, PagePagination } from "../types";
|
|
3
3
|
import type { ConversationId, ConversationResponse, CreateConversationRequest, CreateRunRequest, ListMessagesResponse, RunId, RunResponse } from "./types";
|
|
4
4
|
export * from "./types";
|
|
5
5
|
/**
|
|
@@ -23,7 +23,7 @@ export declare class AgentsApi extends BaseApi {
|
|
|
23
23
|
* Scoped to both `company_id` and `user_id` from the bearer token — peers in
|
|
24
24
|
* the same company are not visible. Never 404s; empty state is `records: []`.
|
|
25
25
|
*/
|
|
26
|
-
listAgentConversations(options?:
|
|
26
|
+
listAgentConversations(options?: PagePagination): Promise<ApiRecordsV2<ConversationResponse>>;
|
|
27
27
|
/**
|
|
28
28
|
* Read a conversation's metadata + current `version`. Always re-read this
|
|
29
29
|
* immediately before starting a run — `version` is the compare-and-swap
|
package/build/agents/index.js
CHANGED
|
@@ -27,7 +27,7 @@ export class AgentsApi extends BaseApi {
|
|
|
27
27
|
* the same company are not visible. Never 404s; empty state is `records: []`.
|
|
28
28
|
*/
|
|
29
29
|
async listAgentConversations(options) {
|
|
30
|
-
return await this.get(conversationsResource, options
|
|
30
|
+
return await this.get(conversationsResource, options);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Read a conversation's metadata + current `version`. Always re-read this
|
package/build/apps/index.js
CHANGED
|
@@ -15,9 +15,7 @@ class AppsApi extends BaseApi {
|
|
|
15
15
|
async getApps(appCategory) {
|
|
16
16
|
return appCategory === undefined
|
|
17
17
|
? await this.get(resourceName)
|
|
18
|
-
: await this.get(resourceName, {
|
|
19
|
-
category: appCategory,
|
|
20
|
-
});
|
|
18
|
+
: await this.get(resourceName, { category: appCategory });
|
|
21
19
|
}
|
|
22
20
|
/**
|
|
23
21
|
* List installations for the authenticated company (or, with an app
|
package/build/base-api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HttpClient } from "./http-client";
|
|
2
|
-
import type { Config,
|
|
2
|
+
import type { Config, QueryParamsOf } from "./types";
|
|
3
3
|
/**
|
|
4
4
|
* BaseApi class provides basic functionality for making API requests.
|
|
5
5
|
*/
|
|
@@ -48,11 +48,18 @@ export declare abstract class BaseApi {
|
|
|
48
48
|
/**
|
|
49
49
|
* Makes a GET request to the given endpoint.
|
|
50
50
|
*
|
|
51
|
+
* `params` is constrained by its own values rather than by an index signature,
|
|
52
|
+
* so a purpose-built params interface can be passed directly — see
|
|
53
|
+
* {@link QueryParamsOf}. Pagination is *not* baked into this signature: the
|
|
54
|
+
* scheme differs per endpoint, so each params type declares its own (see
|
|
55
|
+
* `OffsetPagination` / `PagePagination` / `CursorPagination`).
|
|
56
|
+
*
|
|
51
57
|
* @param {string} endpoint - Endpoint for the request.
|
|
52
58
|
* @returns {Promise<T>} - Promise that resolves with the response data.
|
|
53
59
|
* @template T - Type of the response data.
|
|
60
|
+
* @template P - Type of the query parameters.
|
|
54
61
|
*/
|
|
55
|
-
protected get<T>(endpoint: string, params?:
|
|
62
|
+
protected get<T, P extends QueryParamsOf<P> = Record<string, never>>(endpoint: string, params?: P): Promise<T>;
|
|
56
63
|
/**
|
|
57
64
|
* Makes a POST request to the given endpoint with the given data.
|
|
58
65
|
*
|
|
@@ -93,5 +100,11 @@ export declare abstract class BaseApi {
|
|
|
93
100
|
* @private
|
|
94
101
|
*/
|
|
95
102
|
private constructHeaders;
|
|
96
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Renders params into a query string, repeating array values (`?tag=a&tag=b`).
|
|
105
|
+
*
|
|
106
|
+
* Constrained by value rather than by index signature, for the reasons in
|
|
107
|
+
* {@link QueryParamsOf}.
|
|
108
|
+
*/
|
|
109
|
+
protected constructQueryString<T extends QueryParamsOf<T> = Record<string, never>>(parameters?: T): string;
|
|
97
110
|
}
|
package/build/base-api.js
CHANGED
|
@@ -78,9 +78,16 @@ export class BaseApi {
|
|
|
78
78
|
/**
|
|
79
79
|
* Makes a GET request to the given endpoint.
|
|
80
80
|
*
|
|
81
|
+
* `params` is constrained by its own values rather than by an index signature,
|
|
82
|
+
* so a purpose-built params interface can be passed directly — see
|
|
83
|
+
* {@link QueryParamsOf}. Pagination is *not* baked into this signature: the
|
|
84
|
+
* scheme differs per endpoint, so each params type declares its own (see
|
|
85
|
+
* `OffsetPagination` / `PagePagination` / `CursorPagination`).
|
|
86
|
+
*
|
|
81
87
|
* @param {string} endpoint - Endpoint for the request.
|
|
82
88
|
* @returns {Promise<T>} - Promise that resolves with the response data.
|
|
83
89
|
* @template T - Type of the response data.
|
|
90
|
+
* @template P - Type of the query parameters.
|
|
84
91
|
*/
|
|
85
92
|
async get(endpoint, params) {
|
|
86
93
|
const queryString = this.constructQueryString(params);
|
|
@@ -165,6 +172,12 @@ export class BaseApi {
|
|
|
165
172
|
}
|
|
166
173
|
return headers;
|
|
167
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Renders params into a query string, repeating array values (`?tag=a&tag=b`).
|
|
177
|
+
*
|
|
178
|
+
* Constrained by value rather than by index signature, for the reasons in
|
|
179
|
+
* {@link QueryParamsOf}.
|
|
180
|
+
*/
|
|
168
181
|
constructQueryString(parameters) {
|
|
169
182
|
const queryParameters = [];
|
|
170
183
|
if (parameters != null) {
|
package/build/companies/index.js
CHANGED
|
@@ -19,8 +19,6 @@ export class CompaniesApi extends BaseApi {
|
|
|
19
19
|
* applied server-side to the company name (`name_like` query param).
|
|
20
20
|
*/
|
|
21
21
|
async getCompanies(nameLike) {
|
|
22
|
-
return await this.get(resourceName, {
|
|
23
|
-
name_like: nameLike,
|
|
24
|
-
});
|
|
22
|
+
return await this.get(resourceName, { name_like: nameLike });
|
|
25
23
|
}
|
|
26
24
|
}
|
|
@@ -132,6 +132,10 @@ export interface UpdateComputePoolRequest {
|
|
|
132
132
|
export interface ListComputePoolsResponse {
|
|
133
133
|
records: ComputePoolResponse[];
|
|
134
134
|
}
|
|
135
|
-
export
|
|
135
|
+
export interface ListComputePoolsParams {
|
|
136
|
+
/**
|
|
137
|
+
* Documented by the public API, but the route does not currently read it —
|
|
138
|
+
* active compute pools are returned regardless of the value.
|
|
139
|
+
*/
|
|
136
140
|
status?: ComputePoolStatus;
|
|
137
|
-
}
|
|
141
|
+
}
|
package/build/jobs/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
|
-
import type { ApiRecordsV2 } from "../types";
|
|
2
|
+
import type { ApiRecordsV2, OffsetPagination } from "../types";
|
|
3
3
|
import type { CalculateAffectedRowsInput, CalculateAffectedRowsJob, CollectAccessRulesBillingDataInput, CollectAccessRulesBillingDataJob, CollectAccessRulesBillingDataResult, ColumnDetails, ColumnStatDataType, CostsInput, CostsJob, CreateTableInput, DatasetsCalculateColumnStatsJob, DatasetsCreateTableJob, DatasetsDeleteTableJob, DatasetsDeliverDataJob, DatasetsEnforceRowTtlRetentionPolicyJob, DatasetsEnforceTableTtlRetentionPolicyJob, DatasetsExecuteDmlJob, DatasetsExecuteSelectJob, DatasetsSampleJob, DatasetsSuggestMappingsJob, DatasetsTruncateTableJob, DeleteInput, DeliverInput, EnabledColumnStatFlags, EnforceRowTtlRetentionPolicyInput, EnforceTableTtlRetentionPolicyInput, ExecuteDmlInput, ExecuteDmlResult, ExecuteSelectInput, ExecuteSelectResult, ExplainInput, ExplainJob, ExplainOutput, ForecastInput, ForecastInternalJob, ForecastJob, HealthCheckJob, Job, JobExecutionCluster, JobRequestSource, JobRequestSourceApiUser, JobRequestSourceProcess, JobType, KnownJob, MaterializedViewInput, MaterializedViewJob, MaterializedViewOutput, MaterializedViewRowStats, ModelInferenceRunInput, ModelInferenceRunJob, ModelInferenceRunJobResult, ModelsDeliverModelInput, ModelsDeliverModelJob, ModelsTrainClassifierJob, ModelTrainingRunInput, ModelTrainingRunJob, RefreshMaterializedViewResult, SampleInput, StatsInput, StatsInputV2, SuggestMappingsInput, SuggestMappingsResult, TruncateTableInput } from "./types";
|
|
4
4
|
import { isKnownJob, KNOWN_JOB_TYPES } from "./types";
|
|
5
5
|
type JobStateFilter = "cancelled" | "completed" | "failed" | "pending" | "pending_cancellation" | "running" | "scheduled";
|
|
6
|
-
interface GetJobsParameters extends
|
|
6
|
+
interface GetJobsParameters extends OffsetPagination {
|
|
7
7
|
data_plane_id?: string;
|
|
8
8
|
dataset_id?: number;
|
|
9
|
-
per_page?: number;
|
|
10
|
-
offset?: number;
|
|
11
9
|
order_by?: "created_at_asc" | "created_at_desc" | "updated_at_asc" | "updated_at_desc";
|
|
12
10
|
state?: JobStateFilter | JobStateFilter[];
|
|
13
11
|
type?: string | string[];
|
package/build/types.d.ts
CHANGED
|
@@ -59,10 +59,67 @@ export interface PaginationMetadata {
|
|
|
59
59
|
total_records: number;
|
|
60
60
|
total_pages: number;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
|
+
* A value that can be rendered into a query string.
|
|
64
|
+
*
|
|
65
|
+
* Arrays are repeated (`?tag=a&tag=b`) rather than joined, matching how the
|
|
66
|
+
* backend's `OptionalMultiQueryParamDecoderMatcher` reads them.
|
|
67
|
+
*/
|
|
68
|
+
export type QueryValue = string | number | boolean | null | undefined | Array<string | number | boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* Constrains a params type's *values* to what a query string can express, without
|
|
71
|
+
* requiring an index signature.
|
|
72
|
+
*
|
|
73
|
+
* This is a homomorphic mapped type, so it preserves optional modifiers and maps
|
|
74
|
+
* only over `P`'s own keys. That's the difference that matters: a plain interface
|
|
75
|
+
* satisfies it, whereas `Record<string, unknown>` requires an index signature that
|
|
76
|
+
* TypeScript never gives an interface — and an index signature would also disable
|
|
77
|
+
* excess-property checking, silently accepting misspelled parameter names.
|
|
78
|
+
*/
|
|
79
|
+
export type QueryParamsOf<P> = {
|
|
80
|
+
[K in keyof P]: QueryValue;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* `per_page` + `offset`. Server defaults: `per_page` 50, `offset` 0.
|
|
84
|
+
*
|
|
85
|
+
* The original pagination scheme (`http4s.pagination`), used by billing,
|
|
86
|
+
* contracts, dataset snapshots, dataset stats, data streams, jobs and product
|
|
87
|
+
* admin. Sending `page` to one of these endpoints does nothing — it is ignored
|
|
88
|
+
* and you get the first page every time.
|
|
89
|
+
*/
|
|
90
|
+
export interface OffsetPagination {
|
|
91
|
+
per_page?: number | null;
|
|
92
|
+
offset?: number | null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* `per_page` + `page`. Server default: `page` 1, page size per route.
|
|
96
|
+
*
|
|
97
|
+
* The `http4s.paginationV2` scheme, and the most common one: access rules,
|
|
98
|
+
* agents, app invites, attributes, datasets, installations, models, queries,
|
|
99
|
+
* views and the workflows list.
|
|
100
|
+
*/
|
|
101
|
+
export interface PagePagination {
|
|
63
102
|
page?: number | null;
|
|
64
103
|
per_page?: number | null;
|
|
65
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* `per_page` + `page_token`. Server default: `per_page` 10.
|
|
107
|
+
*
|
|
108
|
+
* Opaque-cursor pagination. Read `next_page_token` off the response and pass it
|
|
109
|
+
* back as `page_token`; a null/absent token means the last page.
|
|
110
|
+
*/
|
|
111
|
+
export interface CursorPagination {
|
|
112
|
+
per_page?: number;
|
|
113
|
+
page_token?: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Page-number pagination.
|
|
117
|
+
*
|
|
118
|
+
* @deprecated Prefer {@link PagePagination}, which names the scheme explicitly.
|
|
119
|
+
* Not every endpoint paginates this way — see {@link OffsetPagination} and
|
|
120
|
+
* {@link CursorPagination}.
|
|
121
|
+
*/
|
|
122
|
+
export type PaginationOptions = PagePagination;
|
|
66
123
|
/**
|
|
67
124
|
* Interface for search parameters
|
|
68
125
|
*/
|
|
@@ -53,13 +53,21 @@ export interface ListRunsResponse {
|
|
|
53
53
|
runs: WorkflowRun[];
|
|
54
54
|
next_page_token?: string | null;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Query parameters for `GET /workflows/{id}/runs`.
|
|
58
|
+
*
|
|
59
|
+
* Deliberately has no index signature: an index signature would silently accept
|
|
60
|
+
* misspelled or legacy parameter names (e.g. `pageSize`/`pageToken`), which the
|
|
61
|
+
* server ignores — the request succeeds and pagination just never advances.
|
|
62
|
+
*/
|
|
63
|
+
export interface ListRunsParams {
|
|
57
64
|
/** Maximum number of runs to return per page (`per_page` query param). Defaults to 10. */
|
|
58
65
|
per_page?: number;
|
|
59
66
|
/** Opaque token from a previous response (`page_token` query param). */
|
|
60
67
|
page_token?: string;
|
|
61
68
|
}
|
|
62
|
-
|
|
69
|
+
/** Query parameters for `GET /workflows`. See {@link ListRunsParams} on why there's no index signature. */
|
|
70
|
+
export interface ListWorkflowsParams extends PaginationOptions {
|
|
63
71
|
/** Narrow results to workflows on this data plane. */
|
|
64
72
|
data_plane_id?: string;
|
|
65
73
|
}
|