@stonecrop/graphql-client 0.4.36 → 0.5.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.
package/dist/index.js
CHANGED
|
@@ -16,14 +16,14 @@ const metaParser = (obj) => {
|
|
|
16
16
|
return JSON.parse(obj, (key, value) => {
|
|
17
17
|
if (typeof value === 'string') {
|
|
18
18
|
try {
|
|
19
|
-
return JSON.parse(value, (
|
|
19
|
+
return JSON.parse(value, (_key, value) => {
|
|
20
20
|
if (typeof value === 'string' && !isNaN(Number(value))) {
|
|
21
21
|
return new Decimal(value);
|
|
22
22
|
}
|
|
23
23
|
return value;
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
catch
|
|
26
|
+
catch {
|
|
27
27
|
// if the value is not a stringified JSON, return as it is
|
|
28
28
|
return value;
|
|
29
29
|
}
|
|
@@ -44,6 +44,7 @@ const metaParser = (obj) => {
|
|
|
44
44
|
const methods = {
|
|
45
45
|
getMeta: async (doctype, url) => {
|
|
46
46
|
const client = new GraphQLClient(url || '/graphql', {
|
|
47
|
+
fetch: window.fetch,
|
|
47
48
|
jsonSerializer: {
|
|
48
49
|
stringify: obj => JSON.stringify(obj), // process the request object before sending; leave as default JSON
|
|
49
50
|
parse: metaParser, // process the response meta object
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,SAAS,CAAA;AAkC7D;;;;;;GAMG;AACH,QAAA,MAAM,OAAO;uBACa,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,QAAQ,MAAM,cAAc,CAAA;AACnC,OAAO,KAAK,EAAoB,YAAY,EAAE,MAAM,SAAS,CAAA;AAkC7D;;;;;;GAMG;AACH,QAAA,MAAM,OAAO;uBACa,MAAM,QAAQ,MAAM,KAAG,OAAO,CAAC,YAAY,CAAC;CAgBrE,CAAA;AAED,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/graphql-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"decimal.js": "^10.4.3",
|
|
38
38
|
"graphql": "~16.6.0",
|
|
39
39
|
"graphql-request": "~6.0.0",
|
|
40
|
-
"@stonecrop/stonecrop": "0.
|
|
40
|
+
"@stonecrop/stonecrop": "0.5.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@
|
|
43
|
+
"@eslint/js": "^9.38.0",
|
|
44
|
+
"@microsoft/api-documenter": "^7.27.3",
|
|
44
45
|
"@miragejs/graphql": "^0.1.13",
|
|
45
|
-
"@rushstack/heft": "^
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
47
|
-
"@typescript-eslint/parser": "^7.18.0",
|
|
46
|
+
"@rushstack/heft": "^1.1.3",
|
|
48
47
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
49
|
-
"
|
|
50
|
-
"eslint": "^
|
|
51
|
-
"eslint-
|
|
52
|
-
"
|
|
48
|
+
"eslint": "^9.38.0",
|
|
49
|
+
"eslint-config-prettier": "^10.1.8",
|
|
50
|
+
"eslint-plugin-vue": "^10.5.1",
|
|
51
|
+
"globals": "^16.4.0",
|
|
53
52
|
"miragejs": "^0.1.48",
|
|
54
53
|
"typescript": "^5.9.3",
|
|
54
|
+
"typescript-eslint": "^8.46.2",
|
|
55
55
|
"vite": "^7.1.1",
|
|
56
56
|
"vue": "^3.5.22",
|
|
57
57
|
"vue-router": "^4.6.3",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"build": "heft build && vite build && rushx docs",
|
|
70
70
|
"dev": "vite",
|
|
71
71
|
"docs": "cd ../common/autoinstallers/doc-tools && node generate-docs.mjs graphql_client",
|
|
72
|
-
"lint": "eslint .
|
|
72
|
+
"lint": "eslint .",
|
|
73
73
|
"preview": "vite preview"
|
|
74
74
|
}
|
|
75
75
|
}
|
package/src/index.ts
CHANGED
|
@@ -19,19 +19,19 @@ const metaParser = (obj: string): MetaParser => {
|
|
|
19
19
|
return JSON.parse(obj, (key, value) => {
|
|
20
20
|
if (typeof value === 'string') {
|
|
21
21
|
try {
|
|
22
|
-
return JSON.parse(value, (
|
|
22
|
+
return JSON.parse(value, (_key, value) => {
|
|
23
23
|
if (typeof value === 'string' && !isNaN(Number(value))) {
|
|
24
24
|
return new Decimal(value)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return value
|
|
28
28
|
})
|
|
29
|
-
} catch
|
|
29
|
+
} catch {
|
|
30
30
|
// if the value is not a stringified JSON, return as it is
|
|
31
31
|
return value
|
|
32
32
|
}
|
|
33
33
|
} else if (!isNaN(Number(value))) {
|
|
34
|
-
return new Decimal(value)
|
|
34
|
+
return new Decimal(value as string | number)
|
|
35
35
|
}
|
|
36
36
|
return value
|
|
37
37
|
})
|
|
@@ -47,6 +47,7 @@ const metaParser = (obj: string): MetaParser => {
|
|
|
47
47
|
const methods = {
|
|
48
48
|
getMeta: async (doctype: string, url?: string): Promise<MetaResponse> => {
|
|
49
49
|
const client = new GraphQLClient(url || '/graphql', {
|
|
50
|
+
fetch: window.fetch,
|
|
50
51
|
jsonSerializer: {
|
|
51
52
|
stringify: obj => JSON.stringify(obj), // process the request object before sending; leave as default JSON
|
|
52
53
|
parse: metaParser, // process the response meta object
|