r-agency-mesh 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/release/index.d.ts +6 -0
- package/release/index.js +31 -19
package/package.json
CHANGED
package/release/index.d.ts
CHANGED
package/release/index.js
CHANGED
|
@@ -12804,20 +12804,20 @@ var init_graph_ql_server = __esm({
|
|
|
12804
12804
|
if (!action) {
|
|
12805
12805
|
return resolve2(new (0, _error2.GraphQLError)("runtime action not exists!"));
|
|
12806
12806
|
}
|
|
12807
|
-
this.ordered(context);
|
|
12807
|
+
await this.ordered(context, info2);
|
|
12808
12808
|
const config = this.container.service("mesh-config");
|
|
12809
12809
|
const request = parseActionRequest(context.req, "graphql");
|
|
12810
12810
|
const authResult = await this.container.service("mesh-auth-provider").check(action, request, context);
|
|
12811
12811
|
if (authResult.errors) {
|
|
12812
12812
|
context.errors = authResult.errors;
|
|
12813
|
-
this.aborted(context);
|
|
12813
|
+
await this.aborted(context, info2);
|
|
12814
12814
|
return resolve2({});
|
|
12815
12815
|
}
|
|
12816
12816
|
if (action.cache.active) {
|
|
12817
12817
|
const cacheData = this.container.service("graphql-cache").get(info2.fieldName);
|
|
12818
12818
|
if (cacheData) {
|
|
12819
12819
|
context.cache = true;
|
|
12820
|
-
this.completed(context);
|
|
12820
|
+
await this.completed(context, info2);
|
|
12821
12821
|
return resolve2(cacheData);
|
|
12822
12822
|
}
|
|
12823
12823
|
}
|
|
@@ -12836,7 +12836,7 @@ var init_graph_ql_server = __esm({
|
|
|
12836
12836
|
const result = await schema.validate(action.schema, request);
|
|
12837
12837
|
if (result.errors.length !== 0) {
|
|
12838
12838
|
context.errors = result.errors;
|
|
12839
|
-
this.aborted(context);
|
|
12839
|
+
await this.aborted(context, info2);
|
|
12840
12840
|
return resolve2({});
|
|
12841
12841
|
}
|
|
12842
12842
|
}
|
|
@@ -12868,7 +12868,7 @@ var init_graph_ql_server = __esm({
|
|
|
12868
12868
|
const resultSource = await loaderSource.load();
|
|
12869
12869
|
if (resultSource.errors) {
|
|
12870
12870
|
context.errors = resultSource.errors;
|
|
12871
|
-
this.aborted(context);
|
|
12871
|
+
await this.aborted(context, info2);
|
|
12872
12872
|
return resolve2({});
|
|
12873
12873
|
}
|
|
12874
12874
|
if (resultSource.data) {
|
|
@@ -12903,7 +12903,7 @@ var init_graph_ql_server = __esm({
|
|
|
12903
12903
|
});
|
|
12904
12904
|
if (resultTarget.errors) {
|
|
12905
12905
|
context.errors = resultTarget.errors;
|
|
12906
|
-
this.aborted(context);
|
|
12906
|
+
await this.aborted(context, info2);
|
|
12907
12907
|
return resolve2({});
|
|
12908
12908
|
}
|
|
12909
12909
|
if (resultTarget.data && response) {
|
|
@@ -12915,16 +12915,20 @@ var init_graph_ql_server = __esm({
|
|
|
12915
12915
|
ttl: _nullishCoalesce(action.cache.ttl, () => ( 1e3))
|
|
12916
12916
|
});
|
|
12917
12917
|
}
|
|
12918
|
-
this.completed(context);
|
|
12918
|
+
await this.completed(context, info2);
|
|
12919
12919
|
resolve2(aware.getMainData());
|
|
12920
12920
|
}
|
|
12921
12921
|
/**
|
|
12922
|
-
* Emits an event
|
|
12922
|
+
* Emits an event indicating that a GraphQL request has been ordered.
|
|
12923
12923
|
*
|
|
12924
|
-
* @param {IGraphQlContext} context - The GraphQL context containing
|
|
12925
|
-
* @
|
|
12924
|
+
* @param {IGraphQlContext} context - The GraphQL execution context containing client and order ID information.
|
|
12925
|
+
* @param {IGraphQlRequestInfo} info - The GraphQL request information.
|
|
12926
|
+
* @return {Promise<void>} A promise that resolves when the operation is complete.
|
|
12926
12927
|
*/
|
|
12927
|
-
ordered(context) {
|
|
12928
|
+
async ordered(context, info2) {
|
|
12929
|
+
await this.container.service("mesh-can-bus").channel("graphql").event("request_ordered", {
|
|
12930
|
+
operation: info2.operation.operation
|
|
12931
|
+
}).dispatch();
|
|
12928
12932
|
if (!context.client) {
|
|
12929
12933
|
return;
|
|
12930
12934
|
}
|
|
@@ -12933,12 +12937,16 @@ var init_graph_ql_server = __esm({
|
|
|
12933
12937
|
});
|
|
12934
12938
|
}
|
|
12935
12939
|
/**
|
|
12936
|
-
*
|
|
12940
|
+
* Handles the event of a GraphQL request being aborted. Emits an event with details regarding the aborted request.
|
|
12937
12941
|
*
|
|
12938
|
-
* @param {IGraphQlContext} context - The
|
|
12939
|
-
* @
|
|
12942
|
+
* @param {IGraphQlContext} context - The context object containing information about the GraphQL request, including the client, order ID, and any errors.
|
|
12943
|
+
* @param {IGraphQlRequestInfo} info - The request information object providing metadata about the GraphQL request.
|
|
12944
|
+
* @return {Promise<void>} A promise that completes when the aborted event is emitted.
|
|
12940
12945
|
*/
|
|
12941
|
-
aborted(context) {
|
|
12946
|
+
async aborted(context, info2) {
|
|
12947
|
+
await this.container.service("mesh-can-bus").channel("graphql").event("request_aborted", {
|
|
12948
|
+
operation: info2.operation.operation
|
|
12949
|
+
}).dispatch();
|
|
12942
12950
|
if (!context.client) {
|
|
12943
12951
|
return;
|
|
12944
12952
|
}
|
|
@@ -12948,12 +12956,16 @@ var init_graph_ql_server = __esm({
|
|
|
12948
12956
|
});
|
|
12949
12957
|
}
|
|
12950
12958
|
/**
|
|
12951
|
-
* Emits
|
|
12959
|
+
* Emits a 'mesh::graphql:request:completed' event with details of the GraphQL request if a client exists in the context.
|
|
12952
12960
|
*
|
|
12953
|
-
* @param {IGraphQlContext} context - The context
|
|
12954
|
-
* @
|
|
12961
|
+
* @param {IGraphQlContext} context - The GraphQL context containing client information, order ID, and request metadata.
|
|
12962
|
+
* @param {IGraphQlRequestInfo} info - The meta information about the GraphQL request.
|
|
12963
|
+
* @return {Promise<void>} Resolves when the event has been emitted or if the context client does not exist.
|
|
12955
12964
|
*/
|
|
12956
|
-
completed(context) {
|
|
12965
|
+
async completed(context, info2) {
|
|
12966
|
+
await this.container.service("mesh-can-bus").channel("graphql").event("request_completed", {
|
|
12967
|
+
operation: info2.operation.operation
|
|
12968
|
+
}).dispatch();
|
|
12957
12969
|
if (!context.client) {
|
|
12958
12970
|
return;
|
|
12959
12971
|
}
|