@ibgib/core-gib 0.0.109 → 0.0.111
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/CHANGELOG.md +2 -1
- package/dist/common/import-export/import-export-helper.web.d.mts +3 -1
- package/dist/common/import-export/import-export-helper.web.d.mts.map +1 -1
- package/dist/common/import-export/import-export-helper.web.mjs +40 -23
- package/dist/common/import-export/import-export-helper.web.mjs.map +1 -1
- package/dist/common/import-export/import-export-types.d.mts +4 -2
- package/dist/common/import-export/import-export-types.d.mts.map +1 -1
- package/package.json +1 -1
- package/src/common/import-export/import-export-helper.web.mts +45 -22
- package/src/common/import-export/import-export-types.mts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -12,7 +12,9 @@ export declare function getRawExportIb({ data, }: {
|
|
|
12
12
|
/**
|
|
13
13
|
* space-delimited info contained in ib.
|
|
14
14
|
*
|
|
15
|
-
* atow (
|
|
15
|
+
* atow (06/2025)
|
|
16
|
+
* `${RAW_EXPORT_ATOM} ${dateString} ${compressDescription} ${graphSize} ${graphStringLength} ${tjpGib}`;
|
|
17
|
+
* OLD (02/2024)
|
|
16
18
|
* `${RAW_EXPORT_ATOM} ${timestampInTicks} ${graphSize} ${graphStringLength}`
|
|
17
19
|
*/
|
|
18
20
|
export declare function parseRawExportIb({ ib, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-export-helper.web.d.mts","sourceRoot":"","sources":["../../../src/common/import-export/import-export-helper.web.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAM7D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjG,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAMtE;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAC3B,IAAI,GACP,EAAE;IACC,IAAI,EAAE,gBAAgB,CAAC;CAC1B,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"import-export-helper.web.d.mts","sourceRoot":"","sources":["../../../src/common/import-export/import-export-helper.web.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAM7D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjG,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAMtE;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAC3B,IAAI,GACP,EAAE;IACC,IAAI,EAAE,gBAAgB,CAAC;CAC1B,GAAG,EAAE,CAuCL;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAC7B,EAAE,GACL,EAAE;IACC,EAAE,EAAE,EAAE,CAAC;CACV,GAAG,eAAe,CAqBlB;AAED,MAAM,WAAW,qBAAqB;IAClC,KAAK,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CAM1B;AACD,MAAM,WAAW,eAAe;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB;AACD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACpC,cAAc,EAAE,iBAAiB,CAAC;IAClC;;OAEG;IACH,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B;AACD,wBAAsB,iBAAiB,CAAC,EACpC,KAAK,EACL,SAAS,EACT,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,YAAY,GAGf,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAuG1D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extractErrorMsg,
|
|
1
|
+
import { extractErrorMsg, getTimestamp, getTimestampInTicks } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
2
|
import { getIbAndGib, getIbGibAddr } from "@ibgib/ts-gib/dist/helper.mjs";
|
|
3
|
-
import { getGib } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
|
|
3
|
+
import { getGib, getGibInfo } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
|
|
4
4
|
import { validateIbGibIntrinsically } from "@ibgib/ts-gib/dist/V1/validate-helper.mjs";
|
|
5
5
|
import { GLOBAL_LOG_A_LOT } from "../../core-constants.mjs";
|
|
6
6
|
import { RAW_EXPORT_ATOM } from "./import-export-constants.mjs";
|
|
@@ -19,7 +19,28 @@ export function getRawExportIb({ data, }) {
|
|
|
19
19
|
const { graphSize, dependencyGraphAsString, timestamp } = data;
|
|
20
20
|
const graphStringLength = dependencyGraphAsString.length;
|
|
21
21
|
const timestampInTicks = getTimestampInTicks(timestamp);
|
|
22
|
-
|
|
22
|
+
const compressDescription = data.compression === 'gzip' ? 'gzip' : 'raw';
|
|
23
|
+
if (!data.timestamp) {
|
|
24
|
+
throw new Error(`(UNEXPECTED) data.timestamp falsy? (E: 2f5bc88488cbf260634239a8a8396825)`);
|
|
25
|
+
}
|
|
26
|
+
const date = new Date(data.timestamp);
|
|
27
|
+
const { ib, gib } = getIbAndGib({ ibGibAddr: data.contextIbGibAddr });
|
|
28
|
+
const gibInfo = getGibInfo({ gib });
|
|
29
|
+
const tjpGib = gibInfo.tjpGib ?? gib;
|
|
30
|
+
/**
|
|
31
|
+
* make it easiest to sort in a file explorer but still be readable.
|
|
32
|
+
*
|
|
33
|
+
* timestampInTicks is not easily human-readable
|
|
34
|
+
*/
|
|
35
|
+
const dateString = date.toISOString().slice(0, 19)
|
|
36
|
+
.replace('T', '_').replace(/:/g, '').replace(/ /g, '_');
|
|
37
|
+
// it's just too much to include the entire ib as well I think
|
|
38
|
+
// let safeSubtextOfThisIb = getSaferSubstring({
|
|
39
|
+
// text: ib.replace(' ', '___'),
|
|
40
|
+
// length: 20, // wth
|
|
41
|
+
// });
|
|
42
|
+
return `${RAW_EXPORT_ATOM} ${dateString} ${compressDescription} ${graphSize} ${graphStringLength} ${tjpGib}`;
|
|
43
|
+
// let exportIb = `ibgib_export ${nowString} ${compress ? 'gzip' : 'raw'} ${safeSubtextOfThisIb} ${gib}`;
|
|
23
44
|
}
|
|
24
45
|
catch (error) {
|
|
25
46
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
@@ -34,7 +55,9 @@ export function getRawExportIb({ data, }) {
|
|
|
34
55
|
/**
|
|
35
56
|
* space-delimited info contained in ib.
|
|
36
57
|
*
|
|
37
|
-
* atow (
|
|
58
|
+
* atow (06/2025)
|
|
59
|
+
* `${RAW_EXPORT_ATOM} ${dateString} ${compressDescription} ${graphSize} ${graphStringLength} ${tjpGib}`;
|
|
60
|
+
* OLD (02/2024)
|
|
38
61
|
* `${RAW_EXPORT_ATOM} ${timestampInTicks} ${graphSize} ${graphStringLength}`
|
|
39
62
|
*/
|
|
40
63
|
export function parseRawExportIb({ ib, }) {
|
|
@@ -43,7 +66,7 @@ export function parseRawExportIb({ ib, }) {
|
|
|
43
66
|
if (logalot) {
|
|
44
67
|
console.log(`${lc} starting... (I: 3297e51184f87a45d343d8654b165324)`);
|
|
45
68
|
}
|
|
46
|
-
const [atom,
|
|
69
|
+
const [atom, dateString, compressDescription, graphSizeStr, graphStringLengthStr, tjpGib] = ib.split(' ');
|
|
47
70
|
if (atom !== RAW_EXPORT_ATOM) {
|
|
48
71
|
throw new Error(`atom (${atom}) !== ${RAW_EXPORT_ATOM} (E: ad7545da5b8c4baeb15d86e92d657524)`);
|
|
49
72
|
}
|
|
@@ -55,7 +78,8 @@ export function parseRawExportIb({ ib, }) {
|
|
|
55
78
|
if (Number.isNaN(graphStringLength) || graphStringLength < 0) {
|
|
56
79
|
throw new Error(`graphStringLength (${graphStringLengthStr}) is not a positive integer. (E: 112ceccee1a54b19ab4f4662b6694ba0)`);
|
|
57
80
|
}
|
|
58
|
-
|
|
81
|
+
const compression = compressDescription === 'gzip' ? 'gzip' : undefined;
|
|
82
|
+
return { atom, dateString, graphSize, graphStringLength, compression, tjpGib, };
|
|
59
83
|
}
|
|
60
84
|
catch (error) {
|
|
61
85
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
@@ -88,7 +112,7 @@ export async function getRawExportIbGib({ ibGib, metaspace, space, compress, liv
|
|
|
88
112
|
// preparingExport = true;
|
|
89
113
|
// build an ibgib that contains the entire dependency graph of this.ibGib and save it
|
|
90
114
|
const validationErrors = await validateIbGibIntrinsically({ ibGib }) ?? [];
|
|
91
|
-
if (validationErrors) {
|
|
115
|
+
if (validationErrors.length > 0) {
|
|
92
116
|
const errorMsg = `ibGib had validation errors: ${validationErrors} (E: 84890bbc0598192498178a98ae299825)`;
|
|
93
117
|
if (ignoreErrors) {
|
|
94
118
|
errorInfos.push({ errorMsg, ibGibAddr });
|
|
@@ -97,41 +121,34 @@ export async function getRawExportIbGib({ ibGib, metaspace, space, compress, liv
|
|
|
97
121
|
throw new Error(errorMsg);
|
|
98
122
|
}
|
|
99
123
|
}
|
|
100
|
-
// build the ib
|
|
101
|
-
const { ib, gib } = getIbAndGib({ ibGib });
|
|
102
|
-
let today = (new Date()).toDateString();
|
|
103
|
-
while (today.includes(' ')) {
|
|
104
|
-
today = today.replace(' ', '_');
|
|
105
|
-
} // lazy
|
|
106
|
-
let safeSubtextOfThisIb = getSaferSubstring({
|
|
107
|
-
text: ib.replace(' ', '___'),
|
|
108
|
-
length: 20, // wth
|
|
109
|
-
});
|
|
110
|
-
let exportIb = `ibgib_export ${today} ${safeSubtextOfThisIb} ${gib}`;
|
|
111
124
|
// build the data
|
|
112
|
-
|
|
125
|
+
const resGraph = await metaspace.getDependencyGraph({
|
|
113
126
|
ibGib,
|
|
114
127
|
live,
|
|
115
128
|
space,
|
|
116
129
|
});
|
|
117
|
-
|
|
130
|
+
const dependencyGraphAsString = compress ?
|
|
118
131
|
await compressIbGibGraphToString({ graph: resGraph }) :
|
|
119
132
|
await serializeGraphToString({ graph: resGraph });
|
|
120
|
-
console.error(`${lc} compress not implemented`);
|
|
121
|
-
// let dependencyGraphAsString = JSON.stringify(resGraph);
|
|
122
133
|
const tjpAddr = getTjpAddr({ ibGib, defaultIfNone: 'incomingAddr' }) ?? ibGibAddr;
|
|
134
|
+
const now = new Date();
|
|
123
135
|
let exportData = {
|
|
124
136
|
contextIbGibAddr: ibGibAddr,
|
|
125
137
|
tjpAddr,
|
|
126
138
|
dependencyGraphAsString,
|
|
127
139
|
graphSize: Object.keys(resGraph).length,
|
|
140
|
+
timestamp: getTimestamp(now),
|
|
141
|
+
timestampMs: now.getMilliseconds(),
|
|
128
142
|
};
|
|
129
143
|
if (compress) {
|
|
130
144
|
exportData.compression = 'gzip';
|
|
131
145
|
}
|
|
132
146
|
// [no rel8ns because this is a self-contained export ibgib]
|
|
133
147
|
// gib
|
|
134
|
-
|
|
148
|
+
const exportIbGib = {
|
|
149
|
+
ib: getRawExportIb({ data: exportData }),
|
|
150
|
+
data: exportData,
|
|
151
|
+
};
|
|
135
152
|
let exportGib = await getGib({ ibGib: exportIbGib, hasTjp: false });
|
|
136
153
|
exportIbGib.gib = exportGib;
|
|
137
154
|
if (logalot || true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-export-helper.web.mjs","sourceRoot":"","sources":["../../../src/common/import-export/import-export-helper.web.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"import-export-helper.web.mjs","sourceRoot":"","sources":["../../../src/common/import-export/import-export-helper.web.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAqB,YAAY,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AAExI,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIhE,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAEjC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAC3B,IAAI,GAGP;IACG,MAAM,EAAE,GAAG,IAAI,cAAc,CAAC,IAAI,GAAG,CAAC;IACtC,IAAI;QACA,IAAI,OAAO,EAAE;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,oDAAoD,CAAC,CAAC;SAAE;QACxF,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAC/D,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,MAAM,CAAC;QACzD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACxD,MAAM,mBAAmB,GAAG,IAAI,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;QAEzE,IAAI,CAAC,IAAI,CAAC,SAAS,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+HAA+H;QAC/H,4CAA4C;QAC5C,mGAAmG;QAEnG,mEAAmE;QACnE,yDAAyD;QACzD,yCAAyC;QAEzC,qBAAqB;QACrB,2BAA2B;QAC3B,mDAAmD;QACnD,oEAAoE;QACpE,wKAAwK;QACxK,kDAAkD;QAClD,uDAAuD;QACvD,4BAA4B;QAC5B,WAAW;QACX,0DAA0D;QAC1D,mCAAmC;QACnC,yBAAyB;QACzB,gDAAgD;QAChD,yCAAyC;QACzC,mCAAmC;QACnC,2BAA2B;QAC3B,UAAU;QACV,IAAI;QACJ,iGAAiG;KACpG;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC;KACf;YAAS;QACN,IAAI,OAAO,EAAE;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;SAAE;KACnD;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IbGibData_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
2
|
-
import { IbGibAddr, IbGibRel8ns } from '@ibgib/ts-gib/dist/types.mjs';
|
|
2
|
+
import { Gib, IbGibAddr, IbGibRel8ns } from '@ibgib/ts-gib/dist/types.mjs';
|
|
3
3
|
export interface RawExportData_V1 extends IbGibData_V1 {
|
|
4
4
|
dependencyGraphAsString: string;
|
|
5
5
|
contextIbGibAddr: IbGibAddr;
|
|
@@ -33,8 +33,10 @@ export interface RawExportIbGib_V1 extends IbGib_V1<RawExportData_V1, RawExportR
|
|
|
33
33
|
*/
|
|
34
34
|
export interface RawExportIbInfo {
|
|
35
35
|
atom: string;
|
|
36
|
-
|
|
36
|
+
dateString: string;
|
|
37
37
|
graphSize: number;
|
|
38
38
|
graphStringLength: number;
|
|
39
|
+
compression?: 'gzip';
|
|
40
|
+
tjpGib: Gib;
|
|
39
41
|
}
|
|
40
42
|
//# sourceMappingURL=import-export-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-export-types.d.mts","sourceRoot":"","sources":["../../../src/common/import-export/import-export-types.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"import-export-types.d.mts","sourceRoot":"","sources":["../../../src/common/import-export/import-export-types.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3E,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IAClD,uBAAuB,EAAE,MAAM,CAAC;IAChC,gBAAgB,EAAE,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;CAAI;AAE3D;;;;;GAKG;AACH,MAAM,WAAW,iBAAkB,SAAQ,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;CAAI;AAE7F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC;CAEf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibgib/core-gib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.111",
|
|
4
4
|
"description": "ibgib core functionality, including base architecture for witnesses, spaces, apps, robbots, etc., as well as shared utility functions. Node v19+ needed for heavily-used isomorphic webcrypto hashing consumed in both node and browsers.",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { extractErrorMsg, getSaferSubstring, getTimestampInTicks } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
1
|
+
import { extractErrorMsg, getSaferSubstring, getTimestamp, getTimestampInTicks } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
2
|
import { Ib, IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
3
3
|
import { getIbAndGib, getIbGibAddr } from "@ibgib/ts-gib/dist/helper.mjs";
|
|
4
|
-
import { getGib } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
|
|
4
|
+
import { getGib, getGibInfo } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
|
|
5
5
|
import { validateIbGibIntrinsically } from "@ibgib/ts-gib/dist/V1/validate-helper.mjs";
|
|
6
6
|
|
|
7
7
|
import { GLOBAL_LOG_A_LOT } from "../../core-constants.mjs";
|
|
@@ -29,7 +29,32 @@ export function getRawExportIb({
|
|
|
29
29
|
const { graphSize, dependencyGraphAsString, timestamp } = data;
|
|
30
30
|
const graphStringLength = dependencyGraphAsString.length;
|
|
31
31
|
const timestampInTicks = getTimestampInTicks(timestamp);
|
|
32
|
-
|
|
32
|
+
const compressDescription = data.compression === 'gzip' ? 'gzip' : 'raw';
|
|
33
|
+
|
|
34
|
+
if (!data.timestamp) { throw new Error(`(UNEXPECTED) data.timestamp falsy? (E: 2f5bc88488cbf260634239a8a8396825)`); }
|
|
35
|
+
const date = new Date(data.timestamp);
|
|
36
|
+
|
|
37
|
+
const { ib, gib } = getIbAndGib({ ibGibAddr: data.contextIbGibAddr });
|
|
38
|
+
const gibInfo = getGibInfo({ gib });
|
|
39
|
+
const tjpGib = gibInfo.tjpGib ?? gib;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* make it easiest to sort in a file explorer but still be readable.
|
|
43
|
+
*
|
|
44
|
+
* timestampInTicks is not easily human-readable
|
|
45
|
+
*/
|
|
46
|
+
const dateString =
|
|
47
|
+
date.toISOString().slice(0, 19)
|
|
48
|
+
.replace('T', '_').replace(/:/g, '').replace(/ /g, '_');
|
|
49
|
+
// it's just too much to include the entire ib as well I think
|
|
50
|
+
// let safeSubtextOfThisIb = getSaferSubstring({
|
|
51
|
+
// text: ib.replace(' ', '___'),
|
|
52
|
+
// length: 20, // wth
|
|
53
|
+
// });
|
|
54
|
+
|
|
55
|
+
return `${RAW_EXPORT_ATOM} ${dateString} ${compressDescription} ${graphSize} ${graphStringLength} ${tjpGib}`;
|
|
56
|
+
|
|
57
|
+
// let exportIb = `ibgib_export ${nowString} ${compress ? 'gzip' : 'raw'} ${safeSubtextOfThisIb} ${gib}`;
|
|
33
58
|
} catch (error) {
|
|
34
59
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
35
60
|
throw error;
|
|
@@ -41,7 +66,9 @@ export function getRawExportIb({
|
|
|
41
66
|
/**
|
|
42
67
|
* space-delimited info contained in ib.
|
|
43
68
|
*
|
|
44
|
-
* atow (
|
|
69
|
+
* atow (06/2025)
|
|
70
|
+
* `${RAW_EXPORT_ATOM} ${dateString} ${compressDescription} ${graphSize} ${graphStringLength} ${tjpGib}`;
|
|
71
|
+
* OLD (02/2024)
|
|
45
72
|
* `${RAW_EXPORT_ATOM} ${timestampInTicks} ${graphSize} ${graphStringLength}`
|
|
46
73
|
*/
|
|
47
74
|
export function parseRawExportIb({
|
|
@@ -52,7 +79,7 @@ export function parseRawExportIb({
|
|
|
52
79
|
const lc = `[${parseRawExportIb.name}]`;
|
|
53
80
|
try {
|
|
54
81
|
if (logalot) { console.log(`${lc} starting... (I: 3297e51184f87a45d343d8654b165324)`); }
|
|
55
|
-
const [atom,
|
|
82
|
+
const [atom, dateString, compressDescription, graphSizeStr, graphStringLengthStr, tjpGib] = ib.split(' ');
|
|
56
83
|
if (atom !== RAW_EXPORT_ATOM) { throw new Error(`atom (${atom}) !== ${RAW_EXPORT_ATOM} (E: ad7545da5b8c4baeb15d86e92d657524)`); }
|
|
57
84
|
const graphSize = Number.parseInt(graphSizeStr);
|
|
58
85
|
if (Number.isNaN(graphSize) || graphSize < 0) { throw new Error(`graphSize (${graphSizeStr}) is not a positive integer. (E: 2b43d9d3462f6e16547b121bccef9b24)`); }
|
|
@@ -60,7 +87,9 @@ export function parseRawExportIb({
|
|
|
60
87
|
const graphStringLength = Number.parseInt(graphStringLengthStr);
|
|
61
88
|
if (Number.isNaN(graphStringLength) || graphStringLength < 0) { throw new Error(`graphStringLength (${graphStringLengthStr}) is not a positive integer. (E: 112ceccee1a54b19ab4f4662b6694ba0)`); }
|
|
62
89
|
|
|
63
|
-
|
|
90
|
+
const compression = compressDescription === 'gzip' ? 'gzip' : undefined;
|
|
91
|
+
|
|
92
|
+
return { atom, dateString, graphSize, graphStringLength, compression, tjpGib, };
|
|
64
93
|
} catch (error) {
|
|
65
94
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
66
95
|
throw error;
|
|
@@ -127,7 +156,7 @@ export async function getRawExportIbGib({
|
|
|
127
156
|
// build an ibgib that contains the entire dependency graph of this.ibGib and save it
|
|
128
157
|
|
|
129
158
|
const validationErrors = await validateIbGibIntrinsically({ ibGib }) ?? [];
|
|
130
|
-
if (validationErrors) {
|
|
159
|
+
if (validationErrors.length > 0) {
|
|
131
160
|
const errorMsg = `ibGib had validation errors: ${validationErrors} (E: 84890bbc0598192498178a98ae299825)`;
|
|
132
161
|
if (ignoreErrors) {
|
|
133
162
|
errorInfos.push({ errorMsg, ibGibAddr });
|
|
@@ -136,40 +165,34 @@ export async function getRawExportIbGib({
|
|
|
136
165
|
}
|
|
137
166
|
}
|
|
138
167
|
|
|
139
|
-
// build the ib
|
|
140
|
-
const { ib, gib } = getIbAndGib({ ibGib });
|
|
141
|
-
let today = (new Date()).toDateString();
|
|
142
|
-
while (today.includes(' ')) { today = today.replace(' ', '_'); } // lazy
|
|
143
|
-
let safeSubtextOfThisIb = getSaferSubstring({
|
|
144
|
-
text: ib.replace(' ', '___'),
|
|
145
|
-
length: 20, // wth
|
|
146
|
-
});
|
|
147
|
-
let exportIb = `ibgib_export ${today} ${safeSubtextOfThisIb} ${gib}`;
|
|
148
|
-
|
|
149
168
|
// build the data
|
|
150
|
-
|
|
169
|
+
const resGraph = await metaspace.getDependencyGraph({
|
|
151
170
|
ibGib,
|
|
152
171
|
live,
|
|
153
172
|
space,
|
|
154
173
|
});
|
|
155
|
-
|
|
174
|
+
const dependencyGraphAsString = compress ?
|
|
156
175
|
await compressIbGibGraphToString({ graph: resGraph }) :
|
|
157
176
|
await serializeGraphToString({ graph: resGraph });
|
|
158
|
-
console.error(`${lc} compress not implemented`)
|
|
159
|
-
// let dependencyGraphAsString = JSON.stringify(resGraph);
|
|
160
177
|
const tjpAddr = getTjpAddr({ ibGib, defaultIfNone: 'incomingAddr' }) ?? ibGibAddr;
|
|
178
|
+
const now = new Date();
|
|
161
179
|
let exportData: RawExportData_V1 = {
|
|
162
180
|
contextIbGibAddr: ibGibAddr,
|
|
163
181
|
tjpAddr,
|
|
164
182
|
dependencyGraphAsString,
|
|
165
183
|
graphSize: Object.keys(resGraph).length,
|
|
184
|
+
timestamp: getTimestamp(now),
|
|
185
|
+
timestampMs: now.getMilliseconds(),
|
|
166
186
|
};
|
|
167
187
|
if (compress) { exportData.compression = 'gzip'; }
|
|
168
188
|
|
|
169
189
|
// [no rel8ns because this is a self-contained export ibgib]
|
|
170
190
|
|
|
171
191
|
// gib
|
|
172
|
-
|
|
192
|
+
const exportIbGib: RawExportIbGib_V1 = {
|
|
193
|
+
ib: getRawExportIb({ data: exportData }),
|
|
194
|
+
data: exportData,
|
|
195
|
+
};
|
|
173
196
|
let exportGib = await getGib({ ibGib: exportIbGib, hasTjp: false });
|
|
174
197
|
exportIbGib.gib = exportGib;
|
|
175
198
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IbGibData_V1, IbGib_V1 } from '@ibgib/ts-gib/dist/V1/types.mjs';
|
|
2
|
-
import { IbGibAddr, IbGibRel8ns } from '@ibgib/ts-gib/dist/types.mjs';
|
|
2
|
+
import { Gib, IbGibAddr, IbGibRel8ns } from '@ibgib/ts-gib/dist/types.mjs';
|
|
3
3
|
|
|
4
4
|
export interface RawExportData_V1 extends IbGibData_V1 {
|
|
5
5
|
dependencyGraphAsString: string,
|
|
@@ -35,7 +35,11 @@ export interface RawExportIbGib_V1 extends IbGib_V1<RawExportData_V1, RawExportR
|
|
|
35
35
|
*/
|
|
36
36
|
export interface RawExportIbInfo {
|
|
37
37
|
atom: string;
|
|
38
|
-
|
|
38
|
+
dateString: string;
|
|
39
|
+
// timestampInTicks: string;
|
|
39
40
|
graphSize: number;
|
|
40
41
|
graphStringLength: number;
|
|
42
|
+
compression?: 'gzip';
|
|
43
|
+
tjpGib: Gib;
|
|
44
|
+
// return `${RAW_EXPORT_ATOM} ${dateString} ${compressDescription} ${graphSize} ${graphStringLength} ${tjpGib}`;
|
|
41
45
|
}
|