@ibgib/core-gib 0.0.105 → 0.0.107

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 (39) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/common/import-export/import-export-helper.web.d.mts +49 -0
  3. package/dist/common/import-export/import-export-helper.web.d.mts.map +1 -0
  4. package/dist/common/import-export/import-export-helper.web.mjs +184 -0
  5. package/dist/common/import-export/import-export-helper.web.mjs.map +1 -0
  6. package/dist/common/import-export/import-export-types.d.mts +9 -0
  7. package/dist/common/import-export/import-export-types.d.mts.map +1 -1
  8. package/dist/common/other/graph-helper.d.mts +2 -3
  9. package/dist/common/other/graph-helper.d.mts.map +1 -1
  10. package/dist/common/other/graph-helper.mjs.map +1 -1
  11. package/dist/common/other/graph-types.d.mts +8 -0
  12. package/dist/common/other/graph-types.d.mts.map +1 -0
  13. package/dist/common/other/graph-types.mjs +2 -0
  14. package/dist/common/other/graph-types.mjs.map +1 -0
  15. package/dist/common/other/ibgib-helper.respec.mjs.map +1 -1
  16. package/dist/common/other/other-helper.respec.d.mts +2 -0
  17. package/dist/common/other/other-helper.respec.d.mts.map +1 -0
  18. package/dist/common/other/other-helper.respec.mjs +85 -0
  19. package/dist/common/other/other-helper.respec.mjs.map +1 -0
  20. package/dist/common/other/other-helper.web.d.mts +30 -0
  21. package/dist/common/other/other-helper.web.d.mts.map +1 -0
  22. package/dist/common/other/other-helper.web.mjs +161 -0
  23. package/dist/common/other/other-helper.web.mjs.map +1 -0
  24. package/dist/common/other/other-types.d.mts +7 -0
  25. package/dist/common/other/other-types.d.mts.map +1 -1
  26. package/package.json +1 -1
  27. package/src/common/import-export/import-export-helper.web.mts +222 -0
  28. package/src/common/import-export/import-export-types.mts +9 -0
  29. package/src/common/other/graph-helper.mts +2 -2
  30. package/src/common/other/graph-types.mts +6 -0
  31. package/src/common/other/ibgib-helper.respec.mts +1 -1
  32. package/src/common/other/other-helper.respec.mts +100 -0
  33. package/src/common/other/other-helper.web.mts +184 -0
  34. package/src/common/other/other-types.mts +8 -0
  35. package/dist/common/import-export/import-export-helper.d.mts +0 -18
  36. package/dist/common/import-export/import-export-helper.d.mts.map +0 -1
  37. package/dist/common/import-export/import-export-helper.mjs +0 -65
  38. package/dist/common/import-export/import-export-helper.mjs.map +0 -1
  39. package/src/common/import-export/import-export-helper.mts +0 -62
