@webda/fs 4.0.0-beta.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/LICENSE +166 -0
- package/README.md +130 -0
- package/lib/filebinary.service.d.ts +184 -0
- package/lib/filebinary.service.d.ts.map +1 -0
- package/lib/filebinary.service.js +467 -0
- package/lib/filebinary.service.js.map +1 -0
- package/lib/filequeue.service.d.ts +62 -0
- package/lib/filequeue.service.d.ts.map +1 -0
- package/lib/filequeue.service.js +138 -0
- package/lib/filequeue.service.js.map +1 -0
- package/lib/filestore.service.d.ts +133 -0
- package/lib/filestore.service.d.ts.map +1 -0
- package/lib/filestore.service.js +423 -0
- package/lib/filestore.service.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -0
- package/lib/socketpubsub.service.d.ts +150 -0
- package/lib/socketpubsub.service.d.ts.map +1 -0
- package/lib/socketpubsub.service.js +348 -0
- package/lib/socketpubsub.service.js.map +1 -0
- package/package.json +50 -0
- package/webda.module.json +304 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
|
166
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# @webda/fs module
|
|
2
|
+
|
|
3
|
+
This module is part of Webda Application Framework that allows you to quickly develop applications with all modern prerequisites: Security, Extensibility, GraphQL, REST, CloudNative [https://webda.io](https://webda.io)
|
|
4
|
+
|
|
5
|
+
<img src="https://webda.io/images/webda.svg" width="128" />
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
[](https://gitter.im/loopingz/webda?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
10
|
+
[](https://codecov.io/gh/loopingz/webda.io)
|
|
11
|
+
[](https://sonarcloud.io/summary/new_code?id=loopingz_webda.io)
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
<!-- README_HEADER -->
|
|
15
|
+
|
|
16
|
+
# @webda/fs
|
|
17
|
+
|
|
18
|
+
> Filesystem-backed Store, Binary, and Queue implementations for Webda — ideal for local development, testing, or single-instance deployments where you want persistence without an external database.
|
|
19
|
+
|
|
20
|
+
## When to use it
|
|
21
|
+
|
|
22
|
+
- You are developing or running unit tests locally and need a zero-config persistent store without spinning up a database.
|
|
23
|
+
- You need to store file uploads on local disk (e.g. a blog system or a small self-hosted app) using `FileBinary`.
|
|
24
|
+
- You want a file-backed queue (`FileQueue`) for sequential task processing in a single-process scenario.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @webda/fs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"services": {
|
|
37
|
+
"postStore": {
|
|
38
|
+
"type": "FileStore",
|
|
39
|
+
"model": "MyApp/Post",
|
|
40
|
+
"folder": "./data/posts"
|
|
41
|
+
},
|
|
42
|
+
"uploads": {
|
|
43
|
+
"type": "FileBinary",
|
|
44
|
+
"folder": "./data/uploads",
|
|
45
|
+
"maxSize": 10485760
|
|
46
|
+
},
|
|
47
|
+
"fileQueue": {
|
|
48
|
+
"type": "FileQueue",
|
|
49
|
+
"folder": "./data/queue"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### FileStore parameters
|
|
56
|
+
|
|
57
|
+
| Parameter | Type | Default | Required | Description |
|
|
58
|
+
|---|---|---|---|---|
|
|
59
|
+
| `folder` | string | — | Yes | Directory where each model instance is stored as a JSON file |
|
|
60
|
+
| `beautify` | string \| number | — | No | Indentation passed to `JSON.stringify` (e.g. `2` for pretty-print) |
|
|
61
|
+
|
|
62
|
+
### FileBinary parameters
|
|
63
|
+
|
|
64
|
+
| Parameter | Type | Default | Required | Description |
|
|
65
|
+
|---|---|---|---|---|
|
|
66
|
+
| `folder` | string | — | Yes | Directory where uploaded binaries are stored |
|
|
67
|
+
| `maxSize` | number | `10485760` | No | Maximum accepted upload size in bytes (default 10 MB) |
|
|
68
|
+
| `url` | string | — | No | URL prefix for direct-download links |
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import { CoreModel, Model, Expose, BinaryFile, BinaryMap } from "@webda/core";
|
|
74
|
+
import { Bean, Inject } from "@webda/core";
|
|
75
|
+
import { Store } from "@webda/core";
|
|
76
|
+
|
|
77
|
+
@Model()
|
|
78
|
+
export class Post extends CoreModel {
|
|
79
|
+
@Expose()
|
|
80
|
+
title: string;
|
|
81
|
+
|
|
82
|
+
@BinaryMap({ cardinality: "ONE" })
|
|
83
|
+
cover: BinaryFile;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// In webda.config.json: configure FileStore (model storage) and FileBinary (uploads)
|
|
87
|
+
// Webda auto-wires them — no extra service code required.
|
|
88
|
+
|
|
89
|
+
// Programmatic usage
|
|
90
|
+
@Bean
|
|
91
|
+
export class PostService extends Service {
|
|
92
|
+
@Inject("postStore")
|
|
93
|
+
store: Store<Post>;
|
|
94
|
+
|
|
95
|
+
async createPost(title: string): Promise<Post> {
|
|
96
|
+
const post = new Post();
|
|
97
|
+
post.title = title;
|
|
98
|
+
return post.save();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async listPosts(): Promise<Post[]> {
|
|
102
|
+
return (await Post.query("")).results;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Reference
|
|
108
|
+
|
|
109
|
+
- API reference: see the auto-generated typedoc at `docs/pages/Modules/fs/`.
|
|
110
|
+
- Source: [`packages/fs`](https://github.com/loopingz/webda.io/tree/main/packages/fs)
|
|
111
|
+
- Related: [`@webda/aws`](../aws) for `DynamoStore` and `S3Binary` as cloud-native replacements; [`@webda/mongodb`](../mongodb) for a MongoDB-backed store; [`@webda/core`](../core) for the `Store`, `Binary`, and `Queue` base classes.
|
|
112
|
+
|
|
113
|
+
<!-- README_FOOTER -->
|
|
114
|
+
## Sponsors
|
|
115
|
+
|
|
116
|
+
<!--
|
|
117
|
+
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor](mailto:sponsor@webda.io)
|
|
118
|
+
-->
|
|
119
|
+
|
|
120
|
+
Arize AI is a machine learning observability and model monitoring platform. It helps you visualize, monitor, and explain your machine learning models. [Learn more](https://arize.com)
|
|
121
|
+
|
|
122
|
+
[<img src="https://arize.com/hubfs/arize/brand/arize-logomark-1.png" width="200">](https://arize.com)
|
|
123
|
+
|
|
124
|
+
Loopingz is a software development company that provides consulting and development services. [Learn more](https://loopingz.com)
|
|
125
|
+
|
|
126
|
+
[<img src="https://loopingz.com/images/logo.png" width="200">](https://loopingz.com)
|
|
127
|
+
|
|
128
|
+
Tellae is an innovative consulting firm specialized in cities transportation issues. We provide our clients, both public and private, with solutions to support your strategic and operational decisions. [Learn more](https://tellae.fr)
|
|
129
|
+
|
|
130
|
+
[<img src="https://tellae.fr/" width="200">](https://tellae.fr)
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Readable } from "stream";
|
|
2
|
+
import { BinaryFile, BinaryMap, CloudBinary, CloudBinaryParameters, CoreModel, CoreModelWithBinary, CryptoService, OperationContext, WebContext } from "@webda/core";
|
|
3
|
+
/** Configuration parameters for the filesystem-backed binary storage service. */
|
|
4
|
+
export declare class FileBinaryParameters extends CloudBinaryParameters {
|
|
5
|
+
/**
|
|
6
|
+
* Define the folder to store objects in
|
|
7
|
+
*/
|
|
8
|
+
folder: string;
|
|
9
|
+
/**
|
|
10
|
+
* Maximum size to handle
|
|
11
|
+
* @default 10Mb
|
|
12
|
+
*/
|
|
13
|
+
maxSize?: number;
|
|
14
|
+
/**
|
|
15
|
+
* URL to use for direct download
|
|
16
|
+
*/
|
|
17
|
+
url?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Load and normalize parameters, ensuring the folder path has a trailing slash.
|
|
20
|
+
*
|
|
21
|
+
* @param params - raw parameter values
|
|
22
|
+
* @returns this instance for chaining
|
|
23
|
+
*/
|
|
24
|
+
load(params: any): this;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* FileBinary handles the storage of binary on a hard drive
|
|
28
|
+
*
|
|
29
|
+
* The structure used for now is
|
|
30
|
+
* /folder/{hash}/data
|
|
31
|
+
* /folder/{hash}/{targetStore}_{uuid}
|
|
32
|
+
* /folder/{hash}/challenge
|
|
33
|
+
*
|
|
34
|
+
* It takes one parameter
|
|
35
|
+
* folder: "path"
|
|
36
|
+
*
|
|
37
|
+
* See Binary the general interface
|
|
38
|
+
* @category CoreServices
|
|
39
|
+
* @WebdaModda
|
|
40
|
+
*/
|
|
41
|
+
export declare class FileBinary<T extends FileBinaryParameters = FileBinaryParameters> extends CloudBinary<T> {
|
|
42
|
+
/**
|
|
43
|
+
* Used for hmac
|
|
44
|
+
*/
|
|
45
|
+
cryptoService: CryptoService;
|
|
46
|
+
/**
|
|
47
|
+
* Load parameters
|
|
48
|
+
*
|
|
49
|
+
* @param params - raw parameter values
|
|
50
|
+
* @returns the loaded parameters
|
|
51
|
+
*/
|
|
52
|
+
loadParameters(params: any): T;
|
|
53
|
+
/**
|
|
54
|
+
* Create the storage folder if needed
|
|
55
|
+
*/
|
|
56
|
+
computeParameters(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Register download/upload routes if a public URL is configured.
|
|
59
|
+
*
|
|
60
|
+
* Routes depend on the runtime `parameters.url` + content hash, so they're
|
|
61
|
+
* registered programmatically rather than via `@Route`.
|
|
62
|
+
*
|
|
63
|
+
* @returns this for chaining
|
|
64
|
+
*/
|
|
65
|
+
init(): Promise<this>;
|
|
66
|
+
/**
|
|
67
|
+
* Download a binary with a challenge
|
|
68
|
+
*
|
|
69
|
+
* @param ctx - the web context
|
|
70
|
+
*/
|
|
71
|
+
downloadBinaryLink(ctx: WebContext<any, any, {
|
|
72
|
+
hash: string;
|
|
73
|
+
}>): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* @override
|
|
76
|
+
*/
|
|
77
|
+
_get(info: BinaryMap): Promise<Readable>;
|
|
78
|
+
/**
|
|
79
|
+
* Get signed url to download an element
|
|
80
|
+
*
|
|
81
|
+
* @param map - the binary map
|
|
82
|
+
* @param expires - expiration time in seconds
|
|
83
|
+
* @param context - the web context
|
|
84
|
+
* @returns the signed download URL
|
|
85
|
+
*/
|
|
86
|
+
getSignedUrlFromMap(map: BinaryMap, expires: number, context: WebContext): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Get storage path for a hash
|
|
89
|
+
*
|
|
90
|
+
* @param hash - the content hash
|
|
91
|
+
* @param postfix - optional path suffix
|
|
92
|
+
* @returns the filesystem path
|
|
93
|
+
*/
|
|
94
|
+
_getPath(hash: string, postfix?: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Create a file if it does not already exist, using the given permission mode.
|
|
97
|
+
*
|
|
98
|
+
* @param filePath - path of the file to create
|
|
99
|
+
* @param mode - file permission mode
|
|
100
|
+
*/
|
|
101
|
+
_touch(filePath: any, mode?: number): void;
|
|
102
|
+
/**
|
|
103
|
+
* Get token for action
|
|
104
|
+
*
|
|
105
|
+
* @param hash - the content hash
|
|
106
|
+
* @param method - HTTP method (PUT or GET)
|
|
107
|
+
* @param expiresIn - token TTL in seconds
|
|
108
|
+
* @returns the signed JWT token
|
|
109
|
+
*/
|
|
110
|
+
getToken(hash: string, method: "PUT" | "GET", expiresIn?: number): Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Get put URL
|
|
113
|
+
*
|
|
114
|
+
* @param ctx - the operation context
|
|
115
|
+
* @returns the upload URL
|
|
116
|
+
*/
|
|
117
|
+
getPutUrl(ctx: OperationContext<BinaryFile>): Promise<string>;
|
|
118
|
+
/**
|
|
119
|
+
* Will give you the redirect url
|
|
120
|
+
*
|
|
121
|
+
* @param object - the model instance
|
|
122
|
+
* @param attribute - the binary attribute name
|
|
123
|
+
* @param info - optional binary file info
|
|
124
|
+
* @param context - the operation context
|
|
125
|
+
* @returns the redirect URL and method, or undefined if already stored
|
|
126
|
+
*/
|
|
127
|
+
putRedirectUrl(object: CoreModel, attribute: string, info?: BinaryFile, context?: OperationContext<BinaryFile>): Promise<{
|
|
128
|
+
url: string;
|
|
129
|
+
method: string;
|
|
130
|
+
}>;
|
|
131
|
+
/**
|
|
132
|
+
* Store the binary sent
|
|
133
|
+
*
|
|
134
|
+
* @param ctx - the web context
|
|
135
|
+
*/
|
|
136
|
+
storeBinary(ctx: WebContext): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* @override
|
|
139
|
+
*/
|
|
140
|
+
getUsageCount(hash: string): Promise<number>;
|
|
141
|
+
/**
|
|
142
|
+
* Delete any usage marker and hash
|
|
143
|
+
*
|
|
144
|
+
* @param hash - the content hash to clean
|
|
145
|
+
*/
|
|
146
|
+
_cleanHash(hash: string): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* @override
|
|
149
|
+
*/
|
|
150
|
+
_cleanUsage(hash: string, uuid: string, attribute?: string): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* @override
|
|
153
|
+
*/
|
|
154
|
+
delete(object: CoreModelWithBinary, property: string, index?: number): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Verify that a binary with the given hash exists and contains the expected challenge marker.
|
|
157
|
+
*
|
|
158
|
+
* @param hash - the content hash
|
|
159
|
+
* @param challenge - the challenge string
|
|
160
|
+
* @returns true if the challenge marker exists
|
|
161
|
+
*/
|
|
162
|
+
challenge(hash: any, challenge: any): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* @override
|
|
165
|
+
*/
|
|
166
|
+
cascadeDelete(info: BinaryMap, uuid: string): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Write a binary file's stream to the local filesystem under its content-hash directory.
|
|
169
|
+
*
|
|
170
|
+
* @param file - the binary file to store
|
|
171
|
+
* @param object - the model instance
|
|
172
|
+
* @param attribute - the binary attribute name
|
|
173
|
+
*/
|
|
174
|
+
_store(file: BinaryFile, object: CoreModel, attribute: string): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* @override
|
|
177
|
+
*/
|
|
178
|
+
store(object: CoreModel, property: string, file: BinaryFile): Promise<any>;
|
|
179
|
+
/**
|
|
180
|
+
* Clean all data
|
|
181
|
+
*/
|
|
182
|
+
___cleanData(): Promise<void>;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=filebinary.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filebinary.service.d.ts","sourceRoot":"","sources":["../src/filebinary.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EACL,UAAU,EACV,SAAS,EAGT,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,mBAAmB,EACnB,aAAa,EAGb,gBAAgB,EAChB,UAAU,EAEX,MAAM,aAAa,CAAC;AAGrB,iFAAiF;AACjF,qBAAa,oBAAqB,SAAQ,qBAAqB;IAC7D;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAWtB;CACF;AACD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,UAAU,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;IACnG;;OAEG;IAEH,aAAa,EAAE,aAAa,CAAC;IAC7B;;;;;OAKG;IACH,cAAc,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAE7B;IAED;;OAEG;IACH,iBAAiB,SAKhB;IAED;;;;;;;OAOG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAgD1B;IAED;;;;OAIG;IACG,kBAAkB,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,iBAsBnE;IAED;;OAEG;IACG,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,C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