@ptkl/sdk 1.9.2 → 1.10.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.
@@ -170,10 +170,6 @@ var ProtokolSDK010 = (function (exports, axios) {
170
170
  if (ctx.only && ctx.only.length > 0) {
171
171
  params.only = ctx.only;
172
172
  }
173
- else if (ctx.includeFields && ctx.includeFields.length > 0) {
174
- // Backward-compatible alias. The API now prefers `only`.
175
- params.includeFields = ctx.includeFields;
176
- }
177
173
  if (Object.keys(ctx.$adv || []).length > 0) {
178
174
  params.$adv = [(_a = ctx.$adv) !== null && _a !== void 0 ? _a : {}];
179
175
  }
@@ -961,12 +957,13 @@ var ProtokolSDK010 = (function (exports, axios) {
961
957
  }
962
958
 
963
959
  class Thunder extends PlatformBaseClient {
964
- async read(type, filters, flag, options, only) {
960
+ async read(type, filters, flag, opts) {
961
+ const { only, ...options } = opts !== null && opts !== void 0 ? opts : {};
965
962
  return await this.client.post("/v3/system/thunder", {
966
963
  type,
967
964
  filters,
968
965
  flag,
969
- options,
966
+ options: Object.keys(options).length ? options : undefined,
970
967
  only,
971
968
  });
972
969
  }
@@ -981,14 +978,14 @@ var ProtokolSDK010 = (function (exports, axios) {
981
978
  async operation(name, filters, data) {
982
979
  return await this.write(name, filters, data, "Operation");
983
980
  }
984
- async find(name, filters, only) {
985
- return await this.read(name, filters, "Find", undefined, only);
981
+ async find(name, filters, options) {
982
+ return await this.read(name, filters, "Find", options);
986
983
  }
987
- async findOne(name, filters, only) {
988
- return await this.read(name, filters, "FindOne", undefined, only);
984
+ async findOne(name, filters, options) {
985
+ return await this.read(name, filters, "FindOne", options);
989
986
  }
990
- async paginate(name, filters, options, only) {
991
- return await this.read(name, filters, "Paginate", options, only);
987
+ async paginate(name, filters, options) {
988
+ return await this.read(name, filters, "Paginate", options);
992
989
  }
993
990
  async upsert(name, filters, data) {
994
991
  return await this.write(name, filters, data, "Upsert");
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.9.2",
3
+ "version": "1.10.0",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",
@@ -1,11 +1,12 @@
1
1
  import PlatformBaseClient from "./platformBaseClient";
2
+ import type { ThunderReadOptions } from "../types/thunder";
2
3
  export default class Thunder extends PlatformBaseClient {
3
- read(type: string, filters: any, flag: string, options?: any, only?: string[]): Promise<import("axios").AxiosResponse<any, any>>;
4
+ read(type: string, filters: any, flag: string, opts?: ThunderReadOptions): Promise<import("axios").AxiosResponse<any, any>>;
4
5
  write(type: string, filters: any, d: any, flag: any): Promise<import("axios").AxiosResponse<any, any>>;
5
6
  operation(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
6
- find(name: string, filters: any, only?: string[]): Promise<import("axios").AxiosResponse<any, any>>;
7
- findOne(name: string, filters: any, only?: string[]): Promise<import("axios").AxiosResponse<any, any>>;
8
- paginate(name: string, filters: any, options?: any, only?: string[]): Promise<import("axios").AxiosResponse<any, any>>;
7
+ find(name: string, filters: any, options?: ThunderReadOptions): Promise<import("axios").AxiosResponse<any, any>>;
8
+ findOne(name: string, filters: any, options?: ThunderReadOptions): Promise<import("axios").AxiosResponse<any, any>>;
9
+ paginate(name: string, filters: any, options?: ThunderReadOptions): Promise<import("axios").AxiosResponse<any, any>>;
9
10
  upsert(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
10
11
  insertOne(name: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
11
12
  updateOne(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
@@ -19136,10 +19136,6 @@ class Component extends PlatformBaseClient {
19136
19136
  if (ctx.only && ctx.only.length > 0) {
19137
19137
  params.only = ctx.only;
19138
19138
  }
19139
- else if (ctx.includeFields && ctx.includeFields.length > 0) {
19140
- // Backward-compatible alias. The API now prefers `only`.
19141
- params.includeFields = ctx.includeFields;
19142
- }
19143
19139
  if (Object.keys(ctx.$adv || []).length > 0) {
19144
19140
  params.$adv = [(_a = ctx.$adv) !== null && _a !== void 0 ? _a : {}];
19145
19141
  }
@@ -19927,12 +19923,13 @@ class ComponentUtils extends PlatformBaseClient {
19927
19923
  }
19928
19924
 
19929
19925
  class Thunder extends PlatformBaseClient {
19930
- async read(type, filters, flag, options, only) {
19926
+ async read(type, filters, flag, opts) {
19927
+ const { only, ...options } = opts !== null && opts !== void 0 ? opts : {};
19931
19928
  return await this.client.post("/v3/system/thunder", {
19932
19929
  type,
19933
19930
  filters,
19934
19931
  flag,
19935
- options,
19932
+ options: Object.keys(options).length ? options : undefined,
19936
19933
  only,
19937
19934
  });
19938
19935
  }
@@ -19947,14 +19944,14 @@ class Thunder extends PlatformBaseClient {
19947
19944
  async operation(name, filters, data) {
19948
19945
  return await this.write(name, filters, data, "Operation");
19949
19946
  }
19950
- async find(name, filters, only) {
19951
- return await this.read(name, filters, "Find", undefined, only);
19947
+ async find(name, filters, options) {
19948
+ return await this.read(name, filters, "Find", options);
19952
19949
  }
19953
- async findOne(name, filters, only) {
19954
- return await this.read(name, filters, "FindOne", undefined, only);
19950
+ async findOne(name, filters, options) {
19951
+ return await this.read(name, filters, "FindOne", options);
19955
19952
  }
19956
- async paginate(name, filters, options, only) {
19957
- return await this.read(name, filters, "Paginate", options, only);
19953
+ async paginate(name, filters, options) {
19954
+ return await this.read(name, filters, "Paginate", options);
19958
19955
  }
19959
19956
  async upsert(name, filters, data) {
19960
19957
  return await this.write(name, filters, data, "Upsert");
@@ -169,10 +169,6 @@ class Component extends PlatformBaseClient {
169
169
  if (ctx.only && ctx.only.length > 0) {
170
170
  params.only = ctx.only;
171
171
  }
172
- else if (ctx.includeFields && ctx.includeFields.length > 0) {
173
- // Backward-compatible alias. The API now prefers `only`.
174
- params.includeFields = ctx.includeFields;
175
- }
176
172
  if (Object.keys(ctx.$adv || []).length > 0) {
177
173
  params.$adv = [(_a = ctx.$adv) !== null && _a !== void 0 ? _a : {}];
178
174
  }
@@ -960,12 +956,13 @@ class ComponentUtils extends PlatformBaseClient {
960
956
  }
961
957
 
962
958
  class Thunder extends PlatformBaseClient {
963
- async read(type, filters, flag, options, only) {
959
+ async read(type, filters, flag, opts) {
960
+ const { only, ...options } = opts !== null && opts !== void 0 ? opts : {};
964
961
  return await this.client.post("/v3/system/thunder", {
965
962
  type,
966
963
  filters,
967
964
  flag,
968
- options,
965
+ options: Object.keys(options).length ? options : undefined,
969
966
  only,
970
967
  });
971
968
  }
@@ -980,14 +977,14 @@ class Thunder extends PlatformBaseClient {
980
977
  async operation(name, filters, data) {
981
978
  return await this.write(name, filters, data, "Operation");
982
979
  }
983
- async find(name, filters, only) {
984
- return await this.read(name, filters, "Find", undefined, only);
980
+ async find(name, filters, options) {
981
+ return await this.read(name, filters, "Find", options);
985
982
  }
986
- async findOne(name, filters, only) {
987
- return await this.read(name, filters, "FindOne", undefined, only);
983
+ async findOne(name, filters, options) {
984
+ return await this.read(name, filters, "FindOne", options);
988
985
  }
989
- async paginate(name, filters, options, only) {
990
- return await this.read(name, filters, "Paginate", options, only);
986
+ async paginate(name, filters, options) {
987
+ return await this.read(name, filters, "Paginate", options);
991
988
  }
992
989
  async upsert(name, filters, data) {
993
990
  return await this.write(name, filters, data, "Upsert");
@@ -10,7 +10,6 @@ type FindParams = {
10
10
  dateTo?: string;
11
11
  dateField?: string;
12
12
  only?: string[];
13
- includeFields?: string[];
14
13
  $adv?: FindAdvancedParams;
15
14
  $aggregate?: FindAggregateParams[];
16
15
  };
@@ -0,0 +1,4 @@
1
+ export type ThunderReadOptions = {
2
+ cacheTTL?: number;
3
+ only?: string[];
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.9.2",
3
+ "version": "1.10.0",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",