@e280/quay 0.0.0-11 → 0.0.0-13
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/README.md +59 -0
- package/package.json +2 -1
- package/s/cellar/cask.ts +13 -7
- package/s/cellar/cellar.test.ts +20 -18
- package/s/cellar/cellar.ts +3 -3
- package/s/cellar/forklift.ts +2 -2
- package/s/cellar/memory-forklift.ts +4 -3
- package/s/cellar/opfs-forklift.ts +4 -6
- package/s/dom/components/browser/style.css.ts +30 -30
- package/s/dom/components/dropzone/style.css.ts +11 -12
- package/s/dom/components/filter/component.ts +2 -2
- package/s/dom/components/searchbar/component.ts +5 -2
- package/s/dom/components/sort/component.ts +3 -3
- package/s/dom/theme.css.ts +28 -0
- package/s/dom/views/tree/style.css.ts +9 -9
- package/s/logic/aspects/codex/parts/hierarchy.ts +1 -0
- package/s/logic/group.ts +5 -3
- package/s/logic/presets/media/library.test.ts +41 -14
- package/s/logic/presets/media/library.ts +25 -17
- package/x/cellar/cask.d.ts +4 -4
- package/x/cellar/cask.js +13 -9
- package/x/cellar/cask.js.map +1 -1
- package/x/cellar/cellar.d.ts +1 -1
- package/x/cellar/cellar.js +3 -3
- package/x/cellar/cellar.js.map +1 -1
- package/x/cellar/cellar.test.js +19 -18
- package/x/cellar/cellar.test.js.map +1 -1
- package/x/cellar/forklift.d.ts +2 -2
- package/x/cellar/memory-forklift.d.ts +2 -2
- package/x/cellar/memory-forklift.js +3 -2
- package/x/cellar/memory-forklift.js.map +1 -1
- package/x/cellar/opfs-forklift.d.ts +2 -2
- package/x/cellar/opfs-forklift.js +3 -5
- package/x/cellar/opfs-forklift.js.map +1 -1
- package/x/demo/main.bundle.min.js +104 -71
- package/x/demo/main.bundle.min.js.map +2 -2
- package/x/dom/components/browser/style.css.js +30 -29
- package/x/dom/components/browser/style.css.js.map +1 -1
- package/x/dom/components/dropzone/style.css.js +11 -11
- package/x/dom/components/filter/component.js +2 -2
- package/x/dom/components/searchbar/component.js +5 -1
- package/x/dom/components/searchbar/component.js.map +1 -1
- package/x/dom/components/sort/component.js +3 -3
- package/x/dom/theme.css.js +28 -0
- package/x/dom/theme.css.js.map +1 -1
- package/x/dom/views/tree/style.css.js +9 -9
- package/x/index.html +2 -2
- package/x/logic/aspects/codex/parts/hierarchy.js +1 -0
- package/x/logic/aspects/codex/parts/hierarchy.js.map +1 -1
- package/x/logic/group.d.ts +3 -3
- package/x/logic/group.js +3 -2
- package/x/logic/group.js.map +1 -1
- package/x/logic/presets/media/library.d.ts +4 -40
- package/x/logic/presets/media/library.js +21 -16
- package/x/logic/presets/media/library.js.map +1 -1
- package/x/logic/presets/media/library.test.d.ts +3 -2
- package/x/logic/presets/media/library.test.js +34 -14
- package/x/logic/presets/media/library.test.js.map +1 -1
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
import { Txt } from "@e280/stz";
|
|
2
2
|
import { expect, Science, test } from "@e280/science";
|
|
3
3
|
import { MediaLibrary } from "./library.js";
|
|
4
|
+
import { Permissions } from "../../permissions.js";
|
|
4
5
|
delete globalThis.localStorage;
|
|
5
6
|
export default Science.suite({
|
|
6
|
-
"
|
|
7
|
+
"uploads files into cellar and index": test(async () => {
|
|
7
8
|
const group = new MediaLibrary();
|
|
8
|
-
|
|
9
|
-
const
|
|
9
|
+
await group.upload([file("hello.txt", "hello")], group.config.root);
|
|
10
|
+
const record = await recordByLabel(group, "hello.txt");
|
|
11
|
+
const item = group.findByHash(record.hash);
|
|
12
|
+
expect(item.specimen.label).is("hello.txt");
|
|
10
13
|
expect(await group.cellar.has(record.hash)).is(true);
|
|
11
|
-
|
|
14
|
+
}),
|
|
15
|
+
"upload respects upload permission": test(async () => {
|
|
16
|
+
const group = new MediaLibrary();
|
|
17
|
+
const file = new File([Txt.toBytes("hello")], "hello.txt", { type: "text/plain" });
|
|
18
|
+
group.config.permissions = () => Permissions.readOnly;
|
|
19
|
+
expect(() => group.upload([file], group.config.root)).throws();
|
|
12
20
|
}),
|
|
13
21
|
"lists media records": test(async () => {
|
|
14
22
|
const store = new MediaLibrary();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const records = [];
|
|
18
|
-
for await (const record of store.records())
|
|
19
|
-
records.push(record);
|
|
20
|
-
expect(records.some(r => r.hash === record.hash)).is(true);
|
|
23
|
+
await store.upload([file("image.png", "image", "image/png")], store.config.root);
|
|
24
|
+
expect(await recordByLabel(store, "image.png")).ok();
|
|
21
25
|
}),
|
|
22
|
-
"
|
|
26
|
+
"deletes media records and bytes": test(async () => {
|
|
23
27
|
const store = new MediaLibrary();
|
|
24
|
-
|
|
25
|
-
const record = await store.
|
|
26
|
-
|
|
28
|
+
await store.upload([file("delete.png", "delete-image", "image/png")], store.config.root);
|
|
29
|
+
const record = await recordByLabel(store, "delete.png");
|
|
30
|
+
const item = store.findByHash(record.hash);
|
|
31
|
+
await store.delete(item);
|
|
27
32
|
expect(await store.cellar.has(record.hash)).is(false);
|
|
28
33
|
expect(store.findByHash(record.hash)).is(undefined);
|
|
29
34
|
}),
|
|
30
35
|
});
|
|
36
|
+
function file(name, text, type = "text/plain") {
|
|
37
|
+
return new File([Txt.toBytes(text)], name, { type });
|
|
38
|
+
}
|
|
39
|
+
async function records(store) {
|
|
40
|
+
const records = [];
|
|
41
|
+
for await (const record of store.records())
|
|
42
|
+
records.push(record);
|
|
43
|
+
return records;
|
|
44
|
+
}
|
|
45
|
+
async function recordByLabel(store, label) {
|
|
46
|
+
const record = (await records(store)).find(r => r.label === label);
|
|
47
|
+
if (!record)
|
|
48
|
+
throw new Error(`expected record "${label}"`);
|
|
49
|
+
return record;
|
|
50
|
+
}
|
|
31
51
|
//# sourceMappingURL=library.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.test.js","sourceRoot":"","sources":["../../../../s/logic/presets/media/library.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAC7B,OAAO,EAAC,MAAM,EAAE,OA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