laranex-schema-viewer-ui 0.2.0 → 0.4.0
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/NOTICE +11 -0
- package/README.md +20 -2
- package/contract/allowlist.schema.json +62 -0
- package/contract/check.mjs +7 -3
- package/contract/conformance/comparison/column-fields-same-driver.json +387 -0
- package/contract/conformance/comparison/combined-declared-only.json +275 -0
- package/contract/conformance/comparison/constraints.json +356 -0
- package/contract/conformance/comparison/cross-driver-types.json +453 -0
- package/contract/conformance/comparison/foreign-key-matching.json +615 -0
- package/contract/conformance/comparison/incomplete-coverage.json +214 -0
- package/contract/conformance/comparison/incomplete-limit.json +249 -0
- package/contract/conformance/comparison/index-matching.json +588 -0
- package/contract/conformance/comparison/primary-key.json +443 -0
- package/contract/conformance/comparison/referential-actions-mysql.json +321 -0
- package/contract/conformance/comparison/severity-overrides.json +283 -0
- package/contract/conformance/comparison/tables-missing-extra.json +306 -0
- package/contract/conformance/comparison/tenant-schemas-equal.json +329 -0
- package/contract/conformance/comparison/unnamed-duplicates.json +268 -0
- package/contract/conformance/comparison-diagnostics/both-sides-and-omitted.json +330 -0
- package/contract/conformance/comparison-diagnostics/complete.json +390 -0
- package/contract/conformance/comparison-diagnostics/coverage.json +405 -0
- package/contract/conformance/comparison-diagnostics/limit-zero.json +335 -0
- package/contract/conformance/comparison-diagnostics/omitted.json +370 -0
- package/contract/conformance/comparison-diagnostics/tenant-schema-label.json +162 -0
- package/contract/conformance/coverage-gaps/combined-document.json +71 -0
- package/contract/conformance/coverage-gaps/complete.json +53 -0
- package/contract/conformance/coverage-gaps/coverage-unknown.json +33 -0
- package/contract/conformance/coverage-gaps/declared-document.json +56 -0
- package/contract/conformance/coverage-gaps/default-schema-not-read.json +57 -0
- package/contract/conformance/coverage-gaps/default-schema-unknown.json +52 -0
- package/contract/conformance/coverage-gaps/feature-states.json +65 -0
- package/contract/conformance/coverage-gaps/features-then-schema.json +67 -0
- package/contract/conformance/coverage-gaps/not-applicable.json +50 -0
- package/contract/conformance/coverage-gaps/schema-not-read.json +58 -0
- package/contract/conformance/coverage-gaps/schemas-unknown.json +50 -0
- package/contract/conformance/gate/comparison-drift.json +346 -0
- package/contract/conformance/gate/diagnostics-only.json +257 -0
- package/contract/conformance/gate/extraction-warning-only.json +176 -0
- package/contract/conformance/gate/failed-inspection.json +183 -0
- package/contract/conformance/gate/incomplete-comparison.json +310 -0
- package/contract/conformance/gate/incomplete-coverage.json +355 -0
- package/contract/conformance/gate/incomplete-required-coverage.json +233 -0
- package/contract/conformance/gate/invalid-document.json +52 -0
- package/contract/conformance/gate/migration-only.json +650 -0
- package/contract/conformance/gate/migration-unknown.json +315 -0
- package/contract/conformance/gate/newer-minor.json +352 -0
- package/contract/conformance/gate/not-a-document.json +37 -0
- package/contract/conformance/gate/partial-coverage.json +242 -0
- package/contract/conformance/gate/precedence.json +431 -0
- package/contract/conformance/gate/requested-missing.json +417 -0
- package/contract/conformance/gate/requested-none.json +245 -0
- package/contract/conformance/gate/requested-wildcard-empty.json +189 -0
- package/contract/conformance/gate/requested-wildcard.json +387 -0
- package/contract/conformance/gate/threshold-below-severity.json +312 -0
- package/contract/conformance/gate/threshold-likely-at-certainty.json +312 -0
- package/contract/conformance/gate/threshold-likely-below-certainty.json +312 -0
- package/contract/conformance/gate/unsupported-version.json +269 -0
- package/contract/conformance/gate/zero-comparisons.json +242 -0
- package/contract/conformance/graph/composite-unordered-pairs.json +1 -1
- package/contract/conformance/graph/cross-connection-foreign-key.json +1 -1
- package/contract/conformance/graph/cross-connection-relationship.json +1 -1
- package/contract/conformance/graph/duplicate-foreign-keys.json +1 -1
- package/contract/conformance/graph/duplicate-table-names.json +1 -1
- package/contract/conformance/graph/foreign-key-and-relationships.json +1 -1
- package/contract/conformance/graph/foreign-key-only.json +1 -1
- package/contract/conformance/graph/link-note.json +1 -1
- package/contract/conformance/graph/multiple-between-tables.json +1 -1
- package/contract/conformance/graph/pivot.json +1 -1
- package/contract/conformance/graph/polymorphic.json +1 -1
- package/contract/conformance/graph/relationship-only.json +1 -1
- package/contract/conformance/graph/self-reference.json +1 -1
- package/contract/conformance/graph/through.json +1 -1
- package/contract/conformance/graph/unresolved-endpoint.json +1 -1
- package/contract/conformance/inference/association-table-without-key.json +283 -0
- package/contract/conformance/inference/association-table.json +314 -0
- package/contract/conformance/inference/composite-foreign-key.json +295 -0
- package/contract/conformance/inference/covered-by-relationship.json +224 -0
- package/contract/conformance/inference/many-to-one.json +223 -0
- package/contract/conformance/inference/multiple-foreign-keys.json +318 -0
- package/contract/conformance/inference/multiple-models.json +241 -0
- package/contract/conformance/inference/one-to-one-unique-constraint.json +241 -0
- package/contract/conformance/inference/one-to-one-unique-index.json +423 -0
- package/contract/conformance/inference/self-reference.json +169 -0
- package/contract/conformance/inference/unconfirmed-foreign-key.json +223 -0
- package/contract/conformance/inference/unmapped-tables.json +273 -0
- package/contract/conformance/migrations/behind.json +64 -0
- package/contract/conformance/migrations/diverged.json +62 -0
- package/contract/conformance/migrations/history-unavailable.json +15 -0
- package/contract/conformance/migrations/merge-behind.json +80 -0
- package/contract/conformance/migrations/missing-parent-recorded.json +55 -0
- package/contract/conformance/migrations/multiple-heads-behind.json +68 -0
- package/contract/conformance/migrations/multiple-heads-up-to-date.json +67 -0
- package/contract/conformance/migrations/partial-history-behind.json +55 -0
- package/contract/conformance/migrations/partial-history-missing-pending.json +69 -0
- package/contract/conformance/migrations/uninitialized-without-history.json +13 -0
- package/contract/conformance/migrations/uninitialized.json +63 -0
- package/contract/conformance/migrations/unknown-revision.json +64 -0
- package/contract/conformance/migrations/up-to-date.json +61 -0
- package/contract/conformance/migrations/version-table-unreadable.json +59 -0
- package/contract/conformance/overrides/empty.json +9 -0
- package/contract/conformance/overrides/every-field.json +262 -0
- package/contract/conformance/overrides/field-of-another-type.json +32 -0
- package/contract/conformance/overrides/field-on-missing-or-extra.json +25 -0
- package/contract/conformance/overrides/malformed.json +37 -0
- package/contract/conformance/overrides/not-an-array.json +15 -0
- package/contract/conformance/overrides/repeated.json +41 -0
- package/contract/conformance/overrides/unknown-field.json +18 -0
- package/contract/conformance/overrides/unknown-values.json +32 -0
- package/contract/conformance/requests/duplicates.json +271 -0
- package/contract/conformance/requests/explicit-over-wildcard.json +212 -0
- package/contract/conformance/requests/explicit-pairs.json +192 -0
- package/contract/conformance/requests/no-requests.json +130 -0
- package/contract/conformance/requests/ordering.json +271 -0
- package/contract/conformance/requests/unknown-connection.json +218 -0
- package/contract/conformance/requests/wildcard-baseline-is-a-name.json +162 -0
- package/contract/conformance/requests/wildcard-declared-coverage.json +82 -0
- package/contract/conformance/requests/wildcard-default-schema.json +202 -0
- package/contract/conformance/requests/wildcard-no-match.json +180 -0
- package/contract/conformance/requests/wildcard-no-schemas.json +180 -0
- package/contract/conformance/requests/wildcard-other-connection.json +222 -0
- package/contract/conformance/requests/wildcard-tenants.json +202 -0
- package/contract/conformance/scan/allowlist-crlf.json +61 -0
- package/contract/conformance/scan/allowlist-exact.json +61 -0
- package/contract/conformance/scan/allowlist-include-cycle.json +72 -0
- package/contract/conformance/scan/allowlist-include-root.json +72 -0
- package/contract/conformance/scan/allowlist-invalid.json +66 -0
- package/contract/conformance/scan/allowlist-missing-include.json +67 -0
- package/contract/conformance/scan/allowlist-moved.json +76 -0
- package/contract/conformance/scan/allowlist-stale-entry.json +74 -0
- package/contract/conformance/scan/allowlist-tampered.json +61 -0
- package/contract/conformance/scan/embedded-json-parse-bundle.json +50 -0
- package/contract/conformance/scan/embedded-object-literal-bundle.json +50 -0
- package/contract/conformance/scan/embedded-offline-html.json +50 -0
- package/contract/conformance/scan/embedded-source-map.json +50 -0
- package/contract/conformance/scan/embedded-viewer-global.json +50 -0
- package/contract/conformance/scan/history-path-at-commit.json +108 -0
- package/contract/conformance/scan/near-miss-contract-format.json +46 -0
- package/contract/conformance/scan/near-miss-depth-7.json +40 -0
- package/contract/conformance/scan/near-miss-gate-format.json +46 -0
- package/contract/conformance/scan/near-miss-javascript-in-tree.json +40 -0
- package/contract/conformance/scan/near-miss-no-connections-json.json +40 -0
- package/contract/conformance/scan/near-miss-numeric-version.json +40 -0
- package/contract/conformance/scan/near-miss-viewer-global-without-schema.json +40 -0
- package/contract/conformance/scan/negative-gate-report.json +40 -0
- package/contract/conformance/scan/negative-json-schemas.json +46 -0
- package/contract/conformance/scan/negative-package-manifests.json +64 -0
- package/contract/conformance/scan/negative-validator-code.json +40 -0
- package/contract/conformance/scan/negative-viewer-manifest.json +46 -0
- package/contract/conformance/scan/positive-byte-order-mark.json +50 -0
- package/contract/conformance/scan/positive-canonical.json +50 -0
- package/contract/conformance/scan/positive-compact.json +50 -0
- package/contract/conformance/scan/positive-legacy-laravel-envelope.json +50 -0
- package/contract/conformance/scan/positive-legacy-node-v1.json +50 -0
- package/contract/conformance/scan/positive-legacy-python-v1.json +50 -0
- package/contract/conformance/scan/positive-nested-depth-3.json +50 -0
- package/contract/conformance/scan/positive-nested-depth-6.json +50 -0
- package/contract/conformance/scan/positive-nested-in-array.json +50 -0
- package/contract/conformance/scan/positive-nested-legacy.json +50 -0
- package/contract/conformance/scan/positive-version-1-0.json +50 -0
- package/contract/conformance/scan/positive-version-3-0.json +50 -0
- package/contract/conformance/scan/precedence-clean.json +40 -0
- package/contract/conformance/scan/precedence-confirmed-over-uncertain.json +65 -0
- package/contract/conformance/scan/precedence-incomplete-over-confirmed.json +67 -0
- package/contract/conformance/scan/uncertain-html-fragment.json +65 -0
- package/contract/conformance/scan/uncertain-truncated-format.json +50 -0
- package/contract/conformance/scan/uncertain-truncated-json.json +50 -0
- package/contract/conformance/store/add-to-empty.json +596 -0
- package/contract/conformance/store/complete-drops-diagnostic.json +516 -0
- package/contract/conformance/store/idempotent.json +701 -0
- package/contract/conformance/store/replace.json +639 -0
- package/contract/fixtures/gate/invalid/checked-comparisons-unsorted.json +265 -0
- package/contract/fixtures/gate/invalid/comparison-finding-kind.json +264 -0
- package/contract/fixtures/gate/invalid/counts-mismatch.json +264 -0
- package/contract/fixtures/gate/invalid/exit-code-out-of-range.json +84 -0
- package/contract/fixtures/gate/invalid/finding-wrong-id.json +264 -0
- package/contract/fixtures/gate/invalid/findings-unsorted.json +264 -0
- package/contract/fixtures/gate/invalid/incomplete-reported-as-drift.json +84 -0
- package/contract/fixtures/gate/invalid/invalid-document-with-findings.json +34 -0
- package/contract/fixtures/gate/invalid/migration-finding-severity.json +264 -0
- package/contract/fixtures/gate/invalid/passed-flag-mismatch.json +264 -0
- package/contract/fixtures/gate/invalid/passed-with-qualifying-findings.json +264 -0
- package/contract/fixtures/gate/invalid/requested-unsorted.json +285 -0
- package/contract/fixtures/gate/invalid/unknown-error-kind.json +84 -0
- package/contract/fixtures/gate/valid/drift.json +258 -0
- package/contract/fixtures/gate/valid/incomplete.json +78 -0
- package/contract/fixtures/gate/valid/invalid.json +26 -0
- package/contract/fixtures/gate/valid/migrations.json +102 -0
- package/contract/fixtures/gate/valid/passed.json +58 -0
- package/contract/fixtures/gate/valid/requested.json +269 -0
- package/contract/fixtures/invalid/backs-check-constraint.json +5 -53
- package/contract/fixtures/invalid/column-subject-without-columns.json +642 -0
- package/contract/fixtures/invalid/comparison-omitted-but-complete.json +2232 -0
- package/contract/fixtures/invalid/comparison-same-scope.json +2749 -0
- package/contract/fixtures/invalid/comparison-summary-mismatch.json +2749 -0
- package/contract/fixtures/invalid/comparison-unknown-connection.json +2749 -0
- package/contract/fixtures/invalid/comparison-wrong-id.json +2749 -0
- package/contract/fixtures/invalid/coverage-claims-complete.json +12 -17
- package/contract/fixtures/invalid/coverage-for-wrong-source.json +4 -32
- package/contract/fixtures/invalid/diagnostic-unknown-subject.json +12 -17
- package/contract/fixtures/invalid/diagnostic-wrong-id.json +644 -0
- package/contract/fixtures/invalid/difference-changed-without-fields.json +2743 -0
- package/contract/fixtures/invalid/difference-key-names-schema.json +2749 -0
- package/contract/fixtures/invalid/difference-key-unknown-column.json +2749 -0
- package/contract/fixtures/invalid/difference-missing-with-target.json +2753 -0
- package/contract/fixtures/invalid/difference-side-outside-scope.json +2749 -0
- package/contract/fixtures/invalid/difference-side-wrong-entity.json +2749 -0
- package/contract/fixtures/invalid/difference-wrong-id.json +2749 -0
- package/contract/fixtures/invalid/differences-unsorted.json +2749 -0
- package/contract/fixtures/invalid/drift-without-both-sources.json +12 -17
- package/contract/fixtures/invalid/{index-columns-out-of-order.json → driver-alias.json} +6 -54
- package/contract/fixtures/invalid/duplicate-ids.json +5 -29
- package/contract/fixtures/invalid/foreign-key-across-connections.json +8 -26
- package/contract/fixtures/invalid/foreign-key-column-counts.json +5 -11
- package/contract/fixtures/invalid/foreign-key-unknown-target.json +5 -53
- package/contract/fixtures/invalid/index-part-column-and-expression.json +5 -53
- package/contract/fixtures/invalid/inferred-covered-foreign-key.json +2176 -0
- package/contract/fixtures/invalid/inferred-kind-mismatch.json +2191 -0
- package/contract/fixtures/invalid/inferred-model-not-mapping-table.json +2191 -0
- package/contract/fixtures/invalid/inferred-unknown-foreign-key.json +2191 -0
- package/contract/fixtures/invalid/inferred-wrong-id.json +2191 -0
- package/contract/fixtures/invalid/inferred-wrong-links.json +2191 -0
- package/contract/fixtures/invalid/link-state-mismatch.json +44 -97
- package/contract/fixtures/invalid/migration-coverage-wrong-table.json +1699 -0
- package/contract/fixtures/invalid/migration-revisions-without-version-table.json +1699 -0
- package/contract/fixtures/invalid/migration-unknown-coverage-certain.json +1699 -0
- package/contract/fixtures/invalid/migration-unlisted-unknown-revision.json +1697 -0
- package/contract/fixtures/invalid/migration-version-table-outside-scope.json +1699 -0
- package/contract/fixtures/invalid/migration-wrong-heads.json +1698 -0
- package/contract/fixtures/invalid/migration-wrong-id.json +1699 -0
- package/contract/fixtures/invalid/migration-wrong-missing.json +1697 -0
- package/contract/fixtures/invalid/migration-wrong-status.json +1695 -0
- package/contract/fixtures/invalid/missing-field.json +5 -15
- package/contract/fixtures/invalid/pivot-unknown-column.json +44 -97
- package/contract/fixtures/invalid/predicate-without-partial.json +5 -15
- package/contract/fixtures/invalid/primary-index-not-unique.json +6 -54
- package/contract/fixtures/invalid/primary-index-other-columns.json +811 -0
- package/contract/fixtures/invalid/provenance-outside-source.json +5 -15
- package/contract/fixtures/invalid/related-model-missing.json +12 -17
- package/contract/fixtures/invalid/strict-other-minor.json +301 -0
- package/contract/fixtures/invalid/unknown-property-strict.json +6 -16
- package/contract/fixtures/invalid/unsupported-major.json +7 -17
- package/contract/fixtures/invalid/wrong-format.json +5 -15
- package/contract/fixtures/valid/combined-drift.json +12 -17
- package/contract/fixtures/valid/combined-eloquent.json +44 -97
- package/contract/fixtures/valid/combined-multi-connection.json +8 -26
- package/contract/fixtures/valid/comparison-incomplete.json +2225 -0
- package/contract/fixtures/valid/comparison-multi-connection.json +889 -0
- package/contract/fixtures/valid/comparison-schema-named-tables.json +381 -0
- package/contract/fixtures/valid/comparison-tenant-schemas.json +2742 -0
- package/contract/fixtures/valid/database-mysql-indexes.json +4 -32
- package/contract/fixtures/valid/database-postgresql-indexes.json +5 -53
- package/contract/fixtures/valid/database-sqlite-indexes.json +5 -15
- package/contract/fixtures/valid/declared-multi-connection.json +4 -1
- package/contract/fixtures/valid/declared-sqlalchemy.json +5 -11
- package/contract/fixtures/valid/inferred-associations.json +2184 -0
- package/contract/fixtures/valid/migrations-alembic.json +1692 -0
- package/contract/gate-report.schema.json +242 -0
- package/contract/scan-report.schema.json +218 -0
- package/contract/scan.mjs +355 -0
- package/contract/schema.json +636 -18
- package/contract/synthetic.json +370 -0
- package/dist/lib/contract-ZsLKbScP.js +803 -0
- package/dist/lib/contract-ZsLKbScP.js.map +1 -0
- package/dist/lib/contract.js +3 -1
- package/dist/lib/export-oCZEaixp.js +651 -0
- package/dist/lib/export-oCZEaixp.js.map +1 -0
- package/dist/lib/export.js +1 -0
- package/dist/lib/index.js +4373 -1821
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/styles.css +1 -1
- package/dist/lib/validate-B1oz49AC.js +1784 -0
- package/dist/lib/validate-B1oz49AC.js.map +1 -0
- package/dist/types/contract/comparison.d.ts +65 -0
- package/dist/types/contract/document.d.ts +2 -2
- package/dist/types/contract/gate.d.ts +63 -0
- package/dist/types/contract/ids.d.ts +10 -0
- package/dist/types/contract/index.d.ts +6 -0
- package/dist/types/contract/inference.d.ts +10 -0
- package/dist/types/contract/migration.d.ts +8 -0
- package/dist/types/contract/scan.d.ts +114 -0
- package/dist/types/contract/serialize.d.ts +1 -0
- package/dist/types/contract/sha256.d.ts +1 -0
- package/dist/types/contract/types.d.ts +122 -5
- package/dist/types/export/common.d.ts +44 -0
- package/dist/types/export/dbml.d.ts +3 -0
- package/dist/types/export/index.d.ts +10 -0
- package/dist/types/export/json.d.ts +7 -0
- package/dist/types/export/markdown.d.ts +4 -0
- package/dist/types/export/mermaid.d.ts +4 -0
- package/dist/types/export/types.d.ts +28 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/viewer/Browse.d.ts +6 -2
- package/dist/types/viewer/Compare.d.ts +39 -0
- package/dist/types/viewer/Details.d.ts +40 -7
- package/dist/types/viewer/DownloadDialog.d.ts +16 -0
- package/dist/types/viewer/Inferred.d.ts +20 -0
- package/dist/types/viewer/Migrations.d.ts +14 -0
- package/dist/types/viewer/SchemaEdge.d.ts +3 -1
- package/dist/types/viewer/SchemaViewer.d.ts +2 -0
- package/dist/types/viewer/TableNode.d.ts +6 -0
- package/dist/types/viewer/brand.d.ts +32 -0
- package/dist/types/viewer/exportImage.d.ts +21 -2
- package/dist/types/viewer/graph.d.ts +16 -2
- package/dist/types/viewer/icons.d.ts +96 -0
- package/dist/types/viewer/intelligence.d.ts +55 -0
- package/dist/types/viewer/layout.d.ts +5 -0
- package/dist/types/viewer/offline.d.ts +9 -0
- package/dist/types/viewer/ui.d.ts +7 -29
- package/dist/viewer/app.css +1 -1
- package/dist/viewer/app.js +36 -8
- package/dist/viewer/favicon.ico +0 -0
- package/dist/viewer/favicon.svg +1 -1
- package/dist/viewer/index.html +2 -2
- package/dist/viewer/manifest.json +19 -13
- package/dist/viewer/offline.js +67 -0
- package/docs/contract.md +646 -26
- package/docs/integration.md +16 -8
- package/package.json +7 -2
- package/dist/lib/contract-N4axHCW3.js +0 -774
- package/dist/lib/contract-N4axHCW3.js.map +0 -1
package/NOTICE
CHANGED
|
@@ -9,6 +9,17 @@ and orthogonal edge routing are adapted from Laranex Laravel Schema Viewer,
|
|
|
9
9
|
ui/src/elk.ts, ui/src/layout.ts and ui/src/routing.ts, inspected at commit
|
|
10
10
|
62b056a (https://github.com/laranex/laravel-schema-viewer).
|
|
11
11
|
|
|
12
|
+
The icons (src/viewer/icons.tsx) and the brand mark (src/viewer/brand.ts),
|
|
13
|
+
which is also the favicon and the documentation site's logo, are adapted from
|
|
14
|
+
Laranex Laravel Schema Viewer, ui/src/App.tsx and ui/src/components/*.tsx,
|
|
15
|
+
inspected at commit 62b056a: the same shapes, proportions and viewBoxes, drawn
|
|
16
|
+
in the viewer's own theme colors. The icons Laravel has no counterpart for
|
|
17
|
+
(select, details, changes, compare, migrations, behind, branch, circle) are
|
|
18
|
+
drawn for this package in the same style. No third-party icon set is used.
|
|
19
|
+
The line ends (crow's foot, bar, double bar and through arrow) are adapted from
|
|
20
|
+
ui/src/components/LinkEdge.tsx at the same commit and drawn the same way in
|
|
21
|
+
images (src/viewer/graph.ts END_SHAPES).
|
|
22
|
+
|
|
12
23
|
The laranex-schema contract takes its structure and camelCase naming from
|
|
13
24
|
Laravel Schema Viewer's serialized document (src/Schema/*.php) and its
|
|
14
25
|
provenance-preserving rules from Python Schema Viewer's snapshot contract
|
package/README.md
CHANGED
|
@@ -16,10 +16,28 @@ import 'laranex-schema-viewer-ui/styles.css';
|
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
18
|
import { validateDocument, buildGraph, canonicalJson } from 'laranex-schema-viewer-ui/contract';
|
|
19
|
+
import { dbml, mermaid, markdown, json } from 'laranex-schema-viewer-ui/export';
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
The viewer's Download dialog exports a connection as Mermaid, DBML, Markdown or a scoped JSON document, the diagram as
|
|
23
|
+
SVG or PNG, and the whole viewer as one offline HTML file, all in the browser; see [docs/exports.md](docs/exports.md).
|
|
24
|
+
|
|
25
|
+
The viewer displays the comparisons, migration tracks and inferred associations a document stores (Compare and
|
|
26
|
+
Migrations tabs, difference marks on the diagram, inferred marks on foreign-key edges) and never computes them; see
|
|
27
|
+
[docs/views.md](docs/views.md).
|
|
28
|
+
|
|
29
|
+
The viewer is a development-only tool: never expose it or its snapshots in production, and require authentication
|
|
30
|
+
even in local development. [docs/embedding.md](docs/embedding.md) shows how to add it to an existing React, Next.js,
|
|
31
|
+
Vue, Angular, FastAPI or Node.js application as a protected development page; [docs/security.md](docs/security.md) is
|
|
32
|
+
the policy.
|
|
33
|
+
|
|
34
|
+
Hosts without Node.js serve `node_modules/laranex-schema-viewer-ui/dist/viewer/` as static files (including its
|
|
35
|
+
`favicon.svg` and `favicon.ico`) with a `snapshot.json` beside `index.html`, or use
|
|
36
|
+
`<laranex-schema-viewer src="snapshot.json">`. Using the viewer (layout, connections, line ends, column details,
|
|
37
|
+
shortcuts and deep links) is described in [docs/viewer.md](docs/viewer.md).
|
|
38
|
+
|
|
39
|
+
Its icons, brand mark, favicon and line ends come from Laranex Laravel Schema Viewer, drawn in this package's own
|
|
40
|
+
theme colors (see NOTICE); [docs/parity.md](docs/parity.md) compares the two viewers feature by feature.
|
|
23
41
|
|
|
24
42
|
## License
|
|
25
43
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://laranex.github.io/schema-viewer-ui/laranex-schema-allowlist/1.0.json",
|
|
4
|
+
"title": "laranex-schema-allowlist 1.0",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"format": {
|
|
8
|
+
"const": "laranex-schema-allowlist"
|
|
9
|
+
},
|
|
10
|
+
"version": {
|
|
11
|
+
"const": "1.0"
|
|
12
|
+
},
|
|
13
|
+
"entries": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"properties": {
|
|
18
|
+
"path": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"pattern": "^(?!/)(?!.*//)(?!.*/$)(?!(.*/)?\\.\\.?(/|$))[^\\\\\\u0000]+$"
|
|
21
|
+
},
|
|
22
|
+
"sha256": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"required": [
|
|
28
|
+
"path",
|
|
29
|
+
"sha256"
|
|
30
|
+
],
|
|
31
|
+
"additionalProperties": false
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"include": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"path": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"pattern": "^(?!/)(?!.*//)(?!.*/$)(?!(.*/)?\\.\\.?(/|$))[^\\\\\\u0000]+$"
|
|
42
|
+
},
|
|
43
|
+
"root": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"pattern": "^\\.$|^(?!/)(?!.*//)(?!.*/$)(?!(.*/)?\\.\\.?(/|$))[^\\\\\\u0000]+$"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"required": [
|
|
49
|
+
"path",
|
|
50
|
+
"root"
|
|
51
|
+
],
|
|
52
|
+
"additionalProperties": false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"required": [
|
|
57
|
+
"format",
|
|
58
|
+
"version",
|
|
59
|
+
"entries"
|
|
60
|
+
],
|
|
61
|
+
"additionalProperties": false
|
|
62
|
+
}
|
package/contract/check.mjs
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
//
|
|
4
4
|
// node node_modules/laranex-schema-viewer-ui/contract/check.mjs [--lenient] [--no-graph] [--no-canonical] FILE...
|
|
5
5
|
//
|
|
6
|
-
// By default a document must pass strict validation
|
|
7
|
-
//
|
|
6
|
+
// By default a document must pass strict validation (which also checks comparison ids, order and summaries, and
|
|
7
|
+
// migration statuses), store exactly the links the shared graph builder produces and the inferred associations the
|
|
8
|
+
// shared inference produces, and be written in canonical form. Exits 1 when any file fails.
|
|
8
9
|
import { readFileSync } from 'node:fs';
|
|
9
|
-
import { buildGraph, canonicalJson, validateDocument } from '../dist/lib/contract.js';
|
|
10
|
+
import { buildGraph, canonicalJson, inferAssociations, validateDocument } from '../dist/lib/contract.js';
|
|
10
11
|
|
|
11
12
|
const args = process.argv.slice(2);
|
|
12
13
|
const flags = new Set(args.filter((a) => a.startsWith('--')));
|
|
@@ -37,6 +38,9 @@ for (const file of files) {
|
|
|
37
38
|
if (canonicalJson(expected.derivedLinks) !== canonicalJson(doc.derivedLinks)) {
|
|
38
39
|
problems.push('derivedLinks differ from the shared graph builder');
|
|
39
40
|
}
|
|
41
|
+
if (canonicalJson(inferAssociations(doc)) !== canonicalJson(doc.inferredAssociations)) {
|
|
42
|
+
problems.push('inferredAssociations differ from the shared inference');
|
|
43
|
+
}
|
|
40
44
|
}
|
|
41
45
|
if (!flags.has('--no-canonical') && canonicalJson(doc) !== text) {
|
|
42
46
|
problems.push('not in canonical form (sorted keys, two-space indentation, trailing newline)');
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Columns match by name; on one driver types compare as written (certain), defaults as normalized SQL (likely), and fields are sorted",
|
|
3
|
+
"expected": {
|
|
4
|
+
"baseline": {
|
|
5
|
+
"connection": "connection:a",
|
|
6
|
+
"schema": null
|
|
7
|
+
},
|
|
8
|
+
"complete": true,
|
|
9
|
+
"differences": [
|
|
10
|
+
{
|
|
11
|
+
"baseline": {
|
|
12
|
+
"id": null,
|
|
13
|
+
"label": "users.email",
|
|
14
|
+
"table": "a:users"
|
|
15
|
+
},
|
|
16
|
+
"certainty": "certain",
|
|
17
|
+
"change": "changed",
|
|
18
|
+
"fields": [
|
|
19
|
+
{
|
|
20
|
+
"baseline": true,
|
|
21
|
+
"field": "nullable",
|
|
22
|
+
"target": false
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"baseline": "varchar(255)",
|
|
26
|
+
"field": "type",
|
|
27
|
+
"target": "VARCHAR(320)"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"id": "x411857b333eecaa2",
|
|
31
|
+
"key": [
|
|
32
|
+
"users",
|
|
33
|
+
"email"
|
|
34
|
+
],
|
|
35
|
+
"objectType": "column",
|
|
36
|
+
"severity": "warning",
|
|
37
|
+
"target": {
|
|
38
|
+
"id": null,
|
|
39
|
+
"label": "users.email",
|
|
40
|
+
"table": "b:users"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"baseline": {
|
|
45
|
+
"id": null,
|
|
46
|
+
"label": "users.note",
|
|
47
|
+
"table": "a:users"
|
|
48
|
+
},
|
|
49
|
+
"certainty": "certain",
|
|
50
|
+
"change": "changed",
|
|
51
|
+
"fields": [
|
|
52
|
+
{
|
|
53
|
+
"baseline": "old",
|
|
54
|
+
"field": "comment",
|
|
55
|
+
"target": "new"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"id": "x46fb774d0d31dcf8",
|
|
59
|
+
"key": [
|
|
60
|
+
"users",
|
|
61
|
+
"note"
|
|
62
|
+
],
|
|
63
|
+
"objectType": "column",
|
|
64
|
+
"severity": "info",
|
|
65
|
+
"target": {
|
|
66
|
+
"id": null,
|
|
67
|
+
"label": "users.note",
|
|
68
|
+
"table": "b:users"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"baseline": null,
|
|
73
|
+
"certainty": "certain",
|
|
74
|
+
"change": "extra",
|
|
75
|
+
"fields": [],
|
|
76
|
+
"id": "xb29093c0bc285345",
|
|
77
|
+
"key": [
|
|
78
|
+
"users",
|
|
79
|
+
"phone"
|
|
80
|
+
],
|
|
81
|
+
"objectType": "column",
|
|
82
|
+
"severity": "error",
|
|
83
|
+
"target": {
|
|
84
|
+
"id": null,
|
|
85
|
+
"label": "users.phone",
|
|
86
|
+
"table": "b:users"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"baseline": {
|
|
91
|
+
"id": null,
|
|
92
|
+
"label": "users.status",
|
|
93
|
+
"table": "a:users"
|
|
94
|
+
},
|
|
95
|
+
"certainty": "likely",
|
|
96
|
+
"change": "changed",
|
|
97
|
+
"fields": [
|
|
98
|
+
{
|
|
99
|
+
"baseline": {
|
|
100
|
+
"kind": "literal",
|
|
101
|
+
"value": "'a'::text"
|
|
102
|
+
},
|
|
103
|
+
"field": "default",
|
|
104
|
+
"target": {
|
|
105
|
+
"kind": "literal",
|
|
106
|
+
"value": "'b'::text"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"id": "x2f91ca963ed4eca9",
|
|
111
|
+
"key": [
|
|
112
|
+
"users",
|
|
113
|
+
"status"
|
|
114
|
+
],
|
|
115
|
+
"objectType": "column",
|
|
116
|
+
"severity": "warning",
|
|
117
|
+
"target": {
|
|
118
|
+
"id": null,
|
|
119
|
+
"label": "users.status",
|
|
120
|
+
"table": "b:users"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"id": "ccd30999b0df19108",
|
|
125
|
+
"omitted": 0,
|
|
126
|
+
"summary": {
|
|
127
|
+
"changed": 3,
|
|
128
|
+
"extra": 1,
|
|
129
|
+
"missing": 0
|
|
130
|
+
},
|
|
131
|
+
"target": {
|
|
132
|
+
"connection": "connection:b",
|
|
133
|
+
"schema": null
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"input": {
|
|
137
|
+
"baseline": {
|
|
138
|
+
"connection": "connection:a",
|
|
139
|
+
"schema": null
|
|
140
|
+
},
|
|
141
|
+
"document": {
|
|
142
|
+
"connections": [
|
|
143
|
+
{
|
|
144
|
+
"coverage": {
|
|
145
|
+
"database": {
|
|
146
|
+
"complete": true,
|
|
147
|
+
"features": {
|
|
148
|
+
"checkConstraints": "complete",
|
|
149
|
+
"columnTypes": "complete",
|
|
150
|
+
"columns": "complete",
|
|
151
|
+
"comments": "complete",
|
|
152
|
+
"defaults": "complete",
|
|
153
|
+
"foreignKeys": "complete",
|
|
154
|
+
"includedColumns": "complete",
|
|
155
|
+
"indexExpressions": "complete",
|
|
156
|
+
"indexPredicates": "complete",
|
|
157
|
+
"indexes": "complete",
|
|
158
|
+
"primaryKeys": "complete",
|
|
159
|
+
"referentialActions": "complete",
|
|
160
|
+
"tables": "complete",
|
|
161
|
+
"uniqueConstraints": "complete"
|
|
162
|
+
},
|
|
163
|
+
"schemas": null
|
|
164
|
+
},
|
|
165
|
+
"declared": null
|
|
166
|
+
},
|
|
167
|
+
"defaultSchema": null,
|
|
168
|
+
"driver": "postgresql",
|
|
169
|
+
"id": "connection:a",
|
|
170
|
+
"name": "a",
|
|
171
|
+
"tables": [
|
|
172
|
+
{
|
|
173
|
+
"columns": [
|
|
174
|
+
{
|
|
175
|
+
"autoIncrement": false,
|
|
176
|
+
"collation": null,
|
|
177
|
+
"comment": null,
|
|
178
|
+
"default": null,
|
|
179
|
+
"enum": null,
|
|
180
|
+
"generated": null,
|
|
181
|
+
"name": "email",
|
|
182
|
+
"note": null,
|
|
183
|
+
"nullable": true,
|
|
184
|
+
"ormDefault": null,
|
|
185
|
+
"provenance": [
|
|
186
|
+
"database"
|
|
187
|
+
],
|
|
188
|
+
"timezone": null,
|
|
189
|
+
"type": "varchar(255)",
|
|
190
|
+
"typeName": "varchar"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"autoIncrement": false,
|
|
194
|
+
"collation": null,
|
|
195
|
+
"comment": "old",
|
|
196
|
+
"default": null,
|
|
197
|
+
"enum": null,
|
|
198
|
+
"generated": null,
|
|
199
|
+
"name": "note",
|
|
200
|
+
"note": null,
|
|
201
|
+
"nullable": false,
|
|
202
|
+
"ormDefault": null,
|
|
203
|
+
"provenance": [
|
|
204
|
+
"database"
|
|
205
|
+
],
|
|
206
|
+
"timezone": null,
|
|
207
|
+
"type": "text",
|
|
208
|
+
"typeName": "text"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"autoIncrement": false,
|
|
212
|
+
"collation": null,
|
|
213
|
+
"comment": null,
|
|
214
|
+
"default": {
|
|
215
|
+
"kind": "literal",
|
|
216
|
+
"value": "'a'::text"
|
|
217
|
+
},
|
|
218
|
+
"enum": null,
|
|
219
|
+
"generated": null,
|
|
220
|
+
"name": "status",
|
|
221
|
+
"note": null,
|
|
222
|
+
"nullable": false,
|
|
223
|
+
"ormDefault": null,
|
|
224
|
+
"provenance": [
|
|
225
|
+
"database"
|
|
226
|
+
],
|
|
227
|
+
"timezone": null,
|
|
228
|
+
"type": "text",
|
|
229
|
+
"typeName": "text"
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
"comment": "People",
|
|
233
|
+
"constraints": [],
|
|
234
|
+
"foreignKeys": [],
|
|
235
|
+
"id": "a:users",
|
|
236
|
+
"indexes": [],
|
|
237
|
+
"name": "users",
|
|
238
|
+
"note": null,
|
|
239
|
+
"owner": {
|
|
240
|
+
"kind": "application",
|
|
241
|
+
"package": null
|
|
242
|
+
},
|
|
243
|
+
"primaryKey": [],
|
|
244
|
+
"provenance": [
|
|
245
|
+
"database"
|
|
246
|
+
],
|
|
247
|
+
"schema": null
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"coverage": {
|
|
253
|
+
"database": {
|
|
254
|
+
"complete": true,
|
|
255
|
+
"features": {
|
|
256
|
+
"checkConstraints": "complete",
|
|
257
|
+
"columnTypes": "complete",
|
|
258
|
+
"columns": "complete",
|
|
259
|
+
"comments": "complete",
|
|
260
|
+
"defaults": "complete",
|
|
261
|
+
"foreignKeys": "complete",
|
|
262
|
+
"includedColumns": "complete",
|
|
263
|
+
"indexExpressions": "complete",
|
|
264
|
+
"indexPredicates": "complete",
|
|
265
|
+
"indexes": "complete",
|
|
266
|
+
"primaryKeys": "complete",
|
|
267
|
+
"referentialActions": "complete",
|
|
268
|
+
"tables": "complete",
|
|
269
|
+
"uniqueConstraints": "complete"
|
|
270
|
+
},
|
|
271
|
+
"schemas": null
|
|
272
|
+
},
|
|
273
|
+
"declared": null
|
|
274
|
+
},
|
|
275
|
+
"defaultSchema": null,
|
|
276
|
+
"driver": "postgresql",
|
|
277
|
+
"id": "connection:b",
|
|
278
|
+
"name": "b",
|
|
279
|
+
"tables": [
|
|
280
|
+
{
|
|
281
|
+
"columns": [
|
|
282
|
+
{
|
|
283
|
+
"autoIncrement": false,
|
|
284
|
+
"collation": null,
|
|
285
|
+
"comment": null,
|
|
286
|
+
"default": null,
|
|
287
|
+
"enum": null,
|
|
288
|
+
"generated": null,
|
|
289
|
+
"name": "email",
|
|
290
|
+
"note": null,
|
|
291
|
+
"nullable": false,
|
|
292
|
+
"ormDefault": null,
|
|
293
|
+
"provenance": [
|
|
294
|
+
"database"
|
|
295
|
+
],
|
|
296
|
+
"timezone": null,
|
|
297
|
+
"type": "VARCHAR(320)",
|
|
298
|
+
"typeName": "varchar"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"autoIncrement": false,
|
|
302
|
+
"collation": null,
|
|
303
|
+
"comment": "new",
|
|
304
|
+
"default": null,
|
|
305
|
+
"enum": null,
|
|
306
|
+
"generated": null,
|
|
307
|
+
"name": "note",
|
|
308
|
+
"note": null,
|
|
309
|
+
"nullable": false,
|
|
310
|
+
"ormDefault": null,
|
|
311
|
+
"provenance": [
|
|
312
|
+
"database"
|
|
313
|
+
],
|
|
314
|
+
"timezone": null,
|
|
315
|
+
"type": "text",
|
|
316
|
+
"typeName": "text"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"autoIncrement": false,
|
|
320
|
+
"collation": null,
|
|
321
|
+
"comment": null,
|
|
322
|
+
"default": null,
|
|
323
|
+
"enum": null,
|
|
324
|
+
"generated": null,
|
|
325
|
+
"name": "phone",
|
|
326
|
+
"note": null,
|
|
327
|
+
"nullable": false,
|
|
328
|
+
"ormDefault": null,
|
|
329
|
+
"provenance": [
|
|
330
|
+
"database"
|
|
331
|
+
],
|
|
332
|
+
"timezone": null,
|
|
333
|
+
"type": "text",
|
|
334
|
+
"typeName": "text"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"autoIncrement": false,
|
|
338
|
+
"collation": null,
|
|
339
|
+
"comment": null,
|
|
340
|
+
"default": {
|
|
341
|
+
"kind": "literal",
|
|
342
|
+
"value": "'b'::text"
|
|
343
|
+
},
|
|
344
|
+
"enum": null,
|
|
345
|
+
"generated": null,
|
|
346
|
+
"name": "status",
|
|
347
|
+
"note": null,
|
|
348
|
+
"nullable": false,
|
|
349
|
+
"ormDefault": null,
|
|
350
|
+
"provenance": [
|
|
351
|
+
"database"
|
|
352
|
+
],
|
|
353
|
+
"timezone": null,
|
|
354
|
+
"type": "text",
|
|
355
|
+
"typeName": "text"
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
"comment": "People",
|
|
359
|
+
"constraints": [],
|
|
360
|
+
"foreignKeys": [],
|
|
361
|
+
"id": "b:users",
|
|
362
|
+
"indexes": [],
|
|
363
|
+
"name": "users",
|
|
364
|
+
"note": null,
|
|
365
|
+
"owner": {
|
|
366
|
+
"kind": "application",
|
|
367
|
+
"package": null
|
|
368
|
+
},
|
|
369
|
+
"primaryKey": [],
|
|
370
|
+
"provenance": [
|
|
371
|
+
"database"
|
|
372
|
+
],
|
|
373
|
+
"schema": null
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
"source": "database"
|
|
379
|
+
},
|
|
380
|
+
"limit": null,
|
|
381
|
+
"overrides": [],
|
|
382
|
+
"target": {
|
|
383
|
+
"connection": "connection:b",
|
|
384
|
+
"schema": null
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|