@toa.io/extensions.introspection 1.0.0-alpha.274 → 1.0.0-alpha.277
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 +27 -0
- package/components/introspection.edges/operations/lib/types.js +1 -2
- package/components/introspection.edges/operations/merge.d.ts +1 -1
- package/components/introspection.edges/operations/merge.js +1 -5
- package/components/introspection.edges/operations/merge.js.map +1 -1
- package/components/introspection.edges/source/merge.ts +1 -1
- package/components/introspection.edges/tsconfig.json +2 -1
- package/components/introspection.edges/tsconfig.tsbuildinfo +1 -0
- package/components/introspection.nodes/operations/lib/types.js +1 -2
- package/components/introspection.nodes/operations/merge.d.ts +1 -1
- package/components/introspection.nodes/operations/merge.js +1 -5
- package/components/introspection.nodes/operations/merge.js.map +1 -1
- package/components/introspection.nodes/source/merge.ts +1 -1
- package/components/introspection.nodes/tsconfig.json +2 -1
- package/components/introspection.nodes/tsconfig.tsbuildinfo +1 -0
- package/cucumber.mjs +5 -0
- package/features/site/favicon.ico +0 -0
- package/features/steps/Map.ts +7 -4
- package/features/steps/UI.ts +7 -4
- package/features/steps/components/probe.discreet/operations/ping.js +1 -5
- package/features/steps/components/probe.quiet/operations/ping.js +1 -5
- package/features/steps/components/probe.source/operations/crash.js +1 -5
- package/features/steps/components/probe.source/operations/fail.js +1 -5
- package/features/steps/components/probe.source/operations/relay.js +1 -5
- package/features/steps/components/probe.target/operations/compute.js +1 -5
- package/features/steps/components/probe.target/operations/count.js +1 -5
- package/features/ui.feature +8 -0
- package/package.json +8 -7
- package/source/Composition.ts +3 -3
- package/source/Factory.ts +11 -11
- package/source/Reporter.ts +5 -5
- package/source/Tenant.ts +3 -3
- package/source/UI.ts +18 -3
- package/source/annotation.ts +1 -1
- package/source/describe.ts +1 -1
- package/source/extension.ts +7 -6
- package/source/index.ts +6 -6
- package/source/keys.ts +0 -0
- package/source/manifest.ts +3 -3
- package/source/sample.ts +2 -2
- package/source/schemas.ts +3 -3
- package/transpiled/Composition.d.ts +2 -2
- package/transpiled/Composition.js +10 -16
- package/transpiled/Composition.js.map +1 -1
- package/transpiled/Explorer.js +5 -9
- package/transpiled/Explorer.js.map +1 -1
- package/transpiled/Factory.d.ts +1 -1
- package/transpiled/Factory.js +25 -29
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Reporter.d.ts +3 -3
- package/transpiled/Reporter.js +17 -44
- package/transpiled/Reporter.js.map +1 -1
- package/transpiled/Tenant.d.ts +2 -2
- package/transpiled/Tenant.js +5 -9
- package/transpiled/Tenant.js.map +1 -1
- package/transpiled/UI.js +28 -42
- package/transpiled/UI.js.map +1 -1
- package/transpiled/annotation.js +11 -18
- package/transpiled/annotation.js.map +1 -1
- package/transpiled/const.js +14 -17
- package/transpiled/const.js.map +1 -1
- package/transpiled/describe.d.ts +1 -1
- package/transpiled/describe.js +1 -5
- package/transpiled/describe.js.map +1 -1
- package/transpiled/extension.d.ts +1 -1
- package/transpiled/extension.js +13 -39
- package/transpiled/extension.js.map +1 -1
- package/transpiled/index.d.ts +6 -6
- package/transpiled/index.js +4 -24
- package/transpiled/index.js.map +1 -1
- package/transpiled/keys.d.ts +1 -1
- package/transpiled/keys.js +0 -0
- package/transpiled/keys.js.map +1 -1
- package/transpiled/manifest.d.ts +1 -1
- package/transpiled/manifest.js +4 -31
- package/transpiled/manifest.js.map +1 -1
- package/transpiled/model.js +1 -2
- package/transpiled/sample.d.ts +1 -1
- package/transpiled/sample.js +7 -12
- package/transpiled/sample.js.map +1 -1
- package/transpiled/schemas.d.ts +1 -1
- package/transpiled/schemas.js +6 -12
- package/transpiled/schemas.js.map +1 -1
- package/tsconfig.json +2 -1
- package/tsconfig.tsbuildinfo +1 -0
- package/ui/dist/_app/immutable/assets/0.CWRy6hIz.css +2 -0
- package/ui/dist/_app/immutable/chunks/{CWBmo41A.js → 4d7brJza.js} +1 -1
- package/ui/dist/_app/immutable/chunks/{CK4sLEd3.js → BVv4SYrQ.js} +1 -1
- package/ui/dist/_app/immutable/chunks/{CXPzWPPc.js → C_kdB4X2.js} +1 -1
- package/ui/dist/_app/immutable/chunks/{lbvTT87l.js → CxYfr1U5.js} +1 -1
- package/ui/dist/_app/immutable/chunks/{DkRoH8VB.js → DDKoJC_D.js} +2 -2
- package/ui/dist/_app/immutable/chunks/DmszgSBE.js +1 -0
- package/ui/dist/_app/immutable/chunks/{DV5FeqaS.js → Do5Xe4vM.js} +1 -1
- package/ui/dist/_app/immutable/chunks/{BY43uyo-.js → DwyaYyzF.js} +1 -1
- package/ui/dist/_app/immutable/chunks/qMMF_Rd1.js +1 -0
- package/ui/dist/_app/immutable/entry/{app.wjPYH3Z9.js → app.BVV__aDk.js} +2 -2
- package/ui/dist/_app/immutable/entry/start.Bzmzsr0o.js +1 -0
- package/ui/dist/_app/immutable/nodes/{0.Bt74MSIV.js → 0.CoXu2yXo.js} +1 -1
- package/ui/dist/_app/immutable/nodes/{1.CcKCLlFa.js → 1.inKtchRm.js} +1 -1
- package/ui/dist/_app/immutable/nodes/{2.iCDxFSgZ.js → 2.XKZKnU2Z.js} +2 -2
- package/ui/dist/_app/immutable/nodes/3.DBlxuG_f.js +1 -0
- package/ui/dist/_app/immutable/nodes/4.nH2s4zsj.js +1 -0
- package/ui/dist/_app/immutable/nodes/{5.CZuKWYoU.js → 5.D8rUvfC7.js} +1 -1
- package/ui/dist/_app/version.json +1 -1
- package/ui/dist/apple-touch-icon.png +0 -0
- package/ui/dist/favicon-96x96.png +0 -0
- package/ui/dist/favicon.ico +0 -0
- package/ui/dist/index.html +19 -13
- package/components/introspection.edges/operations/tsconfig.tsbuildinfo +0 -1
- package/components/introspection.nodes/operations/tsconfig.tsbuildinfo +0 -1
- package/cucumber.js +0 -8
- package/transpiled/tsconfig.tsbuildinfo +0 -1
- package/ui/dist/_app/immutable/assets/0.BkgBCl4O.css +0 -2
- package/ui/dist/_app/immutable/chunks/9wc6uLPR.js +0 -1
- package/ui/dist/_app/immutable/chunks/CU2CTSKU.js +0 -1
- package/ui/dist/_app/immutable/entry/start.CiEOO9Qu.js +0 -1
- package/ui/dist/_app/immutable/nodes/3.BDSk4SqM.js +0 -1
- package/ui/dist/_app/immutable/nodes/4.CFeQkq9O.js +0 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function computation (input) {
|
|
1
|
+
export function computation (input) {
|
|
4
2
|
return NOPE
|
|
5
3
|
}
|
|
6
4
|
|
|
@@ -8,5 +6,3 @@ const NOPE = Object.create(Error.prototype, {
|
|
|
8
6
|
code: { value: 'NOPE' },
|
|
9
7
|
message: { value: 'declined on purpose', enumerable: true }
|
|
10
8
|
})
|
|
11
|
-
|
|
12
|
-
exports.computation = computation
|
package/features/ui.feature
CHANGED
|
@@ -59,6 +59,14 @@ Feature: Publishing the UI
|
|
|
59
59
|
And the "content-type" header is "text/javascript; charset=utf-8"
|
|
60
60
|
And the "cache-control" header is "public, max-age=31536000, immutable"
|
|
61
61
|
|
|
62
|
+
Scenario: An icon is held, but not forever
|
|
63
|
+
It is named for what it is rather than for its content, so it is asked about again.
|
|
64
|
+
|
|
65
|
+
Given the UI is published
|
|
66
|
+
When "/.introspection/favicon.ico" is requested
|
|
67
|
+
Then the status is 200
|
|
68
|
+
And the "cache-control" header is "public, max-age=86400"
|
|
69
|
+
|
|
62
70
|
Scenario: The page itself is never cached
|
|
63
71
|
Given the UI is published
|
|
64
72
|
When "/.introspection/" is requested
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.introspection",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.277",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "Toa Introspection",
|
|
5
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
7
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -17,16 +18,16 @@
|
|
|
17
18
|
"access": "public"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@toa.io/core": "1.0.0-alpha.
|
|
21
|
-
"@toa.io/generic": "1.0.0-alpha.
|
|
22
|
-
"@toa.io/schemas": "1.0.0-alpha.
|
|
23
|
-
"openspan": "1.0.0-alpha.
|
|
21
|
+
"@toa.io/core": "1.0.0-alpha.277",
|
|
22
|
+
"@toa.io/generic": "1.0.0-alpha.277",
|
|
23
|
+
"@toa.io/schemas": "1.0.0-alpha.277",
|
|
24
|
+
"openspan": "1.0.0-alpha.277"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
27
|
"transpile": "npx tsc && npx tsc -p ./components/introspection.nodes && npx tsc -p ./components/introspection.edges",
|
|
27
28
|
"build:ui": "npm --prefix ui ci && npm --prefix ui run build",
|
|
28
29
|
"prepack": "npm run build:ui",
|
|
29
|
-
"features": "
|
|
30
|
+
"features": "TSX_TSCONFIG_PATH=features/steps/tsconfig.json NODE_OPTIONS=--import=tsx cucumber-js --tags 'not @samples and not @shutdown' && TOA_INTROSPECTION_SAMPLES=1 TSX_TSCONFIG_PATH=features/steps/tsconfig.json NODE_OPTIONS=--import=tsx cucumber-js --tags @samples && TOA_INTROSPECTION_INTERVAL=3600 TSX_TSCONFIG_PATH=features/steps/tsconfig.json NODE_OPTIONS=--import=tsx cucumber-js --tags @shutdown"
|
|
30
31
|
},
|
|
31
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "0c0071418c2c56a44e621ba5ced5cdd23dff1738"
|
|
32
33
|
}
|
package/source/Composition.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readdirSync, type Dirent } from 'node:fs'
|
|
2
2
|
import { resolve } from 'node:path'
|
|
3
3
|
import { Connector } from '@toa.io/core'
|
|
4
|
-
import { type Bootloader } from './Factory'
|
|
5
|
-
import type { Annotation } from './annotation'
|
|
4
|
+
import { type Bootloader } from './Factory.js'
|
|
5
|
+
import type { Annotation } from './annotation.js'
|
|
6
6
|
|
|
7
7
|
/** Hosts the introspection components in the explorer process. */
|
|
8
8
|
export class Composition extends Connector {
|
|
@@ -58,4 +58,4 @@ interface Components {
|
|
|
58
58
|
paths: string[]
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const ROOT = resolve(
|
|
61
|
+
const ROOT = resolve(import.meta.dirname, '../components/')
|
package/source/Factory.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { Connector } from '@toa.io/core'
|
|
2
|
-
import { DISABLED, environment, component as declaration, settings } from './annotation'
|
|
3
|
-
import { NAMESPACE, UI_PORT } from './const'
|
|
4
|
-
import { describe } from './describe'
|
|
5
|
-
import { Reporter } from './Reporter'
|
|
6
|
-
import { Tenant } from './Tenant'
|
|
7
|
-
import { Composition } from './Composition'
|
|
8
|
-
import { Explorer } from './Explorer'
|
|
9
|
-
import { UI } from './UI'
|
|
10
|
-
import { capture, samplable } from './sample'
|
|
11
|
-
import type { Declaration, Options, Settings } from './annotation'
|
|
12
|
-
import type { Origin, Outcome, Target } from './model'
|
|
2
|
+
import { DISABLED, environment, component as declaration, settings } from './annotation.js'
|
|
3
|
+
import { NAMESPACE, UI_PORT } from './const.js'
|
|
4
|
+
import { describe } from './describe.js'
|
|
5
|
+
import { Reporter } from './Reporter.js'
|
|
6
|
+
import { Tenant } from './Tenant.js'
|
|
7
|
+
import { Composition } from './Composition.js'
|
|
8
|
+
import { Explorer } from './Explorer.js'
|
|
9
|
+
import { UI } from './UI.js'
|
|
10
|
+
import { capture, samplable } from './sample.js'
|
|
11
|
+
import type { Declaration, Options, Settings } from './annotation.js'
|
|
12
|
+
import type { Origin, Outcome, Target } from './model.js'
|
|
13
13
|
import type { Manifest } from '@toa.io/norm'
|
|
14
14
|
import type { Component, Locator, Reply, Request, extensions } from '@toa.io/core'
|
|
15
15
|
|
package/source/Reporter.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Connector, Locator } from '@toa.io/core'
|
|
2
2
|
import { console } from 'openspan'
|
|
3
|
-
import { EDGES, MAX_EDGES, NAMESPACE, NODES } from './const'
|
|
4
|
-
import * as keys from './keys'
|
|
5
|
-
import type { Bootloader } from './Factory'
|
|
6
|
-
import type { Options } from './annotation'
|
|
7
|
-
import type { Edge, Node } from './model'
|
|
3
|
+
import { EDGES, MAX_EDGES, NAMESPACE, NODES } from './const.js'
|
|
4
|
+
import * as keys from './keys.js'
|
|
5
|
+
import type { Bootloader } from './Factory.js'
|
|
6
|
+
import type { Options } from './annotation.js'
|
|
7
|
+
import type { Edge, Node } from './model.js'
|
|
8
8
|
import type { Remote } from '@toa.io/core'
|
|
9
9
|
|
|
10
10
|
/**
|
package/source/Tenant.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { setTimeout } from 'node:timers/promises'
|
|
2
2
|
import { Connector } from '@toa.io/core'
|
|
3
|
-
import { ANNOUNCE_INTERVAL } from './const'
|
|
4
|
-
import type { Reporter } from './Reporter'
|
|
5
|
-
import type { Node } from './model'
|
|
3
|
+
import { ANNOUNCE_INTERVAL } from './const.js'
|
|
4
|
+
import type { Reporter } from './Reporter.js'
|
|
5
|
+
import type { Node } from './model.js'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Announces the static description of a component.
|
package/source/UI.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as http from 'node:http'
|
|
|
3
3
|
import * as path from 'node:path'
|
|
4
4
|
import { Connector } from '@toa.io/core'
|
|
5
5
|
import { console } from 'openspan'
|
|
6
|
-
import { UI_PATH } from './const'
|
|
6
|
+
import { UI_PATH } from './const.js'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Serves the introspection UI: the directory `ui` builds, and nothing else.
|
|
@@ -150,7 +150,7 @@ export class UI extends Connector {
|
|
|
150
150
|
response.writeHead(200, {
|
|
151
151
|
'content-type': TYPES[path.extname(file)] ?? 'application/octet-stream',
|
|
152
152
|
'content-length': stats.size,
|
|
153
|
-
'cache-control':
|
|
153
|
+
'cache-control': caching(path.relative(this.root, file))
|
|
154
154
|
})
|
|
155
155
|
|
|
156
156
|
if (request.method === 'HEAD')
|
|
@@ -173,12 +173,27 @@ function isFile (file: string): boolean {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/** Where `npm run build:ui` puts the page, from both `source` and `transpiled`. */
|
|
176
|
-
const SITE = path.resolve(
|
|
176
|
+
const SITE = path.resolve(import.meta.dirname, '..', 'ui', 'dist')
|
|
177
177
|
|
|
178
178
|
/** Assets under this prefix carry their build hash in the name. */
|
|
179
179
|
const IMMUTABLE = path.join('_app', 'immutable')
|
|
180
180
|
const FOREVER = 'public, max-age=31536000, immutable'
|
|
181
181
|
|
|
182
|
+
/** The icons: named without a hash, so they are re-read, but rarely. */
|
|
183
|
+
const ICONS = new Set(['favicon.ico', 'favicon-96x96.png', 'apple-touch-icon.png'])
|
|
184
|
+
const DAY = 'public, max-age=86400'
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* How long what is served may be held. The page is never cached — it names the assets,
|
|
188
|
+
* and their names carry the build. An icon is named for what it is rather than for its
|
|
189
|
+
* content, so it is asked about again, but not on every page load.
|
|
190
|
+
*/
|
|
191
|
+
function caching (relative: string): string {
|
|
192
|
+
if (relative.startsWith(IMMUTABLE)) return FOREVER
|
|
193
|
+
|
|
194
|
+
return ICONS.has(relative) ? DAY : 'no-cache'
|
|
195
|
+
}
|
|
196
|
+
|
|
182
197
|
const TYPES: Record<string, string> = {
|
|
183
198
|
'.css': 'text/css; charset=utf-8',
|
|
184
199
|
'.html': 'text/html; charset=utf-8',
|
package/source/annotation.ts
CHANGED
package/source/describe.ts
CHANGED
package/source/extension.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { options } from './annotation.js'
|
|
3
|
+
import { components } from './Composition.js'
|
|
4
|
+
import { ENV, UI_PATH, UI_PORT } from './const.js'
|
|
5
|
+
import * as schemas from './schemas.js'
|
|
6
|
+
import type { Annotation } from './annotation.js'
|
|
6
7
|
import type { Dependency, Instances, Service } from '@toa.io/operations'
|
|
7
8
|
|
|
8
9
|
export const standalone = true
|
|
@@ -26,7 +27,7 @@ export function deployment (_: Instances<unknown>, annotation?: Annotation): Dep
|
|
|
26
27
|
const service: Service = {
|
|
27
28
|
group: 'introspection',
|
|
28
29
|
name: 'explorer',
|
|
29
|
-
version:
|
|
30
|
+
version: JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version,
|
|
30
31
|
components: components().labels,
|
|
31
32
|
resources: annotation?.resources,
|
|
32
33
|
variables: []
|
package/source/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { Factory } from './Factory'
|
|
2
|
-
export { manifest } from './manifest'
|
|
3
|
-
export { components } from './Composition'
|
|
4
|
-
export * from './extension'
|
|
1
|
+
export { Factory } from './Factory.js'
|
|
2
|
+
export { manifest } from './manifest.js'
|
|
3
|
+
export { components } from './Composition.js'
|
|
4
|
+
export * from './extension.js'
|
|
5
5
|
|
|
6
|
-
export type { Annotation, Declaration, Options, Settings } from './annotation'
|
|
7
|
-
export type * from './model'
|
|
6
|
+
export type { Annotation, Declaration, Options, Settings } from './annotation.js'
|
|
7
|
+
export type * from './model.js'
|
package/source/keys.ts
CHANGED
|
Binary file
|
package/source/manifest.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { component } from './annotation'
|
|
2
|
-
import * as schemas from './schemas'
|
|
3
|
-
import type { Declaration } from './annotation'
|
|
1
|
+
import { component } from './annotation.js'
|
|
2
|
+
import * as schemas from './schemas.js'
|
|
3
|
+
import type { Declaration } from './annotation.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The component level of the annotation.
|
package/source/sample.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable } from 'node:stream'
|
|
2
|
-
import { REDACTED, SAMPLE_LIMIT } from './const'
|
|
3
|
-
import type { Outcome, Sample } from './model'
|
|
2
|
+
import { REDACTED, SAMPLE_LIMIT } from './const.js'
|
|
3
|
+
import type { Outcome, Sample } from './model.js'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Captures the payload of a call. Only reached when both the context and the
|
package/source/schemas.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { resolve } from 'node:path'
|
|
2
|
-
import schemas from '@toa.io/schemas'
|
|
2
|
+
import * as schemas from '@toa.io/schemas'
|
|
3
3
|
import type { Schema } from '@toa.io/schemas'
|
|
4
|
-
import type { Annotation, Declaration } from './annotation'
|
|
4
|
+
import type { Annotation, Declaration } from './annotation.js'
|
|
5
5
|
|
|
6
|
-
const path = resolve(
|
|
6
|
+
const path = resolve(import.meta.dirname, '../schemas')
|
|
7
7
|
const namespace = schemas.namespace(path)
|
|
8
8
|
|
|
9
9
|
export const annotation: Schema<Exclude<Annotation, false>> = namespace.schema('annotation')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connector } from '@toa.io/core';
|
|
2
|
-
import { type Bootloader } from './Factory';
|
|
3
|
-
import type { Annotation } from './annotation';
|
|
2
|
+
import { type Bootloader } from './Factory.js';
|
|
3
|
+
import type { Annotation } from './annotation.js';
|
|
4
4
|
/** Hosts the introspection components in the explorer process. */
|
|
5
5
|
export declare class Composition extends Connector {
|
|
6
6
|
private readonly boot;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const node_fs_1 = require("node:fs");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
const core_1 = require("@toa.io/core");
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { Connector } from '@toa.io/core';
|
|
7
4
|
/** Hosts the introspection components in the explorer process. */
|
|
8
|
-
class Composition extends
|
|
5
|
+
export class Composition extends Connector {
|
|
9
6
|
boot;
|
|
10
7
|
constructor(boot) {
|
|
11
8
|
super();
|
|
@@ -18,13 +15,11 @@ class Composition extends core_1.Connector {
|
|
|
18
15
|
this.depends(composition);
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return entries().map((entry) => (0, node_path_1.resolve)(ROOT, entry.name));
|
|
18
|
+
export function find() {
|
|
19
|
+
return entries().map((entry) => resolve(ROOT, entry.name));
|
|
24
20
|
}
|
|
25
|
-
exports.find = find;
|
|
26
21
|
function entries() {
|
|
27
|
-
const entries =
|
|
22
|
+
const entries = readdirSync(ROOT, { withFileTypes: true });
|
|
28
23
|
return entries.filter((entry) => entry.isDirectory());
|
|
29
24
|
}
|
|
30
25
|
/**
|
|
@@ -32,17 +27,16 @@ function entries() {
|
|
|
32
27
|
* must not end up with the explorer components — nor with the exposition
|
|
33
28
|
* dependency they bring in.
|
|
34
29
|
*/
|
|
35
|
-
function components(annotation) {
|
|
30
|
+
export function components(annotation) {
|
|
36
31
|
if (annotation === false)
|
|
37
32
|
return { labels: [], paths: [] };
|
|
38
33
|
const labels = [];
|
|
39
34
|
const paths = [];
|
|
40
35
|
for (const entry of entries()) {
|
|
41
36
|
labels.push(entry.name.replace('.', '-'));
|
|
42
|
-
paths.push(
|
|
37
|
+
paths.push(resolve(ROOT, entry.name));
|
|
43
38
|
}
|
|
44
39
|
return { labels, paths };
|
|
45
40
|
}
|
|
46
|
-
|
|
47
|
-
const ROOT = (0, node_path_1.resolve)(__dirname, '../components/');
|
|
41
|
+
const ROOT = resolve(import.meta.dirname, '../components/');
|
|
48
42
|
//# sourceMappingURL=Composition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Composition.js","sourceRoot":"","sources":["../source/Composition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Composition.js","sourceRoot":"","sources":["../source/Composition.ts"],"names":[],"m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AO,EAAE,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;QACzC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IACvC,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAA;AAC1B,CAAC;AAOD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA"}
|
package/transpiled/Explorer.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Explorer = void 0;
|
|
4
|
-
const core_1 = require("@toa.io/core");
|
|
5
|
-
const openspan_1 = require("openspan");
|
|
1
|
+
import { Connector } from '@toa.io/core';
|
|
2
|
+
import { console } from 'openspan';
|
|
6
3
|
/**
|
|
7
4
|
* The explorer process. It hosts the introspection components — the map is read
|
|
8
5
|
* through their own operations — and serves the UI.
|
|
9
6
|
*/
|
|
10
|
-
class Explorer extends
|
|
7
|
+
export class Explorer extends Connector {
|
|
11
8
|
async open() {
|
|
12
|
-
|
|
9
|
+
console.info('Introspection explorer started');
|
|
13
10
|
}
|
|
14
11
|
dispose() {
|
|
15
|
-
|
|
12
|
+
console.info('Introspection explorer is closed');
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
|
-
exports.Explorer = Explorer;
|
|
19
15
|
//# sourceMappingURL=Explorer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../source/Explorer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Explorer.js","sourceRoot":"","sources":["../source/Explorer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAElC;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,SAAS;IAClB,KAAK,CAAC,IAAI;QAC3B,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;IAChD,CAAC;IAEkB,OAAO;QACxB,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAA;IAClD,CAAC;CACF"}
|
package/transpiled/Factory.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Connector } from '@toa.io/core';
|
|
2
|
-
import type { Declaration } from './annotation';
|
|
2
|
+
import type { Declaration } from './annotation.js';
|
|
3
3
|
import type { Manifest } from '@toa.io/norm';
|
|
4
4
|
import type { Component, Locator, extensions } from '@toa.io/core';
|
|
5
5
|
export declare class Factory implements extensions.Factory {
|
package/transpiled/Factory.js
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const UI_1 = require("./UI");
|
|
13
|
-
const sample_1 = require("./sample");
|
|
14
|
-
class Factory {
|
|
1
|
+
import { Connector } from '@toa.io/core';
|
|
2
|
+
import { DISABLED, environment, component as declaration, settings } from './annotation.js';
|
|
3
|
+
import { NAMESPACE, UI_PORT } from './const.js';
|
|
4
|
+
import { describe } from './describe.js';
|
|
5
|
+
import { Reporter } from './Reporter.js';
|
|
6
|
+
import { Tenant } from './Tenant.js';
|
|
7
|
+
import { Composition } from './Composition.js';
|
|
8
|
+
import { Explorer } from './Explorer.js';
|
|
9
|
+
import { UI } from './UI.js';
|
|
10
|
+
import { capture, samplable } from './sample.js';
|
|
11
|
+
export class Factory {
|
|
15
12
|
boot;
|
|
16
13
|
options;
|
|
17
14
|
settings = {};
|
|
18
15
|
reporter = null;
|
|
19
16
|
constructor(boot) {
|
|
20
17
|
this.boot = boot;
|
|
21
|
-
this.options =
|
|
18
|
+
this.options = environment();
|
|
22
19
|
}
|
|
23
20
|
tenant(locator, decl, manifest) {
|
|
24
|
-
const resolved =
|
|
21
|
+
const resolved = settings(locator.namespace, declaration(decl), this.options);
|
|
25
22
|
this.settings[locator.id] = resolved;
|
|
26
|
-
if (!resolved.enabled || locator.namespace ===
|
|
27
|
-
return new
|
|
28
|
-
return new
|
|
23
|
+
if (!resolved.enabled || locator.namespace === NAMESPACE)
|
|
24
|
+
return new Connector();
|
|
25
|
+
return new Tenant(this.collector(), describe(manifest));
|
|
29
26
|
}
|
|
30
27
|
component(component) {
|
|
31
28
|
const locator = component.locator;
|
|
@@ -53,8 +50,8 @@ class Factory {
|
|
|
53
50
|
// a call that failed is still a connection between two components
|
|
54
51
|
const src = request?.source ?? UNKNOWN;
|
|
55
52
|
const dst = { namespace: locator.namespace, component: locator.name, operation: endpoint };
|
|
56
|
-
const sample = resolved.samples &&
|
|
57
|
-
?
|
|
53
|
+
const sample = resolved.samples && samplable(request?.input)
|
|
54
|
+
? capture(request?.input, outcome)
|
|
58
55
|
: undefined;
|
|
59
56
|
reporter.observe({ src, dst, sample });
|
|
60
57
|
}
|
|
@@ -65,11 +62,11 @@ class Factory {
|
|
|
65
62
|
service() {
|
|
66
63
|
if (this.options === null)
|
|
67
64
|
return null;
|
|
68
|
-
const composition = new
|
|
69
|
-
const explorer = new
|
|
65
|
+
const composition = new Composition(this.boot);
|
|
66
|
+
const explorer = new Explorer();
|
|
70
67
|
explorer.depends(composition);
|
|
71
68
|
if (this.options.ui)
|
|
72
|
-
explorer.depends(new
|
|
69
|
+
explorer.depends(new UI(UI_PORT));
|
|
73
70
|
return explorer;
|
|
74
71
|
}
|
|
75
72
|
/**
|
|
@@ -78,16 +75,15 @@ class Factory {
|
|
|
78
75
|
* the environment, with sampling off.
|
|
79
76
|
*/
|
|
80
77
|
resolve(locator) {
|
|
81
|
-
if (locator.namespace ===
|
|
82
|
-
return
|
|
78
|
+
if (locator.namespace === NAMESPACE)
|
|
79
|
+
return DISABLED;
|
|
83
80
|
return this.settings[locator.id] ??
|
|
84
|
-
|
|
81
|
+
settings(locator.namespace, {}, this.options === null ? null : { ...this.options, samples: false });
|
|
85
82
|
}
|
|
86
83
|
collector() {
|
|
87
|
-
this.reporter ??= new
|
|
84
|
+
this.reporter ??= new Reporter(this.boot, this.options);
|
|
88
85
|
return this.reporter;
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
|
-
exports.Factory = Factory;
|
|
92
88
|
const UNKNOWN = { service: 'unknown' };
|
|
93
89
|
//# sourceMappingURL=Factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Factory.js","sourceRoot":"","sources":["../source/Factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,IAAI,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC3F,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAMhD,MAAM,OAAO,OAAO;IACD,IAAI,CAAY;IAChB,OAAO,CAAgB;IACvB,QAAQ,GAA6B,EAAE,CAAA;IAChD,QAAQ,GAAoB,IA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ACjB,CAAC;IAED;;;;OAIG;IACK,OAAO,CAAE,OAAgB;QAC/B,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS;YACjC,OAAO,QAAQ,CAAA;QAEjB,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9B,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,EAAE,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;IACvG,CAAC;IAEO,SAAS;QACf,IAAI,CAAC,QAAQ,KAAK,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAQ,CAAC,CAAA;QAExD,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;CACF;AAED,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,SAAS,EAAW,CAAA"}
|
package/transpiled/Reporter.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connector } from '@toa.io/core';
|
|
2
|
-
import type { Bootloader } from './Factory';
|
|
3
|
-
import type { Options } from './annotation';
|
|
4
|
-
import type { Edge, Node } from './model';
|
|
2
|
+
import type { Bootloader } from './Factory.js';
|
|
3
|
+
import type { Options } from './annotation.js';
|
|
4
|
+
import type { Edge, Node } from './model.js';
|
|
5
5
|
/**
|
|
6
6
|
* Buffers what a process observes and flushes it into the introspection
|
|
7
7
|
* components.
|