@graphql-codegen/urql-svelte-operations-store 1.1.21 → 1.1.22-alpha-5d16266dd.0
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.
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const visitorPluginCommon = require('@graphql-codegen/visitor-plugin-common');
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.plugin = void 0;
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
|
+
const change_case_all_1 = require("change-case-all");
|
|
6
|
+
const visitor_plugin_common_1 = require("@graphql-codegen/visitor-plugin-common");
|
|
9
7
|
function getOperationSuffix(config, node, operationType) {
|
|
10
8
|
const { omitOperationSuffix = false, dedupeOperationSuffix = false } = config || {};
|
|
11
9
|
const operationName = typeof node === 'string' ? node : node.name ? node.name.value : '';
|
|
@@ -16,14 +14,14 @@ function getOperationSuffix(config, node, operationType) {
|
|
|
16
14
|
: operationType;
|
|
17
15
|
}
|
|
18
16
|
const plugin = (schema, documents, config) => {
|
|
19
|
-
const allAst =
|
|
20
|
-
const convertName =
|
|
21
|
-
const operationResultSuffix =
|
|
17
|
+
const allAst = (0, graphql_1.concatAST)(documents.map(v => v.document));
|
|
18
|
+
const convertName = (0, visitor_plugin_common_1.convertFactory)(config);
|
|
19
|
+
const operationResultSuffix = (0, visitor_plugin_common_1.getConfigValue)(config.operationResultSuffix, '');
|
|
22
20
|
const out = allAst.definitions
|
|
23
21
|
.map(node => {
|
|
24
22
|
var _a;
|
|
25
23
|
if (node.kind === 'OperationDefinition' && ((_a = node.name) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
26
|
-
const operationType =
|
|
24
|
+
const operationType = (0, change_case_all_1.pascalCase)(node.operation);
|
|
27
25
|
const operationTypeSuffix = getOperationSuffix(config, node, operationType);
|
|
28
26
|
const operationVariablesTypes = convertName(node, {
|
|
29
27
|
suffix: operationTypeSuffix + 'Variables',
|
|
@@ -44,5 +42,4 @@ const plugin = (schema, documents, config) => {
|
|
|
44
42
|
content: out.filter(Boolean).join('\n'),
|
|
45
43
|
};
|
|
46
44
|
};
|
|
47
|
-
|
|
48
45
|
exports.plugin = plugin;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { concatAST } from 'graphql';
|
|
2
2
|
import { pascalCase } from 'change-case-all';
|
|
3
3
|
import { convertFactory, getConfigValue } from '@graphql-codegen/visitor-plugin-common';
|
|
4
|
-
|
|
5
4
|
function getOperationSuffix(config, node, operationType) {
|
|
6
5
|
const { omitOperationSuffix = false, dedupeOperationSuffix = false } = config || {};
|
|
7
6
|
const operationName = typeof node === 'string' ? node : node.name ? node.name.value : '';
|
|
@@ -11,7 +10,7 @@ function getOperationSuffix(config, node, operationType) {
|
|
|
11
10
|
? ''
|
|
12
11
|
: operationType;
|
|
13
12
|
}
|
|
14
|
-
const plugin = (schema, documents, config) => {
|
|
13
|
+
export const plugin = (schema, documents, config) => {
|
|
15
14
|
const allAst = concatAST(documents.map(v => v.document));
|
|
16
15
|
const convertName = convertFactory(config);
|
|
17
16
|
const operationResultSuffix = getConfigValue(config.operationResultSuffix, '');
|
|
@@ -40,5 +39,3 @@ const plugin = (schema, documents, config) => {
|
|
|
40
39
|
content: out.filter(Boolean).join('\n'),
|
|
41
40
|
};
|
|
42
41
|
};
|
|
43
|
-
|
|
44
|
-
export { plugin };
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/urql-svelte-operations-store",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22-alpha-5d16266dd.0",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating wrapper for OperationsStore for Svelte & Urql",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@urql/exchange-graphcache": "^4.1.1",
|
|
7
6
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
8
|
-
"graphql-tag": "^2.0.0"
|
|
7
|
+
"graphql-tag": "^2.0.0",
|
|
8
|
+
"@urql/exchange-graphcache": "^4.1.1"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@graphql-codegen/plugin-helpers": "^2.4.0",
|
|
12
|
-
"@graphql-codegen/visitor-plugin-common": "2.
|
|
12
|
+
"@graphql-codegen/visitor-plugin-common": "2.11.0-alpha-5d16266dd.0",
|
|
13
13
|
"auto-bind": "~4.0.0",
|
|
14
14
|
"change-case-all": "1.0.14",
|
|
15
15
|
"tslib": "~2.4.0"
|
|
@@ -20,21 +20,28 @@
|
|
|
20
20
|
"directory": "packages/plugins/typescript/urql-svelte-operations-store"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
|
-
"main": "index.js",
|
|
24
|
-
"module": "index.
|
|
25
|
-
"typings": "index.d.ts",
|
|
23
|
+
"main": "cjs/index.js",
|
|
24
|
+
"module": "esm/index.js",
|
|
25
|
+
"typings": "typings/index.d.ts",
|
|
26
26
|
"typescript": {
|
|
27
|
-
"definition": "index.d.ts"
|
|
27
|
+
"definition": "typings/index.d.ts"
|
|
28
28
|
},
|
|
29
|
+
"type": "module",
|
|
29
30
|
"exports": {
|
|
30
|
-
"./package.json": "./package.json",
|
|
31
31
|
".": {
|
|
32
|
-
"require":
|
|
33
|
-
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./typings/index.d.ts",
|
|
34
|
+
"default": "./cjs/index.js"
|
|
35
|
+
},
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./typings/index.d.ts",
|
|
38
|
+
"default": "./esm/index.js"
|
|
39
|
+
},
|
|
40
|
+
"default": {
|
|
41
|
+
"types": "./typings/index.d.ts",
|
|
42
|
+
"default": "./esm/index.js"
|
|
43
|
+
}
|
|
34
44
|
},
|
|
35
|
-
"
|
|
36
|
-
"require": "./*.js",
|
|
37
|
-
"import": "./*.mjs"
|
|
38
|
-
}
|
|
45
|
+
"./package.json": "./package.json"
|
|
39
46
|
}
|
|
40
|
-
}
|
|
47
|
+
}
|
|
File without changes
|