@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.
Files changed (79) hide show
  1. package/build/access-rules/index.d.ts +3 -3
  2. package/build/access-rules/index.js +1 -1
  3. package/build/access-rules/types.d.ts +17 -3
  4. package/build/access-tokens/index.d.ts +4 -4
  5. package/build/access-tokens/index.js +3 -2
  6. package/build/access-tokens/types.d.ts +5 -3
  7. package/build/agents/types.d.ts +22 -6
  8. package/build/apps/index.d.ts +19 -6
  9. package/build/apps/index.js +26 -10
  10. package/build/apps/types.d.ts +1 -1
  11. package/build/attributes/index.d.ts +15 -12
  12. package/build/attributes/index.js +16 -7
  13. package/build/attributes/types.d.ts +18 -2
  14. package/build/authentication/types.d.ts +3 -3
  15. package/build/companies/index.d.ts +7 -4
  16. package/build/companies/index.js +10 -5
  17. package/build/company-info/types.d.ts +10 -0
  18. package/build/compute-pools/types.d.ts +16 -1
  19. package/build/connections/index.d.ts +29 -25
  20. package/build/connections/index.js +48 -29
  21. package/build/connections/types.d.ts +69 -16
  22. package/build/contracts/index.d.ts +10 -19
  23. package/build/contracts/index.js +8 -22
  24. package/build/contracts/types.d.ts +6 -2
  25. package/build/data-planes/index.d.ts +5 -1
  26. package/build/data-planes/index.js +7 -1
  27. package/build/data-planes/types.d.ts +95 -15
  28. package/build/data-streams/types.d.ts +13 -11
  29. package/build/datasets/index.d.ts +15 -4
  30. package/build/datasets/index.js +5 -3
  31. package/build/datasets/types.d.ts +17 -11
  32. package/build/encryption-materials/index.d.ts +5 -3
  33. package/build/encryption-materials/index.js +3 -1
  34. package/build/encryption-materials/types.d.ts +17 -5
  35. package/build/forecast/types.d.ts +42 -18
  36. package/build/health/index.d.ts +5 -0
  37. package/build/health/index.js +5 -0
  38. package/build/health/types.d.ts +8 -2
  39. package/build/installations/index.d.ts +6 -0
  40. package/build/installations/index.js +2 -1
  41. package/build/installations/types.d.ts +7 -1
  42. package/build/jobs/index.d.ts +7 -3
  43. package/build/jobs/index.js +5 -3
  44. package/build/jobs/types.d.ts +14 -14
  45. package/build/mappings/index.d.ts +15 -5
  46. package/build/mappings/index.js +9 -4
  47. package/build/mappings/types.d.ts +5 -3
  48. package/build/model-inference/index.d.ts +2 -2
  49. package/build/model-inference/types.d.ts +23 -4
  50. package/build/model-training/types.d.ts +16 -1
  51. package/build/models/index.d.ts +13 -12
  52. package/build/models/index.js +29 -8
  53. package/build/models/types.d.ts +96 -10
  54. package/build/nql/types.d.ts +17 -7
  55. package/build/nql/types.js +5 -1
  56. package/build/ping/index.d.ts +5 -1
  57. package/build/ping/index.js +5 -1
  58. package/build/products/index.d.ts +4 -3
  59. package/build/products/index.js +2 -2
  60. package/build/products/types.d.ts +26 -23
  61. package/build/queries/index.d.ts +7 -6
  62. package/build/queries/index.js +34 -4
  63. package/build/queries/types.d.ts +15 -0
  64. package/build/resources/index.d.ts +2 -2
  65. package/build/resources/index.js +1 -1
  66. package/build/resources/types.d.ts +16 -8
  67. package/build/rosetta-stone/index.d.ts +8 -8
  68. package/build/rosetta-stone/index.js +16 -32
  69. package/build/subscriptions/types.d.ts +3 -3
  70. package/build/uploads/index.d.ts +4 -1
  71. package/build/uploads/index.js +5 -2
  72. package/build/views/index.d.ts +11 -10
  73. package/build/views/index.js +40 -7
  74. package/build/views/types.d.ts +25 -4
  75. package/build/whoami/types.d.ts +38 -9
  76. package/build/workflows/index.d.ts +6 -7
  77. package/build/workflows/index.js +3 -2
  78. package/build/workflows/types.d.ts +14 -3
  79. package/package.json +3 -3
@@ -1,34 +1,37 @@
1
1
  type ProductId = string;
