@narrative.io/data-collaboration-sdk-ts 2.94.1 → 2.95.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.
@@ -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;
@@ -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, DatasetStatus, DatasetTableSummary, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, IngestDatasetFileRequest, 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 { FilePerSnapshotResponse, Dataset, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, SnapshotAgeExpression, SnapshotTTLPolicy, TTLPolicy, TTLPolicyKind, TableClock, TableClockKind, TableTTLPolicy, UpsertRetentionPoliciesRequest, 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, };
7
+ export type { CronRefresh, DatasetFieldConfig, DatasetFieldNamespace, DatasetStatisticsConfiguration, HistogramOptions, HistogramOverflow, ManualRefresh, NestedNodeConfig, NestedPropertyConfig, NonPrimitiveNodeConfig, OnUpdateRefresh, PrimitiveNodeConfig, RefreshTrigger, RosettaStoneFieldConfig, RosettaStoneFieldNamespace, StatConfig, StatisticsConfigurationResponse, StatName, StatOptions, } from "./statistics-types";
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,7 @@ 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
+ putStatisticsConfiguration(datasetId: number, configuration: DatasetStatisticsConfiguration): Promise<StatisticsConfigurationResponse>;
225
+ getStatisticsConfiguration(datasetId: number): Promise<StatisticsConfigurationResponse>;
226
+ deleteStatisticsConfiguration(datasetId: number): Promise<StatisticsConfigurationResponse>;
218
227
  }
@@ -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,13 @@ export class DatasetApi extends BaseApi {
287
295
  async deleteDatasetRefreshSchedule(datasetId) {
288
296
  await this.delete(`${resourceName}/${datasetId}/refresh-schedule`);
289
297
  }
298
+ async putStatisticsConfiguration(datasetId, configuration) {
299
+ return await this.put(`${resourceName}/${datasetId}/statistics-configuration`, configuration);
300
+ }
301
+ async getStatisticsConfiguration(datasetId) {
302
+ return await this.get(`${resourceName}/${datasetId}/statistics-configuration`);
303
+ }
304
+ async deleteStatisticsConfiguration(datasetId) {
305
+ return await this.base_api.delete(`${resourceName}/${datasetId}/statistics-configuration`);
306
+ }
290
307
  }
@@ -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";
@@ -1,3 +1,4 @@
1
+ // ---- Snapshot-level retention (legacy) ----
1
2
  export var Operator;
2
3
  (function (Operator) {
3
4
  Operator["GreaterThan"] = ">";
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";
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "2.94.1",
3
+ "version": "2.95.0",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",
@@ -28,19 +28,19 @@
28
28
  "@babel/core": "7.29.0",
29
29
  "@babel/preset-env": "7.29.0",
30
30
  "@babel/preset-typescript": "7.28.5",
31
- "@biomejs/biome": "2.3.14",
32
- "@commitlint/cli": "20.4.1",
33
- "@commitlint/config-conventional": "20.4.1",
31
+ "@biomejs/biome": "2.4.5",
32
+ "@commitlint/cli": "20.4.3",
33
+ "@commitlint/config-conventional": "20.4.3",
34
34
  "@types/jest": "30.0.0",
35
35
  "babel-jest": "30.2.0",
36
36
  "jest": "30.2.0",
37
- "lefthook": "2.1.0",
37
+ "lefthook": "2.1.2",
38
38
  "ts-jest": "29.4.6"
39
39
  },
40
40
  "dependencies": {
41
41
  "mande": "2.0.9",
42
42
  "zod": "4.3.6",
43
- "bignumber.js": "9.3.1"
43
+ "bignumber.js": "10.0.2"
44
44
  },
45
45
  "overrides": {
46
46
  "semver@<7.5.2": "7.5.2"