@restorecommerce/facade 1.3.5 → 1.3.7
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/.eslintrc.cjs +1 -11
- package/CHANGELOG.md +20 -0
- package/codegen/tsconfig.codegen.tsbuildinfo +1 -0
- package/debug-run.ts +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +5 -4
- package/tsconfig-base.json +8 -19
- package/tsconfig.codegen.json +0 -1
- package/tsconfig.debug.json +1 -5
- package/tsconfig.generate.json +0 -3
- package/tsconfig.lib.json +1 -2
- package/tsconfig.test.json +1 -22
- package/codegen/index.d.ts +0 -12
- package/codegen/index.js +0 -43
- package/dist/gql/index.d.ts +0 -1
- package/dist/gql/index.js +0 -1
- package/dist/gql/protos/federation.d.ts +0 -6
- package/dist/gql/protos/federation.js +0 -46
- package/dist/gql/protos/graphql.d.ts +0 -11
- package/dist/gql/protos/graphql.js +0 -158
- package/dist/gql/protos/index.d.ts +0 -6
- package/dist/gql/protos/index.js +0 -6
- package/dist/gql/protos/registry.d.ts +0 -23
- package/dist/gql/protos/registry.js +0 -366
- package/dist/gql/protos/resolvers.d.ts +0 -9
- package/dist/gql/protos/resolvers.js +0 -479
- package/dist/gql/protos/schema.d.ts +0 -14
- package/dist/gql/protos/schema.js +0 -224
- package/dist/gql/protos/stream-to-async-iterator.d.ts +0 -50
- package/dist/gql/protos/stream-to-async-iterator.js +0 -190
- package/dist/gql/protos/types.d.ts +0 -96
- package/dist/gql/protos/types.js +0 -1
- package/dist/gql/protos/utils.d.ts +0 -18
- package/dist/gql/protos/utils.js +0 -133
- package/dist/gql/types/AccessControlTypes.d.ts +0 -6
- package/dist/gql/types/AccessControlTypes.js +0 -97
- package/dist/gql/types/DateType.d.ts +0 -2
- package/dist/gql/types/DateType.js +0 -29
- package/dist/gql/types/FilterType.d.ts +0 -2
- package/dist/gql/types/FilterType.js +0 -72
- package/dist/gql/types/MetaType.d.ts +0 -2
- package/dist/gql/types/MetaType.js +0 -25
- package/dist/gql/types/ScopeType.d.ts +0 -2
- package/dist/gql/types/ScopeType.js +0 -13
- package/dist/gql/types/SortType.d.ts +0 -3
- package/dist/gql/types/SortType.js +0 -30
- package/dist/gql/types/StatusType.d.ts +0 -2
- package/dist/gql/types/StatusType.js +0 -15
- package/dist/gql/types/index.d.ts +0 -7
- package/dist/gql/types/index.js +0 -7
- package/dist/index.d.ts +0 -63
- package/dist/index.js +0 -307
- package/dist/interfaces.d.ts +0 -47
- package/dist/interfaces.js +0 -4
- package/dist/middlewares/index.d.ts +0 -1
- package/dist/middlewares/index.js +0 -1
- package/dist/middlewares/req-res-logger/index.d.ts +0 -14
- package/dist/middlewares/req-res-logger/index.js +0 -90
- package/dist/modules/access-control/gql/federation.d.ts +0 -2
- package/dist/modules/access-control/gql/federation.js +0 -13
- package/dist/modules/access-control/gql/schema.d.ts +0 -2
- package/dist/modules/access-control/gql/schema.generated.d.ts +0 -1124
- package/dist/modules/access-control/gql/schema.generated.js +0 -80
- package/dist/modules/access-control/gql/schema.js +0 -5
- package/dist/modules/access-control/gql/types.d.ts +0 -3
- package/dist/modules/access-control/gql/types.js +0 -14
- package/dist/modules/access-control/grpc/index.d.ts +0 -13
- package/dist/modules/access-control/grpc/index.js +0 -14
- package/dist/modules/access-control/index.d.ts +0 -2
- package/dist/modules/access-control/index.js +0 -26
- package/dist/modules/access-control/interfaces.d.ts +0 -15
- package/dist/modules/access-control/interfaces.js +0 -1
- package/dist/modules/catalog/gql/federation.d.ts +0 -2
- package/dist/modules/catalog/gql/federation.js +0 -13
- package/dist/modules/catalog/gql/schema.d.ts +0 -2
- package/dist/modules/catalog/gql/schema.generated.d.ts +0 -1503
- package/dist/modules/catalog/gql/schema.generated.js +0 -74
- package/dist/modules/catalog/gql/schema.js +0 -5
- package/dist/modules/catalog/gql/types.d.ts +0 -3
- package/dist/modules/catalog/gql/types.js +0 -16
- package/dist/modules/catalog/grpc/index.d.ts +0 -15
- package/dist/modules/catalog/grpc/index.js +0 -16
- package/dist/modules/catalog/index.d.ts +0 -2
- package/dist/modules/catalog/index.js +0 -26
- package/dist/modules/catalog/interfaces.d.ts +0 -16
- package/dist/modules/catalog/interfaces.js +0 -1
- package/dist/modules/facade-status/gql/index.d.ts +0 -1
- package/dist/modules/facade-status/gql/index.js +0 -11
- package/dist/modules/facade-status/gql/resolvers.d.ts +0 -2
- package/dist/modules/facade-status/gql/resolvers.js +0 -18
- package/dist/modules/facade-status/gql/schema.d.ts +0 -3
- package/dist/modules/facade-status/gql/schema.generated.d.ts +0 -109
- package/dist/modules/facade-status/gql/schema.generated.js +0 -1
- package/dist/modules/facade-status/gql/schema.js +0 -14
- package/dist/modules/facade-status/gql/types.d.ts +0 -2
- package/dist/modules/facade-status/gql/types.js +0 -10
- package/dist/modules/facade-status/index.d.ts +0 -2
- package/dist/modules/facade-status/index.js +0 -8
- package/dist/modules/facade-status/interfaces.d.ts +0 -4
- package/dist/modules/facade-status/interfaces.js +0 -1
- package/dist/modules/fulfillment/gql/federation.d.ts +0 -2
- package/dist/modules/fulfillment/gql/federation.js +0 -13
- package/dist/modules/fulfillment/gql/schema.d.ts +0 -2
- package/dist/modules/fulfillment/gql/schema.generated.d.ts +0 -1539
- package/dist/modules/fulfillment/gql/schema.generated.js +0 -79
- package/dist/modules/fulfillment/gql/schema.js +0 -5
- package/dist/modules/fulfillment/gql/types.d.ts +0 -3
- package/dist/modules/fulfillment/gql/types.js +0 -12
- package/dist/modules/fulfillment/grpc/index.d.ts +0 -9
- package/dist/modules/fulfillment/grpc/index.js +0 -10
- package/dist/modules/fulfillment/index.d.ts +0 -2
- package/dist/modules/fulfillment/index.js +0 -26
- package/dist/modules/fulfillment/interfaces.d.ts +0 -16
- package/dist/modules/fulfillment/interfaces.js +0 -1
- package/dist/modules/identity/api-key/api-key.d.ts +0 -11
- package/dist/modules/identity/api-key/api-key.js +0 -137
- package/dist/modules/identity/gql/federation.d.ts +0 -2
- package/dist/modules/identity/gql/federation.js +0 -5
- package/dist/modules/identity/gql/schema.d.ts +0 -2
- package/dist/modules/identity/gql/schema.generated.d.ts +0 -1661
- package/dist/modules/identity/gql/schema.generated.js +0 -75
- package/dist/modules/identity/gql/schema.js +0 -5
- package/dist/modules/identity/gql/types.d.ts +0 -3
- package/dist/modules/identity/gql/types.js +0 -18
- package/dist/modules/identity/grpc/index.d.ts +0 -15
- package/dist/modules/identity/grpc/index.js +0 -16
- package/dist/modules/identity/index.d.ts +0 -4
- package/dist/modules/identity/index.js +0 -54
- package/dist/modules/identity/interfaces.d.ts +0 -22
- package/dist/modules/identity/interfaces.js +0 -1
- package/dist/modules/identity/oauth/oauth.d.ts +0 -11
- package/dist/modules/identity/oauth/oauth.js +0 -170
- package/dist/modules/identity/oidc/adapter.d.ts +0 -4
- package/dist/modules/identity/oidc/adapter.js +0 -135
- package/dist/modules/identity/oidc/in-memory-adapter.d.ts +0 -16
- package/dist/modules/identity/oidc/in-memory-adapter.js +0 -85
- package/dist/modules/identity/oidc/index.d.ts +0 -18
- package/dist/modules/identity/oidc/index.js +0 -147
- package/dist/modules/identity/oidc/interfaces.d.ts +0 -73
- package/dist/modules/identity/oidc/interfaces.js +0 -7
- package/dist/modules/identity/oidc/password-grant.d.ts +0 -2
- package/dist/modules/identity/oidc/password-grant.js +0 -163
- package/dist/modules/identity/oidc/router.d.ts +0 -13
- package/dist/modules/identity/oidc/router.js +0 -164
- package/dist/modules/identity/oidc/templates.d.ts +0 -36
- package/dist/modules/identity/oidc/templates.js +0 -60
- package/dist/modules/identity/oidc/user.d.ts +0 -6
- package/dist/modules/identity/oidc/user.js +0 -91
- package/dist/modules/identity/oidc/utils.d.ts +0 -6
- package/dist/modules/identity/oidc/utils.js +0 -15
- package/dist/modules/index.d.ts +0 -13
- package/dist/modules/index.js +0 -13
- package/dist/modules/indexing/gql/federation.d.ts +0 -2
- package/dist/modules/indexing/gql/federation.js +0 -13
- package/dist/modules/indexing/gql/schema.d.ts +0 -2
- package/dist/modules/indexing/gql/schema.generated.d.ts +0 -226
- package/dist/modules/indexing/gql/schema.generated.js +0 -6
- package/dist/modules/indexing/gql/schema.js +0 -5
- package/dist/modules/indexing/gql/types.d.ts +0 -3
- package/dist/modules/indexing/gql/types.js +0 -8
- package/dist/modules/indexing/grpc/index.d.ts +0 -7
- package/dist/modules/indexing/grpc/index.js +0 -8
- package/dist/modules/indexing/index.d.ts +0 -2
- package/dist/modules/indexing/index.js +0 -26
- package/dist/modules/indexing/interfaces.d.ts +0 -13
- package/dist/modules/indexing/interfaces.js +0 -1
- package/dist/modules/invoicing/gql/federation.d.ts +0 -2
- package/dist/modules/invoicing/gql/federation.js +0 -13
- package/dist/modules/invoicing/gql/schema.d.ts +0 -2
- package/dist/modules/invoicing/gql/schema.generated.d.ts +0 -1150
- package/dist/modules/invoicing/gql/schema.generated.js +0 -75
- package/dist/modules/invoicing/gql/schema.js +0 -5
- package/dist/modules/invoicing/gql/types.d.ts +0 -3
- package/dist/modules/invoicing/gql/types.js +0 -8
- package/dist/modules/invoicing/grpc/index.d.ts +0 -7
- package/dist/modules/invoicing/grpc/index.js +0 -8
- package/dist/modules/invoicing/index.d.ts +0 -2
- package/dist/modules/invoicing/index.js +0 -26
- package/dist/modules/invoicing/interfaces.d.ts +0 -16
- package/dist/modules/invoicing/interfaces.js +0 -1
- package/dist/modules/master_data/gql/federation.d.ts +0 -2
- package/dist/modules/master_data/gql/federation.js +0 -13
- package/dist/modules/master_data/gql/schema.d.ts +0 -2
- package/dist/modules/master_data/gql/schema.generated.d.ts +0 -2520
- package/dist/modules/master_data/gql/schema.generated.js +0 -114
- package/dist/modules/master_data/gql/schema.js +0 -5
- package/dist/modules/master_data/gql/types.d.ts +0 -3
- package/dist/modules/master_data/gql/types.js +0 -32
- package/dist/modules/master_data/grpc/index.d.ts +0 -30
- package/dist/modules/master_data/grpc/index.js +0 -32
- package/dist/modules/master_data/index.d.ts +0 -2
- package/dist/modules/master_data/index.js +0 -26
- package/dist/modules/master_data/interfaces.d.ts +0 -16
- package/dist/modules/master_data/interfaces.js +0 -1
- package/dist/modules/notification/gql/federation.d.ts +0 -2
- package/dist/modules/notification/gql/federation.js +0 -13
- package/dist/modules/notification/gql/schema.d.ts +0 -2
- package/dist/modules/notification/gql/schema.generated.d.ts +0 -632
- package/dist/modules/notification/gql/schema.generated.js +0 -68
- package/dist/modules/notification/gql/schema.js +0 -5
- package/dist/modules/notification/gql/types.d.ts +0 -3
- package/dist/modules/notification/gql/types.js +0 -8
- package/dist/modules/notification/grpc/index.d.ts +0 -7
- package/dist/modules/notification/grpc/index.js +0 -8
- package/dist/modules/notification/index.d.ts +0 -2
- package/dist/modules/notification/index.js +0 -26
- package/dist/modules/notification/interfaces.d.ts +0 -16
- package/dist/modules/notification/interfaces.js +0 -1
- package/dist/modules/ordering/gql/federation.d.ts +0 -2
- package/dist/modules/ordering/gql/federation.js +0 -13
- package/dist/modules/ordering/gql/schema.d.ts +0 -2
- package/dist/modules/ordering/gql/schema.generated.d.ts +0 -1407
- package/dist/modules/ordering/gql/schema.generated.js +0 -91
- package/dist/modules/ordering/gql/schema.js +0 -5
- package/dist/modules/ordering/gql/types.d.ts +0 -3
- package/dist/modules/ordering/gql/types.js +0 -8
- package/dist/modules/ordering/grpc/index.d.ts +0 -7
- package/dist/modules/ordering/grpc/index.js +0 -8
- package/dist/modules/ordering/index.d.ts +0 -2
- package/dist/modules/ordering/index.js +0 -26
- package/dist/modules/ordering/interfaces.d.ts +0 -16
- package/dist/modules/ordering/interfaces.js +0 -1
- package/dist/modules/ostorage/gql/federation.d.ts +0 -2
- package/dist/modules/ostorage/gql/federation.js +0 -13
- package/dist/modules/ostorage/gql/schema.d.ts +0 -2
- package/dist/modules/ostorage/gql/schema.generated.d.ts +0 -846
- package/dist/modules/ostorage/gql/schema.generated.js +0 -31
- package/dist/modules/ostorage/gql/schema.js +0 -5
- package/dist/modules/ostorage/gql/types.d.ts +0 -3
- package/dist/modules/ostorage/gql/types.js +0 -8
- package/dist/modules/ostorage/grpc/index.d.ts +0 -7
- package/dist/modules/ostorage/grpc/index.js +0 -8
- package/dist/modules/ostorage/index.d.ts +0 -2
- package/dist/modules/ostorage/index.js +0 -46
- package/dist/modules/ostorage/interfaces.d.ts +0 -16
- package/dist/modules/ostorage/interfaces.js +0 -1
- package/dist/modules/ostorage/objectDownloadReqHandler.d.ts +0 -1
- package/dist/modules/ostorage/objectDownloadReqHandler.js +0 -134
- package/dist/modules/payment/gql/federation.d.ts +0 -2
- package/dist/modules/payment/gql/federation.js +0 -13
- package/dist/modules/payment/gql/schema.d.ts +0 -2
- package/dist/modules/payment/gql/schema.generated.d.ts +0 -647
- package/dist/modules/payment/gql/schema.generated.js +0 -156
- package/dist/modules/payment/gql/schema.js +0 -5
- package/dist/modules/payment/gql/types.d.ts +0 -3
- package/dist/modules/payment/gql/types.js +0 -8
- package/dist/modules/payment/grpc/index.d.ts +0 -7
- package/dist/modules/payment/grpc/index.js +0 -8
- package/dist/modules/payment/index.d.ts +0 -2
- package/dist/modules/payment/index.js +0 -26
- package/dist/modules/payment/interfaces.d.ts +0 -16
- package/dist/modules/payment/interfaces.js +0 -1
- package/dist/modules/scheduling/gql/federation.d.ts +0 -2
- package/dist/modules/scheduling/gql/federation.js +0 -13
- package/dist/modules/scheduling/gql/schema.d.ts +0 -2
- package/dist/modules/scheduling/gql/schema.generated.d.ts +0 -626
- package/dist/modules/scheduling/gql/schema.generated.js +0 -31
- package/dist/modules/scheduling/gql/schema.js +0 -5
- package/dist/modules/scheduling/gql/types.d.ts +0 -3
- package/dist/modules/scheduling/gql/types.js +0 -8
- package/dist/modules/scheduling/grpc/index.d.ts +0 -7
- package/dist/modules/scheduling/grpc/index.js +0 -8
- package/dist/modules/scheduling/index.d.ts +0 -2
- package/dist/modules/scheduling/index.js +0 -26
- package/dist/modules/scheduling/interfaces.d.ts +0 -16
- package/dist/modules/scheduling/interfaces.js +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.js +0 -14
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@restorecommerce/facade",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.7",
|
4
4
|
"description": "Facade for Restorecommerce microservices",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"typings": "dist/index.d.ts",
|
@@ -26,9 +26,9 @@
|
|
26
26
|
"@grpc/proto-loader": "^0.7.7",
|
27
27
|
"@koa/cors": "^4.0.0",
|
28
28
|
"@restorecommerce/grpc-client": "^2.0.1",
|
29
|
-
"@restorecommerce/kafka-client": "^1.0.
|
29
|
+
"@restorecommerce/kafka-client": "^1.0.11",
|
30
30
|
"@restorecommerce/logger": "^1.2.3",
|
31
|
-
"@restorecommerce/rc-grpc-clients": "^
|
31
|
+
"@restorecommerce/rc-grpc-clients": "^4.0.0",
|
32
32
|
"@restorecommerce/service-config": "^1.0.5",
|
33
33
|
"array.prototype.flat": "^1.3.1",
|
34
34
|
"co": "^4.6.0",
|
@@ -66,6 +66,7 @@
|
|
66
66
|
"@graphql-codegen/core": "^4.0.0",
|
67
67
|
"@graphql-codegen/typescript": "^4.0.0",
|
68
68
|
"@graphql-codegen/typescript-resolvers": "^4.0.0",
|
69
|
+
"@restorecommerce/dev": "^0.0.2",
|
69
70
|
"@types/array.prototype.flat": "^1.2.1",
|
70
71
|
"@types/co": "^4.6.3",
|
71
72
|
"@types/debug": "^4.1.8",
|
@@ -136,5 +137,5 @@
|
|
136
137
|
}
|
137
138
|
}
|
138
139
|
},
|
139
|
-
"gitHead": "
|
140
|
+
"gitHead": "a6f633f4c1f61773ce6a93b9a9720cd00d3c005f"
|
140
141
|
}
|
package/tsconfig-base.json
CHANGED
@@ -1,23 +1,12 @@
|
|
1
1
|
{
|
2
|
-
"extends": "
|
2
|
+
"extends": "./node_modules/@restorecommerce/dev/tsconfig.json",
|
3
3
|
"compilerOptions": {
|
4
|
-
"
|
5
|
-
"
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
"
|
11
|
-
"declaration": true,
|
12
|
-
"strict": true,
|
13
|
-
"target": "ES6",
|
14
|
-
"module": "ESNext",
|
15
|
-
"moduleResolution": "Node16",
|
16
|
-
"skipLibCheck": true // temp work around for kafka-client typings
|
17
|
-
},
|
18
|
-
"ts-node": {
|
19
|
-
"transpileOnly": true,
|
20
|
-
"files": true,
|
21
|
-
"experimentalResolver": true
|
4
|
+
"paths": {
|
5
|
+
"@modules": ["src/modules/index"],
|
6
|
+
"@modules/*": ["src/modules/*"],
|
7
|
+
"@gql": ["src/gql/index"],
|
8
|
+
"@gql/*": ["src/gql/*"]
|
9
|
+
},
|
10
|
+
"rootDirs": ["src"]
|
22
11
|
}
|
23
12
|
}
|
package/tsconfig.codegen.json
CHANGED
package/tsconfig.debug.json
CHANGED
package/tsconfig.generate.json
CHANGED
package/tsconfig.lib.json
CHANGED
package/tsconfig.test.json
CHANGED
@@ -1,28 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"extends": "./tsconfig-base.json",
|
3
3
|
"compilerOptions": {
|
4
|
-
"
|
5
|
-
"paths": {
|
6
|
-
"@modules": ["src/modules/index"],
|
7
|
-
"@modules/*": ["src/modules/*"],
|
8
|
-
"@gql": ["src/gql/index"],
|
9
|
-
"@gql/*": ["src/gql/*"]
|
10
|
-
},
|
11
|
-
"esModuleInterop": true,
|
12
|
-
"allowJs": true,
|
13
|
-
|
14
|
-
"rootDirs": ["src"],
|
15
|
-
"outDir": "dist",
|
16
|
-
"lib": ["ES2022"],
|
17
|
-
"target": "ES2022",
|
18
|
-
"module": "ES2022",
|
19
|
-
"composite": true,
|
20
|
-
"moduleResolution": "node",
|
21
|
-
"declaration": true,
|
22
|
-
"declarationMap": true,
|
23
|
-
"incremental": true,
|
24
|
-
"types": ["jest", "node", "@types/jest"],
|
25
|
-
"sourceMap": true
|
4
|
+
"types": ["jest", "node", "@types/jest"]
|
26
5
|
},
|
27
6
|
"include": [
|
28
7
|
"./tests/**/*.ts",
|
package/codegen/index.d.ts
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
export interface GenerateSchemaTypingsArgs {
|
2
|
-
schema: any;
|
3
|
-
outputFile: string;
|
4
|
-
typescript?: {
|
5
|
-
[key: string]: any;
|
6
|
-
};
|
7
|
-
typescriptResolvers?: {
|
8
|
-
contextType?: string;
|
9
|
-
[key: string]: any;
|
10
|
-
};
|
11
|
-
}
|
12
|
-
export declare const generateSchemaTypings: ({ schema, outputFile, typescript, typescriptResolvers }: GenerateSchemaTypingsArgs) => Promise<void>;
|
package/codegen/index.js
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import * as fs from 'node:fs';
|
11
|
-
import * as typescriptPlugin from '@graphql-codegen/typescript';
|
12
|
-
import * as typescriptResolversPlugin from '@graphql-codegen/typescript-resolvers';
|
13
|
-
import { codegen } from '@graphql-codegen/core';
|
14
|
-
export const generateSchemaTypings = ({ schema, outputFile, typescript, typescriptResolvers }) => __awaiter(void 0, void 0, void 0, function* () {
|
15
|
-
try {
|
16
|
-
const codegenConfig /* typings wrong? */ = {
|
17
|
-
// used by a plugin internally, although the 'typescript' plugin currently
|
18
|
-
// returns the string output, rather than writing to a file
|
19
|
-
filename: outputFile,
|
20
|
-
schemaAst: schema,
|
21
|
-
documents: [],
|
22
|
-
plugins: [
|
23
|
-
{
|
24
|
-
typescript: Object.assign({ maybeValue: 'T | null | undefined', inputMaybeValue: 'T | null | undefined' }, (typescript !== null && typescript !== void 0 ? typescript : {})),
|
25
|
-
},
|
26
|
-
{
|
27
|
-
typescriptResolvers: Object.assign({ noSchemaStitching: true, useIndexSignature: true, federation: true }, (typescriptResolvers !== null && typescriptResolvers !== void 0 ? typescriptResolvers : {})),
|
28
|
-
},
|
29
|
-
],
|
30
|
-
pluginMap: {
|
31
|
-
typescript: typescriptPlugin,
|
32
|
-
typescriptResolvers: typescriptResolversPlugin,
|
33
|
-
},
|
34
|
-
emitLegacyCommonJSImports: false
|
35
|
-
};
|
36
|
-
const output = yield codegen(codegenConfig);
|
37
|
-
fs.writeFileSync(outputFile, output);
|
38
|
-
console.log('Schema typings generated in' + outputFile);
|
39
|
-
}
|
40
|
-
catch (ex) {
|
41
|
-
console.error(ex);
|
42
|
-
}
|
43
|
-
});
|
package/dist/gql/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './types/index.js';
|
package/dist/gql/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './types/index.js';
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { type FederatedSchemaWithResolvers, type GraphQLResolverMap, type ProtoMetadata, type ServiceClient, type SubSpaceServiceConfig } from './types.js';
|
2
|
-
import { type GraphQLSchema } from 'graphql/index.js';
|
3
|
-
import { GraphQLObjectType } from 'graphql';
|
4
|
-
import { GraphQLList } from 'graphql/type/definition.js';
|
5
|
-
export declare const buildFederatedSubscriptionSchema: <T, M extends Record<string, any>, CTX extends ServiceClient<CTX, keyof CTX, M>>(subServices: ProtoMetadata[], config: SubSpaceServiceConfig, namespace: string, schema: GraphQLSchema) => FederatedSchemaWithResolvers;
|
6
|
-
export declare const mergeSubscribeIntoSchema: (schema: GraphQLObjectType | GraphQLList<any> | null | undefined, resolvers: GraphQLResolverMap<any>[string]) => void;
|
@@ -1,46 +0,0 @@
|
|
1
|
-
import { buildSubgraphSchema } from '@apollo/federation';
|
2
|
-
import { gql } from 'graphql-tag';
|
3
|
-
import { printSchema } from 'graphql/index.js';
|
4
|
-
import { GraphQLObjectType } from 'graphql';
|
5
|
-
import { GraphQLList, GraphQLScalarType } from 'graphql/type/definition.js';
|
6
|
-
import { generateSubServiceResolvers } from './resolvers.js';
|
7
|
-
export const buildFederatedSubscriptionSchema = (subServices, config, namespace, schema) => {
|
8
|
-
const resolvers = generateSubServiceResolvers(subServices, config, namespace);
|
9
|
-
// TODO There is currently no way of building a federated schema from GraphQLSchema Object
|
10
|
-
// See https://github.com/apollographql/apollo-server/pull/4310
|
11
|
-
const federatedSchema = buildSubgraphSchema({
|
12
|
-
typeDefs: gql(printSchema(schema)),
|
13
|
-
resolvers
|
14
|
-
});
|
15
|
-
return {
|
16
|
-
federatedSchema,
|
17
|
-
resolvers
|
18
|
-
};
|
19
|
-
};
|
20
|
-
export const mergeSubscribeIntoSchema = (schema, resolvers) => {
|
21
|
-
if (!schema || !resolvers) {
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
Object.entries(resolvers).forEach(([key, val]) => {
|
25
|
-
if (schema instanceof GraphQLList) {
|
26
|
-
mergeSubscribeIntoSchema(schema.ofType, val);
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
const field = schema.getFields()[key];
|
30
|
-
if (!field) {
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
if ('resolve' in val || 'subscribe' in val) {
|
34
|
-
field.subscribe = val['subscribe'] || field.subscribe;
|
35
|
-
field.resolve = val['resolve'] || field.resolve;
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
const fieldType = field.type;
|
39
|
-
if (fieldType instanceof GraphQLScalarType) {
|
40
|
-
field.subscribe = val['subscribe'];
|
41
|
-
}
|
42
|
-
else if (fieldType instanceof GraphQLObjectType) {
|
43
|
-
mergeSubscribeIntoSchema(fieldType, val);
|
44
|
-
}
|
45
|
-
});
|
46
|
-
};
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { type GraphQLInputField, type GraphQLOutputType } from 'graphql';
|
2
|
-
import { GraphQLEnumType, GraphQLInputObjectType, type GraphQLInputType } from 'graphql/type/definition.js';
|
3
|
-
import { type ProtoMetadata, type ServiceConfig } from './types.js';
|
4
|
-
import { type ServiceDescriptorProto } from 'ts-proto-descriptors';
|
5
|
-
export declare const Mutate: string[];
|
6
|
-
export declare const preprocessGQLInput: (data: any, model: GraphQLInputObjectType | GraphQLEnumType | GraphQLInputField | GraphQLInputType) => Promise<any>;
|
7
|
-
export declare const postProcessGQLValue: (data: any, model: GraphQLOutputType) => any;
|
8
|
-
export declare const getWhitelistBlacklistConfig: (metaService: ServiceDescriptorProto, config: ServiceConfig, meta: ProtoMetadata, entity: string) => {
|
9
|
-
queries: Set<string>;
|
10
|
-
mutations: Set<string>;
|
11
|
-
};
|
@@ -1,158 +0,0 @@
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
|
-
});
|
9
|
-
};
|
10
|
-
import { GraphQLList, GraphQLNonNull, GraphQLObjectType, } from 'graphql';
|
11
|
-
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLScalarType, } from 'graphql/type/definition.js';
|
12
|
-
export const Mutate = ['Create', 'Update', 'Upsert'];
|
13
|
-
export const preprocessGQLInput = (data, model) => __awaiter(void 0, void 0, void 0, function* () {
|
14
|
-
if (model instanceof GraphQLEnumType) {
|
15
|
-
return data;
|
16
|
-
}
|
17
|
-
if (model instanceof GraphQLInputObjectType) {
|
18
|
-
if (model.name === 'IGoogleProtobufAny') {
|
19
|
-
// TODO Use encoded once resource base supports it
|
20
|
-
// const typing = getTyping(data.typeUrl);
|
21
|
-
// if (!typing) {
|
22
|
-
// throw Error(`GoogleProtobufAny could not find input type: ${data.typeUrl}`);
|
23
|
-
// }
|
24
|
-
//
|
25
|
-
// const encoded = typing.processor.encode(typing.processor.fromPartial(data.value)).finish();
|
26
|
-
const encoded = Buffer.from(JSON.stringify(data.value));
|
27
|
-
return Object.assign(Object.assign({}, data), { value: encoded });
|
28
|
-
}
|
29
|
-
else {
|
30
|
-
const fields = model.getFields();
|
31
|
-
for (let key of Object.keys(fields)) {
|
32
|
-
if (data && key in data) {
|
33
|
-
data[key] = yield preprocessGQLInput(data[key], fields[key].type);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
if (model instanceof GraphQLScalarType) {
|
39
|
-
if (model.name === 'IDateTime') {
|
40
|
-
return new Date(data);
|
41
|
-
}
|
42
|
-
}
|
43
|
-
if (model instanceof GraphQLNonNull) {
|
44
|
-
return yield preprocessGQLInput(data, model.ofType);
|
45
|
-
}
|
46
|
-
if (model instanceof GraphQLList) {
|
47
|
-
for (let i = 0; i < data.length; i++) {
|
48
|
-
data[i] = yield preprocessGQLInput(data[i], model.ofType);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
if (model instanceof GraphQLScalarType) {
|
52
|
-
switch (model.name) {
|
53
|
-
case 'Upload':
|
54
|
-
if (typeof data !== 'object') {
|
55
|
-
return Buffer.from(data.toString(), 'utf8');
|
56
|
-
}
|
57
|
-
let fileData = yield data;
|
58
|
-
const upload = yield fileData.promise;
|
59
|
-
const stream = upload.createReadStream();
|
60
|
-
return stream;
|
61
|
-
}
|
62
|
-
}
|
63
|
-
return data;
|
64
|
-
});
|
65
|
-
export const postProcessGQLValue = (data, model) => {
|
66
|
-
if (model instanceof GraphQLEnumType) {
|
67
|
-
return data;
|
68
|
-
}
|
69
|
-
if (model instanceof GraphQLObjectType) {
|
70
|
-
if (model.name === 'GoogleProtobufAny' && (data === null || data === void 0 ? void 0 : data.value)) {
|
71
|
-
// TODO Use encoded once resource base supports it
|
72
|
-
const decoded = JSON.parse(data.value.toString());
|
73
|
-
return Object.assign(Object.assign({}, data), { value: decoded });
|
74
|
-
}
|
75
|
-
else {
|
76
|
-
const fields = model.getFields();
|
77
|
-
for (let key of Object.keys(fields)) {
|
78
|
-
if (data && key in data) {
|
79
|
-
data[key] = postProcessGQLValue(data[key], fields[key].type);
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
if (model instanceof GraphQLNonNull) {
|
85
|
-
return postProcessGQLValue(data, model.ofType);
|
86
|
-
}
|
87
|
-
if (model instanceof GraphQLList) {
|
88
|
-
for (let i = 0; i < data.length; i++) {
|
89
|
-
data[i] = postProcessGQLValue(data[i], model.ofType);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return data;
|
93
|
-
};
|
94
|
-
export const getWhitelistBlacklistConfig = (metaService, config, meta, entity) => {
|
95
|
-
var _a, _b, _c, _d;
|
96
|
-
const queryList = [];
|
97
|
-
if (meta.options && meta.options.services && meta.options.services[metaService.name] && meta.options.services[metaService.name].methods) {
|
98
|
-
const methods = meta.options.services[metaService.name].methods;
|
99
|
-
for (const key of Object.keys(methods)) {
|
100
|
-
if ('is_query' in methods[key] && methods[key]['is_query']) {
|
101
|
-
queryList.push(key);
|
102
|
-
}
|
103
|
-
}
|
104
|
-
}
|
105
|
-
const mut = new Set(metaService.method.map(m => m.name).filter(key => queryList.indexOf(key) < 0));
|
106
|
-
const que = new Set(metaService.method.map(m => m.name).filter(key => queryList.indexOf(key) >= 0));
|
107
|
-
if (config[entity]) {
|
108
|
-
if ((_b = (_a = config[entity]) === null || _a === void 0 ? void 0 : _a.methods) === null || _b === void 0 ? void 0 : _b.whitelist) {
|
109
|
-
const whitelist = new Set(config[entity].methods.whitelist);
|
110
|
-
mut.forEach(key => {
|
111
|
-
if (whitelist.has(key)) {
|
112
|
-
whitelist.delete(key);
|
113
|
-
}
|
114
|
-
else {
|
115
|
-
mut.delete(key);
|
116
|
-
}
|
117
|
-
});
|
118
|
-
que.forEach(key => {
|
119
|
-
if (whitelist.has(key)) {
|
120
|
-
whitelist.delete(key);
|
121
|
-
}
|
122
|
-
else {
|
123
|
-
que.delete(key);
|
124
|
-
}
|
125
|
-
});
|
126
|
-
if (whitelist.size > 0) {
|
127
|
-
// TODO Log error that whitelist contains methods that don't exist
|
128
|
-
console.error('Whitelist contains undefined methods:', whitelist);
|
129
|
-
}
|
130
|
-
}
|
131
|
-
else if ((_d = (_c = config[entity]) === null || _c === void 0 ? void 0 : _c.methods) === null || _d === void 0 ? void 0 : _d.blacklist) {
|
132
|
-
const blacklist = new Set(config[entity].methods.blacklist);
|
133
|
-
mut.forEach(key => {
|
134
|
-
if (blacklist.has(key)) {
|
135
|
-
blacklist.delete(key);
|
136
|
-
mut.delete(key);
|
137
|
-
}
|
138
|
-
});
|
139
|
-
que.forEach(key => {
|
140
|
-
if (blacklist.has(key)) {
|
141
|
-
blacklist.delete(key);
|
142
|
-
que.delete(key);
|
143
|
-
}
|
144
|
-
});
|
145
|
-
if (blacklist.size > 0) {
|
146
|
-
// TODO Log error that blacklist contains methods that don't exist
|
147
|
-
console.error('Blacklist contains undefined methods:', blacklist);
|
148
|
-
}
|
149
|
-
}
|
150
|
-
}
|
151
|
-
if (Mutate.findIndex(val => mut.has(val)) > -1) {
|
152
|
-
mut.add('Mutate');
|
153
|
-
}
|
154
|
-
return {
|
155
|
-
mutations: mut,
|
156
|
-
queries: que
|
157
|
-
};
|
158
|
-
};
|
package/dist/gql/protos/index.js
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
import { type GraphQLEnumTypeConfig, type GraphQLInputObjectTypeConfig, GraphQLObjectType, type GraphQLObjectTypeConfig } from 'graphql';
|
2
|
-
import { GraphQLEnumType, GraphQLInputObjectType, GraphQLScalarType } from 'graphql/type/definition.js';
|
3
|
-
import { type ProtoMetadata, type ProtoMetaMessageOptions } from './types.js';
|
4
|
-
import { type DescriptorProto, type EnumDescriptorProto, type MethodDescriptorProto } from 'ts-proto-descriptors';
|
5
|
-
export interface TypingData {
|
6
|
-
output: GraphQLObjectType | GraphQLEnumType | GraphQLScalarType;
|
7
|
-
input: GraphQLInputObjectType | GraphQLEnumType | GraphQLScalarType;
|
8
|
-
meta: DescriptorProto | EnumDescriptorProto;
|
9
|
-
processor?: any;
|
10
|
-
}
|
11
|
-
export declare const registeredTypings: Map<string, TypingData>;
|
12
|
-
export declare const scalarTypes: string[];
|
13
|
-
export declare const IGoogleProtobufAny: GraphQLInputObjectType;
|
14
|
-
export declare const clearRegistry: () => void;
|
15
|
-
export declare const getRegisteredEnumTypings: () => string[];
|
16
|
-
export declare const getNameSpaceTypeName: (typeName: string) => string | undefined;
|
17
|
-
export declare const getTyping: (type: string) => TypingData | undefined;
|
18
|
-
export declare const recursiveEnumCheck: (typeName: string, enumMap: Map<string, string>, prevFieldName: string, traversedFields: string[]) => Map<string, string>;
|
19
|
-
export declare const registerTyping: (protoPackage: string, message: DescriptorProto, methodDef: MethodDescriptorProto[], opts?: Omit<Readonly<GraphQLObjectTypeConfig<any, any>>, 'fields'>, inputOpts?: Omit<Readonly<GraphQLInputObjectTypeConfig>, 'fields'>, messageOptions?: ProtoMetaMessageOptions) => void;
|
20
|
-
export declare const registerEnumTyping: <T = {
|
21
|
-
[key: string]: any;
|
22
|
-
}>(protoPackage: string, message: EnumDescriptorProto, opts?: Omit<Readonly<GraphQLEnumTypeConfig>, 'values'>) => void;
|
23
|
-
export declare const registerPackagesRecursive: (...protoMetadata: ProtoMetadata[]) => void;
|