@ibgib/core-gib 0.0.7 → 0.0.10
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 +34 -13
- package/dist/assumptions.respec.d.mts +2 -0
- package/dist/assumptions.respec.d.mts.map +1 -0
- package/dist/assumptions.respec.mjs +41 -0
- package/dist/assumptions.respec.mjs.map +1 -0
- package/dist/common/form/form-helper.d.mts.map +1 -1
- package/dist/common/form/form-helper.mjs +0 -2
- package/dist/common/form/form-helper.mjs.map +1 -1
- package/dist/core-constants.d.mts +0 -2
- package/dist/core-constants.d.mts.map +1 -1
- package/dist/core-constants.mjs +0 -2
- package/dist/core-constants.mjs.map +1 -1
- package/dist/core-helper.respec.d.mts +2 -0
- package/dist/core-helper.respec.d.mts.map +1 -0
- package/dist/core-helper.respec.mjs +53 -0
- package/dist/core-helper.respec.mjs.map +1 -0
- package/dist/core-types.d.mts +24 -2
- package/dist/core-types.d.mts.map +1 -1
- package/dist/respec-gib.node.d.mts +2 -0
- package/dist/respec-gib.node.d.mts.map +1 -0
- package/dist/respec-gib.node.mjs +211 -0
- package/dist/respec-gib.node.mjs.map +1 -0
- package/dist/spec-helper.node.respec.d.mts +12 -0
- package/dist/spec-helper.node.respec.d.mts.map +1 -0
- package/dist/spec-helper.node.respec.mjs +43 -0
- package/dist/spec-helper.node.respec.mjs.map +1 -0
- package/dist/witness/app/app-base-v1.d.mts +1 -0
- package/dist/witness/app/app-base-v1.d.mts.map +1 -1
- package/dist/witness/app/app-base-v1.mjs +48 -11
- package/dist/witness/app/app-base-v1.mjs.map +1 -1
- package/dist/witness/app/app-constants.d.mts +2 -0
- package/dist/witness/app/app-constants.d.mts.map +1 -1
- package/dist/witness/app/app-constants.mjs +2 -0
- package/dist/witness/app/app-constants.mjs.map +1 -1
- package/dist/witness/app/app-helper.d.mts.map +1 -1
- package/dist/witness/app/app-helper.mjs +2 -1
- package/dist/witness/app/app-helper.mjs.map +1 -1
- package/dist/witness/robbot/robbot-base-v1.d.mts +4 -5
- package/dist/witness/robbot/robbot-base-v1.d.mts.map +1 -1
- package/dist/witness/robbot/robbot-base-v1.mjs +29 -1
- package/dist/witness/robbot/robbot-base-v1.mjs.map +1 -1
- package/dist/witness/robbot/robbot-helper.respec.d.mts +2 -0
- package/dist/witness/robbot/robbot-helper.respec.d.mts.map +1 -0
- package/dist/witness/robbot/robbot-helper.respec.mjs +106 -0
- package/dist/witness/robbot/robbot-helper.respec.mjs.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-helper.d.mts +3 -0
- package/dist/witness/space/bootstrap/bootstrap-helper.d.mts.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-helper.mjs +51 -0
- package/dist/witness/space/bootstrap/bootstrap-helper.mjs.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-types.d.mts +117 -0
- package/dist/witness/space/bootstrap/bootstrap-types.d.mts.map +1 -0
- package/dist/witness/space/bootstrap/bootstrap-types.mjs +7 -0
- package/dist/witness/space/bootstrap/bootstrap-types.mjs.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-constants.d.mts +64 -0
- package/dist/witness/space/filesystem-space/filesystem-constants.d.mts.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-constants.mjs +64 -0
- package/dist/witness/space/filesystem-space/filesystem-constants.mjs.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts +180 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.d.mts.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.mjs +1145 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.mjs.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.d.mts +2 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.d.mts.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.mjs +107 -0
- package/dist/witness/space/filesystem-space/filesystem-space-v1.respec.mjs.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-types.d.mts +73 -0
- package/dist/witness/space/filesystem-space/filesystem-types.d.mts.map +1 -0
- package/dist/witness/space/filesystem-space/filesystem-types.mjs +2 -0
- package/dist/witness/space/filesystem-space/filesystem-types.mjs.map +1 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.d.mts +90 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.d.mts.map +1 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.mjs +669 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.mjs.map +1 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.d.mts +2 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.d.mts.map +1 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.mjs +129 -0
- package/dist/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.mjs.map +1 -0
- package/dist/witness/space/{inner-space-v1.d.mts → inner-space/inner-space-v1.d.mts} +2 -2
- package/dist/witness/space/inner-space/inner-space-v1.d.mts.map +1 -0
- package/dist/witness/space/{inner-space-v1.mjs → inner-space/inner-space-v1.mjs} +3 -3
- package/dist/witness/space/inner-space/inner-space-v1.mjs.map +1 -0
- package/dist/witness/space/inner-space/inner-space-v1.respec.d.mts +2 -0
- package/dist/witness/space/inner-space/inner-space-v1.respec.d.mts.map +1 -0
- package/dist/witness/space/inner-space/inner-space-v1.respec.mjs +56 -0
- package/dist/witness/space/inner-space/inner-space-v1.respec.mjs.map +1 -0
- package/dist/witness/space/space-constants.d.mts +0 -27
- package/dist/witness/space/space-constants.d.mts.map +1 -1
- package/dist/witness/space/space-constants.mjs +0 -27
- package/dist/witness/space/space-constants.mjs.map +1 -1
- package/dist/witness/space/space-helper.d.mts +3 -3
- package/dist/witness/space/space-helper.d.mts.map +1 -1
- package/dist/witness/space/space-helper.mjs +6 -51
- package/dist/witness/space/space-helper.mjs.map +1 -1
- package/dist/witness/space/space-respec-helper.d.mts +71 -0
- package/dist/witness/space/space-respec-helper.d.mts.map +1 -0
- package/dist/witness/space/space-respec-helper.mjs +186 -0
- package/dist/witness/space/space-respec-helper.mjs.map +1 -0
- package/dist/witness/space/space-types.d.mts +0 -98
- package/dist/witness/space/space-types.d.mts.map +1 -1
- package/dist/witness/space/space-types.mjs +0 -1
- package/dist/witness/space/space-types.mjs.map +1 -1
- package/dist/witness/witness-base-v1.d.mts.map +1 -1
- package/dist/witness/witness-base-v1.mjs +7 -7
- package/dist/witness/witness-base-v1.mjs.map +1 -1
- package/dist/witness/witness-helper.d.mts +8 -0
- package/dist/witness/witness-helper.d.mts.map +1 -1
- package/dist/witness/witness-helper.mjs +30 -0
- package/dist/witness/witness-helper.mjs.map +1 -1
- package/package.json +12 -15
- package/src/{assumptions.spec.mts → assumptions.respec.mts} +11 -5
- package/src/common/form/form-helper.mts +3 -4
- package/src/core-constants.mts +0 -2
- package/src/core-helper.respec.mts +71 -0
- package/src/core-types.mts +24 -2
- package/src/respec-gib.node.mts +199 -0
- package/src/spec-helper.node.respec.mts +45 -0
- package/src/witness/app/app-base-v1.mts +38 -23
- package/src/witness/app/app-constants.mts +3 -0
- package/src/witness/app/app-helper.mts +2 -1
- package/src/witness/robbot/robbot-base-v1.mts +9 -6
- package/src/witness/robbot/{robbot-helper.spec.mts → robbot-helper.respec.mts} +39 -33
- package/src/witness/space/bootstrap/bootstrap-helper.mts +50 -0
- package/src/witness/space/bootstrap/bootstrap-types.mts +123 -0
- package/src/witness/space/filesystem-space/filesystem-constants.mts +66 -0
- package/src/witness/space/filesystem-space/filesystem-space-v1.mts +1283 -0
- package/src/witness/space/filesystem-space/filesystem-space-v1.respec.mts +110 -0
- package/src/witness/space/filesystem-space/filesystem-types.mts +75 -0
- package/src/witness/space/filesystem-space/node-filesystem-space-v1.mts +697 -0
- package/src/witness/space/filesystem-space/node-filesystem-space-v1.node.respec.mts +148 -0
- package/src/witness/space/{inner-space-v1.mts → inner-space/inner-space-v1.mts} +5 -6
- package/src/witness/space/{inner-space-v1.spec.mts → inner-space/inner-space-v1.respec.mts} +17 -8
- package/src/witness/space/space-constants.mts +0 -27
- package/src/witness/space/space-helper.mts +17 -54
- package/src/witness/space/{space-spec-helper.spec.mts → space-respec-helper.mts} +97 -57
- package/src/witness/space/space-types.mts +0 -105
- package/src/witness/witness-base-v1.mts +8 -6
- package/src/witness/witness-helper.mts +31 -0
- package/tsconfig.json +4 -2
- package/dist/witness/space/inner-space-v1.d.mts.map +0 -1
- package/dist/witness/space/inner-space-v1.mjs.map +0 -1
- package/jasmine-browser.json +0 -18
- package/jasmine.json +0 -6
- package/src/core-helper.spec.mts +0 -64
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
firstOfEach, firstOfAll, ifWe,
|
|
3
|
+
lastOfEach, lastOfAll,
|
|
4
|
+
ifWeMight, iReckon, respecfully
|
|
5
|
+
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
6
|
+
const maam = `[${import.meta.url}]`, sir = maam;
|
|
7
|
+
import { getUUID, } from '@ibgib/helper-gib';
|
|
8
|
+
import { getIbGibAddr } from '@ibgib/ts-gib';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
testSpace_createAndInit,
|
|
12
|
+
testSpace_persistTransformResult,
|
|
13
|
+
testSpace_PutGetDelete
|
|
14
|
+
} from '../space-respec-helper.mjs';
|
|
15
|
+
import { FilesystemSpace_V1, } from './filesystem-space-v1.mjs';
|
|
16
|
+
import {
|
|
17
|
+
PutIbGibFileOpts, PutIbGibFileResult,
|
|
18
|
+
DeleteIbGibFileOpts, DeleteIbGibFilesResult,
|
|
19
|
+
GetIbGibFileOpts, GetIbGibFileResult
|
|
20
|
+
} from './filesystem-types.mjs';
|
|
21
|
+
import { IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* simple mock that naively implements file operations using a private map that holds ibgibs.
|
|
25
|
+
*/
|
|
26
|
+
class MockFilesystemSpace_V1 extends FilesystemSpace_V1<any, any, any, any> {
|
|
27
|
+
#files: { [key: string]: IbGib_V1 } = {};
|
|
28
|
+
|
|
29
|
+
protected async putFile({ ibGib, isMeta, isDna, }: PutIbGibFileOpts): Promise<PutIbGibFileResult> {
|
|
30
|
+
if (!ibGib) { throw new Error(`ibGib required (E: 8a63c7d0922565d6d14ceabd9d881f23)`); }
|
|
31
|
+
let addr = getIbGibAddr({ ibGib });
|
|
32
|
+
this.#files[addr] = ibGib;
|
|
33
|
+
return { success: true }
|
|
34
|
+
}
|
|
35
|
+
protected async deleteFile({ addr, isMeta, isDna, }: DeleteIbGibFileOpts): Promise<DeleteIbGibFilesResult> {
|
|
36
|
+
if (!addr) { throw new Error(`addr required (E: 74167b11ed53abd5db45da2e19d4c923)`); }
|
|
37
|
+
if (this.#files[addr]) { delete this.#files[addr]; }
|
|
38
|
+
return { success: true }
|
|
39
|
+
}
|
|
40
|
+
protected async getFile({ addr, isMeta, isDna, }: GetIbGibFileOpts): Promise<GetIbGibFileResult> {
|
|
41
|
+
if (!addr) { throw new Error(`addr required (E: 07bcbc77f59b26266f447bedc7bab723)`); }
|
|
42
|
+
if (this.#files[addr]) {
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
ibGib: this.#files[addr],
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
return {
|
|
49
|
+
success: false,
|
|
50
|
+
errorMsg: 'addr not found',
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
await respecfully(sir, `[${FilesystemSpace_V1.name} specs]`, async () => {
|
|
58
|
+
|
|
59
|
+
await testSpace_createAndInit({
|
|
60
|
+
respecfulTitle: sir,
|
|
61
|
+
// shortcircuitRespec: true,
|
|
62
|
+
fnGetInitialData: async () => {
|
|
63
|
+
return {
|
|
64
|
+
name: (await getUUID()).substring(0, 8),
|
|
65
|
+
uuid: await getUUID(),
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
fnGetInitialRel8ns: () => {
|
|
69
|
+
return Promise.resolve(undefined);
|
|
70
|
+
},
|
|
71
|
+
fnGetSpace: (initialData: any, initialRel8ns) => {
|
|
72
|
+
return Promise.resolve(new MockFilesystemSpace_V1(initialData, initialRel8ns));
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
await testSpace_PutGetDelete({
|
|
77
|
+
respecfulTitle: sir,
|
|
78
|
+
// shortcircuitRespec: true,
|
|
79
|
+
fnGetInitialData: async () => {
|
|
80
|
+
return {
|
|
81
|
+
name: (await getUUID()).substring(0, 8),
|
|
82
|
+
uuid: await getUUID(),
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
fnGetInitialRel8ns: () => {
|
|
86
|
+
return Promise.resolve(undefined);
|
|
87
|
+
},
|
|
88
|
+
fnGetSpace: (initialData: any, initialRel8ns) => {
|
|
89
|
+
return Promise.resolve(new MockFilesystemSpace_V1(initialData, initialRel8ns));
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
await testSpace_persistTransformResult({
|
|
94
|
+
respecfulTitle: sir,
|
|
95
|
+
// shortcircuitRespec: true,
|
|
96
|
+
fnGetInitialData: async () => {
|
|
97
|
+
return {
|
|
98
|
+
name: (await getUUID()).substring(0, 8),
|
|
99
|
+
uuid: await getUUID(),
|
|
100
|
+
};
|
|
101
|
+
},
|
|
102
|
+
fnGetInitialRel8ns: () => {
|
|
103
|
+
return Promise.resolve(undefined);
|
|
104
|
+
},
|
|
105
|
+
fnGetSpace: (initialData: any, initialRel8ns) => {
|
|
106
|
+
return Promise.resolve(new MockFilesystemSpace_V1(initialData, initialRel8ns));
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { IbGibAddr } from "@ibgib/ts-gib";
|
|
2
|
+
import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/index.mjs";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* encoding of the file.
|
|
6
|
+
*
|
|
7
|
+
* I'm bringing this over from my IonicSpace_V1 which used Capacitor.
|
|
8
|
+
* In that lib, this is a string mapped enum.
|
|
9
|
+
*/
|
|
10
|
+
export type Encoding = 'utf8' | 'UTF-8' | string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* I'm bringing this over from my IonicSpace_V1 which used Capacitor.
|
|
14
|
+
* In that lib, this is a string mapped enum.
|
|
15
|
+
*
|
|
16
|
+
* But in that case, this is a special folder, whereas with this
|
|
17
|
+
* implementation that may not be the case.
|
|
18
|
+
*/
|
|
19
|
+
export type Directory = string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* common shape of get/put/delete file function results
|
|
23
|
+
*/
|
|
24
|
+
export interface FileResult {
|
|
25
|
+
success?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If errored, this will contain the errorMsg.
|
|
28
|
+
*/
|
|
29
|
+
errorMsg?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Options for retrieving data from the file system.
|
|
34
|
+
*/
|
|
35
|
+
export interface GetIbGibFileOpts {
|
|
36
|
+
/**
|
|
37
|
+
* If getting ibGib object, this is its address.
|
|
38
|
+
*/
|
|
39
|
+
addr?: IbGibAddr;
|
|
40
|
+
/**
|
|
41
|
+
* If truthy, will look in the meta subpath first, then the regular if not found.
|
|
42
|
+
*/
|
|
43
|
+
isMeta?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Are we looking for a DNA ibgib?
|
|
46
|
+
*/
|
|
47
|
+
isDna?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Result for retrieving an ibGib from the file system.
|
|
51
|
+
*/
|
|
52
|
+
export interface GetIbGibFileResult extends FileResult {
|
|
53
|
+
/**
|
|
54
|
+
* ibGib if retrieving a "regular" ibGib.
|
|
55
|
+
*
|
|
56
|
+
* This is used when you're not getting a pic, e.g.
|
|
57
|
+
*/
|
|
58
|
+
ibGib?: IbGib_V1;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PutIbGibFileOpts {
|
|
62
|
+
ibGib?: IbGib_V1;
|
|
63
|
+
/**
|
|
64
|
+
* If true, will store with metas.
|
|
65
|
+
*/
|
|
66
|
+
isMeta?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* If true, will store in a different folder.
|
|
69
|
+
*/
|
|
70
|
+
isDna?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface PutIbGibFileResult extends FileResult { }
|
|
73
|
+
|
|
74
|
+
export interface DeleteIbGibFileOpts extends GetIbGibFileOpts { }
|
|
75
|
+
export interface DeleteIbGibFilesResult extends FileResult { }
|