@haibun/domain-storage 1.30.7 → 1.31.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/build/AStorage.d.ts +11 -6
- package/build/AStorage.js +22 -24
- package/build/AStorage.js.map +1 -1
- package/build/domain-storage.d.ts +23 -18
- package/build/domain-storage.js +7 -0
- package/build/domain-storage.js.map +1 -1
- package/package.json +3 -3
package/build/AStorage.d.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { AStepper, TNamed, TAnyFixme } from
|
|
3
|
-
import { IFile, TLocationOptions, TMediaType } from
|
|
2
|
+
import { AStepper, TNamed, TAnyFixme } from '@haibun/core/build/lib/defs.js';
|
|
3
|
+
import { IFile, TLocationOptions, TMediaType, TPathedOrString } from './domain-storage.js';
|
|
4
|
+
type TTree = Array<IFile | IFileWithEntries>;
|
|
5
|
+
interface IFileWithEntries extends IFile {
|
|
6
|
+
entries: TTree;
|
|
7
|
+
}
|
|
4
8
|
export declare abstract class AStorage extends AStepper {
|
|
5
9
|
abstract readFile(path: string, coding?: string): TAnyFixme;
|
|
6
10
|
abstract readdir(dir: string): Promise<string[]>;
|
|
7
11
|
abstract lstatToIFile(file: string): Promise<IFile>;
|
|
8
|
-
abstract writeFileBuffer(file:
|
|
9
|
-
readTree(dir: string): Promise<
|
|
12
|
+
abstract writeFileBuffer(file: TPathedOrString, contents: Buffer, mediaType: TMediaType): void;
|
|
13
|
+
readTree(dir: string, filter?: string): Promise<TTree>;
|
|
10
14
|
readdirStat(dir: string): Promise<IFile[]>;
|
|
11
|
-
writeFile(file:
|
|
15
|
+
writeFile(file: TPathedOrString, contents: string | Buffer, mediaType: TMediaType): Promise<void>;
|
|
12
16
|
latestFrom(dir: string): Promise<any>;
|
|
13
17
|
abstract mkdir(dir: string): any;
|
|
14
18
|
abstract mkdirp(dir: string): any;
|
|
15
19
|
abstract exists(ntt: string): any;
|
|
16
|
-
webIndexer(dir: string): Promise<string[]> | undefined;
|
|
17
20
|
rmrf(dir: string): Promise<void>;
|
|
18
21
|
fromCaptureLocation(mediaType: TMediaType, ...where: string[]): string;
|
|
22
|
+
fromLocation(mediaType: TMediaType, ...where: string[]): string;
|
|
19
23
|
locator(loc: TLocationOptions, ...where: (string | undefined)[]): string;
|
|
20
24
|
getCaptureLocation(loc: TLocationOptions, app?: string): Promise<string>;
|
|
21
25
|
/**
|
|
@@ -61,3 +65,4 @@ export declare abstract class AStorage extends AStepper {
|
|
|
61
65
|
};
|
|
62
66
|
};
|
|
63
67
|
}
|
|
68
|
+
export {};
|
package/build/AStorage.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CAPTURE, AStepper, OK, DEFAULT_DEST } from
|
|
1
|
+
import { CAPTURE, AStepper, OK, DEFAULT_DEST } from '@haibun/core/build/lib/defs.js';
|
|
2
2
|
import { actionNotOK } from '@haibun/core/build/lib/util/index.js';
|
|
3
|
-
import { setShared } from
|
|
3
|
+
import { setShared } from '@haibun/core/build/steps/vars.js';
|
|
4
4
|
export class AStorage extends AStepper {
|
|
5
|
-
async readTree(dir) {
|
|
5
|
+
async readTree(dir, filter) {
|
|
6
6
|
const entries = await this.readdirStat(dir);
|
|
7
7
|
const tree = [];
|
|
8
8
|
for (const e of entries) {
|
|
9
9
|
if (e.isDirectory) {
|
|
10
|
-
const sub = await this.readTree(e.name.replace(/^\/\//, '/'));
|
|
10
|
+
const sub = await this.readTree(e.name.replace(/^\/\//, '/'), filter);
|
|
11
11
|
tree.push({ ...e, entries: sub });
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
@@ -34,28 +34,26 @@ export class AStorage extends AStepper {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
async latestFrom(dir) {
|
|
37
|
-
const orderReccentFiles = async (dir) => (await this.readdirStat(dir))
|
|
38
|
-
.filter(f => f.isFile)
|
|
39
|
-
.sort((a, b) => b.created - a.created);
|
|
37
|
+
const orderReccentFiles = async (dir) => (await this.readdirStat(dir)).filter((f) => f.isFile).sort((a, b) => b.created - a.created);
|
|
40
38
|
return orderReccentFiles(dir)[0];
|
|
41
39
|
}
|
|
42
|
-
async webIndexer(dir) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
40
|
async rmrf(dir) {
|
|
46
41
|
throw Error(`rmrf not implemented at ${dir}`);
|
|
47
42
|
}
|
|
48
43
|
fromCaptureLocation(mediaType, ...where) {
|
|
49
|
-
return [`./${CAPTURE}`, ...where]
|
|
44
|
+
return this.fromLocation(mediaType, ...[`./${CAPTURE}`, ...where]);
|
|
45
|
+
}
|
|
46
|
+
fromLocation(mediaType, ...where) {
|
|
47
|
+
return where.join('/');
|
|
50
48
|
}
|
|
51
49
|
locator(loc, ...where) {
|
|
52
50
|
const { options } = loc;
|
|
53
|
-
const path = [options.base, CAPTURE, options.DEST || DEFAULT_DEST].concat(where.filter(w => w !== undefined));
|
|
51
|
+
const path = [options.base, CAPTURE, options.DEST || DEFAULT_DEST].concat(where.filter((w) => w !== undefined));
|
|
54
52
|
return '.' + path.join('/');
|
|
55
53
|
}
|
|
56
54
|
async getCaptureLocation(loc, app) {
|
|
57
55
|
const { tag } = loc;
|
|
58
|
-
const locator = this.locator(loc,
|
|
56
|
+
const locator = this.locator(loc, tag.key, `loop-${tag.loop}`, `seq-${tag.sequence}`, `featn-${tag.featureNum}`, `mem-${tag.member}`, app);
|
|
59
57
|
return locator;
|
|
60
58
|
}
|
|
61
59
|
/**
|
|
@@ -65,7 +63,7 @@ export class AStorage extends AStepper {
|
|
|
65
63
|
*/
|
|
66
64
|
pathed(mediaType, f, relativeTo) {
|
|
67
65
|
if (relativeTo) {
|
|
68
|
-
return f.replace(relativeTo, '.');
|
|
66
|
+
return (f || 'FIXMEPATHED').replace(relativeTo, '.');
|
|
69
67
|
}
|
|
70
68
|
return f;
|
|
71
69
|
}
|
|
@@ -91,14 +89,14 @@ export class AStorage extends AStepper {
|
|
|
91
89
|
const text = await this.readFile(where, 'utf-8');
|
|
92
90
|
setShared({ what, value: text }, vstep, this.getWorld());
|
|
93
91
|
return OK;
|
|
94
|
-
}
|
|
92
|
+
},
|
|
95
93
|
},
|
|
96
94
|
testIs: {
|
|
97
95
|
gwta: `text at {where} is {what}`,
|
|
98
96
|
action: async ({ where, what }) => {
|
|
99
97
|
const text = await this.readFile(where, 'utf-8');
|
|
100
98
|
return text === what ? OK : actionNotOK(`text at ${where} is not ${what}; it's ${text}`);
|
|
101
|
-
}
|
|
99
|
+
},
|
|
102
100
|
},
|
|
103
101
|
readText: {
|
|
104
102
|
gwta: `read text from {where}`,
|
|
@@ -106,7 +104,7 @@ export class AStorage extends AStepper {
|
|
|
106
104
|
const text = await this.readFile(where, 'utf-8');
|
|
107
105
|
this.getWorld().logger.log(text);
|
|
108
106
|
return OK;
|
|
109
|
-
}
|
|
107
|
+
},
|
|
110
108
|
},
|
|
111
109
|
listFiles: {
|
|
112
110
|
gwta: `list files from {where}`,
|
|
@@ -114,31 +112,31 @@ export class AStorage extends AStepper {
|
|
|
114
112
|
const files = await this.readdir(where);
|
|
115
113
|
this.getWorld().logger.log(`files from ${where}: ${files.join(', ')}`);
|
|
116
114
|
return OK;
|
|
117
|
-
}
|
|
115
|
+
},
|
|
118
116
|
},
|
|
119
117
|
clearFiles: {
|
|
120
118
|
gwta: `clear files matching {where}`,
|
|
121
119
|
action: async ({ where }) => {
|
|
122
|
-
const dirs = where.split(',').map(d => d.trim());
|
|
120
|
+
const dirs = where.split(',').map((d) => d.trim());
|
|
123
121
|
for (const dir of dirs) {
|
|
124
122
|
await this.rmrf(dir);
|
|
125
123
|
}
|
|
126
124
|
return OK;
|
|
127
|
-
}
|
|
125
|
+
},
|
|
128
126
|
},
|
|
129
127
|
fileExists: {
|
|
130
128
|
gwta: `storage entry {what} exists`,
|
|
131
129
|
action: async ({ what }) => {
|
|
132
130
|
const exists = this.exists(what);
|
|
133
131
|
return exists ? OK : actionNotOK(`file ${what} does not exist`);
|
|
134
|
-
}
|
|
132
|
+
},
|
|
135
133
|
},
|
|
136
134
|
clearAllFiles: {
|
|
137
135
|
gwta: `clear files`,
|
|
138
136
|
action: async () => {
|
|
139
137
|
await this.rmrf('');
|
|
140
138
|
return OK;
|
|
141
|
-
}
|
|
139
|
+
},
|
|
142
140
|
},
|
|
143
141
|
isTheSame: {
|
|
144
142
|
gwta: `{what} is the same as {where}`,
|
|
@@ -146,8 +144,8 @@ export class AStorage extends AStepper {
|
|
|
146
144
|
const c1 = this.readFile(what, 'binary');
|
|
147
145
|
const c2 = this.readFile(where, 'binary');
|
|
148
146
|
return Buffer.from(c1)?.equals(Buffer.from(c2)) ? OK : actionNotOK(`contents are not the same ${what} ${where}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
147
|
+
},
|
|
148
|
+
},
|
|
151
149
|
};
|
|
152
150
|
}
|
|
153
151
|
//# sourceMappingURL=AStorage.js.map
|
package/build/AStorage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AStorage.js","sourceRoot":"","sources":["../src/AStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAU,YAAY,EAAa,MAAM,gCAAgC,
|
|
1
|
+
{"version":3,"file":"AStorage.js","sourceRoot":"","sources":["../src/AStorage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAU,YAAY,EAAa,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAQ7D,MAAM,OAAgB,QAAS,SAAQ,QAAQ;IAM7C,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,MAAe;QACzC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC5C,MAAM,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EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,6BAA6B,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;YACnH,CAAC;SACF;KACF,CAAC;CACH"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WorkspaceContext } from '@haibun/core/build/lib/contexts.js';
|
|
2
2
|
import { TNamed, TVStep, AStepper, TFromDomain, TFileTypeDomain, TExtraOptions, TFeatureResult, TOptions, TTag, TAnyFixme } from '@haibun/core/build/lib/defs.js';
|
|
3
|
+
import { TLogHistory } from '@haibun/core/build/lib/interfaces/logger.js';
|
|
3
4
|
export type TTrackResult = {
|
|
4
5
|
meta: {
|
|
5
6
|
title: string;
|
|
@@ -14,20 +15,12 @@ export type TMissingTracks = {
|
|
|
14
15
|
export type TCoding = TAnyFixme;
|
|
15
16
|
export declare const STORAGE_LOCATION = "STORAGE_LOCATION";
|
|
16
17
|
export declare const STORAGE_ITEM = "STORAGE_ITEM";
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
webReviewIndexer: IWebReviewIndexer;
|
|
20
|
-
}
|
|
21
|
-
export type TWebContext = {
|
|
22
|
-
[name: string]: string;
|
|
18
|
+
export type TPathed = {
|
|
19
|
+
pathed: string;
|
|
23
20
|
};
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
webContext: TWebContext;
|
|
28
|
-
}
|
|
29
|
-
export type TGetLatestPublished = () => Promise<string[]>;
|
|
30
|
-
export type TResolvePublishedReview = (link: string) => Promise<TReviewLink>;
|
|
21
|
+
export declare function isPathed(path: TPathedOrString): path is TPathed;
|
|
22
|
+
export declare function actualPath(path: TPathedOrString): string;
|
|
23
|
+
export type TPathedOrString = TPathed | string;
|
|
31
24
|
export type TReviewLink = {
|
|
32
25
|
link: string;
|
|
33
26
|
title: string;
|
|
@@ -37,6 +30,21 @@ export type TReviewLink = {
|
|
|
37
30
|
success: number;
|
|
38
31
|
};
|
|
39
32
|
};
|
|
33
|
+
export type TResolvePublishedReview = (link: string) => Promise<TReviewLink>;
|
|
34
|
+
export interface IGetPublishedReviews {
|
|
35
|
+
getPublishedReviews: () => Promise<string[]>;
|
|
36
|
+
endpoint: (path: string) => string;
|
|
37
|
+
}
|
|
38
|
+
export interface IWebReviewIndexer {
|
|
39
|
+
getLatestPublished: TGetLatestPublished;
|
|
40
|
+
resolvePublishedReview: TResolvePublishedReview;
|
|
41
|
+
webContext: TWebContext;
|
|
42
|
+
}
|
|
43
|
+
export declare const storageLocation: TFileTypeDomain;
|
|
44
|
+
export type TWebContext = {
|
|
45
|
+
[name: string]: string;
|
|
46
|
+
};
|
|
47
|
+
export type TGetLatestPublished = () => Promise<string[]>;
|
|
40
48
|
export interface IFile {
|
|
41
49
|
name: string;
|
|
42
50
|
isDirectory: boolean;
|
|
@@ -80,7 +88,7 @@ declare const DomainStorage: {
|
|
|
80
88
|
world?: import("@haibun/core/build/lib/defs.js").TWorld;
|
|
81
89
|
close?(): void;
|
|
82
90
|
endFeature?(): void;
|
|
83
|
-
onFailure?(result: import("@haibun/core/build/lib/defs.js").TStepResult): void
|
|
91
|
+
onFailure?(result: import("@haibun/core/build/lib/defs.js").TStepResult, step: TVStep): Promise<void | import("@haibun/core/build/lib/interfaces/logger.js").TMessageContext>;
|
|
84
92
|
setWorld(world: import("@haibun/core/build/lib/defs.js").TWorld, steppers: AStepper[]): Promise<void>;
|
|
85
93
|
getWorld(): import("@haibun/core/build/lib/defs.js").TWorld;
|
|
86
94
|
};
|
|
@@ -101,10 +109,7 @@ export type TLocationOptions = {
|
|
|
101
109
|
mediaType: TMediaType;
|
|
102
110
|
};
|
|
103
111
|
export interface ITrackResults {
|
|
104
|
-
writeTracksFile(loc: TLocationOptions, title: string, result: TFeatureResult, startTime: Date, startOffset: number): TAnyFixme;
|
|
105
|
-
}
|
|
106
|
-
export interface IReviewResult {
|
|
107
|
-
writeReview(loc: TLocationOptions, result: TTrackResult | TMissingTracks, allStartTime: number): TAnyFixme;
|
|
112
|
+
writeTracksFile(loc: TLocationOptions, title: string, result: TFeatureResult, startTime: Date, startOffset: number, logHistory: TLogHistory[]): TAnyFixme;
|
|
108
113
|
}
|
|
109
114
|
/**
|
|
110
115
|
* Normalize the extension. This should probably be reconsidered.
|
package/build/domain-storage.js
CHANGED
|
@@ -2,6 +2,12 @@ import { OK, AStepper } from '@haibun/core/build/lib/defs.js';
|
|
|
2
2
|
import { stringOrError } from '@haibun/core/build/lib/util/index.js';
|
|
3
3
|
export const STORAGE_LOCATION = 'STORAGE_LOCATION';
|
|
4
4
|
export const STORAGE_ITEM = 'STORAGE_ITEM';
|
|
5
|
+
export function isPathed(path) {
|
|
6
|
+
return path.pathed !== undefined;
|
|
7
|
+
}
|
|
8
|
+
export function actualPath(path) {
|
|
9
|
+
return isPathed(path) ? path.pathed : path;
|
|
10
|
+
}
|
|
5
11
|
export const storageLocation = {
|
|
6
12
|
name: STORAGE_LOCATION, fileType: STORAGE_LOCATION, is: 'string', validate: (content) => {
|
|
7
13
|
return undefined;
|
|
@@ -66,6 +72,7 @@ const MAPPED_MEDIA_TYPES = {
|
|
|
66
72
|
otf: 'font/otf',
|
|
67
73
|
};
|
|
68
74
|
const MEDIA_TYPES = {
|
|
75
|
+
webm: 'video',
|
|
69
76
|
html: 'text/html',
|
|
70
77
|
json: 'json',
|
|
71
78
|
video: 'video/mp4',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-storage.js","sourceRoot":"","sources":["../src/domain-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,EAAE,EAAE,QAAQ,EAAuG,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"domain-storage.js","sourceRoot":"","sources":["../src/domain-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,EAAE,EAAE,QAAQ,EAAuG,MAAM,gCAAgC,CAAC;AAEhM,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAOrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAk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AAC;IAC/B,OAAO,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,0BAA0B,CAAC;IACxE,OAAmB,SAAS,CAAC;AAC/B,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AAChD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haibun/domain-storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.31.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
7
7
|
"main": "index.js",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"xversion": "npm run format && git add -A src"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@haibun/context": "1.
|
|
28
|
-
"@haibun/core": "1.
|
|
27
|
+
"@haibun/context": "1.31.0",
|
|
28
|
+
"@haibun/core": "1.31.0"
|
|
29
29
|
},
|
|
30
30
|
"gitHead": "7cf9680bd922fb622fb59f1e6bf5b65284cb8fd5"
|
|
31
31
|
}
|