@flighthq/resource 0.0.0-stage → 0.5.1-edge.4334.2a5a54c

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/LICENSE.md ADDED
@@ -0,0 +1,9 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2013-2026 Joshua Granick and other contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,17 @@
1
- # Temporary Holding Version
1
+ # @flighthq/resource
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Resource resolution state
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install @flighthq/resource
9
+ ```
10
+
11
+ Import the supported application-facing API from `@flighthq/resource`. The `@flighthq/resource/contract` export is the wider package-to-package contract used to compose Flight itself.
12
+
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
+
15
+ - [Flight project](https://github.com/flighthq/flight)
16
+ - [Source for @flighthq/resource@0.5.1-edge.4334.2a5a54c](https://github.com/flighthq/flight/tree/2a5a54c3b182bc9c1ac247df07e9c0fcf44e668b/packages/resource)
17
+ - [License](https://github.com/flighthq/flight/blob/2a5a54c3b182bc9c1ac247df07e9c0fcf44e668b/LICENSE.md)
@@ -0,0 +1,2 @@
1
+ export { ResourceResolutionState } from './resourceResolutionState.ts';
2
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,4 @@
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';
4
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export { ResourceResolutionState } from './contract.ts';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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 ADDED
@@ -0,0 +1,4 @@
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';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,23 @@
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
+ */
16
+ export declare const ResourceResolutionState: {
17
+ readonly Failed: 'Failed';
18
+ readonly Loading: 'Loading';
19
+ readonly Resolved: 'Resolved';
20
+ readonly Unresolved: 'Unresolved';
21
+ };
22
+ export type ResourceResolutionState = (typeof ResourceResolutionState)[keyof typeof ResourceResolutionState];
23
+ //# sourceMappingURL=resourceResolutionState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resourceResolutionState.d.ts","sourceRoot":"","sources":["../src/resourceResolutionState.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB;aAClC,MAAM,EAAE,QAAQ;aAChB,OAAO,EAAE,SAAS;aAClB,QAAQ,EAAE,UAAU;aACpB,UAAU,EAAE,YAAY;CAChB,CAAC;AACX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,24 @@
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
+ */
18
+ export const ResourceResolutionState = {
19
+ Failed: 'Failed',
20
+ Loading: 'Loading',
21
+ Resolved: 'Resolved',
22
+ Unresolved: 'Unresolved',
23
+ };
24
+ //# sourceMappingURL=resourceResolutionState.js.map
@@ -0,0 +1 @@
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,48 @@
1
1
  {
2
2
  "name": "@flighthq/resource",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.5.1-edge.4334.2a5a54c",
4
+ "author": "Joshua Granick and other contributors",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/flighthq/flight.git",
9
+ "directory": "packages/resource"
10
+ },
11
+ "type": "module",
12
+ "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./contract": {
20
+ "types": "./dist/contract.d.ts",
21
+ "default": "./dist/contract.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "src/**/*.test.ts",
27
+ "!dist/**/*.test.js",
28
+ "!dist/**/*.test.d.ts",
29
+ "!dist/**/*.test.js.map",
30
+ "!dist/**/*.test.d.ts.map"
31
+ ],
32
+ "scripts": {
33
+ "build": "tsc -b",
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",
37
+ "test": "vitest run --config vitest.config.ts",
38
+ "test:watch": "vitest --watch --config vitest.config.ts",
39
+ "prepack": "npm run clean && npm run clean:dist && npm run build",
40
+ "clean:dist": "tsx ../../scripts/clean-package-dist.ts"
41
+ },
42
+ "dependencies": {},
43
+ "devDependencies": {
44
+ "typescript": "^7.0.2"
45
+ },
46
+ "description": "Resource resolution state",
47
+ "sideEffects": false
48
+ }
@@ -0,0 +1,31 @@
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
+ }
23
+
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);
30
+ });
31
+ });