@toa.io/norm 1.0.0-alpha.325 → 1.0.0-alpha.326

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,20 @@
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.326](https://github.com/toa-io/toa/compare/v1.0.0-alpha.325...v1.0.0-alpha.326) (2026-10-06)
7
+
8
+ * feat(core)!: deliver an operation's error as its code and its cause ([18d303b](https://github.com/toa-io/toa/commit/18d303b9143930735e4b093345db1dbf37f90052))
9
+
10
+ ### Bug Fixes
11
+
12
+ * **deps:** find files with tinyglobby, which carries no braces ([ef951af](https://github.com/toa-io/toa/commit/ef951af26b5f93fec567033520c62ca01f397355))
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * an error returned with a `code` field and no message is an exception,
17
+ and a property of an error other than `cause` no longer reaches the caller.
18
+
19
+
6
20
  # [1.0.0-alpha.325](https://github.com/toa-io/toa/compare/v1.0.0-alpha.324...v1.0.0-alpha.325) (2026-10-02)
7
21
 
8
22
  **Note:** Version bump only for package @toa.io/norm
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/norm",
3
- "version": "1.0.0-alpha.325",
3
+ "version": "1.0.0-alpha.326",
4
4
  "type": "module",
5
5
  "description": "Toa declarations normalization and validation",
6
6
  "author": "temich <tema.gurtovoy@gmail.com>",
@@ -21,12 +21,12 @@
21
21
  "test": "echo \"Error: run tests from root\" && exit 1"
22
22
  },
23
23
  "dependencies": {
24
- "@toa.io/core": "1.0.0-alpha.323",
25
- "@toa.io/definitions": "1.0.0-alpha.325",
24
+ "@toa.io/core": "1.0.0-alpha.326",
25
+ "@toa.io/definitions": "1.0.0-alpha.326",
26
26
  "@toa.io/generic": "1.0.0-alpha.311",
27
27
  "@toa.io/prototype": "1.0.0-alpha.323",
28
- "@toa.io/schemas": "1.0.0-alpha.311",
29
- "fast-glob": "3.3.3"
28
+ "@toa.io/schemas": "1.0.0-alpha.326",
29
+ "tinyglobby": "0.2.17"
30
30
  },
31
- "gitHead": "95bc03e65c65f02d536da6ed027cf4f78f5cec74"
31
+ "gitHead": "60f11bdc805d0c39bcb06064b2218b11114a35ad"
32
32
  }
@@ -1,7 +1,7 @@
1
1
  import { join } from 'node:path'
2
2
  import { createHash } from 'node:crypto'
3
3
  import fs from 'node:fs/promises'
4
- import glob from 'fast-glob'
4
+ import { glob } from 'tinyglobby'
5
5
 
6
6
  import { definition } from '../../definition.js'
7
7
 
@@ -39,6 +39,7 @@ async function list(manifest) {
39
39
  cwd: manifest.path,
40
40
  dot: true,
41
41
  onlyFiles: true,
42
+ expandDirectories: false,
42
43
  // sources a component keeps outside its own directory are its own: what a link points to is
43
44
  // hashed as the file it stands for, so changing it changes the version
44
45
  followSymbolicLinks: true,
@@ -1,7 +1,7 @@
1
1
  import { basename, extname, resolve } from 'node:path'
2
2
  import { readFile } from 'node:fs/promises'
3
3
 
4
- import glob from 'fast-glob'
4
+ import { glob } from 'tinyglobby'
5
5
  import { yaml } from '@toa.io/generic'
6
6
 
7
7
  /**
@@ -54,4 +54,4 @@ async function read(path) {
54
54
 
55
55
  const DIRECTORY = 'migrations'
56
56
  const EXTENSIONS = '.{yaml,yml,json}'
57
- const GLOB = { onlyFiles: true, absolute: true }
57
+ const GLOB = { onlyFiles: true, absolute: true, expandDirectories: false }
@@ -186,10 +186,10 @@ properties:
186
186
  output:
187
187
  $ref: https://json-schema.org/draft/2019-09/schema
188
188
  errors:
189
- # what a reply may carry as a code: the error schema allows either
189
+ # what a reply may carry as a code: the message of the error returned
190
190
  type: array
191
191
  items:
192
- type: [string, integer]
192
+ type: string
193
193
  query:
194
194
  type: boolean
195
195
  required: [type, scope, bindings]
package/src/context.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { resolve } from 'node:path'
2
2
  import { convolve, environment as variables } from '@toa.io/generic'
3
- import glob from 'fast-glob'
3
+ import { glob } from 'tinyglobby'
4
4
  import { readFile } from 'node:fs/promises'
5
5
  import { yaml as jsyaml } from '@toa.io/generic'
6
6
 
@@ -37,7 +37,8 @@ export const context = async (
37
37
 
38
38
  validate(context)
39
39
 
40
- const paths = await glob(resolve(root, COMPONENTS), GLOB)
40
+ // a directory is answered with the separator that ends it, and a component's path has none
41
+ const paths = (await glob(resolve(root, COMPONENTS), GLOB)).map((path) => path.slice(0, -1))
41
42
 
42
43
  context.components = await Promise.all(paths.map(component))
43
44
 
@@ -58,7 +59,7 @@ export const context = async (
58
59
  const CONTEXT = 'context.toa.yaml'
59
60
  const COMPONENTS = 'components/*'
60
61
 
61
- const GLOB = { onlyDirectories: true, absolute: true }
62
+ const GLOB = { onlyDirectories: true, absolute: true, expandDirectories: false }
62
63
 
63
64
  /**
64
65
  * Reads a YAML file, resolving anchors into distinct objects so that
@@ -12,7 +12,7 @@ export type Operation = {
12
12
  description?: string
13
13
  input?: any
14
14
  output?: any
15
- error?: any
15
+ errors?: string[]
16
16
  query?: boolean
17
17
  /** served by every process under an address of its own, which a call to it names */
18
18
  stateful?: boolean