repzo 1.0.237 → 1.0.239

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) => string;
1
+ export declare const generateUUID: (prefix?: string, suffix?: string, length?: number) => string;
package/lib/helper.js CHANGED
@@ -1,11 +1,14 @@
1
- import { v7 as uuidv7 } from "uuid";
2
- export const generateUUID = (prefix = "", suffix = "") => {
1
+ export const generateUUID = (prefix = "", suffix = "", length = 8) => {
3
2
  if ((prefix && typeof prefix !== "string") ||
4
3
  (suffix && typeof suffix !== "string")) {
5
4
  throw new Error("Prefix and suffix must be strings");
6
5
  }
7
- const uuid = uuidv7();
6
+ const randomPortion = Math.random()
7
+ .toString(36)
8
+ .substring(2, 2 + length);
9
+ const timestamp = Date.now().toString(36);
8
10
  const formattedPrefix = prefix ? `${prefix}-` : "";
9
11
  const formattedSuffix = suffix ? `-${suffix}` : "";
10
- return `${formattedPrefix}${uuid}${formattedSuffix}`;
12
+ const uuid = `${formattedPrefix}${timestamp}${randomPortion}${formattedSuffix}`;
13
+ return uuid;
11
14
  };
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);
225
+ return generateUUID(prefix, suffix, length);
226
226
  };
227
227
  this.core = {
228
228
  updateHeader: (newHeaders) => {
@@ -712,7 +712,7 @@ export declare namespace Service {
712
712
  assigned_media?: string | Media.MediaSchema;
713
713
  teams?: string[] | Team.TeamSchema[];
714
714
  };
715
- type PopulatedKeys = "category" | "sub_category" | "tax" | "sv_tax" | "media" | "measureunit_family" | "measureunit" | "sv_measureUnit" | "brand" | "product_groups" | "teams";
715
+ type PopulatedKeys = "category" | "sub_category" | "tax" | "sv_tax" | "media" | "measureunit_family" | "measureunit" | "sv_measureUnit" | "brand" | "product_groups" | "teams" | "measureunit_family_with_measureunit";
716
716
  export namespace Find {
717
717
  type Params = DefaultPaginationQueryParams & {
718
718
  populatedKeys?: PopulatedKeys[];
@@ -1366,7 +1366,7 @@ export declare namespace Service {
1366
1366
  _id: string;
1367
1367
  name: string;
1368
1368
  local_name?: string;
1369
- measureunits: string[];
1369
+ measureunits: string[] | Pick<MeasureUnit.MeasureUnitSchema, "_id" | "name" | "disabled">[];
1370
1370
  disabled?: boolean;
1371
1371
  integration_meta?: {
1372
1372
  [key: string]: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.237",
3
+ "version": "1.0.239",
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": "^13.0.0"
55
+ "uuid": "^8.3.2"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@apidevtools/swagger-parser": "^12.0.0",
package/src/helper.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { v7 as uuidv7 } from "uuid";
2
-
3
- export const generateUUID = (prefix = "", suffix = ""): string => {
1
+ export const generateUUID = (
2
+ prefix: string = "",
3
+ suffix: string = "",
4
+ length: number = 8,
5
+ ) => {
4
6
  if (
5
7
  (prefix && typeof prefix !== "string") ||
6
8
  (suffix && typeof suffix !== "string")
@@ -8,9 +10,16 @@ export const generateUUID = (prefix = "", suffix = ""): string => {
8
10
  throw new Error("Prefix and suffix must be strings");
9
11
  }
10
12
 
11
- const uuid = uuidv7();
13
+ const randomPortion = Math.random()
14
+ .toString(36)
15
+ .substring(2, 2 + length);
16
+
17
+ const timestamp = Date.now().toString(36);
18
+
12
19
  const formattedPrefix = prefix ? `${prefix}-` : "";
13
20
  const formattedSuffix = suffix ? `-${suffix}` : "";
14
21
 
15
- return `${formattedPrefix}${uuid}${formattedSuffix}`;
22
+ const uuid = `${formattedPrefix}${timestamp}${randomPortion}${formattedSuffix}`;
23
+
24
+ return uuid;
16
25
  };
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);
395
+ return generateUUID(prefix, suffix, length);
396
396
  };
397
397
 
398
398
  core = {
@@ -955,7 +955,8 @@ export namespace Service {
955
955
  | "sv_measureUnit"
956
956
  | "brand"
957
957
  | "product_groups"
958
- | "teams";
958
+ | "teams"
959
+ | "measureunit_family_with_measureunit";
959
960
 
960
961
  export namespace Find {
961
962
  export type Params = DefaultPaginationQueryParams & {
@@ -1632,7 +1633,9 @@ export namespace Service {
1632
1633
  _id: string;
1633
1634
  name: string;
1634
1635
  local_name?: string;
1635
- measureunits: string[];
1636
+ measureunits:
1637
+ | string[]
1638
+ | Pick<MeasureUnit.MeasureUnitSchema, "_id" | "name" | "disabled">[];
1636
1639
  disabled?: boolean;
1637
1640
  integration_meta?: { [key: string]: any };
1638
1641
  company_namespace: string[];