@narrative.io/data-collaboration-sdk-ts 0.0.148 → 0.0.150

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.
package/build/index.d.ts CHANGED
@@ -4,6 +4,7 @@ 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
6
  import type { DatasetTableSummaryAPIResponse, Dataset, DatasetTableSummary, FilePerSnapshotResponse, RetentionPolicy, UpdateDatasetRequest, SchemaFileConfigType, SchemaPropertiesType, DatasetStatus, DatasetWriteMode, SchemaFileConfig, SchemaProperties, SchemaProperty, SchemaPrimitiveProperty, SchemaObjectProperty, SchemaArrayProperty, SchemaArrayItems, SchemaArrayItemsPrimitive, SchemaArrayItemsObject, SchemaArrayItemsArray, Schema, AdvancedStatisticsMetadata, SnapshotRange, Configuration, Columns, ColumnSummary, ColumnStatistics, BasicStatistics, AdvancedStatistics, Histogram, Value, CreateDatasetRequest, IngestDatasetFileRequest } from "./datasets/types";
7
+ import { type User } from "./whoami/types";
7
8
  import { type HealthCheckResult } from "./health/types";
8
9
  import { type SampleRecords } from "./rosetta-stone/types";
9
10
  import { AttributeApi } from "./attributes";
@@ -30,8 +31,9 @@ import { MappingsApi } from "./mappings";
30
31
  import { type AccessRule, AccessRulesApi } from "./access-rules/";
31
32
  import { type Subscription, type SubscriptionDetails, type DataStreamSubscriptionDetails, type MarketplaceSubscriptionDetails, type SubscriptionOutput, type SubscriptionType, type SubscriptionStatus, type SubscriptionBudget, SubscriptionsApi } from "./subscriptions";
32
33
  import { type Job, JobsApi } from "./jobs";
34
+ import { WhoAmIApi } from "./whoami";
33
35
  declare class NarrativeApi extends BaseApi {
34
36
  }
35
- interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi {
37
+ interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi, WhoAmIApi {
36
38
  }
37
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, 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 UpdateDatasetRequest, type SchemaFileConfigType, type SchemaPropertiesType, type DatasetStatus, type DatasetWriteMode, type SchemaFileConfig, type SchemaProperties, type SchemaProperty, type SchemaPrimitiveProperty, type SchemaObjectProperty, type SchemaArrayProperty, type SchemaArrayItems, type SchemaArrayItemsPrimitive, type SchemaArrayItemsObject, type SchemaArrayItemsArray, type Schema, type AdvancedStatisticsMetadata, type SnapshotRange, type Configuration, type Columns, type ColumnSummary, type ColumnStatistics, type BasicStatistics, type AdvancedStatistics, type Histogram, type Value, type CreateDatasetRequest, type IngestDatasetFileRequest, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type CompiledNql, type CreateMaterializedView, type Deduplication, type Explain, type Expression, type Raw, type Select, type Statement, type Table, type Nql, type NqlAst, 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, type AccessRule, type Subscription, type SubscriptionDetails, type DataStreamSubscriptionDetails, type MarketplaceSubscriptionDetails, type SubscriptionOutput, type SubscriptionType, type SubscriptionStatus, type SubscriptionBudget, type Job, compileStatement, parseStatement, };
39
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, WhoAmIApi, 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 UpdateDatasetRequest, type SchemaFileConfigType, type SchemaPropertiesType, type DatasetStatus, type DatasetWriteMode, type SchemaFileConfig, type SchemaProperties, type SchemaProperty, type SchemaPrimitiveProperty, type SchemaObjectProperty, type SchemaArrayProperty, type SchemaArrayItems, type SchemaArrayItemsPrimitive, type SchemaArrayItemsObject, type SchemaArrayItemsArray, type Schema, type AdvancedStatisticsMetadata, type SnapshotRange, type Configuration, type Columns, type ColumnSummary, type ColumnStatistics, type BasicStatistics, type AdvancedStatistics, type Histogram, type Value, type CreateDatasetRequest, type IngestDatasetFileRequest, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type CompiledNql, type CreateMaterializedView, type Deduplication, type Explain, type Expression, type Raw, type Select, type Statement, type Table, type Nql, type NqlAst, 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, type AccessRule, type Subscription, type SubscriptionDetails, type DataStreamSubscriptionDetails, type MarketplaceSubscriptionDetails, type SubscriptionOutput, type SubscriptionType, type SubscriptionStatus, type SubscriptionBudget, type Job, type User, compileStatement, parseStatement, };
package/build/index.js CHANGED
@@ -23,6 +23,7 @@ import { MappingsApi } from "./mappings";
23
23
  import { AccessRulesApi } from "./access-rules/";
