@narrative.io/data-collaboration-sdk-ts 0.0.76 → 0.0.78

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.
@@ -9,7 +9,7 @@ export interface LoginResponse {
9
9
  name: string;
10
10
  company_id: number;
11
11
  company_name: string;
12
- role: number;
12
+ role: UserRole;
13
13
  };
14
14
  api_token: ApiToken;
15
15
  legacy_token: string;
@@ -1,16 +1,21 @@
1
1
  import { BaseApi } from '../base-api';
2
2
  import { type ApiRecords } from '../types';
3
- import { type CompanyInfo } from './types';
3
+ import { type CompanyInfo, type WhoAmI } from './types';
4
4
  /**
5
5
  * A class for accessing the Company Info API
6
6
  * @extends BaseApi
7
7
  */
8
8
  declare class CompanyInfoApi extends BaseApi {
9
9
  companyId: () => Promise<number>;
10
+ /**
11
+ * Get the logged in company id
12
+ * @returns {Promise<WhoAmI>}
13
+ */
14
+ whoami(): Promise<WhoAmI>;
10
15
  /**
11
16
  * Get a list of all providers in the Data Streams Market
12
17
  * @returns {Promise<ApiRecords<CompanyInfo[]>>} - Promise resolving to an array of CompanyInfo records
13
18
  */
14
19
  getAllProvidersCompanyInfo(): Promise<ApiRecords<CompanyInfo>>;
15
20
  }
16
- export { type CompanyInfo, CompanyInfoApi };
21
+ export { type CompanyInfo, type WhoAmI, CompanyInfoApi };
@@ -14,6 +14,13 @@ class CompanyInfoApi extends BaseApi {
14
14
  companyId = async () => {
15
15
  return (await this.get(`${resourceName}/whoami`)).id;
16
16
  };
17
+ /**
18
+ * Get the logged in company id
19
+ * @returns {Promise<WhoAmI>}
20
+ */
21
+ async whoami() {
22
+ return await this.get(`${resourceName}/whoami?with_user_id=true`);
23
+ }
17
24
  /**
18
25
  * Get a list of all providers in the Data Streams Market
19
26
  * @returns {Promise<ApiRecords<CompanyInfo[]>>} - Promise resolving to an array of CompanyInfo records
@@ -11,3 +11,7 @@ export interface CompanyInfo {
11
11
  contact: string;
12
12
  created_at: string;
13
13
  }
14
+ export interface WhoAmI {
15
+ id: number;
16
+ userId?: number;
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",