@@ -0,0 +1,161 @@
1
+ import { extractErrorMsg } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
2
+ import { GLOBAL_LOG_A_LOT } from "../../core-constants.mjs";
3
+ const logalot = GLOBAL_LOG_A_LOT;
4
+ /**
5
+ * @internal Helper to convert a Uint8Array to a Base64 string
6
+ * @param uint8Array @
7
+ * @returns Base64 string
8
+ */
9
+ function uint8ArrayToBase64(uint8Array) {
10
+ return new Promise((resolve, reject) => {
11
+ const blob = new Blob([uint8Array], { type: 'application/octet-stream' });
12
+ const reader = new FileReader();
13
+ reader.onload = () => {
14
+ const dataUrl = reader.result;
15
+ // The result is a data URL: "data:application/octet-stream;base64,..."
16
+ // We only want the Base64 part.
17
+ const base64String = dataUrl.split(',')[1];
18
+ resolve(base64String);
19
+ };
20
+ reader.onerror = (error) => reject(error);
21
+ reader.readAsDataURL(blob);
22
+ });
23
+ }
24
+ /**
25
+ * @internal Helper to convert a Base64 string back to a Uint8Array
26
+ * @param base64String to convert back to Uint8Array
27
+ * @returns Uint8Array
28
+ */
29
+ async function base64ToUint8Array(base64String) {
30
+ // Use the fetch API to decode the Base64 string.
31
+ // This is a modern and robust way to handle Base64 in the browser.
32
+ const dataUrl = `data:application/octet-stream;base64,${base64String}`;
33
+ const response = await fetch(dataUrl);
34
+ const blob = await response.blob();
35
+ const buffer = await blob.arrayBuffer();
36
+ return new Uint8Array(buffer);
37
+ }
38
+ /**
39
+ * Compresses an FlatIbGibGraph object into a Blob.
40
+ * @param graph The FlatIbGibGraph object to compress.
41
+ * @returns A Promise that resolves with the compressed Blob.
42
+ */
43
+ export async function compressIbGib(graph) {
44
+ // 1. Serialize: Create a JSON-safe representation of the graph
45
+ // We use a custom replacer to handle Uint8Array
46
+ // const replacer = (key: string, value: any) => {
47
+ // if (value instanceof Uint8Array) {
48
+ // // This part is async, so we can't use it directly in JSON.stringify.
49
+ // // We must pre-process the object first.
50
+ // throw new Error("Cannot use async replacer. Pre-process the object first.");
51
+ // }
52
+ // return value;
53
+ // };
54
+ // Pre-process the graph to handle async Base64 conversion
55
+ const serializableGraph = JSON.parse(JSON.stringify(graph)); // Deep clone to avoid mutation
56
+ for (const key in serializableGraph) {
57
+ if (graph[key].data instanceof Uint8Array) {
58
+ serializableGraph[key].data = {
59
+ _dataType: 'Uint8Array_Base64',
60
+ value: await uint8ArrayToBase64(graph[key].data)
61
+ };
62
+ }
63
+ }
64
+ // 2. Stringify: Convert the serializable object to a JSON string
65
+ const jsonString = JSON.stringify(serializableGraph);
66
+ // 3. Encode: Convert the string to a Uint8Array (UTF-8)
67
+ const dataToCompress = new TextEncoder().encode(jsonString);
68
+ // 4. Compress: Use the Compression Streams API
69
+ const stream = new Response(dataToCompress).body;
70
+ const compressedStream = stream.pipeThrough(new CompressionStream('gzip'));
71
+ // Return the compressed data as a Blob
72
+ return await new Response(compressedStream).blob();
73
+ }
74
+ /**
75
+ * Decompresses a Blob back into an FlatIbGibGraph object.
76
+ * @param compressedBlob The Blob containing the compressed graph data.
77
+ * @returns A Promise that resolves with the original FlatIbGibGraph object.
78
+ */
79
+ export async function decompressIbGib(compressedBlob) {
80
+ // 1. Decompress: Use the Decompression Streams API
81
+ const decompressedStream = compressedBlob.stream().pipeThrough(new DecompressionStream('gzip'));
82
+ // 2. Decode: Convert the decompressed stream back to a string
83
+ const jsonString = await new Response(decompressedStream).text();
84
+ // 3. Deserialize: Parse the JSON with a reviver to restore Uint8Arrays
85
+ const reviver = (key, value) => {
86
+ if (value && value._dataType === 'Uint8Array_Base64') {
87
+ // This part is async, so we can't use it in JSON.parse.
88
+ // We must post-process the object.
89
+ return value; // Return the placeholder for now
90
+ }
91
+ return value;
92
+ };
93
+ const parsedGraph = JSON.parse(jsonString, reviver);
94
+ // Post-process to convert Base64 back to Uint8Array
95
+ for (const key in parsedGraph) {
96
+ const data = parsedGraph[key].data;
97
+ if (data && data._dataType === 'Uint8Array_Base64') {
98
+ parsedGraph[key].data = await base64ToUint8Array(data.value);
99
+ }
100
+ }
101
+ return parsedGraph;
102
+ }
103
+ /**
104
+ * Compresses an FlatIbGibGraph object and returns a Base64 string representation.
105
+ * @param graph The FlatIbGibGraph object to compress.
106
+ * @returns A Promise that resolves with the compressed data as a Base64 string.
107
+ */
108
+ export async function compressIbGibGraphToString({ graph }) {
109
+ const lc = `[${compressIbGibGraphToString.name}]`;
110
+ try {
111
+ if (logalot) {
112
+ console.log(`${lc} starting... (I: 1352f8540c08f0b725952df8f18c4825)`);
113
+ }
114
+ // 1. Get the compressed data as a Blob first.
115
+ const compressedBlob = await compressIbGib(graph);
116
+ // 2. Convert the Blob's binary data to a Uint8Array.
117
+ const buffer = await compressedBlob.arrayBuffer();
118
+ const uint8Array = new Uint8Array(buffer);
119
+ // 3. Convert that Uint8Array to a Base64 string.
120
+ return await uint8ArrayToBase64(uint8Array);
121
+ }
122
+ catch (error) {
123
+ console.error(`${lc} ${extractErrorMsg(error)}`);
124
+ throw error;
125
+ }
126
+ finally {
127
+ if (logalot) {
128
+ console.log(`${lc} complete.`);
129
+ }
130
+ }
131
+ }
132
+ /**
133
+ * Decompresses a Base64 string back into an FlatIbGibGraph object.
134
+ * @param compressedBase64 The Base64 string containing the compressed graph data.
135
+ * @returns A Promise that resolves with the original FlatIbGibGraph object.
136
+ */
137
+ export async function decompressIbGibGraphFromString({ compressedBase64, }) {
138
+ const lc = `[${decompressIbGibGraphFromString.name}]`;
139
+ try {
140
+ if (logalot) {
141
+ console.log(`${lc} starting... (I: 5f3fa940a2c8f8d7b877978ae7f87825)`);
142
+ }
143
+ // 1. Convert the Base64 string back to a Uint8Array.
144
+ const compressedUint8Array = await base64ToUint8Array(compressedBase64);
145
+ // 2. Create a Blob from the Uint8Array.
146
+ // The MIME type isn't strictly necessary for DecompressionStream but is good practice.
147
+ const compressedBlob = new Blob([compressedUint8Array], { type: 'application/gzip' });
148
+ // 3. Use our existing function to decompress the Blob.
149
+ return await decompressIbGib(compressedBlob);
150
+ }
151
+ catch (error) {
152
+ console.error(`${lc} ${extractErrorMsg(error)}`);
153
+ throw error;
154
+ }
155
+ finally {
156
+ if (logalot) {
157
+ console.log(`${lc} complete.`);
158
+ }
159
+ }
160
+ }
161
+ //# sourceMappingURL=other-helper.web.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"other-helper.web.mjs","sourceRoot":"","sources":["../../../src/common/other/other-helper.web.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAEjC;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,UAAsB;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC,CAAC;QAC1E,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;YACjB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAgB,CAAC;YACxC,uEAAuE;YACvE,gCAAgC;YAChC,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,OAAO,CAAC,YAAY,CAAC,CAAC;QAC1B,CAAC,CAAC;QACF,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAA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,IAAI,CAAC,CAAC,oBAAoB,CAAC,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;QAEtF,uDAAuD;QACvD,OAAO,MAAM,eAAe,CAAC,cAAc,CAAC,CAAC;KAChD;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"}
@@ -162,4 +162,11 @@ export interface IbGibTimelineUpdateInfo extends IbGib_V1 {
162
162
  latestAddr: IbGibAddr;
163
163
  latestIbGib?: IbGib_V1<any>;
164
164
  }
