@graphty/graph-io 0.3.26 → 0.3.27
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/dist/chunks/{choose-BbJI55dx.js → choose-DrXtu_96.js} +2 -2
- package/dist/chunks/{choose-BbJI55dx.js.map → choose-DrXtu_96.js.map} +1 -1
- package/dist/chunks/{constants-BCsFsMj4.js → constants-ikG85dT8.js} +2 -2
- package/dist/chunks/{constants-BCsFsMj4.js.map → constants-ikG85dT8.js.map} +1 -1
- package/dist/chunks/{escape-D0g6NNUy.js → escape-D1HPTUrP.js} +10 -9
- package/dist/chunks/escape-D1HPTUrP.js.map +1 -0
- package/dist/chunks/{export-BTI4yQgy.js → export-CHd4tQE2.js} +4 -4
- package/dist/chunks/export-CHd4tQE2.js.map +1 -0
- package/dist/chunks/{exporter-Cra2GYcN.js → exporter-D23CKNqF.js} +5 -5
- package/dist/chunks/exporter-D23CKNqF.js.map +1 -0
- package/dist/chunks/{exporter-tne475KK.js → exporter-DfWTgrti.js} +5 -5
- package/dist/chunks/exporter-DfWTgrti.js.map +1 -0
- package/dist/chunks/{exporter-BMqk5oxW.js → exporter-DhtW6FxK.js} +3 -3
- package/dist/chunks/{exporter-BMqk5oxW.js.map → exporter-DhtW6FxK.js.map} +1 -1
- package/dist/chunks/{exporter-Dxh231ZF.js → exporter-IHv4nkCm.js} +4 -4
- package/dist/chunks/exporter-IHv4nkCm.js.map +1 -0
- package/dist/chunks/{importer-BfIsp1f9.js → importer-B1wmPQjr.js} +5 -5
- package/dist/chunks/{importer-BfIsp1f9.js.map → importer-B1wmPQjr.js.map} +1 -1
- package/dist/chunks/{importer-Bcl1d4xH.js → importer-B2W_58pz.js} +5 -5
- package/dist/chunks/importer-B2W_58pz.js.map +1 -0
- package/dist/chunks/{importer-90YWhJoF.js → importer-BSALvkui.js} +9 -9
- package/dist/chunks/importer-BSALvkui.js.map +1 -0
- package/dist/chunks/{importer-DfVu6j59.js → importer-BVRE--Un.js} +4 -4
- package/dist/chunks/importer-BVRE--Un.js.map +1 -0
- package/dist/chunks/{importer-DCjOvO7U.js → importer-CIAzt-wo.js} +6 -6
- package/dist/chunks/importer-CIAzt-wo.js.map +1 -0
- package/dist/chunks/{importer-Dku_VAIY.js → importer-DpEW5zeG.js} +4 -4
- package/dist/chunks/{importer-Dku_VAIY.js.map → importer-DpEW5zeG.js.map} +1 -1
- package/dist/chunks/{importer-C_TEA1zJ.js → importer-z_FL4VMb.js} +9 -9
- package/dist/chunks/importer-z_FL4VMb.js.map +1 -0
- package/dist/chunks/{json-elements-3tnyt5uZ.js → json-elements-BAmNBZok.js} +4 -4
- package/dist/chunks/json-elements-BAmNBZok.js.map +1 -0
- package/dist/chunks/{ontology-export-B9Tcf37D.js → ontology-export-Bab4eUA8.js} +2 -2
- package/dist/chunks/{ontology-export-B9Tcf37D.js.map → ontology-export-Bab4eUA8.js.map} +1 -1
- package/dist/chunks/{records-CQXT__mY.js → records-CdlvL4RO.js} +2 -2
- package/dist/chunks/{records-CQXT__mY.js.map → records-CdlvL4RO.js.map} +1 -1
- package/dist/chunks/{text-DmcUs5_Q.js → text-DzXjAiTl.js} +2 -2
- package/dist/chunks/{text-DmcUs5_Q.js.map → text-DzXjAiTl.js.map} +1 -1
- package/dist/csv.js +5 -5
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +1 -1
- package/dist/gexf.js +2 -2
- package/dist/gml.js +5 -5
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +26 -26
- package/dist/graphml.js +2 -2
- package/dist/json.js +1 -1
- package/dist/neo4j.js +4 -4
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/common/declared-types.js +2 -2
- package/dist/src/common/declared-types.js.map +1 -1
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +6 -5
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.js +1 -1
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/lists.js +1 -1
- package/dist/src/common/lists.js.map +1 -1
- package/dist/src/common/xml.js +2 -2
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/csv/exporter.js +1 -1
- package/dist/src/formats/csv/exporter.js.map +1 -1
- package/dist/src/formats/cx/importer.js +2 -2
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cx2/importer.js +1 -1
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cys/session.js +3 -3
- package/dist/src/formats/cys/session.js.map +1 -1
- package/dist/src/formats/gml/syntax.js +2 -2
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +1 -1
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/pajek/exporter.js +1 -1
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/syntax.js +3 -3
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +1 -1
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/values.js +1 -1
- package/dist/src/formats/xgmml/values.js.map +1 -1
- package/dist/xgmml.js +2 -2
- package/package.json +2 -2
- package/src/common/declared-types.ts +2 -2
- package/src/common/escape.ts +6 -5
- package/src/common/input.ts +2 -2
- package/src/common/json-elements.ts +1 -1
- package/src/common/lists.ts +1 -1
- package/src/common/xml.ts +2 -2
- package/src/formats/csv/exporter.ts +1 -1
- package/src/formats/cx/importer.ts +2 -2
- package/src/formats/cx2/exporter.ts +1 -1
- package/src/formats/cx2/importer.ts +1 -1
- package/src/formats/cys/session.ts +3 -3
- package/src/formats/gml/syntax.ts +2 -2
- package/src/formats/json/dialect.ts +1 -1
- package/src/formats/neo4j/exporter.ts +2 -2
- package/src/formats/pajek/exporter.ts +1 -1
- package/src/formats/pajek/syntax.ts +3 -3
- package/src/formats/xgmml/exporter.ts +1 -1
- package/src/formats/xgmml/values.ts +1 -1
- package/dist/chunks/escape-D0g6NNUy.js.map +0 -1
- package/dist/chunks/export-BTI4yQgy.js.map +0 -1
- package/dist/chunks/exporter-Cra2GYcN.js.map +0 -1
- package/dist/chunks/exporter-Dxh231ZF.js.map +0 -1
- package/dist/chunks/exporter-tne475KK.js.map +0 -1
- package/dist/chunks/importer-90YWhJoF.js.map +0 -1
- package/dist/chunks/importer-Bcl1d4xH.js.map +0 -1
- package/dist/chunks/importer-C_TEA1zJ.js.map +0 -1
- package/dist/chunks/importer-DCjOvO7U.js.map +0 -1
- package/dist/chunks/importer-DfVu6j59.js.map +0 -1
- package/dist/chunks/json-elements-3tnyt5uZ.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphFormatError } from "@graphty/graph-format";
|
|
2
|
-
import { a as CX2_FORMAT, s as stringify, d as directionNotes, p as planNodeIds, O as ORIGINAL_ID_ATTRIBUTE, n as nonFinitePositions, b as planEdgeIds, e as cx2Type, f as aspectBlock, B as BYPASS_NAMESPACE, g as declaredType } from "./importer-
|
|
3
|
-
import { c as capabilities, L as LOSS, r as resolveExportOptions, a as checkCapabilities, p as pairFolding, e as explicitWeights, b as plural } from "./export-
|
|
4
|
-
import { i as isRecord, P as POSITION_COLUMN } from "./json-elements-
|
|
2
|
+
import { a as CX2_FORMAT, s as stringify, d as directionNotes, p as planNodeIds, O as ORIGINAL_ID_ATTRIBUTE, n as nonFinitePositions, b as planEdgeIds, e as cx2Type, f as aspectBlock, B as BYPASS_NAMESPACE, g as declaredType } from "./importer-BVRE--Un.js";
|
|
3
|
+
import { c as capabilities, L as LOSS, r as resolveExportOptions, a as checkCapabilities, p as pairFolding, e as explicitWeights, b as plural } from "./export-CHd4tQE2.js";
|
|
4
|
+
import { i as isRecord, P as POSITION_COLUMN } from "./json-elements-BAmNBZok.js";
|
|
5
5
|
import { j as joinText, e as encodeChunks } from "./writer-DxjgHwSe.js";
|
|
6
6
|
const CX2_LOSS = Object.freeze({
|
|
7
7
|
/**
|
|
@@ -542,4 +542,4 @@ export {
|
|
|
542
542
|
CX2_LOSS as a,
|
|
543
543
|
cx2Exporter as c
|
|
544
544
|
};
|
|
545
|
-
//# sourceMappingURL=exporter-
|
|
545
|
+
//# sourceMappingURL=exporter-IHv4nkCm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporter-IHv4nkCm.js","sources":["../../src/formats/cx2/exporter.ts"],"sourcesContent":["/**\n * The CX2 exporter (design/graph-io/cytoscape-and-obo/design.md section 1.3; graphty issue #307):\n * writes a snapshot as one CX2 document -- the descriptor, the pre-metadata, one\n * `attributeDeclarations` block (aliases from `origin.id`, defaults from `meta.default`),\n * `networkAttributes`, `nodes` (x / y from the position with y flipped back to screen coordinates,\n * `z` from the `z` column), `edges`, the `cx2.bypass` columns as `nodeBypasses` / `edgeBypasses`,\n * the opaque aspects a CX2 import kept (which returns its own style rules) and `status`.\n *\n * What CX2 cannot hold is announced by check() before anything is written: every edge is\n * directed (W_CX2_UNDIRECTED_AS_DIRECTED, W_MUTUAL_EXPANDED), node ids are integers (E_ID_CHARSET\n * unless `sanitizeIds: \"mangle\"`, which keeps the original in the `graphty:originalId` attribute\n * the importer restores), nested values are written as JSON text (W_CX2_JSON_AS_STRING), NaN and\n * the infinities as null (W_CX2_NONFINITE_AS_NULL), and the generic notes of checkCapabilities().\n */\n\nimport { type Column, GraphFormatError, type GraphSnapshot } from \"@graphty/graph-format\";\n\nimport {\n aspectBlock,\n declaredType,\n directionNotes,\n nonFinitePositions,\n planEdgeIds,\n planNodeIds,\n stringify,\n type WrittenIds,\n} from \"../../common/cx-export.js\";\nimport { type PairFolding, pairFolding } from \"../../common/direction.js\";\nimport { capabilities, checkCapabilities, LOSS } from \"../../common/export.js\";\nimport { isRecord, POSITION_COLUMN } from \"../../common/json-elements.js\";\nimport { type ResolvedExportOptions, resolveExportOptions } from \"../../common/options.js\";\nimport { plural } from \"../../common/plural.js\";\nimport { type ExplicitWeights, explicitWeights } from \"../../common/weights.js\";\nimport { encodeChunks, joinText } from \"../../common/writer.js\";\nimport { type CommonExportOptions, type ExportCapabilities, type GraphExporter, type LossNote } from \"../../types.js\";\nimport { BYPASS_NAMESPACE, CX2_FORMAT, cx2Type, ORIGINAL_ID_ATTRIBUTE } from \"./importer.js\";\n\n/**\n * The options of the CX2 exporter: the common export options; it has none of its own.\n * @category Built-in formats\n */\nexport type Cx2ExportOptions = CommonExportOptions;\n\n/**\n * The loss notes the CX2 exporter's check() returns, by name. A key is the\n * code without its severity and format prefixes.\n * @category Built-in formats\n */\nexport const CX2_LOSS = Object.freeze({\n /**\n * Every edge is written as directed, so an undirected graph, or the undirected edges of a mixed graph, read back\n * as directed.\n */\n UNDIRECTED_AS_DIRECTED: \"W_CX2_UNDIRECTED_AS_DIRECTED\",\n /** A nested (json) column is written as a string attribute holding its JSON text. */\n JSON_AS_STRING: \"W_CX2_JSON_AS_STRING\",\n /** NaN and the infinities cannot be written; they are written as null and read back unset. */\n NONFINITE_AS_NULL: \"W_CX2_NONFINITE_AS_NULL\",\n /** A mutual pair is written as two directed edges without its mark. */\n MUTUAL_EXPANDED: LOSS.MUTUAL_EXPANDED,\n /**\n * An attribute without the weight role is named like the key weights are written under; it reads back as the edge\n * weight, or is not written when the graph has weights of its own.\n */\n WEIGHT_KEY_CLASH: LOSS.WEIGHT_KEY_CLASH,\n /** A parent / parents column: CX2 has no containment. */\n HIERARCHY_DROPPED: LOSS.HIERARCHY,\n /** A start / end / timestamp column: CX2 has no time. */\n TEMPORAL_DROPPED: LOSS.TEMPORAL,\n /** An attribute with a role the format has no place for is written as a plain attribute; the role is lost. */\n ROLE_DROPPED: LOSS.ROLE,\n /**\n * An attribute type CX2 stores as another (a 32-bit float as double, an unsigned integer as long, a dictionary as\n * string); it reads back with that type.\n */\n DTYPE_UNSUPPORTED: LOSS.DTYPE,\n /**\n * Node ids the format cannot write, under `sanitizeIds: \"error\"`; the save fails with E_INVALID_ID. Pass\n * `sanitizeIds: \"mangle\"` to rewrite them.\n */\n ID_CHARSET: LOSS.ID_CHARSET,\n /** Node ids that are not integers under sanitizeIds \"mangle\": renumbered, originals kept. */\n ID_MANGLED: LOSS.ID_MANGLED,\n /** Edges without a usable id get generated integer ids. */\n EDGE_IDS_GENERATED: LOSS.EDGE_IDS_GENERATED,\n});\n\n/**\n * What CX2 keeps: directed multigraphs with self-loops, integer node ids,\n * required integer edge ids, declared string / double / integer / boolean columns and lists of\n * them, declared defaults, network attributes and the position role. f32, u32, u8 and dict columns\n * are written as the nearest declared type and read back as it.\n * @category Built-in formats\n */\nexport const CX2_CAPABILITIES: ExportCapabilities = capabilities({\n mixedDirection: false,\n multiEdges: true,\n selfLoops: true,\n edgeIds: \"required\",\n idCharset: \"integer\",\n dtypes: [\"string\", \"f64\", \"i32\", \"bool\"],\n components: false,\n lists: true,\n json: false,\n defaults: true,\n options: false,\n hierarchy: false,\n temporal: \"none\",\n graphAttributes: true,\n positions: true,\n viz: false,\n});\n\n/** The roles CX2 has a slot for, and the column names its importer gives them. */\nconst SLOT_ROLES: ReadonlySet<string> = new Set([\"label\", \"position\", \"id\"]);\nconst ROLE_NAMES: Readonly<Record<string, string>> = Object.freeze({\n label: \"name\",\n position: POSITION_COLUMN,\n});\n\n/** Roles whose columns are never written as attributes. */\nconst SKIPPED_ROLES: ReadonlySet<string> = new Set([\n \"directed\",\n \"pair\",\n \"mutual\",\n \"weight\",\n \"timeText\",\n \"originalId\",\n \"parent\",\n \"parents\",\n \"start\",\n \"end\",\n \"timestamp\",\n \"timestamps\",\n \"spells\",\n \"open\",\n \"spellsOpen\",\n \"position\",\n \"color\",\n \"size\",\n \"shape\",\n \"thickness\",\n]);\n\n/** The aspects the exporter writes itself; an opaque aspect of the same name is not written again. */\nconst CORE_ASPECTS: ReadonlySet<string> = new Set([\n \"nodes\",\n \"edges\",\n \"attributeDeclarations\",\n \"networkAttributes\",\n \"nodeBypasses\",\n \"edgeBypasses\",\n \"metaData\",\n \"status\",\n]);\n\n/** The weight attribute name. */\nconst WEIGHT_ATTRIBUTE = \"weight\";\n\n/** One attribute column as it will be written. */\ninterface AttributePlan {\n readonly column: Column;\n /** The full attribute name. */\n readonly name: string;\n /** The key used in v (the alias, or the name). */\n readonly key: string;\n /** The declared type text. */\n readonly d: string;\n /** Whether values are written as their JSON text (a json column). */\n readonly jsonText: boolean;\n}\n\n/** Everything export() and check() need, computed once. */\ninterface Plan {\n readonly notes: LossNote[];\n readonly fatal: GraphFormatError | null;\n readonly ids: WrittenIds | null;\n readonly folding: PairFolding;\n readonly weights: ExplicitWeights;\n readonly nodeAttrs: readonly AttributePlan[];\n readonly edgeAttrs: readonly AttributePlan[];\n readonly graphAttrs: readonly AttributePlan[];\n readonly nodeBypasses: readonly Column[];\n readonly edgeBypasses: readonly Column[];\n readonly position: Column | null;\n readonly positionZ: boolean;\n readonly z: Column | null;\n readonly edgeIds: readonly number[];\n readonly originalIds: boolean;\n}\n\n/**\n * Whether a column is a bypass column of a CX2 import.\n * @param column - the column\n * @returns true for the cx2.bypass namespace\n */\nfunction isBypass(column: Column): boolean {\n return column.meta.origin?.namespace === BYPASS_NAMESPACE;\n}\n\n/**\n * Whether a column is the z (stacking order) column.\n * @param column - the column\n * @returns true for the column marked by a Cytoscape-family importer\n */\nfunction isZ(column: Column): boolean {\n return column.meta.extra.cytoscape === \"z\";\n}\n\n/**\n * Count the non-finite numbers of a column.\n * @param column - the column\n * @returns how many set cells (or list items) are NaN or infinite\n */\nfunction nonFiniteCount(column: Column): number {\n const { dtype, itemDtype } = column.meta;\n const numeric =\n dtype === \"f32\" || dtype === \"f64\" || (dtype === \"list\" && (itemDtype === \"f32\" || itemDtype === \"f64\"));\n if (!numeric) {\n return 0;\n }\n let count = 0;\n for (let i = 0; i < column.length; i++) {\n if (!column.isSet(i)) {\n continue;\n }\n const value = column.value(i);\n if (dtype === \"list\") {\n if ((value as readonly number[]).some((v) => !Number.isFinite(v))) {\n count++;\n }\n } else if (!Number.isFinite(value)) {\n count++;\n }\n }\n return count;\n}\n\n/**\n * Plan the attribute columns of one table.\n * @param table - the table\n * @param skip - columns not written as attributes\n * @param rename - the written name of a column, when it differs (the label as `name`)\n * @param reserved - keys already used in v\n * @returns the plans\n */\nfunction planAttributes(\n table: Iterable<Column>,\n skip: (column: Column) => boolean,\n rename: (column: Column) => string,\n reserved: ReadonlySet<string> = new Set(),\n): AttributePlan[] {\n const plans: AttributePlan[] = [];\n const used = new Set<string>(reserved);\n const candidates = [...table].filter((c) => !skip(c));\n for (const column of candidates) {\n used.add(rename(column));\n }\n for (const column of candidates) {\n const name = rename(column);\n const { origin } = column.meta;\n let key = name;\n const alias = origin?.format === CX2_FORMAT && typeof origin.id === \"string\" ? origin.id : null;\n if (alias !== null && alias.length > 0 && alias !== name && !used.has(alias)) {\n key = alias;\n used.add(alias);\n }\n plans.push({ column, name, key, d: declaredType(column), jsonText: column.meta.dtype === \"json\" });\n }\n return plans;\n}\n\n/**\n * Plan an export: the notes, the fatal condition and what is written.\n * @param snapshot - the snapshot\n * @param common - the resolved common options\n * @returns the plan\n */\nfunction plan(snapshot: GraphSnapshot, common: ResolvedExportOptions): Plan {\n const notes: LossNote[] = [];\n let fatal: GraphFormatError | null = null;\n const note = (code: string, message: string, column: string | null = null, count: number | null = null): void => {\n notes.push(Object.freeze({ code, message, column, count }));\n };\n // bypass columns are written as bypasses, which hold any JSON value\n const bypassNames = new Set(\n [...snapshot.nodes, ...snapshot.edges].filter((c) => isBypass(c) || isZ(c)).map((c) => c.meta.name),\n );\n for (const gen of checkCapabilities(snapshot, CX2_CAPABILITIES, common, {\n roles: SLOT_ROLES,\n roleNames: ROLE_NAMES,\n })) {\n if (gen.column !== null && bypassNames.has(gen.column) && (gen.code === LOSS.JSON || gen.code === LOSS.DTYPE)) {\n continue;\n }\n if (gen.code === LOSS.ID_CHARSET || gen.code === LOSS.ID_MANGLED) {\n // counted below: CX2 also keeps integer ids beyond 2^53, which the generic rule refuses\n continue;\n }\n if (gen.code === LOSS.JSON) {\n note(\n CX2_LOSS.JSON_AS_STRING,\n `${gen.column === null ? \"a column\" : `column \"${gen.column}\"`} holds nested values; written as a string attribute holding their JSON text`,\n gen.column,\n gen.count,\n );\n continue;\n }\n if (gen.code === LOSS.MIXED_DIRECTION_ERROR && fatal === null) {\n fatal = new GraphFormatError(\"E_DIRECTED\", gen.message, { reason: \"mixed direction\" });\n }\n notes.push(gen);\n }\n\n const folding = pairFolding(snapshot);\n directionNotes(snapshot, folding, common, CX2_LOSS.UNDIRECTED_AS_DIRECTED, note);\n\n const planned = planNodeIds(snapshot, common, \"CX2\", ORIGINAL_ID_ATTRIBUTE, note);\n const ids = planned instanceof GraphFormatError ? null : planned;\n if (planned instanceof GraphFormatError) {\n fatal ??= planned;\n }\n\n const weights = explicitWeights(snapshot);\n const label = snapshot.nodes.byRole(\"label\");\n const nodeAttrs = planAttributes(\n snapshot.nodes,\n (c) => (c.meta.role !== null && SKIPPED_ROLES.has(c.meta.role)) || isBypass(c) || isZ(c),\n (c) => (c === label && !snapshot.nodes.has(\"name\") ? \"name\" : c.meta.name),\n ids !== null && ids.changed > 0 ? new Set([ORIGINAL_ID_ATTRIBUTE]) : new Set(),\n );\n const plainWeight = snapshot.edges.get(WEIGHT_ATTRIBUTE);\n const weightColumnClash = plainWeight !== null && plainWeight.meta.role === null;\n if (weightColumnClash) {\n note(\n LOSS.WEIGHT_KEY_CLASH,\n weights.weighted\n ? `edge column \"${WEIGHT_ATTRIBUTE}\" is not written: the explicit weights are written under that name`\n : `edge column \"${WEIGHT_ATTRIBUTE}\" reads back as the edge weight`,\n WEIGHT_ATTRIBUTE,\n null,\n );\n }\n const edgeAttrs = planAttributes(\n snapshot.edges,\n (c) =>\n (c.meta.role !== null && (SKIPPED_ROLES.has(c.meta.role) || c.meta.role === \"id\")) ||\n isBypass(c) ||\n (weights.weighted && c === plainWeight),\n (c) => c.meta.name,\n weights.weighted ? new Set([WEIGHT_ATTRIBUTE]) : new Set(),\n );\n const graphAttrs = planAttributes(\n snapshot.graph,\n () => false,\n (c) => c.meta.name,\n ).map((p) => ({ ...p, key: p.name }));\n\n let nonfinite = 0;\n for (const p of [...nodeAttrs, ...edgeAttrs, ...graphAttrs]) {\n nonfinite += nonFiniteCount(p.column);\n }\n for (let e = 0; e < snapshot.edgeCount; e++) {\n if (weights.isExplicit(e) && !Number.isFinite(weights.value(e))) {\n nonfinite++;\n }\n }\n const position = snapshot.nodes.byRole(\"position\");\n if (position !== null) {\n nonfinite += nonFinitePositions(position);\n }\n if (nonfinite > 0) {\n note(\n CX2_LOSS.NONFINITE_AS_NULL,\n `${nonfinite} NaN or infinite value${plural(nonfinite)} cannot be written in CX2; written as null, they read back unset`,\n null,\n nonfinite,\n );\n }\n\n const edgeIds = planEdgeIds(snapshot, note);\n const z = [...snapshot.nodes].find(isZ) ?? null;\n const positionZ = position !== null && z === null && position.meta.extra.sourceDims === 3;\n return {\n notes,\n fatal,\n ids,\n folding,\n weights,\n nodeAttrs,\n edgeAttrs,\n graphAttrs,\n nodeBypasses: [...snapshot.nodes].filter(isBypass),\n edgeBypasses: [...snapshot.edges].filter(isBypass),\n position,\n positionZ,\n z,\n edgeIds,\n originalIds: ids !== null && ids.changed > 0,\n };\n}\n\n// ============================================================ writing\n\n/**\n * The value written for one cell.\n * @param p - the attribute plan\n * @param row - the row\n * @returns the value, or undefined for an unset cell\n */\nfunction cellValue(p: AttributePlan, row: number): unknown {\n const { column } = p;\n if (!column.isSet(row)) {\n return undefined;\n }\n const value = column.value(row);\n if (p.jsonText) {\n return JSON.stringify(value);\n }\n if (column.meta.dtype === \"list\" || column.meta.components > 1) {\n const items = Array.from(value as ArrayLike<unknown>);\n if (p.d === \"string\") {\n return JSON.stringify(items);\n }\n return items.some((v) => typeof v === \"number\" && !Number.isFinite(v)) ? null : items;\n }\n if (typeof value === \"number\" && !Number.isFinite(value)) {\n return null;\n }\n return value;\n}\n\n/**\n * The declarations of one table.\n * @param plans - the attribute plans\n * @param defaults - whether defaults and aliases may be written (not for network attributes)\n * @returns the declaration object\n */\nfunction declarations(plans: readonly AttributePlan[], defaults: boolean): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const p of plans) {\n const decl: Record<string, unknown> = { d: p.d };\n if (defaults && p.key !== p.name) {\n decl.a = p.key;\n }\n const fallback = p.column.meta.default;\n if (defaults && fallback !== undefined && fallback !== null) {\n if (defaultFits(cx2Type(p.d), fallback)) {\n decl.v = fallback;\n }\n }\n out[p.name] = decl;\n }\n return out;\n}\n\n/**\n * Whether a declared default can be written as the value of a declared type.\n * @param type - the type\n * @param fallback - the default\n * @returns true when it matches\n */\nfunction defaultFits(type: ReturnType<typeof cx2Type>, fallback: unknown): boolean {\n if (type === null) {\n return false;\n }\n if (type.list) {\n return Array.isArray(fallback);\n }\n switch (type.scalar) {\n case \"string\":\n return typeof fallback === \"string\";\n case \"boolean\":\n return typeof fallback === \"boolean\";\n default:\n return typeof fallback === \"number\" && Number.isFinite(fallback);\n }\n}\n\n/**\n * The v object of one element.\n * @param plans - the attribute plans\n * @param row - the row\n * @returns the object, or null when empty\n */\nfunction attributesOf(plans: readonly AttributePlan[], row: number): Record<string, unknown> | null {\n let out: Record<string, unknown> | null = null;\n for (const p of plans) {\n const value = cellValue(p, row);\n if (value !== undefined) {\n out ??= {};\n out[p.key] = value;\n }\n }\n return out;\n}\n\n/**\n * Write the document as text parts.\n * @param snapshot - the snapshot\n * @param p - the plan\n * @yields the document's text\n * @returns nothing\n */\nfunction* write(snapshot: GraphSnapshot, p: Plan): Generator<string, void, undefined> {\n if (p.fatal !== null) {\n throw p.fatal;\n }\n const { ids } = p;\n if (ids === null) {\n throw new GraphFormatError(\"E_INVALID_ID\", \"node ids cannot be written as CX2 integers\", { reason: \"charset\" });\n }\n const { src, dst } = snapshot.edgeList();\n const edges: number[] = [];\n for (let e = 0; e < snapshot.edgeCount; e++) {\n if (!p.folding.folded(e)) {\n edges.push(e);\n }\n }\n\n const nodeDecls = declarations(p.nodeAttrs, true);\n if (p.originalIds) {\n nodeDecls[ORIGINAL_ID_ATTRIBUTE] = { d: \"string\" };\n }\n const edgeDecls = declarations(p.edgeAttrs, true);\n if (p.weights.weighted) {\n edgeDecls[WEIGHT_ATTRIBUTE] = { d: \"double\" };\n }\n const networkDecls = declarations(p.graphAttrs, false);\n const network: Record<string, unknown> = {};\n for (const a of p.graphAttrs) {\n const value = cellValue(a, 0);\n if (value !== undefined) {\n network[a.name] = value;\n }\n }\n const { meta } = snapshot;\n for (const [key, value] of [\n [\"name\", meta.name],\n [\"description\", meta.description],\n ] as const) {\n if (value !== null && !(key in network) && !(key in networkDecls)) {\n network[key] = value;\n networkDecls[key] = { d: \"string\" };\n }\n }\n const kept = isRecord(meta.extra.cx2) ? meta.extra.cx2 : {};\n const otherDecls = isRecord(kept.declarations) ? kept.declarations : {};\n const opaque = meta.sourceFormat === CX2_FORMAT && isRecord(kept.opaque) ? kept.opaque : {};\n const declarationsElement: Record<string, unknown> = { ...otherDecls };\n for (const [key, table] of [\n [\"networkAttributes\", networkDecls],\n [\"nodes\", nodeDecls],\n [\"edges\", edgeDecls],\n ] as const) {\n if (Object.keys(table).length > 0) {\n declarationsElement[key] = table;\n }\n }\n const nodeBypassRows = bypassRows(p.nodeBypasses, snapshot.nodeCount);\n const edgeBypassRows = bypassRows(p.edgeBypasses, snapshot.edgeCount).filter((e) => !p.folding.folded(e));\n const opaqueAspects = Object.entries(opaque).filter(\n (entry): entry is [string, unknown[]] => !CORE_ASPECTS.has(entry[0]) && Array.isArray(entry[1]),\n );\n\n const counts: [string, number][] = [];\n const hasDeclarations = Object.keys(declarationsElement).length > 0;\n if (hasDeclarations) {\n counts.push([\"attributeDeclarations\", 1]);\n }\n if (Object.keys(network).length > 0) {\n counts.push([\"networkAttributes\", 1]);\n }\n counts.push([\"nodes\", snapshot.nodeCount], [\"edges\", edges.length]);\n if (nodeBypassRows.length > 0) {\n counts.push([\"nodeBypasses\", nodeBypassRows.length]);\n }\n if (edgeBypassRows.length > 0) {\n counts.push([\"edgeBypasses\", edgeBypassRows.length]);\n }\n for (const [name, elements] of opaqueAspects) {\n counts.push([name, elements.length]);\n }\n\n yield '[{\"CXVersion\":\"2.0\",\"hasFragments\":false},\\n';\n yield `{\"metaData\":${stringify(counts.map(([name, elementCount]) => ({ name, elementCount })))}},\\n`;\n if (hasDeclarations) {\n yield `{\"attributeDeclarations\":[${stringify(declarationsElement)}]},\\n`;\n }\n if (Object.keys(network).length > 0) {\n yield `{\"networkAttributes\":[${stringify(network)}]},\\n`;\n }\n yield* block(\"nodes\", snapshot.nodeCount, (i) => stringify(nodeElement(p, ids, i)));\n yield* block(\"edges\", edges.length, (k) => {\n const e = edges[k];\n const element: Record<string, unknown> = {\n id: p.edgeIds[e],\n s: ids.idAt(src[e]),\n t: ids.idAt(dst[e]),\n };\n let v = attributesOf(p.edgeAttrs, e);\n if (p.weights.isExplicit(e)) {\n const w = p.weights.value(e);\n v ??= {};\n v[WEIGHT_ATTRIBUTE] = Number.isFinite(w) ? w : null;\n }\n if (v !== null) {\n element.v = v;\n }\n return stringify(element);\n });\n if (nodeBypassRows.length > 0) {\n yield* block(\"nodeBypasses\", nodeBypassRows.length, (k) => {\n const i = nodeBypassRows[k];\n return stringify({ id: ids.idAt(i), v: bypassValues(p.nodeBypasses, i) });\n });\n }\n if (edgeBypassRows.length > 0) {\n yield* block(\"edgeBypasses\", edgeBypassRows.length, (k) => {\n const e = edgeBypassRows[k];\n return stringify({ id: p.edgeIds[e], v: bypassValues(p.edgeBypasses, e) });\n });\n }\n for (const [name, elements] of opaqueAspects) {\n yield* block(name, elements.length, (k) => stringify(elements[k]));\n }\n yield '{\"status\":[{\"error\":\"\",\"success\":true}]}]\\n';\n}\n\n/**\n * The text of one aspect block, element by element.\n * @param aspect - the aspect name\n * @param count - its element count\n * @param element - the JSON text of element k\n * @returns the block's text parts\n */\nfunction block(aspect: string, count: number, element: (k: number) => string): Generator<string, void, undefined> {\n return aspectBlock(\n aspect,\n (function* elements(): Generator<string, void, undefined> {\n for (let k = 0; k < count; k++) {\n yield element(k);\n }\n })(),\n );\n}\n\n/**\n * The element of node i.\n * @param p - the plan\n * @param ids - the written ids\n * @param i - the node index\n * @returns the element\n */\nfunction nodeElement(p: Plan, ids: WrittenIds, i: number): Record<string, unknown> {\n const element: Record<string, unknown> = { id: ids.idAt(i) };\n if (p.position?.isSet(i) === true) {\n const point = p.position.value(i) as ArrayLike<number>;\n if (Number.isFinite(point[0]) && Number.isFinite(point[1])) {\n element.x = point[0];\n element.y = point[1] === 0 ? 0 : -point[1];\n if (p.positionZ && Number.isFinite(point[2])) {\n element.z = point[2];\n }\n }\n }\n if (p.z?.isSet(i) === true) {\n const z = p.z.value(i);\n if (typeof z === \"number\" && Number.isFinite(z)) {\n element.z = z;\n }\n }\n let v = attributesOf(p.nodeAttrs, i);\n if (p.originalIds && ids.isChanged(i)) {\n v ??= {};\n v[ORIGINAL_ID_ATTRIBUTE] = String(ids.originalAt(i));\n }\n if (v !== null) {\n element.v = v;\n }\n return element;\n}\n\n/**\n * The rows with at least one bypass value.\n * @param columns - the bypass columns\n * @param rows - the row count\n * @returns the rows, ascending\n */\nfunction bypassRows(columns: readonly Column[], rows: number): number[] {\n const out: number[] = [];\n if (columns.length === 0) {\n return out;\n }\n for (let i = 0; i < rows; i++) {\n if (columns.some((c) => c.isSet(i))) {\n out.push(i);\n }\n }\n return out;\n}\n\n/**\n * The bypass values of one row.\n * @param columns - the bypass columns\n * @param row - the row\n * @returns property -> value\n */\nfunction bypassValues(columns: readonly Column[], row: number): Record<string, unknown> {\n const out: Record<string, unknown> = {};\n for (const column of columns) {\n if (column.isSet(row)) {\n // the visual property's own name: a column renamed for a clash with an attribute keeps it in origin.id\n const property = column.meta.origin?.id;\n out[typeof property === \"string\" && property.length > 0 ? property : column.meta.name] = column.value(row);\n }\n }\n return out;\n}\n\n/**\n * The CX2 exporter plugin.\n * @category Built-in formats\n */\nexport const cx2Exporter: GraphExporter<Cx2ExportOptions> = Object.freeze({\n format: CX2_FORMAT,\n options: Object.freeze([]),\n capabilities: CX2_CAPABILITIES,\n\n /**\n * Pre-flight: what export() would lose, without writing anything.\n * @param snapshot - the snapshot\n * @param options - the common options\n * @returns the notes, empty when the export is exact\n */\n check(snapshot: GraphSnapshot, options?: Cx2ExportOptions): readonly LossNote[] {\n return Object.freeze([...plan(snapshot, resolveExportOptions(options)).notes]);\n },\n\n /**\n * Write the document as UTF-8 chunks.\n * @param snapshot - the snapshot\n * @param options - the common options\n * @returns the chunks\n */\n export(snapshot: GraphSnapshot, options?: Cx2ExportOptions): AsyncIterable<Uint8Array> {\n return encodeChunks(write(snapshot, plan(snapshot, resolveExportOptions(options))));\n },\n\n /**\n * Write the document as one string.\n * @param snapshot - the snapshot\n * @param options - the common options\n * @returns the document\n */\n exportToString(snapshot: GraphSnapshot, options?: Cx2ExportOptions): Promise<string> {\n return joinText(write(snapshot, plan(snapshot, resolveExportOptions(options))));\n },\n});\n"],"names":[],"mappings":";;;;;AAgDO,MAAM,WAAW,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlC,wBAAwB;AAAA;AAAA,EAExB,gBAAgB;AAAA;AAAA,EAEhB,mBAAmB;AAAA;AAAA,EAEnB,iBAAiB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtB,kBAAkB,KAAK;AAAA;AAAA,EAEvB,mBAAmB,KAAK;AAAA;AAAA,EAExB,kBAAkB,KAAK;AAAA;AAAA,EAEvB,cAAc,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnB,mBAAmB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKxB,YAAY,KAAK;AAAA;AAAA,EAEjB,YAAY,KAAK;AAAA;AAAA,EAEjB,oBAAoB,KAAK;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AAO,OAAO,CAAC,GAAG,KAAK,UAAU,qBAAqB,OAAO,CAAC,EAAE,KAAK,CAAC;AAAA,EACjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAO,UAAyB,SAAuD;AACnF,WAAO,aAAa,MAAM,UAAU,KAAK,UAAU,qBAAqB,OAAO,CAAC,CAAC,CAAC;AAAA,EACtF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eAAe,UAAyB,SAA6C;AACjF,WAAO,SAAS,MAAM,UAAU,KAAK,UAAU,qBAAqB,OAAO,CAAC,CAAC,CAAC;AAAA,EAClF;AACJ,CAAC;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { GraphFormatError, INVALID_INDEX } from "@graphty/graph-format";
|
|
2
2
|
import { c as childrenCsr } from "./children-CL3Cy0ez.js";
|
|
3
|
-
import { L as LOSS, r as resolveExportOptions, a as checkCapabilities, c as capabilities, bE as countMixedEdges, e as explicitWeights, p as pairFolding, b as plural, aE as sanitizeIds, aa as formatF32, ab as formatF64, a9 as idText, $ as agree, aF as formatDecimal, aG as formatInteger, aH as canonicalId, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, I as ID_MERGED_CODE, O as OPTION_IGNORED_CODE, C as COLUMN_RENAMED_CODE, R as ROLE_TAKEN_CODE, o as DUPLICATE_ATTRIBUTE_CODE, P as PRECISION_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, v as ENCODING_CONFLICT_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, ak as SYNTAX_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, al as resolveImportOptions, a8 as ImportReportBuilder, an as reportUnusedOptions, bC as readText, ao as reportSinkOptions, am as throwIfAborted, ap as graphChosen, ar as IdCoercer, aq as DirectionResolver, aL as parseWeightText, bF as canonicalEncoding, aJ as survivesF32, a1 as declareResolved } from "./export-
|
|
4
|
-
import { c as quoteDotId, d as isWritableDotText } from "./escape-
|
|
5
|
-
import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, p as parseTextCell, T as TextCellWriter } from "./text-
|
|
3
|
+
import { L as LOSS, r as resolveExportOptions, a as checkCapabilities, c as capabilities, bE as countMixedEdges, e as explicitWeights, p as pairFolding, b as plural, aE as sanitizeIds, aa as formatF32, ab as formatF64, a9 as idText, $ as agree, aF as formatDecimal, aG as formatInteger, aH as canonicalId, M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, d as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, I as ID_MERGED_CODE, O as OPTION_IGNORED_CODE, C as COLUMN_RENAMED_CODE, R as ROLE_TAKEN_CODE, o as DUPLICATE_ATTRIBUTE_CODE, P as PRECISION_CODE, ae as AMBIGUOUS_GRAPH_NAME_CODE, af as GRAPH_NOT_FOUND_CODE, l as MULTIPLE_GRAPHS_CODE, v as ENCODING_CONFLICT_CODE, w as UNKNOWN_ENCODING_CODE, x as ENCODING_FALLBACK_CODE, y as INVALID_ENCODING_CODE, z as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, ak as SYNTAX_CODE, F as ELEMENT_ISSUE, G as INPUT_ISSUE, al as resolveImportOptions, a8 as ImportReportBuilder, an as reportUnusedOptions, bC as readText, ao as reportSinkOptions, am as throwIfAborted, ap as graphChosen, ar as IdCoercer, aq as DirectionResolver, aL as parseWeightText, bF as canonicalEncoding, aJ as survivesF32, a1 as declareResolved } from "./export-CHd4tQE2.js";
|
|
4
|
+
import { c as quoteDotId, d as isWritableDotText } from "./escape-D1HPTUrP.js";
|
|
5
|
+
import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, p as parseTextCell, T as TextCellWriter } from "./text-DzXjAiTl.js";
|
|
6
6
|
import { j as joinText, e as encodeChunks, i as indentUnit } from "./writer-DxjgHwSe.js";
|
|
7
|
-
import { i as importChosenGraph } from "./choose-
|
|
7
|
+
import { i as importChosenGraph } from "./choose-DrXtu_96.js";
|
|
8
8
|
const DOT_FORMAT = "dot";
|
|
9
9
|
const DOT_ORIGIN = Object.freeze({ format: DOT_FORMAT });
|
|
10
10
|
const CLUSTER_COLUMN = "graphty.cluster";
|
|
@@ -2642,4 +2642,4 @@ export {
|
|
|
2642
2642
|
dotImporter as b,
|
|
2643
2643
|
dotExporter as d
|
|
2644
2644
|
};
|
|
2645
|
-
//# sourceMappingURL=importer-
|
|
2645
|
+
//# sourceMappingURL=importer-B1wmPQjr.js.map
|