@agnostack/next-shopify 1.14.1 → 1.15.0-beta.2
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 +14 -0
- package/dist/lib/handlers/api/auth.js +11 -15
- package/dist/lib/handlers/api/auth.js.map +1 -1
- package/dist/lib/handlers/api/billing.d.ts.map +1 -1
- package/dist/lib/handlers/api/billing.js +9 -12
- package/dist/lib/handlers/api/billing.js.map +1 -1
- package/dist/lib/handlers/api/callback.js +33 -37
- package/dist/lib/handlers/api/callback.js.map +1 -1
- package/dist/lib/handlers/api/index.js +7 -25
- package/dist/lib/handlers/api/index.js.map +1 -1
- package/dist/lib/handlers/api/uninstall.d.ts.map +1 -1
- package/dist/lib/handlers/api/uninstall.js +8 -11
- package/dist/lib/handlers/api/uninstall.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/appInstallation.js +7 -11
- package/dist/lib/handlers/api/verifiable/appInstallation.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/graph.d.ts.map +1 -1
- package/dist/lib/handlers/api/verifiable/graph.js +22 -25
- package/dist/lib/handlers/api/verifiable/graph.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/index.js +5 -21
- package/dist/lib/handlers/api/verifiable/index.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/proxy.d.ts.map +1 -1
- package/dist/lib/handlers/api/verifiable/proxy.js +32 -38
- package/dist/lib/handlers/api/verifiable/proxy.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/rest.d.ts.map +1 -1
- package/dist/lib/handlers/api/verifiable/rest.js +19 -22
- package/dist/lib/handlers/api/verifiable/rest.js.map +1 -1
- package/dist/lib/handlers/api/verifiable/token.js +23 -26
- package/dist/lib/handlers/api/verifiable/token.js.map +1 -1
- package/dist/lib/handlers/api/webhook.d.ts.map +1 -1
- package/dist/lib/handlers/api/webhook.js +9 -12
- package/dist/lib/handlers/api/webhook.js.map +1 -1
- package/dist/lib/handlers/index.js +2 -18
- package/dist/lib/handlers/index.js.map +1 -1
- package/dist/lib/handlers/ssr/index.js +2 -18
- package/dist/lib/handlers/ssr/index.js.map +1 -1
- package/dist/lib/handlers/ssr/protect.js +17 -24
- package/dist/lib/handlers/ssr/protect.js.map +1 -1
- package/dist/lib/handlers/ssr/wrap.js +6 -10
- package/dist/lib/handlers/ssr/wrap.js.map +1 -1
- package/dist/lib/index.d.ts +2 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +5 -25
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/utils/billing.js +18 -23
- package/dist/lib/utils/billing.js.map +1 -1
- package/dist/lib/utils/crypto.js +15 -25
- package/dist/lib/utils/crypto.js.map +1 -1
- package/dist/lib/utils/firebase.js +17 -29
- package/dist/lib/utils/firebase.js.map +1 -1
- package/dist/lib/utils/headers.js +6 -13
- package/dist/lib/utils/headers.js.map +1 -1
- package/dist/lib/utils/index.d.ts +0 -2
- package/dist/lib/utils/index.js +8 -26
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/session.js +59 -64
- package/dist/lib/utils/session.js.map +1 -1
- package/dist/lib/utils/shopify-api-js/oauth.js +16 -23
- package/dist/lib/utils/shopify-api-js/oauth.js.map +1 -1
- package/dist/lib/utils/shopify.js +25 -37
- package/dist/lib/utils/shopify.js.map +1 -1
- package/dist/lib/utils/token.d.ts +1 -1
- package/dist/lib/utils/token.js +11 -15
- package/dist/lib/utils/token.js.map +1 -1
- package/dist/lib/withShopify.js +77 -81
- package/dist/lib/withShopify.js.map +1 -1
- package/dist/react/hooks/index.js +1 -17
- package/dist/react/hooks/index.js.map +1 -1
- package/dist/react/hooks/useVerification.js +7 -11
- package/dist/react/hooks/useVerification.js.map +1 -1
- package/dist/react/index.js +1 -17
- package/dist/react/index.js.map +1 -1
- package/dist/runtime/index.js +1 -17
- package/dist/runtime/index.js.map +1 -1
- package/dist/shared/constants.js +11 -15
- package/dist/shared/constants.js.map +1 -1
- package/dist/shared/datetime.js +83 -110
- package/dist/shared/datetime.js.map +1 -1
- package/dist/shared/display.js +154 -236
- package/dist/shared/display.js.map +1 -1
- package/dist/shared/errors.d.ts +0 -5
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +5 -34
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/graph.js +11 -14
- package/dist/shared/graph.js.map +1 -1
- package/dist/shared/index.js +10 -26
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/match.js +17 -25
- package/dist/shared/match.js.map +1 -1
- package/dist/shared/request.d.ts +5 -0
- package/dist/shared/request.d.ts.map +1 -1
- package/dist/shared/request.js +32 -15
- package/dist/shared/request.js.map +1 -1
- package/dist/shared/shopify.d.ts +1 -6
- package/dist/shared/shopify.d.ts.map +1 -1
- package/dist/shared/shopify.js +21 -54
- package/dist/shared/shopify.js.map +1 -1
- package/dist/shared/subtlecrypto.js +13 -39
- package/dist/shared/subtlecrypto.js.map +1 -1
- package/dist/shared/verification.js +23 -29
- package/dist/shared/verification.js.map +1 -1
- package/dist/umd/lib/handlers/api/auth.d.ts +2 -0
- package/dist/umd/lib/handlers/api/auth.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/billing.d.ts +2 -0
- package/dist/umd/lib/handlers/api/billing.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/callback.d.ts +2 -0
- package/dist/umd/lib/handlers/api/callback.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/index.d.ts +10 -0
- package/dist/umd/lib/handlers/api/index.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/types.d.ts +1 -0
- package/dist/umd/lib/handlers/api/types.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/uninstall.d.ts +2 -0
- package/dist/umd/lib/handlers/api/uninstall.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/verifiable/appInstallation.d.ts +2 -0
- package/dist/umd/lib/handlers/api/verifiable/appInstallation.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/verifiable/graph.d.ts +2 -0
- package/dist/umd/lib/handlers/api/verifiable/graph.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/verifiable/index.d.ts +6 -0
- package/dist/umd/lib/handlers/api/verifiable/index.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/verifiable/proxy.d.ts +2 -0
- package/dist/umd/lib/handlers/api/verifiable/proxy.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/verifiable/rest.d.ts +2 -0
- package/dist/umd/lib/handlers/api/verifiable/rest.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/verifiable/token.d.ts +4 -0
- package/dist/umd/lib/handlers/api/verifiable/token.d.ts.map +1 -0
- package/dist/umd/lib/handlers/api/webhook.d.ts +2 -0
- package/dist/umd/lib/handlers/api/webhook.d.ts.map +1 -0
- package/dist/umd/lib/handlers/index.d.ts +3 -0
- package/dist/umd/lib/handlers/index.d.ts.map +1 -0
- package/dist/umd/lib/handlers/ssr/index.d.ts +3 -0
- package/dist/umd/lib/handlers/ssr/index.d.ts.map +1 -0
- package/dist/umd/lib/handlers/ssr/protect.d.ts +16 -0
- package/dist/umd/lib/handlers/ssr/protect.d.ts.map +1 -0
- package/dist/umd/lib/handlers/ssr/types.d.ts +1 -0
- package/dist/umd/lib/handlers/ssr/types.d.ts.map +1 -0
- package/dist/umd/lib/handlers/ssr/wrap.d.ts +9 -0
- package/dist/umd/lib/handlers/ssr/wrap.d.ts.map +1 -0
- package/dist/umd/lib/handlers/types.d.ts +1 -0
- package/dist/umd/lib/handlers/types.d.ts.map +1 -0
- package/dist/umd/lib/index.d.ts +6 -0
- package/dist/umd/lib/index.d.ts.map +1 -0
- package/dist/umd/lib/types.d.ts +1 -0
- package/dist/umd/lib/types.d.ts.map +1 -0
- package/dist/umd/lib/utils/billing.d.ts +24 -0
- package/dist/umd/lib/utils/billing.d.ts.map +1 -0
- package/dist/umd/lib/utils/crypto.d.ts +22 -0
- package/dist/umd/lib/utils/crypto.d.ts.map +1 -0
- package/dist/umd/lib/utils/firebase.d.ts +25 -0
- package/dist/umd/lib/utils/firebase.d.ts.map +1 -0
- package/dist/umd/lib/utils/headers.d.ts +5 -0
- package/dist/umd/lib/utils/headers.d.ts.map +1 -0
- package/dist/umd/lib/utils/index.d.ts +9 -0
- package/dist/umd/lib/utils/index.d.ts.map +1 -0
- package/dist/umd/lib/utils/session.d.ts +41 -0
- package/dist/umd/lib/utils/session.d.ts.map +1 -0
- package/dist/umd/lib/utils/shopify-api-js/oauth.d.ts +9 -0
- package/dist/umd/lib/utils/shopify-api-js/oauth.d.ts.map +1 -0
- package/dist/umd/lib/utils/shopify.d.ts +26 -0
- package/dist/umd/lib/utils/shopify.d.ts.map +1 -0
- package/dist/umd/lib/utils/token.d.ts +19 -0
- package/dist/umd/lib/utils/token.d.ts.map +1 -0
- package/dist/umd/lib/utils/types.d.ts +1 -0
- package/dist/umd/lib/utils/types.d.ts.map +1 -0
- package/dist/umd/lib/withShopify.d.ts +6 -0
- package/dist/umd/lib/withShopify.d.ts.map +1 -0
- package/dist/umd/react/hooks/index.d.ts +2 -0
- package/dist/umd/react/hooks/index.d.ts.map +1 -0
- package/dist/umd/react/hooks/useVerification.d.ts +8 -0
- package/dist/umd/react/hooks/useVerification.d.ts.map +1 -0
- package/dist/umd/react/index.d.ts +2 -0
- package/dist/umd/react/index.d.ts.map +1 -0
- package/dist/umd/react/types.d.ts +1 -0
- package/dist/umd/react/types.d.ts.map +1 -0
- package/dist/umd/runtime/index.d.ts +2 -0
- package/dist/umd/runtime/index.d.ts.map +1 -0
- package/dist/umd/runtime/types.d.ts +1 -0
- package/dist/umd/runtime/types.d.ts.map +1 -0
- package/dist/umd/shared/constants.d.ts +211 -0
- package/dist/umd/shared/constants.d.ts.map +1 -0
- package/dist/umd/shared/datetime.d.ts +96 -0
- package/dist/umd/shared/datetime.d.ts.map +1 -0
- package/dist/umd/shared/display.d.ts +102 -0
- package/dist/umd/shared/display.d.ts.map +1 -0
- package/dist/umd/shared/errors.d.ts +19 -0
- package/dist/umd/shared/errors.d.ts.map +1 -0
- package/dist/umd/shared/graph.d.ts +24 -0
- package/dist/umd/shared/graph.d.ts.map +1 -0
- package/dist/umd/shared/index.d.ts +11 -0
- package/dist/umd/shared/index.d.ts.map +1 -0
- package/dist/umd/shared/match.d.ts +6 -0
- package/dist/umd/shared/match.d.ts.map +1 -0
- package/dist/umd/shared/request.d.ts +16 -0
- package/dist/umd/shared/request.d.ts.map +1 -0
- package/dist/umd/shared/shopify.d.ts +31 -0
- package/dist/umd/shared/shopify.d.ts.map +1 -0
- package/dist/umd/shared/subtlecrypto.d.ts +41 -0
- package/dist/umd/shared/subtlecrypto.d.ts.map +1 -0
- package/dist/umd/shared/types.d.ts +1 -0
- package/dist/umd/shared/types.d.ts.map +1 -0
- package/dist/umd/shared/verification.d.ts +24 -0
- package/dist/umd/shared/verification.d.ts.map +1 -0
- package/dist/umd/umd-verification.js +968 -0
- package/dist/umd/umd-verification.js.map +1 -0
- package/dist/umd/verification/errors.d.ts +6 -0
- package/dist/umd/verification/errors.d.ts.map +1 -0
- package/dist/umd/verification/index.d.ts +2 -0
- package/dist/umd/verification/index.d.ts.map +1 -0
- package/dist/umd/verification/rawbody.d.ts.map +1 -0
- package/dist/umd/verification/types.d.ts +1 -0
- package/dist/umd/verification/types.d.ts.map +1 -0
- package/dist/umd/verification/verification.d.ts.map +1 -0
- package/dist/verification/errors.d.ts +6 -0
- package/dist/verification/errors.d.ts.map +1 -0
- package/dist/verification/errors.js +22 -0
- package/dist/verification/errors.js.map +1 -0
- package/dist/verification/index.d.ts +2 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +2 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/rawbody.d.ts +2 -0
- package/dist/verification/rawbody.d.ts.map +1 -0
- package/dist/{lib/utils → verification}/rawbody.js +4 -10
- package/dist/verification/rawbody.js.map +1 -0
- package/dist/verification/types.d.ts +1 -0
- package/dist/verification/types.d.ts.map +1 -0
- package/dist/verification/types.js +1 -0
- package/dist/verification/types.js.map +1 -0
- package/dist/verification/verification.d.ts +8 -0
- package/dist/verification/verification.d.ts.map +1 -0
- package/dist/{lib/utils → verification}/verification.js +20 -21
- package/dist/verification/verification.js.map +1 -0
- 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/bytes/History.md +97 -0
- package/node_modules/bytes/LICENSE +23 -0
- package/node_modules/bytes/Readme.md +152 -0
- package/node_modules/bytes/index.js +170 -0
- package/node_modules/bytes/package.json +42 -0
- package/node_modules/depd/History.md +103 -0
- package/node_modules/depd/LICENSE +22 -0
- package/node_modules/depd/Readme.md +280 -0
- package/node_modules/depd/index.js +538 -0
- package/node_modules/depd/lib/browser/index.js +77 -0
- package/node_modules/depd/package.json +45 -0
- package/node_modules/http-errors/HISTORY.md +180 -0
- package/node_modules/http-errors/LICENSE +23 -0
- package/node_modules/http-errors/README.md +169 -0
- package/node_modules/http-errors/index.js +289 -0
- package/node_modules/http-errors/package.json +50 -0
- package/node_modules/iconv-lite/Changelog.md +162 -0
- package/node_modules/iconv-lite/LICENSE +21 -0
- package/node_modules/iconv-lite/README.md +156 -0
- package/node_modules/iconv-lite/encodings/dbcs-codec.js +555 -0
- package/node_modules/iconv-lite/encodings/dbcs-data.js +176 -0
- package/node_modules/iconv-lite/encodings/index.js +22 -0
- package/node_modules/iconv-lite/encodings/internal.js +188 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
- package/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
- package/node_modules/iconv-lite/encodings/sbcs-data.js +174 -0
- package/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
- package/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
- package/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
- package/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
- package/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
- package/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
- package/node_modules/iconv-lite/encodings/tables/gbk-added.json +55 -0
- package/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
- package/node_modules/iconv-lite/encodings/utf16.js +177 -0
- package/node_modules/iconv-lite/encodings/utf7.js +290 -0
- package/node_modules/iconv-lite/lib/bom-handling.js +52 -0
- package/node_modules/iconv-lite/lib/extend-node.js +217 -0
- package/node_modules/iconv-lite/lib/index.d.ts +24 -0
- package/node_modules/iconv-lite/lib/index.js +153 -0
- package/node_modules/iconv-lite/lib/streams.js +121 -0
- package/node_modules/iconv-lite/package.json +46 -0
- package/node_modules/inherits/LICENSE +16 -0
- package/node_modules/inherits/README.md +42 -0
- package/node_modules/inherits/inherits.js +9 -0
- package/node_modules/inherits/inherits_browser.js +27 -0
- package/node_modules/inherits/package.json +29 -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/node_modules/raw-body/HISTORY.md +308 -0
- package/node_modules/raw-body/LICENSE +22 -0
- package/node_modules/raw-body/README.md +223 -0
- package/node_modules/raw-body/SECURITY.md +24 -0
- package/node_modules/raw-body/index.d.ts +87 -0
- package/node_modules/raw-body/index.js +336 -0
- package/node_modules/raw-body/package.json +49 -0
- package/node_modules/safer-buffer/LICENSE +21 -0
- package/node_modules/safer-buffer/Porting-Buffer.md +268 -0
- package/node_modules/safer-buffer/Readme.md +156 -0
- package/node_modules/safer-buffer/dangerous.js +58 -0
- package/node_modules/safer-buffer/package.json +34 -0
- package/node_modules/safer-buffer/safer.js +77 -0
- package/node_modules/safer-buffer/tests.js +406 -0
- package/node_modules/setprototypeof/LICENSE +13 -0
- package/node_modules/setprototypeof/README.md +31 -0
- package/node_modules/setprototypeof/index.d.ts +2 -0
- package/node_modules/setprototypeof/index.js +17 -0
- package/node_modules/setprototypeof/package.json +38 -0
- package/node_modules/setprototypeof/test/index.js +24 -0
- package/node_modules/statuses/HISTORY.md +82 -0
- package/node_modules/statuses/LICENSE +23 -0
- package/node_modules/statuses/README.md +136 -0
- package/node_modules/statuses/codes.json +65 -0
- package/node_modules/statuses/index.js +146 -0
- package/node_modules/statuses/package.json +49 -0
- package/node_modules/toidentifier/HISTORY.md +9 -0
- package/node_modules/toidentifier/LICENSE +21 -0
- package/node_modules/toidentifier/README.md +61 -0
- package/node_modules/toidentifier/index.js +32 -0
- package/node_modules/toidentifier/package.json +38 -0
- package/node_modules/unpipe/HISTORY.md +4 -0
- package/node_modules/unpipe/LICENSE +22 -0
- package/node_modules/unpipe/README.md +43 -0
- package/node_modules/unpipe/index.js +69 -0
- package/node_modules/unpipe/package.json +27 -0
- package/package.json +22 -4
- package/dist/lib/utils/rawbody.d.ts.map +0 -1
- package/dist/lib/utils/rawbody.js.map +0 -1
- package/dist/lib/utils/verification.d.ts.map +0 -1
- package/dist/lib/utils/verification.js.map +0 -1
- /package/dist/{lib/utils → umd/verification}/rawbody.d.ts +0 -0
- /package/dist/{lib/utils → umd/verification}/verification.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"umd-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","../../node_modules/raw-body/index.js","../../src/verification/rawbody.js","../../src/verification/errors.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 */\nimport { v4 as uuidV4 } from 'uuid'\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\n// #endregion lib-utils-js\n\nexport const getGUID = () => (\n uuidV4()\n)\n\nexport const getInteger = () => (\n getGUID().replace(/\\D/g,'')\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\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","/*!\n * raw-body\n * Copyright(c) 2013-2014 Jonathan Ong\n * Copyright(c) 2014-2022 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict'\n\n/**\n * Module dependencies.\n * @private\n */\n\nvar asyncHooks = tryRequireAsyncHooks()\nvar bytes = require('bytes')\nvar createError = require('http-errors')\nvar iconv = require('iconv-lite')\nvar unpipe = require('unpipe')\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = getRawBody\n\n/**\n * Module variables.\n * @private\n */\n\nvar ICONV_ENCODING_MESSAGE_REGEXP = /^Encoding not recognized: /\n\n/**\n * Get the decoder for a given encoding.\n *\n * @param {string} encoding\n * @private\n */\n\nfunction getDecoder (encoding) {\n if (!encoding) return null\n\n try {\n return iconv.getDecoder(encoding)\n } catch (e) {\n // error getting decoder\n if (!ICONV_ENCODING_MESSAGE_REGEXP.test(e.message)) throw e\n\n // the encoding was not found\n throw createError(415, 'specified encoding unsupported', {\n encoding: encoding,\n type: 'encoding.unsupported'\n })\n }\n}\n\n/**\n * Get the raw body of a stream (typically HTTP).\n *\n * @param {object} stream\n * @param {object|string|function} [options]\n * @param {function} [callback]\n * @public\n */\n\nfunction getRawBody (stream, options, callback) {\n var done = callback\n var opts = options || {}\n\n // light validation\n if (stream === undefined) {\n throw new TypeError('argument stream is required')\n } else if (typeof stream !== 'object' || stream === null || typeof stream.on !== 'function') {\n throw new TypeError('argument stream must be a stream')\n }\n\n if (options === true || typeof options === 'string') {\n // short cut for encoding\n opts = {\n encoding: options\n }\n }\n\n if (typeof options === 'function') {\n done = options\n opts = {}\n }\n\n // validate callback is a function, if provided\n if (done !== undefined && typeof done !== 'function') {\n throw new TypeError('argument callback must be a function')\n }\n\n // require the callback without promises\n if (!done && !global.Promise) {\n throw new TypeError('argument callback is required')\n }\n\n // get encoding\n var encoding = opts.encoding !== true\n ? opts.encoding\n : 'utf-8'\n\n // convert the limit to an integer\n var limit = bytes.parse(opts.limit)\n\n // convert the expected length to an integer\n var length = opts.length != null && !isNaN(opts.length)\n ? parseInt(opts.length, 10)\n : null\n\n if (done) {\n // classic callback style\n return readStream(stream, encoding, length, limit, wrap(done))\n }\n\n return new Promise(function executor (resolve, reject) {\n readStream(stream, encoding, length, limit, function onRead (err, buf) {\n if (err) return reject(err)\n resolve(buf)\n })\n })\n}\n\n/**\n * Halt a stream.\n *\n * @param {Object} stream\n * @private\n */\n\nfunction halt (stream) {\n // unpipe everything from the stream\n unpipe(stream)\n\n // pause stream\n if (typeof stream.pause === 'function') {\n stream.pause()\n }\n}\n\n/**\n * Read the data from the stream.\n *\n * @param {object} stream\n * @param {string} encoding\n * @param {number} length\n * @param {number} limit\n * @param {function} callback\n * @public\n */\n\nfunction readStream (stream, encoding, length, limit, callback) {\n var complete = false\n var sync = true\n\n // check the length and limit options.\n // note: we intentionally leave the stream paused,\n // so users should handle the stream themselves.\n if (limit !== null && length !== null && length > limit) {\n return done(createError(413, 'request entity too large', {\n expected: length,\n length: length,\n limit: limit,\n type: 'entity.too.large'\n }))\n }\n\n // streams1: assert request encoding is buffer.\n // streams2+: assert the stream encoding is buffer.\n // stream._decoder: streams1\n // state.encoding: streams2\n // state.decoder: streams2, specifically < 0.10.6\n var state = stream._readableState\n if (stream._decoder || (state && (state.encoding || state.decoder))) {\n // developer error\n return done(createError(500, 'stream encoding should not be set', {\n type: 'stream.encoding.set'\n }))\n }\n\n if (typeof stream.readable !== 'undefined' && !stream.readable) {\n return done(createError(500, 'stream is not readable', {\n type: 'stream.not.readable'\n }))\n }\n\n var received = 0\n var decoder\n\n try {\n decoder = getDecoder(encoding)\n } catch (err) {\n return done(err)\n }\n\n var buffer = decoder\n ? ''\n : []\n\n // attach listeners\n stream.on('aborted', onAborted)\n stream.on('close', cleanup)\n stream.on('data', onData)\n stream.on('end', onEnd)\n stream.on('error', onEnd)\n\n // mark sync section complete\n sync = false\n\n function done () {\n var args = new Array(arguments.length)\n\n // copy arguments\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i]\n }\n\n // mark complete\n complete = true\n\n if (sync) {\n process.nextTick(invokeCallback)\n } else {\n invokeCallback()\n }\n\n function invokeCallback () {\n cleanup()\n\n if (args[0]) {\n // halt the stream on error\n halt(stream)\n }\n\n callback.apply(null, args)\n }\n }\n\n function onAborted () {\n if (complete) return\n\n done(createError(400, 'request aborted', {\n code: 'ECONNABORTED',\n expected: length,\n length: length,\n received: received,\n type: 'request.aborted'\n }))\n }\n\n function onData (chunk) {\n if (complete) return\n\n received += chunk.length\n\n if (limit !== null && received > limit) {\n done(createError(413, 'request entity too large', {\n limit: limit,\n received: received,\n type: 'entity.too.large'\n }))\n } else if (decoder) {\n buffer += decoder.write(chunk)\n } else {\n buffer.push(chunk)\n }\n }\n\n function onEnd (err) {\n if (complete) return\n if (err) return done(err)\n\n if (length !== null && received !== length) {\n done(createError(400, 'request size did not match content length', {\n expected: length,\n length: length,\n received: received,\n type: 'request.size.invalid'\n }))\n } else {\n var string = decoder\n ? buffer + (decoder.end() || '')\n : Buffer.concat(buffer)\n done(null, string)\n }\n }\n\n function cleanup () {\n buffer = null\n\n stream.removeListener('aborted', onAborted)\n stream.removeListener('data', onData)\n stream.removeListener('end', onEnd)\n stream.removeListener('error', onEnd)\n stream.removeListener('close', cleanup)\n }\n}\n\n/**\n * Try to require async_hooks\n * @private\n */\n\nfunction tryRequireAsyncHooks () {\n try {\n return require('async_hooks')\n } catch (e) {\n return {}\n }\n}\n\n/**\n * Wrap function with async resource, if possible.\n * AsyncResource.bind static method backported.\n * @private\n */\n\nfunction wrap (fn) {\n var res\n\n // create anonymous resource\n if (asyncHooks.AsyncResource) {\n res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')\n }\n\n // incompatible node.js\n if (!res || !res.runInAsyncScope) {\n return fn\n }\n\n // return bound function\n return res.runInAsyncScope.bind(res, fn, null)\n}\n","// import getRawBody from 'raw-body'\nimport * as getRawBody from 'raw-body'\n\n// TODO: explore returning mutated request object adding on req.rawBody??\n// TODO: move to req.text() after next 13.5\nexport const ensureRawBody = async (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","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 { subtle } from '../shared/subtlecrypto'\nimport { getRequestMethod, normalizeURIParts } from '../shared/request'\nimport {\n objectToSortedString,\n ensureString,\n safeParse,\n isTrue,\n} from '../shared/display'\nimport { ensureRawBody } from './rawbody'\nimport { VerificationError } from './errors'\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":["getRawBody"],"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,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;EAExC,IAAI,MAAM,GAAG,OAAO,GAAG,KAAK,WAAW,GAAG,GAAG,GAAG,CAAC;;ECRjD;AAkGA;EACO,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,IAAI;EAClC;EACA,EAAE,CAAC,KAAK,IAAI,SAAS,MAAM,OAAO,KAAK,KAAK,IAAI,CAAC;EACjD,EAAC;AA2BD;EACO,MAAM,QAAQ,GAAG,CAAC,KAAK,KAAK;EACnC,EAAE,IAAI,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE;EAC/B;EACA,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,G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AAM,MAAM,eAAe,GAAG,OAAO,QAAQ,KAAK;EAClD,QAAQ,IAAI,CAAC,QAAQ,IAAI,iBAAiB,IAAI,CAAC,YAAY,IAAI,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 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/verification/errors.js"],"names":[],"mappings":"AAAA;IACE,sCAOC;IAJC,UAAgB;IAChB,UAAgB;CAInB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verification/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rawbody.d.ts","sourceRoot":"","sources":["../../src/verification/rawbody.js"],"names":[],"mappings":"AAKO,sDAkBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/verification/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../src/verification/verification.js"],"names":[],"mappings":"AAWO;;;;;;GA2FN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/verification/errors.js"],"names":[],"mappings":"AAAA;IACE,sCAOC;IAJC,UAAgB;IAChB,UAAgB;CAInB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
export class VerificationError extends Error {
|
|
13
|
+
constructor(message, _data) {
|
|
14
|
+
super(message);
|
|
15
|
+
const _a = _data !== null && _data !== void 0 ? _data : {}, { code = 500 } = _a, data = __rest(_a, ["code"]);
|
|
16
|
+
this.code = code;
|
|
17
|
+
this.data = data;
|
|
18
|
+
this.name = 'VerificationError';
|
|
19
|
+
Object.setPrototypeOf(this, VerificationError.prototype);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/verification/errors.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAO,EAAE,KAAK;QACxB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,MAAM,KAA0B,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,EAArC,EAAE,IAAI,GAAG,GAAG,OAAyB,EAApB,IAAI,cAArB,QAAuB,CAAc,CAAA;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;QAC/B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAA;IAC1D,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verification/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/verification/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rawbody.d.ts","sourceRoot":"","sources":["../../src/verification/rawbody.js"],"names":[],"mappings":"AAKO,sDAkBN"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,16 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ensureRawBody = void 0;
|
|
16
|
-
const raw_body_1 = __importDefault(require("raw-body"));
|
|
10
|
+
// import getRawBody from 'raw-body'
|
|
11
|
+
import * as getRawBody from 'raw-body';
|
|
17
12
|
// TODO: explore returning mutated request object adding on req.rawBody??
|
|
18
13
|
// TODO: move to req.text() after next 13.5
|
|
19
|
-
const ensureRawBody = (req) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
return ((
|
|
14
|
+
export const ensureRawBody = (req) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
return (getRawBody(req)
|
|
21
16
|
.then((_rawBody) => _rawBody.toString())
|
|
22
17
|
.catch((error) => {
|
|
23
18
|
// NOTE: this is intended to ensure if getRawBody is called 2x w/in a route that it returns the already streamed body
|
|
@@ -33,5 +28,4 @@ const ensureRawBody = (req) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
33
28
|
throw error;
|
|
34
29
|
}));
|
|
35
30
|
});
|
|
36
|
-
exports.ensureRawBody = ensureRawBody;
|
|
37
31
|
//# sourceMappingURL=rawbody.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rawbody.js","sourceRoot":"","sources":["../../src/verification/rawbody.js"],"names":[],"mappings":";;;;;;;;;AAAA,oCAAoC;AACpC,OAAO,KAAK,UAAU,MAAM,UAAU,CAAA;AAEtC,yEAAyE;AACzE,2CAA2C;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAO,GAAG,EAAE,EAAE;IAAC,OAAA,CAC1C,UAAU,CAAC,GAAG,CAAC;SACZ,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;SACvC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACf,qHAAqH;QACrH,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,qBAAqB,CAAC,EAAE;YAC3C,IAAI,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAA,EAAE;gBACjB,mCAAmC;gBACnC,OAAO,CAAC,IAAI,CAAC,0OAA0O,CAAC,CAAA;gBACxP,OAAO,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAA;aACjB;YAED,OAAO,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,OAAO,CAAA;SACpB;QAED,OAAO,CAAC,KAAK,CAAC,+BAA+B,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,GAAG,GAAG,EAAE,KAAK,CAAC,CAAA;QAChE,MAAM,KAAK,CAAA;IACf,CAAC,CAAC,CACH,CAAA;EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/verification/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/verification/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification.d.ts","sourceRoot":"","sources":["../../src/verification/verification.js"],"names":[],"mappings":"AAWO;;;;;;GA2FN"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,29 +7,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
import { subtle } from '../shared/subtlecrypto';
|
|
11
|
+
import { getRequestMethod, normalizeURIParts } from '../shared/request';
|
|
12
|
+
import { objectToSortedString, ensureString, safeParse, isTrue, } from '../shared/display';
|
|
13
|
+
import { ensureRawBody } from './rawbody';
|
|
14
|
+
import { VerificationError } from './errors';
|
|
15
|
+
export const getVerificationHelpers = ({ keyPairs }) => ((req, params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
16
|
var _a;
|
|
17
17
|
const { 'x-public-key': apiKey, 'x-ephemeral-key': ephemeralPublicKey, 'x-authorization-timestamp': customAuthTimestamp, 'x-authorization': customAuth, } = (_a = req.headers) !== null && _a !== void 0 ? _a : {};
|
|
18
18
|
const { uri: _uri, disableRecryption: _disableRecryption } = params !== null && params !== void 0 ? params : {};
|
|
19
19
|
const uri = _uri !== null && _uri !== void 0 ? _uri : req.url;
|
|
20
|
-
const disableRecryption =
|
|
20
|
+
const disableRecryption = isTrue(_disableRecryption);
|
|
21
21
|
let isVerifiable;
|
|
22
22
|
try {
|
|
23
|
-
const [authProtocol, authSignature] =
|
|
24
|
-
isVerifiable =
|
|
23
|
+
const [authProtocol, authSignature] = ensureString(customAuth).split(' ');
|
|
24
|
+
isVerifiable = isTrue(apiKey &&
|
|
25
25
|
ephemeralPublicKey &&
|
|
26
26
|
(keyPairs === null || keyPairs === void 0 ? void 0 : keyPairs.shared) &&
|
|
27
27
|
customAuthTimestamp &&
|
|
28
28
|
authSignature &&
|
|
29
29
|
(authProtocol === 'HMAC-SHA256'));
|
|
30
30
|
let verificationKeys;
|
|
31
|
-
const rawBody = yield
|
|
31
|
+
const rawBody = yield ensureRawBody(req);
|
|
32
32
|
// NOTE: requestBody should be wind up decrypted when isVerifiable (unless disableRecryption, then will pass through)
|
|
33
|
-
let requestBody =
|
|
33
|
+
let requestBody = safeParse(rawBody);
|
|
34
34
|
// TEMP!!! remove isVerifiable check once webwidget moved to react
|
|
35
35
|
if (isVerifiable) {
|
|
36
36
|
if (!apiKey ||
|
|
@@ -40,30 +40,30 @@ const getVerificationHelpers = ({ keyPairs }) => ((req, params) => __awaiter(voi
|
|
|
40
40
|
!(keyPairs === null || keyPairs === void 0 ? void 0 : keyPairs.shared) ||
|
|
41
41
|
(apiKey !== keyPairs.shared.publicKey) ||
|
|
42
42
|
(authProtocol !== 'HMAC-SHA256')) {
|
|
43
|
-
throw new
|
|
43
|
+
throw new VerificationError('Invalid or missing authorization', { code: 401 });
|
|
44
44
|
}
|
|
45
|
-
verificationKeys = yield
|
|
45
|
+
verificationKeys = yield subtle.getVerificationKeys({
|
|
46
46
|
publicKey: ephemeralPublicKey,
|
|
47
47
|
privateKey: keyPairs.shared.privateKey,
|
|
48
48
|
});
|
|
49
49
|
if (!verificationKeys) {
|
|
50
|
-
throw new
|
|
50
|
+
throw new VerificationError('Invalid or missing verification', { code: 412 });
|
|
51
51
|
}
|
|
52
|
-
const verificationPayload =
|
|
53
|
-
const isValid = yield
|
|
52
|
+
const verificationPayload = objectToSortedString(Object.assign({ method: getRequestMethod(rawBody, req.method), timestamp: customAuthTimestamp, body: requestBody }, normalizeURIParts(uri)));
|
|
53
|
+
const isValid = yield subtle.verifyHMAC(verificationPayload, verificationKeys.derivedHMACKey, authSignature);
|
|
54
54
|
if (!isValid) {
|
|
55
|
-
throw new
|
|
55
|
+
throw new VerificationError('Invalid or missing verification', { code: 412 });
|
|
56
56
|
}
|
|
57
57
|
if (!disableRecryption && requestBody) {
|
|
58
|
-
const decryptedMessage = yield
|
|
59
|
-
requestBody =
|
|
58
|
+
const decryptedMessage = yield subtle.decryptMessage(requestBody, verificationKeys.derivedSecretKey);
|
|
59
|
+
requestBody = safeParse(decryptedMessage);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
const processResponse = (response) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
63
|
if (!response || disableRecryption || !isVerifiable || !(verificationKeys === null || verificationKeys === void 0 ? void 0 : verificationKeys.derivedSecretKey)) {
|
|
64
64
|
return response;
|
|
65
65
|
}
|
|
66
|
-
return
|
|
66
|
+
return subtle.encryptMessage(JSON.stringify(response), verificationKeys.derivedSecretKey);
|
|
67
67
|
});
|
|
68
68
|
return { rawBody, requestBody, processResponse };
|
|
69
69
|
}
|
|
@@ -72,5 +72,4 @@ const getVerificationHelpers = ({ keyPairs }) => ((req, params) => __awaiter(voi
|
|
|
72
72
|
throw error;
|
|
73
73
|
}
|
|
74
74
|
}));
|
|
75
|
-
exports.getVerificationHelpers = getVerificationHelpers;
|
|
76
75
|
//# sourceMappingURL=verification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification.js","sourceRoot":"","sources":["../../src/verification/verification.js"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,SAAS,EACT,MAAM,GACP,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACtD,CAAO,GAAG,EAAE,MAAM,EAAE,EAAE;;IACpB,MAAM,EACJ,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,kBAAkB,EACrC,2BAA2B,EAAE,mBAAmB,EAChD,iBAAiB,EAAE,UAAU,GAC9B,GAAG,MAAA,GAAG,CAAC,OAAO,mCAAI,EAAE,CAAA;IAErB,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAA;IACzE,MAAM,GAAG,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,GAAG,CAAC,GA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AA;KACZ;AACH,CAAC,CAAA,CACF,CAAA"}
|
|
@@ -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,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,OAAM,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,OAAM,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,CAA0C,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,C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