@cedarjs/api 0.0.4

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 (194) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -0
  3. package/dist/auth/index.d.ts +51 -0
  4. package/dist/auth/index.d.ts.map +1 -0
  5. package/dist/auth/index.js +89 -0
  6. package/dist/auth/parseJWT.d.ts +6 -0
  7. package/dist/auth/parseJWT.d.ts.map +1 -0
  8. package/dist/auth/parseJWT.js +33 -0
  9. package/dist/auth/verifiers/base64Sha1Verifier.d.ts +19 -0
  10. package/dist/auth/verifiers/base64Sha1Verifier.d.ts.map +1 -0
  11. package/dist/auth/verifiers/base64Sha1Verifier.js +57 -0
  12. package/dist/auth/verifiers/base64Sha256Verifier.d.ts +19 -0
  13. package/dist/auth/verifiers/base64Sha256Verifier.d.ts.map +1 -0
  14. package/dist/auth/verifiers/base64Sha256Verifier.js +57 -0
  15. package/dist/auth/verifiers/common.d.ts +104 -0
  16. package/dist/auth/verifiers/common.d.ts.map +1 -0
  17. package/dist/auth/verifiers/common.js +59 -0
  18. package/dist/auth/verifiers/index.d.ts +8 -0
  19. package/dist/auth/verifiers/index.d.ts.map +1 -0
  20. package/dist/auth/verifiers/index.js +12 -0
  21. package/dist/auth/verifiers/jwtVerifier.d.ts +26 -0
  22. package/dist/auth/verifiers/jwtVerifier.d.ts.map +1 -0
  23. package/dist/auth/verifiers/jwtVerifier.js +55 -0
  24. package/dist/auth/verifiers/secretKeyVerifier.d.ts +14 -0
  25. package/dist/auth/verifiers/secretKeyVerifier.d.ts.map +1 -0
  26. package/dist/auth/verifiers/secretKeyVerifier.js +20 -0
  27. package/dist/auth/verifiers/sha1Verifier.d.ts +25 -0
  28. package/dist/auth/verifiers/sha1Verifier.d.ts.map +1 -0
  29. package/dist/auth/verifiers/sha1Verifier.js +65 -0
  30. package/dist/auth/verifiers/sha256Verifier.d.ts +25 -0
  31. package/dist/auth/verifiers/sha256Verifier.d.ts.map +1 -0
  32. package/dist/auth/verifiers/sha256Verifier.js +65 -0
  33. package/dist/auth/verifiers/skipVerifier.d.ts +13 -0
  34. package/dist/auth/verifiers/skipVerifier.d.ts.map +1 -0
  35. package/dist/auth/verifiers/skipVerifier.js +17 -0
  36. package/dist/auth/verifiers/timestampSchemeVerifier.d.ts +16 -0
  37. package/dist/auth/verifiers/timestampSchemeVerifier.d.ts.map +1 -0
  38. package/dist/auth/verifiers/timestampSchemeVerifier.js +65 -0
  39. package/dist/bins/redwood.d.ts +9 -0
  40. package/dist/bins/redwood.d.ts.map +1 -0
  41. package/dist/bins/rwfw.d.ts +3 -0
  42. package/dist/bins/rwfw.d.ts.map +1 -0
  43. package/dist/bins/tsc.d.ts +3 -0
  44. package/dist/bins/tsc.d.ts.map +1 -0
  45. package/dist/cache/clients/BaseClient.d.ts +11 -0
  46. package/dist/cache/clients/BaseClient.d.ts.map +1 -0
  47. package/dist/cache/clients/BaseClient.js +7 -0
  48. package/dist/cache/clients/InMemoryClient.d.ts +31 -0
  49. package/dist/cache/clients/InMemoryClient.d.ts.map +1 -0
  50. package/dist/cache/clients/InMemoryClient.js +70 -0
  51. package/dist/cache/clients/MemcachedClient.d.ts +16 -0
  52. package/dist/cache/clients/MemcachedClient.d.ts.map +1 -0
  53. package/dist/cache/clients/MemcachedClient.js +45 -0
  54. package/dist/cache/clients/RedisClient.d.ts +20 -0
  55. package/dist/cache/clients/RedisClient.d.ts.map +1 -0
  56. package/dist/cache/clients/RedisClient.js +49 -0
  57. package/dist/cache/errors.d.ts +4 -0
  58. package/dist/cache/errors.d.ts.map +1 -0
  59. package/dist/cache/errors.js +9 -0
  60. package/dist/cache/index.d.ts +35 -0
  61. package/dist/cache/index.d.ts.map +1 -0
  62. package/dist/cache/index.js +132 -0
  63. package/dist/cjs/auth/index.d.ts +51 -0
  64. package/dist/cjs/auth/index.d.ts.map +1 -0
  65. package/dist/cjs/auth/index.js +129 -0
  66. package/dist/cjs/auth/parseJWT.d.ts +6 -0
  67. package/dist/cjs/auth/parseJWT.d.ts.map +1 -0
  68. package/dist/cjs/auth/parseJWT.js +57 -0
  69. package/dist/cjs/auth/verifiers/base64Sha1Verifier.d.ts +19 -0
  70. package/dist/cjs/auth/verifiers/base64Sha1Verifier.d.ts.map +1 -0
  71. package/dist/cjs/auth/verifiers/base64Sha1Verifier.js +77 -0
  72. package/dist/cjs/auth/verifiers/base64Sha256Verifier.d.ts +19 -0
  73. package/dist/cjs/auth/verifiers/base64Sha256Verifier.d.ts.map +1 -0
  74. package/dist/cjs/auth/verifiers/base64Sha256Verifier.js +77 -0
  75. package/dist/cjs/auth/verifiers/common.d.ts +104 -0
  76. package/dist/cjs/auth/verifiers/common.d.ts.map +1 -0
  77. package/dist/cjs/auth/verifiers/common.js +99 -0
  78. package/dist/cjs/auth/verifiers/index.d.ts +8 -0
  79. package/dist/cjs/auth/verifiers/index.d.ts.map +1 -0
  80. package/dist/cjs/auth/verifiers/index.js +38 -0
  81. package/dist/cjs/auth/verifiers/jwtVerifier.d.ts +26 -0
  82. package/dist/cjs/auth/verifiers/jwtVerifier.d.ts.map +1 -0
  83. package/dist/cjs/auth/verifiers/jwtVerifier.js +86 -0
  84. package/dist/cjs/auth/verifiers/secretKeyVerifier.d.ts +14 -0
  85. package/dist/cjs/auth/verifiers/secretKeyVerifier.d.ts.map +1 -0
  86. package/dist/cjs/auth/verifiers/secretKeyVerifier.js +40 -0
  87. package/dist/cjs/auth/verifiers/sha1Verifier.d.ts +25 -0
  88. package/dist/cjs/auth/verifiers/sha1Verifier.d.ts.map +1 -0
  89. package/dist/cjs/auth/verifiers/sha1Verifier.js +85 -0
  90. package/dist/cjs/auth/verifiers/sha256Verifier.d.ts +25 -0
  91. package/dist/cjs/auth/verifiers/sha256Verifier.d.ts.map +1 -0
  92. package/dist/cjs/auth/verifiers/sha256Verifier.js +85 -0
  93. package/dist/cjs/auth/verifiers/skipVerifier.d.ts +13 -0
  94. package/dist/cjs/auth/verifiers/skipVerifier.d.ts.map +1 -0
  95. package/dist/cjs/auth/verifiers/skipVerifier.js +37 -0
  96. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.d.ts +16 -0
  97. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.d.ts.map +1 -0
  98. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.js +81 -0
  99. package/dist/cjs/bins/redwood.d.ts +9 -0
  100. package/dist/cjs/bins/redwood.d.ts.map +1 -0
  101. package/dist/cjs/bins/redwood.js +36 -0
  102. package/dist/cjs/bins/rwfw.d.ts +3 -0
  103. package/dist/cjs/bins/rwfw.d.ts.map +1 -0
  104. package/dist/cjs/bins/rwfw.js +36 -0
  105. package/dist/cjs/bins/tsc.d.ts +3 -0
  106. package/dist/cjs/bins/tsc.d.ts.map +1 -0
  107. package/dist/cjs/bins/tsc.js +30 -0
  108. package/dist/cjs/cache/clients/BaseClient.d.ts +11 -0
  109. package/dist/cjs/cache/clients/BaseClient.d.ts.map +1 -0
  110. package/dist/cjs/cache/clients/BaseClient.js +27 -0
  111. package/dist/cjs/cache/clients/InMemoryClient.d.ts +31 -0
  112. package/dist/cjs/cache/clients/InMemoryClient.d.ts.map +1 -0
  113. package/dist/cjs/cache/clients/InMemoryClient.js +100 -0
  114. package/dist/cjs/cache/clients/MemcachedClient.d.ts +16 -0
  115. package/dist/cjs/cache/clients/MemcachedClient.d.ts.map +1 -0
  116. package/dist/cjs/cache/clients/MemcachedClient.js +75 -0
  117. package/dist/cjs/cache/clients/RedisClient.d.ts +20 -0
  118. package/dist/cjs/cache/clients/RedisClient.d.ts.map +1 -0
  119. package/dist/cjs/cache/clients/RedisClient.js +79 -0
  120. package/dist/cjs/cache/errors.d.ts +4 -0
  121. package/dist/cjs/cache/errors.d.ts.map +1 -0
  122. package/dist/cjs/cache/errors.js +33 -0
  123. package/dist/cjs/cache/index.d.ts +35 -0
  124. package/dist/cjs/cache/index.d.ts.map +1 -0
  125. package/dist/cjs/cache/index.js +171 -0
  126. package/dist/cjs/cors.d.ts +16 -0
  127. package/dist/cjs/cors.d.ts.map +1 -0
  128. package/dist/cjs/cors.js +93 -0
  129. package/dist/cjs/errors.d.ts +5 -0
  130. package/dist/cjs/errors.d.ts.map +1 -0
  131. package/dist/cjs/errors.js +38 -0
  132. package/dist/cjs/event.d.ts +3 -0
  133. package/dist/cjs/event.d.ts.map +1 -0
  134. package/dist/cjs/event.js +34 -0
  135. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts +4 -0
  136. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts.map +1 -0
  137. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.js +72 -0
  138. package/dist/cjs/index.d.ts +11 -0
  139. package/dist/cjs/index.d.ts.map +1 -0
  140. package/dist/cjs/index.js +82 -0
  141. package/dist/cjs/logger/index.d.ts +179 -0
  142. package/dist/cjs/logger/index.d.ts.map +1 -0
  143. package/dist/cjs/logger/index.js +195 -0
  144. package/dist/cjs/package.json +1 -0
  145. package/dist/cjs/transforms.d.ts +35 -0
  146. package/dist/cjs/transforms.d.ts.map +1 -0
  147. package/dist/cjs/transforms.js +98 -0
  148. package/dist/cjs/types.d.ts +25 -0
  149. package/dist/cjs/types.d.ts.map +1 -0
  150. package/dist/cjs/types.js +16 -0
  151. package/dist/cjs/validations/errors.d.ts +101 -0
  152. package/dist/cjs/validations/errors.d.ts.map +1 -0
  153. package/dist/cjs/validations/errors.js +298 -0
  154. package/dist/cjs/validations/validations.d.ts +222 -0
  155. package/dist/cjs/validations/validations.d.ts.map +1 -0
  156. package/dist/cjs/validations/validations.js +351 -0
  157. package/dist/cjs/webhooks/index.d.ts +76 -0
  158. package/dist/cjs/webhooks/index.d.ts.map +1 -0
  159. package/dist/cjs/webhooks/index.js +107 -0
  160. package/dist/cors.d.ts +16 -0
  161. package/dist/cors.d.ts.map +1 -0
  162. package/dist/cors.js +69 -0
  163. package/dist/errors.d.ts +5 -0
  164. package/dist/errors.d.ts.map +1 -0
  165. package/dist/errors.js +14 -0
  166. package/dist/event.d.ts +3 -0
  167. package/dist/event.d.ts.map +1 -0
  168. package/dist/event.js +10 -0
  169. package/dist/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts +4 -0
  170. package/dist/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts.map +1 -0
  171. package/dist/functions/fixtures/apiGatewayProxyEvent.fixture.js +48 -0
  172. package/dist/index.d.ts +11 -0
  173. package/dist/index.d.ts.map +1 -0
  174. package/dist/index.js +38 -0
  175. package/dist/logger/index.d.ts +179 -0
  176. package/dist/logger/index.d.ts.map +1 -0
  177. package/dist/logger/index.js +152 -0
  178. package/dist/package.json +1 -0
  179. package/dist/transforms.d.ts +35 -0
  180. package/dist/transforms.d.ts.map +1 -0
  181. package/dist/transforms.js +70 -0
  182. package/dist/types.d.ts +25 -0
  183. package/dist/types.d.ts.map +1 -0
  184. package/dist/types.js +0 -0
  185. package/dist/validations/errors.d.ts +101 -0
  186. package/dist/validations/errors.d.ts.map +1 -0
  187. package/dist/validations/errors.js +239 -0
  188. package/dist/validations/validations.d.ts +222 -0
  189. package/dist/validations/validations.d.ts.map +1 -0
  190. package/dist/validations/validations.js +314 -0
  191. package/dist/webhooks/index.d.ts +76 -0
  192. package/dist/webhooks/index.d.ts.map +1 -0
  193. package/dist/webhooks/index.js +85 -0
  194. package/package.json +130 -0
