@cedarjs/api 5.0.6 → 5.0.7-next.186

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 (115) hide show
  1. package/dist/auth/index.d.ts +9 -0
  2. package/dist/auth/index.d.ts.map +1 -1
  3. package/dist/auth/index.js +7 -0
  4. package/dist/bins/cedar.js +14 -0
  5. package/dist/bins/cfw.js +14 -0
  6. package/dist/bins/redwood.js +14 -0
  7. package/dist/bins/tsc.js +8 -0
  8. package/dist/index.js +3 -3
  9. package/dist/runtime.d.ts +0 -26
  10. package/dist/runtime.d.ts.map +1 -1
  11. package/dist/runtime.js +1 -22
  12. package/package.json +17 -41
  13. package/dist/cjs/auth/index.d.ts +0 -64
  14. package/dist/cjs/auth/index.d.ts.map +0 -1
  15. package/dist/cjs/auth/index.js +0 -143
  16. package/dist/cjs/auth/parseJWT.d.ts +0 -6
  17. package/dist/cjs/auth/parseJWT.d.ts.map +0 -1
  18. package/dist/cjs/auth/parseJWT.js +0 -57
  19. package/dist/cjs/auth/verifiers/base64Sha1Verifier.d.ts +0 -18
  20. package/dist/cjs/auth/verifiers/base64Sha1Verifier.d.ts.map +0 -1
  21. package/dist/cjs/auth/verifiers/base64Sha1Verifier.js +0 -77
  22. package/dist/cjs/auth/verifiers/base64Sha256Verifier.d.ts +0 -18
  23. package/dist/cjs/auth/verifiers/base64Sha256Verifier.d.ts.map +0 -1
  24. package/dist/cjs/auth/verifiers/base64Sha256Verifier.js +0 -77
  25. package/dist/cjs/auth/verifiers/common.d.ts +0 -112
  26. package/dist/cjs/auth/verifiers/common.d.ts.map +0 -1
  27. package/dist/cjs/auth/verifiers/common.js +0 -89
  28. package/dist/cjs/auth/verifiers/index.d.ts +0 -8
  29. package/dist/cjs/auth/verifiers/index.d.ts.map +0 -1
  30. package/dist/cjs/auth/verifiers/index.js +0 -39
  31. package/dist/cjs/auth/verifiers/jwtVerifier.d.ts +0 -18
  32. package/dist/cjs/auth/verifiers/jwtVerifier.d.ts.map +0 -1
  33. package/dist/cjs/auth/verifiers/jwtVerifier.js +0 -84
  34. package/dist/cjs/auth/verifiers/secretKeyVerifier.d.ts +0 -11
  35. package/dist/cjs/auth/verifiers/secretKeyVerifier.d.ts.map +0 -1
  36. package/dist/cjs/auth/verifiers/secretKeyVerifier.js +0 -43
  37. package/dist/cjs/auth/verifiers/sha1Verifier.d.ts +0 -17
  38. package/dist/cjs/auth/verifiers/sha1Verifier.d.ts.map +0 -1
  39. package/dist/cjs/auth/verifiers/sha1Verifier.js +0 -85
  40. package/dist/cjs/auth/verifiers/sha256Verifier.d.ts +0 -17
  41. package/dist/cjs/auth/verifiers/sha256Verifier.d.ts.map +0 -1
  42. package/dist/cjs/auth/verifiers/sha256Verifier.js +0 -85
  43. package/dist/cjs/auth/verifiers/skipVerifier.d.ts +0 -11
  44. package/dist/cjs/auth/verifiers/skipVerifier.d.ts.map +0 -1
  45. package/dist/cjs/auth/verifiers/skipVerifier.js +0 -40
  46. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.d.ts +0 -14
  47. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.d.ts.map +0 -1
  48. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.js +0 -86
  49. package/dist/cjs/bins/cedar.d.ts +0 -9
  50. package/dist/cjs/bins/cedar.d.ts.map +0 -1
  51. package/dist/cjs/bins/cedar.js +0 -36
  52. package/dist/cjs/bins/cfw.d.ts +0 -3
  53. package/dist/cjs/bins/cfw.d.ts.map +0 -1
  54. package/dist/cjs/bins/cfw.js +0 -36
  55. package/dist/cjs/bins/redwood.d.ts +0 -9
  56. package/dist/cjs/bins/redwood.d.ts.map +0 -1
  57. package/dist/cjs/bins/redwood.js +0 -36
  58. package/dist/cjs/bins/tsc.d.ts +0 -3
  59. package/dist/cjs/bins/tsc.d.ts.map +0 -1
  60. package/dist/cjs/bins/tsc.js +0 -30
  61. package/dist/cjs/cache/clients/BaseClient.d.ts +0 -11
  62. package/dist/cjs/cache/clients/BaseClient.d.ts.map +0 -1
  63. package/dist/cjs/cache/clients/BaseClient.js +0 -31
  64. package/dist/cjs/cache/clients/InMemoryClient.d.ts +0 -31
  65. package/dist/cjs/cache/clients/InMemoryClient.d.ts.map +0 -1
  66. package/dist/cjs/cache/clients/InMemoryClient.js +0 -94
  67. package/dist/cjs/cache/clients/MemcachedClient.d.ts +0 -16
  68. package/dist/cjs/cache/clients/MemcachedClient.d.ts.map +0 -1
  69. package/dist/cjs/cache/clients/MemcachedClient.js +0 -79
  70. package/dist/cjs/cache/clients/RedisClient.d.ts +0 -20
  71. package/dist/cjs/cache/clients/RedisClient.d.ts.map +0 -1
  72. package/dist/cjs/cache/clients/RedisClient.js +0 -83
  73. package/dist/cjs/cache/errors.d.ts +0 -4
  74. package/dist/cjs/cache/errors.d.ts.map +0 -1
  75. package/dist/cjs/cache/errors.js +0 -33
  76. package/dist/cjs/cache/index.d.ts +0 -35
  77. package/dist/cjs/cache/index.d.ts.map +0 -1
  78. package/dist/cjs/cache/index.js +0 -165
  79. package/dist/cjs/cors.d.ts +0 -16
  80. package/dist/cjs/cors.d.ts.map +0 -1
  81. package/dist/cjs/cors.js +0 -93
  82. package/dist/cjs/errors.d.ts +0 -5
  83. package/dist/cjs/errors.d.ts.map +0 -1
  84. package/dist/cjs/errors.js +0 -38
  85. package/dist/cjs/event.d.ts +0 -3
  86. package/dist/cjs/event.d.ts.map +0 -1
  87. package/dist/cjs/event.js +0 -34
  88. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts +0 -4
  89. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts.map +0 -1
  90. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.js +0 -72
  91. package/dist/cjs/index.d.ts +0 -15
  92. package/dist/cjs/index.d.ts.map +0 -1
  93. package/dist/cjs/index.js +0 -54
  94. package/dist/cjs/logger/index.d.ts +0 -179
  95. package/dist/cjs/logger/index.d.ts.map +0 -1
  96. package/dist/cjs/logger/index.js +0 -185
  97. package/dist/cjs/package.json +0 -1
  98. package/dist/cjs/runtime.d.ts +0 -68
  99. package/dist/cjs/runtime.d.ts.map +0 -1
  100. package/dist/cjs/runtime.js +0 -200
  101. package/dist/cjs/transforms.d.ts +0 -36
  102. package/dist/cjs/transforms.d.ts.map +0 -1
  103. package/dist/cjs/transforms.js +0 -176
  104. package/dist/cjs/types.d.ts +0 -25
  105. package/dist/cjs/types.d.ts.map +0 -1
  106. package/dist/cjs/types.js +0 -16
  107. package/dist/cjs/validations/errors.d.ts +0 -101
  108. package/dist/cjs/validations/errors.d.ts.map +0 -1
  109. package/dist/cjs/validations/errors.js +0 -298
  110. package/dist/cjs/validations/validations.d.ts +0 -235
  111. package/dist/cjs/validations/validations.d.ts.map +0 -1
  112. package/dist/cjs/validations/validations.js +0 -353
  113. package/dist/cjs/webhooks/index.d.ts +0 -77
  114. package/dist/cjs/webhooks/index.d.ts.map +0 -1
  115. package/dist/cjs/webhooks/index.js +0 -102