24
24
  import { SubscriptionsApi, } from "./subscriptions";
25
25
  import { JobsApi } from "./jobs";
26
+ import { WhoAmIApi } from "./whoami";
26
27
  class NarrativeApi extends BaseApi {
27
28
  }
28
29
  applyMixins(NarrativeApi, [
@@ -46,5 +47,6 @@ applyMixins(NarrativeApi, [
46
47
  AccessRulesApi,
47
48
  SubscriptionsApi,
48
49
  JobsApi,
50
+ WhoAmIApi,
49
51
  ]);
50
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, compileStatement, parseStatement, };
52
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, WhoAmIApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, compileStatement, parseStatement, };
@@ -1,15 +1,15 @@
1
1
  import * as ast from "./Ast";
2
- type Statement = CreateMaterializedView | Explain;
3
- interface CreateMaterializedView {
2
+ export type Statement = CreateMaterializedView | Explain;
3
+ export interface CreateMaterializedView {
4
4
  type: "create_materialized_view";
5
5
  name: string;
6
6
  select: Select;
7
7
  }
8
- interface Explain {
8
+ export interface Explain {
9
9
  type: "explain";
10
10
  query: Select;
11
11
  }
12
- interface Select {
12
+ export interface Select {
13
13
  type: "select";
14
14
  budget: ast.NqlBudget | null;
15
15
  columns: Expression[];
@@ -17,184 +17,183 @@ interface Select {
17
17
  from: Table[] | Raw;
18
18
  where: BooleanExpression | Raw | null;
19
19
  }
20
- type Expression = ArithmeticExpression | BooleanExpression | ColumnRef | Lit | FunctionCall | StringExpression | UnaryMinus | Raw;
21
- interface Raw {
20
+ export type Expression = ArithmeticExpression | BooleanExpression | ColumnRef | Lit | FunctionCall | StringExpression | UnaryMinus | Raw;
21
+ export interface Raw {
22
22
  type: "nql";
23
23
  as?: string;
24
24
  nql: string;
25
25
  }
26
- interface Deduplication {
26
+ export interface Deduplication {
27
27
  type: "deduplication";
28
28
  expressions: Expression[];
29
29
  }
30
- type ColumnRef = AttributeRef | DatasetColumnRef | RawRef;
31
- type ArithmeticExpression = BinaryArithmeticExpression | UnaryMinus;
32
- type BinaryArithmeticExpression = Add | Divide | Multiply | Subtract;
33
- type BooleanExpression = And | Between | Equals | NotEquals | Gt | Gte | In | IsNull | Like | Lt | Lte | Not | Or;
34
- type StringExpression = Concat;
35
- type Table = RosettaTable | DatasetTable | RawTable;
36
- interface RosettaTable {
30
+ export type ColumnRef = AttributeRef | DatasetColumnRef | RawRef;
31
+ export type ArithmeticExpression = BinaryArithmeticExpression | UnaryMinus;
32
+ export type BinaryArithmeticExpression = Add | Divide | Multiply | Subtract;
33
+ export type BooleanExpression = And | Between | Equals | NotEquals | Gt | Gte | In | IsNull | Like | Lt | Lte | Not | Or;
34
+ export type StringExpression = Concat;
35
+ export type Table = RosettaTable | DatasetTable | RawTable;
36
+ export interface RosettaTable {
37
37
  type: "rosetta_stone";
38
38
  as?: string;
39
39
  join?: Join;
40
40
  }
41
- interface DatasetTable {
41
+ export interface DatasetTable {
42
42
  type: "dataset";
43
43
  as?: string;
44
44
  datasetId: number;
45
45
  join?: Join;
46
46
  }
47
- interface RawTable {
47
+ export interface RawTable {
48
48
  type: "raw_table";
49
49
  as?: string;
50
50
  nql: string;
51
51
  join?: Join;
52
52
  }
53
- interface Join {
53
+ export interface Join {
54
54
  type: "join";
55
55
  condition: BooleanExpression | Raw | null;
56
56
  conditionType: ast.NqlJoinConditionType;
57
57
  joinType: ast.NqlJoinType;
58
58
  }
59
- interface AttributeRef {
59
+ export interface AttributeRef {
60
60
  type: "attribute_ref";
61
61
  as?: string;
62
62
  name: string;
63
63
  column: string;
64
64
  }
65
- interface DatasetColumnRef {
65
+ export interface DatasetColumnRef {
66
66
  type: "dataset_column_ref";
67
67
  as?: string;
68
68
  column: string;
69
69
  datasetId: number;
70
70
  }
71
- interface RawRef {
71
+ export interface RawRef {
72
72
  type: "raw_ref";
73
73
  as?: string;
74
74
  nql: string;
75
75
  }
76
- interface Lit {
76
+ export interface Lit {
77
77
  type: "lit";
78
78
  as?: string;
79
79
  value_type: ast.NqlSimpleType;
80
80
  value: string | null;
81
81
  }
82
- interface FunctionCall {
82
+ export interface FunctionCall {
83
83
  type: "function";
84
84
  as?: string;
85
85
  args: Expression[];
86
86
  name: string;
87
87
  }
88
- interface Add {
88
+ export interface Add {
89
89
  type: "+";
90
90
  as?: string;
91
91
  operands: Expression[];
92
92
  }
93
- interface Divide {
93
+ export interface Divide {
94
94
  type: "/";
95
95
  as?: string;
96
96
  operands: Expression[];
97
97
  }
98
- interface Multiply {
98
+ export interface Multiply {
99
99
  type: "*";
100
100
  as?: string;
101
101
  operands: Expression[];
102
102
  }
103
- interface Subtract {
103
+ export interface Subtract {
104
104
  type: "-";
105
105
  as?: string;
106
106
  operands: Expression[];
107
107
  }
108
- interface UnaryMinus {
108
+ export interface UnaryMinus {
109
109
  type: "unary_-";
110
110
  as?: string;
111
111
  operand: Expression;
112
112
  }
113
- interface And {
113
+ export interface And {
114
114
  type: "and";
115
115
  as?: string;
116
116
  operands: Expression[];
117
117
  }
118
- interface Or {
118
+ export interface Or {
119
119
  type: "or";
120
120
  as?: string;
121
121
  operands: Expression[];
122
122
  }
123
- interface Not {
123
+ export interface Not {
124
124
  type: "not";
125
125
  as?: string;
126
126
  operand: BooleanExpression | Raw;
127
127
  }
128
128
  /** Implicitly we only support asymmetric betweens. */
129
- interface Between {
129
+ export interface Between {
130
130
  type: "between";
131
131
  as?: string;
132
132
  operand: Expression;
133
133
  lower: Expression;
134
134
  upper: Expression;
135
135
  }
136
- interface Equals {
136
+ export interface Equals {
137
137
  type: "=";
138
138
  as?: string;
139
139
  left: Expression;
140
140
  right: Expression;
141
141
  }
142
- interface NotEquals {
142
+ export interface NotEquals {
143
143
  type: "<>";
144
144
  as?: string;
145
145
  left: Expression;
146
146
  right: Expression;
147
147
  }
148
- interface Lt {
148
+ export interface Lt {
149
149
  type: "<";
150
150
  as?: string;
151
151
  left: Expression;
152
152
  right: Expression;
153
153
  }
154
- interface Lte {
154
+ export interface Lte {
155
155
  type: "<=";
156
156
  as?: string;
157
157
  left: Expression;
158
158
  right: Expression;
159
159
  }
160
- interface Gt {
160
+ export interface Gt {
161
161
  type: ">";
162
162
  as?: string;
163
163
  left: Expression;
164
164
  right: Expression;
165
165
  }
166
- interface Gte {
166
+ export interface Gte {
167
167
  type: ">=";
168
168
  as?: string;
169
169
  left: Expression;
170
170
  right: Expression;
171
171
  }
172
- interface In {
172
+ export interface In {
173
173
  type: "in";
174
174
  as?: string;
175
175
  negated: boolean;
176
176
  expression: Expression;
177
177
  values: Expression[] | Raw;
178
178
  }
179
- interface IsNull {
179
+ export interface IsNull {
180
180
  type: "is_null";
181
181
  as?: string;
182
182
  negated: boolean;
183
183
  operand: Expression;
184
184
  }
185
- interface Like {
185
+ export interface Like {
186
186
  type: "like";
187
187
  as?: string;
188
188
  negated: boolean;
189
189
  value: Expression;
190
190
  pattern: string;
191
191
  }
192
- interface Concat {
192
+ export interface Concat {
193
193
  type: "||";
194
194
  as?: string;
195
195
  operands: Expression[];
196
196
  }
197
- export type { CreateMaterializedView, Deduplication, Explain, Expression, Raw, Select, Statement, Table, };
198
197
  export declare function parseStatement(n: ast.NqlAst): Statement | Raw;
199
198
  export declare function parseCreateMaterializedView(n: ast.NqlCreateMaterializedView): CreateMaterializedView;
200
199
  export declare function parseExplain(n: ast.NqlExplain): Explain | Raw;
@@ -0,0 +1,14 @@
1
+ import { BaseApi } from "../base-api";
2
+ import { type User } from "../whoami/types";
3
+ /**
4
+ * A class for accessing the Ping API.
5
+ * @extends BaseApi
6
+ */
7
+ export declare class WhoAmIApi extends BaseApi {
8
+ /**
9
+ * The the current users information from the API.
10
+ *
11
+ * @returns {Promise<User>} A promise that resolves with the result of the WhoAmI call.
12
+ */
13
+ getWhoAmI(): Promise<User>;
14
+ }
@@ -0,0 +1,22 @@
1
+ import { BaseApi } from "../base-api";
2
+ /**
3
+ * The name of the resource to be used in API requests.
4
+ * @constant
5
+ * @private
6
+ * @type {string}
7
+ */
8
+ const resourceName = "whoami";
9
+ /**
10
+ * A class for accessing the Ping API.
11
+ * @extends BaseApi
12
+ */
13
+ export class WhoAmIApi extends BaseApi {
14
+ /**
15
+ * The the current users information from the API.
16
+ *
17
+ * @returns {Promise<User>} A promise that resolves with the result of the WhoAmI call.
18
+ */
19
+ async getWhoAmI() {
20
+ return await this.get(resourceName);
21
+ }
22
+ }
@@ -0,0 +1,30 @@
1
+ export interface User {
2
+ user_id: number;
3
+ name: string;
4
+ company_access_list: number[];
5
+ current_company_scope: CompanyScope;
6
+ permissions: Permission[];
7
+ created_at: string;
8
+ created_by: null | string;
9
+ last_updated_at: string;
10
+ last_updated_by: null | string;
11
+ }
12
+ export interface CompanyScope {
13
+ company_id: number;
14
+ slug: null | string;
15
+ name: string;
16
+ short_description: null | string;
17
+ long_description: null | string;
18
+ contact_email: null | string;
19
+ website: null | string;
20
+ data_shop_url: null | string;
21
+ twitter_link: null | string;
22
+ linkedin_link: null | string;
23
+ image_url: string;
24
+ status: string;
25
+ visibility: string;
26
+ }
27
+ export interface Permission {
28
+ resource: string;
29
+ access: string[];
30
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.148",
3
+ "version": "0.0.150",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",
@@ -23,8 +23,8 @@
23
23
  "@babel/core": "^7.22.5",
24
24
  "@babel/preset-env": "^7.22.5",
25
25
  "@babel/preset-typescript": "^7.18.6",
26
- "@commitlint/cli": "^17.4.2",
27
- "@commitlint/config-conventional": "^17.4.2",
26
+ "@commitlint/cli": "^18.2.0",
27
+ "@commitlint/config-conventional": "^18.1.0",
28
28
  "@types/jest": "^29.5.0",
29
29
  "babel-jest": "^29.4.3",
30
30
  "eslint-config-prettier": "^9.0.0",