@powerhousedao/reactor-api 6.0.0-staging.3 → 6.0.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 (338) hide show
  1. package/README.md +6 -0
  2. package/dist/index.d.mts +3085 -0
  3. package/dist/index.d.mts.map +1 -0
  4. package/dist/index.mjs +6720 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/src/packages/https-hooks.d.mts +39 -0
  7. package/dist/src/packages/https-hooks.d.mts.map +1 -0
  8. package/dist/src/packages/https-hooks.mjs +82 -0
  9. package/dist/src/packages/https-hooks.mjs.map +1 -0
  10. package/dist/src/packages/vite-loader.d.mts +29 -0
  11. package/dist/src/packages/vite-loader.d.mts.map +1 -0
  12. package/dist/src/packages/vite-loader.mjs +145 -0
  13. package/dist/src/packages/vite-loader.mjs.map +1 -0
  14. package/dist/types-Do4QTfT3.d.mts +37 -0
  15. package/dist/types-Do4QTfT3.d.mts.map +1 -0
  16. package/dist/utils-BFkbSO_H.mjs +296 -0
  17. package/dist/utils-BFkbSO_H.mjs.map +1 -0
  18. package/package.json +60 -42
  19. package/dist/codegen.d.ts +0 -4
  20. package/dist/codegen.d.ts.map +0 -1
  21. package/dist/codegen.js +0 -38
  22. package/dist/codegen.js.map +0 -1
  23. package/dist/index.d.ts +0 -14
  24. package/dist/index.d.ts.map +0 -1
  25. package/dist/index.js +0 -14
  26. package/dist/index.js.map +0 -1
  27. package/dist/src/config.d.ts +0 -6
  28. package/dist/src/config.d.ts.map +0 -1
  29. package/dist/src/config.js +0 -6
  30. package/dist/src/config.js.map +0 -1
  31. package/dist/src/graphql/analytics-subgraph.d.ts +0 -14
  32. package/dist/src/graphql/analytics-subgraph.d.ts.map +0 -1
  33. package/dist/src/graphql/analytics-subgraph.js +0 -26
  34. package/dist/src/graphql/analytics-subgraph.js.map +0 -1
  35. package/dist/src/graphql/auth/index.d.ts +0 -2
  36. package/dist/src/graphql/auth/index.d.ts.map +0 -1
  37. package/dist/src/graphql/auth/index.js +0 -2
  38. package/dist/src/graphql/auth/index.js.map +0 -1
  39. package/dist/src/graphql/auth/resolvers.d.ts +0 -149
  40. package/dist/src/graphql/auth/resolvers.d.ts.map +0 -1
  41. package/dist/src/graphql/auth/resolvers.js +0 -173
  42. package/dist/src/graphql/auth/resolvers.js.map +0 -1
  43. package/dist/src/graphql/auth/schema.graphql +0 -173
  44. package/dist/src/graphql/auth/subgraph.d.ts +0 -177
  45. package/dist/src/graphql/auth/subgraph.d.ts.map +0 -1
  46. package/dist/src/graphql/auth/subgraph.js +0 -340
  47. package/dist/src/graphql/auth/subgraph.js.map +0 -1
  48. package/dist/src/graphql/base-subgraph.d.ts +0 -20
  49. package/dist/src/graphql/base-subgraph.d.ts.map +0 -1
  50. package/dist/src/graphql/base-subgraph.js +0 -34
  51. package/dist/src/graphql/base-subgraph.js.map +0 -1
  52. package/dist/src/graphql/document-model-subgraph.d.ts +0 -103
  53. package/dist/src/graphql/document-model-subgraph.d.ts.map +0 -1
  54. package/dist/src/graphql/document-model-subgraph.js +0 -595
  55. package/dist/src/graphql/document-model-subgraph.js.map +0 -1
  56. package/dist/src/graphql/drive-subgraph.d.ts +0 -25
  57. package/dist/src/graphql/drive-subgraph.d.ts.map +0 -1
  58. package/dist/src/graphql/drive-subgraph.js +0 -488
  59. package/dist/src/graphql/drive-subgraph.js.map +0 -1
  60. package/dist/src/graphql/graphql-manager.d.ts +0 -52
  61. package/dist/src/graphql/graphql-manager.d.ts.map +0 -1
  62. package/dist/src/graphql/graphql-manager.js +0 -491
  63. package/dist/src/graphql/graphql-manager.js.map +0 -1
  64. package/dist/src/graphql/index.d.ts +0 -10
  65. package/dist/src/graphql/index.d.ts.map +0 -1
  66. package/dist/src/graphql/index.js +0 -10
  67. package/dist/src/graphql/index.js.map +0 -1
  68. package/dist/src/graphql/playground.d.ts +0 -2
  69. package/dist/src/graphql/playground.d.ts.map +0 -1
  70. package/dist/src/graphql/playground.js +0 -74
  71. package/dist/src/graphql/playground.js.map +0 -1
  72. package/dist/src/graphql/reactor/adapters.d.ts +0 -62
  73. package/dist/src/graphql/reactor/adapters.d.ts.map +0 -1
  74. package/dist/src/graphql/reactor/adapters.js +0 -270
  75. package/dist/src/graphql/reactor/adapters.js.map +0 -1
  76. package/dist/src/graphql/reactor/factory.d.ts +0 -95
  77. package/dist/src/graphql/reactor/factory.d.ts.map +0 -1
  78. package/dist/src/graphql/reactor/factory.js +0 -7
  79. package/dist/src/graphql/reactor/factory.js.map +0 -1
  80. package/dist/src/graphql/reactor/gen/graphql.d.ts +0 -1355
  81. package/dist/src/graphql/reactor/gen/graphql.d.ts.map +0 -1
  82. package/dist/src/graphql/reactor/gen/graphql.js +0 -615
  83. package/dist/src/graphql/reactor/gen/graphql.js.map +0 -1
  84. package/dist/src/graphql/reactor/index.d.ts +0 -4
  85. package/dist/src/graphql/reactor/index.d.ts.map +0 -1
  86. package/dist/src/graphql/reactor/index.js +0 -4
  87. package/dist/src/graphql/reactor/index.js.map +0 -1
  88. package/dist/src/graphql/reactor/operations.graphql +0 -336
  89. package/dist/src/graphql/reactor/pubsub.d.ts +0 -27
  90. package/dist/src/graphql/reactor/pubsub.d.ts.map +0 -1
  91. package/dist/src/graphql/reactor/pubsub.js +0 -93
  92. package/dist/src/graphql/reactor/pubsub.js.map +0 -1
  93. package/dist/src/graphql/reactor/requester.d.ts +0 -4
  94. package/dist/src/graphql/reactor/requester.d.ts.map +0 -1
  95. package/dist/src/graphql/reactor/requester.js +0 -22
  96. package/dist/src/graphql/reactor/requester.js.map +0 -1
  97. package/dist/src/graphql/reactor/requester.with-zod.d.ts +0 -4
  98. package/dist/src/graphql/reactor/requester.with-zod.d.ts.map +0 -1
  99. package/dist/src/graphql/reactor/requester.with-zod.js +0 -119
  100. package/dist/src/graphql/reactor/requester.with-zod.js.map +0 -1
  101. package/dist/src/graphql/reactor/resolvers.d.ts +0 -211
  102. package/dist/src/graphql/reactor/resolvers.d.ts.map +0 -1
  103. package/dist/src/graphql/reactor/resolvers.js +0 -595
  104. package/dist/src/graphql/reactor/resolvers.js.map +0 -1
  105. package/dist/src/graphql/reactor/schema.graphql +0 -469
  106. package/dist/src/graphql/reactor/subgraph.d.ts +0 -47
  107. package/dist/src/graphql/reactor/subgraph.d.ts.map +0 -1
  108. package/dist/src/graphql/reactor/subgraph.js +0 -522
  109. package/dist/src/graphql/reactor/subgraph.js.map +0 -1
  110. package/dist/src/graphql/reactor/validation.d.ts +0 -120
  111. package/dist/src/graphql/reactor/validation.d.ts.map +0 -1
  112. package/dist/src/graphql/reactor/validation.js +0 -87
  113. package/dist/src/graphql/reactor/validation.js.map +0 -1
  114. package/dist/src/graphql/system/env/getters.d.ts +0 -2
  115. package/dist/src/graphql/system/env/getters.d.ts.map +0 -1
  116. package/dist/src/graphql/system/env/getters.js +0 -4
  117. package/dist/src/graphql/system/env/getters.js.map +0 -1
  118. package/dist/src/graphql/system/env/index.d.ts +0 -2
  119. package/dist/src/graphql/system/env/index.d.ts.map +0 -1
  120. package/dist/src/graphql/system/env/index.js +0 -5
  121. package/dist/src/graphql/system/env/index.js.map +0 -1
  122. package/dist/src/graphql/system/index.d.ts +0 -2
  123. package/dist/src/graphql/system/index.d.ts.map +0 -1
  124. package/dist/src/graphql/system/index.js +0 -2
  125. package/dist/src/graphql/system/index.js.map +0 -1
  126. package/dist/src/graphql/system/types.d.ts +0 -2
  127. package/dist/src/graphql/system/types.d.ts.map +0 -1
  128. package/dist/src/graphql/system/types.js +0 -2
  129. package/dist/src/graphql/system/types.js.map +0 -1
  130. package/dist/src/graphql/temp-hack-rwa-type-defs.d.ts +0 -57
  131. package/dist/src/graphql/temp-hack-rwa-type-defs.d.ts.map +0 -1
  132. package/dist/src/graphql/temp-hack-rwa-type-defs.js +0 -2
  133. package/dist/src/graphql/temp-hack-rwa-type-defs.js.map +0 -1
  134. package/dist/src/graphql/types.d.ts +0 -103
  135. package/dist/src/graphql/types.d.ts.map +0 -1
  136. package/dist/src/graphql/types.js +0 -2
  137. package/dist/src/graphql/types.js.map +0 -1
  138. package/dist/src/graphql/utils.d.ts +0 -26
  139. package/dist/src/graphql/utils.d.ts.map +0 -1
  140. package/dist/src/graphql/utils.js +0 -104
  141. package/dist/src/graphql/utils.js.map +0 -1
  142. package/dist/src/graphql/websocket.d.ts +0 -3
  143. package/dist/src/graphql/websocket.d.ts.map +0 -1
  144. package/dist/src/graphql/websocket.js +0 -15
  145. package/dist/src/graphql/websocket.js.map +0 -1
  146. package/dist/src/migrations/001_create_document_permissions.d.ts +0 -4
  147. package/dist/src/migrations/001_create_document_permissions.d.ts.map +0 -1
  148. package/dist/src/migrations/001_create_document_permissions.js +0 -91
  149. package/dist/src/migrations/001_create_document_permissions.js.map +0 -1
  150. package/dist/src/migrations/index.d.ts +0 -10
  151. package/dist/src/migrations/index.d.ts.map +0 -1
  152. package/dist/src/migrations/index.js +0 -56
  153. package/dist/src/migrations/index.js.map +0 -1
  154. package/dist/src/packages/import-loader.d.ts +0 -16
  155. package/dist/src/packages/import-loader.d.ts.map +0 -1
  156. package/dist/src/packages/import-loader.js +0 -61
  157. package/dist/src/packages/import-loader.js.map +0 -1
  158. package/dist/src/packages/import-resolver.d.ts +0 -5
  159. package/dist/src/packages/import-resolver.d.ts.map +0 -1
  160. package/dist/src/packages/import-resolver.js +0 -127
  161. package/dist/src/packages/import-resolver.js.map +0 -1
  162. package/dist/src/packages/package-manager.d.ts +0 -34
  163. package/dist/src/packages/package-manager.d.ts.map +0 -1
  164. package/dist/src/packages/package-manager.js +0 -213
  165. package/dist/src/packages/package-manager.js.map +0 -1
  166. package/dist/src/packages/types.d.ts +0 -40
  167. package/dist/src/packages/types.d.ts.map +0 -1
  168. package/dist/src/packages/types.js +0 -2
  169. package/dist/src/packages/types.js.map +0 -1
  170. package/dist/src/packages/util.d.ts +0 -27
  171. package/dist/src/packages/util.d.ts.map +0 -1
  172. package/dist/src/packages/util.js +0 -97
  173. package/dist/src/packages/util.js.map +0 -1
  174. package/dist/src/packages/vite-loader.d.ts +0 -25
  175. package/dist/src/packages/vite-loader.d.ts.map +0 -1
  176. package/dist/src/packages/vite-loader.js +0 -182
  177. package/dist/src/packages/vite-loader.js.map +0 -1
  178. package/dist/src/server.d.ts +0 -80
  179. package/dist/src/server.d.ts.map +0 -1
  180. package/dist/src/server.js +0 -427
  181. package/dist/src/server.js.map +0 -1
  182. package/dist/src/services/auth.service.d.ts +0 -68
  183. package/dist/src/services/auth.service.d.ts.map +0 -1
  184. package/dist/src/services/auth.service.js +0 -190
  185. package/dist/src/services/auth.service.js.map +0 -1
  186. package/dist/src/services/document-permission.service.d.ts +0 -201
  187. package/dist/src/services/document-permission.service.d.ts.map +0 -1
  188. package/dist/src/services/document-permission.service.js +0 -636
  189. package/dist/src/services/document-permission.service.js.map +0 -1
  190. package/dist/src/sync/types.d.ts +0 -10
  191. package/dist/src/sync/types.d.ts.map +0 -1
  192. package/dist/src/sync/types.js +0 -2
  193. package/dist/src/sync/types.js.map +0 -1
  194. package/dist/src/sync/utils.d.ts +0 -7
  195. package/dist/src/sync/utils.d.ts.map +0 -1
  196. package/dist/src/sync/utils.js +0 -78
  197. package/dist/src/sync/utils.js.map +0 -1
  198. package/dist/src/tracing.d.ts +0 -4
  199. package/dist/src/tracing.d.ts.map +0 -1
  200. package/dist/src/tracing.js +0 -122
  201. package/dist/src/tracing.js.map +0 -1
  202. package/dist/src/types.d.ts +0 -18
  203. package/dist/src/types.d.ts.map +0 -1
  204. package/dist/src/types.js +0 -2
  205. package/dist/src/types.js.map +0 -1
  206. package/dist/src/utils/auth.d.ts +0 -3
  207. package/dist/src/utils/auth.d.ts.map +0 -1
  208. package/dist/src/utils/auth.js +0 -19
  209. package/dist/src/utils/auth.js.map +0 -1
  210. package/dist/src/utils/create-schema.d.ts +0 -31
  211. package/dist/src/utils/create-schema.d.ts.map +0 -1
  212. package/dist/src/utils/create-schema.js +0 -548
  213. package/dist/src/utils/create-schema.js.map +0 -1
  214. package/dist/src/utils/db.d.ts +0 -74
  215. package/dist/src/utils/db.d.ts.map +0 -1
  216. package/dist/src/utils/db.js +0 -101
  217. package/dist/src/utils/db.js.map +0 -1
  218. package/dist/src/utils/drive-url.d.ts +0 -2
  219. package/dist/src/utils/drive-url.d.ts.map +0 -1
  220. package/dist/src/utils/drive-url.js +0 -3
  221. package/dist/src/utils/drive-url.js.map +0 -1
  222. package/dist/src/utils/index.d.ts +0 -4
  223. package/dist/src/utils/index.d.ts.map +0 -1
  224. package/dist/src/utils/index.js +0 -4
  225. package/dist/src/utils/index.js.map +0 -1
  226. package/dist/test/benchmarks/load.bench.d.ts +0 -2
  227. package/dist/test/benchmarks/load.bench.d.ts.map +0 -1
  228. package/dist/test/benchmarks/load.bench.js +0 -73
  229. package/dist/test/benchmarks/load.bench.js.map +0 -1
  230. package/dist/test/benchmarks/sync.bench.d.ts +0 -2
  231. package/dist/test/benchmarks/sync.bench.d.ts.map +0 -1
  232. package/dist/test/benchmarks/sync.bench.js +0 -119
  233. package/dist/test/benchmarks/sync.bench.js.map +0 -1
  234. package/dist/test/connect-switchboard-reshuffle-convergence.test.d.ts +0 -2
  235. package/dist/test/connect-switchboard-reshuffle-convergence.test.d.ts.map +0 -1
  236. package/dist/test/connect-switchboard-reshuffle-convergence.test.js +0 -203
  237. package/dist/test/connect-switchboard-reshuffle-convergence.test.js.map +0 -1
  238. package/dist/test/connect-switchboard-sync.test.d.ts +0 -2
  239. package/dist/test/connect-switchboard-sync.test.d.ts.map +0 -1
  240. package/dist/test/connect-switchboard-sync.test.js +0 -581
  241. package/dist/test/connect-switchboard-sync.test.js.map +0 -1
  242. package/dist/test/document-drive-subgraph.test.d.ts +0 -2
  243. package/dist/test/document-drive-subgraph.test.d.ts.map +0 -1
  244. package/dist/test/document-drive-subgraph.test.js +0 -186
  245. package/dist/test/document-drive-subgraph.test.js.map +0 -1
  246. package/dist/test/document-model-subgraph-legacy-permissions.test.d.ts +0 -2
  247. package/dist/test/document-model-subgraph-legacy-permissions.test.d.ts.map +0 -1
  248. package/dist/test/document-model-subgraph-legacy-permissions.test.js +0 -518
  249. package/dist/test/document-model-subgraph-legacy-permissions.test.js.map +0 -1
  250. package/dist/test/document-model-subgraph-permissions.test.d.ts +0 -2
  251. package/dist/test/document-model-subgraph-permissions.test.d.ts.map +0 -1
  252. package/dist/test/document-model-subgraph-permissions.test.js +0 -635
  253. package/dist/test/document-model-subgraph-permissions.test.js.map +0 -1
  254. package/dist/test/document-model-subgraph.test.d.ts +0 -2
  255. package/dist/test/document-model-subgraph.test.d.ts.map +0 -1
  256. package/dist/test/document-model-subgraph.test.js +0 -441
  257. package/dist/test/document-model-subgraph.test.js.map +0 -1
  258. package/dist/test/document-permission.service.test.d.ts +0 -2
  259. package/dist/test/document-permission.service.test.d.ts.map +0 -1
  260. package/dist/test/document-permission.service.test.js +0 -480
  261. package/dist/test/document-permission.service.test.js.map +0 -1
  262. package/dist/test/drive-handlers.d.ts +0 -4
  263. package/dist/test/drive-handlers.d.ts.map +0 -1
  264. package/dist/test/drive-handlers.js +0 -39
  265. package/dist/test/drive-handlers.js.map +0 -1
  266. package/dist/test/drive-info-endpoint.test.d.ts +0 -2
  267. package/dist/test/drive-info-endpoint.test.d.ts.map +0 -1
  268. package/dist/test/drive-info-endpoint.test.js +0 -123
  269. package/dist/test/drive-info-endpoint.test.js.map +0 -1
  270. package/dist/test/drive-subgraph-permissions.test.d.ts +0 -2
  271. package/dist/test/drive-subgraph-permissions.test.d.ts.map +0 -1
  272. package/dist/test/drive-subgraph-permissions.test.js +0 -195
  273. package/dist/test/drive-subgraph-permissions.test.js.map +0 -1
  274. package/dist/test/drive.test.d.ts +0 -2
  275. package/dist/test/drive.test.d.ts.map +0 -1
  276. package/dist/test/drive.test.js +0 -142
  277. package/dist/test/drive.test.js.map +0 -1
  278. package/dist/test/identity-integration.test.d.ts +0 -2
  279. package/dist/test/identity-integration.test.d.ts.map +0 -1
  280. package/dist/test/identity-integration.test.js +0 -349
  281. package/dist/test/identity-integration.test.js.map +0 -1
  282. package/dist/test/index.d.ts +0 -3
  283. package/dist/test/index.d.ts.map +0 -1
  284. package/dist/test/index.js +0 -3
  285. package/dist/test/index.js.map +0 -1
  286. package/dist/test/permissions-integration.test.d.ts +0 -2
  287. package/dist/test/permissions-integration.test.d.ts.map +0 -1
  288. package/dist/test/permissions-integration.test.js +0 -421
  289. package/dist/test/permissions-integration.test.js.map +0 -1
  290. package/dist/test/pull-responder-transmitter.test.d.ts +0 -2
  291. package/dist/test/pull-responder-transmitter.test.d.ts.map +0 -1
  292. package/dist/test/pull-responder-transmitter.test.js +0 -220
  293. package/dist/test/pull-responder-transmitter.test.js.map +0 -1
  294. package/dist/test/push-backfill.test.d.ts +0 -2
  295. package/dist/test/push-backfill.test.d.ts.map +0 -1
  296. package/dist/test/push-backfill.test.js +0 -298
  297. package/dist/test/push-backfill.test.js.map +0 -1
  298. package/dist/test/push-transmitter.test.d.ts +0 -2
  299. package/dist/test/push-transmitter.test.d.ts.map +0 -1
  300. package/dist/test/push-transmitter.test.js +0 -179
  301. package/dist/test/push-transmitter.test.js.map +0 -1
  302. package/dist/test/reactor-adapters.test.d.ts +0 -2
  303. package/dist/test/reactor-adapters.test.d.ts.map +0 -1
  304. package/dist/test/reactor-adapters.test.js +0 -379
  305. package/dist/test/reactor-adapters.test.js.map +0 -1
  306. package/dist/test/reactor-client.test.d.ts +0 -2
  307. package/dist/test/reactor-client.test.d.ts.map +0 -1
  308. package/dist/test/reactor-client.test.js +0 -212
  309. package/dist/test/reactor-client.test.js.map +0 -1
  310. package/dist/test/reactor-resolvers.test.d.ts +0 -2
  311. package/dist/test/reactor-resolvers.test.d.ts.map +0 -1
  312. package/dist/test/reactor-resolvers.test.js +0 -258
  313. package/dist/test/reactor-resolvers.test.js.map +0 -1
  314. package/dist/test/reactor-subgraph-permissions.test.d.ts +0 -2
  315. package/dist/test/reactor-subgraph-permissions.test.d.ts.map +0 -1
  316. package/dist/test/reactor-subgraph-permissions.test.js +0 -397
  317. package/dist/test/reactor-subgraph-permissions.test.js.map +0 -1
  318. package/dist/test/router.test.d.ts +0 -2
  319. package/dist/test/router.test.d.ts.map +0 -1
  320. package/dist/test/router.test.js +0 -38
  321. package/dist/test/router.test.js.map +0 -1
  322. package/dist/test/subscriptions.test.d.ts +0 -2
  323. package/dist/test/subscriptions.test.d.ts.map +0 -1
  324. package/dist/test/subscriptions.test.js +0 -248
  325. package/dist/test/subscriptions.test.js.map +0 -1
  326. package/dist/test/utils/gql-resolver-bridge.d.ts +0 -15
  327. package/dist/test/utils/gql-resolver-bridge.d.ts.map +0 -1
  328. package/dist/test/utils/gql-resolver-bridge.js +0 -89
  329. package/dist/test/utils/gql-resolver-bridge.js.map +0 -1
  330. package/dist/test/utils.d.ts +0 -10
  331. package/dist/test/utils.d.ts.map +0 -1
  332. package/dist/test/utils.js +0 -23
  333. package/dist/test/utils.js.map +0 -1
  334. package/dist/tsconfig.tsbuildinfo +0 -1
  335. package/dist/vitest.config.d.ts +0 -3
  336. package/dist/vitest.config.d.ts.map +0 -1
  337. package/dist/vitest.config.js +0 -38
  338. package/dist/vitest.config.js.map +0 -1
