@narrative.io/data-collaboration-sdk-ts 2.94.1 → 2.95.0-beta.1

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 (64) hide show
  1. package/build/access-rules/index.d.ts +1 -1
  2. package/build/access-tokens/index.d.ts +1 -1
  3. package/build/access-tokens/types.d.ts +2 -0
  4. package/build/access-tokens/types.js +2 -0
  5. package/build/apps/index.d.ts +8 -1
  6. package/build/apps/index.js +9 -0
  7. package/build/attributes/index.d.ts +1 -1
  8. package/build/authentication/index.d.ts +1 -1
  9. package/build/collaboration-policy/core/filter-builder.js +7 -1
  10. package/build/collaboration-policy/core/jsonschema/json-schema-types.d.ts +45 -0
  11. package/build/collaboration-policy/core/jsonschema/json-schema-types.js +1 -0
  12. package/build/collaboration-policy/core/jsonschema/policy-branches.d.ts +49 -0
  13. package/build/collaboration-policy/core/jsonschema/policy-branches.js +1 -0
  14. package/build/collaboration-policy/core/jsonschema/policy-evaluator.d.ts +22 -0
  15. package/build/collaboration-policy/core/jsonschema/policy-evaluator.js +260 -0
  16. package/build/collaboration-policy/core/jsonschema/sql-builder.d.ts +79 -0
  17. package/build/collaboration-policy/core/jsonschema/sql-builder.js +306 -0
  18. package/build/collaboration-policy/core/jsonschema/sql-poc.d.ts +79 -0
  19. package/build/collaboration-policy/core/jsonschema/sql-poc.js +305 -0
  20. package/build/collaboration-policy/core/types.d.ts +81 -10
  21. package/build/collaboration-policy/index.d.ts +5 -4
  22. package/build/collaboration-policy/index.js +4 -3
  23. package/build/collaboration-policy/useCollaborationPolicy.d.ts +13 -4
  24. package/build/collaboration-policy/useCollaborationPolicy.js +23 -1
  25. package/build/collaboration-policy/utils/path-helpers.d.ts +7 -3
  26. package/build/collaboration-policy/utils/path-helpers.js +6 -22
  27. package/build/company-info/index.d.ts +1 -1
  28. package/build/connections/index.d.ts +1 -1
  29. package/build/contracts/index.d.ts +1 -1
  30. package/build/data-planes/types.d.ts +1 -1
  31. package/build/data-streams/index.d.ts +1 -1
  32. package/build/datasets/index.d.ts +21 -3
  33. package/build/datasets/index.js +31 -2
  34. package/build/datasets/statistics-types.d.ts +81 -0
  35. package/build/datasets/statistics-types.js +1 -0
  36. package/build/datasets/types.d.ts +85 -9
  37. package/build/datasets/types.js +1 -0
  38. package/build/forecast/index.d.ts +1 -1
  39. package/build/index.d.ts +1 -0
  40. package/build/index.js +1 -0
  41. package/build/installations/index.d.ts +1 -1
  42. package/build/jobs/index.d.ts +1 -1
  43. package/build/jobs/types.d.ts +1 -0
  44. package/build/mappings/index.d.ts +1 -1
  45. package/build/model-inference/index.d.ts +1 -1
  46. package/build/model-training/index.d.ts +1 -1
  47. package/build/models/index.d.ts +1 -1
  48. package/build/nql/Ast.d.ts +1 -1
  49. package/build/nql/SubstraitParser.d.ts +771 -0
  50. package/build/nql/SubstraitParser.js +797 -0
  51. package/build/nql/index.d.ts +1 -1
  52. package/build/nql/index.js +1 -1
  53. package/build/nql/types.d.ts +9 -9
  54. package/build/products/index.d.ts +1 -1
  55. package/build/queries/index.d.ts +1 -1
  56. package/build/resources/index.d.ts +1 -1
  57. package/build/rosetta/types.d.ts +1 -1
  58. package/build/rosetta/types.js +1 -1
  59. package/build/rosetta-stone/index.d.ts +1 -1
  60. package/build/subscriptions/index.d.ts +1 -1
  61. package/build/uploads/index.d.ts +1 -1
  62. package/build/views/index.d.ts +1 -1
  63. package/build/workflows/index.d.ts +1 -1
  64. package/package.json +11 -10
