@pristine-ts/gcp 2.0.16

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 (220) hide show
  1. package/LICENSE +201 -0
  2. package/dist/lib/cjs/clients/clients.js +22 -0
  3. package/dist/lib/cjs/clients/clients.js.map +1 -0
  4. package/dist/lib/cjs/clients/cloud-storage.client.js +189 -0
  5. package/dist/lib/cjs/clients/cloud-storage.client.js.map +1 -0
  6. package/dist/lib/cjs/clients/eventarc.client.js +146 -0
  7. package/dist/lib/cjs/clients/eventarc.client.js.map +1 -0
  8. package/dist/lib/cjs/clients/firestore.client.js +238 -0
  9. package/dist/lib/cjs/clients/firestore.client.js.map +1 -0
  10. package/dist/lib/cjs/clients/pub-sub.client.js +97 -0
  11. package/dist/lib/cjs/clients/pub-sub.client.js.map +1 -0
  12. package/dist/lib/cjs/clients/secret-manager.client.js +118 -0
  13. package/dist/lib/cjs/clients/secret-manager.client.js.map +1 -0
  14. package/dist/lib/cjs/decorators/decorators.js +18 -0
  15. package/dist/lib/cjs/decorators/decorators.js.map +1 -0
  16. package/dist/lib/cjs/decorators/dynamic-collection-name.decorator.js +33 -0
  17. package/dist/lib/cjs/decorators/dynamic-collection-name.decorator.js.map +1 -0
  18. package/dist/lib/cjs/enums/cloud-storage-event-type.enum.js +16 -0
  19. package/dist/lib/cjs/enums/cloud-storage-event-type.enum.js.map +1 -0
  20. package/dist/lib/cjs/enums/cloud-storage-presigned-operation-type.enum.js +13 -0
  21. package/dist/lib/cjs/enums/cloud-storage-presigned-operation-type.enum.js.map +1 -0
  22. package/dist/lib/cjs/enums/enums.js +22 -0
  23. package/dist/lib/cjs/enums/enums.js.map +1 -0
  24. package/dist/lib/cjs/enums/eventarc-event-type.enum.js +12 -0
  25. package/dist/lib/cjs/enums/eventarc-event-type.enum.js.map +1 -0
  26. package/dist/lib/cjs/enums/firestore-event-type.enum.js +16 -0
  27. package/dist/lib/cjs/enums/firestore-event-type.enum.js.map +1 -0
  28. package/dist/lib/cjs/enums/pub-sub-event-type.enum.js +13 -0
  29. package/dist/lib/cjs/enums/pub-sub-event-type.enum.js.map +1 -0
  30. package/dist/lib/cjs/errors/errors.js +20 -0
  31. package/dist/lib/cjs/errors/errors.js.map +1 -0
  32. package/dist/lib/cjs/errors/eventarc-publish.error.js +17 -0
  33. package/dist/lib/cjs/errors/eventarc-publish.error.js.map +1 -0
  34. package/dist/lib/cjs/errors/get-secret.error.js +17 -0
  35. package/dist/lib/cjs/errors/get-secret.error.js.map +1 -0
  36. package/dist/lib/cjs/errors/pub-sub-publish.error.js +19 -0
  37. package/dist/lib/cjs/errors/pub-sub-publish.error.js.map +1 -0
  38. package/dist/lib/cjs/event-payloads/cloud-storage.event-payload.js +11 -0
  39. package/dist/lib/cjs/event-payloads/cloud-storage.event-payload.js.map +1 -0
  40. package/dist/lib/cjs/event-payloads/event-payloads.js +21 -0
  41. package/dist/lib/cjs/event-payloads/event-payloads.js.map +1 -0
  42. package/dist/lib/cjs/event-payloads/eventarc.event-payload.js +11 -0
  43. package/dist/lib/cjs/event-payloads/eventarc.event-payload.js.map +1 -0
  44. package/dist/lib/cjs/event-payloads/firestore.event-payload.js +11 -0
  45. package/dist/lib/cjs/event-payloads/firestore.event-payload.js.map +1 -0
  46. package/dist/lib/cjs/event-payloads/pub-sub.event-payload.js +17 -0
  47. package/dist/lib/cjs/event-payloads/pub-sub.event-payload.js.map +1 -0
  48. package/dist/lib/cjs/gcp.configuration-keys.js +20 -0
  49. package/dist/lib/cjs/gcp.configuration-keys.js.map +1 -0
  50. package/dist/lib/cjs/gcp.module.js +76 -0
  51. package/dist/lib/cjs/gcp.module.js.map +1 -0
  52. package/dist/lib/cjs/gcp.module.keyname.js +5 -0
  53. package/dist/lib/cjs/gcp.module.keyname.js.map +1 -0
  54. package/dist/lib/cjs/interfaces/client-options.interface.js +3 -0
  55. package/dist/lib/cjs/interfaces/client-options.interface.js.map +1 -0
  56. package/dist/lib/cjs/interfaces/cloud-storage-client.interface.js +3 -0
  57. package/dist/lib/cjs/interfaces/cloud-storage-client.interface.js.map +1 -0
  58. package/dist/lib/cjs/interfaces/eventarc-client.interface.js +3 -0
  59. package/dist/lib/cjs/interfaces/eventarc-client.interface.js.map +1 -0
  60. package/dist/lib/cjs/interfaces/firestore-client.interface.js +3 -0
  61. package/dist/lib/cjs/interfaces/firestore-client.interface.js.map +1 -0
  62. package/dist/lib/cjs/interfaces/interfaces.js +23 -0
  63. package/dist/lib/cjs/interfaces/interfaces.js.map +1 -0
  64. package/dist/lib/cjs/interfaces/pub-sub-client.interface.js +3 -0
  65. package/dist/lib/cjs/interfaces/pub-sub-client.interface.js.map +1 -0
  66. package/dist/lib/cjs/interfaces/secret-manager-client.interface.js +3 -0
  67. package/dist/lib/cjs/interfaces/secret-manager-client.interface.js.map +1 -0
  68. package/dist/lib/cjs/mappers/cloud-storage-event.mapper.js +87 -0
  69. package/dist/lib/cjs/mappers/cloud-storage-event.mapper.js.map +1 -0
  70. package/dist/lib/cjs/mappers/eventarc-event.mapper.js +84 -0
  71. package/dist/lib/cjs/mappers/eventarc-event.mapper.js.map +1 -0
  72. package/dist/lib/cjs/mappers/firestore-event.mapper.js +78 -0
  73. package/dist/lib/cjs/mappers/firestore-event.mapper.js.map +1 -0
  74. package/dist/lib/cjs/mappers/mappers.js +21 -0
  75. package/dist/lib/cjs/mappers/mappers.js.map +1 -0
  76. package/dist/lib/cjs/mappers/pub-sub-event.mapper.js +78 -0
  77. package/dist/lib/cjs/mappers/pub-sub-event.mapper.js.map +1 -0
  78. package/dist/lib/cjs/models/dynamic-collection-name.model.js +11 -0
  79. package/dist/lib/cjs/models/dynamic-collection-name.model.js.map +1 -0
  80. package/dist/lib/cjs/models/eventarc-message.model.js +10 -0
  81. package/dist/lib/cjs/models/eventarc-message.model.js.map +1 -0
  82. package/dist/lib/cjs/models/models.js +20 -0
  83. package/dist/lib/cjs/models/models.js.map +1 -0
  84. package/dist/lib/cjs/models/pub-sub-message-sent-confirmation.model.js +11 -0
  85. package/dist/lib/cjs/models/pub-sub-message-sent-confirmation.model.js.map +1 -0
  86. package/dist/lib/cjs/models/pub-sub-message.model.js +11 -0
  87. package/dist/lib/cjs/models/pub-sub-message.model.js.map +1 -0
  88. package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -0
  89. package/dist/lib/esm/clients/clients.js +6 -0
  90. package/dist/lib/esm/clients/clients.js.map +1 -0
  91. package/dist/lib/esm/clients/cloud-storage.client.js +186 -0
  92. package/dist/lib/esm/clients/cloud-storage.client.js.map +1 -0
  93. package/dist/lib/esm/clients/eventarc.client.js +110 -0
  94. package/dist/lib/esm/clients/eventarc.client.js.map +1 -0
  95. package/dist/lib/esm/clients/firestore.client.js +235 -0
  96. package/dist/lib/esm/clients/firestore.client.js.map +1 -0
  97. package/dist/lib/esm/clients/pub-sub.client.js +94 -0
  98. package/dist/lib/esm/clients/pub-sub.client.js.map +1 -0
  99. package/dist/lib/esm/clients/secret-manager.client.js +115 -0
  100. package/dist/lib/esm/clients/secret-manager.client.js.map +1 -0
  101. package/dist/lib/esm/decorators/decorators.js +2 -0
  102. package/dist/lib/esm/decorators/decorators.js.map +1 -0
  103. package/dist/lib/esm/decorators/dynamic-collection-name.decorator.js +29 -0
  104. package/dist/lib/esm/decorators/dynamic-collection-name.decorator.js.map +1 -0
  105. package/dist/lib/esm/enums/cloud-storage-event-type.enum.js +13 -0
  106. package/dist/lib/esm/enums/cloud-storage-event-type.enum.js.map +1 -0
  107. package/dist/lib/esm/enums/cloud-storage-presigned-operation-type.enum.js +10 -0
  108. package/dist/lib/esm/enums/cloud-storage-presigned-operation-type.enum.js.map +1 -0
  109. package/dist/lib/esm/enums/enums.js +6 -0
  110. package/dist/lib/esm/enums/enums.js.map +1 -0
  111. package/dist/lib/esm/enums/eventarc-event-type.enum.js +9 -0
  112. package/dist/lib/esm/enums/eventarc-event-type.enum.js.map +1 -0
  113. package/dist/lib/esm/enums/firestore-event-type.enum.js +13 -0
  114. package/dist/lib/esm/enums/firestore-event-type.enum.js.map +1 -0
  115. package/dist/lib/esm/enums/pub-sub-event-type.enum.js +10 -0
  116. package/dist/lib/esm/enums/pub-sub-event-type.enum.js.map +1 -0
  117. package/dist/lib/esm/errors/errors.js +4 -0
  118. package/dist/lib/esm/errors/errors.js.map +1 -0
  119. package/dist/lib/esm/errors/eventarc-publish.error.js +13 -0
  120. package/dist/lib/esm/errors/eventarc-publish.error.js.map +1 -0
  121. package/dist/lib/esm/errors/get-secret.error.js +13 -0
  122. package/dist/lib/esm/errors/get-secret.error.js.map +1 -0
  123. package/dist/lib/esm/errors/pub-sub-publish.error.js +15 -0
  124. package/dist/lib/esm/errors/pub-sub-publish.error.js.map +1 -0
  125. package/dist/lib/esm/event-payloads/cloud-storage.event-payload.js +7 -0
  126. package/dist/lib/esm/event-payloads/cloud-storage.event-payload.js.map +1 -0
  127. package/dist/lib/esm/event-payloads/event-payloads.js +5 -0
  128. package/dist/lib/esm/event-payloads/event-payloads.js.map +1 -0
  129. package/dist/lib/esm/event-payloads/eventarc.event-payload.js +7 -0
  130. package/dist/lib/esm/event-payloads/eventarc.event-payload.js.map +1 -0
  131. package/dist/lib/esm/event-payloads/firestore.event-payload.js +7 -0
  132. package/dist/lib/esm/event-payloads/firestore.event-payload.js.map +1 -0
  133. package/dist/lib/esm/event-payloads/pub-sub.event-payload.js +13 -0
  134. package/dist/lib/esm/event-payloads/pub-sub.event-payload.js.map +1 -0
  135. package/dist/lib/esm/gcp.configuration-keys.js +17 -0
  136. package/dist/lib/esm/gcp.configuration-keys.js.map +1 -0
  137. package/dist/lib/esm/gcp.module.js +59 -0
  138. package/dist/lib/esm/gcp.module.js.map +1 -0
  139. package/dist/lib/esm/gcp.module.keyname.js +2 -0
  140. package/dist/lib/esm/gcp.module.keyname.js.map +1 -0
  141. package/dist/lib/esm/interfaces/client-options.interface.js +2 -0
  142. package/dist/lib/esm/interfaces/client-options.interface.js.map +1 -0
  143. package/dist/lib/esm/interfaces/cloud-storage-client.interface.js +2 -0
  144. package/dist/lib/esm/interfaces/cloud-storage-client.interface.js.map +1 -0
  145. package/dist/lib/esm/interfaces/eventarc-client.interface.js +2 -0
  146. package/dist/lib/esm/interfaces/eventarc-client.interface.js.map +1 -0
  147. package/dist/lib/esm/interfaces/firestore-client.interface.js +2 -0
  148. package/dist/lib/esm/interfaces/firestore-client.interface.js.map +1 -0
  149. package/dist/lib/esm/interfaces/interfaces.js +7 -0
  150. package/dist/lib/esm/interfaces/interfaces.js.map +1 -0
  151. package/dist/lib/esm/interfaces/pub-sub-client.interface.js +2 -0
  152. package/dist/lib/esm/interfaces/pub-sub-client.interface.js.map +1 -0
  153. package/dist/lib/esm/interfaces/secret-manager-client.interface.js +2 -0
  154. package/dist/lib/esm/interfaces/secret-manager-client.interface.js.map +1 -0
  155. package/dist/lib/esm/mappers/cloud-storage-event.mapper.js +84 -0
  156. package/dist/lib/esm/mappers/cloud-storage-event.mapper.js.map +1 -0
  157. package/dist/lib/esm/mappers/eventarc-event.mapper.js +81 -0
  158. package/dist/lib/esm/mappers/eventarc-event.mapper.js.map +1 -0
  159. package/dist/lib/esm/mappers/firestore-event.mapper.js +75 -0
  160. package/dist/lib/esm/mappers/firestore-event.mapper.js.map +1 -0
  161. package/dist/lib/esm/mappers/mappers.js +5 -0
  162. package/dist/lib/esm/mappers/mappers.js.map +1 -0
  163. package/dist/lib/esm/mappers/pub-sub-event.mapper.js +75 -0
  164. package/dist/lib/esm/mappers/pub-sub-event.mapper.js.map +1 -0
  165. package/dist/lib/esm/models/dynamic-collection-name.model.js +7 -0
  166. package/dist/lib/esm/models/dynamic-collection-name.model.js.map +1 -0
  167. package/dist/lib/esm/models/eventarc-message.model.js +6 -0
  168. package/dist/lib/esm/models/eventarc-message.model.js.map +1 -0
  169. package/dist/lib/esm/models/models.js +4 -0
  170. package/dist/lib/esm/models/models.js.map +1 -0
  171. package/dist/lib/esm/models/pub-sub-message-sent-confirmation.model.js +7 -0
  172. package/dist/lib/esm/models/pub-sub-message-sent-confirmation.model.js.map +1 -0
  173. package/dist/lib/esm/models/pub-sub-message.model.js +7 -0
  174. package/dist/lib/esm/models/pub-sub-message.model.js.map +1 -0
  175. package/dist/lib/esm/tsconfig.tsbuildinfo +1 -0
  176. package/dist/types/clients/clients.d.ts +5 -0
  177. package/dist/types/clients/cloud-storage.client.d.ts +26 -0
  178. package/dist/types/clients/eventarc.client.d.ts +26 -0
  179. package/dist/types/clients/firestore.client.d.ts +47 -0
  180. package/dist/types/clients/pub-sub.client.d.ts +23 -0
  181. package/dist/types/clients/secret-manager.client.d.ts +24 -0
  182. package/dist/types/decorators/decorators.d.ts +1 -0
  183. package/dist/types/decorators/dynamic-collection-name.decorator.d.ts +22 -0
  184. package/dist/types/enums/cloud-storage-event-type.enum.d.ts +11 -0
  185. package/dist/types/enums/cloud-storage-presigned-operation-type.enum.d.ts +8 -0
  186. package/dist/types/enums/enums.d.ts +5 -0
  187. package/dist/types/enums/eventarc-event-type.enum.d.ts +7 -0
  188. package/dist/types/enums/firestore-event-type.enum.d.ts +11 -0
  189. package/dist/types/enums/pub-sub-event-type.enum.d.ts +8 -0
  190. package/dist/types/errors/errors.d.ts +3 -0
  191. package/dist/types/errors/eventarc-publish.error.d.ts +8 -0
  192. package/dist/types/errors/get-secret.error.d.ts +8 -0
  193. package/dist/types/errors/pub-sub-publish.error.d.ts +14 -0
  194. package/dist/types/event-payloads/cloud-storage.event-payload.d.ts +55 -0
  195. package/dist/types/event-payloads/event-payloads.d.ts +4 -0
  196. package/dist/types/event-payloads/eventarc.event-payload.d.ts +39 -0
  197. package/dist/types/event-payloads/firestore.event-payload.d.ts +43 -0
  198. package/dist/types/event-payloads/pub-sub.event-payload.d.ts +37 -0
  199. package/dist/types/gcp.configuration-keys.d.ts +35 -0
  200. package/dist/types/gcp.module.d.ts +11 -0
  201. package/dist/types/gcp.module.keyname.d.ts +1 -0
  202. package/dist/types/interfaces/client-options.interface.d.ts +19 -0
  203. package/dist/types/interfaces/cloud-storage-client.interface.d.ts +14 -0
  204. package/dist/types/interfaces/eventarc-client.interface.d.ts +5 -0
  205. package/dist/types/interfaces/firestore-client.interface.d.ts +27 -0
  206. package/dist/types/interfaces/interfaces.d.ts +6 -0
  207. package/dist/types/interfaces/pub-sub-client.interface.d.ts +8 -0
  208. package/dist/types/interfaces/secret-manager-client.interface.d.ts +9 -0
  209. package/dist/types/mappers/cloud-storage-event.mapper.d.ts +22 -0
  210. package/dist/types/mappers/eventarc-event.mapper.d.ts +22 -0
  211. package/dist/types/mappers/firestore-event.mapper.d.ts +17 -0
  212. package/dist/types/mappers/mappers.d.ts +4 -0
  213. package/dist/types/mappers/pub-sub-event.mapper.d.ts +23 -0
  214. package/dist/types/models/dynamic-collection-name.model.d.ts +8 -0
  215. package/dist/types/models/eventarc-message.model.d.ts +25 -0
  216. package/dist/types/models/models.d.ts +3 -0
  217. package/dist/types/models/pub-sub-message-sent-confirmation.model.d.ts +7 -0
  218. package/dist/types/models/pub-sub-message.model.d.ts +21 -0
  219. package/package.json +72 -0
  220. package/readme.md +32 -0
