@flighthq/resource 0.5.1-next.3302.76ece6b → 0.5.1-next.4304.322dc96

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 CHANGED
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/resource`. The `@fli
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/resource@0.5.1-next.3302.76ece6b](https://github.com/flighthq/flight/tree/76ece6bee38e3d07816f341b7f017bfcec3e8e29/packages/resource)
17
- - [License](https://github.com/flighthq/flight/blob/76ece6bee38e3d07816f341b7f017bfcec3e8e29/LICENSE.md)
16
+ - [Source for @flighthq/resource@0.5.1-next.4304.322dc96](https://github.com/flighthq/flight/tree/322dc963fc5a404a31bc0cc612e906de504ea024/packages/resource)
17
+ - [License](https://github.com/flighthq/flight/blob/322dc963fc5a404a31bc0cc612e906de504ea024/LICENSE.md)
@@ -1,2 +1,2 @@
1
- export * from './resourceResolutionState.ts';
1
+ export { ResourceResolutionState } from './resourceResolutionState.ts';
2
2
  //# sourceMappingURL=contract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/contract.js CHANGED
@@ -1,2 +1,4 @@
1
- export * from "./resourceResolutionState.js";
1
+ // Generated from crates/flight-resource/src/lib.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ export { ResourceResolutionState } from "./resourceResolutionState.js";
2
4
  //# sourceMappingURL=contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,mEAAmE;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './resourceResolutionState.ts';
1
+ export { ResourceResolutionState } from './contract.ts';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
- export * from "./resourceResolutionState.js";
1
+ // Generated from crates/flight-resource/src/lib.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ export { ResourceResolutionState } from "./contract.js";
2
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,mEAAmE;AAEnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC"}
@@ -1,3 +1,18 @@
1
+ /**
2
+ * The lifecycle state of one resource reference (image or audio) as it moves from a
3
+ * parser-emitted reference to a live, decoded resource. Queryable plain data that callers
4
+ * (a loading HUD, a fade controller, analytics) read directly off the reference; the resolver
5
+ * advances it.
6
+ *
7
+ * - `Unresolved`: emitted by the parser, not yet requested.
8
+ * - `Loading`: the resolver has started decoding or fetching (in flight).
9
+ * - `Resolved`: decoded and bound.
10
+ * - `Failed`: decode or fetch failed; an expected outcome, not a throw.
11
+ *
12
+ * TS: a closed const namespace whose values are the serialized strings, identical to the
13
+ * variant names: `'Failed'`, `'Loading'`, `'Resolved'`, `'Unresolved'`.
14
+ * C++ `enum class` with no re-casing.
15
+ */
1
16
  export declare const ResourceResolutionState: {
2
17
  readonly Failed: "Failed";
3
18
  readonly Loading: "Loading";
@@ -1 +1 @@
1
- {"version":3,"file":"resourceResolutionState.d.ts","sourceRoot":"","sources":["../src/resourceResolutionState.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB;;;;;CAK1B,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"resourceResolutionState.d.ts","sourceRoot":"","sources":["../src/resourceResolutionState.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB;;;;;CAK1B,CAAC;AACX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC"}
@@ -1,3 +1,20 @@
1
+ // Generated from crates/flight-resource/src/resource_resolution_state.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+ /**
4
+ * The lifecycle state of one resource reference (image or audio) as it moves from a
5
+ * parser-emitted reference to a live, decoded resource. Queryable plain data that callers
6
+ * (a loading HUD, a fade controller, analytics) read directly off the reference; the resolver
7
+ * advances it.
8
+ *
9
+ * - `Unresolved`: emitted by the parser, not yet requested.
10
+ * - `Loading`: the resolver has started decoding or fetching (in flight).
11
+ * - `Resolved`: decoded and bound.
12
+ * - `Failed`: decode or fetch failed; an expected outcome, not a throw.
13
+ *
14
+ * TS: a closed const namespace whose values are the serialized strings, identical to the
15
+ * variant names: `'Failed'`, `'Loading'`, `'Resolved'`, `'Unresolved'`.
16
+ * C++ `enum class` with no re-casing.
17
+ */
1
18
  export const ResourceResolutionState = {
2
19
  Failed: 'Failed',
3
20
  Loading: 'Loading',
@@ -1 +1 @@
1
- {"version":3,"file":"resourceResolutionState.js","sourceRoot":"","sources":["../src/resourceResolutionState.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;CAChB,CAAC"}
1
+ {"version":3,"file":"resourceResolutionState.js","sourceRoot":"","sources":["../src/resourceResolutionState.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,mEAAmE;AAEnE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;CAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flighthq/resource",
3
- "version": "0.5.1-next.3302.76ece6b",
3
+ "version": "0.5.1-next.4304.322dc96",
4
4
  "author": "Joshua Granick and other contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,6 +32,8 @@
32
32
  "scripts": {
33
33
  "build": "tsc -b",
34
34
  "clean": "tsc -b --clean",
35
+ "generate": "tsx ../../scripts/generate-rust-package.ts --crate flight-resource --package resource",
36
+ "generate:check": "tsx ../../scripts/generate-rust-package.ts --crate flight-resource --package resource --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",
@@ -1,14 +1,31 @@
1
- import { ResourceResolutionState } from './resourceResolutionState.ts';
2
-
3
- describe('ResourceResolutionState', () => {
4
- it('names the four lifecycle states as canonical PascalCase values', () => {
5
- expect(ResourceResolutionState.Unresolved).toBe('Unresolved');
6
- expect(ResourceResolutionState.Loading).toBe('Loading');
7
- expect(ResourceResolutionState.Resolved).toBe('Resolved');
8
- expect(ResourceResolutionState.Failed).toBe('Failed');
9
- });
1
+ // Generated from crates/flight-resource/tests/resource_resolution_state_test.rs by flight-compiler.
2
+ // Rust is authoritative; run `npm run generate` after changing it.
3
+
4
+ import { describe, expect, it } from 'vitest';
5
+
6
+ import type { ResourceResolutionState } from './contract.ts';
7
+
8
+ function getStateOrdinal(state: ResourceResolutionState): number {
9
+ return (() => {
10
+ const matchValue = state;
11
+ switch (matchValue) {
12
+ case 'Failed':
13
+ return 0;
14
+ case 'Loading':
15
+ return 1;
16
+ case 'Resolved':
17
+ return 2;
18
+ case 'Unresolved':
19
+ return 3;
20
+ }
21
+ })();
22
+ }
10
23
 
11
- it('is a closed four-member vocabulary', () => {
12
- expect(Object.values(ResourceResolutionState).sort()).toEqual(['Failed', 'Loading', 'Resolved', 'Unresolved']);
24
+ describe('resourceResolutionState', () => {
25
+ it('is a closed four member vocabulary', () => {
26
+ expect(getStateOrdinal('Failed')).toEqual(0);
27
+ expect(getStateOrdinal('Loading')).toEqual(1);
28
+ expect(getStateOrdinal('Resolved')).toEqual(2);
29
+ expect(getStateOrdinal('Unresolved')).toEqual(3);
13
30
  });
14
31
  });