@narrative.io/data-collaboration-sdk-ts 0.0.54 → 0.0.56
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/authentication/index.d.ts +23 -0
- package/build/authentication/index.js +33 -0
- package/build/authentication/types.d.ts +24 -0
- package/build/authentication/types.js +1 -0
- package/build/index.d.ts +4 -3
- package/build/index.js +3 -2
- package/build/nql/index.d.ts +2 -2
- package/build/nql/types.d.ts +27 -0
- package/build/nql/types.js +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseApi } from '../base-api';
|
|
2
|
+
import { type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A class for accessing the Authentication API
|
|
5
|
+
* @extends BaseApi
|
|
6
|
+
*/
|
|
7
|
+
declare class AuthenticationApi extends BaseApi {
|
|
8
|
+
/**
|
|
9
|
+
* Logs in the user.
|
|
10
|
+
*
|
|
11
|
+
* @param {LoginRequest} loginRequest - The login request object.
|
|
12
|
+
* @returns {Promise<LoginResponse>} - A promise that resolves to the login response.
|
|
13
|
+
*/
|
|
14
|
+
login(loginRequest: LoginRequest): Promise<LoginResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Registers a new user.
|
|
17
|
+
*
|
|
18
|
+
* @param {RegisterRequest} registerRequest - The register request object.
|
|
19
|
+
* @returns {Promise<RegisterResponse>} - A promise that resolves to the register response.
|
|
20
|
+
*/
|
|
21
|
+
register(registerRequest: RegisterRequest): Promise<RegisterResponse>;
|
|
22
|
+
}
|
|
23
|
+
export { type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, AuthenticationApi };
|
|
@@ -0,0 +1,33 @@
|
|
|
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 = 'authentication';
|
|
9
|
+
/**
|
|
10
|
+
* A class for accessing the Authentication API
|
|
11
|
+
* @extends BaseApi
|
|
12
|
+
*/
|
|
13
|
+
class AuthenticationApi extends BaseApi {
|
|
14
|
+
/**
|
|
15
|
+
* Logs in the user.
|
|
16
|
+
*
|
|
17
|
+
* @param {LoginRequest} loginRequest - The login request object.
|
|
18
|
+
* @returns {Promise<LoginResponse>} - A promise that resolves to the login response.
|
|
19
|
+
*/
|
|
20
|
+
async login(loginRequest) {
|
|
21
|
+
return await this.post(`${resourceName}/login`, loginRequest);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Registers a new user.
|
|
25
|
+
*
|
|
26
|
+
* @param {RegisterRequest} registerRequest - The register request object.
|
|
27
|
+
* @returns {Promise<RegisterResponse>} - A promise that resolves to the register response.
|
|
28
|
+
*/
|
|
29
|
+
async register(registerRequest) {
|
|
30
|
+
return await this.post(`${resourceName}/register`, registerRequest);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export { AuthenticationApi };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface LoginRequest {
|
|
2
|
+
stytch_token: string;
|
|
3
|
+
session_duration_minutes?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface LoginResponse {
|
|
6
|
+
user: LoggedInUser;
|
|
7
|
+
api_token: string;
|
|
8
|
+
stytch_session_token: string;
|
|
9
|
+
stytch_session_jwt: string;
|
|
10
|
+
}
|
|
11
|
+
export interface RegisterRequest {
|
|
12
|
+
stytch_token: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
company_name: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RegisterResponse {
|
|
17
|
+
user_id: number;
|
|
18
|
+
}
|
|
19
|
+
export interface LoggedInUser {
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
company_id: number;
|
|
23
|
+
company_name: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/index.d.ts
CHANGED
|
@@ -16,13 +16,14 @@ 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 Nql, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression } 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 { AuthenticationApi, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser } from './authentication';
|
|
24
25
|
declare class NarrativeApi extends BaseApi {
|
|
25
26
|
}
|
|
26
|
-
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi {
|
|
27
|
+
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi {
|
|
27
28
|
}
|
|
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
|
|
29
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, 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, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, getNqlObject, buildNql };
|
package/build/index.js
CHANGED
|
@@ -15,7 +15,8 @@ import { DataStreamsApi } from './data-streams';
|
|
|
15
15
|
import { ForecastApi } from './forecast';
|
|
16
16
|
import { ContractsApi } from './contracts';
|
|
17
17
|
import { getNqlObject, buildNql } from './nql/NQLParser';
|
|
18
|
+
import { AuthenticationApi } from './authentication';
|
|
18
19
|
class NarrativeApi extends BaseApi {
|
|
19
20
|
}
|
|
20
|
-
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi]);
|
|
21
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, getNqlObject, buildNql };
|
|
21
|
+
applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi]);
|
|
22
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, getNqlObject, buildNql };
|
package/build/nql/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseApi } from '../base-api';
|
|
2
2
|
import type { Plan } from './SubstraitParser';
|
|
3
|
-
import type { Nql, NqlCompileResult, NqlQueryInput,
|
|
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
|
|
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 };
|
package/build/nql/types.d.ts
CHANGED
|
@@ -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;
|
|
@@ -1256,3 +1282,4 @@ export interface NqlCompileResult {
|
|
|
1256
1282
|
sql: string;
|
|
1257
1283
|
mappingErrors?: NqlMappingErrors;
|
|
1258
1284
|
}
|
|
1285
|
+
export {};
|
package/build/nql/types.js
CHANGED
|
@@ -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
|
|
54
|
+
const NqlExpressionObj = z.union([NqlFieldObj, z.string(), z.number(), z.boolean()]);
|
|
55
55
|
export const NqlFilterBinaryExpressionObj = z.object({
|
|
56
|
-
left:
|
|
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:
|
|
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.');
|