@toa.io/operations 1.0.0-alpha.300 → 1.0.0-alpha.301

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.301](https://github.com/toa-io/toa/compare/v1.0.0-alpha.300...v1.0.0-alpha.301) (2026-09-11)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **operations:** a composition of evicted components asks for no resources ([a6a3ec7](https://github.com/toa-io/toa/commit/a6a3ec76781812f5a9bdd46c6de0fe7769174d57))
11
+
12
+ ### Features
13
+
14
+ * **operations:** an evicted component is given its environment and configuration ([6cf7890](https://github.com/toa-io/toa/commit/6cf7890a632a2185d2b7d9790890a04187e5a897))
15
+
16
+
6
17
  # [1.0.0-alpha.300](https://github.com/toa-io/toa/compare/v1.0.0-alpha.299...v1.0.0-alpha.300) (2026-09-11)
7
18
 
8
19
  * feat(core)!: an operation may ask to run once ([dca616c](https://github.com/toa-io/toa/commit/dca616cb380a7a389e277875d3bd5ca55a6e4d45))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/operations",
3
- "version": "1.0.0-alpha.300",
3
+ "version": "1.0.0-alpha.301",
4
4
  "type": "module",
5
5
  "description": "Toa Deployment",
6
6
  "homepage": "https://toa.io",
@@ -28,11 +28,11 @@
28
28
  "test": "echo \"Error: run tests from root\" && exit 1"
29
29
  },
30
30
  "dependencies": {
31
- "@toa.io/generic": "1.0.0-alpha.292",
32
- "@toa.io/kubernetes": "1.0.0-alpha.293",
33
- "@toa.io/norm": "1.0.0-alpha.300",
31
+ "@toa.io/generic": "1.0.0-alpha.301",
32
+ "@toa.io/kubernetes": "1.0.0-alpha.301",
33
+ "@toa.io/norm": "1.0.0-alpha.301",
34
34
  "oxc-parser": "0.149.0",
35
- "paseto": "4.0.0"
35
+ "paseto": "4.0.1"
36
36
  },
37
- "gitHead": "f91131a9aeb29aa271f177c4055ddcf0cda8c75e"
37
+ "gitHead": "cc49bc90efd35464b2ad7803246786c607a44685"
38
38
  }
@@ -9,7 +9,7 @@
9
9
  * `resources: null` — at either place.
10
10
  */
11
11
  export function resources(context, values) {
12
- for (const unit of units(values)) {
12
+ for (const unit of units(values, evicted(context))) {
13
13
  // `null` is an answer and `undefined` is not one, so the fallback reads only the latter
14
14
  if (unit.deployment.resources === undefined)
15
15
  unit.deployment.resources = context.resources
@@ -86,12 +86,38 @@ const SUFFIXES = {
86
86
  Ei: 2 ** 60
87
87
  }
88
88
 
89
- function* units(values) {
89
+ /**
90
+ * The labels of the components the context evicts, whether or not the eviction was applied:
91
+ * `toa env -c` does not apply it, since a local run of an evicted component still needs its
92
+ * variables.
93
+ *
94
+ * @returns {Set<string>}
95
+ */
96
+ function evicted(context) {
97
+ const ids = new Set(context.evicted?.components ?? [])
98
+
99
+ return new Set(
100
+ (context.components ?? [])
101
+ .filter(({ locator }) => ids.has(locator.id))
102
+ .map(({ locator }) => locator.label)
103
+ )
104
+ }
105
+
106
+ function* units(values, evicted) {
90
107
  if (values.mono !== undefined)
91
108
  yield { deployment: values.mono, subject: 'The mono deployment' }
92
109
 
93
- for (const composition of values.compositions ?? [])
110
+ for (const composition of values.compositions ?? []) {
111
+ // a composition of what the context evicts is here only for a local run of it, and Toa
112
+ // deploys none of it, so nothing asks what it may take
113
+ if (
114
+ composition.components?.length > 0 &&
115
+ composition.components.every((label) => evicted.has(label))
116
+ )
117
+ continue
118
+
94
119
  yield { deployment: composition, subject: `Composition '${composition.name}'` }
120
+ }
95
121
 
96
122
  for (const service of values.services ?? []) {
97
123
  // a service a composition runs has no deployment of its own to size; the composition
@@ -128,8 +128,10 @@ export class Factory {
128
128
 
129
129
  const annotation = this.#context.annotations?.[name]
130
130
 
131
+ // every instance as well: what a definition keeps for all of its components, such as the
132
+ // configuration the values service serves, holds for an evicted one too
131
133
  /** @type {toa.deployment.dependency.Declaration} */
132
- const dependency = module.deployment(managed, annotation)
134
+ const dependency = module.deployment(managed, annotation, instances)
133
135
 
134
136
  // mono claims every service, including one an extension added since this context was
135
137
  // written, so its claim is the wildcard rather than a list
@@ -169,7 +171,7 @@ export class Factory {
169
171
  }
170
172
 
171
173
  static async create(path, environment, options = {}) {
172
- const context = await load(path, environment)
174
+ const context = await load(path, environment, options)
173
175
 
174
176
  return new Factory(context, options)
175
177
  }
@@ -1,38 +1,36 @@
1
1
  import { Image } from './image.js'
2
2
  import { generate } from 'randomstring'
3
3
 
4
- const version = '168b04ff'
5
- const name = generate()
4
+ const reported = '168b04ff'
5
+ export const name = generate()
6
6
 
7
7
  /**
8
8
  * @implements {toa.deployment.images.Image}
9
9
  */
10
- class Class extends Image {
10
+ export class Class extends Image {
11
11
  get name() {
12
12
  return name
13
13
  }
14
14
 
15
15
  get version() {
16
- return version
16
+ return reported
17
17
  }
18
18
  }
19
19
 
20
20
  /** @type {toa.norm.context.Runtime} */
21
- const runtime = {
21
+ export const runtime = {
22
22
  version: '0.0.0'
23
23
  }
24
24
 
25
25
  /** @type {toa.norm.context.Registry} */
26
- const registry = {
26
+ export const registry = {
27
27
  base: 'node:alpine'
28
28
  }
29
29
 
30
30
  export const scope = generate()
31
31
 
32
- // distinct from the module's own `version` above
33
- const published = 'ba2409fc'
32
+ // distinct from the version `Class` reports
33
+ export const version = 'ba2409fc'
34
34
 
35
35
  // the fixture stands in for the global process
36
- const current = process
37
-
38
- export { name, Class, runtime, registry, current as process, published as version }
36
+ export const process = globalThis.process
@@ -1,4 +1,4 @@
1
- import type * as _deployment from './deployment.js'
1
+ import type * as _deployment from './deployment.d.ts'
2
2
 
3
3
  declare namespace toa.deployment {
4
4
  interface Composition extends _deployment.Deployable {
@@ -1,4 +1,4 @@
1
- import * as _service from './service.js'
1
+ import * as _service from './service.d.ts'
2
2
  import { dependencies } from '@toa.io/norm/types/context'
3
3
 
4
4
  declare namespace toa.deployment {
@@ -1,6 +1,6 @@
1
- import type * as _composition from './composition.js'
2
- import type * as _service from './service.js'
3
- import type * as _dependency from './dependency.js'
1
+ import type * as _composition from './composition.d.ts'
2
+ import type * as _service from './service.d.ts'
3
+ import type * as _dependency from './dependency.d.ts'
4
4
 
5
5
  declare namespace toa.deployment {
6
6
  interface Declaration {
@@ -1,5 +1,5 @@
1
- import type * as _operator from './operator.js'
2
- import * as _registry from './registry.js'
1
+ import type * as _operator from './operator.d.ts'
2
+ import * as _registry from './registry.d.ts'
3
3
 
4
4
  declare namespace toa.deployment {
5
5
  interface Factory {
@@ -1,8 +1,8 @@
1
1
  // noinspection ES6UnusedImports
2
2
 
3
3
  import type { Composition } from '@toa.io/norm/types'
4
- import type { Image } from './image.js'
5
- import type { dependency } from '../dependency.js'
4
+ import type { Image } from './image.d.ts'
5
+ import type { dependency } from '../dependency.d.ts'
6
6
 
7
7
  declare namespace toa.deployment.images {
8
8
  interface Factory {
@@ -1,8 +1,8 @@
1
1
  // noinspection ES6UnusedImports
2
2
 
3
3
  import type { Composition } from '@toa.io/norm'
4
- import type { dependency } from '../dependency.js'
5
- import type { Image } from './image.js'
4
+ import type { dependency } from '../dependency.d.ts'
5
+ import type { Image } from './image.d.ts'
6
6
 
7
7
  declare namespace toa.deployment.images {
8
8
  interface Registry {
@@ -1,5 +1,5 @@
1
- import * as _deployment from './deployment.js'
2
- import * as _dependency from './dependency.js'
1
+ import * as _deployment from './deployment.d.ts'
2
+ import * as _dependency from './dependency.d.ts'
3
3
 
4
4
  declare namespace toa.deployment {
5
5
  interface Operator {
@@ -1,6 +1,6 @@
1
1
  import type * as _norm from '@toa.io/norm/types'
2
- import type * as _dependency from './dependency.js'
3
- import type * as _image from './images/image.js'
2
+ import type * as _dependency from './dependency.d.ts'
3
+ import type * as _image from './images/image.d.ts'
4
4
 
5
5
  declare namespace toa.deployment {
6
6
  interface Registry {
@@ -1,4 +1,4 @@
1
- import type * as _deployment from './deployment.js'
1
+ import type * as _deployment from './deployment.d.ts'
2
2
 
3
3
  declare namespace toa.deployment {
4
4
  interface Ingress {
package/types/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './dependency.js'
1
+ export * from './dependency.ts'