@ptkl/sdk 1.6.4 → 1.6.6

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.
@@ -432,16 +432,21 @@ var ProtokolSDK010 = (function (exports, axios) {
432
432
  * Get a single extension by name from the component
433
433
  *
434
434
  * @param name - The name of the extension to retrieve
435
- * @param version - The component version
435
+ * @param version - The component version (optional; if not provided, the active environment version is used)
436
436
  * @returns The extension object
437
437
  *
438
438
  * @example
439
439
  * ```typescript
440
440
  * const extension = await component.getExtension('shipping_tracker', '0.1.0')
441
+ * // or, using the active environment:
442
+ * const extension = await component.getExtension('shipping_tracker')
441
443
  * ```
442
444
  */
443
445
  async getExtension(name, version) {
444
- return await this.client.get(`/v4/system/component/${this.ref}/${version}/extensions/${name}`);
446
+ if (version) {
447
+ return await this.client.get(`/v4/system/component/${this.ref}/${version}/extensions/${name}`);
448
+ }
449
+ return await this.client.get(`/v4/system/component/${this.ref}/extensions/${name}`);
445
450
  }
446
451
  /**
447
452
  * Install a new extension on the component
@@ -1681,9 +1686,8 @@ var ProtokolSDK010 = (function (exports, axios) {
1681
1686
  let formData = new FormData();
1682
1687
  let count = 0;
1683
1688
  files.forEach((file, index) => {
1684
- let rename = file.rename || file.name;
1685
- let orgExt = file.name.split('.');
1686
- rename = `${rename}.${orgExt[orgExt.length - 1]}`;
1689
+ const orgExt = file.name.split('.').pop();
1690
+ const rename = file.rename ? `${file.rename}.${orgExt}` : file.name;
1687
1691
  formData.append('file', file, rename);
1688
1692
  count++;
1689
1693
  });
package/dist/index.0.9.js CHANGED
@@ -1382,9 +1382,8 @@ var ProtokolSDK09 = (function (exports, axios) {
1382
1382
  let formData = new FormData();
1383
1383
  let count = 0;
1384
1384
  files.forEach((file, index) => {
1385
- let rename = file.rename || file.name;
1386
- let orgExt = file.name.split('.');
1387
- rename = `${rename}.${orgExt[orgExt.length - 1]}`;
1385
+ const orgExt = file.name.split('.').pop();
1386
+ const rename = file.rename ? `${file.rename}.${orgExt}` : file.name;
1388
1387
  formData.append('file', file, rename);
1389
1388
  count++;
1390
1389
  });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",
@@ -183,15 +183,17 @@ export default class Component<C extends string = string> extends PlatformBaseCl
183
183
  * Get a single extension by name from the component
184
184
  *
185
185
  * @param name - The name of the extension to retrieve
186
- * @param version - The component version
186
+ * @param version - The component version (optional; if not provided, the active environment version is used)
187
187
  * @returns The extension object
188
188
  *
189
189
  * @example
190
190
  * ```typescript
191
191
  * const extension = await component.getExtension('shipping_tracker', '0.1.0')
192
+ * // or, using the active environment:
193
+ * const extension = await component.getExtension('shipping_tracker')
192
194
  * ```
193
195
  */
194
- getExtension(name: string, version: string): Promise<AxiosResponse<any, any>>;
196
+ getExtension(name: string, version?: string): Promise<AxiosResponse<any, any>>;
195
197
  /**
196
198
  * Install a new extension on the component
197
199
  *
@@ -19398,16 +19398,21 @@ class Component extends PlatformBaseClient {
19398
19398
  * Get a single extension by name from the component
19399
19399
  *
19400
19400
  * @param name - The name of the extension to retrieve
19401
- * @param version - The component version
19401
+ * @param version - The component version (optional; if not provided, the active environment version is used)
19402
19402
  * @returns The extension object
19403
19403
  *
19404
19404
  * @example
19405
19405
  * ```typescript
19406
19406
  * const extension = await component.getExtension('shipping_tracker', '0.1.0')
19407
+ * // or, using the active environment:
19408
+ * const extension = await component.getExtension('shipping_tracker')
19407
19409
  * ```
19408
19410
  */
19409
19411
  async getExtension(name, version) {
19410
- return await this.client.get(`/v4/system/component/${this.ref}/${version}/extensions/${name}`);
19412
+ if (version) {
19413
+ return await this.client.get(`/v4/system/component/${this.ref}/${version}/extensions/${name}`);
19414
+ }
19415
+ return await this.client.get(`/v4/system/component/${this.ref}/extensions/${name}`);
19411
19416
  }
19412
19417
  /**
19413
19418
  * Install a new extension on the component
@@ -20647,9 +20652,8 @@ class DMS extends IntegrationsBaseClient {
20647
20652
  let formData = new FormData();
20648
20653
  let count = 0;
20649
20654
  files.forEach((file, index) => {
20650
- let rename = file.rename || file.name;
20651
- let orgExt = file.name.split('.');
20652
- rename = `${rename}.${orgExt[orgExt.length - 1]}`;
20655
+ const orgExt = file.name.split('.').pop();
20656
+ const rename = file.rename ? `${file.rename}.${orgExt}` : file.name;
20653
20657
  formData.append('file', file, rename);
20654
20658
  count++;
20655
20659
  });
@@ -431,16 +431,21 @@ class Component extends PlatformBaseClient {
431
431
  * Get a single extension by name from the component
432
432
  *
433
433
  * @param name - The name of the extension to retrieve
434
- * @param version - The component version
434
+ * @param version - The component version (optional; if not provided, the active environment version is used)
435
435
  * @returns The extension object
436
436
  *
437
437
  * @example
438
438
  * ```typescript
439
439
  * const extension = await component.getExtension('shipping_tracker', '0.1.0')
440
+ * // or, using the active environment:
441
+ * const extension = await component.getExtension('shipping_tracker')
440
442
  * ```
441
443
  */
442
444
  async getExtension(name, version) {
443
- return await this.client.get(`/v4/system/component/${this.ref}/${version}/extensions/${name}`);
445
+ if (version) {
446
+ return await this.client.get(`/v4/system/component/${this.ref}/${version}/extensions/${name}`);
447
+ }
448
+ return await this.client.get(`/v4/system/component/${this.ref}/extensions/${name}`);
444
449
  }
445
450
  /**
446
451
  * Install a new extension on the component
@@ -1680,9 +1685,8 @@ class DMS extends IntegrationsBaseClient {
1680
1685
  let formData = new FormData();
1681
1686
  let count = 0;
1682
1687
  files.forEach((file, index) => {
1683
- let rename = file.rename || file.name;
1684
- let orgExt = file.name.split('.');
1685
- rename = `${rename}.${orgExt[orgExt.length - 1]}`;
1688
+ const orgExt = file.name.split('.').pop();
1689
+ const rename = file.rename ? `${file.rename}.${orgExt}` : file.name;
1686
1690
  formData.append('file', file, rename);
1687
1691
  count++;
1688
1692
  });
@@ -236,7 +236,7 @@ type FieldConstraints = {
236
236
  to?: string;
237
237
  from?: string;
238
238
  days?: number[];
239
- days_of_month?: number[];
239
+ days_of_month?: number[] | null;
240
240
  ranges?: Array<{
241
241
  from: string;
242
242
  to: string;
@@ -247,7 +247,7 @@ type FieldConstraints = {
247
247
  to?: string;
248
248
  from?: string;
249
249
  days?: number[];
250
- days_of_month?: number[];
250
+ days_of_month?: number[] | null;
251
251
  ranges?: Array<{
252
252
  from: string;
253
253
  to: string;
@@ -321,7 +321,7 @@ type PresetContext = {
321
321
  };
322
322
  type Preset = {
323
323
  name: string;
324
- roles?: string[];
324
+ roles?: string[] | null;
325
325
  context: PresetContext;
326
326
  };
327
327
  type Function = {
@@ -331,12 +331,12 @@ type Function = {
331
331
  type Extension = {
332
332
  name: string;
333
333
  is_active: boolean;
334
- fields?: SettingsField[];
335
- functions?: Function[];
336
- workflows?: Record<string, any>[];
337
- templates?: Record<string, any>;
338
- templates_dist?: TemplatesDist;
339
- config?: Record<string, any>;
334
+ fields?: SettingsField[] | null;
335
+ functions?: Function[] | null;
336
+ workflows?: Record<string, any>[] | null;
337
+ templates?: Record<string, any> | null;
338
+ templates_dist?: TemplatesDist | null;
339
+ config?: Record<string, any> | null;
340
340
  version?: string;
341
341
  };
342
342
  type FieldAccessConfig = {
@@ -353,9 +353,9 @@ type Policy<T = Record<string, any>> = {
353
353
  config?: T;
354
354
  };
355
355
  type TemplatesDist = {
356
- sdk_version: number;
357
- sdk_engine: string;
358
- dist: Record<string, any>;
356
+ sdk_version?: number | null;
357
+ sdk_engine?: string | null;
358
+ dist?: Record<string, any> | null;
359
359
  };
360
360
  type Settings = {
361
361
  version?: string;
@@ -391,7 +391,7 @@ type Settings = {
391
391
  };
392
392
  presets?: Preset[] | null;
393
393
  templates?: Record<string, any>[] | null;
394
- templates_dist?: TemplatesDist;
394
+ templates_dist?: TemplatesDist | null;
395
395
  config?: Record<string, any> | null;
396
396
  functions?: Function[] | null;
397
397
  extensions?: Extension[] | null;
@@ -20350,9 +20350,8 @@ class DMS extends IntegrationsBaseClient {
20350
20350
  let formData = new FormData();
20351
20351
  let count = 0;
20352
20352
  files.forEach((file, index) => {
20353
- let rename = file.rename || file.name;
20354
- let orgExt = file.name.split('.');
20355
- rename = `${rename}.${orgExt[orgExt.length - 1]}`;
20353
+ const orgExt = file.name.split('.').pop();
20354
+ const rename = file.rename ? `${file.rename}.${orgExt}` : file.name;
20356
20355
  formData.append('file', file, rename);
20357
20356
  count++;
20358
20357
  });
@@ -1381,9 +1381,8 @@ class DMS extends IntegrationsBaseClient {
1381
1381
  let formData = new FormData();
1382
1382
  let count = 0;
1383
1383
  files.forEach((file, index) => {
1384
- let rename = file.rename || file.name;
1385
- let orgExt = file.name.split('.');
1386
- rename = `${rename}.${orgExt[orgExt.length - 1]}`;
1384
+ const orgExt = file.name.split('.').pop();
1385
+ const rename = file.rename ? `${file.rename}.${orgExt}` : file.name;
1387
1386
  formData.append('file', file, rename);
1388
1387
  count++;
1389
1388
  });
@@ -236,7 +236,7 @@ type FieldConstraints = {
236
236
  to?: string;
237
237
  from?: string;
238
238
  days?: number[];
239
- days_of_month?: number[];
239
+ days_of_month?: number[] | null;
240
240
  ranges?: Array<{
241
241
  from: string;
242
242
  to: string;
@@ -247,7 +247,7 @@ type FieldConstraints = {
247
247
  to?: string;
248
248
  from?: string;
249
249
  days?: number[];
250
- days_of_month?: number[];
250
+ days_of_month?: number[] | null;
251
251
  ranges?: Array<{
252
252
  from: string;
253
253
  to: string;
@@ -321,7 +321,7 @@ type PresetContext = {
321
321
  };
322
322
  type Preset = {
323
323
  name: string;
324
- roles?: string[];
324
+ roles?: string[] | null;
325
325
  context: PresetContext;
326
326
  };
327
327
  type Function = {
@@ -335,14 +335,14 @@ type Extension = {
335
335
  functions?: Function[];
336
336
  workflows?: Record<string, any>[];
337
337
  templates?: Record<string, any>;
338
- templates_dist?: TemplatesDist;
338
+ templates_dist?: TemplatesDist | null;
339
339
  config?: Record<string, any>;
340
340
  version?: string;
341
341
  };
342
342
  type FieldAccessConfig = {
343
343
  fields: string[];
344
344
  actions: string[];
345
- roles: string[];
345
+ roles: string[] | null;
346
346
  };
347
347
  type Policy<T = Record<string, any>> = {
348
348
  type: string;
@@ -353,9 +353,9 @@ type Policy<T = Record<string, any>> = {
353
353
  config?: T;
354
354
  };
355
355
  type TemplatesDist = {
356
- sdk_version: number;
357
- sdk_engine: string;
358
- dist: Record<string, any>;
356
+ sdk_version?: number;
357
+ sdk_engine?: string;
358
+ dist?: Record<string, any>;
359
359
  };
360
360
  type Settings = {
361
361
  version?: string;
@@ -391,7 +391,7 @@ type Settings = {
391
391
  };
392
392
  presets?: Preset[] | null;
393
393
  templates?: Record<string, any>[] | null;
394
- templates_dist?: TemplatesDist;
394
+ templates_dist?: TemplatesDist | null;
395
395
  config?: Record<string, any> | null;
396
396
  functions?: Function[] | null;
397
397
  extensions?: Extension[] | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",