@powerhousedao/reactor-api 6.0.0-dev.24 → 6.0.0-dev.241

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 (330) hide show
  1. package/README.md +6 -0
  2. package/dist/index.d.mts +3034 -0
  3. package/dist/index.d.mts.map +1 -0
  4. package/dist/index.mjs +6612 -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-CHCRSWig.mjs +289 -0
  17. package/dist/utils-CHCRSWig.mjs.map +1 -0
  18. package/package.json +69 -69
  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 -7
  28. package/dist/src/config.d.ts.map +0 -1
  29. package/dist/src/config.js +0 -10
  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 -45
  53. package/dist/src/graphql/document-model-subgraph.d.ts.map +0 -1
  54. package/dist/src/graphql/document-model-subgraph.js +0 -237
  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 -487
  59. package/dist/src/graphql/drive-subgraph.js.map +0 -1
  60. package/dist/src/graphql/graphql-manager.d.ts +0 -47
  61. package/dist/src/graphql/graphql-manager.d.ts.map +0 -1
  62. package/dist/src/graphql/graphql-manager.js +0 -433
  63. package/dist/src/graphql/graphql-manager.js.map +0 -1
  64. package/dist/src/graphql/index.d.ts +0 -9
  65. package/dist/src/graphql/index.d.ts.map +0 -1
  66. package/dist/src/graphql/index.js +0 -9
  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 -84
  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 -1242
  81. package/dist/src/graphql/reactor/gen/graphql.d.ts.map +0 -1
  82. package/dist/src/graphql/reactor/gen/graphql.js +0 -496
  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 -253
  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 -53
  100. package/dist/src/graphql/reactor/requester.with-zod.js.map +0 -1
  101. package/dist/src/graphql/reactor/resolvers.d.ts +0 -175
  102. package/dist/src/graphql/reactor/resolvers.d.ts.map +0 -1
  103. package/dist/src/graphql/reactor/resolvers.js +0 -526
  104. package/dist/src/graphql/reactor/resolvers.js.map +0 -1
  105. package/dist/src/graphql/reactor/schema.graphql +0 -432
  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 -555
  109. package/dist/src/graphql/reactor/subgraph.js.map +0 -1
  110. package/dist/src/graphql/reactor/validation.d.ts +0 -102
  111. package/dist/src/graphql/reactor/validation.d.ts.map +0 -1
  112. package/dist/src/graphql/reactor/validation.js +0 -73
  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 -3
  123. package/dist/src/graphql/system/index.d.ts.map +0 -1
  124. package/dist/src/graphql/system/index.js +0 -3
  125. package/dist/src/graphql/system/index.js.map +0 -1
  126. package/dist/src/graphql/system/system-subgraph.d.ts +0 -49
  127. package/dist/src/graphql/system/system-subgraph.d.ts.map +0 -1
  128. package/dist/src/graphql/system/system-subgraph.js +0 -130
  129. package/dist/src/graphql/system/system-subgraph.js.map +0 -1
  130. package/dist/src/graphql/system/types.d.ts +0 -2
  131. package/dist/src/graphql/system/types.d.ts.map +0 -1
  132. package/dist/src/graphql/system/types.js +0 -2
  133. package/dist/src/graphql/system/types.js.map +0 -1
  134. package/dist/src/graphql/temp-hack-rwa-type-defs.d.ts +0 -57
  135. package/dist/src/graphql/temp-hack-rwa-type-defs.d.ts.map +0 -1
  136. package/dist/src/graphql/temp-hack-rwa-type-defs.js +0 -2
  137. package/dist/src/graphql/temp-hack-rwa-type-defs.js.map +0 -1
  138. package/dist/src/graphql/types.d.ts +0 -103
  139. package/dist/src/graphql/types.d.ts.map +0 -1
  140. package/dist/src/graphql/types.js +0 -2
  141. package/dist/src/graphql/types.js.map +0 -1
  142. package/dist/src/graphql/utils.d.ts +0 -26
  143. package/dist/src/graphql/utils.d.ts.map +0 -1
  144. package/dist/src/graphql/utils.js +0 -100
  145. package/dist/src/graphql/utils.js.map +0 -1
  146. package/dist/src/graphql/websocket.d.ts +0 -3
  147. package/dist/src/graphql/websocket.d.ts.map +0 -1
  148. package/dist/src/graphql/websocket.js +0 -15
  149. package/dist/src/graphql/websocket.js.map +0 -1
  150. package/dist/src/migrations/001_create_document_permissions.d.ts +0 -4
  151. package/dist/src/migrations/001_create_document_permissions.d.ts.map +0 -1
  152. package/dist/src/migrations/001_create_document_permissions.js +0 -91
  153. package/dist/src/migrations/001_create_document_permissions.js.map +0 -1
  154. package/dist/src/migrations/index.d.ts +0 -10
  155. package/dist/src/migrations/index.d.ts.map +0 -1
  156. package/dist/src/migrations/index.js +0 -56
  157. package/dist/src/migrations/index.js.map +0 -1
  158. package/dist/src/packages/import-loader.d.ts +0 -16
  159. package/dist/src/packages/import-loader.d.ts.map +0 -1
  160. package/dist/src/packages/import-loader.js +0 -61
  161. package/dist/src/packages/import-loader.js.map +0 -1
  162. package/dist/src/packages/import-resolver.d.ts +0 -5
  163. package/dist/src/packages/import-resolver.d.ts.map +0 -1
  164. package/dist/src/packages/import-resolver.js +0 -127
  165. package/dist/src/packages/import-resolver.js.map +0 -1
  166. package/dist/src/packages/package-manager.d.ts +0 -34
  167. package/dist/src/packages/package-manager.d.ts.map +0 -1
  168. package/dist/src/packages/package-manager.js +0 -213
  169. package/dist/src/packages/package-manager.js.map +0 -1
  170. package/dist/src/packages/types.d.ts +0 -39
  171. package/dist/src/packages/types.d.ts.map +0 -1
  172. package/dist/src/packages/types.js +0 -2
  173. package/dist/src/packages/types.js.map +0 -1
  174. package/dist/src/packages/util.d.ts +0 -27
  175. package/dist/src/packages/util.d.ts.map +0 -1
  176. package/dist/src/packages/util.js +0 -97
  177. package/dist/src/packages/util.js.map +0 -1
  178. package/dist/src/packages/vite-loader.d.ts +0 -24
  179. package/dist/src/packages/vite-loader.d.ts.map +0 -1
  180. package/dist/src/packages/vite-loader.js +0 -172
  181. package/dist/src/packages/vite-loader.js.map +0 -1
  182. package/dist/src/server.d.ts +0 -73
  183. package/dist/src/server.d.ts.map +0 -1
  184. package/dist/src/server.js +0 -431
  185. package/dist/src/server.js.map +0 -1
  186. package/dist/src/services/auth.service.d.ts +0 -68
  187. package/dist/src/services/auth.service.d.ts.map +0 -1
  188. package/dist/src/services/auth.service.js +0 -199
  189. package/dist/src/services/auth.service.js.map +0 -1
  190. package/dist/src/services/document-permission.service.d.ts +0 -201
  191. package/dist/src/services/document-permission.service.d.ts.map +0 -1
  192. package/dist/src/services/document-permission.service.js +0 -636
  193. package/dist/src/services/document-permission.service.js.map +0 -1
  194. package/dist/src/sync/types.d.ts +0 -10
  195. package/dist/src/sync/types.d.ts.map +0 -1
  196. package/dist/src/sync/types.js +0 -2
  197. package/dist/src/sync/types.js.map +0 -1
  198. package/dist/src/sync/utils.d.ts +0 -7
  199. package/dist/src/sync/utils.d.ts.map +0 -1
  200. package/dist/src/sync/utils.js +0 -78
  201. package/dist/src/sync/utils.js.map +0 -1
  202. package/dist/src/tracing.d.ts +0 -4
  203. package/dist/src/tracing.d.ts.map +0 -1
  204. package/dist/src/tracing.js +0 -122
  205. package/dist/src/tracing.js.map +0 -1
  206. package/dist/src/types.d.ts +0 -18
  207. package/dist/src/types.d.ts.map +0 -1
  208. package/dist/src/types.js +0 -2
  209. package/dist/src/types.js.map +0 -1
  210. package/dist/src/utils/auth.d.ts +0 -3
  211. package/dist/src/utils/auth.d.ts.map +0 -1
  212. package/dist/src/utils/auth.js +0 -19
  213. package/dist/src/utils/auth.js.map +0 -1
  214. package/dist/src/utils/create-schema.d.ts +0 -11
  215. package/dist/src/utils/create-schema.d.ts.map +0 -1
  216. package/dist/src/utils/create-schema.js +0 -322
  217. package/dist/src/utils/create-schema.js.map +0 -1
  218. package/dist/src/utils/db.d.ts +0 -74
  219. package/dist/src/utils/db.d.ts.map +0 -1
  220. package/dist/src/utils/db.js +0 -101
  221. package/dist/src/utils/db.js.map +0 -1
  222. package/dist/src/utils/drive-url.d.ts +0 -2
  223. package/dist/src/utils/drive-url.d.ts.map +0 -1
  224. package/dist/src/utils/drive-url.js +0 -3
  225. package/dist/src/utils/drive-url.js.map +0 -1
  226. package/dist/src/utils/index.d.ts +0 -4
  227. package/dist/src/utils/index.d.ts.map +0 -1
  228. package/dist/src/utils/index.js +0 -4
  229. package/dist/src/utils/index.js.map +0 -1
  230. package/dist/test/benchmarks/load.bench.d.ts +0 -2
  231. package/dist/test/benchmarks/load.bench.d.ts.map +0 -1
  232. package/dist/test/benchmarks/load.bench.js +0 -73
  233. package/dist/test/benchmarks/load.bench.js.map +0 -1
  234. package/dist/test/benchmarks/sync.bench.d.ts +0 -2
  235. package/dist/test/benchmarks/sync.bench.d.ts.map +0 -1
  236. package/dist/test/benchmarks/sync.bench.js +0 -119
  237. package/dist/test/benchmarks/sync.bench.js.map +0 -1
  238. package/dist/test/document-model-subgraph-legacy-permissions.test.d.ts +0 -2
  239. package/dist/test/document-model-subgraph-legacy-permissions.test.d.ts.map +0 -1
  240. package/dist/test/document-model-subgraph-legacy-permissions.test.js +0 -518
  241. package/dist/test/document-model-subgraph-legacy-permissions.test.js.map +0 -1
  242. package/dist/test/document-permission.service.test.d.ts +0 -2
  243. package/dist/test/document-permission.service.test.d.ts.map +0 -1
  244. package/dist/test/document-permission.service.test.js +0 -480
  245. package/dist/test/document-permission.service.test.js.map +0 -1
  246. package/dist/test/drive-handlers.d.ts +0 -4
  247. package/dist/test/drive-handlers.d.ts.map +0 -1
  248. package/dist/test/drive-handlers.js +0 -39
  249. package/dist/test/drive-handlers.js.map +0 -1
  250. package/dist/test/drive-subgraph-permissions.test.d.ts +0 -2
  251. package/dist/test/drive-subgraph-permissions.test.d.ts.map +0 -1
  252. package/dist/test/drive-subgraph-permissions.test.js +0 -195
  253. package/dist/test/drive-subgraph-permissions.test.js.map +0 -1
  254. package/dist/test/drive.test.d.ts +0 -2
  255. package/dist/test/drive.test.d.ts.map +0 -1
  256. package/dist/test/drive.test.js +0 -142
  257. package/dist/test/drive.test.js.map +0 -1
  258. package/dist/test/identity-integration.test.d.ts +0 -2
  259. package/dist/test/identity-integration.test.d.ts.map +0 -1
  260. package/dist/test/identity-integration.test.js +0 -349
  261. package/dist/test/identity-integration.test.js.map +0 -1
  262. package/dist/test/index.d.ts +0 -3
  263. package/dist/test/index.d.ts.map +0 -1
  264. package/dist/test/index.js +0 -3
  265. package/dist/test/index.js.map +0 -1
  266. package/dist/test/permissions-integration.test.d.ts +0 -2
  267. package/dist/test/permissions-integration.test.d.ts.map +0 -1
  268. package/dist/test/permissions-integration.test.js +0 -421
  269. package/dist/test/permissions-integration.test.js.map +0 -1
  270. package/dist/test/pull-responder-transmitter.test.d.ts +0 -2
  271. package/dist/test/pull-responder-transmitter.test.d.ts.map +0 -1
  272. package/dist/test/pull-responder-transmitter.test.js +0 -220
  273. package/dist/test/pull-responder-transmitter.test.js.map +0 -1
  274. package/dist/test/push-transmitter.test.d.ts +0 -2
  275. package/dist/test/push-transmitter.test.d.ts.map +0 -1
  276. package/dist/test/push-transmitter.test.js +0 -179
  277. package/dist/test/push-transmitter.test.js.map +0 -1
  278. package/dist/test/reactor-adapters.test.d.ts +0 -2
  279. package/dist/test/reactor-adapters.test.d.ts.map +0 -1
  280. package/dist/test/reactor-adapters.test.js +0 -379
  281. package/dist/test/reactor-adapters.test.js.map +0 -1
  282. package/dist/test/reactor-client.test.d.ts +0 -2
  283. package/dist/test/reactor-client.test.d.ts.map +0 -1
  284. package/dist/test/reactor-client.test.js +0 -212
  285. package/dist/test/reactor-client.test.js.map +0 -1
  286. package/dist/test/reactor-resolvers.test.d.ts +0 -2
  287. package/dist/test/reactor-resolvers.test.d.ts.map +0 -1
  288. package/dist/test/reactor-resolvers.test.js +0 -261
  289. package/dist/test/reactor-resolvers.test.js.map +0 -1
  290. package/dist/test/reactor-subgraph-permissions.test.d.ts +0 -2
  291. package/dist/test/reactor-subgraph-permissions.test.d.ts.map +0 -1
  292. package/dist/test/reactor-subgraph-permissions.test.js +0 -400
  293. package/dist/test/reactor-subgraph-permissions.test.js.map +0 -1
  294. package/dist/test/router.test.d.ts +0 -2
  295. package/dist/test/router.test.d.ts.map +0 -1
  296. package/dist/test/router.test.js +0 -38
  297. package/dist/test/router.test.js.map +0 -1
  298. package/dist/test/subscriptions.test.d.ts +0 -2
  299. package/dist/test/subscriptions.test.d.ts.map +0 -1
  300. package/dist/test/subscriptions.test.js +0 -246
  301. package/dist/test/subscriptions.test.js.map +0 -1
  302. package/dist/test/system.test.d.ts +0 -2
  303. package/dist/test/system.test.d.ts.map +0 -1
  304. package/dist/test/system.test.js +0 -211
  305. package/dist/test/system.test.js.map +0 -1
  306. package/dist/test/three-reactor-gql-sync.test.d.ts +0 -2
  307. package/dist/test/three-reactor-gql-sync.test.d.ts.map +0 -1
  308. package/dist/test/three-reactor-gql-sync.test.js +0 -368
  309. package/dist/test/three-reactor-gql-sync.test.js.map +0 -1
  310. package/dist/test/two-reactor-gql-catchup-duplicate.test.d.ts +0 -2
  311. package/dist/test/two-reactor-gql-catchup-duplicate.test.d.ts.map +0 -1
  312. package/dist/test/two-reactor-gql-catchup-duplicate.test.js +0 -264
  313. package/dist/test/two-reactor-gql-catchup-duplicate.test.js.map +0 -1
  314. package/dist/test/two-reactor-gql-sync.test.d.ts +0 -2
  315. package/dist/test/two-reactor-gql-sync.test.d.ts.map +0 -1
  316. package/dist/test/two-reactor-gql-sync.test.js +0 -348
  317. package/dist/test/two-reactor-gql-sync.test.js.map +0 -1
  318. package/dist/test/utils/gql-resolver-bridge.d.ts +0 -12
  319. package/dist/test/utils/gql-resolver-bridge.d.ts.map +0 -1
  320. package/dist/test/utils/gql-resolver-bridge.js +0 -60
  321. package/dist/test/utils/gql-resolver-bridge.js.map +0 -1
  322. package/dist/test/utils.d.ts +0 -10
  323. package/dist/test/utils.d.ts.map +0 -1
  324. package/dist/test/utils.js +0 -23
  325. package/dist/test/utils.js.map +0 -1
  326. package/dist/tsconfig.tsbuildinfo +0 -1
  327. package/dist/vitest.config.d.ts +0 -3
  328. package/dist/vitest.config.d.ts.map +0 -1
  329. package/dist/vitest.config.js +0 -38
  330. package/dist/vitest.config.js.map +0 -1