@@ -1,20 +1,91 @@
1
- import type { CollaborationPolicyType } from "../types";
2
- type PolicyDefinition = CollaborationPolicyType["policy"]["definition"];
3
- export type StructureNode = PolicyDefinition["structure"];
4
- export type ExtendedAttributeNode = Extract<StructureNode, {
5
- field: unknown;
6
- }>;
7
- export type PolicyFilter = NonNullable<PolicyDefinition["filters"]>[number];
8
- export type PathValue = NonNullable<ExtendedAttributeNode["field"]["additional_required_properties"]>[number];
1
+ /**
2
+ * PathValue describes a path to a subfield, expressed as either dot notation
3
+ * or a JSON Pointer. Used in filter attribute references to specify which
4
+ * subfield of an attribute to operate on.
5
+ */
6
+ export type PathValue = {
7
+ dot: string;
8
+ } | {
9
+ pointer: string;
10
+ };
11
+ /**
12
+ * An attribute reference within a filter expression.
13
+ */
14
+ export interface FilterAttributeRef {
15
+ type: "attribute";
16
+ attribute_name: string;
17
+ path?: PathValue;
18
+ }
19
+ /**
20
+ * A filter expression: a literal value or an attribute reference.
21
+ */
22
+ export type FilterExpression = string | number | boolean | FilterAttributeRef;
23
+ /**
24
+ * PolicyFilter is a single filter entry in a policy definition.
25
+ *
26
+ * This is the canonical filter type used across the codebase (JSON-Schema
27
+ * filters, SQL builder, etc.).
28
+ */
29
+ export type PolicyFilter = PolicyFilterAndOr | PolicyFilterNot | PolicyFilterIsNull | PolicyFilterIn | PolicyFilterCompare | PolicyFilterBetween;
30
+ interface PolicyFilterBase {
31
+ stage?: "generation";
32
+ name?: string;
33
+ required?: boolean;
34
+ }
35
+ interface PolicyFilterAndOr extends PolicyFilterBase {
36
+ op: "and" | "or";
37
+ args: FilterExpression[];
38
+ }
39
+ interface PolicyFilterNot extends PolicyFilterBase {
40
+ op: "not";
41
+ args: FilterExpression[];
42
+ }
43
+ interface PolicyFilterIsNull extends PolicyFilterBase {
44
+ op: "is_null" | "is_not_null";
45
+ left: FilterExpression;
46
+ }
47
+ interface PolicyFilterIn extends PolicyFilterBase {
48
+ op: "in" | "not in";
49
+ left: FilterExpression;
50
+ right: FilterExpression[];
51
+ }
52
+ interface PolicyFilterCompare extends PolicyFilterBase {
53
+ op: "=" | "<>" | ">" | ">=" | "<" | "<=" | "like" | "not like";
54
+ left: FilterExpression;
55
+ right: FilterExpression;
56
+ }
57
+ interface PolicyFilterBetween extends PolicyFilterBase {
58
+ op: "between";
59
+ operand: FilterExpression;
60
+ lower: FilterExpression;
61
+ upper: FilterExpression;
62
+ }
63
+ /**
64
+ * Map from attribute name -> set of normalized paths that must be selected
65
+ * for SQL generation.
66
+ */
9
67
  export type AttributePathIndex = Map<string, Set<string>>;
68
+ /**
69
+ * A logical group of SQL fragments combined by an operation.
70
+ */
10
71
  export interface PolicySqlGroup {
11
72
  fragments: Array<string | PolicySqlGroup>;
12
73
  operation: "AND" | "OR";
13
74
  }
75
+ /**
76
+ * Core SQL fragments required to represent a set of collaboration policies.
77
+ */
14
78
  export interface PolicySqlFragments {
15
79
  select: string[];
16
80
  where: Array<PolicySqlGroup | string>;
17
81
  }