@@ -0,0 +1,49 @@
1
+ import BaseClient from "./BaseClient.js";
2
+ class RedisClient extends BaseClient {
3
+ client;
4
+ logger;
5
+ redisOptions;
6
+ constructor(options) {
7
+ const { logger, ...redisOptions } = options;
8
+ super();
9
+ this.logger = logger;
10
+ this.redisOptions = redisOptions;
11
+ }
12
+ async connect() {
13
+ const { createClient } = await import("redis");
14
+ this.client = createClient(this.redisOptions);
15
+ this.client.on(
16
+ "error",
17
+ (err) => this.logger?.error(err) || console.error(err)
18
+ );
19
+ await this.client.connect();
20
+ }
21
+ // @NOTE: disconnect intentionally not implemented for Redis
22
+ // Because node-redis recovers gracefully from connection loss
23
+ async get(key) {
24
+ if (!this.client) {
25
+ await this.connect();
26
+ }
27
+ const result = await this.client?.get(key);
28
+ return result ? JSON.parse(result) : null;
29
+ }
30
+ async set(key, value, options) {
31
+ const setOptions = {};
32
+ if (!this.client) {
33
+ await this.connect();
34
+ }
35
+ if (options.expires) {
36
+ setOptions.EX = options.expires;
37
+ }
38
+ return this.client?.set(key, JSON.stringify(value), setOptions);
39
+ }
40
+ async del(key) {
41
+ if (!this.client) {
42
+ await this.connect();
43
+ }
44
+ return !!await this.client?.del([key]);
45
+ }
46
+ }
47
+ export {
48
+ RedisClient as default
49
+ };
@@ -0,0 +1,4 @@
1
+ export declare class CacheTimeoutError extends Error {
2
+ constructor();
3
+ }
4
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/cache/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAkB,SAAQ,KAAK;;CAK3C"}
@@ -0,0 +1,9 @@
1
+ class CacheTimeoutError extends Error {
2
+ constructor() {
3
+ super("Timed out waiting for response from the cache server");
4
+ this.name = "CacheTimeoutError";
5
+ }
6
+ }
7
+ export {
8
+ CacheTimeoutError
9
+ };
@@ -0,0 +1,35 @@
1
+ import type { Logger } from '../logger/index.js';
2
+ import type BaseClient from './clients/BaseClient.js';
3
+ export { default as MemcachedClient } from './clients/MemcachedClient.js';
4
+ export { default as RedisClient } from './clients/RedisClient.js';
5
+ export { default as InMemoryClient } from './clients/InMemoryClient.js';
6
+ export interface CreateCacheOptions {
7
+ logger?: Logger;
8
+ timeout?: number;
9
+ prefix?: string;
10
+ fields?: {
11
+ id: string;
12
+ updatedAt: string;
13
+ };
14
+ }
15
+ export interface CacheOptions {
16
+ expires?: number;
17
+ }
18
+ export interface CacheFindManyOptions<TFindManyArgs extends Record<string, unknown>> extends CacheOptions {
19
+ conditions?: TFindManyArgs;
20
+ }
21
+ export type CacheKey = string | string[];
22
+ export type LatestQuery = Record<string, unknown>;
23
+ type GenericDelegate = {
24
+ findMany: (...args: any) => any;
25
+ findFirst: (...args: any) => any;
26
+ };
27
+ export declare const cacheKeySeparator = "-";
28
+ export declare const formatCacheKey: (key: CacheKey, prefix?: string) => string;
29
+ export declare const createCache: (cacheClient: BaseClient, options?: CreateCacheOptions) => {
30
+ cache: <TResult>(key: CacheKey, input: () => TResult | Promise<TResult>, options?: CacheOptions) => Promise<any>;
31
+ cacheFindMany: <TDelegate extends GenericDelegate>(key: CacheKey, model: TDelegate, options?: CacheFindManyOptions<Parameters<TDelegate["findMany"]>[0]>) => Promise<any>;
32
+ cacheClient: BaseClient;
33
+ deleteCacheKey: (key: CacheKey) => Promise<any>;
34
+ };
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAA;AAGrD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAEvE,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE;QACP,EAAE,EAAE,MAAM,CAAA;QACV,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,oBAAoB,CACnC,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC7C,SAAQ,YAAY;IACpB,UAAU,CAAC,EAAE,aAAa,CAAA;CAC3B;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,EAAE,CAAA;AACxC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEjD,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAA;IAC/B,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAA;CACjC,CAAA;AAQD,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,eAAO,MAAM,cAAc,QAAS,QAAQ,WAAW,MAAM,WAkB5D,CAAA;AAMD,eAAO,MAAM,WAAW,gBACT,UAAU,YACb,kBAAkB;YAQP,OAAO,OACrB,QAAQ,SACN,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,YAC7B,YAAY,KACrB,OAAO,CAAC,GAAG,CAAC;oBAqDc,SAAS,SAAS,eAAe,OACvD,QAAQ,SACN,SAAS,YACP,oBAAoB,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;0BAgDlC,QAAQ;CA0B5C,CAAA"}
@@ -0,0 +1,132 @@
1
+ import { CacheTimeoutError } from "./errors.js";
2
+ import { default as default2 } from "./clients/MemcachedClient.js";
3
+ import { default as default3 } from "./clients/RedisClient.js";
4
+ import { default as default4 } from "./clients/InMemoryClient.js";
5
+ const DEFAULT_LATEST_FIELDS = { id: "id", updatedAt: "updatedAt" };
6
+ const wait = (ms) => {
7
+ return new Promise((resolve) => setTimeout(resolve, ms));
8
+ };
9
+ const cacheKeySeparator = "-";
10
+ const formatCacheKey = (key, prefix) => {
11
+ let output;
12
+ if (Array.isArray(key)) {
13
+ output = key.join(cacheKeySeparator);
14
+ } else {
15
+ output = key;
16
+ }
17
+ if (prefix && !output.toString().match(new RegExp("^" + prefix + cacheKeySeparator))) {
18
+ output = `${prefix}${cacheKeySeparator}${output}`;
19
+ }
20
+ return output;
21
+ };
22
+ const serialize = (input) => {
23
+ return JSON.parse(JSON.stringify(input));
24
+ };
25
+ const createCache = (cacheClient, options) => {
26
+ const client = cacheClient;
27
+ const logger = options?.logger;
28
+ const timeout = options?.timeout || 1e3;
29
+ const prefix = options?.prefix;
30
+ const fields = options?.fields || DEFAULT_LATEST_FIELDS;
31
+ const cache = async (key, input, options2) => {
32
+ const cacheKey = formatCacheKey(key, prefix);
33
+ try {
34
+ const result = await Promise.race([
35
+ client.get(cacheKey),
36
+ wait(timeout).then(() => {
37
+ throw new CacheTimeoutError();
38
+ })
39
+ ]);
40
+ if (result) {
41
+ logger?.debug(`[Cache] HIT key '${cacheKey}'`);
42
+ return result;
43
+ }
44
+ } catch (e) {
45
+ logger?.error(`[Cache] Error GET '${cacheKey}': ${e.message}`);
46
+ if (e instanceof CacheTimeoutError && client.disconnect) {
47
+ logger?.error(`[Cache] Disconnecting current instance...`);
48
+ await client.disconnect();
49
+ }
50
+ return serialize(await input());
51
+ }
52
+ let data;
53
+ try {
54
+ data = await input();
55
+ await Promise.race([
56
+ client.set(cacheKey, data, options2 || {}),
57
+ wait(timeout).then(() => {
58
+ throw new CacheTimeoutError();
59
+ })
60
+ ]);
61
+ logger?.debug(
62
+ `[Cache] MISS '${cacheKey}', SET ${JSON.stringify(data).length} bytes`
63
+ );
64
+ return serialize(data);
65
+ } catch (e) {
66
+ logger?.error(`[Cache] Error SET '${cacheKey}': ${e.message}`);
67
+ return serialize(data || await input());
68
+ }
69
+ };
70
+ const cacheFindMany = async (key, model, options2 = {}) => {
71
+ const { conditions, ...rest } = options2;
72
+ const cacheKey = formatCacheKey(key, prefix);
73
+ let latest, latestCacheKey;
74
+ const { PrismaClientValidationError } = await import("@prisma/client");
75
+ try {
76
+ latest = await model.findFirst({
77
+ ...conditions,
78
+ orderBy: { [fields.updatedAt]: "desc" },
79
+ select: { [fields.id]: true, [fields.updatedAt]: true }
80
+ });
81
+ } catch (e) {
82
+ if (e instanceof PrismaClientValidationError) {
83
+ logger?.error(
84
+ `[Cache] cacheFindMany error: model does not contain \`${fields.id}\` or \`${fields.updatedAt}\` fields`
85
+ );
86
+ } else {
87
+ logger?.error(`[Cache] cacheFindMany error: ${e.message}`);
88
+ }
89
+ return serialize(await model.findMany(conditions));
90
+ }
91
+ if (latest) {
92
+ latestCacheKey = `${cacheKey}${cacheKeySeparator}${latest.id}${cacheKeySeparator}${latest[fields.updatedAt].getTime()}`;
93
+ } else {
94
+ logger?.debug(
95
+ `[Cache] cacheFindMany: No data to cache for key \`${key}\`, skipping`
96
+ );
97
+ return serialize(await model.findMany(conditions));
98
+ }
99
+ return cache(latestCacheKey, () => model.findMany(conditions), rest);
100
+ };
101
+ const deleteCacheKey = async (key) => {
102
+ let result;
103
+ const cacheKey = formatCacheKey(key, prefix);
104
+ try {
105
+ await Promise.race([
106
+ result = client.del(cacheKey),
107
+ wait(timeout).then(() => {
108
+ throw new CacheTimeoutError();
109
+ })
110
+ ]);
111
+ logger?.debug(`[Cache] DEL '${cacheKey}'`);
112
+ return result;
113
+ } catch (e) {
114
+ logger?.error(`[Cache] Error DEL '${cacheKey}': ${e.message}`);
115
+ return false;
116
+ }
117
+ };
118
+ return {
119
+ cache,
120
+ cacheFindMany,
121
+ cacheClient: client,
122
+ deleteCacheKey
123
+ };
124
+ };
125
+ export {
126
+ default4 as InMemoryClient,
127
+ default2 as MemcachedClient,
128
+ default3 as RedisClient,
129
+ cacheKeySeparator,
130
+ createCache,
131
+ formatCacheKey
132
+ };
@@ -0,0 +1,51 @@
1
+ export * from './parseJWT.js';
2
+ import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda';
3
+ import type { Decoded } from './parseJWT.js';
4
+ export type { Decoded };
5
+ export declare const AUTH_PROVIDER_HEADER = "auth-provider";
6
+ export declare const getAuthProviderHeader: (event: APIGatewayProxyEvent | Request) => string | null | undefined;
7
+ export interface AuthorizationHeader {
8
+ schema: 'Bearer' | 'Basic' | string;
9
+ token: string;
10
+ }
11
+ export type AuthorizationCookies = {
12
+ parsedCookie: Record<string, string | undefined>;
13
+ rawCookie: string;
14
+ type: string | undefined;
15
+ } | null;
16
+ export declare const parseAuthorizationCookie: (event: APIGatewayProxyEvent | Request) => AuthorizationCookies;
17
+ /**
18
+ * Split the `Authorization` header into a schema and token part.
19
+ */
20
+ export declare const parseAuthorizationHeader: (event: APIGatewayProxyEvent | Request) => AuthorizationHeader;
21
+ /** @MARK Note that we do not send LambdaContext when making fetch requests
22
+ *
23
+ * This part is incomplete, as we need to decide how we will make the breaking change to
24
+ * 1. getCurrentUser
25
+ * 2. authDecoders
26
+
27
+ */
28
+ export type AuthContextPayload = [
29
+ Decoded,
30
+ {
31
+ type: string;
32
+ } & AuthorizationHeader,
33
+ {
34
+ event: APIGatewayProxyEvent | Request;
35
+ context?: LambdaContext;
36
+ }
37
+ ];
38
+ export type Decoder = (token: string, type: string, req: {
39
+ event: APIGatewayProxyEvent | Request;
40
+ context?: LambdaContext;
41
+ }) => Promise<Decoded>;
42
+ /**
43
+ * Get the authorization information from the request headers and request context.
44
+ * @returns [decoded, { type, schema, token }, { event, context }]
45
+ **/
46
+ export declare const getAuthenticationContext: ({ authDecoder, event, context, }: {
47
+ authDecoder?: Decoder | Decoder[];
48
+ event: APIGatewayProxyEvent | Request;
49
+ context: LambdaContext;
50
+ }) => Promise<undefined | AuthContextPayload>;
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAA;AAKhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,YAAY,EAAE,OAAO,EAAE,CAAA;AAGvB,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AAEnD,eAAO,MAAM,qBAAqB,UACzB,oBAAoB,GAAG,OAAO,8BAStC,CAAA;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACnC,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,GAAG,IAAI,CAAA;AAER,eAAO,MAAM,wBAAwB,UAC5B,oBAAoB,GAAG,OAAO,KACpC,oBAiBF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,UAC5B,oBAAoB,GAAG,OAAO,KACpC,mBAUF,CAAA;AAED;;;;;;GAMG;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO;IACP;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,mBAAmB;IAEtC;QACE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;QACrC,OAAO,CAAC,EAAE,aAAa,CAAA;KACxB;CACF,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,CACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE;IACH,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;IACrC,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,KACE,OAAO,CAAC,OAAO,CAAC,CAAA;AAErB;;;IAGI;AACJ,eAAO,MAAM,wBAAwB,qCAIlC;IACD,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAA;IACjC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;IACrC,OAAO,EAAE,aAAa,CAAA;CACvB,KAAG,OAAO,CAAC,SAAS,GAAG,kBAAkB,CA6DzC,CAAA"}
@@ -0,0 +1,129 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var auth_exports = {};
31
+ __export(auth_exports, {
32
+ AUTH_PROVIDER_HEADER: () => AUTH_PROVIDER_HEADER,
33
+ getAuthProviderHeader: () => getAuthProviderHeader,
34
+ getAuthenticationContext: () => getAuthenticationContext,
35
+ parseAuthorizationCookie: () => parseAuthorizationCookie,
36
+ parseAuthorizationHeader: () => parseAuthorizationHeader
37
+ });
38
+ module.exports = __toCommonJS(auth_exports);
39
+ __reExport(auth_exports, require("./parseJWT.js"), module.exports);
40
+ var cookie = __toESM(require("cookie"), 1);
41
+ var import_event = require("../event.js");
42
+ const AUTH_PROVIDER_HEADER = "auth-provider";
43
+ const getAuthProviderHeader = (event) => {
44
+ const authProviderKey = Object.keys(event?.headers ?? {}).find(
45
+ (key) => key.toLowerCase() === AUTH_PROVIDER_HEADER
46
+ );
47
+ if (authProviderKey) {
48
+ return (0, import_event.getEventHeader)(event, authProviderKey);
49
+ }
50
+ return void 0;
51
+ };
52
+ const parseAuthorizationCookie = (event) => {
53
+ const cookieHeader = (0, import_event.getEventHeader)(event, "Cookie");
54
+ if (!cookieHeader) {
55
+ return null;
56
+ }
57
+ const parsedCookie = cookie.parse(cookieHeader);
58
+ return {
59
+ parsedCookie,
60
+ rawCookie: cookieHeader,
61
+ // When not unauthenticated, this will be null/undefined
62
+ // Remember that the cookie header could contain other (unrelated) values!
63
+ type: parsedCookie[AUTH_PROVIDER_HEADER]
64
+ };
65
+ };
66
+ const parseAuthorizationHeader = (event) => {
67
+ const parts = (0, import_event.getEventHeader)(event, "Authorization")?.split(" ");
68
+ if (parts?.length !== 2) {
69
+ throw new Error("The `Authorization` header is not valid.");
70
+ }
71
+ const [schema, token] = parts;
72
+ if (!schema.length || !token.length) {
73
+ throw new Error("The `Authorization` header is not valid.");
74
+ }
75
+ return { schema, token };
76
+ };
77
+ const getAuthenticationContext = async ({
78
+ authDecoder,
79
+ event,
80
+ context
81
+ }) => {
82
+ const cookieHeader = parseAuthorizationCookie(event);
83
+ const typeFromHeader = getAuthProviderHeader(event);
84
+ if (!typeFromHeader && !cookieHeader) {
85
+ return void 0;
86
+ }
87
+ let token;
88
+ let type;
89
+ let schema;
90
+ if (cookieHeader?.type) {
91
+ token = cookieHeader.rawCookie;
92
+ type = cookieHeader.type;
93
+ schema = "cookie";
94
+ } else if (typeFromHeader) {
95
+ const parsedAuthHeader = parseAuthorizationHeader(event);
96
+ token = parsedAuthHeader.token;
97
+ type = typeFromHeader;
98
+ schema = parsedAuthHeader.schema;
99
+ }
100
+ if (!token || !type || !schema) {
101
+ return void 0;
102
+ }
103
+ let authDecoders = [];
104
+ if (Array.isArray(authDecoder)) {
105
+ authDecoders = authDecoder;
106
+ } else if (authDecoder) {
107
+ authDecoders = [authDecoder];
108
+ }
109
+ let decoded = null;
110
+ let i = 0;
111
+ while (!decoded && i < authDecoders.length) {
112
+ decoded = await authDecoders[i](token, type, {
113
+ // @MARK: When called from middleware, the decoder will pass Request, not Lambda event
114
+ event,
115
+ context
116
+ });
117
+ i++;
118
+ }
119
+ return [decoded, { type, schema, token }, { event, context }];
120
+ };
121
+ // Annotate the CommonJS export names for ESM import in node:
122
+ 0 && (module.exports = {
123
+ AUTH_PROVIDER_HEADER,
124
+ getAuthProviderHeader,
125
+ getAuthenticationContext,
126
+ parseAuthorizationCookie,
127
+ parseAuthorizationHeader,
128
+ ...require("./parseJWT.js")
129
+ });
@@ -0,0 +1,6 @@
1
+ export type Decoded = Record<string, unknown> | null;
2
+ export declare const parseJWT: (token: {
3
+ decoded: Decoded;
4
+ namespace?: string;
5
+ }) => any;
6
+ //# sourceMappingURL=parseJWT.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseJWT.d.ts","sourceRoot":"","sources":["../../../src/auth/parseJWT.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;AA8DpD,eAAO,MAAM,QAAQ,UAAW;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,KAAG,GAKH,CAAA"}
@@ -0,0 +1,57 @@
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 parseJWT_exports = {};
20
+ __export(parseJWT_exports, {
21
+ parseJWT: () => parseJWT
22
+ });
23
+ module.exports = __toCommonJS(parseJWT_exports);
24
+ function isTokenWithRoles(token) {
25
+ return !!token.decoded?.roles;
26
+ }
27
+ function isTokenWithMetadata(token) {
28
+ const claim = token.namespace ? `${token.namespace}/app_metadata` : "app_metadata";
29
+ return !!token.decoded?.[claim];
30
+ }
31
+ const appMetadata = (token) => {
32
+ if (typeof token.decoded === "string") {
33
+ return {};
34
+ }
35
+ if (isTokenWithMetadata(token)) {
36
+ const claim = token.namespace ? `${token.namespace}/app_metadata` : "app_metadata";
37
+ return token.decoded?.[claim];
38
+ }
39
+ return {};
40
+ };
41
+ const roles = (token) => {
42
+ if (isTokenWithRoles(token)) {
43
+ return token.decoded.roles;
44
+ }
45
+ const metadata = appMetadata(token);
46
+ return metadata?.roles || metadata.authorization?.roles || [];
47
+ };
48
+ const parseJWT = (token) => {
49
+ return {
50
+ appMetadata: appMetadata(token),
51
+ roles: roles(token)
52
+ };
53
+ };
54
+ // Annotate the CommonJS export names for ESM import in node:
55
+ 0 && (module.exports = {
56
+ parseJWT
57
+ });
@@ -0,0 +1,19 @@
1
+ import type { WebhookVerifier, VerifyOptions } from './common.js';
2
+ export interface Base64Sha1Verifier extends WebhookVerifier {
3
+ type: 'base64Sha1Verifier';
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
+ * Base64 SHA1 HMAC Payload Verifier
12
+ *
13
+ * Based on Svix's webhook payload verification, but using SHA1 instead
14
+ * @see https://docs.svix.com/receiving/verifying-payloads/how-manual
15
+ * @see https://github.com/svix/svix-webhooks/blob/main/javascript/src/index.ts
16
+ */
17
+ declare const base64Sha1Verifier: (_options?: VerifyOptions) => Base64Sha1Verifier;
18
+ export default base64Sha1Verifier;
19
+ //# sourceMappingURL=base64Sha1Verifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64Sha1Verifier.d.ts","sourceRoot":"","sources":["../../../../src/auth/verifiers/base64Sha1Verifier.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEjE,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AA0BD,eAAO,MAAM,eAAe,oCAIzB;IACD,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,KAAG,OA0BH,CAAA;AAED;;;;;;GAMG;AACH,QAAA,MAAM,kBAAkB,cAAe,aAAa,KAAG,kBAUtD,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,77 @@
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 base64Sha1Verifier_exports = {};
20
+ __export(base64Sha1Verifier_exports, {
21
+ default: () => base64Sha1Verifier_default,
22
+ verifySignature: () => verifySignature
23
+ });
24
+ module.exports = __toCommonJS(base64Sha1Verifier_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.slice(0, 3) + s.slice(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, Buffer.from(secret, "base64"));
38
+ payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
39
+ const digest = hmac.update(payload).digest();
40
+ return digest.toString("base64");
41
+ };
42
+ const verifySignature = ({
43
+ payload,
44
+ secret = import_common.DEFAULT_WEBHOOK_SECRET,
45
+ signature
46
+ }) => {
47
+ try {
48
+ const webhookSignature = Buffer.from(signature || "", "base64");
49
+ const hmac = (0, import_crypto.createHmac)("sha1", Buffer.from(secret, "base64"));
50
+ payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
51
+ const digest = hmac.update(payload).digest();
52
+ if (webhookSignature.length === digest.length && (0, import_crypto.timingSafeEqual)(digest, webhookSignature)) {
53
+ return true;
54
+ }
55
+ throw new import_common.WebhookVerificationError();
56
+ } catch (error) {
57
+ throw new import_common.WebhookVerificationError(
58
+ `${import_common.VERIFICATION_ERROR_MESSAGE}: ${error.message}`
59
+ );
60
+ }
61
+ };
62
+ const base64Sha1Verifier = (_options) => {
63
+ return {
64
+ sign: ({ payload, secret }) => {
65
+ return createSignature({ payload, secret });
66
+ },
67
+ verify: ({ payload, secret, signature }) => {
68
+ return verifySignature({ payload, secret, signature });
69
+ },
70
+ type: "base64Sha1Verifier"
71
+ };
72
+ };
73
+ var base64Sha1Verifier_default = base64Sha1Verifier;
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ verifySignature
77
+ });
@@ -0,0 +1,19 @@
1
+ import type { WebhookVerifier, VerifyOptions } from './common.js';
2
+ export interface Base64Sha256Verifier extends WebhookVerifier {
3
+ type: 'base64Sha256Verifier';
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
+ * Base64 SHA256 HMAC Payload Verifier
12
+ *
13
+ * Based on Svix's webhook payload verification
14
+ * @see https://docs.svix.com/receiving/verifying-payloads/how-manual
15
+ * @see https://github.com/svix/svix-webhooks/blob/main/javascript/src/index.ts
16
+ */
17
+ declare const base64Sha256Verifier: (_options?: VerifyOptions) => Base64Sha256Verifier;
18
+ export default base64Sha256Verifier;
19
+ //# sourceMappingURL=base64Sha256Verifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64Sha256Verifier.d.ts","sourceRoot":"","sources":["../../../../src/auth/verifiers/base64Sha256Verifier.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEjE,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,IAAI,EAAE,sBAAsB,CAAA;CAC7B;AA0BD,eAAO,MAAM,eAAe,oCAIzB;IACD,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,KAAG,OA0BH,CAAA;AAED;;;;;;GAMG;AACH,QAAA,MAAM,oBAAoB,cACb,aAAa,KACvB,oBAUF,CAAA;AAED,eAAe,oBAAoB,CAAA"}