@@ -0,0 +1,289 @@
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]="24a89c58-9371-5eb9-9d53-da949ef27f28")}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 = [`${packageName}/dist/${subPath}/index.js`, `${packageName}/dist/${subPath}.js`];
88
+ for (const suggestedPath of suggestedPaths) try {
89
+ return await import(
90
+ /* @vite-ignore */
91
+ suggestedPath
92
+ );
93
+ } catch {}
94
+ return null;
95
+ }
96
+ /**
97
+ * Attempts to resolve package using import.meta.resolve
98
+ */
99
+ async function tryImportMetaResolve(packageName, subPath) {
100
+ try {
101
+ const resolvedUrl = import.meta.resolve?.(`${packageName}/package.json`);
102
+ if (!resolvedUrl) return null;
103
+ const packageRoot = path.dirname(new URL(resolvedUrl).pathname);
104
+ const pathsToTry = [
105
+ path.join(packageRoot, "dist", subPath, "index.js"),
106
+ path.join(packageRoot, "dist", `${subPath}.js`),
107
+ path.join(packageRoot, subPath, "index.js"),
108
+ path.join(packageRoot, `${subPath}.js`)
109
+ ];
110
+ for (const attemptPath of pathsToTry) try {
111
+ return await import(
112
+ /* @vite-ignore */
113
+ attemptPath
114
+ );
115
+ } catch {}
116
+ } catch {}
117
+ return null;
118
+ }
119
+ /**
120
+ * Resolves symlinks in node_modules to find the real package location
121
+ */
122
+ async function resolveSymlinkedPaths(packageName, subPath) {
123
+ const packageBaseName = packageName.includes("/") ? packageName.split("/").pop() : packageName;
124
+ const nodeModulesPatterns = [path.join(process.cwd(), "node_modules", packageName), path.join(process.cwd(), "node_modules", packageBaseName || packageName)];
125
+ const workspacePatterns = [];
126
+ for (const nodeModulesPath of nodeModulesPatterns) try {
127
+ const fs = await import("node:fs");
128
+ if (fs.existsSync(nodeModulesPath)) {
129
+ const realPath = fs.realpathSync(nodeModulesPath);
130
+ workspacePatterns.push(path.join(realPath, "dist", subPath, "index.js"), path.join(realPath, "dist", `${subPath}.js`), path.join(realPath, subPath, "index.js"), path.join(realPath, `${subPath}.js`));
131
+ }
132
+ } catch {}
133
+ return workspacePatterns;
134
+ }
135
+ /**
136
+ * Generates common workspace pattern paths
137
+ */
138
+ function getCommonWorkspacePaths(packageName, subPath) {
139
+ const packageBaseName = packageName.includes("/") ? packageName.split("/").pop() : packageName;
140
+ const commonRoots = [process.cwd(), path.dirname(process.cwd())];
141
+ const workspacePatterns = [];
142
+ for (const root of commonRoots) workspacePatterns.push(path.join(root, "packages", packageBaseName || packageName, "dist", subPath, "index.js"), path.join(root, "packages", packageBaseName || packageName, "dist", `${subPath}.js`));
143
+ return workspacePatterns;
144
+ }
145
+ /**
146
+ * Attempts to import from a list of workspace patterns
147
+ */
148
+ async function tryWorkspacePatterns(patterns) {
149
+ for (const workspacePath of patterns) try {
150
+ return await import(
151
+ /* @vite-ignore */
152
+ workspacePath
153
+ );
154
+ } catch {}
155
+ return null;
156
+ }
157
+ /**
158
+ * Attempts to resolve linked packages using various fallback strategies
159
+ */
160
+ async function resolveLinkedPackage(packageName, subPath) {
161
+ let result = await tryNodeSuggestedPaths(packageName, subPath);
162
+ if (result) return result;
163
+ result = await tryImportMetaResolve(packageName, subPath);
164
+ if (result) return result;
165
+ result = await tryWorkspacePatterns(await resolveSymlinkedPaths(packageName, subPath));
166
+ if (result) return result;
167
+ result = await tryWorkspacePatterns(getCommonWorkspacePaths(packageName, subPath));
168
+ if (result) return result;
169
+ return null;
170
+ }
171
+ //#endregion
172
+ //#region src/packages/util.ts
173
+ childLogger(["reactor-api", "packages/util"]);
174
+ /**
175
+ * Tries to import document models from a package. This function cannot throw.
176
+ */
177
+ async function loadDocumentModels(packageName) {
178
+ return loadDependency(packageName, "document-models");
179
+ }
180
+ /**
181
+ * Tries to import subgraphs from a package. This function cannot throw.
182
+ */
183
+ async function loadSubgraphs(packageName) {
184
+ return loadDependency(packageName, "subgraphs");
185
+ }
186
+ /**
187
+ * Tries to import processors from a package. This function cannot throw.
188
+ */
189
+ async function loadProcessors(packageName) {
190
+ return loadDependency(packageName, "processors");
191
+ }
192
+ /**
193
+ * Generic dependency loader - tries to import a dependency from a package. This function cannot throw.
194
+ * Returns null if the dependency cannot be loaded.
195
+ */
196
+ async function loadDependency(packageName, subPath) {
197
+ const fullPath = `${packageName}/${subPath}`;
198
+ try {
199
+ return await import(
200
+ /* @vite-ignore */
201
+ fullPath
202
+ );
203
+ } catch (e) {
204
+ if (e instanceof Error && "code" in e && (e.code === "ERR_MODULE_NOT_FOUND" || e.code === "ERR_UNSUPPORTED_DIR_IMPORT")) {
205
+ const result = await resolveLinkedPackage(packageName, subPath);
206
+ if (result) return result;
207
+ }
208
+ throw e;
209
+ }
210
+ }
211
+ function debounce(func, delay = 250) {
212
+ let timer;
213
+ return (immediate = false, ...args) => {
214
+ if (timer) clearTimeout(timer);
215
+ return new Promise((resolve, reject) => {
216
+ if (immediate) func(...args).then(resolve).catch(reject);
217
+ else timer = setTimeout(() => {
218
+ func(...args).then(resolve).catch(reject);
219
+ }, delay);
220
+ });
221
+ };
222
+ }
223
+ function isSubpath(parent, dir) {
224
+ const relative = path.relative(parent, dir);
225
+ return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
226
+ }
227
+ //#endregion
228
+ //#region src/graphql/utils.ts
229
+ function isSubgraphClass(candidate) {
230
+ if (typeof candidate !== "function") return false;
231
+ let proto = Object.getPrototypeOf(candidate);
232
+ while (proto) {
233
+ if (Object.prototype.isPrototypeOf.call(proto, BaseSubgraph)) return true;
234
+ proto = Object.getPrototypeOf(proto);
235
+ }
236
+ return false;
237
+ }
238
+ function buildGraphqlOperations(operations, skip, first) {
239
+ return operations.slice(skip, skip + first).map(buildGraphqlOperation);
240
+ }
241
+ function buildGraphqlOperation(operation) {
242
+ const signer = operation.action.context?.signer;
243
+ return {
244
+ id: operation.id ?? "",
245
+ type: operation.action.type,
246
+ index: operation.index,
247
+ timestampUtcMs: operation.timestampUtcMs,
248
+ hash: operation.hash,
249
+ skip: operation.skip,
250
+ inputText: typeof operation.action.input === "string" ? operation.action.input : JSON.stringify(operation.action.input),
251
+ error: operation.error,
252
+ context: { signer: signer ? {
253
+ user: signer.user,
254
+ app: signer.app,
255
+ signatures: signer.signatures.map((sig) => Array.isArray(sig) ? sig.join(", ") : sig)
256
+ } : void 0 }
257
+ };
258
+ }
259
+ function buildGraphQlDocument(doc) {
260
+ const state = doc.state;
261
+ const initialState = doc.initialState;
262
+ const globalState = "global" in doc.state ? doc.state.global : {};
263
+ return {
264
+ id: doc.header.id,
265
+ name: doc.header.name,
266
+ documentType: doc.header.documentType,
267
+ revision: doc.header.revision.global || 0,
268
+ createdAtUtcIso: doc.header.createdAtUtcIso,
269
+ lastModifiedAtUtcIso: doc.header.lastModifiedAtUtcIso,
270
+ operations: [],
271
+ stateJSON: globalState,
272
+ state,
273
+ initialState
274
+ };
275
+ }
276
+ function buildGraphQlDriveDocument(doc) {
277
+ return {
278
+ ...buildGraphQlDocument(doc),
279
+ meta: { preferredEditor: doc.header.meta?.preferredEditor },
280
+ slug: doc.header.slug,
281
+ state: doc.state.global,
282
+ initialState: doc.state.global
283
+ };
284
+ }
285
+ //#endregion
286
+ 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 };
287
+
288
+ //# sourceMappingURL=utils-CHCRSWig.mjs.map
289
+ //# debugId=24a89c58-9371-5eb9-9d53-da949ef27f28
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-CHCRSWig.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/${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\", 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\", 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 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,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B;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":"24a89c58-9371-5eb9-9d53-da949ef27f28"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/reactor-api",
3
- "version": "6.0.0-dev.24",
3
+ "version": "6.0.0-dev.241",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "repository": {
@@ -9,14 +9,22 @@
9
9
  },
10
10
  "exports": {
11
11
  ".": {
12
- "import": "./dist/index.js",
13
- "types": "./dist/index.d.ts"
12
+ "types": "./dist/index.d.mts",
13
+ "import": "./dist/index.mjs"
14
+ },
15
+ "./vite": {
16
+ "types": "./dist/vite-loader.d.mts",
17
+ "import": "./dist/src/packages/vite-loader.mjs"
18
+ },
19
+ "./https-hooks": {
20
+ "types": "./dist/https-hooks.d.mts",
21
+ "import": "./dist/src/packages/https-hooks.mjs"
14
22
  },
15
23
  "./test": {
16
24
  "import": "./test/index.ts"
17
25
  }
18
26
  },
19
- "types": "./dist/index.d.ts",
27
+ "types": "./dist/index.d.mts",
20
28
  "files": [
21
29
  "dist"
22
30
  ],
@@ -28,92 +36,84 @@
28
36
  "author": "",
29
37
  "license": "AGPL-3.0-only",
30
38
  "dependencies": {
31
- "@apollo/gateway": "^2.11.3",
32
- "@apollo/server": "^5.0.0",
33
- "@apollo/subgraph": "^2.11.3",
39
+ "@apollo/gateway": "^2.13.2",
40
+ "@apollo/server": "^5.5.1",
41
+ "@apollo/subgraph": "^2.13.2",
34
42
  "@as-integrations/express4": "^1.1.2",
35
- "@electric-sql/pglite": "0.2.17",
36
- "@graphql-typed-document-node/core": "^3.2.0",
37
- "@opentelemetry/auto-instrumentations-node": "^0.57.1",
38
- "@opentelemetry/exporter-trace-otlp-http": "^0.57.2",
39
- "@opentelemetry/resources": "^1.29.0",
40
- "@opentelemetry/sdk-node": "^0.57.2",
41
- "@opentelemetry/sdk-trace-base": "^1.29.0",
42
- "@opentelemetry/semantic-conventions": "^1.29.0",
43
+ "@electric-sql/pglite": "0.3.15",
43
44
  "@originjs/vite-plugin-commonjs": "^1.0.3",
44
- "@powerhousedao/analytics-engine-core": "^0.5.0",
45
- "@powerhousedao/analytics-engine-graphql": "^0.4.0",
46
- "@powerhousedao/analytics-engine-pg": "^0.6.0",
47
- "@powerhousedao/document-engineering": "^1.40.1",
45
+ "@powerhousedao/document-engineering": "1.40.3",
46
+ "@fastify/cors": "^11.0.1",
47
+ "@mercuriusjs/gateway": "^5.2.0",
48
+ "mercurius": "^16.8.0",
49
+ "@fastify/formbody": "^8.0.1",
50
+ "@fastify/middie": "^9.3.2",
48
51
  "body-parser": "^1.20.3",
49
- "change-case": "^5.4.4",
52
+ "fastify": "^5.8.5",
53
+ "change-case": "5.4.4",
50
54
  "cors": "^2.8.5",
51
55
  "devcert": "^1.2.2",
52
56
  "dotenv": "^16.4.5",
53
- "drizzle-kit": "^0.25.0",
54
- "drizzle-orm": "^0.34.1",
55
- "ethers": "^6.0.8",
56
- "express": "^4.21.1",
57
- "graphql": "^16.11.0",
57
+ "express": "4.21.1",
58
+ "graphql": "16.12.0",
59
+ "graphql-sse": "2.6.0",
58
60
  "graphql-subscriptions": "^3.0.0",
59
61
  "graphql-type-json": "^0.3.2",
60
- "graphql-ws": "^6.0.6",
61
- "jsonwebtoken": "^9.0.2",
62
- "knex": "^3.1.0",
63
- "knex-pglite": "^0.10.0",
64
- "kysely": "^0.28.2",
65
- "kysely-knex": "^0.2.0",
66
- "ms": "^2.1.3",
67
- "nanoevents": "^9.0.0",
68
- "pg": "^8.13.0",
69
- "read-pkg": "^9.0.1",
70
- "siwe": "^2.3.2",
71
- "uuid": "^9.0.1",
72
- "wildcard-match": "^5.1.3",
62
+ "graphql-ws": "6.0.7",
63
+ "knex": "3.1.0",
64
+ "knex-pglite": "0.13.0",
65
+ "kysely": "0.28.16",
66
+ "kysely-knex": "0.2.0",
67
+ "path-to-regexp": "^8.4.0",
68
+ "pg": "8.18.0",
69
+ "read-pkg": "10.1.0",
73
70
  "ws": "^8.18.3",
74
- "zod": "^4.3.5",
75
- "@powerhousedao/config": "6.0.0-dev.24",
76
- "@powerhousedao/reactor-mcp": "6.0.0-dev.24",
77
- "@powerhousedao/reactor": "6.0.0-dev.24",
78
- "@renown/sdk": "6.0.0-dev.24",
79
- "document-drive": "6.0.0-dev.24",
80
- "document-model": "6.0.0-dev.24"
71
+ "zod": "4.3.6",
72
+ "graphql-tag": "2.12.6",
73
+ "@powerhousedao/analytics-engine-core": "6.0.0-dev.241",
74
+ "@powerhousedao/analytics-engine-graphql": "6.0.0-dev.241",
75
+ "@powerhousedao/config": "6.0.0-dev.241",
76
+ "@powerhousedao/analytics-engine-pg": "6.0.0-dev.241",
77
+ "@powerhousedao/reactor": "6.0.0-dev.241",
78
+ "@powerhousedao/reactor-attachments": "6.0.0-dev.241",
79
+ "@powerhousedao/reactor-mcp": "6.0.0-dev.241",
80
+ "@powerhousedao/shared": "6.0.0-dev.241",
81
+ "document-model": "6.0.0-dev.241",
82
+ "@renown/sdk": "6.0.0-dev.241"
81
83
  },
82
84
  "devDependencies": {
83
- "@graphql-codegen/cli": "^5.0.0",
84
- "@graphql-codegen/client-preset": "^4.1.0",
85
- "@graphql-codegen/typed-document-node": "^5.0.1",
86
- "@graphql-codegen/typescript": "^4.0.1",
87
- "@graphql-codegen/typescript-generic-sdk": "^4.0.2",
88
- "@graphql-codegen/typescript-graphql-request": "^6.2.0",
89
- "@graphql-codegen/typescript-operations": "^4.0.1",
90
- "@graphql-codegen/typescript-resolvers": "^4.0.1",
91
- "@graphql-tools/graphql-file-loader": "^8.0.0",
92
- "@graphql-tools/load": "^8.0.0",
85
+ "@graphql-codegen/cli": "6.1.1",
86
+ "@graphql-codegen/typescript": "5.0.7",
87
+ "@graphql-codegen/typescript-generic-sdk": "4.1.0",
88
+ "@graphql-codegen/typescript-operations": "5.0.7",
89
+ "@graphql-codegen/typescript-resolvers": "5.1.5",
93
90
  "@types/body-parser": "^1.19.5",
94
91
  "@types/cors": "^2.8.17",
95
- "@types/express": "^4.17.25",
96
- "@types/jsonwebtoken": "^9.0.7",
97
- "@types/ms": "^0.7.34",
98
- "@types/node": "^24.6.1",
99
- "@types/pg": "^8.11.10",
92
+ "@types/express": "4.17.25",
93
+ "@types/node": "25.2.3",
94
+ "@types/pg": "8.16.0",
100
95
  "@types/ws": "^8.18.1",
101
- "copyfiles": "^2.4.1",
102
- "esbuild": "^0.24.0",
103
- "graphql-tag": "^2.12.6",
104
- "kysely-pglite-dialect": "^1.2.0",
96
+ "tsdown": "0.21.1",
105
97
  "msw": "^2.7.3",
106
- "tinybench": "^3.1.1",
107
- "vite": "^7.1.9",
108
- "vitest": "^3.2.4"
98
+ "vitest": "4.1.1"
99
+ },
100
+ "peerDependencies": {
101
+ "vite": "^8.0.0"
102
+ },
103
+ "peerDependenciesMeta": {
104
+ "vite": {
105
+ "optional": true
106
+ }
109
107
  },
110
108
  "scripts": {
111
109
  "tsc": "tsc",
112
- "build": "copyfiles -u 0 \"src/**/*.graphql\" dist/",
110
+ "build": "tsdown",
113
111
  "lint": "eslint",
114
112
  "test": "vitest --run",
115
113
  "bench": "vitest bench",
116
114
  "codegen": "graphql-codegen --config codegen.ts && prettier --write src/graphql/reactor/gen/*.ts && eslint --fix src/graphql/reactor/gen/*.ts --no-warn-ignored",
117
- "codegen:watch": "graphql-codegen --config codegen.ts --watch"
115
+ "codegen:watch": "graphql-codegen --config codegen.ts --watch",
116
+ "dev": "tsx src/dev.ts",
117
+ "capture-hub-dump": "tsx scripts/capture-hub-dump.ts"
118
118
  }
119
119
  }
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: "zod",
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,KAAK;gBACb,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,7 +0,0 @@
1
- import { AnalyticsSubgraph } from "./graphql/analytics-subgraph.js";
2
- import { SystemSubgraph } from "./graphql/system/index.js";
3
- export declare const config: {
4
- basePath: string;
5
- };
6
- export declare const DefaultCoreSubgraphs: readonly [typeof SystemSubgraph, typeof AnalyticsSubgraph];
7
- //# 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;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,eAAO,MAAM,oBAAoB,4DAGvB,CAAC"}
@@ -1,10 +0,0 @@
1
- import { AnalyticsSubgraph } from "./graphql/analytics-subgraph.js";
2
- import { SystemSubgraph } from "./graphql/system/index.js";
3
- export const config = {
4
- basePath: process.env.BASE_PATH || "/",
5
- };
6
- export const DefaultCoreSubgraphs = [
7
- SystemSubgraph,
8
- AnalyticsSubgraph,
9
- ];
10
- //# 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;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,GAAG;CACvC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,cAAc;IACd,iBAAiB;CACT,CAAC"}