@ibgib/ts-gib 0.5.20 → 0.5.23
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/.VSCodeCounter/2024-07-02_16-01-47/details.md +45 -0
- package/.VSCodeCounter/2024-07-02_16-01-47/diff-details.md +15 -0
- package/.VSCodeCounter/2024-07-02_16-01-47/diff.csv +2 -0
- package/.VSCodeCounter/2024-07-02_16-01-47/diff.md +19 -0
- package/.VSCodeCounter/2024-07-02_16-01-47/diff.txt +22 -0
- package/.VSCodeCounter/2024-07-02_16-01-47/results.csv +32 -0
- package/.VSCodeCounter/2024-07-02_16-01-47/results.json +1 -0
- package/.VSCodeCounter/2024-07-02_16-01-47/results.md +30 -0
- package/.VSCodeCounter/2024-07-02_16-01-47/results.txt +63 -0
- package/.vscode/tasks.json +0 -0
- package/CHANGELOG.md +11 -0
- package/dist/V1/factory.mjs.map +1 -1
- package/dist/V1/sha256v1.d.mts +1 -0
- package/dist/V1/sha256v1.d.mts.map +1 -1
- package/dist/V1/sha256v1.mjs +182 -1
- package/dist/V1/sha256v1.mjs.map +1 -1
- package/dist/V1/transforms/fork.mjs.map +1 -1
- package/dist/V1/transforms/mut8.mjs +1 -1
- package/dist/V1/transforms/mut8.mjs.map +1 -1
- package/dist/V1/transforms/rel8.d.mts.map +1 -1
- package/dist/V1/transforms/rel8.mjs +2 -2
- package/dist/V1/transforms/rel8.mjs.map +1 -1
- package/dist/V1/transforms/transform-helper.mjs +1 -1
- package/dist/V1/transforms/transform-helper.mjs.map +1 -1
- package/dist/V1/v1-helper.d.mts.map +1 -1
- package/dist/V1/v1-helper.mjs +5 -5
- package/dist/V1/v1-helper.mjs.map +1 -1
- package/dist/V1/validate-helper.mjs.map +1 -1
- package/dist/helper.d.mts +21 -0
- package/dist/helper.d.mts.map +1 -1
- package/dist/helper.mjs +43 -0
- package/dist/helper.mjs.map +1 -1
- package/dist/respec-gib.node.mjs +2 -2
- package/dist/respec-gib.node.mjs.map +1 -1
- package/package.json +2 -2
- package/src/V1/factory.respec.mts +4 -8
- package/src/V1/sha256v1.mts +183 -1
- package/src/V1/sha256v1.respec.mts +1030 -8
- package/src/V1/transforms/{fork.spec.mts → fork.respec.mts} +37 -25
- package/src/V1/transforms/mut8.mts +1 -1
- package/src/V1/transforms/{mut8.spec.mts → mut8.respec.mts} +39 -32
- package/src/V1/transforms/rel8.mts +2 -3
- package/src/V1/transforms/{rel8.spec.mts → rel8.respec.mts} +76 -61
- package/src/V1/transforms/{transform-helper.spec.mts → transform-helper.respec.mts} +9 -9
- package/src/V1/v1-helper.mts +6 -5
- package/src/helper.mts +48 -0
- package/src/helper.respec.mts +81 -1
- package/src/respec-gib.node.mts +1 -1
|
@@ -16,12 +16,20 @@
|
|
|
16
16
|
* is required for browser until I get some kind of browser testing
|
|
17
17
|
* going.
|
|
18
18
|
*/
|
|
19
|
+
import { clone, delay, } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
20
|
+
import {
|
|
21
|
+
firstOfEach, firstOfAll, ifWe,
|
|
22
|
+
lastOfEach, lastOfAll,
|
|
23
|
+
ifWeMight, iReckon, respecfully,
|
|
24
|
+
respecfullyDear
|
|
25
|
+
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
26
|
+
const maam = `[${import.meta.url}]`, sir = maam;
|
|
27
|
+
|
|
19
28
|
import { IbGib_V1, IbGibRel8ns_V1, Rel8n } from '../types.mjs';
|
|
20
29
|
import { fork } from './fork.mjs';
|
|
21
30
|
import { TransformOpts_Fork, IbGibAddr, Ib, TransformResult } from '../../types.mjs';
|
|
22
|
-
import { getIbGibAddr } from '../../helper.mjs';
|
|
23
|
-
import {
|
|
24
|
-
import { ROOT, ROOT_ADDR } from '../constants.mjs';
|
|
31
|
+
import { getIbGibAddr, toNormalizedForHashing } from '../../helper.mjs';
|
|
32
|
+
import { ROOT, } from '../constants.mjs';
|
|
25
33
|
import { mut8 } from './mut8.mjs';
|
|
26
34
|
import { getGib } from './transform-helper.mjs';
|
|
27
35
|
|
|
@@ -36,14 +44,14 @@ await respecfully(sir, `when forking the root`, async () => {
|
|
|
36
44
|
|
|
37
45
|
await ifWe(sir, `should have no rel8ns (because forked from the root)`, async () => {
|
|
38
46
|
const { newIbGib } = await fork({ src });
|
|
39
|
-
iReckon(sir, newIbGib.rel8ns).
|
|
47
|
+
iReckon(sir, newIbGib.rel8ns).isGonnaBeUndefined();
|
|
40
48
|
});
|
|
41
49
|
|
|
42
50
|
await respecfully(sir, `should respect param`, async () => {
|
|
43
51
|
await ifWe(sir, `noTimestamp`, async () => {
|
|
44
52
|
const { newIbGib } = await fork({ src, noTimestamp: true });
|
|
45
53
|
if (newIbGib?.data) {
|
|
46
|
-
iReckon(sir, newIbGib.data!.timestamp).
|
|
54
|
+
iReckon(sir, newIbGib.data!.timestamp).isGonnaBeUndefined();
|
|
47
55
|
} else {
|
|
48
56
|
// data being falsy is passing so no expect statement needed
|
|
49
57
|
}
|
|
@@ -86,13 +94,13 @@ await respecfully(sir, `when forking the root`, async () => {
|
|
|
86
94
|
// counting on environment (node) to be consistent with invalid dates in the future
|
|
87
95
|
const invalidDate = new Date("asdf");
|
|
88
96
|
iReckon(sir, invalidDate.toString()).isGonnaBe("Invalid Date");
|
|
89
|
-
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").
|
|
97
|
+
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").isGonnaBeTrue();
|
|
90
98
|
});
|
|
91
99
|
await ifWe(sir, `uuid`, async () => {
|
|
92
100
|
const { newIbGib } = await fork({ src, tjp: { uuid: true } });
|
|
93
101
|
iReckon(sir, newIbGib?.data).isGonnaBeTruthy();
|
|
94
102
|
iReckon(sir, newIbGib!.data?.uuid).isGonnaBeTruthy();
|
|
95
|
-
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").
|
|
103
|
+
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").isGonnaBeTrue()
|
|
96
104
|
});
|
|
97
105
|
await ifWe(sir, `timestamp && uuid`, async () => {
|
|
98
106
|
const { newIbGib } = await fork({ src, tjp: { timestamp: true, uuid: true } });
|
|
@@ -104,7 +112,7 @@ await respecfully(sir, `when forking the root`, async () => {
|
|
|
104
112
|
iReckon(sir, testDate).isGonnaBeTruthy();
|
|
105
113
|
iReckon(sir, testDate.toString()).not.isGonnaBe("Invalid Date");
|
|
106
114
|
iReckon(sir, newIbGib!.data?.uuid).isGonnaBeTruthy();
|
|
107
|
-
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").
|
|
115
|
+
iReckon(sir, newIbGib!.data?.isTjp).asTo("isTjp").isGonnaBeTrue()
|
|
108
116
|
});
|
|
109
117
|
});
|
|
110
118
|
|
|
@@ -117,12 +125,12 @@ await respecfully(sir, `when forking the root`, async () => {
|
|
|
117
125
|
|
|
118
126
|
await ifWe(sir, `cloneRel8ns (setting should be ignored since forking root)`, async () => {
|
|
119
127
|
const { newIbGib } = await fork({ src, cloneRel8ns: true, noTimestamp: true });
|
|
120
|
-
iReckon(sir, newIbGib?.rel8ns).
|
|
128
|
+
iReckon(sir, newIbGib?.rel8ns).isGonnaBeUndefined();
|
|
121
129
|
});
|
|
122
130
|
|
|
123
131
|
await ifWe(sir, `cloneData (setting should be ignored since forking root)`, async () => {
|
|
124
132
|
const { newIbGib } = await fork({ src, cloneData: true, noTimestamp: true });
|
|
125
|
-
iReckon(sir, newIbGib?.data).
|
|
133
|
+
iReckon(sir, newIbGib?.data).isGonnaBeUndefined();
|
|
126
134
|
});
|
|
127
135
|
});
|
|
128
136
|
|
|
@@ -150,9 +158,9 @@ await respecfully(sir, `when forking the root`, async () => {
|
|
|
150
158
|
const forkDnaData = (forkDna.data as TransformOpts_Fork<IbGib_V1>)!;
|
|
151
159
|
|
|
152
160
|
iReckon(sir, forkDna.data).asTo(`should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
153
|
-
iReckon(sir, forkDnaData.dna).asTo(`should have well-formed common transform opts`).
|
|
154
|
-
iReckon(sir, forkDnaData.srcAddr).asTo(`should have well-formed common transform opts`).
|
|
155
|
-
iReckon(sir, forkDnaData.src).asTo(`should have well-formed common transform opts`).
|
|
161
|
+
iReckon(sir, forkDnaData.dna).asTo(`should have well-formed common transform opts`).isGonnaBeTrue()
|
|
162
|
+
iReckon(sir, forkDnaData.srcAddr).asTo(`should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
163
|
+
iReckon(sir, forkDnaData.src).asTo(`should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
156
164
|
|
|
157
165
|
iReckon(sir, forkDnaData.type).asTo(`should have well-formed data specific to fork transform`).isGonnaBe("fork");
|
|
158
166
|
iReckon(sir, forkDnaData.destIb).asTo(`should have well-formed data specific to fork transform`).isGonnaBe(destIb);
|
|
@@ -196,7 +204,8 @@ await respecfully(sir, `when forking a regular ibgib`, async () => {
|
|
|
196
204
|
let src: IbGib_V1;
|
|
197
205
|
let srcAddr: IbGibAddr;
|
|
198
206
|
|
|
199
|
-
|
|
207
|
+
|
|
208
|
+
firstOfEach(sir, async () => {
|
|
200
209
|
// This will be the src we're working off of.
|
|
201
210
|
const beforeResult = await fork({ src: ROOT, uuid: true });
|
|
202
211
|
src = beforeResult.newIbGib;
|
|
@@ -243,10 +252,11 @@ await respecfully(sir, `when forking a regular ibgib`, async () => {
|
|
|
243
252
|
// need to reconsider inability to rename/remove timestamp data
|
|
244
253
|
// seems silly since bad actors can always do this and security is
|
|
245
254
|
// really through other means.
|
|
246
|
-
const testData = { x: 1, y: 2, deeper: { zzz: 333 }, uuid: 'tbd', timestamp: 'tbd' };
|
|
255
|
+
const testData = { x: 1, y: 2, deeper: { zzz: 333 }, uuid: 'tbd', timestamp: 'tbd', timestampMs: -1 };
|
|
247
256
|
const { newIbGib: grandparent } = await fork({ src, cloneData: true, noTimestamp: true });
|
|
248
257
|
testData.uuid = grandparent.data!.uuid!;
|
|
249
258
|
testData.timestamp = grandparent.data!.timestamp!;
|
|
259
|
+
testData.timestampMs = grandparent.data!.timestampMs!;
|
|
250
260
|
const { newIbGib: parent } =
|
|
251
261
|
await mut8({
|
|
252
262
|
src: grandparent,
|
|
@@ -261,13 +271,15 @@ await respecfully(sir, `when forking a regular ibgib`, async () => {
|
|
|
261
271
|
iReckon(sir, newIbGib!.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
262
272
|
iReckon(sir, newIbGib!.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
263
273
|
const parentAddr = getIbGibAddr({ ibGib: parent });
|
|
274
|
+
|
|
264
275
|
iReckon(sir, newIbGib!.rel8ns!.ancestor![newIbGib!.rel8ns!.ancestor!.length - 1]).isGonnaBe(parentAddr);
|
|
276
|
+
|
|
265
277
|
iReckon(sir, newIbGib!.data).isGonnaBeTruthy();
|
|
266
|
-
iReckon(sir, newIbGib!.data).isGonnaBe(testData);
|
|
267
|
-
});
|
|
268
278
|
|
|
269
|
-
|
|
270
|
-
|
|
279
|
+
// 12/2024 - ok, I have changed fundamental gib hashing with
|
|
280
|
+
// normalization. this sorts keys and removes 'undefined' values
|
|
281
|
+
iReckon(sir, toNormalizedForHashing(newIbGib!.data)).isGonnaBe(toNormalizedForHashing(testData));
|
|
282
|
+
});
|
|
271
283
|
});
|
|
272
284
|
|
|
273
285
|
await respecfully(sir, `when forking multiple regular ibgibs, NON LINKED REL8NS`, async () => {
|
|
@@ -276,7 +288,7 @@ await respecfully(sir, `when forking multiple regular ibgibs, NON LINKED REL8NS`
|
|
|
276
288
|
let srcForks: { [ib: string]: TransformResult<IbGib_V1> } = {};
|
|
277
289
|
let srcIbGibs: { [ib: string]: IbGib_V1 } = {};
|
|
278
290
|
|
|
279
|
-
|
|
291
|
+
firstOfEach(sir, async () => {
|
|
280
292
|
// These will be the srcs we're working off of.
|
|
281
293
|
// a forked from root, b forked from a, etc.
|
|
282
294
|
let prevIbGib: IbGib_V1 | undefined;
|
|
@@ -287,7 +299,7 @@ await respecfully(sir, `when forking multiple regular ibgibs, NON LINKED REL8NS`
|
|
|
287
299
|
prevIbGib = forkResult.newIbGib;
|
|
288
300
|
}
|
|
289
301
|
});
|
|
290
|
-
|
|
302
|
+
lastOfEach(sir, () => {
|
|
291
303
|
srcForks = {};
|
|
292
304
|
srcIbGibs = {};
|
|
293
305
|
})
|
|
@@ -319,7 +331,7 @@ await respecfully(sir, `when forking multiple regular ibgibs, NON LINKED REL8NS`
|
|
|
319
331
|
iReckon(sir, newIbGib?.rel8ns).isGonnaBeTruthy();
|
|
320
332
|
iReckon(sir, newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
321
333
|
iReckon(sir, newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
322
|
-
iReckon(sir, newIbGib?.rel8ns!.ancestor!.length).
|
|
334
|
+
iReckon(sir, newIbGib?.rel8ns!.ancestor!.length > 0).isGonnaBeTrue();
|
|
323
335
|
const prevIbGibAddr = getIbGibAddr({ ibGib: prevIbGib });
|
|
324
336
|
iReckon(sir, newIbGib?.rel8ns!.ancestor![newIbGib!.rel8ns!.ancestor!.length - 1]).isGonnaBe(prevIbGibAddr);
|
|
325
337
|
})
|
|
@@ -346,7 +358,7 @@ await respecfully(sir, `when forking with YES LINKED 'ancestor' rel8n...`, async
|
|
|
346
358
|
let srcForks: { [ib: string]: TransformResult<IbGib_V1> } = {};
|
|
347
359
|
let srcIbGibs: { [ib: string]: IbGib_V1 } = {};
|
|
348
360
|
|
|
349
|
-
|
|
361
|
+
firstOfEach(sir, async () => {
|
|
350
362
|
// These will be the srcs we're working off of.
|
|
351
363
|
// a forked from root, b forked from a, etc.
|
|
352
364
|
let prevIbGib: IbGib_V1 | undefined;
|
|
@@ -363,7 +375,7 @@ await respecfully(sir, `when forking with YES LINKED 'ancestor' rel8n...`, async
|
|
|
363
375
|
|
|
364
376
|
}
|
|
365
377
|
});
|
|
366
|
-
|
|
378
|
+
lastOfEach(sir, () => {
|
|
367
379
|
srcForks = {};
|
|
368
380
|
srcIbGibs = {};
|
|
369
381
|
})
|
|
@@ -390,7 +402,7 @@ await respecfully(sir, `when forking with YES LINKED 'ancestor' rel8n...`, async
|
|
|
390
402
|
// the first one forks from the root, so the rel8ns should be undefined which is tested elsewhere
|
|
391
403
|
ibs.filter(ib => ib === "a").forEach(ib => {
|
|
392
404
|
const newIbGib = srcIbGibs[ib]!;
|
|
393
|
-
iReckon(sir, newIbGib?.rel8ns).
|
|
405
|
+
iReckon(sir, newIbGib?.rel8ns).isGonnaBeUndefined();
|
|
394
406
|
// expect(newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
395
407
|
// expect(newIbGib?.rel8ns!.ancestor).isGonnaBeTruthy();
|
|
396
408
|
// expect(newIbGib?.rel8ns!.ancestor!.length).isGonnaBe(1);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getIbGibAddr } from '../../helper.mjs';
|
|
2
|
-
import { clone, getTimestamp, } from '@ibgib/helper-gib';
|
|
2
|
+
import { clone, getTimestamp, } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
3
3
|
import { IbGib_V1, IbGibData_V1, IbGibRel8ns_V1, Rel8n } from '../types.mjs';
|
|
4
4
|
import { TransformOpts_Mut8, TransformResult } from '../../types.mjs';
|
|
5
5
|
import { IBGIB_DELIMITER, } from '../constants.mjs';
|
|
@@ -7,10 +7,17 @@
|
|
|
7
7
|
* going.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { clone, delay, } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
11
|
+
import {
|
|
12
|
+
firstOfEach, firstOfAll, ifWe,
|
|
13
|
+
lastOfEach, lastOfAll,
|
|
14
|
+
ifWeMight, iReckon, respecfully
|
|
15
|
+
} from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
|
|
16
|
+
const maam = `[${import.meta.url}]`, sir = maam;
|
|
17
|
+
|
|
10
18
|
import { IbGib_V1, IbGibRel8ns_V1 } from '../types.mjs';
|
|
11
19
|
import { TransformOpts_Mut8, IbGibAddr } from '../../types.mjs';
|
|
12
20
|
import { getIbGibAddr, getIbAndGib, } from '../../helper.mjs';
|
|
13
|
-
import { clone, delay, } from '@ibgib/helper-gib';
|
|
14
21
|
import { sha256v1, } from '../sha256v1.mjs';
|
|
15
22
|
import { ROOT } from '../constants.mjs';
|
|
16
23
|
import { fork } from './fork.mjs';
|
|
@@ -53,7 +60,7 @@ await respecfully(sir, `can't mut8 primitives (including the root)`, async () =>
|
|
|
53
60
|
} catch (error) {
|
|
54
61
|
errored = true;
|
|
55
62
|
}
|
|
56
|
-
iReckon(sir, errored).
|
|
63
|
+
iReckon(sir, errored).isGonnaBeTrue()
|
|
57
64
|
});
|
|
58
65
|
|
|
59
66
|
await ifWe(sir, `should fail to mut8 add or patch data (ib: ${src.ib})`, async () => {
|
|
@@ -63,7 +70,7 @@ await respecfully(sir, `can't mut8 primitives (including the root)`, async () =>
|
|
|
63
70
|
} catch (error) {
|
|
64
71
|
errored = true;
|
|
65
72
|
}
|
|
66
|
-
iReckon(sir, errored).
|
|
73
|
+
iReckon(sir, errored).isGonnaBeTrue()
|
|
67
74
|
});
|
|
68
75
|
|
|
69
76
|
await ifWe(sir, `should fail to mut8 rename data (ib: ${src.ib})`, async () => {
|
|
@@ -73,7 +80,7 @@ await respecfully(sir, `can't mut8 primitives (including the root)`, async () =>
|
|
|
73
80
|
} catch (error) {
|
|
74
81
|
errored = true;
|
|
75
82
|
}
|
|
76
|
-
iReckon(sir, errored).
|
|
83
|
+
iReckon(sir, errored).isGonnaBeTrue()
|
|
77
84
|
});
|
|
78
85
|
|
|
79
86
|
await ifWe(sir, `should fail to mut8 remove data (ib: ${src.ib})`, async () => {
|
|
@@ -83,7 +90,7 @@ await respecfully(sir, `can't mut8 primitives (including the root)`, async () =>
|
|
|
83
90
|
} catch (error) {
|
|
84
91
|
errored = true;
|
|
85
92
|
}
|
|
86
|
-
iReckon(sir, errored).
|
|
93
|
+
iReckon(sir, errored).isGonnaBeTrue()
|
|
87
94
|
});
|
|
88
95
|
}
|
|
89
96
|
});
|
|
@@ -145,7 +152,7 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
145
152
|
.isGonnaBe(1);
|
|
146
153
|
|
|
147
154
|
// the data should have the new key name that we did
|
|
148
|
-
iReckon(sir, Object.keys(dataRenamedIbGib.data!)).
|
|
155
|
+
iReckon(sir, Object.keys(dataRenamedIbGib.data!)).includes(newNameForX);
|
|
149
156
|
|
|
150
157
|
// the data value for that new key name should be the same as before, since we didn't change it
|
|
151
158
|
iReckon(sir, dataRenamedIbGib.data![newNameForX]).isGonnaBe(valueForX);
|
|
@@ -185,7 +192,7 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
185
192
|
iReckon(sir, dataRemovedIbGib.data).isGonnaBeTruthy();
|
|
186
193
|
|
|
187
194
|
// the data value for that new key name should be the same as before, since we didn't change it
|
|
188
|
-
iReckon(sir, dataRemovedIbGib.data!.x).
|
|
195
|
+
iReckon(sir, dataRemovedIbGib.data!.x).isGonnaBeUndefined();
|
|
189
196
|
|
|
190
197
|
// the most recent past of the dataRemovedIbGib should be the src's address
|
|
191
198
|
iReckon(sir, dataRemovedIbGib.rel8ns!.past![dataRemovedIbGib.rel8ns!.past!.length - 1]).isGonnaBe(dataAddedAddr);
|
|
@@ -212,7 +219,7 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
212
219
|
const tjpAddr = getIbGibAddr({ ibGib: tjpIbGib });
|
|
213
220
|
const tjpAddrGib = getIbAndGib({ ibGibAddr: tjpAddr }).gib;
|
|
214
221
|
iReckon(sir, tjpIbGib!.data?.uuid).isGonnaBeTruthy();
|
|
215
|
-
iReckon(sir, tjpIbGib!.data?.isTjp).asTo("isTjp").
|
|
222
|
+
iReckon(sir, tjpIbGib!.data?.isTjp).asTo("isTjp").isGonnaBeTrue()
|
|
216
223
|
const { newIbGib: hasRel8dTjp } = await mut8({
|
|
217
224
|
src: tjpIbGib,
|
|
218
225
|
dataToAddOrPatch: { someData: "not intrinsically pertinent to this test" },
|
|
@@ -220,25 +227,25 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
220
227
|
const hasRel8dTjpAddr = getIbGibAddr({ ibGib: hasRel8dTjp });
|
|
221
228
|
const hasRel8dTjpAddrGib = getIbAndGib({ ibGibAddr: hasRel8dTjpAddr }).gib;
|
|
222
229
|
iReckon(sir, hasRel8dTjp!.data?.uuid).isGonnaBeTruthy();
|
|
223
|
-
iReckon(sir, hasRel8dTjp!.data?.isTjp).asTo("isTjp after additional mut8").
|
|
230
|
+
iReckon(sir, hasRel8dTjp!.data?.isTjp).asTo("isTjp after additional mut8").isGonnaBeUndefined();
|
|
224
231
|
iReckon(sir, hasRel8dTjp!.rel8ns).asTo("rel8ns").isGonnaBeTruthy();
|
|
225
232
|
iReckon(sir, hasRel8dTjp!.rel8ns!.tjp).asTo("rel8ns.tjp").isGonnaBeTruthy();
|
|
226
233
|
iReckon(sir, hasRel8dTjp!.rel8ns!.tjp!.length).asTo("rel8ns.tjp.length").isGonnaBe(1);
|
|
227
|
-
iReckon(sir, hasRel8dTjp!.rel8ns!.tjp).asTo("rel8ns.tjp include").
|
|
234
|
+
iReckon(sir, hasRel8dTjp!.rel8ns!.tjp).asTo("rel8ns.tjp include").includes(tjpAddr);
|
|
228
235
|
|
|
229
236
|
// the gib should not just be the hash, since it has a tjp timeline
|
|
230
|
-
iReckon(sir, hasRel8dTjpAddrGib).
|
|
237
|
+
iReckon(sir, hasRel8dTjpAddrGib).includes(tjpAddrGib);
|
|
231
238
|
|
|
232
239
|
// shoe-horning in here some getGibInfo testing...eesh
|
|
233
240
|
let hasRel8dTjpGibInfo = getGibInfo({ ibGibAddr: hasRel8dTjpAddr }); // via addr
|
|
234
|
-
iReckon(sir, hasRel8dTjpGibInfo.isPrimitive).
|
|
235
|
-
iReckon(sir, hasRel8dTjpGibInfo.piecesCount).
|
|
241
|
+
iReckon(sir, hasRel8dTjpGibInfo.isPrimitive).isGonnaBeUndefined();
|
|
242
|
+
iReckon(sir, hasRel8dTjpGibInfo.piecesCount).asTo('pieces count').isGonnaBe(2);
|
|
236
243
|
const hasRel8dTjpHash = await sha256v1(hasRel8dTjp, '');
|
|
237
|
-
iReckon(sir, hasRel8dTjpGibInfo.punctiliarHash).
|
|
244
|
+
iReckon(sir, hasRel8dTjpGibInfo.punctiliarHash).asTo('punctiliarHash').isGonnaBe(hasRel8dTjpHash);
|
|
238
245
|
iReckon(sir, hasRel8dTjpGibInfo.tjpGib).isGonnaBe(tjpAddrGib);
|
|
239
246
|
// the info should be the same if we get it straight from the gib
|
|
240
247
|
const hasRel8dTjpGibInfo_viaGib = getGibInfo({ gib: hasRel8dTjpAddrGib }); // via gib
|
|
241
|
-
iReckon(sir, hasRel8dTjpGibInfo_viaGib).
|
|
248
|
+
iReckon(sir, hasRel8dTjpGibInfo_viaGib).asTo('infos via addr and gib should be equal').isGonnaBe(hasRel8dTjpGibInfo);
|
|
242
249
|
});
|
|
243
250
|
}
|
|
244
251
|
} // double for..of statement
|
|
@@ -251,7 +258,7 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
251
258
|
patchDna: IbGib_V1, dataPatchedIbGib1: IbGib_V1,
|
|
252
259
|
renameDna: IbGib_V1, dataRenamedIbGib1: IbGib_V1,
|
|
253
260
|
removeDna: IbGib_V1, dataRemovedIbGib1: IbGib_V1;
|
|
254
|
-
|
|
261
|
+
firstOfAll(sir, async () => {
|
|
255
262
|
const resInit = await fork({ src: ROOT, dna: true });
|
|
256
263
|
src = resInit.newIbGib;
|
|
257
264
|
forkDnas = resInit.dnas!;
|
|
@@ -284,9 +291,9 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
284
291
|
|
|
285
292
|
iReckon(sir, mut8DnaData).asTo(`should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
286
293
|
iReckon(sir, mut8DnaData).asTo(`should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
287
|
-
iReckon(sir, mut8DnaData.dna).asTo(`should have well-formed common transform opts`).
|
|
288
|
-
iReckon(sir, mut8DnaData.srcAddr).asTo(`should have well-formed common transform opts`).
|
|
289
|
-
iReckon(sir, mut8DnaData.src).asTo(`should have well-formed common transform opts`).
|
|
294
|
+
iReckon(sir, mut8DnaData.dna).asTo(`should have well-formed common transform opts`).isGonnaBeTrue()
|
|
295
|
+
iReckon(sir, mut8DnaData.srcAddr).asTo(`should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
296
|
+
iReckon(sir, mut8DnaData.src).asTo(`should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
290
297
|
|
|
291
298
|
iReckon(sir, mut8DnaData.type).asTo(`should have well-formed data specific to type of mut8`).isGonnaBe("mut8");
|
|
292
299
|
iReckon(sir, mut8DnaData.dataToAddOrPatch).asTo(`should have well-formed data specific to type of mut8`).isGonnaBe(dataToAdd);
|
|
@@ -315,9 +322,9 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
315
322
|
|
|
316
323
|
iReckon(sir, mut8DnaData).asTo(`data patched, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
317
324
|
iReckon(sir, mut8DnaData).asTo(`data patched, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
318
|
-
iReckon(sir, mut8DnaData.dna).asTo(`data patched, should have well-formed common transform opts`).
|
|
319
|
-
iReckon(sir, mut8DnaData.srcAddr).asTo(`data patched, should have well-formed common transform opts`).
|
|
320
|
-
iReckon(sir, mut8DnaData.src).asTo(`data patched, should have well-formed common transform opts`).
|
|
325
|
+
iReckon(sir, mut8DnaData.dna).asTo(`data patched, should have well-formed common transform opts`).isGonnaBeTrue()
|
|
326
|
+
iReckon(sir, mut8DnaData.srcAddr).asTo(`data patched, should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
327
|
+
iReckon(sir, mut8DnaData.src).asTo(`data patched, should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
321
328
|
iReckon(sir, mut8DnaData.type).asTo(`data patched, should have well-formed data specific to type of mut8`).isGonnaBe("mut8");
|
|
322
329
|
iReckon(sir, mut8DnaData.dataToAddOrPatch).asTo(`data patched, should have well-formed data specific to type of mut8`).isGonnaBe(dataToPatch);
|
|
323
330
|
}
|
|
@@ -344,9 +351,9 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
344
351
|
|
|
345
352
|
iReckon(sir, mut8DnaData).asTo(`data renamed, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
346
353
|
iReckon(sir, mut8DnaData).asTo(`data renamed, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
347
|
-
iReckon(sir, mut8DnaData.dna).asTo(`data renamed, should have well-formed common transform opts`).
|
|
348
|
-
iReckon(sir, mut8DnaData.srcAddr).asTo(`data renamed, should have well-formed common transform opts`).
|
|
349
|
-
iReckon(sir, mut8DnaData.src).asTo(`data renamed, should have well-formed common transform opts`).
|
|
354
|
+
iReckon(sir, mut8DnaData.dna).asTo(`data renamed, should have well-formed common transform opts`).isGonnaBeTrue()
|
|
355
|
+
iReckon(sir, mut8DnaData.srcAddr).asTo(`data renamed, should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
356
|
+
iReckon(sir, mut8DnaData.src).asTo(`data renamed, should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
350
357
|
|
|
351
358
|
iReckon(sir, mut8DnaData.type).asTo(`data renamed, should have well-formed data specific to type of mut8`).isGonnaBe("mut8");
|
|
352
359
|
iReckon(sir, mut8DnaData.dataToRename).asTo(`data renamed, should have well-formed data specific to type of mut8`).isGonnaBe(dataToRename);
|
|
@@ -375,9 +382,9 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
375
382
|
|
|
376
383
|
iReckon(sir, mut8DnaData).asTo(`data removed, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
377
384
|
iReckon(sir, mut8DnaData).asTo(`data removed, should have well-formed common transform opts`).isGonnaBeTruthy();
|
|
378
|
-
iReckon(sir, mut8DnaData.dna).asTo(`data removed, should have well-formed common transform opts`).
|
|
379
|
-
iReckon(sir, mut8DnaData.srcAddr).asTo(`data removed, should have well-formed common transform opts`).
|
|
380
|
-
iReckon(sir, mut8DnaData.src).asTo(`data removed, should have well-formed common transform opts`).
|
|
385
|
+
iReckon(sir, mut8DnaData.dna).asTo(`data removed, should have well-formed common transform opts`).isGonnaBeTrue()
|
|
386
|
+
iReckon(sir, mut8DnaData.srcAddr).asTo(`data removed, should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
387
|
+
iReckon(sir, mut8DnaData.src).asTo(`data removed, should have well-formed common transform opts`).isGonnaBeUndefined();
|
|
381
388
|
|
|
382
389
|
iReckon(sir, mut8DnaData.type).asTo(`data removed, should have well-formed data specific to type of mut8`).isGonnaBe("mut8");
|
|
383
390
|
iReckon(sir, mut8DnaData.dataToRemove).asTo(`data removed, should have well-formed data specific to type of mut8`).isGonnaBe(dataToRemove);
|
|
@@ -511,7 +518,7 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
511
518
|
|
|
512
519
|
// the data should have the new key name that we did
|
|
513
520
|
iReckon(sir, dataRenamedIbGib.data!.nested1).isGonnaBeTruthy();
|
|
514
|
-
iReckon(sir, dataRenamedIbGib.data!.nested1![RENAME_ME_KEY]).
|
|
521
|
+
iReckon(sir, dataRenamedIbGib.data!.nested1![RENAME_ME_KEY]).isGonnaBeUndefined();
|
|
515
522
|
iReckon(sir, dataRenamedIbGib.data!.nested1![RENAMED_KEY]).isGonnaBeTruthy();
|
|
516
523
|
|
|
517
524
|
// the data value for that new key name should be the same as before, since we didn't change it
|
|
@@ -554,7 +561,7 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
554
561
|
|
|
555
562
|
// the data value for that new key name should be the same as before, since we didn't change it
|
|
556
563
|
iReckon(sir, dataRemovedIbGib.data!.xyObj).isGonnaBeTruthy();
|
|
557
|
-
iReckon(sir, dataRemovedIbGib.data!.xyObj!.x).
|
|
564
|
+
iReckon(sir, dataRemovedIbGib.data!.xyObj!.x).isGonnaBeUndefined();
|
|
558
565
|
|
|
559
566
|
// the most recent past of the dataRemovedIbGib should be the src's address
|
|
560
567
|
iReckon(sir, dataRemovedIbGib.rel8ns!.past![dataRemovedIbGib.rel8ns!.past!.length - 1]).isGonnaBe(dataAddedAddr);
|
|
@@ -592,7 +599,7 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
592
599
|
let { newIbGib: src_0 } =
|
|
593
600
|
await fork({ src: primitive, noTimestamp: true });
|
|
594
601
|
|
|
595
|
-
iReckon(sir, src_0.data).
|
|
602
|
+
iReckon(sir, src_0.data).isGonnaBeUndefined();
|
|
596
603
|
|
|
597
604
|
let { newIbGib: src_1 } =
|
|
598
605
|
await mut8({
|
|
@@ -610,7 +617,7 @@ await respecfully(sir, `when mutating a regular ibgib`, async () => {
|
|
|
610
617
|
let { newIbGib: src_0 } =
|
|
611
618
|
await fork({ src: primitive, noTimestamp: true, nCounter: false });
|
|
612
619
|
|
|
613
|
-
iReckon(sir, src_0.data).
|
|
620
|
+
iReckon(sir, src_0.data).isGonnaBeUndefined();
|
|
614
621
|
|
|
615
622
|
let { newIbGib: src_1 } =
|
|
616
623
|
await mut8({
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { getIbGibAddr,
|
|
2
|
-
import {
|
|
3
|
-
import { sha256v1 } from '../sha256v1.mjs';
|
|
1
|
+
import { getIbGibAddr, } from '../../helper.mjs';
|
|
2
|
+
import { clone, getTimestamp, } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
4
3
|
import { IbGib_V1, IbGibData_V1, IbGibRel8ns_V1, Rel8n } from '../types.mjs';
|
|
5
4
|
import { TransformOpts_Rel8, TransformResult, IbGibAddr } from '../../types.mjs';
|
|
6
5
|
import { IBGIB_DELIMITER, GIB, FORBIDDEN_ADD_RENAME_REMOVE_REL8N_NAMES } from '../constants.mjs';
|