@highstate/contract 0.20.0 → 0.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/contract",
3
- "version": "0.20.0",
3
+ "version": "0.21.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -28,29 +28,28 @@
28
28
  "platform"
29
29
  ]
30
30
  },
31
+ "scripts": {
32
+ "build": "bun run --bun highstate build",
33
+ "test": "bun run --bun vitest run",
34
+ "typecheck": "tsgo --noEmit --skipLibCheck",
35
+ "biome": "biome check --write --unsafe --error-on-warnings",
36
+ "biome:check": "biome check --error-on-warnings"
37
+ },
31
38
  "dependencies": {
32
- "@paralleldrive/cuid2": "^2.2.2",
33
39
  "@noble/hashes": "^2.0.0",
40
+ "@paralleldrive/cuid2": "^2.2.2",
34
41
  "remeda": "^2.21.0",
35
42
  "type-fest": "^4.41.0",
36
43
  "yaml": "^2.8.0",
37
- "zod": "^4.0.5"
44
+ "zod": "^4.3.6"
38
45
  },
39
46
  "devDependencies": {
40
47
  "@biomejs/biome": "2.2.0",
41
48
  "@typescript/native-preview": "^7.0.0-dev.20250920.1",
42
49
  "@vitest/coverage-v8": "2.1.8",
43
- "highstate-cli-bootstrap": "npm:@highstate/cli",
44
50
  "vitest": "^3.2.4"
45
51
  },
46
52
  "repository": {
47
53
  "url": "https://github.com/highstate-io/highstate"
48
- },
49
- "scripts": {
50
- "build": "highstate build",
51
- "test": "vitest run",
52
- "typecheck": "tsgo --noEmit --skipLibCheck",
53
- "biome": "biome check --write --unsafe --error-on-warnings",
54
- "biome:check": "biome check --error-on-warnings"
55
54
  }
56
- }
55
+ }
@@ -1,9 +1,10 @@
1
1
  import { beforeEach, describe, expect, it } from "vitest"
2
2
  import { z } from "zod"
3
- import { defineComponent, kind } from "./component"
3
+ import { defineComponent } from "./component"
4
4
  import { defineEntity } from "./entity"
5
- import { boundaryInput, getRuntimeInstances, resetEvaluation } from "./evaluation"
5
+ import { getRuntimeInstances, resetEvaluation } from "./evaluation"
6
6
  import { type EntityInput, type InstanceInput, selectInput } from "./instance"
7
+ import { boundaryInput, kind } from "./shared"
7
8
 