@@ -0,0 +1,6 @@
1
+ export * from "./cloud-storage.client";
2
+ export * from "./eventarc.client";
3
+ export * from "./firestore.client";
4
+ export * from "./pub-sub.client";
5
+ export * from "./secret-manager.client";
6
+ //# sourceMappingURL=clients.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../../src/clients/clients.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,186 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ import { inject, injectable } from "tsyringe";
23
+ import { injectConfig, moduleScoped, tag, traced } from "@pristine-ts/common";
24
+ import { Storage } from "@google-cloud/storage";
25
+ import { Readable } from "stream";
26
+ import { GcpModuleKeyname } from "../gcp.module.keyname";
27
+ import { GcpConfigurationKeys } from "../gcp.configuration-keys";
28
+ import { CloudStoragePresignedOperationTypeEnum } from "../enums/cloud-storage-presigned-operation-type.enum";
29
+ /**
30
+ * Client for Google Cloud Storage. Mirrors `S3Client` in `@pristine-ts/aws`.
31
+ */
32
+ let CloudStorageClient = class CloudStorageClient {
33
+ constructor(logHandler, projectId) {
34
+ this.logHandler = logHandler;
35
+ this.projectId = projectId;
36
+ }
37
+ getClient() {
38
+ var _a;
39
+ return this.client = (_a = this.client) !== null && _a !== void 0 ? _a : new Storage({ projectId: this.projectId });
40
+ }
41
+ get(bucketName, key, options) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ this.logHandler.debug("CloudStorageClient: Downloading object.", { extra: { bucketName, key } });
44
+ try {
45
+ const [contents] = yield this.getClient().bucket(bucketName).file(key).download();
46
+ return contents;
47
+ }
48
+ catch (e) {
49
+ this.logHandler.error("CloudStorageClient: Error downloading object.", { extra: { error: e, bucketName, key } });
50
+ throw e;
51
+ }
52
+ });
53
+ }
54
+ getObjectBodyAsArrayBuffer(bucketName, key, options) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const buffer = yield this.get(bucketName, key, options);
57
+ return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
58
+ });
59
+ }
60
+ listKeys(bucketName, prefix, options) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ this.logHandler.debug("CloudStorageClient: Listing keys.", { extra: { bucketName, prefix } });
63
+ try {
64
+ const [files] = yield this.getClient().bucket(bucketName).getFiles({ prefix });
65
+ return files.map((file) => file.name);
66
+ }
67
+ catch (e) {
68
+ this.logHandler.error("CloudStorageClient: Error listing keys.", { extra: { error: e, bucketName } });
69
+ throw e;
70
+ }
71
+ });
72
+ }
73
+ upload(bucketName, key, data, contentType, contentEncoding, options) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ this.logHandler.debug("CloudStorageClient: Uploading object.", { extra: { bucketName, key, contentType, contentEncoding } });
76
+ try {
77
+ const file = this.getClient().bucket(bucketName).file(key);
78
+ if (data instanceof Readable) {
79
+ yield new Promise((resolve, reject) => {
80
+ data
81
+ .pipe(file.createWriteStream({ metadata: { contentType, contentEncoding } }))
82
+ .on("finish", () => resolve())
83
+ .on("error", reject);
84
+ });
85
+ }
86
+ else {
87
+ yield file.save(data, { metadata: { contentType, contentEncoding } });
88
+ }
89
+ }
90
+ catch (e) {
91
+ this.logHandler.error("CloudStorageClient: Error uploading object.", { extra: { error: e, bucketName, key } });
92
+ throw e;
93
+ }
94
+ });
95
+ }
96
+ download(bucketName, key, options) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ this.logHandler.debug("CloudStorageClient: Streaming object.", { extra: { bucketName, key } });
99
+ return this.getClient().bucket(bucketName).file(key).createReadStream();
100
+ });
101
+ }
102
+ deleteObject(bucketName, key, options) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ this.logHandler.debug("CloudStorageClient: Deleting object.", { extra: { bucketName, key } });
105
+ try {
106
+ yield this.getClient().bucket(bucketName).file(key).delete();
107
+ }
108
+ catch (e) {
109
+ this.logHandler.error("CloudStorageClient: Error deleting object.", { extra: { error: e, bucketName, key } });
110
+ throw e;
111
+ }
112
+ });
113
+ }
114
+ /**
115
+ * Creates a V4 signed URL granting `operation` on the object for `expiresInSeconds`.
116
+ */
117
+ createSignedUrl(bucketName_1, key_1, operation_1) {
118
+ return __awaiter(this, arguments, void 0, function* (bucketName, key, operation, expiresInSeconds = 300) {
119
+ this.logHandler.debug("CloudStorageClient: Creating signed URL.", { extra: { bucketName, key, operation, expiresInSeconds } });
120
+ try {
121
+ const [url] = yield this.getClient().bucket(bucketName).file(key).getSignedUrl({
122
+ version: "v4",
123
+ action: operation === CloudStoragePresignedOperationTypeEnum.Read ? "read" : "write",
124
+ expires: Date.now() + expiresInSeconds * 1000,
125
+ });
126
+ return url;
127
+ }
128
+ catch (e) {
129
+ this.logHandler.error("CloudStorageClient: Error creating signed URL.", { extra: { error: e, bucketName, key, operation } });
130
+ throw e;
131
+ }
132
+ });
133
+ }
134
+ };
135
+ __decorate([
136
+ traced(),
137
+ __metadata("design:type", Function),
138
+ __metadata("design:paramtypes", [String, String, Object]),
139
+ __metadata("design:returntype", Promise)
140
+ ], CloudStorageClient.prototype, "get", null);
141
+ __decorate([
142
+ traced(),
143
+ __metadata("design:type", Function),
144
+ __metadata("design:paramtypes", [String, String, Object]),
145
+ __metadata("design:returntype", Promise)
146
+ ], CloudStorageClient.prototype, "getObjectBodyAsArrayBuffer", null);
147
+ __decorate([
148
+ traced(),
149
+ __metadata("design:type", Function),
150
+ __metadata("design:paramtypes", [String, String, Object]),
151
+ __metadata("design:returntype", Promise)
152
+ ], CloudStorageClient.prototype, "listKeys", null);
153
+ __decorate([
154
+ traced(),
155
+ __metadata("design:type", Function),
156
+ __metadata("design:paramtypes", [String, String, Object, String, String, Object]),
157
+ __metadata("design:returntype", Promise)
158
+ ], CloudStorageClient.prototype, "upload", null);
159
+ __decorate([
160
+ traced(),
161
+ __metadata("design:type", Function),
162
+ __metadata("design:paramtypes", [String, String, Object]),
163
+ __metadata("design:returntype", Promise)
164
+ ], CloudStorageClient.prototype, "download", null);
165
+ __decorate([
166
+ traced(),
167
+ __metadata("design:type", Function),
168
+ __metadata("design:paramtypes", [String, String, Object]),
169
+ __metadata("design:returntype", Promise)
170
+ ], CloudStorageClient.prototype, "deleteObject", null);
171
+ __decorate([
172
+ traced(),
173
+ __metadata("design:type", Function),
174
+ __metadata("design:paramtypes", [String, String, String, Number]),
175
+ __metadata("design:returntype", Promise)
176
+ ], CloudStorageClient.prototype, "createSignedUrl", null);
177
+ CloudStorageClient = __decorate([
178
+ tag("CloudStorageClientInterface"),
179
+ moduleScoped(GcpModuleKeyname),
180
+ injectable(),
181
+ __param(0, inject("LogHandlerInterface")),
182
+ __param(1, injectConfig(GcpConfigurationKeys.ProjectId)),
183
+ __metadata("design:paramtypes", [Object, String])
184
+ ], CloudStorageClient);
185
+ export { CloudStorageClient };
186
+ //# sourceMappingURL=cloud-storage.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-storage.client.js","sourceRoot":"","sources":["../../../../src/clients/cloud-storage.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAC,MAAM,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AC,EAAC,CAAC,CAAC;gBACzH,MAAM,CAAC,CAAC;YACV,CAAC;QACH,CAAC;KAAA;CACF,CAAA;AAjGO;IADL,MAAM,EAAE;;;;6CAUR;AAGK;IADL,MAAM,EAAE;;;;oEAIR;AAGK;IADL,MAAM,EAAE;;;;kDAUR;AAGK;IADL,MAAM,EAAE;;;;gDA0BR;AAGK;IADL,MAAM,EAAE;;;;kDAIR;AAGK;IADL,MAAM,EAAE;;;;sDASR;AAMK;IADL,MAAM,EAAE;;;;yDAmBR;AA9GU,kBAAkB;IAH9B,GAAG,CAAC,6BAA6B,CAAC;IAClC,YAAY,CAAC,gBAAgB,CAAC;IAC9B,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAA;;GALpC,kBAAkB,CA+G9B"}
@@ -0,0 +1,110 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ import { inject, injectable } from "tsyringe";
23
+ import * as crypto from "crypto";
24
+ import { injectConfig, moduleScoped, tag, traced } from "@pristine-ts/common";
25
+ import { PublisherClient } from "@google-cloud/eventarc-publishing";
26
+ import { GcpModuleKeyname } from "../gcp.module.keyname";
27
+ import { GcpConfigurationKeys } from "../gcp.configuration-keys";
28
+ import { EventarcPublishError } from "../errors/eventarc-publish.error";
29
+ /**
30
+ * Client for publishing CloudEvents through Eventarc. Mirrors `EventBridgeClient` in
31
+ * `@pristine-ts/aws`. Uses the Eventarc Publishing API (`PublisherClient`) which lets
32
+ * services emit CloudEvents to a channel for routing.
33
+ */
34
+ let EventarcClient = class EventarcClient {
35
+ constructor(logHandler, projectId, region) {
36
+ this.logHandler = logHandler;
37
+ this.projectId = projectId;
38
+ this.region = region;
39
+ }
40
+ getClient() {
41
+ var _a;
42
+ return this.client = (_a = this.client) !== null && _a !== void 0 ? _a : new PublisherClient();
43
+ }
44
+ /**
45
+ * Publish one or more CloudEvents to an Eventarc channel.
46
+ *
47
+ * @param events One event or a batch.
48
+ * @param channel Channel id (bare or fully-qualified). Defaults to the configured
49
+ * project's default region channel `projects/{p}/locations/{r}/channels/default`.
50
+ */
51
+ publish(events, channel, options) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ const channelName = (channel === null || channel === void 0 ? void 0 : channel.startsWith("projects/"))
54
+ ? channel
55
+ : `projects/${this.projectId}/locations/${this.region}/channels/${channel !== null && channel !== void 0 ? channel : "default"}`;
56
+ const batch = Array.isArray(events) ? events : [events];
57
+ this.logHandler.debug("EventarcClient: Publishing events.", {
58
+ extra: { channelName, count: batch.length },
59
+ eventId: options === null || options === void 0 ? void 0 : options.eventId,
60
+ eventGroupId: options === null || options === void 0 ? void 0 : options.eventGroupId,
61
+ });
62
+ try {
63
+ // The eventarc-publishing SDK expects events as protobuf `Any`-wrapped CloudEvents;
64
+ // we hand a structured CloudEvent JSON string via the `textEvent` field. The SDK's
65
+ // generated types are very loose here (`IAny[]`), so we cast.
66
+ yield this.getClient().publishChannelConnectionEvents({
67
+ channelConnection: channelName,
68
+ events: batch.map((event) => {
69
+ var _a;
70
+ return ({
71
+ textEvent: JSON.stringify({
72
+ specversion: "1.0",
73
+ id: crypto.randomUUID(),
74
+ type: event.type,
75
+ source: event.source,
76
+ subject: event.subject,
77
+ datacontenttype: (_a = event.dataContentType) !== null && _a !== void 0 ? _a : "application/json",
78
+ data: event.data,
79
+ }),
80
+ });
81
+ }),
82
+ });
83
+ }
84
+ catch (error) {
85
+ this.logHandler.error("EventarcClient: Failed to publish events.", {
86
+ extra: { error, channelName },
87
+ eventId: options === null || options === void 0 ? void 0 : options.eventId,
88
+ });
89
+ throw new EventarcPublishError(error);
90
+ }
91
+ });
92
+ }
93
+ };
94
+ __decorate([
95
+ traced(),
96
+ __metadata("design:type", Function),
97
+ __metadata("design:paramtypes", [Object, String, Object]),
98
+ __metadata("design:returntype", Promise)
99
+ ], EventarcClient.prototype, "publish", null);
100
+ EventarcClient = __decorate([
101
+ tag("EventarcClientInterface"),
102
+ moduleScoped(GcpModuleKeyname),
103
+ injectable(),
104
+ __param(0, inject("LogHandlerInterface")),
105
+ __param(1, injectConfig(GcpConfigurationKeys.ProjectId)),
106
+ __param(2, injectConfig(GcpConfigurationKeys.Region)),
107
+ __metadata("design:paramtypes", [Object, String, String])
108
+ ], EventarcClient);
109
+ export { EventarcClient };
110
+ //# sourceMappingURL=eventarc.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventarc.client.js","sourceRoot":"","sources":["../../../../src/clients/eventarc.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UA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AAC;IAC9B,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAC7B,WAAA,YAAY,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAA;IAC5C,WAAA,YAAY,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;;GANjC,cAAc,CA8D1B"}
@@ -0,0 +1,235 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var _a, _b, _c;
23
+ import { inject, injectable } from "tsyringe";
24
+ import { injectConfig, moduleScoped, tag, traced } from "@pristine-ts/common";
25
+ import { Firestore } from "@google-cloud/firestore";
26
+ import { GcpModuleKeyname } from "../gcp.module.keyname";
27
+ import { GcpConfigurationKeys } from "../gcp.configuration-keys";
28
+ /**
29
+ * Client for Google Cloud Firestore (Native mode). Provides typed CRUD against a
30
+ * model class plus a `findBySecondaryIndex` for indexed field-equality lookups.
31
+ *
32
+ * Document↔object mapping uses the class name (lowercased) as the collection key;
33
+ * fields are persisted verbatim via property copy. A typed decorator-based mapper
34
+ * (`@firestoreCollection` / `@firestoreField`) is a future extension.
35
+ */
36
+ let FirestoreClient = class FirestoreClient {
37
+ constructor(logHandler, projectId) {
38
+ this.logHandler = logHandler;
39
+ this.projectId = projectId;
40
+ }
41
+ getClient() {
42
+ var _a;
43
+ return this.client = (_a = this.client) !== null && _a !== void 0 ? _a : new Firestore({ projectId: this.projectId });
44
+ }
45
+ /**
46
+ * Resolves the Firestore collection name for a model class — the class name
47
+ * lowercased.
48
+ */
49
+ getCollectionName(classType) {
50
+ return classType.name.toLowerCase();
51
+ }
52
+ get(classType, id) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ const collection = this.getCollectionName(classType);
55
+ this.logHandler.debug("FirestoreClient: Getting document.", { extra: { collection, id } });
56
+ try {
57
+ const snapshot = yield this.getClient().collection(collection).doc(id).get();
58
+ if (snapshot.exists === false) {
59
+ return undefined;
60
+ }
61
+ const instance = new classType();
62
+ Object.assign(instance, snapshot.data());
63
+ return instance;
64
+ }
65
+ catch (e) {
66
+ this.logHandler.error("FirestoreClient: Error getting document.", { extra: { error: e, collection, id } });
67
+ throw e;
68
+ }
69
+ });
70
+ }
71
+ list(classType, options) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ var _a;
74
+ const collection = this.getCollectionName(classType);
75
+ this.logHandler.debug("FirestoreClient: Listing documents.", { extra: { collection, options } });
76
+ try {
77
+ let query = this.getClient().collection(collection).limit((_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : 100);
78
+ if ((options === null || options === void 0 ? void 0 : options.startAfter) !== undefined) {
79
+ query = query.startAfter(options.startAfter);
80
+ }
81
+ const snapshot = yield query.get();
82
+ return snapshot.docs.map((doc) => {
83
+ const instance = new classType();
84
+ Object.assign(instance, doc.data());
85
+ return instance;
86
+ });
87
+ }
88
+ catch (e) {
89
+ this.logHandler.error("FirestoreClient: Error listing documents.", { extra: { error: e, collection } });
90
+ throw e;
91
+ }
92
+ });
93
+ }
94
+ create(item) {
95
+ return __awaiter(this, void 0, void 0, function* () {
96
+ const collection = this.getCollectionName(item.constructor);
97
+ const id = item.id;
98
+ this.logHandler.debug("FirestoreClient: Creating document.", { extra: { collection, id } });
99
+ try {
100
+ const docRef = id ? this.getClient().collection(collection).doc(id) : this.getClient().collection(collection).doc();
101
+ yield docRef.create(Object.assign({}, item));
102
+ item.id = docRef.id;
103
+ return item;
104
+ }
105
+ catch (e) {
106
+ this.logHandler.error("FirestoreClient: Error creating document.", { extra: { error: e, collection, id } });
107
+ throw e;
108
+ }
109
+ });
110
+ }
111
+ update(item) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ const collection = this.getCollectionName(item.constructor);
114
+ const id = item.id;
115
+ this.logHandler.debug("FirestoreClient: Updating document.", { extra: { collection, id } });
116
+ try {
117
+ yield this.getClient().collection(collection).doc(id).update(Object.assign({}, item));
118
+ return item;
119
+ }
120
+ catch (e) {
121
+ this.logHandler.error("FirestoreClient: Error updating document.", { extra: { error: e, collection, id } });
122
+ throw e;
123
+ }
124
+ });
125
+ }
126
+ save(item) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ const collection = this.getCollectionName(item.constructor);
129
+ const id = item.id;
130
+ this.logHandler.debug("FirestoreClient: Saving (upsert) document.", { extra: { collection, id } });
131
+ try {
132
+ const docRef = id ? this.getClient().collection(collection).doc(id) : this.getClient().collection(collection).doc();
133
+ yield docRef.set(Object.assign({}, item), { merge: true });
134
+ item.id = docRef.id;
135
+ return item;
136
+ }
137
+ catch (e) {
138
+ this.logHandler.error("FirestoreClient: Error saving document.", { extra: { error: e, collection, id } });
139
+ throw e;
140
+ }
141
+ });
142
+ }
143
+ delete(classType, id) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ const collection = this.getCollectionName(classType);
146
+ this.logHandler.debug("FirestoreClient: Deleting document.", { extra: { collection, id } });
147
+ try {
148
+ yield this.getClient().collection(collection).doc(id).delete();
149
+ }
150
+ catch (e) {
151
+ this.logHandler.error("FirestoreClient: Error deleting document.", { extra: { error: e, collection, id } });
152
+ throw e;
153
+ }
154
+ });
155
+ }
156
+ /**
157
+ * Find documents by a field-equality predicate. Firestore requires a composite index
158
+ * for compound queries; for the single-field case this returns immediately.
159
+ */
160
+ findBySecondaryIndex(classType, field, value, options) {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ var _a;
163
+ const collection = this.getCollectionName(classType);
164
+ this.logHandler.debug("FirestoreClient: Find by index.", { extra: { collection, field, value, options } });
165
+ try {
166
+ const snapshot = yield this.getClient()
167
+ .collection(collection)
168
+ .where(field, "==", value)
169
+ .limit((_a = options === null || options === void 0 ? void 0 : options.limit) !== null && _a !== void 0 ? _a : 100)
170
+ .get();
171
+ return snapshot.docs.map((doc) => {
172
+ const instance = new classType();
173
+ Object.assign(instance, doc.data());
174
+ return instance;
175
+ });
176
+ }
177
+ catch (e) {
178
+ this.logHandler.error("FirestoreClient: Error in findBySecondaryIndex.", { extra: { error: e, collection, field } });
179
+ throw e;
180
+ }
181
+ });
182
+ }
183
+ };
184
+ __decorate([
185
+ traced(),
186
+ __metadata("design:type", Function),
187
+ __metadata("design:paramtypes", [Object, String]),
188
+ __metadata("design:returntype", Promise)
189
+ ], FirestoreClient.prototype, "get", null);
190
+ __decorate([
191
+ traced(),
192
+ __metadata("design:type", Function),
193
+ __metadata("design:paramtypes", [Object, Object]),
194
+ __metadata("design:returntype", Promise)
195
+ ], FirestoreClient.prototype, "list", null);
196
+ __decorate([
197
+ traced(),
198
+ __metadata("design:type", Function),
199
+ __metadata("design:paramtypes", [typeof (_a = typeof T !== "undefined" && T) === "function" ? _a : Object]),
200
+ __metadata("design:returntype", Promise)
201
+ ], FirestoreClient.prototype, "create", null);
202
+ __decorate([
203
+ traced(),
204
+ __metadata("design:type", Function),
205
+ __metadata("design:paramtypes", [typeof (_b = typeof T !== "undefined" && T) === "function" ? _b : Object]),
206
+ __metadata("design:returntype", Promise)
207
+ ], FirestoreClient.prototype, "update", null);
208
+ __decorate([
209
+ traced(),
210
+ __metadata("design:type", Function),
211
+ __metadata("design:paramtypes", [typeof (_c = typeof T !== "undefined" && T) === "function" ? _c : Object]),
212
+ __metadata("design:returntype", Promise)
213
+ ], FirestoreClient.prototype, "save", null);
214
+ __decorate([
215
+ traced(),
216
+ __metadata("design:type", Function),
217
+ __metadata("design:paramtypes", [Object, String]),
218
+ __metadata("design:returntype", Promise)
219
+ ], FirestoreClient.prototype, "delete", null);
220
+ __decorate([
221
+ traced(),
222
+ __metadata("design:type", Function),
223
+ __metadata("design:paramtypes", [Object, String, Object, Object]),
224
+ __metadata("design:returntype", Promise)
225
+ ], FirestoreClient.prototype, "findBySecondaryIndex", null);
226
+ FirestoreClient = __decorate([
227
+ tag("FirestoreClientInterface"),
228
+ moduleScoped(GcpModuleKeyname),
229
+ injectable(),
230
+ __param(0, inject("LogHandlerInterface")),
231
+ __param(1, injectConfig(GcpConfigurationKeys.ProjectId)),
232
+ __metadata("design:paramtypes", [Object, String])
233
+ ], FirestoreClient);
234
+ export { FirestoreClient };
235
+ //# sourceMappingURL=firestore.client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firestore.client.js","sourceRoot":"","sources":["../../../../src/clients/firestore.client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAAC,MA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