Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion REVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Reserve Important for the cases below. Everything else is Nit at most. That incl
- Values that reach a query outside a Query Fragment, or any other break of the rules in `docs/agents/connectors.md`.
- A limit that doesn't bound the scan.
- A change to one connector, or to shared query code, that changes behavior in the other query languages without saying why.
- **Runtime APIs newer than the browser floor in `packages/graph-explorer/.browserslistrc`,** such as `Error.isError` or Iterator helpers. The browser packages set `lib: ES2023`, so `tsc` catches ES2024 and later APIs, but not ES2023 APIs that shipped after the floor, or DOM APIs, which `lib` doesn't version.
- **Runtime APIs newer than the browser floor in `packages/graph-explorer/.browserslistrc`,** such as `Error.isError` or Iterator helpers. The browser packages set `lib: ES2023` (graph-explorer adds `ES2024.String`, which is inside the floor), so `tsc` catches the rest of ES2024 and later APIs, but not ES2023 APIs that shipped after the floor, or DOM APIs, which `lib` doesn't version.
- **Production code that imports a `devDependency`.**
- **Work that grows with graph or schema size:** one query or subscription per item, quadratic loops, or copying passes over large collections.
- **Tests that can't fail.** Ask whether the test would fail if the change were reverted. Flag these:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import fc from "fast-check";
import { describe, expect, it } from "vitest";

import { createEdgeId, createVertexId } from "@/core";
import { isWellFormedString } from "@/utils/isWellFormedString";

import {
EmptyIdentifierError,
Expand Down Expand Up @@ -44,7 +43,7 @@ describe("fragment.string", () => {
it("should round-trip arbitrary strings through the literal", () => {
fc.assert(
fc.property(fc.string(), value => {
fc.pre(isWellFormedString(value) && !value.includes("\0"));
fc.pre(value.isWellFormed() && !value.includes("\0"));
expect(JSON.parse(fragment.string(value))).toBe(value);
}),
);
Expand Down
4 changes: 1 addition & 3 deletions packages/graph-explorer/src/connector/queryValueError.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { QueryEngine } from "@shared/types";

import { isWellFormedString } from "@/utils";

import type { FragmentPosition } from "./queryFragment";

/**
Expand Down Expand Up @@ -85,7 +83,7 @@ export class UnrepresentableStringError extends UnrepresentableValueError {
* escaped text and always pass.
*/
export function assertRepresentable(value: string): void {
if (!isWellFormedString(value) || value.includes("\0")) {
if (!value.isWellFormed() || value.includes("\0")) {
throw new UnrepresentableStringError(value);
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/graph-explorer/src/core/icons/iconSource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Branded } from "@/utils/branded";

import { isWellFormedString } from "@/utils/isWellFormedString";
import { getLucideName } from "@/utils/lucideIcons";

/**
Expand Down Expand Up @@ -34,7 +33,7 @@ const ICON_VALUE_PATTERN =
* too: `encodeURIComponent` throws on one during style computation.
*/
export function isAllowedIconValue(value: string): boolean {
return ICON_VALUE_PATTERN.test(value) && isWellFormedString(value);
return ICON_VALUE_PATTERN.test(value) && value.isWellFormed();
}

/** Identity of an icon, independent of the color any vertex type renders it in. */
Expand Down
1 change: 0 additions & 1 deletion packages/graph-explorer/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export * from "./formatRelativeDate";
export * from "./numbers";
export * from "./isCancellationError";
export * from "./isVisible";
export * from "./isWellFormedString";
export * from "./parseNumberSafely";
export * from "./setHelpers";
export * from "./typedEntries";
66 changes: 0 additions & 66 deletions packages/graph-explorer/src/utils/isWellFormedString.test.ts

This file was deleted.

15 changes: 0 additions & 15 deletions packages/graph-explorer/src/utils/isWellFormedString.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/graph-explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"jsx": "react-jsx",

/* Type Resolution */
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"lib": ["ES2023", "ES2024.String", "DOM", "DOM.Iterable"],
"types": ["vite/client", "@types/wicg-file-system-access"],
"paths": {
"@/*": ["./src/*"],
Expand Down
Loading