@narrative.io/data-collaboration-sdk-ts 2.95.0-beta.0 → 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 (50) 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 +1 -1
  6. package/build/attributes/index.d.ts +1 -1
  7. package/build/authentication/index.d.ts +1 -1
  8. package/build/collaboration-policy/core/jsonschema/json-schema-types.d.ts +2 -2
  9. package/build/collaboration-policy/core/jsonschema/sql-builder.js +2 -1
  10. package/build/collaboration-policy/core/sql-builder.js +9 -11
  11. package/build/collaboration-policy/types/collaboration-policy.d.ts +1370 -0
  12. package/build/collaboration-policy/types/collaboration-policy.js +274 -0
  13. package/build/collaboration-policy/types/index.d.ts +2 -0
  14. package/build/collaboration-policy/types/index.js +1 -0
  15. package/build/company-info/index.d.ts +1 -1
  16. package/build/connections/index.d.ts +1 -1
  17. package/build/contracts/index.d.ts +1 -1
  18. package/build/data-planes/types.d.ts +1 -1
  19. package/build/data-streams/index.d.ts +1 -1
  20. package/build/datasets/index.d.ts +12 -3
  21. package/build/datasets/index.js +19 -2
  22. package/build/datasets/statistics-types.d.ts +81 -0
  23. package/build/datasets/statistics-types.js +1 -0
  24. package/build/datasets/types.d.ts +83 -11
  25. package/build/datasets/types.js +1 -0
  26. package/build/forecast/index.d.ts +1 -1
  27. package/build/index.d.ts +1 -0
  28. package/build/index.js +1 -0
  29. package/build/installations/index.d.ts +1 -1
  30. package/build/jobs/index.d.ts +1 -1
  31. package/build/jobs/types.d.ts +1 -0
  32. package/build/mappings/index.d.ts +1 -1
  33. package/build/model-inference/index.d.ts +1 -1
  34. package/build/model-training/index.d.ts +1 -1
  35. package/build/models/index.d.ts +1 -1
  36. package/build/nql/Ast.d.ts +1 -1
  37. package/build/nql/index.d.ts +1 -1
  38. package/build/nql/index.js +1 -1
  39. package/build/nql/types.d.ts +9 -9
  40. package/build/products/index.d.ts +1 -1
  41. package/build/queries/index.d.ts +1 -1
  42. package/build/resources/index.d.ts +1 -1
  43. package/build/rosetta/types.d.ts +1 -1
  44. package/build/rosetta/types.js +1 -1
  45. package/build/rosetta-stone/index.d.ts +1 -1
  46. package/build/subscriptions/index.d.ts +1 -1
  47. package/build/uploads/index.d.ts +1 -1
  48. package/build/views/index.d.ts +1 -1
  49. package/build/workflows/index.d.ts +1 -1
  50. package/package.json +9 -9
