@globalbrain/sefirot 3.20.0 → 3.21.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/lib/composables/Lang.ts +6 -0
- package/lib/http/Http.ts +29 -27
- package/package.json +14 -14
package/lib/composables/Lang.ts
CHANGED
package/lib/http/Http.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { $fetch, type FetchOptions } from 'ofetch'
|
|
|
5
5
|
import { stringify } from 'qs'
|
|
6
6
|
|
|
7
7
|
export class Http {
|
|
8
|
+
static base: string | undefined = undefined
|
|
8
9
|
static xsrfUrl = '/api/csrf-cookie'
|
|
9
10
|
|
|
10
11
|
private async ensureXsrfToken(): Promise<string | undefined> {
|
|
@@ -35,6 +36,7 @@ export class Http {
|
|
|
35
36
|
return [
|
|
36
37
|
`${url}${queryString ? `?${queryString}` : ''}`,
|
|
37
38
|
{
|
|
39
|
+
baseURL: Http.base,
|
|
38
40
|
method,
|
|
39
41
|
credentials: 'include',
|
|
40
42
|
...options,
|
|
@@ -55,33 +57,6 @@ export class Http {
|
|
|
55
57
|
return $fetch.raw<T, any>(...(await this.buildRequest(url, options)))
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
private objectToFormData(obj: any, form?: FormData, namespace?: string) {
|
|
59
|
-
const fd = form || new FormData()
|
|
60
|
-
let formKey: string
|
|
61
|
-
|
|
62
|
-
for (const property in obj) {
|
|
63
|
-
if (Reflect.has(obj, property)) {
|
|
64
|
-
if (namespace) {
|
|
65
|
-
formKey = `${namespace}[${property}]`
|
|
66
|
-
} else {
|
|
67
|
-
formKey = property
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (obj[property] === undefined) {
|
|
71
|
-
continue
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (typeof obj[property] === 'object' && !(obj[property] instanceof Blob)) {
|
|
75
|
-
this.objectToFormData(obj[property], fd, property)
|
|
76
|
-
} else {
|
|
77
|
-
fd.append(formKey, obj[property])
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return fd
|
|
83
|
-
}
|
|
84
|
-
|
|
85
60
|
async get<T = any>(url: string, options?: FetchOptions): Promise<T> {
|
|
86
61
|
return this.performRequest<T>(url, { method: 'GET', ...options })
|
|
87
62
|
}
|
|
@@ -132,6 +107,33 @@ export class Http {
|
|
|
132
107
|
|
|
133
108
|
FileSaver.saveAs(blob, filename as string)
|
|
134
109
|
}
|
|
110
|
+
|
|
111
|
+
private objectToFormData(obj: any, form?: FormData, namespace?: string) {
|
|
112
|
+
const fd = form || new FormData()
|
|
113
|
+
let formKey: string
|
|
114
|
+
|
|
115
|
+
for (const property in obj) {
|
|
116
|
+
if (Reflect.has(obj, property)) {
|
|
117
|
+
if (namespace) {
|
|
118
|
+
formKey = `${namespace}[${property}]`
|
|
119
|
+
} else {
|
|
120
|
+
formKey = property
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (obj[property] === undefined) {
|
|
124
|
+
continue
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (typeof obj[property] === 'object' && !(obj[property] instanceof Blob)) {
|
|
128
|
+
this.objectToFormData(obj[property], fd, property)
|
|
129
|
+
} else {
|
|
130
|
+
fd.append(formKey, obj[property])
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return fd
|
|
136
|
+
}
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
export type { FetchOptions }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@globalbrain/sefirot",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"packageManager": "pnpm@8.
|
|
3
|
+
"version": "3.21.0",
|
|
4
|
+
"packageManager": "pnpm@8.14.0",
|
|
5
5
|
"description": "Vue Components for Global Brain Design System.",
|
|
6
6
|
"author": "Kia Ishii <ka.ishii@globalbrains.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"@types/markdown-it": "^13.0.7",
|
|
47
47
|
"@vuelidate/core": "^2.0.3",
|
|
48
48
|
"@vuelidate/validators": "^2.0.4",
|
|
49
|
-
"@vueuse/core": "^10.7.
|
|
49
|
+
"@vueuse/core": "^10.7.1",
|
|
50
50
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
51
51
|
"fuse.js": "^7.0.0",
|
|
52
52
|
"lodash-es": "^4.17.21",
|
|
53
53
|
"markdown-it": "^14.0.0",
|
|
54
54
|
"normalize.css": "^8.0.1",
|
|
55
55
|
"pinia": "^2.1.7",
|
|
56
|
-
"postcss": "^8.4.
|
|
56
|
+
"postcss": "^8.4.33",
|
|
57
57
|
"postcss-nested": "^6.0.1",
|
|
58
58
|
"v-calendar": "^3.1.2",
|
|
59
|
-
"vue": "^3.
|
|
59
|
+
"vue": "^3.4.5",
|
|
60
60
|
"vue-router": "^4.2.5"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
@@ -80,13 +80,13 @@
|
|
|
80
80
|
"@types/body-scroll-lock": "^3.1.2",
|
|
81
81
|
"@types/lodash-es": "^4.17.12",
|
|
82
82
|
"@types/markdown-it": "^13.0.7",
|
|
83
|
-
"@types/node": "^20.10.
|
|
84
|
-
"@vitejs/plugin-vue": "^5.0.
|
|
85
|
-
"@vitest/coverage-v8": "^1.1.
|
|
83
|
+
"@types/node": "^20.10.6",
|
|
84
|
+
"@vitejs/plugin-vue": "^5.0.2",
|
|
85
|
+
"@vitest/coverage-v8": "^1.1.2",
|
|
86
86
|
"@vue/test-utils": "^2.4.3",
|
|
87
87
|
"@vuelidate/core": "^2.0.3",
|
|
88
88
|
"@vuelidate/validators": "^2.0.4",
|
|
89
|
-
"@vueuse/core": "^10.7.
|
|
89
|
+
"@vueuse/core": "^10.7.1",
|
|
90
90
|
"body-scroll-lock": "4.0.0-beta.0",
|
|
91
91
|
"eslint": "^8.56.0",
|
|
92
92
|
"fuse.js": "^7.0.0",
|
|
@@ -96,17 +96,17 @@
|
|
|
96
96
|
"markdown-it": "^14.0.0",
|
|
97
97
|
"normalize.css": "^8.0.1",
|
|
98
98
|
"pinia": "^2.1.7",
|
|
99
|
-
"postcss": "^8.4.
|
|
99
|
+
"postcss": "^8.4.33",
|
|
100
100
|
"postcss-nested": "^6.0.1",
|
|
101
101
|
"punycode": "^2.3.1",
|
|
102
102
|
"release-it": "^17.0.1",
|
|
103
103
|
"typescript": "~5.3.3",
|
|
104
104
|
"v-calendar": "^3.1.2",
|
|
105
105
|
"vite": "^5.0.10",
|
|
106
|
-
"vitepress": "1.0.0-rc.
|
|
107
|
-
"vitest": "^1.1.
|
|
108
|
-
"vue": "^3.
|
|
106
|
+
"vitepress": "1.0.0-rc.35",
|
|
107
|
+
"vitest": "^1.1.2",
|
|
108
|
+
"vue": "^3.4.5",
|
|
109
109
|
"vue-router": "^4.2.5",
|
|
110
|
-
"vue-tsc": "^1.8.
|
|
110
|
+
"vue-tsc": "^1.8.27"
|
|
111
111
|
}
|
|
112
112
|
}
|