@graphql-mesh/soap 1.0.0-alpha-3fc47d119.0 → 1.0.0-alpha-20230420181317-a95037648

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/cjs/index.js ADDED
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const store_1 = require("@graphql-mesh/store");
4
+ const utils_1 = require("@graphql-mesh/utils");
5
+ const soap_1 = require("@omnigraph/soap");
6
+ class SoapHandler {
7
+ constructor({ config, store, baseDir, importFn, logger, }) {
8
+ this.config = config;
9
+ this.soapSDLProxy = store.proxy('schemaWithAnnotations', store_1.PredefinedProxyOptions.GraphQLSchemaWithDiffing);
10
+ this.baseDir = baseDir;
11
+ this.importFn = importFn;
12
+ this.logger = logger;
13
+ }
14
+ async getMeshSource({ fetchFn }) {
15
+ let schema;
16
+ if (this.config.source.endsWith('.graphql')) {
17
+ schema = await (0, utils_1.readFileOrUrl)(this.config.source, {
18
+ allowUnknownExtensions: true,
19
+ cwd: this.baseDir,
20
+ fetch: fetchFn,
21
+ importFn: this.importFn,
22
+ logger: this.logger,
23
+ });
24
+ }
25
+ else {
26
+ schema = await this.soapSDLProxy.getWithSet(async () => {
27
+ const soapLoader = new soap_1.SOAPLoader({
28
+ fetch: fetchFn,
29
+ });
30
+ const wsdlLocation = this.config.source;
31
+ const wsdl = await (0, utils_1.readFileOrUrl)(wsdlLocation, {
32
+ allowUnknownExtensions: true,
33
+ cwd: this.baseDir,
34
+ fetch: fetchFn,
35
+ importFn: this.importFn,
36
+ logger: this.logger,
37
+ });
38
+ const object = await soapLoader.loadWSDL(wsdl);
39
+ soapLoader.loadedLocations.set(wsdlLocation, object);
40
+ return soapLoader.buildSchema();
41
+ });
42
+ }
43
+ // Create executor lazily for faster startup
44
+ let executor;
45
+ return {
46
+ schema,
47
+ executor(...args) {
48
+ if (!executor) {
49
+ executor = (0, soap_1.createExecutorFromSchemaAST)(schema, fetchFn);
50
+ }
51
+ return executor(...args);
52
+ },
53
+ };
54
+ }
55
+ }
56
+ exports.default = SoapHandler;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
package/esm/index.js ADDED
@@ -0,0 +1,53 @@
1
+ import { PredefinedProxyOptions } from '@graphql-mesh/store';
2
+ import { readFileOrUrl } from '@graphql-mesh/utils';
3
+ import { createExecutorFromSchemaAST, SOAPLoader } from '@omnigraph/soap';
4
+ export default class SoapHandler {
5
+ constructor({ config, store, baseDir, importFn, logger, }) {
6
+ this.config = config;
7
+ this.soapSDLProxy = store.proxy('schemaWithAnnotations', PredefinedProxyOptions.GraphQLSchemaWithDiffing);
8
+ this.baseDir = baseDir;
9
+ this.importFn = importFn;
10
+ this.logger = logger;
11
+ }
12
+ async getMeshSource({ fetchFn }) {
13
+ let schema;
14
+ if (this.config.source.endsWith('.graphql')) {
15
+ schema = await readFileOrUrl(this.config.source, {
16
+ allowUnknownExtensions: true,
17
+ cwd: this.baseDir,
18
+ fetch: fetchFn,
19
+ importFn: this.importFn,
20
+ logger: this.logger,
21
+ });
22
+ }
23
+ else {
24
+ schema = await this.soapSDLProxy.getWithSet(async () => {
25
+ const soapLoader = new SOAPLoader({
26
+ fetch: fetchFn,
27
+ });
28
+ const wsdlLocation = this.config.source;
29
+ const wsdl = await readFileOrUrl(wsdlLocation, {
30
+ allowUnknownExtensions: true,
31
+ cwd: this.baseDir,
32
+ fetch: fetchFn,
33
+ importFn: this.importFn,
34
+ logger: this.logger,
35
+ });
36
+ const object = await soapLoader.loadWSDL(wsdl);
37
+ soapLoader.loadedLocations.set(wsdlLocation, object);
38
+ return soapLoader.buildSchema();
39
+ });
40
+ }
41
+ // Create executor lazily for faster startup
42
+ let executor;
43
+ return {
44
+ schema,
45
+ executor(...args) {
46
+ if (!executor) {
47
+ executor = createExecutorFromSchemaAST(schema, fetchFn);
48
+ }
49
+ return executor(...args);
50
+ },
51
+ };
52
+ }
53
+ }
package/package.json CHANGED
@@ -1,19 +1,17 @@
1
1
  {
2
2
  "name": "@graphql-mesh/soap",
3
- "version": "1.0.0-alpha-3fc47d119.0",
3
+ "version": "1.0.0-alpha-20230420181317-a95037648",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
- "@graphql-mesh/types": "0.79.0-alpha-3fc47d119.0",
7
- "@graphql-mesh/utils": "1.0.0-alpha-3fc47d119.0",
8
- "graphql": "*"
6
+ "@graphql-mesh/store": "1.0.0-alpha-20230420181317-a95037648",
7
+ "@graphql-mesh/types": "1.0.0-alpha-20230420181317-a95037648",
8
+ "@graphql-mesh/utils": "1.0.0-alpha-20230420181317-a95037648",
9
+ "@graphql-tools/utils": "^9.2.1",
10
+ "graphql": "*",
11
+ "tslib": "^2.4.0"
9
12
  },