@@ -0,0 +1,274 @@
1
+ import * as z from "zod/v4";
2
+ /** Branded types */
3
+ const CollaborationPolicyIdentifier = z
4
+ .string()
5
+ .regex(/^[a-zA-Z0-9_-]+$/)
6
+ .brand("CollaborationPolicyId")
7
+ .meta({
8
+ id: "collaboration_policy_identifier",
9
+ });
10
+ /**
11
+ * Refresh Schedule Schema
12
+ *
13
+ * Specifies how often the destination should be refreshed to ensure data doesn't expire.
14
+ * This is the maximum time interval allowed between destination updates. Waiting longer
15
+ * than this duration may result in the destination expiring data that should be retained.
16
+ *
17
+ * Uses ISO 8601 duration format (e.g., "PT1H" for 1 hour, "P1D" for 1 day).
18
+ * Supported values:
19
+ * - PT1H: Hourly (1 hour)
20
+ * - P1D: Daily (1 day)
21
+ * - P7D: Weekly (7 days)
22
+ * - P1M: Monthly (1 month)
23
+ * - P0D: Once (no recurring refresh)
24
+ * - Custom ISO 8601 duration strings (e.g., "PT30M" for 30 minutes, "P2W" for 2 weeks)
25
+ */
26
+ const RefreshScheduleSchema = z
27
+ .object({
28
+ max: z
29
+ .string()
30
+ .regex(/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/, "Invalid ISO 8601 duration format. Expected format like 'PT1H' (1 hour), 'P1D' (1 day), 'P7D' (7 days), 'P1M' (1 month), or 'P0D' (once)"),
31
+ })
32
+ .strict()
33
+ .meta({
34
+ id: "refresh_schedule",
35
+ });
36
+ const CollaborationPolicyDefinitionMetadataSchema = z
37
+ .object({
38
+ tags: z.array(z.string().regex(/^[a-zA-Z0-9_-]+$/)).optional(),
39
+ refresh_schedule: RefreshScheduleSchema.optional(),
40
+ })
41
+ .meta({ id: "metadata" });
42
+ const JsonPointerSchema = z
43
+ .string()
44
+ .regex(/^(#\/|\/).+/, 'JSON Pointer must start with "/" or "#/".')
45
+ .meta({ id: "json-pointer" });
46
+ /** Path can be dot-style or JSON Pointer */
47
+ const PathSchema = z
48
+ .union([
49
+ z
50
+ .object({
51
+ dot: z.string().min(1, "Dot path cannot be empty"),
52
+ })
53
+ .strict(),
54
+ z
55
+ .object({
56
+ pointer: JsonPointerSchema,
57
+ })
58
+ .strict(),
59
+ ])
60
+ .meta({ id: "path" });
61
+ /** ---------------------------
62
+ * Base + contextual variants
63
+ * --------------------------*/
64
+ /**
65
+ * BaseAttributeRef:
66
+ * - supports either `attribute_name` (by name) OR `attribute` (by pointer), not both
67
+ * - includes both `additional_required_properties` and `path` (context will prune)
68
+ */
69
+ const BaseAttributeRef = z
70
+ .object({
71
+ type: z.literal("attribute").meta({ id: "field_type" }),
72
+ // Choose ONE of these identifiers:
73
+ attribute_name: z.string().meta({ id: "attribute_name" }),
74
+ // Context-specific fields (trim in the derived schemas):
75
+ additional_required_properties: z
76
+ .array(PathSchema)
77
+ .optional()
78
+ .meta({ id: "additional_required_properties" }),
79
+ path: PathSchema.optional(),
80
+ })
81
+ .strict()
82
+ .meta({ id: "attribute_reference" });
83
+ /**
84
+ * StructureAttributeRef:
85
+ * - used in your “structure” (the logical tree)
86
+ * - allows: attribute_name + additional_required_properties
87
+ * - forbids: path, attribute (pointer)
88
+ * Example target:
89
+ * field: {
90
+ * type: "attribute",
91
+ * attribute_name: "sha256_hashed_email",
92
+ * additional_required_properties: [{ dot: "type" }],
93
+ * }
94
+ */
95
+ const StructureAttributeRef = BaseAttributeRef.omit({
96
+ path: true,
97
+ }).meta({ id: "structure_attribute_reference" });
98
+ /**
99
+ * FilterAttributeRef:
100
+ * - used inside filters
101
+ * - allows: attribute (pointer) + optional path
102
+ * - forbids: additional_required_properties, attribute_name
103
+ * Example target:
104
+ * left: {
105
+ * type: "attribute",
106
+ * attribute: "https://api.narrative.io/attributes/iso_3166_1_country",
107
+ * path: { dot: "value" },
108
+ * }
109
+ */
110
+ const FilterAttributeRef = BaseAttributeRef.omit({
111
+ additional_required_properties: true,
112
+ }).meta({ id: "filter_attribute_reference" });
113
+ // Now Expression can reference Filter without a lazy;
114
+ // the recursive bits inside Filter are handled by getters.
115
+ const Expression = z
116
+ .union([
117
+ z
118
+ .string()
119
+ .refine((s) => !s.startsWith("https://api.narrative.io/attributes/"), "String expression cannot be a JSON pointer; use { type:'attribute', attribute: ... }"),
120
+ z.number(),
121
+ z.boolean(),
122
+ FilterAttributeRef,
123
+ ])
124
+ .meta({ id: "expression" });
125
+ const FilterAndOr = z
126
+ .object({
127
+ op: z.enum(["and", "or"]),
128
+ stage: z.literal("generation").default("generation"),
129
+ name: z.string().optional(),
130
+ required: z.boolean().default(true),
131
+ get args() {
132
+ return z.array(Expression).min(2);
133
+ },
134
+ })
135
+ .strict();
136
+ const FilterNot = z
137
+ .object({
138
+ op: z.literal("not"),
139
+ stage: z.literal("generation").default("generation"),
140
+ name: z.string().optional(),
141
+ required: z.boolean().default(true),
142
+ get args() {
143
+ return z.array(Expression).length(1);
144
+ },
145
+ })
146
+ .strict();
147
+ const FilterIsNull = z
148
+ .object({
149
+ op: z.enum(["is_null", "is_not_null"]),
150
+ stage: z.literal("generation").default("generation"),
151
+ name: z.string().optional(),
152
+ required: z.boolean().default(true),
153
+ get left() {
154
+ return Expression;
155
+ },
156
+ })
157
+ .strict();
158
+ const FilterIn = z
159
+ .object({
160
+ op: z.enum(["in", "not in"]),
161
+ stage: z.literal("generation").default("generation"),
162
+ name: z.string().optional(),
163
+ required: z.boolean().default(true),
164
+ get left() {
165
+ return Expression;
166
+ },
167
+ get right() {
168
+ return z.array(Expression).min(1);
169
+ },
170
+ })
171
+ .strict();
172
+ const FilterCompare = z
173
+ .object({
174
+ op: z.enum(["=", "<>", ">", ">=", "<", "<=", "like", "not like"]),
175
+ stage: z.literal("generation").default("generation"),
176
+ name: z.string().optional(),
177
+ required: z.boolean().default(true),
178
+ get left() {
179
+ return Expression;
180
+ },
181
+ get right() {
182
+ return Expression;
183
+ },
184
+ })
185
+ .strict();
186
+ const FilterBetween = z
187
+ .object({
188
+ op: z.literal("between"),
189
+ stage: z.literal("generation").default("generation"),
190
+ name: z.string().optional(),
191
+ required: z.boolean().default(true),
192
+ get operand() {
193
+ return Expression;
194
+ },
195
+ get lower() {
196
+ return Expression;
197
+ },
198
+ get upper() {
199
+ return Expression;
200
+ },
201
+ })
202
+ .strict();
203
+ const Filter = z
204
+ .union([
205
+ FilterAndOr,
206
+ FilterNot,
207
+ FilterIsNull,
208
+ FilterIn,
209
+ FilterCompare,
210
+ FilterBetween,
211
+ ])
212
+ .meta({ id: "filter" });
213
+ const logicalTree = (leaf) => {
214
+ const NodeSchema = z.lazy(() => z
215
+ .union([
216
+ z
217
+ .object({
218
+ anyOf: z
219
+ .array(z.union([leaf, NodeSchema]))
220
+ .min(1)
221
+ .meta({ id: "any_of" }),
222
+ })
223
+ .strict()
224
+ .meta({ id: "any_of_object" }),
225
+ z
226
+ .object({
227
+ allOf: z
228
+ .array(z.union([leaf, NodeSchema]))
229
+ .min(1)
230
+ .meta({ id: "all_of" }),
231
+ })
232
+ .strict()
233
+ .meta({ id: "all_of_object" }),
234
+ ])
235
+ .meta({ id: "logical_node" }));
236
+ // Top-level can be a leaf T or a logical node.
237
+ return z.union([leaf, NodeSchema]).meta({ id: "logical_tree" });
238
+ };
239
+ const ExtendedAttribute = z
240
+ .object({
241
+ field: StructureAttributeRef,
242
+ filters: z.array(Filter).optional(),
243
+ })
244
+ .meta({ id: "extended_attribute" });
245
+ const CollaborationPolicyDefinitionShape = z
246
+ .object({
247
+ id: CollaborationPolicyIdentifier,
248
+ structure: logicalTree(ExtendedAttribute).meta({ id: "structure" }),
249
+ filters: z.array(Filter).optional(),
250
+ })
251
+ .meta({ id: "shape" });
252
+ const CollaborationPolicyDefinition = z
253
+ .object({
254
+ metadata: CollaborationPolicyDefinitionMetadataSchema,
255
+ definition: CollaborationPolicyDefinitionShape,
256
+ })
257
+ .meta({ id: "policy_definition" });
258
+ const CollaborationPolicy = z
259
+ .object({
260
+ name: CollaborationPolicyIdentifier,
261
+ description: z.string().max(2000).optional(),
262
+ display_name: z.string().max(255),
263
+ policy: CollaborationPolicyDefinition,
264
+ })
265
+ .meta({ id: "policy" });
266
+ // Export the schema for validation
267
+ export { CollaborationPolicy };
268
+ export function buildCollaborationPolicyJsonSchema(options = {}) {
269
+ const override = (options ?? {});
270
+ return z.toJSONSchema(CollaborationPolicy, {
271
+ reused: "ref",
272
+ ...override,
273
+ });
274
+ }
@@ -0,0 +1,2 @@
1
+ export type { CollaborationPolicyInput, CollaborationPolicyType, } from "./collaboration-policy";
2
+ export { buildCollaborationPolicyJsonSchema, CollaborationPolicy, } from "./collaboration-policy";
@@ -0,0 +1 @@
1
+ export { buildCollaborationPolicyJsonSchema, CollaborationPolicy, } from "./collaboration-policy";
@@ -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, DatasetInterfaceValidation, 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, DatasetInterfaceValidation, };
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
  /**
@@ -224,4 +230,7 @@ export declare class DatasetApi extends BaseApi {
224
230
  * @returns {Promise<DatasetInterfaceValidation>} - Accepted interface IDs and per-interface validation errors.
225
231
  */
226
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>;
227
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.
@@ -299,4 +307,13 @@ export class DatasetApi extends BaseApi {
299
307
  const queryString = this.constructQueryString(tags != null ? { tags } : undefined);
300
308
  return await this.get(`${resourceName}/${datasetId}/interfaces${queryString}`);
301
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
+ }
302
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,9 +295,30 @@ 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
+ }
247
318
  export interface DatasetInterfaceValidation {
248
- accepted: string[];
249
- errors: Record<string, string[]>;
319
+ dataset_id: number;
320
+ accepted: DatasetInterfaceRef[];
321
+ errors: DatasetInterfaceError[];
250
322
  }
251
323
  export interface UpdateDatasetRefreshScheduleRequest {
252
324
  cron?: 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;