@ldsg/graphql-workflows 0.3.6
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/LICENSE +22 -0
- package/README.md +1 -0
- package/dist/constants.d.ts +17 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +30 -0
- package/dist/handler.d.ts +8 -0
- package/dist/handler.d.ts.map +1 -0
- package/dist/handler.js +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/instantiate-resource.d.ts +6 -0
- package/dist/instantiate-resource.d.ts.map +1 -0
- package/dist/instantiate-resource.js +13 -0
- package/dist/resource.d.ts +7 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/resource.js +57 -0
- package/dist/types/graphql-path-fragment-info.d.ts +4 -0
- package/dist/types/graphql-path-fragment-info.d.ts.map +1 -0
- package/dist/types/graphql-path-fragment-info.js +2 -0
- package/dist/types/graphql-workflow-info.ts.d.ts +7 -0
- package/dist/types/graphql-workflow-info.ts.d.ts.map +1 -0
- package/dist/types/graphql-workflow-info.ts.js +2 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +19 -0
- package/dist/types/specific-resource-settings.d.ts +4 -0
- package/dist/types/specific-resource-settings.d.ts.map +1 -0
- package/dist/types/specific-resource-settings.js +2 -0
- package/dist/utils/get-graphql-path-fragment-infos.d.ts +15 -0
- package/dist/utils/get-graphql-path-fragment-infos.d.ts.map +1 -0
- package/dist/utils/get-graphql-path-fragment-infos.js +23 -0
- package/dist/utils/get-graphql-path-info-string.d.ts +14 -0
- package/dist/utils/get-graphql-path-info-string.d.ts.map +1 -0
- package/dist/utils/get-graphql-path-info-string.js +24 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +18 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# LDSG Graphql Workflows Resource
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HandlerSpecificResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
|
|
3
|
+
import { GeneralResourceSettings } from "@ldsg/types";
|
|
4
|
+
/**
|
|
5
|
+
* Instantiate Resource Handler General Resource Settings
|
|
6
|
+
* 实例化资源处理程序普通资源配置
|
|
7
|
+
*/
|
|
8
|
+
export declare const INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS: GeneralResourceSettings;
|
|
9
|
+
/**
|
|
10
|
+
* Instantiate Resource Handler Specific Resource Settings
|
|
11
|
+
* 实例化资源处理程序特殊资源配置
|
|
12
|
+
* 框架通过此实例化此资源
|
|
13
|
+
*/
|
|
14
|
+
export declare const INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS: HandlerSpecificResourceSettings;
|
|
15
|
+
export declare const RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS: GeneralResourceSettings;
|
|
16
|
+
export declare const RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS: ResourceDefinitionSpecificResourceSettings;
|
|
17
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAIlE,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAQnE,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBACb,CAAC;AAEhD,eAAO,MAAM,8CAA8C,EAAE,0CAI1D,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = void 0;
|
|
4
|
+
const graphql_1 = require("@ldsg/graphql");
|
|
5
|
+
/**
|
|
6
|
+
* Instantiate Resource Handler General Resource Settings
|
|
7
|
+
* 实例化资源处理程序普通资源配置
|
|
8
|
+
*/
|
|
9
|
+
exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = {
|
|
10
|
+
title: "GraphQL工作流组实例化资源处理程序",
|
|
11
|
+
description: "",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Instantiate Resource Handler Specific Resource Settings
|
|
15
|
+
* 实例化资源处理程序特殊资源配置
|
|
16
|
+
* 框架通过此实例化此资源
|
|
17
|
+
*/
|
|
18
|
+
exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
|
|
19
|
+
code: `export * from "@ldsg/graphql-workflows";`,
|
|
20
|
+
dependencies: [
|
|
21
|
+
{
|
|
22
|
+
name: "@ldsg/graphql-workflows",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = { title: "GraphQL工作流组资源定义", description: "" };
|
|
27
|
+
exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
|
|
28
|
+
kind: "graphql-workflows",
|
|
29
|
+
parentKind: graphql_1.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS.kind,
|
|
30
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
|
|
3
|
+
import { GraphqlWorkflowsResource } from "./resource";
|
|
4
|
+
import { GraphqlWorkflowsSpecificResourceSettings } from "./types";
|
|
5
|
+
export declare const handler: Handler<[
|
|
6
|
+
InstantiateResourceParams<HandlerExtendedResourceSettings<GraphqlWorkflowsSpecificResourceSettings>>
|
|
7
|
+
], InstantiateResourceRes<GraphqlWorkflowsResource>>;
|
|
8
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC;AAEnE,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IACE,yBAAyB,CACvB,+BAA+B,CAAC,wCAAwC,CAAC,CAC1E;CACF,EACD,sBAAsB,CAAC,wBAAwB,CAAC,CAC3B,CAAC"}
|
package/dist/handler.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./handler"), exports);
|
|
19
|
+
__exportStar(require("./instantiate-resource"), exports);
|
|
20
|
+
__exportStar(require("./resource"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResource } from "@ldsg/resource";
|
|
3
|
+
import { GraphqlWorkflowsResource } from "./resource";
|
|
4
|
+
import { GraphqlWorkflowsSpecificResourceSettings } from "./types";
|
|
5
|
+
export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<GraphqlWorkflowsSpecificResourceSettings>, GraphqlWorkflowsResource>;
|
|
6
|
+
//# sourceMappingURL=instantiate-resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instantiate-resource.d.ts","sourceRoot":"","sources":["../src/instantiate-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,wCAAwC,EAAE,MAAM,SAAS,CAAC;AAEnE,eAAO,MAAM,mBAAmB,EAAE,mBAAmB,CACnD,+BAA+B,CAAC,wCAAwC,CAAC,EACzE,wBAAwB,CAWzB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.instantiateResource = void 0;
|
|
4
|
+
const resource_1 = require("./resource");
|
|
5
|
+
const instantiateResource = (params) => {
|
|
6
|
+
const { resourceConstructorParams } = params;
|
|
7
|
+
const resource = new resource_1.GraphqlWorkflowsResource(resourceConstructorParams);
|
|
8
|
+
const res = {
|
|
9
|
+
resource,
|
|
10
|
+
};
|
|
11
|
+
return res;
|
|
12
|
+
};
|
|
13
|
+
exports.instantiateResource = instantiateResource;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GetGraphqlMiddlewareInfo } from "@ldsg/graphql";
|
|
2
|
+
import { Resource } from "@ldsg/resource";
|
|
3
|
+
import { GraphqlWorkflowsSpecificResourceSettings } from "./types";
|
|
4
|
+
export declare class GraphqlWorkflowsResource extends Resource<GraphqlWorkflowsSpecificResourceSettings> {
|
|
5
|
+
getGraphqlMiddlewareInfo: GetGraphqlMiddlewareInfo;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAyB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,OAAO,EAEL,wCAAwC,EACzC,MAAM,SAAS,CAAC;AAGjB,qBAAa,wBAAyB,SAAQ,QAAQ,CAAC,wCAAwC,CAAC;IAC9F,wBAAwB,EAAE,wBAAwB,CAoEhD;CACH"}
|
package/dist/resource.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphqlWorkflowsResource = void 0;
|
|
4
|
+
const resource_1 = require("@ldsg/resource");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
class GraphqlWorkflowsResource extends resource_1.Resource {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.getGraphqlMiddlewareInfo = () => {
|
|
10
|
+
const { id, getFilteredResources } = this;
|
|
11
|
+
const { resources } = getFilteredResources({
|
|
12
|
+
parentId: id,
|
|
13
|
+
});
|
|
14
|
+
const graphqlPathInfoStringToWorkflowInfoMap = {};
|
|
15
|
+
resources.forEach((resource) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const graphqlWorkflowInfo = (_a = resource.getGraphqlWorkflowInfo) === null || _a === void 0 ? void 0 : _a.call(resource);
|
|
18
|
+
if (graphqlWorkflowInfo) {
|
|
19
|
+
const { graphqlPathInfoString, workflowInfo } = graphqlWorkflowInfo;
|
|
20
|
+
graphqlPathInfoStringToWorkflowInfoMap[graphqlPathInfoString] =
|
|
21
|
+
workflowInfo;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const workflowMiddleware = async (resolve, source, args, context, info) => {
|
|
25
|
+
const { path } = info;
|
|
26
|
+
const { graphqlPathInfoString } = (0, utils_1.getGraphqlPathInfoString)({
|
|
27
|
+
path,
|
|
28
|
+
});
|
|
29
|
+
let res;
|
|
30
|
+
if (graphqlPathInfoString in graphqlPathInfoStringToWorkflowInfoMap) {
|
|
31
|
+
const workflowInfo = graphqlPathInfoStringToWorkflowInfoMap[graphqlPathInfoString];
|
|
32
|
+
const variables = {
|
|
33
|
+
resolve,
|
|
34
|
+
source,
|
|
35
|
+
args,
|
|
36
|
+
context,
|
|
37
|
+
info,
|
|
38
|
+
};
|
|
39
|
+
const executeRes = await workflowInfo.execute({
|
|
40
|
+
variables,
|
|
41
|
+
});
|
|
42
|
+
res = executeRes.variables;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
res = await resolve(source, args, context, info);
|
|
46
|
+
}
|
|
47
|
+
return res;
|
|
48
|
+
};
|
|
49
|
+
const res = {
|
|
50
|
+
sort: 0,
|
|
51
|
+
middleware: workflowMiddleware,
|
|
52
|
+
};
|
|
53
|
+
return res;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.GraphqlWorkflowsResource = GraphqlWorkflowsResource;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-path-fragment-info.d.ts","sourceRoot":"","sources":["../../src/types/graphql-path-fragment-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,kBAAkB,CAAC,MAAM,CAAC,EAC1B,KAAK,GAAG,UAAU,CACnB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WorkflowInfo } from "@ldsg/workflow";
|
|
2
|
+
export interface GraphqlWorkflowInfo {
|
|
3
|
+
graphqlPathInfoString: string;
|
|
4
|
+
workflowInfo: WorkflowInfo;
|
|
5
|
+
}
|
|
6
|
+
export type GetGraphqlWorkflowInfo = () => GraphqlWorkflowInfo;
|
|
7
|
+
//# sourceMappingURL=graphql-workflow-info.ts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-workflow-info.ts.d.ts","sourceRoot":"","sources":["../../src/types/graphql-workflow-info.ts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAClC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,MAAM,sBAAsB,GAAG,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./graphql-path-fragment-info"), exports);
|
|
18
|
+
__exportStar(require("./graphql-workflow-info.ts"), exports);
|
|
19
|
+
__exportStar(require("./specific-resource-settings"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,wCACf,SAAQ,wBAAwB;CAAG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GraphQLResolveInfo } from "graphql";
|
|
2
|
+
import { GraphqlPathFragmentInfos } from "../types";
|
|
3
|
+
interface GetGraphqlPathFragmentInfosParmas {
|
|
4
|
+
path: GraphQLResolveInfo["path"];
|
|
5
|
+
}
|
|
6
|
+
interface GetGraphqlPathFragmentInfosRes {
|
|
7
|
+
graphqlPathFragmentInfos: GraphqlPathFragmentInfos;
|
|
8
|
+
}
|
|
9
|
+
export type GetGraphqlPathFragmentInfos = (params: GetGraphqlPathFragmentInfosParmas) => GetGraphqlPathFragmentInfosRes;
|
|
10
|
+
/**
|
|
11
|
+
* 获取路径片段信息组
|
|
12
|
+
*/
|
|
13
|
+
export declare const getGraphqlPathFragmentInfos: GetGraphqlPathFragmentInfos;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=get-graphql-path-fragment-infos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-graphql-path-fragment-infos.d.ts","sourceRoot":"","sources":["../../src/utils/get-graphql-path-fragment-infos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,UAAU,iCAAiC;IACzC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,UAAU,8BAA8B;IACtC,wBAAwB,EAAE,wBAAwB,CAAC;CACpD;AAED,MAAM,MAAM,2BAA2B,GAAG,CACxC,MAAM,EAAE,iCAAiC,KACtC,8BAA8B,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,2BAA2B,EAAE,2BAuBzC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGraphqlPathFragmentInfos = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* 获取路径片段信息组
|
|
6
|
+
*/
|
|
7
|
+
const getGraphqlPathFragmentInfos = (params) => {
|
|
8
|
+
const { path } = params;
|
|
9
|
+
const graphqlPathFragmentInfos = [];
|
|
10
|
+
let current = path;
|
|
11
|
+
while (current) {
|
|
12
|
+
graphqlPathFragmentInfos.unshift({
|
|
13
|
+
key: current.key,
|
|
14
|
+
typename: current.typename,
|
|
15
|
+
});
|
|
16
|
+
current = current.prev;
|
|
17
|
+
}
|
|
18
|
+
const res = {
|
|
19
|
+
graphqlPathFragmentInfos,
|
|
20
|
+
};
|
|
21
|
+
return res;
|
|
22
|
+
};
|
|
23
|
+
exports.getGraphqlPathFragmentInfos = getGraphqlPathFragmentInfos;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GraphQLResolveInfo } from "graphql";
|
|
2
|
+
interface GetGraphqlPathInfoStringParmas {
|
|
3
|
+
path: GraphQLResolveInfo["path"];
|
|
4
|
+
}
|
|
5
|
+
interface GetGraphqlPathInfoStringRes {
|
|
6
|
+
graphqlPathInfoString: string;
|
|
7
|
+
}
|
|
8
|
+
export type GetGraphqlPathInfoString = (params: GetGraphqlPathInfoStringParmas) => GetGraphqlPathInfoStringRes;
|
|
9
|
+
/**
|
|
10
|
+
* 获取路径信息字符串
|
|
11
|
+
*/
|
|
12
|
+
export declare const getGraphqlPathInfoString: GetGraphqlPathInfoString;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=get-graphql-path-info-string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-graphql-path-info-string.d.ts","sourceRoot":"","sources":["../../src/utils/get-graphql-path-info-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,UAAU,8BAA8B;IACtC,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,UAAU,2BAA2B;IACnC,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,MAAM,EAAE,8BAA8B,KACnC,2BAA2B,CAAC;AAEjC;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,wBAoBtC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGraphqlPathInfoString = void 0;
|
|
4
|
+
const get_graphql_path_fragment_infos_1 = require("./get-graphql-path-fragment-infos");
|
|
5
|
+
/**
|
|
6
|
+
* 获取路径信息字符串
|
|
7
|
+
*/
|
|
8
|
+
const getGraphqlPathInfoString = (params) => {
|
|
9
|
+
const { path } = params;
|
|
10
|
+
const { graphqlPathFragmentInfos } = (0, get_graphql_path_fragment_infos_1.getGraphqlPathFragmentInfos)({
|
|
11
|
+
path,
|
|
12
|
+
});
|
|
13
|
+
const graphqlPathInfoString = graphqlPathFragmentInfos
|
|
14
|
+
.map((graphqlPathFragmentInfo) => {
|
|
15
|
+
const { key, typename } = graphqlPathFragmentInfo;
|
|
16
|
+
return `${typename}:${key}`;
|
|
17
|
+
})
|
|
18
|
+
.join(".");
|
|
19
|
+
const res = {
|
|
20
|
+
graphqlPathInfoString,
|
|
21
|
+
};
|
|
22
|
+
return res;
|
|
23
|
+
};
|
|
24
|
+
exports.getGraphqlPathInfoString = getGraphqlPathInfoString;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-graphql-path-fragment-infos"), exports);
|
|
18
|
+
__exportStar(require("./get-graphql-path-info-string"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ldsg/graphql-workflows",
|
|
3
|
+
"version": "0.3.6",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/"
|
|
8
|
+
],
|
|
9
|
+
"types": "dist",
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "wanxger",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"graphql-compose": "^9.1.0",
|
|
18
|
+
"graphql-yoga": "^5.13.4",
|
|
19
|
+
"@ldsg/resource": "0.3.6",
|
|
20
|
+
"@ldsg/resource-definition": "0.3.6",
|
|
21
|
+
"@ldsg/handler": "0.3.6"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/supertest": "^6.0.0",
|
|
25
|
+
"graphql": "16.11.0",
|
|
26
|
+
"supertest": "^6.3.4",
|
|
27
|
+
"@ldsg/application": "0.3.6",
|
|
28
|
+
"@ldsg/graphql": "0.3.6",
|
|
29
|
+
"@ldsg/types": "0.3.6"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc --project tsconfig.build.json",
|
|
33
|
+
"clean": "rm -rf dist"
|
|
34
|
+
}
|
|
35
|
+
}
|