@ptkl/sdk 0.8.2 → 0.8.4

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
@@ -17856,13 +17856,11 @@ class PlatformBaseClient extends BaseClient {
17856
17856
  headers['X-Project-Env'] = "dev";
17857
17857
  }
17858
17858
  }
17859
- if (window) {
17859
+ if (typeof window !== "undefined") {
17860
17860
  // @ts-ignore
17861
17861
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
17862
17862
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
17863
17863
  // @ts-ignore
17864
- token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
17865
- // @ts-ignore
17866
17864
  env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
17867
17865
  }
17868
17866
  if (token) {
@@ -17912,7 +17910,7 @@ class Functions extends PlatformBaseClient {
17912
17910
  params: d.query,
17913
17911
  headers: d.headers
17914
17912
  });
17915
- return data.data;
17913
+ return data;
17916
17914
  }
17917
17915
  async generateSignature(ref, env) {
17918
17916
  return await this.client.get(`/v1/system/function/signature/${env}/${ref}`);
@@ -17921,25 +17919,19 @@ class Functions extends PlatformBaseClient {
17921
17919
 
17922
17920
  class Roles extends PlatformBaseClient {
17923
17921
  async create(role) {
17924
- const res = await this.client.post("/v1/user/role/create", role);
17925
- // writeFileSync(`.role.create.json`,JSON.stringify(res))
17926
- return res.data;
17922
+ return await this.client.post("/v1/user/role/create", role);
17927
17923
  }
17928
17924
  async delete(uuid) {
17929
- const { data } = await this.client.delete(`/v1/user/role/delete/${uuid}`);
17930
- return data;
17925
+ return await this.client.delete(`/v1/user/role/delete/${uuid}`);
17931
17926
  }
17932
17927
  async list() {
17933
- const { data } = await this.client.get(`/v1/user/role/list`);
17934
- return data;
17928
+ return await this.client.get(`/v1/user/role/list`);
17935
17929
  }
17936
17930
  async listPermissions() {
17937
- const { data } = await this.client.get(`/v1/user/permissions/list`);
17938
- return data;
17931
+ return await this.client.get(`/v1/user/permissions/list`);
17939
17932
  }
17940
17933
  async edit(permissions, workspaces, level, uuid) {
17941
- const { data } = await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
17942
- return data;
17934
+ return await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
17943
17935
  }
17944
17936
  }
17945
17937
 
@@ -18031,64 +18023,57 @@ class Component extends PlatformBaseClient {
18031
18023
  * }
18032
18024
  * )
18033
18025
  **/
18034
- find(filters, opts) {
18026
+ async find(filters, opts) {
18035
18027
  const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== undefined ? opts : {};
18036
- return new Promise((resolve, reject) => {
18037
- let payload = {
18038
- context: filters,
18039
- ref: this.ref,
18040
- };
18041
- let ctx = payload.context;
18042
- let offset = ctx.currentPage;
18043
- if (offset == undefined) {
18044
- offset = 0;
18045
- }
18046
- let limit = ctx.perPage;
18047
- if (limit == undefined || limit == -1) {
18048
- limit = 10;
18049
- }
18050
- let sortDesc = 1;
18051
- if (ctx.sortDesc) {
18052
- sortDesc = -1;
18053
- }
18054
- if (ctx.filterOn === undefined) {
18055
- ctx.filterOn = [];
18056
- }
18057
- let params = {
18058
- offset: offset,
18059
- sortBy: ctx.sortBy,
18060
- sortDesc: sortDesc,
18061
- filter: ctx.filter,
18062
- filterOn: ctx.filterOn.join(","),
18063
- limit: limit,
18064
- dateFrom: ctx.dateFrom,
18065
- dateTo: ctx.dateTo,
18066
- dateField: ctx.dateField,
18067
- };
18068
- if (Object.keys(ctx.$adv || []).length > 0) {
18069
- params.$adv = JSON.stringify([ctx.$adv]);
18070
- }
18071
- if (ctx.$aggregate && ctx.$aggregate.length > 0) {
18072
- params.$aggregate = JSON.stringify(ctx.$aggregate);
18073
- }
18074
- if (opts) {
18075
- Object.keys(opts).forEach(k => {
18076
- params[`_opt_${k}`] = opts ? opts[k] : null;
18077
- });
18078
- }
18079
- this.client.get(`/v3/system/component/${this.ref}/models`, {
18080
- params: params,
18081
- headers: {
18082
- 'X-Cache': cache,
18083
- 'X-Build-Ttl': buildttl,
18084
- 'Accept-Language': locale
18085
- }
18086
- }).then((resp) => {
18087
- let { data = [] } = resp || {};
18088
- resolve(data);
18089
- }).catch((err) => {
18090
- reject(err);
18028
+ let payload = {
18029
+ context: filters,
18030
+ ref: this.ref,
18031
+ };
18032
+ let ctx = payload.context;
18033
+ let offset = ctx.currentPage;
18034
+ if (offset == undefined) {
18035
+ offset = 0;
18036
+ }
18037
+ let limit = ctx.perPage;
18038
+ if (limit == undefined || limit == -1) {
18039
+ limit = 10;
18040
+ }
18041
+ let sortDesc = 1;
18042
+ if (ctx.sortDesc) {
18043
+ sortDesc = -1;
18044
+ }
18045
+ if (ctx.filterOn === undefined) {
18046
+ ctx.filterOn = [];
18047
+ }
18048
+ let params = {
18049
+ offset: offset,
18050
+ sortBy: ctx.sortBy,
18051
+ sortDesc: sortDesc,
18052
+ filter: ctx.filter,
18053
+ filterOn: ctx.filterOn.join(","),
18054
+ limit: limit,
18055
+ dateFrom: ctx.dateFrom,
18056
+ dateTo: ctx.dateTo,
18057
+ dateField: ctx.dateField,
18058
+ };
18059
+ if (Object.keys(ctx.$adv || []).length > 0) {
18060
+ params.$adv = JSON.stringify([ctx.$adv]);
18061
+ }
18062
+ if (ctx.$aggregate && ctx.$aggregate.length > 0) {
18063
+ params.$aggregate = JSON.stringify(ctx.$aggregate);
18064
+ }
18065
+ if (opts) {
18066
+ Object.keys(opts).forEach(k => {
18067
+ params[`_opt_${k}`] = opts ? opts[k] : null;
18091
18068
  });
18069
+ }
18070
+ return await this.client.get(`/v3/system/component/${this.ref}/models`, {
18071
+ params: params,
18072
+ headers: {
18073
+ 'X-Cache': cache,
18074
+ 'X-Build-Ttl': buildttl,
18075
+ 'Accept-Language': locale
18076
+ }
18092
18077
  });
18093
18078
  }
18094
18079
  /**
@@ -18120,8 +18105,7 @@ class Component extends PlatformBaseClient {
18120
18105
  * @returns (Promise<Model>)
18121
18106
  */
18122
18107
  async get(uuid) {
18123
- const { data } = await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}`);
18124
- return data;
18108
+ return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}`);
18125
18109
  }
18126
18110
  /**
18127
18111
  * Update model by uuid
@@ -18131,11 +18115,10 @@ class Component extends PlatformBaseClient {
18131
18115
  * @returns
18132
18116
  */
18133
18117
  async update(uuid, data, options) {
18134
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
18118
+ return await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
18135
18119
  data,
18136
18120
  options,
18137
18121
  });
18138
- return responseData;
18139
18122
  }
18140
18123
  /**
18141
18124
  * Update many models
@@ -18145,11 +18128,24 @@ class Component extends PlatformBaseClient {
18145
18128
  * @returns
18146
18129
  */
18147
18130
  async updateMany(data, options) {
18148
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/models/bulk`, {
18131
+ return await this.client.post(`/v3/system/component/${this.ref}/models/bulk`, {
18132
+ data,
18133
+ options,
18134
+ });
18135
+ }
18136
+ /**
18137
+ * Modify models by filters
18138
+ *
18139
+ * @param data
18140
+ * @param options
18141
+ * @returns
18142
+ */
18143
+ async modify(filters, data, options) {
18144
+ return await this.client.patch(`/v3/system/component/${this.ref}/modify/model`, {
18145
+ filters,
18149
18146
  data,
18150
18147
  options,
18151
18148
  });
18152
- return responseData;
18153
18149
  }
18154
18150
  /**
18155
18151
  * Concurrent update model by uuid
@@ -18160,85 +18156,72 @@ class Component extends PlatformBaseClient {
18160
18156
  * @returns
18161
18157
  */
18162
18158
  async concurrentUpdate(uuid, version, data, options) {
18163
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
18159
+ return await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
18164
18160
  version: version,
18165
18161
  data,
18166
18162
  options,
18167
18163
  });
18168
- return responseData;
18169
18164
  }
18170
18165
  async create(model) {
18171
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/model`, model);
18172
- return data;
18166
+ return await this.client.post(`/v3/system/component/${this.ref}/model`, model);
18173
18167
  }
18174
18168
  async delete(uuid) {
18175
- const { data } = await this.client.delete(`/v3/system/component/${this.ref}/model/${uuid}`);
18176
- return data;
18169
+ return await this.client.delete(`/v3/system/component/${this.ref}/model/${uuid}`);
18177
18170
  }
18178
18171
  async aggregate(pipeline) {
18179
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/aggregate`, pipeline);
18180
- return data;
18172
+ return await this.client.post(`/v3/system/component/${this.ref}/aggregate`, pipeline);
18181
18173
  }
18182
18174
  async settings() {
18183
- const { data } = await this.client.get(`/v3/system/component/settings/${this.ref}`);
18184
- return data;
18175
+ return await this.client.get(`/v3/system/component/settings/${this.ref}`);
18185
18176
  }
18186
18177
  async saveSettings(settings, version) {
18187
- const { data } = await this.client.post(`/v3/system/component/settings/${this.ref}/${version}`, settings);
18188
- return data;
18178
+ return await this.client.post(`/v3/system/component/settings/${this.ref}/${version}`, settings);
18189
18179
  }
18190
18180
  async saveTemplatesDist(version, sdkVersion, engine, dist) {
18191
- const { data } = await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
18181
+ return await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
18192
18182
  templates_dist: {
18193
18183
  sdk_version: sdkVersion,
18194
18184
  sdk_engine: engine,
18195
18185
  dist,
18196
18186
  }
18197
18187
  });
18198
- return data;
18199
18188
  }
18200
18189
  async workflow(event, input) {
18201
- const { data } = await this.client.post(`/v1/system/component/${this.ref}/workflow/event`, {
18190
+ return await this.client.post(`/v1/system/component/${this.ref}/workflow/event`, {
18202
18191
  event,
18203
18192
  input
18204
18193
  });
18205
- return data;
18206
18194
  }
18207
18195
  async function(name, input) {
18208
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, input);
18209
- return data;
18196
+ return await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, input);
18210
18197
  }
18211
18198
  }
18212
18199
 
18213
18200
  class ComponentUtils extends PlatformBaseClient {
18214
18201
  async list() {
18215
- const { data } = await this.client.get("/v1/system/components");
18216
- return data;
18202
+ return await this.client.get("/v1/system/components");
18217
18203
  }
18218
18204
  async create(data) {
18219
- const { data: responseData } = await this.client.post("/v3/system/component/create", data);
18220
- return responseData;
18205
+ return await this.client.post("/v3/system/component/create", data);
18221
18206
  }
18222
18207
  }
18223
18208
 
18224
18209
  class Thunder extends PlatformBaseClient {
18225
18210
  async read(type, filters, flag, options) {
18226
- const { data } = await this.client.post("/v3/system/thunder", {
18211
+ return await this.client.post("/v3/system/thunder", {
18227
18212
  type,
18228
18213
  filters,
18229
18214
  flag,
18230
18215
  options,
18231
18216
  });
18232
- return data;
18233
18217
  }
18234
18218
  async write(type, filters, d, flag) {
18235
- const { data } = await this.client.put("/v3/system/thunder", {
18219
+ return await this.client.put("/v3/system/thunder", {
18236
18220
  type,
18237
18221
  filters,
18238
18222
  flag,
18239
18223
  data: d,
18240
18224
  });
18241
- return data;
18242
18225
  }
18243
18226
  async operation(name, filters, data) {
18244
18227
  return await this.write(name, filters, data, "Operation");
@@ -18268,11 +18251,10 @@ class Thunder extends PlatformBaseClient {
18268
18251
 
18269
18252
  class Ratchet extends PlatformBaseClient {
18270
18253
  async query(name, params) {
18271
- let res = await this.client.post('/v1/ratchet/query', {
18254
+ return await this.client.post('/v1/ratchet/query', {
18272
18255
  name: name,
18273
18256
  params: params
18274
18257
  });
18275
- return res.data;
18276
18258
  }
18277
18259
  }
18278
18260
 
@@ -18294,14 +18276,10 @@ class Sandbox extends PlatformBaseClient {
18294
18276
 
18295
18277
  class System extends PlatformBaseClient {
18296
18278
  async resourceResolver(ref, resourceName, format) {
18297
- const { data } = await this.client.post("/v3/system/resource-resolver", {
18279
+ return await this.client.post("/v3/system/resource-resolver", {
18298
18280
  type: resourceName,
18299
18281
  format,
18300
18282
  });
18301
- if (format) {
18302
- return data.format;
18303
- }
18304
- return data;
18305
18283
  }
18306
18284
  }
18307
18285
 
@@ -18420,7 +18398,7 @@ class IntegrationsBaseClient extends BaseClient {
18420
18398
  headers['X-Project-Env'] = "dev";
18421
18399
  }
18422
18400
  }
18423
- if (window) {
18401
+ if (typeof window !== "undefined") {
18424
18402
  // @ts-ignore
18425
18403
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
18426
18404
  host = (_b = __global_env__.INTEGRATION_API) !== null && _b !== undefined ? _b : host;
package/dist/index.esm.js CHANGED
@@ -46,13 +46,11 @@ class PlatformBaseClient extends BaseClient {
46
46
  headers['X-Project-Env'] = "dev";
47
47
  }
48
48
  }
49
- if (window) {
49
+ if (typeof window !== "undefined") {
50
50
  // @ts-ignore
51
51
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
52
52
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
53
53
  // @ts-ignore
54
- token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
55
- // @ts-ignore
56
54
  env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
57
55
  }
58
56
  if (token) {
@@ -102,7 +100,7 @@ class Functions extends PlatformBaseClient {
102
100
  params: d.query,
103
101
  headers: d.headers
104
102
  });
105
- return data.data;
103
+ return data;
106
104
  }
107
105
  async generateSignature(ref, env) {
108
106
  return await this.client.get(`/v1/system/function/signature/${env}/${ref}`);
@@ -111,25 +109,19 @@ class Functions extends PlatformBaseClient {
111
109
 
112
110
  class Roles extends PlatformBaseClient {
113
111
  async create(role) {
114
- const res = await this.client.post("/v1/user/role/create", role);
115
- // writeFileSync(`.role.create.json`,JSON.stringify(res))
116
- return res.data;
112
+ return await this.client.post("/v1/user/role/create", role);
117
113
  }
118
114
  async delete(uuid) {
119
- const { data } = await this.client.delete(`/v1/user/role/delete/${uuid}`);
120
- return data;
115
+ return await this.client.delete(`/v1/user/role/delete/${uuid}`);
121
116
  }
122
117
  async list() {
123
- const { data } = await this.client.get(`/v1/user/role/list`);
124
- return data;
118
+ return await this.client.get(`/v1/user/role/list`);
125
119
  }
126
120
  async listPermissions() {
127
- const { data } = await this.client.get(`/v1/user/permissions/list`);
128
- return data;
121
+ return await this.client.get(`/v1/user/permissions/list`);
129
122
  }
130
123
  async edit(permissions, workspaces, level, uuid) {
131
- const { data } = await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
132
- return data;
124
+ return await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
133
125
  }
134
126
  }
135
127
 
@@ -221,64 +213,57 @@ class Component extends PlatformBaseClient {
221
213
  * }
222
214
  * )
223
215
  **/
224
- find(filters, opts) {
216
+ async find(filters, opts) {
225
217
  const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== undefined ? opts : {};
226
- return new Promise((resolve, reject) => {
227
- let payload = {
228
- context: filters,
229
- ref: this.ref,
230
- };
231
- let ctx = payload.context;
232
- let offset = ctx.currentPage;
233
- if (offset == undefined) {
234
- offset = 0;
235
- }
236
- let limit = ctx.perPage;
237
- if (limit == undefined || limit == -1) {
238
- limit = 10;
239
- }
240
- let sortDesc = 1;
241
- if (ctx.sortDesc) {
242
- sortDesc = -1;
243
- }
244
- if (ctx.filterOn === undefined) {
245
- ctx.filterOn = [];
246
- }
247
- let params = {
248
- offset: offset,
249
- sortBy: ctx.sortBy,
250
- sortDesc: sortDesc,
251
- filter: ctx.filter,
252
- filterOn: ctx.filterOn.join(","),
253
- limit: limit,
254
- dateFrom: ctx.dateFrom,
255
- dateTo: ctx.dateTo,
256
- dateField: ctx.dateField,
257
- };
258
- if (Object.keys(ctx.$adv || []).length > 0) {
259
- params.$adv = JSON.stringify([ctx.$adv]);
260
- }
261
- if (ctx.$aggregate && ctx.$aggregate.length > 0) {
262
- params.$aggregate = JSON.stringify(ctx.$aggregate);
263
- }
264
- if (opts) {
265
- Object.keys(opts).forEach(k => {
266
- params[`_opt_${k}`] = opts ? opts[k] : null;
267
- });
268
- }
269
- this.client.get(`/v3/system/component/${this.ref}/models`, {
270
- params: params,
271
- headers: {
272
- 'X-Cache': cache,
273
- 'X-Build-Ttl': buildttl,
274
- 'Accept-Language': locale
275
- }
276
- }).then((resp) => {
277
- let { data = [] } = resp || {};
278
- resolve(data);
279
- }).catch((err) => {
280
- reject(err);
218
+ let payload = {
219
+ context: filters,
220
+ ref: this.ref,
221
+ };
222
+ let ctx = payload.context;
223
+ let offset = ctx.currentPage;
224
+ if (offset == undefined) {
225
+ offset = 0;
226
+ }
227
+ let limit = ctx.perPage;
228
+ if (limit == undefined || limit == -1) {
229
+ limit = 10;
230
+ }
231
+ let sortDesc = 1;
232
+ if (ctx.sortDesc) {
233
+ sortDesc = -1;
234
+ }
235
+ if (ctx.filterOn === undefined) {
236
+ ctx.filterOn = [];
237
+ }
238
+ let params = {
239
+ offset: offset,
240
+ sortBy: ctx.sortBy,
241
+ sortDesc: sortDesc,
242
+ filter: ctx.filter,
243
+ filterOn: ctx.filterOn.join(","),
244
+ limit: limit,
245
+ dateFrom: ctx.dateFrom,
246
+ dateTo: ctx.dateTo,
247
+ dateField: ctx.dateField,
248
+ };
249
+ if (Object.keys(ctx.$adv || []).length > 0) {
250
+ params.$adv = JSON.stringify([ctx.$adv]);
251
+ }
252
+ if (ctx.$aggregate && ctx.$aggregate.length > 0) {
253
+ params.$aggregate = JSON.stringify(ctx.$aggregate);
254
+ }
255
+ if (opts) {
256
+ Object.keys(opts).forEach(k => {
257
+ params[`_opt_${k}`] = opts ? opts[k] : null;
281
258
  });
259
+ }
260
+ return await this.client.get(`/v3/system/component/${this.ref}/models`, {
261
+ params: params,
262
+ headers: {
263
+ 'X-Cache': cache,
264
+ 'X-Build-Ttl': buildttl,
265
+ 'Accept-Language': locale
266
+ }
282
267
  });
283
268
  }
284
269
  /**
@@ -310,8 +295,7 @@ class Component extends PlatformBaseClient {
310
295
  * @returns (Promise<Model>)
311
296
  */
312
297
  async get(uuid) {
313
- const { data } = await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}`);
314
- return data;
298
+ return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}`);
315
299
  }
316
300
  /**
317
301
  * Update model by uuid
@@ -321,11 +305,10 @@ class Component extends PlatformBaseClient {
321
305
  * @returns
322
306
  */
323
307
  async update(uuid, data, options) {
324
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
308
+ return await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
325
309
  data,
326
310
  options,
327
311
  });
328
- return responseData;
329
312
  }
330
313
  /**
331
314
  * Update many models
@@ -335,11 +318,24 @@ class Component extends PlatformBaseClient {
335
318
  * @returns
336
319
  */
337
320
  async updateMany(data, options) {
338
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/models/bulk`, {
321
+ return await this.client.post(`/v3/system/component/${this.ref}/models/bulk`, {
322
+ data,
323
+ options,
324
+ });
325
+ }
326
+ /**
327
+ * Modify models by filters
328
+ *
329
+ * @param data
330
+ * @param options
331
+ * @returns
332
+ */
333
+ async modify(filters, data, options) {
334
+ return await this.client.patch(`/v3/system/component/${this.ref}/modify/model`, {
335
+ filters,
339
336
  data,
340
337
  options,
341
338
  });
342
- return responseData;
343
339
  }