2
- type ProductSkuType = "processing" | "storage" | "transfer";
3
- type ProductCloudType = "aws" | "gcp" | "azure";
4
- type ProductUnitType = "bytes" | "average-bytes-per-month";
5
- type ProductStatus = "active" | "archived";
6
- interface ProductRate {
7
- type: string;
8
- unitPrice: {
9
- type: string;
10
- currency: string;
11
- priceInMicroCents: number;
12
- };
2
+ export type ProductSkuTypeCategory = "processing" | "storage" | "transfer" | "marketplace-data-transaction";
3
+ export interface ProductSkuType {
4
+ category: ProductSkuTypeCategory;
5
+ }
6
+ export interface ProductCloudPlatform {
7
+ region?: string;
8
+ platform?: string;
9
+ }
10
+ export type ProductStatus = "active" | "archived";
11
+ export type ProductRateType = "per_unit" | "percent_of_gmv";
12
+ export interface ProductRate {
13
+ type: ProductRateType;
14
+ unit_price: ProductUnitPrice;
13
15
  }
14
16
  export interface ProductUnitPrice {
15
- type: string;
16
- currency: string;
17
- priceInMicroCents: number;
17
+ value: number;
18
+ expressed_in: string;
19
+ currency?: string;
18
20
  }
19
21
  export interface Product {
20
22
  id: ProductId;
21
23
  sku: string;
22
- skuType: ProductSkuType;
23
- payableCompanyId: number;
24
+ sku_type: ProductSkuType;
25
+ payable_company_id: number;
24
26
  name: string;
25
- description?: string | null;
26
- cloud?: ProductCloudType | null;
27
- region?: string | null;
28
- unit: ProductUnitType;
29
- defaultRate: ProductRate;
27
+ description?: string;
28
+ cloud_platform?: ProductCloudPlatform;
29
+ unit: string;
30
+ default_rate: ProductRate;
30
31
  status: ProductStatus;
31
- createdAt: string;
32
- updatedAt: string;
32
+ created_at: string;
33
+ created_by_user_id?: number;
34
+ updated_at: string;
35
+ updated_by_user_id?: number;
33
36
  }
34
37
  export {};
@@ -1,17 +1,18 @@
1
1
  import { BaseApi } from "../base-api";
2
- import type { ApiRecords } from "../types";
3
- import type { CreateNqlQueryRequest, NqlOwnedQueryResponse, NqlQueryAst, NqlQueryCollaborators, NqlQueryMetadata, NqlQueryOwner, NqlQueryResponse, NqlSharedQueryResponse, UpdateNqlQueryRequest } from "./types";
2
+ import type { ApiRecordsV2 } from "../types";
3
+ import type { CreateNqlQueryRequest, GetQueriesParams, NqlOwnedQueryResponse, NqlQueryAst, NqlQueryCollaborators, NqlQueryMetadata, NqlQueryOwner, NqlQueryResponse, NqlSharedQueryResponse, UpdateNqlQueryRequest } from "./types";
4
4
  /**
5
5
  * A class for accessing the Queries API.
6
6
  * @extends BaseApi
7
7
  */
8
8
  declare class QueriesApi extends BaseApi {
9
9
  /**
10
- * Gets a list of accessable queries from the API.
10
+ * Gets a paginated list of accessible queries from the API.
11
11
  *
12
- * @returns {Promise<ApiRecords<NqlQuery>>} A promise that resolves with the list of queries.
12
+ * @param {GetQueriesParams} [params] - Optional pagination, ownership, tag, owner, and keyword filters.
13
+ * @returns {Promise<ApiRecordsV2<NqlQueryResponse>>} A promise that resolves with the paginated list of queries.
13
14
  */
14
- getQueries(): Promise<ApiRecords<NqlQueryResponse>>;
15
+ getQueries(params?: GetQueriesParams): Promise<ApiRecordsV2<NqlQueryResponse>>;
15
16
  /**
16
17
  * Gets a single query from the API by its ID.
17
18
  *
@@ -42,4 +43,4 @@ declare class QueriesApi extends BaseApi {
42
43
  */
43
44
  updateQuery(queryId: string, data: UpdateNqlQueryRequest): Promise<NqlQueryResponse>;
44
45
  }
45
- export { type CreateNqlQueryRequest, type NqlOwnedQueryResponse, type NqlQueryAst, type NqlQueryCollaborators, type NqlQueryMetadata, type NqlQueryOwner, type NqlQueryResponse, type NqlSharedQueryResponse, QueriesApi, type UpdateNqlQueryRequest, };
46
+ export { type CreateNqlQueryRequest, type GetQueriesParams, type NqlOwnedQueryResponse, type NqlQueryAst, type NqlQueryCollaborators, type NqlQueryMetadata, type NqlQueryOwner, type NqlQueryResponse, type NqlSharedQueryResponse, QueriesApi, type UpdateNqlQueryRequest, };
@@ -12,12 +12,42 @@ const resourceName = "v2/queries";
12
12
  */
13
13
  class QueriesApi extends BaseApi {
14
14
  /**
15
- * Gets a list of accessable queries from the API.
15
+ * Gets a paginated list of accessible queries from the API.
16
16
  *
17
- * @returns {Promise<ApiRecords<NqlQuery>>} A promise that resolves with the list of queries.
17
+ * @param {GetQueriesParams} [params] - Optional pagination, ownership, tag, owner, and keyword filters.
18
+ * @returns {Promise<ApiRecordsV2<NqlQueryResponse>>} A promise that resolves with the paginated list of queries.
18
19
  */
19
- async getQueries() {
20
- return await this.get(resourceName);
20
+ async getQueries(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?.is_owned !== undefined) {
29
+ queryParams.append("is_owned", params.is_owned.toString());
30
+ }
31
+ if (params?.q) {
32
+ queryParams.append("q", params.q);
33
+ }
34
+ if (params?.tag) {
35
+ const tags = Array.isArray(params.tag) ? params.tag : [params.tag];
36
+ for (const tag of tags) {
37
+ queryParams.append("tag", tag);
38
+ }
39
+ }
40
+ if (params?.company_id) {
41
+ const companyIds = Array.isArray(params.company_id)
42
+ ? params.company_id
43
+ : [params.company_id];
44
+ for (const companyId of companyIds) {
45
+ queryParams.append("company_id", companyId.toString());
46
+ }
47
+ }
48
+ const queryString = queryParams.toString();
49
+ const url = queryString ? `${resourceName}?${queryString}` : resourceName;
50
+ return await this.get(url);
21
51
  }
22
52
  /**
23
53
  * Gets a single query from the API by its ID.
@@ -64,3 +64,18 @@ export interface NqlQueryMetadata {
64
64
  updated_by_user_id?: number;
65
65
  updated_at: string;
66
66
  }
67
+ /**
68
+ * Query parameters accepted by `GET /v2/queries`.
69
+ */
70
+ export interface GetQueriesParams {
71
+ page?: number;
72
+ per_page?: number;
73
+ /** `true` returns only owned queries; `false` only shared-with-you queries. */
74
+ is_owned?: boolean;
75
+ /** Filters by tag. OR-d together when multiple are given. */
76
+ tag?: string | string[];
77
+ /** Filters by owning company id. OR-d together when multiple are given. */
78
+ company_id?: number | number[];
79
+ /** Free-text keyword search. */
80
+ q?: string;
81
+ }
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import { BaseApi } from "../base-api";
6
6
  import type { ApiRecords } from "../types";
7
- import type { BucketCreationRequest, Resource, UpdateAccessTypeRequest } from "./types";
8
- export type { BucketCreationRequest, Resource, UpdateAccessTypeRequest };
7
+ import type { BucketCreationRequest, BucketPolicyAuth, Resource, ResourceAuth, RoleAuth, UpdateAccessTypeRequest } from "./types";
8
+ export type { BucketCreationRequest, BucketPolicyAuth, Resource, ResourceAuth, RoleAuth, UpdateAccessTypeRequest, };
9
9
  /**
10
10
  * @class ResourceApi
11
11
  * @extends {BaseApi}
@@ -37,6 +37,6 @@ export class ResourceApi extends BaseApi {
37
37
  * @returns {Promise<Resource>} A promise that resolves to the updated resource.
38
38
  */
39
39
  async updateAccessType(request) {
40
- return await this.post(`${resourceName}/buckets/access`, request);
40
+ return await this.post(`${resourceName}/update-access`, request);
41
41
  }
42
42
  }
@@ -1,12 +1,19 @@
1
+ export interface BucketPolicyAuth {
2
+ type: "bucket_policy";
3
+ account_id: string;
4
+ }
5
+ export interface RoleAuth {
6
+ type: "role";
7
+ account_id: string;
8
+ external_id?: string;
9
+ /** The ARN of the role to assume to perform bucket management operations. */
10
+ role?: string;
11
+ }
12
+ export type ResourceAuth = BucketPolicyAuth | RoleAuth;
1
13
  export interface Resource {
2
14
  id: string;
3
15
  company_id: number;
4
- auth: {
5
- type: "bucket_policy" | "role";
6
- account_id: string;
7
- external_id?: string;
8
- role?: string;
9
- };
16
+ auth: ResourceAuth;
10
17
  name: string;
11
18
  created_at: string;
12
19
  updated_at: string;
@@ -14,7 +21,7 @@ export interface Resource {
14
21
  }
15
22
  export interface RoleBasedBucketAccess {
16
23
  type: "role";
17
- external_id: string;
24
+ external_id?: string;
18
25
  }
19
26
  export interface PolicyBasedBucketAccess {
20
27
  type: "bucket_policy";
@@ -27,5 +34,6 @@ export type BucketAccess = RoleBasedBucketAccess | PolicyBasedBucketAccess;
27
34
  export interface BucketCreationRequest {
28
35
  account_id: string;
29
36
  resource_id: string;
30
- access: BucketAccess;
37
+ /** Defaults server-side to role-based access (with no external id) when omitted. */
38
+ access?: BucketAccess;
31
39
  }
@@ -1,17 +1,17 @@
1
1
  import { BaseApi } from "../base-api";
2
- import type { Dataset } from "../datasets";
3
- import type { Mapping } from "../mappings/types";
4
2
  import type { RosettaStoneResponse, SampleRecord, SampleRecords } from "./types";
5
3
  declare class RosettaStoneApi extends BaseApi {
6
4
  /**
7
- * Fetches suggested mappings generated from sample records.
5
+ * Fetches suggested attribute label mappings for a set of sample records.
8
6
  *
9
- * @param sample
10
- * @returns {Promise<Mapping[]>} - A promise that resolves to the created mapping.
7
+ * Posts the sample to `POST /rosetta-stone/labels/sample` using the
8
+ * authenticated base client. The backend flattens each record and returns a
9
+ * scored label suggestion per detected key.
10
+ *
11
+ * @param sample - The sample records to derive label suggestions from.
12
+ * @returns A promise that resolves to the scored label suggestions.
11
13
  * @experimental
12
14
  */
13
- getMappingRecommendationsFromSample(dataset: Partial<Dataset>, sample: SampleRecords, remap_existing_mappings?: boolean): Promise<{
14
- response: Mapping[];
15
- }>;
15
+ getMappingRecommendationsFromSample(sample: SampleRecord[]): Promise<RosettaStoneResponse[]>;
16
16
  }
17
17
  export { RosettaStoneApi, type RosettaStoneResponse, type SampleRecord, type SampleRecords, };
@@ -1,41 +1,25 @@
1
1
  import { BaseApi } from "../base-api";
2
+ /**
3
+ * The name of the resource to be used in API requests.
4
+ * @constant
5
+ * @private
6
+ * @type {string}
7
+ */
8
+ const resourceName = "rosetta-stone";
2
9
  class RosettaStoneApi extends BaseApi {
3
10
  /**
4
- * Fetches suggested mappings generated from sample records.
11
+ * Fetches suggested attribute label mappings for a set of sample records.
5
12
  *
6
- * @param sample
7
- * @returns {Promise<Mapping[]>} - A promise that resolves to the created mapping.
13
+ * Posts the sample to `POST /rosetta-stone/labels/sample` using the
14
+ * authenticated base client. The backend flattens each record and returns a
15
+ * scored label suggestion per detected key.
16
+ *
17
+ * @param sample - The sample records to derive label suggestions from.
18
+ * @returns A promise that resolves to the scored label suggestions.
8
19
  * @experimental
9
20
  */
10
- async getMappingRecommendationsFromSample(dataset, sample, remap_existing_mappings = false) {
11
- try {
12
- const resp = await fetch("https://rosetta-stone-api.narrative.io/v1/rosetta_stone/suggest_mappings ", {
13
- method: "POST",
14
- body: JSON.stringify({
15
- dataset,
16
- sample: {
17
- records: sample.sample,
18
- },
19
- remap_existing_mappings,
20
- }),
21
- headers: {
22
- "Content-Type": "application/json",
23
- },
24
- });
25
- const mappings = (await resp.json());
26
- return {
27
- response: mappings.response.map((mapping) => {
28
- return {
29
- ...mapping,
30
- dataset_id: dataset.id ?? 0,
31
- };
32
- }),
33
- };
34
- }
35
- catch (e) {
36
- console.error(e);
37
- return { response: [] };
38
- }
21
+ async getMappingRecommendationsFromSample(sample) {
22
+ return await this.post(`${resourceName}/labels/sample`, { sample });
39
23
  }
40
24
  }
41
25
  export { RosettaStoneApi, };
@@ -12,7 +12,7 @@ export interface Subscription {
12
12
  output?: SubscriptionOutput;
13
13
  cadence?: SubscriptionCadence;
14
14
  status: SubscriptionStatus;
15
- update_at: string;
15
+ updated_at: string;
16
16
  }
17
17
  export interface SubscriptionBudget {
18
18
  amount: {
@@ -23,7 +23,7 @@ export interface SubscriptionBudget {
23
23
  type: SubscriptionBudgetPeriod;
24
24
  };
25
25
  }
26
- export type SubscriptionBudgetPeriod = "calendar_daily" | "calendar_monthly";
26
+ export type SubscriptionBudgetPeriod = "calendar_daily" | "calendar_monthly" | "calendar_weekly";
27
27
  export interface SubscriptionDetails {
28
28
  type: SubscriptionType;
29
29
  data_rules: DataRules;
@@ -40,7 +40,7 @@ export type DataStreamSubscriptionDetails = SubscriptionDetails & {
40
40
  };
41
41
  export type MarketplaceSubscriptionDetails = SubscriptionDetails & {
42
42
  type: "marketplace";
43
- company_contraint?: CompanyConstraint;
43
+ company_constraint?: CompanyConstraint;
44
44
  dataset_constraint?: DatasetConstraint;
45
45
  pricing: {
46
46
  micro_cents_usd: number;
@@ -14,9 +14,12 @@ declare class UploadsApi extends BaseApi {
14
14
  */
15
15
  getUploadUrl(uploadPath: string): Promise<UploadsResponse>;
16
16
  /**
17
- * Confirms the completion of an upload process.
17
+ * Confirms the completion of an upload process by ingesting the uploaded file into a dataset.
18
18
  * This method should be called after a file has been uploaded to the provided URL to finalize the upload.
19
19
  *
20
+ * Note: this calls `POST /datasets/{dataset_id}/upload` — there is no `uploads/{id}` confirmation
21
+ * endpoint; `/uploads/{upload_path}` (see {@link getUploadUrl}) only supports issuing upload URLs.
22
+ *
20
23
  * @async
21
24
  * @param {number} datasetId - The unique identifier of the dataset being uploaded.
22
25
  * @param {string} uploadPath - The path where the file was uploaded.
@@ -22,16 +22,19 @@ class UploadsApi extends BaseApi {
22
22
  return await this.post(`${resourceName}/${uploadPath}`);
23
23
  }
24
24
  /**
25
- * Confirms the completion of an upload process.
25
+ * Confirms the completion of an upload process by ingesting the uploaded file into a dataset.
26
26
  * This method should be called after a file has been uploaded to the provided URL to finalize the upload.
27
27
  *
28
+ * Note: this calls `POST /datasets/{dataset_id}/upload` — there is no `uploads/{id}` confirmation
29
+ * endpoint; `/uploads/{upload_path}` (see {@link getUploadUrl}) only supports issuing upload URLs.
30
+ *
28
31
  * @async
29
32
  * @param {number} datasetId - The unique identifier of the dataset being uploaded.
30
33
  * @param {string} uploadPath - The path where the file was uploaded.
31
34
  * @returns {Promise<void>} A promise resolving when the upload confirmation is complete.
32
35
  */
33
36
  async confirmUpload(datasetId, uploadInfo) {
34
- await this.put(`${resourceName}/${datasetId}`, {
37
+ await this.post(`datasets/${datasetId}/upload`, {
35
38
  source_file: uploadInfo.path,
36
39
  });
37
40
  }
@@ -1,28 +1,29 @@
1
1
  import { BaseApi } from "../base-api";
2
- import type { ApiRecords } from "../types";
3
- import type { CreateViewRequest, OwnedView, SharedView, UpdateViewRequest, View, ViewOwner } from "./types";
2
+ import type { ApiRecordsV2 } from "../types";
3
+ import type { CreateViewRequest, GetViewsParams, OwnedView, SharedView, UpdateViewRequest, View, ViewOwner } from "./types";
4
4
  /**
5
5
  * A class for accessing the Views API.
6
6
  * @extends BaseApi
7
7
  */
8
8
  declare class ViewsApi extends BaseApi {
9
9
  /**
10
- * Gets a list of accessable viees from the API.
10
+ * Gets a paginated list of accessible views from the API.
11
11
  *
12
- * @returns {Promise<ApiRecords<View>>} A promise that resolves with the list of views.
12
+ * @param {GetViewsParams} [params] - Optional pagination, ownership, tag, owner, status, and keyword filters.
13
+ * @returns {Promise<ApiRecordsV2<View>>} A promise that resolves with the paginated list of views.
13
14
  */
14
- getViews(): Promise<ApiRecords<View>>;
15
+ getViews(params?: GetViewsParams): Promise<ApiRecordsV2<View>>;
15
16
  /**
16
17
  * Gets a single view from the API by its ID.
17
18
  *
18
- * @param {number} viewId - The ID of the view to retrieve.
19
+ * @param {string} viewId - The ID (UUID) of the view to retrieve.
19
20
  * @returns {Promise<View>} A promise that resolves with the view.
20
21
  */
21
- getView(viewId: number): Promise<View>;
22
+ getView(viewId: string): Promise<View>;
22
23
  /**
23
- * Deletes a single view from the API by its ID.
24
+ * Deletes (archives) a single view from the API by its ID.
24
25
  *
25
- * @param {number} viewId - The ID of the view to delete.
26
+ * @param {string} viewId - The ID (UUID) of the view to delete.
26
27
  * @returns {Promise<void>} A promise that resolves when the delete operation is complete.
27
28
  */
28
29
  deleteView(viewId: string): Promise<void>;
@@ -42,4 +43,4 @@ declare class ViewsApi extends BaseApi {
42
43
  */
43
44
  updateView(viewId: string, data: UpdateViewRequest): Promise<View>;
44
45
  }
45
- export { type CreateViewRequest, type OwnedView, type SharedView, type UpdateViewRequest, type View, type ViewOwner, ViewsApi, };
46
+ export { type CreateViewRequest, type GetViewsParams, type OwnedView, type SharedView, type UpdateViewRequest, type View, type ViewOwner, ViewsApi, };
@@ -12,26 +12,59 @@ const resourceName = "v2/views";
12
12
  */
13
13
  class ViewsApi extends BaseApi {
14
14
  /**
15
- * Gets a list of accessable viees from the API.
15
+ * Gets a paginated list of accessible views from the API.
16
16
  *
17
- * @returns {Promise<ApiRecords<View>>} A promise that resolves with the list of views.
17
+ * @param {GetViewsParams} [params] - Optional pagination, ownership, tag, owner, status, and keyword filters.
18
+ * @returns {Promise<ApiRecordsV2<View>>} A promise that resolves with the paginated list of views.
18
19
  */
19
- async getViews() {
20
- return await this.get(resourceName);
20
+ async getViews(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?.is_owned !== undefined) {
29
+ queryParams.append("is_owned", params.is_owned.toString());
30
+ }
31
+ if (params?.status) {
32
+ queryParams.append("status", params.status);
33
+ }
34
+ if (params?.q) {
35
+ queryParams.append("q", params.q);
36
+ }
37
+ if (params?.tag) {
38
+ const tags = Array.isArray(params.tag) ? params.tag : [params.tag];
39
+ for (const tag of tags) {
40
+ queryParams.append("tag", tag);
41
+ }
42
+ }
43
+ if (params?.company_id) {
44
+ const companyIds = Array.isArray(params.company_id)
45
+ ? params.company_id
46
+ : [params.company_id];
47
+ for (const companyId of companyIds) {
48
+ queryParams.append("company_id", companyId.toString());
49
+ }
50
+ }
51
+ const queryString = queryParams.toString();
52
+ const url = queryString ? `${resourceName}?${queryString}` : resourceName;
53
+ return await this.get(url);
21
54
  }
22
55
  /**
23
56
  * Gets a single view from the API by its ID.
24
57
  *
25
- * @param {number} viewId - The ID of the view to retrieve.
58
+ * @param {string} viewId - The ID (UUID) of the view to retrieve.
26
59
  * @returns {Promise<View>} A promise that resolves with the view.
27
60
  */
28
61
  async getView(viewId) {
29
62
  return await this.get(`${resourceName}/${viewId}`);
30
63
  }
31
64
  /**
32
- * Deletes a single view from the API by its ID.
65
+ * Deletes (archives) a single view from the API by its ID.
33
66
  *
34
- * @param {number} viewId - The ID of the view to delete.
67
+ * @param {string} viewId - The ID (UUID) of the view to delete.
35
68
  * @returns {Promise<void>} A promise that resolves when the delete operation is complete.
36
69
  */
37
70
  async deleteView(viewId) {
@@ -1,20 +1,26 @@
1
1
  import type { NqlQueryMetadata, NqlQueryOwner } from "../queries";
2
2
  import type { CollaboratorsConfig } from "../types";
3
3
  export interface SharedView {
4
- id: number;
4
+ /** UUID. */
5
+ id: string;
5
6
  name: string;
6
7
  owner: NqlQueryOwner;
7
8
  nql: string;
9
+ /** Whether the view is active or archived. */
10
+ status?: string;
8
11
  display_name?: string;
9
12
  tags?: string[];
10
13
  schema?: unknown;
11
14
  is_owned?: boolean;
12
15
  }
13
16
  export interface OwnedView {
14
- id: number;
17
+ /** UUID. */
18
+ id: string;
15
19
  name: string;
16
20
  owner: NqlQueryOwner;
17
21
  nql: string;
22
+ /** Whether the view is active or archived. */
23
+ status?: string;
18
24
  collaborators: CollaboratorsConfig;
19
25
  metadata: NqlQueryMetadata;
20
26
  display_name?: string;
@@ -35,10 +41,25 @@ export interface CreateViewRequest {
35
41
  tags?: string[];
36
42
  }
37
43
  export interface UpdateViewRequest {
38
- name?: string;
39
- nql?: string;
40
44
  collaborators?: CollaboratorsConfig;
41
45
  display_name?: string;
42
46
  tags?: string[];
43
47
  }
44
48
  export type View = OwnedView | SharedView;
49
+ /**
50
+ * Query parameters accepted by `GET /v2/views`.
51
+ */
52
+ export interface GetViewsParams {
53
+ page?: number;
54
+ per_page?: number;
55
+ /** `true` returns only owned views; `false` only shared-with-you views. */
56
+ is_owned?: boolean;
57
+ /** Filters by tag. OR-d together when multiple are given. */
58
+ tag?: string | string[];
59
+ /** Filters by owning company id. OR-d together when multiple are given. */
60
+ company_id?: number | number[];
61
+ /** Filters by view status. */
62
+ status?: string;
63
+ /** Free-text keyword search. */
64
+ q?: string;
65
+ }
@@ -1,18 +1,23 @@
1
1
  import type { UserRole } from "../authentication";
2
2
  export interface User {
3
3
  user_id: number;
4
+ access_token: WhoamiAccessTokenInfo;
4
5
  name: string;
5
6
  email: string;
6
7
  role: UserRole;
7
8
  company_access_list: number[];
8
- accessible_companies?: CompanyScope[];
9
+ accessible_companies: CompanyScope[];
9
10
  current_company_scope: CompanyScope;
10
- permissions: Permission[];
11
+ permissions: WhoamiPermission[];
11
12
  created_at: string;
12
13
  created_by: null | string;
13
- last_updated_at: string;
14
+ last_updated_at: string | null;
14
15
  last_updated_by: null | string;
15
16
  }
17
+ /** Metadata about the bearer token used to make the `/whoami` request. */
18
+ export interface WhoamiAccessTokenInfo {
19
+ expires_at: string;
20
+ }
16
21
  export interface CompanyScope {
17
22
  company_id: number;
18
23
  slug: null | string;
@@ -24,11 +29,35 @@ export interface CompanyScope {
24
29
  data_shop_url: null | string;
25
30
  twitter_link: null | string;
26
31
  linkedin_link: null | string;
27
- image_url: string;
28
- status: string;
29
- visibility: string;
32
+ image_url: string | null;
33
+ status: CompanyScopeStatus;
34
+ visibility: CompanyScopeVisibility;
30
35
  }
31
- export interface Permission {
32
- resource: string;
33
- access: string;
36
+ /**
37
+ * Lifecycle status of a company. The wire literals come from the shared
38
+ * `CompanyCommonCodecs` (authoritative over the public schema, which lists a
39
+ * stale `deleted` value).
40
+ */
41
+ export type CompanyScopeStatus = "active" | "archived" | "pending";
42
+ /**
43
+ * Discovery visibility of a company. The wire literals come from the shared
44
+ * `CompanyCommonCodecs` (note the hyphenated `invisible-in-discover`, not the
45
+ * schema's underscored spelling).
46
+ */
47
+ export type CompanyScopeVisibility = "invisible" | "invisible-in-discover" | "visible";
48
+ /**
49
+ * Access levels a permission may grant. Scoped to this module (`Whoami*`) to
50
+ * avoid colliding with similarly-named types exported by other modules (e.g.
51
+ * `Resource` from `../resources`) via the package's `export *` barrel.
52
+ */
53
+ export type WhoamiAccess = "read" | "write" | "admin";
54
+ /**
55
+ * Resources a permission may apply to. Scoped to this module (`Whoami*`) to
56
+ * avoid colliding with similarly-named types exported by other modules (e.g.
57
+ * `Resource` from `../resources`) via the package's `export *` barrel.
58
+ */
59
+ export type WhoamiResource = "api_info" | "attributes" | "apps" | "app_profiles" | "resources" | "charges" | "datasets" | "data_streams" | "deliveries" | "destinations" | "forecasts" | "installations" | "lists" | "mappings" | "internal_reports" | "subscriptions" | "payment_methods" | "uploads" | "company_info" | "schema_preset";
60
+ export interface WhoamiPermission {
61
+ resource: WhoamiResource;
62
+ access: WhoamiAccess[];
34
63
  }
@@ -1,7 +1,5 @@
1
1
  import { BaseApi } from "../base-api";
2
- import type { PaginationOptions } from "../types";
3
- type WorkflowPaginationOptions = PaginationOptions & Record<string, unknown>;
4
- import type { CreateWorkflowRequest, CreateWorkflowResponse, ListRunsParams, ListRunsResponse, ListWorkflowsResponse, ScheduleWorkflowRequest, ScheduleWorkflowResponse, TriggerWorkflowResponse, WorkflowResponse, WorkflowRun, WorkflowRunStatus, WorkflowStatus } from "./types";
2
+ import type { CreateWorkflowRequest, CreateWorkflowResponse, ListRunsParams, ListRunsResponse, ListWorkflowsParams, ListWorkflowsResponse, ScheduleWorkflowRequest, ScheduleWorkflowResponse, TriggerWorkflowResponse, WorkflowResponse, WorkflowRun, WorkflowRunStatus, WorkflowStatus } from "./types";
5
3
  /**
6
4
  * @module WorkflowsApi
7
5
  * @description This module provides methods for creating, scheduling, triggering, and archiving workflows.
@@ -11,10 +9,11 @@ declare class WorkflowsApi extends BaseApi {
11
9
  /**
12
10
  * List all active workflows for the authenticated company.
13
11
  *
14
- * @param {PaginationOptions} [params] - Optional pagination parameters.
12
+ * @param {ListWorkflowsParams} [params] - Optional pagination parameters, plus
13
+ * `data_plane_id` to return only the workflows on that data plane.
15
14
  * @returns {Promise<ListWorkflowsResponse>} A promise that resolves to a paginated list of workflows.
16
15
  */
17
- listWorkflows(params?: WorkflowPaginationOptions): Promise<ListWorkflowsResponse>;
16
+ listWorkflows(params?: ListWorkflowsParams): Promise<ListWorkflowsResponse>;
18
17
  /**
19
18
  * Create a new workflow from a YAML specification.
20
19
  * The specification is parsed and validated before the workflow is persisted.
@@ -58,9 +57,9 @@ declare class WorkflowsApi extends BaseApi {
58
57
  * List execution runs for a workflow. Results are ordered by start time descending.
59
58
  *
60
59
  * @param {string} workflowId - The unique identifier for the workflow.
61
- * @param {ListRunsParams} [params] - Optional pagination parameters (pageSize, pageToken).
60
+ * @param {ListRunsParams} [params] - Optional pagination parameters (per_page, page_token).
62
61
  * @returns {Promise<ListRunsResponse>} A promise that resolves to a paginated list of workflow runs.
63
62
  */
64
63
  listWorkflowRuns(workflowId: string, params?: ListRunsParams): Promise<ListRunsResponse>;
65
64
  }
66
- export { type CreateWorkflowRequest, type CreateWorkflowResponse, type ListRunsParams, type ListRunsResponse, type ListWorkflowsResponse, type ScheduleWorkflowRequest, type ScheduleWorkflowResponse, type TriggerWorkflowResponse, type WorkflowResponse, type WorkflowRun, type WorkflowRunStatus, type WorkflowStatus, WorkflowsApi, };
65
+ export { type CreateWorkflowRequest, type CreateWorkflowResponse, type ListRunsParams, type ListRunsResponse, type ListWorkflowsParams, type ListWorkflowsResponse, type ScheduleWorkflowRequest, type ScheduleWorkflowResponse, type TriggerWorkflowResponse, type WorkflowResponse, type WorkflowRun, type WorkflowRunStatus, type WorkflowStatus, WorkflowsApi, };