@unchainedshop/cockpit-api 1.0.1 → 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 CHANGED
@@ -1,2 +1,3 @@
1
- export declare const makeCockpitSchema: () => Promise<import("graphql").GraphQLSchema>;
1
+ import CockpitAPI from "./api.js";
2
+ export default CockpitAPI;
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,iBAAiB,gDAW7B,CAAC"}
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
- exports.makeCockpitSchema = void 0;
16
- const wrap_1 = require("@graphql-tools/wrap");
17
6
  const api_js_1 = __importDefault(require("./api.js"));
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_js_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;
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":";;;;;;;;;;;;;;;AAAA,8CAI6B;AAC7B,sDAAkC;AAElC,SAAe,cAAc;yDAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAO;;QAC/D,MAAM,YAAY,GAAG,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,0CAAE,OAAO,0CAAG,iBAAiB,CAAC,CAAC;QAChE,MAAM,UAAU,GAAG,MAAM,IAAA,gBAAU,EAAC,YAAY,CAAC,CAAC;QAClD,OAAO,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;CAAA;AAEM,MAAM,iBAAiB,GAAG,GAAS,EAAE;IACxC,MAAM,gBAAgB,GAAG,IAAA,iBAAU,EAAC;QAChC,MAAM,EAAE,MAAM,IAAA,yBAAkB,EAAC,cAAc,CAAC;QAChD,QAAQ,EAAE,cAAc;QACxB,UAAU,EAAE;YACR,IAAI,uBAAgB,CAAC,CAAC,aAAa,EAAE,EAAE;gBACnC,OAAO,aAAa,KAAK,UAAU,CAAC;YACxC,CAAC,CAAC;SACL;KACJ,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAA,CAAC;AAXW,QAAA,iBAAiB,qBAW5B"}
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.1",
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
1
  import CockpitAPI from "./api.js";
7
2
 
8
- async function remoteExecutor({ document, variables, context }: any) {
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