@redmix/api 9.0.0-canary.581 → 9.0.0-canary.583

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.
Files changed (130) hide show
  1. package/dist/auth/index.js +10 -49
  2. package/dist/auth/parseJWT.js +3 -26
  3. package/dist/auth/verifiers/base64Sha1Verifier.js +18 -37
  4. package/dist/auth/verifiers/base64Sha256Verifier.js +18 -37
  5. package/dist/auth/verifiers/common.js +19 -58
  6. package/dist/auth/verifiers/index.js +8 -33
  7. package/dist/auth/verifiers/jwtVerifier.js +17 -47
  8. package/dist/auth/verifiers/secretKeyVerifier.js +7 -26
  9. package/dist/auth/verifiers/sha1Verifier.js +18 -37
  10. package/dist/auth/verifiers/sha256Verifier.js +18 -37
  11. package/dist/auth/verifiers/skipVerifier.js +4 -23
  12. package/dist/auth/verifiers/timestampSchemeVerifier.js +18 -33
  13. package/dist/cache/clients/BaseClient.js +4 -23
  14. package/dist/cache/clients/InMemoryClient.js +6 -35
  15. package/dist/cache/clients/MemcachedClient.js +6 -35
  16. package/dist/cache/clients/RedisClient.js +6 -35
  17. package/dist/cache/errors.js +3 -26
  18. package/dist/cache/index.js +14 -52
  19. package/dist/cjs/auth/index.d.ts +51 -0
  20. package/dist/cjs/auth/index.d.ts.map +1 -0
  21. package/dist/cjs/auth/index.js +129 -0
  22. package/dist/cjs/auth/parseJWT.d.ts +6 -0
  23. package/dist/cjs/auth/parseJWT.d.ts.map +1 -0
  24. package/dist/cjs/auth/parseJWT.js +57 -0
  25. package/dist/cjs/auth/verifiers/base64Sha1Verifier.d.ts +19 -0
  26. package/dist/cjs/auth/verifiers/base64Sha1Verifier.d.ts.map +1 -0
  27. package/dist/cjs/auth/verifiers/base64Sha1Verifier.js +77 -0
  28. package/dist/cjs/auth/verifiers/base64Sha256Verifier.d.ts +19 -0
  29. package/dist/cjs/auth/verifiers/base64Sha256Verifier.d.ts.map +1 -0
  30. package/dist/cjs/auth/verifiers/base64Sha256Verifier.js +77 -0
  31. package/dist/cjs/auth/verifiers/common.d.ts +104 -0
  32. package/dist/cjs/auth/verifiers/common.d.ts.map +1 -0
  33. package/dist/cjs/auth/verifiers/common.js +99 -0
  34. package/dist/cjs/auth/verifiers/index.d.ts +8 -0
  35. package/dist/cjs/auth/verifiers/index.d.ts.map +1 -0
  36. package/dist/cjs/auth/verifiers/index.js +38 -0
  37. package/dist/cjs/auth/verifiers/jwtVerifier.d.ts +26 -0
  38. package/dist/cjs/auth/verifiers/jwtVerifier.d.ts.map +1 -0
  39. package/dist/cjs/auth/verifiers/jwtVerifier.js +86 -0
  40. package/dist/cjs/auth/verifiers/secretKeyVerifier.d.ts +14 -0
  41. package/dist/cjs/auth/verifiers/secretKeyVerifier.d.ts.map +1 -0
  42. package/dist/cjs/auth/verifiers/secretKeyVerifier.js +40 -0
  43. package/dist/cjs/auth/verifiers/sha1Verifier.d.ts +25 -0
  44. package/dist/cjs/auth/verifiers/sha1Verifier.d.ts.map +1 -0
  45. package/dist/cjs/auth/verifiers/sha1Verifier.js +85 -0
  46. package/dist/cjs/auth/verifiers/sha256Verifier.d.ts +25 -0
  47. package/dist/cjs/auth/verifiers/sha256Verifier.d.ts.map +1 -0
  48. package/dist/cjs/auth/verifiers/sha256Verifier.js +85 -0
  49. package/dist/cjs/auth/verifiers/skipVerifier.d.ts +13 -0
  50. package/dist/cjs/auth/verifiers/skipVerifier.d.ts.map +1 -0
  51. package/dist/cjs/auth/verifiers/skipVerifier.js +37 -0
  52. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.d.ts +16 -0
  53. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.d.ts.map +1 -0
  54. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.js +81 -0
  55. package/dist/cjs/bins/redwood.d.ts +9 -0
  56. package/dist/cjs/bins/redwood.d.ts.map +1 -0
  57. package/dist/cjs/bins/rwfw.d.ts +3 -0
  58. package/dist/cjs/bins/rwfw.d.ts.map +1 -0
  59. package/dist/cjs/bins/tsc.d.ts +3 -0
  60. package/dist/cjs/bins/tsc.d.ts.map +1 -0
  61. package/dist/{bins → cjs/bins}/tsc.js +2 -2
  62. package/dist/cjs/cache/clients/BaseClient.d.ts +11 -0
  63. package/dist/cjs/cache/clients/BaseClient.d.ts.map +1 -0
  64. package/dist/cjs/cache/clients/BaseClient.js +27 -0
  65. package/dist/cjs/cache/clients/InMemoryClient.d.ts +31 -0
  66. package/dist/cjs/cache/clients/InMemoryClient.d.ts.map +1 -0
  67. package/dist/cjs/cache/clients/InMemoryClient.js +100 -0
  68. package/dist/cjs/cache/clients/MemcachedClient.d.ts +16 -0
  69. package/dist/cjs/cache/clients/MemcachedClient.d.ts.map +1 -0
  70. package/dist/cjs/cache/clients/MemcachedClient.js +75 -0
  71. package/dist/cjs/cache/clients/RedisClient.d.ts +20 -0
  72. package/dist/cjs/cache/clients/RedisClient.d.ts.map +1 -0
  73. package/dist/cjs/cache/clients/RedisClient.js +79 -0
  74. package/dist/cjs/cache/errors.d.ts +4 -0
  75. package/dist/cjs/cache/errors.d.ts.map +1 -0
  76. package/dist/cjs/cache/errors.js +33 -0
  77. package/dist/cjs/cache/index.d.ts +35 -0
  78. package/dist/cjs/cache/index.d.ts.map +1 -0
  79. package/dist/cjs/cache/index.js +171 -0
  80. package/dist/cjs/cors.d.ts +16 -0
  81. package/dist/cjs/cors.d.ts.map +1 -0
  82. package/dist/cjs/cors.js +93 -0
  83. package/dist/cjs/errors.d.ts +5 -0
  84. package/dist/cjs/errors.d.ts.map +1 -0
  85. package/dist/cjs/errors.js +38 -0
  86. package/dist/cjs/event.d.ts +3 -0
  87. package/dist/cjs/event.d.ts.map +1 -0
  88. package/dist/cjs/event.js +34 -0
  89. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts +4 -0
  90. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts.map +1 -0
  91. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.js +72 -0
  92. package/dist/cjs/index.d.ts +11 -0
  93. package/dist/cjs/index.d.ts.map +1 -0
  94. package/dist/cjs/index.js +63 -0
  95. package/dist/cjs/logger/index.d.ts +179 -0
  96. package/dist/cjs/logger/index.d.ts.map +1 -0
  97. package/dist/cjs/logger/index.js +195 -0
  98. package/dist/cjs/package.json +1 -0
  99. package/dist/cjs/transforms.d.ts +35 -0
  100. package/dist/cjs/transforms.d.ts.map +1 -0
  101. package/dist/cjs/transforms.js +98 -0
  102. package/dist/cjs/types.d.ts +25 -0
  103. package/dist/cjs/types.d.ts.map +1 -0
  104. package/dist/cjs/types.js +16 -0
  105. package/dist/cjs/validations/errors.d.ts +101 -0
  106. package/dist/cjs/validations/errors.d.ts.map +1 -0
  107. package/dist/cjs/validations/errors.js +298 -0
  108. package/dist/cjs/validations/validations.d.ts +222 -0
  109. package/dist/cjs/validations/validations.d.ts.map +1 -0
  110. package/dist/cjs/validations/validations.js +351 -0
  111. package/dist/cjs/webhooks/index.d.ts +76 -0
  112. package/dist/cjs/webhooks/index.d.ts.map +1 -0
  113. package/dist/cjs/webhooks/index.js +107 -0
  114. package/dist/cors.js +7 -30
  115. package/dist/errors.js +3 -26
  116. package/dist/event.js +5 -28
  117. package/dist/functions/fixtures/apiGatewayProxyEvent.fixture.js +4 -27
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +17 -46
  120. package/dist/logger/index.d.ts.map +1 -1
  121. package/dist/logger/index.js +6 -48
  122. package/dist/package.json +1 -0
  123. package/dist/transforms.js +6 -33
  124. package/dist/types.js +1 -16
  125. package/dist/validations/errors.js +8 -66
  126. package/dist/validations/validations.js +8 -44
  127. package/dist/webhooks/index.js +25 -46
  128. package/package.json +53 -18
  129. /package/dist/{bins → cjs/bins}/redwood.js +0 -0
  130. /package/dist/{bins → cjs/bins}/rwfw.js +0 -0
