repzo 1.0.235 → 1.0.237

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/lib/helper.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const generateUUID: (prefix?: string, suffix?: string, length?: number) => string;
1
+ export declare const generateUUID: (prefix?: string, suffix?: string) => string;
package/lib/helper.js CHANGED
@@ -1,17 +1,11 @@
1
- import crypto from "crypto";
2
- export const generateUUID = (prefix = "", suffix = "", length = 8) => {
1
+ import { v7 as uuidv7 } from "uuid";
2
+ export const generateUUID = (prefix = "", suffix = "") => {
3
3
  if ((prefix && typeof prefix !== "string") ||
4
4
  (suffix && typeof suffix !== "string")) {
5
5
  throw new Error("Prefix and suffix must be strings");
6
6
  }
7
- if (typeof crypto === "undefined" ||
8
- typeof crypto.randomBytes !== "function") {
9
- throw new Error("crypto module or randomBytes function is unavailable");
10
- }
11
- const randomPortion = BigInt(`0x${crypto.randomBytes(length).toString("hex")}`).toString(36);
12
- const timestamp = Date.now().toString(36);
7
+ const uuid = uuidv7();
13
8
  const formattedPrefix = prefix ? `${prefix}-` : "";
14
9
  const formattedSuffix = suffix ? `-${suffix}` : "";
15
- const uuid = `${formattedPrefix}${timestamp}${randomPortion}${formattedSuffix}`;
16
- return uuid;
10
+ return `${formattedPrefix}${uuid}${formattedSuffix}`;
17
11
  };
package/lib/index.js CHANGED
@@ -222,7 +222,7 @@ class Repzo {
222
222
  constructor(apiKey, options) {
223
223
  this.available_services = availableService;
224
224
  this.generateUUID = ({ prefix, suffix, length, }) => {
225
- return generateUUID(prefix, suffix, length);
225
+ return generateUUID(prefix, suffix);
226
226
  };
227
227
  this.core = {
228
228
  updateHeader: (newHeaders) => {
@@ -2444,7 +2444,8 @@ export declare namespace Service {
2444
2444
  rep_must_end_day_after_specific_time: boolean;
2445
2445
  rep_can_upload_media_on_payment?: boolean;
2446
2446
  rep_can_access_sales_reports?: boolean;
2447
- rep_must_add_delivery_date_on_sales_order_and_invoice?: boolean;
2447
+ rep_must_add_delivery_date_on_sales_order?: boolean;
2448
+ rep_must_add_delivery_date_on_invoice?: boolean;
2448
2449
  rep_can_view_stock_on_transfers?: boolean;
2449
2450
  rep_must_invoice_items_from_cross_inventory_and_msl?: boolean;
2450
2451
  }
@@ -2703,7 +2704,8 @@ export declare namespace Service {
2703
2704
  "permissions.rep_can_create_negative_invoices"?: boolean;
2704
2705
  "permissions.rep_can_upload_media_on_payment"?: boolean;
2705
2706
  "permissions.rep_can_access_sales_reports"?: boolean;
2706
- "permissions.rep_must_add_delivery_date_on_sales_order_and_invoice"?: boolean;
2707
+ "permissions.rep_must_add_delivery_date_on_sales_order"?: boolean;
2708
+ "permissions.rep_must_add_delivery_date_on_invoice"?: boolean;
2707
2709
  "permissions.rep_can_view_stock_on_transfers"?: boolean;
2708
2710
  "permissions.rep_must_invoice_items_from_cross_inventory_and_msl"?: boolean;
2709
2711
  "settings.rep_must_end_day_after"?: `${number}:${number}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.235",
3
+ "version": "1.0.237",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -52,7 +52,7 @@
52
52
  "dependencies": {
53
53
  "@babel/parser": "^7.14.7",
54
54
  "@types/axios": "^0.9.36",
55
- "uuid": "^8.3.2"
55
+ "uuid": "^13.0.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@apidevtools/swagger-parser": "^12.0.0",
package/src/helper.ts CHANGED
@@ -1,32 +1,16 @@
1
- import crypto from "crypto";
1
+ import { v7 as uuidv7 } from "uuid";
2
2
 
3
- export const generateUUID = (
4
- prefix = "",
5
- suffix = "",
6
- length: number = 8,
7
- ): string => {
3
+ export const generateUUID = (prefix = "", suffix = ""): string => {
8
4
  if (
9
5
  (prefix && typeof prefix !== "string") ||
10
6
  (suffix && typeof suffix !== "string")
11
7
  ) {
12
8
  throw new Error("Prefix and suffix must be strings");
13
9
  }
14
- if (
15
- typeof crypto === "undefined" ||
16
- typeof crypto.randomBytes !== "function"
17
- ) {
18
- throw new Error("crypto module or randomBytes function is unavailable");
19
- }
20
- const randomPortion = BigInt(
21
- `0x${crypto.randomBytes(length).toString("hex")}`,
22
- ).toString(36);
23
-
24
- const timestamp = Date.now().toString(36);
25
10
 
11
+ const uuid = uuidv7();
26
12
  const formattedPrefix = prefix ? `${prefix}-` : "";
27
13
  const formattedSuffix = suffix ? `-${suffix}` : "";
28
14
 
29
- const uuid = `${formattedPrefix}${timestamp}${randomPortion}${formattedSuffix}`;
30
-
31
- return uuid;
15
+ return `${formattedPrefix}${uuid}${formattedSuffix}`;
32
16
  };
package/src/index.ts CHANGED
@@ -392,7 +392,7 @@ export default class Repzo {
392
392
  suffix?: string;
393
393
  length: number;
394
394
  }): string => {
395
- return generateUUID(prefix, suffix, length);
395
+ return generateUUID(prefix, suffix);
396
396
  };
397
397
 
398
398
  core = {
@@ -2851,7 +2851,8 @@ export namespace Service {
2851
2851
  rep_must_end_day_after_specific_time: boolean;
2852
2852
  rep_can_upload_media_on_payment?: boolean;
2853
2853
  rep_can_access_sales_reports?: boolean;
2854
- rep_must_add_delivery_date_on_sales_order_and_invoice?: boolean;
2854
+ rep_must_add_delivery_date_on_sales_order?: boolean;
2855
+ rep_must_add_delivery_date_on_invoice?: boolean;
2855
2856
  rep_can_view_stock_on_transfers?: boolean;
2856
2857
  rep_must_invoice_items_from_cross_inventory_and_msl?: boolean;
2857
2858
  }
@@ -3134,7 +3135,8 @@ export namespace Service {
3134
3135
  "permissions.rep_can_create_negative_invoices"?: boolean;
3135
3136
  "permissions.rep_can_upload_media_on_payment"?: boolean;
3136
3137
  "permissions.rep_can_access_sales_reports"?: boolean;
3137
- "permissions.rep_must_add_delivery_date_on_sales_order_and_invoice"?: boolean;
3138
+ "permissions.rep_must_add_delivery_date_on_sales_order"?: boolean;
3139
+ "permissions.rep_must_add_delivery_date_on_invoice"?: boolean;
3138
3140
  "permissions.rep_can_view_stock_on_transfers"?: boolean;
3139
3141
  "permissions.rep_must_invoice_items_from_cross_inventory_and_msl"?: boolean;
3140
3142
  "settings.rep_must_end_day_after"?: `${number}:${number}`;