82
+ /**
83
+ * Full result of applying collaboration policies to a dataset, including:
84
+ * - which policies were applied
85
+ * - which were skipped and why
86
+ * - warnings
87
+ * - the minimum refresh schedule across applied policies
88
+ */
18
89
  export interface PolicyMatchResult extends PolicySqlFragments {
19
90
  appliedPolicies: string[];
20
91
  skippedPolicies: Array<{
@@ -23,7 +94,7 @@ export interface PolicyMatchResult extends PolicySqlFragments {
23
94
  details: string[];
24
95
  }>;
25
96
  warnings: string[];
26
- /** The minimum refresh schedule in milliseconds across all evaluated policies */
27
- refresh_schedule: number;
97
+ /** The minimum refresh schedule as an ISO 8601 duration string across all evaluated policies */
98
+ refresh_schedule: string;
28
99
  }
29
100
  export {};
@@ -1,4 +1,5 @@
1
- export { buildPolicySql, buildPolicySqlWithValidation, categorizePolicies, } from "./core/sql-builder";
2
- export type { AttributePathIndex, ExtendedAttributeNode, PathValue, PolicyFilter, PolicyMatchResult, PolicySqlFragments, PolicySqlGroup, StructureNode, } from "./core/types";
3
- export type { CollaborationPolicyInput, CollaborationPolicyType, } from "./types";
4
- export { buildCollaborationPolicyJsonSchema, CollaborationPolicy, } from "./types";
1
+ export type { JsonSchemaConnectorPolicy } from "./core/jsonschema/json-schema-types";
2
+ export { evaluateJsonSchemaPolicies } from "./core/jsonschema/policy-evaluator";
3
+ export { buildPolicySql, buildPolicySqlWithJsonSchema, buildPolicySqlWithValidation, categorizePolicies, type JsonSchemaPolicyMatchResult, } from "./core/jsonschema/sql-builder";
4
+ export type { AttributePathIndex, FilterAttributeRef, FilterExpression, PathValue, PolicyFilter, PolicyMatchResult, PolicySqlFragments, PolicySqlGroup, } from "./core/types";
5
+ export { default as useCollaborationPolicy } from "./useCollaborationPolicy";
@@ -1,3 +1,4 @@
1
- // Export the main functions
2
- export { buildPolicySql, buildPolicySqlWithValidation, categorizePolicies, } from "./core/sql-builder";
3
- export { buildCollaborationPolicyJsonSchema, CollaborationPolicy, } from "./types";
1
+ export { evaluateJsonSchemaPolicies } from "./core/jsonschema/policy-evaluator";
2
+ export { buildPolicySql, buildPolicySqlWithJsonSchema, buildPolicySqlWithValidation, categorizePolicies, } from "./core/jsonschema/sql-builder";
3
+ // Hook-style entrypoint
4
+ export { default as useCollaborationPolicy } from "./useCollaborationPolicy";
@@ -1,8 +1,17 @@
1
1
  import type { Attribute } from "../attributes/types";
2
2
  import type { Dataset } from "../datasets/types";
3
- import type { PolicySqlFragments } from "./core/types";
4
- import type { CollaborationPolicyType } from "./types";
3
+ import type { JsonSchemaConnectorPolicy } from "./core/jsonschema/json-schema-types";
4
+ import type { PolicyMatchResult, PolicySqlFragments } from "./core/types";
5
+ /**
6
+ * Hook-style wrapper that exposes collaboration policy helpers.
7
+ *
8
+ * Public API surface:
9
+ * - categorizePolicies
10
+ * - buildPolicySql
11
+ * - buildPolicySqlWithValidation
12
+ */
5
13
  export default function useCollaborationPolicy(): {
6
- getEligibleConnectorsPolicies: (dataset: Dataset, policies: CollaborationPolicyType[], attributes: Attribute[]) => CollaborationPolicyType[];
7
- buildPolicySqlFragments: (dataset: Dataset, policies: CollaborationPolicyType[], attributes: Attribute[]) => PolicySqlFragments;
14
+ getEligibleConnectorsPolicies: (dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]) => JsonSchemaConnectorPolicy[];
15
+ buildPolicySqlFragments: (dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]) => PolicySqlFragments;
16
+ buildPolicySqlWithValidationJsonSchema: (dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]) => PolicyMatchResult;
8
17
  };
@@ -1,14 +1,36 @@
1
- import { buildPolicySql, categorizePolicies } from "./core/sql-builder";
1
+ import { buildPolicySql, buildPolicySqlWithValidation, categorizePolicies, } from "./core/jsonschema/sql-builder";
2
+ /**
3
+ * Hook-style wrapper that exposes collaboration policy helpers.
4
+ *
5
+ * Public API surface:
6
+ * - categorizePolicies
7
+ * - buildPolicySql
8
+ * - buildPolicySqlWithValidation
9
+ */
2
10
  export default function useCollaborationPolicy() {
11
+ /**
12
+ * Get policies that are compatible with a dataset using the JSON-Schema policy system.
13
+ */
3
14
  const getEligibleConnectorsPolicies = (dataset, policies, attributes) => {
4
15
  const { matching } = categorizePolicies(policies, dataset, attributes);
5
16
  return matching;
6
17
  };
18
+ /**
19
+ * Build SQL fragments using JSON-Schema policies, without per-policy validation.
20
+ */
7
21
  const buildPolicySqlFragments = (dataset, policies, attributes) => {
8
22
  return buildPolicySql(dataset, policies, attributes);
9
23
  };
24
+ /**
25
+ * Validate each JSON-Schema policy against the dataset and build SQL
26
+ * plus metadata (appliedPolicies, skippedPolicies, etc.).
27
+ */
28
+ const buildPolicySqlWithValidationJsonSchema = (dataset, policies, attributes) => {
29
+ return buildPolicySqlWithValidation(dataset, policies, attributes);
30
+ };
10
31
  return {
11
32
  getEligibleConnectorsPolicies,
12
33
  buildPolicySqlFragments,
34
+ buildPolicySqlWithValidationJsonSchema,
13
35
  };
14
36
  }
@@ -1,4 +1,8 @@
1
- import type { Attribute } from "../../attributes/types";
2
- import type { AttributePathIndex, PathValue } from "../core/types";
3
- export declare function markAttributePath(index: AttributePathIndex, attribute: Attribute, path: string): void;
1
+ import type { PathValue } from "../core/types";
2
+ /**
3
+ * Normalizes a PathValue (dot notation or JSON pointer) into a simple dot-notation string.
4
+ *
5
+ * @param path - A PathValue with either `{ dot: "..." }` or `{ pointer: "..." }` format.
6
+ * @returns Normalized dot-notation string, or empty string for undefined/null.
7
+ */
4
8
  export declare function normalizePathValue(path?: PathValue): string;
