memfs 4.36.2 → 4.37.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.
Files changed (80) hide show
  1. package/README.md +6 -10
  2. package/lib/fsa/CoreFileSystemHandle.d.ts +1 -1
  3. package/lib/fsa/CoreFileSystemHandle.js +1 -1
  4. package/lib/fsa/CoreFileSystemHandle.js.map +1 -1
  5. package/lib/fsa/types.d.ts +1 -1
  6. package/lib/fsa-to-node/FsaNodeFs.js +8 -24
  7. package/lib/fsa-to-node/FsaNodeFs.js.map +1 -1
  8. package/lib/fsa-to-node/FsaNodeReadStream.d.ts +2 -2
  9. package/lib/fsa-to-node/FsaNodeReadStream.js +2 -2
  10. package/lib/fsa-to-node/FsaNodeReadStream.js.map +1 -1
  11. package/lib/fsa-to-node/FsaNodeWriteStream.d.ts +1 -1
  12. package/lib/fsa-to-node/FsaNodeWriteStream.js +2 -2
  13. package/lib/fsa-to-node/FsaNodeWriteStream.js.map +1 -1
  14. package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.js +1 -1
  15. package/lib/fsa-to-node/worker/FsaNodeSyncAdapterWorker.js.map +1 -1
  16. package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.d.ts +4 -4
  17. package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.js +4 -3
  18. package/lib/node-to-fsa/NodeFileSystemDirectoryHandle.js.map +1 -1
  19. package/lib/node-to-fsa/NodeFileSystemHandle.d.ts +6 -2
  20. package/lib/node-to-fsa/NodeFileSystemHandle.js +27 -2
  21. package/lib/node-to-fsa/NodeFileSystemHandle.js.map +1 -1
  22. package/lib/node-to-fsa/types.d.ts +1 -1
  23. package/package.json +5 -4
  24. package/lib/cas/types.d.ts +0 -10
  25. package/lib/cas/types.js +0 -3
  26. package/lib/cas/types.js.map +0 -1
  27. package/lib/crud/types.d.ts +0 -83
  28. package/lib/crud/types.js +0 -3
  29. package/lib/crud/types.js.map +0 -1
  30. package/lib/crud/util.d.ts +0 -2
  31. package/lib/crud/util.js +0 -11
  32. package/lib/crud/util.js.map +0 -1
  33. package/lib/crud-to-cas/CrudCas.d.ts +0 -10
  34. package/lib/crud-to-cas/CrudCas.js +0 -15
  35. package/lib/crud-to-cas/CrudCas.js.map +0 -1
  36. package/lib/crud-to-cas/CrudCasBase.d.ts +0 -14
  37. package/lib/crud-to-cas/CrudCasBase.js +0 -58
  38. package/lib/crud-to-cas/CrudCasBase.js.map +0 -1
  39. package/lib/crud-to-cas/index.d.ts +0 -1
  40. package/lib/crud-to-cas/index.js +0 -6
  41. package/lib/crud-to-cas/index.js.map +0 -1
  42. package/lib/crud-to-cas/util.d.ts +0 -2
  43. package/lib/crud-to-cas/util.js +0 -13
  44. package/lib/crud-to-cas/util.js.map +0 -1
  45. package/lib/fsa-to-crud/FsaCrud.d.ts +0 -16
  46. package/lib/fsa-to-crud/FsaCrud.js +0 -211
  47. package/lib/fsa-to-crud/FsaCrud.js.map +0 -1
  48. package/lib/fsa-to-crud/index.d.ts +0 -1
  49. package/lib/fsa-to-crud/index.js +0 -6
  50. package/lib/fsa-to-crud/index.js.map +0 -1
  51. package/lib/fsa-to-crud/util.d.ts +0 -5
  52. package/lib/fsa-to-crud/util.js +0 -12
  53. package/lib/fsa-to-crud/util.js.map +0 -1
  54. package/lib/node-to-crud/NodeCrud.d.ts +0 -23
  55. package/lib/node-to-crud/NodeCrud.js +0 -253
  56. package/lib/node-to-crud/NodeCrud.js.map +0 -1
  57. package/lib/node-to-crud/index.d.ts +0 -1
  58. package/lib/node-to-crud/index.js +0 -6
  59. package/lib/node-to-crud/index.js.map +0 -1
  60. package/lib/thingies/Defer.d.ts +0 -17
  61. package/lib/thingies/Defer.js +0 -25
  62. package/lib/thingies/Defer.js.map +0 -1
  63. package/lib/thingies/concurrency.d.ts +0 -3
  64. package/lib/thingies/concurrency.js +0 -42
  65. package/lib/thingies/concurrency.js.map +0 -1
  66. package/lib/thingies/go.d.ts +0 -3
  67. package/lib/thingies/go.js +0 -9
  68. package/lib/thingies/go.js.map +0 -1
  69. package/lib/thingies/index.d.ts +0 -4
  70. package/lib/thingies/index.js +0 -8
  71. package/lib/thingies/index.js.map +0 -1
  72. package/lib/thingies/of.d.ts +0 -10
  73. package/lib/thingies/of.js +0 -22
  74. package/lib/thingies/of.js.map +0 -1
  75. package/lib/thingies/types.d.ts +0 -1
  76. package/lib/thingies/types.js +0 -3
  77. package/lib/thingies/types.js.map +0 -1
  78. package/lib/webfs/index.d.ts +0 -1
  79. package/lib/webfs/index.js +0 -22
  80. package/lib/webfs/index.js.map +0 -1
