@spoosh/plugin-qs 0.1.2 → 0.1.3
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/README.md +25 -10
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -16,10 +16,9 @@ npm install @spoosh/plugin-qs
|
|
|
16
16
|
import { Spoosh } from "@spoosh/core";
|
|
17
17
|
import { qsPlugin } from "@spoosh/plugin-qs";
|
|
18
18
|
|
|
19
|
-
const client = new Spoosh<ApiSchema, Error>("/api")
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]);
|
|
19
|
+
const client = new Spoosh<ApiSchema, Error>("/api").use([
|
|
20
|
+
qsPlugin({ arrayFormat: "brackets" }),
|
|
21
|
+
]);
|
|
23
22
|
|
|
24
23
|
const query = {
|
|
25
24
|
pagination: { limit: 10, offset: 0 },
|
|
@@ -68,28 +67,36 @@ useRead((api) => api.data.$get({ query }), { skipNulls: false });
|
|
|
68
67
|
### brackets (default)
|
|
69
68
|
|
|
70
69
|
```typescript
|
|
71
|
-
{
|
|
70
|
+
{
|
|
71
|
+
tags: ["a", "b"];
|
|
72
|
+
}
|
|
72
73
|
// tags[]=a&tags[]=b
|
|
73
74
|
```
|
|
74
75
|
|
|
75
76
|
### indices
|
|
76
77
|
|
|
77
78
|
```typescript
|
|
78
|
-
{
|
|
79
|
+
{
|
|
80
|
+
tags: ["a", "b"];
|
|
81
|
+
}
|
|
79
82
|
// tags[0]=a&tags[1]=b
|
|
80
83
|
```
|
|
81
84
|
|
|
82
85
|
### repeat
|
|
83
86
|
|
|
84
87
|
```typescript
|
|
85
|
-
{
|
|
88
|
+
{
|
|
89
|
+
tags: ["a", "b"];
|
|
90
|
+
}
|
|
86
91
|
// tags=a&tags=b
|
|
87
92
|
```
|
|
88
93
|
|
|
89
94
|
### comma
|
|
90
95
|
|
|
91
96
|
```typescript
|
|
92
|
-
{
|
|
97
|
+
{
|
|
98
|
+
tags: ["a", "b"];
|
|
99
|
+
}
|
|
93
100
|
// tags=a,b
|
|
94
101
|
```
|
|
95
102
|
|
|
@@ -97,10 +104,18 @@ useRead((api) => api.data.$get({ query }), { skipNulls: false });
|
|
|
97
104
|
|
|
98
105
|
```typescript
|
|
99
106
|
// allowDots: false (default)
|
|
100
|
-
{
|
|
107
|
+
{
|
|
108
|
+
filters: {
|
|
109
|
+
status: "active";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
101
112
|
// filters[status]=active
|
|
102
113
|
|
|
103
114
|
// allowDots: true
|
|
104
|
-
{
|
|
115
|
+
{
|
|
116
|
+
filters: {
|
|
117
|
+
status: "active";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
105
120
|
// filters.status=active
|
|
106
121
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/plugin-qs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Query string serialization plugin for Spoosh with nested object support",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"qs": "^6.13.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@spoosh/core": ">=0.
|
|
40
|
+
"@spoosh/core": ">=0.4.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/qs": "^6.9.17",
|
|
44
|
-
"@spoosh/core": "0.
|
|
45
|
-
"@spoosh/test-utils": "0.1.
|
|
44
|
+
"@spoosh/core": "0.4.0",
|
|
45
|
+
"@spoosh/test-utils": "0.1.4"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"dev": "tsup --watch",
|