@@ -1,25 +1,9 @@
1
- export function markAttributePath(index, attribute, path) {
2
- const attributePaths = index.get(attribute.name) ?? new Set();
3
- // Use the provided path, even if it's an empty string (which represents the root attribute)
4
- const normalized = path !== undefined && path !== null
5
- ? path
6
- : determineDefaultPath(attribute);
7
- attributePaths.add(normalized);
8
- index.set(attribute.name, attributePaths);
9
- }
10
- function determineDefaultPath(attribute) {
11
- if (attribute.type === "object" && "properties" in attribute) {
12
- const properties = attribute.properties ?? {};
13
- if ("value" in properties) {
14
- return "value";
15
- }
16
- const [firstKey] = Object.keys(properties);
17
- if (firstKey) {
18
- return firstKey;
19
- }
20
- }
21
- return "";
22
- }
1
+ /**
2
+ * Normalizes a PathValue (dot notation or JSON pointer) into a simple dot-notation string.
3
+ *
4
+ * @param path - A PathValue with either `{ dot: "..." }` or `{ pointer: "..." }` format.
5
+ * @returns Normalized dot-notation string, or empty string for undefined/null.
6
+ */
23
7
  export function normalizePathValue(path) {
24
8
  if (!path) {
25
9
  return "";
@@ -18,4 +18,4 @@ declare class CompanyInfoApi extends BaseApi {
18
18
  */
19
19
  getAllProvidersCompanyInfo(): Promise<ApiRecords<CompanyInfo>>;
20
20
  }
21
- export { type CompanyInfo, type WhoAmI, CompanyInfoApi };
21
+ export { type CompanyInfo, CompanyInfoApi, type WhoAmI };
@@ -69,4 +69,4 @@ declare class ConnectionsApi extends BaseApi {
69
69
  */
70
70
  getConnections(): Promise<ApiRecords<ConnectionV2>>;
71
71
  }
72
- export { type Connection, type ConnectionV2, type ConnectionStatus, ConnectionsApi, };
72
+ export { type Connection, type ConnectionStatus, ConnectionsApi, type ConnectionV2, };
@@ -36,4 +36,4 @@ declare class ContractsApi extends BaseApi {
36
36
  */
37
37
  getActiveContract(): Promise<ContractDetails>;
38
38
  }
39
- export { ContractsApi, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, };
39
+ export { type ContractDetails, type ContractRateView, ContractsApi, type CustomerContract, type PaymentMethod, };
@@ -15,7 +15,7 @@ export interface DataPlanePlatform {
15
15
  region: DataPlanePlatformRegion;
16
16
  }
17
17
  export interface DataPlaneCollaborators {
18
- use: Participants;
18
+ participants: Participants;
19
19
  }
20
20
  export interface DataPlane {
21
21
  type: DataPlaneType;
@@ -24,4 +24,4 @@ declare class DataStreamsApi extends BaseApi {
24
24
  getDataStreamBySlug(slug: string, companyId: number, authenticated: boolean): Promise<DataStream>;
25
25
  private getBaseUri;
26
26
  }
27
- export { DataStreamsApi, type DataRules, type ColumnSet, type ColumnWithFilterAndExport, type AttributeSet, type DataStream, };
27
+ export { type AttributeSet, type ColumnSet, type ColumnWithFilterAndExport, type DataRules, type DataStream, DataStreamsApi, };
@@ -1,8 +1,10 @@
1
1
  import type { UnknownJob } from "src/jobs/types";
2
2
  import { BaseApi } from "../base-api";
3
3
  import type { ApiRecords } from "../types";
4
- import type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetStatus, DatasetTableSummary, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, IngestDatasetFileRequest, RecalculationInfo, RetentionPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotRange, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, Value } from "./types";
5
- export type { FilePerSnapshotResponse, Dataset, RetentionPolicy, DatasetTableSummaryAPIResponse, ColumnStatistics, UpdateDatasetRequest, SchemaFileConfigType, SchemaPropertiesType, DatasetStatus, DatasetWriteMode, SchemaFileConfig, SchemaProperties, SchemaProperty, SchemaPrimitiveProperty, SchemaObjectProperty, SchemaArrayProperty, SchemaArrayItems, SchemaArrayItemsPrimitive, SchemaArrayItemsObject, SchemaArrayItemsArray, Schema, AdvancedStatisticsMetadata, SnapshotRange, Configuration, Columns, ColumnSummary, BasicStatistics, AdvancedStatistics, Histogram, Value, CreateDatasetRequest, UpdateDatasetRefreshScheduleRequest, CreateDatasetRefreshScheduleRequest, };
4
+ import type { DatasetStatisticsConfiguration, StatisticsConfigurationResponse } from "./statistics-types";
5
+ import type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummary, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, IngestDatasetFileRequest, JsonSchemaValidationNode, RecalculationInfo, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value } from "./types";
6
+ export type { CronRefresh, DatasetFieldConfig, DatasetFieldNamespace, DatasetStatisticsConfiguration, HistogramOptions, HistogramOverflow, ManualRefresh, NestedNodeConfig, NestedPropertyConfig, NonPrimitiveNodeConfig, OnUpdateRefresh, PrimitiveNodeConfig, RefreshTrigger, RosettaStoneFieldConfig, RosettaStoneFieldNamespace, StatConfig, StatisticsConfigurationResponse, StatName, StatOptions, } from "./statistics-types";
7
+ export type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, JsonSchemaValidationNode, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value, };
6
8
  /**
7
9
  * @module DatasetApi
8
10
  * @description This module provides methods for fetching datasets.
@@ -166,6 +168,8 @@ export declare class DatasetApi extends BaseApi {
166
168
  * @public
167
169
  */
