@unchainedshop/cockpit-api 1.0.0 → 1.0.4
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.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -33
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/src/index.ts +2 -24
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,UAAU,CAAC;AAElC,eAAe,UAAU,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
14
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const api_1 = __importDefault(require("./api"));
|
|
18
|
-
function remoteExecutor(_a) {
|
|
19
|
-
return __awaiter(this, arguments, void 0, function* ({ document, variables, context }) {
|
|
20
|
-
var _b, _c;
|
|
21
|
-
const cockpitSpace = (_c = (_b = context === null || context === void 0 ? void 0 : context.req) === null || _b === void 0 ? void 0 : _b.headers) === null || _c === void 0 ? void 0 : _c["x-cockpit-space"];
|
|
22
|
-
const getCockpit = yield (0, api_1.default)(cockpitSpace);
|
|
23
|
-
return getCockpit.graphQL(document, variables);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
const makeCockpitSchema = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
const getCockpitSchema = (0, wrap_1.wrapSchema)({
|
|
28
|
-
schema: yield (0, wrap_1.schemaFromExecutor)(remoteExecutor),
|
|
29
|
-
executor: remoteExecutor,
|
|
30
|
-
transforms: [
|
|
31
|
-
new wrap_1.FilterRootFields((operationName) => {
|
|
32
|
-
return operationName !== "Mutation";
|
|
33
|
-
}),
|
|
34
|
-
],
|
|
35
|
-
});
|
|
36
|
-
return getCockpitSchema;
|
|
37
|
-
});
|
|
38
|
-
exports.makeCockpitSchema = makeCockpitSchema;
|
|
6
|
+
const api_js_1 = __importDefault(require("./api.js"));
|
|
7
|
+
exports.default = api_js_1.default;
|
|
39
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,sDAAkC;AAElC,kBAAe,gBAAU,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unchainedshop/cockpit-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Cokpit api endpoints",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"author": "unchainedshop",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"@graphql-tools/wrap": "^10.0.5",
|
|
17
|
+
"dependencies": {
|
|
19
18
|
"@unchainedshop/logger": "^2.10.5",
|
|
20
19
|
"graphql": "^16.8.2",
|
|
21
20
|
"lru-cache": "^10.2.2"
|
package/src/index.ts
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
FilterRootFields,
|
|
3
|
-
schemaFromExecutor,
|
|
4
|
-
wrapSchema,
|
|
5
|
-
} from "@graphql-tools/wrap";
|
|
6
|
-
import CockpitAPI from "./api";
|
|
1
|
+
import CockpitAPI from "./api.js";
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
const cockpitSpace = context?.req?.headers?.["x-cockpit-space"];
|
|
10
|
-
const getCockpit = await CockpitAPI(cockpitSpace);
|
|
11
|
-
return getCockpit.graphQL(document, variables);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const makeCockpitSchema = async () => {
|
|
15
|
-
const getCockpitSchema = wrapSchema({
|
|
16
|
-
schema: await schemaFromExecutor(remoteExecutor),
|
|
17
|
-
executor: remoteExecutor,
|
|
18
|
-
transforms: [
|
|
19
|
-
new FilterRootFields((operationName) => {
|
|
20
|
-
return operationName !== "Mutation";
|
|
21
|
-
}),
|
|
22
|
-
],
|
|
23
|
-
});
|
|
24
|
-
return getCockpitSchema;
|
|
25
|
-
};
|
|
3
|
+
export default CockpitAPI
|