@narrative.io/data-collaboration-sdk-ts 0.0.102 → 0.0.104

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.
@@ -1,7 +1,7 @@
1
1
  import { type ApiRecords } from '../types';
2
2
  import { BaseApi } from '../base-api';
3
- import type { FilePerSnapshotResponse, Dataset, DatasetTableSummaryAPIResponse, ColumnStatistics } from './types';
4
- export { type FilePerSnapshotResponse, type Dataset, type DatasetTableSummaryAPIResponse, type ColumnStatistics };
3
+ import type { FilePerSnapshotResponse, Dataset, DatasetTableSummaryAPIResponse, ColumnStatistics, RetentionPolicy } from './types';
4
+ export { type FilePerSnapshotResponse, type Dataset, type RetentionPolicy, type DatasetTableSummaryAPIResponse, type ColumnStatistics };
5
5
  /**
6
6
  * @module DatasetApi
7
7
  * @description This module provides methods for fetching datasets.
@@ -81,4 +81,15 @@ export declare class DatasetApi extends BaseApi {
81
81
  * @public
82
82
  */
83
83
  getColumnStats(datasetId: number): Promise<ColumnStatistics>;
84
+ /**
85
+ * Updates the retention policy of a specific dataset.
86
+ *
87
+ * @param {number} datasetId - The ID of the dataset to update the retention policy for.
88
+ * @param {RetentionPolicy} policy - The new retention policy to be applied.
89
+ * @returns {Promise<Dataset>} A Promise that resolves with the updated dataset object.
90
+ * @throws {Error} If there is an issue with the request or the response.
91
+ * @memberof DatasetApi
92
+ * @public
93
+ */
94
+ updateRetentionPolicy(datasetId: number, policy: RetentionPolicy): Promise<Dataset>;
84
95
  }
@@ -100,4 +100,17 @@ export class DatasetApi extends BaseApi {
100
100
  async getColumnStats(datasetId) {
101
101
  return await this.get(`${resourceName}/${datasetId}/column-stats`);
102
102
  }
103
+ /**
104
+ * Updates the retention policy of a specific dataset.
105
+ *
106
+ * @param {number} datasetId - The ID of the dataset to update the retention policy for.
107
+ * @param {RetentionPolicy} policy - The new retention policy to be applied.
108
+ * @returns {Promise<Dataset>} A Promise that resolves with the updated dataset object.
109
+ * @throws {Error} If there is an issue with the request or the response.
110
+ * @memberof DatasetApi
111
+ * @public
112
+ */
113
+ async updateRetentionPolicy(datasetId, policy) {
114
+ return await this.put(`${resourceName}/${datasetId}/retention-policy`, policy);
115
+ }
103
116
  }