344
340
  /**
345
341
  * Concurrent update model by uuid
@@ -350,85 +346,72 @@ class Component extends PlatformBaseClient {
350
346
  * @returns
351
347
  */
352
348
  async concurrentUpdate(uuid, version, data, options) {
353
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
349
+ return await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
354
350
  version: version,
355
351
  data,
356
352
  options,
357
353
  });
358
- return responseData;
359
354
  }
360
355
  async create(model) {
361
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/model`, model);
362
- return data;
356
+ return await this.client.post(`/v3/system/component/${this.ref}/model`, model);
363
357
  }
364
358
  async delete(uuid) {
365
- const { data } = await this.client.delete(`/v3/system/component/${this.ref}/model/${uuid}`);
366
- return data;
359
+ return await this.client.delete(`/v3/system/component/${this.ref}/model/${uuid}`);
367
360
  }
368
361
  async aggregate(pipeline) {
369
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/aggregate`, pipeline);
370
- return data;
362
+ return await this.client.post(`/v3/system/component/${this.ref}/aggregate`, pipeline);
371
363
  }
372
364
  async settings() {
373
- const { data } = await this.client.get(`/v3/system/component/settings/${this.ref}`);
374
- return data;
365
+ return await this.client.get(`/v3/system/component/settings/${this.ref}`);
375
366
  }
