@nodestackapp/server 0.0.0-stage → 1.3.0

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 (348) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +181 -2
  3. package/bin/nodebase.js +4 -0
  4. package/bin/nodestack.js +21 -0
  5. package/dist/NodeBase.d.ts +2 -0
  6. package/dist/NodeBase.d.ts.map +1 -0
  7. package/dist/NodeBase.js +8 -0
  8. package/dist/NodeBase.js.map +1 -0
  9. package/dist/NodeStack.d.ts +106 -0
  10. package/dist/NodeStack.d.ts.map +1 -0
  11. package/dist/NodeStack.js +298 -0
  12. package/dist/NodeStack.js.map +1 -0
  13. package/dist/admin/AdminUIBundler.d.ts +8 -0
  14. package/dist/admin/AdminUIBundler.d.ts.map +1 -0
  15. package/dist/admin/AdminUIBundler.js +103 -0
  16. package/dist/admin/AdminUIBundler.js.map +1 -0
  17. package/dist/admin/AdminUIService.d.ts +30 -0
  18. package/dist/admin/AdminUIService.d.ts.map +1 -0
  19. package/dist/admin/AdminUIService.js +210 -0
  20. package/dist/admin/AdminUIService.js.map +1 -0
  21. package/dist/admin/DocsService.d.ts +29 -0
  22. package/dist/admin/DocsService.d.ts.map +1 -0
  23. package/dist/admin/DocsService.js +564 -0
  24. package/dist/admin/DocsService.js.map +1 -0
  25. package/dist/admin/ui/css/analytics.css +325 -0
  26. package/dist/admin/ui/css/main.css +2015 -0
  27. package/dist/admin/ui/css/rules.css +264 -0
  28. package/dist/admin/ui/css/webhooks.css +336 -0
  29. package/dist/admin/ui/favicon.svg +17 -0
  30. package/dist/admin/ui/icon.svg +17 -0
  31. package/dist/admin/ui/index.html +14584 -0
  32. package/dist/admin/ui/js/analytics.js +624 -0
  33. package/dist/admin/ui/js/api.js +353 -0
  34. package/dist/admin/ui/js/app.js +263 -0
  35. package/dist/admin/ui/js/apps.js +436 -0
  36. package/dist/admin/ui/js/collections.js +436 -0
  37. package/dist/admin/ui/js/command-palette.js +600 -0
  38. package/dist/admin/ui/js/demo.js +559 -0
  39. package/dist/admin/ui/js/modals.js +2379 -0
  40. package/dist/admin/ui/js/plugin-tester.js +559 -0
  41. package/dist/admin/ui/js/plugins.js +768 -0
  42. package/dist/admin/ui/js/records.js +1270 -0
  43. package/dist/admin/ui/js/rules.js +775 -0
  44. package/dist/admin/ui/js/schema.js +290 -0
  45. package/dist/admin/ui/js/state.js +140 -0
  46. package/dist/admin/ui/js/views.js +714 -0
  47. package/dist/admin/ui/js/webhooks.js +1086 -0
  48. package/dist/analytics/AnalyticsService.d.ts +62 -0
  49. package/dist/analytics/AnalyticsService.d.ts.map +1 -0
  50. package/dist/analytics/AnalyticsService.js +196 -0
  51. package/dist/analytics/AnalyticsService.js.map +1 -0
  52. package/dist/apps/AppManager.d.ts +28 -0
  53. package/dist/apps/AppManager.d.ts.map +1 -0
  54. package/dist/apps/AppManager.js +211 -0
  55. package/dist/apps/AppManager.js.map +1 -0
  56. package/dist/apps/AppRegistry.d.ts +27 -0
  57. package/dist/apps/AppRegistry.d.ts.map +1 -0
  58. package/dist/apps/AppRegistry.js +220 -0
  59. package/dist/apps/AppRegistry.js.map +1 -0
  60. package/dist/apps/AppScope.d.ts +55 -0
  61. package/dist/apps/AppScope.d.ts.map +1 -0
  62. package/dist/apps/AppScope.js +295 -0
  63. package/dist/apps/AppScope.js.map +1 -0
  64. package/dist/apps/index.d.ts +5 -0
  65. package/dist/apps/index.d.ts.map +1 -0
  66. package/dist/apps/index.js +21 -0
  67. package/dist/apps/index.js.map +1 -0
  68. package/dist/apps/models/App.d.ts +29 -0
  69. package/dist/apps/models/App.d.ts.map +1 -0
  70. package/dist/apps/models/App.js +3 -0
  71. package/dist/apps/models/App.js.map +1 -0
  72. package/dist/audit/AuditLogService.d.ts +68 -0
  73. package/dist/audit/AuditLogService.d.ts.map +1 -0
  74. package/dist/audit/AuditLogService.js +243 -0
  75. package/dist/audit/AuditLogService.js.map +1 -0
  76. package/dist/auth/AuthService.d.ts +35 -0
  77. package/dist/auth/AuthService.d.ts.map +1 -0
  78. package/dist/auth/AuthService.js +276 -0
  79. package/dist/auth/AuthService.js.map +1 -0
  80. package/dist/cli/cli.d.ts +3 -0
  81. package/dist/cli/cli.d.ts.map +1 -0
  82. package/dist/cli/cli.js +477 -0
  83. package/dist/cli/cli.js.map +1 -0
  84. package/dist/core/config/ConfigService.d.ts +41 -0
  85. package/dist/core/config/ConfigService.d.ts.map +1 -0
  86. package/dist/core/config/ConfigService.js +139 -0
  87. package/dist/core/config/ConfigService.js.map +1 -0
  88. package/dist/core/config/EnvLoader.d.ts +7 -0
  89. package/dist/core/config/EnvLoader.d.ts.map +1 -0
  90. package/dist/core/config/EnvLoader.js +84 -0
  91. package/dist/core/config/EnvLoader.js.map +1 -0
  92. package/dist/core/container/Container.d.ts +34 -0
  93. package/dist/core/container/Container.d.ts.map +1 -0
  94. package/dist/core/container/Container.js +98 -0
  95. package/dist/core/container/Container.js.map +1 -0
  96. package/dist/core/container/Tokens.d.ts +40 -0
  97. package/dist/core/container/Tokens.d.ts.map +1 -0
  98. package/dist/core/container/Tokens.js +40 -0
  99. package/dist/core/container/Tokens.js.map +1 -0
  100. package/dist/core/errors/AppError.d.ts +24 -0
  101. package/dist/core/errors/AppError.d.ts.map +1 -0
  102. package/dist/core/errors/AppError.js +52 -0
  103. package/dist/core/errors/AppError.js.map +1 -0
  104. package/dist/core/events/EventBus.d.ts +45 -0
  105. package/dist/core/events/EventBus.d.ts.map +1 -0
  106. package/dist/core/events/EventBus.js +360 -0
  107. package/dist/core/events/EventBus.js.map +1 -0
  108. package/dist/core/events/types.d.ts +35 -0
  109. package/dist/core/events/types.d.ts.map +1 -0
  110. package/dist/core/events/types.js +3 -0
  111. package/dist/core/events/types.js.map +1 -0
  112. package/dist/core/maintenance/MaintenanceGate.d.ts +65 -0
  113. package/dist/core/maintenance/MaintenanceGate.d.ts.map +1 -0
  114. package/dist/core/maintenance/MaintenanceGate.js +162 -0
  115. package/dist/core/maintenance/MaintenanceGate.js.map +1 -0
  116. package/dist/core/plugins/PluginManager.d.ts +150 -0
  117. package/dist/core/plugins/PluginManager.d.ts.map +1 -0
  118. package/dist/core/plugins/PluginManager.js +1592 -0
  119. package/dist/core/plugins/PluginManager.js.map +1 -0
  120. package/dist/core/plugins/types.d.ts +170 -0
  121. package/dist/core/plugins/types.d.ts.map +1 -0
  122. package/dist/core/plugins/types.js +3 -0
  123. package/dist/core/plugins/types.js.map +1 -0
  124. package/dist/database/DatabaseService.d.ts +27 -0
  125. package/dist/database/DatabaseService.d.ts.map +1 -0
  126. package/dist/database/DatabaseService.js +97 -0
  127. package/dist/database/DatabaseService.js.map +1 -0
  128. package/dist/database/drivers/IDatabaseDriver.d.ts +17 -0
  129. package/dist/database/drivers/IDatabaseDriver.d.ts.map +1 -0
  130. package/dist/database/drivers/IDatabaseDriver.js +3 -0
  131. package/dist/database/drivers/IDatabaseDriver.js.map +1 -0
  132. package/dist/database/drivers/NodeSqliteDriver.d.ts +16 -0
  133. package/dist/database/drivers/NodeSqliteDriver.d.ts.map +1 -0
  134. package/dist/database/drivers/NodeSqliteDriver.js +115 -0
  135. package/dist/database/drivers/NodeSqliteDriver.js.map +1 -0
  136. package/dist/database/migrations/SystemMigrations.d.ts +5 -0
  137. package/dist/database/migrations/SystemMigrations.d.ts.map +1 -0
  138. package/dist/database/migrations/SystemMigrations.js +164 -0
  139. package/dist/database/migrations/SystemMigrations.js.map +1 -0
  140. package/dist/demo/DemoService.d.ts +115 -0
  141. package/dist/demo/DemoService.d.ts.map +1 -0
  142. package/dist/demo/DemoService.js +427 -0
  143. package/dist/demo/DemoService.js.map +1 -0
  144. package/dist/files/FileStorageService.d.ts +35 -0
  145. package/dist/files/FileStorageService.d.ts.map +1 -0
  146. package/dist/files/FileStorageService.js +126 -0
  147. package/dist/files/FileStorageService.js.map +1 -0
  148. package/dist/http/HttpServer.d.ts +61 -0
  149. package/dist/http/HttpServer.d.ts.map +1 -0
  150. package/dist/http/HttpServer.js +478 -0
  151. package/dist/http/HttpServer.js.map +1 -0
  152. package/dist/http/controllers/AnalyticsController.d.ts +9 -0
  153. package/dist/http/controllers/AnalyticsController.d.ts.map +1 -0
  154. package/dist/http/controllers/AnalyticsController.js +18 -0
  155. package/dist/http/controllers/AnalyticsController.js.map +1 -0
  156. package/dist/http/controllers/AppController.d.ts +29 -0
  157. package/dist/http/controllers/AppController.d.ts.map +1 -0
  158. package/dist/http/controllers/AppController.js +36 -0
  159. package/dist/http/controllers/AppController.js.map +1 -0
  160. package/dist/http/controllers/AuditLogController.d.ts +26 -0
  161. package/dist/http/controllers/AuditLogController.d.ts.map +1 -0
  162. package/dist/http/controllers/AuditLogController.js +32 -0
  163. package/dist/http/controllers/AuditLogController.js.map +1 -0
  164. package/dist/http/controllers/AuthController.d.ts +18 -0
  165. package/dist/http/controllers/AuthController.d.ts.map +1 -0
  166. package/dist/http/controllers/AuthController.js +84 -0
  167. package/dist/http/controllers/AuthController.js.map +1 -0
  168. package/dist/http/controllers/BaseController.d.ts +7 -0
  169. package/dist/http/controllers/BaseController.d.ts.map +1 -0
  170. package/dist/http/controllers/BaseController.js +20 -0
  171. package/dist/http/controllers/BaseController.js.map +1 -0
  172. package/dist/http/controllers/CollectionController.d.ts +44 -0
  173. package/dist/http/controllers/CollectionController.d.ts.map +1 -0
  174. package/dist/http/controllers/CollectionController.js +89 -0
  175. package/dist/http/controllers/CollectionController.js.map +1 -0
  176. package/dist/http/controllers/DemoController.d.ts +34 -0
  177. package/dist/http/controllers/DemoController.d.ts.map +1 -0
  178. package/dist/http/controllers/DemoController.js +55 -0
  179. package/dist/http/controllers/DemoController.js.map +1 -0
  180. package/dist/http/controllers/FileController.d.ts +29 -0
  181. package/dist/http/controllers/FileController.d.ts.map +1 -0
  182. package/dist/http/controllers/FileController.js +172 -0
  183. package/dist/http/controllers/FileController.js.map +1 -0
  184. package/dist/http/controllers/HealthController.d.ts +10 -0
  185. package/dist/http/controllers/HealthController.d.ts.map +1 -0
  186. package/dist/http/controllers/HealthController.js +28 -0
  187. package/dist/http/controllers/HealthController.js.map +1 -0
  188. package/dist/http/controllers/LogController.d.ts +15 -0
  189. package/dist/http/controllers/LogController.d.ts.map +1 -0
  190. package/dist/http/controllers/LogController.js +25 -0
  191. package/dist/http/controllers/LogController.js.map +1 -0
  192. package/dist/http/controllers/RealtimeController.d.ts +13 -0
  193. package/dist/http/controllers/RealtimeController.d.ts.map +1 -0
  194. package/dist/http/controllers/RealtimeController.js +54 -0
  195. package/dist/http/controllers/RealtimeController.js.map +1 -0
  196. package/dist/http/controllers/RecordController.d.ts +74 -0
  197. package/dist/http/controllers/RecordController.d.ts.map +1 -0
  198. package/dist/http/controllers/RecordController.js +202 -0
  199. package/dist/http/controllers/RecordController.js.map +1 -0
  200. package/dist/http/controllers/TemplateController.d.ts +29 -0
  201. package/dist/http/controllers/TemplateController.d.ts.map +1 -0
  202. package/dist/http/controllers/TemplateController.js +63 -0
  203. package/dist/http/controllers/TemplateController.js.map +1 -0
  204. package/dist/http/controllers/WebhookController.d.ts +78 -0
  205. package/dist/http/controllers/WebhookController.d.ts.map +1 -0
  206. package/dist/http/controllers/WebhookController.js +113 -0
  207. package/dist/http/controllers/WebhookController.js.map +1 -0
  208. package/dist/http/middleware/AppResolutionMiddleware.d.ts +8 -0
  209. package/dist/http/middleware/AppResolutionMiddleware.d.ts.map +1 -0
  210. package/dist/http/middleware/AppResolutionMiddleware.js +98 -0
  211. package/dist/http/middleware/AppResolutionMiddleware.js.map +1 -0
  212. package/dist/http/middleware/AuthMiddleware.d.ts +17 -0
  213. package/dist/http/middleware/AuthMiddleware.d.ts.map +1 -0
  214. package/dist/http/middleware/AuthMiddleware.js +97 -0
  215. package/dist/http/middleware/AuthMiddleware.js.map +1 -0
  216. package/dist/http/middleware/ChaosMiddleware.d.ts +130 -0
  217. package/dist/http/middleware/ChaosMiddleware.d.ts.map +1 -0
  218. package/dist/http/middleware/ChaosMiddleware.js +434 -0
  219. package/dist/http/middleware/ChaosMiddleware.js.map +1 -0
  220. package/dist/index.d.ts +52 -0
  221. package/dist/index.d.ts.map +1 -0
  222. package/dist/index.js +141 -0
  223. package/dist/index.js.map +1 -0
  224. package/dist/logger/LogService.d.ts +31 -0
  225. package/dist/logger/LogService.d.ts.map +1 -0
  226. package/dist/logger/LogService.js +104 -0
  227. package/dist/logger/LogService.js.map +1 -0
  228. package/dist/plugins/algolia.d.ts +76 -0
  229. package/dist/plugins/algolia.d.ts.map +1 -0
  230. package/dist/plugins/algolia.js +532 -0
  231. package/dist/plugins/algolia.js.map +1 -0
  232. package/dist/plugins/index.d.ts +6 -0
  233. package/dist/plugins/index.d.ts.map +1 -0
  234. package/dist/plugins/index.js +22 -0
  235. package/dist/plugins/index.js.map +1 -0
  236. package/dist/plugins/resend.d.ts +42 -0
  237. package/dist/plugins/resend.d.ts.map +1 -0
  238. package/dist/plugins/resend.js +335 -0
  239. package/dist/plugins/resend.js.map +1 -0
  240. package/dist/plugins/s3.d.ts +35 -0
  241. package/dist/plugins/s3.d.ts.map +1 -0
  242. package/dist/plugins/s3.js +425 -0
  243. package/dist/plugins/s3.js.map +1 -0
  244. package/dist/plugins/stripe.d.ts +45 -0
  245. package/dist/plugins/stripe.d.ts.map +1 -0
  246. package/dist/plugins/stripe.js +470 -0
  247. package/dist/plugins/stripe.js.map +1 -0
  248. package/dist/plugins/webhooks.d.ts +35 -0
  249. package/dist/plugins/webhooks.d.ts.map +1 -0
  250. package/dist/plugins/webhooks.js +415 -0
  251. package/dist/plugins/webhooks.js.map +1 -0
  252. package/dist/realtime/RealtimeService.d.ts +26 -0
  253. package/dist/realtime/RealtimeService.d.ts.map +1 -0
  254. package/dist/realtime/RealtimeService.js +165 -0
  255. package/dist/realtime/RealtimeService.js.map +1 -0
  256. package/dist/records/CsvHelper.d.ts +27 -0
  257. package/dist/records/CsvHelper.d.ts.map +1 -0
  258. package/dist/records/CsvHelper.js +195 -0
  259. package/dist/records/CsvHelper.js.map +1 -0
  260. package/dist/records/FakerEngine.d.ts +73 -0
  261. package/dist/records/FakerEngine.d.ts.map +1 -0
  262. package/dist/records/FakerEngine.js +644 -0
  263. package/dist/records/FakerEngine.js.map +1 -0
  264. package/dist/records/FilterCodec.d.ts +22 -0
  265. package/dist/records/FilterCodec.d.ts.map +1 -0
  266. package/dist/records/FilterCodec.js +57 -0
  267. package/dist/records/FilterCodec.js.map +1 -0
  268. package/dist/records/FtsService.d.ts +63 -0
  269. package/dist/records/FtsService.d.ts.map +1 -0
  270. package/dist/records/FtsService.js +310 -0
  271. package/dist/records/FtsService.js.map +1 -0
  272. package/dist/records/MockDataService.d.ts +31 -0
  273. package/dist/records/MockDataService.d.ts.map +1 -0
  274. package/dist/records/MockDataService.js +222 -0
  275. package/dist/records/MockDataService.js.map +1 -0
  276. package/dist/records/QueryFilterParser.d.ts +35 -0
  277. package/dist/records/QueryFilterParser.d.ts.map +1 -0
  278. package/dist/records/QueryFilterParser.js +262 -0
  279. package/dist/records/QueryFilterParser.js.map +1 -0
  280. package/dist/records/RecordService.d.ts +77 -0
  281. package/dist/records/RecordService.d.ts.map +1 -0
  282. package/dist/records/RecordService.js +686 -0
  283. package/dist/records/RecordService.js.map +1 -0
  284. package/dist/rules/RuleBuilder.d.ts +72 -0
  285. package/dist/rules/RuleBuilder.d.ts.map +1 -0
  286. package/dist/rules/RuleBuilder.js +383 -0
  287. package/dist/rules/RuleBuilder.js.map +1 -0
  288. package/dist/rules/RuleEngine.d.ts +28 -0
  289. package/dist/rules/RuleEngine.d.ts.map +1 -0
  290. package/dist/rules/RuleEngine.js +204 -0
  291. package/dist/rules/RuleEngine.js.map +1 -0
  292. package/dist/schema/OpenApiGenerator.d.ts +32 -0
  293. package/dist/schema/OpenApiGenerator.d.ts.map +1 -0
  294. package/dist/schema/OpenApiGenerator.js +1836 -0
  295. package/dist/schema/OpenApiGenerator.js.map +1 -0
  296. package/dist/schema/SchemaInferenceService.d.ts +82 -0
  297. package/dist/schema/SchemaInferenceService.d.ts.map +1 -0
  298. package/dist/schema/SchemaInferenceService.js +622 -0
  299. package/dist/schema/SchemaInferenceService.js.map +1 -0
  300. package/dist/schema/SchemaService.d.ts +33 -0
  301. package/dist/schema/SchemaService.d.ts.map +1 -0
  302. package/dist/schema/SchemaService.js +338 -0
  303. package/dist/schema/SchemaService.js.map +1 -0
  304. package/dist/schema/TypeGenerator.d.ts +19 -0
  305. package/dist/schema/TypeGenerator.d.ts.map +1 -0
  306. package/dist/schema/TypeGenerator.js +173 -0
  307. package/dist/schema/TypeGenerator.js.map +1 -0
  308. package/dist/schema/models/Collection.d.ts +44 -0
  309. package/dist/schema/models/Collection.d.ts.map +1 -0
  310. package/dist/schema/models/Collection.js +3 -0
  311. package/dist/schema/models/Collection.js.map +1 -0
  312. package/dist/schema/models/Field.d.ts +25 -0
  313. package/dist/schema/models/Field.d.ts.map +1 -0
  314. package/dist/schema/models/Field.js +3 -0
  315. package/dist/schema/models/Field.js.map +1 -0
  316. package/dist/templates/TemplateImageGenerator.d.ts +43 -0
  317. package/dist/templates/TemplateImageGenerator.d.ts.map +1 -0
  318. package/dist/templates/TemplateImageGenerator.js +350 -0
  319. package/dist/templates/TemplateImageGenerator.js.map +1 -0
  320. package/dist/templates/TemplateService.d.ts +31 -0
  321. package/dist/templates/TemplateService.d.ts.map +1 -0
  322. package/dist/templates/TemplateService.js +209 -0
  323. package/dist/templates/TemplateService.js.map +1 -0
  324. package/dist/templates/definitions/blog.d.ts +3 -0
  325. package/dist/templates/definitions/blog.d.ts.map +1 -0
  326. package/dist/templates/definitions/blog.js +386 -0
  327. package/dist/templates/definitions/blog.js.map +1 -0
  328. package/dist/templates/definitions/crm.d.ts +3 -0
  329. package/dist/templates/definitions/crm.d.ts.map +1 -0
  330. package/dist/templates/definitions/crm.js +456 -0
  331. package/dist/templates/definitions/crm.js.map +1 -0
  332. package/dist/templates/definitions/ecommerce.d.ts +3 -0
  333. package/dist/templates/definitions/ecommerce.d.ts.map +1 -0
  334. package/dist/templates/definitions/ecommerce.js +781 -0
  335. package/dist/templates/definitions/ecommerce.js.map +1 -0
  336. package/dist/templates/definitions/index.d.ts +7 -0
  337. package/dist/templates/definitions/index.d.ts.map +1 -0
  338. package/dist/templates/definitions/index.js +15 -0
  339. package/dist/templates/definitions/index.js.map +1 -0
  340. package/dist/templates/types.d.ts +65 -0
  341. package/dist/templates/types.d.ts.map +1 -0
  342. package/dist/templates/types.js +3 -0
  343. package/dist/templates/types.js.map +1 -0
  344. package/dist/webhooks/WebhookService.d.ts +149 -0
  345. package/dist/webhooks/WebhookService.d.ts.map +1 -0
  346. package/dist/webhooks/WebhookService.js +781 -0
  347. package/dist/webhooks/WebhookService.js.map +1 -0
  348. package/package.json +86 -4
