@narrative.io/data-collaboration-sdk-ts 3.7.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 (81) 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 +23 -2
  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/AstParser.js +29 -6
  55. package/build/nql/NqlBuilder.js +14 -1
  56. package/build/nql/types.d.ts +17 -7
  57. package/build/nql/types.js +5 -1
  58. package/build/ping/index.d.ts +5 -1
  59. package/build/ping/index.js +5 -1
  60. package/build/products/index.d.ts +4 -3
  61. package/build/products/index.js +2 -2
  62. package/build/products/types.d.ts +26 -23
  63. package/build/queries/index.d.ts +7 -6
  64. package/build/queries/index.js +34 -4
  65. package/build/queries/types.d.ts +15 -0
  66. package/build/resources/index.d.ts +2 -2
  67. package/build/resources/index.js +1 -1
  68. package/build/resources/types.d.ts +16 -8
  69. package/build/rosetta-stone/index.d.ts +8 -8
  70. package/build/rosetta-stone/index.js +16 -32
  71. package/build/subscriptions/types.d.ts +3 -3
  72. package/build/uploads/index.d.ts +4 -1
  73. package/build/uploads/index.js +5 -2
  74. package/build/views/index.d.ts +11 -10
  75. package/build/views/index.js +40 -7
  76. package/build/views/types.d.ts +25 -4
  77. package/build/whoami/types.d.ts +38 -9
  78. package/build/workflows/index.d.ts +6 -7
  79. package/build/workflows/index.js +3 -2
  80. package/build/workflows/types.d.ts +14 -3
  81. package/package.json +3 -3
@@ -1,12 +1,13 @@
1
1
  import { BaseApi } from "../base-api";
2
2
  import type { ApiRecords } from "../types";
3
- import type { Connection, ConnectionStatus, ConnectionV2 } from "./types";
3
+ import type { ConnectionAppRef, ConnectionFilters, ConnectionProfileRef, ConnectionQueryType, ConnectionStatus, ConnectionType, ConnectionV2, CreateConnectionRequest, CreateDatasetConnectionRequest, CreateModelConnectionRequest, DatasetConnection, ModelConnection } from "./types";
4
4
  /**
5
5
  * Class representing the API for connections.
6
6
  *
7
7
  * @module ConnectionsApi
8
8
  * @extends BaseApi
9
- * @description This class provides methods for fetching and managing connection records.
9
+ * @description This class provides methods for fetching and managing connection records via the
10
+ * `/v2/connections` API.
10
11
  */
