@qelos/sdk 3.7.4 → 3.8.0

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.
@@ -8,6 +8,7 @@ import QlManageConfigurations from './manage-configurations';
8
8
  import QlAdminWorkspaces from './workspaces';
9
9
  import QlManageBlueprints from './manage-blueprints';
10
10
  import { QlRoles } from './roles';
11
+ import QlIntegrationSources from './integration-sources';
11
12
  export default class QelosAdministratorSDK<T = any> extends QelosSDK {
12
13
  users: QlUsers<T>;
13
14
  manageLayouts: QlManageLayouts;
@@ -17,6 +18,7 @@ export default class QelosAdministratorSDK<T = any> extends QelosSDK {
17
18
  events: QlEvents;
18
19
  adminWorkspaces: QlAdminWorkspaces;
19
20
  roles: QlRoles;
21
+ integrationSources: QlIntegrationSources;
20
22
  constructor(options: QelosSDKOptions);
21
23
  impersonateUser(userId: string, workspaceId?: string): void;
22
24
  clearImpersonation(): void;
@@ -7,6 +7,7 @@ import QlManageConfigurations from './manage-configurations';
7
7
  import QlAdminWorkspaces from './workspaces';
8
8
  import QlManageBlueprints from './manage-blueprints';
9
9
  import { QlRoles } from './roles';
10
+ import QlIntegrationSources from './integration-sources';
10
11
  export default class QelosAdministratorSDK extends QelosSDK {
11
12
  users;
12
13
  manageLayouts;
@@ -15,7 +16,8 @@ export default class QelosAdministratorSDK extends QelosSDK {
15
16
  drafts;
16
17
  events;
17
18
  adminWorkspaces;
18
- roles; // Added the roles property
19
+ roles;
20
+ integrationSources;
19
21
  constructor(options) {
20
22
  super(options);
21
23
  this.users = new QlUsers(options);
@@ -25,7 +27,8 @@ export default class QelosAdministratorSDK extends QelosSDK {
25
27
  this.drafts = new QlDrafts(options);
26
28
  this.events = new QlEvents(options);
27
29
  this.adminWorkspaces = new QlAdminWorkspaces(options);
28
- this.roles = new QlRoles(options); //Instantiated the QlRoles class inside the constructor
30
+ this.roles = new QlRoles(options);
31
+ this.integrationSources = new QlIntegrationSources(options);
29
32
  if (!options.extraQueryParams) {
30
33
  options.extraQueryParams = () => ({
31
34
  bypassAdmin: 'true'
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/administrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,sBAAsB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,kBAAkB,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,qBAA+B,SAAQ,QAAQ;IAClE,KAAK,CAAa;IAClB,aAAa,CAAkB;IAC/B,oBAAoB,CAAyB;IAC7C,gBAAgB,CAAqB;IACrC,MAAM,CAAW;IACjB,MAAM,CAAW;IACjB,eAAe,CAAoB;IACnC,KAAK,CAAU,CAAC,2BAA2B;IAE3C,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,IAAI,OAAO,CAAI,OAAO,CAAC,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,oBAAoB,GAAG,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,gBAAgB,GAAG,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,IAAI,iBAAiB,CAAC,OAA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C;CACF"}
@@ -0,0 +1,15 @@
1
+ import { QelosSDKOptions, RequestExtra } from '../types';
2
+ import BaseSDK from '../base-sdk';
3
+ import { IIntegrationSource } from '@qelos/global-types';
4
+ export default class QlIntegrationSources extends BaseSDK {
5
+ private options;
6
+ private relativePath;
7
+ constructor(options: QelosSDKOptions);
8
+ getIntegrationSource(sourceId: string, extra?: RequestExtra): Promise<IIntegrationSource>;
9
+ getList(query?: {
10
+ kind?: string;
11
+ }, extra?: RequestExtra): Promise<IIntegrationSource[]>;
12
+ remove(sourceId: string): Promise<any>;
13
+ update(sourceId: string, changes: Partial<Pick<IIntegrationSource, 'name' | 'labels' | 'metadata' | 'authentication'>>): Promise<IIntegrationSource>;
14
+ create(source: Pick<IIntegrationSource, 'name' | 'labels' | 'metadata' | 'authentication'>): Promise<IIntegrationSource>;
15
+ }
@@ -0,0 +1,33 @@
1
+ import BaseSDK from '../base-sdk';
2
+ export default class QlIntegrationSources extends BaseSDK {
3
+ options;
4
+ relativePath = '/api/integration-sources';
5
+ constructor(options) {
6
+ super(options);
7
+ this.options = options;
8
+ }
9
+ getIntegrationSource(sourceId, extra) {
10
+ return this.callJsonApi(`${this.relativePath}/${sourceId}`, extra);
11
+ }
12
+ getList(query, extra) {
13
+ return this.callJsonApi(this.relativePath + this.getQueryParams(query), extra);
14
+ }
15
+ remove(sourceId) {
16
+ return this.callApi(`${this.relativePath}/${sourceId}`, { method: 'delete' });
17
+ }
18
+ update(sourceId, changes) {
19
+ return this.callJsonApi(`${this.relativePath}/${sourceId}`, {
20
+ method: 'put',
21
+ headers: { 'content-type': 'application/json' },
22
+ body: JSON.stringify(changes)
23
+ });
24
+ }
25
+ create(source) {
26
+ return this.callJsonApi(this.relativePath, {
27
+ method: 'post',
28
+ headers: { 'content-type': 'application/json' },
29
+ body: JSON.stringify(source)
30
+ });
31
+ }
32
+ }
33
+ //# sourceMappingURL=integration-sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-sources.js","sourceRoot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AC,SAAS,CAAC,MAAM,CAAC;SAC7B,CAAC,CAAA;IACJ,CAAC;CAEF"}
package/dist/base-sdk.js CHANGED
@@ -15,9 +15,17 @@ export default class BaseSDK {
15
15
  }
16
16
  callJsonApi(relativeUrl, data) {
17
17
  return this.callApi(relativeUrl, data).then(async (res) => {
18
- if (this.qlOptions.forceRefresh && res.status === 401) {
18
+ if (this.qlOptions.forceRefresh && res.status >= 400 && res.status < 500) {
19
19
  const headers = await this.qlOptions.extraHeaders(relativeUrl, true);
20
20
  if (!headers.authorization) {
21
+ if (this.qlOptions.onFailedRefreshToken) {
22
+ try {
23
+ await this.qlOptions.onFailedRefreshToken();
24
+ }
25
+ catch (e) {
26
+ throw new Error('could not able to refresh token');
27
+ }
28
+ }
21
29
  throw new Error('could not able to refresh token');
22
30
  }
23
31
  res = await this.callApi(relativeUrl, data);
@@ -1 +1 @@
1
- {"version":3,"file":"base-sdk.js","sourceRoot":"","sources":["../src/base-sdk.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,OAAO,OAAO;IAIN;IAHpB,OAAO,CAAS;IAChB,MAAM,CAAY;IAElB,YAAoB,SAA0B;QAA1B,cAAS,GAAT,SAAS,CAAiB;QAC5C,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC;QACjG,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,IAAkB;QACnD,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,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gBAC9B,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC7D,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YACtD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE;gBACX,MAAM,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aAC3D;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAC;IACL,CAAC;IAED,cAAc,CAAC,SAA+B;QAC5C,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACxH,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,CAAC;CACF"}
@@ -1,21 +1,7 @@
1
+ import type { IAppConfigurationMetadata as IAppConfiguration } from '@qelos/global-types';
1
2
  import { QelosSDKOptions } from "./types";
2
3
  import BaseSDK from "./base-sdk";
3
- export interface IAppConfiguration {
4
- name: string;
5
- logoUrl: string;
6
- description: string;
7
- keywords: string;
8
- slogan: string;
9
- language: string;
10
- direction: string;
11
- titleSuffix: string;
12
- themeStylesUrl: string;
13
- scriptUrl: string;
14
- homeScreen: string;
15
- colorsPalette: Record<string, string>;
16
- websiteUrls: string[];
17
- [key: string]: any;
18
- }
4
+ export type { IAppConfiguration };
19
5
  export default class QlAppConfigurations extends BaseSDK {
20
6
  private relativePath;
21
7
  constructor(options: QelosSDKOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"configurations.js","sourceRoot":"","sources":["../src/configurations.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AAoBjC,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,OAAO;IAC9C,YAAY,GAAG,uCAAuC,CAAC;IAE/D,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,mBAAmB,CAAC,KAA4B;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAgC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,CAAC,OAAmC,EAAE,KAA4B;QACtE,OAAO,IAAI,CAAC,WAAW,CAAgC,IAAI,CAAC,YAAY,EAAE;YACxE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC;YACzC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"file":"configurations.js","sourceRoot":"","sources":["../src/configurations.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,YAAY,CAAC;AAIjC,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,OAAO;IAC9C,YAAY,GAAG,uCAAuC,CAAC;IAE/D,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,mBAAmB,CAAC,KAA4B;QAC9C,OAAO,IAAI,CAAC,WAAW,CAAgC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,CAAC,OAAmC,EAAE,KAA4B;QACtE,OAAO,IAAI,CAAC,WAAW,CAAgC,IAAI,CAAC,YAAY,EAAE;YACxE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;YAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC;YACzC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
package/dist/types.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface QelosSDKOptions {
9
9
  [key: string]: string;
10
10
  }>;
11
11
  forceRefresh?: boolean;
12
+ onFailedRefreshToken?: () => Promise<void>;
12
13
  extraQueryParams?: () => Record<string, string>;
13
14
  }
14
15
  export type RequestExtra = Partial<RequestInit & {
@@ -16,6 +16,7 @@ export interface IWorkspace {
16
16
  isPrivilegedUser?: boolean;
17
17
  members?: IWorkspaceMember[];
18
18
  invites?: IInvite[];
19
+ labels: string[];
19
20
  [key: string]: any;
20
21
  }
21
22
  export default class QlWorkspaces extends BaseSDK {
@@ -1 +1 @@
1
- {"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../src/workspaces.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,YAAY,CAAC;AAyBjC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IACvC,YAAY,GAAG,iBAAiB,CAAC;IAEzC,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IAED,YAAY,CAAC,WAAmB;QAC9B,OAAO,IAAI,CAAC,WAAW,CAAa,GAAG,IAAI,CAAC,YAAY,IAAI,WAAW,EAAE,CAAC,CAAA;IAC5E,CAAC;IAED,UAAU,CAAC,WAAmB;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAqB,GAAG,IAAI,CAAC,YAAY,IAAI,WAAW,UAAU,CAAC,CAAA;IAC5F,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAe,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3D,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"name": "@qelos/sdk",
3
- "version": "3.7.4",
3
+ "version": "3.8.0",
4
4
  "description": "SDK for Qelos API",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -13,11 +13,11 @@
13
13
  "access": "public"
14
14
  },
15
15
  "dependencies": {
16
- "@qelos/global-types": "^3.7.4"
16
+ "@qelos/global-types": "^3.8.0"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tsx": "^3.12.7",
20
20
  "typescript": "^4.9.5"
21
21
  },
22
- "gitHead": "19f9c9c5e119299f5bbe3f9cf9acb44578eb10cb"
22
+ "gitHead": "cb6281585059df8baa9b2ce388fb00577b2cf99b"
23
23
  }
@@ -8,6 +8,7 @@ import QlManageConfigurations from './manage-configurations';
8
8
  import QlAdminWorkspaces from './workspaces';
9
9
  import QlManageBlueprints from './manage-blueprints';
10
10
  import { QlRoles } from './roles';
11
+ import QlIntegrationSources from './integration-sources';
11
12
 
12
13
  export default class QelosAdministratorSDK<T = any> extends QelosSDK {
13
14
  users: QlUsers<T>;
@@ -17,7 +18,8 @@ export default class QelosAdministratorSDK<T = any> extends QelosSDK {
17
18
  drafts: QlDrafts;
18
19
  events: QlEvents;
19
20
  adminWorkspaces: QlAdminWorkspaces;
20
- roles: QlRoles; // Added the roles property
21
+ roles: QlRoles;
22
+ integrationSources: QlIntegrationSources;
21
23
 
22
24
  constructor(options: QelosSDKOptions) {
23
25
  super(options);
@@ -28,7 +30,8 @@ export default class QelosAdministratorSDK<T = any> extends QelosSDK {
28
30
  this.drafts = new QlDrafts(options);
29
31
  this.events = new QlEvents(options);
30
32
  this.adminWorkspaces = new QlAdminWorkspaces(options);
31
- this.roles = new QlRoles(options) //Instantiated the QlRoles class inside the constructor
33
+ this.roles = new QlRoles(options);
34
+ this.integrationSources = new QlIntegrationSources(options);
32
35
 
33
36
  if (!options.extraQueryParams) {
34
37
  options.extraQueryParams = () => ({
@@ -0,0 +1,43 @@
1
+ import { QelosSDKOptions, RequestExtra } from '../types';
2
+ import BaseSDK from '../base-sdk';
3
+ import { IIntegrationSource } from '@qelos/global-types';
4
+
5
+ export default class QlIntegrationSources extends BaseSDK {
6
+ private relativePath = '/api/integration-sources';
7
+
8
+ constructor(private options: QelosSDKOptions) {
9
+ super(options)
10
+ }
11
+
12
+ getIntegrationSource(sourceId: string, extra?: RequestExtra) {
13
+ return this.callJsonApi<IIntegrationSource>(`${this.relativePath}/${sourceId}`, extra);
14
+ }
15
+
16
+ getList(query?: { kind?: string }, extra?: RequestExtra) {
17
+ return this.callJsonApi<IIntegrationSource[]>(this.relativePath + this.getQueryParams(query), extra);
18
+ }
19
+
20
+ remove(sourceId: string): Promise<any> {
21
+ return this.callApi(`${this.relativePath}/${sourceId}`, { method: 'delete' });
22
+ }
23
+
24
+ update(sourceId: string, changes: Partial<Pick<IIntegrationSource, 'name' | 'labels' | 'metadata' | 'authentication'>>): Promise<IIntegrationSource> {
25
+ return this.callJsonApi<IIntegrationSource>(
26
+ `${this.relativePath}/${sourceId}`,
27
+ {
28
+ method: 'put',
29
+ headers: { 'content-type': 'application/json' },
30
+ body: JSON.stringify(changes)
31
+ }
32
+ )
33
+ }
34
+
35
+ create(source: Pick<IIntegrationSource, 'name' | 'labels' | 'metadata' | 'authentication'>): Promise<IIntegrationSource> {
36
+ return this.callJsonApi<IIntegrationSource>(this.relativePath, {
37
+ method: 'post',
38
+ headers: { 'content-type': 'application/json' },
39
+ body: JSON.stringify(source)
40
+ })
41
+ }
42
+
43
+ }
package/src/base-sdk.ts CHANGED
@@ -18,9 +18,16 @@ export default class BaseSDK {
18
18
 
19
19
  callJsonApi<T>(relativeUrl: string, data?: RequestInit): Promise<T> {
20
20
  return this.callApi(relativeUrl, data).then(async res => {
21
- if (this.qlOptions.forceRefresh && res.status === 401) {
21
+ if (this.qlOptions.forceRefresh && res.status >= 400 && res.status < 500) {
22
22
  const headers = await this.qlOptions.extraHeaders(relativeUrl, true);
23
23
  if (!headers.authorization) {
24
+ if (this.qlOptions.onFailedRefreshToken) {
25
+ try {
26
+ await this.qlOptions.onFailedRefreshToken();
27
+ } catch (e) {
28
+ throw new Error('could not able to refresh token');
29
+ }
30
+ }
24
31
  throw new Error('could not able to refresh token');
25
32
  }
26
33
  res = await this.callApi(relativeUrl, data);
@@ -1,23 +1,8 @@
1
+ import type { IAppConfigurationMetadata as IAppConfiguration } from '@qelos/global-types';
1
2
  import { QelosSDKOptions } from "./types";
2
3
  import BaseSDK from "./base-sdk";
3
4
 
4
- export interface IAppConfiguration {
5
- name: string;
6
- logoUrl: string;
7
- description: string;
8
- keywords: string;
9
- slogan: string;
10
- language: string;
11
- direction: string;
12
- titleSuffix: string;
13
- themeStylesUrl: string;
14
- scriptUrl: string;
15
- homeScreen: string;
16
- colorsPalette: Record<string, string>;
17
- websiteUrls: string[];
18
-
19
- [key: string]: any;
20
- }
5
+ export type { IAppConfiguration };
21
6
 
22
7
  export default class QlAppConfigurations extends BaseSDK {
23
8
  private relativePath = "/api/configurations/app-configuration";
package/src/types.ts CHANGED
@@ -8,6 +8,7 @@ export interface QelosSDKOptions {
8
8
  getAccessToken?: () => undefined | string;
9
9
  extraHeaders?: (relativeUrl: string, forceRefresh?: boolean) => Promise<{ [key: string]: string }>;
10
10
  forceRefresh?: boolean;
11
+ onFailedRefreshToken?: () => Promise<void>;
11
12
  extraQueryParams?: () => Record<string, string>
12
13
  }
13
14
 
package/src/workspaces.ts CHANGED
@@ -20,6 +20,7 @@ export interface IWorkspace {
20
20
 
21
21
  members?: IWorkspaceMember[];
22
22
  invites?: IInvite[];
23
+ labels: string[]
23
24
 
24
25
  [key: string]: any;
25
26
  }