@@ -0,0 +1,470 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.StripeService = void 0;
37
+ exports.stripePlugin = stripePlugin;
38
+ const crypto = __importStar(require("crypto"));
39
+ class StripeService {
40
+ options;
41
+ constructor(options = {}) {
42
+ this.options = { ...options };
43
+ }
44
+ updateOptions(newOpts) {
45
+ this.options = { ...this.options, ...newOpts };
46
+ }
47
+ isLiveMode() {
48
+ return Boolean(this.options.secretKey && this.options.secretKey.startsWith('sk_live_'));
49
+ }
50
+ isConfigured() {
51
+ return Boolean((this.options.secretKey && this.options.secretKey.trim() !== '') ||
52
+ this.options.dryRun);
53
+ }
54
+ isTestMode() {
55
+ return this.isConfigured() && !this.isLiveMode();
56
+ }
57
+ getBaseUrl() {
58
+ if (this.options.endpoint) {
59
+ return this.options.endpoint.replace(/\/+$/, '');
60
+ }
61
+ return 'https://api.stripe.com';
62
+ }
63
+ async createCheckoutSession(params) {
64
+ const currency = (params.currency || this.options.currency || 'usd').toLowerCase();
65
+ const isTest = this.isTestMode();
66
+ if (this.options.dryRun) {
67
+ const prefix = isTest ? 'cs_test_' : 'cs_live_';
68
+ const id = `${prefix}${crypto.randomBytes(12).toString('hex')}`;
69
+ return {
70
+ id,
71
+ url: `https://checkout.stripe.com/pay/${id}`,
72
+ amount: params.amount,
73
+ currency,
74
+ customerEmail: params.email,
75
+ status: 'open',
76
+ livemode: !isTest,
77
+ };
78
+ }
79
+ if (!this.options.secretKey || !this.options.secretKey.trim()) {
80
+ const err = new Error('Stripe Secret Key is not configured. Please enter your Stripe Secret Key (sk_test_... or sk_live_...) in the extension configuration.');
81
+ err.status = 400;
82
+ throw err;
83
+ }
84
+ const fetchFn = this.options.fetch || globalThis.fetch;
85
+ if (!fetchFn) {
86
+ throw new Error('[StripeService] Global fetch is not available');
87
+ }
88
+ const url = `${this.getBaseUrl()}/v1/checkout/sessions`;
89
+ // Stripe API uses application/x-www-form-urlencoded
90
+ const form = new URLSearchParams();
91
+ form.append('mode', 'payment');
92
+ form.append('success_url', params.successUrl || 'https://localhost:3000/success?session_id={CHECKOUT_SESSION_ID}');
93
+ form.append('cancel_url', params.cancelUrl || 'https://localhost:3000/cancel');
94
+ if (params.email) {
95
+ form.append('customer_email', params.email);
96
+ }
97
+ if (params.customerId) {
98
+ form.append('customer', params.customerId);
99
+ }
100
+ form.append('line_items[0][price_data][currency]', currency);
101
+ form.append('line_items[0][price_data][unit_amount]', String(Math.round(params.amount)));
102
+ form.append('line_items[0][price_data][product_data][name]', params.productName || 'Payment');
103
+ form.append('line_items[0][quantity]', '1');
104
+ const res = await fetchFn(url, {
105
+ method: 'POST',
106
+ headers: {
107
+ 'Authorization': `Bearer ${this.options.secretKey}`,
108
+ 'Content-Type': 'application/x-www-form-urlencoded',
109
+ },
110
+ body: form.toString(),
111
+ });
112
+ if (!res.ok) {
113
+ const errData = await res.json().catch(() => null);
114
+ const errMsg = errData?.error?.message || (await res.text().catch(() => '')) || res.statusText;
115
+ const error = new Error(`Stripe API error (${res.status}): ${errMsg}`);
116
+ error.status = res.status;
117
+ error.response = errData;
118
+ throw error;
119
+ }
120
+ const data = await res.json();
121
+ return {
122
+ id: data.id,
123
+ url: data.url || `https://checkout.stripe.com/pay/${data.id}`,
124
+ amount: typeof data.amount_total === 'number' ? data.amount_total : params.amount,
125
+ currency: data.currency || currency,
126
+ customerEmail: data.customer_email || params.email,
127
+ status: data.status || 'open',
128
+ livemode: Boolean(data.livemode),
129
+ };
130
+ }
131
+ verifyWebhookSignature(rawBody, signatureHeader, secret, toleranceSeconds = 300) {
132
+ const webhookSecret = secret || this.options.webhookSecret;
133
+ if (!webhookSecret || !signatureHeader) {
134
+ return false;
135
+ }
136
+ const parts = signatureHeader.split(',');
137
+ let timestamp = null;
138
+ const signatures = [];
139
+ for (const part of parts) {
140
+ const idx = part.indexOf('=');
141
+ if (idx === -1)
142
+ continue;
143
+ const key = part.slice(0, idx).trim();
144
+ const val = part.slice(idx + 1).trim();
145
+ if (key === 't') {
146
+ timestamp = parseInt(val, 10);
147
+ }
148
+ else if (key === 'v1' && val) {
149
+ signatures.push(val);
150
+ }
151
+ }
152
+ if (!timestamp || signatures.length === 0 || isNaN(timestamp)) {
153
+ return false;
154
+ }
155
+ if (toleranceSeconds > 0) {
156
+ const now = Math.floor(Date.now() / 1000);
157
+ if (Math.abs(now - timestamp) > toleranceSeconds) {
158
+ return false;
159
+ }
160
+ }
161
+ const bodyStr = typeof rawBody === 'string' ? rawBody : rawBody.toString('utf8');
162
+ const signedPayload = `${timestamp}.${bodyStr}`;
163
+ const expectedSignature = crypto
164
+ .createHmac('sha256', webhookSecret)
165
+ .update(signedPayload, 'utf8')
166
+ .digest('hex');
167
+ const expectedBuffer = Buffer.from(expectedSignature, 'utf8');
168
+ for (const sig of signatures) {
169
+ const sigBuffer = Buffer.from(sig, 'utf8');
170
+ if (sigBuffer.length === expectedBuffer.length &&
171
+ crypto.timingSafeEqual(sigBuffer, expectedBuffer)) {
172
+ return true;
173
+ }
174
+ }
175
+ return false;
176
+ }
177
+ generateWebhookSignature(rawBody, secret, timestamp) {
178
+ const webhookSecret = secret || this.options.webhookSecret;
179
+ if (!webhookSecret) {
180
+ throw new Error('[StripeService] webhookSecret is required to generate a signature');
181
+ }
182
+ const t = timestamp || Math.floor(Date.now() / 1000);
183
+ const bodyStr = typeof rawBody === 'string' ? rawBody : rawBody.toString('utf8');
184
+ const signedPayload = `${t}.${bodyStr}`;
185
+ const signature = crypto
186
+ .createHmac('sha256', webhookSecret)
187
+ .update(signedPayload, 'utf8')
188
+ .digest('hex');
189
+ return `t=${t},v1=${signature}`;
190
+ }
191
+ }
192
+ exports.StripeService = StripeService;
193
+ function stripePlugin(options = {}) {
194
+ const secretKey = options?.secretKey || process.env.STRIPE_SECRET_KEY || '';
195
+ const customersCol = options?.customersCollection || '_stripe_customers';
196
+ const paymentsCol = options?.paymentsCollection || '_stripe_payments';
197
+ const stripeService = new StripeService({ ...options, secretKey });
198
+ let currentContext = null;
199
+ const isConfigured = stripeService.isConfigured();
200
+ const isLive = stripeService.isLiveMode();
201
+ const navItem = {
202
+ id: 'stripe',
203
+ title: 'Stripe Payments',
204
+ badge: !isConfigured ? 'UNCONFIGURED' : isLive ? 'LIVE' : 'TEST MODE',
205
+ badgeVariant: !isConfigured ? 'warning' : isLive ? 'danger' : 'warning',
206
+ icon: `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="5" width="20" height="14" rx="2"/><line x1="2" y1="10" x2="22" y2="10"/></svg>`,
207
+ view: {
208
+ title: 'Stripe Payment Extension',
209
+ description: !isConfigured
210
+ ? 'Unconfigured — Stripe Secret Key (sk_test_... or sk_live_...) required.'
211
+ : `Configured in ${isLive ? 'Live Mode' : 'Test Mode'} with collections ${customersCol} & ${paymentsCol}.`,
212
+ html: `
213
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem;">
214
+ <div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
215
+ <div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Webhook Route</div>
216
+ <div style="font-size: 13px; font-weight: 700; color: #60a5fa; font-family: monospace; margin-top: 4px;">POST /api/stripe/webhook</div>
217
+ </div>
218
+ <div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
219
+ <div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Customer Table</div>
220
+ <div style="font-size: 13px; font-weight: 700; color: #34d399; font-family: monospace; margin-top: 4px;">${customersCol}</div>
221
+ </div>
222
+ <div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
223
+ <div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Payments Table</div>
224
+ <div style="font-size: 13px; font-weight: 700; color: #34d399; font-family: monospace; margin-top: 4px;">${paymentsCol}</div>
225
+ </div>
226
+ </div>
227
+ `,
228
+ },
229
+ };
230
+ const plugin = {
231
+ name: 'stripe',
232
+ version: '1.0.0',
233
+ description: 'Stripe payments, checkout sessions, customer billing & webhook events',
234
+ codeOptions: { ...(options || {}) },
235
+ buildAdminNavItems(cfg) {
236
+ const secKey = cfg.secretKey !== undefined ? cfg.secretKey : (options?.secretKey || '');
237
+ const isNowConfigured = Boolean((secKey && String(secKey).trim()) || cfg.dryRun || options?.dryRun);
238
+ const isNowLive = Boolean(secKey && String(secKey).startsWith('sk_live_'));
239
+ return [{
240
+ id: 'stripe',
241
+ title: 'Stripe Payments',
242
+ badge: !isNowConfigured ? 'UNCONFIGURED' : isNowLive ? 'LIVE' : 'TEST MODE',
243
+ badgeVariant: !isNowConfigured ? 'warning' : isNowLive ? 'danger' : 'warning',
244
+ icon: `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="5" width="20" height="14" rx="2"/><line x1="2" y1="10" x2="22" y2="10"/></svg>`,
245
+ view: {
246
+ title: 'Stripe Payment Extension',
247
+ description: !isNowConfigured
248
+ ? 'Unconfigured — Stripe Secret Key (sk_test_... or sk_live_...) required.'
249
+ : `Configured in ${isNowLive ? 'Live Mode' : 'Test Mode'} with collections ${customersCol} & ${paymentsCol}.`,
250
+ html: `
251
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem;">
252
+ <div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
253
+ <div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Webhook Route</div>
254
+ <div style="font-size: 13px; font-weight: 700; color: #60a5fa; font-family: monospace; margin-top: 4px;">POST /api/stripe/webhook</div>
255
+ </div>
256
+ <div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
257
+ <div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Customer Table</div>
258
+ <div style="font-size: 13px; font-weight: 700; color: #34d399; font-family: monospace; margin-top: 4px;">${customersCol}</div>
259
+ </div>
260
+ <div style="background: var(--bg-input); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 0.85rem 1rem;">
261
+ <div style="font-size: 11px; color: var(--text-muted); text-transform: uppercase;">Payments Table</div>
262
+ <div style="font-size: 13px; font-weight: 700; color: #34d399; font-family: monospace; margin-top: 4px;">${paymentsCol}</div>
263
+ </div>
264
+ </div>
265
+ `,
266
+ },
267
+ }];
268
+ },
269
+ configSchema: {
270
+ fields: [
271
+ {
272
+ name: 'secretKey',
273
+ label: 'Stripe Secret Key',
274
+ type: 'password',
275
+ envKey: 'STRIPE_SECRET_KEY',
276
+ placeholder: 'sk_test_... or sk_live_...',
277
+ description: 'Used for Stripe Checkout sessions and payment processing',
278
+ required: true,
279
+ },
280
+ {
281
+ name: 'webhookSecret',
282
+ label: 'Webhook Signing Secret',
283
+ type: 'password',
284
+ envKey: 'STRIPE_WEBHOOK_SECRET',
285
+ placeholder: 'whsec_...',
286
+ description: 'Used to verify incoming Stripe webhook event signatures',
287
+ },
288
+ {
289
+ name: 'currency',
290
+ label: 'Default Currency',
291
+ type: 'text',
292
+ envKey: 'STRIPE_CURRENCY',
293
+ defaultValue: 'usd',
294
+ placeholder: 'usd',
295
+ description: 'Standard 3-letter ISO currency code (usd, eur, gbp, etc.)',
296
+ },
297
+ {
298
+ name: 'endpoint',
299
+ label: 'Custom API Endpoint',
300
+ type: 'text',
301
+ envKey: 'STRIPE_ENDPOINT',
302
+ placeholder: 'https://api.stripe.com',
303
+ description: 'Custom Stripe base endpoint for proxies or local mocks',
304
+ },
305
+ {
306
+ name: 'dryRun',
307
+ label: 'Dry Run Simulation',
308
+ type: 'boolean',
309
+ defaultValue: false,
310
+ description: 'Simulate checkout sessions without calling Stripe live API',
311
+ },
312
+ ],
313
+ },
314
+ onConfigUpdate(newConfig) {
315
+ stripeService.updateOptions(newConfig);
316
+ const isNowConfigured = stripeService.isConfigured();
317
+ const isNowLive = stripeService.isLiveMode();
318
+ navItem.badge = !isNowConfigured ? 'UNCONFIGURED' : isNowLive ? 'LIVE' : 'TEST MODE';
319
+ navItem.badgeVariant = !isNowConfigured ? 'warning' : isNowLive ? 'danger' : 'warning';
320
+ if (typeof navItem.view === 'object' && navItem.view) {
321
+ navItem.view.description = !isNowConfigured
322
+ ? 'Unconfigured — Stripe Secret Key (sk_test_... or sk_live_...) required.'
323
+ : `Configured in ${isNowLive ? 'Live Mode' : 'Test Mode'} with collections ${customersCol} & ${paymentsCol}.`;
324
+ }
325
+ if (currentContext) {
326
+ currentContext.registerAdminNav(navItem);
327
+ }
328
+ },
329
+ collections: [
330
+ {
331
+ name: customersCol,
332
+ type: 'base',
333
+ system: true,
334
+ schema: [
335
+ { id: 'f_cust_id', name: 'customerId', type: 'text', required: true, unique: true },
336
+ { id: 'f_email', name: 'email', type: 'email', required: true },
337
+ { id: 'f_user_id', name: 'userId', type: 'text', required: false },
338
+ { id: 'f_sub_id', name: 'subscriptionId', type: 'text', required: false },
339
+ { id: 'f_sub_status', name: 'subscriptionStatus', type: 'text', required: false },
340
+ { id: 'f_plan', name: 'plan', type: 'text', required: false },
341
+ ],
342
+ },
343
+ {
344
+ name: paymentsCol,
345
+ type: 'base',
346
+ system: true,
347
+ schema: [
348
+ { id: 'f_pi_id', name: 'paymentIntentId', type: 'text', required: true, unique: true },
349
+ { id: 'f_cust_ref', name: 'customerId', type: 'text', required: false },
350
+ { id: 'f_amount', name: 'amount', type: 'number', required: true },
351
+ { id: 'f_curr', name: 'currency', type: 'text', required: false, defaultValue: 'usd' },
352
+ { id: 'f_status', name: 'status', type: 'text', required: true },
353
+ ],
354
+ },
355
+ ],
356
+ adminNavItems: [navItem],
357
+ register(ctx) {
358
+ currentContext = ctx;
359
+ // 1. Bind service into container
360
+ ctx.bindService(Symbol.for('StripeService'), stripeService);
361
+ const getScopedStripe = (req) => {
362
+ const targetDb = req.appScope?.db;
363
+ const records = req.appScope?.records || ctx.app.records;
364
+ if (!targetDb || !ctx.app.plugins?.getEffectiveConfig) {
365
+ return { service: stripeService, records };
366
+ }
367
+ const appConfig = ctx.app.plugins.getEffectiveConfig('stripe', targetDb);
368
+ const scopedService = new StripeService({
369
+ ...options,
370
+ ...appConfig,
371
+ });
372
+ return { service: scopedService, records };
373
+ };
374
+ // 2. Register custom developer endpoints
375
+ ctx.registerRoute('GET', '/api/stripe/status', async (req, reply) => {
376
+ const { service: activeStripe } = getScopedStripe(req);
377
+ const isCurrentConfigured = activeStripe.isConfigured();
378
+ const isCurrentTest = activeStripe.isTestMode();
379
+ const isCurrentLive = activeStripe.isLiveMode();
380
+ return reply.send({
381
+ enabled: true,
382
+ configured: isCurrentConfigured,
383
+ testMode: isCurrentTest,
384
+ liveMode: isCurrentLive,
385
+ currency: activeStripe.options.currency || 'usd',
386
+ customersCollection: customersCol,
387
+ paymentsCollection: paymentsCol,
388
+ });
389
+ });
390
+ ctx.registerRoute('POST', '/api/stripe/checkout-session', async (req, reply) => {
391
+ const { service: activeStripe } = getScopedStripe(req);
392
+ const body = req.body || {};
393
+ if (!body.email || !body.amount) {
394
+ return reply.status(400).send({
395
+ statusCode: 400,
396
+ message: 'email and amount are required to create a checkout session',
397
+ });
398
+ }
399
+ try {
400
+ const session = await activeStripe.createCheckoutSession(body);
401
+ return reply.status(201).send(session);
402
+ }
403
+ catch (err) {
404
+ const statusCode = typeof err.status === 'number' && err.status >= 400 && err.status < 600
405
+ ? err.status
406
+ : 502;
407
+ return reply.status(statusCode).send({
408
+ statusCode,
409
+ message: err.message || 'Failed to create Stripe checkout session',
410
+ });
411
+ }
412
+ });
413
+ const captureRawBody = async (req, _reply, payload) => {
414
+ let data = '';
415
+ for await (const chunk of payload) {
416
+ data += chunk;
417
+ }
418
+ req.rawBody = data;
419
+ const { Readable } = await import('stream');
420
+ return Readable.from([data]);
421
+ };
422
+ ctx.registerRoute('POST', '/api/stripe/webhook', async (req, reply) => {
423
+ const { service: activeStripe, records } = getScopedStripe(req);
424
+ const webhookSecret = activeStripe.options.webhookSecret || options.webhookSecret || process.env.STRIPE_WEBHOOK_SECRET;
425
+ if (webhookSecret) {
426
+ const sigHeader = req.headers['stripe-signature'] || '';
427
+ if (!sigHeader) {
428
+ return reply.status(400).send({
429
+ statusCode: 400,
430
+ message: 'Missing stripe-signature header',
431
+ });
432
+ }
433
+ const rawBody = req.rawBody ||
434
+ (typeof req.body === 'string' ? req.body : JSON.stringify(req.body));
435
+ const isValid = activeStripe.verifyWebhookSignature(rawBody, sigHeader, webhookSecret);
436
+ if (!isValid) {
437
+ return reply.status(400).send({
438
+ statusCode: 400,
439
+ message: 'Invalid stripe webhook signature',
440
+ });
441
+ }
442
+ }
443
+ const payload = req.body || {};
444
+ const eventType = payload.type || 'payment_intent.succeeded';
445
+ const dataObject = payload.data?.object || payload;
446
+ // Auto-record payment if payment_intent
447
+ if (eventType === 'payment_intent.succeeded' || eventType === 'checkout.session.completed') {
448
+ const piId = dataObject.id || `pi_${crypto.randomBytes(8).toString('hex')}`;
449
+ try {
450
+ await records.create(paymentsCol, {
451
+ paymentIntentId: piId,
452
+ customerId: dataObject.customer || '',
453
+ amount: dataObject.amount || 0,
454
+ currency: dataObject.currency || activeStripe.options.currency || options.currency || 'usd',
455
+ status: 'succeeded',
456
+ });
457
+ }
458
+ catch (e) {
459
+ // Already recorded or validation notice
460
+ }
461
+ }
462
+ // Trigger custom EventBus event for developers to subscribe
463
+ await ctx.eventBus.emit('stripe:webhook', { type: eventType, data: dataObject });
464
+ return reply.send({ received: true, event: eventType });
465
+ }, { preParsing: captureRawBody });
466
+ },
467
+ };
468
+ return plugin;
469
+ }
470
+ //# sourceMappingURL=stripe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripe.js","sourceRoot":"","sources":["../../src/plugins/stripe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,MAAM,mCAAe;AA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,cAAc,EAAE,CAC/B,CAAC;QACJ,CAAC;KACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { INodeStackPlugin } from '../core/plugins/types';
2
+ export interface WebhookPluginOptions {
3
+ discordWebhookUrl?: string;
4
+ slackWebhookUrl?: string;
5
+ collections?: string[];
6
+ events?: Array<'create' | 'update' | 'delete'>;
7
+ collectionName?: string;
8
+ /** Authentication policy for action routes (e.g., /api/webhooks/test): 'admin' (default), 'adminOrInitial', 'user', or 'public' */
9
+ authPolicy?: 'admin' | 'adminOrInitial' | 'user' | 'public';
10
+ /** Custom fetch implementation (defaults to globalThis.fetch) */
11
+ fetch?: typeof fetch;
12
+ /** Run in dry-run mode without making outbound network calls */
13
+ dryRun?: boolean;
14
+ }
15
+ export interface WebhookDispatchResult {
16
+ id: string;
17
+ platform: 'discord' | 'slack';
18
+ payload: any;
19
+ status: 'dispatched' | 'failed';
20
+ statusCode?: number;
21
+ error?: string;
22
+ timestamp: string;
23
+ }
24
+ export declare class WebhookNotificationService {
25
+ dispatched: WebhookDispatchResult[];
26
+ options: WebhookPluginOptions;
27
+ constructor(options?: WebhookPluginOptions);
28
+ updateOptions(newOpts: Partial<WebhookPluginOptions>): void;
29
+ getWebhookUrl(platform: 'discord' | 'slack'): string | undefined;
30
+ getActivePlatforms(): Array<'discord' | 'slack'>;
31
+ formatPayload(platform: 'discord' | 'slack', payload: any): Record<string, any>;
32
+ dispatch(platform: 'discord' | 'slack', payload: any, customUrl?: string): Promise<WebhookDispatchResult>;
33
+ }
34
+ export declare function webhookPlugin(options?: WebhookPluginOptions): INodeStackPlugin;
35
+ //# sourceMappingURL=webhooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/plugins/webhooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAwC,MAAM,uBAAuB,CAAC;AAE/F,MAAM,WAAW,oBAAo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