11
12
  declare class ConnectionsApi extends BaseApi {
12
13
  /**
@@ -14,59 +15,62 @@ declare class ConnectionsApi extends BaseApi {
14
15
  *
15
16
  * @public
16
17
  * @async
17
- * @param {string} [connectionId] - The ID of the connection to retrieve.
18
- * @returns {Promise<Connection>} A promise that resolves to the connection object.
18
+ * @param {string} connectionId - The ID of the connection to retrieve.
19
+ * @returns {Promise<ConnectionV2>} A promise that resolves to the connection object.
19
20
  * @throws Will throw an error if the API call fails.
20
21
  */
21
- getConnection(connectionId?: string): Promise<Connection>;
22
+ getConnection(connectionId: string): Promise<ConnectionV2>;
22
23
  /**
23
- * Retrieves all connections associated with a specific dataset.
24
+ * Lists the calling company's connections, optionally filtered by app, connection type, dataset, model, or
25
+ * profile.
24
26
  *
25
27
  * @public
26
28
  * @async
27
- * @param {number} datasetId - The ID of the dataset to retrieve connections for.
28
- * @returns {Promise<ApiRecords<Connection>>} A promise that resolves to an array of connection objects.
29
+ * @param {ConnectionFilters} [filters] - Optional filters to narrow the returned connections.
30
+ * @returns {Promise<ApiRecords<ConnectionV2>>} A promise that resolves to an array of connection objects.
29
31
  * @throws Will throw an error if the API call fails.
30
32
  */
31
- getDatasetConnections(datasetId: number): Promise<ApiRecords<Connection>>;
33
+ getConnections(filters?: ConnectionFilters): Promise<ApiRecords<ConnectionV2>>;
32
34
  /**
33
- * Retrieves all connections associated with a specific profile.
35
+ * Retrieves all connections associated with a specific dataset.
34
36
  *
35
37
  * @public
36
38
  * @async
37
- * @param {number} profileId - The ID of the profile to retrieve connections for.
38
- * @returns {Promise<ApiRecords<Connection>>} A promise that resolves to an array of connection objects.
39
+ * @param {number} datasetId - The ID of the dataset to retrieve connections for.
40
+ * @returns {Promise<ApiRecords<ConnectionV2>>} A promise that resolves to an array of connection objects.
39
41
  * @throws Will throw an error if the API call fails.
40
42
  */
41
- getProfileConnections(profileId: string): Promise<ApiRecords<Connection>>;
43
+ getDatasetConnections(datasetId: number): Promise<ApiRecords<ConnectionV2>>;
42
44
  /**
43
- * Creates a new connection.
45
+ * Retrieves all connections associated with a specific profile.
44
46
  *
45
47
  * @public
46
48
  * @async
47
- * @param {Omit<Connection, "id">} newConnection - The connection data to create, excluding the ID.
48
- * @returns {Promise<Connection>} A promise that resolves to the newly created connection object.
49
+ * @param {string} profileId - The ID of the profile to retrieve connections for.
50
+ * @returns {Promise<ApiRecords<ConnectionV2>>} A promise that resolves to an array of connection objects.
49
51
  * @throws Will throw an error if the API call fails.
50
52
  */
51
- createConnection(newConnection: Omit<Connection, "id">): Promise<Connection>;
53
+ getProfileConnections(profileId: string): Promise<ApiRecords<ConnectionV2>>;
52
54
  /**
53
- * Deletes a connection.
55
+ * Creates a new connection routing a dataset's or model's data to a connector app.
54
56
  *
55
57
  * @public
56
58
  * @async
57
- * @param {string} connectionId - The ID of the connection to delete.
58
- * @returns {Promise<void>} A promise that resolves when the connection is deleted.
59
+ * @param {CreateConnectionRequest} newConnection - The connection data to create; a discriminated union keyed
60
+ * on `type` (`connections_dataset` | `connections_model`).
61
+ * @returns {Promise<ConnectionV2>} A promise that resolves to the newly created connection object.
59
62
  * @throws Will throw an error if the API call fails.
60
63
  */
61
- deleteConnection(connectionId: string): Promise<void>;
64
+ createConnection(newConnection: CreateConnectionRequest): Promise<ConnectionV2>;
62
65
  /**
63
- * Retrieves all connections for a given account.
66
+ * Archives a connection. The connection is not deleted; its status becomes `archived`.
64
67
  *
65
68
  * @public
66
69
  * @async
67
- * @returns {Promise<ApiRecords<ConnectionV2>>} A promise that resolves to an array of connection objects.
70
+ * @param {string} connectionId - The ID of the connection to archive.
71
+ * @returns {Promise<void>} A promise that resolves when the connection is archived.
68
72
  * @throws Will throw an error if the API call fails.
69
73
  */
70
- getConnections(): Promise<ApiRecords<ConnectionV2>>;
74
+ deleteConnection(connectionId: string): Promise<void>;
71
75
  }
72
- export { type Connection, type ConnectionStatus, ConnectionsApi, type ConnectionV2, };
76
+ export { type ConnectionAppRef, type ConnectionFilters, type ConnectionProfileRef, type ConnectionQueryType, type ConnectionStatus, ConnectionsApi, type ConnectionType, type ConnectionV2, type CreateConnectionRequest, type CreateDatasetConnectionRequest, type CreateModelConnectionRequest, type DatasetConnection, type ModelConnection, };
@@ -5,13 +5,14 @@ import { BaseApi } from "../base-api";
5
5
  * @private
6
6
  * @type {string}
7
7
  */
8
- const resourceName = "connections";
8
+ const resourceName = "v2/connections";
9
9
  /**
10
10
  * Class representing the API for connections.
11
11
  *
12
12
  * @module ConnectionsApi
13
13
  * @extends BaseApi
14
- * @description This class provides methods for fetching and managing connection records.
14
+ * @description This class provides methods for fetching and managing connection records via the
15
+ * `/v2/connections` API.
15
16
  */