8
9
  describe("defineComponent", () => {
9
10
  beforeEach(resetEvaluation)
package/src/component.ts CHANGED
@@ -2,21 +2,20 @@
2
2
 
3
3
  import type { Simplify } from "type-fest"
4
4
  import type { Entity, implementedTypes } from "./entity"
5
+ import type {
6
+ EntityInput,
7
+ InstanceId,
8
+ InstanceInput,
9
+ MultipleInput,
10
+ RequiredInput,
11
+ RequiredMultipleInput,
12
+ RuntimeInput,
13
+ } from "./instance"
5
14
  import type { OptionalEmptyRecords, PartialKeys } from "./utils"
6
15
  import { isNonNullish, mapValues, pickBy, uniqueBy } from "remeda"
7
16
  import { z } from "zod"
8
- import { boundaryInput, registerInstance } from "./evaluation"
17
+ import { registerInstance } from "./evaluation"
9
18
  import { camelCaseToHumanReadable } from "./i18n"
10
- import {
11
- type EntityInput,
12
- type InstanceId,
13
- type InstanceInput,
14
- inputKey,
15
- type MultipleInput,
16
- type RequiredInput,
17
- type RequiredMultipleInput,
18
- type RuntimeInput,
19
- } from "./instance"
20
19
  import {
21
20
  createDeepOutputAccessor,
22
21
  createInput,
@@ -31,8 +30,14 @@ import {
31
30
  type VersionedName,
32
31
  versionedNameSchema,
33
32
  } from "./meta"
34
-
35
- export const runtimeSchema = Symbol("runtimeSchema")
33
+ import {
34
+ boundaryInput,
35
+ type ComponentKind,
36
+ componentKindSchema,
37
+ inputKey,
38
+ kind,
39
+ runtimeSchema,
40
+ } from "./shared"
36
41
 
37
42
  let validationEnabled = true
38
43
 
@@ -40,9 +45,6 @@ export function setValidationEnabled(enabled: boolean): void {
40
45
  validationEnabled = enabled
41
46
  }
42
47
 
43
- export const componentKindSchema = z.enum(["composite", "unit"])
44
- export type ComponentKind = z.infer<typeof componentKindSchema>
45
-
46
48
  export const componentArgumentSchema = z.object({
47
49
  /**
48
50
  * The JSON schema of the argument value.
@@ -478,7 +480,6 @@ type ValidateCallInputs<
478
480
  }
479
481
 
480
482
  export const originalCreate = Symbol("originalCreate")
481
- export const kind = Symbol("kind")
482
483
 
483
484
  export type Component<
484
485
  TType extends VersionedName = VersionedName,
package/src/evaluation.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import type { Component } from "./component"
2
2
  import type { InstanceInput, InstanceModel, RuntimeInput } from "./instance"
3
3
  import { mapValues } from "remeda"
4
+ import { boundaryInput } from "./shared"
4
5
 
5
6
  export type RuntimeInstance = {
6
7
  instance: InstanceModel
7
8
  component: Component
8
9
  }
9
10
 
10
- export const boundaryInput = Symbol("boundaryInput")
11
-
12
11
  function isStableInstanceInput(value: unknown): value is InstanceInput {
13
12
  return (
14
13
  typeof value === "object" &&
package/src/index.ts CHANGED
@@ -53,13 +53,11 @@ export {
53
53
  getInstanceId,
54
54
  // for unit API
55
55
  type ComponentInputSpec,
56
- runtimeSchema,
57
56
  // types
58
57
  type Component,
59
58
  type ComponentModel,
60
59
  type ComponentInput,
61
60
  type ComponentArgument,
62
- type ComponentKind,
63
61
  // extra types
64
62
  type ComponentArgumentOptions,
65
63
  type FullComponentArgumentOptions,
@@ -76,6 +74,15 @@ export {
76
74
  originalCreate,
77
75
  } from "./component"
78
76
 
77
+ export {
78
+ boundaryInput,
79
+ inputKey,
80
+ kind,
81
+ runtimeSchema,
82
+ componentKindSchema,
83
+ type ComponentKind,
84
+ } from "./shared"
85
+
79
86
  // for runner <-> stack communication
80
87
  export * from "./pulumi"
81
88
 
@@ -1,5 +1,5 @@
1
1
  import type { InstanceInput, MultipleInput, RequiredInput, RuntimeInput } from "./instance"
2
- import { boundaryInput } from "./evaluation"
2
+ import { boundaryInput } from "./shared"
3
3
 
4
4
  type CreateInputOptions = {
5
5
  boundary?: InstanceInput
package/src/instance.ts CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  import type { Entity, EntityIncludeRef, EntityTypes } from "./entity"
4
4
  import { z } from "zod"
5
- import { componentKindSchema } from "./component"
6
- import { boundaryInput } from "./evaluation"
7
5
  import { createInput, createNonProvidedInput } from "./instance-input"
8
6
  import {
9
7
  type GenericName,
@@ -12,6 +10,7 @@ import {
12
10
  type VersionedName,
13
11
  versionedNameSchema,
14
12
  } from "./meta"
13
+ import { boundaryInput, componentKindSchema } from "./shared"
15
14
 
16
15
  declare const type: unique symbol
17
16
 
@@ -240,12 +239,6 @@ type SelectInputResult<TInput extends RuntimeInput> = TInput extends RequiredInp
240
239
  ? TRuntime
241
240
  : TInput
242
241
 
243
- export function inputKey(input: InstanceInput): string {
244
- return input.path
245
- ? `${input.instanceId}:${input.output}:${input.path}`
246
- : `${input.instanceId}:${input.output}`
247
- }
248
-
249
242
  export const positionSchema = z.object({
250
243
  x: z.number(),
251
244
  y: z.number(),
package/src/shared.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { InstanceInput } from "./instance"
2
+ import { z } from "zod"
3
+
4
+ export const componentKindSchema = z.enum(["composite", "unit"])
5
+ export type ComponentKind = z.infer<typeof componentKindSchema>
6
+
7
+ export const runtimeSchema = Symbol("runtimeSchema")
8
+ export const kind = Symbol("kind")
9
+ export const boundaryInput = Symbol("boundaryInput")
10
+
11
+ export function inputKey(input: InstanceInput): string {
12
+ return input.path
13
+ ? `${input.instanceId}:${input.output}:${input.path}`
14
+ : `${input.instanceId}:${input.output}`
15
+ }
package/src/unit.ts CHANGED
@@ -19,12 +19,11 @@ import {
19
19
  componentModelSchema,
20
20
  defineComponent,
21
21
  type FullComponentArgumentOptions,
22
- kind,
23
22
  mapArgument,
24
23
  type ToFullComponentArgumentOptions,
25
24
  toFullComponentArgumentOptions,
26
25
  } from "./component"
27
- import { boundaryInput } from "./evaluation"
26
+ import { boundaryInput, kind } from "./shared"
28
27
 
29
28
  export const componentSecretSchema = componentArgumentSchema.extend({
30
29
  /**
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Exeteres
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.