@@ -0,0 +1,296 @@
1
+
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="e8b85da7-0078-579c-8d72-5c00006a8107")}catch(e){}}();
3
+ import { gql } from "graphql-tag";
4
+ import { GraphQLError } from "graphql";
5
+ import { childLogger } from "document-model";
6
+ import path from "node:path";
7
+ //#region src/graphql/base-subgraph.ts
8
+ var BaseSubgraph = class {
9
+ name = "example";
10
+ path = "";
11
+ resolvers = { Query: { hello: () => this.name } };
12
+ typeDefs = gql`
13
+ type Query {
14
+ hello: String
15
+ }
16
+ `;
17
+ reactorClient;
18
+ graphqlManager;
19
+ relationalDb;
20
+ syncManager;
21
+ documentPermissionService;
22
+ authorizationService;
23
+ constructor(args) {
24
+ this.reactorClient = args.reactorClient;
25
+ this.graphqlManager = args.graphqlManager;
26
+ this.relationalDb = args.relationalDb;
27
+ this.syncManager = args.syncManager;
28
+ this.documentPermissionService = args.documentPermissionService;
29
+ this.authorizationService = args.authorizationService;
30
+ this.path = args.path ?? "";
31
+ }
32
+ async onSetup() {}
33
+ getParentIdsFn() {
34
+ return async (documentId) => {
35
+ try {
36
+ return (await this.reactorClient.getIncomingRelationships(documentId, "child")).results.map((doc) => doc.header.id);
37
+ } catch {
38
+ return [];
39
+ }
40
+ };
41
+ }
42
+ hasGlobalAdminAccess(ctx) {
43
+ return !!ctx.isAdmin?.(ctx.user?.address ?? "");
44
+ }
45
+ async canReadDocument(documentId, ctx) {
46
+ if (this.authorizationService) return this.authorizationService.canRead(documentId, ctx.user?.address, this.getParentIdsFn());
47
+ if (this.hasGlobalAdminAccess(ctx)) return true;
48
+ if (this.documentPermissionService) return this.documentPermissionService.canRead(documentId, ctx.user?.address, this.getParentIdsFn());
49
+ return false;
50
+ }
51
+ async assertCanRead(documentId, ctx) {
52
+ if (this.authorizationService) {
53
+ if (!await this.authorizationService.canRead(documentId, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError("Forbidden: insufficient permissions to read this document");
54
+ return;
55
+ }
56
+ if (!this.hasGlobalAdminAccess(ctx)) if (this.documentPermissionService) {
57
+ if (!await this.documentPermissionService.canRead(documentId, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError("Forbidden: insufficient permissions to read this document");
58
+ } else throw new GraphQLError("Forbidden: insufficient permissions to read this document");
59
+ }
60
+ async assertCanWrite(documentId, ctx) {
61
+ if (this.authorizationService) {
62
+ if (!await this.authorizationService.canWrite(documentId, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError("Forbidden: insufficient permissions to write to this document");
63
+ return;
64
+ }
65
+ if (!this.hasGlobalAdminAccess(ctx)) if (this.documentPermissionService) {
66
+ if (!await this.documentPermissionService.canWrite(documentId, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError("Forbidden: insufficient permissions to write to this document");
67
+ } else throw new GraphQLError("Forbidden: insufficient permissions to write to this document");
68
+ }
69
+ async assertCanExecuteOperation(documentId, operationType, ctx) {
70
+ if (this.authorizationService) {
71
+ if (!await this.authorizationService.canMutate(documentId, operationType, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError(`Forbidden: insufficient permissions to execute operation "${operationType}" on this document`);
72
+ return;
73
+ }
74
+ if (!this.documentPermissionService) return;
75
+ if (ctx.isAdmin?.(ctx.user?.address ?? "")) return;
76
+ if (await this.documentPermissionService.isOperationRestricted(documentId, operationType)) {
77
+ if (!await this.documentPermissionService.canExecuteOperation(documentId, operationType, ctx.user?.address)) throw new GraphQLError(`Forbidden: insufficient permissions to execute operation "${operationType}" on this document`);
78
+ }
79
+ }
80
+ };
81
+ //#endregion
82
+ //#region src/packages/import-resolver.ts
83
+ /**
84
+ * Attempts to import from suggested Node.js paths
85
+ */
86
+ async function tryNodeSuggestedPaths(packageName, subPath) {
87
+ const suggestedPaths = [
88
+ `${packageName}/dist/node/${subPath}/index.mjs`,
89
+ `${packageName}/dist/node/${subPath}.mjs`,
90
+ `${packageName}/dist/${subPath}/index.js`,
91
+ `${packageName}/dist/${subPath}.js`
92
+ ];
93
+ for (const suggestedPath of suggestedPaths) try {
94
+ return await import(
95
+ /* @vite-ignore */
96
+ suggestedPath
97
+ );
98
+ } catch {}
99
+ return null;
100
+ }
101
+ /**
102
+ * Attempts to resolve package using import.meta.resolve
103
+ */
104
+ async function tryImportMetaResolve(packageName, subPath) {
105
+ try {
106
+ const resolvedUrl = import.meta.resolve?.(`${packageName}/package.json`);
107
+ if (!resolvedUrl) return null;
108
+ const packageRoot = path.dirname(new URL(resolvedUrl).pathname);
109
+ const pathsToTry = [
110
+ path.join(packageRoot, "dist", "node", subPath, "index.mjs"),
111
+ path.join(packageRoot, "dist", "node", `${subPath}.mjs`),
112
+ path.join(packageRoot, "dist", subPath, "index.js"),
113
+ path.join(packageRoot, "dist", `${subPath}.js`),
114
+ path.join(packageRoot, subPath, "index.js"),
115
+ path.join(packageRoot, `${subPath}.js`)
116
+ ];
117
+ for (const attemptPath of pathsToTry) try {
118
+ return await import(
119
+ /* @vite-ignore */
120
+ attemptPath
121
+ );
122
+ } catch {}
123
+ } catch {}
124
+ return null;
125
+ }
126
+ /**
127
+ * Resolves symlinks in node_modules to find the real package location
128
+ */
129
+ async function resolveSymlinkedPaths(packageName, subPath) {
130
+ const packageBaseName = packageName.includes("/") ? packageName.split("/").pop() : packageName;
131
+ const nodeModulesPatterns = [path.join(process.cwd(), "node_modules", packageName), path.join(process.cwd(), "node_modules", packageBaseName || packageName)];
132
+ const workspacePatterns = [];
133
+ for (const nodeModulesPath of nodeModulesPatterns) try {
134
+ const fs = await import("node:fs");
135
+ if (fs.existsSync(nodeModulesPath)) {
136
+ const realPath = fs.realpathSync(nodeModulesPath);
137
+ workspacePatterns.push(path.join(realPath, "dist", "node", subPath, "index.mjs"), path.join(realPath, "dist", "node", `${subPath}.mjs`), path.join(realPath, "dist", subPath, "index.js"), path.join(realPath, "dist", `${subPath}.js`), path.join(realPath, subPath, "index.js"), path.join(realPath, `${subPath}.js`));
138
+ }
139
+ } catch {}
140
+ return workspacePatterns;
141
+ }
142
+ /**
143
+ * Generates common workspace pattern paths
144
+ */
145
+ function getCommonWorkspacePaths(packageName, subPath) {
146
+ const packageBaseName = packageName.includes("/") ? packageName.split("/").pop() : packageName;
147
+ const commonRoots = [process.cwd(), path.dirname(process.cwd())];
148
+ const workspacePatterns = [];
149
+ for (const root of commonRoots) workspacePatterns.push(path.join(root, "packages", packageBaseName || packageName, "dist", "node", subPath, "index.mjs"), path.join(root, "packages", packageBaseName || packageName, "dist", "node", `${subPath}.mjs`), path.join(root, "packages", packageBaseName || packageName, "dist", subPath, "index.js"), path.join(root, "packages", packageBaseName || packageName, "dist", `${subPath}.js`));
150
+ return workspacePatterns;
151
+ }
152
+ /**
153
+ * Attempts to import from a list of workspace patterns
154
+ */
155
+ async function tryWorkspacePatterns(patterns) {
156
+ for (const workspacePath of patterns) try {
157
+ return await import(
158
+ /* @vite-ignore */
159
+ workspacePath
160
+ );
161
+ } catch {}
162
+ return null;
163
+ }
164
+ /**
165
+ * Attempts to resolve linked packages using various fallback strategies
166
+ */
167
+ async function resolveLinkedPackage(packageName, subPath) {
168
+ let result = await tryNodeSuggestedPaths(packageName, subPath);
169
+ if (result) return result;
170
+ result = await tryImportMetaResolve(packageName, subPath);
171
+ if (result) return result;
172
+ result = await tryWorkspacePatterns(await resolveSymlinkedPaths(packageName, subPath));
173
+ if (result) return result;
174
+ result = await tryWorkspacePatterns(getCommonWorkspacePaths(packageName, subPath));
175
+ if (result) return result;
176
+ return null;
177
+ }
178
+ //#endregion
179
+ //#region src/packages/util.ts
180
+ childLogger(["reactor-api", "packages/util"]);
181
+ /**
182
+ * Tries to import document models from a package. This function cannot throw.
183
+ */
184
+ async function loadDocumentModels(packageName) {
185
+ return loadDependency(packageName, "document-models");
186
+ }
187
+ /**
188
+ * Tries to import subgraphs from a package. This function cannot throw.
189
+ */
190
+ async function loadSubgraphs(packageName) {
191
+ return loadDependency(packageName, "subgraphs");
192
+ }
193
+ /**
194
+ * Tries to import processors from a package. This function cannot throw.
195
+ */
196
+ async function loadProcessors(packageName) {
197
+ return loadDependency(packageName, "processors");
198
+ }
199
+ /**
200
+ * Generic dependency loader - tries to import a dependency from a package. This function cannot throw.
201
+ * Returns null if the dependency cannot be loaded.
202
+ */
203
+ async function loadDependency(packageName, subPath) {
204
+ const fullPath = `${packageName}/${subPath}`;
205
+ try {
206
+ return await import(
207
+ /* @vite-ignore */
208
+ fullPath
209
+ );
210
+ } catch (e) {
211
+ if (e instanceof Error && "code" in e && (e.code === "ERR_MODULE_NOT_FOUND" || e.code === "ERR_UNSUPPORTED_DIR_IMPORT")) {
212
+ const result = await resolveLinkedPackage(packageName, subPath);
213
+ if (result) return result;
214
+ }
215
+ throw e;
216
+ }
217
+ }
218
+ function debounce(func, delay = 250) {
219
+ let timer;
220
+ return (immediate = false, ...args) => {
221
+ if (timer) clearTimeout(timer);
222
+ return new Promise((resolve, reject) => {
223
+ if (immediate) func(...args).then(resolve).catch(reject);
224
+ else timer = setTimeout(() => {
225
+ func(...args).then(resolve).catch(reject);
226
+ }, delay);
227
+ });
228
+ };
229
+ }
230
+ function isSubpath(parent, dir) {
231
+ const relative = path.relative(parent, dir);
232
+ return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
233
+ }
234
+ //#endregion
235
+ //#region src/graphql/utils.ts
236
+ function isSubgraphClass(candidate) {
237
+ if (typeof candidate !== "function") return false;
238
+ let proto = Object.getPrototypeOf(candidate);
239
+ while (proto) {
240
+ if (Object.prototype.isPrototypeOf.call(proto, BaseSubgraph)) return true;
241
+ proto = Object.getPrototypeOf(proto);
242
+ }
243
+ return false;
244
+ }
245
+ function buildGraphqlOperations(operations, skip, first) {
246
+ return operations.slice(skip, skip + first).map(buildGraphqlOperation);
247
+ }
248
+ function buildGraphqlOperation(operation) {
249
+ const signer = operation.action.context?.signer;
250
+ return {
251
+ id: operation.id ?? "",
252
+ type: operation.action.type,
253
+ index: operation.index,
254
+ timestampUtcMs: operation.timestampUtcMs,
255
+ hash: operation.hash,
256
+ skip: operation.skip,
257
+ inputText: typeof operation.action.input === "string" ? operation.action.input : JSON.stringify(operation.action.input),
258
+ error: operation.error,
259
+ context: { signer: signer ? {
260
+ user: signer.user,
261
+ app: signer.app,
262
+ signatures: signer.signatures.map((sig) => Array.isArray(sig) ? sig.join(", ") : sig)
263
+ } : void 0 }
264
+ };
265
+ }
266
+ function buildGraphQlDocument(doc) {
267
+ const state = doc.state;
268
+ const initialState = doc.initialState;
269
+ const globalState = "global" in doc.state ? doc.state.global : {};
270
+ return {
271
+ id: doc.header.id,
272
+ name: doc.header.name,
273
+ documentType: doc.header.documentType,
274
+ revision: doc.header.revision.global || 0,
275
+ createdAtUtcIso: doc.header.createdAtUtcIso,
276
+ lastModifiedAtUtcIso: doc.header.lastModifiedAtUtcIso,
277
+ operations: [],
278
+ stateJSON: globalState,
279
+ state,
280
+ initialState
281
+ };
282
+ }
283
+ function buildGraphQlDriveDocument(doc) {
284
+ return {
285
+ ...buildGraphQlDocument(doc),
286
+ meta: { preferredEditor: doc.header.meta?.preferredEditor },
287
+ slug: doc.header.slug,
288
+ state: doc.state.global,
289
+ initialState: doc.state.global
290
+ };
291
+ }
292
+ //#endregion
293
+ export { isSubgraphClass as a, loadDocumentModels as c, BaseSubgraph as d, buildGraphqlOperations as i, loadProcessors as l, buildGraphQlDriveDocument as n, debounce as o, buildGraphqlOperation as r, isSubpath as s, buildGraphQlDocument as t, loadSubgraphs as u };
294
+
295
+ //# sourceMappingURL=utils-BFkbSO_H.mjs.map
296
+ //# debugId=e8b85da7-0078-579c-8d72-5c00006a8107
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-BFkbSO_H.mjs","sources":["../src/graphql/base-subgraph.ts","../src/packages/import-resolver.ts","../src/packages/util.ts","../src/graphql/utils.ts"],"sourcesContent":["import type {\n IReactorClient,\n IRelationalDb,\n ISyncManager,\n} from \"@powerhousedao/reactor\";\nimport type {\n GraphQLManager,\n ISubgraph,\n SubgraphArgs,\n} from \"@powerhousedao/reactor-api\";\nimport type { DocumentNode } from \"graphql\";\nimport { GraphQLError } from \"graphql\";\nimport { gql } from \"graphql-tag\";\nimport type { AuthorizationService } from \"../services/authorization.service.js\";\nimport type {\n DocumentPermissionService,\n GetParentIdsFn,\n} from \"../services/document-permission.service.js\";\nimport type { Context } from \"./types.js\";\n\nexport class BaseSubgraph implements ISubgraph {\n name = \"example\";\n path = \"\";\n resolvers: Record<string, any> = {\n Query: {\n hello: () => this.name,\n },\n };\n typeDefs: DocumentNode = gql`\n type Query {\n hello: String\n }\n `;\n reactorClient: IReactorClient;\n graphqlManager: GraphQLManager;\n relationalDb: IRelationalDb;\n syncManager: ISyncManager;\n documentPermissionService?: DocumentPermissionService;\n authorizationService?: AuthorizationService;\n\n constructor(args: SubgraphArgs) {\n this.reactorClient = args.reactorClient;\n this.graphqlManager = args.graphqlManager;\n this.relationalDb = args.relationalDb;\n this.syncManager = args.syncManager;\n this.documentPermissionService = args.documentPermissionService;\n this.authorizationService = args.authorizationService;\n this.path = args.path ?? \"\";\n }\n\n async onSetup() {\n // noop\n }\n\n // ============================================\n // Shared permission helpers\n // ============================================\n\n protected getParentIdsFn(): GetParentIdsFn {\n return async (documentId: string): Promise<string[]> => {\n try {\n const result = await this.reactorClient.getIncomingRelationships(\n documentId,\n \"child\",\n );\n return result.results.map((doc) => doc.header.id);\n } catch {\n return [];\n }\n };\n }\n\n protected hasGlobalAdminAccess(ctx: Context): boolean {\n return !!ctx.isAdmin?.(ctx.user?.address ?? \"\");\n }\n\n protected async canReadDocument(\n documentId: string,\n ctx: Context,\n ): Promise<boolean> {\n if (this.authorizationService) {\n return this.authorizationService.canRead(\n documentId,\n ctx.user?.address,\n this.getParentIdsFn(),\n );\n }\n if (this.hasGlobalAdminAccess(ctx)) return true;\n if (this.documentPermissionService) {\n return this.documentPermissionService.canRead(\n documentId,\n ctx.user?.address,\n this.getParentIdsFn(),\n );\n }\n return false;\n }\n\n protected async assertCanRead(\n documentId: string,\n ctx: Context,\n ): Promise<void> {\n if (this.authorizationService) {\n const canRead = await this.authorizationService.canRead(\n documentId,\n ctx.user?.address,\n this.getParentIdsFn(),\n );\n if (!canRead) {\n throw new GraphQLError(\n \"Forbidden: insufficient permissions to read this document\",\n );\n }\n return;\n }\n // Legacy fallback\n if (!this.hasGlobalAdminAccess(ctx)) {\n if (this.documentPermissionService) {\n const canRead = await this.documentPermissionService.canRead(\n documentId,\n ctx.user?.address,\n this.getParentIdsFn(),\n );\n if (!canRead) {\n throw new GraphQLError(\n \"Forbidden: insufficient permissions to read this document\",\n );\n }\n } else {\n throw new GraphQLError(\n \"Forbidden: insufficient permissions to read this document\",\n );\n }\n }\n }\n\n protected async assertCanWrite(\n documentId: string,\n ctx: Context,\n ): Promise<void> {\n if (this.authorizationService) {\n const canWrite = await this.authorizationService.canWrite(\n documentId,\n ctx.user?.address,\n this.getParentIdsFn(),\n );\n if (!canWrite) {\n throw new GraphQLError(\n \"Forbidden: insufficient permissions to write to this document\",\n );\n }\n return;\n }\n // Legacy fallback\n if (!this.hasGlobalAdminAccess(ctx)) {\n if (this.documentPermissionService) {\n const canWrite = await this.documentPermissionService.canWrite(\n documentId,\n ctx.user?.address,\n this.getParentIdsFn(),\n );\n if (!canWrite) {\n throw new GraphQLError(\n \"Forbidden: insufficient permissions to write to this document\",\n );\n }\n } else {\n throw new GraphQLError(\n \"Forbidden: insufficient permissions to write to this document\",\n );\n }\n }\n }\n\n protected async assertCanExecuteOperation(\n documentId: string,\n operationType: string,\n ctx: Context,\n ): Promise<void> {\n if (this.authorizationService) {\n const canMutate = await this.authorizationService.canMutate(\n documentId,\n operationType,\n ctx.user?.address,\n this.getParentIdsFn(),\n );\n if (!canMutate) {\n throw new GraphQLError(\n `Forbidden: insufficient permissions to execute operation \"${operationType}\" on this document`,\n );\n }\n return;\n }\n // Legacy fallback\n if (!this.documentPermissionService) return;\n if (ctx.isAdmin?.(ctx.user?.address ?? \"\")) return;\n const isRestricted =\n await this.documentPermissionService.isOperationRestricted(\n documentId,\n operationType,\n );\n if (isRestricted) {\n const canExecute =\n await this.documentPermissionService.canExecuteOperation(\n documentId,\n operationType,\n ctx.user?.address,\n );\n if (!canExecute) {\n throw new GraphQLError(\n `Forbidden: insufficient permissions to execute operation \"${operationType}\" on this document`,\n );\n }\n }\n }\n}\n","import path from \"node:path\";\n\n/**\n * Attempts to import from suggested Node.js paths\n */\nasync function tryNodeSuggestedPaths<T>(\n packageName: string,\n subPath: string,\n): Promise<T | null> {\n const suggestedPaths = [\n `${packageName}/dist/node/${subPath}/index.mjs`,\n `${packageName}/dist/node/${subPath}.mjs`,\n `${packageName}/dist/${subPath}/index.js`,\n `${packageName}/dist/${subPath}.js`,\n ];\n\n for (const suggestedPath of suggestedPaths) {\n try {\n return (await import(/* @vite-ignore */ suggestedPath)) as T;\n } catch {\n // Continue to next attempt\n }\n }\n\n return null;\n}\n\n/**\n * Attempts to resolve package using import.meta.resolve\n */\nasync function tryImportMetaResolve<T>(\n packageName: string,\n subPath: string,\n): Promise<T | null> {\n try {\n const resolvedUrl = import.meta.resolve?.(`${packageName}/package.json`);\n if (!resolvedUrl) return null;\n\n const packageRoot = path.dirname(new URL(resolvedUrl).pathname);\n const pathsToTry = [\n path.join(packageRoot, \"dist\", \"node\", subPath, \"index.mjs\"),\n path.join(packageRoot, \"dist\", \"node\", `${subPath}.mjs`),\n path.join(packageRoot, \"dist\", subPath, \"index.js\"),\n path.join(packageRoot, \"dist\", `${subPath}.js`),\n path.join(packageRoot, subPath, \"index.js\"),\n path.join(packageRoot, `${subPath}.js`),\n ];\n\n for (const attemptPath of pathsToTry) {\n try {\n return (await import(/* @vite-ignore */ attemptPath)) as T;\n } catch {\n // Continue to next attempt\n }\n }\n } catch {\n // import.meta.resolve failed\n }\n\n return null;\n}\n\n/**\n * Resolves symlinks in node_modules to find the real package location\n */\nasync function resolveSymlinkedPaths(\n packageName: string,\n subPath: string,\n): Promise<string[]> {\n const packageBaseName = packageName.includes(\"/\")\n ? packageName.split(\"/\").pop()\n : packageName;\n const nodeModulesPatterns = [\n path.join(process.cwd(), \"node_modules\", packageName),\n path.join(process.cwd(), \"node_modules\", packageBaseName || packageName),\n ];\n\n const workspacePatterns: string[] = [];\n\n for (const nodeModulesPath of nodeModulesPatterns) {\n try {\n const fs = await import(\"node:fs\");\n if (fs.existsSync(nodeModulesPath)) {\n const realPath = fs.realpathSync(nodeModulesPath);\n\n workspacePatterns.push(\n path.join(realPath, \"dist\", \"node\", subPath, \"index.mjs\"),\n path.join(realPath, \"dist\", \"node\", `${subPath}.mjs`),\n path.join(realPath, \"dist\", subPath, \"index.js\"),\n path.join(realPath, \"dist\", `${subPath}.js`),\n path.join(realPath, subPath, \"index.js\"),\n path.join(realPath, `${subPath}.js`),\n );\n }\n } catch {\n // Continue to next attempt\n }\n }\n\n return workspacePatterns;\n}\n\n/**\n * Generates common workspace pattern paths\n */\nfunction getCommonWorkspacePaths(\n packageName: string,\n subPath: string,\n): string[] {\n const packageBaseName = packageName.includes(\"/\")\n ? packageName.split(\"/\").pop()\n : packageName;\n const commonRoots = [process.cwd(), path.dirname(process.cwd())];\n\n const workspacePatterns: string[] = [];\n for (const root of commonRoots) {\n workspacePatterns.push(\n path.join(\n root,\n \"packages\",\n packageBaseName || packageName,\n \"dist\",\n \"node\",\n subPath,\n \"index.mjs\",\n ),\n path.join(\n root,\n \"packages\",\n packageBaseName || packageName,\n \"dist\",\n \"node\",\n `${subPath}.mjs`,\n ),\n path.join(\n root,\n \"packages\",\n packageBaseName || packageName,\n \"dist\",\n subPath,\n \"index.js\",\n ),\n path.join(\n root,\n \"packages\",\n packageBaseName || packageName,\n \"dist\",\n `${subPath}.js`,\n ),\n );\n }\n\n return workspacePatterns;\n}\n\n/**\n * Attempts to import from a list of workspace patterns\n */\nasync function tryWorkspacePatterns<T>(patterns: string[]): Promise<T | null> {\n for (const workspacePath of patterns) {\n try {\n return (await import(/* @vite-ignore */ workspacePath)) as T;\n } catch {\n // Continue to next attempt\n }\n }\n\n return null;\n}\n\n/**\n * Attempts to resolve linked packages using various fallback strategies\n */\nexport async function resolveLinkedPackage<T>(\n packageName: string,\n subPath: string,\n): Promise<T | null> {\n // Try Node.js suggested paths first\n let result = await tryNodeSuggestedPaths<T>(packageName, subPath);\n if (result) return result;\n\n // Try import.meta.resolve\n result = await tryImportMetaResolve<T>(packageName, subPath);\n if (result) return result;\n\n // Try symlink resolution\n const symlinkPaths = await resolveSymlinkedPaths(packageName, subPath);\n result = await tryWorkspacePatterns<T>(symlinkPaths);\n if (result) return result;\n\n // Try common workspace patterns as final fallback\n const commonPaths = getCommonWorkspacePaths(packageName, subPath);\n result = await tryWorkspacePatterns<T>(commonPaths);\n if (result) return result;\n\n return null;\n}\n","import type {\n ProcessorFactoryBuilder,\n SubgraphClass,\n} from \"@powerhousedao/reactor-api\";\nimport type { DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { childLogger } from \"document-model\";\nimport { execSync } from \"node:child_process\";\nimport path from \"node:path\";\nimport { resolveLinkedPackage } from \"./import-resolver.js\";\n\n// Define the expected module export structures\ntype DocumentModelsExport = Record<string, DocumentModelModule>;\ntype SubgraphsExport = Record<string, Record<string, SubgraphClass>>;\ntype ProcessorsExport = {\n processorFactory?: ProcessorFactoryBuilder;\n processorFactoryLegacy?: ProcessorFactoryBuilder;\n};\n\nconst logger = childLogger([\"reactor-api\", \"packages/util\"]);\n\nexport const installPackages = async (packages: string[]) => {\n for (const packageName of packages) {\n execSync(`ph install ${packageName}`);\n }\n};\n\nexport const readManifest = () => {\n const manifest = execSync(`ph manifest`).toString();\n return manifest;\n};\n\n/**\n * Tries to import document models from a package. This function cannot throw.\n */\nexport async function loadDocumentModels(\n packageName: string,\n): Promise<DocumentModelsExport | null> {\n return loadDependency(packageName, \"document-models\");\n}\n\n/**\n * Tries to import subgraphs from a package. This function cannot throw.\n */\nexport async function loadSubgraphs(\n packageName: string,\n): Promise<SubgraphsExport | null> {\n return loadDependency(packageName, \"subgraphs\");\n}\n\n/**\n * Tries to import processors from a package. This function cannot throw.\n */\nexport async function loadProcessors(\n packageName: string,\n): Promise<ProcessorsExport | null> {\n return loadDependency(packageName, \"processors\");\n}\n\n/**\n * Generic dependency loader - tries to import a dependency from a package. This function cannot throw.\n * Returns null if the dependency cannot be loaded.\n */\nasync function loadDependency<T = unknown>(\n packageName: string,\n subPath: string,\n): Promise<T> {\n const fullPath = `${packageName}/${subPath}`;\n\n // Try the standard import first\n try {\n // vite does not support this, but that's okay as we have provided the\n // vite-loader for this purpose\n\n const module = (await import(/* @vite-ignore */ fullPath)) as T;\n return module;\n } catch (e) {\n // Handle module not found errors with fallback resolution\n if (\n e instanceof Error &&\n \"code\" in e &&\n (e.code === \"ERR_MODULE_NOT_FOUND\" ||\n e.code === \"ERR_UNSUPPORTED_DIR_IMPORT\")\n ) {\n const result = await resolveLinkedPackage<T>(packageName, subPath);\n if (result) return result;\n }\n throw e;\n }\n}\n\nexport function debounce<T extends unknown[], R>(\n func: (...args: T) => Promise<R>,\n delay = 250,\n) {\n let timer: number;\n return (immediate = false, ...args: T) => {\n if (timer) {\n clearTimeout(timer);\n }\n return new Promise<R>((resolve, reject) => {\n if (immediate) {\n func(...args)\n .then(resolve)\n .catch(reject);\n } else {\n timer = setTimeout(() => {\n func(...args)\n .then(resolve)\n .catch(reject);\n }, delay) as unknown as number;\n }\n });\n };\n}\n\nexport function isSubpath(parent: string, dir: string) {\n const relative = path.relative(parent, dir);\n return relative && !relative.startsWith(\"..\") && !path.isAbsolute(relative);\n}\n","import type {\n GqlDocument,\n GqlDriveDocument,\n GqlOperation,\n SubgraphClass,\n} from \"@powerhousedao/reactor-api\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type {\n Operation,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\nimport { BaseSubgraph } from \"./base-subgraph.js\";\n\nexport function isSubgraphClass(\n candidate: unknown,\n): candidate is SubgraphClass {\n if (typeof candidate !== \"function\") return false;\n\n let proto: unknown = Object.getPrototypeOf(candidate);\n while (proto) {\n if (Object.prototype.isPrototypeOf.call(proto, BaseSubgraph)) return true;\n\n proto = Object.getPrototypeOf(proto);\n }\n\n return false;\n}\n\nexport function buildGraphqlOperations(\n operations: Operation[],\n skip: number,\n first: number,\n): GqlOperation[] {\n return operations.slice(skip, skip + first).map(buildGraphqlOperation);\n}\n\nexport function buildGraphqlOperation(operation: Operation): GqlOperation {\n const signer = operation.action.context?.signer;\n return {\n id: operation.id ?? \"\",\n type: operation.action.type,\n index: operation.index,\n timestampUtcMs: operation.timestampUtcMs,\n hash: operation.hash,\n skip: operation.skip,\n inputText:\n typeof operation.action.input === \"string\"\n ? operation.action.input\n : JSON.stringify(operation.action.input),\n error: operation.error,\n context: {\n signer: signer\n ? {\n user: signer.user,\n app: signer.app,\n signatures: signer.signatures.map((sig) =>\n Array.isArray(sig) ? sig.join(\", \") : sig,\n ),\n }\n : undefined,\n },\n };\n}\n\nexport function buildGraphQlDocument(doc: PHDocument): GqlDocument {\n // Return full state with all scopes (auth, document, global, local)\n // This matches the ReactorSubgraph pattern in adapters.ts\n const state = doc.state;\n const initialState = doc.initialState;\n // For stateJSON, use global state for backward compatibility\n const globalState = \"global\" in doc.state ? doc.state.global : {};\n return {\n id: doc.header.id,\n name: doc.header.name,\n documentType: doc.header.documentType,\n revision: doc.header.revision.global || 0,\n createdAtUtcIso: doc.header.createdAtUtcIso,\n lastModifiedAtUtcIso: doc.header.lastModifiedAtUtcIso,\n operations: [],\n stateJSON: globalState as JSON,\n state,\n initialState,\n };\n}\n\nexport function buildGraphQlDriveDocument(\n doc: DocumentDriveDocument,\n): GqlDriveDocument {\n const gqlDoc = buildGraphQlDocument(doc);\n return {\n ...gqlDoc,\n meta: {\n preferredEditor: doc.header.meta?.preferredEditor,\n },\n slug: doc.header.slug,\n state: doc.state.global,\n initialState: doc.state.global,\n };\n}\n"],"names":[],"mappings":";;;;;;;AAoBA,IAAa,eAAb,MAA+C;CAC7C,OAAO;CACP,OAAO;CACP,YAAiC,EAC/B,OAAO,EACL,aAAa,KAAK,MACnB,EACF;CACD,WAAyB,GAAG;;;;;CAK5B;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,MAAoB;AAC9B,OAAK,gBAAgB,KAAK;AAC1B,OAAK,iBAAiB,KAAK;AAC3B,OAAK,eAAe,KAAK;AACzB,OAAK,cAAc,KAAK;AACxB,OAAK,4BAA4B,KAAK;AACtC,OAAK,uBAAuB,KAAK;AACjC,OAAK,OAAO,KAAK,QAAQ;;CAG3B,MAAM,UAAU;CAQhB,iBAA2C;AACzC,SAAO,OAAO,eAA0C;AACtD,OAAI;AAKF,YAJe,MAAM,KAAK,cAAc,yBACtC,YACA,QACD,EACa,QAAQ,KAAK,QAAQ,IAAI,OAAO,GAAG;WAC3C;AACN,W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;EACf,MAAM,IAAI,OAAO;EACjB,cAAc,IAAI,OAAO;EACzB,UAAU,IAAI,OAAO,SAAS,UAAU;EACxC,iBAAiB,IAAI,OAAO;EAC5B,sBAAsB,IAAI,OAAO;EACjC,YAAY,EAAE;EACd,WAAW;EACX;EACA;EACD;;AAGH,SAAgB,0BACd,KACkB;AAElB,QAAO;EACL,GAFa,qBAAqB,IAAI;EAGtC,MAAM,EACJ,iBAAiB,IAAI,OAAO,MAAM,iBACnC;EACD,MAAM,IAAI,OAAO;EACjB,OAAO,IAAI,MAAM;EACjB,cAAc,IAAI,MAAM;EACzB","debug_id":"e8b85da7-0078-579c-8d72-5c00006a8107"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/reactor-api",
3
- "version": "6.0.0-staging.3",
3
+ "version": "6.0.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "repository": {
@@ -9,22 +9,25 @@
9
9
  },
10
10
  "exports": {
11
11
  ".": {
12
- "import": "./dist/index.js",
13
- "types": "./dist/index.d.ts"
12
+ "source": "./index.mts",
13
+ "types": "./dist/index.d.mts",
14
+ "import": "./dist/index.mjs"
14
15
  },
15
- "./graphql": {
16
- "import": "./dist/graphql/index.js",
17
- "types": "./dist/graphql/index.d.ts"
16
+ "./vite": {
17
+ "source": "./src/packages/vite-loader.mts",
18
+ "types": "./dist/vite-loader.d.mts",
19
+ "import": "./dist/src/packages/vite-loader.mjs"
18
20
  },
19
- "./graphql/*": {
20
- "import": "./dist/graphql/*.js",
21
- "types": "./dist/graphql/*.d.ts"
21
+ "./https-hooks": {
22
+ "source": "./src/packages/https-hooks.mts",
23
+ "types": "./dist/https-hooks.d.mts",
24
+ "import": "./dist/src/packages/https-hooks.mjs"
22
25
  },
23
26
  "./test": {
24
27
  "import": "./test/index.ts"
25
28
  }
26
29
  },
27
- "types": "./dist/index.d.ts",
30
+ "types": "./dist/index.d.mts",
28
31
  "files": [
29
32
  "dist"
30
33
  ],
@@ -36,48 +39,50 @@
36
39
  "author": "",
37
40
  "license": "AGPL-3.0-only",
38
41
  "dependencies": {
39
- "@apollo/gateway": "^2.11.3",
40
- "@apollo/server": "^5.0.0",
41
- "@apollo/subgraph": "^2.11.3",
42
+ "@apollo/gateway": "^2.13.2",
43
+ "@apollo/server": "^5.5.1",
44
+ "@apollo/subgraph": "^2.13.2",
42
45
  "@as-integrations/express4": "^1.1.2",
43
46
  "@electric-sql/pglite": "0.3.15",
44
- "@opentelemetry/auto-instrumentations-node": "^0.57.1",
45
- "@opentelemetry/exporter-trace-otlp-http": "^0.57.2",
46
- "@opentelemetry/resources": "^1.29.0",
47
- "@opentelemetry/sdk-node": "^0.57.2",
48
- "@opentelemetry/sdk-trace-base": "^1.29.0",
49
- "@opentelemetry/semantic-conventions": "^1.29.0",
50
47
  "@originjs/vite-plugin-commonjs": "^1.0.3",
51
- "@powerhousedao/analytics-engine-core": "0.6.4",
52
- "@powerhousedao/analytics-engine-graphql": "0.6.4",
53
- "@powerhousedao/analytics-engine-pg": "0.6.4",
54
- "@powerhousedao/document-engineering": "1.40.1",
48
+ "@powerhousedao/document-engineering": "1.40.5",
49
+ "@fastify/cors": "^11.0.1",
50
+ "@mercuriusjs/gateway": "^5.2.0",
51
+ "mercurius": "^16.8.0",
52
+ "@fastify/formbody": "^8.0.1",
53
+ "@fastify/middie": "^9.3.2",
55
54
  "body-parser": "^1.20.3",
55
+ "fastify": "^5.8.5",
56
56
  "change-case": "5.4.4",
57
57
  "cors": "^2.8.5",
58
58
  "devcert": "^1.2.2",
59
59
  "dotenv": "^16.4.5",
60
- "express": "^4.21.1",
61
- "graphql": "16.12.0",
60
+ "express": "4.21.1",
61
+ "graphql-sse": "2.6.0",
62
62
  "graphql-subscriptions": "^3.0.0",
63
63
  "graphql-type-json": "^0.3.2",
64
- "graphql-ws": "^6.0.6",
64
+ "graphql-ws": "6.0.7",
65
65
  "knex": "3.1.0",
66
66
  "knex-pglite": "0.13.0",
67
- "kysely": "0.28.11",
67
+ "kysely": "0.28.16",
68
68
  "kysely-knex": "0.2.0",
69
- "path-to-regexp": "^8.3.0",
69
+ "path-to-regexp": "^8.4.0",
70
70
  "pg": "8.18.0",
71
71
  "read-pkg": "10.1.0",
72
72
  "ws": "^8.18.3",
73
73
  "zod": "4.3.6",
74
- "@powerhousedao/config": "6.0.0-staging.3",
75
- "@renown/sdk": "6.0.0-staging.3",
76
- "@powerhousedao/reactor": "6.0.0-staging.3",
77
- "document-drive": "6.0.0-staging.3",
78
- "@powerhousedao/reactor-mcp": "6.0.0-staging.3",
79
- "document-model": "6.0.0-staging.3",
80
- "@powerhousedao/shared": "6.0.0-staging.3"
74
+ "@powerhousedao/config": "6.0.0",
75
+ "@powerhousedao/pglite-fs": "6.0.0",
76
+ "@powerhousedao/analytics-engine-core": "6.0.0",
77
+ "@powerhousedao/analytics-engine-graphql": "6.0.0",
78
+ "@powerhousedao/reactor": "6.0.0",
79
+ "@powerhousedao/analytics-engine-pg": "6.0.0",
80
+ "@powerhousedao/reactor-attachments": "6.0.0",
81
+ "@powerhousedao/reactor-drive": "6.0.0",
82
+ "@powerhousedao/shared": "6.0.0",
83
+ "@powerhousedao/reactor-mcp": "6.0.0",
84
+ "@renown/sdk": "6.0.0",
85
+ "document-model": "6.0.0"
81
86
  },
82
87
  "devDependencies": {
83
88
  "@graphql-codegen/cli": "6.1.1",
@@ -87,23 +92,36 @@
87
92
  "@graphql-codegen/typescript-resolvers": "5.1.5",
88
93
  "@types/body-parser": "^1.19.5",
89
94
  "@types/cors": "^2.8.17",
90
- "@types/express": "^4.17.25",
95
+ "@types/express": "4.17.25",
91
96
  "@types/node": "25.2.3",
92
97
  "@types/pg": "8.16.0",
93
98
  "@types/ws": "^8.18.1",
94
- "copyfiles": "2.4.1",
95
- "graphql-tag": "2.12.6",
99
+ "graphql": "^16",
100
+ "graphql-tag": "^2",
101
+ "tsdown": "0.21.1",
96
102
  "msw": "^2.7.3",
97
- "vite": "7.3.1",
98
- "vitest": "3.2.4"
103
+ "vitest": "4.1.1"
104
+ },
105
+ "peerDependencies": {
106
+ "graphql": "^16",
107
+ "graphql-tag": "^2",
108
+ "vite": "^8.0.0"
109
+ },
110
+ "peerDependenciesMeta": {
111
+ "vite": {
112
+ "optional": true
113
+ }
99
114
  },
100
115
  "scripts": {
101
116
  "tsc": "tsc",
102
- "build:misc": "copyfiles -u 0 \"src/**/*.graphql\" dist/",
117
+ "build": "tsdown",
103
118
  "lint": "eslint",
104
119
  "test": "vitest --run",
105
120
  "bench": "vitest bench",
106
121
  "codegen": "graphql-codegen --config codegen.ts && prettier --write src/graphql/reactor/gen/*.ts && eslint --fix src/graphql/reactor/gen/*.ts --no-warn-ignored",
107
- "codegen:watch": "graphql-codegen --config codegen.ts --watch"
122
+ "codegen:watch": "graphql-codegen --config codegen.ts --watch",
123
+ "dev": "tsx src/dev.ts",
124
+ "capture-hub-dump": "tsx scripts/capture-hub-dump.ts",
125
+ "convert-hub-dump": "tsx scripts/convert-hub-dump.ts"
108
126
  }
109
127
  }
package/dist/codegen.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { CodegenConfig } from "@graphql-codegen/cli";
2
- declare const config: CodegenConfig;
3
- export default config;
4
- //# sourceMappingURL=codegen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../codegen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,QAAA,MAAM,MAAM,EAAE,aAmCb,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/codegen.js DELETED
@@ -1,38 +0,0 @@
1
- const config = {
2
- schema: "./src/graphql/reactor/*.graphql",
3
- documents: ["./src/graphql/reactor/operations.graphql"],
4
- generates: {
5
- "./src/graphql/reactor/gen/graphql.ts": {
6
- plugins: [
7
- "typescript",
8
- "typescript-operations",
9
- "typescript-resolvers",
10
- "typescript-validation-schema",
11
- "typescript-generic-sdk",
12
- ],
13
- config: {
14
- contextType: "../../types.js#Context",
15
- scalars: {
16
- JSONObject: "NonNullable<unknown>",
17
- DateTime: "string | Date",
18
- },
19
- scalarSchemas: {
20
- JSONObject: "z.custom<NonNullable<unknown>>((v) => v != null)",
21
- DateTime: "z.union([z.string(), z.date()])",
22
- },
23
- useIndexSignature: true,
24
- strictScalars: true,
25
- skipTypename: true,
26
- enumsAsTypes: false,
27
- constEnums: false,
28
- immutableTypes: true,
29
- maybeValue: "T | null | undefined",
30
- arrayInputCoercion: false,
31
- schema: "zodv4",
32
- gqlImport: "graphql-tag#gql",
33
- },
34
- },
35
- },
36
- };
37
- export default config;
38
- //# sourceMappingURL=codegen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codegen.js","sourceRoot":"","sources":["../codegen.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAkB;IAC5B,MAAM,EAAE,iCAAiC;IACzC,SAAS,EAAE,CAAC,0CAA0C,CAAC;IACvD,SAAS,EAAE;QACT,sCAAsC,EAAE;YACtC,OAAO,EAAE;gBACP,YAAY;gBACZ,uBAAuB;gBACvB,sBAAsB;gBACtB,8BAA8B;gBAC9B,wBAAwB;aACzB;YACD,MAAM,EAAE;gBACN,WAAW,EAAE,wBAAwB;gBACrC,OAAO,EAAE;oBACP,UAAU,EAAE,sBAAsB;oBAClC,QAAQ,EAAE,eAAe;iBAC1B;gBACD,aAAa,EAAE;oBACb,UAAU,EAAE,kDAAkD;oBAC9D,QAAQ,EAAE,iCAAiC;iBAC5C;gBACD,iBAAiB,EAAE,IAAI;gBACvB,aAAa,EAAE,IAAI;gBACnB,YAAY,EAAE,IAAI;gBAClB,YAAY,EAAE,KAAK;gBACnB,UAAU,EAAE,KAAK;gBACjB,cAAc,EAAE,IAAI;gBACpB,UAAU,EAAE,sBAAsB;gBAClC,kBAAkB,EAAE,KAAK;gBACzB,MAAM,EAAE,OAAO;gBACf,SAAS,EAAE,iBAAiB;aAC7B;SACF;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- export * from "./src/graphql/index.js";
2
- export * from "./src/graphql/types.js";
3
- export * from "./src/packages/import-loader.js";
4
- export * from "./src/packages/package-manager.js";
5
- export * from "./src/packages/vite-loader.js";
6
- export * from "./src/server.js";
7
- export * from "./src/services/auth.service.js";
8
- export * from "./src/services/document-permission.service.js";
9
- export * from "./src/sync/types.js";
10
- export * from "./src/sync/utils.js";
11
- export * from "./src/tracing.js";
12
- export * from "./src/types.js";
13
- export * from "./src/utils/index.js";
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
package/dist/index.js DELETED
@@ -1,14 +0,0 @@
1
- export * from "./src/graphql/index.js";
2
- export * from "./src/graphql/types.js";
3
- export * from "./src/packages/import-loader.js";
4
- export * from "./src/packages/package-manager.js";
5
- export * from "./src/packages/vite-loader.js";
6
- export * from "./src/server.js";
7
- export * from "./src/services/auth.service.js";
8
- export * from "./src/services/document-permission.service.js";
9
- export * from "./src/sync/types.js";
10
- export * from "./src/sync/utils.js";
11
- export * from "./src/tracing.js";
12
- export * from "./src/types.js";
13
- export * from "./src/utils/index.js";
14
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
@@ -1,6 +0,0 @@
1
- import { AnalyticsSubgraph } from "./graphql/analytics-subgraph.js";
2
- export declare const config: {
3
- basePath: string;
4
- };
5
- export declare const DefaultCoreSubgraphs: readonly [typeof AnalyticsSubgraph];
6
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,eAAO,MAAM,oBAAoB,qCAA+B,CAAC"}
@@ -1,6 +0,0 @@
1
- import { AnalyticsSubgraph } from "./graphql/analytics-subgraph.js";
2
- export const config = {
3
- basePath: process.env.BASE_PATH || "/",
4
- };
5
- export const DefaultCoreSubgraphs = [AnalyticsSubgraph];
6
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,GAAG;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,iBAAiB,CAAU,CAAC"}
@@ -1,14 +0,0 @@
1
- import type { GraphQLResolverMap } from "@apollo/subgraph/dist/schema-helper/resolverMap.js";
2
- import type { IAnalyticsStore } from "@powerhousedao/analytics-engine-core";
3
- import { AnalyticsModel } from "@powerhousedao/analytics-engine-graphql";
4
- import type { Context, SubgraphArgs } from "@powerhousedao/reactor-api";
5
- import { BaseSubgraph } from "./base-subgraph.js";
6
- export declare class AnalyticsSubgraph extends BaseSubgraph {
7
- analyticsStore: IAnalyticsStore;
8
- analyticsModel: AnalyticsModel;
9
- name: string;
10
- typeDefs: import("graphql").DocumentNode;
11
- resolvers: GraphQLResolverMap<Context>;
12
- constructor(args: SubgraphArgs);
13
- }
14
- //# sourceMappingURL=analytics-subgraph.d.ts.map