10
13
  "dependencies": {
11
- "@graphql-mesh/cross-helpers": "0.2.0",
12
- "@graphql-mesh/store": "1.0.0-alpha-3fc47d119.0",
13
- "@graphql-tools/utils": "8.8.0",
14
- "graphql-scalars": "1.17.0",
15
- "soap": "0.45.0",
16
- "tslib": "^2.4.0"
14
+ "@omnigraph/soap": "1.0.0-alpha-20230420181317-a95037648"
17
15
  },
18
16
  "repository": {
19
17
  "type": "git",
@@ -21,21 +19,28 @@
21
19
  "directory": "packages/handlers/soap"
22
20
  },
23
21
  "license": "MIT",
24
- "main": "index.js",
25
- "module": "index.mjs",
26
- "typings": "index.d.ts",
22
+ "main": "cjs/index.js",
23
+ "module": "esm/index.js",
24
+ "typings": "typings/index.d.ts",
27
25
  "typescript": {
28
- "definition": "index.d.ts"
26
+ "definition": "typings/index.d.ts"
29
27
  },
28
+ "type": "module",
30
29
  "exports": {
31
30
  ".": {
32
- "require": "./index.js",
33
- "import": "./index.mjs"
34
- },
35
- "./*": {
36
- "require": "./*.js",
37
- "import": "./*.mjs"
31
+ "require": {
32
+ "types": "./typings/index.d.cts",
33
+ "default": "./cjs/index.js"
34
+ },
35
+ "import": {
36
+ "types": "./typings/index.d.ts",
37
+ "default": "./esm/index.js"
38
+ },
39
+ "default": {
40
+ "types": "./typings/index.d.ts",
41
+ "default": "./esm/index.js"
42
+ }
38
43
  },
39
44
  "./package.json": "./package.json"
40
45
  }
41
- }
46
+ }
@@ -0,0 +1,10 @@
1
+ import { GetMeshSourcePayload, MeshHandler, MeshHandlerOptions, MeshSource, YamlConfig } from '@graphql-mesh/types';
2
+ export default class SoapHandler implements MeshHandler {
3
+ private config;
4
+ private soapSDLProxy;
5
+ private baseDir;
6
+ private importFn;
7
+ private logger;
8
+ constructor({ config, store, baseDir, importFn, logger, }: MeshHandlerOptions<YamlConfig.SoapHandler>);
9
+ getMeshSource({ fetchFn }: GetMeshSourcePayload): Promise<MeshSource>;
10
+ }
@@ -0,0 +1,10 @@
1
+ import { GetMeshSourcePayload, MeshHandler, MeshHandlerOptions, MeshSource, YamlConfig } from '@graphql-mesh/types';
2
+ export default class SoapHandler implements MeshHandler {
3
+ private config;
4
+ private soapSDLProxy;
5
+ private baseDir;
6
+ private importFn;
7
+ private logger;
8
+ constructor({ config, store, baseDir, importFn, logger, }: MeshHandlerOptions<YamlConfig.SoapHandler>);
9
+ getMeshSource({ fetchFn }: GetMeshSourcePayload): Promise<MeshSource>;
10
+ }
package/index.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { GetMeshSourceOptions, MeshHandler, YamlConfig } from '@graphql-mesh/types';
2
- export default class SoapHandler implements MeshHandler {
3
- private config;
4
- private baseDir;
5
- private fetchFn;
6
- private wsdlResponse;
7
- private importFn;
8
- private logger;
9
- constructor({ config, baseDir, fetchFn, store, importFn, logger }: GetMeshSourceOptions<YamlConfig.SoapHandler>);
10
- getMeshSource(): Promise<{
11
- schema: import("graphql").GraphQLSchema;
12
- }>;
13
- }