@@ -1,29 +1,10 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var sha1Verifier_exports = {};
20
- __export(sha1Verifier_exports, {
21
- default: () => sha1Verifier_default,
22
- verifySignature: () => verifySignature
23
- });
24
- module.exports = __toCommonJS(sha1Verifier_exports);
25
- var import_crypto = require("crypto");
26
- var import_common = require("./common.js");
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
2
+ import { createHmac, timingSafeEqual } from "crypto";
3
+ import {
4
+ WebhookVerificationError,
5
+ VERIFICATION_ERROR_MESSAGE,
6
+ DEFAULT_WEBHOOK_SECRET
7
+ } from "./common.js";
27
8
  function toNormalizedJsonString(payload) {
28
9
  return JSON.stringify(payload).replace(/[^\\]\\u[\da-f]{4}/g, (s) => {
29
10
  return s.substr(0, 3) + s.substr(3).toUpperCase();
@@ -31,10 +12,10 @@ function toNormalizedJsonString(payload) {
31
12
  }
32
13
  const createSignature = ({
33
14
  payload,
34
- secret = import_common.DEFAULT_WEBHOOK_SECRET
15
+ secret = DEFAULT_WEBHOOK_SECRET
35
16
  }) => {
36
17
  const algorithm = "sha1";
37
- const hmac = (0, import_crypto.createHmac)(algorithm, secret);
18
+ const hmac = createHmac(algorithm, secret);
38
19
  payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
39
20
  const digest = Buffer.from(
40
21
  algorithm + "=" + hmac.update(payload).digest("hex"),
@@ -44,26 +25,26 @@ const createSignature = ({
44
25
  };
45
26
  const verifySignature = ({
46
27
  payload,
47
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
28
+ secret = DEFAULT_WEBHOOK_SECRET,
48
29
  signature
49
30
  }) => {
50
31
  try {
51
32
  const algorithm = signature.split("=")[0];
52
33
  const webhookSignature = Buffer.from(signature || "", "utf8");
53
- const hmac = (0, import_crypto.createHmac)(algorithm, secret);
34
+ const hmac = createHmac(algorithm, secret);
54
35
  payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
55
36
  const digest = Buffer.from(
56
37
  algorithm + "=" + hmac.update(payload).digest("hex"),
57
38
  "utf8"
58
39
  );
59
- const verified = webhookSignature.length === digest.length && (0, import_crypto.timingSafeEqual)(digest, webhookSignature);
40
+ const verified = webhookSignature.length === digest.length && timingSafeEqual(digest, webhookSignature);
60
41
  if (verified) {
61
42
  return verified;
62
43
  }
63
- throw new import_common.WebhookVerificationError();
44
+ throw new WebhookVerificationError();
64
45
  } catch (error) {
65
- throw new import_common.WebhookVerificationError(
66
- `${import_common.VERIFICATION_ERROR_MESSAGE}: ${error.message}`
46
+ throw new WebhookVerificationError(
47
+ `${VERIFICATION_ERROR_MESSAGE}: ${error.message}`
67
48
  );
68
49
  }
69
50
  };
@@ -79,7 +60,7 @@ const sha1Verifier = (_options) => {
79
60
  };
80
61
  };
81
62
  var sha1Verifier_default = sha1Verifier;
82
- // Annotate the CommonJS export names for ESM import in node:
83
- 0 && (module.exports = {
63
+ export {
64
+ sha1Verifier_default as default,
84
65
  verifySignature
85
- });
66
+ };
@@ -1,29 +1,10 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var sha256Verifier_exports = {};
20
- __export(sha256Verifier_exports, {
21
- default: () => sha256Verifier_default,
22
- verifySignature: () => verifySignature
23
- });
24
- module.exports = __toCommonJS(sha256Verifier_exports);
25
- var import_crypto = require("crypto");
26
- var import_common = require("./common.js");
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
2
+ import { createHmac, timingSafeEqual } from "crypto";
3
+ import {
4
+ WebhookVerificationError,
5
+ VERIFICATION_ERROR_MESSAGE,
6
+ DEFAULT_WEBHOOK_SECRET
7
+ } from "./common.js";
27
8
  function toNormalizedJsonString(payload) {
28
9
  return JSON.stringify(payload).replace(/[^\\]\\u[\da-f]{4}/g, (s) => {
29
10
  return s.substr(0, 3) + s.substr(3).toUpperCase();
@@ -31,10 +12,10 @@ function toNormalizedJsonString(payload) {
31
12
  }
32
13
  const createSignature = ({
33
14
  payload,
34
- secret = import_common.DEFAULT_WEBHOOK_SECRET
15
+ secret = DEFAULT_WEBHOOK_SECRET
35
16
  }) => {
36
17
  const algorithm = "sha256";
37
- const hmac = (0, import_crypto.createHmac)(algorithm, secret);
18
+ const hmac = createHmac(algorithm, secret);
38
19
  payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
39
20
  const digest = Buffer.from(
40
21
  algorithm + "=" + hmac.update(payload).digest("hex"),
@@ -44,26 +25,26 @@ const createSignature = ({
44
25
  };
45
26
  const verifySignature = ({
46
27
  payload,
47
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
28
+ secret = DEFAULT_WEBHOOK_SECRET,
48
29
  signature
49
30
  }) => {
50
31
  try {
51
32
  const algorithm = signature.split("=")[0];
52
33
  const webhookSignature = Buffer.from(signature || "", "utf8");
53
- const hmac = (0, import_crypto.createHmac)(algorithm, secret);
34
+ const hmac = createHmac(algorithm, secret);
54
35
  payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
55
36
  const digest = Buffer.from(
56
37
  algorithm + "=" + hmac.update(payload).digest("hex"),
57
38
  "utf8"
58
39
  );
59
- const verified = webhookSignature.length === digest.length && (0, import_crypto.timingSafeEqual)(digest, webhookSignature);
40
+ const verified = webhookSignature.length === digest.length && timingSafeEqual(digest, webhookSignature);
60
41
  if (verified) {
61
42
  return verified;
62
43
  }
63
- throw new import_common.WebhookVerificationError();
44
+ throw new WebhookVerificationError();
64
45
  } catch (error) {
65
- throw new import_common.WebhookVerificationError(
66
- `${import_common.VERIFICATION_ERROR_MESSAGE}: ${error.message}`
46
+ throw new WebhookVerificationError(
47
+ `${VERIFICATION_ERROR_MESSAGE}: ${error.message}`
67
48
  );
68
49
  }
69
50
  };
@@ -79,7 +60,7 @@ const sha256Verifier = (_options) => {
79
60
  };
80
61
  };
81
62
  var sha256Verifier_default = sha256Verifier;
82
- // Annotate the CommonJS export names for ESM import in node:
83
- 0 && (module.exports = {
63
+ export {
64
+ sha256Verifier_default as default,
84
65
  verifySignature
85
- });
66
+ };
@@ -1,26 +1,4 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var skipVerifier_exports = {};
20
- __export(skipVerifier_exports, {
21
- default: () => skipVerifier_default
22
- });
23
- module.exports = __toCommonJS(skipVerifier_exports);
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
24
2
  const skipVerifier = (_options) => {
25
3
  return {
26
4
  sign: () => {
@@ -35,3 +13,6 @@ const skipVerifier = (_options) => {
35
13
  };
36
14
  };
37
15
  var skipVerifier_default = skipVerifier;
16
+ export {
17
+ skipVerifier_default as default
18
+ };
@@ -1,37 +1,19 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var timestampSchemeVerifier_exports = {};
20
- __export(timestampSchemeVerifier_exports, {
21
- default: () => timestampSchemeVerifier_default
22
- });
23
- module.exports = __toCommonJS(timestampSchemeVerifier_exports);
24
- var import_crypto = require("crypto");
25
- var import_common = require("./common.js");
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
2
+ import { createHmac } from "crypto";
3
+ import {
4
+ WebhookVerificationError,
5
+ DEFAULT_WEBHOOK_SECRET,
6
+ DEFAULT_TOLERANCE
7
+ } from "./common.js";
26
8
  const getHmac = ({ secret }) => {
27
9
  if (typeof secret === "undefined" || secret === "") {
28
- throw new import_common.WebhookVerificationError();
10
+ throw new WebhookVerificationError();
29
11
  }
30
- return (0, import_crypto.createHmac)("sha256", secret);
12
+ return createHmac("sha256", secret);
31
13
  };
32
14
  const createSignature = ({
33
15
  payload,
34
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
16
+ secret = DEFAULT_WEBHOOK_SECRET,
35
17
  timestamp = Date.now()
36
18
  }) => {
37
19
  const hmac = getHmac({ secret });
@@ -40,28 +22,28 @@ const createSignature = ({
40
22
  };
41
23
  const verifySignature = ({
42
24
  payload,
43
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
25
+ secret = DEFAULT_WEBHOOK_SECRET,
44
26
  signature,
45
27
  options
46
28
  }) => {
47
29
  const match = /t=(\d+),v1=([\da-f]+)/.exec(signature);
48
30
  if (!match) {
49
- throw new import_common.WebhookVerificationError();
31
+ throw new WebhookVerificationError();
50
32
  }
51
33
  const signedStamp = Number(match[1]);
52
34
  const signedPayload = match[2];
53
35
  const timestamp = options?.currentTimestampOverride ?? Date.now();
54
- const tolerance = options?.tolerance ?? import_common.DEFAULT_TOLERANCE;
36
+ const tolerance = options?.tolerance ?? DEFAULT_TOLERANCE;
55
37
  const difference = Math.abs(timestamp - signedStamp);
56
38
  if (difference > tolerance) {
57
- throw new import_common.WebhookVerificationError();
39
+ throw new WebhookVerificationError();
58
40
  }
59
41
  const hmac = getHmac({ secret });
60
42
  hmac.update(signedStamp + "." + payload);
61
43
  if (hmac.digest("hex") === signedPayload) {
62
44
  return true;
63
45
  }
64
- throw new import_common.WebhookVerificationError();
46
+ throw new WebhookVerificationError();
65
47
  };
66
48
  const timestampSchemeVerifier = (options) => {
67
49
  return {
@@ -79,3 +61,6 @@ const timestampSchemeVerifier = (options) => {
79
61
  };
80
62
  };
81
63
  var timestampSchemeVerifier_default = timestampSchemeVerifier;
64
+ export {
65
+ timestampSchemeVerifier_default as default
66
+ };
@@ -1,27 +1,8 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var BaseClient_exports = {};
20
- __export(BaseClient_exports, {
21
- default: () => BaseClient
22
- });
23
- module.exports = __toCommonJS(BaseClient_exports);
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
24
2
  class BaseClient {
25
3
  constructor() {
26
4
  }
27
5
  }
6
+ export {
7
+ BaseClient as default
8
+ };
@@ -1,38 +1,6 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var InMemoryClient_exports = {};
30
- __export(InMemoryClient_exports, {
31
- default: () => InMemoryClient
32
- });
33
- module.exports = __toCommonJS(InMemoryClient_exports);
34
- var import_BaseClient = __toESM(require("./BaseClient.js"));
35
- class InMemoryClient extends import_BaseClient.default {
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
2
+ import BaseClient from "./BaseClient.js";
3
+ class InMemoryClient extends BaseClient {
36
4
  storage;
37
5
  // initialize with pre-cached data if needed
38
6
  constructor(data = {}) {
@@ -98,3 +66,6 @@ class InMemoryClient extends import_BaseClient.default {
98
66
  return !!this.cacheKeyForValue(value);
99
67
  }
100
68
  }
69
+ export {
70
+ InMemoryClient as default
71
+ };
@@ -1,38 +1,6 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var MemcachedClient_exports = {};
30
- __export(MemcachedClient_exports, {
31
- default: () => MemcachedClient
32
- });
33
- module.exports = __toCommonJS(MemcachedClient_exports);
34
- var import_BaseClient = __toESM(require("./BaseClient.js"));
35
- class MemcachedClient extends import_BaseClient.default {
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
2
+ import BaseClient from "./BaseClient.js";
3
+ class MemcachedClient extends BaseClient {
36
4
  client;
37
5
  servers;
38
6
  options;
@@ -73,3 +41,6 @@ class MemcachedClient extends import_BaseClient.default {
73
41
  return this.client?.delete(key);
74
42
  }
75
43
  }
44
+ export {
45
+ MemcachedClient as default
46
+ };
@@ -1,38 +1,6 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var RedisClient_exports = {};
30
- __export(RedisClient_exports, {
31
- default: () => RedisClient
32
- });
33
- module.exports = __toCommonJS(RedisClient_exports);
34
- var import_BaseClient = __toESM(require("./BaseClient.js"));
35
- class RedisClient extends import_BaseClient.default {
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
2
+ import BaseClient from "./BaseClient.js";
3
+ class RedisClient extends BaseClient {
36
4
  client;
37
5
  logger;
38
6
  redisOptions;
@@ -77,3 +45,6 @@ class RedisClient extends import_BaseClient.default {
77
45
  return !!await this.client?.del([key]);
78
46
  }
79
47
  }
48
+ export {
49
+ RedisClient as default
50
+ };
@@ -1,33 +1,10 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var errors_exports = {};
20
- __export(errors_exports, {
21
- CacheTimeoutError: () => CacheTimeoutError
22
- });
23
- module.exports = __toCommonJS(errors_exports);
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
24
2
  class CacheTimeoutError extends Error {
25
3
  constructor() {
26
4
  super("Timed out waiting for response from the cache server");
27
5
  this.name = "CacheTimeoutError";
28
6
  }
29
7
  }
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
8
+ export {
32
9
  CacheTimeoutError
33
- });
10
+ };
@@ -1,45 +1,8 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var cache_exports = {};
30
- __export(cache_exports, {
31
- InMemoryClient: () => import_InMemoryClient.default,
32
- MemcachedClient: () => import_MemcachedClient.default,
33
- RedisClient: () => import_RedisClient.default,
34
- cacheKeySeparator: () => cacheKeySeparator,
35
- createCache: () => createCache,
36
- formatCacheKey: () => formatCacheKey
37
- });
38
- module.exports = __toCommonJS(cache_exports);
39
- var import_errors = require("./errors.js");
40
- var import_MemcachedClient = __toESM(require("./clients/MemcachedClient.js"));
41
- var import_RedisClient = __toESM(require("./clients/RedisClient.js"));
42
- var import_InMemoryClient = __toESM(require("./clients/InMemoryClient.js"));
1
+ import bannerPath from "node:path"; import bannerUrl from "node:url"; const __filename = bannerUrl.fileURLToPath(import.meta.url); const __dirname = bannerPath.dirname(__filename);
2
+ import { CacheTimeoutError } from "./errors.js";
3
+ import { default as default2 } from "./clients/MemcachedClient.js";
4
+ import { default as default3 } from "./clients/RedisClient.js";
5
+ import { default as default4 } from "./clients/InMemoryClient.js";
43
6
  const DEFAULT_LATEST_FIELDS = { id: "id", updatedAt: "updatedAt" };
44
7
  const wait = (ms) => {
45
8
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -72,7 +35,7 @@ const createCache = (cacheClient, options) => {
72
35
  const result = await Promise.race([
73
36
  client.get(cacheKey),
74
37
  wait(timeout).then(() => {
75
- throw new import_errors.CacheTimeoutError();
38
+ throw new CacheTimeoutError();
76
39
  })
77
40
  ]);
78
41
  if (result) {
@@ -81,7 +44,7 @@ const createCache = (cacheClient, options) => {
81
44
  }
82
45
  } catch (e) {
83
46
  logger?.error(`[Cache] Error GET '${cacheKey}': ${e.message}`);
84
- if (e instanceof import_errors.CacheTimeoutError && client.disconnect) {
47
+ if (e instanceof CacheTimeoutError && client.disconnect) {
85
48
  logger?.error(`[Cache] Disconnecting current instance...`);
86
49
  await client.disconnect();
87
50
  }
@@ -93,7 +56,7 @@ const createCache = (cacheClient, options) => {
93
56
  await Promise.race([
94
57
  client.set(cacheKey, data, options2 || {}),
95
58
  wait(timeout).then(() => {
96
- throw new import_errors.CacheTimeoutError();
59
+ throw new CacheTimeoutError();
97
60
  })
98
61
  ]);
99
62
  logger?.debug(
@@ -143,7 +106,7 @@ const createCache = (cacheClient, options) => {
143
106
  await Promise.race([
144
107
  result = client.del(cacheKey),
145
108
  wait(timeout).then(() => {
146
- throw new import_errors.CacheTimeoutError();
109
+ throw new CacheTimeoutError();
147
110
  })
148
111
  ]);
149
112
  logger?.debug(`[Cache] DEL '${cacheKey}'`);
@@ -160,12 +123,11 @@ const createCache = (cacheClient, options) => {
160
123
  deleteCacheKey
161
124
  };
162
125
  };
163
- // Annotate the CommonJS export names for ESM import in node:
164
- 0 && (module.exports = {
165
- InMemoryClient,
166
- MemcachedClient,
167
- RedisClient,
126
+ export {
127
+ default4 as InMemoryClient,
128
+ default2 as MemcachedClient,
129
+ default3 as RedisClient,
168
130
  cacheKeySeparator,
169
131
  createCache,
170
132
  formatCacheKey
171
- });
133
+ };