@tachybase/module-file 1.3.21 → 1.3.23
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/client/index.js +1 -1
- package/dist/client/interfaces/attachment.d.ts +1 -0
- package/dist/externalVersion.js +7 -9
- package/dist/node_modules/@aws-sdk/client-s3/node_modules/.bin/uuid +2 -2
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mkdirp/LICENSE +2 -2
- package/dist/node_modules/mkdirp/bin/cmd.js +64 -29
- package/dist/node_modules/mkdirp/index.js +1 -1
- package/dist/node_modules/mkdirp/lib/find-made.js +29 -0
- package/dist/node_modules/mkdirp/lib/mkdirp-manual.js +64 -0
- package/dist/node_modules/mkdirp/lib/mkdirp-native.js +39 -0
- package/dist/node_modules/mkdirp/lib/opts-arg.js +23 -0
- package/dist/node_modules/mkdirp/lib/path-arg.js +29 -0
- package/dist/node_modules/mkdirp/lib/use-native.js +10 -0
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/mkdirp/readme.markdown +201 -35
- package/dist/node_modules/multer-aliyun-oss/package.json +1 -1
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/multer-s3/package.json +1 -1
- package/dist/server/FileModel.d.ts +1 -1
- package/dist/server/FileModel.js +2 -2
- package/dist/server/actions/attachments.d.ts +1 -1
- package/dist/server/actions/attachments.js +7 -7
- package/dist/server/actions/index.js +2 -12
- package/dist/server/collections/attachments.d.ts +1 -1
- package/dist/server/collections/attachments.js +2 -2
- package/dist/server/collections/storages.d.ts +1 -1
- package/dist/server/collections/storages.js +2 -2
- package/dist/server/migrations/20230831160742-fix-attachment-field.d.ts +1 -1
- package/dist/server/migrations/20230831160742-fix-attachment-field.js +2 -3
- package/dist/server/migrations/20231120142523-fix-storage.d.ts +1 -1
- package/dist/server/migrations/20231120142523-fix-storage.js +1 -1
- package/dist/server/migrations/20240306223006-update-target.d.ts +1 -1
- package/dist/server/migrations/20240306223006-update-target.js +1 -1
- package/dist/server/server.d.ts +1 -1
- package/dist/server/server.js +4 -4
- package/dist/server/storages/index.d.ts +1 -2
- package/dist/server/storages/index.js +2 -2
- package/package.json +11 -18
- package/dist/node_modules/mkdirp/bin/usage.txt +0 -12
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
# mkdirp
|
|
2
2
|
|
|
3
|
-
Like `mkdir -p`, but in
|
|
3
|
+
Like `mkdir -p`, but in Node.js!
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Now with a modern API and no\* bugs!
|
|
6
|
+
|
|
7
|
+
<small>\* may contain some bugs</small>
|
|
6
8
|
|
|
7
9
|
# example
|
|
8
10
|
|
|
9
11
|
## pow.js
|
|
10
12
|
|
|
11
13
|
```js
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
14
|
+
const mkdirp = require('mkdirp')
|
|
15
|
+
|
|
16
|
+
// return value is a Promise resolving to the first directory created
|
|
17
|
+
mkdirp('/tmp/foo/bar/baz').then(made =>
|
|
18
|
+
console.log(`made directories, starting with ${made}`))
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
Output
|
|
21
|
+
Output (where `/tmp/foo` already exists)
|
|
21
22
|
|
|
22
23
|
```
|
|
23
|
-
|
|
24
|
+
made directories, starting with /tmp/foo/bar
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or, if you don't have time to wait around for promises:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
const mkdirp = require('mkdirp')
|
|
31
|
+
|
|
32
|
+
// return value is the first directory created
|
|
33
|
+
const made = mkdirp.sync('/tmp/foo/bar/baz')
|
|
34
|
+
console.log(`made directories, starting with ${made}`)
|
|
24
35
|
```
|
|
25
36
|
|
|
26
37
|
And now /tmp/foo/bar/baz exists, huzzah!
|
|
@@ -28,55 +39,198 @@ And now /tmp/foo/bar/baz exists, huzzah!
|
|
|
28
39
|
# methods
|
|
29
40
|
|
|
30
41
|
```js
|
|
31
|
-
|
|
42
|
+
const mkdirp = require('mkdirp')
|
|
32
43
|
```
|
|
33
44
|
|
|
34
|
-
## mkdirp(dir, opts
|
|
45
|
+
## mkdirp(dir, [opts]) -> Promise<String | undefined>
|
|
35
46
|
|
|
36
47
|
Create a new directory and any necessary subdirectories at `dir` with octal
|
|
37
|
-
permission string `opts.mode`. If `opts` is a
|
|
38
|
-
the `opts.mode`.
|
|
48
|
+
permission string `opts.mode`. If `opts` is a string or number, it will be
|
|
49
|
+
treated as the `opts.mode`.
|
|
39
50
|
|
|
40
|
-
If `opts.mode` isn't specified, it defaults to `
|
|
51
|
+
If `opts.mode` isn't specified, it defaults to `0o777 &
|
|
52
|
+
(~process.umask())`.
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
Promise resolves to first directory `made` that had to be created, or
|
|
55
|
+
`undefined` if everything already exists. Promise rejects if any errors
|
|
56
|
+
are encountered. Note that, in the case of promise rejection, some
|
|
57
|
+
directories _may_ have been created, as recursive directory creation is not
|
|
58
|
+
an atomic operation.
|
|
44
59
|
|
|
45
60
|
You can optionally pass in an alternate `fs` implementation by passing in
|
|
46
|
-
`opts.fs`. Your implementation should have `opts.fs.mkdir(path,
|
|
47
|
-
`opts.fs.stat(path, cb)`.
|
|
61
|
+
`opts.fs`. Your implementation should have `opts.fs.mkdir(path, opts, cb)`
|
|
62
|
+
and `opts.fs.stat(path, cb)`.
|
|
48
63
|
|
|
49
|
-
|
|
64
|
+
You can also override just one or the other of `mkdir` and `stat` by
|
|
65
|
+
passing in `opts.stat` or `opts.mkdir`, or providing an `fs` option that
|
|
66
|
+
only overrides one of these.
|
|
50
67
|
|
|
51
|
-
|
|
52
|
-
with octal permission string `opts.mode`. If `opts` is a non-object, it will be
|
|
53
|
-
treated as the `opts.mode`.
|
|
68
|
+
## mkdirp.sync(dir, opts) -> String|null
|
|
54
69
|
|
|
55
|
-
|
|
70
|
+
Synchronously create a new directory and any necessary subdirectories at
|
|
71
|
+
`dir` with octal permission string `opts.mode`. If `opts` is a string or
|
|
72
|
+
number, it will be treated as the `opts.mode`.
|
|
56
73
|
|
|
57
|
-
|
|
74
|
+
If `opts.mode` isn't specified, it defaults to `0o777 &
|
|
75
|
+
(~process.umask())`.
|
|
76
|
+
|
|
77
|
+
Returns the first directory that had to be created, or undefined if
|
|
78
|
+
everything already exists.
|
|
58
79
|
|
|
59
80
|
You can optionally pass in an alternate `fs` implementation by passing in
|
|
60
|
-
`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)`
|
|
61
|
-
`opts.fs.statSync(path)`.
|
|
81
|
+
`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)`
|
|
82
|
+
and `opts.fs.statSync(path)`.
|
|
83
|
+
|
|
84
|
+
You can also override just one or the other of `mkdirSync` and `statSync`
|
|
85
|
+
by passing in `opts.statSync` or `opts.mkdirSync`, or providing an `fs`
|
|
86
|
+
option that only overrides one of these.
|
|
62
87
|
|
|
63
|
-
|
|
88
|
+
## mkdirp.manual, mkdirp.manualSync
|
|
89
|
+
|
|
90
|
+
Use the manual implementation (not the native one). This is the default
|
|
91
|
+
when the native implementation is not available or the stat/mkdir
|
|
92
|
+
implementation is overridden.
|
|
93
|
+
|
|
94
|
+
## mkdirp.native, mkdirp.nativeSync
|
|
95
|
+
|
|
96
|
+
Use the native implementation (not the manual one). This is the default
|
|
97
|
+
when the native implementation is available and stat/mkdir are not
|
|
98
|
+
overridden.
|
|
99
|
+
|
|
100
|
+
# implementation
|
|
101
|
+
|
|
102
|
+
On Node.js v10.12.0 and above, use the native `fs.mkdir(p,
|
|
103
|
+
{recursive:true})` option, unless `fs.mkdir`/`fs.mkdirSync` has been
|
|
104
|
+
overridden by an option.
|
|
105
|
+
|
|
106
|
+
## native implementation
|
|
107
|
+
|
|
108
|
+
- If the path is a root directory, then pass it to the underlying
|
|
109
|
+
implementation and return the result/error. (In this case, it'll either
|
|
110
|
+
succeed or fail, but we aren't actually creating any dirs.)
|
|
111
|
+
- Walk up the path statting each directory, to find the first path that
|
|
112
|
+
will be created, `made`.
|
|
113
|
+
- Call `fs.mkdir(path, { recursive: true })` (or `fs.mkdirSync`)
|
|
114
|
+
- If error, raise it to the caller.
|
|
115
|
+
- Return `made`.
|
|
116
|
+
|
|
117
|
+
## manual implementation
|
|
118
|
+
|
|
119
|
+
- Call underlying `fs.mkdir` implementation, with `recursive: false`
|
|
120
|
+
- If error:
|
|
121
|
+
- If path is a root directory, raise to the caller and do not handle it
|
|
122
|
+
- If ENOENT, mkdirp parent dir, store result as `made`
|
|
123
|
+
- stat(path)
|
|
124
|
+
- If error, raise original `mkdir` error
|
|
125
|
+
- If directory, return `made`
|
|
126
|
+
- Else, raise original `mkdir` error
|
|
127
|
+
- else
|
|
128
|
+
- return `undefined` if a root dir, or `made` if set, or `path`
|
|
129
|
+
|
|
130
|
+
## windows vs unix caveat
|
|
131
|
+
|
|
132
|
+
On Windows file systems, attempts to create a root directory (ie, a drive
|
|
133
|
+
letter or root UNC path) will fail. If the root directory exists, then it
|
|
134
|
+
will fail with `EPERM`. If the root directory does not exist, then it will
|
|
135
|
+
fail with `ENOENT`.
|
|
136
|
+
|
|
137
|
+
On posix file systems, attempts to create a root directory (in recursive
|
|
138
|
+
mode) will succeed silently, as it is treated like just another directory
|
|
139
|
+
that already exists. (In non-recursive mode, of course, it fails with
|
|
140
|
+
`EEXIST`.)
|
|
141
|
+
|
|
142
|
+
In order to preserve this system-specific behavior (and because it's not as
|
|
143
|
+
if we can create the parent of a root directory anyway), attempts to create
|
|
144
|
+
a root directory are passed directly to the `fs` implementation, and any
|
|
145
|
+
errors encountered are not handled.
|
|
146
|
+
|
|
147
|
+
## native error caveat
|
|
148
|
+
|
|
149
|
+
The native implementation (as of at least Node.js v13.4.0) does not provide
|
|
150
|
+
appropriate errors in some cases (see
|
|
151
|
+
[nodejs/node#31481](https://github.com/nodejs/node/issues/31481) and
|
|
152
|
+
[nodejs/node#28015](https://github.com/nodejs/node/issues/28015)).
|
|
153
|
+
|
|
154
|
+
In order to work around this issue, the native implementation will fall
|
|
155
|
+
back to the manual implementation if an `ENOENT` error is encountered.
|
|
156
|
+
|
|
157
|
+
# choosing a recursive mkdir implementation
|
|
158
|
+
|
|
159
|
+
There are a few to choose from! Use the one that suits your needs best :D
|
|
160
|
+
|
|
161
|
+
## use `fs.mkdir(path, {recursive: true}, cb)` if:
|
|
162
|
+
|
|
163
|
+
- You wish to optimize performance even at the expense of other factors.
|
|
164
|
+
- You don't need to know the first dir created.
|
|
165
|
+
- You are ok with getting `ENOENT` as the error when some other problem is
|
|
166
|
+
the actual cause.
|
|
167
|
+
- You can limit your platforms to Node.js v10.12 and above.
|
|
168
|
+
- You're ok with using callbacks instead of promises.
|
|
169
|
+
- You don't need/want a CLI.
|
|
170
|
+
- You don't need to override the `fs` methods in use.
|
|
171
|
+
|
|
172
|
+
## use this module (mkdirp 1.x) if:
|
|
173
|
+
|
|
174
|
+
- You need to know the first directory that was created.
|
|
175
|
+
- You wish to use the native implementation if available, but fall back
|
|
176
|
+
when it's not.
|
|
177
|
+
- You prefer promise-returning APIs to callback-taking APIs.
|
|
178
|
+
- You want more useful error messages than the native recursive mkdir
|
|
179
|
+
provides (at least as of Node.js v13.4), and are ok with re-trying on
|
|
180
|
+
`ENOENT` to achieve this.
|
|
181
|
+
- You need (or at least, are ok with) a CLI.
|
|
182
|
+
- You need to override the `fs` methods in use.
|
|
183
|
+
|
|
184
|
+
## use [`make-dir`](http://npm.im/make-dir) if:
|
|
185
|
+
|
|
186
|
+
- You do not need to know the first dir created (and wish to save a few
|
|
187
|
+
`stat` calls when using the native implementation for this reason).
|
|
188
|
+
- You wish to use the native implementation if available, but fall back
|
|
189
|
+
when it's not.
|
|
190
|
+
- You prefer promise-returning APIs to callback-taking APIs.
|
|
191
|
+
- You are ok with occasionally getting `ENOENT` errors for failures that
|
|
192
|
+
are actually related to something other than a missing file system entry.
|
|
193
|
+
- You don't need/want a CLI.
|
|
194
|
+
- You need to override the `fs` methods in use.
|
|
195
|
+
|
|
196
|
+
## use mkdirp 0.x if:
|
|
197
|
+
|
|
198
|
+
- You need to know the first directory that was created.
|
|
199
|
+
- You need (or at least, are ok with) a CLI.
|
|
200
|
+
- You need to override the `fs` methods in use.
|
|
201
|
+
- You're ok with using callbacks instead of promises.
|
|
202
|
+
- You are not running on Windows, where the root-level ENOENT errors can
|
|
203
|
+
lead to infinite regress.
|
|
204
|
+
- You think vinyl just sounds warmer and richer for some weird reason.
|
|
205
|
+
- You are supporting truly ancient Node.js versions, before even the advent
|
|
206
|
+
of a `Promise` language primitive. (Please don't. You deserve better.)
|
|
207
|
+
|
|
208
|
+
# cli
|
|
64
209
|
|
|
65
210
|
This package also ships with a `mkdirp` command.
|
|
66
211
|
|
|
67
212
|
```
|
|
213
|
+
$ mkdirp -h
|
|
214
|
+
|
|
68
215
|
usage: mkdirp [DIR1,DIR2..] {OPTIONS}
|
|
69
216
|
|
|
70
|
-
Create each supplied directory including any necessary parent directories
|
|
71
|
-
don't yet exist.
|
|
72
|
-
|
|
217
|
+
Create each supplied directory including any necessary parent directories
|
|
218
|
+
that don't yet exist.
|
|
219
|
+
|
|
73
220
|
If the directory already exists, do nothing.
|
|
74
221
|
|
|
75
222
|
OPTIONS are:
|
|
76
223
|
|
|
77
|
-
-m
|
|
78
|
-
|
|
224
|
+
-m<mode> If a directory needs to be created, set the mode as an octal
|
|
225
|
+
--mode=<mode> permission string.
|
|
226
|
+
|
|
227
|
+
-v --version Print the mkdirp version number
|
|
79
228
|
|
|
229
|
+
-h --help Print this helpful banner
|
|
230
|
+
|
|
231
|
+
-p --print Print the first directories created for each path provided
|
|
232
|
+
|
|
233
|
+
--manual Use manual implementation, even if native is available
|
|
80
234
|
```
|
|
81
235
|
|
|
82
236
|
# install
|
|
@@ -87,13 +241,25 @@ With [npm](http://npmjs.org) do:
|
|
|
87
241
|
npm install mkdirp
|
|
88
242
|
```
|
|
89
243
|
|
|
90
|
-
to get the library, or
|
|
244
|
+
to get the library locally, or
|
|
91
245
|
|
|
92
246
|
```
|
|
93
247
|
npm install -g mkdirp
|
|
94
248
|
```
|
|
95
249
|
|
|
96
|
-
to get the command
|
|
250
|
+
to get the command everywhere, or
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
npx mkdirp ...
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
to run the command without installing it globally.
|
|
257
|
+
|
|
258
|
+
# platform support
|
|
259
|
+
|
|
260
|
+
This module works on node v8, but only v10 and above are officially
|
|
261
|
+
supported, as Node v8 reached its LTS end of life 2020-01-01, which is in
|
|
262
|
+
the past, as of this writing.
|
|
97
263
|
|
|
98
264
|
# license
|
|
99
265
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"multer-aliyun-oss","version":"2.1.3","description":"Multer Storage for AliYun OSS","main":"index.js","scripts":{},"author":"AngusYoung","license":"ISC","repository":{"type":"git","url":"git+https://github.com/ay86/multer-aliyun-oss.git"},"keywords":["multer","storage","aliyun","oss"],"dependencies":{"ali-oss":"^6.1.0"},"_lastModified":"2025-
|
|
1
|
+
{"name":"multer-aliyun-oss","version":"2.1.3","description":"Multer Storage for AliYun OSS","main":"index.js","scripts":{},"author":"AngusYoung","license":"ISC","repository":{"type":"git","url":"git+https://github.com/ay86/multer-aliyun-oss.git"},"keywords":["multer","storage","aliyun","oss"],"dependencies":{"ali-oss":"^6.1.0"},"_lastModified":"2025-08-02T21:24:29.688Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-
|
|
1
|
+
{"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-08-02T21:24:41.139Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2025-
|
|
1
|
+
{"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2025-08-02T21:24:37.371Z"}
|
package/dist/server/FileModel.js
CHANGED
|
@@ -20,8 +20,8 @@ __export(FileModel_exports, {
|
|
|
20
20
|
FileModel: () => FileModel
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(FileModel_exports);
|
|
23
|
-
var
|
|
24
|
-
class FileModel extends
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
class FileModel extends import_server.Model {
|
|
25
25
|
toJSON() {
|
|
26
26
|
var _a, _b;
|
|
27
27
|
const json = super.toJSON();
|
|
@@ -31,11 +31,11 @@ __export(attachments_exports, {
|
|
|
31
31
|
destroyMiddleware: () => destroyMiddleware
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(attachments_exports);
|
|
34
|
-
var
|
|
35
|
-
var
|
|
34
|
+
var import_node_path = __toESM(require("node:path"));
|
|
35
|
+
var import_server = require("@tego/server");
|
|
36
36
|
var import_constants = require("../constants");
|
|
37
37
|
var Rules = __toESM(require("../rules"));
|
|
38
|
-
var
|
|
38
|
+
var import_server2 = __toESM(require("../server"));
|
|
39
39
|
var import_storages = require("../storages");
|
|
40
40
|
function getFileFilter(storage) {
|
|
41
41
|
return (req, file, cb) => {
|
|
@@ -52,8 +52,8 @@ function getFileData(ctx) {
|
|
|
52
52
|
}
|
|
53
53
|
const storageConfig = (0, import_storages.getStorageConfig)(storage.type);
|
|
54
54
|
const { [storageConfig.filenameKey || "filename"]: name } = file;
|
|
55
|
-
const filename =
|
|
56
|
-
const extname =
|
|
55
|
+
const filename = import_node_path.default.basename(name);
|
|
56
|
+
const extname = import_node_path.default.extname(filename);
|
|
57
57
|
const urlPath = storage.path ? storage.path.replace(/^([^/])/, "/$1") : "";
|
|
58
58
|
return {
|
|
59
59
|
title: Buffer.from(file.originalname, "latin1").toString("utf8").replace(extname, ""),
|
|
@@ -91,7 +91,7 @@ async function multipart(ctx, next) {
|
|
|
91
91
|
},
|
|
92
92
|
storage: storageConfig.make(storage)
|
|
93
93
|
};
|
|
94
|
-
const upload = (0,
|
|
94
|
+
const upload = (0, import_server.koaMulter)(multerOptions).single(import_constants.FILE_FIELD_NAME);
|
|
95
95
|
try {
|
|
96
96
|
await upload(ctx, () => {
|
|
97
97
|
});
|
|
@@ -119,7 +119,7 @@ async function createMiddleware(ctx, next) {
|
|
|
119
119
|
const storageName = ((_c = (_b = ctx.db.getFieldByPath(attachmentField)) == null ? void 0 : _b.options) == null ? void 0 : _c.storage) || collection.options.storage;
|
|
120
120
|
const StorageRepo = ctx.db.getRepository("storages");
|
|
121
121
|
const storage = await StorageRepo.findOne({ filter: storageName ? { name: storageName } : { default: true } });
|
|
122
|
-
const plugin = ctx.app.pm.get(
|
|
122
|
+
const plugin = ctx.app.pm.get(import_server2.default);
|
|
123
123
|
ctx.storage = plugin.parseStorage(storage);
|
|
124
124
|
await multipart(ctx, next);
|
|
125
125
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,24 +14,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
var actions_exports = {};
|
|
29
19
|
__export(actions_exports, {
|
|
30
20
|
default: () => actions_default
|
|
31
21
|
});
|
|
32
22
|
module.exports = __toCommonJS(actions_exports);
|
|
33
|
-
var
|
|
23
|
+
var import_server = require("@tego/server");
|
|
34
24
|
var import_attachments = require("./attachments");
|
|
35
25
|
function actions_default({ app }) {
|
|
36
26
|
app.resourcer.use(import_attachments.createMiddleware, { tag: "createMiddleware", after: "auth" });
|
|
37
|
-
app.resourcer.registerActionHandler("upload",
|
|
27
|
+
app.resourcer.registerActionHandler("upload", import_server.actions.create);
|
|
38
28
|
app.resourcer.use(import_attachments.destroyMiddleware, { tag: "fileUploadHandling" });
|
|
39
29
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionOptions;
|
|
2
2
|
export default _default;
|
|
@@ -20,8 +20,8 @@ __export(attachments_exports, {
|
|
|
20
20
|
default: () => attachments_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(attachments_exports);
|
|
23
|
-
var
|
|
24
|
-
var attachments_default = (0,
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
var attachments_default = (0, import_server.defineCollection)({
|
|
25
25
|
dumpRules: {
|
|
26
26
|
group: "user"
|
|
27
27
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@
|
|
1
|
+
declare const _default: import("@tego/server").CollectionOptions;
|
|
2
2
|
export default _default;
|
|
@@ -20,8 +20,8 @@ __export(storages_exports, {
|
|
|
20
20
|
default: () => storages_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(storages_exports);
|
|
23
|
-
var
|
|
24
|
-
var storages_default = (0,
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
|
+
var storages_default = (0, import_server.defineCollection)({
|
|
25
25
|
dumpRules: "required",
|
|
26
26
|
name: "storages",
|
|
27
27
|
shared: true,
|
|
@@ -20,8 +20,7 @@ __export(fix_attachment_field_exports, {
|
|
|
20
20
|
default: () => fix_attachment_field_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(fix_attachment_field_exports);
|
|
23
|
-
var
|
|
24
|
-
var import_server = require("@tachybase/server");
|
|
23
|
+
var import_server = require("@tego/server");
|
|
25
24
|
class fix_attachment_field_default extends import_server.Migration {
|
|
26
25
|
constructor() {
|
|
27
26
|
super(...arguments);
|
|
@@ -37,7 +36,7 @@ class fix_attachment_field_default extends import_server.Migration {
|
|
|
37
36
|
filter: {
|
|
38
37
|
"schema.x-component": "CollectionField",
|
|
39
38
|
"schema.x-component-props.action": {
|
|
40
|
-
[
|
|
39
|
+
[import_server.Op.like]: "%:create?attachementField%"
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
});
|
|
@@ -20,7 +20,7 @@ __export(fix_storage_exports, {
|
|
|
20
20
|
default: () => fix_storage_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(fix_storage_exports);
|
|
23
|
-
var import_server = require("@
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
24
|
class fix_storage_default extends import_server.Migration {
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
|
@@ -20,7 +20,7 @@ __export(update_target_exports, {
|
|
|
20
20
|
default: () => update_target_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(update_target_exports);
|
|
23
|
-
var import_server = require("@
|
|
23
|
+
var import_server = require("@tego/server");
|
|
24
24
|
class update_target_default extends import_server.Migration {
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
package/dist/server/server.d.ts
CHANGED
package/dist/server/server.js
CHANGED
|
@@ -31,8 +31,8 @@ __export(server_exports, {
|
|
|
31
31
|
storageTypes: () => import_storages2.default
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(server_exports);
|
|
34
|
-
var
|
|
35
|
-
var import_server = require("@
|
|
34
|
+
var import_node_path = require("node:path");
|
|
35
|
+
var import_server = require("@tego/server");
|
|
36
36
|
var import_actions = __toESM(require("./actions"));
|
|
37
37
|
var import_FileModel = require("./FileModel");
|
|
38
38
|
var import_storages = require("./storages");
|
|
@@ -87,7 +87,7 @@ class PluginFileManager extends import_server.Plugin {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
async load() {
|
|
90
|
-
await this.importCollections((0,
|
|
90
|
+
await this.importCollections((0, import_node_path.resolve)(__dirname, "./collections"));
|
|
91
91
|
const Storage = this.db.getModel("storages");
|
|
92
92
|
Storage.afterSave(async (m, { transaction }) => {
|
|
93
93
|
await this.loadStorages({ transaction });
|
|
@@ -101,7 +101,7 @@ class PluginFileManager extends import_server.Plugin {
|
|
|
101
101
|
});
|
|
102
102
|
this.db.addMigrations({
|
|
103
103
|
namespace: "file-manager",
|
|
104
|
-
directory: (0,
|
|
104
|
+
directory: (0, import_node_path.resolve)(__dirname, "migrations"),
|
|
105
105
|
context: {
|
|
106
106
|
plugin: this
|
|
107
107
|
}
|
|
@@ -31,13 +31,13 @@ __export(storages_exports, {
|
|
|
31
31
|
getStorageConfig: () => getStorageConfig
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(storages_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_server = require("@tego/server");
|
|
35
35
|
var import_constants = require("../constants");
|
|
36
36
|
var import_ali_oss = __toESM(require("./ali-oss"));
|
|
37
37
|
var import_local = __toESM(require("./local"));
|
|
38
38
|
var import_s3 = __toESM(require("./s3"));
|
|
39
39
|
var import_tx_cos = __toESM(require("./tx-cos"));
|
|
40
|
-
const storageTypes = new
|
|
40
|
+
const storageTypes = new import_server.Registry();
|
|
41
41
|
storageTypes.register(import_constants.STORAGE_TYPE_LOCAL, import_local.default);
|
|
42
42
|
storageTypes.register(import_constants.STORAGE_TYPE_ALI_OSS, import_ali_oss.default);
|
|
43
43
|
storageTypes.register(import_constants.STORAGE_TYPE_S3, import_s3.default);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/module-file",
|
|
3
3
|
"displayName": "File manager",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.23",
|
|
5
5
|
"description": "Provides files storage services with files collection template and attachment field.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Collections",
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
"main": "./dist/server/index.js",
|
|
12
12
|
"dependencies": {},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@ant-design/icons": "^5.
|
|
14
|
+
"@ant-design/icons": "^5.6.1",
|
|
15
15
|
"@aws-sdk/client-s3": "^3.850.0",
|
|
16
|
+
"@tachybase/schema": "^1.3.43",
|
|
17
|
+
"@tachybase/test": "^1.3.43",
|
|
18
|
+
"@tego/client": "^1.3.43",
|
|
19
|
+
"@tego/server": "^1.3.43",
|
|
16
20
|
"@types/koa-multer": "^1.0.4",
|
|
17
21
|
"@types/multer": "^1.4.12",
|
|
18
22
|
"antd": "5.22.5",
|
|
@@ -20,28 +24,17 @@
|
|
|
20
24
|
"koa-static": "^5.0.0",
|
|
21
25
|
"lodash": "4.17.21",
|
|
22
26
|
"mime-match": "^1.0.2",
|
|
23
|
-
"mkdirp": "
|
|
27
|
+
"mkdirp": "^1.0.4",
|
|
24
28
|
"multer": "2.0.1",
|
|
25
29
|
"multer-aliyun-oss": "2.1.3",
|
|
26
30
|
"multer-cos": "^1.0.3",
|
|
27
31
|
"multer-s3": "^3.0.1",
|
|
28
|
-
"react": "
|
|
29
|
-
"react-i18next": "
|
|
32
|
+
"react": "18.3.1",
|
|
33
|
+
"react-i18next": "15.2.0",
|
|
30
34
|
"supertest": "^7.1.3",
|
|
31
|
-
"@tachybase/
|
|
32
|
-
"@tachybase/schema": "1.3.21"
|
|
33
|
-
},
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"@tachybase/actions": "1.3.21",
|
|
36
|
-
"@tachybase/database": "1.3.21",
|
|
37
|
-
"@tachybase/server": "1.3.21",
|
|
38
|
-
"@tachybase/utils": "1.3.21",
|
|
39
|
-
"@tachybase/test": "1.3.21",
|
|
40
|
-
"@tachybase/client": "1.3.21"
|
|
35
|
+
"@tachybase/client": "1.3.23"
|
|
41
36
|
},
|
|
42
37
|
"description.zh-CN": "提供文件存储服务,并提供了文件表模板和附件字段。",
|
|
43
38
|
"displayName.zh-CN": "文件管理器",
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build": "tachybase-build --no-dts @tachybase/module-file"
|
|
46
|
-
}
|
|
39
|
+
"scripts": {}
|
|
47
40
|
}
|