@_linked/server 2.7.4 → 2.7.5
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @\_linked/server
|
|
2
2
|
|
|
3
|
+
## 2.7.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#61](https://github.com/linked-fw/server/pull/61) [`fd8a5ec`](https://github.com/linked-fw/server/commit/fd8a5ec14f14a91e03ced486582a3ffd698e0967) Thanks [@flyon](https://github.com/flyon)! - `LocalFileStore` no longer extends `Shape`.
|
|
8
|
+
|
|
9
|
+
It used nothing from `Shape`: no `this.id`, no `this.uri`, no `nodeShape`, no
|
|
10
|
+
Shape statics, no property decorators, and no caller anywhere treats it as a
|
|
11
|
+
Shape. The only inherited behaviour was `super({id})` writing an id nothing read.
|
|
12
|
+
|
|
13
|
+
Stores and datasets stopped being Shapes deliberately in core `0e8c86e`
|
|
14
|
+
("datasets are not shapes"), and `Shape`'s instantiation guard is currently
|
|
15
|
+
deferred naming this class as the reason it had to be. This removes one of the
|
|
16
|
+
last obstacles to re-enabling that guard.
|
|
17
|
+
|
|
18
|
+
No API change: the constructor still accepts both the `string` and `{id}` forms,
|
|
19
|
+
and the class still implements `IFileStore` in full.
|
|
20
|
+
|
|
3
21
|
## 2.7.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FileStat, IFileStore, SaveFileOptions } from '@_linked/core/interfaces/IFileStore';
|
|
2
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
3
2
|
/**
|
|
4
3
|
* What `saveFile` stored, and where.
|
|
5
4
|
*
|
|
@@ -14,9 +13,27 @@ export interface SavedFileLocation {
|
|
|
14
13
|
/** The public URL, the same string `saveFile` returns. */
|
|
15
14
|
publicURL: string;
|
|
16
15
|
}
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* A file store is not a Shape.
|
|
18
|
+
*
|
|
19
|
+
* This class used to `extends Shape`, but used nothing from it: no `this.id`, no
|
|
20
|
+
* `this.uri`, no `nodeShape`, no Shape statics, no property decorators, and no
|
|
21
|
+
* caller that treated it as a Shape. The only inherited behaviour was `super({id})`
|
|
22
|
+
* writing an id that nothing ever read.
|
|
23
|
+
*
|
|
24
|
+
* Datasets and stores stopped being Shapes deliberately (core `0e8c86e`,
|
|
25
|
+
* "datasets are not shapes"), and `Shape`'s instantiation guard is currently
|
|
26
|
+
* DEFERRED naming this very class as the reason. Dropping the inheritance removes
|
|
27
|
+
* one of the last obstacles to re-enabling it.
|
|
28
|
+
*/
|
|
29
|
+
export declare class LocalFileStore implements IFileStore {
|
|
18
30
|
private readonly basePath;
|
|
19
31
|
readonly accessURL: string;
|
|
32
|
+
/**
|
|
33
|
+
* `n` names the store. It was previously also accepted as `{id}` because that is
|
|
34
|
+
* `Shape`'s constructor signature; both forms are still taken so existing callers
|
|
35
|
+
* keep working, but neither is stored as a node id any more.
|
|
36
|
+
*/
|
|
20
37
|
constructor(n: string | {
|
|
21
38
|
id: string;
|
|
22
39
|
}, basePath?: string);
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { relativeFileSystemUploadPath } from '@_linked/server-utils/utils/Upload';
|
|
2
2
|
import { publicUploadPath } from '@_linked/server-utils/utils/ServerPaths';
|
|
3
3
|
import { normalizeSaveFileOptions, } from '@_linked/core/interfaces/IFileStore';
|
|
4
|
-
import { Shape } from '@_linked/core/shapes/Shape';
|
|
5
4
|
import { createHash } from 'node:crypto';
|
|
6
5
|
import * as fsSync from 'node:fs';
|
|
7
6
|
import fs from 'node:fs/promises';
|
|
8
7
|
import path from 'node:path';
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* A file store is not a Shape.
|
|
10
|
+
*
|
|
11
|
+
* This class used to `extends Shape`, but used nothing from it: no `this.id`, no
|
|
12
|
+
* `this.uri`, no `nodeShape`, no Shape statics, no property decorators, and no
|
|
13
|
+
* caller that treated it as a Shape. The only inherited behaviour was `super({id})`
|
|
14
|
+
* writing an id that nothing ever read.
|
|
15
|
+
*
|
|
16
|
+
* Datasets and stores stopped being Shapes deliberately (core `0e8c86e`,
|
|
17
|
+
* "datasets are not shapes"), and `Shape`'s instantiation guard is currently
|
|
18
|
+
* DEFERRED naming this very class as the reason. Dropping the inheritance removes
|
|
19
|
+
* one of the last obstacles to re-enabling it.
|
|
20
|
+
*/
|
|
21
|
+
export class LocalFileStore {
|
|
22
|
+
/**
|
|
23
|
+
* `n` names the store. It was previously also accepted as `{id}` because that is
|
|
24
|
+
* `Shape`'s constructor signature; both forms are still taken so existing callers
|
|
25
|
+
* keep working, but neither is stored as a node id any more.
|
|
26
|
+
*/
|
|
10
27
|
constructor(n, basePath = relativeFileSystemUploadPath) {
|
|
11
|
-
if (typeof n === 'string') {
|
|
12
|
-
const uri = `${process.env.DATA_ROOT}/local-filestore/${n}`;
|
|
13
|
-
super({ id: uri });
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
super(n);
|
|
17
|
-
}
|
|
18
28
|
this.accessURL = process.env.SITE_ROOT;
|
|
19
29
|
this.basePath = basePath;
|
|
20
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalFileStore.js","sourceRoot":"","sources":["../../../../src/shapes/filestores/LocalFileStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAIL,wBAAwB,GACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"LocalFileStore.js","sourceRoot":"","sources":["../../../../src/shapes/filestores/LocalFileStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF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