@toa.io/extensions.storages 1.0.0-alpha.34 → 1.0.0-alpha.340
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/package.json +43 -18
- package/readme.md +127 -47
- package/transpiled/Aspect.d.ts +8 -4
- package/transpiled/Aspect.js +12 -14
- package/transpiled/Aspect.js.map +1 -1
- package/transpiled/Entry.d.ts +14 -11
- package/transpiled/Entry.js +1 -2
- package/transpiled/Factory.d.ts +10 -2
- package/transpiled/Factory.js +52 -32
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Provider.d.ts +23 -19
- package/transpiled/Provider.js +18 -32
- package/transpiled/Provider.js.map +1 -1
- package/transpiled/Scanner.d.ts +10 -4
- package/transpiled/Scanner.js +38 -26
- package/transpiled/Scanner.js.map +1 -1
- package/transpiled/Secrets.d.ts +5 -0
- package/transpiled/Secrets.js +2 -0
- package/transpiled/Secrets.js.map +1 -0
- package/transpiled/Storage.d.ts +35 -22
- package/transpiled/Storage.js +95 -141
- package/transpiled/Storage.js.map +1 -1
- package/transpiled/errors.d.ts +15 -0
- package/transpiled/errors.js +12 -0
- package/transpiled/errors.js.map +1 -0
- package/transpiled/index.d.ts +4 -4
- package/transpiled/index.js +1 -9
- package/transpiled/index.js.map +1 -1
- package/transpiled/measurements.d.ts +3 -0
- package/transpiled/measurements.js +23 -0
- package/transpiled/measurements.js.map +1 -0
- package/transpiled/providers/Cloudinary.d.ts +55 -0
- package/transpiled/providers/Cloudinary.js +232 -0
- package/transpiled/providers/Cloudinary.js.map +1 -0
- package/transpiled/providers/Declaration.d.ts +9 -5
- package/transpiled/providers/Declaration.js +1 -2
- package/transpiled/providers/FileSystem.d.ts +16 -11
- package/transpiled/providers/FileSystem.js +64 -43
- package/transpiled/providers/FileSystem.js.map +1 -1
- package/transpiled/providers/S3.d.ts +18 -18
- package/transpiled/providers/S3.js +87 -122
- package/transpiled/providers/S3.js.map +1 -1
- package/transpiled/providers/Spaces.d.ts +12 -0
- package/transpiled/providers/Spaces.js +13 -0
- package/transpiled/providers/Spaces.js.map +1 -0
- package/transpiled/providers/Temporary.d.ts +2 -3
- package/transpiled/providers/Temporary.js +7 -11
- package/transpiled/providers/Temporary.js.map +1 -1
- package/transpiled/providers/Test.d.ts +4 -4
- package/transpiled/providers/Test.js +6 -12
- package/transpiled/providers/Test.js.map +1 -1
- package/transpiled/providers/index.d.ts +23 -11
- package/transpiled/providers/index.js +30 -14
- package/transpiled/providers/index.js.map +1 -1
- package/transpiled/providers/index.types.d.ts +5 -0
- package/transpiled/providers/index.types.js +2 -0
- package/transpiled/providers/index.types.js.map +1 -0
- package/transpiled/test/util.d.ts +113 -6
- package/transpiled/test/util.js +68 -15
- package/transpiled/test/util.js.map +1 -1
- package/schemas/annotation.cos.yaml +0 -10
- package/schemas/fs.cos.yaml +0 -9
- package/schemas/mem.cos.yaml +0 -6
- package/schemas/s3.cos.yaml +0 -16
- package/schemas/test.cos.yaml +0 -8
- package/schemas/tmp.cos.yaml +0 -9
- package/source/Annotation.ts +0 -39
- package/source/Aspect.ts +0 -25
- package/source/Entry.ts +0 -14
- package/source/Factory.ts +0 -68
- package/source/Provider.ts +0 -37
- package/source/Scanner.ts +0 -153
- package/source/Storage.test.ts +0 -472
- package/source/Storage.ts +0 -235
- package/source/deployment.ts +0 -57
- package/source/index.ts +0 -5
- package/source/manifest.ts +0 -8
- package/source/providers/Declaration.ts +0 -10
- package/source/providers/FileSystem.test.ts +0 -5
- package/source/providers/FileSystem.ts +0 -63
- package/source/providers/Memory.ts +0 -55
- package/source/providers/S3.test.ts +0 -134
- package/source/providers/S3.ts +0 -196
- package/source/providers/Temporary.ts +0 -16
- package/source/providers/Test.ts +0 -13
- package/source/providers/index.test.ts +0 -136
- package/source/providers/index.ts +0 -16
- package/source/providers/readme.md +0 -25
- package/source/schemas.test.ts +0 -58
- package/source/schemas.ts +0 -15
- package/source/test/.env.example +0 -1
- package/source/test/albert.jpg +0 -0
- package/source/test/empty.txt +0 -0
- package/source/test/lenna.ascii +0 -64
- package/source/test/lenna.png +0 -0
- package/source/test/sample.avi +0 -0
- package/source/test/sample.avif +0 -0
- package/source/test/sample.gif +0 -0
- package/source/test/sample.heic +0 -0
- package/source/test/sample.jpeg +0 -0
- package/source/test/sample.jxl +0 -0
- package/source/test/sample.svg +0 -4
- package/source/test/sample.wav +0 -0
- package/source/test/sample.webp +0 -0
- package/source/test/util.ts +0 -45
- package/transpiled/Annotation.d.ts +0 -3
- package/transpiled/Annotation.js +0 -57
- package/transpiled/Annotation.js.map +0 -1
- package/transpiled/deployment.d.ts +0 -5
- package/transpiled/deployment.js +0 -68
- package/transpiled/deployment.js.map +0 -1
- package/transpiled/manifest.d.ts +0 -1
- package/transpiled/manifest.js +0 -9
- package/transpiled/manifest.js.map +0 -1
- package/transpiled/providers/Memory.d.ts +0 -15
- package/transpiled/providers/Memory.js +0 -72
- package/transpiled/providers/Memory.js.map +0 -1
- package/transpiled/schemas.d.ts +0 -9
- package/transpiled/schemas.js +0 -14
- package/transpiled/schemas.js.map +0 -1
- package/transpiled/tsconfig.tsbuildinfo +0 -1
- package/tsconfig.json +0 -12
package/transpiled/Provider.js
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ERR_NO_URL } from './errors.js';
|
|
2
|
+
export class Provider {
|
|
3
|
+
static SECRETS;
|
|
4
|
+
root;
|
|
5
|
+
options;
|
|
6
|
+
constructor(options, secrets) {
|
|
7
|
+
this.options = options;
|
|
8
|
+
new.target.SECRETS?.forEach(({ name, optional }) => {
|
|
9
|
+
if (optional !== true && secrets?.[name] === undefined)
|
|
10
|
+
throw new Error(`Missing secret '${name}'`);
|
|
11
|
+
});
|
|
7
12
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Provider = void 0;
|
|
27
|
-
const assert = __importStar(require("node:assert"));
|
|
28
|
-
class Provider {
|
|
29
|
-
static SECRETS = [];
|
|
30
|
-
constructor(_, secrets) {
|
|
31
|
-
for (const { name, optional = false } of new.target.SECRETS)
|
|
32
|
-
assert.ok(optional || secrets?.[name] !== undefined, `Missing secret '${name}'`);
|
|
13
|
+
/**
|
|
14
|
+
* Where whoever is given it reads the file straight from the provider, with no credentials of
|
|
15
|
+
* their own, for `expires` seconds where the address is signed. A provider that serves no
|
|
16
|
+
* address of its own answers `NO_URL`.
|
|
17
|
+
*/
|
|
18
|
+
async url(_path, _expires) {
|
|
19
|
+
return ERR_NO_URL;
|
|
33
20
|
}
|
|
34
21
|
}
|
|
35
|
-
exports.Provider = Provider;
|
|
36
22
|
//# sourceMappingURL=Provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../source/Provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../source/Provider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,OAAgB,QAAQ;IACrB,MAAM,CAAU,OAAO,CAAoB;IAClC,IAAI,CAAS;IACb,OAAO,CAAS;IAEhC,YAAsB,OAAgB,EAAE,OAAiB;QACvD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QAEtB,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;YACjD,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,SAAS;gBACpD,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,GAAG,CAAC,CAAA;QAC/C,CAAC,CAAC,CAAA;IACJ,CAAC;IAcD;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,KAAa,EAAE,QAAgB;QAC9C,OAAO,UAAU,CAAA;IACnB,CAAC;CACF"}
|
package/transpiled/Scanner.d.ts
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { PassThrough, type TransformCallback } from 'node:stream';
|
|
4
2
|
export declare class Scanner extends PassThrough {
|
|
5
3
|
size: number;
|
|
6
4
|
type: string;
|
|
7
|
-
error
|
|
5
|
+
error?: Error;
|
|
8
6
|
private readonly hash;
|
|
9
7
|
private readonly claim?;
|
|
10
8
|
private readonly accept?;
|
|
9
|
+
private readonly limit?;
|
|
11
10
|
private position;
|
|
12
|
-
private
|
|
11
|
+
private completed;
|
|
13
12
|
private readonly chunks;
|
|
14
13
|
constructor(control?: ScanOptions);
|
|
15
14
|
digest(): string;
|
|
16
15
|
_transform(buffer: Buffer, encoding: BufferEncoding, callback: TransformCallback): void;
|
|
16
|
+
/**
|
|
17
|
+
* A body that ends before a signature could be read is checked as it is: the type it claims, and
|
|
18
|
+
* what is acceptable, are what any other body is held to.
|
|
19
|
+
*/
|
|
20
|
+
_flush(callback: TransformCallback): void;
|
|
17
21
|
private readonly process;
|
|
18
22
|
private complete;
|
|
19
23
|
private verify;
|
|
20
24
|
private match;
|
|
25
|
+
private negotiate;
|
|
21
26
|
private interrupt;
|
|
22
27
|
}
|
|
23
28
|
export interface ScanOptions {
|
|
24
29
|
claim?: string;
|
|
25
30
|
accept?: string;
|
|
31
|
+
limit?: number;
|
|
26
32
|
}
|
package/transpiled/Scanner.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const agent_1 = require("@toa.io/agent");
|
|
7
|
-
const error_value_1 = require("error-value");
|
|
8
|
-
class Scanner extends node_stream_1.PassThrough {
|
|
1
|
+
import { PassThrough } from 'node:stream';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import Negotiator from 'negotiator';
|
|
4
|
+
import { coded } from './errors.js';
|
|
5
|
+
export class Scanner extends PassThrough {
|
|
9
6
|
size = 0;
|
|
10
7
|
type = 'application/octet-stream';
|
|
11
|
-
error
|
|
12
|
-
hash =
|
|
8
|
+
error;
|
|
9
|
+
hash = createHash('md5');
|
|
13
10
|
claim;
|
|
14
11
|
accept;
|
|
12
|
+
limit;
|
|
15
13
|
position = 0;
|
|
16
|
-
|
|
14
|
+
completed = false;
|
|
17
15
|
chunks = [];
|
|
18
16
|
constructor(control) {
|
|
19
17
|
super();
|
|
20
18
|
this.claim = control?.claim;
|
|
21
19
|
this.accept = control?.accept;
|
|
20
|
+
this.limit = control?.limit;
|
|
22
21
|
}
|
|
23
22
|
digest() {
|
|
24
23
|
return this.hash.digest('hex');
|
|
@@ -27,10 +26,20 @@ class Scanner extends node_stream_1.PassThrough {
|
|
|
27
26
|
super._transform(buffer, encoding, callback);
|
|
28
27
|
this.process(buffer);
|
|
29
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* A body that ends before a signature could be read is checked as it is: the type it claims, and
|
|
31
|
+
* what is acceptable, are what any other body is held to.
|
|
32
|
+
*/
|
|
33
|
+
_flush(callback) {
|
|
34
|
+
if (!this.completed)
|
|
35
|
+
this.complete();
|
|
36
|
+
if (this.error === undefined)
|
|
37
|
+
callback();
|
|
38
|
+
}
|
|
30
39
|
process = (buffer) => {
|
|
31
40
|
this.size += buffer.length;
|
|
32
41
|
this.hash.update(buffer);
|
|
33
|
-
if (this.
|
|
42
|
+
if (this.completed)
|
|
34
43
|
return;
|
|
35
44
|
if (this.position + buffer.length > HEADER_SIZE)
|
|
36
45
|
buffer = buffer.subarray(0, HEADER_SIZE - this.position);
|
|
@@ -38,15 +47,14 @@ class Scanner extends node_stream_1.PassThrough {
|
|
|
38
47
|
this.position += buffer.length;
|
|
39
48
|
if (this.position === HEADER_SIZE)
|
|
40
49
|
this.complete();
|
|
50
|
+
if (this.limit !== undefined && this.size > this.limit)
|
|
51
|
+
this.interrupt(ERR_LIMIT_EXCEEDED);
|
|
41
52
|
};
|
|
42
53
|
complete() {
|
|
43
54
|
const header = Buffer.concat(this.chunks).toString('hex');
|
|
44
|
-
const signature = SIGNATURES
|
|
45
|
-
.find(({ off, hex, expression }) => {
|
|
55
|
+
const signature = SIGNATURES.find(({ off, hex, expression }) => {
|
|
46
56
|
const sig = header.slice(off, off + hex.length);
|
|
47
|
-
return expression === undefined
|
|
48
|
-
? sig === hex
|
|
49
|
-
: expression.test(sig);
|
|
57
|
+
return expression === undefined ? sig === hex : expression.test(sig);
|
|
50
58
|
});
|
|
51
59
|
const type = signature?.type ?? this.claim;
|
|
52
60
|
if (type !== undefined) {
|
|
@@ -54,7 +62,7 @@ class Scanner extends node_stream_1.PassThrough {
|
|
|
54
62
|
this.type = type;
|
|
55
63
|
}
|
|
56
64
|
this.verify(signature);
|
|
57
|
-
this.
|
|
65
|
+
this.completed = true;
|
|
58
66
|
}
|
|
59
67
|
verify(signature) {
|
|
60
68
|
if (this.claim === undefined || this.claim === 'application/octet-stream')
|
|
@@ -68,20 +76,24 @@ class Scanner extends node_stream_1.PassThrough {
|
|
|
68
76
|
match(type) {
|
|
69
77
|
if (this.accept === undefined)
|
|
70
78
|
return;
|
|
71
|
-
const unacceptable =
|
|
79
|
+
const unacceptable = this.negotiate(this.accept, [type]) === null;
|
|
72
80
|
if (unacceptable)
|
|
73
81
|
this.interrupt(ERR_NOT_ACCEPTABLE);
|
|
74
82
|
}
|
|
83
|
+
negotiate(accept, type) {
|
|
84
|
+
return new Negotiator({ headers: { accept } }).mediaType(type) ?? null;
|
|
85
|
+
}
|
|
75
86
|
interrupt(error) {
|
|
87
|
+
this.completed = true;
|
|
76
88
|
this.error = error;
|
|
77
|
-
this.
|
|
89
|
+
this.destroy(error);
|
|
78
90
|
}
|
|
79
91
|
}
|
|
80
|
-
exports.Scanner = Scanner;
|
|
81
92
|
// https://en.wikipedia.org/wiki/List_of_file_signatures
|
|
82
93
|
const SIGNATURES = [
|
|
83
94
|
{ hex: 'ff d8 ff e0', off: 0, type: 'image/jpeg' },
|
|
84
95
|
{ hex: 'ff d8 ff e1', off: 0, type: 'image/jpeg' },
|
|
96
|
+
{ hex: 'ff d8 ff e2', off: 0, type: 'image/jpeg' },
|
|
85
97
|
{ hex: 'ff d8 ff ee', off: 0, type: 'image/jpeg' },
|
|
86
98
|
{ hex: 'ff d8 ff db', off: 0, type: 'image/jpeg' },
|
|
87
99
|
{ hex: '89 50 4e 47', off: 0, type: 'image/png' },
|
|
@@ -94,7 +106,7 @@ const SIGNATURES = [
|
|
|
94
106
|
{ hex: '52 49 46 46 ?? ?? ?? ?? 57 41 56 45', off: 0, type: 'audio/wav' }
|
|
95
107
|
/*
|
|
96
108
|
When adding a new signature, include a copyright-free sample file in the `.tests` directory
|
|
97
|
-
and update the
|
|
109
|
+
and update the `signatures` test group in `Storage.test.ts`.
|
|
98
110
|
*/
|
|
99
111
|
].map((signature) => {
|
|
100
112
|
signature.hex = signature.hex.replaceAll(' ', '');
|
|
@@ -104,9 +116,9 @@ const SIGNATURES = [
|
|
|
104
116
|
}
|
|
105
117
|
return signature;
|
|
106
118
|
});
|
|
107
|
-
const HEADER_SIZE = SIGNATURES
|
|
108
|
-
.reduce((max, { off, hex }) => Math.max(max, off + hex.length), 0) / 2;
|
|
119
|
+
const HEADER_SIZE = SIGNATURES.reduce((max, { off, hex }) => Math.max(max, off + hex.length), 0) / 2;
|
|
109
120
|
const KNOWN_TYPES = new Set(SIGNATURES.map(({ type }) => type));
|
|
110
|
-
const ERR_TYPE_MISMATCH = (
|
|
111
|
-
const ERR_NOT_ACCEPTABLE = (
|
|
121
|
+
const ERR_TYPE_MISMATCH = coded('TYPE_MISMATCH');
|
|
122
|
+
const ERR_NOT_ACCEPTABLE = coded('NOT_ACCEPTABLE');
|
|
123
|
+
const ERR_LIMIT_EXCEEDED = coded('LIMIT_EXCEEDED');
|
|
112
124
|
//# sourceMappingURL=Scanner.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scanner.js","sourceRoot":"","sources":["../source/Scanner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Scanner.js","sourceRoot":"","sources":["../source/Scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAC/B,IAAI,GAAG,CAAC,CAAA;IACR,IAAI,GAAG,0BAA0B,CAAA;IACjC,KAAK,CAAQ;IAEH,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;IACxB,KAAK,CAAS;IACd,MAAM,CAAS;IACf,KAAK,CAAS;IACvB,QAAQ,GAAG,CAAC,CAAA;IACZ,SAAS,GAAG,KAAK,CAAA;IACR,MAAM,GAAa,EAAE,CAAA;IAEtC,YAAmB,OAAqB;QACtC,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,CAAA;QAC3B,IAAI,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAA;QAC7B,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,CAAA;IAC7B,CAAC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W,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;AAE/D,MAAM,iBAAiB,GAAG,KAAK,CAAC,eAAe,CAAC,CAAA;AAEhD,MAAM,kBAAkB,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAA;AAElD,MAAM,kBAAkB,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Secrets.js","sourceRoot":"","sources":["../source/Secrets.ts"],"names":[],"mappings":""}
|
package/transpiled/Storage.d.ts
CHANGED
|
@@ -1,30 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import type { ScanOptions } from './Scanner';
|
|
4
|
-
import type { Provider } from './Provider';
|
|
5
|
-
|
|
6
|
-
export declare class Storage {
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import type { Attributes, Entry, Stream } from './Entry.ts';
|
|
3
|
+
import type { ScanOptions } from './Scanner.ts';
|
|
4
|
+
import type { Provider } from './Provider.ts';
|
|
5
|
+
export declare class Storage<T extends Provider = Provider> {
|
|
7
6
|
private readonly provider;
|
|
8
|
-
|
|
7
|
+
private readonly scope?;
|
|
8
|
+
constructor(provider: T, scope?: Scope);
|
|
9
|
+
options(): T['options'];
|
|
9
10
|
put(path: string, stream: Readable, options?: Options): Maybe<Entry>;
|
|
10
|
-
get(path: string): Maybe<
|
|
11
|
-
|
|
12
|
-
fetch(path: string): Maybe<Readable>;
|
|
11
|
+
get(path: string, options?: unknown): Maybe<Stream>;
|
|
12
|
+
head(path: string): Promise<Maybe<Entry>>;
|
|
13
13
|
delete(path: string): Maybe<void>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Where the file is read straight from the provider, by whoever is given the address and with
|
|
16
|
+
* no credentials of their own: a model, a browser, another service. A signed address is good for
|
|
17
|
+
* `expires` seconds, an hour unless asked otherwise and a week at most. `NOT_FOUND` is a file the
|
|
18
|
+
* storage does not have, where the provider can tell; `NO_URL` is a storage that serves no
|
|
19
|
+
* address of its own.
|
|
20
|
+
*/
|
|
21
|
+
url(path: string, options?: UrlOptions): Maybe<string>;
|
|
22
|
+
path(): string | null;
|
|
23
|
+
private locate;
|
|
24
|
+
private span;
|
|
25
|
+
}
|
|
26
|
+
export interface UrlOptions {
|
|
27
|
+
/** Seconds a signed address is good for: an hour by default, a week at most. */
|
|
28
|
+
expires?: number;
|
|
23
29
|
}
|
|
24
|
-
type Maybe<T> = Promise<T | Error>;
|
|
25
|
-
type Meta = Record<string, string>;
|
|
26
30
|
interface Options extends ScanOptions {
|
|
27
|
-
|
|
31
|
+
id?: string;
|
|
32
|
+
origin?: string;
|
|
33
|
+
attributes?: Attributes;
|
|
34
|
+
}
|
|
35
|
+
type Maybe<T> = Promise<T | Error>;
|
|
36
|
+
export interface Scope {
|
|
37
|
+
/** the logical storage name, e.g. `octets` */
|
|
38
|
+
name: string;
|
|
39
|
+
/** the provider id, e.g. `s3` */
|
|
40
|
+
provider: string;
|
|
28
41
|
}
|
|
29
42
|
export type Storages = Record<string, Storage>;
|
|
30
43
|
export {};
|
package/transpiled/Storage.js
CHANGED
|
@@ -1,157 +1,111 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const msgpackr_1 = require("msgpackr");
|
|
8
|
-
const generic_1 = require("@toa.io/generic");
|
|
9
|
-
const error_value_1 = require("error-value");
|
|
10
|
-
const Scanner_1 = require("./Scanner");
|
|
11
|
-
class Storage {
|
|
1
|
+
import { basename, dirname, join } from 'node:path';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { console } from 'openspan';
|
|
4
|
+
import { Scanner } from './Scanner.js';
|
|
5
|
+
import { operation } from './measurements.js';
|
|
6
|
+
export class Storage {
|
|
12
7
|
provider;
|
|
13
|
-
|
|
8
|
+
scope;
|
|
9
|
+
constructor(provider, scope) {
|
|
14
10
|
this.provider = provider;
|
|
11
|
+
this.scope = scope;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const pipe = stream.pipe(scanner);
|
|
19
|
-
const tempname = await this.transit(pipe);
|
|
20
|
-
if (scanner.error !== null)
|
|
21
|
-
return scanner.error;
|
|
22
|
-
const id = scanner.digest();
|
|
23
|
-
await this.persist(tempname, id);
|
|
24
|
-
return await this.create(path, id, scanner.size, scanner.type, options?.meta);
|
|
13
|
+
options() {
|
|
14
|
+
return this.provider.options;
|
|
25
15
|
}
|
|
26
|
-
async
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
16
|
+
async put(path, stream, options) {
|
|
17
|
+
return await console.span(this.span('put', path), async () => {
|
|
18
|
+
const scanner = new Scanner(options);
|
|
19
|
+
const pipe = stream.pipe(scanner).on('error', () => undefined);
|
|
20
|
+
const id = options?.id ?? randomUUID().replace(/-/g, '');
|
|
21
|
+
const location = this.locate(path, id);
|
|
22
|
+
/**
|
|
23
|
+
* Provider can return or throw an error.
|
|
24
|
+
* If thrown error is TYPE_MISMATCH from the Scanner, it should be returned.
|
|
25
|
+
*/
|
|
26
|
+
const error = await this.provider
|
|
27
|
+
.put(location, pipe)
|
|
28
|
+
.catch((error) => {
|
|
29
|
+
if (error === scanner.error)
|
|
30
|
+
return error;
|
|
31
|
+
else
|
|
32
|
+
throw error;
|
|
33
|
+
});
|
|
34
|
+
if (error instanceof Error)
|
|
35
|
+
return error;
|
|
36
|
+
const metadata = {
|
|
37
|
+
id,
|
|
38
|
+
size: scanner.size,
|
|
39
|
+
type: scanner.type,
|
|
40
|
+
checksum: scanner.digest(),
|
|
41
|
+
created: new Date().toISOString(),
|
|
42
|
+
attributes: options?.attributes ?? {}
|
|
43
|
+
};
|
|
44
|
+
if (options?.origin !== undefined)
|
|
45
|
+
metadata.attributes.origin = options.origin;
|
|
46
|
+
await this.provider.commit(location, metadata);
|
|
47
|
+
return metadata;
|
|
48
|
+
});
|
|
33
49
|
}
|
|
34
|
-
async
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
async get(path, options) {
|
|
51
|
+
return await console.span(this.span('get', dirname(path)), async () => {
|
|
52
|
+
const location = this.locate(path);
|
|
53
|
+
return await this.provider.get(location, options);
|
|
54
|
+
});
|
|
37
55
|
}
|
|
38
|
-
async
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return ERR_NOT_FOUND;
|
|
51
|
-
else
|
|
52
|
-
return stream;
|
|
56
|
+
async head(path) {
|
|
57
|
+
return await console.span(this.span('head', dirname(path)), async () => {
|
|
58
|
+
const id = basename(path).split('.')[0];
|
|
59
|
+
const location = this.locate(path);
|
|
60
|
+
const metadata = await this.provider.head(location);
|
|
61
|
+
if (metadata instanceof Error)
|
|
62
|
+
return metadata;
|
|
63
|
+
return {
|
|
64
|
+
id,
|
|
65
|
+
...metadata
|
|
66
|
+
};
|
|
67
|
+
});
|
|
53
68
|
}
|
|
54
69
|
async delete(path) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
await Promise.all([
|
|
60
|
-
this.provider.delete(paths.metafile),
|
|
61
|
-
this.provider.delete(paths.vardir)
|
|
62
|
-
]);
|
|
63
|
-
}
|
|
64
|
-
async move(path, to) {
|
|
65
|
-
const source = this.destruct(path);
|
|
66
|
-
const rel = to.startsWith('.');
|
|
67
|
-
const dir = to.endsWith('/');
|
|
68
|
-
if (rel)
|
|
69
|
-
to = node_path_1.posix.resolve(source.rel + '/', to);
|
|
70
|
-
if (dir)
|
|
71
|
-
to = node_path_1.posix.join(to, source.ent);
|
|
72
|
-
const target = this.destruct(to);
|
|
73
|
-
await Promise.all([
|
|
74
|
-
this.provider.move(source.metafile, target.metafile),
|
|
75
|
-
this.provider.moveDir(source.vardir, target.vardir)
|
|
76
|
-
]);
|
|
77
|
-
}
|
|
78
|
-
async diversify(path, name, stream) {
|
|
79
|
-
const scanner = new Scanner_1.Scanner();
|
|
80
|
-
const pipe = stream.pipe(scanner);
|
|
81
|
-
await this.provider.put(node_path_1.posix.join(ENTRIES_ROOT, path), name, pipe);
|
|
82
|
-
if (scanner.error !== null)
|
|
83
|
-
return scanner.error;
|
|
84
|
-
const { size, type } = scanner;
|
|
85
|
-
const entry = await this.get(path);
|
|
86
|
-
if (entry instanceof Error)
|
|
87
|
-
return entry;
|
|
88
|
-
entry.variants = entry.variants.filter((variant) => variant.name !== name);
|
|
89
|
-
entry.variants.push({ name, size, type });
|
|
90
|
-
await this.save(path, entry);
|
|
70
|
+
return await console.span(this.span('delete', dirname(path)), async () => {
|
|
71
|
+
const location = this.locate(path);
|
|
72
|
+
return await this.provider.delete(location);
|
|
73
|
+
});
|
|
91
74
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Where the file is read straight from the provider, by whoever is given the address and with
|
|
77
|
+
* no credentials of their own: a model, a browser, another service. A signed address is good for
|
|
78
|
+
* `expires` seconds, an hour unless asked otherwise and a week at most. `NOT_FOUND` is a file the
|
|
79
|
+
* storage does not have, where the provider can tell; `NO_URL` is a storage that serves no
|
|
80
|
+
* address of its own.
|
|
81
|
+
*/
|
|
82
|
+
async url(path, options) {
|
|
83
|
+
return await console.span(this.span('url', dirname(path)), async () => {
|
|
84
|
+
const expires = Math.min(options?.expires ?? HOUR, WEEK);
|
|
85
|
+
return await this.provider.url(this.locate(path), expires);
|
|
86
|
+
});
|
|
102
87
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
await this.provider.put(TEMP, tempname, stream);
|
|
106
|
-
return tempname;
|
|
88
|
+
path() {
|
|
89
|
+
return this.provider.root ?? null;
|
|
107
90
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const blob = node_path_1.posix.join(BLOBs, id);
|
|
111
|
-
await this.provider.move(temp, blob);
|
|
91
|
+
locate(...rel) {
|
|
92
|
+
return join(ENTRIES, ...rel);
|
|
112
93
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
94
|
+
span(method, path) {
|
|
95
|
+
return {
|
|
96
|
+
name: `${method} ${this.scope?.name ?? 'storage'}`,
|
|
97
|
+
kind: 'client',
|
|
98
|
+
attributes: {
|
|
99
|
+
...(this.scope === undefined ? {} : { provider: this.scope.provider }),
|
|
100
|
+
path
|
|
101
|
+
},
|
|
102
|
+
measure: operation(method, this.scope)
|
|
122
103
|
};
|
|
123
|
-
const metafile = node_path_1.posix.join(path, entry.id);
|
|
124
|
-
const existing = await this.get(metafile);
|
|
125
|
-
if (existing instanceof Error)
|
|
126
|
-
await this.save(metafile, entry);
|
|
127
|
-
return entry;
|
|
128
|
-
}
|
|
129
|
-
async save(path, entry) {
|
|
130
|
-
const paths = this.destruct(path);
|
|
131
|
-
const stream = node_stream_1.Readable.from((0, msgpackr_1.encode)(entry));
|
|
132
|
-
await this.provider.put(paths.metadir, paths.ent, stream);
|
|
133
|
-
}
|
|
134
|
-
parse(path) {
|
|
135
|
-
const [last, ...segments] = path.split('/').reverse();
|
|
136
|
-
const [id, ...rest] = last.split('.');
|
|
137
|
-
const variant = rest.length > 0 ? rest.join('.') : null;
|
|
138
|
-
const rel = segments.reverse().join('/');
|
|
139
|
-
return { rel, id, variant };
|
|
140
|
-
}
|
|
141
|
-
destruct(path) {
|
|
142
|
-
const rel = node_path_1.posix.dirname(path);
|
|
143
|
-
const dir = node_path_1.posix.join(ENTRIES_ROOT, rel);
|
|
144
|
-
const ent = node_path_1.posix.basename(path);
|
|
145
|
-
const metadir = node_path_1.posix.join(dir, ENTRIES_DIR);
|
|
146
|
-
const metafile = node_path_1.posix.join(metadir, ent);
|
|
147
|
-
const vardir = node_path_1.posix.join(dir, ent);
|
|
148
|
-
return { rel, dir, ent, metadir, metafile, vardir };
|
|
149
104
|
}
|
|
150
105
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
const ENTRIES_DIR = '.meta';
|
|
106
|
+
const ENTRIES = '/';
|
|
107
|
+
/** How long a signed address is good for, unless asked otherwise, s. */
|
|
108
|
+
const HOUR = 60 * 60;
|
|
109
|
+
/** The longest a signed address is good for: what S3 signs for, s. */
|
|
110
|
+
const WEEK = 7 * 24 * HOUR;
|
|
157
111
|
//# sourceMappingURL=Storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../source/Storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../source/Storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,OAAO,EAAoB,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAM7C,MAAM,OAAO,OAAO;IACD,QAAQ,CAAG;IACX,KAAK,CAAQ;IAE9B,YAAmB,QAAW,EAAE,KAAa;QAC3C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACx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