@narrative.io/data-collaboration-sdk-ts 0.0.55 → 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.
@@ -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
@@ -21,8 +21,9 @@ 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 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 };
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",