@narrative.io/data-collaboration-sdk-ts 0.0.27 → 0.0.29

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/base-api.js CHANGED
@@ -13,7 +13,7 @@ export class BaseApi {
13
13
  */
14
14
  constructor(config) {
15
15
  this.apiKey = config.apiKey;
16
- this.environment = config.environment === null ? config.environment : 'prod';
16
+ this.environment = config.environment ?? 'prod';
17
17
  this.base_api = mande(`${this.getBaseUrl()}`, {
18
18
  headers: this.getHeaders()
19
19
  });
package/build/index.d.ts CHANGED
@@ -12,8 +12,9 @@ import { PingApi } from './ping';
12
12
  import { type PingStatus } from './ping/types';
13
13
  import { type Product, ProductsApi } from './products';
14
14
  import { CompanyInfoApi, type CompanyInfo } from './company-info';
15
+ import { InstallationsApi, type Installation } from './installations';
15
16
  declare class NarrativeApi extends BaseApi {
16
17
  }
17
- interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi {
18
+ interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi {
18
19
  }
19
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, 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 };
20
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, 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 };
package/build/index.js CHANGED
@@ -7,7 +7,8 @@ import { AttributeApi } from './attributes';
7
7
  import { PingApi } from './ping';
8
8
  import { ProductsApi } from './products';
9
9
  import { CompanyInfoApi } from './company-info';
10
+ import { InstallationsApi } from './installations';
10
11
  class NarrativeApi extends BaseApi {
11
12
  }
12
- applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi]);
13
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi };
13
+ applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi]);
14
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi };
@@ -0,0 +1,17 @@
1
+ import { type ApiRecords } from '../types';
2
+ import { BaseApi } from '../base-api';
3
+ import { type Installation } from './types';
4
+ /**
5
+ * @module InstallationsApi
6
+ * @description This module provides methods for fetching installation records.
7
+ * @extends BaseApi
8
+ */
9
+ declare class InstallationsApi extends BaseApi {
10
+ /**
11
+ * Get all installations for the current user
12
+ * @param {number} appCategory - An optional filter for app categories.
13
+ * @returns {Promise<ApiRecords<Installation>>} - Promise resolving with the list of installations.
14
+ */
15
+ getInstallations(appCategory?: string): Promise<ApiRecords<Installation>>;
16
+ }
17
+ export { type Installation, InstallationsApi };
@@ -0,0 +1,19 @@
1
+ import { BaseApi } from '../base-api';
2
+ const resourceName = 'installations';
3
+ /**
4
+ * @module InstallationsApi
5
+ * @description This module provides methods for fetching installation records.
6
+ * @extends BaseApi
7
+ */
8
+ class InstallationsApi extends BaseApi {
9
+ /**
10
+ * Get all installations for the current user
11
+ * @param {number} appCategory - An optional filter for app categories.
12
+ * @returns {Promise<ApiRecords<Installation>>} - Promise resolving with the list of installations.
13
+ */
14
+ async getInstallations(appCategory) {
15
+ const appCategoryQuery = `?app_category=${appCategory ?? ''}`;
16
+ return await this.get(`${resourceName}${appCategoryQuery}`);
17
+ }
18
+ }
19
+ export { InstallationsApi };
@@ -0,0 +1,14 @@
1
+ export interface Installation {
2
+ id: number;
3
+ app_id: number;
4
+ company_id: number;
5
+ tier_id: string;
6
+ permissions: string[];
7
+ installation_time: Date;
8
+ }
9
+ export interface Permission {
10
+ acess: Access;
11
+ resource: string;
12
+ }
13
+ type Access = 'read' | 'write' | 'admin' | 'create' | 'revise';
14
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { BaseApi } from '../base-api';
2
- import { type RosettaStoneResponse, type SampleRecords } from './types';
3
- export declare class RosettaStoneApi extends BaseApi {
2
+ import type { RosettaStoneResponse, SampleRecords, SampleRecord } from './types';
3
+ declare class RosettaStoneApi extends BaseApi {
4
4
  getLabelsFromSample(sample: SampleRecords): Promise<RosettaStoneResponse[]>;
5
5
  }
6
+ export { RosettaStoneApi, type SampleRecords, type RosettaStoneResponse, type SampleRecord };
@@ -1,7 +1,8 @@
1
1
  import { BaseApi } from '../base-api';
2
2
  const resourceName = 'rosetta-stone';
3
- export class RosettaStoneApi extends BaseApi {
3
+ class RosettaStoneApi extends BaseApi {
4
4
  async getLabelsFromSample(sample) {
5
5
  return await this.post(`${resourceName}/labels/sample`, sample);
6
6
  }
7
7
  }
8
+ export { RosettaStoneApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",