@@ -1,85 +0,0 @@
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
- sha1Verifier: () => sha1Verifier,
22
- verifySignature: () => verifySignature
23
- });
24
- module.exports = __toCommonJS(sha1Verifier_exports);
25
- var import_crypto = require("crypto");
26
- var import_common = require("./common.js");
27
- function toNormalizedJsonString(payload) {
28
- return JSON.stringify(payload).replace(/[^\\]\\u[\da-f]{4}/g, (s) => {
29
- return s.substr(0, 3) + s.substr(3).toUpperCase();
30
- });
31
- }
32
- const createSignature = ({
33
- payload,
34
- secret = import_common.DEFAULT_WEBHOOK_SECRET
35
- }) => {
36
- const algorithm = "sha1";
37
- const hmac = (0, import_crypto.createHmac)(algorithm, secret);
38
- payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
39
- const digest = Buffer.from(
40
- algorithm + "=" + hmac.update(payload).digest("hex"),
41
- "utf8"
42
- );
43
- return digest.toString();
44
- };
45
- const verifySignature = ({
46
- payload,
47
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
48
- signature
49
- }) => {
50
- try {
51
- const algorithm = signature.split("=")[0];
52
- const webhookSignature = Buffer.from(signature || "", "utf8");
53
- const hmac = (0, import_crypto.createHmac)(algorithm, secret);
54
- payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
55
- const digest = Buffer.from(
56
- algorithm + "=" + hmac.update(payload).digest("hex"),
57
- "utf8"
58
- );
59
- const verified = webhookSignature.length === digest.length && (0, import_crypto.timingSafeEqual)(digest, webhookSignature);
60
- if (verified) {
61
- return verified;
62
- }
63
- throw new import_common.WebhookVerificationError();
64
- } catch (error) {
65
- throw new import_common.WebhookVerificationError(
66
- `${import_common.VERIFICATION_ERROR_MESSAGE}: ${error.message}`
67
- );
68
- }
69
- };
70
- function sha1Verifier(_options) {
71
- return {
72
- sign: ({ payload, secret }) => {
73
- return createSignature({ payload, secret });
74
- },
75
- verify: ({ payload, secret, signature }) => {
76
- return verifySignature({ payload, secret, signature });
77
- },
78
- type: "sha1Verifier"
79
- };
80
- }
81
- // Annotate the CommonJS export names for ESM import in node:
82
- 0 && (module.exports = {
83
- sha1Verifier,
84
- verifySignature
85
- });
@@ -1,17 +0,0 @@
1
- import type { WebhookVerifier, VerifyOptions } from './common.js';
2
- export interface Sha256Verifier extends WebhookVerifier {
3
- type: 'sha256Verifier';
4
- }
5
- export declare const verifySignature: ({ payload, secret, signature, }: {
6
- payload: string | Record<string, unknown>;
7
- secret: string;
8
- signature: string;
9
- }) => boolean;
10
- /**
11
- * SHA256 HMAC Payload Verifier
12
- *
13
- * Based on GitHub's webhook payload verification
14
- * @see https://docs.github.com/en/developers/webhooks-and-events/securing-your-webhooks
15
- */
16
- export declare function sha256Verifier(_options?: VerifyOptions): Sha256Verifier;
17
- //# sourceMappingURL=sha256Verifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sha256Verifier.d.ts","sourceRoot":"","sources":["../../../../src/auth/verifiers/sha256Verifier.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEjE,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,IAAI,EAAE,gBAAgB,CAAA;CACvB;AA6BD,eAAO,MAAM,eAAe,GAAI,iCAI7B;IACD,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,KAAG,OA+BH,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,cAAc,CAUvE"}
@@ -1,85 +0,0 @@
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
- sha256Verifier: () => sha256Verifier,
22
- verifySignature: () => verifySignature
23
- });
24
- module.exports = __toCommonJS(sha256Verifier_exports);
25
- var import_crypto = require("crypto");
26
- var import_common = require("./common.js");
27
- function toNormalizedJsonString(payload) {
28
- return JSON.stringify(payload).replace(/[^\\]\\u[\da-f]{4}/g, (s) => {
29
- return s.substr(0, 3) + s.substr(3).toUpperCase();
30
- });
31
- }
32
- const createSignature = ({
33
- payload,
34
- secret = import_common.DEFAULT_WEBHOOK_SECRET
35
- }) => {
36
- const algorithm = "sha256";
37
- const hmac = (0, import_crypto.createHmac)(algorithm, secret);
38
- payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
39
- const digest = Buffer.from(
40
- algorithm + "=" + hmac.update(payload).digest("hex"),
41
- "utf8"
42
- );
43
- return digest.toString();
44
- };
45
- const verifySignature = ({
46
- payload,
47
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
48
- signature
49
- }) => {
50
- try {
51
- const algorithm = signature.split("=")[0];
52
- const webhookSignature = Buffer.from(signature || "", "utf8");
53
- const hmac = (0, import_crypto.createHmac)(algorithm, secret);
54
- payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
55
- const digest = Buffer.from(
56
- algorithm + "=" + hmac.update(payload).digest("hex"),
57
- "utf8"
58
- );
59
- const verified = webhookSignature.length === digest.length && (0, import_crypto.timingSafeEqual)(digest, webhookSignature);
60
- if (verified) {
61
- return verified;
62
- }
63
- throw new import_common.WebhookVerificationError();
64
- } catch (error) {
65
- throw new import_common.WebhookVerificationError(
66
- `${import_common.VERIFICATION_ERROR_MESSAGE}: ${error.message}`
67
- );
68
- }
69
- };
70
- function sha256Verifier(_options) {
71
- return {
72
- sign: ({ payload, secret }) => {
73
- return createSignature({ payload, secret });
74
- },
75
- verify: ({ payload, secret, signature }) => {
76
- return verifySignature({ payload, secret, signature });
77
- },
78
- type: "sha256Verifier"
79
- };
80
- }
81
- // Annotate the CommonJS export names for ESM import in node:
82
- 0 && (module.exports = {
83
- sha256Verifier,
84
- verifySignature
85
- });
@@ -1,11 +0,0 @@
1
- import type { VerifyOptions, WebhookVerifier } from './common.js';
2
- export interface SkipVerifier extends WebhookVerifier {
3
- type: 'skipVerifier';
4
- }
5
- /**
6
- * skipVerifier skips webhook signature verification.
7
- * Use when there is no signature provided or the webhook is
8
- * entirely public.
9
- */
10
- export declare function skipVerifier(_options?: VerifyOptions): SkipVerifier;
11
- //# sourceMappingURL=skipVerifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"skipVerifier.d.ts","sourceRoot":"","sources":["../../../../src/auth/verifiers/skipVerifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEjE,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,IAAI,EAAE,cAAc,CAAA;CACrB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,YAAY,CAYnE"}
@@ -1,40 +0,0 @@
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
- skipVerifier: () => skipVerifier
22
- });
23
- module.exports = __toCommonJS(skipVerifier_exports);
24
- function skipVerifier(_options) {
25
- return {
26
- sign: () => {
27
- console.warn(`No signature is created for the skipVerifier verifier`);
28
- return "";
29
- },
30
- verify: () => {
31
- console.warn(`The skipVerifier verifier considers all signatures valid`);
32
- return true;
33
- },
34
- type: "skipVerifier"
35
- };
36
- }
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- skipVerifier
40
- });
@@ -1,14 +0,0 @@
1
- import type { WebhookVerifier, VerifyOptions } from './common.js';
2
- export interface TimestampSchemeVerifier extends WebhookVerifier {
3
- type: 'timestampSchemeVerifier';
4
- }
5
- /**
6
- * Timestamp & Scheme Verifier
7
- *
8
- * Based on Stripe's secure webhook implementation
9
- *
10
- * @see https://stripe.com/docs/webhooks/signatures
11
- */
12
- export declare function timestampSchemeVerifier(options?: VerifyOptions): TimestampSchemeVerifier;
13
- export default timestampSchemeVerifier;
14
- //# sourceMappingURL=timestampSchemeVerifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timestampSchemeVerifier.d.ts","sourceRoot":"","sources":["../../../../src/auth/verifiers/timestampSchemeVerifier.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEjE,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,IAAI,EAAE,yBAAyB,CAAA;CAChC;AAwHD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,CAAC,EAAE,aAAa,GACtB,uBAAuB,CAczB;AAED,eAAe,uBAAuB,CAAA"}
@@ -1,86 +0,0 @@
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
- timestampSchemeVerifier: () => timestampSchemeVerifier
23
- });
24
- module.exports = __toCommonJS(timestampSchemeVerifier_exports);
25
- var import_crypto = require("crypto");
26
- var import_common = require("./common.js");
27
- const getHmac = ({ secret }) => {
28
- if (typeof secret === "undefined" || secret === "") {
29
- throw new import_common.WebhookVerificationError();
30
- }
31
- return (0, import_crypto.createHmac)("sha256", secret);
32
- };
33
- const createSignature = ({
34
- payload,
35
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
36
- timestamp = Date.now()
37
- }) => {
38
- const hmac = getHmac({ secret });
39
- hmac.update(timestamp + "." + payload);
40
- return `t=${timestamp},v1=${hmac.digest("hex")}`;
41
- };
42
- const verifySignature = ({
43
- payload,
44
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
45
- signature,
46
- options
47
- }) => {
48
- const match = /t=(\d+),v1=([\da-f]+)/.exec(signature);
49
- if (!match) {
50
- throw new import_common.WebhookVerificationError();
51
- }
52
- const signedStamp = Number(match[1]);
53
- const signedPayload = match[2];
54
- const timestamp = options?.currentTimestampOverride ?? Date.now();
55
- const tolerance = options?.tolerance ?? import_common.DEFAULT_TOLERANCE;
56
- const difference = Math.abs(timestamp - signedStamp);
57
- if (difference > tolerance) {
58
- throw new import_common.WebhookVerificationError();
59
- }
60
- const hmac = getHmac({ secret });
61
- hmac.update(signedStamp + "." + payload);
62
- if (hmac.digest("hex") === signedPayload) {
63
- return true;
64
- }
65
- throw new import_common.WebhookVerificationError();
66
- };
67
- function timestampSchemeVerifier(options) {
68
- return {
69
- sign: ({ payload, secret }) => {
70
- return createSignature({
71
- payload,
72
- secret,
73
- timestamp: options?.currentTimestampOverride
74
- });
75
- },
76
- verify: ({ payload, secret, signature }) => {
77
- return verifySignature({ payload, secret, signature, options });
78
- },
79
- type: "timestampSchemeVerifier"
80
- };
81
- }
82
- var timestampSchemeVerifier_default = timestampSchemeVerifier;
83
- // Annotate the CommonJS export names for ESM import in node:
84
- 0 && (module.exports = {
85
- timestampSchemeVerifier
86
- });
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * This file lets users run the Cedar CLI commands inside the /api directory
4
- * in their projects.
5
- * This works because of the "bin" field in the @cedarjs/api package.json file
6
- * that points to this file.
7
- */
8
- export {};
9
- //# sourceMappingURL=cedar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cedar.d.ts","sourceRoot":"","sources":["../../../src/bins/cedar.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
- var import_node_module = require("node:module");
26
- var import_node_url = require("node:url");
27
- const cliPackageJsonFileUrl = (0, import_node_url.pathToFileURL)(
28
- require.resolve("@cedarjs/cli/package.json")
29
- );
30
- const requireFromCli = (0, import_node_module.createRequire)(cliPackageJsonFileUrl);
31
- const bins = requireFromCli("./package.json")["bin"];
32
- const cliEntryPointUrl = new URL(bins["cedar"], cliPackageJsonFileUrl);
33
- if (process.env.PROJECT_CWD) {
34
- process.chdir(process.env.PROJECT_CWD);
35
- }
36
- import(cliEntryPointUrl.toString());
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=cfw.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cfw.d.ts","sourceRoot":"","sources":["../../../src/bins/cfw.ts"],"names":[],"mappings":""}
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
- var import_node_module = require("node:module");
26
- var import_node_url = require("node:url");
27
- const cliPackageJsonFileUrl = (0, import_node_url.pathToFileURL)(
28
- require.resolve("@cedarjs/cli/package.json")
29
- );
30
- const requireFromCli = (0, import_node_module.createRequire)(cliPackageJsonFileUrl);
31
- const bins = requireFromCli("./package.json")["bin"];
32
- const cliEntryPointUrl = new URL(bins["cfw"], cliPackageJsonFileUrl);
33
- if (process.env.PROJECT_CWD) {
34
- process.chdir(process.env.PROJECT_CWD);
35
- }
36
- import(cliEntryPointUrl.toString());
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * This file lets users run the Cedar CLI commands inside the /api directory
4
- * in their projects.
5
- * This works because of the "bin" field in the @cedarjs/api package.json file
6
- * that points to this file.
7
- */
8
- export {};
9
- //# sourceMappingURL=redwood.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redwood.d.ts","sourceRoot":"","sources":["../../../src/bins/redwood.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
- var import_node_module = require("node:module");
26
- var import_node_url = require("node:url");
27
- const cliPackageJsonFileUrl = (0, import_node_url.pathToFileURL)(
28
- require.resolve("@cedarjs/cli/package.json")
29
- );
30
- const requireFromCli = (0, import_node_module.createRequire)(cliPackageJsonFileUrl);
31
- const bins = requireFromCli("./package.json")["bin"];
32
- const cliEntryPointUrl = new URL(bins["redwood"], cliPackageJsonFileUrl);
33
- if (process.env.PROJECT_CWD) {
34
- process.chdir(process.env.PROJECT_CWD);
35
- }
36
- import(cliEntryPointUrl.toString());
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=tsc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tsc.d.ts","sourceRoot":"","sources":["../../../src/bins/tsc.ts"],"names":[],"mappings":""}
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
- var import_node_module = require("node:module");
26
- const requireFromTypeScript = (0, import_node_module.createRequire)(
27
- require.resolve("typescript/package.json")
28
- );
29
- const bins = requireFromTypeScript("./package.json")["bin"];
30
- requireFromTypeScript(bins["tsc"]);
@@ -1,11 +0,0 @@
1
- export declare abstract class BaseClient {
2
- constructor();
3
- disconnect?(): void | Promise<void>;
4
- abstract connect(): void | Promise<void>;
5
- abstract get(key: string): any;
6
- abstract set(key: string, value: unknown, options: {
7
- expires?: number;
8
- }): Promise<any> | any;
9
- abstract del(key: string): Promise<boolean> | any;
10
- }
11
- //# sourceMappingURL=BaseClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../../../../src/cache/clients/BaseClient.ts"],"names":[],"mappings":"AAAA,8BAAsB,UAAU;;IAK9B,UAAU,CAAC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAEnC,QAAQ,CAAC,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAGxC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG;IAG9B,QAAQ,CAAC,GAAG,CACV,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5B,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG;IAGrB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG;CAClD"}
@@ -1,31 +0,0 @@
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
- BaseClient: () => BaseClient
22
- });
23
- module.exports = __toCommonJS(BaseClient_exports);
24
- class BaseClient {
25
- constructor() {
26
- }
27
- }
28
- // Annotate the CommonJS export names for ESM import in node:
29
- 0 && (module.exports = {
30
- BaseClient
31
- });
@@ -1,31 +0,0 @@
1
- import { BaseClient } from './BaseClient.js';
2
- type CacheOptions = {
3
- expires?: number;
4
- };
5
- export declare class InMemoryClient extends BaseClient {
6
- storage: Record<string, {
7
- expires: number;
8
- value: string;
9
- }>;
10
- constructor(data?: {});
11
- /**
12
- * Special function for testing, only available in InMemoryClient
13
- *
14
- * Returns deserialized content of cache as an array of values (without cache keys)
15
- *
16
- */
17
- get contents(): any[];
18
- disconnect(): Promise<void>;
19
- connect(): Promise<void>;
20
- get(key: string): Promise<any>;
21
- set(key: string, value: unknown, options?: CacheOptions): Promise<boolean>;
22
- del(key: string): Promise<boolean>;
23
- /**
24
- * Special functions for testing, only available in InMemoryClient
25
- */
26
- clear(): Promise<void>;
27
- cacheKeyForValue(value: any): string | null;
28
- isCached(value: any): boolean;
29
- }
30
- export {};
31
- //# sourceMappingURL=InMemoryClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InMemoryClient.d.ts","sourceRoot":"","sources":["../../../../src/cache/clients/InMemoryClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,KAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,qBAAa,cAAe,SAAQ,UAAU;IAC5C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;gBAG/C,IAAI,KAAK;IAKrB;;;;;OAKG;IACH,IAAI,QAAQ,UAIX;IAGK,UAAU;IACV,OAAO;IAEP,GAAG,CAAC,GAAG,EAAE,MAAM;IAWf,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAE,YAAiB;IAU3D,GAAG,CAAC,GAAG,EAAE,MAAM;IASrB;;OAEG;IACG,KAAK;IAIX,gBAAgB,CAAC,KAAK,EAAE,GAAG;IAU3B,QAAQ,CAAC,KAAK,EAAE,GAAG;CAGpB"}