@@ -1,3 +1,4 @@
1
+ import type { Mapping } from '../mappings/types';
1
2
  export interface Dataset {
2
3
  id: number;
3
4
  company_id: number;
@@ -12,6 +13,7 @@ export interface Dataset {
12
13
  write_mode: DatasetWriteMode;
13
14
  last_snapshot_created_at?: string;
14
15
  active_dataset_stored_bytes?: number;
16
+ mappings?: Mapping[];
15
17
  }
16
18
  export interface DatasetColumnSummary {
17
19
  id: number;
@@ -51,11 +53,25 @@ type SchemaFileConfigType = 'flat' | 'json' | 'parquet';
51
53
  type SchemaPropertiesType = 'string' | 'boolean' | 'double' | 'long' | 'timestamptz' | 'object' | 'array';
52
54
  type DatasetStatus = 'active' | 'archived';
53
55
  type DatasetWriteMode = 'append' | 'overwrite';
54
- type RetentionPolicyType = 'retain_everything';
56
+ type ExpressionlessRetentionPolicyType = 'retain_everything' | 'expire_everything';
57
+ type ExpressionedRetentionPolicyType = 'retain_when' | 'expire_when';
55
58
  type SchemaType = 'object' | 'value';
56
- interface RetentionPolicy {
57
- type: RetentionPolicyType;
58
- }
59
+ export declare enum Operator {
60
+ GreaterThan = ">",
61
+ LessThan = "<",
62
+ GreaterThanOrEqualTo = ">=",
63
+ LessThanOrEqualTo = "<="
64
+ }
65
+ export type RetentionPolicy = {
66
+ type: ExpressionlessRetentionPolicyType;
67
+ } | {
68
+ type: ExpressionedRetentionPolicyType;
69
+ expression?: {
70
+ type: 'snapshot_age';
71
+ operator: Operator;
72
+ period: string;
73
+ };
74
+ };
59
75
  interface SchemaFileConfig {
60
76
  type: SchemaFileConfigType;
61
77
  delimiter?: string;
@@ -1 +1,7 @@
1
- export {};
1
+ export var Operator;
2
+ (function (Operator) {
3
+ Operator["GreaterThan"] = ">";
4
+ Operator["LessThan"] = "<";
5
+ Operator["GreaterThanOrEqualTo"] = ">=";
6
+ Operator["LessThanOrEqualTo"] = "<=";
7
+ })(Operator || (Operator = {}));
package/build/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { DatasetApi } from './datasets';
3
3
  import { HealthCheckApi } from './health';
4
4
  import { RosettaStoneApi } from './rosetta-stone';
5
5
  import { type Environment, type Config, type ApiRecords, type MonetaryAmount } from './types';
6
- import { type DatasetTableSummaryAPIResponse, type Dataset, type DatasetTableSummary, type FilePerSnapshotResponse } from './datasets/types';
6
+ import type { DatasetTableSummaryAPIResponse, Dataset, DatasetTableSummary, FilePerSnapshotResponse, RetentionPolicy } from './datasets/types';
7
7
  import { type HealthCheckResult } from './health/types';
8
8
  import { type SampleRecords } from './rosetta-stone/types';
9
9
  import { AttributeApi } from './attributes';
@@ -31,4 +31,4 @@ declare class NarrativeApi extends BaseApi {
31
31
  }
32
32
  interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi {
33
33
  }
34
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, type App, type Resource, type UploadsResponse, type PingStatus, type Attribute, type ShallowAttribute, type RefAttribute, type SubAttribute, type PrimitiveAttribute, type ArrayAttribute, type ObjectAttribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type Nql, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression, type DataStream, type DataRules, type ColumnSet, type ColumnWithFilterAndExport, type AttributeSet, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type ForecastBody, type ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, type ConversationMessages, type ConversationSystemMessage, type ConversationUserMessage, type RosettaRequestMessage, type ConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, type RosettaResponseMessage, type ConversationAssistantMessageWithoutFunctionCall };
34
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, type App, type Resource, type UploadsResponse, type PingStatus, type Attribute, type ShallowAttribute, type RefAttribute, type SubAttribute, type PrimitiveAttribute, type ArrayAttribute, type ObjectAttribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type Nql, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression, type DataStream, type DataRules, type ColumnSet, type ColumnWithFilterAndExport, type AttributeSet, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type ForecastBody, type ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, type ConversationMessages, type ConversationSystemMessage, type ConversationUserMessage, type RosettaRequestMessage, type ConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, type RosettaResponseMessage, type ConversationAssistantMessageWithoutFunctionCall, type RetentionPolicy };
@@ -245,7 +245,7 @@ export declare const NqlFilterBinaryExpressionObj: z.ZodObject<{
245
245
  table: string;
246
246
  };
247
247
  } | undefined);
248
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
248
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
249
249
  }, {
250
250
  left: (string | number | boolean | {
251
251
  field: string;
@@ -273,7 +273,7 @@ export declare const NqlFilterBinaryExpressionObj: z.ZodObject<{
273
273
  table: string;
274
274
  };
275
275
  } | undefined);
276
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
276
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
277
277
  }>;
278
278
  export declare const NqlFilterExpressionObj: z.ZodUnion<[z.ZodObject<{
279
279
  field: z.ZodObject<{
@@ -399,7 +399,7 @@ export declare const NqlFilterExpressionObj: z.ZodUnion<[z.ZodObject<{
399
399
  table: string;
400
400
  };
401
401
  } | undefined);
402
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
402
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
403
403
  }, {
404
404
  left: (string | number | boolean | {
405
405
  field: string;
@@ -427,7 +427,7 @@ export declare const NqlFilterExpressionObj: z.ZodUnion<[z.ZodObject<{
427
427
  table: string;
428
428
  };
429
429
  } | undefined);
430
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
430
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
431
431
  }>]>;
432
432
  export type NqlFilterExpression = z.infer<typeof NqlFilterExpressionObj>;
433
433
  export declare const NqlBooleanExpressionObj: z.ZodEnum<["AND", "OR"]>;
@@ -558,7 +558,7 @@ export declare const NqlWhereObj: z.ZodEffects<z.ZodObject<{
558
558
  table: string;
559
559
  };
560
560
  } | undefined);
