@toa.io/extensions.exposition 1.0.0-alpha.272 → 1.0.0-alpha.274
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 +211 -0
- package/components/exposition.atom/manifest.toa.yaml +3 -1
- package/components/exposition.octets/manifest.toa.yaml +28 -10
- package/components/exposition.octets/operations/put.js +20 -5
- package/components/identity.bans/manifest.toa.yaml +26 -7
- package/components/identity.bans/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/manifest.toa.yaml +106 -30
- package/components/identity.basic/operations/authenticate.js +7 -4
- package/components/identity.basic/operations/authenticate.js.map +1 -1
- package/components/identity.basic/operations/incept.js +3 -2
- package/components/identity.basic/operations/incept.js.map +1 -1
- package/components/identity.basic/operations/transit.js +17 -6
- package/components/identity.basic/operations/transit.js.map +1 -1
- package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/operations/types.d.ts +2 -2
- package/components/identity.basic/source/authenticate.ts +8 -4
- package/components/identity.basic/source/incept.ts +3 -2
- package/components/identity.basic/source/transit.ts +20 -6
- package/components/identity.basic/source/types.ts +2 -2
- package/components/identity.credentials/manifest.toa.yaml +34 -13
- package/components/identity.credentials/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/manifest.toa.yaml +120 -28
- package/components/identity.federation/operations/authenticate.js +3 -2
- package/components/identity.federation/operations/authenticate.js.map +1 -1
- package/components/identity.federation/operations/create.js +4 -2
- package/components/identity.federation/operations/create.js.map +1 -1
- package/components/identity.federation/operations/lib/errors.d.ts +70 -11
- package/components/identity.federation/operations/lib/errors.js +40 -11
- package/components/identity.federation/operations/lib/errors.js.map +1 -1
- package/components/identity.federation/operations/lib/exchange.js +2 -2
- package/components/identity.federation/operations/lib/exchange.js.map +1 -1
- package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/operations/types/configuration.d.ts +3 -2
- package/components/identity.federation/source/authenticate.ts +3 -2
- package/components/identity.federation/source/create.ts +4 -2
- package/components/identity.federation/source/lib/errors.ts +49 -12
- package/components/identity.federation/source/lib/exchange.ts +2 -2
- package/components/identity.federation/source/types/configuration.ts +4 -2
- package/components/identity.keys/manifest.toa.yaml +14 -6
- package/components/identity.keys/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/manifest.toa.yaml +44 -15
- package/components/identity.otp/operations/authenticate.js +9 -4
- package/components/identity.otp/operations/authenticate.js.map +1 -1
- package/components/identity.otp/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.otp/source/authenticate.ts +11 -4
- package/components/identity.passkeys/manifest.toa.yaml +38 -8
- package/components/identity.passkeys/operations/authenticate.js +3 -2
- package/components/identity.passkeys/operations/authenticate.js.map +1 -1
- package/components/identity.passkeys/operations/create.js +6 -3
- package/components/identity.passkeys/operations/create.js.map +1 -1
- package/components/identity.passkeys/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.passkeys/operations/use.js +6 -3
- package/components/identity.passkeys/operations/use.js.map +1 -1
- package/components/identity.passkeys/source/authenticate.ts +3 -2
- package/components/identity.passkeys/source/create.ts +7 -3
- package/components/identity.passkeys/source/use.ts +7 -3
- package/components/identity.roles/manifest.toa.yaml +41 -10
- package/components/identity.roles/operations/grant.js +3 -2
- package/components/identity.roles/operations/grant.js.map +1 -1
- package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/source/grant.ts +3 -2
- package/components/identity.tokens/manifest.toa.yaml +99 -39
- package/components/identity.tokens/operations/authenticate.js +6 -3
- package/components/identity.tokens/operations/authenticate.js.map +1 -1
- package/components/identity.tokens/operations/decrypt.js +10 -5
- package/components/identity.tokens/operations/decrypt.js.map +1 -1
- package/components/identity.tokens/operations/encrypt.js +4 -3
- package/components/identity.tokens/operations/encrypt.js.map +1 -1
- package/components/identity.tokens/operations/lib/types.d.ts +3 -2
- package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/source/authenticate.test.ts +7 -2
- package/components/identity.tokens/source/authenticate.ts +7 -3
- package/components/identity.tokens/source/decrypt.test.ts +13 -7
- package/components/identity.tokens/source/decrypt.ts +12 -5
- package/components/identity.tokens/source/encrypt.test.ts +9 -4
- package/components/identity.tokens/source/encrypt.ts +4 -3
- package/components/identity.tokens/source/lib/types.ts +3 -2
- package/context.toa.yaml +2 -2
- package/documentation/components.md +1 -1
- package/documentation/identity.md +4 -1
- package/features/configuration.feature +207 -0
- package/features/cors.feature +1 -1
- package/features/dev.feature +1 -1
- package/features/identity.federation.feature +18 -9
- package/features/{identtiy.tokens.custom.feature → identity.tokens.custom.feature} +39 -0
- package/features/introspection.map.feature +16 -0
- package/features/map.feature +1 -1
- package/features/octets.download.feature +1 -1
- package/features/octets.meta.feature +1 -1
- package/features/passkeys.feature +8 -8
- package/features/require.feature +2 -2
- package/features/response.feature +3 -3
- package/features/steps/Components.ts +41 -4
- package/features/steps/Gateway.ts +61 -23
- package/features/steps/HTTP.ts +3 -5
- package/features/steps/Parameters.ts +2 -3
- package/features/steps/Realtime.ts +4 -4
- package/features/steps/Workspace.ts +8 -3
- package/features/steps/components/audit/manifest.toa.yaml +12 -5
- package/features/steps/components/echo/manifest.toa.yaml +33 -8
- package/features/steps/components/notify/manifest.toa.yaml +12 -5
- package/features/steps/components/octets.tester/manifest.toa.yaml +43 -14
- package/features/steps/components/orders/manifest.toa.yaml +22 -5
- package/features/steps/components/pots/manifest.toa.yaml +71 -17
- package/features/steps/components/pricing/manifest.toa.yaml +8 -2
- package/features/steps/components/sequences/manifest.toa.yaml +3 -1
- package/features/steps/components/users/manifest.toa.yaml +18 -3
- package/features/steps/components/users.properties/manifest.toa.yaml +12 -2
- package/package.json +5 -6
- package/schemas/annotation.cos.yaml +37 -17
- package/schemas/directive.cos.yaml +7 -3
- package/schemas/io/throttle.cos.yaml +47 -8
- package/schemas/method.cos.yaml +21 -9
- package/schemas/node.cos.yaml +22 -7
- package/schemas/octets/delete.cos.yaml +15 -2
- package/schemas/octets/get.cos.yaml +5 -2
- package/schemas/octets/put.cos.yaml +6 -3
- package/schemas/octets/workflow.cos.yaml +0 -1
- package/schemas/query.cos.yaml +31 -14
- package/schemas/querystring.cos.yaml +19 -9
- package/schemas/range.cos.yaml +10 -2
- package/schemas/route.cos.yaml +6 -2
- package/source/Branch.test.ts +37 -0
- package/source/Branch.ts +37 -0
- package/source/Factory.ts +5 -5
- package/source/Gateway.ts +20 -13
- package/source/HTTP/formats/yaml.test.ts +10 -2
- package/source/HTTP/formats/yaml.ts +21 -1
- package/source/RTD/Tree.ts +4 -1
- package/source/Tenant.ts +3 -3
- package/source/deployment.ts +3 -4
- package/source/directives/map/Headers.ts +8 -1
- package/source/directives/octets/Put.ts +6 -3
- package/source/root.ts +2 -2
- package/transpiled/Branch.d.ts +23 -0
- package/transpiled/Branch.js +16 -0
- package/transpiled/Branch.js.map +1 -1
- package/transpiled/Factory.js +4 -4
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.js +17 -7
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/formats/yaml.js +15 -1
- package/transpiled/HTTP/formats/yaml.js.map +1 -1
- package/transpiled/RTD/Tree.js +4 -1
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/Tenant.d.ts +1 -1
- package/transpiled/Tenant.js +1 -1
- package/transpiled/Tenant.js.map +1 -1
- package/transpiled/deployment.js +3 -4
- package/transpiled/deployment.js.map +1 -1
- package/transpiled/directives/map/Headers.js +7 -1
- package/transpiled/directives/map/Headers.js.map +1 -1
- package/transpiled/directives/octets/Put.js.map +1 -1
- package/transpiled/root.js +1 -1
- package/transpiled/root.js.map +1 -1
- package/transpiled/tsconfig.tsbuildinfo +1 -1
package/source/Factory.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert'
|
|
2
2
|
import { createHash } from 'node:crypto'
|
|
3
3
|
import { console, traces, type LevelName, type TracesOptions } from 'openspan'
|
|
4
|
-
import { decode } from '@toa.io/generic'
|
|
5
4
|
import { Tenant } from './Tenant'
|
|
6
5
|
import { Gateway } from './Gateway'
|
|
7
6
|
import { Remotes } from './Remotes'
|
|
@@ -29,7 +28,8 @@ export class Factory implements extensions.Factory {
|
|
|
29
28
|
const broadcast: Broadcast = this.boot.bindings.broadcast(CHANNEL, locator.id)
|
|
30
29
|
const hash = createHash('sha256').update(JSON.stringify(node)).digest('hex')
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
// no timestamp: the tenant stamps each announcement with its own start time
|
|
32
|
+
const branch: Omit<Branch, 'timestamp'> = {
|
|
33
33
|
namespace: locator.namespace,
|
|
34
34
|
component: locator.name,
|
|
35
35
|
isolated: locator.namespace === 'identity',
|
|
@@ -46,7 +46,7 @@ export class Factory implements extensions.Factory {
|
|
|
46
46
|
|
|
47
47
|
configureLogs()
|
|
48
48
|
|
|
49
|
-
const options =
|
|
49
|
+
const options = JSON.parse(process.env.TOA_EXPOSITION_PROPERTIES) as http.Options
|
|
50
50
|
const broadcast: Broadcast = this.boot.bindings.broadcast(CHANNEL)
|
|
51
51
|
const server = http.Server.create({ ...options })
|
|
52
52
|
const remotes = new Remotes(this.boot)
|
|
@@ -76,13 +76,13 @@ const TRACES_ENV = 'TOA_TELEMETRY_TRACES'
|
|
|
76
76
|
function configureLogs (): void {
|
|
77
77
|
const globEnv = process.env[LOGS_PREFIX]
|
|
78
78
|
const level: LevelName = process.env.TOA_DEV === '1' ? 'trace' : 'info'
|
|
79
|
-
const options = globEnv === undefined ? { level } :
|
|
79
|
+
const options = globEnv === undefined ? { level } : JSON.parse(globEnv) as { level?: LevelName }
|
|
80
80
|
|
|
81
81
|
console.configure({ level: options.level ?? level })
|
|
82
82
|
|
|
83
83
|
const tracesEnv = process.env[TRACES_ENV]
|
|
84
84
|
|
|
85
|
-
traces(tracesEnv === undefined ? development() :
|
|
85
|
+
traces(tracesEnv === undefined ? development() : JSON.parse(tracesEnv) as TracesOptions)
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
package/source/Gateway.ts
CHANGED
|
@@ -4,10 +4,11 @@ import { console } from 'openspan'
|
|
|
4
4
|
import { type bindings, Connector } from '@toa.io/core'
|
|
5
5
|
import * as http from './HTTP'
|
|
6
6
|
import { rethrow } from './exceptions'
|
|
7
|
+
import { decide } from './Branch'
|
|
7
8
|
import type { Interception } from './Interception'
|
|
8
9
|
import type { Method, Node, Parameter, Tree, Match } from './RTD'
|
|
9
10
|
import type { Label } from './discovery'
|
|
10
|
-
import type { Branch } from './Branch'
|
|
11
|
+
import type { Branch, Exposed } from './Branch'
|
|
11
12
|
|
|
12
13
|
export class Gateway extends Connector {
|
|
13
14
|
private readonly broadcast: Broadcast
|
|
@@ -231,13 +232,24 @@ export class Gateway extends Connector {
|
|
|
231
232
|
|
|
232
233
|
const exposed = this.branches.get(id)
|
|
233
234
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
if (exposed !== undefined)
|
|
236
|
+
switch (decide(exposed, branch)) {
|
|
237
|
+
// rebuilding an identical branch would only tear down its live endpoints
|
|
238
|
+
case 'refresh':
|
|
239
|
+
this.tree.refresh(exposed.nodes)
|
|
240
|
+
console.trace('Branch refreshed', attributes)
|
|
238
241
|
|
|
239
|
-
|
|
240
|
-
|
|
242
|
+
return
|
|
243
|
+
|
|
244
|
+
case 'superseded':
|
|
245
|
+
console.debug('Branch superseded', {
|
|
246
|
+
...attributes,
|
|
247
|
+
timestamp: branch.timestamp,
|
|
248
|
+
exposed: exposed.timestamp
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
return
|
|
252
|
+
}
|
|
241
253
|
|
|
242
254
|
let nodes: Node[]
|
|
243
255
|
|
|
@@ -251,7 +263,7 @@ export class Gateway extends Connector {
|
|
|
251
263
|
return
|
|
252
264
|
}
|
|
253
265
|
|
|
254
|
-
this.branches.set(id, { version: branch.version, nodes })
|
|
266
|
+
this.branches.set(id, { version: branch.version, timestamp: branch.timestamp, nodes })
|
|
255
267
|
|
|
256
268
|
if (this.lastMerge !== 0)
|
|
257
269
|
this.widestGap = Math.max(this.widestGap, Date.now() - this.lastMerge)
|
|
@@ -266,11 +278,6 @@ export class Gateway extends Connector {
|
|
|
266
278
|
|
|
267
279
|
export type Broadcast = bindings.Broadcast<Label>
|
|
268
280
|
|
|
269
|
-
interface Exposed {
|
|
270
|
-
version: string
|
|
271
|
-
nodes: Node[]
|
|
272
|
-
}
|
|
273
|
-
|
|
274
281
|
const SETTLE_QUIET_MIN = 500
|
|
275
282
|
const SETTLE_QUIET_MAX = 10_000
|
|
276
283
|
const SETTLE_QUIET_FACTOR = 2
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { Err } from 'error-value'
|
|
2
1
|
import { encode } from './yaml'
|
|
3
2
|
|
|
4
3
|
it('encodes error values as their public properties', () => {
|
|
5
|
-
const value = new
|
|
4
|
+
const value = new (class InvalidUsernameError extends Error {
|
|
5
|
+
public readonly code = 'INVALID_USERNAME'
|
|
6
|
+
public override readonly message = 'Username is not meeting the requirements'
|
|
7
|
+
})()
|
|
6
8
|
|
|
7
9
|
expect(encode(value).toString())
|
|
8
10
|
.toBe('code: INVALID_USERNAME\nmessage: Username is not meeting the requirements\n')
|
|
9
11
|
})
|
|
12
|
+
|
|
13
|
+
it('writes a value the way its toJSON says', () => {
|
|
14
|
+
const secret = { unwrap: () => 's3cret', toJSON: () => '<REDACTED>' }
|
|
15
|
+
|
|
16
|
+
expect(encode({ a: 1, b: secret }).toString()).toBe('a: 1\nb: <REDACTED>\n')
|
|
17
|
+
})
|
|
@@ -10,8 +10,28 @@ export function decode (buffer: Buffer, charset = 'utf-8'): any {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function encode (value: any): Buffer {
|
|
13
|
-
const serializable = value instanceof Error ? Object.assign({}, value) : value
|
|
13
|
+
const serializable = value instanceof Error ? Object.assign({}, value) : represent(value)
|
|
14
14
|
const text = yaml.dump(serializable, { lineWidth: -1, noRefs: true })
|
|
15
15
|
|
|
16
16
|
return Buffer.from(text)
|
|
17
17
|
}
|
|
18
|
+
|
|
19
|
+
/** What says how it is to be written — a redacted secret — is written that way, as in JSON. */
|
|
20
|
+
function represent (value: unknown): unknown {
|
|
21
|
+
if (typeof value !== 'object' || value === null || value instanceof Date || Buffer.isBuffer(value))
|
|
22
|
+
return value
|
|
23
|
+
|
|
24
|
+
if ('toJSON' in value && typeof value.toJSON === 'function')
|
|
25
|
+
return value.toJSON()
|
|
26
|
+
|
|
27
|
+
if (Array.isArray(value))
|
|
28
|
+
return value.map(represent)
|
|
29
|
+
|
|
30
|
+
const object = value as Record<string, unknown>
|
|
31
|
+
const represented: Record<string, unknown> = {}
|
|
32
|
+
|
|
33
|
+
for (const key of Object.keys(object))
|
|
34
|
+
represented[key] = represent(object[key])
|
|
35
|
+
|
|
36
|
+
return represented
|
|
37
|
+
}
|
package/source/RTD/Tree.ts
CHANGED
|
@@ -59,7 +59,10 @@ export class Tree {
|
|
|
59
59
|
endpoints: this.endpoints,
|
|
60
60
|
directives: {
|
|
61
61
|
factory: this.directives,
|
|
62
|
-
|
|
62
|
+
// A merged branch is mounted under the root, so it inherits the root's
|
|
63
|
+
// directives. The trunk is the root: createNode adds them itself, and
|
|
64
|
+
// seeding them here too would apply every one of them twice.
|
|
65
|
+
stack: node === this.root ? [] : this.root.directives ?? []
|
|
63
66
|
},
|
|
64
67
|
path: label(extension),
|
|
65
68
|
extension
|
package/source/Tenant.ts
CHANGED
|
@@ -7,11 +7,11 @@ import type { Branch } from './Branch'
|
|
|
7
7
|
|
|
8
8
|
export class Tenant extends Connector {
|
|
9
9
|
private readonly broadcast: Broadcast
|
|
10
|
-
private readonly branch: Branch
|
|
10
|
+
private readonly branch: Omit<Branch, 'timestamp'>
|
|
11
11
|
private started = 0
|
|
12
12
|
private stopped = false
|
|
13
13
|
|
|
14
|
-
public constructor (broadcast: Broadcast, branch: Branch) {
|
|
14
|
+
public constructor (broadcast: Broadcast, branch: Omit<Branch, 'timestamp'>) {
|
|
15
15
|
super()
|
|
16
16
|
|
|
17
17
|
this.broadcast = broadcast
|
|
@@ -58,7 +58,7 @@ export class Tenant extends Connector {
|
|
|
58
58
|
if (this.stopped)
|
|
59
59
|
return
|
|
60
60
|
|
|
61
|
-
await this.broadcast.transmit('expose', this.branch)
|
|
61
|
+
await this.broadcast.transmit('expose', { ...this.branch, timestamp: this.started })
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
package/source/deployment.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import assert from 'node:assert'
|
|
2
2
|
import { type Dependency, type Service } from '@toa.io/operations'
|
|
3
|
-
import { encode } from '@toa.io/generic'
|
|
4
3
|
import { type Annotation } from './Annotation'
|
|
5
4
|
import * as schemas from './schemas'
|
|
6
5
|
import { shortcuts } from './Directive'
|
|
@@ -35,7 +34,7 @@ export function deployment (_: unknown, annotation?: Annotation): Dependency {
|
|
|
35
34
|
|
|
36
35
|
service.variables!.push({
|
|
37
36
|
name: 'TOA_EXPOSITION',
|
|
38
|
-
value:
|
|
37
|
+
value: JSON.stringify(tree)
|
|
39
38
|
})
|
|
40
39
|
}
|
|
41
40
|
|
|
@@ -57,13 +56,13 @@ export function deployment (_: unknown, annotation?: Annotation): Dependency {
|
|
|
57
56
|
|
|
58
57
|
service.variables!.push({
|
|
59
58
|
name: 'TOA_EXPOSITION_PROPERTIES',
|
|
60
|
-
value:
|
|
59
|
+
value: JSON.stringify(properties)
|
|
61
60
|
})
|
|
62
61
|
|
|
63
62
|
// Nested identity composition shares this process; gateway already exposes /.ready.
|
|
64
63
|
service.variables!.push({
|
|
65
64
|
name: 'TOA_TELEMETRY_READY',
|
|
66
|
-
value:
|
|
65
|
+
value: JSON.stringify(false)
|
|
67
66
|
})
|
|
68
67
|
|
|
69
68
|
return { services: [service] }
|
|
@@ -3,6 +3,13 @@ import { cors } from '../cors'
|
|
|
3
3
|
import { Mapping } from './Mapping'
|
|
4
4
|
import type { Input } from '../../io'
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Forbidden request header names: the browser sets them itself and a script cannot
|
|
8
|
+
* list them in `Access-Control-Request-Headers`, so there is nothing to advertise
|
|
9
|
+
* or vary on. The value is still read, it just never reaches CORS.
|
|
10
|
+
*/
|
|
11
|
+
const FORBIDDEN = new Set(['host', 'origin'])
|
|
12
|
+
|
|
6
13
|
export class Headers extends Mapping<Record<string, string>> {
|
|
7
14
|
private readonly headers: string[]
|
|
8
15
|
|
|
@@ -14,7 +21,7 @@ export class Headers extends Mapping<Record<string, string>> {
|
|
|
14
21
|
|
|
15
22
|
super(map)
|
|
16
23
|
|
|
17
|
-
this.headers = Object.values(map).filter((header) => header
|
|
24
|
+
this.headers = Object.values(map).filter((header) => !FORBIDDEN.has(header))
|
|
18
25
|
this.headers.forEach((header) => cors.allow(header))
|
|
19
26
|
}
|
|
20
27
|
|
|
@@ -11,7 +11,6 @@ import type { Parameter } from '../../RTD'
|
|
|
11
11
|
import type { Unit, Location } from './workflows'
|
|
12
12
|
import type { Entry } from '@toa.io/extensions.storages'
|
|
13
13
|
import type { Remotes } from '../../Remotes'
|
|
14
|
-
import type { Err } from 'error-value'
|
|
15
14
|
import type { Component } from '@toa.io/core'
|
|
16
15
|
import type { Output } from '../../io'
|
|
17
16
|
import type { Input } from './types'
|
|
@@ -73,7 +72,7 @@ export class Put extends Directive {
|
|
|
73
72
|
const entry = await this.storage.invoke<Entry>('put', request)
|
|
74
73
|
|
|
75
74
|
return match<Output>(entry,
|
|
76
|
-
Error, (error:
|
|
75
|
+
Error, (error: CodedError) => this.throw(error),
|
|
77
76
|
() => this.reply(input, storage, entry, parameters))
|
|
78
77
|
}
|
|
79
78
|
|
|
@@ -104,7 +103,7 @@ export class Put extends Directive {
|
|
|
104
103
|
return stream
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
private throw (error:
|
|
106
|
+
private throw (error: CodedError): never {
|
|
108
107
|
throw match(error.code,
|
|
109
108
|
'NOT_ACCEPTABLE', () => new http.UnsupportedMediaType(),
|
|
110
109
|
'TYPE_MISMATCH', () => new http.BadRequest(),
|
|
@@ -136,3 +135,7 @@ interface StoreRequest {
|
|
|
136
135
|
attributes?: Record<string, string>
|
|
137
136
|
}
|
|
138
137
|
}
|
|
138
|
+
|
|
139
|
+
interface CodedError extends Error {
|
|
140
|
+
code: string
|
|
141
|
+
}
|
package/source/root.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { merge } from '@toa.io/generic'
|
|
2
2
|
import { syntax } from './RTD'
|
|
3
3
|
|
|
4
4
|
export function resolve (): syntax.Node {
|
|
5
5
|
const value = process.env.TOA_EXPOSITION
|
|
6
|
-
const root = value !== undefined ?
|
|
6
|
+
const root = value !== undefined ? JSON.parse(value) as syntax.Node : syntax.createNode()
|
|
7
7
|
|
|
8
8
|
merge(root, PREDEFINED)
|
|
9
9
|
|
package/transpiled/Branch.d.ts
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import type * as RTD from './RTD/syntax';
|
|
2
|
+
import type { Node } from './RTD';
|
|
2
3
|
export interface Branch {
|
|
3
4
|
namespace: string;
|
|
4
5
|
component: string;
|
|
5
6
|
isolated: boolean;
|
|
6
7
|
node: RTD.Node;
|
|
7
8
|
version: string;
|
|
9
|
+
/**
|
|
10
|
+
* When the tenant that announced it started, by its own clock. A replica on its way
|
|
11
|
+
* out announces the same component with an older stamp than the one replacing it, and
|
|
12
|
+
* that is what tells the two apart when their versions differ.
|
|
13
|
+
*/
|
|
14
|
+
timestamp: number;
|
|
8
15
|
}
|
|
16
|
+
/** A branch the gateway has merged, and the tenant it came from. */
|
|
17
|
+
export interface Exposed {
|
|
18
|
+
version: string;
|
|
19
|
+
/** The start time of the tenant this branch came from. */
|
|
20
|
+
timestamp: number;
|
|
21
|
+
nodes: Node[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What to do with an announcement about a component that already has a branch exposed.
|
|
25
|
+
*
|
|
26
|
+
* - `refresh`: the same version, so its expiration is extended and its endpoints left alone
|
|
27
|
+
* - `superseded`: it came from a tenant that started before the one exposed now
|
|
28
|
+
* - `merge`: everything else
|
|
29
|
+
*/
|
|
30
|
+
export declare function decide(exposed: Exposed, branch: Branch): Decision;
|
|
31
|
+
export type Decision = 'merge' | 'refresh' | 'superseded';
|
package/transpiled/Branch.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decide = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* What to do with an announcement about a component that already has a branch exposed.
|
|
6
|
+
*
|
|
7
|
+
* - `refresh`: the same version, so its expiration is extended and its endpoints left alone
|
|
8
|
+
* - `superseded`: it came from a tenant that started before the one exposed now
|
|
9
|
+
* - `merge`: everything else
|
|
10
|
+
*/
|
|
11
|
+
function decide(exposed, branch) {
|
|
12
|
+
if (exposed.version === branch.version)
|
|
13
|
+
return 'refresh';
|
|
14
|
+
if (branch.timestamp < exposed.timestamp)
|
|
15
|
+
return 'superseded';
|
|
16
|
+
return 'merge';
|
|
17
|
+
}
|
|
18
|
+
exports.decide = decide;
|
|
3
19
|
//# sourceMappingURL=Branch.js.map
|
package/transpiled/Branch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Branch.js","sourceRoot":"","sources":["../source/Branch.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Branch.js","sourceRoot":"","sources":["../source/Branch.ts"],"names":[],"mappings":";;;AA4BA;;;;;;GAMG;AACH,SAAgB,MAAM,CAAE,OAAgB,EAAE,MAAc;IACtD,IAAI,OAAO,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO;QACpC,OAAO,SAAS,CAAA;IAElB,IAAI,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS;QACtC,OAAO,YAAY,CAAA;IAErB,OAAO,OAAO,CAAA;AAChB,CAAC;AARD,wBAQC"}
|
package/transpiled/Factory.js
CHANGED
|
@@ -30,7 +30,6 @@ exports.Factory = void 0;
|
|
|
30
30
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
31
31
|
const node_crypto_1 = require("node:crypto");
|
|
32
32
|
const openspan_1 = require("openspan");
|
|
33
|
-
const generic_1 = require("@toa.io/generic");
|
|
34
33
|
const Tenant_1 = require("./Tenant");
|
|
35
34
|
const Gateway_1 = require("./Gateway");
|
|
36
35
|
const Remotes_1 = require("./Remotes");
|
|
@@ -50,6 +49,7 @@ class Factory {
|
|
|
50
49
|
tenant(locator, node) {
|
|
51
50
|
const broadcast = this.boot.bindings.broadcast(CHANNEL, locator.id);
|
|
52
51
|
const hash = (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(node)).digest('hex');
|
|
52
|
+
// no timestamp: the tenant stamps each announcement with its own start time
|
|
53
53
|
const branch = {
|
|
54
54
|
namespace: locator.namespace,
|
|
55
55
|
component: locator.name,
|
|
@@ -62,7 +62,7 @@ class Factory {
|
|
|
62
62
|
service() {
|
|
63
63
|
node_assert_1.default.ok(process.env.TOA_EXPOSITION_PROPERTIES, 'TOA_EXPOSITION_PROPERTIES is undefined');
|
|
64
64
|
configureLogs();
|
|
65
|
-
const options =
|
|
65
|
+
const options = JSON.parse(process.env.TOA_EXPOSITION_PROPERTIES);
|
|
66
66
|
const broadcast = this.boot.bindings.broadcast(CHANNEL);
|
|
67
67
|
const server = http.Server.create({ ...options });
|
|
68
68
|
const remotes = new Remotes_1.Remotes(this.boot);
|
|
@@ -87,10 +87,10 @@ const TRACES_ENV = 'TOA_TELEMETRY_TRACES';
|
|
|
87
87
|
function configureLogs() {
|
|
88
88
|
const globEnv = process.env[LOGS_PREFIX];
|
|
89
89
|
const level = process.env.TOA_DEV === '1' ? 'trace' : 'info';
|
|
90
|
-
const options = globEnv === undefined ? { level } :
|
|
90
|
+
const options = globEnv === undefined ? { level } : JSON.parse(globEnv);
|
|
91
91
|
openspan_1.console.configure({ level: options.level ?? level });
|
|
92
92
|
const tracesEnv = process.env[TRACES_ENV];
|
|
93
|
-
(0, openspan_1.traces)(tracesEnv === undefined ? development() :
|
|
93
|
+
(0, openspan_1.traces)(tracesEnv === undefined ? development() : JSON.parse(tracesEnv));
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Tracing is off unless it is configured. The console exporter is a local development
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAChC,6CAAwC;AACxC,uCAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAChC,6CAAwC;AACxC,uCAA8E;AAC9E,qCAAiC;AACjC,uCAAmC;AACnC,uCAAmC;AACnC,+BAA4B;AAC5B,yCAA6C;AAC7C,6CAAqD;AACrD,2CAA+C;AAC/C,+CAA2C;AAC3C,6CAA8B;AAC9B,iDAA6C;AAC7C,6CAA8B;AAM9B,MAAa,OAAO;IACD,IAAI,CAAY;IAEjC,YAAoB,IAAgB;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAEM,MAAM,CAAE,OAAgB,EAAE,IAAiB;QAChD,MAAM,SAAS,GAAc,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAA;QAC9E,MAAM,IAAI,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAE5E,4EAA4E;QAC5E,MAAM,MAAM,GA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A;IAE/E,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AACpD,CAAC"}
|
package/transpiled/Gateway.js
CHANGED
|
@@ -33,6 +33,7 @@ const openspan_1 = require("openspan");
|
|
|
33
33
|
const core_1 = require("@toa.io/core");
|
|
34
34
|
const http = __importStar(require("./HTTP"));
|
|
35
35
|
const exceptions_1 = require("./exceptions");
|
|
36
|
+
const Branch_1 = require("./Branch");
|
|
36
37
|
class Gateway extends core_1.Connector {
|
|
37
38
|
broadcast;
|
|
38
39
|
tree;
|
|
@@ -190,12 +191,21 @@ class Gateway extends core_1.Connector {
|
|
|
190
191
|
version: branch.version
|
|
191
192
|
};
|
|
192
193
|
const exposed = this.branches.get(id);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
194
|
+
if (exposed !== undefined)
|
|
195
|
+
switch ((0, Branch_1.decide)(exposed, branch)) {
|
|
196
|
+
// rebuilding an identical branch would only tear down its live endpoints
|
|
197
|
+
case 'refresh':
|
|
198
|
+
this.tree.refresh(exposed.nodes);
|
|
199
|
+
openspan_1.console.trace('Branch refreshed', attributes);
|
|
200
|
+
return;
|
|
201
|
+
case 'superseded':
|
|
202
|
+
openspan_1.console.debug('Branch superseded', {
|
|
203
|
+
...attributes,
|
|
204
|
+
timestamp: branch.timestamp,
|
|
205
|
+
exposed: exposed.timestamp
|
|
206
|
+
});
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
199
209
|
let nodes;
|
|
200
210
|
try {
|
|
201
211
|
nodes = this.tree.merge(branch.node, branch);
|
|
@@ -205,7 +215,7 @@ class Gateway extends core_1.Connector {
|
|
|
205
215
|
openspan_1.console.error('Branch merge exception', { message, ...attributes });
|
|
206
216
|
return;
|
|
207
217
|
}
|
|
208
|
-
this.branches.set(id, { version: branch.version, nodes });
|
|
218
|
+
this.branches.set(id, { version: branch.version, timestamp: branch.timestamp, nodes });
|
|
209
219
|
if (this.lastMerge !== 0)
|
|
210
220
|
this.widestGap = Math.max(this.widestGap, Date.now() - this.lastMerge);
|
|
211
221
|
this.lastMerge = Date.now();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gateway.js","sourceRoot":"","sources":["../source/Gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAChC,mDAAiD;AACjD,uCAAkC;AAClC,uCAAuD;AACvD,6CAA8B;AAC9B,6CAAsC;
|
|
1
|
+
{"version":3,"file":"Gateway.js","sourceRoot":"","sources":["../source/Gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAChC,mDAAiD;AACjD,uCAAkC;AAClC,uCAAuD;AACvD,6CAA8B;AAC9B,6CAAsC;AACtC,qCAAiC;AAMjC,MAAa,OAAQ,SAAQ,gBAAS;IACnB,SAAS,CAAW;IACpB,IAAI,CAAM;IACV,WAAW,CAAc;IACzB,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAA;IAC9C,SAAS,GAAG,CAAC,CAAA;IACb,SAAS,GAAG,CAAC,CAAA;IACb,QAAQ,GAAG,CAAC,CAAA;IACZ,OAAO,GAAG,KAAK,CAAA;IACf,iBAAiB,GAAwB,IAAI,CAAA;IAErD,YAAoB,SAAoB,EAAE,IAAU,EAAE,YAA0B;QAC9E,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,WAAW,GAAG,YAAY,CAAA;QAE/B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAE,OAAqB;QACzC,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAA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AAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAA;QAExE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAC3B,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAA;QAC1B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAA;QAE7B,kBAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;IAC3C,CAAC;CACF;AAxQD,0BAwQC;AAID,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAC5B,MAAM,gBAAgB,GAAG,MAAM,CAAA;AAC/B,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAC7B,MAAM,cAAc,GAAG,MAAM,CAAA;AAC7B,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,MAAM,YAAY,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;AACzC,MAAM,aAAa,GAAG,KAAK,CAAA"}
|
|
@@ -33,9 +33,23 @@ function decode(buffer, charset = 'utf-8') {
|
|
|
33
33
|
}
|
|
34
34
|
exports.decode = decode;
|
|
35
35
|
function encode(value) {
|
|
36
|
-
const serializable = value instanceof Error ? Object.assign({}, value) : value;
|
|
36
|
+
const serializable = value instanceof Error ? Object.assign({}, value) : represent(value);
|
|
37
37
|
const text = yaml.dump(serializable, { lineWidth: -1, noRefs: true });
|
|
38
38
|
return Buffer.from(text);
|
|
39
39
|
}
|
|
40
40
|
exports.encode = encode;
|
|
41
|
+
/** What says how it is to be written — a redacted secret — is written that way, as in JSON. */
|
|
42
|
+
function represent(value) {
|
|
43
|
+
if (typeof value !== 'object' || value === null || value instanceof Date || Buffer.isBuffer(value))
|
|
44
|
+
return value;
|
|
45
|
+
if ('toJSON' in value && typeof value.toJSON === 'function')
|
|
46
|
+
return value.toJSON();
|
|
47
|
+
if (Array.isArray(value))
|
|
48
|
+
return value.map(represent);
|
|
49
|
+
const object = value;
|
|
50
|
+
const represented = {};
|
|
51
|
+
for (const key of Object.keys(object))
|
|
52
|
+
represented[key] = represent(object[key]);
|
|
53
|
+
return represented;
|
|
54
|
+
}
|
|
41
55
|
//# sourceMappingURL=yaml.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../../source/HTTP/formats/yaml.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAA+B;AAElB,QAAA,IAAI,GAAG,kBAAkB,CAAA;AACzB,QAAA,SAAS,GAAG,gBAAgB,CAAA;AAEzC,SAAgB,MAAM,CAAE,MAAc,EAAE,OAAO,GAAG,OAAO;IACvD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAyB,CAAC,CAAA;IAEvD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AAJD,wBAIC;AAED,SAAgB,MAAM,CAAE,KAAU;IAChC,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../../source/HTTP/formats/yaml.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAA+B;AAElB,QAAA,IAAI,GAAG,kBAAkB,CAAA;AACzB,QAAA,SAAS,GAAG,gBAAgB,CAAA;AAEzC,SAAgB,MAAM,CAAE,MAAc,EAAE,OAAO,GAAG,OAAO;IACvD,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAyB,CAAC,CAAA;IAEvD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACxB,CAAC;AAJD,wBAIC;AAED,SAAgB,MAAM,CAAE,KAAU;IAChC,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IACzF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IAErE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAC;AALD,wBAKC;AAED,+FAA+F;AAC/F,SAAS,SAAS,CAAE,KAAc;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,YAAY,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChG,OAAO,KAAK,CAAA;IAEd,IAAI,QAAQ,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU;QACzD,OAAO,KAAK,CAAC,MAAM,EAAE,CAAA;IAEvB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACtB,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAE7B,MAAM,MAAM,GAAG,KAAgC,CAAA;IAC/C,MAAM,WAAW,GAA4B,EAAE,CAAA;IAE/C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QACnC,WAAW,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;IAE3C,OAAO,WAAW,CAAA;AACpB,CAAC"}
|
package/transpiled/RTD/Tree.js
CHANGED
|
@@ -45,7 +45,10 @@ class Tree {
|
|
|
45
45
|
endpoints: this.endpoints,
|
|
46
46
|
directives: {
|
|
47
47
|
factory: this.directives,
|
|
48
|
-
|
|
48
|
+
// A merged branch is mounted under the root, so it inherits the root's
|
|
49
|
+
// directives. The trunk is the root: createNode adds them itself, and
|
|
50
|
+
// seeding them here too would apply every one of them twice.
|
|
51
|
+
stack: node === this.root ? [] : this.root.directives ?? []
|
|
49
52
|
},
|
|
50
53
|
path: label(extension),
|
|
51
54
|
extension
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../source/RTD/Tree.ts"],"names":[],"mappings":";;;AAAA,uCAAiD;AACjD,uCAAoC;AAQpC,MAAa,IAAI;IACE,IAAI,CAAa;IACjB,KAAK,CAAM;IACX,SAAS,CAAkB;IAC3B,UAAU,CAAkB;IAE7C,YAAoB,IAAiB,EAAE,SAA2B,EAAE,UAA4B;QAC9F,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAC/C,CAAC;IAEM,KAAK,CAAE,IAAY;QACxB,IAAI,IAAI,KAAK,GAAG;YACd,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,KAAK;gBAChB,UAAU,EAAE,EAAE;aACf,CAAA;QAEH,MAAM,SAAS,GAAG,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAA;QAEhC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACpC,CAAC;IAEM,KAAK,CAAE,IAAiB,EAAE,SAAkB;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAE3D,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACjC,CAAC;IAED;;;OAGG;IACI,OAAO,CAAE,KAAa;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,IAAA,mBAAS,GAAE,CAAA;QAE3C,KAAK,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AAQ;QACnE,CAAC,CAAC,GAAG,SAAS,IAAI,SAAS,EAAE;QAC7B,CAAC,CAAC,EAAE,CAAA;AACR,CAAC;AAED,MAAM,SAAS,GAAG,IAAI,CAAA"}
|
package/transpiled/Tenant.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class Tenant extends Connector {
|
|
|
7
7
|
private readonly branch;
|
|
8
8
|
private started;
|
|
9
9
|
private stopped;
|
|
10
|
-
constructor(broadcast: Broadcast, branch: Branch);
|
|
10
|
+
constructor(broadcast: Broadcast, branch: Omit<Branch, 'timestamp'>);
|
|
11
11
|
open(): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Announcing is stopped where the teardown begins, not in `dispose`, which a connector
|
package/transpiled/Tenant.js
CHANGED
|
@@ -44,7 +44,7 @@ class Tenant extends core_1.Connector {
|
|
|
44
44
|
// is the same announcement by another route
|
|
45
45
|
if (this.stopped)
|
|
46
46
|
return;
|
|
47
|
-
await this.broadcast.transmit('expose', this.branch);
|
|
47
|
+
await this.broadcast.transmit('expose', { ...this.branch, timestamp: this.started });
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
exports.Tenant = Tenant;
|
package/transpiled/Tenant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tenant.js","sourceRoot":"","sources":["../source/Tenant.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AACjD,uCAAwC;AACxC,mCAAoC;AAKpC,MAAa,MAAO,SAAQ,gBAAS;IAClB,SAAS,CAAW;IACpB,MAAM,
|
|
1
|
+
{"version":3,"file":"Tenant.js","sourceRoot":"","sources":["../source/Tenant.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AACjD,uCAAwC;AACxC,mCAAoC;AAKpC,MAAa,MAAO,SAAQ,gBAAS;IAClB,SAAS,CAAW;IACpB,MAAM,CAA2B;IAC1C,OAAO,GAAG,CAAC,CAAA;IACX,OAAO,GAAG,KAAK,CAAA;IAEvB,YAAoB,SA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uDC;AAED,SAAS,cAAc,CAAE,MAAc;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC,CAAA;AAC5F,CAAC;AAED,MAAM,UAAU,GAAG,KAAK,CAAA;AACxB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAU,GAAG,GAAG,CAAC,CAAA;AAC/C,MAAM,UAAU,GAAG,OAAO,CAAA"}
|
package/transpiled/deployment.js
CHANGED
|
@@ -28,7 +28,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.deployment = void 0;
|
|
30
30
|
const node_assert_1 = __importDefault(require("node:assert"));
|
|
31
|
-
const generic_1 = require("@toa.io/generic");
|
|
32
31
|
const schemas = __importStar(require("./schemas"));
|
|
33
32
|
const Directive_1 = require("./Directive");
|
|
34
33
|
const Composition_1 = require("./Composition");
|
|
@@ -57,7 +56,7 @@ function deployment(_, annotation) {
|
|
|
57
56
|
const tree = (0, syntax_1.parse)(annotation['/'], Directive_1.shortcuts);
|
|
58
57
|
service.variables.push({
|
|
59
58
|
name: 'TOA_EXPOSITION',
|
|
60
|
-
value:
|
|
59
|
+
value: JSON.stringify(tree)
|
|
61
60
|
});
|
|
62
61
|
}
|
|
63
62
|
const { debug, authorities } = annotation;
|
|
@@ -72,12 +71,12 @@ function deployment(_, annotation) {
|
|
|
72
71
|
properties.debug = true;
|
|
73
72
|
service.variables.push({
|
|
74
73
|
name: 'TOA_EXPOSITION_PROPERTIES',
|
|
75
|
-
value:
|
|
74
|
+
value: JSON.stringify(properties)
|
|
76
75
|
});
|
|
77
76
|
// Nested identity composition shares this process; gateway already exposes /.ready.
|
|
78
77
|
service.variables.push({
|
|
79
78
|
name: 'TOA_TELEMETRY_READY',
|
|
80
|
-
value:
|
|
79
|
+
value: JSON.stringify(false)
|
|
81
80
|
});
|
|
82
81
|
return { services: [service] };
|
|
83
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../source/deployment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;
|
|
1
|
+
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../source/deployment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAGhC,mDAAoC;AACpC,2CAAuC;AACvC,+CAA0C;AAC1C,yCAAoC;AACpC,iCAAoC;AAEpC,SAAgB,UAAU,CAAE,CAAU,EAAE,UAAuB;IAC7D,qBAAM,CAAC,EAAE,CAAC,UAAU,KAAK,SAAS,EAAE,2CAA2C,CAAC,CAAA;IAChF,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IAEvC,MAAM,MAAM,GAAG,IAAA,wBAAU,GAAE,CAAC,MAAM,CAAA;IAElC,MAAM,OAAO,GAAY;QACvB,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,WAAI;QACV,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO;QAC3C,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,MAAM;QAClB,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,OAAO,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE;QACjC,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,WAAI;YACV,KAAK,EAAE,YAAK;SACb;KACF,CAAA;IAED,IAAI,UAAU,EAAE,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,UAAU,CAAC,GAAG,CAAC,EAAE,qBAAS,CAAC,CAA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