16
17
  class ConnectionsApi extends BaseApi {
17
18
  /**
@@ -19,76 +20,94 @@ class ConnectionsApi extends BaseApi {
19
20
  *
20
21
  * @public
21
22
  * @async
22
- * @param {string} [connectionId] - The ID of the connection to retrieve.
23
- * @returns {Promise<Connection>} A promise that resolves to the connection object.
23
+ * @param {string} connectionId - The ID of the connection to retrieve.
24
+ * @returns {Promise<ConnectionV2>} A promise that resolves to the connection object.
24
25
  * @throws Will throw an error if the API call fails.
25
26
  */
26
27
  async getConnection(connectionId) {
27
28
  const url = `${resourceName}/${connectionId}`;
28
29
  return await this.get(url);
29
30
  }
31
+ /**
32
+ * Lists the calling company's connections, optionally filtered by app, connection type, dataset, model, or
33
+ * profile.
34
+ *
35
+ * @public
36
+ * @async
37
+ * @param {ConnectionFilters} [filters] - Optional filters to narrow the returned connections.
38
+ * @returns {Promise<ApiRecords<ConnectionV2>>} A promise that resolves to an array of connection objects.
39
+ * @throws Will throw an error if the API call fails.
40
+ */
41
+ async getConnections(filters) {
42
+ const queryParams = new URLSearchParams();
43
+ if (filters?.app_id != null) {
44
+ queryParams.append("app_id", String(filters.app_id));
45
+ }
46
+ if (filters?.connection_type) {
47
+ queryParams.append("connection_type", filters.connection_type);
48
+ }
49
+ if (filters?.dataset_id != null) {
50
+ queryParams.append("dataset_id", String(filters.dataset_id));
51
+ }
52
+ if (filters?.model_id != null) {
53
+ queryParams.append("model_id", String(filters.model_id));
54
+ }
55
+ if (filters?.profile_id) {
56
+ queryParams.append("profile_id", filters.profile_id);
57
+ }
58
+ const queryString = queryParams.toString();
59
+ const url = queryString ? `${resourceName}?${queryString}` : resourceName;
60
+ return await this.get(url);
61
+ }
30
62
  /**
31
63
  * Retrieves all connections associated with a specific dataset.
32
64
  *
33
65
  * @public
34
66
  * @async
35
67
  * @param {number} datasetId - The ID of the dataset to retrieve connections for.
36
- * @returns {Promise<ApiRecords<Connection>>} A promise that resolves to an array of connection objects.
68
+ * @returns {Promise<ApiRecords<ConnectionV2>>} A promise that resolves to an array of connection objects.
37
69
  * @throws Will throw an error if the API call fails.
38
70
  */
39
71
  async getDatasetConnections(datasetId) {
40
- const url = `${resourceName}?dataset_id=${datasetId}`;
41
- return await this.get(url);
72
+ return await this.getConnections({ dataset_id: datasetId });
42
73
  }
43
74
  /**
44
75
  * Retrieves all connections associated with a specific profile.
45
76
  *
46
77
  * @public
47
78
  * @async
48
- * @param {number} profileId - The ID of the profile to retrieve connections for.
49
- * @returns {Promise<ApiRecords<Connection>>} A promise that resolves to an array of connection objects.
79
+ * @param {string} profileId - The ID of the profile to retrieve connections for.
80
+ * @returns {Promise<ApiRecords<ConnectionV2>>} A promise that resolves to an array of connection objects.
50
81
  * @throws Will throw an error if the API call fails.
51
82
  */
52
83
  async getProfileConnections(profileId) {
53
- const url = `${resourceName}?profile_id=${profileId}`;
54
- return await this.get(url);
84
+ return await this.getConnections({ profile_id: profileId });
55
85
  }
56
86
  /**
57
- * Creates a new connection.
87
+ * Creates a new connection routing a dataset's or model's data to a connector app.
58
88
  *
59
89
  * @public
60
90
  * @async
61
- * @param {Omit<Connection, "id">} newConnection - The connection data to create, excluding the ID.
62
- * @returns {Promise<Connection>} A promise that resolves to the newly created connection object.
91
+ * @param {CreateConnectionRequest} newConnection - The connection data to create; a discriminated union keyed
92
+ * on `type` (`connections_dataset` | `connections_model`).
93
+ * @returns {Promise<ConnectionV2>} A promise that resolves to the newly created connection object.
63
94
  * @throws Will throw an error if the API call fails.
64
95
  */
65
96
  async createConnection(newConnection) {
66
97
  return await this.post(resourceName, newConnection);
67
98
  }
68
99
  /**
69
- * Deletes a connection.
100
+ * Archives a connection. The connection is not deleted; its status becomes `archived`.
70
101
  *
71
102
  * @public
72
103
  * @async
73
- * @param {string} connectionId - The ID of the connection to delete.
74
- * @returns {Promise<void>} A promise that resolves when the connection is deleted.
104
+ * @param {string} connectionId - The ID of the connection to archive.
105
+ * @returns {Promise<void>} A promise that resolves when the connection is archived.
75
106
  * @throws Will throw an error if the API call fails.
76
107
  */
77
108
  async deleteConnection(connectionId) {
78
109
  const url = `${resourceName}/${connectionId}`;
79
110
  return await this.delete(url);
80
111
  }
81
- /**
82
- * Retrieves all connections for a given account.
83
- *
84
- * @public
85
- * @async
86
- * @returns {Promise<ApiRecords<ConnectionV2>>} A promise that resolves to an array of connection objects.
87
- * @throws Will throw an error if the API call fails.
88
- */
89
- async getConnections() {
90
- const url = `v2/${resourceName}`;
91
- return await this.get(url);
92
- }
93
112
  }
