@hla4ts/spacekit 0.1.0 → 0.1.1

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.
@@ -1,25 +1,25 @@
1
- import { parseSpacekitEnv, type SpacekitEnvDefaults } from "./env.ts";
2
- import type { SpacekitAppOptions } from "./see-app.ts";
3
-
4
- export interface SpaceFomConfigOptions<T extends Record<string, unknown>> {
5
- env?: Record<string, string | undefined>;
6
- envDefaults?: SpacekitEnvDefaults;
7
- app?: Partial<SpacekitAppOptions>;
8
- extras?: (env: Record<string, string | undefined>) => T;
9
- }
10
-
11
- export function createSpaceFomConfig<T extends Record<string, unknown> = Record<string, never>>(
12
- options: SpaceFomConfigOptions<T> = {}
13
- ): { app: SpacekitAppOptions } & T {
14
- const env = options.env ?? process.env;
15
- const base = parseSpacekitEnv({
16
- env,
17
- defaults: options.envDefaults,
18
- });
19
- const app: SpacekitAppOptions = {
20
- ...base,
21
- ...options.app,
22
- };
23
- const extras = options.extras ? options.extras(env) : ({} as T);
24
- return { app, ...extras };
25
- }
1
+ import { parseSpacekitEnv, type SpacekitEnvDefaults } from "./env.ts";
2
+ import type { SpacekitAppOptions } from "./see-app.ts";
3
+
4
+ export interface SpaceFomConfigOptions<T extends Record<string, unknown>> {
5
+ env?: Record<string, string | undefined>;
6
+ envDefaults?: SpacekitEnvDefaults;
7
+ app?: Partial<SpacekitAppOptions>;
8
+ extras?: (env: Record<string, string | undefined>) => T;
9
+ }
10
+
11
+ export function createSpaceFomConfig<T extends Record<string, unknown> = Record<string, never>>(
12
+ options: SpaceFomConfigOptions<T> = {}
13
+ ): { app: SpacekitAppOptions } & T {
14
+ const env = options.env ?? process.env;
15
+ const base = parseSpacekitEnv({
16
+ env,
17
+ defaults: options.envDefaults,
18
+ });
19
+ const app: SpacekitAppOptions = {
20
+ ...base,
21
+ ...options.app,
22
+ };
23
+ const extras = options.extras ? options.extras(env) : ({} as T);
24
+ return { app, ...extras };
25
+ }
@@ -1,27 +1,27 @@
1
- import { expect, test } from "bun:test";
2
- import { buildDeclarativeFomFromDecorators } from "./decorators.ts";
3
- import { ModeTransitionRequest } from "./spacefom-interactions.ts";
4
- import { PhysicalEntity } from "./spacefom-entities.ts";
5
-
6
- test("ModeTransitionRequest decorator metadata builds schema", () => {
7
- const declarative = buildDeclarativeFomFromDecorators({
8
- interactionClasses: [ModeTransitionRequest],
9
- });
10
-
11
- const schema = declarative.getInteractionSchema<{ execution_mode: number }>(
12
- "HLAinteractionRoot.ModeTransitionRequest"
13
- );
14
- expect(schema?.parameters.execution_mode?.dataType).toBe("HLAinteger16LE");
15
- });
16
-
17
- test("PhysicalEntity decorator metadata builds canonical schema", () => {
18
- const declarative = buildDeclarativeFomFromDecorators({
19
- objectClasses: [PhysicalEntity],
20
- });
21
-
22
- const schema = declarative.getObjectSchema<{ parent_reference_frame: string; state: unknown }>(
23
- "HLAobjectRoot.PhysicalEntity"
24
- );
25
- expect(schema?.attributes.parent_reference_frame?.dataType).toBe("HLAunicodeString");
26
- expect(schema?.attributes.state?.dataType).toBe("SpaceTimeCoordinateState");
27
- });
1
+ import { expect, test } from "bun:test";
2
+ import { buildDeclarativeFomFromDecorators } from "./decorators.ts";
3
+ import { ModeTransitionRequest } from "./spacefom-interactions.ts";
4
+ import { PhysicalEntity } from "./spacefom-entities.ts";
5
+
6
+ test("ModeTransitionRequest decorator metadata builds schema", () => {
7
+ const declarative = buildDeclarativeFomFromDecorators({
8
+ interactionClasses: [ModeTransitionRequest],
9
+ });
10
+
11
+ const schema = declarative.getInteractionSchema<{ execution_mode: number }>(
12
+ "HLAinteractionRoot.ModeTransitionRequest"
13
+ );
14
+ expect(schema?.parameters.execution_mode?.dataType).toBe("HLAinteger16LE");
15
+ });
16
+
17
+ test("PhysicalEntity decorator metadata builds canonical schema", () => {
18
+ const declarative = buildDeclarativeFomFromDecorators({
19
+ objectClasses: [PhysicalEntity],
20
+ });
21
+
22
+ const schema = declarative.getObjectSchema<{ parent_reference_frame: string; state: unknown }>(
23
+ "HLAobjectRoot.PhysicalEntity"
24
+ );
25
+ expect(schema?.attributes.parent_reference_frame?.dataType).toBe("HLAunicodeString");
26
+ expect(schema?.attributes.state?.dataType).toBe("SpaceTimeCoordinateState");
27
+ });