@toa.io/core 1.0.0-alpha.272 → 1.0.0-alpha.273
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 +8 -0
- package/package.json +4 -5
- package/src/call.js +10 -2
- package/src/contract/schemas/index.js +9 -4
- package/test/contract/contract.fixtures.js +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.273](https://github.com/toa-io/toa/compare/v1.0.0-alpha.272...v1.0.0-alpha.273) (2026-09-02)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @toa.io/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
# [1.0.0-alpha.272](https://github.com/toa-io/toa/compare/v1.0.0-alpha.271...v1.0.0-alpha.272) (2026-09-01)
|
|
7
15
|
|
|
8
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.273",
|
|
4
4
|
"description": "Toa Core",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -21,11 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@rsql/parser": "1.2.4",
|
|
24
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
25
|
-
"
|
|
26
|
-
"error-value": "0.3.0",
|
|
24
|
+
"@toa.io/generic": "1.0.0-alpha.273",
|
|
25
|
+
"js-yaml": "4.3.1",
|
|
27
26
|
"openspan": "1.0.0-alpha.272",
|
|
28
27
|
"uuid": "11.1.1"
|
|
29
28
|
},
|
|
30
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ad3284850ece95ffd5325fd0995707fc144c9c3d"
|
|
31
30
|
}
|
package/src/call.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
const { Readable } = require('node:stream')
|
|
4
4
|
const { current, encode } = require('openspan')
|
|
5
5
|
const { Connector } = require('./connector')
|
|
6
|
-
const { Err } = require('error-value')
|
|
7
6
|
|
|
8
7
|
class Call extends Connector {
|
|
9
8
|
#transmitter
|
|
@@ -48,7 +47,7 @@ class Call extends Connector {
|
|
|
48
47
|
throw reply.exception
|
|
49
48
|
|
|
50
49
|
if (reply.error !== undefined)
|
|
51
|
-
return
|
|
50
|
+
return new RemoteError(reply.error)
|
|
52
51
|
else
|
|
53
52
|
return reply.output
|
|
54
53
|
}
|
|
@@ -60,3 +59,12 @@ class Call extends Connector {
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
exports.Call = Call
|
|
62
|
+
|
|
63
|
+
// the remote error as a value: every property it carries, and nothing else enumerable
|
|
64
|
+
class RemoteError extends Error {
|
|
65
|
+
constructor (error) {
|
|
66
|
+
super()
|
|
67
|
+
|
|
68
|
+
Object.assign(this, error)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { resolve } = require('path')
|
|
4
|
-
const {
|
|
4
|
+
const { readFileSync } = require('node:fs')
|
|
5
|
+
const { load: parseYAML } = require('js-yaml')
|
|
5
6
|
|
|
6
|
-
exports.query =
|
|
7
|
-
exports.error =
|
|
8
|
-
exports.source =
|
|
7
|
+
exports.query = read(resolve(__dirname, './query.yaml'))
|
|
8
|
+
exports.error = read(resolve(__dirname, './error.yaml'))
|
|
9
|
+
exports.source = read(resolve(__dirname, './source.yaml'))
|
|
10
|
+
|
|
11
|
+
function read (path) {
|
|
12
|
+
return parseYAML(readFileSync(path, 'utf8'))
|
|
13
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { generate } = require('randomstring')
|
|
4
|
-
const {
|
|
4
|
+
const { readFileSync } = require('node:fs')
|
|
5
|
+
const { load: parseYAML } = require('js-yaml')
|
|
5
6
|
const { resolve } = require('path')
|
|
6
7
|
|
|
7
8
|
// noinspection JSCheckFunctionSignatures
|
|
@@ -20,7 +21,7 @@ const schemas = {
|
|
|
20
21
|
type: 'object',
|
|
21
22
|
properties: {
|
|
22
23
|
input: { type: 'null' },
|
|
23
|
-
query:
|
|
24
|
+
query: parseYAML(readFileSync(resolve(__dirname, '../../src/contract/schemas/query.yaml'), 'utf8')),
|
|
24
25
|
authentic: { type: 'boolean' }
|
|
25
26
|
},
|
|
26
27
|
additionalProperties: true
|