r-agency-mesh 1.2.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 +7 -1
- package/release/index.js +31 -19
package/package.json
CHANGED
package/release/index.d.ts
CHANGED
|
@@ -2155,6 +2155,12 @@ interface IMeshCoreCANBusEvents {
|
|
|
2155
2155
|
request_ordered: {
|
|
2156
2156
|
operation: string;
|
|
2157
2157
|
};
|
|
2158
|
+
request_aborted: {
|
|
2159
|
+
operation: string;
|
|
2160
|
+
};
|
|
2161
|
+
request_completed: {
|
|
2162
|
+
operation: string;
|
|
2163
|
+
};
|
|
2158
2164
|
};
|
|
2159
2165
|
}
|
|
2160
2166
|
|
|
@@ -2428,4 +2434,4 @@ declare function RegisterBootLoader(options: IBootLoaderOptions): any;
|
|
|
2428
2434
|
*/
|
|
2429
2435
|
declare const startServer: (props: NsBootstrap.IStartServerProps) => void;
|
|
2430
2436
|
|
|
2431
|
-
export { AbstractService, type AfterCompileNextFn, BaseOrmEntity, type BootstrapEvents, type GraphqlUploadFile, type IAbstractService, type IActionBootArgs, type IBootLoader, type IBootLoaderBootArgs, type IBootLoaderBuildArgs, type IBootLoaderOptions, type IBroadcastManager, type ICANBusChannel, type ICANBusEvent, type ICANBusEventArgs, type ICANBusEventOptions, type ICANBusEventResult, type ICANBusEventRunner, type ICANBusEventV2, type IContainer, type IDatabaseAdapter, type IEnvironment, type IExecutableAction, type IExecutableActionProps, type IGlobals, type IGraphQlSchemaBuilder, type IGraphQlSchemaBuilderInternal, type IGraphqlFileUpload, type IGraphqlUploadArgs, type ILogger, type IMeshCANBus, type IMeshConfig, type IMeshCoreCANBusEvents, type IMeshCoreServices, type IMeshCronJob, type IMeshCronJobArgs, type IMeshCronJobExecuteResult, type IMeshCronJobOptions, type IMeshCronJobRunnerResult, type IMeshCronManager, type IMeshError, type IMeshImageOptOptions, type IMeshImageOptRequestQueries, type IMeshImageOptResult, type IMeshPlugin, type IMeshSoredCronJobRunner, type IMeshStoredCronJob, type IMeshUploadProgressInfo, type IMeshUploadProgressOptions, type IMeshUploadService, type IPagination, type IRuntimeActionAuth, type IStaticLoader, type IUploadFileResource, type IUploadedFile, type IUploadedFileMeta, type IWebsocketCommander, type IWebsocketInternalEvents, type InitFnResult, Inject, InjectService, type MainFnArgs, type MainFnResult, type MeshContainerServices, type MeshCronJobs, type MeshRouter, NsCore, NsRuntime, NsServer, type PluginBeforeStartFn, type PluginBuildGraphqlSchemaFn, type PluginBuildRouterFn, type PluginInitFn, type PluginNextFn, type PluginWsClientConnectedFn, RegisterBootLoader, RegisterCronJob, type RuntimeActionHeaders, type UploadFileResourceType, type UploadServiceFileUploadedFn, cloneDeepObject, createDataListing, distDir, findFiles, genDir, getGlobal, lcfirst, ltrim, mergeDeepObject, parsePagination, publicDir, rootDir, rtrim, startServer, staticDir, stringHasOnlySpaces, stringIsEmpty, trim, ucfirst };
|
|
2437
|
+
export { AbstractService, type AfterCompileNextFn, BaseOrmEntity, type BootLoaderNextFn, type BootstrapEvents, type GraphqlUploadFile, type IAbstractService, type IActionBootArgs, type IBootLoader, type IBootLoaderBootArgs, type IBootLoaderBuildArgs, type IBootLoaderOptions, type IBroadcastManager, type ICANBusChannel, type ICANBusEvent, type ICANBusEventArgs, type ICANBusEventOptions, type ICANBusEventResult, type ICANBusEventRunner, type ICANBusEventV2, type IContainer, type IDatabaseAdapter, type IEnvironment, type IExecutableAction, type IExecutableActionProps, type IGlobals, type IGraphQlSchemaBuilder, type IGraphQlSchemaBuilderInternal, type IGraphqlFileUpload, type IGraphqlUploadArgs, type ILogger, type IMeshCANBus, type IMeshConfig, type IMeshCoreCANBusEvents, type IMeshCoreServices, type IMeshCronJob, type IMeshCronJobArgs, type IMeshCronJobExecuteResult, type IMeshCronJobOptions, type IMeshCronJobRunnerResult, type IMeshCronManager, type IMeshError, type IMeshImageOptOptions, type IMeshImageOptRequestQueries, type IMeshImageOptResult, type IMeshPlugin, type IMeshSoredCronJobRunner, type IMeshStoredCronJob, type IMeshUploadProgressInfo, type IMeshUploadProgressOptions, type IMeshUploadService, type IPagination, type IRuntimeActionAuth, type IStaticLoader, type IUploadFileResource, type IUploadedFile, type IUploadedFileMeta, type IWebsocketCommander, type IWebsocketInternalEvents, type InitFnResult, Inject, InjectService, type MainFnArgs, type MainFnResult, type MeshContainerServices, type MeshCronJobs, type MeshRouter, NsCore, NsRuntime, NsServer, type PluginBeforeStartFn, type PluginBuildGraphqlSchemaFn, type PluginBuildRouterFn, type PluginInitFn, type PluginNextFn, type PluginWsClientConnectedFn, RegisterBootLoader, RegisterCronJob, type RuntimeActionHeaders, type UploadFileResourceType, type UploadServiceFileUploadedFn, cloneDeepObject, createDataListing, distDir, findFiles, genDir, getGlobal, lcfirst, ltrim, mergeDeepObject, parsePagination, publicDir, rootDir, rtrim, startServer, staticDir, stringHasOnlySpaces, stringIsEmpty, trim, ucfirst };
|
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
|
}
|