@loaders.gl/graphs 5.0.0-beta.1 → 5.0.0-beta.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 +4 -2
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/dot-loader-types.cjs +60 -0
- package/dist/dot-loader-types.cjs.map +7 -0
- package/dist/dot-loader-types.d.ts +4 -2
- package/dist/dot-loader-types.d.ts.map +1 -1
- package/dist/dot-loader-types.js +3 -2
- package/dist/dot-loader-types.js.map +1 -1
- package/dist/dot-loader.cjs +15 -295
- package/dist/dot-loader.cjs.map +2 -2
- package/dist/dot-loader.d.ts +2 -1
- package/dist/dot-loader.d.ts.map +1 -1
- package/dist/dot-loader.js +3 -3
- package/dist/dot-loader.js.map +1 -1
- package/dist/gexf-loader-types.cjs +60 -0
- package/dist/gexf-loader-types.cjs.map +7 -0
- package/dist/gexf-loader-types.d.ts +4 -2
- package/dist/gexf-loader-types.d.ts.map +1 -1
- package/dist/gexf-loader-types.js +3 -2
- package/dist/gexf-loader-types.js.map +1 -1
- package/dist/gexf-loader.cjs +1652 -287
- package/dist/gexf-loader.cjs.map +3 -3
- package/dist/gexf-loader.d.ts +2 -1
- package/dist/gexf-loader.d.ts.map +1 -1
- package/dist/gexf-loader.js +3 -3
- package/dist/gexf-loader.js.map +1 -1
- package/dist/graph-types.d.ts +3 -2
- package/dist/graph-types.d.ts.map +1 -1
- package/dist/graphml-loader-types.cjs +60 -0
- package/dist/graphml-loader-types.cjs.map +7 -0
- package/dist/graphml-loader-types.d.ts +4 -2
- package/dist/graphml-loader-types.d.ts.map +1 -1
- package/dist/graphml-loader-types.js +3 -2
- package/dist/graphml-loader-types.js.map +1 -1
- package/dist/graphml-loader.cjs +1633 -280
- package/dist/graphml-loader.cjs.map +3 -3
- package/dist/graphml-loader.d.ts +2 -1
- package/dist/graphml-loader.d.ts.map +1 -1
- package/dist/graphml-loader.js +3 -3
- package/dist/graphml-loader.js.map +1 -1
- package/dist/index.cjs +36 -1930
- package/dist/index.cjs.map +4 -3
- package/dist/lib/build-graph-tables.d.ts.map +1 -1
- package/dist/lib/build-graph-tables.js +2 -4
- package/dist/lib/build-graph-tables.js.map +1 -1
- package/dist/lib/parse-gexf.d.ts.map +1 -1
- package/dist/lib/parse-gexf.js +10 -8
- package/dist/lib/parse-gexf.js.map +1 -1
- package/dist/lib/parse-graphml.js +4 -4
- package/dist/lib/parse-graphml.js.map +1 -1
- package/package.json +9 -7
- package/src/dot-loader-types.ts +2 -1
- package/src/dot-loader.ts +3 -3
- package/src/gexf-loader-types.ts +2 -1
- package/src/gexf-loader.ts +3 -3
- package/src/graph-types.ts +3 -2
- package/src/graphml-loader-types.ts +2 -1
- package/src/graphml-loader.ts +3 -3
- package/src/lib/build-graph-tables.ts +5 -7
- package/src/lib/parse-gexf.ts +10 -8
- package/src/lib/parse-graphml.ts +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @loaders.gl/graphs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Graph loaders for Graphviz DOT, GraphML, and GEXF.
|
|
4
|
+
|
|
5
|
+
Supported formats: DOT, GraphML, GEXF.
|
|
4
6
|
|
|
5
7
|
## Graph output shapes
|
|
6
8
|
|
|
@@ -180,4 +182,4 @@ Foreign namespace extensions are ignored. See the [GEXF specification](https://g
|
|
|
180
182
|
## Sources and credits
|
|
181
183
|
|
|
182
184
|
See [THIRD-PARTY-NOTICES.md](./THIRD-PARTY-NOTICES.md) for implementation lineage
|
|
183
|
-
and applicable notices, and the project-wide [
|
|
185
|
+
and applicable notices, and the project-wide [Attributions and Credits](https://loaders.gl/docs/references-and-credits).
|
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @loaders.gl/graphs: sources and credits
|
|
2
2
|
|
|
3
|
-
Graph loaders are developed by vis.gl contributors against DOT, GEXF and GraphML format definitions.
|
|
3
|
+
Graph loaders are developed by vis.gl contributors against DOT, GEXF and GraphML format definitions. The native @loaders.gl/documents parser supplies XML parsing; Apache Arrow supplies columnar tables.
|
|
4
4
|
|
|
5
5
|
## Scope and maintenance
|
|
6
6
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// dist/dot-loader-types.js
|
|
31
|
+
var dot_loader_types_exports = {};
|
|
32
|
+
__export(dot_loader_types_exports, {
|
|
33
|
+
DOTLoader: () => DOTLoader
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(dot_loader_types_exports);
|
|
36
|
+
var VERSION = true ? "5.0.0-beta.10" : "latest";
|
|
37
|
+
async function preload() {
|
|
38
|
+
const { DOTLoaderWithParser } = await import("@loaders.gl/graphs/dot-loader");
|
|
39
|
+
return DOTLoaderWithParser;
|
|
40
|
+
}
|
|
41
|
+
var DOTLoader = {
|
|
42
|
+
name: "DOT",
|
|
43
|
+
id: "dot",
|
|
44
|
+
module: "graphs",
|
|
45
|
+
version: VERSION,
|
|
46
|
+
extensions: ["dot", "gv"],
|
|
47
|
+
mimeTypes: ["text/vnd.graphviz", "text/x-graphviz", "application/vnd.graphviz"],
|
|
48
|
+
text: true,
|
|
49
|
+
worker: false,
|
|
50
|
+
supportsNativeArrow: true,
|
|
51
|
+
dataType: null,
|
|
52
|
+
batchType: null,
|
|
53
|
+
options: { dot: { shape: "arrow" } },
|
|
54
|
+
preload
|
|
55
|
+
};
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
DOTLoader
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=dot-loader-types.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/dot-loader-types.ts"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Loader} from '@loaders.gl/core/loader-utils';\nimport type {DOTOutput} from './dot-types';\nimport type {GraphShape} from './graph-types';\n\n/** Options for selecting the DOT graph output representation. */\nexport type DOTLoaderOptions = {\n /** Format-specific graph options. */\n dot?: {\n /** Representation of each named table; defaults to Arrow. */\n shape?: GraphShape;\n };\n};\n\n// @ts-ignore __VERSION__ is injected by the build.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** Preloads the DOT parser implementation. */\nasync function preload() {\n const {DOTLoaderWithParser} = await import('@loaders.gl/graphs/dot-loader');\n return DOTLoaderWithParser;\n}\n\n/** Metadata-only loader for Graphviz DOT documents. */\nexport const DOTLoader = {\n name: 'DOT',\n id: 'dot',\n module: 'graphs',\n version: VERSION,\n extensions: ['dot', 'gv'],\n mimeTypes: ['text/vnd.graphviz', 'text/x-graphviz', 'application/vnd.graphviz'],\n text: true,\n worker: false,\n supportsNativeArrow: true,\n dataType: null as unknown as DOTOutput,\n batchType: null as never,\n options: {dot: {shape: 'arrow'}},\n preload\n} as const satisfies Loader<DOTOutput, never, DOTLoaderOptions>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAkBA,IAAM,UAAU,OAAoC,kBAAe;AAGnE,eAAe,UAAO;AACpB,QAAM,EAAC,oBAAmB,IAAI,MAAM,OAAO,+BAA+B;AAC1E,SAAO;AACT;AAGO,IAAM,YAAY;EACvB,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,SAAS;EACT,YAAY,CAAC,OAAO,IAAI;EACxB,WAAW,CAAC,qBAAqB,mBAAmB,0BAA0B;EAC9E,MAAM;EACN,QAAQ;EACR,qBAAqB;EACrB,UAAU;EACV,WAAW;EACX,SAAS,EAAC,KAAK,EAAC,OAAO,QAAO,EAAC;EAC/B;;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -21,11 +21,12 @@ declare function preload(): Promise<{
|
|
|
21
21
|
mimeTypes: ["text/vnd.graphviz", "text/x-graphviz", "application/vnd.graphviz"];
|
|
22
22
|
text: true;
|
|
23
23
|
worker: false;
|
|
24
|
+
supportsNativeArrow: true;
|
|
24
25
|
dataType: DOTOutput;
|
|
25
26
|
batchType: never;
|
|
26
27
|
options: {
|
|
27
28
|
readonly dot: {
|
|
28
|
-
readonly shape: "arrow
|
|
29
|
+
readonly shape: "arrow";
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
preload: typeof preload;
|
|
@@ -40,11 +41,12 @@ export declare const DOTLoader: {
|
|
|
40
41
|
readonly mimeTypes: ["text/vnd.graphviz", "text/x-graphviz", "application/vnd.graphviz"];
|
|
41
42
|
readonly text: true;
|
|
42
43
|
readonly worker: false;
|
|
44
|
+
readonly supportsNativeArrow: true;
|
|
43
45
|
readonly dataType: DOTOutput;
|
|
44
46
|
readonly batchType: never;
|
|
45
47
|
readonly options: {
|
|
46
48
|
readonly dot: {
|
|
47
|
-
readonly shape: "arrow
|
|
49
|
+
readonly shape: "arrow";
|
|
48
50
|
};
|
|
49
51
|
};
|
|
50
52
|
readonly preload: typeof preload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot-loader-types.d.ts","sourceRoot":"","sources":["../src/dot-loader-types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,SAAS,EAAC,uBAAoB;AAC3C,OAAO,KAAK,EAAC,UAAU,EAAC,yBAAsB;AAE9C,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qCAAqC;IACrC,GAAG,CAAC,EAAE;QACJ,6DAA6D;QAC7D,KAAK,CAAC,EAAE,UAAU,CAAC;KACpB,CAAC;CACH,CAAC;AAKF,8CAA8C;AAC9C,iBAAe,OAAO
|
|
1
|
+
{"version":3,"file":"dot-loader-types.d.ts","sourceRoot":"","sources":["../src/dot-loader-types.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,SAAS,EAAC,uBAAoB;AAC3C,OAAO,KAAK,EAAC,UAAU,EAAC,yBAAsB;AAE9C,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qCAAqC;IACrC,GAAG,CAAC,EAAE;QACJ,6DAA6D;QAC7D,KAAK,CAAC,EAAE,UAAU,CAAC;KACpB,CAAC;CACH,CAAC;AAKF,8CAA8C;AAC9C,iBAAe,OAAO;;;;;;;;;;;;;cAgBS,SAAS;eACnB,KAAK;;;;;;;GAdzB;AAED,uDAAuD;AACvD,eAAO,MAAM,SAAS;;;;;;;;;;uBAUS,SAAS;wBACnB,KAAK;;;;;;;CAGqC,CAAC"}
|
package/dist/dot-loader-types.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
// @ts-ignore __VERSION__ is injected by the build.
|
|
5
|
-
const VERSION = typeof "5.0.0-beta.
|
|
5
|
+
const VERSION = typeof "5.0.0-beta.10" !== 'undefined' ? "5.0.0-beta.10" : 'latest';
|
|
6
6
|
/** Preloads the DOT parser implementation. */
|
|
7
7
|
async function preload() {
|
|
8
8
|
const { DOTLoaderWithParser } = await import('@loaders.gl/graphs/dot-loader');
|
|
@@ -18,9 +18,10 @@ export const DOTLoader = {
|
|
|
18
18
|
mimeTypes: ['text/vnd.graphviz', 'text/x-graphviz', 'application/vnd.graphviz'],
|
|
19
19
|
text: true,
|
|
20
20
|
worker: false,
|
|
21
|
+
supportsNativeArrow: true,
|
|
21
22
|
dataType: null,
|
|
22
23
|
batchType: null,
|
|
23
|
-
options: { dot: { shape: 'arrow
|
|
24
|
+
options: { dot: { shape: 'arrow' } },
|
|
24
25
|
preload
|
|
25
26
|
};
|
|
26
27
|
//# sourceMappingURL=dot-loader-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot-loader-types.js","sourceRoot":"","sources":["../src/dot-loader-types.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAepC,mDAAmD;AACnD,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"dot-loader-types.js","sourceRoot":"","sources":["../src/dot-loader-types.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAepC,mDAAmD;AACnD,MAAM,OAAO,GAAG,sBAAkB,KAAK,WAAW,CAAC,CAAC,iBAAa,CAAC,CAAC,QAAQ,CAAC;AAE5E,8CAA8C;AAC9C,KAAK,UAAU,OAAO;IACpB,MAAM,EAAC,mBAAmB,EAAC,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;IAC5E,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,uDAAuD;AACvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,KAAK;IACX,EAAE,EAAE,KAAK;IACT,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC;IACzB,SAAS,EAAE,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,0BAA0B,CAAC;IAC/E,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,KAAK;IACb,mBAAmB,EAAE,IAAI;IACzB,QAAQ,EAAE,IAA4B;IACtC,SAAS,EAAE,IAAa;IACxB,OAAO,EAAE,EAAC,GAAG,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC;IAChC,OAAO;CACsD,CAAC"}
|
package/dist/dot-loader.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __esm = (fn, res, err) => function __init() {
|
|
9
7
|
if (err) throw err[0];
|
|
@@ -25,14 +23,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
23
|
}
|
|
26
24
|
return to;
|
|
27
25
|
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
27
|
|
|
38
28
|
// src/dot-loader-types.ts
|
|
@@ -54,288 +44,21 @@ var init_dot_loader_types = __esm({
|
|
|
54
44
|
mimeTypes: ["text/vnd.graphviz", "text/x-graphviz", "application/vnd.graphviz"],
|
|
55
45
|
text: true,
|
|
56
46
|
worker: false,
|
|
47
|
+
supportsNativeArrow: true,
|
|
57
48
|
dataType: null,
|
|
58
49
|
batchType: null,
|
|
59
|
-
options: { dot: { shape: "arrow
|
|
50
|
+
options: { dot: { shape: "arrow" } },
|
|
60
51
|
preload
|
|
61
52
|
};
|
|
62
53
|
}
|
|
63
54
|
});
|
|
64
55
|
|
|
65
|
-
// ../core/src/schema-utils/lib/schema/convert-arrow-schema.ts
|
|
66
|
-
function convertArrowToSchema(arrowSchema) {
|
|
67
|
-
return serializeArrowSchema(arrowSchema);
|
|
68
|
-
}
|
|
69
|
-
function serializeArrowSchema(arrowSchema) {
|
|
70
|
-
return {
|
|
71
|
-
fields: arrowSchema.fields.map((arrowField) => serializeArrowField(arrowField)),
|
|
72
|
-
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function serializeArrowMetadata(arrowMetadata) {
|
|
76
|
-
return Object.fromEntries(arrowMetadata);
|
|
77
|
-
}
|
|
78
|
-
function serializeArrowField(field) {
|
|
79
|
-
return {
|
|
80
|
-
name: field.name,
|
|
81
|
-
type: serializeArrowType(field.type),
|
|
82
|
-
nullable: field.nullable,
|
|
83
|
-
metadata: serializeArrowMetadata(field.metadata)
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function serializeArrowType(arrowType) {
|
|
87
|
-
if (isArrowViewType(arrowType, "BinaryView")) {
|
|
88
|
-
return "binary-view";
|
|
89
|
-
}
|
|
90
|
-
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
91
|
-
return "utf8-view";
|
|
92
|
-
}
|
|
93
|
-
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
94
|
-
const largeListType = arrowType;
|
|
95
|
-
return {
|
|
96
|
-
type: "large-list",
|
|
97
|
-
children: [serializeArrowField(largeListType.valueField)]
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
switch (arrowType.constructor) {
|
|
101
|
-
case arrow.Null:
|
|
102
|
-
return "null";
|
|
103
|
-
case arrow.Binary:
|
|
104
|
-
return "binary";
|
|
105
|
-
case arrow.FixedSizeBinary:
|
|
106
|
-
return {
|
|
107
|
-
type: "fixed-size-binary",
|
|
108
|
-
byteWidth: arrowType.byteWidth
|
|
109
|
-
};
|
|
110
|
-
case arrow.Bool:
|
|
111
|
-
return "bool";
|
|
112
|
-
case arrow.Int:
|
|
113
|
-
const intType = arrowType;
|
|
114
|
-
return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
|
|
115
|
-
case arrow.Int8:
|
|
116
|
-
return "int8";
|
|
117
|
-
case arrow.Int16:
|
|
118
|
-
return "int16";
|
|
119
|
-
case arrow.Int32:
|
|
120
|
-
return "int32";
|
|
121
|
-
case arrow.Int64:
|
|
122
|
-
return "int64";
|
|
123
|
-
case arrow.Uint8:
|
|
124
|
-
return "uint8";
|
|
125
|
-
case arrow.Uint16:
|
|
126
|
-
return "uint16";
|
|
127
|
-
case arrow.Uint32:
|
|
128
|
-
return "uint32";
|
|
129
|
-
case arrow.Uint64:
|
|
130
|
-
return "uint64";
|
|
131
|
-
case arrow.Float:
|
|
132
|
-
const precision = arrowType.precision;
|
|
133
|
-
switch (precision) {
|
|
134
|
-
case arrow.Precision.HALF:
|
|
135
|
-
return "float16";
|
|
136
|
-
case arrow.Precision.SINGLE:
|
|
137
|
-
return "float32";
|
|
138
|
-
case arrow.Precision.DOUBLE:
|
|
139
|
-
return "float64";
|
|
140
|
-
default:
|
|
141
|
-
return "float16";
|
|
142
|
-
}
|
|
143
|
-
case arrow.Float16:
|
|
144
|
-
return "float16";
|
|
145
|
-
case arrow.Float32:
|
|
146
|
-
return "float32";
|
|
147
|
-
case arrow.Float64:
|
|
148
|
-
return "float64";
|
|
149
|
-
case arrow.Utf8:
|
|
150
|
-
return "utf8";
|
|
151
|
-
case arrow.Decimal:
|
|
152
|
-
const decimal = arrowType;
|
|
153
|
-
return {
|
|
154
|
-
type: "decimal",
|
|
155
|
-
bitWidth: decimal.bitWidth,
|
|
156
|
-
precision: decimal.precision,
|
|
157
|
-
scale: decimal.scale
|
|
158
|
-
};
|
|
159
|
-
case arrow.Date_:
|
|
160
|
-
const dateUnit = arrowType.unit;
|
|
161
|
-
return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
|
|
162
|
-
case arrow.DateDay:
|
|
163
|
-
return "date-day";
|
|
164
|
-
case arrow.DateMillisecond:
|
|
165
|
-
return "date-millisecond";
|
|
166
|
-
case arrow.Time:
|
|
167
|
-
const timeUnit = arrowType.unit;
|
|
168
|
-
switch (timeUnit) {
|
|
169
|
-
case arrow.TimeUnit.SECOND:
|
|
170
|
-
return "time-second";
|
|
171
|
-
case arrow.TimeUnit.MILLISECOND:
|
|
172
|
-
return "time-millisecond";
|
|
173
|
-
case arrow.TimeUnit.MICROSECOND:
|
|
174
|
-
return "time-microsecond";
|
|
175
|
-
case arrow.TimeUnit.NANOSECOND:
|
|
176
|
-
return "time-nanosecond";
|
|
177
|
-
default:
|
|
178
|
-
return "time-second";
|
|
179
|
-
}
|
|
180
|
-
case arrow.TimeMillisecond:
|
|
181
|
-
return "time-millisecond";
|
|
182
|
-
case arrow.TimeSecond:
|
|
183
|
-
return "time-second";
|
|
184
|
-
case arrow.TimeMicrosecond:
|
|
185
|
-
return "time-microsecond";
|
|
186
|
-
case arrow.TimeNanosecond:
|
|
187
|
-
return "time-nanosecond";
|
|
188
|
-
case arrow.Timestamp:
|
|
189
|
-
const timeStampUnit = arrowType.unit;
|
|
190
|
-
switch (timeStampUnit) {
|
|
191
|
-
case arrow.TimeUnit.SECOND:
|
|
192
|
-
return "timestamp-second";
|
|
193
|
-
case arrow.TimeUnit.MILLISECOND:
|
|
194
|
-
return "timestamp-millisecond";
|
|
195
|
-
case arrow.TimeUnit.MICROSECOND:
|
|
196
|
-
return "timestamp-microsecond";
|
|
197
|
-
case arrow.TimeUnit.NANOSECOND:
|
|
198
|
-
return "timestamp-nanosecond";
|
|
199
|
-
default:
|
|
200
|
-
return "timestamp-second";
|
|
201
|
-
}
|
|
202
|
-
case arrow.TimestampSecond:
|
|
203
|
-
return "timestamp-second";
|
|
204
|
-
case arrow.TimestampMillisecond:
|
|
205
|
-
return "timestamp-millisecond";
|
|
206
|
-
case arrow.TimestampMicrosecond:
|
|
207
|
-
return "timestamp-microsecond";
|
|
208
|
-
case arrow.TimestampNanosecond:
|
|
209
|
-
return "timestamp-nanosecond";
|
|
210
|
-
case arrow.Interval:
|
|
211
|
-
const intervalUnit = arrowType.unit;
|
|
212
|
-
switch (intervalUnit) {
|
|
213
|
-
case arrow.IntervalUnit.DAY_TIME:
|
|
214
|
-
return "interval-daytime";
|
|
215
|
-
case arrow.IntervalUnit.YEAR_MONTH:
|
|
216
|
-
return "interval-yearmonth";
|
|
217
|
-
default:
|
|
218
|
-
return "interval-daytime";
|
|
219
|
-
}
|
|
220
|
-
case arrow.IntervalDayTime:
|
|
221
|
-
return "interval-daytime";
|
|
222
|
-
case arrow.IntervalYearMonth:
|
|
223
|
-
return "interval-yearmonth";
|
|
224
|
-
case arrow.Map_:
|
|
225
|
-
const mapType = arrowType;
|
|
226
|
-
return {
|
|
227
|
-
type: "map",
|
|
228
|
-
keysSorted: mapType.keysSorted,
|
|
229
|
-
children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
|
|
230
|
-
};
|
|
231
|
-
case arrow.List:
|
|
232
|
-
const listType = arrowType;
|
|
233
|
-
const listField = listType.valueField;
|
|
234
|
-
return {
|
|
235
|
-
type: "list",
|
|
236
|
-
children: [serializeArrowField(listField)]
|
|
237
|
-
};
|
|
238
|
-
case arrow.FixedSizeList:
|
|
239
|
-
const fixedSizeList = arrowType;
|
|
240
|
-
return {
|
|
241
|
-
type: "fixed-size-list",
|
|
242
|
-
listSize: fixedSizeList.listSize,
|
|
243
|
-
children: [serializeArrowField(fixedSizeList.children[0])]
|
|
244
|
-
};
|
|
245
|
-
case arrow.Struct:
|
|
246
|
-
const structType = arrowType;
|
|
247
|
-
return {
|
|
248
|
-
type: "struct",
|
|
249
|
-
children: structType.children.map((arrowField) => serializeArrowField(arrowField))
|
|
250
|
-
};
|
|
251
|
-
case arrow.SparseUnion:
|
|
252
|
-
case arrow.DenseUnion:
|
|
253
|
-
const unionType = arrowType;
|
|
254
|
-
return {
|
|
255
|
-
type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
|
|
256
|
-
typeIds: unionType.typeIds,
|
|
257
|
-
children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
|
|
258
|
-
typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
|
|
259
|
-
};
|
|
260
|
-
case arrow.Dictionary:
|
|
261
|
-
const dictionaryType = arrowType;
|
|
262
|
-
return {
|
|
263
|
-
type: "dictionary",
|
|
264
|
-
id: dictionaryType.id,
|
|
265
|
-
indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
|
|
266
|
-
dictionary: serializeArrowType(dictionaryType.dictionary),
|
|
267
|
-
isOrdered: dictionaryType.isOrdered
|
|
268
|
-
};
|
|
269
|
-
default:
|
|
270
|
-
throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
function getOptionalArrowConstructor(typeName) {
|
|
274
|
-
return arrow[typeName];
|
|
275
|
-
}
|
|
276
|
-
function isArrowViewType(arrowType, viewTypeName) {
|
|
277
|
-
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
278
|
-
if (constructor && arrowType instanceof constructor) {
|
|
279
|
-
return true;
|
|
280
|
-
}
|
|
281
|
-
const guards = arrow.DataType;
|
|
282
|
-
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
283
|
-
return Boolean(guard == null ? void 0 : guard(arrowType));
|
|
284
|
-
}
|
|
285
|
-
function isOptionalArrowType(arrowType, typeName) {
|
|
286
|
-
const constructor = getOptionalArrowConstructor(typeName);
|
|
287
|
-
return Boolean(constructor && arrowType instanceof constructor);
|
|
288
|
-
}
|
|
289
|
-
function serializeArrowDictionaryKeyType(arrowType) {
|
|
290
|
-
if (arrowType instanceof arrow.Int) {
|
|
291
|
-
const prefix = arrowType.isSigned ? "int" : "uint";
|
|
292
|
-
const keyType = `${prefix}${arrowType.bitWidth}`;
|
|
293
|
-
if (isSchemaDictionaryKeyType(keyType)) {
|
|
294
|
-
return keyType;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
switch (arrowType.constructor) {
|
|
298
|
-
case arrow.Int8:
|
|
299
|
-
return "int8";
|
|
300
|
-
case arrow.Int16:
|
|
301
|
-
return "int16";
|
|
302
|
-
case arrow.Int32:
|
|
303
|
-
return "int32";
|
|
304
|
-
case arrow.Uint8:
|
|
305
|
-
return "uint8";
|
|
306
|
-
case arrow.Uint16:
|
|
307
|
-
return "uint16";
|
|
308
|
-
case arrow.Uint32:
|
|
309
|
-
return "uint32";
|
|
310
|
-
default:
|
|
311
|
-
throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
function isSchemaDictionaryKeyType(keyType) {
|
|
315
|
-
return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
|
|
316
|
-
}
|
|
317
|
-
var arrow;
|
|
318
|
-
var init_convert_arrow_schema = __esm({
|
|
319
|
-
"../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
|
|
320
|
-
"use strict";
|
|
321
|
-
arrow = __toESM(require("apache-arrow"), 1);
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
// ../core/src/schema-utils/index.ts
|
|
326
|
-
var init_schema_utils = __esm({
|
|
327
|
-
"../core/src/schema-utils/index.ts"() {
|
|
328
|
-
"use strict";
|
|
329
|
-
init_convert_arrow_schema();
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
|
|
333
56
|
// src/lib/build-graph-tables.ts
|
|
334
57
|
function buildGraphTables(nodes, edges, shape, declarations) {
|
|
335
58
|
if (shape === "plain-graph-data") {
|
|
336
59
|
return { shape, nodes: Array.from(nodes), edges: Array.from(edges) };
|
|
337
60
|
}
|
|
338
|
-
if (shape !== "arrow
|
|
61
|
+
if (shape !== "arrow" && shape !== "object-row-table") {
|
|
339
62
|
throw new Error(`Unsupported graph shape: ${shape}`);
|
|
340
63
|
}
|
|
341
64
|
const nodeTable = buildGraphTable(nodes, false, shape, declarations == null ? void 0 : declarations.nodes);
|
|
@@ -375,8 +98,7 @@ function buildGraphTable(records, isEdge, shape, declarations) {
|
|
|
375
98
|
type
|
|
376
99
|
);
|
|
377
100
|
}
|
|
378
|
-
|
|
379
|
-
return { shape, schema: convertArrowToSchema(data.schema), data };
|
|
101
|
+
return new import_apache_arrow.Table(vectors);
|
|
380
102
|
}
|
|
381
103
|
function inferAttributeType(values, declarations) {
|
|
382
104
|
const names = new Set(declarations == null ? void 0 : declarations.keys());
|
|
@@ -471,7 +193,6 @@ var init_build_graph_tables = __esm({
|
|
|
471
193
|
"src/lib/build-graph-tables.ts"() {
|
|
472
194
|
"use strict";
|
|
473
195
|
import_apache_arrow = require("apache-arrow");
|
|
474
|
-
init_schema_utils();
|
|
475
196
|
}
|
|
476
197
|
});
|
|
477
198
|
|
|
@@ -1196,15 +917,15 @@ var init_dot_loader = __esm({
|
|
|
1196
917
|
...DOTLoader,
|
|
1197
918
|
parse: async (data, options) => {
|
|
1198
919
|
var _a;
|
|
1199
|
-
return parseDOT(new TextDecoder().decode(data), ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow
|
|
920
|
+
return parseDOT(new TextDecoder().decode(data), ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow");
|
|
1200
921
|
},
|
|
1201
922
|
parseSync: (data, options) => {
|
|
1202
923
|
var _a;
|
|
1203
|
-
return parseDOT(new TextDecoder().decode(data), ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow
|
|
924
|
+
return parseDOT(new TextDecoder().decode(data), ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow");
|
|
1204
925
|
},
|
|
1205
926
|
parseTextSync: (data, options) => {
|
|
1206
927
|
var _a;
|
|
1207
|
-
return parseDOT(data, ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow
|
|
928
|
+
return parseDOT(data, ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow");
|
|
1208
929
|
}
|
|
1209
930
|
};
|
|
1210
931
|
}
|
|
@@ -1218,7 +939,7 @@ __export(dot_loader_exports2, {
|
|
|
1218
939
|
module.exports = __toCommonJS(dot_loader_exports2);
|
|
1219
940
|
|
|
1220
941
|
// dist/dot-loader-types.js
|
|
1221
|
-
var VERSION2 = true ? "5.0.0-beta.
|
|
942
|
+
var VERSION2 = true ? "5.0.0-beta.10" : "latest";
|
|
1222
943
|
async function preload2() {
|
|
1223
944
|
const { DOTLoaderWithParser: DOTLoaderWithParser3 } = await Promise.resolve().then(() => (init_dot_loader(), dot_loader_exports));
|
|
1224
945
|
return DOTLoaderWithParser3;
|
|
@@ -1232,20 +953,20 @@ var DOTLoader2 = {
|
|
|
1232
953
|
mimeTypes: ["text/vnd.graphviz", "text/x-graphviz", "application/vnd.graphviz"],
|
|
1233
954
|
text: true,
|
|
1234
955
|
worker: false,
|
|
956
|
+
supportsNativeArrow: true,
|
|
1235
957
|
dataType: null,
|
|
1236
958
|
batchType: null,
|
|
1237
|
-
options: { dot: { shape: "arrow
|
|
959
|
+
options: { dot: { shape: "arrow" } },
|
|
1238
960
|
preload: preload2
|
|
1239
961
|
};
|
|
1240
962
|
|
|
1241
963
|
// dist/lib/build-graph-tables.js
|
|
1242
964
|
var import_apache_arrow2 = require("apache-arrow");
|
|
1243
|
-
init_schema_utils();
|
|
1244
965
|
function buildGraphTables2(nodes, edges, shape, declarations) {
|
|
1245
966
|
if (shape === "plain-graph-data") {
|
|
1246
967
|
return { shape, nodes: Array.from(nodes), edges: Array.from(edges) };
|
|
1247
968
|
}
|
|
1248
|
-
if (shape !== "arrow
|
|
969
|
+
if (shape !== "arrow" && shape !== "object-row-table") {
|
|
1249
970
|
throw new Error(`Unsupported graph shape: ${shape}`);
|
|
1250
971
|
}
|
|
1251
972
|
const nodeTable = buildGraphTable2(nodes, false, shape, declarations == null ? void 0 : declarations.nodes);
|
|
@@ -1278,8 +999,7 @@ function buildGraphTable2(records, isEdge, shape, declarations) {
|
|
|
1278
999
|
const type = name === "attributes" ? inferAttributeType2(values, declarations) : name === "directed" ? new import_apache_arrow2.Bool() : new import_apache_arrow2.Utf8();
|
|
1279
1000
|
vectors[name] = (0, import_apache_arrow2.vectorFromArray)(values.map((value) => normalizeValue2(value, type)), type);
|
|
1280
1001
|
}
|
|
1281
|
-
|
|
1282
|
-
return { shape, schema: convertArrowToSchema(data.schema), data };
|
|
1002
|
+
return new import_apache_arrow2.Table(vectors);
|
|
1283
1003
|
}
|
|
1284
1004
|
function inferAttributeType2(values, declarations) {
|
|
1285
1005
|
const names = new Set(declarations == null ? void 0 : declarations.keys());
|
|
@@ -2059,15 +1779,15 @@ var DOTLoaderWithParser2 = {
|
|
|
2059
1779
|
...DOTLoader2,
|
|
2060
1780
|
parse: async (data, options) => {
|
|
2061
1781
|
var _a;
|
|
2062
|
-
return parseDOT2(new TextDecoder().decode(data), ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow
|
|
1782
|
+
return parseDOT2(new TextDecoder().decode(data), ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow");
|
|
2063
1783
|
},
|
|
2064
1784
|
parseSync: (data, options) => {
|
|
2065
1785
|
var _a;
|
|
2066
|
-
return parseDOT2(new TextDecoder().decode(data), ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow
|
|
1786
|
+
return parseDOT2(new TextDecoder().decode(data), ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow");
|
|
2067
1787
|
},
|
|
2068
1788
|
parseTextSync: (data, options) => {
|
|
2069
1789
|
var _a;
|
|
2070
|
-
return parseDOT2(data, ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow
|
|
1790
|
+
return parseDOT2(data, ((_a = options == null ? void 0 : options.dot) == null ? void 0 : _a.shape) ?? "arrow");
|
|
2071
1791
|
}
|
|
2072
1792
|
};
|
|
2073
1793
|
//# sourceMappingURL=dot-loader.cjs.map
|