@powerhousedao/reactor-api 6.0.0-dev.209 → 6.0.0-dev.210
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/dist/index.d.mts +92 -77
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +127 -116
- package/dist/index.mjs.map +1 -1
- package/dist/src/packages/vite-loader.mjs +1 -1
- package/dist/{utils-BQp2hnaa.mjs → utils-CVrD_vPF.mjs} +2 -2
- package/dist/utils-CVrD_vPF.mjs.map +1 -0
- package/package.json +11 -11
- package/dist/utils-BQp2hnaa.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isSubgraphClass, c as loadDocumentModels, d as BaseSubgraph, i as buildGraphqlOperations, l as loadProcessors, n as buildGraphQlDriveDocument, o as debounce, r as buildGraphqlOperation, t as buildGraphQlDocument, u as loadSubgraphs } from "./utils-
|
|
1
|
+
import { a as isSubgraphClass, c as loadDocumentModels, d as BaseSubgraph, i as buildGraphqlOperations, l as loadProcessors, n as buildGraphQlDriveDocument, o as debounce, r as buildGraphqlOperation, t as buildGraphQlDocument, u as loadSubgraphs } from "./utils-CVrD_vPF.mjs";
|
|
2
2
|
import { AnalyticsQueryEngine } from "@powerhousedao/analytics-engine-core";
|
|
3
3
|
import { AnalyticsModel, AnalyticsResolvers, typedefs } from "@powerhousedao/analytics-engine-graphql";
|
|
4
4
|
import { gql } from "graphql-tag";
|
|
@@ -1695,11 +1695,11 @@ function generateNewApiSchema(documentName, specification, _stateSchemaTypes, pr
|
|
|
1695
1695
|
"""Find ${documentName} documents by search criteria"""
|
|
1696
1696
|
findDocuments(search: ${documentName}_SearchFilterInput, view: ${documentName}_ViewFilterInput, paging: ${documentName}_PagingInput): ${documentName}_DocumentResultPage!
|
|
1697
1697
|
|
|
1698
|
-
"""Get
|
|
1699
|
-
|
|
1698
|
+
"""Get outgoing relationships of a ${documentName} document"""
|
|
1699
|
+
documentOutgoingRelationships(sourceIdentifier: String!, relationshipType: String!, view: ${documentName}_ViewFilterInput, paging: ${documentName}_PagingInput): ${documentName}_DocumentResultPage!
|
|
1700
1700
|
|
|
1701
|
-
"""Get
|
|
1702
|
-
|
|
1701
|
+
"""Get incoming relationships to a ${documentName} document"""
|
|
1702
|
+
documentIncomingRelationships(targetIdentifier: String!, relationshipType: String!, view: ${documentName}_ViewFilterInput, paging: ${documentName}_PagingInput): ${documentName}_DocumentResultPage!
|
|
1703
1703
|
}
|
|
1704
1704
|
`;
|
|
1705
1705
|
let initialStateInputSchema = "";
|
|
@@ -2060,14 +2060,16 @@ const GetDocumentWithOperationsDocument = gql`
|
|
|
2060
2060
|
}
|
|
2061
2061
|
${PhDocumentFieldsFragmentDoc}
|
|
2062
2062
|
`;
|
|
2063
|
-
const
|
|
2064
|
-
query
|
|
2065
|
-
$
|
|
2063
|
+
const GetDocumentOutgoingRelationshipsDocument = gql`
|
|
2064
|
+
query GetDocumentOutgoingRelationships(
|
|
2065
|
+
$sourceIdentifier: String!
|
|
2066
|
+
$relationshipType: String!
|
|
2066
2067
|
$view: ViewFilterInput
|
|
2067
2068
|
$paging: PagingInput
|
|
2068
2069
|
) {
|
|
2069
|
-
|
|
2070
|
-
|
|
2070
|
+
documentOutgoingRelationships(
|
|
2071
|
+
sourceIdentifier: $sourceIdentifier
|
|
2072
|
+
relationshipType: $relationshipType
|
|
2071
2073
|
view: $view
|
|
2072
2074
|
paging: $paging
|
|
2073
2075
|
) {
|
|
@@ -2082,14 +2084,16 @@ const GetDocumentChildrenDocument = gql`
|
|
|
2082
2084
|
}
|
|
2083
2085
|
${PhDocumentFieldsFragmentDoc}
|
|
2084
2086
|
`;
|
|
2085
|
-
const
|
|
2086
|
-
query
|
|
2087
|
-
$
|
|
2087
|
+
const GetDocumentIncomingRelationshipsDocument = gql`
|
|
2088
|
+
query GetDocumentIncomingRelationships(
|
|
2089
|
+
$targetIdentifier: String!
|
|
2090
|
+
$relationshipType: String!
|
|
2088
2091
|
$view: ViewFilterInput
|
|
2089
2092
|
$paging: PagingInput
|
|
2090
2093
|
) {
|
|
2091
|
-
|
|
2092
|
-
|
|
2094
|
+
documentIncomingRelationships(
|
|
2095
|
+
targetIdentifier: $targetIdentifier
|
|
2096
|
+
relationshipType: $relationshipType
|
|
2093
2097
|
view: $view
|
|
2094
2098
|
paging: $paging
|
|
2095
2099
|
) {
|
|
@@ -2250,15 +2254,17 @@ const RenameDocumentDocument = gql`
|
|
|
2250
2254
|
}
|
|
2251
2255
|
${PhDocumentFieldsFragmentDoc}
|
|
2252
2256
|
`;
|
|
2253
|
-
const
|
|
2254
|
-
mutation
|
|
2255
|
-
$
|
|
2256
|
-
$
|
|
2257
|
+
const AddRelationshipDocument = gql`
|
|
2258
|
+
mutation AddRelationship(
|
|
2259
|
+
$sourceIdentifier: String!
|
|
2260
|
+
$targetIdentifier: String!
|
|
2261
|
+
$relationshipType: String!
|
|
2257
2262
|
$branch: String
|
|
2258
2263
|
) {
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2264
|
+
addRelationship(
|
|
2265
|
+
sourceIdentifier: $sourceIdentifier
|
|
2266
|
+
targetIdentifier: $targetIdentifier
|
|
2267
|
+
relationshipType: $relationshipType
|
|
2262
2268
|
branch: $branch
|
|
2263
2269
|
) {
|
|
2264
2270
|
...PHDocumentFields
|
|
@@ -2266,15 +2272,17 @@ const AddChildrenDocument = gql`
|
|
|
2266
2272
|
}
|
|
2267
2273
|
${PhDocumentFieldsFragmentDoc}
|
|
2268
2274
|
`;
|
|
2269
|
-
const
|
|
2270
|
-
mutation
|
|
2271
|
-
$
|
|
2272
|
-
$
|
|
2275
|
+
const RemoveRelationshipDocument = gql`
|
|
2276
|
+
mutation RemoveRelationship(
|
|
2277
|
+
$sourceIdentifier: String!
|
|
2278
|
+
$targetIdentifier: String!
|
|
2279
|
+
$relationshipType: String!
|
|
2273
2280
|
$branch: String
|
|
2274
2281
|
) {
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2282
|
+
removeRelationship(
|
|
2283
|
+
sourceIdentifier: $sourceIdentifier
|
|
2284
|
+
targetIdentifier: $targetIdentifier
|
|
2285
|
+
relationshipType: $relationshipType
|
|
2278
2286
|
branch: $branch
|
|
2279
2287
|
) {
|
|
2280
2288
|
...PHDocumentFields
|
|
@@ -2282,17 +2290,19 @@ const RemoveChildrenDocument = gql`
|
|
|
2282
2290
|
}
|
|
2283
2291
|
${PhDocumentFieldsFragmentDoc}
|
|
2284
2292
|
`;
|
|
2285
|
-
const
|
|
2286
|
-
mutation
|
|
2293
|
+
const MoveRelationshipDocument = gql`
|
|
2294
|
+
mutation MoveRelationship(
|
|
2287
2295
|
$sourceParentIdentifier: String!
|
|
2288
2296
|
$targetParentIdentifier: String!
|
|
2289
|
-
$
|
|
2297
|
+
$targetIdentifier: String!
|
|
2298
|
+
$relationshipType: String!
|
|
2290
2299
|
$branch: String
|
|
2291
2300
|
) {
|
|
2292
|
-
|
|
2301
|
+
moveRelationship(
|
|
2293
2302
|
sourceParentIdentifier: $sourceParentIdentifier
|
|
2294
2303
|
targetParentIdentifier: $targetParentIdentifier
|
|
2295
|
-
|
|
2304
|
+
targetIdentifier: $targetIdentifier
|
|
2305
|
+
relationshipType: $relationshipType
|
|
2296
2306
|
branch: $branch
|
|
2297
2307
|
) {
|
|
2298
2308
|
source {
|
|
@@ -2447,11 +2457,11 @@ function getSdk(requester) {
|
|
|
2447
2457
|
GetDocumentWithOperations(variables, options) {
|
|
2448
2458
|
return requester(GetDocumentWithOperationsDocument, variables, options);
|
|
2449
2459
|
},
|
|
2450
|
-
|
|
2451
|
-
return requester(
|
|
2460
|
+
GetDocumentOutgoingRelationships(variables, options) {
|
|
2461
|
+
return requester(GetDocumentOutgoingRelationshipsDocument, variables, options);
|
|
2452
2462
|
},
|
|
2453
|
-
|
|
2454
|
-
return requester(
|
|
2463
|
+
GetDocumentIncomingRelationships(variables, options) {
|
|
2464
|
+
return requester(GetDocumentIncomingRelationshipsDocument, variables, options);
|
|
2455
2465
|
},
|
|
2456
2466
|
FindDocuments(variables, options) {
|
|
2457
2467
|
return requester(FindDocumentsDocument, variables, options);
|
|
@@ -2477,14 +2487,14 @@ function getSdk(requester) {
|
|
|
2477
2487
|
RenameDocument(variables, options) {
|
|
2478
2488
|
return requester(RenameDocumentDocument, variables, options);
|
|
2479
2489
|
},
|
|
2480
|
-
|
|
2481
|
-
return requester(
|
|
2490
|
+
AddRelationship(variables, options) {
|
|
2491
|
+
return requester(AddRelationshipDocument, variables, options);
|
|
2482
2492
|
},
|
|
2483
|
-
|
|
2484
|
-
return requester(
|
|
2493
|
+
RemoveRelationship(variables, options) {
|
|
2494
|
+
return requester(RemoveRelationshipDocument, variables, options);
|
|
2485
2495
|
},
|
|
2486
|
-
|
|
2487
|
-
return requester(
|
|
2496
|
+
MoveRelationship(variables, options) {
|
|
2497
|
+
return requester(MoveRelationshipDocument, variables, options);
|
|
2488
2498
|
},
|
|
2489
2499
|
DeleteDocument(variables, options) {
|
|
2490
2500
|
return requester(DeleteDocumentDocument, variables, options);
|
|
@@ -2749,7 +2759,7 @@ async function document(reactorClient, args) {
|
|
|
2749
2759
|
}
|
|
2750
2760
|
let children;
|
|
2751
2761
|
try {
|
|
2752
|
-
children = await reactorClient.
|
|
2762
|
+
children = await reactorClient.getOutgoingRelationships(args.identifier, "child", view);
|
|
2753
2763
|
} catch (error) {
|
|
2754
2764
|
throw new GraphQLError(`Failed to fetch children: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2755
2765
|
}
|
|
@@ -2762,7 +2772,7 @@ async function document(reactorClient, args) {
|
|
|
2762
2772
|
throw new GraphQLError(`Failed to convert document to GraphQL: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2763
2773
|
}
|
|
2764
2774
|
}
|
|
2765
|
-
async function
|
|
2775
|
+
async function documentOutgoingRelationships(reactorClient, args) {
|
|
2766
2776
|
let view;
|
|
2767
2777
|
if (args.view) view = {
|
|
2768
2778
|
branch: fromInputMaybe(args.view.branch),
|
|
@@ -2779,17 +2789,17 @@ async function documentChildren(reactorClient, args) {
|
|
|
2779
2789
|
}
|
|
2780
2790
|
let result;
|
|
2781
2791
|
try {
|
|
2782
|
-
result = await reactorClient.
|
|
2792
|
+
result = await reactorClient.getOutgoingRelationships(args.sourceIdentifier, args.relationshipType, view, paging);
|
|
2783
2793
|
} catch (error) {
|
|
2784
|
-
throw new GraphQLError(`Failed to fetch
|
|
2794
|
+
throw new GraphQLError(`Failed to fetch outgoing relationships: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2785
2795
|
}
|
|
2786
2796
|
try {
|
|
2787
2797
|
return toPhDocumentResultPage(result);
|
|
2788
2798
|
} catch (error) {
|
|
2789
|
-
throw new GraphQLError(`Failed to convert
|
|
2799
|
+
throw new GraphQLError(`Failed to convert outgoing relationships to GraphQL: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2790
2800
|
}
|
|
2791
2801
|
}
|
|
2792
|
-
async function
|
|
2802
|
+
async function documentIncomingRelationships(reactorClient, args) {
|
|
2793
2803
|
let view;
|
|
2794
2804
|
if (args.view) view = {
|
|
2795
2805
|
branch: fromInputMaybe(args.view.branch),
|
|
@@ -2806,14 +2816,14 @@ async function documentParents(reactorClient, args) {
|
|
|
2806
2816
|
}
|
|
2807
2817
|
let result;
|
|
2808
2818
|
try {
|
|
2809
|
-
result = await reactorClient.
|
|
2819
|
+
result = await reactorClient.getIncomingRelationships(args.targetIdentifier, args.relationshipType, view, paging);
|
|
2810
2820
|
} catch (error) {
|
|
2811
|
-
throw new GraphQLError(`Failed to fetch
|
|
2821
|
+
throw new GraphQLError(`Failed to fetch incoming relationships: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2812
2822
|
}
|
|
2813
2823
|
try {
|
|
2814
2824
|
return toPhDocumentResultPage(result);
|
|
2815
2825
|
} catch (error) {
|
|
2816
|
-
throw new GraphQLError(`Failed to convert
|
|
2826
|
+
throw new GraphQLError(`Failed to convert incoming relationships to GraphQL: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2817
2827
|
}
|
|
2818
2828
|
}
|
|
2819
2829
|
async function findDocuments(reactorClient, args) {
|
|
@@ -2907,7 +2917,7 @@ async function createDocument(reactorClient, args) {
|
|
|
2907
2917
|
const parentIdentifier = fromInputMaybe(args.parentIdentifier);
|
|
2908
2918
|
let result;
|
|
2909
2919
|
try {
|
|
2910
|
-
if (parentIdentifier) if ((await reactorClient.get(parentIdentifier)).header.documentType === DRIVE_DOCUMENT_TYPE) result = await reactorClient.
|
|
2920
|
+
if (parentIdentifier) if ((await reactorClient.get(parentIdentifier)).header.documentType === DRIVE_DOCUMENT_TYPE) result = await reactorClient.drives.addFile(parentIdentifier, document);
|
|
2911
2921
|
else result = await reactorClient.create(document, parentIdentifier);
|
|
2912
2922
|
else result = await reactorClient.create(document);
|
|
2913
2923
|
} catch (error) {
|
|
@@ -2927,7 +2937,7 @@ async function createEmptyDocument(reactorClient, args) {
|
|
|
2927
2937
|
if (parentIdentifier) if ((await reactorClient.get(parentIdentifier)).header.documentType === DRIVE_DOCUMENT_TYPE) {
|
|
2928
2938
|
const document = (await reactorClient.getDocumentModelModule(args.documentType)).utils.createDocument();
|
|
2929
2939
|
if (name) document.header.name = name;
|
|
2930
|
-
result = await reactorClient.
|
|
2940
|
+
result = await reactorClient.drives.addFile(parentIdentifier, document);
|
|
2931
2941
|
} else result = await reactorClient.createEmpty(args.documentType, { parentIdentifier });
|
|
2932
2942
|
else result = await reactorClient.createEmpty(args.documentType, {});
|
|
2933
2943
|
} catch (error) {
|
|
@@ -2972,7 +2982,7 @@ async function createDocumentWithInitialState(reactorClient, args) {
|
|
|
2972
2982
|
throw new GraphQLError(`Parent document not found: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2973
2983
|
}
|
|
2974
2984
|
if (parent.header.documentType === DRIVE_DOCUMENT_TYPE) try {
|
|
2975
|
-
result = await reactorClient.
|
|
2985
|
+
result = await reactorClient.drives.addFile(parentIdentifier, document);
|
|
2976
2986
|
} catch (error) {
|
|
2977
2987
|
throw new GraphQLError(`Failed to create document in drive: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
2978
2988
|
}
|
|
@@ -3044,14 +3054,13 @@ async function renameDocument(reactorClient, args, signal) {
|
|
|
3044
3054
|
throw new GraphQLError(`Failed to convert renamed document to GraphQL: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3045
3055
|
}
|
|
3046
3056
|
}
|
|
3047
|
-
async function
|
|
3057
|
+
async function addRelationship(reactorClient, args) {
|
|
3048
3058
|
const branch = fromInputMaybe(args.branch);
|
|
3049
|
-
const documentIdentifiers = [...args.documentIdentifiers];
|
|
3050
3059
|
let result;
|
|
3051
3060
|
try {
|
|
3052
|
-
result = await reactorClient.
|
|
3061
|
+
result = await reactorClient.addRelationship(args.sourceIdentifier, args.targetIdentifier, args.relationshipType, branch);
|
|
3053
3062
|
} catch (error) {
|
|
3054
|
-
throw new GraphQLError(`Failed to add
|
|
3063
|
+
throw new GraphQLError(`Failed to add relationship: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3055
3064
|
}
|
|
3056
3065
|
try {
|
|
3057
3066
|
return toGqlPhDocument(result);
|
|
@@ -3059,14 +3068,13 @@ async function addChildren(reactorClient, args) {
|
|
|
3059
3068
|
throw new GraphQLError(`Failed to convert document to GraphQL: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3060
3069
|
}
|
|
3061
3070
|
}
|
|
3062
|
-
async function
|
|
3071
|
+
async function removeRelationship(reactorClient, args) {
|
|
3063
3072
|
const branch = fromInputMaybe(args.branch);
|
|
3064
|
-
const documentIdentifiers = [...args.documentIdentifiers];
|
|
3065
3073
|
let result;
|
|
3066
3074
|
try {
|
|
3067
|
-
result = await reactorClient.
|
|
3075
|
+
result = await reactorClient.removeRelationship(args.sourceIdentifier, args.targetIdentifier, args.relationshipType, branch);
|
|
3068
3076
|
} catch (error) {
|
|
3069
|
-
throw new GraphQLError(`Failed to remove
|
|
3077
|
+
throw new GraphQLError(`Failed to remove relationship: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3070
3078
|
}
|
|
3071
3079
|
try {
|
|
3072
3080
|
return toGqlPhDocument(result);
|
|
@@ -3074,14 +3082,13 @@ async function removeChildren(reactorClient, args) {
|
|
|
3074
3082
|
throw new GraphQLError(`Failed to convert document to GraphQL: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3075
3083
|
}
|
|
3076
3084
|
}
|
|
3077
|
-
async function
|
|
3085
|
+
async function moveRelationship(reactorClient, args) {
|
|
3078
3086
|
const branch = fromInputMaybe(args.branch);
|
|
3079
|
-
const documentIdentifiers = [...args.documentIdentifiers];
|
|
3080
3087
|
let result;
|
|
3081
3088
|
try {
|
|
3082
|
-
result = await reactorClient.
|
|
3089
|
+
result = await reactorClient.moveRelationship(args.sourceParentIdentifier, args.targetParentIdentifier, args.targetIdentifier, args.relationshipType, branch);
|
|
3083
3090
|
} catch (error) {
|
|
3084
|
-
throw new GraphQLError(`Failed to move
|
|
3091
|
+
throw new GraphQLError(`Failed to move relationship: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
3085
3092
|
}
|
|
3086
3093
|
try {
|
|
3087
3094
|
return {
|
|
@@ -3095,7 +3102,9 @@ async function moveChildren(reactorClient, args) {
|
|
|
3095
3102
|
async function deleteDocument(reactorClient, args) {
|
|
3096
3103
|
const propagate = toReactorPropagationMode(args.propagate);
|
|
3097
3104
|
try {
|
|
3098
|
-
await reactorClient.
|
|
3105
|
+
const driveParent = (await reactorClient.getIncomingRelationships(args.identifier, "child")).results.find((p) => p.header.documentType === "powerhouse/document-drive");
|
|
3106
|
+
if (driveParent) await reactorClient.drives.removeNode(driveParent.header.id, args.identifier);
|
|
3107
|
+
else await reactorClient.deleteDocument(args.identifier, propagate);
|
|
3099
3108
|
return true;
|
|
3100
3109
|
} catch (error) {
|
|
3101
3110
|
throw new GraphQLError(`Failed to delete document: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -3367,11 +3376,12 @@ var DocumentModelSubgraph = class extends BaseSubgraph {
|
|
|
3367
3376
|
}
|
|
3368
3377
|
return result;
|
|
3369
3378
|
},
|
|
3370
|
-
|
|
3371
|
-
const {
|
|
3372
|
-
await this.assertCanRead(
|
|
3373
|
-
const result = await
|
|
3374
|
-
|
|
3379
|
+
documentOutgoingRelationships: async (_, args, ctx) => {
|
|
3380
|
+
const { sourceIdentifier, relationshipType, view, paging } = args;
|
|
3381
|
+
await this.assertCanRead(sourceIdentifier, ctx);
|
|
3382
|
+
const result = await documentOutgoingRelationships(this.reactorClient, {
|
|
3383
|
+
sourceIdentifier,
|
|
3384
|
+
relationshipType,
|
|
3375
3385
|
view,
|
|
3376
3386
|
paging
|
|
3377
3387
|
});
|
|
@@ -3382,11 +3392,12 @@ var DocumentModelSubgraph = class extends BaseSubgraph {
|
|
|
3382
3392
|
totalCount: filteredItems.length
|
|
3383
3393
|
};
|
|
3384
3394
|
},
|
|
3385
|
-
|
|
3386
|
-
const {
|
|
3387
|
-
await this.assertCanRead(
|
|
3388
|
-
return
|
|
3389
|
-
|
|
3395
|
+
documentIncomingRelationships: async (_, args, ctx) => {
|
|
3396
|
+
const { targetIdentifier, relationshipType, view, paging } = args;
|
|
3397
|
+
await this.assertCanRead(targetIdentifier, ctx);
|
|
3398
|
+
return documentIncomingRelationships(this.reactorClient, {
|
|
3399
|
+
targetIdentifier,
|
|
3400
|
+
relationshipType,
|
|
3390
3401
|
view,
|
|
3391
3402
|
paging
|
|
3392
3403
|
});
|
|
@@ -4096,7 +4107,7 @@ const DocumentWithChildrenDTO = z.object({
|
|
|
4096
4107
|
document: PHDocumentDTO,
|
|
4097
4108
|
childIds: z.array(z.string())
|
|
4098
4109
|
}).strip();
|
|
4099
|
-
const
|
|
4110
|
+
const MoveRelationshipResultDTO = z.object({
|
|
4100
4111
|
source: PHDocumentDTO,
|
|
4101
4112
|
target: PHDocumentDTO
|
|
4102
4113
|
}).strip();
|
|
@@ -4186,11 +4197,11 @@ const operationValidators = {
|
|
|
4186
4197
|
GetDocumentModels: (data) => {
|
|
4187
4198
|
if (data.documentModels) DocumentModelResultPageDTO.parse(data.documentModels);
|
|
4188
4199
|
},
|
|
4189
|
-
|
|
4190
|
-
if (data.
|
|
4200
|
+
GetDocumentOutgoingRelationships: (data) => {
|
|
4201
|
+
if (data.documentOutgoingRelationships) PHDocumentResultPageDTO.parse(data.documentOutgoingRelationships);
|
|
4191
4202
|
},
|
|
4192
|
-
|
|
4193
|
-
if (data.
|
|
4203
|
+
GetDocumentIncomingRelationships: (data) => {
|
|
4204
|
+
if (data.documentIncomingRelationships) PHDocumentResultPageDTO.parse(data.documentIncomingRelationships);
|
|
4194
4205
|
},
|
|
4195
4206
|
FindDocuments: (data) => {
|
|
4196
4207
|
if (data.findDocuments) PHDocumentResultPageDTO.parse(data.findDocuments);
|
|
@@ -4216,14 +4227,14 @@ const operationValidators = {
|
|
|
4216
4227
|
RenameDocument: (data) => {
|
|
4217
4228
|
if (data.renameDocument) PHDocumentDTO.parse(data.renameDocument);
|
|
4218
4229
|
},
|
|
4219
|
-
|
|
4220
|
-
if (data.
|
|
4230
|
+
AddRelationship: (data) => {
|
|
4231
|
+
if (data.addRelationship) PHDocumentDTO.parse(data.addRelationship);
|
|
4221
4232
|
},
|
|
4222
|
-
|
|
4223
|
-
if (data.
|
|
4233
|
+
RemoveRelationship: (data) => {
|
|
4234
|
+
if (data.removeRelationship) PHDocumentDTO.parse(data.removeRelationship);
|
|
4224
4235
|
},
|
|
4225
|
-
|
|
4226
|
-
if (data.
|
|
4236
|
+
MoveRelationship: (data) => {
|
|
4237
|
+
if (data.moveRelationship) MoveRelationshipResultDTO.parse(data.moveRelationship);
|
|
4227
4238
|
},
|
|
4228
4239
|
DeleteDocument: (data) => {
|
|
4229
4240
|
if (data.deleteDocument !== void 0) {}
|
|
@@ -4260,7 +4271,7 @@ function createReactorGraphQLClient(url, fetchImpl = fetch, headers) {
|
|
|
4260
4271
|
}
|
|
4261
4272
|
//#endregion
|
|
4262
4273
|
//#region src/graphql/reactor/schema.graphql
|
|
4263
|
-
var schema_default = "# Scalar types (for codegen - also defined in create-schema.ts)\nscalar JSONObject\nscalar DateTime\n\n# Input types\ninput PagingInput {\n limit: Int\n offset: Int\n cursor: String\n}\n\ninput ViewFilterInput {\n branch: String\n scopes: [String!]\n}\n\ninput SearchFilterInput {\n type: String\n parentId: String\n identifiers: [String!]\n}\n\ninput OperationsFilterInput {\n documentId: String!\n branch: String\n scopes: [String!]\n actionTypes: [String!]\n sinceRevision: Int\n timestampFrom: String\n timestampTo: String\n}\n\ninput DocumentOperationsFilterInput {\n branch: String\n scopes: [String!]\n actionTypes: [String!]\n sinceRevision: Int\n timestampFrom: String\n timestampTo: String\n}\n\n# Enums\nenum PropagationMode {\n CASCADE\n ORPHAN\n}\n\nenum DocumentChangeType {\n CREATED\n DELETED\n UPDATED\n PARENT_ADDED\n PARENT_REMOVED\n CHILD_ADDED\n CHILD_REMOVED\n}\n\n# Object types\ntype DocumentModelGlobalState {\n id: String!\n name: String!\n namespace: String\n version: String\n specification: JSONObject!\n}\n\ntype DocumentModelResultPage {\n items: [DocumentModelGlobalState!]!\n totalCount: Int!\n hasNextPage: Boolean!\n hasPreviousPage: Boolean!\n cursor: String\n}\n\ntype Revision {\n scope: String!\n revision: Int!\n}\n\ntype PHDocument {\n id: String!\n slug: String\n preferredEditor: String\n name: String!\n documentType: String!\n state: JSONObject!\n revisionsList: [Revision!]!\n createdAtUtcIso: DateTime!\n lastModifiedAtUtcIso: DateTime!\n operations(\n filter: DocumentOperationsFilterInput\n paging: PagingInput\n ): ReactorOperationResultPage\n}\n\ntype PHDocumentResultPage {\n items: [PHDocument!]!\n totalCount: Int!\n hasNextPage: Boolean!\n hasPreviousPage: Boolean!\n cursor: String\n}\n\ntype ReactorOperationResultPage {\n items: [ReactorOperation!]!\n totalCount: Int!\n hasNextPage: Boolean!\n hasPreviousPage: Boolean!\n cursor: String\n}\n\ntype DeadLetterInfo {\n documentId: String!\n error: String!\n jobId: String!\n branch: String!\n scopes: [String!]!\n operationCount: Int!\n}\n\ntype PollSyncEnvelopesResult {\n envelopes: [SyncEnvelope!]!\n ackOrdinal: Int!\n deadLetters: [DeadLetterInfo!]!\n hasMore: Boolean!\n}\n\ntype DocumentWithChildren {\n document: PHDocument!\n childIds: [String!]!\n}\n\ntype
|
|
4274
|
+
var schema_default = "# Scalar types (for codegen - also defined in create-schema.ts)\nscalar JSONObject\nscalar DateTime\n\n# Input types\ninput PagingInput {\n limit: Int\n offset: Int\n cursor: String\n}\n\ninput ViewFilterInput {\n branch: String\n scopes: [String!]\n}\n\ninput SearchFilterInput {\n type: String\n parentId: String\n identifiers: [String!]\n}\n\ninput OperationsFilterInput {\n documentId: String!\n branch: String\n scopes: [String!]\n actionTypes: [String!]\n sinceRevision: Int\n timestampFrom: String\n timestampTo: String\n}\n\ninput DocumentOperationsFilterInput {\n branch: String\n scopes: [String!]\n actionTypes: [String!]\n sinceRevision: Int\n timestampFrom: String\n timestampTo: String\n}\n\n# Enums\nenum PropagationMode {\n CASCADE\n ORPHAN\n}\n\nenum DocumentChangeType {\n CREATED\n DELETED\n UPDATED\n PARENT_ADDED\n PARENT_REMOVED\n CHILD_ADDED\n CHILD_REMOVED\n}\n\n# Object types\ntype DocumentModelGlobalState {\n id: String!\n name: String!\n namespace: String\n version: String\n specification: JSONObject!\n}\n\ntype DocumentModelResultPage {\n items: [DocumentModelGlobalState!]!\n totalCount: Int!\n hasNextPage: Boolean!\n hasPreviousPage: Boolean!\n cursor: String\n}\n\ntype Revision {\n scope: String!\n revision: Int!\n}\n\ntype PHDocument {\n id: String!\n slug: String\n preferredEditor: String\n name: String!\n documentType: String!\n state: JSONObject!\n revisionsList: [Revision!]!\n createdAtUtcIso: DateTime!\n lastModifiedAtUtcIso: DateTime!\n operations(\n filter: DocumentOperationsFilterInput\n paging: PagingInput\n ): ReactorOperationResultPage\n}\n\ntype PHDocumentResultPage {\n items: [PHDocument!]!\n totalCount: Int!\n hasNextPage: Boolean!\n hasPreviousPage: Boolean!\n cursor: String\n}\n\ntype ReactorOperationResultPage {\n items: [ReactorOperation!]!\n totalCount: Int!\n hasNextPage: Boolean!\n hasPreviousPage: Boolean!\n cursor: String\n}\n\ntype DeadLetterInfo {\n documentId: String!\n error: String!\n jobId: String!\n branch: String!\n scopes: [String!]!\n operationCount: Int!\n}\n\ntype PollSyncEnvelopesResult {\n envelopes: [SyncEnvelope!]!\n ackOrdinal: Int!\n deadLetters: [DeadLetterInfo!]!\n hasMore: Boolean!\n}\n\ntype DocumentWithChildren {\n document: PHDocument!\n childIds: [String!]!\n}\n\ntype MoveRelationshipResult {\n source: PHDocument!\n target: PHDocument!\n}\n\ntype JobInfo {\n id: String!\n status: String!\n result: JSONObject!\n error: String\n createdAt: DateTime!\n completedAt: DateTime\n}\n\ntype DocumentChangeEvent {\n type: DocumentChangeType!\n documents: [PHDocument!]!\n context: DocumentChangeContext\n}\n\ntype DocumentChangeContext {\n parentId: String\n childId: String\n}\n\ntype JobChangeEvent {\n jobId: String!\n status: String!\n result: JSONObject!\n error: String\n}\n\ntype ReactorSignerUser {\n address: String!\n networkId: String!\n chainId: Int!\n}\n\ntype ReactorSignerApp {\n name: String!\n key: String!\n}\n\ntype ReactorSigner {\n user: ReactorSignerUser\n app: ReactorSignerApp\n signatures: [String!]!\n}\n\ntype ActionContext {\n signer: ReactorSigner\n}\n\ntype Action {\n id: String!\n type: String!\n timestampUtcMs: String!\n input: JSONObject!\n scope: String!\n attachments: [Attachment!]\n context: ActionContext\n}\n\ntype Attachment {\n data: String!\n mimeType: String!\n hash: String!\n extension: String\n fileName: String\n}\n\n# Input types for sync operations\ninput ActionContextInput {\n signer: ReactorSignerInput\n}\n\ninput ReactorSignerInput {\n user: ReactorSignerUserInput\n app: ReactorSignerAppInput\n signatures: [String!]!\n}\n\ninput ReactorSignerUserInput {\n address: String!\n networkId: String!\n chainId: Int!\n}\n\ninput ReactorSignerAppInput {\n name: String!\n key: String!\n}\n\ninput ActionInput {\n id: String!\n type: String!\n timestampUtcMs: String!\n input: JSONObject!\n scope: String!\n attachments: [AttachmentInput!]\n context: ActionContextInput\n}\n\ninput AttachmentInput {\n data: String!\n mimeType: String!\n hash: String!\n extension: String\n fileName: String\n}\n\n# Synchronization types\ntype ReactorOperation {\n index: Int!\n timestampUtcMs: String!\n hash: String!\n skip: Int!\n error: String\n id: String\n action: Action!\n}\n\ninput OperationInput {\n index: Int!\n timestampUtcMs: String!\n hash: String!\n skip: Int!\n error: String\n id: String\n action: ActionInput!\n}\n\ntype OperationContext {\n documentId: String!\n documentType: String!\n scope: String!\n branch: String!\n ordinal: Int!\n}\n\ninput OperationContextInput {\n documentId: String!\n documentType: String!\n scope: String!\n branch: String!\n ordinal: Int!\n}\n\ntype OperationWithContext {\n operation: ReactorOperation!\n context: OperationContext!\n}\n\ninput OperationWithContextInput {\n operation: OperationInput!\n context: OperationContextInput!\n}\n\ntype ChannelMeta {\n id: String!\n}\n\ninput ChannelMetaInput {\n id: String!\n}\n\ntype RemoteCursor {\n remoteName: String!\n cursorOrdinal: Int!\n lastSyncedAtUtcMs: String\n}\n\ninput RemoteCursorInput {\n remoteName: String!\n cursorOrdinal: Int!\n lastSyncedAtUtcMs: String\n}\n\nenum SyncEnvelopeType {\n OPERATIONS\n ACK\n}\n\ntype SyncEnvelope {\n type: SyncEnvelopeType!\n channelMeta: ChannelMeta!\n operations: [OperationWithContext!]\n cursor: RemoteCursor\n key: String\n dependsOn: [String!]\n}\n\ninput SyncEnvelopeInput {\n type: SyncEnvelopeType!\n channelMeta: ChannelMetaInput!\n operations: [OperationWithContextInput!]\n cursor: RemoteCursorInput\n key: String\n dependsOn: [String!]\n}\n\ninput RemoteFilterInput {\n documentId: [String!]!\n scope: [String!]!\n branch: String!\n}\n\ninput TouchChannelInput {\n id: String!\n name: String!\n collectionId: String!\n filter: RemoteFilterInput!\n sinceTimestampUtcMs: String!\n}\n\ntype TouchChannelResult {\n success: Boolean!\n ackOrdinal: Int!\n}\n\ntype Query {\n # Get document models for a namespace\n documentModels(\n namespace: String\n paging: PagingInput\n ): DocumentModelResultPage!\n\n # Get a specific document by ID or slug\n document(identifier: String!, view: ViewFilterInput): DocumentWithChildren\n\n # Get outgoing relationships of a given type from a source document\n documentOutgoingRelationships(\n sourceIdentifier: String!\n relationshipType: String!\n view: ViewFilterInput\n paging: PagingInput\n ): PHDocumentResultPage!\n\n # Get incoming relationships of a given type to a target document\n documentIncomingRelationships(\n targetIdentifier: String!\n relationshipType: String!\n view: ViewFilterInput\n paging: PagingInput\n ): PHDocumentResultPage!\n\n # Find documents by search criteria\n findDocuments(\n search: SearchFilterInput\n view: ViewFilterInput\n paging: PagingInput\n ): PHDocumentResultPage!\n\n # Get job status\n jobStatus(jobId: String!): JobInfo\n\n # Get operations for a document with filtering and pagination\n documentOperations(\n filter: OperationsFilterInput!\n paging: PagingInput\n ): ReactorOperationResultPage!\n\n # Poll for sync envelopes from a channel\n pollSyncEnvelopes(\n channelId: String!\n outboxAck: Int!\n outboxLatest: Int!\n ): PollSyncEnvelopesResult!\n}\n\ntype Mutation {\n # Create a new document\n createDocument(document: JSONObject!, parentIdentifier: String): PHDocument!\n\n # Create an empty document of specified type\n createEmptyDocument(\n documentType: String!\n parentIdentifier: String\n ): PHDocument!\n\n # Apply actions to a document (synchronous)\n mutateDocument(\n documentIdentifier: String!\n actions: [JSONObject!]!\n view: ViewFilterInput\n ): PHDocument!\n\n # Submit actions to a document (asynchronous)\n mutateDocumentAsync(\n documentIdentifier: String!\n actions: [JSONObject!]!\n view: ViewFilterInput\n ): String!\n\n # Rename a document\n renameDocument(\n documentIdentifier: String!\n name: String!\n branch: String\n ): PHDocument!\n\n # Add a relationship between two documents\n addRelationship(\n sourceIdentifier: String!\n targetIdentifier: String!\n relationshipType: String!\n branch: String\n ): PHDocument!\n\n # Remove a relationship between two documents\n removeRelationship(\n sourceIdentifier: String!\n targetIdentifier: String!\n relationshipType: String!\n branch: String\n ): PHDocument!\n\n # Move a relationship from one source to another\n moveRelationship(\n sourceParentIdentifier: String!\n targetParentIdentifier: String!\n targetIdentifier: String!\n relationshipType: String!\n branch: String\n ): MoveRelationshipResult!\n\n # Delete a single document\n deleteDocument(identifier: String!, propagate: PropagationMode): Boolean!\n\n # Delete multiple documents\n deleteDocuments(identifiers: [String!]!, propagate: PropagationMode): Boolean!\n\n # Touch (create or update) a channel for sync\n touchChannel(input: TouchChannelInput!): TouchChannelResult!\n\n # Push sync envelopes to a channel\n pushSyncEnvelopes(envelopes: [SyncEnvelopeInput!]!): Boolean!\n}\n\ntype Subscription {\n # Subscribe to document changes\n documentChanges(\n search: SearchFilterInput\n view: ViewFilterInput\n ): DocumentChangeEvent!\n\n # Subscribe to job changes\n jobChanges(jobId: String!): JobChangeEvent!\n}\n";
|
|
4264
4275
|
//#endregion
|
|
4265
4276
|
//#region src/graphql/reactor/pubsub.ts
|
|
4266
4277
|
const pubSub = new PubSub();
|
|
@@ -4410,21 +4421,21 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4410
4421
|
throw error;
|
|
4411
4422
|
}
|
|
4412
4423
|
},
|
|
4413
|
-
|
|
4414
|
-
this.logger.debug("
|
|
4424
|
+
documentOutgoingRelationships: async (_parent, args, ctx) => {
|
|
4425
|
+
this.logger.debug("documentOutgoingRelationships(@args)", args);
|
|
4415
4426
|
try {
|
|
4416
|
-
await this.assertCanRead(args.
|
|
4417
|
-
return await
|
|
4427
|
+
await this.assertCanRead(args.sourceIdentifier, ctx);
|
|
4428
|
+
return await documentOutgoingRelationships(this.reactorClient, args);
|
|
4418
4429
|
} catch (error) {
|
|
4419
|
-
this.logger.error("Error in
|
|
4430
|
+
this.logger.error("Error in documentOutgoingRelationships: @Error", error);
|
|
4420
4431
|
throw error;
|
|
4421
4432
|
}
|
|
4422
4433
|
},
|
|
4423
|
-
|
|
4424
|
-
this.logger.debug("
|
|
4434
|
+
documentIncomingRelationships: async (_parent, args, ctx) => {
|
|
4435
|
+
this.logger.debug("documentIncomingRelationships(@args)", args);
|
|
4425
4436
|
try {
|
|
4426
|
-
await this.assertCanRead(args.
|
|
4427
|
-
const result = await
|
|
4437
|
+
await this.assertCanRead(args.targetIdentifier, ctx);
|
|
4438
|
+
const result = await documentIncomingRelationships(this.reactorClient, args);
|
|
4428
4439
|
if (!this.hasGlobalAdminAccess(ctx) && this.documentPermissionService) {
|
|
4429
4440
|
const filteredItems = [];
|
|
4430
4441
|
for (const item of result.items) if (await this.canReadDocument(item.id, ctx)) filteredItems.push(item);
|
|
@@ -4435,7 +4446,7 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4435
4446
|
}
|
|
4436
4447
|
return result;
|
|
4437
4448
|
} catch (error) {
|
|
4438
|
-
this.logger.error("Error in
|
|
4449
|
+
this.logger.error("Error in documentIncomingRelationships: @Error", error);
|
|
4439
4450
|
throw error;
|
|
4440
4451
|
}
|
|
4441
4452
|
},
|
|
@@ -4562,34 +4573,34 @@ var ReactorSubgraph = class extends BaseSubgraph {
|
|
|
4562
4573
|
throw error;
|
|
4563
4574
|
}
|
|
4564
4575
|
},
|
|
4565
|
-
|
|
4566
|
-
this.logger.debug("
|
|
4576
|
+
addRelationship: async (_parent, args, ctx) => {
|
|
4577
|
+
this.logger.debug("addRelationship(@args)", args);
|
|
4567
4578
|
try {
|
|
4568
|
-
await this.assertCanWrite(args.
|
|
4569
|
-
return await
|
|
4579
|
+
await this.assertCanWrite(args.sourceIdentifier, ctx);
|
|
4580
|
+
return await addRelationship(this.reactorClient, args);
|
|
4570
4581
|
} catch (error) {
|
|
4571
|
-
this.logger.error("Error in
|
|
4582
|
+
this.logger.error("Error in addRelationship(@args): @Error", error);
|
|
4572
4583
|
throw error;
|
|
4573
4584
|
}
|
|
4574
4585
|
},
|
|
4575
|
-
|
|
4576
|
-
this.logger.debug("
|
|
4586
|
+
removeRelationship: async (_parent, args, ctx) => {
|
|
4587
|
+
this.logger.debug("removeRelationship(@args)", args);
|
|
4577
4588
|
try {
|
|
4578
|
-
await this.assertCanWrite(args.
|
|
4579
|
-
return await
|
|
4589
|
+
await this.assertCanWrite(args.sourceIdentifier, ctx);
|
|
4590
|
+
return await removeRelationship(this.reactorClient, args);
|
|
4580
4591
|
} catch (error) {
|
|
4581
|
-
this.logger.error("Error in
|
|
4592
|
+
this.logger.error("Error in removeRelationship(@args): @Error", error);
|
|
4582
4593
|
throw error;
|
|
4583
4594
|
}
|
|
4584
4595
|
},
|
|
4585
|
-
|
|
4586
|
-
this.logger.debug("
|
|
4596
|
+
moveRelationship: async (_parent, args, ctx) => {
|
|
4597
|
+
this.logger.debug("moveRelationship(@args)", args);
|
|
4587
4598
|
try {
|
|
4588
4599
|
await this.assertCanWrite(args.sourceParentIdentifier, ctx);
|
|
4589
4600
|
await this.assertCanWrite(args.targetParentIdentifier, ctx);
|
|
4590
|
-
return await
|
|
4601
|
+
return await moveRelationship(this.reactorClient, args);
|
|
4591
4602
|
} catch (error) {
|
|
4592
|
-
this.logger.error("Error in
|
|
4603
|
+
this.logger.error("Error in moveRelationship(@args): @Error @args", error, args);
|
|
4593
4604
|
throw error;
|
|
4594
4605
|
}
|
|
4595
4606
|
},
|
|
@@ -6448,6 +6459,6 @@ var PackageManagementService = class {
|
|
|
6448
6459
|
}
|
|
6449
6460
|
};
|
|
6450
6461
|
//#endregion
|
|
6451
|
-
export { ADMIN_USERS, ActionContextInputSchema, ActionInputSchema,
|
|
6462
|
+
export { ADMIN_USERS, ActionContextInputSchema, ActionInputSchema, AddRelationshipDocument, AnalyticsSubgraph, AttachmentInputSchema, AuthService, AuthSubgraph, BaseSubgraph, ChannelMetaInputSchema, CreateDocumentDocument, CreateEmptyDocumentDocument, DeleteDocumentDocument, DeleteDocumentsDocument, DocumentChangeType, DocumentChangeTypeSchema, DocumentChangesDocument, DocumentOperationsFilterInputSchema, DocumentPermissionService, FindDocumentsDocument, GetDocumentDocument, GetDocumentIncomingRelationshipsDocument, GetDocumentModelsDocument, GetDocumentOperationsDocument, GetDocumentOutgoingRelationshipsDocument, GetDocumentWithOperationsDocument, GetJobStatusDocument, GraphQLManager, HttpDocumentModelLoader, HttpPackageLoader, ImportPackageLoader, InMemoryPackageStorage, JobChangesDocument, MoveRelationshipDocument, MutateDocumentAsyncDocument, MutateDocumentDocument, OperationContextInputSchema, OperationInputSchema, OperationWithContextInputSchema, OperationsFilterInputSchema, PackageManagementService, PackageManager, PackagesSubgraph, PagingInputSchema, PhDocumentFieldsFragmentDoc, PollSyncEnvelopesDocument, PropagationMode, PropagationModeSchema, PushSyncEnvelopesDocument, ReactorSignerAppInputSchema, ReactorSignerInputSchema, ReactorSignerUserInputSchema, ReactorSubgraph, RemoteCursorInputSchema, RemoteFilterInputSchema, RemoveRelationshipDocument, RenameDocumentDocument, SearchFilterInputSchema, SyncEnvelopeInputSchema, SyncEnvelopeType, SyncEnvelopeTypeSchema, SystemSubgraph, TouchChannelDocument, TouchChannelInputSchema, ViewFilterInputSchema, buildGraphQlDocument, buildGraphQlDriveDocument, buildGraphqlOperation, buildGraphqlOperations, buildSubgraphSchemaModule, createAuthFetchMiddleware, createGatewayAdapter, createHttpAdapter, createMergedSchema, createReactorGraphQLClient, createSchema, definedNonNullAnySchema, driveIdFromUrl, generateDocumentModelSchema, getAuthContext, getDbClient, getDocumentModelSchemaName, getDocumentModelTypeDefs, getGitHash, getSdk, getUniqueDocumentModels, getVersion, initAnalyticsStoreSql, initTracing, initializeAndStartAPI, isDefinedNonNullAny, isSubgraphClass, isTracingEnabled, parseDriveUrl, renderGraphqlPlayground, trace };
|
|
6452
6463
|
|
|
6453
6464
|
//# sourceMappingURL=index.mjs.map
|