@@ -1,10 +0,0 @@
1
- import type { CrudResourceInfo } from '../crud/types';
2
- export interface CasApi<Hash> {
3
- put(blob: Uint8Array): Promise<Hash>;
4
- get(hash: Hash, options?: CasGetOptions): Promise<Uint8Array>;
5
- del(hash: Hash, silent?: boolean): Promise<void>;
6
- info(hash: Hash): Promise<CrudResourceInfo>;
7
- }
8
- export interface CasGetOptions {
9
- skipVerification?: boolean;
10
- }
package/lib/cas/types.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cas/types.ts"],"names":[],"mappings":""}
@@ -1,83 +0,0 @@
1
- export interface CrudApi {
2
- /**
3
- * Creates a new resource, or overwrites an existing one.
4
- *
5
- * @param collection Type of the resource, collection name.
6
- * @param id Id of the resource, document name.
7
- * @param data Blob content of the resource.
8
- * @param options Write behavior options.
9
- */
10
- put: (collection: CrudCollection, id: string, data: Uint8Array, options?: CrudPutOptions) => Promise<void>;
11
- /**
12
- * Retrieves the content of a resource.
13
- *
14
- * @param collection Type of the resource, collection name.
15
- * @param id Id of the resource, document name.
16
- * @returns Blob content of the resource.
17
- */
18
- get: (collection: CrudCollection, id: string) => Promise<Uint8Array>;
19
- /**
20
- * Deletes a resource.
21
- *
22
- * @param collection Type of the resource, collection name.
23
- * @param id Id of the resource, document name.
24
- * @param silent When true, does not throw an error if the collection or
25
- * resource does not exist. Default is false.
26
- */
27
- del: (collection: CrudCollection, id: string, silent?: boolean) => Promise<void>;
28
- /**
29
- * Fetches information about a resource.
30
- *
31
- * @param collection Type of the resource, collection name.
32
- * @param id Id of the resource, document name, if any.
33
- * @returns Information about the resource.
34
- */
35
- info: (collection: CrudCollection, id?: string) => Promise<CrudResourceInfo>;
36
- /**
37
- * Deletes all resources of a collection, and deletes recursively all sub-collections.
38
- *
39
- * @param collection Type of the resource, collection name.
40
- * @param silent When true, does not throw an error if the collection or
41
- * resource does not exist. Default is false.
42
- */
43
- drop: (collection: CrudCollection, silent?: boolean) => Promise<void>;
44
- /**
45
- * Iterates over all resources of a collection.
46
- *
47
- * @param collection Type of the resource, collection name.
48
- * @returns Iterator of resources of the given type.
49
- */
50
- scan: (collection: CrudCollection) => AsyncIterableIterator<CrudCollectionEntry>;
51
- /**
52
- * Fetches a list of resources of a collection, and sub-collections.
53
- *
54
- * @param collection Type of the resource, collection name.
55
- * @returns List of resources of the given type, and sub-types.
56
- */
57
- list: (collection: CrudCollection) => Promise<CrudCollectionEntry[]>;
58
- /**
59
- * Creates a new CrudApi instance, with the given collection as root.
60
- *
61
- * @param collection Type of the resource, collection name.
62
- * @returns A new CrudApi instance, with the given collection as root.
63
- */
64
- from: (collection: CrudCollection) => Promise<CrudApi>;
65
- }
66
- export type CrudCollection = string[];
67
- export interface CrudPutOptions {
68
- throwIf?: 'exists' | 'missing';
69
- }
70
- export interface CrudCollectionEntry {
71
- /** Kind of the resource, type or item. */
72
- type: 'resource' | 'collection';
73
- /** Name of the resource. */
74
- id: string;
75
- }
76
- export interface CrudResourceInfo extends CrudCollectionEntry {
77
- /** Size of the resource in bytes. */
78
- size?: number;
79
- /** Timestamp when the resource last modified. */
80
- modified?: number;
81
- /** Timestamp when the resource was created. */
82
- created?: number;
83
- }
package/lib/crud/types.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/crud/types.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- import { CrudCollection } from './types';
2
- export declare const assertType: (type: CrudCollection, method: string, klass: string) => void;
package/lib/crud/util.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertType = void 0;
4
- const util_1 = require("../node-to-fsa/util");
5
- const assertType = (type, method, klass) => {
6
- const length = type.length;
7
- for (let i = 0; i < length; i++)
8
- (0, util_1.assertName)(type[i], method, klass);
9
- };
10
- exports.assertType = assertType;
11
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/crud/util.ts"],"names":[],"mappings":";;;AACA,8CAAiD;AAE1C,MAAM,UAAU,GAAG,CAAC,IAAoB,EAAE,MAAc,EAAE,KAAa,EAAQ,EAAE;IACtF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE;QAAE,IAAA,iBAAU,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACtE,CAAC,CAAC;AAHW,QAAA,UAAU,cAGrB"}
@@ -1,10 +0,0 @@
1
- import { CrudCasBase } from './CrudCasBase';
2
- import type { CrudApi } from '../crud/types';
3
- export interface CrudCasOptions {
4
- hash: (blob: Uint8Array) => Promise<string>;
5
- }
6
- export declare class CrudCas extends CrudCasBase<string> {
7
- protected readonly crud: CrudApi;
8
- protected readonly options: CrudCasOptions;
9
- constructor(crud: CrudApi, options: CrudCasOptions);
10
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CrudCas = void 0;
4
- const util_1 = require("./util");
5
- const CrudCasBase_1 = require("./CrudCasBase");
6
- const hashEqual = (h1, h2) => h1 === h2;
7
- class CrudCas extends CrudCasBase_1.CrudCasBase {
8
- constructor(crud, options) {
9
- super(crud, options.hash, util_1.hashToLocation, hashEqual);
10
- this.crud = crud;
11
- this.options = options;
12
- }
13
- }
14
- exports.CrudCas = CrudCas;
15
- //# sourceMappingURL=CrudCas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CrudCas.js","sourceRoot":"","sources":["../../src/crud-to-cas/CrudCas.ts"],"names":[],"mappings":";;;AAAA,iCAAwC;AACxC,+CAA4C;AAO5C,MAAM,SAAS,GAAG,CAAC,EAAU,EAAE,EAAU,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;AAExD,MAAa,OAAQ,SAAQ,yBAAmB;IAC9C,YACqB,IAAa,EACb,OAAuB;QAE1C,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,qBAAc,EAAE,SAAS,CAAC,CAAC;QAHlC,SAAI,GAAJ,IAAI,CAAS;QACb,YAAO,GAAP,OAAO,CAAgB;IAG5C,CAAC;CACF;AAPD,0BAOC"}
@@ -1,14 +0,0 @@
1
- import type { CasApi, CasGetOptions } from '../cas/types';
2
- import type { CrudApi, CrudResourceInfo } from '../crud/types';
3
- import type { FsLocation } from '../fsa-to-node/types';
4
- export declare class CrudCasBase<Hash> implements CasApi<Hash> {
5
- protected readonly crud: CrudApi;
6
- protected readonly hash: (blob: Uint8Array) => Promise<Hash>;
7
- protected readonly hash2Loc: (hash: Hash) => FsLocation;
8
- protected readonly hashEqual: (h1: Hash, h2: Hash) => boolean;
9
- constructor(crud: CrudApi, hash: (blob: Uint8Array) => Promise<Hash>, hash2Loc: (hash: Hash) => FsLocation, hashEqual: (h1: Hash, h2: Hash) => boolean);
10
- readonly put: (blob: Uint8Array) => Promise<Hash>;
11
- readonly get: (hash: Hash, options?: CasGetOptions) => Promise<Uint8Array>;
12
- readonly del: (hash: Hash, silent?: boolean) => Promise<void>;
13
- readonly info: (hash: Hash) => Promise<CrudResourceInfo>;
14
- }
@@ -1,58 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CrudCasBase = void 0;
4
- const normalizeErrors = async (code) => {
5
- try {
6
- return await code();
7
- }
8
- catch (error) {
9
- if (error && typeof error === 'object') {
10
- switch (error.name) {
11
- case 'ResourceNotFound':
12
- case 'CollectionNotFound':
13
- throw new DOMException(error.message, 'BlobNotFound');
14
- }
15
- }
16
- throw error;
17
- }
18
- };
19
- class CrudCasBase {
20
- constructor(crud, hash, hash2Loc, hashEqual) {
21
- this.crud = crud;
22
- this.hash = hash;
23
- this.hash2Loc = hash2Loc;
24
- this.hashEqual = hashEqual;
25
- this.put = async (blob) => {
26
- const digest = await this.hash(blob);
27
- const [collection, resource] = this.hash2Loc(digest);
28
- await this.crud.put(collection, resource, blob);
29
- return digest;
30
- };
31
- this.get = async (hash, options) => {
32
- const [collection, resource] = this.hash2Loc(hash);
33
- return await normalizeErrors(async () => {
34
- const blob = await this.crud.get(collection, resource);
35
- if (!(options === null || options === void 0 ? void 0 : options.skipVerification)) {
36
- const digest = await this.hash(blob);
37
- if (!this.hashEqual(digest, hash))
38
- throw new DOMException('Blob contents does not match hash', 'Integrity');
39
- }
40
- return blob;
41
- });
42
- };
43
- this.del = async (hash, silent) => {
44
- const [collection, resource] = this.hash2Loc(hash);
45
- await normalizeErrors(async () => {
46
- return await this.crud.del(collection, resource, silent);
47
- });
48
- };
49
- this.info = async (hash) => {
50
- const [collection, resource] = this.hash2Loc(hash);
51
- return await normalizeErrors(async () => {
52
- return await this.crud.info(collection, resource);
53
- });
54
- };
55
- }
56
- }
57
- exports.CrudCasBase = CrudCasBase;
58
- //# sourceMappingURL=CrudCasBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CrudCasBase.js","sourceRoot":"","sources":["../../src/crud-to-cas/Crud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 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CrudCas = void 0;
4
- var CrudCas_1 = require("./CrudCas");
5
- Object.defineProperty(exports, "CrudCas", { enumerable: true, get: function () { return CrudCas_1.CrudCas; } });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crud-to-cas/index.ts"],"names":[],"mappings":";;;AAAA,qCAAoD;AAA3C,kGAAA,OAAO,OAAA"}
@@ -1,2 +0,0 @@
1
- import type { FsLocation } from '../fsa-to-node/types';
2
- export declare const hashToLocation: (hash: string) => FsLocation;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hashToLocation = void 0;
4
- const hashToLocation = (hash) => {
5
- if (hash.length < 20)
6
- throw new TypeError('Hash is too short');
7
- const lastTwo = hash.slice(-2);
8
- const twoBeforeLastTwo = hash.slice(-4, -2);
9
- const folder = [lastTwo, twoBeforeLastTwo];
10
- return [folder, hash];
11
- };
12
- exports.hashToLocation = hashToLocation;
13
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/crud-to-cas/util.ts"],"names":[],"mappings":";;;AAEO,MAAM,cAAc,GAAG,CAAC,IAAY,EAAc,EAAE;IACzD,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;IAC3C,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACxB,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB"}
@@ -1,16 +0,0 @@
1
- import type * as crud from '../crud/types';
2
- import type * as fsa from '../fsa/types';
3
- export declare class FsaCrud implements crud.CrudApi {
4
- protected readonly root: fsa.IFileSystemDirectoryHandle | Promise<fsa.IFileSystemDirectoryHandle>;
5
- constructor(root: fsa.IFileSystemDirectoryHandle | Promise<fsa.IFileSystemDirectoryHandle>);
6
- protected getDir(collection: crud.CrudCollection, create: boolean): Promise<[dir: fsa.IFileSystemDirectoryHandle, parent: fsa.IFileSystemDirectoryHandle | undefined]>;
7
- protected getFile(collection: crud.CrudCollection, id: string): Promise<[dir: fsa.IFileSystemDirectoryHandle, file: fsa.IFileSystemFileHandle]>;
8
- readonly put: (collection: crud.CrudCollection, id: string, data: Uint8Array, options?: crud.CrudPutOptions) => Promise<void>;
9
- readonly get: (collection: crud.CrudCollection, id: string) => Promise<Uint8Array>;
10
- readonly del: (collection: crud.CrudCollection, id: string, silent?: boolean) => Promise<void>;
11
- readonly info: (collection: crud.CrudCollection, id?: string) => Promise<crud.CrudResourceInfo>;
12
- readonly drop: (collection: crud.CrudCollection, silent?: boolean) => Promise<void>;
13
- readonly scan: (collection: crud.CrudCollection) => AsyncIterableIterator<crud.CrudCollectionEntry>;
14
- readonly list: (collection: crud.CrudCollection) => Promise<crud.CrudCollectionEntry[]>;
15
- readonly from: (collection: crud.CrudCollection) => Promise<crud.CrudApi>;
16
- }
@@ -1,211 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FsaCrud = void 0;
4
- const tslib_1 = require("tslib");
5
- const util_1 = require("../node-to-fsa/util");
6
- const util_2 = require("../crud/util");
7
- const util_3 = require("./util");
8
- class FsaCrud {
9
- constructor(root) {
10
- this.root = root;
11
- this.put = async (collection, id, data, options) => {
12
- (0, util_2.assertType)(collection, 'put', 'crudfs');
13
- (0, util_1.assertName)(id, 'put', 'crudfs');
14
- const [dir] = await this.getDir(collection, true);
15
- let file;
16
- switch (options === null || options === void 0 ? void 0 : options.throwIf) {
17
- case 'exists': {
18
- try {
19
- file = await dir.getFileHandle(id, { create: false });
20
- throw (0, util_3.newExistsError)();
21
- }
22
- catch (e) {
23
- if (e.name !== 'NotFoundError')
24
- throw e;
25
- file = await dir.getFileHandle(id, { create: true });
26
- }
27
- break;
28
- }
29
- case 'missing': {
30
- try {
31
- file = await dir.getFileHandle(id, { create: false });
32
- }
33
- catch (e) {
34
- if (e.name === 'NotFoundError')
35
- throw (0, util_3.newMissingError)();
36
- throw e;
37
- }
38
- break;
39
- }
40
- default: {
41
- file = await dir.getFileHandle(id, { create: true });
42
- }
43
- }
44
- const writable = await file.createWritable();
45
- await writable.write(data);
46
- await writable.close();
47
- };
48
- this.get = async (collection, id) => {
49
- (0, util_2.assertType)(collection, 'get', 'crudfs');
50
- (0, util_1.assertName)(id, 'get', 'crudfs');
51
- const [, file] = await this.getFile(collection, id);
52
- const blob = await file.getFile();
53
- const buffer = await blob.arrayBuffer();
54
- return new Uint8Array(buffer);
55
- };
56
- this.del = async (collection, id, silent) => {
57
- (0, util_2.assertType)(collection, 'del', 'crudfs');
58
- (0, util_1.assertName)(id, 'del', 'crudfs');
59
- try {
60
- const [dir] = await this.getFile(collection, id);
61
- await dir.removeEntry(id, { recursive: false });
62
- }
63
- catch (error) {
64
- if (!silent)
65
- throw error;
66
- }
67
- };
68
- this.info = async (collection, id) => {
69
- (0, util_2.assertType)(collection, 'info', 'crudfs');
70
- if (id) {
71
- (0, util_1.assertName)(id, 'info', 'crudfs');
72
- const [, file] = await this.getFile(collection, id);
73
- const blob = await file.getFile();
74
- return {
75
- type: 'resource',
76
- id,
77
- size: blob.size,
78
- modified: blob.lastModified,
79
- };
80
- }
81
- else {
82
- await this.getDir(collection, false);
83
- return {
84
- type: 'collection',
85
- id: '',
86
- };
87
- }
88
- };
89
- this.drop = async (collection, silent) => {
90
- var _a, e_1, _b, _c;
91
- (0, util_2.assertType)(collection, 'drop', 'crudfs');
92
- try {
93
- const [dir, parent] = await this.getDir(collection, false);
94
- if (parent) {
95
- await parent.removeEntry(dir.name, { recursive: true });
96
- }
97
- else {
98
- const root = await this.root;
99
- try {
100
- for (var _d = true, _e = tslib_1.__asyncValues(root.keys()), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
101
- _c = _f.value;
102
- _d = false;
103
- const name = _c;
104
- await root.removeEntry(name, { recursive: true });
105
- }
106
- }
107
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
108
- finally {
109
- try {
110
- if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
111
- }
112
- finally { if (e_1) throw e_1.error; }
113
- }
114
- }
115
- }
116
- catch (error) {
117
- if (!silent)
118
- throw error;
119
- }
120
- };
121
- this.scan = function (collection) {
122
- return tslib_1.__asyncGenerator(this, arguments, function* () {
123
- var _a, e_2, _b, _c;
124
- (0, util_2.assertType)(collection, 'scan', 'crudfs');
125
- const [dir] = yield tslib_1.__await(this.getDir(collection, false));
126
- try {
127
- for (var _d = true, _e = tslib_1.__asyncValues(dir.entries()), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a; _d = true) {
128
- _c = _f.value;
129
- _d = false;
130
- const [id, handle] = _c;
131
- if (handle.kind === 'file') {
132
- yield yield tslib_1.__await({
133
- type: 'resource',
134
- id,
135
- });
136
- }
137
- else if (handle.kind === 'directory') {
138
- yield yield tslib_1.__await({
139
- type: 'collection',
140
- id,
141
- });
142
- }
143
- }
144
- }
145
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
146
- finally {
147
- try {
148
- if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
149
- }
150
- finally { if (e_2) throw e_2.error; }
151
- }
152
- });
153
- };
154
- this.list = async (collection) => {
155
- var _a, e_3, _b, _c;
156
- const entries = [];
157
- try {
158
- for (var _d = true, _e = tslib_1.__asyncValues(this.scan(collection)), _f; _f = await _e.next(), _a = _f.done, !_a; _d = true) {
159
- _c = _f.value;
160
- _d = false;
161
- const entry = _c;
162
- entries.push(entry);
163
- }
164
- }
165
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
166
- finally {
167
- try {
168
- if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
169
- }
170
- finally { if (e_3) throw e_3.error; }
171
- }
172
- return entries;
173
- };
174
- this.from = async (collection) => {
175
- (0, util_2.assertType)(collection, 'from', 'crudfs');
176
- const [dir] = await this.getDir(collection, true);
177
- return new FsaCrud(dir);
178
- };
179
- }
180
- async getDir(collection, create) {
181
- let parent = undefined;
182
- let dir = await this.root;
183
- try {
184
- for (const name of collection) {
185
- const child = await dir.getDirectoryHandle(name, { create });
186
- parent = dir;
187
- dir = child;
188
- }
189
- return [dir, parent];
190
- }
191
- catch (error) {
192
- if (error.name === 'NotFoundError')
193
- throw (0, util_3.newFolder404Error)(collection);
194
- throw error;
195
- }
196
- }
197
- async getFile(collection, id) {
198
- const [dir] = await this.getDir(collection, false);
199
- try {
200
- const file = await dir.getFileHandle(id, { create: false });
201
- return [dir, file];
202
- }
203
- catch (error) {
204
- if (error.name === 'NotFoundError')
205
- throw (0, util_3.newFile404Error)(collection, id);
206
- throw error;
207
- }
208
- }
209
- }
210
- exports.FsaCrud = FsaCrud;
211
- //# sourceMappingURL=FsaCrud.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FsaCrud.js","sourceRoot":"","sources":["../../src/fsa-to-crud/FsaCrud.ts"],"names":[],"mappings":";;;;AAEA,8CAAiD;AACjD,uCAA0C;AAC1C,iCAA6F;AAE7F,MAAa,OAAO;IAClB,YACqB,IAA8E;QAA9E,SAAI,GAAJ,IAAI,CAA0E;QAoCnF,QAAG,GAAG,KAAK,EACzB,UAA+B,EAC/B,EAAU,EACV,IAAgB,EAChB,OAA6B,EACd,EAAE;YACjB,IAAA,iBAAU,EAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YACxC,IAAA,iBAAU,EAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC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;YAC5D,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe;gBAAE,MAAM,IAAA,sBAAe,EAAC,UAAU,EAAE,EAAE,CAAC,CAAC;YAC1E,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAgIF;AApKD,0BAoKC"}
@@ -1 +0,0 @@
1
- export { FsaCrud } from './FsaCrud';
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FsaCrud = void 0;
4
- var FsaCrud_1 = require("./FsaCrud");
5
- Object.defineProperty(exports, "FsaCrud", { enumerable: true, get: function () { return FsaCrud_1.FsaCrud; } });
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fsa-to-crud/index.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
@@ -1,5 +0,0 @@
1
- import type * as crud from '../crud/types';
2
- export declare const newFile404Error: (collection: crud.CrudCollection, id: string) => DOMException;
3
- export declare const newFolder404Error: (collection: crud.CrudCollection) => DOMException;
4
- export declare const newExistsError: () => DOMException;
5
- export declare const newMissingError: () => DOMException;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newMissingError = exports.newExistsError = exports.newFolder404Error = exports.newFile404Error = void 0;
4
- const newFile404Error = (collection, id) => new DOMException(`Resource "${id}" in /${collection.join('/')} not found`, 'ResourceNotFound');
5
- exports.newFile404Error = newFile404Error;
6
- const newFolder404Error = (collection) => new DOMException(`Collection /${collection.join('/')} does not exist`, 'CollectionNotFound');
7
- exports.newFolder404Error = newFolder404Error;
8
- const newExistsError = () => new DOMException('Resource already exists', 'Exists');
9
- exports.newExistsError = newExistsError;
10
- const newMissingError = () => new DOMException('Resource is missing', 'Missing');
11
- exports.newMissingError = newMissingError;
12
- //# sourceMappingURL=util.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/fsa-to-crud/util.ts"],"names":[],"mappings":";;;AAEO,MAAM,eAAe,GAAG,CAAC,UAA+B,EAAE,EAAU,EAAE,EAAE,CAC7E,IAAI,YAAY,CAAC,aAAa,EAAE,SAAS,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AADpF,QAAA,eAAe,mBACqE;AAE1F,MAAM,iBAAiB,GAAG,CAAC,UAA+B,EAAE,EAAE,CACnE,IAAI,YAAY,CAAC,eAAe,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,CAAC;AADlF,QAAA,iBAAiB,qBACiE;AAExF,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,yBAAyB,EAAE,QAAQ,CAAC,CAAC;AAA7E,QAAA,cAAc,kBAA+D;AAEnF,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAC;AAA3E,QAAA,eAAe,mBAA4D"}
@@ -1,23 +0,0 @@
1
- import type { FsPromisesApi } from '../node/types';
2
- import type * as crud from '../crud/types';
3
- export interface NodeCrudOptions {
4
- readonly fs: FsPromisesApi;
5
- readonly dir: string;
6
- readonly separator?: string;
7
- }
8
- export declare class NodeCrud implements crud.CrudApi {
9
- protected readonly options: NodeCrudOptions;
10
- protected readonly fs: FsPromisesApi;
11
- protected readonly dir: string;
12
- protected readonly separator: string;
13
- constructor(options: NodeCrudOptions);
14
- protected checkDir(collection: crud.CrudCollection): Promise<string>;
15
- readonly put: (collection: crud.CrudCollection, id: string, data: Uint8Array, options?: crud.CrudPutOptions) => Promise<void>;
16
- readonly get: (collection: crud.CrudCollection, id: string) => Promise<Uint8Array>;
17
- readonly del: (collection: crud.CrudCollection, id: string, silent?: boolean) => Promise<void>;
18
- readonly info: (collection: crud.CrudCollection, id?: string) => Promise<crud.CrudResourceInfo>;
19
- readonly drop: (collection: crud.CrudCollection, silent?: boolean) => Promise<void>;
20
- readonly scan: (collection: crud.CrudCollection) => AsyncIterableIterator<crud.CrudCollectionEntry>;
21
- readonly list: (collection: crud.CrudCollection) => Promise<crud.CrudCollectionEntry[]>;
22
- readonly from: (collection: crud.CrudCollection) => Promise<crud.CrudApi>;
23
- }