@narrative.io/data-collaboration-sdk-ts 0.0.53 → 0.0.55

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
@@ -16,14 +16,13 @@ import { type PingStatus } from './ping/types';
16
16
  import { type Product, ProductsApi } from './products';
17
17
  import { CompanyInfoApi, type CompanyInfo } from './company-info';
18
18
  import { InstallationsApi, type Installation } from './installations';
19
- import { NqlApi, type NqlCompileResult, type NqlResult } from './nql';
19
+ import { NqlApi, type Nql, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression } from './nql';
20
20
  import { DataStreamsApi, type DataStream } from './data-streams';
21
21
  import { ForecastApi, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState } from './forecast';
22
22
  import { ContractsApi, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView } from './contracts';
23
23
  import { getNqlObject, buildNql } from './nql/NQLParser';
24
- import type { Nql, NqlQueryInput } from './nql/types';
25
24
  declare class NarrativeApi extends BaseApi {
26
25
  }
27
26
  interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi {
28
27
  }
29
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, type Resource, type UploadsResponse, type PingStatus, type Attribute, 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 NqlQueryInput, type NqlResult, type NqlCompileResult, type DataStream, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type Nql, getNqlObject, buildNql };
28
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, type Resource, type UploadsResponse, type PingStatus, type Attribute, 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 ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, getNqlObject, buildNql };
@@ -1,6 +1,6 @@
1
1
  import { BaseApi } from '../base-api';
2
2
  import type { Plan } from './SubstraitParser';
3
- import type { Nql, NqlCompileResult, NqlQueryInput, NqlResult } from './types';
3
+ import type { Nql, NqlField, NqlResult, NqlCompileResult, NqlQueryInput, NqlExpression, NqlWhere, NqlFilterBinaryExpression, NqlBooleanExpression, NqlFilterExpression, NqlFilterUnaryExpression } from './types';
4
4
  /**
5
5
  * A class for accessing the NQL API.
6
6
  * @extends BaseApi
@@ -35,4 +35,4 @@ declare class NqlApi extends BaseApi {
35
35
  */
36
36
  getNqlByJobId(id: string): Promise<NqlResult>;
37
37
  }
38
- export { NqlApi, type NqlResult, type NqlQueryInput, type NqlCompileResult, type Nql };
38
+ export { NqlApi, type Nql, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression };
@@ -140,6 +140,32 @@ export declare const NqlFilterUnaryExpressionObj: z.ZodObject<{
140
140
  operator: "IS NULL" | "IS NOT NULL";
141
141
  }>;
142
142
  export type NqlFilterUnaryExpression = z.infer<typeof NqlFilterUnaryExpressionObj>;
143
+ declare const NqlExpressionObj: z.ZodUnion<[z.ZodObject<{
144
+ field: z.ZodString;
145
+ table: z.ZodObject<{
146
+ database: z.ZodEnum<["narrative"]>;
147
+ table: z.ZodEnum<["rosetta_stone"]>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ database: "narrative";
150
+ table: "rosetta_stone";
151
+ }, {
152
+ database: "narrative";
153
+ table: "rosetta_stone";
154
+ }>;
155
+ }, "strip", z.ZodTypeAny, {
156
+ field: string;
157
+ table: {
158
+ database: "narrative";
159
+ table: "rosetta_stone";
160
+ };
161
+ }, {
162
+ field: string;
163
+ table: {
164
+ database: "narrative";
165
+ table: "rosetta_stone";
166
+ };
167
+ }>, z.ZodString, z.ZodNumber, z.ZodBoolean]>;
168
+ export type NqlExpression = z.infer<typeof NqlExpressionObj>;
143
169
  export declare const NqlFilterBinaryExpressionObj: z.ZodObject<{
144
170
  left: z.ZodUnion<[z.ZodObject<{
145
171
  field: z.ZodString;
@@ -724,7 +750,7 @@ export declare const NqlWhereObj: z.ZodEffects<z.ZodObject<{
724
750
  })[];
725
751
  }>;
726
752
  export type NqlWhere = z.infer<typeof NqlWhereObj>;
727
- export type NqlFilteBinaryExpression = z.infer<typeof NqlFilterBinaryExpressionObj>;
753
+ export type NqlFilterBinaryExpression = z.infer<typeof NqlFilterBinaryExpressionObj>;
728
754
  export declare const NqlObj: z.ZodObject<{
729
755
  explain: z.ZodOptional<z.ZodEnum<["EXPLAIN"]>>;
730
756
  select: z.ZodArray<z.ZodObject<{
@@ -1243,14 +1269,10 @@ export interface NqlResult {
1243
1269
  user_id: number;
1244
1270
  };
1245
1271
  result: {
1246
- success: {
1247
- result: {
1248
- forecast: {
1249
- rows: number;
1250
- cost: number;
1251
- };
1252
- };
1253
- };
1272
+ type: string;
1273
+ rows: number;
1274
+ cost: number;
1275
+ nql_type: string;
1254
1276
  };
1255
1277
  state: string;
1256
1278
  updated_at: string;
@@ -1260,3 +1282,4 @@ export interface NqlCompileResult {
1260
1282
  sql: string;
1261
1283
  mappingErrors?: NqlMappingErrors;
1262
1284
  }
1285
+ export {};
@@ -51,11 +51,11 @@ export const NqlFilterUnaryExpressionObj = z.object({
51
51
  field: NqlFieldObj,
52
52
  operator: z.enum(['IS NULL', 'IS NOT NULL']).describe('The operator to use for the filter. As a standalone operator it only expects the field to be defined.')
53
53
  });
54
- const NqlExpression = z.union([NqlFieldObj, z.string(), z.number(), z.boolean()]);
54
+ const NqlExpressionObj = z.union([NqlFieldObj, z.string(), z.number(), z.boolean()]);
55
55
  export const NqlFilterBinaryExpressionObj = z.object({
56
- left: NqlExpression,
56
+ left: NqlExpressionObj,
57
57
  operator: z.enum(['=', '!=', '>', '<', '>=', '<=', 'IN', 'NOT IN', 'LIKE', 'NOT LIKE']).describe('The operator to use for the filter. As a binary operator it expects both a left and right expression'),
58
- right: NqlExpression
58
+ right: NqlExpressionObj
59
59
  });
60
60
  export const NqlFilterExpressionObj = z.union([NqlFilterUnaryExpressionObj, NqlFilterBinaryExpressionObj]);
61
61
  export const NqlBooleanExpressionObj = z.enum(['AND', 'OR']).describe('The operator to use for the filter. As a standalone operator it only expects the field to be defined.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.53",
3
+ "version": "0.0.55",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",