@webiny/utils 5.41.4-beta.6 → 5.42.0-beta.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.
- package/cacheKey.js.map +1 -1
- package/createIdentifier.js.map +1 -1
- package/createZodError.js.map +1 -1
- package/generateId.js.map +1 -1
- package/package.json +8 -13
- package/zeroPad.js.map +1 -1
package/cacheKey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_crypto","_interopRequireDefault","require","getCacheKey","input","JSON","stringify","createCacheKey","options","key","crypto","createHash","algorithm","update","digest","encoding","exports"],"sources":["cacheKey.ts"],"sourcesContent":["import crypto, { BinaryToTextEncoding } from \"crypto\";\n\nexport type ICacheKeyKeys = Record<string, any> | string | number;\n\nexport interface ICacheKeyOptions {\n algorithm?: CacheKeyAlgorithmType;\n encoding?: BinaryToTextEncoding;\n}\n\nexport type CacheKeyAlgorithmType = \"md5\" | \"sha1\" | \"sha224\" | \"sha256\" | \"sha384\" | \"sha512\";\n\nconst getCacheKey = (input: ICacheKeyKeys): string => {\n if (typeof input === \"string\") {\n return input;\n } else if (typeof input === \"number\") {\n return `${input}`;\n }\n return JSON.stringify(input);\n};\n\nexport const createCacheKey = (input: ICacheKeyKeys, options?: ICacheKeyOptions): string => {\n const key = getCacheKey(input);\n return crypto\n .createHash(options?.algorithm || \"sha1\")\n .update(key)\n .digest(options?.encoding || \"hex\");\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAWA,MAAMC,WAAW,GAAIC,KAAoB,IAAa;EAClD,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB,CAAC,MAAM,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAClC,
|
|
1
|
+
{"version":3,"names":["_crypto","_interopRequireDefault","require","getCacheKey","input","JSON","stringify","createCacheKey","options","key","crypto","createHash","algorithm","update","digest","encoding","exports"],"sources":["cacheKey.ts"],"sourcesContent":["import crypto, { BinaryToTextEncoding } from \"crypto\";\n\nexport type ICacheKeyKeys = Record<string, any> | string | number;\n\nexport interface ICacheKeyOptions {\n algorithm?: CacheKeyAlgorithmType;\n encoding?: BinaryToTextEncoding;\n}\n\nexport type CacheKeyAlgorithmType = \"md5\" | \"sha1\" | \"sha224\" | \"sha256\" | \"sha384\" | \"sha512\";\n\nconst getCacheKey = (input: ICacheKeyKeys): string => {\n if (typeof input === \"string\") {\n return input;\n } else if (typeof input === \"number\") {\n return `${input}`;\n }\n return JSON.stringify(input);\n};\n\nexport const createCacheKey = (input: ICacheKeyKeys, options?: ICacheKeyOptions): string => {\n const key = getCacheKey(input);\n return crypto\n .createHash(options?.algorithm || \"sha1\")\n .update(key)\n .digest(options?.encoding || \"hex\");\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAWA,MAAMC,WAAW,GAAIC,KAAoB,IAAa;EAClD,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOA,KAAK;EAChB,CAAC,MAAM,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAClC,OAAO,GAAGA,KAAK,EAAE;EACrB;EACA,OAAOC,IAAI,CAACC,SAAS,CAACF,KAAK,CAAC;AAChC,CAAC;AAEM,MAAMG,cAAc,GAAGA,CAACH,KAAoB,EAAEI,OAA0B,KAAa;EACxF,MAAMC,GAAG,GAAGN,WAAW,CAACC,KAAK,CAAC;EAC9B,OAAOM,eAAM,CACRC,UAAU,CAACH,OAAO,EAAEI,SAAS,IAAI,MAAM,CAAC,CACxCC,MAAM,CAACJ,GAAG,CAAC,CACXK,MAAM,CAACN,OAAO,EAAEO,QAAQ,IAAI,KAAK,CAAC;AAC3C,CAAC;AAACC,OAAA,CAAAT,cAAA,GAAAA,cAAA","ignoreList":[]}
|
package/createIdentifier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_zeroPad","require","_parseIdentifier","createIdentifier","values","id","parseIdentifier","zeroPad","version","exports"],"sources":["createIdentifier.ts"],"sourcesContent":["import { zeroPad } from \"~/zeroPad\";\nimport { parseIdentifier } from \"~/parseIdentifier\";\n\n/**\n * Used to create the identifier that is an absolute unique for the record.\n * It is created out of the generated ID and version of the record.\n *\n *\n * The input ID is being parsed as you might send a full ID instead of only the generated one.\n */\nexport interface CreateIdentifierParams {\n id: string;\n version: number;\n}\n\nexport const createIdentifier = (values: CreateIdentifierParams): string => {\n const { id } = parseIdentifier(values.id);\n\n return `${id}#${zeroPad(values.version)}`;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,MAAME,gBAAgB,GAAIC,MAA8B,IAAa;EACxE,MAAM;IAAEC;EAAG,CAAC,GAAG,IAAAC,gCAAe,EAACF,MAAM,CAACC,EAAE,CAAC;EAEzC,
|
|
1
|
+
{"version":3,"names":["_zeroPad","require","_parseIdentifier","createIdentifier","values","id","parseIdentifier","zeroPad","version","exports"],"sources":["createIdentifier.ts"],"sourcesContent":["import { zeroPad } from \"~/zeroPad\";\nimport { parseIdentifier } from \"~/parseIdentifier\";\n\n/**\n * Used to create the identifier that is an absolute unique for the record.\n * It is created out of the generated ID and version of the record.\n *\n *\n * The input ID is being parsed as you might send a full ID instead of only the generated one.\n */\nexport interface CreateIdentifierParams {\n id: string;\n version: number;\n}\n\nexport const createIdentifier = (values: CreateIdentifierParams): string => {\n const { id } = parseIdentifier(values.id);\n\n return `${id}#${zeroPad(values.version)}`;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,MAAME,gBAAgB,GAAIC,MAA8B,IAAa;EACxE,MAAM;IAAEC;EAAG,CAAC,GAAG,IAAAC,gCAAe,EAACF,MAAM,CAACC,EAAE,CAAC;EAEzC,OAAO,GAAGA,EAAE,IAAI,IAAAE,gBAAO,EAACH,MAAM,CAACI,OAAO,CAAC,EAAE;AAC7C,CAAC;AAACC,OAAA,CAAAN,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
package/createZodError.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","createValidationErrorData","error","invalidFields","issues","reduce","collection","issue","name","path","join","code","message","data","fatal","createZodError","WebinyError","exports"],"sources":["createZodError.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ZodError } from \"zod/lib/ZodError\";\n\ninterface OutputError {\n code: string;\n data: Record<string, any> | null;\n message: string;\n}\n\nexport interface OutputErrors {\n [key: string]: OutputError;\n}\n\nconst createValidationErrorData = (error: ZodError) => {\n return {\n invalidFields: error.issues.reduce<OutputErrors>((collection, issue) => {\n const name = issue.path.join(\".\");\n if (!name) {\n return collection;\n }\n collection[name] = {\n code: issue.code,\n message: issue.message,\n data: {\n fatal: issue.fatal,\n path: issue.path\n }\n };\n\n return collection;\n }, {})\n };\n};\n\nexport const createZodError = (error: ZodError) => {\n return new WebinyError({\n message: `Validation failed.`,\n code: \"VALIDATION_FAILED_INVALID_FIELDS\",\n data: createValidationErrorData(error)\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAaA,MAAMC,yBAAyB,GAAIC,KAAe,IAAK;EACnD,OAAO;IACHC,aAAa,EAAED,KAAK,CAACE,MAAM,CAACC,MAAM,CAAe,CAACC,UAAU,EAAEC,KAAK,KAAK;MACpE,MAAMC,IAAI,GAAGD,KAAK,CAACE,IAAI,CAACC,IAAI,CAAC,GAAG,CAAC;MACjC,IAAI,CAACF,IAAI,EAAE;QACP,OAAOF,UAAU;MACrB;MACAA,UAAU,CAACE,IAAI,CAAC,GAAG;QACfG,IAAI,EAAEJ,KAAK,CAACI,IAAI;QAChBC,OAAO,EAAEL,KAAK,CAACK,OAAO;QACtBC,IAAI,EAAE;UACFC,KAAK,EAAEP,KAAK,CAACO,KAAK;UAClBL,IAAI,EAAEF,KAAK,CAACE;QAChB;MACJ,CAAC;MAED,OAAOH,UAAU;IACrB,CAAC,EAAE,CAAC,CAAC;EACT,CAAC;AACL,CAAC;AAEM,MAAMS,cAAc,GAAIb,KAAe,IAAK;EAC/C,OAAO,IAAIc,cAAW,CAAC;IACnBJ,OAAO,
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","createValidationErrorData","error","invalidFields","issues","reduce","collection","issue","name","path","join","code","message","data","fatal","createZodError","WebinyError","exports"],"sources":["createZodError.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ZodError } from \"zod/lib/ZodError\";\n\ninterface OutputError {\n code: string;\n data: Record<string, any> | null;\n message: string;\n}\n\nexport interface OutputErrors {\n [key: string]: OutputError;\n}\n\nconst createValidationErrorData = (error: ZodError) => {\n return {\n invalidFields: error.issues.reduce<OutputErrors>((collection, issue) => {\n const name = issue.path.join(\".\");\n if (!name) {\n return collection;\n }\n collection[name] = {\n code: issue.code,\n message: issue.message,\n data: {\n fatal: issue.fatal,\n path: issue.path\n }\n };\n\n return collection;\n }, {})\n };\n};\n\nexport const createZodError = (error: ZodError) => {\n return new WebinyError({\n message: `Validation failed.`,\n code: \"VALIDATION_FAILED_INVALID_FIELDS\",\n data: createValidationErrorData(error)\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAaA,MAAMC,yBAAyB,GAAIC,KAAe,IAAK;EACnD,OAAO;IACHC,aAAa,EAAED,KAAK,CAACE,MAAM,CAACC,MAAM,CAAe,CAACC,UAAU,EAAEC,KAAK,KAAK;MACpE,MAAMC,IAAI,GAAGD,KAAK,CAACE,IAAI,CAACC,IAAI,CAAC,GAAG,CAAC;MACjC,IAAI,CAACF,IAAI,EAAE;QACP,OAAOF,UAAU;MACrB;MACAA,UAAU,CAACE,IAAI,CAAC,GAAG;QACfG,IAAI,EAAEJ,KAAK,CAACI,IAAI;QAChBC,OAAO,EAAEL,KAAK,CAACK,OAAO;QACtBC,IAAI,EAAE;UACFC,KAAK,EAAEP,KAAK,CAACO,KAAK;UAClBL,IAAI,EAAEF,KAAK,CAACE;QAChB;MACJ,CAAC;MAED,OAAOH,UAAU;IACrB,CAAC,EAAE,CAAC,CAAC;EACT,CAAC;AACL,CAAC;AAEM,MAAMS,cAAc,GAAIb,KAAe,IAAK;EAC/C,OAAO,IAAIc,cAAW,CAAC;IACnBJ,OAAO,EAAE,oBAAoB;IAC7BD,IAAI,EAAE,kCAAkC;IACxCE,IAAI,EAAEZ,yBAAyB,CAACC,KAAK;EACzC,CAAC,CAAC;AACN,CAAC;AAACe,OAAA,CAAAF,cAAA,GAAAA,cAAA","ignoreList":[]}
|
package/generateId.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nanoid","require","_nanoidDictionary","DEFAULT_SIZE","generateAlphaNumericId","exports","customAlphabet","alphanumeric","generateAlphaNumericLowerCaseId","lowercase","numbers","generateAlphaId","uppercase","generateAlphaLowerCaseId","generateAlphaUpperCaseId","generateId","size","nanoid"],"sources":["generateId.ts"],"sourcesContent":["import { nanoid, customAlphabet } from \"nanoid\";\n/**\n * Package nanoid-dictionary is missing types\n */\n// @ts-expect-error\nimport { lowercase, uppercase, alphanumeric, numbers } from \"nanoid-dictionary\";\n\nconst DEFAULT_SIZE = 21;\n\nexport const generateAlphaNumericId = customAlphabet(alphanumeric, DEFAULT_SIZE);\n\nexport const generateAlphaNumericLowerCaseId = customAlphabet(\n `${lowercase}${numbers}`,\n DEFAULT_SIZE\n);\n\nexport const generateAlphaId = customAlphabet(`${lowercase}${uppercase}`, DEFAULT_SIZE);\n\nexport const generateAlphaLowerCaseId = customAlphabet(lowercase, DEFAULT_SIZE);\n\nexport const generateAlphaUpperCaseId = customAlphabet(uppercase, DEFAULT_SIZE);\n\nexport const generateId = (size = DEFAULT_SIZE): string => {\n return nanoid(size);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AAJA;AACA;AACA;AACA;;AAGA,MAAME,YAAY,GAAG,EAAE;AAEhB,MAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,IAAAE,sBAAc,EAACC,8BAAY,EAAEJ,YAAY,CAAC;AAEzE,MAAMK,+BAA+B,GAAAH,OAAA,CAAAG,+BAAA,GAAG,IAAAF,sBAAc,
|
|
1
|
+
{"version":3,"names":["_nanoid","require","_nanoidDictionary","DEFAULT_SIZE","generateAlphaNumericId","exports","customAlphabet","alphanumeric","generateAlphaNumericLowerCaseId","lowercase","numbers","generateAlphaId","uppercase","generateAlphaLowerCaseId","generateAlphaUpperCaseId","generateId","size","nanoid"],"sources":["generateId.ts"],"sourcesContent":["import { nanoid, customAlphabet } from \"nanoid\";\n/**\n * Package nanoid-dictionary is missing types\n */\n// @ts-expect-error\nimport { lowercase, uppercase, alphanumeric, numbers } from \"nanoid-dictionary\";\n\nconst DEFAULT_SIZE = 21;\n\nexport const generateAlphaNumericId = customAlphabet(alphanumeric, DEFAULT_SIZE);\n\nexport const generateAlphaNumericLowerCaseId = customAlphabet(\n `${lowercase}${numbers}`,\n DEFAULT_SIZE\n);\n\nexport const generateAlphaId = customAlphabet(`${lowercase}${uppercase}`, DEFAULT_SIZE);\n\nexport const generateAlphaLowerCaseId = customAlphabet(lowercase, DEFAULT_SIZE);\n\nexport const generateAlphaUpperCaseId = customAlphabet(uppercase, DEFAULT_SIZE);\n\nexport const generateId = (size = DEFAULT_SIZE): string => {\n return nanoid(size);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AAJA;AACA;AACA;AACA;;AAGA,MAAME,YAAY,GAAG,EAAE;AAEhB,MAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,IAAAE,sBAAc,EAACC,8BAAY,EAAEJ,YAAY,CAAC;AAEzE,MAAMK,+BAA+B,GAAAH,OAAA,CAAAG,+BAAA,GAAG,IAAAF,sBAAc,EACzD,GAAGG,2BAAS,GAAGC,yBAAO,EAAE,EACxBP,YACJ,CAAC;AAEM,MAAMQ,eAAe,GAAAN,OAAA,CAAAM,eAAA,GAAG,IAAAL,sBAAc,EAAC,GAAGG,2BAAS,GAAGG,2BAAS,EAAE,EAAET,YAAY,CAAC;AAEhF,MAAMU,wBAAwB,GAAAR,OAAA,CAAAQ,wBAAA,GAAG,IAAAP,sBAAc,EAACG,2BAAS,EAAEN,YAAY,CAAC;AAExE,MAAMW,wBAAwB,GAAAT,OAAA,CAAAS,wBAAA,GAAG,IAAAR,sBAAc,EAACM,2BAAS,EAAET,YAAY,CAAC;AAExE,MAAMY,UAAU,GAAGA,CAACC,IAAI,GAAGb,YAAY,KAAa;EACvD,OAAO,IAAAc,cAAM,EAACD,IAAI,CAAC;AACvB,CAAC;AAACX,OAAA,CAAAU,UAAA,GAAAA,UAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.42.0-beta.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"repository": {
|
|
@@ -15,26 +15,21 @@
|
|
|
15
15
|
"directory": "dist"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@webiny/error": "5.
|
|
18
|
+
"@webiny/error": "5.42.0-beta.0",
|
|
19
19
|
"mdbid": "1.0.0",
|
|
20
|
-
"nanoid": "3.3.
|
|
20
|
+
"nanoid": "3.3.8",
|
|
21
21
|
"nanoid-dictionary": "4.3.0",
|
|
22
22
|
"p-retry": "4.6.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"
|
|
28
|
-
"@babel/preset-typescript": "7.24.1",
|
|
29
|
-
"@babel/runtime": "7.24.1",
|
|
30
|
-
"@webiny/cli": "5.41.4-beta.6",
|
|
31
|
-
"@webiny/project-utils": "5.41.4-beta.6",
|
|
32
|
-
"rimraf": "5.0.5",
|
|
25
|
+
"@webiny/cli": "5.42.0-beta.0",
|
|
26
|
+
"@webiny/project-utils": "5.42.0-beta.0",
|
|
27
|
+
"rimraf": "6.0.1",
|
|
33
28
|
"ttypescript": "1.5.15",
|
|
34
29
|
"typescript": "4.9.5"
|
|
35
30
|
},
|
|
36
31
|
"peerDependencies": {
|
|
37
|
-
"zod": "^3.
|
|
32
|
+
"zod": "^3.23.8"
|
|
38
33
|
},
|
|
39
34
|
"scripts": {
|
|
40
35
|
"build": "yarn webiny run build",
|
|
@@ -47,5 +42,5 @@
|
|
|
47
42
|
]
|
|
48
43
|
}
|
|
49
44
|
},
|
|
50
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "ebf90f62ed3f28114ffdb012b7e5f80988af53d3"
|
|
51
46
|
}
|
package/zeroPad.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["zeroPad","version","amount","padStart","exports"],"sources":["zeroPad.ts"],"sourcesContent":["/**\n * Used when we need to create an ID of some data record.\n * Or, for example, when adding the revision record to the DynamoDB table.\n */\nexport const zeroPad = (version: string | number, amount = 4): string => {\n return `${version}`.padStart(amount, \"0\");\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,OAAO,GAAGA,CAACC,OAAwB,EAAEC,MAAM,GAAG,CAAC,KAAa;EACrE,
|
|
1
|
+
{"version":3,"names":["zeroPad","version","amount","padStart","exports"],"sources":["zeroPad.ts"],"sourcesContent":["/**\n * Used when we need to create an ID of some data record.\n * Or, for example, when adding the revision record to the DynamoDB table.\n */\nexport const zeroPad = (version: string | number, amount = 4): string => {\n return `${version}`.padStart(amount, \"0\");\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,OAAO,GAAGA,CAACC,OAAwB,EAAEC,MAAM,GAAG,CAAC,KAAa;EACrE,OAAO,GAAGD,OAAO,EAAE,CAACE,QAAQ,CAACD,MAAM,EAAE,GAAG,CAAC;AAC7C,CAAC;AAACE,OAAA,CAAAJ,OAAA,GAAAA,OAAA","ignoreList":[]}
|