@agnostack/next-shopify 1.15.0-beta.7 → 1.15.0-beta.8
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/CHANGELOG.md +7 -0
- package/dist/umd/verification.js +14 -8
- package/dist/umd/verification.js.map +1 -1
- package/node_modules/browser-monads-ts/LICENSE +21 -0
- package/node_modules/browser-monads-ts/README.md +46 -0
- package/node_modules/browser-monads-ts/dist/browser-monads-ts.cjs.js +2 -0
- package/node_modules/browser-monads-ts/dist/browser-monads-ts.cjs.js.map +1 -0
- package/node_modules/browser-monads-ts/dist/browser-monads-ts.es.js +12 -0
- package/node_modules/browser-monads-ts/dist/browser-monads-ts.es.js.map +1 -0
- package/node_modules/browser-monads-ts/dist/index.d.ts +5 -0
- package/node_modules/browser-monads-ts/dist/index.d.ts.map +1 -0
- package/node_modules/browser-monads-ts/package.json +79 -0
- package/node_modules/nothing-mock/LICENSE +21 -0
- package/node_modules/nothing-mock/README.md +266 -0
- package/node_modules/nothing-mock/dist/nothing-mock.es.js +2 -0
- package/node_modules/nothing-mock/dist/nothing-mock.es.js.map +1 -0
- package/node_modules/nothing-mock/dist/nothing-mock.js +2 -0
- package/node_modules/nothing-mock/dist/nothing-mock.js.map +1 -0
- package/node_modules/nothing-mock/dist/nothing-mock.modern.js +2 -0
- package/node_modules/nothing-mock/dist/nothing-mock.modern.js.map +1 -0
- package/node_modules/nothing-mock/dist/nothing-mock.umd.js +2 -0
- package/node_modules/nothing-mock/dist/nothing-mock.umd.js.map +1 -0
- package/node_modules/nothing-mock/index.d.ts +6 -0
- package/node_modules/nothing-mock/package.json +29 -0
- package/node_modules/nothing-mock/src/index.js +15 -0
- package/package.json +4 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.15.0-beta.8](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.7...v1.15.0-beta.8) (2023-12-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* added back bundle for monads ([99f8aa2](https://github.com/agnostack/next-shopify/commit/99f8aa25add4f7d1e7e364e9a6c33bd524ef3140))
|
|
7
|
+
|
|
1
8
|
# [1.15.0-beta.7](https://github.com/agnostack/next-shopify/compare/v1.15.0-beta.6...v1.15.0-beta.7) (2023-12-08)
|
|
2
9
|
|
|
3
10
|
|
package/dist/umd/verification.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@agnostack/next-shopify/umd-verification"] = {}
|
|
5
|
-
})(this, (function (exports
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@agnostack/next-shopify/umd-verification"] = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
|
+
|
|
7
|
+
var n,r=((n=function(){return r}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return ""},n.valueOf=function(){return !1},new Proxy(Object.freeze(n),{get:function(n,t){return n.hasOwnProperty(t)?n[t]:r}})),u=function(n){return n===r};
|
|
8
|
+
|
|
9
|
+
let win = global.window;
|
|
10
|
+
let exists = (variable) => !u(variable);
|
|
11
|
+
let window = typeof win !== "undefined" ? win : r;
|
|
6
12
|
|
|
7
13
|
/* eslint-disable no-use-before-define */
|
|
8
14
|
|
|
@@ -115,8 +121,8 @@
|
|
|
115
121
|
};
|
|
116
122
|
|
|
117
123
|
const getTextDecoder = async () => {
|
|
118
|
-
if (
|
|
119
|
-
return
|
|
124
|
+
if (exists(window) && (typeof window?.TextDecoder === 'function')) {
|
|
125
|
+
return window.TextDecoder
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
try {
|
|
@@ -129,8 +135,8 @@
|
|
|
129
135
|
};
|
|
130
136
|
|
|
131
137
|
const getTextEncoder = async () => {
|
|
132
|
-
if (
|
|
133
|
-
return
|
|
138
|
+
if (exists(window) && (typeof window?.TextEncoder === 'function')) {
|
|
139
|
+
return window.TextEncoder
|
|
134
140
|
}
|
|
135
141
|
|
|
136
142
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification.js","sources":["../../src/shared/display.js","../../src/shared/subtlecrypto.js","../../src/shared/request.js","../../src/verification/utils/errors.js","../../src/verification/utils/rawbody.js","../../src/verification/verification.js"],"sourcesContent":["/* eslint-disable no-use-before-define */\n\n// #region lib-core\n// TODO!!!: keep in sync between next-shopify and lib-core (and lib-utils-js at bottom)\nexport const normalizeShopifyId = (shopifyData) => {\n const isString = isType(shopifyData, 'string')\n if (isString && !shopifyData.startsWith('gid:')) {\n if (!isNumericOnly(shopifyData)) {\n return {}\n }\n\n return {\n id: `${shopifyData}`,\n }\n }\n\n const { id: _entityId, legacyResourceId } = isString\n ? { id: shopifyData }\n : ensureObject(shopifyData)\n\n if (stringEmpty(_entityId) && stringEmpty(legacyResourceId)) {\n return {}\n }\n\n const entity_id = ensureString(_entityId)\n const { entity_type, parsedId } = entity_id.match(/^gid:\\/\\/shopify\\/(?<entity_type>.*)\\/(?<parsedId>[0-9]+).*$/)?.groups ?? {}\n const id = ensureString(parsedId || legacyResourceId)\n\n const hasEntityId = stringNotEmpty(entity_id)\n const hasEntityType = stringNotEmpty(entity_type)\n\n return {\n ...stringNotEmpty(id) && { id },\n ...hasEntityId && { entity_id },\n ...hasEntityType && { entity_type },\n ...(hasEntityId && hasEntityType) && {\n gid: `gid://shopify/${entity_type}/${entity_id}`,\n },\n }\n}\n\nexport const random = (max = 100, min = 1) => {\n const floor = Math.min(max, min)\n return Math.floor(Math.random() * (max - floor + 1)) + floor\n}\n\nexport const nextRandom = (max = 100, min = 1) => {\n const maximum = Math.max(max, 0)\n const minimum = Math.max(min, 0)\n\n let randomNumber = maximum\n\n if (maximum > minimum) {\n do {\n randomNumber = random(maximum, minimum)\n } while (randomNumber === nextRandom.last)\n\n nextRandom.last = randomNumber\n }\n\n return randomNumber\n}\n\nexport const arrayRandom = (_values, _max = 1) => {\n const values = ensureArray(_values)\n const valuesLength = values.length\n const maxLength = Math.min(_max, valuesLength)\n\n if (valuesLength <= maxLength) {\n return values\n }\n\n const arrayLength = valuesLength - 1\n const randomValues = []\n do {\n const newVal = values[nextRandom(arrayLength, 0)]\n if (!randomValues.includes(newVal)) {\n randomValues.push(newVal)\n }\n } while (randomValues.length < maxLength)\n\n return randomValues\n}\n\nexport const arrayRandomItem = (_values) => (\n arrayRandom(_values)[0]\n)\n\nexport const isArray = (value) => (\n // eslint-disable-next-line eqeqeq\n (value != undefined) && Array.isArray(value)\n)\n\nexport const isSet = (value) => (\n // eslint-disable-next-line eqeqeq\n (value != undefined) && (value instanceof Set)\n)\n\nexport const isType = (value, type) => (\n // eslint-disable-next-line eqeqeq, valid-typeof\n (value != undefined) && (typeof value === type)\n)\n\nexport const isTypeEnhanced = (value, type) => {\n switch (true) {\n case (type === 'set'): {\n return isSet(value)\n }\n\n case (type === 'array'): {\n return (\n isArray(value) &&\n !isSet(value)\n )\n }\n\n case (type === 'object'): {\n return (\n isType(value, type) &&\n !isArray(value)\n )\n }\n\n default: {\n return isType(value, type)\n }\n }\n}\n\nexport const safeTrim = (value) => {\n if (isType(value, 'string')) {\n // eslint-disable-next-line no-param-reassign\n value = value.trim()\n }\n\n return value\n}\n\nexport const safeParse = (value, trim) => {\n if (isType(value, 'string')) {\n if (trim) {\n // eslint-disable-next-line no-param-reassign\n value = safeTrim(value)\n }\n\n if (value.startsWith('{') || value.startsWith('[') || value.startsWith('\"')) {\n // eslint-disable-next-line no-param-reassign\n value = JSON.parse(value)\n }\n }\n\n // TODO: should this be value ?? {}\n return value\n}\n\nexport const ensureString = (string) => (\n string ? `${string}` : ''\n)\n\n// HMMM: what if 'string' is an object?\nexport const ensureStringOnly = (string) => (\n // eslint-disable-next-line eqeqeq\n (string != undefined) ? `${string}` : ''\n)\n\nexport const ensureStringAscii = (string) => (\n // eslint-disable-next-line no-control-regex\n ensureStringOnly(string).replace(/[^\\x00-\\x7F]/g, '')\n)\n\nexport const ensureStringClean = (string) => (\n // eslint-disable-next-line no-control-regex\n ensureStringOnly(string).replace(/[^a-z0-9_-]/gi, '')\n)\n\nexport const ensureAlphaNumeric = (string) => (\n // eslint-disable-next-line no-control-regex\n ensureStringOnly(string).replace(/[^a-z0-9]/gi, '')\n)\n\nexport const isNumericOnly = (value) => {\n const [matched] = `${value}`.match(/^([0-9]+)$/) ?? []\n // eslint-disable-next-line eqeqeq\n return (matched != undefined)\n}\n\nexport const isNumericNegatable = (value) => {\n const [matched] = `${value}`.match(/^(-?[0-9]+(\\.[0-9]+)?)?$/) ?? []\n // eslint-disable-next-line eqeqeq\n return (matched != undefined)\n}\n\n// TODO: explore places using ensureNumeric to move to isNumericNegatable\nexport const ensureNumeric = (string) => (\n Number(ensureString(string).replace(/[^0-9.]/gi, ''))\n)\n\nexport const ensureNumericOnly = (string) => (\n Number(ensureString(string).replace(/[^0-9]/gi, ''))\n)\n\n// TODO: update regex to handle negative number returns negative. Something like (?!\\d\\.)(-?\\d+(\\.\\d)?)\nexport const ensureNumericNegatable = (string) => (\n Number(ensureString(string).replace(/[^0-9.-]/gi, ''))\n)\n\nexport const ensureNumericConstrained = (value, { min: _min = 0, max: _max = 100 } = {}) => {\n const min = ensureNumericNegatable(_min)\n const max = ensureNumericNegatable(_max)\n\n return Math.max(\n min,\n Math.min(ensureNumeric(value), max)\n )\n}\n\nexport const ensureArray = (array = []) => (\n // eslint-disable-next-line no-nested-ternary\n !array ? [] : Array.isArray(array) ? array : [array]\n)\n\nexport const ensureArraySet = (arrayOrSet) => (\n ensureArray(isSet(arrayOrSet) ? [...arrayOrSet] : arrayOrSet)\n)\n\nexport const arrayEmpty = (array, disableEmptyString = false) => (\n // eslint-disable-next-line eqeqeq\n !array || !array.length || (array.length === 1 && (array[0] == undefined || (disableEmptyString && stringEmpty(array[0]))))\n)\n\nexport const arrayNotEmpty = (array, disableEmptyString = false) => (\n // eslint-disable-next-line eqeqeq\n !arrayEmpty(array) && array[0] != undefined && (!disableEmptyString || stringNotEmpty(array[0]))\n)\n\nexport const findLastMatch = (array, filterCallback = (value) => (value)) => (\n ensureArray(array).filter(filterCallback).slice(-1)[0]\n)\n\nexport const ensureObject = (object) => (\n object ?? {}\n)\n\n// NOTE: this does not ensure !isType(string)\nexport const objectEmpty = (object) => (\n !object || !Object.keys(object).length\n)\n\nexport const objectNotEmpty = (object) => (\n !objectEmpty(object)\n)\n\nexport const nullable = (object) => (\n (!object || (object === 'null') || (object === undefined) || (object === null))\n ? null // TODO: explore undefined here??\n : object\n)\n\nexport const objectContainsAnyValue = (object) => (\n Object.values(ensureObject(object)).some((value) => nullable(value))\n)\n\nconst isUndefined = (value) => (\n // eslint-disable-next-line eqeqeq\n value == undefined\n)\n\nexport const cleanObject = (object, allowEmptyLeafs, isEmptyCallback) => (\n Object.entries(ensureObject(object)).reduce((\n _cleanedObject,\n [key, _value]\n ) => {\n if (!allowEmptyLeafs && (isEmptyCallback?.(_value) ?? isUndefined(_value))) {\n return _cleanedObject // skip key if null or undefined\n }\n\n const value = !Array.isArray(_value)\n ? cleanObjectValue(_value, allowEmptyLeafs, isEmptyCallback)\n : _value.reduce((_data, __value) => ([\n ..._data,\n cleanObjectValue(__value, allowEmptyLeafs, isEmptyCallback)\n ]), [])\n\n return {\n ..._cleanedObject,\n [key]: value,\n }\n }, {})\n)\n\nconst cleanObjectValue = (value, allowEmptyLeafs, isEmptyCallback) => (\n isType(value, 'object') ? cleanObject(value, allowEmptyLeafs, isEmptyCallback) : value\n)\n\nexport const stringNotEmptyOnly = (stringable) => {\n const string = ensureStringOnly(stringable)\n return ((string.length > 0) && !['null', 'undefined'].includes(string))\n}\n\nexport const stringEmptyOnly = (stringable) => (\n !stringNotEmptyOnly(stringable)\n)\n\nexport const stringNotEmpty = (stringable) => {\n const string = ensureString(stringable)\n return ((string.length > 0) && !['null', 'undefined'].includes(string))\n}\n\nexport const stringEmpty = (stringable) => (\n !stringNotEmpty(stringable)\n)\n\nconst splitString = (splitting, index = splitting.length) => {\n const string = ensureString(splitting)\n return [string.slice(0, index), string.slice(index)]\n}\n\nexport const compareNumber = (number1 = 0, number2 = 0) => (\n number1 - number2\n)\n\nexport const compareString = (string1, string2) => {\n if (stringEmpty(string1)) {\n return 1\n }\n\n if (stringEmpty(string2)) {\n return -1\n }\n\n return ensureString(string1).localeCompare(string2)\n}\n\nexport const compareEntryKeys = ([string1], [string2]) => (\n compareString(string1, string2)\n)\n\nexport const objectToSortedString = (object, separator = '') => (\n Object.entries(ensureObject(object))\n .sort(compareEntryKeys)\n .map(([key, value]) => `${key}=${value}`)\n .join(separator)\n)\n\nexport const isHTML = (string) => (\n (string?.startsWith?.('<') || string?.startsWith?.('\\n<')) ?? false\n)\n\nexport const freeze = (logMessage, object, type = 'log') => {\n console[type](logMessage, !object ? object : JSON.parse(JSON.stringify(ensureObject(object))))\n}\n\nexport const replaceSpaces = (string, replacement = '') => (\n !isType(string, 'string')\n ? ''\n : string.replace(/\\s/g, replacement)\n)\n\nconst recase = (string, replacement = '') => (\n !isType(string, 'string')\n ? ''\n : string\n .replace(/[^a-zA-Z0-9]+/g, replacement)\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/([0-9])([^0-9])/g, '$1-$2')\n .replace(/([^0-9])([0-9])/g, '$1-$2')\n .replace(/[-_]+/g, replacement)\n .replace(new RegExp(`${replacement}$`), '')\n .toLowerCase()\n)\n\nexport const zencase = (string, replacement = '-') => (\n !isType(string, 'string')\n ? ''\n : replaceSpaces(string, replacement)\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(new RegExp(`${replacement}$`), '')\n .toLowerCase()\n)\n\nexport const dashcase = (string) => (\n recase(string, '-')\n)\n\nexport const undashcase = (string, replacement = ' ') => (\n ensureString(string).replace(/-/g, replacement).trim()\n)\n\nexport const snakecase = (string) => (\n recase(string, '_')\n)\n\nexport const unsnakecase = (string, replacement = ' ') => (\n ensureString(string).replace(/_/g, replacement).trim()\n)\n\nexport const uppercase = (string) => (\n ensureString(string).toUpperCase()\n)\n\nexport const lowercase = (string, defaultValue = '') => (\n !stringNotEmpty(string)\n ? defaultValue\n : ensureString(string).toLowerCase()\n)\n\nexport const slugify = (string) => (\n lowercase(dashcase(string))\n)\n\nexport const capitalize = (string) => {\n const parts = splitString(string, 1)\n return `${uppercase(parts[0])}${parts[1]}`\n}\n\nexport const camelCase = (string) => (\n stringNotEmpty(string)\n ? unsnakecase(undashcase(string)).replace(/\\w\\S*/g, (word, charIndex) => {\n if (charIndex === 0) {\n return lowercase(word)\n }\n return `${uppercase(word.charAt(0))}${lowercase(word.substr(1))}`\n }).split(' ').join('')\n : ''\n)\n\nexport const titleCase = (string, _overrides) => {\n if (!stringNotEmpty(string)) {\n return ''\n }\n\n const overrides = {\n 'add-ons': 'Add-Ons',\n agnostack: 'agnoStack',\n ai: 'AI',\n b2b: 'B2B',\n b2c: 'B2C',\n cartcollab: 'CartCollab',\n 'cartcollab(sm)': 'CartCollab(SM)',\n chatgpt: 'ChatGPT',\n covid: 'COVID',\n covid19: 'COVID-19',\n 'covid-19': 'COVID-19',\n crm: 'CRM',\n elasticpath: 'Elastic Path',\n ecommerce: 'eCommerce',\n 'e-commerce': 'eCommerce',\n faqs: 'FAQs',\n gpt: 'GPT',\n 'smile.io': 'Smile.io',\n 'stamped.io': 'Stamped.io',\n 'judge.me': 'Judge.me',\n 'influence.io': 'Influence.io',\n keepsmallstrong: 'KeepSmallStrong',\n loyaltylion: 'LoyaltyLion',\n openai: 'OpenAI',\n paypal: 'PayPal',\n 'postscript.io': 'Postscript.io',\n recharge: 'ReCharge',\n 'stay.ai': 'Stay.ai',\n 'stay ai': 'Stay Ai',\n shipengine: 'ShipEngine',\n shipperhq: 'ShipperHQ',\n shipstation: 'ShipStation',\n taxjar: 'TaxJar',\n yotpo: 'YotPo',\n ..._overrides,\n }\n\n const stringParts = lowercase(string)\n .split(' ')\n .reduce((\n _stringParts,\n _stringPart\n ) => {\n const stringPart = overrides[_stringPart] ?? _stringPart\n .replace(/([A-Z]+)/g, ' $1')\n .replace(/\\s\\s+/g, ' ')\n .replace(/(\\b[a-z](?!\\s)*)/g, (firstChar) => uppercase(firstChar))\n\n return [\n ..._stringParts,\n ...stringNotEmpty(stringPart) ? [stringPart] : []\n ]\n }, [])\n\n return stringParts.join(' ')\n}\n\nexport const removeLeadingSlash = (string) => (\n ensureString(string).replace(/^\\//, '')\n)\n\nexport const removeLeadingTrailingQuotes = (string) => (\n ensureString(string).replace(/^\"|\"$/g, '')\n)\n\n// TODO: not sure if this should remove multipel at end or just one (as it does now)?\nexport const removeTrailingSlash = (string) => (\n ensureString(string).replace(/\\/$/, '')\n)\n\nexport const removeLeadingTrailingSlash = (string) => (\n removeTrailingSlash(removeLeadingSlash(string))\n)\n\nexport const ensureLeadingSlash = (string) => (\n `/${removeLeadingSlash(string)}`\n)\n\nexport const ensureTrailingSlash = (string) => (\n `${removeTrailingSlash(string)}/`\n)\n\nexport const ensureExtension = (string, extension) => {\n if (stringEmpty(extension)) {\n return string\n }\n\n const filePath = string.match(/(.*)\\..+$/)?.[1] ?? string\n\n return `${filePath}.${extension}`\n}\n\nexport const wrappedEncode = (basePath, _wrappingPath) => {\n const wrappingPath = ensureString(_wrappingPath)\n if (stringEmpty(basePath)) {\n return wrappingPath\n }\n\n return `${basePath}${encodeURIComponent(wrappingPath)}`\n}\n\nexport const splitCommas = (value) => (\n ensureString(value)\n .replace(/, /g, ',')\n .split(',')\n .reduce((_values, _value) => {\n const __value = safeTrim(_value)\n return [\n ..._values,\n ...stringNotEmpty(__value) ? [__value] : [] // TODO: explore stringEmptyOnly?\n ]\n }, [])\n)\n\nexport const combineCommas = (values) => (\n [...new Set(\n ensureArray(values).reduce((\n _combined,\n value\n ) => ([\n ..._combined,\n ...splitCommas(value)\n ]), [])\n )]\n)\n\nexport const normalizeArray = (input, separator = ' ') => {\n const inputArray = ensureArray(input)\n\n return inputArray.reduce((normalized, _ignore, index) => ([\n ...normalized,\n inputArray.slice(0, index + 1).join(separator)\n ]), []).reverse()\n}\n\nexport const arrayToObject = (arrayable, key) => (\n ensureArray(arrayable).reduce((_object, item) => ({\n ..._object,\n [item?.[key]]: item,\n }), {})\n)\n\nexport const isTrue = (value, falsy) => {\n const string = ensureString(value)\n return ![...ensureArray(falsy), '', 'false'].includes(string)\n}\n\n// TODO: move all uses of parseKeywords to parseKeywordGroups\nexport const parseKeywords = (keywordGroup, previous) => (\n [...new Set(ensureArray(keywordGroup).reduce((_parsedKeywords, keyword) => {\n const keywords = splitCommas(keyword)\n\n return [\n ..._parsedKeywords,\n ...keywords.filter((_keyword) => stringNotEmpty(_keyword))\n ]\n }, ensureArray(previous)))].join(', ')\n)\n\nexport const parseKeywordGroups = (keywordGroups) => {\n const parsedKeywords = ensureArray(keywordGroups).reduce((_parsedKeywords, keywordGroup) => ([\n ..._parsedKeywords,\n ...ensureArray(keywordGroup).reduce((_parsedGroupKeywords, keyword) => {\n const keywords = splitCommas(keyword)\n\n return [\n ..._parsedGroupKeywords,\n ...keywords.filter((_keyword) => stringNotEmpty(_keyword))\n ]\n }, [])\n ]), [])\n\n return [...new Set(parsedKeywords)].join(', ')\n}\n\nexport const parseProjectName = (_name) => {\n const name = ensureString(_name)\n const [, organization, ...parts] = /(@.*)([\\\\]+|\\/)+(.*)/.exec(name) ?? []\n const projectName = organization ? name.replace(organization, '').replace('/', '') : name\n\n return {\n name,\n parts,\n organization,\n projectName,\n }\n}\n\nexport const parseProject = (packageInfo) => {\n const { shortName, owner: _appOwner, name: _name, appName: _appName, keywords, siteName: _siteName } = packageInfo ?? {}\n const { name, organization, projectName } = parseProjectName(_name)\n\n const appName = _appName ?? projectName?.slice(projectName?.indexOf('-') + 1)\n const siteName = _siteName ?? projectName?.slice(projectName?.indexOf('-') + 1)\n const companyName = titleCase(organization?.replace('@', ''))\n const appOwner = _appOwner ?? companyName\n\n return [{\n keywords,\n appOwner,\n appName,\n siteName,\n shortName,\n companyName,\n projectName,\n }, organization, name]\n}\n\n// #endregion lib-core\n\n// #region lib-utils-js\n\nexport const querystringToObject = (queryString) => {\n if (stringEmpty(queryString)) {\n return {}\n }\n\n const urlParams = new URLSearchParams(queryString)\n return Object.fromEntries(urlParams)\n}\n\nexport const arrayIncludesAll = (_values, comparison) => {\n const values = ensureArray(_values)\n return ensureArray(comparison).every((value) => (\n stringNotEmpty(value) && values.includes(value)\n ))\n}\n\nexport const arraysMatch = (array1, array2) => (\n arrayIncludesAll(array1, array2) && arrayIncludesAll(array2, array1)\n)\n\nexport const appendQuery = (_basePath, queryString) => {\n const basePath = ensureString(_basePath)\n if (stringEmpty(queryString)) {\n return basePath\n }\n return `${basePath}${basePath.includes('?') ? '&' : '?'}${queryString}`\n}\n","import { exists, window } from 'browser-monads-ts'\n\nimport { ensureArray, ensureString, objectEmpty } from './display'\n\nconst getWebCrypto = async () => {\n try {\n const crypto = (await import('isomorphic-webcrypto')).default\n return crypto\n } catch (error) {\n console.error('Failed to import isomorphic-webcrypto', error)\n throw error\n }\n}\n\nconst getTextDecoder = async () => {\n if (exists(window) && (typeof window?.TextDecoder === 'function')) {\n return window.TextDecoder\n }\n\n try {\n const TextDecoder = (await import('util')).TextDecoder\n return TextDecoder\n } catch (error) {\n console.error('Failed to import utils.TextDecoder', error)\n throw error\n }\n}\n\nconst getTextEncoder = async () => {\n if (exists(window) && (typeof window?.TextEncoder === 'function')) {\n return window.TextEncoder\n }\n\n try {\n const TextEncoder = (await import('util')).TextEncoder\n return TextEncoder\n } catch (error) {\n console.error('Failed to import utils.TextEncoder', error)\n throw error\n }\n}\n\nconst timingSafeEqual = (value1, value2) => {\n if (\n (value1 == undefined) ||\n (value2 == undefined) ||\n (value1.length !== value2.length)\n ) {\n return false\n }\n\n let result = 0\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < value1.length; i++) {\n // eslint-disable-next-line no-bitwise\n result |= value1[i] ^ value2[i]\n }\n\n return (result === 0)\n}\n\nconst stringToHex = (stringValue) => (\n Array.from(ensureString(stringValue), (char) => (\n char.charCodeAt(0).toString(16).padStart(2, '0')\n )).join('')\n)\n\nconst hexToString = (hexValue) => (\n ensureArray(\n ensureString(hexValue).match(/.{1,2}/g)\n )\n .map((byte) => String.fromCharCode(parseInt(byte, 16)))\n .join('')\n)\n\nconst arrayBufferToString = async (arrayBuffer) => {\n const uint8Array = new Uint8Array(arrayBuffer)\n const Decoder = await getTextDecoder()\n return new Decoder().decode(uint8Array)\n}\n\nconst arrayToArrayBuffer = (array) => (\n (ArrayBuffer.from != undefined)\n ? ArrayBuffer.from(array)\n : new Uint8Array(array).buffer\n)\n\nconst ensureArrayBuffer = (arrayOrArrayBuffer) => (\n (arrayOrArrayBuffer instanceof ArrayBuffer)\n ? arrayOrArrayBuffer\n : arrayToArrayBuffer(arrayOrArrayBuffer)\n)\n\nconst generateKeyPair = async () => {\n const crypto = await getWebCrypto()\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDH',\n namedCurve: 'P-256',\n },\n true,\n ['deriveKey']\n )\n\n return keyPair\n}\n\nconst getKeyOperations = (keyType) => {\n switch (keyType) {\n case 'private':\n case 'privateKey': {\n return ['deriveKey']\n }\n\n case 'secret':\n case 'secretKey':\n case 'sharedSecret': {\n return ['encrypt', 'decrypt'] \n }\n\n default: {\n return []\n }\n }\n}\n\nconst getKeyAlgorythm = (keyType) => {\n switch (keyType) {\n case 'derivedKey':\n case 'derived':\n case 'secret':\n case 'secretKey':\n case 'sharedSecret': {\n return {\n name: 'AES-GCM',\n }\n }\n\n default: {\n return {\n name: 'ECDH',\n namedCurve: 'P-256',\n }\n }\n }\n}\n\nconst generateHMAC = async (message, derivedKey) => {\n if (!message || !derivedKey) {\n return undefined\n } \n\n const crypto = await getWebCrypto()\n const Encoder = await getTextEncoder()\n\n const signature = await crypto.subtle.sign(\n 'HMAC',\n derivedKey,\n new Encoder().encode(message)\n )\n\n return stringToHex(\n arrayBufferToString(signature)\n )\n}\n\nconst verifyHMAC = async (message, derivedKey, verifiableHMAC) => {\n const calculatedHMAC = await generateHMAC(message, derivedKey)\n\n return timingSafeEqual(calculatedHMAC, verifiableHMAC)\n}\n\nconst getStorableKey = async (key) => {\n const crypto = await getWebCrypto()\n\n const exportedJWK = await crypto.subtle.exportKey('jwk', key)\n return stringToHex(JSON.stringify(exportedJWK))\n}\n\nconst restoreStorableKey = async (keyType, storableHex) => {\n if (!storableHex) {\n return undefined\n }\n const crypto = await getWebCrypto()\n\n const exportedJWK = JSON.parse(hexToString(storableHex) || '{}')\n if (objectEmpty(exportedJWK)) {\n return undefined\n }\n\n return crypto.subtle.importKey(\n 'jwk',\n exportedJWK,\n getKeyAlgorythm(keyType),\n true,\n getKeyOperations(keyType)\n )\n}\n\nconst getStorableKeyPair = async (keyPair) => {\n const storableKeys = {}\n\n // eslint-disable-next-line no-restricted-syntax\n for (const [keyType, key] of Object.entries(keyPair)) {\n // eslint-disable-next-line no-await-in-loop\n storableKeys[keyType] = await getStorableKey(key)\n }\n\n return storableKeys\n}\n\nconst restoreStorableKeyPair = async (keyPair) => {\n const restoredKeys = {}\n\n // eslint-disable-next-line no-restricted-syntax\n for (const [keyType, key] of Object.entries(keyPair)) {\n // eslint-disable-next-line no-await-in-loop\n restoredKeys[keyType] = await restoreStorableKey(keyType, key)\n }\n\n return restoredKeys\n}\n\nconst deriveSharedKey = async ({ publicKey, privateKey }) => {\n if (!publicKey || !privateKey) {\n return undefined\n }\n\n const crypto = await getWebCrypto()\n const derivedKey = await crypto.subtle.deriveKey(\n {\n name: 'ECDH',\n public: publicKey,\n },\n privateKey,\n {\n name: 'AES-GCM',\n length: 256,\n },\n true,\n ['encrypt', 'decrypt']\n )\n return derivedKey\n}\n\nconst deriveHMACKey = async ({ publicKey, privateKey }) => {\n if (!publicKey || !privateKey) {\n return undefined\n }\n\n const crypto = await getWebCrypto()\n const derivedKey = await crypto.subtle.deriveKey(\n {\n name: 'ECDH',\n public: publicKey,\n },\n privateKey,\n {\n name: 'HMAC',\n hash: { name: 'SHA-256' },\n length: 256, // Adjusted key length, e.g., 128 bits\n },\n true,\n ['sign', 'verify']\n )\n return derivedKey\n}\n\nconst getVerificationKeys = async ({ publicKey, privateKey }) => {\n if (!publicKey || !privateKey) {\n return {}\n }\n\n const sharedKeyPair = await restoreStorableKeyPair({ publicKey, privateKey })\n const derivedHMACKey = await deriveHMACKey(sharedKeyPair)\n const derivedSecretKey = await deriveSharedKey(sharedKeyPair)\n\n return {\n derivedSecretKey,\n derivedHMACKey,\n }\n}\n\nconst encryptMessage = async (decryptedMessage, derivedKey) => {\n if (!decryptedMessage || !derivedKey) {\n return undefined\n }\n\n const crypto = await getWebCrypto()\n const iv = crypto.getRandomValues(new Uint8Array(12))\n const Encoder = await getTextEncoder()\n const encodedMessage = new Encoder().encode(decryptedMessage)\n const ciphertext = await crypto.subtle.encrypt(\n {\n name: 'AES-GCM',\n iv,\n },\n derivedKey,\n encodedMessage\n )\n\n const encryptedMessage = new Uint8Array([\n ...iv,\n ...new Uint8Array(ciphertext)\n ])\n return Array.from(encryptedMessage)\n}\n\nconst decryptMessage = async (encryptedMessage, derivedKey) => {\n if (!encryptedMessage || !derivedKey) {\n return undefined\n }\n\n const crypto = await getWebCrypto()\n // NOTE: this presumed an array or arrayBuffer coming in as encryptedMessage (will fail w/ IV error if its a string)\n const encryptedArrayBuffer = ensureArrayBuffer(encryptedMessage)\n const iv = encryptedArrayBuffer.slice(0, 12)\n const ciphertext = encryptedArrayBuffer.slice(12)\n\n const decryptedArrayBuffer = await crypto.subtle.decrypt(\n {\n name: 'AES-GCM',\n iv,\n },\n derivedKey,\n ciphertext\n )\n\n const Decoder = await getTextDecoder()\n const decryptedMessage = new Decoder().decode(decryptedArrayBuffer)\n return decryptedMessage\n}\n\nexport const subtle = {\n generateKeyPair,\n generateHMAC,\n verifyHMAC,\n getStorableKey,\n getStorableKeyPair,\n restoreStorableKeyPair,\n deriveSharedKey,\n deriveHMACKey,\n getVerificationKeys,\n encryptMessage,\n decryptMessage,\n}\n","import {\n ensureLeadingSlash,\n stringEmpty,\n uppercase,\n safeParse,\n} from './display'\n\nconst TEMP_HOSTNAME = 'xyz.com'\nconst REMOVABLE_KEYS = ['shop', 'host']\n\nexport const HEADER_CONTENT_TYPE = 'Content-Type'\nexport const CONTENT_TYPES = {\n APPLICATION_JSON: 'application/json',\n}\n\nexport const getRequestMethod = (body, _method) => {\n const method = _method ?? (body ? 'POST' : 'GET')\n\n return uppercase(method)\n}\n\nexport const prepareRequestOptions = ({ method: _method, body: _body, headers: _header, ...requestOptions } = {}) => {\n const method = getRequestMethod(_body, _method)\n\n const headers = {\n [HEADER_CONTENT_TYPE]: CONTENT_TYPES.APPLICATION_JSON,\n ..._header,\n }\n\n let body = _body\n if (body && headers[HEADER_CONTENT_TYPE].startsWith(CONTENT_TYPES.APPLICATION_JSON)) {\n body = JSON.stringify(safeParse(body))\n }\n\n return {\n method,\n headers,\n ...(body && (method !== 'GET')) && { body },\n ...requestOptions,\n }\n}\n\nconst convertToURL = (uri) => {\n if (stringEmpty(uri)) {\n return undefined\n }\n\n const protocolRegex = /^(https?:\\/\\/).+/i\n\n if (!protocolRegex.test(uri)) {\n return new URL(`https://${TEMP_HOSTNAME}${ensureLeadingSlash(uri)}`)\n }\n\n return new URL(uri)\n}\n\nexport const normalizeURIParts = (uri) => {\n const urlObject = convertToURL(uri)\n if (!urlObject) {\n return undefined\n }\n\n REMOVABLE_KEYS.forEach((key) => urlObject.searchParams.delete(key))\n\n return {\n ...(urlObject.hostname !== TEMP_HOSTNAME) && {\n origin: urlObject.origin,\n },\n pathname: urlObject.pathname,\n search: urlObject.search,\n }\n}\n","export class VerificationError extends Error {\n constructor(message, _data) {\n super(message)\n const { code = 500, ...data } = _data ?? {}\n this.code = code\n this.data = data\n this.name = 'VerificationError'\n Object.setPrototypeOf(this, VerificationError.prototype)\n }\n}\n","// import getRawBody from 'raw-body'\n// import * as getRawBody from 'raw-body'\n\nconst getChunkedRawBody = async (readable) => {\n const chunks = []\n\n for await (const chunk of readable) {\n chunks.push(typeof chunk === \"string\" ? Buffer.from(chunk) : chunk)\n }\n\n return Buffer.concat(chunks)\n}\n\n// TODO: explore returning mutated request object adding on req.rawBody??\n// TODO: move to req.text() after next 13.5: https://github.com/vercel/next.js/discussions/13405\nexport const ensureRawBody = async (req) => (\n getChunkedRawBody(req)\n // getRawBody(req)\n .then((_rawBody) => _rawBody.toString())\n .catch((error) => {\n // NOTE: this is intended to ensure if getRawBody is called 2x w/in a route that it returns the already streamed body\n if ((error?.type === 'stream.not.readable')) {\n if (!req?.rawBody) {\n // eslint-disable-next-line max-len\n console.info('Ignoring error reading raw requst body. This can occur if the body is attempted to be read twice in a single request. If intentional, please mutate the request to add the result of this call as req.rawBody (to prevent this warning).')\n return req?.body\n }\n\n return req?.rawBody\n }\n\n console.error(`Error getting raw body for '${req?.url}'`, error)\n throw error\n })\n)\n","import { subtle } from '../shared/subtlecrypto'\nimport {\n objectToSortedString,\n ensureString,\n safeParse,\n isTrue,\n} from '../shared/display'\nimport {\n getRequestMethod,\n normalizeURIParts,\n} from '../shared/request'\nimport {\n ensureRawBody,\n VerificationError,\n} from './utils'\n\nexport const getVerificationHelpers = ({ keyPairs }) => (\n async (req, params) => {\n const {\n 'x-public-key': apiKey,\n 'x-ephemeral-key': ephemeralPublicKey,\n 'x-authorization-timestamp': customAuthTimestamp,\n 'x-authorization': customAuth,\n } = req.headers ?? {}\n\n const { uri: _uri, disableRecryption: _disableRecryption } = params ?? {}\n const uri = _uri ?? req.url\n const disableRecryption = isTrue(_disableRecryption)\n\n let isVerifiable\n try {\n const [authProtocol, authSignature] = ensureString(customAuth).split(' ')\n isVerifiable = isTrue(\n apiKey &&\n ephemeralPublicKey &&\n keyPairs?.shared &&\n customAuthTimestamp &&\n authSignature &&\n (authProtocol === 'HMAC-SHA256')\n )\n\n let verificationKeys\n const rawBody = await ensureRawBody(req)\n\n // NOTE: requestBody should be wind up decrypted when isVerifiable (unless disableRecryption, then will pass through)\n let requestBody = safeParse(rawBody)\n\n // TEMP!!! remove isVerifiable check once webwidget moved to react\n if (isVerifiable) {\n if (\n !apiKey ||\n !ephemeralPublicKey ||\n !customAuthTimestamp ||\n !authSignature ||\n !keyPairs?.shared ||\n (apiKey !== keyPairs.shared.publicKey) ||\n (authProtocol !== 'HMAC-SHA256')\n ) {\n throw new VerificationError('Invalid or missing authorization', { code: 401 })\n }\n\n verificationKeys = await subtle.getVerificationKeys({\n publicKey: ephemeralPublicKey,\n privateKey: keyPairs.shared.privateKey,\n })\n\n if (!verificationKeys) {\n throw new VerificationError('Invalid or missing verification', { code: 412 })\n }\n\n const verificationPayload = objectToSortedString({\n method: getRequestMethod(rawBody, req.method),\n timestamp: customAuthTimestamp,\n body: requestBody, // NOTE: requestBody should be encrypted when isVerifiable\n ...normalizeURIParts(uri),\n })\n\n const isValid = await subtle.verifyHMAC(\n verificationPayload,\n verificationKeys.derivedHMACKey,\n authSignature\n )\n\n if (!isValid) {\n throw new VerificationError('Invalid or missing verification', { code: 412 })\n }\n\n if (!disableRecryption && requestBody) {\n const decryptedMessage = await subtle.decryptMessage(requestBody, verificationKeys.derivedSecretKey)\n requestBody = safeParse(decryptedMessage)\n }\n }\n\n const processResponse = async (response) => {\n if (!response || disableRecryption || !isVerifiable || !verificationKeys?.derivedSecretKey) {\n return response\n }\n\n return subtle.encryptMessage(JSON.stringify(response), verificationKeys.derivedSecretKey)\n }\n\n return { rawBody, requestBody, processResponse }\n } catch (error) {\n console.error(`Error handling request verification for '${uri}'`, { error, isVerifiable, disableRecryption })\n throw error\n }\n }\n)\n"],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;AACT;EACA,QAAQ,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC;EACjG,QAAO;AACP;EACA,MAAM,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE;EACtD,KAAK,CAAC,OAAO,KAAK,EAAE;EACpB,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,yCAAyC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,EAAC;EACnH,MAAM,MAAM,KAAK;EACjB,KAAK;EACL,GAAG;EACH;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"verification.js","sources":["../../node_modules/browser-monads-ts/dist/browser-monads-ts.es.js","../../src/shared/display.js","../../src/shared/subtlecrypto.js","../../src/shared/request.js","../../src/verification/utils/errors.js","../../src/verification/utils/rawbody.js","../../src/verification/verification.js"],"sourcesContent":["var n,r=((n=function(){return r}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return \"\"},n.valueOf=function(){return !1},new Proxy(Object.freeze(n),{get:function(n,t){return n.hasOwnProperty(t)?n[t]:r}})),u=function(n){return n===r};\n\nlet win = global.window;\nlet doc = global.document;\nlet nav = global.navigator;\nlet document = typeof doc !== \"undefined\" ? doc : r;\nlet exists = (variable) => !u(variable);\nlet navigator = typeof nav !== \"undefined\" ? nav : r;\nlet window = typeof win !== \"undefined\" ? win : r;\n\nexport { document, exists, navigator, window };\n//# sourceMappingURL=browser-monads-ts.es.js.map\n","/* eslint-disable no-use-before-define */\n\n// #region lib-core\n// TODO!!!: keep in sync between next-shopify and lib-core (and lib-utils-js at bottom)\nexport const normalizeShopifyId = (shopifyData) => {\n const isString = isType(shopifyData, 'string')\n if (isString && !shopifyData.startsWith('gid:')) {\n if (!isNumericOnly(shopifyData)) {\n return {}\n }\n\n return {\n id: `${shopifyData}`,\n }\n }\n\n const { id: _entityId, legacyResourceId } = isString\n ? { id: shopifyData }\n : ensureObject(shopifyData)\n\n if (stringEmpty(_entityId) && stringEmpty(legacyResourceId)) {\n return {}\n }\n\n const entity_id = ensureString(_entityId)\n const { entity_type, parsedId } = entity_id.match(/^gid:\\/\\/shopify\\/(?<entity_type>.*)\\/(?<parsedId>[0-9]+).*$/)?.groups ?? {}\n const id = ensureString(parsedId || legacyResourceId)\n\n const hasEntityId = stringNotEmpty(entity_id)\n const hasEntityType = stringNotEmpty(entity_type)\n\n return {\n ...stringNotEmpty(id) && { id },\n ...hasEntityId && { entity_id },\n ...hasEntityType && { entity_type },\n ...(hasEntityId && hasEntityType) && {\n gid: `gid://shopify/${entity_type}/${entity_id}`,\n },\n }\n}\n\nexport const random = (max = 100, min = 1) => {\n const floor = Math.min(max, min)\n return Math.floor(Math.random() * (max - floor + 1)) + floor\n}\n\nexport const nextRandom = (max = 100, min = 1) => {\n const maximum = Math.max(max, 0)\n const minimum = Math.max(min, 0)\n\n let randomNumber = maximum\n\n if (maximum > minimum) {\n do {\n randomNumber = random(maximum, minimum)\n } while (randomNumber === nextRandom.last)\n\n nextRandom.last = randomNumber\n }\n\n return randomNumber\n}\n\nexport const arrayRandom = (_values, _max = 1) => {\n const values = ensureArray(_values)\n const valuesLength = values.length\n const maxLength = Math.min(_max, valuesLength)\n\n if (valuesLength <= maxLength) {\n return values\n }\n\n const arrayLength = valuesLength - 1\n const randomValues = []\n do {\n const newVal = values[nextRandom(arrayLength, 0)]\n if (!randomValues.includes(newVal)) {\n randomValues.push(newVal)\n }\n } while (randomValues.length < maxLength)\n\n return randomValues\n}\n\nexport const arrayRandomItem = (_values) => (\n arrayRandom(_values)[0]\n)\n\nexport const isArray = (value) => (\n // eslint-disable-next-line eqeqeq\n (value != undefined) && Array.isArray(value)\n)\n\nexport const isSet = (value) => (\n // eslint-disable-next-line eqeqeq\n (value != undefined) && (value instanceof Set)\n)\n\nexport const isType = (value, type) => (\n // eslint-disable-next-line eqeqeq, valid-typeof\n (value != undefined) && (typeof value === type)\n)\n\nexport const isTypeEnhanced = (value, type) => {\n switch (true) {\n case (type === 'set'): {\n return isSet(value)\n }\n\n case (type === 'array'): {\n return (\n isArray(value) &&\n !isSet(value)\n )\n }\n\n case (type === 'object'): {\n return (\n isType(value, type) &&\n !isArray(value)\n )\n }\n\n default: {\n return isType(value, type)\n }\n }\n}\n\nexport const safeTrim = (value) => {\n if (isType(value, 'string')) {\n // eslint-disable-next-line no-param-reassign\n value = value.trim()\n }\n\n return value\n}\n\nexport const safeParse = (value, trim) => {\n if (isType(value, 'string')) {\n if (trim) {\n // eslint-disable-next-line no-param-reassign\n value = safeTrim(value)\n }\n\n if (value.startsWith('{') || value.startsWith('[') || value.startsWith('\"')) {\n // eslint-disable-next-line no-param-reassign\n value = JSON.parse(value)\n }\n }\n\n // TODO: should this be value ?? {}\n return value\n}\n\nexport const ensureString = (string) => (\n string ? `${string}` : ''\n)\n\n// HMMM: what if 'string' is an object?\nexport const ensureStringOnly = (string) => (\n // eslint-disable-next-line eqeqeq\n (string != undefined) ? `${string}` : ''\n)\n\nexport const ensureStringAscii = (string) => (\n // eslint-disable-next-line no-control-regex\n ensureStringOnly(string).replace(/[^\\x00-\\x7F]/g, '')\n)\n\nexport const ensureStringClean = (string) => (\n // eslint-disable-next-line no-control-regex\n ensureStringOnly(string).replace(/[^a-z0-9_-]/gi, '')\n)\n\nexport const ensureAlphaNumeric = (string) => (\n // eslint-disable-next-line no-control-regex\n ensureStringOnly(string).replace(/[^a-z0-9]/gi, '')\n)\n\nexport const isNumericOnly = (value) => {\n const [matched] = `${value}`.match(/^([0-9]+)$/) ?? []\n // eslint-disable-next-line eqeqeq\n return (matched != undefined)\n}\n\nexport const isNumericNegatable = (value) => {\n const [matched] = `${value}`.match(/^(-?[0-9]+(\\.[0-9]+)?)?$/) ?? []\n // eslint-disable-next-line eqeqeq\n return (matched != undefined)\n}\n\n// TODO: explore places using ensureNumeric to move to isNumericNegatable\nexport const ensureNumeric = (string) => (\n Number(ensureString(string).replace(/[^0-9.]/gi, ''))\n)\n\nexport const ensureNumericOnly = (string) => (\n Number(ensureString(string).replace(/[^0-9]/gi, ''))\n)\n\n// TODO: update regex to handle negative number returns negative. Something like (?!\\d\\.)(-?\\d+(\\.\\d)?)\nexport const ensureNumericNegatable = (string) => (\n Number(ensureString(string).replace(/[^0-9.-]/gi, ''))\n)\n\nexport const ensureNumericConstrained = (value, { min: _min = 0, max: _max = 100 } = {}) => {\n const min = ensureNumericNegatable(_min)\n const max = ensureNumericNegatable(_max)\n\n return Math.max(\n min,\n Math.min(ensureNumeric(value), max)\n )\n}\n\nexport const ensureArray = (array = []) => (\n // eslint-disable-next-line no-nested-ternary\n !array ? [] : Array.isArray(array) ? array : [array]\n)\n\nexport const ensureArraySet = (arrayOrSet) => (\n ensureArray(isSet(arrayOrSet) ? [...arrayOrSet] : arrayOrSet)\n)\n\nexport const arrayEmpty = (array, disableEmptyString = false) => (\n // eslint-disable-next-line eqeqeq\n !array || !array.length || (array.length === 1 && (array[0] == undefined || (disableEmptyString && stringEmpty(array[0]))))\n)\n\nexport const arrayNotEmpty = (array, disableEmptyString = false) => (\n // eslint-disable-next-line eqeqeq\n !arrayEmpty(array) && array[0] != undefined && (!disableEmptyString || stringNotEmpty(array[0]))\n)\n\nexport const findLastMatch = (array, filterCallback = (value) => (value)) => (\n ensureArray(array).filter(filterCallback).slice(-1)[0]\n)\n\nexport const ensureObject = (object) => (\n object ?? {}\n)\n\n// NOTE: this does not ensure !isType(string)\nexport const objectEmpty = (object) => (\n !object || !Object.keys(object).length\n)\n\nexport const objectNotEmpty = (object) => (\n !objectEmpty(object)\n)\n\nexport const nullable = (object) => (\n (!object || (object === 'null') || (object === undefined) || (object === null))\n ? null // TODO: explore undefined here??\n : object\n)\n\nexport const objectContainsAnyValue = (object) => (\n Object.values(ensureObject(object)).some((value) => nullable(value))\n)\n\nconst isUndefined = (value) => (\n // eslint-disable-next-line eqeqeq\n value == undefined\n)\n\nexport const cleanObject = (object, allowEmptyLeafs, isEmptyCallback) => (\n Object.entries(ensureObject(object)).reduce((\n _cleanedObject,\n [key, _value]\n ) => {\n if (!allowEmptyLeafs && (isEmptyCallback?.(_value) ?? isUndefined(_value))) {\n return _cleanedObject // skip key if null or undefined\n }\n\n const value = !Array.isArray(_value)\n ? cleanObjectValue(_value, allowEmptyLeafs, isEmptyCallback)\n : _value.reduce((_data, __value) => ([\n ..._data,\n cleanObjectValue(__value, allowEmptyLeafs, isEmptyCallback)\n ]), [])\n\n return {\n ..._cleanedObject,\n [key]: value,\n }\n }, {})\n)\n\nconst cleanObjectValue = (value, allowEmptyLeafs, isEmptyCallback) => (\n isType(value, 'object') ? cleanObject(value, allowEmptyLeafs, isEmptyCallback) : value\n)\n\nexport const stringNotEmptyOnly = (stringable) => {\n const string = ensureStringOnly(stringable)\n return ((string.length > 0) && !['null', 'undefined'].includes(string))\n}\n\nexport const stringEmptyOnly = (stringable) => (\n !stringNotEmptyOnly(stringable)\n)\n\nexport const stringNotEmpty = (stringable) => {\n const string = ensureString(stringable)\n return ((string.length > 0) && !['null', 'undefined'].includes(string))\n}\n\nexport const stringEmpty = (stringable) => (\n !stringNotEmpty(stringable)\n)\n\nconst splitString = (splitting, index = splitting.length) => {\n const string = ensureString(splitting)\n return [string.slice(0, index), string.slice(index)]\n}\n\nexport const compareNumber = (number1 = 0, number2 = 0) => (\n number1 - number2\n)\n\nexport const compareString = (string1, string2) => {\n if (stringEmpty(string1)) {\n return 1\n }\n\n if (stringEmpty(string2)) {\n return -1\n }\n\n return ensureString(string1).localeCompare(string2)\n}\n\nexport const compareEntryKeys = ([string1], [string2]) => (\n compareString(string1, string2)\n)\n\nexport const objectToSortedString = (object, separator = '') => (\n Object.entries(ensureObject(object))\n .sort(compareEntryKeys)\n .map(([key, value]) => `${key}=${value}`)\n .join(separator)\n)\n\nexport const isHTML = (string) => (\n (string?.startsWith?.('<') || string?.startsWith?.('\\n<')) ?? false\n)\n\nexport const freeze = (logMessage, object, type = 'log') => {\n console[type](logMessage, !object ? object : JSON.parse(JSON.stringify(ensureObject(object))))\n}\n\nexport const replaceSpaces = (string, replacement = '') => (\n !isType(string, 'string')\n ? ''\n : string.replace(/\\s/g, replacement)\n)\n\nconst recase = (string, replacement = '') => (\n !isType(string, 'string')\n ? ''\n : string\n .replace(/[^a-zA-Z0-9]+/g, replacement)\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/([0-9])([^0-9])/g, '$1-$2')\n .replace(/([^0-9])([0-9])/g, '$1-$2')\n .replace(/[-_]+/g, replacement)\n .replace(new RegExp(`${replacement}$`), '')\n .toLowerCase()\n)\n\nexport const zencase = (string, replacement = '-') => (\n !isType(string, 'string')\n ? ''\n : replaceSpaces(string, replacement)\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(new RegExp(`${replacement}$`), '')\n .toLowerCase()\n)\n\nexport const dashcase = (string) => (\n recase(string, '-')\n)\n\nexport const undashcase = (string, replacement = ' ') => (\n ensureString(string).replace(/-/g, replacement).trim()\n)\n\nexport const snakecase = (string) => (\n recase(string, '_')\n)\n\nexport const unsnakecase = (string, replacement = ' ') => (\n ensureString(string).replace(/_/g, replacement).trim()\n)\n\nexport const uppercase = (string) => (\n ensureString(string).toUpperCase()\n)\n\nexport const lowercase = (string, defaultValue = '') => (\n !stringNotEmpty(string)\n ? defaultValue\n : ensureString(string).toLowerCase()\n)\n\nexport const slugify = (string) => (\n lowercase(dashcase(string))\n)\n\nexport const capitalize = (string) => {\n const parts = splitString(string, 1)\n return `${uppercase(parts[0])}${parts[1]}`\n}\n\nexport const camelCase = (string) => (\n stringNotEmpty(string)\n ? unsnakecase(undashcase(string)).replace(/\\w\\S*/g, (word, charIndex) => {\n if (charIndex === 0) {\n return lowercase(word)\n }\n return `${uppercase(word.charAt(0))}${lowercase(word.substr(1))}`\n }).split(' ').join('')\n : ''\n)\n\nexport const titleCase = (string, _overrides) => {\n if (!stringNotEmpty(string)) {\n return ''\n }\n\n const overrides = {\n 'add-ons': 'Add-Ons',\n agnostack: 'agnoStack',\n ai: 'AI',\n b2b: 'B2B',\n b2c: 'B2C',\n cartcollab: 'CartCollab',\n 'cartcollab(sm)': 'CartCollab(SM)',\n chatgpt: 'ChatGPT',\n covid: 'COVID',\n covid19: 'COVID-19',\n 'covid-19': 'COVID-19',\n crm: 'CRM',\n elasticpath: 'Elastic Path',\n ecommerce: 'eCommerce',\n 'e-commerce': 'eCommerce',\n faqs: 'FAQs',\n gpt: 'GPT',\n 'smile.io': 'Smile.io',\n 'stamped.io': 'Stamped.io',\n 'judge.me': 'Judge.me',\n 'influence.io': 'Influence.io',\n keepsmallstrong: 'KeepSmallStrong',\n loyaltylion: 'LoyaltyLion',\n openai: 'OpenAI',\n paypal: 'PayPal',\n 'postscript.io': 'Postscript.io',\n recharge: 'ReCharge',\n 'stay.ai': 'Stay.ai',\n 'stay ai': 'Stay Ai',\n shipengine: 'ShipEngine',\n shipperhq: 'ShipperHQ',\n shipstation: 'ShipStation',\n taxjar: 'TaxJar',\n yotpo: 'YotPo',\n ..._overrides,\n }\n\n const stringParts = lowercase(string)\n .split(' ')\n .reduce((\n _stringParts,\n _stringPart\n ) => {\n const stringPart = overrides[_stringPart] ?? _stringPart\n .replace(/([A-Z]+)/g, ' $1')\n .replace(/\\s\\s+/g, ' ')\n .replace(/(\\b[a-z](?!\\s)*)/g, (firstChar) => uppercase(firstChar))\n\n return [\n ..._stringParts,\n ...stringNotEmpty(stringPart) ? [stringPart] : []\n ]\n }, [])\n\n return stringParts.join(' ')\n}\n\nexport const removeLeadingSlash = (string) => (\n ensureString(string).replace(/^\\//, '')\n)\n\nexport const removeLeadingTrailingQuotes = (string) => (\n ensureString(string).replace(/^\"|\"$/g, '')\n)\n\n// TODO: not sure if this should remove multipel at end or just one (as it does now)?\nexport const removeTrailingSlash = (string) => (\n ensureString(string).replace(/\\/$/, '')\n)\n\nexport const removeLeadingTrailingSlash = (string) => (\n removeTrailingSlash(removeLeadingSlash(string))\n)\n\nexport const ensureLeadingSlash = (string) => (\n `/${removeLeadingSlash(string)}`\n)\n\nexport const ensureTrailingSlash = (string) => (\n `${removeTrailingSlash(string)}/`\n)\n\nexport const ensureExtension = (string, extension) => {\n if (stringEmpty(extension)) {\n return string\n }\n\n const filePath = string.match(/(.*)\\..+$/)?.[1] ?? string\n\n return `${filePath}.${extension}`\n}\n\nexport const wrappedEncode = (basePath, _wrappingPath) => {\n const wrappingPath = ensureString(_wrappingPath)\n if (stringEmpty(basePath)) {\n return wrappingPath\n }\n\n return `${basePath}${encodeURIComponent(wrappingPath)}`\n}\n\nexport const splitCommas = (value) => (\n ensureString(value)\n .replace(/, /g, ',')\n .split(',')\n .reduce((_values, _value) => {\n const __value = safeTrim(_value)\n return [\n ..._values,\n ...stringNotEmpty(__value) ? [__value] : [] // TODO: explore stringEmptyOnly?\n ]\n }, [])\n)\n\nexport const combineCommas = (values) => (\n [...new Set(\n ensureArray(values).reduce((\n _combined,\n value\n ) => ([\n ..._combined,\n ...splitCommas(value)\n ]), [])\n )]\n)\n\nexport const normalizeArray = (input, separator = ' ') => {\n const inputArray = ensureArray(input)\n\n return inputArray.reduce((normalized, _ignore, index) => ([\n ...normalized,\n inputArray.slice(0, index + 1).join(separator)\n ]), []).reverse()\n}\n\nexport const arrayToObject = (arrayable, key) => (\n ensureArray(arrayable).reduce((_object, item) => ({\n ..._object,\n [item?.[key]]: item,\n }), {})\n)\n\nexport const isTrue = (value, falsy) => {\n const string = ensureString(value)\n return ![...ensureArray(falsy), '', 'false'].includes(string)\n}\n\n// TODO: move all uses of parseKeywords to parseKeywordGroups\nexport const parseKeywords = (keywordGroup, previous) => (\n [...new Set(ensureArray(keywordGroup).reduce((_parsedKeywords, keyword) => {\n const keywords = splitCommas(keyword)\n\n return [\n ..._parsedKeywords,\n ...keywords.filter((_keyword) => stringNotEmpty(_keyword))\n ]\n }, ensureArray(previous)))].join(', ')\n)\n\nexport const parseKeywordGroups = (keywordGroups) => {\n const parsedKeywords = ensureArray(keywordGroups).reduce((_parsedKeywords, keywordGroup) => ([\n ..._parsedKeywords,\n ...ensureArray(keywordGroup).reduce((_parsedGroupKeywords, keyword) => {\n const keywords = splitCommas(keyword)\n\n return [\n ..._parsedGroupKeywords,\n ...keywords.filter((_keyword) => stringNotEmpty(_keyword))\n ]\n }, [])\n ]), [])\n\n return [...new Set(parsedKeywords)].join(', ')\n}\n\nexport const parseProjectName = (_name) => {\n const name = ensureString(_name)\n const [, organization, ...parts] = /(@.*)([\\\\]+|\\/)+(.*)/.exec(name) ?? []\n const projectName = organization ? name.replace(organization, '').replace('/', '') : name\n\n return {\n name,\n parts,\n organization,\n projectName,\n }\n}\n\nexport const parseProject = (packageInfo) => {\n const { shortName, owner: _appOwner, name: _name, appName: _appName, keywords, siteName: _siteName } = packageInfo ?? {}\n const { name, organization, projectName } = parseProjectName(_name)\n\n const appName = _appName ?? projectName?.slice(projectName?.indexOf('-') + 1)\n const siteName = _siteName ?? projectName?.slice(projectName?.indexOf('-') + 1)\n const companyName = titleCase(organization?.replace('@', ''))\n const appOwner = _appOwner ?? companyName\n\n return [{\n keywords,\n appOwner,\n appName,\n siteName,\n shortName,\n companyName,\n projectName,\n }, organization, name]\n}\n\n// #endregion lib-core\n\n// #region lib-utils-js\n\nexport const querystringToObject = (queryString) => {\n if (stringEmpty(queryString)) {\n return {}\n }\n\n const urlParams = new URLSearchParams(queryString)\n return Object.fromEntries(urlParams)\n}\n\nexport const arrayIncludesAll = (_values, comparison) => {\n const values = ensureArray(_values)\n return ensureArray(comparison).every((value) => (\n stringNotEmpty(value) && values.includes(value)\n ))\n}\n\nexport const arraysMatch = (array1, array2) => (\n arrayIncludesAll(array1, array2) && arrayIncludesAll(array2, array1)\n)\n\nexport const appendQuery = (_basePath, queryString) => {\n const basePath = ensureString(_basePath)\n if (stringEmpty(queryString)) {\n return basePath\n }\n return `${basePath}${basePath.includes('?') ? '&' : '?'}${queryString}`\n}\n","import { exists, window } from 'browser-monads-ts'\n\nimport { ensureArray, ensureString, objectEmpty } from './display'\n\nconst getWebCrypto = async () => {\n try {\n const crypto = (await import('isomorphic-webcrypto')).default\n return crypto\n } catch (error) {\n console.error('Failed to import isomorphic-webcrypto', error)\n throw error\n }\n}\n\nconst getTextDecoder = async () => {\n if (exists(window) && (typeof window?.TextDecoder === 'function')) {\n return window.TextDecoder\n }\n\n try {\n const TextDecoder = (await import('util')).TextDecoder\n return TextDecoder\n } catch (error) {\n console.error('Failed to import utils.TextDecoder', error)\n throw error\n }\n}\n\nconst getTextEncoder = async () => {\n if (exists(window) && (typeof window?.TextEncoder === 'function')) {\n return window.TextEncoder\n }\n\n try {\n const TextEncoder = (await import('util')).TextEncoder\n return TextEncoder\n } catch (error) {\n console.error('Failed to import utils.TextEncoder', error)\n throw error\n }\n}\n\nconst timingSafeEqual = (value1, value2) => {\n if (\n (value1 == undefined) ||\n (value2 == undefined) ||\n (value1.length !== value2.length)\n ) {\n return false\n }\n\n let result = 0\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < value1.length; i++) {\n // eslint-disable-next-line no-bitwise\n result |= value1[i] ^ value2[i]\n }\n\n return (result === 0)\n}\n\nconst stringToHex = (stringValue) => (\n Array.from(ensureString(stringValue), (char) => (\n char.charCodeAt(0).toString(16).padStart(2, '0')\n )).join('')\n)\n\nconst hexToString = (hexValue) => (\n ensureArray(\n ensureString(hexValue).match(/.{1,2}/g)\n )\n .map((byte) => String.fromCharCode(parseInt(byte, 16)))\n .join('')\n)\n\nconst arrayBufferToString = async (arrayBuffer) => {\n const uint8Array = new Uint8Array(arrayBuffer)\n const Decoder = await getTextDecoder()\n return new Decoder().decode(uint8Array)\n}\n\nconst arrayToArrayBuffer = (array) => (\n (ArrayBuffer.from != undefined)\n ? ArrayBuffer.from(array)\n : new Uint8Array(array).buffer\n)\n\nconst ensureArrayBuffer = (arrayOrArrayBuffer) => (\n (arrayOrArrayBuffer instanceof ArrayBuffer)\n ? arrayOrArrayBuffer\n : arrayToArrayBuffer(arrayOrArrayBuffer)\n)\n\nconst generateKeyPair = async () => {\n const crypto = await getWebCrypto()\n const keyPair = await crypto.subtle.generateKey(\n {\n name: 'ECDH',\n namedCurve: 'P-256',\n },\n true,\n ['deriveKey']\n )\n\n return keyPair\n}\n\nconst getKeyOperations = (keyType) => {\n switch (keyType) {\n case 'private':\n case 'privateKey': {\n return ['deriveKey']\n }\n\n case 'secret':\n case 'secretKey':\n case 'sharedSecret': {\n return ['encrypt', 'decrypt'] \n }\n\n default: {\n return []\n }\n }\n}\n\nconst getKeyAlgorythm = (keyType) => {\n switch (keyType) {\n case 'derivedKey':\n case 'derived':\n case 'secret':\n case 'secretKey':\n case 'sharedSecret': {\n return {\n name: 'AES-GCM',\n }\n }\n\n default: {\n return {\n name: 'ECDH',\n namedCurve: 'P-256',\n }\n }\n }\n}\n\nconst generateHMAC = async (message, derivedKey) => {\n if (!message || !derivedKey) {\n return undefined\n } \n\n const crypto = await getWebCrypto()\n const Encoder = await getTextEncoder()\n\n const signature = await crypto.subtle.sign(\n 'HMAC',\n derivedKey,\n new Encoder().encode(message)\n )\n\n return stringToHex(\n arrayBufferToString(signature)\n )\n}\n\nconst verifyHMAC = async (message, derivedKey, verifiableHMAC) => {\n const calculatedHMAC = await generateHMAC(message, derivedKey)\n\n return timingSafeEqual(calculatedHMAC, verifiableHMAC)\n}\n\nconst getStorableKey = async (key) => {\n const crypto = await getWebCrypto()\n\n const exportedJWK = await crypto.subtle.exportKey('jwk', key)\n return stringToHex(JSON.stringify(exportedJWK))\n}\n\nconst restoreStorableKey = async (keyType, storableHex) => {\n if (!storableHex) {\n return undefined\n }\n const crypto = await getWebCrypto()\n\n const exportedJWK = JSON.parse(hexToString(storableHex) || '{}')\n if (objectEmpty(exportedJWK)) {\n return undefined\n }\n\n return crypto.subtle.importKey(\n 'jwk',\n exportedJWK,\n getKeyAlgorythm(keyType),\n true,\n getKeyOperations(keyType)\n )\n}\n\nconst getStorableKeyPair = async (keyPair) => {\n const storableKeys = {}\n\n // eslint-disable-next-line no-restricted-syntax\n for (const [keyType, key] of Object.entries(keyPair)) {\n // eslint-disable-next-line no-await-in-loop\n storableKeys[keyType] = await getStorableKey(key)\n }\n\n return storableKeys\n}\n\nconst restoreStorableKeyPair = async (keyPair) => {\n const restoredKeys = {}\n\n // eslint-disable-next-line no-restricted-syntax\n for (const [keyType, key] of Object.entries(keyPair)) {\n // eslint-disable-next-line no-await-in-loop\n restoredKeys[keyType] = await restoreStorableKey(keyType, key)\n }\n\n return restoredKeys\n}\n\nconst deriveSharedKey = async ({ publicKey, privateKey }) => {\n if (!publicKey || !privateKey) {\n return undefined\n }\n\n const crypto = await getWebCrypto()\n const derivedKey = await crypto.subtle.deriveKey(\n {\n name: 'ECDH',\n public: publicKey,\n },\n privateKey,\n {\n name: 'AES-GCM',\n length: 256,\n },\n true,\n ['encrypt', 'decrypt']\n )\n return derivedKey\n}\n\nconst deriveHMACKey = async ({ publicKey, privateKey }) => {\n if (!publicKey || !privateKey) {\n return undefined\n }\n\n const crypto = await getWebCrypto()\n const derivedKey = await crypto.subtle.deriveKey(\n {\n name: 'ECDH',\n public: publicKey,\n },\n privateKey,\n {\n name: 'HMAC',\n hash: { name: 'SHA-256' },\n length: 256, // Adjusted key length, e.g., 128 bits\n },\n true,\n ['sign', 'verify']\n )\n return derivedKey\n}\n\nconst getVerificationKeys = async ({ publicKey, privateKey }) => {\n if (!publicKey || !privateKey) {\n return {}\n }\n\n const sharedKeyPair = await restoreStorableKeyPair({ publicKey, privateKey })\n const derivedHMACKey = await deriveHMACKey(sharedKeyPair)\n const derivedSecretKey = await deriveSharedKey(sharedKeyPair)\n\n return {\n derivedSecretKey,\n derivedHMACKey,\n }\n}\n\nconst encryptMessage = async (decryptedMessage, derivedKey) => {\n if (!decryptedMessage || !derivedKey) {\n return undefined\n }\n\n const crypto = await getWebCrypto()\n const iv = crypto.getRandomValues(new Uint8Array(12))\n const Encoder = await getTextEncoder()\n const encodedMessage = new Encoder().encode(decryptedMessage)\n const ciphertext = await crypto.subtle.encrypt(\n {\n name: 'AES-GCM',\n iv,\n },\n derivedKey,\n encodedMessage\n )\n\n const encryptedMessage = new Uint8Array([\n ...iv,\n ...new Uint8Array(ciphertext)\n ])\n return Array.from(encryptedMessage)\n}\n\nconst decryptMessage = async (encryptedMessage, derivedKey) => {\n if (!encryptedMessage || !derivedKey) {\n return undefined\n }\n\n const crypto = await getWebCrypto()\n // NOTE: this presumed an array or arrayBuffer coming in as encryptedMessage (will fail w/ IV error if its a string)\n const encryptedArrayBuffer = ensureArrayBuffer(encryptedMessage)\n const iv = encryptedArrayBuffer.slice(0, 12)\n const ciphertext = encryptedArrayBuffer.slice(12)\n\n const decryptedArrayBuffer = await crypto.subtle.decrypt(\n {\n name: 'AES-GCM',\n iv,\n },\n derivedKey,\n ciphertext\n )\n\n const Decoder = await getTextDecoder()\n const decryptedMessage = new Decoder().decode(decryptedArrayBuffer)\n return decryptedMessage\n}\n\nexport const subtle = {\n generateKeyPair,\n generateHMAC,\n verifyHMAC,\n getStorableKey,\n getStorableKeyPair,\n restoreStorableKeyPair,\n deriveSharedKey,\n deriveHMACKey,\n getVerificationKeys,\n encryptMessage,\n decryptMessage,\n}\n","import {\n ensureLeadingSlash,\n stringEmpty,\n uppercase,\n safeParse,\n} from './display'\n\nconst TEMP_HOSTNAME = 'xyz.com'\nconst REMOVABLE_KEYS = ['shop', 'host']\n\nexport const HEADER_CONTENT_TYPE = 'Content-Type'\nexport const CONTENT_TYPES = {\n APPLICATION_JSON: 'application/json',\n}\n\nexport const getRequestMethod = (body, _method) => {\n const method = _method ?? (body ? 'POST' : 'GET')\n\n return uppercase(method)\n}\n\nexport const prepareRequestOptions = ({ method: _method, body: _body, headers: _header, ...requestOptions } = {}) => {\n const method = getRequestMethod(_body, _method)\n\n const headers = {\n [HEADER_CONTENT_TYPE]: CONTENT_TYPES.APPLICATION_JSON,\n ..._header,\n }\n\n let body = _body\n if (body && headers[HEADER_CONTENT_TYPE].startsWith(CONTENT_TYPES.APPLICATION_JSON)) {\n body = JSON.stringify(safeParse(body))\n }\n\n return {\n method,\n headers,\n ...(body && (method !== 'GET')) && { body },\n ...requestOptions,\n }\n}\n\nconst convertToURL = (uri) => {\n if (stringEmpty(uri)) {\n return undefined\n }\n\n const protocolRegex = /^(https?:\\/\\/).+/i\n\n if (!protocolRegex.test(uri)) {\n return new URL(`https://${TEMP_HOSTNAME}${ensureLeadingSlash(uri)}`)\n }\n\n return new URL(uri)\n}\n\nexport const normalizeURIParts = (uri) => {\n const urlObject = convertToURL(uri)\n if (!urlObject) {\n return undefined\n }\n\n REMOVABLE_KEYS.forEach((key) => urlObject.searchParams.delete(key))\n\n return {\n ...(urlObject.hostname !== TEMP_HOSTNAME) && {\n origin: urlObject.origin,\n },\n pathname: urlObject.pathname,\n search: urlObject.search,\n }\n}\n","export class VerificationError extends Error {\n constructor(message, _data) {\n super(message)\n const { code = 500, ...data } = _data ?? {}\n this.code = code\n this.data = data\n this.name = 'VerificationError'\n Object.setPrototypeOf(this, VerificationError.prototype)\n }\n}\n","// import getRawBody from 'raw-body'\n// import * as getRawBody from 'raw-body'\n\nconst getChunkedRawBody = async (readable) => {\n const chunks = []\n\n for await (const chunk of readable) {\n chunks.push(typeof chunk === \"string\" ? Buffer.from(chunk) : chunk)\n }\n\n return Buffer.concat(chunks)\n}\n\n// TODO: explore returning mutated request object adding on req.rawBody??\n// TODO: move to req.text() after next 13.5: https://github.com/vercel/next.js/discussions/13405\nexport const ensureRawBody = async (req) => (\n getChunkedRawBody(req)\n // getRawBody(req)\n .then((_rawBody) => _rawBody.toString())\n .catch((error) => {\n // NOTE: this is intended to ensure if getRawBody is called 2x w/in a route that it returns the already streamed body\n if ((error?.type === 'stream.not.readable')) {\n if (!req?.rawBody) {\n // eslint-disable-next-line max-len\n console.info('Ignoring error reading raw requst body. This can occur if the body is attempted to be read twice in a single request. If intentional, please mutate the request to add the result of this call as req.rawBody (to prevent this warning).')\n return req?.body\n }\n\n return req?.rawBody\n }\n\n console.error(`Error getting raw body for '${req?.url}'`, error)\n throw error\n })\n)\n","import { subtle } from '../shared/subtlecrypto'\nimport {\n objectToSortedString,\n ensureString,\n safeParse,\n isTrue,\n} from '../shared/display'\nimport {\n getRequestMethod,\n normalizeURIParts,\n} from '../shared/request'\nimport {\n ensureRawBody,\n VerificationError,\n} from './utils'\n\nexport const getVerificationHelpers = ({ keyPairs }) => (\n async (req, params) => {\n const {\n 'x-public-key': apiKey,\n 'x-ephemeral-key': ephemeralPublicKey,\n 'x-authorization-timestamp': customAuthTimestamp,\n 'x-authorization': customAuth,\n } = req.headers ?? {}\n\n const { uri: _uri, disableRecryption: _disableRecryption } = params ?? {}\n const uri = _uri ?? req.url\n const disableRecryption = isTrue(_disableRecryption)\n\n let isVerifiable\n try {\n const [authProtocol, authSignature] = ensureString(customAuth).split(' ')\n isVerifiable = isTrue(\n apiKey &&\n ephemeralPublicKey &&\n keyPairs?.shared &&\n customAuthTimestamp &&\n authSignature &&\n (authProtocol === 'HMAC-SHA256')\n )\n\n let verificationKeys\n const rawBody = await ensureRawBody(req)\n\n // NOTE: requestBody should be wind up decrypted when isVerifiable (unless disableRecryption, then will pass through)\n let requestBody = safeParse(rawBody)\n\n // TEMP!!! remove isVerifiable check once webwidget moved to react\n if (isVerifiable) {\n if (\n !apiKey ||\n !ephemeralPublicKey ||\n !customAuthTimestamp ||\n !authSignature ||\n !keyPairs?.shared ||\n (apiKey !== keyPairs.shared.publicKey) ||\n (authProtocol !== 'HMAC-SHA256')\n ) {\n throw new VerificationError('Invalid or missing authorization', { code: 401 })\n }\n\n verificationKeys = await subtle.getVerificationKeys({\n publicKey: ephemeralPublicKey,\n privateKey: keyPairs.shared.privateKey,\n })\n\n if (!verificationKeys) {\n throw new VerificationError('Invalid or missing verification', { code: 412 })\n }\n\n const verificationPayload = objectToSortedString({\n method: getRequestMethod(rawBody, req.method),\n timestamp: customAuthTimestamp,\n body: requestBody, // NOTE: requestBody should be encrypted when isVerifiable\n ...normalizeURIParts(uri),\n })\n\n const isValid = await subtle.verifyHMAC(\n verificationPayload,\n verificationKeys.derivedHMACKey,\n authSignature\n )\n\n if (!isValid) {\n throw new VerificationError('Invalid or missing verification', { code: 412 })\n }\n\n if (!disableRecryption && requestBody) {\n const decryptedMessage = await subtle.decryptMessage(requestBody, verificationKeys.derivedSecretKey)\n requestBody = safeParse(decryptedMessage)\n }\n }\n\n const processResponse = async (response) => {\n if (!response || disableRecryption || !isVerifiable || !verificationKeys?.derivedSecretKey) {\n return response\n }\n\n return subtle.encryptMessage(JSON.stringify(response), verificationKeys.derivedSecretKey)\n }\n\n return { rawBody, requestBody, processResponse }\n } catch (error) {\n console.error(`Error handling request verification for '${uri}'`, { error, isVerifiable, disableRecryption })\n throw error\n }\n }\n)\n"],"names":[],"mappings":";;;;;;EAAA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;AACxP;EACA,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;EAIxB,IAAI,MAAM,GAAG,CAAC,QAAQ,KAAK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,CAAC,gBAAgB,EAAE,gBAAgB,EAAE;EACpG,UAAU,OAAO,QAAQ;EACzB,SAAS;AACT;EACA,QAAQ,OAAO,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC;EACjG,QAAO;AACP;EACA,MAAM,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE;EACtD,KAAK,CAAC,OAAO,KAAK,EAAE;EACpB,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC,yCAAyC,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,EAAC;EACnH,MAAM,MAAM,KAAK;EACjB,KAAK;EACL,GAAG;EACH;;;;;;;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Daniel Esteves
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Browser Monads TS
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.org/package/browser-monads-ts">
|
|
5
|
+
<img src="https://img.shields.io/npm/v/browser-monads-ts/latest.svg" alt="NPM Version" />
|
|
6
|
+
</a>
|
|
7
|
+
<a href="https://www.npmjs.org/package/browser-monads-ts">
|
|
8
|
+
<img src="https://img.shields.io/npm/dm/browser-monads-ts.svg" alt="Monthly download on NPM" />
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://github.com/danestves/browser-monads-ts/actions">
|
|
11
|
+
<img src="https://github.com/danestves/browser-monads-ts/workflows/CI/badge.svg" alt="Workflow of main.yml action" />
|
|
12
|
+
</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
> This package is inspired by [browser-monads](https://github.com/Jense5/browser-monads) currently without support from the author.
|
|
16
|
+
|
|
17
|
+
Provide interfaces for the `window`, `document` and `navigator` variables of a webpage.
|
|
18
|
+
|
|
19
|
+
## What is a monad?
|
|
20
|
+
|
|
21
|
+
> In functional programming, a monad is an abstraction that allows structuring programs generically. Supporting languages may use monads to abstract away boilerplate code needed by the program logic.
|
|
22
|
+
>
|
|
23
|
+
> -Wikipedia - [Monad (functional programming)](<https://en.wikipedia.org/wiki/Monad_(functional_programming)>)
|
|
24
|
+
|
|
25
|
+
You don't really have to know what a monad is since the variables provided by this library aren't _really_ monads. Let's take a look at the `window` variable to get a basic understanding. The main purpose of this variable is that it _may be a window_ or it _may be nothing_. You don't know what it is and you shouldn't really care. In case it is a window, you can use it as you're used to. In case it is not a window, you can still use the same functions on the instance. The caring about the existence of the variable is already taken care of.
|
|
26
|
+
|
|
27
|
+
This same concept is applicable to the `document` variable too. You can use the `exists` function in order to check if the variable exists or you are operating on an instance that contains _nothing_.
|
|
28
|
+
|
|
29
|
+
## Why use monads?
|
|
30
|
+
|
|
31
|
+
This library makes it possible to use these variables without checks with [Gatsby](https://www.gatsbyjs.org) and [NextJS](https://nextjs.org/). This way of programming splits the defensive part from your own code, since you don't have to care anymore about the environment in which you are running. This makes it especially useful with server-side rendering. More info about the `nothing`-type can be found [here](https://github.com/slmgc/Nothing).
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import { window, document, exists } from 'browser-monads';
|
|
37
|
+
|
|
38
|
+
// inside browser ? window.location.href : ''
|
|
39
|
+
window.location.href;
|
|
40
|
+
|
|
41
|
+
// inside browser ? document.getElementById("myId") : ''
|
|
42
|
+
document.getElementById('myId');
|
|
43
|
+
|
|
44
|
+
// inside browser ? true : false
|
|
45
|
+
exists(window);
|
|
46
|
+
```
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var n,t=((n=function(){return t}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return""},n.valueOf=function(){return!1},new Proxy(Object.freeze(n),{get:function(e,o){return e.hasOwnProperty(o)?e[o]:t}})),l=function(e){return e===t};let r=global.window,i=global.document,u=global.navigator,a=typeof i<"u"?i:t,d=e=>!l(e),f=typeof u<"u"?u:t,c=typeof r<"u"?r:t;exports.document=a;exports.exists=d;exports.navigator=f;exports.window=c;
|
|
2
|
+
//# sourceMappingURL=browser-monads-ts.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-monads-ts.cjs.js","sources":["../node_modules/nothing-mock/dist/nothing-mock.es.js","../src/index.ts"],"sourcesContent":["var n,r=((n=function(){return r}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return\"\"},n.valueOf=function(){return!1},new Proxy(Object.freeze(n),{get:function(n,t){return n.hasOwnProperty(t)?n[t]:r}})),t=function(n){return!(!n||!n.valueOf())},u=function(n){return n===r},e=function(n){return!(n===r||null==n)},o=function(n){return JSON.stringify(n,function(n,t){return t===r?null:t})},i=function(n){return JSON.parse(n,function(n,t){return null===t?r:t})};export{r as Nothing,i as deserialize,u as isNothing,e as isSomething,o as serialize,t as toBool};\n//# sourceMappingURL=nothing-mock.es.js.map\n","// Dependencies\nimport { Nothing, isNothing } from 'nothing-mock';\n\nlet win = global.window;\nlet doc = global.document;\nlet nav = global.navigator;\n\nexport let document: Document = typeof doc !== 'undefined' ? doc : Nothing;\nexport let exists = (variable: any) => !isNothing(variable);\nexport let navigator: Navigator = typeof nav !== 'undefined' ? nav : Nothing;\nexport let window: Window = typeof win !== 'undefined' ? win : Nothing;\n"],"names":["Nothing","isNothing"],"mappings":"4GAAG,GAAC,GAAE,EAAI,IAAE,UAAU,CAAC,MAAO,EAAC,GAAG,SAAS,EAAE,eAAe,EAAE,OAAO,aAAa,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,UAAU,CAAC,MAAM,EAAE,EAAE,GAAI,OAAM,OAAO,OAAO,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,EAAE,CAAC,MAAO,GAAE,eAAe,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,GAA4C,EAAE,SAAS,EAAE,CAAC,MAAO,KAAI,CAAC,ECG7R,GAAI,GAAM,OAAO,OACb,EAAM,OAAO,SACb,EAAM,OAAO,UAEN,EAAqB,MAAO,GAAQ,IAAc,EAAMA,EACxD,EAAS,AAAC,GAAkB,CAACC,EAAU,CAAQ,EAC/C,EAAuB,MAAO,GAAQ,IAAc,EAAMD,EAC1D,EAAiB,MAAO,GAAQ,IAAc,EAAMA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var n,r=((n=function(){return r}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return ""},n.valueOf=function(){return !1},new Proxy(Object.freeze(n),{get:function(n,t){return n.hasOwnProperty(t)?n[t]:r}})),u=function(n){return n===r};
|
|
2
|
+
|
|
3
|
+
let win = global.window;
|
|
4
|
+
let doc = global.document;
|
|
5
|
+
let nav = global.navigator;
|
|
6
|
+
let document = typeof doc !== "undefined" ? doc : r;
|
|
7
|
+
let exists = (variable) => !u(variable);
|
|
8
|
+
let navigator = typeof nav !== "undefined" ? nav : r;
|
|
9
|
+
let window = typeof win !== "undefined" ? win : r;
|
|
10
|
+
|
|
11
|
+
export { document, exists, navigator, window };
|
|
12
|
+
//# sourceMappingURL=browser-monads-ts.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-monads-ts.es.js","sources":["../node_modules/nothing-mock/dist/nothing-mock.es.js","../src/index.ts"],"sourcesContent":["var n,r=((n=function(){return r}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return\"\"},n.valueOf=function(){return!1},new Proxy(Object.freeze(n),{get:function(n,t){return n.hasOwnProperty(t)?n[t]:r}})),t=function(n){return!(!n||!n.valueOf())},u=function(n){return n===r},e=function(n){return!(n===r||null==n)},o=function(n){return JSON.stringify(n,function(n,t){return t===r?null:t})},i=function(n){return JSON.parse(n,function(n,t){return null===t?r:t})};export{r as Nothing,i as deserialize,u as isNothing,e as isSomething,o as serialize,t as toBool};\n//# sourceMappingURL=nothing-mock.es.js.map\n","// Dependencies\nimport { Nothing, isNothing } from 'nothing-mock';\n\nlet win = global.window;\nlet doc = global.document;\nlet nav = global.navigator;\n\nexport let document: Document = typeof doc !== 'undefined' ? doc : Nothing;\nexport let exists = (variable: any) => !isNothing(variable);\nexport let navigator: Navigator = typeof nav !== 'undefined' ? nav : Nothing;\nexport let window: Window = typeof win !== 'undefined' ? win : Nothing;\n"],"names":["Nothing","isNothing"],"mappings":"AAAG,IAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ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|
+
"name": "browser-monads-ts",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Provide interfaces for the window, document and navigator variables of a webpage.",
|
|
5
|
+
"homepage": "https://github.com/danestves/browser-monads-ts#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/danestves/browser-monads-ts/issues",
|
|
8
|
+
"email": "estevesd8@gmail.com"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/danestves/browser-monads-ts.git"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "Daniel Esteves",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"require": "./dist/browser-monads-ts.cjs.js",
|
|
20
|
+
"import": "./dist/browser-monads-ts.es.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"main": "dist/browser-monads-ts.cjs.js",
|
|
24
|
+
"module": "dist/browser-monads-ts.es.js",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"typings": "dist/index.d.ts",
|
|
27
|
+
"directories": {
|
|
28
|
+
"src": "src"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"prebuild": "npm run clean",
|
|
35
|
+
"build": "run-p build:*",
|
|
36
|
+
"build:scripts": "vite build",
|
|
37
|
+
"build:types": "tsc --emitDeclarationOnly && tsc-alias",
|
|
38
|
+
"clean": "rimraf dist",
|
|
39
|
+
"dev": "vite",
|
|
40
|
+
"preview": "vite preview",
|
|
41
|
+
"prepublish": "npm run build",
|
|
42
|
+
"size": "size-limit"
|
|
43
|
+
},
|
|
44
|
+
"prettier": {
|
|
45
|
+
"printWidth": 80,
|
|
46
|
+
"semi": true,
|
|
47
|
+
"singleQuote": true,
|
|
48
|
+
"trailingComma": "es5"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"nothing-mock": "^1.0.4"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
|
|
55
|
+
"@size-limit/preset-small-lib": "^7.0.8",
|
|
56
|
+
"@types/node": "^17.0.21",
|
|
57
|
+
"npm-run-all": "^4.1.5",
|
|
58
|
+
"rimraf": "^3.0.2",
|
|
59
|
+
"rollup-plugin-node-polyfills": "^0.2.1",
|
|
60
|
+
"size-limit": "^7.0.8",
|
|
61
|
+
"tsc-alias": "^1.6.4",
|
|
62
|
+
"typescript": "^4.6.2",
|
|
63
|
+
"vite": "^2.8.6",
|
|
64
|
+
"vite-tsconfig-paths": "^3.4.1"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=10"
|
|
68
|
+
},
|
|
69
|
+
"size-limit": [
|
|
70
|
+
{
|
|
71
|
+
"path": "dist/browser-monads-ts.cjs.js",
|
|
72
|
+
"limit": "10 KB"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"path": "dist/browser-monads-ts.es.js",
|
|
76
|
+
"limit": "10 KB"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-present Vladimir Simonov <slmgc@ya.ru>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Nothing
|
|
2
|
+
|
|
3
|
+
[![npm package][npm-badge]][npm] [![npm package][npm-downloads]][npm]
|
|
4
|
+
|
|
5
|
+
**Nothing** is a chainable, callable mock object which always returns itself. You can use it instead of `null` and `undefined` values so you don't have to place safety checks all over your code. The implementation uses [Symbol] and [Proxy] behind the hood which are widely supported by modern desktop and mobile browsers and can be used without a polyfill.
|
|
6
|
+
|
|
7
|
+
## How to install
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm i -S nothing-mock
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## How to use
|
|
14
|
+
|
|
15
|
+
### A simple example
|
|
16
|
+
```js
|
|
17
|
+
import {Nothing} from 'nothing-mock'
|
|
18
|
+
|
|
19
|
+
const foo = Nothing
|
|
20
|
+
foo.bar.baz.qux().spam.ham[0].map((x) => x + 1).eggs.someFn() // returns Nothing
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Reducing boilerplate
|
|
24
|
+
```js
|
|
25
|
+
import {Nothing} from 'nothing-mock'
|
|
26
|
+
|
|
27
|
+
// A regular function with null-checks
|
|
28
|
+
function someFunctionWithNullChecks(foo) {
|
|
29
|
+
return foo &&
|
|
30
|
+
foo.bar &&
|
|
31
|
+
foo.bar.baz &&
|
|
32
|
+
foo.bar.baz.qux &&
|
|
33
|
+
foo.bar.baz.qux()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// There is no need to check for null/undefined if you use Nothing
|
|
37
|
+
function someFunction(foo) {
|
|
38
|
+
return foo.bar.baz.qux()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
someFunctionWithNullChecks(null) // returns null
|
|
42
|
+
someFunction(Nothing) // returns Nothing
|
|
43
|
+
someFunction(null) // throws an exception
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### JSON serialization/deserialization
|
|
47
|
+
```js
|
|
48
|
+
import {Nothing, deserialize, serialize} from 'nothing-mock'
|
|
49
|
+
|
|
50
|
+
const json = `{
|
|
51
|
+
"posts": [{
|
|
52
|
+
"id": 1,
|
|
53
|
+
"userId": 12,
|
|
54
|
+
"content": "post 1",
|
|
55
|
+
"comments": [{
|
|
56
|
+
"id": 1,
|
|
57
|
+
"userId": 34,
|
|
58
|
+
"content": "comment 1"
|
|
59
|
+
}, {
|
|
60
|
+
"id": 2,
|
|
61
|
+
"userId": 56,
|
|
62
|
+
"content": "comment 2"
|
|
63
|
+
}]
|
|
64
|
+
}, {
|
|
65
|
+
"id": 2,
|
|
66
|
+
"userId": 78,
|
|
67
|
+
"content": "post 2",
|
|
68
|
+
"comments": null
|
|
69
|
+
}]
|
|
70
|
+
}`
|
|
71
|
+
|
|
72
|
+
const {posts} = deserialize(json) /* returns: [{
|
|
73
|
+
"id": 1,
|
|
74
|
+
"userId": 12,
|
|
75
|
+
"content": "post 1",
|
|
76
|
+
"comments": [{
|
|
77
|
+
"id": 1,
|
|
78
|
+
"userId": 34,
|
|
79
|
+
"content": "comment 1"
|
|
80
|
+
}, {
|
|
81
|
+
"id": 2,
|
|
82
|
+
"userId": 56,
|
|
83
|
+
"content": "comment 2"
|
|
84
|
+
}]
|
|
85
|
+
}, {
|
|
86
|
+
"id": 2,
|
|
87
|
+
"userId": 78,
|
|
88
|
+
"content": "post 2",
|
|
89
|
+
"comments": Nothing // null values are replaced with Nothing
|
|
90
|
+
}] */
|
|
91
|
+
|
|
92
|
+
function renderPostWithComments(post) {
|
|
93
|
+
return `<div>
|
|
94
|
+
<p>${post.content}</p>
|
|
95
|
+
<ul>${post.comments.map((comment) =>
|
|
96
|
+
`<li>${comment.content}</li>`).join('')
|
|
97
|
+
}</ul>
|
|
98
|
+
</div>`
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
posts.map(renderPostWithComments).join('') /* returns:
|
|
102
|
+
`<div>
|
|
103
|
+
<p>post 1</p>
|
|
104
|
+
<ul>
|
|
105
|
+
<li>comment 1</li>
|
|
106
|
+
<li>comment 2</li>
|
|
107
|
+
</ul>
|
|
108
|
+
</div>
|
|
109
|
+
<div>
|
|
110
|
+
<p>post 2</p>
|
|
111
|
+
<ul></ul> // Nothing is rendered empty
|
|
112
|
+
</div>` */
|
|
113
|
+
|
|
114
|
+
// Serializes an object to JSON and
|
|
115
|
+
// replaces all Nothing values with null
|
|
116
|
+
serialize({posts})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Helper functions
|
|
120
|
+
```js
|
|
121
|
+
import {Nothing, toBool, isNothing, isSomething} from 'nothing-mock'
|
|
122
|
+
|
|
123
|
+
const list = [Nothing, true, false, null, undefined, 0, 1, NaN, '', {}, []]
|
|
124
|
+
list.filter(toBool) // [true, 1, {}, []]
|
|
125
|
+
list.filter(isNothing) // [Nothing]
|
|
126
|
+
list.filter(isSomething) // [true, false, 0, 1, NaN, "", {}, []]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Properties which don't return Nothing
|
|
130
|
+
```jsx
|
|
131
|
+
import {Nothing} from 'nothing-mock'
|
|
132
|
+
|
|
133
|
+
Nothing.length // 0
|
|
134
|
+
Nothing.name // a string
|
|
135
|
+
Nothing.prototype // an object with a constructor
|
|
136
|
+
Nothing.toLocaleString() // ""
|
|
137
|
+
Nothing.toString() // ""
|
|
138
|
+
Nothing.valueOf() // false
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Gotchas
|
|
142
|
+
```js
|
|
143
|
+
import {Nothing, toBool} from 'nothing-mock'
|
|
144
|
+
|
|
145
|
+
String(Nothing) // ""
|
|
146
|
+
Nothing.toString() // ""
|
|
147
|
+
Nothing + 'a string' // "a string"
|
|
148
|
+
Nothing * 123 // 0
|
|
149
|
+
Nothing - 123 // -123
|
|
150
|
+
|
|
151
|
+
// Gotcha: concatenation of Nothing and a number returns a string
|
|
152
|
+
Nothing + 123 // "123"
|
|
153
|
+
|
|
154
|
+
// Solution: Nothing can be excplicitly converted to a number
|
|
155
|
+
Number(Nothing) // 0
|
|
156
|
+
Number(Nothing) + 123 // 123
|
|
157
|
+
|
|
158
|
+
// Gotcha: typecasting of Nothing to a boolean returns true
|
|
159
|
+
Boolean(Nothing) // true
|
|
160
|
+
!!Nothing // true
|
|
161
|
+
|
|
162
|
+
// Solution: Nothing can be converted to false
|
|
163
|
+
Nothing.valueOf() // false
|
|
164
|
+
toBool(Nothing) // false
|
|
165
|
+
|
|
166
|
+
// Gotcha: returning Nothing from a promise never
|
|
167
|
+
// resolves as Nothing is a thenable object
|
|
168
|
+
somePromise
|
|
169
|
+
.then(() => Nothing)
|
|
170
|
+
.then((result) => result) // pending indefinitely
|
|
171
|
+
|
|
172
|
+
// Solution: wrapping Nothing resolves the issue
|
|
173
|
+
somePromise
|
|
174
|
+
.then(() => ({result: Nothing}))
|
|
175
|
+
.then((result) => result) // promise resolves
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## FAQ
|
|
179
|
+
|
|
180
|
+
Q-1: Proxies are slow and there is a runtime overhead. Why should I use **Nothing**?
|
|
181
|
+
|
|
182
|
+
A: You should keep a few things in mind:
|
|
183
|
+
|
|
184
|
+
1. "Premature optimization is the root of all evil" - Donald E. Knuth.
|
|
185
|
+
2. Have you checked the performance of **Nothing**? Does it really impact the performance of your code? If it does, you can always opt out using **Nothing** for performance-critical parts of your code.
|
|
186
|
+
3. You can use **Nothing** for writing unit tests which are less likely to be performance-dependant.
|
|
187
|
+
|
|
188
|
+
Q-2: I believe that it's hard to understand the logic as the code will fail silently if I would use **Nothing**. I prefer to use try/catch blocks instead, e.g.:
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
try {
|
|
192
|
+
foo.bar.baz()
|
|
193
|
+
} catch (e) {
|
|
194
|
+
// deal with it somehow
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
A: Many functional programming languages either don't have or don't endorse the use of imperative constructs such as try/catch blocks because they introduce so-called side effects which actually make it harder to debug and reason about the code. And programs which are written in functional programming languages are considered to be less error-prone and easier to support.
|
|
199
|
+
|
|
200
|
+
You can always check the result if a function call should never return **Nothing** and then handle it properly:
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
const someFunction = (handleNothing, arg) => {
|
|
204
|
+
const result = foo.bar.baz(arg)
|
|
205
|
+
return isNothing(result) ? handleNothing(arg) : result
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Q-3: Why should I use **Nothing** if there are better alternatives like [optional chaining] or [lodash.get]?
|
|
210
|
+
|
|
211
|
+
A: Each of these solutions have their pros and cons. Your choice should depend on the use-case:
|
|
212
|
+
|
|
213
|
+
1. Optional chaining syntax would be the best choice, but it requires a transpilation step as modern browsers don't support the syntax and it might take a while before it will get into the future ECMAScript standard.
|
|
214
|
+
2. `lodash.get` is good for a basic property chain traversal, but it requires an alien syntax and fails when there is a need to call a method somewhere in a property chain:
|
|
215
|
+
|
|
216
|
+
```js
|
|
217
|
+
import get from 'lodash.get'
|
|
218
|
+
|
|
219
|
+
var foo = null
|
|
220
|
+
get(foo, ['bar', 'baz'])() // this will throw an exception
|
|
221
|
+
|
|
222
|
+
var baz = get(foo, ['bar', 'baz'])
|
|
223
|
+
baz && baz() // this won't work if `baz` should be bound to the context of `bar`
|
|
224
|
+
|
|
225
|
+
// For example:
|
|
226
|
+
var foo = {
|
|
227
|
+
bar: {
|
|
228
|
+
baz() {
|
|
229
|
+
console.log(this.qux)
|
|
230
|
+
},
|
|
231
|
+
qux: 'hello'
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
foo.bar.baz() // "hello"
|
|
236
|
+
get(foo, ['bar', 'baz'])() // undefined
|
|
237
|
+
|
|
238
|
+
// This would be a proper solution:
|
|
239
|
+
var bar = get(foo, ['bar'])
|
|
240
|
+
var baz = get(bar, ['baz'])
|
|
241
|
+
baz && baz.call(bar) // "hello"
|
|
242
|
+
|
|
243
|
+
// But then it's easier to get back to the regular syntax:
|
|
244
|
+
foo && foo.bar && foo.bar.baz && foo.bar.baz()
|
|
245
|
+
|
|
246
|
+
// And good luck using `get` for something like this:
|
|
247
|
+
foo.bar.baz()[0].map(() => { /* do something */ })
|
|
248
|
+
|
|
249
|
+
// BTW, an implementation of a lodash-like `get` helper-function is basically a one-liner:
|
|
250
|
+
const get = (o, a) => a.reduce((p, c) => p && p[c], o)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Q-4: I am still not convinced and ain't gonna use **Nothing**!
|
|
254
|
+
|
|
255
|
+
A: Thanks for letting me know! Seriously, it's your choice, I am down with it.
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
**MIT**
|
|
259
|
+
|
|
260
|
+
[Proxy]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#Browser_compatibility
|
|
261
|
+
[Symbol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility
|
|
262
|
+
[npm]: https://www.npmjs.org/package/nothing-mock
|
|
263
|
+
[npm-badge]: https://img.shields.io/npm/v/nothing-mock.svg
|
|
264
|
+
[npm-downloads]: https://img.shields.io/npm/dm/nothing-mock.svg
|
|
265
|
+
[optional chaining]: https://www.npmjs.com/package/babel-plugin-transform-optional-chaining
|
|
266
|
+
[lodash.get]: https://www.npmjs.com/package/lodash.get
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var n,r=((n=function(){return r}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return""},n.valueOf=function(){return!1},new Proxy(Object.freeze(n),{get:function(n,t){return n.hasOwnProperty(t)?n[t]:r}})),t=function(n){return!(!n||!n.valueOf())},u=function(n){return n===r},e=function(n){return!(n===r||null==n)},o=function(n){return JSON.stringify(n,function(n,t){return t===r?null:t})},i=function(n){return JSON.parse(n,function(n,t){return null===t?r:t})};export{r as Nothing,i as deserialize,u as isNothing,e as isSomething,o as serialize,t as toBool};
|
|
2
|
+
//# sourceMappingURL=nothing-mock.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nothing-mock.es.js","sources":["../src/index.js"],"sourcesContent":["export const Nothing = (() => {\n\tconst fn = () => Nothing\n\tfn.toString = fn.toLocaleString = fn[Symbol.toPrimitive] = () => ''\n\tfn.valueOf = () => false\n\n\treturn new Proxy(Object.freeze(fn), {\n\t\tget: (o, key) => o.hasOwnProperty(key) ? o[key] : Nothing\n\t})\n})()\n\nexport const toBool = (o) => !!(o && o.valueOf())\nexport const isNothing = (o) => o === Nothing\nexport const isSomething = (o) => !(o === Nothing || o == null)\nexport const serialize = (o) => JSON.stringify(o, (k, v) => v === Nothing ? null : v)\nexport const deserialize = (s) => JSON.parse(s, (k, v) => v === null ? Nothing : v)"],"names":["Nothing","fn","toString","toLocaleString","Symbol","toPrimitive","valueOf","Proxy","Object","freeze","get","o","key","hasOwnProperty","toBool","isNothing","isSomething","serialize","JSON","stringify","k","v","deserialize","s","parse"],"mappings":"AAAaA,IACNC,EADMD,IACNC,EAAK,kBAAMD,IACdE,SAAWD,EAAGE,eAAiBF,EAAGG,OAAOC,aAAe,iBAAM,IACjEJ,EAAGK,QAAU,yBAEFC,MAAMC,OAAOC,OAAOR,GAAK,CACnCS,IAAK,SAACC,EAAGC,UAAQD,EAAEE,eAAeD,GAAOD,EAAEC,GAAOZ,MAIvCc,EAAS,SAACH,YAASA,IAAKA,EAAEL,YAC1BS,EAAY,SAACJ,UAAMA,IAAMX,GACzBgB,EAAc,SAACL,WAAQA,IAAMX,GAAgB,MAALW,IACxCM,EAAY,SAACN,UAAMO,KAAKC,UAAUR,EAAG,SAACS,EAAGC,UAAMA,IAAMrB,EAAU,KAAOqB,KACtEC,EAAc,SAACC,UAAML,KAAKM,MAAMD,EAAG,SAACH,EAAGC,UAAY,OAANA,EAAarB,EAAUqB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var n,t=((n=function(){return t}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return""},n.valueOf=function(){return!1},new Proxy(Object.freeze(n),{get:function(n,r){return n.hasOwnProperty(r)?n[r]:t}}));exports.Nothing=t,exports.deserialize=function(n){return JSON.parse(n,function(n,r){return null===r?t:r})},exports.isNothing=function(n){return n===t},exports.isSomething=function(n){return!(n===t||null==n)},exports.serialize=function(n){return JSON.stringify(n,function(n,r){return r===t?null:r})},exports.toBool=function(n){return!(!n||!n.valueOf())};
|
|
2
|
+
//# sourceMappingURL=nothing-mock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nothing-mock.js","sources":["../src/index.js"],"sourcesContent":["export const Nothing = (() => {\n\tconst fn = () => Nothing\n\tfn.toString = fn.toLocaleString = fn[Symbol.toPrimitive] = () => ''\n\tfn.valueOf = () => false\n\n\treturn new Proxy(Object.freeze(fn), {\n\t\tget: (o, key) => o.hasOwnProperty(key) ? o[key] : Nothing\n\t})\n})()\n\nexport const toBool = (o) => !!(o && o.valueOf())\nexport const isNothing = (o) => o === Nothing\nexport const isSomething = (o) => !(o === Nothing || o == null)\nexport const serialize = (o) => JSON.stringify(o, (k, v) => v === Nothing ? null : v)\nexport const deserialize = (s) => JSON.parse(s, (k, v) => v === null ? Nothing : v)"],"names":["Nothing","fn","toString","toLocaleString","Symbol","toPrimitive","valueOf","Proxy","Object","freeze","get","o","key","hasOwnProperty","s","JSON","parse","k","v","stringify"],"mappings":"aAAaA,IACNC,EADMD,IACNC,EAAK,kBAAMD,IACdE,SAAWD,EAAGE,eAAiBF,EAAGG,OAAOC,aAAe,iBAAM,IACjEJ,EAAGK,QAAU,yBAEFC,MAAMC,OAAOC,OAAOR,GAAK,CACnCS,IAAK,SAACC,EAAGC,UAAQD,EAAEE,eAAeD,GAAOD,EAAEC,GAAOZ,4CAQzB,SAACc,UAAMC,KAAKC,MAAMF,EAAG,SAACG,EAAGC,UAAY,OAANA,EAAalB,EAAUkB,uBAHxD,SAACP,UAAMA,IAAMX,uBACX,SAACW,WAAQA,IAAMX,GAAgB,MAALW,sBAC5B,SAACA,UAAMI,KAAKI,UAAUR,EAAG,SAACM,EAAGC,UAAMA,IAAMlB,EAAU,KAAOkB,oBAH7D,SAACP,YAASA,IAAKA,EAAEL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=(()=>{const t=()=>e;return t.toString=t.toLocaleString=t[Symbol.toPrimitive]=()=>"",t.valueOf=()=>!1,new Proxy(Object.freeze(t),{get:(t,r)=>t.hasOwnProperty(r)?t[r]:e})})(),t=e=>!(!e||!e.valueOf()),r=t=>t===e,n=t=>!(t===e||null==t),l=t=>JSON.stringify(t,(t,r)=>r===e?null:r),o=t=>JSON.parse(t,(t,r)=>null===r?e:r);export{e as Nothing,o as deserialize,r as isNothing,n as isSomething,l as serialize,t as toBool};
|
|
2
|
+
//# sourceMappingURL=nothing-mock.modern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nothing-mock.modern.js","sources":["../src/index.js"],"sourcesContent":["export const Nothing = (() => {\n\tconst fn = () => Nothing\n\tfn.toString = fn.toLocaleString = fn[Symbol.toPrimitive] = () => ''\n\tfn.valueOf = () => false\n\n\treturn new Proxy(Object.freeze(fn), {\n\t\tget: (o, key) => o.hasOwnProperty(key) ? o[key] : Nothing\n\t})\n})()\n\nexport const toBool = (o) => !!(o && o.valueOf())\nexport const isNothing = (o) => o === Nothing\nexport const isSomething = (o) => !(o === Nothing || o == null)\nexport const serialize = (o) => JSON.stringify(o, (k, v) => v === Nothing ? null : v)\nexport const deserialize = (s) => JSON.parse(s, (k, v) => v === null ? Nothing : v)"],"names":["Nothing","fn","toString","toLocaleString","Symbol","toPrimitive","valueOf","Proxy","Object","freeze","get","o","key","hasOwnProperty","toBool","isNothing","isSomething","serialize","JSON","stringify","k","v","deserialize","s","parse"],"mappings":"AAAaA,MAAAA,EAAU,MACtB,MAAMC,EAAK,IAAMD,EAIjB,OAHAC,EAAGC,SAAWD,EAAGE,eAAiBF,EAAGG,OAAOC,aAAe,IAAM,GACjEJ,EAAGK,QAAU,KAAM,MAERC,MAAMC,OAAOC,OAAOR,GAAK,CACnCS,IAAK,CAACC,EAAGC,IAAQD,EAAEE,eAAeD,GAAOD,EAAEC,GAAOZ,KAN7B,GAUVc,EAAUH,MAASA,IAAKA,EAAEL,WAC1BS,EAAaJ,GAAMA,IAAMX,EACzBgB,EAAeL,KAAQA,IAAMX,GAAgB,MAALW,GACxCM,EAAaN,GAAMO,KAAKC,UAAUR,EAAG,CAACS,EAAGC,IAAMA,IAAMrB,EAAU,KAAOqB,GACtEC,EAAeC,GAAML,KAAKM,MAAMD,EAAG,CAACH,EAAGC,IAAY,OAANA,EAAarB,EAAUqB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n||self).nothingMock={})}(this,function(n){"use strict";var t,e=((t=function(){return e}).toString=t.toLocaleString=t[Symbol.toPrimitive]=function(){return""},t.valueOf=function(){return!1},new Proxy(Object.freeze(t),{get:function(n,t){return n.hasOwnProperty(t)?n[t]:e}}));n.Nothing=e,n.deserialize=function(n){return JSON.parse(n,function(n,t){return null===t?e:t})},n.isNothing=function(n){return n===e},n.isSomething=function(n){return!(n===e||null==n)},n.serialize=function(n){return JSON.stringify(n,function(n,t){return t===e?null:t})},n.toBool=function(n){return!(!n||!n.valueOf())}});
|
|
2
|
+
//# sourceMappingURL=nothing-mock.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nothing-mock.umd.js","sources":["../src/index.js"],"sourcesContent":["export const Nothing = (() => {\n\tconst fn = () => Nothing\n\tfn.toString = fn.toLocaleString = fn[Symbol.toPrimitive] = () => ''\n\tfn.valueOf = () => false\n\n\treturn new Proxy(Object.freeze(fn), {\n\t\tget: (o, key) => o.hasOwnProperty(key) ? o[key] : Nothing\n\t})\n})()\n\nexport const toBool = (o) => !!(o && o.valueOf())\nexport const isNothing = (o) => o === Nothing\nexport const isSomething = (o) => !(o === Nothing || o == null)\nexport const serialize = (o) => JSON.stringify(o, (k, v) => v === Nothing ? null : v)\nexport const deserialize = (s) => JSON.parse(s, (k, v) => v === null ? Nothing : v)"],"names":["fn","Nothing","toString","toLocaleString","Symbol","toPrimitive","valueOf","Proxy","Object","freeze","get","o","key","hasOwnProperty","s","JSON","parse","k","v","stringify"],"mappings":"sPACOA,EADMC,IACND,EAAK,kBAAMC,IACdC,SAAWF,EAAGG,eAAiBH,EAAGI,OAAOC,aAAe,iBAAM,IACjEL,EAAGM,QAAU,yBAEFC,MAAMC,OAAOC,OAAOT,GAAK,CACnCU,IAAK,SAACC,EAAGC,UAAQD,EAAEE,eAAeD,GAAOD,EAAEC,GAAOX,gCAQzB,SAACa,UAAMC,KAAKC,MAAMF,EAAG,SAACG,EAAGC,UAAY,OAANA,EAAajB,EAAUiB,iBAHxD,SAACP,UAAMA,IAAMV,iBACX,SAACU,WAAQA,IAAMV,GAAgB,MAALU,gBAC5B,SAACA,UAAMI,KAAKI,UAAUR,EAAG,SAACM,EAAGC,UAAMA,IAAMjB,EAAU,KAAOiB,cAH7D,SAACP,YAASA,IAAKA,EAAEL"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nothing-mock",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "A chainable, callable mock object which always returns itself",
|
|
6
|
+
"author": "Vladimir Simonov <slmgc@ya.ru>",
|
|
7
|
+
"homepage": "https://github.com/slmgc/Nothing",
|
|
8
|
+
"repository": "github:slmgc/Nothing",
|
|
9
|
+
"main": "dist/nothing-mock.js",
|
|
10
|
+
"module": "dist/nothing-mock.es.js",
|
|
11
|
+
"esmodule": "dist/nothing-mock.modern.js",
|
|
12
|
+
"jsnext:main": "dist/nothing-mock.es.js",
|
|
13
|
+
"unpkg": "dist/nothing-mock.umd.js",
|
|
14
|
+
"source": "src/index.js",
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "microbundle --strict"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"microbundle": "^0.13.0"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"nothing",
|
|
24
|
+
"chainable",
|
|
25
|
+
"callable",
|
|
26
|
+
"mock",
|
|
27
|
+
"testing"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const Nothing = (() => {
|
|
2
|
+
const fn = () => Nothing
|
|
3
|
+
fn.toString = fn.toLocaleString = fn[Symbol.toPrimitive] = () => ''
|
|
4
|
+
fn.valueOf = () => false
|
|
5
|
+
|
|
6
|
+
return new Proxy(Object.freeze(fn), {
|
|
7
|
+
get: (o, key) => o.hasOwnProperty(key) ? o[key] : Nothing
|
|
8
|
+
})
|
|
9
|
+
})()
|
|
10
|
+
|
|
11
|
+
export const toBool = (o) => !!(o && o.valueOf())
|
|
12
|
+
export const isNothing = (o) => o === Nothing
|
|
13
|
+
export const isSomething = (o) => !(o === Nothing || o == null)
|
|
14
|
+
export const serialize = (o) => JSON.stringify(o, (k, v) => v === Nothing ? null : v)
|
|
15
|
+
export const deserialize = (s) => JSON.parse(s, (k, v) => v === null ? Nothing : v)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agnostack/next-shopify",
|
|
3
|
-
"version": "1.15.0-beta.
|
|
3
|
+
"version": "1.15.0-beta.8",
|
|
4
4
|
"author": "agnoStack Dev <developers@agnostack.com> (https://agnostack.com)",
|
|
5
5
|
"owner": "agnoStack",
|
|
6
6
|
"description": "Please contact agnoStack via info@agnostack.com for any questions",
|
|
@@ -40,11 +40,6 @@
|
|
|
40
40
|
"import": "./dist/runtime/index.js"
|
|
41
41
|
},
|
|
42
42
|
"./verification": {
|
|
43
|
-
"types": "./dist/verification/index.d.ts",
|
|
44
|
-
"require": "./dist/verification/index.js",
|
|
45
|
-
"import": "./dist/verification/index.js"
|
|
46
|
-
},
|
|
47
|
-
"./umd-verification": {
|
|
48
43
|
"types": "./dist/umd/verification/index.d.ts",
|
|
49
44
|
"require": "./dist/umd/verification.js",
|
|
50
45
|
"import": "./dist/umd/verification.js"
|
|
@@ -136,6 +131,9 @@
|
|
|
136
131
|
"ts-node": "10.9.1",
|
|
137
132
|
"typescript": "4.7.4"
|
|
138
133
|
},
|
|
134
|
+
"bundledDependencies": [
|
|
135
|
+
"browser-monads-ts"
|
|
136
|
+
],
|
|
139
137
|
"resolutions": {
|
|
140
138
|
"**/npm": "6.14.11"
|
|
141
139
|
},
|