168
170
  updateRetentionPolicy(datasetId: number, policy: RetentionPolicy): Promise<Dataset>;
171
+ upsertRetentionPolicies(datasetId: number, request: UpsertRetentionPoliciesRequest): Promise<Dataset>;
172
+ disableDatasetRetentionPolicy(datasetId: number, policy: TTLPolicy): Promise<Dataset>;
169
173
  /**
170
174
  * Configures the statistics for a specific dataset column.
171
175
  * This method sends a PUT request to the specified endpoint to update the statistics configuration.
@@ -190,7 +194,9 @@ export declare class DatasetApi extends BaseApi {
190
194
  * @throws {Error} If there is an issue with the request or the response.
191
195
  * @memberof DatasetApi
192
196
  */
193
- requestDatasetSample(datasetId: number): Promise<{
197
+ requestDatasetSample(datasetId: number, request?: {
198
+ compute_pool_id?: string;
199
+ }): Promise<{
194
200
  job_id: string;
195
201
  }>;
196
202
  /**
@@ -215,4 +221,16 @@ export declare class DatasetApi extends BaseApi {
215
221
  createDatasetRefreshSchedule(datasetId: number, refreshSchedule: CreateDatasetRefreshScheduleRequest): Promise<void>;
216
222
  updateDatasetRefreshSchedule(datasetId: number, refreshSchedule: UpdateDatasetRefreshScheduleRequest): Promise<void>;
217
223
  deleteDatasetRefreshSchedule(datasetId: number): Promise<void>;
224
+ /**
225
+ * Validate which connector interfaces are compatible with a dataset.
226
+ * Filtered by the user's installed apps and optionally by tags.
227
+ *
228
+ * @param {number} datasetId - The ID of the dataset to validate interfaces against.
229
+ * @param {string[]} [tags] - Optional tags to filter interfaces (e.g. ["audience_delivery"]).
230
+ * @returns {Promise<DatasetInterfaceValidation>} - Accepted interface IDs and per-interface validation errors.
231
+ */
232
+ getDatasetInterfaces(datasetId: number, tags?: string[]): Promise<DatasetInterfaceValidation>;
233
+ putStatisticsConfiguration(datasetId: number, configuration: DatasetStatisticsConfiguration): Promise<StatisticsConfigurationResponse>;
234
+ getStatisticsConfiguration(datasetId: number): Promise<StatisticsConfigurationResponse>;
235
+ deleteStatisticsConfiguration(datasetId: number): Promise<StatisticsConfigurationResponse>;
218
236
  }
