@powerhousedao/reactor-api 6.0.2-staging.2 → 6.0.2-staging.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/index.d.mts +2943 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6375 -0
- package/dist/index.mjs.map +1 -0
- package/dist/src/packages/https-hooks.d.mts +23 -7
- package/dist/src/packages/https-hooks.d.mts.map +1 -1
- package/dist/src/packages/https-hooks.mjs +73 -53
- package/dist/src/packages/https-hooks.mjs.map +1 -1
- package/dist/src/packages/vite-loader.d.mts +29 -0
- package/dist/src/packages/vite-loader.d.mts.map +1 -0
- package/dist/src/packages/vite-loader.mjs +142 -0
- package/dist/src/packages/vite-loader.mjs.map +1 -0
- package/dist/types-Do4QTfT3.d.mts +37 -0
- package/dist/types-Do4QTfT3.d.mts.map +1 -0
- package/dist/utils-DEEhP99G.mjs +286 -0
- package/dist/utils-DEEhP99G.mjs.map +1 -0
- package/package.json +45 -32
- package/dist/codegen.d.ts +0 -4
- package/dist/codegen.d.ts.map +0 -1
- package/dist/codegen.js +0 -38
- package/dist/codegen.js.map +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +0 -1
- package/dist/src/config.d.ts +0 -6
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js +0 -6
- package/dist/src/config.js.map +0 -1
- package/dist/src/dev.d.ts +0 -2
- package/dist/src/dev.d.ts.map +0 -1
- package/dist/src/dev.js +0 -51
- package/dist/src/dev.js.map +0 -1
- package/dist/src/graphql/analytics-subgraph.d.ts +0 -14
- package/dist/src/graphql/analytics-subgraph.d.ts.map +0 -1
- package/dist/src/graphql/analytics-subgraph.js +0 -26
- package/dist/src/graphql/analytics-subgraph.js.map +0 -1
- package/dist/src/graphql/auth/index.d.ts +0 -2
- package/dist/src/graphql/auth/index.d.ts.map +0 -1
- package/dist/src/graphql/auth/index.js +0 -2
- package/dist/src/graphql/auth/index.js.map +0 -1
- package/dist/src/graphql/auth/resolvers.d.ts +0 -166
- package/dist/src/graphql/auth/resolvers.d.ts.map +0 -1
- package/dist/src/graphql/auth/resolvers.js +0 -227
- package/dist/src/graphql/auth/resolvers.js.map +0 -1
- package/dist/src/graphql/auth/schema.graphql +0 -195
- package/dist/src/graphql/auth/subgraph.d.ts +0 -202
- package/dist/src/graphql/auth/subgraph.d.ts.map +0 -1
- package/dist/src/graphql/auth/subgraph.js +0 -384
- package/dist/src/graphql/auth/subgraph.js.map +0 -1
- package/dist/src/graphql/base-subgraph.d.ts +0 -28
- package/dist/src/graphql/base-subgraph.d.ts.map +0 -1
- package/dist/src/graphql/base-subgraph.js +0 -126
- package/dist/src/graphql/base-subgraph.js.map +0 -1
- package/dist/src/graphql/document-model-subgraph.d.ts +0 -105
- package/dist/src/graphql/document-model-subgraph.d.ts.map +0 -1
- package/dist/src/graphql/document-model-subgraph.js +0 -312
- package/dist/src/graphql/document-model-subgraph.js.map +0 -1
- package/dist/src/graphql/graphql-manager.d.ts +0 -68
- package/dist/src/graphql/graphql-manager.d.ts.map +0 -1
- package/dist/src/graphql/graphql-manager.js +0 -589
- package/dist/src/graphql/graphql-manager.js.map +0 -1
- package/dist/src/graphql/index.d.ts +0 -10
- package/dist/src/graphql/index.d.ts.map +0 -1
- package/dist/src/graphql/index.js +0 -10
- package/dist/src/graphql/index.js.map +0 -1
- package/dist/src/graphql/packages/index.d.ts +0 -2
- package/dist/src/graphql/packages/index.d.ts.map +0 -1
- package/dist/src/graphql/packages/index.js +0 -2
- package/dist/src/graphql/packages/index.js.map +0 -1
- package/dist/src/graphql/packages/resolvers.d.ts +0 -31
- package/dist/src/graphql/packages/resolvers.d.ts.map +0 -1
- package/dist/src/graphql/packages/resolvers.js +0 -37
- package/dist/src/graphql/packages/resolvers.js.map +0 -1
- package/dist/src/graphql/packages/schema.graphql +0 -50
- package/dist/src/graphql/packages/subgraph.d.ts +0 -55
- package/dist/src/graphql/packages/subgraph.d.ts.map +0 -1
- package/dist/src/graphql/packages/subgraph.js +0 -73
- package/dist/src/graphql/packages/subgraph.js.map +0 -1
- package/dist/src/graphql/playground.d.ts +0 -2
- package/dist/src/graphql/playground.d.ts.map +0 -1
- package/dist/src/graphql/playground.js +0 -81
- package/dist/src/graphql/playground.js.map +0 -1
- package/dist/src/graphql/reactor/adapters.d.ts +0 -62
- package/dist/src/graphql/reactor/adapters.d.ts.map +0 -1
- package/dist/src/graphql/reactor/adapters.js +0 -271
- package/dist/src/graphql/reactor/adapters.js.map +0 -1
- package/dist/src/graphql/reactor/factory.d.ts +0 -105
- package/dist/src/graphql/reactor/factory.d.ts.map +0 -1
- package/dist/src/graphql/reactor/factory.js +0 -7
- package/dist/src/graphql/reactor/factory.js.map +0 -1
- package/dist/src/graphql/reactor/gen/graphql.d.ts +0 -1489
- package/dist/src/graphql/reactor/gen/graphql.d.ts.map +0 -1
- package/dist/src/graphql/reactor/gen/graphql.js +0 -731
- package/dist/src/graphql/reactor/gen/graphql.js.map +0 -1
- package/dist/src/graphql/reactor/index.d.ts +0 -4
- package/dist/src/graphql/reactor/index.d.ts.map +0 -1
- package/dist/src/graphql/reactor/index.js +0 -4
- package/dist/src/graphql/reactor/index.js.map +0 -1
- package/dist/src/graphql/reactor/operations.graphql +0 -443
- package/dist/src/graphql/reactor/pubsub.d.ts +0 -27
- package/dist/src/graphql/reactor/pubsub.d.ts.map +0 -1
- package/dist/src/graphql/reactor/pubsub.js +0 -93
- package/dist/src/graphql/reactor/pubsub.js.map +0 -1
- package/dist/src/graphql/reactor/requester.d.ts +0 -4
- package/dist/src/graphql/reactor/requester.d.ts.map +0 -1
- package/dist/src/graphql/reactor/requester.js +0 -22
- package/dist/src/graphql/reactor/requester.js.map +0 -1
- package/dist/src/graphql/reactor/requester.with-zod.d.ts +0 -4
- package/dist/src/graphql/reactor/requester.with-zod.d.ts.map +0 -1
- package/dist/src/graphql/reactor/requester.with-zod.js +0 -129
- package/dist/src/graphql/reactor/requester.with-zod.js.map +0 -1
- package/dist/src/graphql/reactor/resolvers.d.ts +0 -223
- package/dist/src/graphql/reactor/resolvers.d.ts.map +0 -1
- package/dist/src/graphql/reactor/resolvers.js +0 -682
- package/dist/src/graphql/reactor/resolvers.js.map +0 -1
- package/dist/src/graphql/reactor/schema.graphql +0 -475
- package/dist/src/graphql/reactor/subgraph.d.ts +0 -18
- package/dist/src/graphql/reactor/subgraph.d.ts.map +0 -1
- package/dist/src/graphql/reactor/subgraph.js +0 -457
- package/dist/src/graphql/reactor/subgraph.js.map +0 -1
- package/dist/src/graphql/reactor/validation.d.ts +0 -348
- package/dist/src/graphql/reactor/validation.d.ts.map +0 -1
- package/dist/src/graphql/reactor/validation.js +0 -167
- package/dist/src/graphql/reactor/validation.js.map +0 -1
- package/dist/src/graphql/sse.d.ts +0 -42
- package/dist/src/graphql/sse.d.ts.map +0 -1
- package/dist/src/graphql/sse.js +0 -33
- package/dist/src/graphql/sse.js.map +0 -1
- package/dist/src/graphql/system/env/getters.d.ts +0 -2
- package/dist/src/graphql/system/env/getters.d.ts.map +0 -1
- package/dist/src/graphql/system/env/getters.js +0 -4
- package/dist/src/graphql/system/env/getters.js.map +0 -1
- package/dist/src/graphql/system/env/index.d.ts +0 -2
- package/dist/src/graphql/system/env/index.d.ts.map +0 -1
- package/dist/src/graphql/system/env/index.js +0 -5
- package/dist/src/graphql/system/env/index.js.map +0 -1
- package/dist/src/graphql/system/index.d.ts +0 -2
- package/dist/src/graphql/system/index.d.ts.map +0 -1
- package/dist/src/graphql/system/index.js +0 -2
- package/dist/src/graphql/system/index.js.map +0 -1
- package/dist/src/graphql/system/types.d.ts +0 -2
- package/dist/src/graphql/system/types.d.ts.map +0 -1
- package/dist/src/graphql/system/types.js +0 -2
- package/dist/src/graphql/system/types.js.map +0 -1
- package/dist/src/graphql/temp-hack-rwa-type-defs.d.ts +0 -57
- package/dist/src/graphql/temp-hack-rwa-type-defs.d.ts.map +0 -1
- package/dist/src/graphql/temp-hack-rwa-type-defs.js +0 -2
- package/dist/src/graphql/temp-hack-rwa-type-defs.js.map +0 -1
- package/dist/src/graphql/types.d.ts +0 -102
- package/dist/src/graphql/types.d.ts.map +0 -1
- package/dist/src/graphql/types.js +0 -2
- package/dist/src/graphql/types.js.map +0 -1
- package/dist/src/graphql/utils.d.ts +0 -9
- package/dist/src/graphql/utils.d.ts.map +0 -1
- package/dist/src/graphql/utils.js +0 -72
- package/dist/src/graphql/utils.js.map +0 -1
- package/dist/src/graphql/websocket.d.ts +0 -3
- package/dist/src/graphql/websocket.d.ts.map +0 -1
- package/dist/src/graphql/websocket.js +0 -15
- package/dist/src/graphql/websocket.js.map +0 -1
- package/dist/src/migrations/001_create_document_permissions.d.ts +0 -4
- package/dist/src/migrations/001_create_document_permissions.d.ts.map +0 -1
- package/dist/src/migrations/001_create_document_permissions.js +0 -91
- package/dist/src/migrations/001_create_document_permissions.js.map +0 -1
- package/dist/src/migrations/002_add_document_protection.d.ts +0 -4
- package/dist/src/migrations/002_add_document_protection.d.ts.map +0 -1
- package/dist/src/migrations/002_add_document_protection.js +0 -18
- package/dist/src/migrations/002_add_document_protection.js.map +0 -1
- package/dist/src/migrations/index.d.ts +0 -10
- package/dist/src/migrations/index.d.ts.map +0 -1
- package/dist/src/migrations/index.js +0 -58
- package/dist/src/migrations/index.js.map +0 -1
- package/dist/src/packages/http-loader.d.ts +0 -68
- package/dist/src/packages/http-loader.d.ts.map +0 -1
- package/dist/src/packages/http-loader.js +0 -176
- package/dist/src/packages/http-loader.js.map +0 -1
- package/dist/src/packages/import-loader.d.ts +0 -14
- package/dist/src/packages/import-loader.d.ts.map +0 -1
- package/dist/src/packages/import-loader.js +0 -46
- package/dist/src/packages/import-loader.js.map +0 -1
- package/dist/src/packages/import-resolver.d.ts +0 -5
- package/dist/src/packages/import-resolver.d.ts.map +0 -1
- package/dist/src/packages/import-resolver.js +0 -127
- package/dist/src/packages/import-resolver.js.map +0 -1
- package/dist/src/packages/package-manager.d.ts +0 -34
- package/dist/src/packages/package-manager.d.ts.map +0 -1
- package/dist/src/packages/package-manager.js +0 -213
- package/dist/src/packages/package-manager.js.map +0 -1
- package/dist/src/packages/types.d.ts +0 -38
- package/dist/src/packages/types.d.ts.map +0 -1
- package/dist/src/packages/types.js +0 -2
- package/dist/src/packages/types.js.map +0 -1
- package/dist/src/packages/util.d.ts +0 -27
- package/dist/src/packages/util.d.ts.map +0 -1
- package/dist/src/packages/util.js +0 -97
- package/dist/src/packages/util.js.map +0 -1
- package/dist/src/packages/vite-loader.d.ts +0 -24
- package/dist/src/packages/vite-loader.d.ts.map +0 -1
- package/dist/src/packages/vite-loader.js +0 -169
- package/dist/src/packages/vite-loader.js.map +0 -1
- package/dist/src/server.d.ts +0 -56
- package/dist/src/server.d.ts.map +0 -1
- package/dist/src/server.js +0 -365
- package/dist/src/server.js.map +0 -1
- package/dist/src/services/auth.service.d.ts +0 -56
- package/dist/src/services/auth.service.d.ts.map +0 -1
- package/dist/src/services/auth.service.js +0 -172
- package/dist/src/services/auth.service.js.map +0 -1
- package/dist/src/services/authorization.service.d.ts +0 -70
- package/dist/src/services/authorization.service.d.ts.map +0 -1
- package/dist/src/services/authorization.service.js +0 -155
- package/dist/src/services/authorization.service.js.map +0 -1
- package/dist/src/services/document-permission.service.d.ts +0 -241
- package/dist/src/services/document-permission.service.d.ts.map +0 -1
- package/dist/src/services/document-permission.service.js +0 -791
- package/dist/src/services/document-permission.service.js.map +0 -1
- package/dist/src/services/package-management.service.d.ts +0 -32
- package/dist/src/services/package-management.service.d.ts.map +0 -1
- package/dist/src/services/package-management.service.js +0 -95
- package/dist/src/services/package-management.service.js.map +0 -1
- package/dist/src/services/package-storage.d.ts +0 -23
- package/dist/src/services/package-storage.d.ts.map +0 -1
- package/dist/src/services/package-storage.js +0 -19
- package/dist/src/services/package-storage.js.map +0 -1
- package/dist/src/tracing.d.ts +0 -4
- package/dist/src/tracing.d.ts.map +0 -1
- package/dist/src/tracing.js +0 -140
- package/dist/src/tracing.js.map +0 -1
- package/dist/src/types.d.ts +0 -17
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils/auth.d.ts +0 -3
- package/dist/src/utils/auth.d.ts.map +0 -1
- package/dist/src/utils/auth.js +0 -12
- package/dist/src/utils/auth.js.map +0 -1
- package/dist/src/utils/create-schema.d.ts +0 -36
- package/dist/src/utils/create-schema.d.ts.map +0 -1
- package/dist/src/utils/create-schema.js +0 -725
- package/dist/src/utils/create-schema.js.map +0 -1
- package/dist/src/utils/db.d.ts +0 -82
- package/dist/src/utils/db.d.ts.map +0 -1
- package/dist/src/utils/db.js +0 -101
- package/dist/src/utils/db.js.map +0 -1
- package/dist/src/utils/drive-url.d.ts +0 -2
- package/dist/src/utils/drive-url.d.ts.map +0 -1
- package/dist/src/utils/drive-url.js +0 -3
- package/dist/src/utils/drive-url.js.map +0 -1
- package/dist/src/utils/index.d.ts +0 -4
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js +0 -4
- package/dist/src/utils/index.js.map +0 -1
- package/dist/test/authorization.service.test.d.ts +0 -2
- package/dist/test/authorization.service.test.d.ts.map +0 -1
- package/dist/test/authorization.service.test.js +0 -252
- package/dist/test/authorization.service.test.js.map +0 -1
- package/dist/test/benchmarks/load.bench.d.ts +0 -2
- package/dist/test/benchmarks/load.bench.d.ts.map +0 -1
- package/dist/test/benchmarks/load.bench.js +0 -73
- package/dist/test/benchmarks/load.bench.js.map +0 -1
- package/dist/test/benchmarks/sync.bench.d.ts +0 -2
- package/dist/test/benchmarks/sync.bench.d.ts.map +0 -1
- package/dist/test/benchmarks/sync.bench.js +0 -119
- package/dist/test/benchmarks/sync.bench.js.map +0 -1
- package/dist/test/connect-switchboard-reshuffle-convergence.test.d.ts +0 -2
- package/dist/test/connect-switchboard-reshuffle-convergence.test.d.ts.map +0 -1
- package/dist/test/connect-switchboard-reshuffle-convergence.test.js +0 -203
- package/dist/test/connect-switchboard-reshuffle-convergence.test.js.map +0 -1
- package/dist/test/connect-switchboard-sync.test.d.ts +0 -2
- package/dist/test/connect-switchboard-sync.test.d.ts.map +0 -1
- package/dist/test/connect-switchboard-sync.test.js +0 -632
- package/dist/test/connect-switchboard-sync.test.js.map +0 -1
- package/dist/test/document-drive-subgraph.test.d.ts +0 -2
- package/dist/test/document-drive-subgraph.test.d.ts.map +0 -1
- package/dist/test/document-drive-subgraph.test.js +0 -249
- package/dist/test/document-drive-subgraph.test.js.map +0 -1
- package/dist/test/document-model-subgraph-permissions.test.d.ts +0 -2
- package/dist/test/document-model-subgraph-permissions.test.d.ts.map +0 -1
- package/dist/test/document-model-subgraph-permissions.test.js +0 -587
- package/dist/test/document-model-subgraph-permissions.test.js.map +0 -1
- package/dist/test/document-permission.service.test.d.ts +0 -2
- package/dist/test/document-permission.service.test.d.ts.map +0 -1
- package/dist/test/document-permission.service.test.js +0 -480
- package/dist/test/document-permission.service.test.js.map +0 -1
- package/dist/test/drive-info-endpoint.test.d.ts +0 -2
- package/dist/test/drive-info-endpoint.test.d.ts.map +0 -1
- package/dist/test/drive-info-endpoint.test.js +0 -123
- package/dist/test/drive-info-endpoint.test.js.map +0 -1
- package/dist/test/fault-injection-sync.test.d.ts +0 -2
- package/dist/test/fault-injection-sync.test.d.ts.map +0 -1
- package/dist/test/fault-injection-sync.test.js +0 -196
- package/dist/test/fault-injection-sync.test.js.map +0 -1
- package/dist/test/identity-integration.test.d.ts +0 -2
- package/dist/test/identity-integration.test.d.ts.map +0 -1
- package/dist/test/identity-integration.test.js +0 -349
- package/dist/test/identity-integration.test.js.map +0 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -2
- package/dist/test/index.js.map +0 -1
- package/dist/test/permissions-integration.test.d.ts +0 -2
- package/dist/test/permissions-integration.test.d.ts.map +0 -1
- package/dist/test/permissions-integration.test.js +0 -407
- package/dist/test/permissions-integration.test.js.map +0 -1
- package/dist/test/push-backfill.test.d.ts +0 -2
- package/dist/test/push-backfill.test.d.ts.map +0 -1
- package/dist/test/push-backfill.test.js +0 -298
- package/dist/test/push-backfill.test.js.map +0 -1
- package/dist/test/reactor-adapters.test.d.ts +0 -2
- package/dist/test/reactor-adapters.test.d.ts.map +0 -1
- package/dist/test/reactor-adapters.test.js +0 -379
- package/dist/test/reactor-adapters.test.js.map +0 -1
- package/dist/test/reactor-client.test.d.ts +0 -2
- package/dist/test/reactor-client.test.d.ts.map +0 -1
- package/dist/test/reactor-client.test.js +0 -371
- package/dist/test/reactor-client.test.js.map +0 -1
- package/dist/test/reactor-resolvers.test.d.ts +0 -2
- package/dist/test/reactor-resolvers.test.d.ts.map +0 -1
- package/dist/test/reactor-resolvers.test.js +0 -258
- package/dist/test/reactor-resolvers.test.js.map +0 -1
- package/dist/test/reactor-subgraph-permissions.test.d.ts +0 -2
- package/dist/test/reactor-subgraph-permissions.test.d.ts.map +0 -1
- package/dist/test/reactor-subgraph-permissions.test.js +0 -371
- package/dist/test/reactor-subgraph-permissions.test.js.map +0 -1
- package/dist/test/router.test.d.ts +0 -2
- package/dist/test/router.test.d.ts.map +0 -1
- package/dist/test/router.test.js +0 -38
- package/dist/test/router.test.js.map +0 -1
- package/dist/test/subscriptions-sse.test.d.ts +0 -2
- package/dist/test/subscriptions-sse.test.d.ts.map +0 -1
- package/dist/test/subscriptions-sse.test.js +0 -264
- package/dist/test/subscriptions-sse.test.js.map +0 -1
- package/dist/test/subscriptions.test.d.ts +0 -2
- package/dist/test/subscriptions.test.d.ts.map +0 -1
- package/dist/test/subscriptions.test.js +0 -248
- package/dist/test/subscriptions.test.js.map +0 -1
- package/dist/test/utils/gql-resolver-bridge.d.ts +0 -15
- package/dist/test/utils/gql-resolver-bridge.d.ts.map +0 -1
- package/dist/test/utils/gql-resolver-bridge.js +0 -89
- package/dist/test/utils/gql-resolver-bridge.js.map +0 -1
- package/dist/test/utils.d.ts +0 -10
- package/dist/test/utils.d.ts.map +0 -1
- package/dist/test/utils.js +0 -23
- package/dist/test/utils.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.config.js +0 -38
- package/dist/vitest.config.js.map +0 -1
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { gql } from "graphql-tag";
|
|
2
|
+
import { GraphQLError } from "graphql";
|
|
3
|
+
import { childLogger } from "document-model";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
//#region src/graphql/base-subgraph.ts
|
|
6
|
+
var BaseSubgraph = class {
|
|
7
|
+
name = "example";
|
|
8
|
+
path = "";
|
|
9
|
+
resolvers = { Query: { hello: () => this.name } };
|
|
10
|
+
typeDefs = gql`
|
|
11
|
+
type Query {
|
|
12
|
+
hello: String
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
reactorClient;
|
|
16
|
+
graphqlManager;
|
|
17
|
+
relationalDb;
|
|
18
|
+
syncManager;
|
|
19
|
+
documentPermissionService;
|
|
20
|
+
authorizationService;
|
|
21
|
+
constructor(args) {
|
|
22
|
+
this.reactorClient = args.reactorClient;
|
|
23
|
+
this.graphqlManager = args.graphqlManager;
|
|
24
|
+
this.relationalDb = args.relationalDb;
|
|
25
|
+
this.syncManager = args.syncManager;
|
|
26
|
+
this.documentPermissionService = args.documentPermissionService;
|
|
27
|
+
this.authorizationService = args.authorizationService;
|
|
28
|
+
this.path = args.path ?? "";
|
|
29
|
+
}
|
|
30
|
+
async onSetup() {}
|
|
31
|
+
getParentIdsFn() {
|
|
32
|
+
return async (documentId) => {
|
|
33
|
+
try {
|
|
34
|
+
return (await this.reactorClient.getParents(documentId)).results.map((doc) => doc.header.id);
|
|
35
|
+
} catch {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
hasGlobalAdminAccess(ctx) {
|
|
41
|
+
return !!ctx.isAdmin?.(ctx.user?.address ?? "");
|
|
42
|
+
}
|
|
43
|
+
async canReadDocument(documentId, ctx) {
|
|
44
|
+
if (this.authorizationService) return this.authorizationService.canRead(documentId, ctx.user?.address, this.getParentIdsFn());
|
|
45
|
+
if (this.hasGlobalAdminAccess(ctx)) return true;
|
|
46
|
+
if (this.documentPermissionService) return this.documentPermissionService.canRead(documentId, ctx.user?.address, this.getParentIdsFn());
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
async assertCanRead(documentId, ctx) {
|
|
50
|
+
if (this.authorizationService) {
|
|
51
|
+
if (!await this.authorizationService.canRead(documentId, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError("Forbidden: insufficient permissions to read this document");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!this.hasGlobalAdminAccess(ctx)) if (this.documentPermissionService) {
|
|
55
|
+
if (!await this.documentPermissionService.canRead(documentId, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError("Forbidden: insufficient permissions to read this document");
|
|
56
|
+
} else throw new GraphQLError("Forbidden: insufficient permissions to read this document");
|
|
57
|
+
}
|
|
58
|
+
async assertCanWrite(documentId, ctx) {
|
|
59
|
+
if (this.authorizationService) {
|
|
60
|
+
if (!await this.authorizationService.canWrite(documentId, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError("Forbidden: insufficient permissions to write to this document");
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!this.hasGlobalAdminAccess(ctx)) if (this.documentPermissionService) {
|
|
64
|
+
if (!await this.documentPermissionService.canWrite(documentId, ctx.user?.address, this.getParentIdsFn())) throw new GraphQLError("Forbidden: insufficient permissions to write to this document");
|
|
65
|
+
} else throw new GraphQLError("Forbidden: insufficient permissions to write to this document");
|
|
66
|
+
}
|
|
67
|
+
async assertCanExecuteOperation(documentId, operationType, ctx) {
|
|
68
|
+
if (this.authorizationService) {
|
|
69
|
+
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`);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!this.documentPermissionService) return;
|
|
73
|
+
if (ctx.isAdmin?.(ctx.user?.address ?? "")) return;
|
|
74
|
+
if (await this.documentPermissionService.isOperationRestricted(documentId, operationType)) {
|
|
75
|
+
if (!await this.documentPermissionService.canExecuteOperation(documentId, operationType, ctx.user?.address)) throw new GraphQLError(`Forbidden: insufficient permissions to execute operation "${operationType}" on this document`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/packages/import-resolver.ts
|
|
81
|
+
/**
|
|
82
|
+
* Attempts to import from suggested Node.js paths
|
|
83
|
+
*/
|
|
84
|
+
async function tryNodeSuggestedPaths(packageName, subPath) {
|
|
85
|
+
const suggestedPaths = [`${packageName}/dist/${subPath}/index.js`, `${packageName}/dist/${subPath}.js`];
|
|
86
|
+
for (const suggestedPath of suggestedPaths) try {
|
|
87
|
+
return await import(
|
|
88
|
+
/* @vite-ignore */
|
|
89
|
+
suggestedPath
|
|
90
|
+
);
|
|
91
|
+
} catch {}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Attempts to resolve package using import.meta.resolve
|
|
96
|
+
*/
|
|
97
|
+
async function tryImportMetaResolve(packageName, subPath) {
|
|
98
|
+
try {
|
|
99
|
+
const resolvedUrl = import.meta.resolve?.(`${packageName}/package.json`);
|
|
100
|
+
if (!resolvedUrl) return null;
|
|
101
|
+
const packageRoot = path.dirname(new URL(resolvedUrl).pathname);
|
|
102
|
+
const pathsToTry = [
|
|
103
|
+
path.join(packageRoot, "dist", subPath, "index.js"),
|
|
104
|
+
path.join(packageRoot, "dist", `${subPath}.js`),
|
|
105
|
+
path.join(packageRoot, subPath, "index.js"),
|
|
106
|
+
path.join(packageRoot, `${subPath}.js`)
|
|
107
|
+
];
|
|
108
|
+
for (const attemptPath of pathsToTry) try {
|
|
109
|
+
return await import(
|
|
110
|
+
/* @vite-ignore */
|
|
111
|
+
attemptPath
|
|
112
|
+
);
|
|
113
|
+
} catch {}
|
|
114
|
+
} catch {}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Resolves symlinks in node_modules to find the real package location
|
|
119
|
+
*/
|
|
120
|
+
async function resolveSymlinkedPaths(packageName, subPath) {
|
|
121
|
+
const packageBaseName = packageName.includes("/") ? packageName.split("/").pop() : packageName;
|
|
122
|
+
const nodeModulesPatterns = [path.join(process.cwd(), "node_modules", packageName), path.join(process.cwd(), "node_modules", packageBaseName || packageName)];
|
|
123
|
+
const workspacePatterns = [];
|
|
124
|
+
for (const nodeModulesPath of nodeModulesPatterns) try {
|
|
125
|
+
const fs = await import("node:fs");
|
|
126
|
+
if (fs.existsSync(nodeModulesPath)) {
|
|
127
|
+
const realPath = fs.realpathSync(nodeModulesPath);
|
|
128
|
+
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`));
|
|
129
|
+
}
|
|
130
|
+
} catch {}
|
|
131
|
+
return workspacePatterns;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Generates common workspace pattern paths
|
|
135
|
+
*/
|
|
136
|
+
function getCommonWorkspacePaths(packageName, subPath) {
|
|
137
|
+
const packageBaseName = packageName.includes("/") ? packageName.split("/").pop() : packageName;
|
|
138
|
+
const commonRoots = [process.cwd(), path.dirname(process.cwd())];
|
|
139
|
+
const workspacePatterns = [];
|
|
140
|
+
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`));
|
|
141
|
+
return workspacePatterns;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Attempts to import from a list of workspace patterns
|
|
145
|
+
*/
|
|
146
|
+
async function tryWorkspacePatterns(patterns) {
|
|
147
|
+
for (const workspacePath of patterns) try {
|
|
148
|
+
return await import(
|
|
149
|
+
/* @vite-ignore */
|
|
150
|
+
workspacePath
|
|
151
|
+
);
|
|
152
|
+
} catch {}
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Attempts to resolve linked packages using various fallback strategies
|
|
157
|
+
*/
|
|
158
|
+
async function resolveLinkedPackage(packageName, subPath) {
|
|
159
|
+
let result = await tryNodeSuggestedPaths(packageName, subPath);
|
|
160
|
+
if (result) return result;
|
|
161
|
+
result = await tryImportMetaResolve(packageName, subPath);
|
|
162
|
+
if (result) return result;
|
|
163
|
+
result = await tryWorkspacePatterns(await resolveSymlinkedPaths(packageName, subPath));
|
|
164
|
+
if (result) return result;
|
|
165
|
+
result = await tryWorkspacePatterns(getCommonWorkspacePaths(packageName, subPath));
|
|
166
|
+
if (result) return result;
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/packages/util.ts
|
|
171
|
+
childLogger(["reactor-api", "packages/util"]);
|
|
172
|
+
/**
|
|
173
|
+
* Tries to import document models from a package. This function cannot throw.
|
|
174
|
+
*/
|
|
175
|
+
async function loadDocumentModels(packageName) {
|
|
176
|
+
return loadDependency(packageName, "document-models");
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Tries to import subgraphs from a package. This function cannot throw.
|
|
180
|
+
*/
|
|
181
|
+
async function loadSubgraphs(packageName) {
|
|
182
|
+
return loadDependency(packageName, "subgraphs");
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Tries to import processors from a package. This function cannot throw.
|
|
186
|
+
*/
|
|
187
|
+
async function loadProcessors(packageName) {
|
|
188
|
+
return loadDependency(packageName, "processors");
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Generic dependency loader - tries to import a dependency from a package. This function cannot throw.
|
|
192
|
+
* Returns null if the dependency cannot be loaded.
|
|
193
|
+
*/
|
|
194
|
+
async function loadDependency(packageName, subPath) {
|
|
195
|
+
const fullPath = `${packageName}/${subPath}`;
|
|
196
|
+
try {
|
|
197
|
+
return await import(
|
|
198
|
+
/* @vite-ignore */
|
|
199
|
+
fullPath
|
|
200
|
+
);
|
|
201
|
+
} catch (e) {
|
|
202
|
+
if (e instanceof Error && "code" in e && (e.code === "ERR_MODULE_NOT_FOUND" || e.code === "ERR_UNSUPPORTED_DIR_IMPORT")) {
|
|
203
|
+
const result = await resolveLinkedPackage(packageName, subPath);
|
|
204
|
+
if (result) return result;
|
|
205
|
+
}
|
|
206
|
+
throw e;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function debounce(func, delay = 250) {
|
|
210
|
+
let timer;
|
|
211
|
+
return (immediate = false, ...args) => {
|
|
212
|
+
if (timer) clearTimeout(timer);
|
|
213
|
+
return new Promise((resolve, reject) => {
|
|
214
|
+
if (immediate) func(...args).then(resolve).catch(reject);
|
|
215
|
+
else timer = setTimeout(() => {
|
|
216
|
+
func(...args).then(resolve).catch(reject);
|
|
217
|
+
}, delay);
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function isSubpath(parent, dir) {
|
|
222
|
+
const relative = path.relative(parent, dir);
|
|
223
|
+
return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/graphql/utils.ts
|
|
227
|
+
function isSubgraphClass(candidate) {
|
|
228
|
+
if (typeof candidate !== "function") return false;
|
|
229
|
+
let proto = Object.getPrototypeOf(candidate);
|
|
230
|
+
while (proto) {
|
|
231
|
+
if (Object.prototype.isPrototypeOf.call(proto, BaseSubgraph)) return true;
|
|
232
|
+
proto = Object.getPrototypeOf(proto);
|
|
233
|
+
}
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
function buildGraphqlOperations(operations, skip, first) {
|
|
237
|
+
return operations.slice(skip, skip + first).map(buildGraphqlOperation);
|
|
238
|
+
}
|
|
239
|
+
function buildGraphqlOperation(operation) {
|
|
240
|
+
const signer = operation.action.context?.signer;
|
|
241
|
+
return {
|
|
242
|
+
id: operation.id ?? "",
|
|
243
|
+
type: operation.action.type,
|
|
244
|
+
index: operation.index,
|
|
245
|
+
timestampUtcMs: operation.timestampUtcMs,
|
|
246
|
+
hash: operation.hash,
|
|
247
|
+
skip: operation.skip,
|
|
248
|
+
inputText: typeof operation.action.input === "string" ? operation.action.input : JSON.stringify(operation.action.input),
|
|
249
|
+
error: operation.error,
|
|
250
|
+
context: { signer: signer ? {
|
|
251
|
+
user: signer.user,
|
|
252
|
+
app: signer.app,
|
|
253
|
+
signatures: signer.signatures.map((sig) => Array.isArray(sig) ? sig.join(", ") : sig)
|
|
254
|
+
} : void 0 }
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
function buildGraphQlDocument(doc) {
|
|
258
|
+
const state = doc.state;
|
|
259
|
+
const initialState = doc.initialState;
|
|
260
|
+
const globalState = "global" in doc.state ? doc.state.global : {};
|
|
261
|
+
return {
|
|
262
|
+
id: doc.header.id,
|
|
263
|
+
name: doc.header.name,
|
|
264
|
+
documentType: doc.header.documentType,
|
|
265
|
+
revision: doc.header.revision.global || 0,
|
|
266
|
+
createdAtUtcIso: doc.header.createdAtUtcIso,
|
|
267
|
+
lastModifiedAtUtcIso: doc.header.lastModifiedAtUtcIso,
|
|
268
|
+
operations: [],
|
|
269
|
+
stateJSON: globalState,
|
|
270
|
+
state,
|
|
271
|
+
initialState
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function buildGraphQlDriveDocument(doc) {
|
|
275
|
+
return {
|
|
276
|
+
...buildGraphQlDocument(doc),
|
|
277
|
+
meta: { preferredEditor: doc.header.meta?.preferredEditor },
|
|
278
|
+
slug: doc.header.slug,
|
|
279
|
+
state: doc.state.global,
|
|
280
|
+
initialState: doc.state.global
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
//#endregion
|
|
284
|
+
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 };
|
|
285
|
+
|
|
286
|
+
//# sourceMappingURL=utils-DEEhP99G.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils-DEEhP99G.mjs","names":[],"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.getParents(documentId);\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"],"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;AAEF,YADe,MAAM,KAAK,cAAc,WAAW,WAAW,EAChD,QAAQ,KAAK,QAAQ,IAAI,OAAO,GAAG;WAC3C;AACN,WAAO,EAAE;;;;CAKf,qBAA+B,KAAuB;AACpD,SAAO,CAAC,CAAC,IAAI,UAAU,IAAI,MAAM,WAAW,GAAG;;CAGjD,MAAgB,gBACd,YACA,KACkB;AAClB,MAAI,KAAK,qBACP,QAAO,KAAK,qBAAqB,QAC/B,YACA,IAAI,MAAM,SACV,KAAK,gBAAgB,CACtB;AAEH,MAAI,KAAK,qBAAqB,IAAI,CAAE,QAAO;AAC3C,MAAI,KAAK,0BACP,QAAO,KAAK,0BAA0B,QACpC,YACA,IAAI,MAAM,SACV,KAAK,gBAAgB,CACtB;AAEH,SAAO;;CAGT,MAAgB,cACd,YACA,KACe;AACf,MAAI,KAAK,sBAAsB;AAM7B,OAAI,CALY,MAAM,KAAK,qBAAqB,QAC9C,YACA,IAAI,MAAM,SACV,KAAK,gBAAgB,CACtB,CAEC,OAAM,IAAI,aACR,4DACD;AAEH;;AAGF,MAAI,CAAC,KAAK,qBAAqB,IAAI,CACjC,KAAI,KAAK;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K,GAAG,IACvC;GACF,GACD,KAAA,GACL;EACF;;AAGH,SAAgB,qBAAqB,KAA8B;CAGjE,MAAM,QAAQ,IAAI;CAClB,MAAM,eAAe,IAAI;CAEzB,MAAM,cAAc,YAAY,IAAI,QAAQ,IAAI,MAAM,SAAS,EAAE;AACjE,QAAO;EACL,IAAI,IAAI,OAAO;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-api",
|
|
3
|
-
"version": "6.0.2-staging.
|
|
3
|
+
"version": "6.0.2-staging.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -9,22 +9,22 @@
|
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
|
+
"import": "./dist/index.mjs"
|
|
14
14
|
},
|
|
15
|
-
"./
|
|
16
|
-
"
|
|
17
|
-
"
|
|
15
|
+
"./vite": {
|
|
16
|
+
"types": "./dist/vite-loader.d.mts",
|
|
17
|
+
"import": "./dist/src/packages/vite-loader.mjs"
|
|
18
18
|
},
|
|
19
|
-
"./
|
|
20
|
-
"
|
|
21
|
-
"
|
|
19
|
+
"./https-hooks": {
|
|
20
|
+
"types": "./dist/https-hooks.d.mts",
|
|
21
|
+
"import": "./dist/src/packages/https-hooks.mjs"
|
|
22
22
|
},
|
|
23
23
|
"./test": {
|
|
24
24
|
"import": "./test/index.ts"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
"types": "./dist/index.d.
|
|
27
|
+
"types": "./dist/index.d.mts",
|
|
28
28
|
"files": [
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"author": "",
|
|
37
37
|
"license": "AGPL-3.0-only",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@apollo/gateway": "^2.
|
|
40
|
-
"@apollo/server": "^5.
|
|
41
|
-
"@apollo/subgraph": "^2.
|
|
39
|
+
"@apollo/gateway": "^2.13.2",
|
|
40
|
+
"@apollo/server": "^5.5.0",
|
|
41
|
+
"@apollo/subgraph": "^2.13.2",
|
|
42
42
|
"@as-integrations/express4": "^1.1.2",
|
|
43
43
|
"@electric-sql/pglite": "0.3.15",
|
|
44
44
|
"@opentelemetry/auto-instrumentations-node": "^0.57.1",
|
|
@@ -51,12 +51,18 @@
|
|
|
51
51
|
"@opentelemetry/semantic-conventions": "^1.29.0",
|
|
52
52
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
53
53
|
"@powerhousedao/document-engineering": "1.40.1",
|
|
54
|
+
"@fastify/cors": "^11.0.1",
|
|
55
|
+
"@mercuriusjs/gateway": "^5.2.0",
|
|
56
|
+
"mercurius": "^16.8.0",
|
|
57
|
+
"@fastify/formbody": "^8.0.1",
|
|
58
|
+
"@fastify/middie": "^9.0.1",
|
|
54
59
|
"body-parser": "^1.20.3",
|
|
60
|
+
"fastify": "^5.3.2",
|
|
55
61
|
"change-case": "5.4.4",
|
|
56
62
|
"cors": "^2.8.5",
|
|
57
63
|
"devcert": "^1.2.2",
|
|
58
64
|
"dotenv": "^16.4.5",
|
|
59
|
-
"express": "
|
|
65
|
+
"express": "4.21.1",
|
|
60
66
|
"graphql": "16.12.0",
|
|
61
67
|
"graphql-sse": "2.6.0",
|
|
62
68
|
"graphql-subscriptions": "^3.0.0",
|
|
@@ -64,23 +70,24 @@
|
|
|
64
70
|
"graphql-ws": "6.0.7",
|
|
65
71
|
"knex": "3.1.0",
|
|
66
72
|
"knex-pglite": "0.13.0",
|
|
67
|
-
"kysely": "0.28.
|
|
73
|
+
"kysely": "0.28.16",
|
|
68
74
|
"kysely-knex": "0.2.0",
|
|
69
|
-
"path-to-regexp": "^8.
|
|
75
|
+
"path-to-regexp": "^8.4.0",
|
|
70
76
|
"pg": "8.18.0",
|
|
71
77
|
"read-pkg": "10.1.0",
|
|
72
78
|
"ws": "^8.18.3",
|
|
73
79
|
"zod": "4.3.6",
|
|
74
|
-
"@
|
|
75
|
-
"
|
|
76
|
-
"@powerhousedao/analytics-engine-core": "6.0.2-staging.
|
|
77
|
-
"@powerhousedao/
|
|
78
|
-
"@powerhousedao/
|
|
79
|
-
"@powerhousedao/
|
|
80
|
-
"@powerhousedao/
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"@renown/sdk": "6.0.2-staging.
|
|
80
|
+
"@opentelemetry/exporter-prometheus": "^0.57.2",
|
|
81
|
+
"graphql-tag": "2.12.6",
|
|
82
|
+
"@powerhousedao/analytics-engine-core": "6.0.2-staging.4",
|
|
83
|
+
"@powerhousedao/analytics-engine-graphql": "6.0.2-staging.4",
|
|
84
|
+
"@powerhousedao/analytics-engine-pg": "6.0.2-staging.4",
|
|
85
|
+
"@powerhousedao/config": "6.0.2-staging.4",
|
|
86
|
+
"@powerhousedao/reactor": "6.0.2-staging.4",
|
|
87
|
+
"@powerhousedao/reactor-mcp": "6.0.2-staging.4",
|
|
88
|
+
"@powerhousedao/shared": "6.0.2-staging.4",
|
|
89
|
+
"@renown/sdk": "6.0.2-staging.4",
|
|
90
|
+
"document-model": "6.0.2-staging.4"
|
|
84
91
|
},
|
|
85
92
|
"devDependencies": {
|
|
86
93
|
"@graphql-codegen/cli": "6.1.1",
|
|
@@ -90,19 +97,25 @@
|
|
|
90
97
|
"@graphql-codegen/typescript-resolvers": "5.1.5",
|
|
91
98
|
"@types/body-parser": "^1.19.5",
|
|
92
99
|
"@types/cors": "^2.8.17",
|
|
93
|
-
"@types/express": "
|
|
100
|
+
"@types/express": "4.17.25",
|
|
94
101
|
"@types/node": "25.2.3",
|
|
95
102
|
"@types/pg": "8.16.0",
|
|
96
103
|
"@types/ws": "^8.18.1",
|
|
97
|
-
"
|
|
98
|
-
"graphql-tag": "2.12.6",
|
|
104
|
+
"tsdown": "0.21.1",
|
|
99
105
|
"msw": "^2.7.3",
|
|
100
|
-
"
|
|
101
|
-
|
|
106
|
+
"vitest": "4.1.1"
|
|
107
|
+
},
|
|
108
|
+
"peerDependencies": {
|
|
109
|
+
"vite": "^8.0.0"
|
|
110
|
+
},
|
|
111
|
+
"peerDependenciesMeta": {
|
|
112
|
+
"vite": {
|
|
113
|
+
"optional": true
|
|
114
|
+
}
|
|
102
115
|
},
|
|
103
116
|
"scripts": {
|
|
104
117
|
"tsc": "tsc",
|
|
105
|
-
"build
|
|
118
|
+
"build": "tsdown",
|
|
106
119
|
"lint": "eslint",
|
|
107
120
|
"test": "vitest --run",
|
|
108
121
|
"bench": "vitest bench",
|
package/dist/codegen.d.ts
DELETED
package/dist/codegen.d.ts.map
DELETED
|
@@ -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
|
package/dist/codegen.js.map
DELETED
|
@@ -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,16 +0,0 @@
|
|
|
1
|
-
export * from "./src/graphql/index.js";
|
|
2
|
-
export * from "./src/graphql/types.js";
|
|
3
|
-
export * from "./src/packages/http-loader.js";
|
|
4
|
-
export { httpsHooksPath } from "./src/packages/https-hooks.mjs";
|
|
5
|
-
export * from "./src/packages/import-loader.js";
|
|
6
|
-
export * from "./src/packages/package-manager.js";
|
|
7
|
-
export * from "./src/packages/vite-loader.js";
|
|
8
|
-
export * from "./src/server.js";
|
|
9
|
-
export * from "./src/services/auth.service.js";
|
|
10
|
-
export * from "./src/services/document-permission.service.js";
|
|
11
|
-
export * from "./src/services/package-management.service.js";
|
|
12
|
-
export * from "./src/services/package-storage.js";
|
|
13
|
-
export * from "./src/tracing.js";
|
|
14
|
-
export * from "./src/types.js";
|
|
15
|
-
export * from "./src/utils/index.js";
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -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,+BAA+B,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,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,8CAA8C,CAAC;AAC7D,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from "./src/graphql/index.js";
|
|
2
|
-
export * from "./src/graphql/types.js";
|
|
3
|
-
export * from "./src/packages/http-loader.js";
|
|
4
|
-
export { httpsHooksPath } from "./src/packages/https-hooks.mjs";
|
|
5
|
-
export * from "./src/packages/import-loader.js";
|
|
6
|
-
export * from "./src/packages/package-manager.js";
|
|
7
|
-
export * from "./src/packages/vite-loader.js";
|
|
8
|
-
export * from "./src/server.js";
|
|
9
|
-
export * from "./src/services/auth.service.js";
|
|
10
|
-
export * from "./src/services/document-permission.service.js";
|
|
11
|
-
export * from "./src/services/package-management.service.js";
|
|
12
|
-
export * from "./src/services/package-storage.js";
|
|
13
|
-
export * from "./src/tracing.js";
|
|
14
|
-
export * from "./src/types.js";
|
|
15
|
-
export * from "./src/utils/index.js";
|
|
16
|
-
//# 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,+BAA+B,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,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,8CAA8C,CAAC;AAC7D,cAAc,mCAAmC,CAAC;AAClD,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
|
package/dist/src/config.d.ts
DELETED
package/dist/src/config.d.ts.map
DELETED
|
@@ -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"}
|
package/dist/src/config.js
DELETED
package/dist/src/config.js.map
DELETED
|
@@ -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"}
|
package/dist/src/dev.d.ts
DELETED
package/dist/src/dev.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/dev.ts"],"names":[],"mappings":""}
|