@flighthq/importdiagnostics 0.5.1-edge.4380.912ae32 → 0.5.1-edge.5076.44cab46
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 +2 -2
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +1 -0
- package/dist/contract.js.map +1 -1
- package/dist/importDiagnosticCollector.d.ts +1 -1
- package/dist/importDiagnosticCollector.d.ts.map +1 -1
- package/dist/importDiagnosticText.d.ts +1 -1
- package/dist/importDiagnosticText.d.ts.map +1 -1
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +24 -0
- package/dist/types.js.map +1 -0
- package/package.json +4 -4
- package/src/importDiagnosticCollector.test.ts +2 -2
- package/src/importDiagnosticText.test.ts +1 -1
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/importdiagnostics`.
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/importdiagnostics@0.5.1-edge.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/importdiagnostics@0.5.1-edge.5076.44cab46](https://github.com/flighthq/flight/tree/44cab464341f8ac6e5e9df951cf974739ba9d3b7/packages/importdiagnostics)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/44cab464341f8ac6e5e9df951cf974739ba9d3b7/LICENSE.md)
|
package/dist/contract.d.ts
CHANGED
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC"}
|
package/dist/contract.js
CHANGED
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImportDiagnostic, ImportDiagnosticSeverity } from '
|
|
1
|
+
import type { ImportDiagnostic, ImportDiagnosticSeverity } from './types.ts';
|
|
2
2
|
export declare function collectImportDiagnostics(run: (sink: ImportDiagnostic[]) => void): ImportDiagnostic[];
|
|
3
3
|
export declare function reportImportDiagnostic(sink: ImportDiagnostic[] | undefined, severity: ImportDiagnosticSeverity, kind: string, origin: string, detail?: Readonly<Record<string, boolean | number | string>>): void;
|
|
4
4
|
//# sourceMappingURL=importDiagnosticCollector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importDiagnosticCollector.d.ts","sourceRoot":"","sources":["../src/importDiagnosticCollector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"importDiagnosticCollector.d.ts","sourceRoot":"","sources":["../src/importDiagnosticCollector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAiB7E,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,IAAI,GAAG,gBAAgB,EAAE,CAIpG;AAcD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,gBAAgB,EAAE,GAAG,SAAS,EACpC,QAAQ,EAAE,wBAAwB,EAClC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC,GAC3D,IAAI,CAGN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importDiagnosticText.d.ts","sourceRoot":"","sources":["../src/importDiagnosticText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"importDiagnosticText.d.ts","sourceRoot":"","sources":["../src/importDiagnosticText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASnD,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAQrF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One structured diagnostic from a `*-formats` importer — the replacement for the free-text
|
|
3
|
+
* `warnings: string[]` idiom. An `ImportDiagnostic` is primarily a **dev/design signal**: it names a
|
|
4
|
+
* place where the importer dropped, skipped, recovered, or rejected third-party input, so the SDK team
|
|
5
|
+
* can *eliminate that gap*. It is not itself a runtime end-user message — it carries no text, only a
|
|
6
|
+
* minimal machine tag.
|
|
7
|
+
*
|
|
8
|
+
* It is a **crumb**, recorded ONLY when a caller has engaged a collector (passes an `ImportDiagnostic[]`
|
|
9
|
+
* sink to the parse — see `collectImportDiagnostics`). The default parse engages no collector, so the
|
|
10
|
+
* colocated `reportImportDiagnostic` seam is near-free: one `undefined` check, no crumb built, no
|
|
11
|
+
* allocation — the normal path is untouched in both speed and (measured) bundle size. The human text is
|
|
12
|
+
* the second opt-in: `formatImportDiagnostic` (and per-package `explain*` message templates) *replay* a
|
|
13
|
+
* crumb into words, and they are separately importable so a production bundle that never expands a crumb
|
|
14
|
+
* sheds every byte of the text machinery. Because `explain*` replays the crumbs the parse itself emitted
|
|
15
|
+
* — no re-parse, no re-walk — it can never drift from the parser.
|
|
16
|
+
*/
|
|
17
|
+
export interface ImportDiagnostic {
|
|
18
|
+
/**
|
|
19
|
+
* Plain-data context for the drop — indices, counts, byte offsets, block ids, names. Never
|
|
20
|
+
* interpolated prose (the `kind` carries the stable identity; identifying values go here so tests and
|
|
21
|
+
* agents can assert on them structurally).
|
|
22
|
+
*/
|
|
23
|
+
detail?: Readonly<Record<string, boolean | number | string>>;
|
|
24
|
+
/**
|
|
25
|
+
* A stable, greppable machine code, dot-namespaced by format:
|
|
26
|
+
* `'awd2.skin-vertex-mismatch'`, `'gltf.accessor-out-of-bounds'`, `'md2.triangle-index-out-of-range'`.
|
|
27
|
+
* The kind string is a **value colocated at the drop site**, never a member of a central registry — a
|
|
28
|
+
* registry would drift out of sync and encode stale "can't do X" claims that survive after X is built.
|
|
29
|
+
* Removing the drop branch removes its kind; nothing else references it.
|
|
30
|
+
*/
|
|
31
|
+
kind: string;
|
|
32
|
+
/**
|
|
33
|
+
* The name of the function that actually emitted the diagnostic (the true origin), not the public
|
|
34
|
+
* wrapper that was called. Fixes the misattribution of the old hand-prefixed `"<wrapper>: message"`
|
|
35
|
+
* convention, where a shared helper's warning named whichever entry point happened to invoke it.
|
|
36
|
+
*/
|
|
37
|
+
origin: string;
|
|
38
|
+
/** The outcome axis — what the importer did with the offending input. See `ImportDiagnosticSeverity`. */
|
|
39
|
+
severity: ImportDiagnosticSeverity;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* What an importer did with input it could not fully honor. Orthogonal to `kind` (which names the
|
|
43
|
+
* specific site): the tolerant-but-loud policy is "never throw on bad third-party data, always record".
|
|
44
|
+
*
|
|
45
|
+
* - `Drop`: data was lost — a vertex stream, a layer, a frame record silently discarded. The highest-value
|
|
46
|
+
* signal: a branch to eliminate.
|
|
47
|
+
* - `Skip`: a recognized-but-unsupported feature was ignored (an unimplemented extension, an unmapped
|
|
48
|
+
* method). A capability gap, not a data-integrity bug.
|
|
49
|
+
* - `Recover`: the importer degraded but continued with a substitute (an identity pose for a missing
|
|
50
|
+
* pose block, an all-zero grid for an unavailable decompressor).
|
|
51
|
+
* - `Reject`: the whole input was refused and a sentinel returned (bad magic, unsupported version,
|
|
52
|
+
* truncated header, malformed JSON).
|
|
53
|
+
*
|
|
54
|
+
* A closed, Flight-owned enumerable: a `const` namespace with a PascalCase value union (the value IS the
|
|
55
|
+
* serialized string and ports to a C/C++ `enum class` with no re-casing). The user writes
|
|
56
|
+
* `ImportDiagnosticSeverity.Drop`. Reporting is never a hot loop, so consumers switch on it directly.
|
|
57
|
+
*/
|
|
58
|
+
export declare const ImportDiagnosticSeverity: {
|
|
59
|
+
readonly Drop: 'Drop';
|
|
60
|
+
readonly Recover: 'Recover';
|
|
61
|
+
readonly Reject: 'Reject';
|
|
62
|
+
readonly Skip: 'Skip';
|
|
63
|
+
};
|
|
64
|
+
export type ImportDiagnosticSeverity = (typeof ImportDiagnosticSeverity)[keyof typeof ImportDiagnosticSeverity];
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;IAC7D;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,yGAAyG;IACzG,QAAQ,EAAE,wBAAwB,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB;aACnC,IAAI,EAAE,MAAM;aACZ,OAAO,EAAE,SAAS;aAClB,MAAM,EAAE,QAAQ;aAChB,IAAI,EAAE,MAAM;CACJ,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an importer did with input it could not fully honor. Orthogonal to `kind` (which names the
|
|
3
|
+
* specific site): the tolerant-but-loud policy is "never throw on bad third-party data, always record".
|
|
4
|
+
*
|
|
5
|
+
* - `Drop`: data was lost — a vertex stream, a layer, a frame record silently discarded. The highest-value
|
|
6
|
+
* signal: a branch to eliminate.
|
|
7
|
+
* - `Skip`: a recognized-but-unsupported feature was ignored (an unimplemented extension, an unmapped
|
|
8
|
+
* method). A capability gap, not a data-integrity bug.
|
|
9
|
+
* - `Recover`: the importer degraded but continued with a substitute (an identity pose for a missing
|
|
10
|
+
* pose block, an all-zero grid for an unavailable decompressor).
|
|
11
|
+
* - `Reject`: the whole input was refused and a sentinel returned (bad magic, unsupported version,
|
|
12
|
+
* truncated header, malformed JSON).
|
|
13
|
+
*
|
|
14
|
+
* A closed, Flight-owned enumerable: a `const` namespace with a PascalCase value union (the value IS the
|
|
15
|
+
* serialized string and ports to a C/C++ `enum class` with no re-casing). The user writes
|
|
16
|
+
* `ImportDiagnosticSeverity.Drop`. Reporting is never a hot loop, so consumers switch on it directly.
|
|
17
|
+
*/
|
|
18
|
+
export const ImportDiagnosticSeverity = {
|
|
19
|
+
Drop: 'Drop',
|
|
20
|
+
Recover: 'Recover',
|
|
21
|
+
Reject: 'Reject',
|
|
22
|
+
Skip: 'Skip',
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/importdiagnostics",
|
|
3
|
-
"version": "0.5.1-edge.
|
|
3
|
+
"version": "0.5.1-edge.5076.44cab46",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsc -b",
|
|
34
34
|
"clean": "tsc -b --clean",
|
|
35
|
+
"generate": "tsx ../../scripts/generate-rust-package.ts --crate flight-importdiagnostics --package importdiagnostics",
|
|
36
|
+
"generate:check": "tsx ../../scripts/generate-rust-package.ts --crate flight-importdiagnostics --package importdiagnostics --check",
|
|
35
37
|
"test": "vitest run --config vitest.config.ts",
|
|
36
38
|
"test:watch": "vitest --watch --config vitest.config.ts",
|
|
37
39
|
"prepack": "npm run clean && npm run clean:dist && npm run build",
|
|
38
40
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
41
|
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@flighthq/types": "0.5.1-edge.4380.912ae32"
|
|
42
|
-
},
|
|
42
|
+
"dependencies": {},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "^7.0.2"
|
|
45
45
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ImportDiagnostic } from '@flighthq/types/contract';
|
|
2
|
-
import { ImportDiagnosticSeverity } from '@flighthq/types/contract';
|
|
3
1
|
import { describe, expect, it } from 'vitest';
|
|
4
2
|
|
|
5
3
|
import { collectImportDiagnostics, reportImportDiagnostic } from './importDiagnosticCollector.ts';
|
|
4
|
+
import type { ImportDiagnostic } from './types.ts';
|
|
5
|
+
import { ImportDiagnosticSeverity } from './types.ts';
|
|
6
6
|
|
|
7
7
|
describe('collectImportDiagnostics', () => {
|
|
8
8
|
it('returns the crumbs the run callback emits into its engaged collector', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ImportDiagnosticSeverity } from '@flighthq/types/contract';
|
|
2
1
|
import { describe, expect, it } from 'vitest';
|
|
3
2
|
|
|
4
3
|
import { formatImportDiagnostic } from './importDiagnosticText.ts';
|
|
4
|
+
import { ImportDiagnosticSeverity } from './types.ts';
|
|
5
5
|
|
|
6
6
|
describe('formatImportDiagnostic', () => {
|
|
7
7
|
it('renders severity, origin, and kind with detail keys sorted', () => {
|