165
+ /**
166
+ * Serializing helper type for compressing dependency graphs.
167
+ */
168
+ export type SerializedUint8Array = {
169
+ _dataType: 'Uint8Array_Base64';
170
+ value: string;
171
+ };
165
172
  //# sourceMappingURL=other-types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"other-types.d.mts","sourceRoot":"","sources":["../../../src/common/other/other-types.mts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,MAAM,WAAW,UAAU;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB;;OAE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ANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibgib/core-gib",
3
- "version": "0.0.105",
3
+ "version": "0.0.107",
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",
@@ -0,0 +1,222 @@
1
+ import { extractErrorMsg, getSaferSubstring, getTimestampInTicks } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
2
+ import { Ib, IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
3
+
4
+ import { GLOBAL_LOG_A_LOT } from "../../core-constants.mjs";
5
+ import { RawExportData_V1, RawExportIbGib_V1, RawExportIbInfo } from "./import-export-types.mjs";
6
+ import { RAW_EXPORT_ATOM } from "./import-export-constants.mjs";
7
+ import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
8
+ import { MetaspaceService } from "../../witness/space/metaspace/metaspace-types.mjs";
9
+ import { IbGibSpaceAny } from "../../witness/space/space-base-v1.mjs";
10
+ import { getIbAndGib, getIbGibAddr } from "@ibgib/ts-gib/dist/helper.mjs";
11
+ import { validateIbGibIntrinsically } from "@ibgib/ts-gib/dist/V1/validate-helper.mjs";
12
+ import { compressIbGibGraphToString } from "../other/other-helper.web.mjs";
13
+ import { getTjpAddr } from "../other/ibgib-helper.mjs";
14
+ import { getGib } from "@ibgib/ts-gib/dist/V1/transforms/transform-helper.mjs";
15
+
16
+ const logalot = GLOBAL_LOG_A_LOT;
17
+
18
+ /**
19
+ * builds the ib for a {@link RawExportIbGib_V1}
20
+ */
21
+ export function getRawExportIb({
22
+ data,
23
+ }: {
24
+ data: RawExportData_V1,
25
+ }): Ib {
26
+ const lc = `[${getRawExportIb.name}]`;
27
+ try {
28
+ if (logalot) { console.log(`${lc} starting... (I: 158dfaeb9613a1531be71a9735184624)`); }
29
+ const { graphSize, dependencyGraphAsString, timestamp } = data;
30
+ const graphStringLength = dependencyGraphAsString.length;
31
+ const timestampInTicks = getTimestampInTicks(timestamp);
32
+ return `${RAW_EXPORT_ATOM} ${timestampInTicks} ${graphSize} ${graphStringLength}`;
33
+ } catch (error) {
34
+ console.error(`${lc} ${extractErrorMsg(error)}`);
35
+ throw error;
36
+ } finally {
37
+ if (logalot) { console.log(`${lc} complete.`); }
38
+ }
39
+ }
40
+
41
+ /**
42
+ * space-delimited info contained in ib.
43
+ *
44
+ * atow (02/2024)
45
+ * `${RAW_EXPORT_ATOM} ${timestampInTicks} ${graphSize} ${graphStringLength}`
46
+ */
47
+ export function parseRawExportIb({
48
+ ib,
49
+ }: {
50
+ ib: Ib,
51
+ }): RawExportIbInfo {
52
+ const lc = `[${parseRawExportIb.name}]`;
53
+ try {
54
+ if (logalot) { console.log(`${lc} starting... (I: 3297e51184f87a45d343d8654b165324)`); }
55
+ const [atom, timestampInTicks, graphSizeStr, graphStringLengthStr] = ib.split(' ');
56
+ if (atom !== RAW_EXPORT_ATOM) { throw new Error(`atom (${atom}) !== ${RAW_EXPORT_ATOM} (E: ad7545da5b8c4baeb15d86e92d657524)`); }
57
+ const graphSize = Number.parseInt(graphSizeStr);
58
+ if (Number.isNaN(graphSize) || graphSize < 0) { throw new Error(`graphSize (${graphSizeStr}) is not a positive integer. (E: 2b43d9d3462f6e16547b121bccef9b24)`); }
59
+
60
+ const graphStringLength = Number.parseInt(graphStringLengthStr);
61
+ if (Number.isNaN(graphStringLength) || graphStringLength < 0) { throw new Error(`graphStringLength (${graphStringLengthStr}) is not a positive integer. (E: 112ceccee1a54b19ab4f4662b6694ba0)`); }
62
+
63
+ return { atom, timestampInTicks, graphSize, graphStringLength };
64
+ } catch (error) {
65
+ console.error(`${lc} ${extractErrorMsg(error)}`);
66
+ throw error;
67
+ } finally {
68
+ if (logalot) { console.log(`${lc} complete.`); }
69
+ }
70
+ }
71
+
72
+ export interface GetRawExportIbGibOpts {
73
+ ibGib: IbGib_V1,
74
+ metaspace: MetaspaceService,
75
+ space: IbGibSpaceAny,
76
+ live: boolean;
77
+ compress?: boolean;
78
+ /**
79
+ * if true, will ignore as much errors as possible to try to get as much data exported as possible.
80
+ */
81
+ ignoreErrors?: boolean;
82
+ // /**
83
+ // * If true, then the export should disassociate from its past and ancestor rel8ns.
84
+ // */
85
+ // detach?: boolean;
86
+ // detachRel8nNames?: string[];
87
+ }
88
+ export interface ExportErrorInfo {
89
+ errorMsg: string;
90
+ ibGibAddr?: IbGibAddr;
91
+ rawError?: any;
92
+ }
93
+ /**
94
+ * this should be an ibgib right?
95
+ */
96
+ export interface GetRawExportIbGibResult {
97
+ rawExportIbGib: RawExportIbGib_V1;
98
+ /**
99
+ * all addrs included in the export.
100
+ */
101
+ manifest: IbGibAddr[];
102
+ errors?: ExportErrorInfo[];
103
+ }
104
+ export async function getRawExportIbGib({
105
+ ibGib,
106
+ metaspace,
107
+ space,
108
+ compress,
109
+ live,
110
+ ignoreErrors,
111
+ // detach,
112
+ // detachRel8nNames,
113
+ }: GetRawExportIbGibOpts): Promise<GetRawExportIbGibResult> {
114
+ const lc = `[${getRawExportIbGib.name}]`;
115
+ try {
116
+ if (logalot) { console.log(`${lc} starting... (I: 0b6ba8608ba8bde0682a0936b9a01825)`); }
117
+ if (!ibGib) { throw new Error(`(UNEXPECTED) ibGib falsy? (E: d2898eea744360865f0da5fb91baae22)`); }
118
+ const ibGibAddr = getIbGibAddr({ ibGib });
119
+ // if (preparingExport) {
120
+ // console.warn(`${lc} already preparing export. (W: cb31b23a313247f0ad128dd984645db4)`);
121
+ // return; /* <<<< returns early */
122
+ // }
123
+ const errorInfos: ExportErrorInfo[] = [];
124
+
125
+ // preparingExport = true;
126
+
127
+ // build an ibgib that contains the entire dependency graph of this.ibGib and save it
128
+
129
+ const validationErrors = await validateIbGibIntrinsically({ ibGib }) ?? [];
130
+ if (validationErrors) {
131
+ const errorMsg = `ibGib had validation errors: ${validationErrors} (E: 84890bbc0598192498178a98ae299825)`;
132
+ if (ignoreErrors) {
133
+ errorInfos.push({ errorMsg, ibGibAddr });
134
+ } else {
135
+ throw new Error(errorMsg);
136
+ }
137
+ }
138
+
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
+ // build the data
150
+ let resGraph = await metaspace.getDependencyGraph({
151
+ ibGib,
152
+ live,
153
+ space,
154
+ });
155
+ let dependencyGraphAsString = compress ?
156
+ await compressIbGibGraphToString({ graph: resGraph }) :
157
+ JSON.stringify(resGraph);
158
+ console.error(`${lc} compress not implemented`)
159
+ // let dependencyGraphAsString = JSON.stringify(resGraph);
160
+ const tjpAddr = getTjpAddr({ ibGib, defaultIfNone: 'incomingAddr' }) ?? ibGibAddr;
161
+ let exportData: RawExportData_V1 = {
162
+ contextIbGibAddr: ibGibAddr,
163
+ tjpAddr,
164
+ dependencyGraphAsString,
165
+ graphSize: Object.keys(resGraph).length,
166
+ };
167
+ if (compress) { exportData.compression = 'gzip'; }
168
+
169
+ // [no rel8ns because this is a self-contained export ibgib]
170
+
171
+ // gib
172
+ let exportIbGib: RawExportIbGib_V1 = { ib: exportIb, data: exportData, };
173
+ let exportGib = await getGib({ ibGib: exportIbGib, hasTjp: false });
174
+ exportIbGib.gib = exportGib;
175
+
176
+ if (logalot || true) { console.log(`${lc} JSON.stringify(exportIbGib).length: ${JSON.stringify(exportIbGib).length} (I: db3a8d913a91d8fc5d6e45981e034822)`); }
177
+
178
+ return {
179
+ rawExportIbGib: exportIbGib,
180
+ manifest: Object.keys(resGraph),
181
+ errors: errorInfos.length > 0 ? errorInfos : undefined,
182
+ };
183
+
184
+
185
+ // // at this point, we have a possibly quite large ibGib whose data includes
186
+ // // every single ibgib that this.ibGib relates to (its dependency graph).
187
+ // // so now we can save this file and later import from it.
188
+
189
+ // // thank you SO, OP and volzotan at https://stackoverflow.com/questions/19721439/download-json-object-as-a-file-from-browser
190
+ // // set the anchor's href to a data stream
191
+ // var dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(exportIbGib));
192
+
193
+ // // get the filename for the anchor to suggest for the "download"
194
+ // let exportAddr = getIbGibAddr({ ibGib: exportIbGib });
195
+ // const filename = `${exportAddr}.json`;
196
+
197
+ // // if (this.web) {
198
+ // // trigger the click
199
+ // const dlAnchorElemId ='export-ibgib-anchor';
200
+ // const dlAnchorElem = document.getElementById(dlAnchorElemId);
201
+ // if (!dlAnchorElem) { throw new Error(`(UNEXPECTED) dlAnchorElem falsy? should be an element with id ${dlAnchorElemId}? (E: 51dfe2d823eedeefb8b9c9580090e625)`); }
202
+ // dlAnchorElem.setAttribute("href", dataStr);
203
+ // dlAnchorElem.setAttribute("download", filename);
204
+ // dlAnchorElem.click();
205
+ // } else {
206
+ // // let res = await Filesystem.requestPermissions();
207
+ // await Filesystem.writeFile({
208
+ // data: dataStr,
209
+ // directory: Directory.ExternalStorage,
210
+ // path: `/Download/${filename}`,
211
+ // encoding: Encoding.UTF8,
212
+ // recursive: true,
213
+ // });
214
+ // }
215
+ // await Dialog.alert({ title: 'export succeeded', message: 'way to go, the export succeeded' });
216
+ } catch (error) {
217
+ console.error(`${lc} ${extractErrorMsg(error)}`);
218
+ throw error;
219
+ } finally {
220
+ if (logalot) { console.log(`${lc} complete.`); }
221
+ }
222
+ }
@@ -9,6 +9,15 @@ export interface RawExportData_V1 extends IbGibData_V1 {
9
9
  * number of entries in the dependency graph of the export.
10
10
  */
11
11
  graphSize: number;
12
+ /**
13
+ * If set, this is the {@link CompressionFormat} used in compression with
14
+ * the {@link dependencyGraphAsString}.
15
+ *
16
+ * ATOW (05/2025) this is only gzip and uses the Compression Streams API
17
+ * with {@link CompressionStream} for compression combined with base64
18
+ * encoding.
19
+ */
20
+ compression?: 'gzip';
12
21
  }
13
22
 
14
23
  export interface RawExportRel8ns_V1 extends IbGibRel8ns { }
@@ -12,6 +12,7 @@ import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
12
12
  import { getFromSpace, getLatestAddrs } from '../../witness/space/space-helper.mjs';
13
13
  import { getTimelinesGroupedByTjp } from './ibgib-helper.mjs';
14
14
  import { IbGibSpaceAny } from '../../witness/space/space-base-v1.mjs';
15
+ import { FlatIbGibGraph } from './graph-types.mjs';
15
16
 
16
17
 
17
18
  const logalot = GLOBAL_LOG_A_LOT || false;
@@ -157,8 +158,7 @@ export interface GetGraphOptions {
157
158
  mapTjpAddrToLatestAddrsInSpace?: { [tjpAddr: string]: IbGibAddr }
158
159
  }
159
160
 
160
- export type GetGraphResult = { [addr: string]: IbGib_V1 };
161
-
161
+ export type GetGraphResult = FlatIbGibGraph;
162
162
 
163
163
  export interface GetGraphProjectionOptions extends GetGraphOptions {
164
164
  // /**
@@ -0,0 +1,6 @@
1
+ import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
2
+
3
+ /**
4
+ * Map of addr -> ibGib
5
+ */
6
+ export type FlatIbGibGraph = { [addr: string]: IbGib_V1 };
@@ -24,7 +24,7 @@ import { GIB, IB } from '@ibgib/ts-gib/dist/V1/constants.mjs';
24
24
  import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
25
25
 
26
26
  import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
27
- import { getBinHashAndExt, getBinIb, getTimestampInfo, } from './ibgib-helper.mjs';
27
+ import { getBinIb, getTimestampInfo, } from './ibgib-helper.mjs';
28
28
 
29
29
  /**
30
30
  * for verbose logging
@@ -0,0 +1,100 @@
1
+ // /**
2
+ // * @module other-helper respec
3
+ // *
4
+ // * we gotta test our other-helper compression functions. Thanks for the help
5
+ // * Gemini.
6
+ // */
7
+
8
+ // // import { cwd, chdir, } from 'node:process';
9
+ // // import { statSync } from 'node:fs';
10
+ // // import { mkdir, } from 'node:fs/promises';
11
+ // // import { ChildProcess, exec, ExecException } from 'node:child_process';
12
+ // import * as pathUtils from 'path';
13
+
14
+ // import {
15
+ // firstOfAll, firstOfEach, ifWe, ifWeMight, iReckon,
16
+ // lastOfAll, lastOfEach, respecfully, respecfullyDear
17
+ // } from '@ibgib/helper-gib/dist/respec-gib/respec-gib.mjs';
18
+ // const maam = `[${import.meta.url}]`, sir = maam;
19
+
20
+ // import {
21
+ // extractErrorMsg,
22
+ // } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
23
+
24
+ // import { GLOBAL_LOG_A_LOT } from '../../core-constants.mjs';
25
+ // import { compressIbGib, compressIbGibGraphToString, decompressIbGibGraphFromString } from './other-helper.mjs';
26
+ // import { FlatIbGibGraph } from './graph-types.mjs';
27
+
28
+ // /**
29
+ // * for verbose logging
30
+ // */
31
+ // const logalot = GLOBAL_LOG_A_LOT || true; // change this when you want to turn off verbose logging
32
+
33
+ // const lcFile: string = `[${pathUtils.basename(import.meta.url)}]`;
34
+
35
+ // const compressDecompressTestName = `compress/decompress dependency graph`;
36
+ // await respecfully(maam, compressDecompressTestName, async () => {
37
+ // await ifWe(maam, `get info...`, async () => {
38
+ // const lc = `[${compressDecompressTestName}]`;
39
+ // try {
40
+
41
+ // if (logalot) { console.log(`${lc} Creating a sample FlatIbGibGraph...`); }
42
+
43
+ // const originalGraph: FlatIbGibGraph = {
44
+ // "root^gib": {
45
+ // ib: "root",
46
+ // gib: "gib",
47
+ // rel8ns: { "child": ["data_node^gib", "binary_node^gib"] },
48
+ // data: { message: "This is the root node" }
49
+ // },
50
+ // "data_node^gib": {
51
+ // ib: "data_node",
52
+ // gib: "gib",
53
+ // rel8ns: undefined,
54
+ // data: { a: 1, b: "hello", c: { nested: true } }
55
+ // },
56
+ // "binary_node^gib": {
57
+ // ib: "binary_node",
58
+ // gib: "gib",
59
+ // rel8ns: undefined,
60
+ // data: new Uint8Array(Array.from({ length: 1024 }, (_, i) => i % 256)) // A larger 1KB binary blob
61
+ // }
62
+ // };
63
+
64
+ // // --- Step 1: Get original size ---
65
+ // // A rough estimate by stringifying the object (doesn't account for binary data well)
66
+ // const roughOriginalSize = JSON.stringify(originalGraph).length;
67
+ // if (logalot) { console.log(`${lc} Rough original size (JSON string): ~${roughOriginalSize} bytes`); }
68
+
69
+ // // --- Step 2: Compress to Blob ---
70
+ // if (logalot) { console.log(`${lc} Compressing to Blob...`); }
71
+ // const compressedBlob = await compressIbGib(originalGraph);
72
+ // if (logalot) { console.log(`${lc} ✅ Compressed Blob size: ${compressedBlob.size} bytes`); }
73
+
74
+ // // --- Step 3: Compress to String ---
75
+ // if (logalot) { console.log(`${lc} Compressing to Base64 String...`); }
76
+ // const compressedString = await compressIbGibGraphToString({ graph: originalGraph });
77
+ // if (logalot) { console.log(`${lc} ✅ Compressed Base64 String size: ${compressedString.length} bytes`); }
78
+
79
+ // // --- Verification ---
80
+ // const sizeRatio = ((compressedString.length / compressedBlob.size) * 100).toFixed(2);
81
+ // // const sizeRatio = ((compressedString.length / compressedBlob.size - 1) * 100).toFixed(2);
82
+ // if (logalot) { console.log(`${lc} (String is ~${sizeRatio}% larger than Blob)`); }
83
+ // // console.log(`${lc} (String is ~${((compressedString.length / compressedBlob.size - 1) * 100).toFixed(1)}% larger than Blob)`);
84
+
85
+ // // --- Step 4: Decompress from String and verify ---
86
+ // if (logalot) { console.log(`${lc} Decompressing from Base64 string...`); }
87
+ // const decompressedGraph = await decompressIbGibGraphFromString({ compressedBase64: compressedString });
88
+
89
+ // const originalBinaryLength = (originalGraph["binary_node^gib"].data as Uint8Array).length;
90
+ // const decompressedBinaryLength = (decompressedGraph["binary_node^gib"].data as Uint8Array).length;
91
+
92
+ // if (logalot) { console.log(`${lc} Decompression complete.`); }
93
+
94
+ // iReckon(maam, decompressedBinaryLength).asTo('decompressedBinaryLength is the same as the originalBinaryLength').isGonnaBe(originalBinaryLength);
95
+ // } catch (error) {
96
+ // console.error(`${lcFile} ${extractErrorMsg(error)}`);
97
+ // throw error;
98
+ // }
99
+ // });
100
+ // });