376
367
  async saveSettings(settings, version) {
377
- const { data } = await this.client.post(`/v3/system/component/settings/${this.ref}/${version}`, settings);
378
- return data;
368
+ return await this.client.post(`/v3/system/component/settings/${this.ref}/${version}`, settings);
379
369
  }
380
370
  async saveTemplatesDist(version, sdkVersion, engine, dist) {
381
- const { data } = await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
371
+ return await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
382
372
  templates_dist: {
383
373
  sdk_version: sdkVersion,
384
374
  sdk_engine: engine,
385
375
  dist,
386
376
  }
387
377
  });
388
- return data;
389
378
  }
390
379
  async workflow(event, input) {
391
- const { data } = await this.client.post(`/v1/system/component/${this.ref}/workflow/event`, {
380
+ return await this.client.post(`/v1/system/component/${this.ref}/workflow/event`, {
392
381
  event,
393
382
  input
394
383
  });
395
- return data;
396
384
  }
397
385
  async function(name, input) {
398
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, input);
399
- return data;
386
+ return await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, input);
400
387
  }
401
388
  }
402
389
 
403
390
  class ComponentUtils extends PlatformBaseClient {
404
391
  async list() {
405
- const { data } = await this.client.get("/v1/system/components");
406
- return data;
392
+ return await this.client.get("/v1/system/components");
407
393
  }
408
394
  async create(data) {
409
- const { data: responseData } = await this.client.post("/v3/system/component/create", data);
410
- return responseData;
395
+ return await this.client.post("/v3/system/component/create", data);
411
396
  }
412
397
  }