@@ -221,6 +221,14 @@ export class DatasetApi extends BaseApi {
221
221
  async updateRetentionPolicy(datasetId, policy) {
222
222
  return await this.put(`${resourceName}/${datasetId}/retention-policy`, policy);
223
223
  }
224
+ async upsertRetentionPolicies(datasetId, request) {
225
+ return await this.put(`${resourceName}/${datasetId}/retention-policy`, request);
226
+ }
227
+ async disableDatasetRetentionPolicy(datasetId, policy) {
228
+ return await this.upsertRetentionPolicies(datasetId, {
229
+ policies: [{ ...policy, enabled: false }],
230
+ });
231
+ }
224
232
  /**
225
233
  * Configures the statistics for a specific dataset column.
226
234
  * This method sends a PUT request to the specified endpoint to update the statistics configuration.
@@ -249,8 +257,8 @@ export class DatasetApi extends BaseApi {
249
257
  * @throws {Error} If there is an issue with the request or the response.
250
258
  * @memberof DatasetApi
251
259
  */
252
- async requestDatasetSample(datasetId) {
253
- return await this.post(`${resourceName}/${datasetId}/request-sample`);
260
+ async requestDatasetSample(datasetId, request) {
261
+ return await this.post(`${resourceName}/${datasetId}/request-sample`, request);
254
262
  }
255
263
  /**
256
264
  * Deletes a sample of a specified dataset by its ID.
@@ -287,4 +295,25 @@ export class DatasetApi extends BaseApi {
287
295
  async deleteDatasetRefreshSchedule(datasetId) {
288
296
  await this.delete(`${resourceName}/${datasetId}/refresh-schedule`);
289
297
  }
298
+ /**
299
+ * Validate which connector interfaces are compatible with a dataset.
300
+ * Filtered by the user's installed apps and optionally by tags.
301
+ *
302
+ * @param {number} datasetId - The ID of the dataset to validate interfaces against.
303
+ * @param {string[]} [tags] - Optional tags to filter interfaces (e.g. ["audience_delivery"]).
304
+ * @returns {Promise<DatasetInterfaceValidation>} - Accepted interface IDs and per-interface validation errors.
305
+ */
306
+ async getDatasetInterfaces(datasetId, tags) {
307
+ const queryString = this.constructQueryString(tags != null ? { tags } : undefined);
308
+ return await this.get(`${resourceName}/${datasetId}/interfaces${queryString}`);
309
+ }
310
+ async putStatisticsConfiguration(datasetId, configuration) {
311
+ return await this.put(`${resourceName}/${datasetId}/statistics-configuration`, configuration);
312
+ }
313
+ async getStatisticsConfiguration(datasetId) {
314
+ return await this.get(`${resourceName}/${datasetId}/statistics-configuration`);
315
+ }
316
+ async deleteStatisticsConfiguration(datasetId) {
317
+ return await this.base_api.delete(`${resourceName}/${datasetId}/statistics-configuration`);
318
+ }
290
319
  }
@@ -0,0 +1,81 @@
1
+ export type StatName = "value_count" | "null_value_count" | "nan_value_count" | "lower_bound" | "upper_bound" | "approx_count_distinct" | "count_distinct" | "histogram" | "mean" | "standard_deviation" | "completeness";
2
+ export type HistogramOverflow = "none" | "truncate";
3
+ export interface HistogramOptions {
4
+ max_bins?: number;
5
+ overflow?: HistogramOverflow;
6
+ }
7
+ export interface StatOptions {
8
+ histogram?: HistogramOptions;
9
+ }
10
+ export type StatConfig = {
11
+ enabled_stats: StatName[];
12
+ stat_options?: StatOptions;
13
+ } | {
14
+ enabled_stats?: StatName[];
15
+ stat_options: StatOptions;
16
+ } | {
17
+ enabled_stats: StatName[];
18
+ stat_options: StatOptions;
19
+ };
20
+ export interface CronRefresh {
21
+ trigger: "cron";
22
+ cron_expression: string;
23
+ }
24
+ export interface OnUpdateRefresh {
25
+ trigger: "on_update";
26
+ }
27
+ export interface ManualRefresh {
28
+ trigger: "manual";
29
+ }
30
+ export type RefreshTrigger = CronRefresh | OnUpdateRefresh | ManualRefresh;
31
+ export interface PrimitiveNodeConfig {
32
+ enabled_stats?: StatName[];
33
+ stat_options?: StatOptions;
34
+ }
35
+ export interface NonPrimitiveNodeConfig {
36
+ self?: StatConfig;
37
+ properties?: NestedPropertyConfig[];
38
+ items?: NestedNodeConfig;
39
+ }
40
+ export type NestedNodeConfig = PrimitiveNodeConfig | NonPrimitiveNodeConfig;
41
+ export type NestedPropertyConfig = (PrimitiveNodeConfig & {
42
+ path: string;
43
+ }) | (NonPrimitiveNodeConfig & {
44
+ path: string;
45
+ });
46
+ export type DatasetFieldConfig = (PrimitiveNodeConfig & {
47
+ field_name: string;
48
+ }) | (NonPrimitiveNodeConfig & {
49
+ field_name: string;
50
+ }) | {
51
+ field_name: string;
52
+ };
53
+ export type RosettaStoneFieldConfig = (PrimitiveNodeConfig & {
54
+ attribute_name: string;
55
+ }) | (NonPrimitiveNodeConfig & {
56
+ attribute_name: string;
57
+ }) | {
58
+ attribute_name: string;
59
+ };
60
+ export interface DatasetFieldNamespace {
61
+ scope?: StatConfig;
62
+ fields?: DatasetFieldConfig[];
63
+ }
64
+ export interface RosettaStoneFieldNamespace {
65
+ scope?: StatConfig;
66
+ fields?: RosettaStoneFieldConfig[];
67
+ }
68
+ export interface DatasetStatisticsConfiguration {
69
+ defaults: StatConfig;
70
+ refresh: RefreshTrigger;
71
+ dataset?: DatasetFieldNamespace;
72
+ rosetta_stone?: RosettaStoneFieldNamespace;
73
+ }
74
+ export interface StatisticsConfigurationResponse {
75
+ id: string;
76
+ dataset_id: number;
77
+ version: number;
78
+ created_at: string;
79
+ created_by: number;
80
+ configuration: DatasetStatisticsConfiguration;
81
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -22,6 +22,9 @@ export interface Dataset {
22
22
  external_id?: string;
23
23
  data_plane?: DataPlane;
24
24
  materialized_view_config?: string;
25
+ compute_pool_config?: {
26
+ default_compute_pool_id?: string;
27
+ };
25
28
  }
26
29
  export interface DatasetStats extends DatasetSummaryStatistics {
27
30
  last_snapshot_added_bytes: number;
@@ -78,8 +81,6 @@ export interface DatasetTableSummaryAPIResponse {
78
81
  export type SchemaPropertiesType = "string" | "boolean" | "double" | "long" | "timestamptz" | "object" | "array";
79
82
  export type DatasetStatus = "active" | "archived" | "pending";
80
83
  export type DatasetWriteMode = "append" | "overwrite";
81
- type ExpressionlessRetentionPolicyType = "retain_everything" | "expire_everything";
82
- type ExpressionedRetentionPolicyType = "retain_when" | "expire_when";
83
84
  type SchemaType = "object" | "value";
84
85
  export declare enum Operator {
85
86
  GreaterThan = ">",
@@ -87,16 +88,66 @@ export declare enum Operator {
87
88
  GreaterThanOrEqualTo = ">=",
88
89
  LessThanOrEqualTo = "<="
89
90
  }
91
+ export interface SnapshotAgeExpression {
92
+ type: "snapshot_age";
93
+ operator: Operator;
94
+ period: string;
95
+ }
90
96
  export type RetentionPolicy = {
91
- type: ExpressionlessRetentionPolicyType;
97
+ type: "retain_everything";
92
98
  } | {
93
- type: ExpressionedRetentionPolicyType;
94
- expression?: {
95
- type: "snapshot_age";
96
- operator: Operator;
97
- period: string;
98
- };
99
+ type: "expire_everything";
100
+ } | {
101
+ type: "retain_when";
102
+ expression?: SnapshotAgeExpression;
103
+ } | {
104
+ type: "expire_when";
105
+ expression?: SnapshotAgeExpression;
99
106
  };
107
+ export interface RowClock {
108
+ kind: "event_time";
109
+ attribute?: string;
110
+ }
111
+ export type TTLPolicyKind = "row_ttl" | "table_ttl" | "snapshot_ttl";
112
+ export interface RowTTLPolicy {
113
+ type: {
114
+ kind: "row_ttl";
115
+ clock?: RowClock;
116
+ };
117
+ enabled: boolean;
118
+ interval: string;
119
+ }
120
+ export type TableClockKind = "created_at" | "max_event_time" | "static_time";
121
+ export interface TableClock {
122
+ kind: TableClockKind;
123
+ column?: string;
124
+ }
125
+ export interface TableTTLPolicy {
126
+ type: {
127
+ kind: "table_ttl";
128
+ clock: TableClock;
129
+ };
130
+ enabled: boolean;
131
+ interval: string;
132
+ }
133
+ export interface SnapshotTTLPolicy {
134
+ type: {
135
+ kind: "snapshot_ttl";
136
+ };
137
+ enabled: boolean;
138
+ interval: string;
139
+ snapshot_retention_policy: RetentionPolicy;
140
+ }
141
+ export type TTLPolicy = RowTTLPolicy | TableTTLPolicy | SnapshotTTLPolicy;
142
+ export interface RetentionScheduleConfig {
143
+ schedule: string;
144
+ schedule_zone_id?: string;
145
+ status?: "active" | "pending" | "archived";
146
+ }
147
+ export interface UpsertRetentionPoliciesRequest {
148
+ policies: TTLPolicy[];
149
+ schedule_config?: RetentionScheduleConfig;
150
+ }
100
151
  export type SchemaFileConfigType = "flat" | "json" | "parquet";
101
152
  export interface FlatFileConfig {
102
153
  type: "flat";
@@ -244,6 +295,31 @@ export interface CreateDatasetRequest {
244
295
  export interface IngestDatasetFileRequest {
245
296
  source_file: string;
246
297
  }
298
+ export interface DatasetInterfaceRef {
299
+ app_id: number;
300
+ interface_id: string;
301
+ }
302
+ /**
303
+ * A JSON-Schema 2020-12 "Basic" output node, used recursively in validation errors.
304
+ * `errors` is keyed by JSON-Schema keyword (`"required"`, `"type"`, etc.); values
305
+ * are human-readable strings.
306
+ */
307
+ export interface JsonSchemaValidationNode {
308
+ valid: boolean;
309
+ evaluationPath: string;
310
+ schemaLocation: string;
311
+ instanceLocation: string;
312
+ errors?: Record<string, string>;
313
+ details?: JsonSchemaValidationNode[];
314
+ }
315
+ export interface DatasetInterfaceError extends DatasetInterfaceRef {
316
+ details: JsonSchemaValidationNode;
317
+ }
318
+ export interface DatasetInterfaceValidation {
319
+ dataset_id: number;
320
+ accepted: DatasetInterfaceRef[];
321
+ errors: DatasetInterfaceError[];
322
+ }
247
323
  export interface UpdateDatasetRefreshScheduleRequest {
248
324
  cron?: string;
249
325
  cron_zone_id?: string;
@@ -1,3 +1,4 @@
1
+ // ---- Snapshot-level retention (legacy) ----
1
2
  export var Operator;
2
3
  (function (Operator) {
3
4
  Operator["GreaterThan"] = ">";
@@ -49,4 +49,4 @@ declare class ForecastApi extends BaseApi {
49
49
  */
50
50
  getPublicForecast(forecastId: string): Promise<ForecastResponse>;
51
51
  }
52
- export { ForecastApi, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type ForecastResult, type CostForecastResult, type ForecastResultFailure, type JobState, };
52
+ export { type CostForecastRequest, type CostForecastResponse, type CostForecastResult, ForecastApi, type ForecastRequest, type ForecastResponse, type ForecastResult, type ForecastResultFailure, type JobState, };
package/build/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export * from "./data-planes";
15
15
  export * from "./data-planes/types";
16
16
  export * from "./data-streams";
17
17
  export * from "./datasets";
18
+ export * from "./datasets/statistics-types";
18
19
  export * from "./datasets/types";
19
20
  export * from "./encryption-materials";
20
21
  export * from "./encryption-materials/types";
package/build/index.js CHANGED
@@ -15,6 +15,7 @@ export * from "./data-planes";
15
15
  export * from "./data-planes/types";
16
16
  export * from "./data-streams";
17
17
  export * from "./datasets";
18
+ export * from "./datasets/statistics-types";
18
19
  export * from "./datasets/types";
19
20
  export * from "./encryption-materials";
20
21
  export * from "./encryption-materials/types";
@@ -15,4 +15,4 @@ declare class InstallationsApi extends BaseApi {
15
15
  getInstallations(appCategory?: string): Promise<ApiRecords<Installation>>;
16
16
  getInstallationProfiles(installationId: number): Promise<ApiRecords<Profile>>;
17
17
  }
18
- export { type Installation, type Profile, InstallationsApi };
18
+ export { type Installation, InstallationsApi, type Profile };
@@ -31,4 +31,4 @@ declare class JobsApi extends BaseApi {
31
31
  */
32
32
  cancelJob(jobId: string): Promise<void>;
33
33
  }
34
- export { type Job, type JobRequestSource, type JobRequestSourceApiUser, type JobRequestSourceProcess, type ForecastInput, type ForecastJob, type ExplainInput, type ExplainJob, type ExplainOutput, type MaterializedViewInput, type MaterializedViewJob, type MaterializedViewOutput, type DeleteInput, type DatasetsDeleteTableJob, type DeliverInput, type DatasetsDeliverDataJob, type SampleInput, type DatasetsSampleJob, type ColumnDetails, type StatsInput, type DatasetsCalculateColumnStatsJob, type ModelTrainingRunInput, type ModelTrainingRunJob, type ModelsDeliverModelInput, type ModelsDeliverModelJob, type ModelInferenceRunInput, type ModelInferenceRunJob, type ModelInferenceRunJobResult, type GetJobsParameters, JobsApi, };
34
+ export { type ColumnDetails, type DatasetsCalculateColumnStatsJob, type DatasetsDeleteTableJob, type DatasetsDeliverDataJob, type DatasetsSampleJob, type DeleteInput, type DeliverInput, type ExplainInput, type ExplainJob, type ExplainOutput, type ForecastInput, type ForecastJob, type GetJobsParameters, type Job, type JobRequestSource, type JobRequestSourceApiUser, type JobRequestSourceProcess, JobsApi, type MaterializedViewInput, type MaterializedViewJob, type MaterializedViewOutput, type ModelInferenceRunInput, type ModelInferenceRunJob, type ModelInferenceRunJobResult, type ModelsDeliverModelInput, type ModelsDeliverModelJob, type ModelTrainingRunInput, type ModelTrainingRunJob, type SampleInput, type StatsInput, };
@@ -19,6 +19,7 @@ interface BaseJob {
19
19
  type: JobType;
20
20
  request_source: JobRequestSource;
21
21
  data_plane_id?: string;
22
+ compute_pool_id?: string;
22
23
  state: JobState;
23
24
  executor?: string;
24
25
  idempotency_key: string;