@ptkl/sdk 0.2.2 → 0.3.1

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/dist/index.cjs.js CHANGED
@@ -17845,7 +17845,7 @@ const isBrowser = typeof window !== "undefined" &&
17845
17845
  class PlatformBaseClient extends BaseClient {
17846
17846
  constructor(options) {
17847
17847
  var _a, _b;
17848
- let { env = null, token, host, } = options !== null && options !== undefined ? options : {};
17848
+ let { env = null, token = null, host = null, } = options !== null && options !== undefined ? options : {};
17849
17849
  let headers = {};
17850
17850
  if (isBrowser) {
17851
17851
  if (localStorage.getItem('protokol_context') == "forge") {
@@ -17858,6 +17858,8 @@ class PlatformBaseClient extends BaseClient {
17858
17858
  // @ts-ignore
17859
17859
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
17860
17860
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
17861
+ //@ts-ignore
17862
+ token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
17861
17863
  }
17862
17864
  if (token) {
17863
17865
  headers['Authorization'] = `Bearer ${token}`;
@@ -18212,6 +18214,51 @@ class ComponentUtils extends PlatformBaseClient {
18212
18214
  }
18213
18215
  }
18214
18216
 
18217
+ class Thunder extends PlatformBaseClient {
18218
+ async read(type, filters, flag, options) {
18219
+ const { data } = await this.client.post("/v3/system/thunder", {
18220
+ type,
18221
+ filters,
18222
+ flag,
18223
+ options,
18224
+ });
18225
+ return data;
18226
+ }
18227
+ async write(type, filters, d, flag) {
18228
+ const { data } = await this.client.put("/v3/system/thunder", {
18229
+ type,
18230
+ filters,
18231
+ flag,
18232
+ data: d,
18233
+ });
18234
+ return data;
18235
+ }
18236
+ async operation(name, filters, data) {
18237
+ return await this.write(name, filters, data, "Operation");
18238
+ }
18239
+ async find(name, filters) {
18240
+ return await this.read(name, filters, "Find");
18241
+ }
18242
+ async findOne(name, filters) {
18243
+ return await this.read(name, filters, "FindOne");
18244
+ }
18245
+ async paginate(name, filters, options) {
18246
+ return await this.read(name, filters, "Paginate", options);
18247
+ }
18248
+ async upsert(name, filters, data) {
18249
+ return await this.write(name, filters, data, "Upsert");
18250
+ }
18251
+ async insertOne(name, data) {
18252
+ return await this.write(name, {}, data, "InsertOne");
18253
+ }
18254
+ async updateOne(name, filters, data) {
18255
+ return await this.write(name, filters, data, "UpdateOne");
18256
+ }
18257
+ async delete(name, filters) {
18258
+ return await this.write(name, filters, {}, "Delete");
18259
+ }
18260
+ }
18261
+
18215
18262
  class Ratchet extends PlatformBaseClient {
18216
18263
  async query(name, params) {
18217
18264
  let res = await this.client.post('/v1/ratchet/query', {
@@ -18316,6 +18363,9 @@ class Platform extends PlatformBaseClient {
18316
18363
  workflow() {
18317
18364
  return (new Workflow()).setClient(this.client);
18318
18365
  }
18366
+ thunder() {
18367
+ return (new Thunder()).setClient(this.client);
18368
+ }
18319
18369
  }
18320
18370
 
18321
18371
  class Invoicing extends PlatformBaseClient {
@@ -18572,6 +18622,7 @@ exports.Ratchet = Ratchet;
18572
18622
  exports.Roles = Roles;
18573
18623
  exports.Sandbox = Sandbox;
18574
18624
  exports.System = System;
18625
+ exports.Thunder = Thunder;
18575
18626
  exports.Users = Users;
18576
18627
  exports.Workflow = Workflow;
18577
18628
  exports.default = Platform;
package/dist/index.esm.js CHANGED
@@ -35,7 +35,7 @@ const isBrowser = typeof window !== "undefined" &&
35
35
  class PlatformBaseClient extends BaseClient {
36
36
  constructor(options) {
37
37
  var _a, _b;
38
- let { env = null, token, host, } = options !== null && options !== undefined ? options : {};
38
+ let { env = null, token = null, host = null, } = options !== null && options !== undefined ? options : {};
39
39
  let headers = {};
40
40
  if (isBrowser) {
41
41
  if (localStorage.getItem('protokol_context') == "forge") {
@@ -48,6 +48,8 @@ class PlatformBaseClient extends BaseClient {
48
48
  // @ts-ignore
49
49
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
50
50
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
51
+ //@ts-ignore
52
+ token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
51
53
  }
52
54
  if (token) {
53
55
  headers['Authorization'] = `Bearer ${token}`;
@@ -402,6 +404,51 @@ class ComponentUtils extends PlatformBaseClient {
402
404
  }
403
405
  }
404
406
 
407
+ class Thunder extends PlatformBaseClient {
408
+ async read(type, filters, flag, options) {
409
+ const { data } = await this.client.post("/v3/system/thunder", {
410
+ type,
411
+ filters,
412
+ flag,
413
+ options,
414
+ });
415
+ return data;
416
+ }
417
+ async write(type, filters, d, flag) {
418
+ const { data } = await this.client.put("/v3/system/thunder", {
419
+ type,
420
+ filters,
421
+ flag,
422
+ data: d,
423
+ });
424
+ return data;
425
+ }
426
+ async operation(name, filters, data) {
427
+ return await this.write(name, filters, data, "Operation");
428
+ }
429
+ async find(name, filters) {
430
+ return await this.read(name, filters, "Find");
431
+ }
432
+ async findOne(name, filters) {
433
+ return await this.read(name, filters, "FindOne");
434
+ }
435
+ async paginate(name, filters, options) {
436
+ return await this.read(name, filters, "Paginate", options);
437
+ }
438
+ async upsert(name, filters, data) {
439
+ return await this.write(name, filters, data, "Upsert");
440
+ }
441
+ async insertOne(name, data) {
442
+ return await this.write(name, {}, data, "InsertOne");
443
+ }
444
+ async updateOne(name, filters, data) {
445
+ return await this.write(name, filters, data, "UpdateOne");
446
+ }
447
+ async delete(name, filters) {
448
+ return await this.write(name, filters, {}, "Delete");
449
+ }
450
+ }
451
+
405
452
  class Ratchet extends PlatformBaseClient {
406
453
  async query(name, params) {
407
454
  let res = await this.client.post('/v1/ratchet/query', {
@@ -506,6 +553,9 @@ class Platform extends PlatformBaseClient {
506
553
  workflow() {
507
554
  return (new Workflow()).setClient(this.client);
508
555
  }
556
+ thunder() {
557
+ return (new Thunder()).setClient(this.client);
558
+ }
509
559
  }
510
560
 
511
561
  class Invoicing extends PlatformBaseClient {
@@ -752,4 +802,4 @@ class Integrations extends IntegrationsBaseClient {
752
802
  }
753
803
  }
754
804
 
755
- export { APIUser, Apps, Component, ComponentUtils, Functions, Integrations as Integration, Ratchet, Roles, Sandbox, System, Users, Workflow, Platform as default };
805
+ export { APIUser, Apps, Component, ComponentUtils, Functions, Integrations as Integration, Ratchet, Roles, Sandbox, System, Thunder, Users, Workflow, Platform as default };
package/dist/index.umd.js CHANGED
@@ -39,7 +39,7 @@
39
39
  class PlatformBaseClient extends BaseClient {
40
40
  constructor(options) {
41
41
  var _a, _b;
42
- let { env = null, token, host, } = options !== null && options !== undefined ? options : {};
42
+ let { env = null, token = null, host = null, } = options !== null && options !== undefined ? options : {};
43
43
  let headers = {};
44
44
  if (isBrowser) {
45
45
  if (localStorage.getItem('protokol_context') == "forge") {
@@ -52,6 +52,8 @@
52
52
  // @ts-ignore
53
53
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
54
54
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
55
+ //@ts-ignore
56
+ token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
55
57
  }
56
58
  if (token) {
57
59
  headers['Authorization'] = `Bearer ${token}`;
@@ -406,6 +408,51 @@
406
408
  }
407
409
  }
408
410
 
411
+ class Thunder extends PlatformBaseClient {
412
+ async read(type, filters, flag, options) {
413
+ const { data } = await this.client.post("/v3/system/thunder", {
414
+ type,
415
+ filters,
416
+ flag,
417
+ options,
418
+ });
419
+ return data;
420
+ }
421
+ async write(type, filters, d, flag) {
422
+ const { data } = await this.client.put("/v3/system/thunder", {
423
+ type,
424
+ filters,
425
+ flag,
426
+ data: d,
427
+ });
428
+ return data;
429
+ }
430
+ async operation(name, filters, data) {
431
+ return await this.write(name, filters, data, "Operation");
432
+ }
433
+ async find(name, filters) {
434
+ return await this.read(name, filters, "Find");
435
+ }
436
+ async findOne(name, filters) {
437
+ return await this.read(name, filters, "FindOne");
438
+ }
439
+ async paginate(name, filters, options) {
440
+ return await this.read(name, filters, "Paginate", options);
441
+ }
442
+ async upsert(name, filters, data) {
443
+ return await this.write(name, filters, data, "Upsert");
444
+ }
445
+ async insertOne(name, data) {
446
+ return await this.write(name, {}, data, "InsertOne");
447
+ }
448
+ async updateOne(name, filters, data) {
449
+ return await this.write(name, filters, data, "UpdateOne");
450
+ }
451
+ async delete(name, filters) {
452
+ return await this.write(name, filters, {}, "Delete");
453
+ }
454
+ }
455
+
409
456
  class Ratchet extends PlatformBaseClient {
410
457
  async query(name, params) {
411
458
  let res = await this.client.post('/v1/ratchet/query', {
@@ -510,6 +557,9 @@
510
557
  workflow() {
511
558
  return (new Workflow()).setClient(this.client);
512
559
  }
560
+ thunder() {
561
+ return (new Thunder()).setClient(this.client);
562
+ }
513
563
  }
514
564
 
515
565
  class Invoicing extends PlatformBaseClient {
@@ -766,6 +816,7 @@
766
816
  exports.Roles = Roles;
767
817
  exports.Sandbox = Sandbox;
768
818
  exports.System = System;
819
+ exports.Thunder = Thunder;
769
820
  exports.Users = Users;
770
821
  exports.Workflow = Workflow;
771
822
  exports.default = Platform;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"
@@ -6,6 +6,7 @@ import Users from "./users";
6
6
  import Apps from "./apps";
7
7
  import Component from "./component";
8
8
  import ComponentUtils from "./componentUtils";
9
+ import Thunder from "./thunder";
9
10
  import Ratchet from "./ratchet";
10
11
  import Sandbox from "./sandbox";
11
12
  import System from "./system";
@@ -27,4 +28,5 @@ export default class Platform extends PlatformBaseClient {
27
28
  sandbox(): Sandbox;
28
29
  system(): System;
29
30
  workflow(): Workflow;
31
+ thunder(): Thunder;
30
32
  }
@@ -11,4 +11,5 @@ export { default as Roles } from './api/roles';
11
11
  export { default as Apps } from './api/apps';
12
12
  export { default as Workflow } from './api/workflow';
13
13
  export { default as ComponentUtils } from './api/componentUtils';
14
+ export { default as Thunder } from './api/thunder';
14
15
  export default Platform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"