413
398
 
414
399
  class Thunder extends PlatformBaseClient {
415
400
  async read(type, filters, flag, options) {
416
- const { data } = await this.client.post("/v3/system/thunder", {
401
+ return await this.client.post("/v3/system/thunder", {
417
402
  type,
418
403
  filters,
419
404
  flag,
420
405
  options,
421
406
  });
422
- return data;
423
407
  }
424
408
  async write(type, filters, d, flag) {
425
- const { data } = await this.client.put("/v3/system/thunder", {
409
+ return await this.client.put("/v3/system/thunder", {
426
410
  type,
427
411
  filters,
428
412
  flag,
429
413
  data: d,
430
414
  });
431
- return data;
432
415
  }
433
416
  async operation(name, filters, data) {
434
417
  return await this.write(name, filters, data, "Operation");
@@ -458,11 +441,10 @@ class Thunder extends PlatformBaseClient {
458
441
 
459
442
  class Ratchet extends PlatformBaseClient {
460
443
  async query(name, params) {
461
- let res = await this.client.post('/v1/ratchet/query', {
444
+ return await this.client.post('/v1/ratchet/query', {
462
445
  name: name,
463
446
  params: params
464
447
  });
465
- return res.data;
466
448
  }
467
449
  }
468
450
 
@@ -484,14 +466,10 @@ class Sandbox extends PlatformBaseClient {
484
466
 
485
467
  class System extends PlatformBaseClient {
486
468
  async resourceResolver(ref, resourceName, format) {
487
- const { data } = await this.client.post("/v3/system/resource-resolver", {
469
+ return await this.client.post("/v3/system/resource-resolver", {
488
470
  type: resourceName,
489
471
  format,
490
472
  });
491
- if (format) {
492
- return data.format;
493
- }
494
- return data;
495
473
  }
496
474
  }
497
475
 
@@ -610,7 +588,7 @@ class IntegrationsBaseClient extends BaseClient {
610
588
  headers['X-Project-Env'] = "dev";
611
589
  }
612
590
  }
613
- if (window) {
591
+ if (typeof window !== "undefined") {
614
592
  // @ts-ignore
615
593
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
616
594
  host = (_b = __global_env__.INTEGRATION_API) !== null && _b !== undefined ? _b : host;
@@ -47,13 +47,11 @@ var ProtokolSDK = (function (exports, axios) {
47
47
  headers['X-Project-Env'] = "dev";
48
48
  }
49
49
  }
50
- if (window) {
50
+ if (typeof window !== "undefined") {
51
51
  // @ts-ignore
52
52
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
53
53
  host = (_b = __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.API_HOST) !== null && _b !== undefined ? _b : host;
54
54
  // @ts-ignore
55
- token = token !== null && token !== undefined ? token : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_API_TOKEN;
56
- // @ts-ignore
57
55
  env = env !== null && env !== undefined ? env : __global_env__ === null || __global_env__ === undefined ? undefined : __global_env__.PROJECT_ENV;
58
56
  }
59
57
  if (token) {
@@ -103,7 +101,7 @@ var ProtokolSDK = (function (exports, axios) {
103
101
  params: d.query,
104
102
  headers: d.headers
105
103
  });
106
- return data.data;
104
+ return data;
107
105
  }
108
106
  async generateSignature(ref, env) {
109
107
  return await this.client.get(`/v1/system/function/signature/${env}/${ref}`);
@@ -112,25 +110,19 @@ var ProtokolSDK = (function (exports, axios) {
112
110
 
113
111
  class Roles extends PlatformBaseClient {
114
112
  async create(role) {
115
- const res = await this.client.post("/v1/user/role/create", role);
116
- // writeFileSync(`.role.create.json`,JSON.stringify(res))
117
- return res.data;
113
+ return await this.client.post("/v1/user/role/create", role);
118
114
  }
119
115
  async delete(uuid) {
120
- const { data } = await this.client.delete(`/v1/user/role/delete/${uuid}`);
121
- return data;
116
+ return await this.client.delete(`/v1/user/role/delete/${uuid}`);
122
117
  }
123
118
  async list() {
124
- const { data } = await this.client.get(`/v1/user/role/list`);
125
- return data;
119
+ return await this.client.get(`/v1/user/role/list`);
126
120
  }
127
121
  async listPermissions() {
128
- const { data } = await this.client.get(`/v1/user/permissions/list`);
129
- return data;
122
+ return await this.client.get(`/v1/user/permissions/list`);
130
123
  }
131
124
  async edit(permissions, workspaces, level, uuid) {
132
- const { data } = await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
133
- return data;
125
+ return await this.client.post(`/v1/user/role/edit/${uuid}`, { permissions, workspaces, level });
134
126
  }
135
127
  }
136
128
 
@@ -222,64 +214,57 @@ var ProtokolSDK = (function (exports, axios) {
222
214
  * }
223
215
  * )
224
216
  **/
225
- find(filters, opts) {
217
+ async find(filters, opts) {
226
218
  const { cache = false, buildttl = -1, locale = "en_US", } = opts !== null && opts !== undefined ? opts : {};
227
- return new Promise((resolve, reject) => {
228
- let payload = {
229
- context: filters,
230
- ref: this.ref,
231
- };
232
- let ctx = payload.context;
233
- let offset = ctx.currentPage;
234
- if (offset == undefined) {
235
- offset = 0;
236
- }
237
- let limit = ctx.perPage;
238
- if (limit == undefined || limit == -1) {
239
- limit = 10;
240
- }
241
- let sortDesc = 1;
242
- if (ctx.sortDesc) {
243
- sortDesc = -1;
244
- }
245
- if (ctx.filterOn === undefined) {
246
- ctx.filterOn = [];
247
- }
248
- let params = {
249
- offset: offset,
250
- sortBy: ctx.sortBy,
251
- sortDesc: sortDesc,
252
- filter: ctx.filter,
253
- filterOn: ctx.filterOn.join(","),
254
- limit: limit,
255
- dateFrom: ctx.dateFrom,
256
- dateTo: ctx.dateTo,
257
- dateField: ctx.dateField,
258
- };
259
- if (Object.keys(ctx.$adv || []).length > 0) {
260
- params.$adv = JSON.stringify([ctx.$adv]);
261
- }
262
- if (ctx.$aggregate && ctx.$aggregate.length > 0) {
263
- params.$aggregate = JSON.stringify(ctx.$aggregate);
264
- }
265
- if (opts) {
266
- Object.keys(opts).forEach(k => {
267
- params[`_opt_${k}`] = opts ? opts[k] : null;
268
- });
269
- }
270
- this.client.get(`/v3/system/component/${this.ref}/models`, {
271
- params: params,
272
- headers: {
273
- 'X-Cache': cache,
274
- 'X-Build-Ttl': buildttl,
275
- 'Accept-Language': locale
276
- }
277
- }).then((resp) => {
278
- let { data = [] } = resp || {};
279
- resolve(data);
280
- }).catch((err) => {
281
- reject(err);
219
+ let payload = {
220
+ context: filters,
221
+ ref: this.ref,
222
+ };
223
+ let ctx = payload.context;
224
+ let offset = ctx.currentPage;
225
+ if (offset == undefined) {
226
+ offset = 0;
227
+ }
228
+ let limit = ctx.perPage;
229
+ if (limit == undefined || limit == -1) {
230
+ limit = 10;
231
+ }
232
+ let sortDesc = 1;
233
+ if (ctx.sortDesc) {
234
+ sortDesc = -1;
235
+ }
236
+ if (ctx.filterOn === undefined) {
237
+ ctx.filterOn = [];
238
+ }
239
+ let params = {
240
+ offset: offset,
241
+ sortBy: ctx.sortBy,
242
+ sortDesc: sortDesc,
243
+ filter: ctx.filter,
244
+ filterOn: ctx.filterOn.join(","),
245
+ limit: limit,
246
+ dateFrom: ctx.dateFrom,
247
+ dateTo: ctx.dateTo,
248
+ dateField: ctx.dateField,
249
+ };
250
+ if (Object.keys(ctx.$adv || []).length > 0) {
251
+ params.$adv = JSON.stringify([ctx.$adv]);
252
+ }
253
+ if (ctx.$aggregate && ctx.$aggregate.length > 0) {
254
+ params.$aggregate = JSON.stringify(ctx.$aggregate);
255
+ }
256
+ if (opts) {
257
+ Object.keys(opts).forEach(k => {
258
+ params[`_opt_${k}`] = opts ? opts[k] : null;
282
259
  });
260
+ }
261
+ return await this.client.get(`/v3/system/component/${this.ref}/models`, {
262
+ params: params,
263
+ headers: {
264
+ 'X-Cache': cache,
265
+ 'X-Build-Ttl': buildttl,
266
+ 'Accept-Language': locale
267
+ }
283
268
  });
284
269
  }
285
270
  /**
@@ -311,8 +296,7 @@ var ProtokolSDK = (function (exports, axios) {
311
296
  * @returns (Promise<Model>)
312
297
  */
313
298
  async get(uuid) {
314
- const { data } = await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}`);
315
- return data;
299
+ return await this.client.get(`/v3/system/component/${this.ref}/model/${uuid}`);
316
300
  }
317
301
  /**
318
302
  * Update model by uuid
@@ -322,11 +306,10 @@ var ProtokolSDK = (function (exports, axios) {
322
306
  * @returns
323
307
  */
324
308
  async update(uuid, data, options) {
325
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
309
+ return await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
326
310
  data,
327
311
  options,
328
312
  });
329
- return responseData;
330
313
  }
331
314
  /**
332
315
  * Update many models
@@ -336,11 +319,24 @@ var ProtokolSDK = (function (exports, axios) {
336
319
  * @returns
337
320
  */
338
321
  async updateMany(data, options) {
339
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/models/bulk`, {
322
+ return await this.client.post(`/v3/system/component/${this.ref}/models/bulk`, {
323
+ data,
324
+ options,
325
+ });
326
+ }
327
+ /**
328
+ * Modify models by filters
329
+ *
330
+ * @param data
331
+ * @param options
332
+ * @returns
333
+ */
334
+ async modify(filters, data, options) {
335
+ return await this.client.patch(`/v3/system/component/${this.ref}/modify/model`, {
336
+ filters,
340
337
  data,
341
338
  options,
342
339
  });
343
- return responseData;
344
340
  }
345
341
  /**
346
342
  * Concurrent update model by uuid
@@ -351,85 +347,72 @@ var ProtokolSDK = (function (exports, axios) {
351
347
  * @returns
352
348
  */
353
349
  async concurrentUpdate(uuid, version, data, options) {
354
- const { data: responseData } = await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
350
+ return await this.client.post(`/v3/system/component/${this.ref}/model/${uuid}`, {
355
351
  version: version,
356
352
  data,
357
353
  options,
358
354
  });
359
- return responseData;
360
355
  }
361
356
  async create(model) {
362
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/model`, model);
363
- return data;
357
+ return await this.client.post(`/v3/system/component/${this.ref}/model`, model);
364
358
  }
365
359
  async delete(uuid) {
366
- const { data } = await this.client.delete(`/v3/system/component/${this.ref}/model/${uuid}`);
367
- return data;
360
+ return await this.client.delete(`/v3/system/component/${this.ref}/model/${uuid}`);
368
361
  }
369
362
  async aggregate(pipeline) {
370
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/aggregate`, pipeline);
371
- return data;
363
+ return await this.client.post(`/v3/system/component/${this.ref}/aggregate`, pipeline);
372
364
  }
373
365
  async settings() {
374
- const { data } = await this.client.get(`/v3/system/component/settings/${this.ref}`);
375
- return data;
366
+ return await this.client.get(`/v3/system/component/settings/${this.ref}`);
376
367
  }
377
368
  async saveSettings(settings, version) {
378
- const { data } = await this.client.post(`/v3/system/component/settings/${this.ref}/${version}`, settings);
379
- return data;
369
+ return await this.client.post(`/v3/system/component/settings/${this.ref}/${version}`, settings);
380
370
  }
381
371
  async saveTemplatesDist(version, sdkVersion, engine, dist) {
382
- const { data } = await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
372
+ return await this.client.post(`/v3/system/component/templates/${this.ref}/${version}`, {
383
373
  templates_dist: {
384
374
  sdk_version: sdkVersion,
385
375
  sdk_engine: engine,
386
376
  dist,
387
377
  }
388
378
  });
389
- return data;
390
379
  }
391
380
  async workflow(event, input) {
392
- const { data } = await this.client.post(`/v1/system/component/${this.ref}/workflow/event`, {
381
+ return await this.client.post(`/v1/system/component/${this.ref}/workflow/event`, {
393
382
  event,
394
383
  input
395
384
  });
396
- return data;
397
385
  }
398
386
  async function(name, input) {
399
- const { data } = await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, input);
400
- return data;
387
+ return await this.client.post(`/v3/system/component/${this.ref}/function/${name}`, input);
401
388
  }
402
389
  }
403
390
 
404
391
  class ComponentUtils extends PlatformBaseClient {
405
392
  async list() {
406
- const { data } = await this.client.get("/v1/system/components");
407
- return data;
393
+ return await this.client.get("/v1/system/components");
408
394
  }
409
395
  async create(data) {
410
- const { data: responseData } = await this.client.post("/v3/system/component/create", data);
411
- return responseData;
396
+ return await this.client.post("/v3/system/component/create", data);
412
397
  }
413
398
  }
414
399
 
415
400
  class Thunder extends PlatformBaseClient {
416
401
  async read(type, filters, flag, options) {
417
- const { data } = await this.client.post("/v3/system/thunder", {
402
+ return await this.client.post("/v3/system/thunder", {
418
403
  type,
419
404
  filters,
420
405
  flag,
421
406
  options,
422
407
  });
423
- return data;
424
408
  }
425
409
  async write(type, filters, d, flag) {
426
- const { data } = await this.client.put("/v3/system/thunder", {
410
+ return await this.client.put("/v3/system/thunder", {
427
411
  type,
428
412
  filters,
429
413
  flag,
430
414
  data: d,
431
415
  });
432
- return data;
433
416
  }
434
417
  async operation(name, filters, data) {
435
418
  return await this.write(name, filters, data, "Operation");
@@ -459,11 +442,10 @@ var ProtokolSDK = (function (exports, axios) {
459
442
 
460
443
  class Ratchet extends PlatformBaseClient {
461
444
  async query(name, params) {
462
- let res = await this.client.post('/v1/ratchet/query', {
445
+ return await this.client.post('/v1/ratchet/query', {
463
446
  name: name,
464
447
  params: params
465
448
  });
466
- return res.data;
467
449
  }
468
450
  }
469
451
 
@@ -485,14 +467,10 @@ var ProtokolSDK = (function (exports, axios) {
485
467
 
486
468
  class System extends PlatformBaseClient {
487
469
  async resourceResolver(ref, resourceName, format) {
488
- const { data } = await this.client.post("/v3/system/resource-resolver", {
470
+ return await this.client.post("/v3/system/resource-resolver", {
489
471
  type: resourceName,
490
472
  format,
491
473
  });
492
- if (format) {
493
- return data.format;
494
- }
495
- return data;
496
474
  }
497
475
  }
498
476
 
@@ -611,7 +589,7 @@ var ProtokolSDK = (function (exports, axios) {
611
589
  headers['X-Project-Env'] = "dev";
612
590
  }
613
591
  }
614
- if (window) {
592
+ if (typeof window !== "undefined") {
615
593
  // @ts-ignore
616
594
  const __global_env__ = window === null || window === undefined ? undefined : window.__ENV_VARIABLES__;
617
595
  host = (_b = __global_env__.INTEGRATION_API) !== null && _b !== undefined ? _b : host;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"
@@ -1,4 +1,4 @@
1
- import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions } from "src/types/component";
1
+ import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions } from "src/types/component";
2
2
  import PlatformBaseClient from "./platformBaseClient";
3
3
  export default class Component extends PlatformBaseClient {
4
4
  private ref;
@@ -53,7 +53,7 @@ export default class Component extends PlatformBaseClient {
53
53
  * @param data
54
54
  * @returns
55
55
  */
56
- update(uuid: string, data: Record<string, any>, options: UpdateOptions): Promise<any>;
56
+ update(uuid: string, data: Record<string, any>, options: UpdateOptions): Promise<import("axios").AxiosResponse<any, any>>;
57
57
  /**
58
58
  * Update many models
59
59
  *
@@ -61,7 +61,15 @@ export default class Component extends PlatformBaseClient {
61
61
  * @param options
62
62
  * @returns
63
63
  */
64
- updateMany(data: Record<string, any>[], options: UpdateOptions): Promise<any>;
64
+ updateMany(data: Record<string, any>[], options: UpdateOptions): Promise<import("axios").AxiosResponse<any, any>>;
65
+ /**
66
+ * Modify models by filters
67
+ *
68
+ * @param data
69
+ * @param options
70
+ * @returns
71
+ */
72
+ modify(filters: Record<string, any>, data: Record<string, any>, options: ModifyOptions): Promise<import("axios").AxiosResponse<any, any>>;
65
73
  /**
66
74
  * Concurrent update model by uuid
67
75
  *
@@ -70,14 +78,14 @@ export default class Component extends PlatformBaseClient {
70
78
  * @param data
71
79
  * @returns
72
80
  */
73
- concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options: UpdateOptions): Promise<any>;
74
- create(model: Record<string, any>): Promise<any>;
75
- delete(uuid: string): Promise<any>;
76
- aggregate(pipeline: FindAggregateParams): Promise<any>;
77
- settings(): Promise<any>;
78
- saveSettings(settings: any, version: string): Promise<any>;
81
+ concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options: UpdateOptions): Promise<import("axios").AxiosResponse<any, any>>;
82
+ create(model: Record<string, any>): Promise<import("axios").AxiosResponse<any, any>>;
83
+ delete(uuid: string): Promise<import("axios").AxiosResponse<any, any>>;
84
+ aggregate(pipeline: FindAggregateParams): Promise<import("axios").AxiosResponse<any, any>>;
85
+ settings(): Promise<import("axios").AxiosResponse<any, any>>;
86
+ saveSettings(settings: any, version: string): Promise<import("axios").AxiosResponse<any, any>>;
79
87
  saveTemplatesDist(version: string, sdkVersion: string, engine: string, dist: Record<string, string>): Promise<any>;
80
- workflow(event: string, input: any): Promise<any>;
81
- function(name: string, input: any): Promise<any>;
88
+ workflow(event: string, input: any): Promise<import("axios").AxiosResponse<any, any>>;
89
+ function(name: string, input: any): Promise<import("axios").AxiosResponse<any, any>>;
82
90
  }
83
91
  export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, };
@@ -1,5 +1,5 @@
1
1
  import PlatformBaseClient from "./platformBaseClient";
2
2
  export default class ComponentUtils extends PlatformBaseClient {
3
- list(): Promise<any>;
4
- create(data: any): Promise<any>;
3
+ list(): Promise<import("axios").AxiosResponse<any, any>>;
4
+ create(data: any): Promise<import("axios").AxiosResponse<any, any>>;
5
5
  }
@@ -16,8 +16,8 @@ export default class Functions extends PlatformBaseClient {
16
16
  */
17
17
  run(id: string, d: {
18
18
  input?: any;
19
- query: any;
20
- headers: any;
19
+ query?: any;
20
+ headers?: any;
21
21
  }): Promise<any>;
22
22
  generateSignature(ref: string, env: string): Promise<import("axios").AxiosResponse<any, any>>;
23
23
  }
@@ -1,4 +1,4 @@
1
1
  import PlatformBaseClient from "./platformBaseClient";
2
2
  export default class Ratchet extends PlatformBaseClient {
3
- query(name: string, params: any): Promise<any>;
3
+ query(name: string, params: any): Promise<import("axios").AxiosResponse<any, any>>;
4
4
  }
@@ -1,4 +1,4 @@
1
1
  import PlatformBaseClient from "./platformBaseClient";
2
2
  export default class System extends PlatformBaseClient {
3
- resourceResolver(ref: string, resourceName: string, format?: string): Promise<any>;
3
+ resourceResolver(ref: string, resourceName: string, format?: string): Promise<import("axios").AxiosResponse<any, any>>;
4
4
  }
@@ -1,13 +1,13 @@
1
1
  import PlatformBaseClient from "./platformBaseClient";
2
2
  export default class Thunder extends PlatformBaseClient {
3
- read(type: string, filters: any, flag: string, options?: any): Promise<any>;
4
- write(type: string, filters: any, d: any, flag: any): Promise<any>;
5
- operation(name: string, filters: any, data: any): Promise<any>;
6
- find(name: string, filters: any): Promise<any>;
7
- findOne(name: string, filters: any): Promise<any>;
8
- paginate(name: string, filters: any, options?: any): Promise<any>;
9
- upsert(name: string, filters: any, data: any): Promise<any>;
10
- insertOne(name: string, data: any): Promise<any>;
11
- updateOne(name: string, filters: any, data: any): Promise<any>;
12
- delete(name: string, filters: any): Promise<any>;
3
+ read(type: string, filters: any, flag: string, options?: any): Promise<import("axios").AxiosResponse<any, any>>;
4
+ write(type: string, filters: any, d: any, flag: any): Promise<import("axios").AxiosResponse<any, any>>;
5
+ operation(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
6
+ find(name: string, filters: any): Promise<import("axios").AxiosResponse<any, any>>;
7
+ findOne(name: string, filters: any): Promise<import("axios").AxiosResponse<any, any>>;
8
+ paginate(name: string, filters: any, options?: any): Promise<import("axios").AxiosResponse<any, any>>;
9
+ upsert(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
10
+ insertOne(name: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
11
+ updateOne(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
12
+ delete(name: string, filters: any): Promise<import("axios").AxiosResponse<any, any>>;
13
13
  }
@@ -44,4 +44,7 @@ type Model = {
44
44
  type UpdateOptions = {
45
45
  force_update_protected_fields: boolean;
46
46
  };
47
- export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions };
47
+ type ModifyOptions = {
48
+ upsert: boolean;
49
+ };
50
+ export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "docs": "typedoc"