94
113
  export { ConnectionsApi, };
@@ -1,21 +1,74 @@
1
1
  export type ConnectionStatus = "active" | "archived";
2
- export interface Connection {
2
+ /** Discriminator values for a {@link ConnectionV2}. */
3
+ export type ConnectionType = "connections_dataset" | "connections_model";
4
+ /** Values accepted by the `connection_type` list filter (distinct from the {@link ConnectionType} discriminator). */
5
+ export type ConnectionQueryType = "dataset" | "model";
6
+ export interface ConnectionAppRef {
7
+ id: number;
8
+ name: string;
9
+ }
10
+ export interface ConnectionProfileRef {
3
11
  id: string;
4
- dataset_id: number;
5
- profile_id: string;
6
- quick_settings: Record<string, unknown>;
7
- status?: ConnectionStatus;
8
- }
9
- export interface ConnectionV2 extends Connection {
10
- type: string;
11
- app: {
12
- id: number;
13
- name: string;
14
- };
12
+ name: string;
13
+ }
14
+ interface ConnectionV2Base {
15
+ id: string;
16
+ app: ConnectionAppRef;
15
17
  created_at: string;
16
18
  installation_id: number;
17
- profile: {
18
- id: string;
19
- name: string;
20
- };
19
+ /** Optional connector-specific settings, validated by the connector. */
20
+ quick_settings?: Record<string, unknown>;
21
+ /** @deprecated kept for backward compatibility, use {@link ConnectionV2Base.profile} instead. */
22
+ profile_id: string;
23
+ profile: ConnectionProfileRef;
24
+ status: ConnectionStatus;
25
+ }
26
+ export interface DatasetConnection extends ConnectionV2Base {
27
+ type: "connections_dataset";
28
+ dataset_id: number;
29
+ }
30
+ export interface ModelConnection extends ConnectionV2Base {
31
+ type: "connections_model";
32
+ model_id: number;
33
+ }
34
+ /**
35
+ * A connection routing a dataset's or model's data to a connector app.
36
+ *
37
+ * Discriminated on `type`.
38
+ */
39
+ export type ConnectionV2 = DatasetConnection | ModelConnection;
40
+ export interface CreateDatasetConnectionRequest {
41
+ type: "connections_dataset";
42
+ /** The dataset whose data is routed to the connector. */
43
+ dataset_id: number;
44
+ profile_id: string;
45
+ /** Optional connector-specific settings, validated by the connector. */
46
+ quick_settings?: Record<string, unknown>;
47
+ }
48
+ export interface CreateModelConnectionRequest {
49
+ type: "connections_model";
50
+ /** The model connected to the connector. */
51
+ model_id: number;
52
+ profile_id: string;
53
+ /** Optional connector-specific settings, validated by the connector. */
54
+ quick_settings?: Record<string, unknown>;
55
+ }
56
+ /**
57
+ * Request body for creating a connection.
58
+ *
59
+ * Discriminated on `type`.
60
+ */
61
+ export type CreateConnectionRequest = CreateDatasetConnectionRequest | CreateModelConnectionRequest;
62
+ export interface ConnectionFilters {
63
+ /** Only return connections to this app. */
64
+ app_id?: number;
65
+ /** Only return connections of this type. */
66
+ connection_type?: ConnectionQueryType;
67
+ /** Only return connections from this dataset. */
68
+ dataset_id?: number;
69
+ /** Only return connections from this model. */
70
+ model_id?: number;
71
+ /** Only return connections created against this app profile. */
72
+ profile_id?: string;
21
73
  }
74
+ export {};
@@ -1,33 +1,24 @@
1
1
  import { BaseApi } from "../base-api";
2
+ import type { ApiRecords } from "../types";
2
3
  import type { ContractDetails, ContractRateView, CustomerContract, PaymentMethod } from "./types";
3
4
  /**
4
5
  * A class for accessing the Contracts API.
6
+ *
7
+ * Only the read routes `GET /contracts` and `GET /contracts/active` are part of
8
+ * the public surface. Fetching a specific contract revision and updating a
9
+ * contract exist server-side only as admin routes (`GET
10
+ * /admin/contracts/{id}/{revision}` and `PUT /admin/contracts/{company_id}`,
11
+ * both requiring `Permission.Admin`), so they are intentionally not exposed
12
+ * here.
5
13
  * @extends BaseApi
6
14
  */
7
15
  declare class ContractsApi extends BaseApi {
8
16
  /**
9
17
  * Gets a list of contracts from the API.
10
18
  *
11
- * @returns {Promise<CustomerContract[]>} A promise that resolves with the list of contracts.
19
+ * @returns {Promise<ApiRecords<ContractDetails>>} A promise that resolves with the list of contracts.
12
20
  */
13
- getContracts(): Promise<ContractDetails[]>;
14
- /**
15
- * Get a customer contract based on the contract ID
16
- *
17
- * @param contractId - ID of the customer contract
18
- * @returns Promise that resolves to the customer contract
19
- *
20
- */
21
- getContract(contractId: string): Promise<ContractDetails>;
22
- /**
23
- * Update a customer contract's payment method based on the contract ID
24
- *
25
- * @param contractId - ID of the customer contract
26
- * @param paymentMethod - the updated payment method
27
- * @returns Promise that resolves to the updated customer contract
28
- *
29
- */
30
- updatePaymentMethod(contractId: string, paymentMethod: PaymentMethod): Promise<ContractDetails>;
21
+ getContracts(): Promise<ApiRecords<ContractDetails>>;
31
22
  /**
32
23
  * Get the active contract for a company
33
24
  *
@@ -8,38 +8,24 @@ import { BaseApi } from "../base-api";
8
8
  const resourceName = "contracts";
9
9
  /**
10
10
  * A class for accessing the Contracts API.
11
+ *
12
+ * Only the read routes `GET /contracts` and `GET /contracts/active` are part of
13
+ * the public surface. Fetching a specific contract revision and updating a
14
+ * contract exist server-side only as admin routes (`GET
15
+ * /admin/contracts/{id}/{revision}` and `PUT /admin/contracts/{company_id}`,
16
+ * both requiring `Permission.Admin`), so they are intentionally not exposed
17
+ * here.
11
18
  * @extends BaseApi
12
19
  */
13
20
  class ContractsApi extends BaseApi {
14
21
  /**
15
22
  * Gets a list of contracts from the API.
16
23
  *
17
- * @returns {Promise<CustomerContract[]>} A promise that resolves with the list of contracts.
24
+ * @returns {Promise<ApiRecords<ContractDetails>>} A promise that resolves with the list of contracts.
18
25
  */
19
26
  async getContracts() {
20
27
  return await this.get(resourceName);
21
28
  }
22
- /**
23
- * Get a customer contract based on the contract ID
24
- *
25
- * @param contractId - ID of the customer contract
26
- * @returns Promise that resolves to the customer contract
27
- *
28
- */
29
- async getContract(contractId) {
30
- return await this.get(`${resourceName}/${contractId}`);
31
- }
32
- /**
33
- * Update a customer contract's payment method based on the contract ID
34
- *
35
- * @param contractId - ID of the customer contract
36
- * @param paymentMethod - the updated payment method
37
- * @returns Promise that resolves to the updated customer contract
38
- *
39
- */
40
- async updatePaymentMethod(contractId, paymentMethod) {
41
- return await this.put(`${resourceName}/${contractId}`, paymentMethod);
42
- }
43
29
  /**
44
30
  * Get the active contract for a company
45
31
  *
@@ -4,7 +4,7 @@ export interface ContractDetails {
4
4
  }
5
5
  export interface CustomerContract {
6
6
  id: string;
7
- company_id: number;
7
+ payable_company_id: number;
8
8
  payment_method: PaymentMethod;
9
9
  internal_notes?: string;
10
10
  revision: number;
@@ -39,10 +39,14 @@ export interface UnitPrice {
39
39
  export interface ProductView {
40
40
  id?: string;
41
41
  sku?: string;
42
- sku_type?: string;
42
+ sku_type?: SkuType;
43
43
  payable_company_id?: number;
44
44
  name?: string;
45
45
  unit?: string;
46
46
  status?: ProductStatus;
47
47
  }
48
+ export type SkuTypeCategory = "processing" | "storage" | "transfer" | "marketplace-data-transaction";
49
+ export interface SkuType {
50
+ category: SkuTypeCategory;
51
+ }
48
52
  export type ProductStatus = "active" | "archived";
@@ -5,6 +5,10 @@ export declare class DataPlaneApi extends BaseApi {
5
5
  getDataPlanes(): Promise<ApiRecords<DataPlane>>;
6
6
  getDataPlane(dataPlaneId: string): Promise<DataPlane>;
7
7
  setDefaultComputePool(dataPlaneId: string, computePoolId: string): Promise<DataPlane>;
8
- clearDefaultComputePool(dataPlaneId: string): Promise<void>;
8
+ /**
9
+ * Clears the default compute pool for a data plane.
10
+ * @returns {Promise<DataPlane>} - Promise resolving with the updated data plane.
11
+ */
12
+ clearDefaultComputePool(dataPlaneId: string): Promise<DataPlane>;
9
13
  runHealthCheck(dataPlaneId: string, computePoolId?: string): Promise<HealthCheckJobResponse>;
10
14
  }
@@ -10,8 +10,14 @@ export class DataPlaneApi extends BaseApi {
10
10
  async setDefaultComputePool(dataPlaneId, computePoolId) {
11
11
  return await this.put(`${resourceName}/${dataPlaneId}/default-compute-pool/${computePoolId}`, undefined);
12
12
  }
13
+ /**
14
+ * Clears the default compute pool for a data plane.
15
+ * @returns {Promise<DataPlane>} - Promise resolving with the updated data plane.
16
+ */
13
17
  async clearDefaultComputePool(dataPlaneId) {
14
- await this.delete(`${resourceName}/${dataPlaneId}/default-compute-pool`);
18
+ // BaseApi#delete discards the response body; the backend returns the updated
19
+ // data plane, so call the underlying client directly to surface it.
20
+ return await this.base_api.delete(`${resourceName}/${dataPlaneId}/default-compute-pool`);
15
21
  }
16
22
  async runHealthCheck(dataPlaneId, computePoolId) {
17
23
  const body = computePoolId != null ? { compute_pool_id: computePoolId } : {};
@@ -1,24 +1,80 @@
1
1
  import type { ComputePoolResponse, Participants } from "../compute-pools/types";
2
+ import type { Job } from "../jobs/types";
3
+ /** Discriminator distinguishing an owned data plane from one shared with you. */
2
4
  export type DataPlaneType = "owned" | "shared";
3
- export type DataPlaneStatus = "active" | "inactive" | "archived";
4
- export type DataPlanePlatformType = "platform_snowflake" | "platform_shared_snowflake" | "platform_aws" | "platform_shared_aws";
5
- export type DataPlaneRegionType = "region_aws";
6
- export interface DataPlanePlatformRegion {
7
- type: DataPlaneRegionType;
5
+ /**
6
+ * Lifecycle status of a data plane. The backend `DataPlane.Status` codec only
7
+ * emits `active` and `archived` (the previously-listed `inactive` could not be
8
+ * confirmed in the backend and was removed).
9
+ */
10
+ export type DataPlaneStatus = "active" | "archived";
11
+ /** An AWS region. `id` is the region code, e.g. `us-east-1`. */
12
+ export interface AwsRegion {
13
+ type: "region_aws";
8
14
  id: string;
9
15
  }
10
- export interface DataPlanePlatform {
11
- type: DataPlanePlatformType;
16
+ export interface AzureRegion {
17
+ type: "region_azure";
18
+ id: string;
19
+ }
20
+ export interface GcpRegion {
21
+ type: "region_gcp";
22
+ id: string;
23
+ }
24
+ /**
25
+ * The region a data plane runs in. Encoded as a discriminated object, not a
26
+ * bare string — see `DataPlane.Region` in `datashops-protocol`.
27
+ */
28
+ export type DataPlaneRegion = AwsRegion | AzureRegion | GcpRegion;
29
+ export interface AwsPlatform {
30
+ type: "platform_aws";
31
+ /** 12-digit AWS account id. */
32
+ account_id: string;
33
+ region: AwsRegion;
34
+ }
35
+ export interface SnowflakePlatform {
36
+ type: "platform_snowflake";
12
37
  account_locator: string;
13
38
  account_name: string;
14
39
  organization_name: string;
15
- region: DataPlanePlatformRegion;
40
+ /**
41
+ * Optional: the platform can fail to parse a region when provisioning the
42
+ * Snowflake Native App. Informational only.
43
+ */
44
+ region?: DataPlaneRegion;
16
45
  }
46
+ /** Platform details returned for a data plane the calling company owns. */
47
+ export type DataPlanePlatform = AwsPlatform | SnowflakePlatform;
48
+ export interface AwsSharedPlatform {
49
+ type: "platform_shared_aws";
50
+ region: AwsRegion;
51
+ }
52
+ export interface SnowflakeSharedPlatform {
53
+ type: "platform_shared_snowflake";
54
+ region?: DataPlaneRegion;
55
+ }
56
+ /**
57
+ * Platform details returned for a data plane shared with you. Account
58
+ * identifiers are omitted for non-owned data planes.
59
+ */
60
+ export type DataPlaneSharedPlatform = AwsSharedPlatform | SnowflakeSharedPlatform;
61
+ /**
62
+ * The `platform.type` discriminator of any data plane, owned or shared. Owned and shared platforms
63
+ * are modelled as separate unions, so this is the flat set of wire literals across both.
64
+ */
65
+ export type DataPlanePlatformType = DataPlanePlatform["type"] | DataPlaneSharedPlatform["type"];
17
66
  export interface DataPlaneCollaborators {
18
67
  participants: Participants;
68
+ /** Companies allowed to create/edit/archive compute pools on this data plane. */
69
+ manage_compute_pools: Participants;
19
70
  }
20
- export interface DataPlane {
21
- type: DataPlaneType;
71
+ /**
72
+ * A data plane owned by the calling company. Includes full details such as the
73
+ * external id and collaborators.
74
+ */
75
+ export interface DataPlaneOwnedResponse {
76
+ type: "owned";
77
+ /** UUID. */
22
78
  id: string;
23
79
  company_id: number;
24
80
  created_at: string;
@@ -27,16 +83,40 @@ export interface DataPlane {
27
83
  platform: DataPlanePlatform;
28
84
  status: DataPlaneStatus;
29
85
  updated_at: string;
86
+ collaborators: DataPlaneCollaborators;
87
+ compute_pools: ComputePoolResponse[];
30
88
  description?: string;
31
89
  tags?: string[];
32
90
  last_heartbeat_at?: string;
33
91
  default_compute_pool_id?: string;
34
- compute_pools?: ComputePoolResponse[];
35
- collaborators?: DataPlaneCollaborators;
36
92
  }
93
+ /**
94
+ * A data plane shared with the calling company. Omits details like the external
95
+ * id and collaborators that are only exposed to the owner.
96
+ */
97
+ export interface DataPlaneSharedResponse {
98
+ type: "shared";
99
+ /** UUID. */
100
+ id: string;
101
+ company_id: number;
102
+ created_at: string;
103
+ display_name: string;
104
+ platform: DataPlaneSharedPlatform;
105
+ status: DataPlaneStatus;
106
+ updated_at: string;
107
+ compute_pools: ComputePoolResponse[];
108
+ description?: string;
109
+ tags?: string[];
110
+ last_heartbeat_at?: string;
111
+ default_compute_pool_id?: string;
112
+ }
113
+ /** Discriminated union of the owned/shared data plane response shapes. */
114
+ export type DataPlane = DataPlaneOwnedResponse | DataPlaneSharedResponse;
37
115
  export interface HealthCheckRequest {
38
116
  compute_pool_id?: string;
39
117
  }
40
- export interface HealthCheckJobResponse {
41
- job_id: string;
42
- }
118
+ /**
119
+ * The backend enqueues a `health_check` job and returns the full job record (201 Created),
120
+ * not just its id — see `POST /data-planes/{id}/health-check`.
121
+ */
122
+ export type HealthCheckJobResponse = Job;