561
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
561
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
562
562
  }, {
563
563
  left: (string | number | boolean | {
564
564
  field: string;
@@ -586,7 +586,7 @@ export declare const NqlWhereObj: z.ZodEffects<z.ZodObject<{
586
586
  table: string;
587
587
  };
588
588
  } | undefined);
589
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
589
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
590
590
  }>]>, "many">;
591
591
  }, "strip", z.ZodTypeAny, {
592
592
  booleanExpressions: ("AND" | "OR")[];
@@ -626,7 +626,7 @@ export declare const NqlWhereObj: z.ZodEffects<z.ZodObject<{
626
626
  table: string;
627
627
  };
628
628
  } | undefined);
629
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
629
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
630
630
  })[];
631
631
  }, {
632
632
  booleanExpressions: ("AND" | "OR")[];
@@ -666,7 +666,7 @@ export declare const NqlWhereObj: z.ZodEffects<z.ZodObject<{
666
666
  table: string;
667
667
  };
668
668
  } | undefined);
669
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
669
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
670
670
  })[];
671
671
  }>, {
672
672
  booleanExpressions: ("AND" | "OR")[];
@@ -706,7 +706,7 @@ export declare const NqlWhereObj: z.ZodEffects<z.ZodObject<{
706
706
  table: string;
707
707
  };
708
708
  } | undefined);
709
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
709
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
710
710
  })[];
711
711
  }, {
712
712
  booleanExpressions: ("AND" | "OR")[];
@@ -746,7 +746,7 @@ export declare const NqlWhereObj: z.ZodEffects<z.ZodObject<{
746
746
  table: string;
747
747
  };
748
748
  } | undefined);
749
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
749
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
750
750
  })[];
751
751
  }>;
752
752
  export type NqlWhere = z.infer<typeof NqlWhereObj>;
@@ -914,7 +914,7 @@ export declare const NqlObj: z.ZodObject<{
914
914
  table: string;
915
915
  };
916
916
  } | undefined);
917
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
917
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
918
918
  }, {
919
919
  left: (string | number | boolean | {
920
920
  field: string;
@@ -942,7 +942,7 @@ export declare const NqlObj: z.ZodObject<{
942
942
  table: string;
943
943
  };
944
944
  } | undefined);
945
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
945
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
946
946
  }>]>, "many">;
947
947
  }, "strip", z.ZodTypeAny, {
948
948
  booleanExpressions: ("AND" | "OR")[];
@@ -982,7 +982,7 @@ export declare const NqlObj: z.ZodObject<{
982
982
  table: string;
983
983
  };
984
984
  } | undefined);
985
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
985
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
986
986
  })[];
987
987
  }, {
988
988
  booleanExpressions: ("AND" | "OR")[];
@@ -1022,7 +1022,7 @@ export declare const NqlObj: z.ZodObject<{
1022
1022
  table: string;
1023
1023
  };
1024
1024
  } | undefined);
1025
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1025
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1026
1026
  })[];
1027
1027
  }>, {
1028
1028
  booleanExpressions: ("AND" | "OR")[];
@@ -1062,7 +1062,7 @@ export declare const NqlObj: z.ZodObject<{
1062
1062
  table: string;
1063
1063
  };
1064
1064
  } | undefined);
1065
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1065
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1066
1066
  })[];
1067
1067
  }, {
1068
1068
  booleanExpressions: ("AND" | "OR")[];
@@ -1102,7 +1102,7 @@ export declare const NqlObj: z.ZodObject<{
1102
1102
  table: string;
1103
1103
  };
1104
1104
  } | undefined);
1105
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1105
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1106
1106
  })[];
1107
1107
  }>;
1108
1108
  limit: z.ZodObject<{
@@ -1173,7 +1173,7 @@ export declare const NqlObj: z.ZodObject<{
1173
1173
  table: string;
1174
1174
  };
1175
1175
  } | undefined);
1176
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1176
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1177
1177
  })[];
1178
1178
  };
1179
1179
  limit: {
@@ -1237,7 +1237,7 @@ export declare const NqlObj: z.ZodObject<{
1237
1237
  table: string;
1238
1238
  };
1239
1239
  } | undefined);
1240
- operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1240
+ operator: ">" | "<" | ">=" | "<=" | "=" | "!=" | "IN" | "NOT IN" | "LIKE" | "NOT LIKE";
1241
1241
  })[];
1242
1242
  };
1243
1243
  limit: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.102",
3
+ "version": "0.0.104",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",