@toa.io/definitions 1.0.0-alpha.288
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/digest/extensions.cadence.json +1 -0
- package/digest/extensions.configuration.json +1 -0
- package/digest/extensions.exposition.json +1 -0
- package/digest/extensions.introspection.json +1 -0
- package/digest/extensions.realtime.json +1 -0
- package/package.json +42 -0
- package/readme.md +75 -0
- package/schemas/extensions.cadence/annotation.cos.yaml +9 -0
- package/schemas/extensions.cadence/declaration.cos.yaml +20 -0
- package/schemas/extensions.configuration/annotation.cos.yaml +29 -0
- package/schemas/extensions.configuration/manifest.cos.yaml +9 -0
- package/schemas/extensions.exposition/annotation.cos.yaml +125 -0
- package/schemas/extensions.exposition/call.cos.yaml +18 -0
- package/schemas/extensions.exposition/directive.cos.yaml +7 -0
- package/schemas/extensions.exposition/method.cos.yaml +23 -0
- package/schemas/extensions.exposition/node.cos.yaml +22 -0
- package/schemas/extensions.exposition/query.cos.yaml +31 -0
- package/schemas/extensions.exposition/querystring.cos.yaml +19 -0
- package/schemas/extensions.exposition/range.cos.yaml +10 -0
- package/schemas/extensions.exposition/route.cos.yaml +6 -0
- package/schemas/extensions.introspection/annotation.cos.yaml +31 -0
- package/schemas/extensions.introspection/declaration.cos.yaml +5 -0
- package/schemas/extensions.storages/annotation.cos.yaml +11 -0
- package/schemas/extensions.storages/cloudinary.cos.yaml +38 -0
- package/schemas/extensions.storages/fs.cos.yaml +13 -0
- package/schemas/extensions.storages/s3.cos.yaml +17 -0
- package/schemas/extensions.storages/spaces.cos.yaml +16 -0
- package/schemas/extensions.storages/test.cos.yaml +10 -0
- package/schemas/extensions.storages/tmp.cos.yaml +10 -0
- package/source/bindings.amqp/annotation.ts +26 -0
- package/source/bindings.amqp/context.ts +68 -0
- package/source/bindings.amqp/deployment.ts +14 -0
- package/source/bindings.amqp/index.ts +9 -0
- package/source/bindings.amqp/instance.ts +3 -0
- package/source/bindings.amqp/sources.ts +39 -0
- package/source/bindings.loop/index.ts +3 -0
- package/source/bridges.bash/const.ts +2 -0
- package/source/bridges.bash/define.ts +38 -0
- package/source/bridges.bash/index.ts +2 -0
- package/source/bridges.node/define.ts +69 -0
- package/source/bridges.node/exports.ts +175 -0
- package/source/bridges.node/index.ts +6 -0
- package/source/bridges.node/operations.ts +127 -0
- package/source/bridges.node/sources.ts +44 -0
- package/source/definition.ts +38 -0
- package/source/digest/generate.ts +77 -0
- package/source/digest/read.ts +39 -0
- package/source/extensions.cadence/components.ts +6 -0
- package/source/extensions.cadence/const.ts +31 -0
- package/source/extensions.cadence/context.ts +10 -0
- package/source/extensions.cadence/deployment.ts +37 -0
- package/source/extensions.cadence/index.ts +8 -0
- package/source/extensions.cadence/manifest.ts +64 -0
- package/source/extensions.cadence/schemas.ts +10 -0
- package/source/extensions.cadence/types.ts +41 -0
- package/source/extensions.configuration/components.ts +6 -0
- package/source/extensions.configuration/const.ts +30 -0
- package/source/extensions.configuration/context.ts +13 -0
- package/source/extensions.configuration/deployment.ts +159 -0
- package/source/extensions.configuration/epoch.ts +22 -0
- package/source/extensions.configuration/index.ts +10 -0
- package/source/extensions.configuration/manifest.ts +12 -0
- package/source/extensions.configuration/schemas.ts +9 -0
- package/source/extensions.exposition/Annotation.ts +91 -0
- package/source/extensions.exposition/components.ts +6 -0
- package/source/extensions.exposition/const.ts +45 -0
- package/source/extensions.exposition/deployment.ts +95 -0
- package/source/extensions.exposition/index.ts +16 -0
- package/source/extensions.exposition/manifest.ts +56 -0
- package/source/extensions.exposition/schemas.ts +16 -0
- package/source/extensions.exposition/shortcuts.ts +14 -0
- package/source/extensions.exposition/syntax/index.ts +2 -0
- package/source/extensions.exposition/syntax/parse.ts +171 -0
- package/source/extensions.exposition/syntax/types.ts +69 -0
- package/source/extensions.fetch/context.ts +10 -0
- package/source/extensions.fetch/index.ts +1 -0
- package/source/extensions.introspection/annotation.ts +87 -0
- package/source/extensions.introspection/components.ts +13 -0
- package/source/extensions.introspection/const.ts +46 -0
- package/source/extensions.introspection/deployment.ts +48 -0
- package/source/extensions.introspection/index.ts +6 -0
- package/source/extensions.introspection/manifest.ts +18 -0
- package/source/extensions.introspection/schemas.ts +12 -0
- package/source/extensions.realtime/components.ts +5 -0
- package/source/extensions.realtime/deployment.ts +89 -0
- package/source/extensions.realtime/index.ts +4 -0
- package/source/extensions.stash/context.ts +10 -0
- package/source/extensions.stash/deployment.ts +22 -0
- package/source/extensions.stash/index.ts +2 -0
- package/source/extensions.state/context.ts +9 -0
- package/source/extensions.state/index.ts +1 -0
- package/source/extensions.storages/Annotation.ts +57 -0
- package/source/extensions.storages/context.ts +14 -0
- package/source/extensions.storages/deployment.ts +91 -0
- package/source/extensions.storages/index.ts +9 -0
- package/source/extensions.storages/manifest.ts +7 -0
- package/source/extensions.storages/schemas.ts +15 -0
- package/source/extensions.storages/secrets.ts +22 -0
- package/source/extensions.telemetry/const.ts +6 -0
- package/source/extensions.telemetry/context.ts +11 -0
- package/source/extensions.telemetry/deployment.ts +91 -0
- package/source/extensions.telemetry/index.ts +5 -0
- package/source/extensions.telemetry/ready.ts +33 -0
- package/source/index.ts +2 -0
- package/source/storages.mongodb/deployment.ts +22 -0
- package/source/storages.mongodb/index.ts +1 -0
- package/source/version.ts +10 -0
- package/transpiled/bindings.amqp/annotation.d.ts +10 -0
- package/transpiled/bindings.amqp/annotation.js +16 -0
- package/transpiled/bindings.amqp/annotation.js.map +1 -0
- package/transpiled/bindings.amqp/annotation.test.d.ts +1 -0
- package/transpiled/bindings.amqp/annotation.test.js +36 -0
- package/transpiled/bindings.amqp/annotation.test.js.map +1 -0
- package/transpiled/bindings.amqp/context.d.ts +7 -0
- package/transpiled/bindings.amqp/context.js +47 -0
- package/transpiled/bindings.amqp/context.js.map +1 -0
- package/transpiled/bindings.amqp/deployment.d.ts +4 -0
- package/transpiled/bindings.amqp/deployment.js +11 -0
- package/transpiled/bindings.amqp/deployment.js.map +1 -0
- package/transpiled/bindings.amqp/index.d.ts +6 -0
- package/transpiled/bindings.amqp/index.js +5 -0
- package/transpiled/bindings.amqp/index.js.map +1 -0
- package/transpiled/bindings.amqp/instance.d.ts +2 -0
- package/transpiled/bindings.amqp/instance.js +2 -0
- package/transpiled/bindings.amqp/instance.js.map +1 -0
- package/transpiled/bindings.amqp/properties.test.d.ts +1 -0
- package/transpiled/bindings.amqp/properties.test.js +7 -0
- package/transpiled/bindings.amqp/properties.test.js.map +1 -0
- package/transpiled/bindings.amqp/sources.d.ts +7 -0
- package/transpiled/bindings.amqp/sources.js +27 -0
- package/transpiled/bindings.amqp/sources.js.map +1 -0
- package/transpiled/bindings.loop/index.d.ts +2 -0
- package/transpiled/bindings.loop/index.js +2 -0
- package/transpiled/bindings.loop/index.js.map +1 -0
- package/transpiled/bindings.loop/properties.test.d.ts +1 -0
- package/transpiled/bindings.loop/properties.test.js +7 -0
- package/transpiled/bindings.loop/properties.test.js.map +1 -0
- package/transpiled/bridges.bash/const.d.ts +2 -0
- package/transpiled/bridges.bash/const.js +3 -0
- package/transpiled/bridges.bash/const.js.map +1 -0
- package/transpiled/bridges.bash/define.d.ts +3 -0
- package/transpiled/bridges.bash/define.js +25 -0
- package/transpiled/bridges.bash/define.js.map +1 -0
- package/transpiled/bridges.bash/index.d.ts +2 -0
- package/transpiled/bridges.bash/index.js +3 -0
- package/transpiled/bridges.bash/index.js.map +1 -0
- package/transpiled/bridges.node/define.d.ts +18 -0
- package/transpiled/bridges.node/define.js +46 -0
- package/transpiled/bridges.node/define.js.map +1 -0
- package/transpiled/bridges.node/exports.d.ts +16 -0
- package/transpiled/bridges.node/exports.js +134 -0
- package/transpiled/bridges.node/exports.js.map +1 -0
- package/transpiled/bridges.node/exports.test.d.ts +1 -0
- package/transpiled/bridges.node/exports.test.js +88 -0
- package/transpiled/bridges.node/exports.test.js.map +1 -0
- package/transpiled/bridges.node/index.d.ts +5 -0
- package/transpiled/bridges.node/index.js +4 -0
- package/transpiled/bridges.node/index.js.map +1 -0
- package/transpiled/bridges.node/operations.d.ts +13 -0
- package/transpiled/bridges.node/operations.js +96 -0
- package/transpiled/bridges.node/operations.js.map +1 -0
- package/transpiled/bridges.node/operations.test.d.ts +1 -0
- package/transpiled/bridges.node/operations.test.js +108 -0
- package/transpiled/bridges.node/operations.test.js.map +1 -0
- package/transpiled/bridges.node/sources.d.ts +7 -0
- package/transpiled/bridges.node/sources.js +36 -0
- package/transpiled/bridges.node/sources.js.map +1 -0
- package/transpiled/definition.d.ts +7 -0
- package/transpiled/definition.js +34 -0
- package/transpiled/definition.js.map +1 -0
- package/transpiled/digest/generate.d.ts +1 -0
- package/transpiled/digest/generate.js +60 -0
- package/transpiled/digest/generate.js.map +1 -0
- package/transpiled/digest/read.d.ts +16 -0
- package/transpiled/digest/read.js +22 -0
- package/transpiled/digest/read.js.map +1 -0
- package/transpiled/extensions.cadence/components.d.ts +3 -0
- package/transpiled/extensions.cadence/components.js +6 -0
- package/transpiled/extensions.cadence/components.js.map +1 -0
- package/transpiled/extensions.cadence/const.d.ts +21 -0
- package/transpiled/extensions.cadence/const.js +26 -0
- package/transpiled/extensions.cadence/const.js.map +1 -0
- package/transpiled/extensions.cadence/context.d.ts +3 -0
- package/transpiled/extensions.cadence/context.js +9 -0
- package/transpiled/extensions.cadence/context.js.map +1 -0
- package/transpiled/extensions.cadence/deployment.d.ts +9 -0
- package/transpiled/extensions.cadence/deployment.js +28 -0
- package/transpiled/extensions.cadence/deployment.js.map +1 -0
- package/transpiled/extensions.cadence/index.d.ts +7 -0
- package/transpiled/extensions.cadence/index.js +7 -0
- package/transpiled/extensions.cadence/index.js.map +1 -0
- package/transpiled/extensions.cadence/manifest.d.ts +11 -0
- package/transpiled/extensions.cadence/manifest.js +42 -0
- package/transpiled/extensions.cadence/manifest.js.map +1 -0
- package/transpiled/extensions.cadence/manifest.test.d.ts +1 -0
- package/transpiled/extensions.cadence/manifest.test.js +41 -0
- package/transpiled/extensions.cadence/manifest.test.js.map +1 -0
- package/transpiled/extensions.cadence/schemas.d.ts +4 -0
- package/transpiled/extensions.cadence/schemas.js +7 -0
- package/transpiled/extensions.cadence/schemas.js.map +1 -0
- package/transpiled/extensions.cadence/types.d.ts +34 -0
- package/transpiled/extensions.cadence/types.js +2 -0
- package/transpiled/extensions.cadence/types.js.map +1 -0
- package/transpiled/extensions.configuration/components.d.ts +3 -0
- package/transpiled/extensions.configuration/components.js +6 -0
- package/transpiled/extensions.configuration/components.js.map +1 -0
- package/transpiled/extensions.configuration/const.d.ts +18 -0
- package/transpiled/extensions.configuration/const.js +22 -0
- package/transpiled/extensions.configuration/const.js.map +1 -0
- package/transpiled/extensions.configuration/context.d.ts +4 -0
- package/transpiled/extensions.configuration/context.js +9 -0
- package/transpiled/extensions.configuration/context.js.map +1 -0
- package/transpiled/extensions.configuration/deployment.d.ts +17 -0
- package/transpiled/extensions.configuration/deployment.js +106 -0
- package/transpiled/extensions.configuration/deployment.js.map +1 -0
- package/transpiled/extensions.configuration/deployment.test.d.ts +1 -0
- package/transpiled/extensions.configuration/deployment.test.js +74 -0
- package/transpiled/extensions.configuration/deployment.test.js.map +1 -0
- package/transpiled/extensions.configuration/epoch.d.ts +2 -0
- package/transpiled/extensions.configuration/epoch.js +19 -0
- package/transpiled/extensions.configuration/epoch.js.map +1 -0
- package/transpiled/extensions.configuration/index.d.ts +9 -0
- package/transpiled/extensions.configuration/index.js +8 -0
- package/transpiled/extensions.configuration/index.js.map +1 -0
- package/transpiled/extensions.configuration/manifest.d.ts +5 -0
- package/transpiled/extensions.configuration/manifest.js +6 -0
- package/transpiled/extensions.configuration/manifest.js.map +1 -0
- package/transpiled/extensions.configuration/manifest.test.d.ts +1 -0
- package/transpiled/extensions.configuration/manifest.test.js +14 -0
- package/transpiled/extensions.configuration/manifest.test.js.map +1 -0
- package/transpiled/extensions.configuration/schemas.d.ts +3 -0
- package/transpiled/extensions.configuration/schemas.js +7 -0
- package/transpiled/extensions.configuration/schemas.js.map +1 -0
- package/transpiled/extensions.exposition/Annotation.d.ts +71 -0
- package/transpiled/extensions.exposition/Annotation.js +2 -0
- package/transpiled/extensions.exposition/Annotation.js.map +1 -0
- package/transpiled/extensions.exposition/components.d.ts +3 -0
- package/transpiled/extensions.exposition/components.js +6 -0
- package/transpiled/extensions.exposition/components.js.map +1 -0
- package/transpiled/extensions.exposition/const.d.ts +36 -0
- package/transpiled/extensions.exposition/const.js +37 -0
- package/transpiled/extensions.exposition/const.js.map +1 -0
- package/transpiled/extensions.exposition/deployment.d.ts +6 -0
- package/transpiled/extensions.exposition/deployment.js +75 -0
- package/transpiled/extensions.exposition/deployment.js.map +1 -0
- package/transpiled/extensions.exposition/index.d.ts +8 -0
- package/transpiled/extensions.exposition/index.js +8 -0
- package/transpiled/extensions.exposition/index.js.map +1 -0
- package/transpiled/extensions.exposition/manifest.d.ts +3 -0
- package/transpiled/extensions.exposition/manifest.js +39 -0
- package/transpiled/extensions.exposition/manifest.js.map +1 -0
- package/transpiled/extensions.exposition/manifest.test.d.ts +1 -0
- package/transpiled/extensions.exposition/manifest.test.js +38 -0
- package/transpiled/extensions.exposition/manifest.test.js.map +1 -0
- package/transpiled/extensions.exposition/schemas.d.ts +7 -0
- package/transpiled/extensions.exposition/schemas.js +10 -0
- package/transpiled/extensions.exposition/schemas.js.map +1 -0
- package/transpiled/extensions.exposition/schemas.test.d.ts +1 -0
- package/transpiled/extensions.exposition/schemas.test.js +22 -0
- package/transpiled/extensions.exposition/schemas.test.js.map +1 -0
- package/transpiled/extensions.exposition/shortcuts.d.ts +3 -0
- package/transpiled/extensions.exposition/shortcuts.js +13 -0
- package/transpiled/extensions.exposition/shortcuts.js.map +1 -0
- package/transpiled/extensions.exposition/syntax/index.d.ts +2 -0
- package/transpiled/extensions.exposition/syntax/index.js +3 -0
- package/transpiled/extensions.exposition/syntax/index.js.map +1 -0
- package/transpiled/extensions.exposition/syntax/parse.d.ts +4 -0
- package/transpiled/extensions.exposition/syntax/parse.js +112 -0
- package/transpiled/extensions.exposition/syntax/parse.js.map +1 -0
- package/transpiled/extensions.exposition/syntax/parse.test.d.ts +1 -0
- package/transpiled/extensions.exposition/syntax/parse.test.js +156 -0
- package/transpiled/extensions.exposition/syntax/parse.test.js.map +1 -0
- package/transpiled/extensions.exposition/syntax/types.d.ts +52 -0
- package/transpiled/extensions.exposition/syntax/types.js +11 -0
- package/transpiled/extensions.exposition/syntax/types.js.map +1 -0
- package/transpiled/extensions.fetch/context.d.ts +3 -0
- package/transpiled/extensions.fetch/context.js +9 -0
- package/transpiled/extensions.fetch/context.js.map +1 -0
- package/transpiled/extensions.fetch/index.d.ts +1 -0
- package/transpiled/extensions.fetch/index.js +2 -0
- package/transpiled/extensions.fetch/index.js.map +1 -0
- package/transpiled/extensions.introspection/annotation.d.ts +40 -0
- package/transpiled/extensions.introspection/annotation.js +39 -0
- package/transpiled/extensions.introspection/annotation.js.map +1 -0
- package/transpiled/extensions.introspection/components.d.ts +8 -0
- package/transpiled/extensions.introspection/components.js +12 -0
- package/transpiled/extensions.introspection/components.js.map +1 -0
- package/transpiled/extensions.introspection/const.d.ts +30 -0
- package/transpiled/extensions.introspection/const.js +35 -0
- package/transpiled/extensions.introspection/const.js.map +1 -0
- package/transpiled/extensions.introspection/deployment.d.ts +14 -0
- package/transpiled/extensions.introspection/deployment.js +41 -0
- package/transpiled/extensions.introspection/deployment.js.map +1 -0
- package/transpiled/extensions.introspection/index.d.ts +6 -0
- package/transpiled/extensions.introspection/index.js +7 -0
- package/transpiled/extensions.introspection/index.js.map +1 -0
- package/transpiled/extensions.introspection/manifest.d.ts +9 -0
- package/transpiled/extensions.introspection/manifest.js +16 -0
- package/transpiled/extensions.introspection/manifest.js.map +1 -0
- package/transpiled/extensions.introspection/schemas.d.ts +4 -0
- package/transpiled/extensions.introspection/schemas.js +7 -0
- package/transpiled/extensions.introspection/schemas.js.map +1 -0
- package/transpiled/extensions.realtime/components.d.ts +2 -0
- package/transpiled/extensions.realtime/components.js +5 -0
- package/transpiled/extensions.realtime/components.js.map +1 -0
- package/transpiled/extensions.realtime/deployment.d.ts +22 -0
- package/transpiled/extensions.realtime/deployment.js +53 -0
- package/transpiled/extensions.realtime/deployment.js.map +1 -0
- package/transpiled/extensions.realtime/index.d.ts +3 -0
- package/transpiled/extensions.realtime/index.js +3 -0
- package/transpiled/extensions.realtime/index.js.map +1 -0
- package/transpiled/extensions.stash/context.d.ts +3 -0
- package/transpiled/extensions.stash/context.js +9 -0
- package/transpiled/extensions.stash/context.js.map +1 -0
- package/transpiled/extensions.stash/deployment.d.ts +5 -0
- package/transpiled/extensions.stash/deployment.js +14 -0
- package/transpiled/extensions.stash/deployment.js.map +1 -0
- package/transpiled/extensions.stash/index.d.ts +2 -0
- package/transpiled/extensions.stash/index.js +3 -0
- package/transpiled/extensions.stash/index.js.map +1 -0
- package/transpiled/extensions.state/context.d.ts +6 -0
- package/transpiled/extensions.state/context.js +8 -0
- package/transpiled/extensions.state/context.js.map +1 -0
- package/transpiled/extensions.state/index.d.ts +1 -0
- package/transpiled/extensions.state/index.js +2 -0
- package/transpiled/extensions.state/index.js.map +1 -0
- package/transpiled/extensions.storages/Annotation.d.ts +8 -0
- package/transpiled/extensions.storages/Annotation.js +31 -0
- package/transpiled/extensions.storages/Annotation.js.map +1 -0
- package/transpiled/extensions.storages/context.d.ts +3 -0
- package/transpiled/extensions.storages/context.js +12 -0
- package/transpiled/extensions.storages/context.js.map +1 -0
- package/transpiled/extensions.storages/deployment.d.ts +5 -0
- package/transpiled/extensions.storages/deployment.js +64 -0
- package/transpiled/extensions.storages/deployment.js.map +1 -0
- package/transpiled/extensions.storages/index.d.ts +8 -0
- package/transpiled/extensions.storages/index.js +7 -0
- package/transpiled/extensions.storages/index.js.map +1 -0
- package/transpiled/extensions.storages/manifest.d.ts +1 -0
- package/transpiled/extensions.storages/manifest.js +8 -0
- package/transpiled/extensions.storages/manifest.js.map +1 -0
- package/transpiled/extensions.storages/schemas.d.ts +9 -0
- package/transpiled/extensions.storages/schemas.js +12 -0
- package/transpiled/extensions.storages/schemas.js.map +1 -0
- package/transpiled/extensions.storages/schemas.test.d.ts +1 -0
- package/transpiled/extensions.storages/schemas.test.js +59 -0
- package/transpiled/extensions.storages/schemas.test.js.map +1 -0
- package/transpiled/extensions.storages/secrets.d.ts +10 -0
- package/transpiled/extensions.storages/secrets.js +16 -0
- package/transpiled/extensions.storages/secrets.js.map +1 -0
- package/transpiled/extensions.telemetry/const.d.ts +4 -0
- package/transpiled/extensions.telemetry/const.js +6 -0
- package/transpiled/extensions.telemetry/const.js.map +1 -0
- package/transpiled/extensions.telemetry/context.d.ts +3 -0
- package/transpiled/extensions.telemetry/context.js +9 -0
- package/transpiled/extensions.telemetry/context.js.map +1 -0
- package/transpiled/extensions.telemetry/deployment.d.ts +18 -0
- package/transpiled/extensions.telemetry/deployment.js +49 -0
- package/transpiled/extensions.telemetry/deployment.js.map +1 -0
- package/transpiled/extensions.telemetry/index.d.ts +5 -0
- package/transpiled/extensions.telemetry/index.js +5 -0
- package/transpiled/extensions.telemetry/index.js.map +1 -0
- package/transpiled/extensions.telemetry/ready.d.ts +14 -0
- package/transpiled/extensions.telemetry/ready.js +16 -0
- package/transpiled/extensions.telemetry/ready.js.map +1 -0
- package/transpiled/index.d.ts +2 -0
- package/transpiled/index.js +3 -0
- package/transpiled/index.js.map +1 -0
- package/transpiled/storages.mongodb/deployment.d.ts +5 -0
- package/transpiled/storages.mongodb/deployment.js +14 -0
- package/transpiled/storages.mongodb/deployment.js.map +1 -0
- package/transpiled/storages.mongodb/index.d.ts +1 -0
- package/transpiled/storages.mongodb/index.js +2 -0
- package/transpiled/storages.mongodb/index.js.map +1 -0
- package/transpiled/version.d.ts +5 -0
- package/transpiled/version.js +8 -0
- package/transpiled/version.js.map +1 -0
- package/tsconfig.json +10 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as schemas from './schemas.js'
|
|
2
|
+
import type { Declaration } from './types.js'
|
|
3
|
+
import type { Manifest } from '@toa.io/norm'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The `cadence:` block of a component manifest: the operations called on a cadence, by the
|
|
7
|
+
* operation each one calls. Norm hands over the whole manifest, so what the declaration refers
|
|
8
|
+
* to is checked here rather than left to fail at boot.
|
|
9
|
+
*
|
|
10
|
+
* A component that declares nothing still has a declaration. `cadence: ~` is how one that only
|
|
11
|
+
* delays calls says so, and it has to produce a value or norm rejects the extension.
|
|
12
|
+
*/
|
|
13
|
+
export function manifest(
|
|
14
|
+
declaration: Declaration | null | undefined,
|
|
15
|
+
component: Manifest
|
|
16
|
+
): Declaration {
|
|
17
|
+
const normalized: Record<string, unknown> = expand(declaration)
|
|
18
|
+
|
|
19
|
+
schemas.declaration.validate<Declaration>(normalized, 'Invalid cadence declaration')
|
|
20
|
+
|
|
21
|
+
for (const [endpoint, pulse] of Object.entries(normalized)) {
|
|
22
|
+
const operation = component.operations?.[endpoint]
|
|
23
|
+
|
|
24
|
+
if (operation === undefined)
|
|
25
|
+
throw new Error(`Pulse refers to undefined operation '${endpoint}'`)
|
|
26
|
+
|
|
27
|
+
if (!TYPES.has(operation.type))
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Pulse '${endpoint}' must refer to an operation of the allowed types: ` +
|
|
30
|
+
[...TYPES].join(', ')
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
if (pulse.intervals > pulse.cycle)
|
|
34
|
+
throw new Error(
|
|
35
|
+
`Pulse '${endpoint}' splits a cycle of ${pulse.cycle} seconds into ` +
|
|
36
|
+
`${pulse.intervals} intervals, which is less than a second each`
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return normalized
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** A pulse whose cycle is not split has nothing to state but the cycle. */
|
|
44
|
+
function expand(declaration: Declaration | null | undefined): Record<string, unknown> {
|
|
45
|
+
if (declaration === null || declaration === undefined) return {}
|
|
46
|
+
|
|
47
|
+
// a cycle nothing splits is one interval, which is what the shorthand declares
|
|
48
|
+
return Object.fromEntries(
|
|
49
|
+
Object.entries(declaration).map(([endpoint, pulse]) => {
|
|
50
|
+
const declared: Record<string, unknown> =
|
|
51
|
+
typeof pulse === 'number' ? { cycle: pulse } : { ...pulse }
|
|
52
|
+
|
|
53
|
+
declared.intervals ??= 1
|
|
54
|
+
|
|
55
|
+
return [endpoint, declared]
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The types a receiver may refer to. An operation that produces no side effects has nothing to
|
|
62
|
+
* be called periodically for.
|
|
63
|
+
*/
|
|
64
|
+
const TYPES = new Set(['transition', 'assignment', 'effect', 'unmanaged'])
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { resolve } from 'node:path'
|
|
2
|
+
import * as schemas from '@toa.io/schemas'
|
|
3
|
+
import type { Schema } from '@toa.io/schemas'
|
|
4
|
+
import type { Annotation, Declaration } from './types.js'
|
|
5
|
+
|
|
6
|
+
const path = resolve(import.meta.dirname, '../../schemas/extensions.cadence')
|
|
7
|
+
const namespace = schemas.namespace(path)
|
|
8
|
+
|
|
9
|
+
export const declaration: Schema<Declaration> = namespace.schema('declaration')
|
|
10
|
+
export const annotation: Schema<Annotation> = namespace.schema('annotation')
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** What one component declares under `cadence:`, by the operation each one calls. */
|
|
2
|
+
export type Declaration = Record<string, Pulse>
|
|
3
|
+
|
|
4
|
+
export interface Pulse {
|
|
5
|
+
/** seconds one whole cycle takes */
|
|
6
|
+
cycle: number
|
|
7
|
+
|
|
8
|
+
/** intervals the cycle is split into; the gap between calls is `cycle / intervals` */
|
|
9
|
+
intervals: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** `context.delay` — a call to be made later, answering the id that cancels it. */
|
|
13
|
+
export interface Delay {
|
|
14
|
+
(endpoint: string, request: object | null, options: Options): Promise<string>
|
|
15
|
+
|
|
16
|
+
/** Raises where the id was never issued. */
|
|
17
|
+
cancel: (id: string) => Promise<void>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Options {
|
|
21
|
+
/** milliseconds from now */
|
|
22
|
+
interval: number
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Milliseconds the call may be late and still be made, or `null` for no bound at all.
|
|
26
|
+
*
|
|
27
|
+
* Stated rather than defaulted, because only the caller knows whether a late call is still
|
|
28
|
+
* the right call: an unpaid order expires on time or not at all, and a report is wanted
|
|
29
|
+
* whenever it can be had. Nothing else in the system can tell those apart.
|
|
30
|
+
*
|
|
31
|
+
* An upper bound on lateness, not a promise of timeliness. It is bounded below by how often
|
|
32
|
+
* a dispatcher scans, so a bound shorter than that is one nothing can honour.
|
|
33
|
+
*/
|
|
34
|
+
overdue: number | null
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** What an application states under `cadence:` in its context. */
|
|
38
|
+
export interface Annotation {
|
|
39
|
+
/** seconds between passes over the calls waiting to be made */
|
|
40
|
+
discreteness?: number
|
|
41
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { environment } from '@toa.io/generic'
|
|
2
|
+
import type { Source } from '@toa.io/core/types'
|
|
3
|
+
|
|
4
|
+
/** Per-component variables: the local override and the secrets. */
|
|
5
|
+
export const PREFIX = 'TOA_CONFIGURATION_'
|
|
6
|
+
|
|
7
|
+
/** The map of every configured component, on the values service. */
|
|
8
|
+
export const VALUES = 'TOA_CONFIGURATION_VALUES'
|
|
9
|
+
|
|
10
|
+
export const SECRET_RX = /^\$(?<variable>[A-Z0-9_]{1,32})$/
|
|
11
|
+
|
|
12
|
+
/** Where the UI is mounted; `/configuration/*` belongs to the component's own API. */
|
|
13
|
+
export const UI_PATH = '/.configuration'
|
|
14
|
+
export const UI_PORT = 8003
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The port the UI is served on. `UI_PORT` is what a deployment publishes and what the chart
|
|
18
|
+
* renders; the variable is for a machine that runs more than one Toa process — a Toa checkout
|
|
19
|
+
* beside an application, or two applications — where one of them has to give it up.
|
|
20
|
+
*/
|
|
21
|
+
export const UI_PORT_ENV = 'TOA_CONFIGURATION_UI_PORT'
|
|
22
|
+
export function uiPort(): number {
|
|
23
|
+
const value = environment.get(UI_PORT_ENV)
|
|
24
|
+
|
|
25
|
+
return value === undefined ? UI_PORT : Number(value)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const EVENT = 'configuration.values.created'
|
|
29
|
+
|
|
30
|
+
export const SOURCE: Source = { service: 'configuration' }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Manifest } from './manifest.js'
|
|
2
|
+
import type { Contribution } from '@toa.io/core/types'
|
|
3
|
+
|
|
4
|
+
/** What this extension puts on the context of a component that declares it. */
|
|
5
|
+
export function context(declaration: Manifest): Contribution {
|
|
6
|
+
const contribution: Contribution = { name: 'configuration', schema: declaration.schema }
|
|
7
|
+
|
|
8
|
+
// a value the schema declares a secret is one on the context, not a string
|
|
9
|
+
if (JSON.stringify(declaration.schema).includes('"secret"'))
|
|
10
|
+
contribution.imports = { '@toa.io/extensions.configuration': ['Secret'] }
|
|
11
|
+
|
|
12
|
+
return contribution
|
|
13
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import {
|
|
3
|
+
type Dependency,
|
|
4
|
+
type Resources,
|
|
5
|
+
type Service,
|
|
6
|
+
type Variable,
|
|
7
|
+
type Variables
|
|
8
|
+
} from '@toa.io/operations'
|
|
9
|
+
import { add } from '@toa.io/generic'
|
|
10
|
+
import { components } from './components.js'
|
|
11
|
+
import { version } from '../version.js'
|
|
12
|
+
import { EVENT, PREFIX, SECRET_RX, UI_PATH, UI_PORT, VALUES } from './const.js'
|
|
13
|
+
import { epoch } from './epoch.js'
|
|
14
|
+
import * as validators from './schemas.js'
|
|
15
|
+
import type { Manifest } from './manifest.js'
|
|
16
|
+
import type { context } from '@toa.io/norm'
|
|
17
|
+
|
|
18
|
+
/** Where Toa's release publishes this service's image. An application takes it
|
|
19
|
+
* instead of building one when its context says `registry.services: published`. */
|
|
20
|
+
export const image = 'ghcr.io/toa-io/extension-configuration-values'
|
|
21
|
+
|
|
22
|
+
export function deployment(
|
|
23
|
+
instances: Instance[],
|
|
24
|
+
annotation: Annotation = {}
|
|
25
|
+
): Dependency {
|
|
26
|
+
const { resources, values } = split(annotation)
|
|
27
|
+
|
|
28
|
+
annotation = prepare(values, instances)
|
|
29
|
+
|
|
30
|
+
const variables: Variables = {}
|
|
31
|
+
|
|
32
|
+
for (const instance of instances) {
|
|
33
|
+
const values = annotation[instance.locator.id]
|
|
34
|
+
|
|
35
|
+
if (values === undefined) continue
|
|
36
|
+
|
|
37
|
+
const secrets = createSecrets(values)
|
|
38
|
+
|
|
39
|
+
if (secrets.length > 0) variables[instance.locator.label] = secrets
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const service: Service = {
|
|
43
|
+
group: 'configuration',
|
|
44
|
+
name: 'values',
|
|
45
|
+
image,
|
|
46
|
+
version,
|
|
47
|
+
components: components().labels,
|
|
48
|
+
resources,
|
|
49
|
+
// the service that holds the values also serves the page that reads them
|
|
50
|
+
port: UI_PORT,
|
|
51
|
+
ingress: { path: UI_PATH },
|
|
52
|
+
variables: [
|
|
53
|
+
{
|
|
54
|
+
name: VALUES,
|
|
55
|
+
value: JSON.stringify(describe(instances, annotation))
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return { services: [service], variables, events: [EVENT] }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** What the values service is given: the epoch, the schema and the defaults of every component. */
|
|
64
|
+
export function describe(instances: Instance[], annotation: Annotation = {}): Values {
|
|
65
|
+
annotation = prepare(split(annotation).values, instances)
|
|
66
|
+
|
|
67
|
+
const values: Values = {}
|
|
68
|
+
|
|
69
|
+
for (const { locator, manifest } of instances) {
|
|
70
|
+
const deployed = annotation[locator.id]
|
|
71
|
+
|
|
72
|
+
values[locator.id] = {
|
|
73
|
+
epoch: epoch(manifest.schema),
|
|
74
|
+
schema: manifest.schema,
|
|
75
|
+
// what the Context says stands over what the manifest declares, value by value: a
|
|
76
|
+
// deployment that names one of them does not thereby unset the rest
|
|
77
|
+
defaults:
|
|
78
|
+
deployed === undefined
|
|
79
|
+
? manifest.defaults
|
|
80
|
+
: add(structuredClone(deployed), manifest.defaults ?? {})
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return values
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function createSecrets(values: object): Variable[] {
|
|
88
|
+
const secrets: Variable[] = []
|
|
89
|
+
|
|
90
|
+
for (const value of Object.values(values)) {
|
|
91
|
+
if (typeof value === 'object' && value !== null)
|
|
92
|
+
secrets.push(...createSecrets(value as object))
|
|
93
|
+
|
|
94
|
+
if (typeof value !== 'string') continue
|
|
95
|
+
|
|
96
|
+
const match = value.match(SECRET_RX)
|
|
97
|
+
|
|
98
|
+
if (match === null) continue
|
|
99
|
+
|
|
100
|
+
const name = match.groups?.variable
|
|
101
|
+
|
|
102
|
+
assert.ok(name !== undefined)
|
|
103
|
+
|
|
104
|
+
secrets.push({
|
|
105
|
+
name: PREFIX + '_' + name,
|
|
106
|
+
secret: {
|
|
107
|
+
name: 'toa-configuration',
|
|
108
|
+
key: name
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return secrets
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The service's own resources, and the component values that are the rest of the annotation.
|
|
118
|
+
*
|
|
119
|
+
* Every key here names a component, so the one option the service has of its own needs a
|
|
120
|
+
* name that cannot be mistaken for one. `resources` is reserved: a component actually
|
|
121
|
+
* called that is written with its namespace, `default.resources`, which is what an id is
|
|
122
|
+
* anyway — the bare form is the shorthand.
|
|
123
|
+
*/
|
|
124
|
+
function split(annotation: Annotation): { resources?: Resources; values: Annotation } {
|
|
125
|
+
validators.annotation.validate(annotation)
|
|
126
|
+
|
|
127
|
+
const { resources, ...values } = annotation as Annotation & { resources?: Resources }
|
|
128
|
+
|
|
129
|
+
return { resources, values }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Validated, keyed by full component ids, and checked against the components that ask. */
|
|
133
|
+
function prepare(annotation: Annotation, instances: Instance[]): Annotation {
|
|
134
|
+
const normalized: Annotation = {}
|
|
135
|
+
const requested = instances.map((instance) => instance.locator.id)
|
|
136
|
+
|
|
137
|
+
for (const [key, values] of Object.entries(annotation)) {
|
|
138
|
+
const id = key.includes('.') ? key : 'default.' + key
|
|
139
|
+
|
|
140
|
+
assert.ok(
|
|
141
|
+
requested.includes(id),
|
|
142
|
+
`Component '${id}' does not request configuration or does not exist.`
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
normalized[id] = values
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return normalized
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type Annotation = Record<string, object>
|
|
152
|
+
export type Instance = context.Dependency<Manifest>
|
|
153
|
+
export type Values = Record<string, Entry>
|
|
154
|
+
|
|
155
|
+
export interface Entry {
|
|
156
|
+
epoch: string
|
|
157
|
+
schema: object
|
|
158
|
+
defaults?: object
|
|
159
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto'
|
|
2
|
+
|
|
3
|
+
/** The same for the same schema, whatever the key order it was written in. */
|
|
4
|
+
export function epoch(schema: object): string {
|
|
5
|
+
return createHash('sha256').update(canonical(schema)).digest('hex')
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function canonical(value: unknown): string {
|
|
9
|
+
if (Array.isArray(value)) return '[' + value.map(canonical).join(',') + ']'
|
|
10
|
+
|
|
11
|
+
if (value !== null && typeof value === 'object') {
|
|
12
|
+
const object = value as Record<string, unknown>
|
|
13
|
+
const keys = Object.keys(object)
|
|
14
|
+
.filter((key) => object[key] !== undefined)
|
|
15
|
+
.sort()
|
|
16
|
+
const entries = keys.map((key) => JSON.stringify(key) + ':' + canonical(object[key]))
|
|
17
|
+
|
|
18
|
+
return '{' + entries.join(',') + '}'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return JSON.stringify(value) ?? 'null'
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { manifest } from './manifest.js'
|
|
2
|
+
export { components } from './components.js'
|
|
3
|
+
export { deployment, describe, image } from './deployment.js'
|
|
4
|
+
export { epoch } from './epoch.js'
|
|
5
|
+
export { context } from './context.js'
|
|
6
|
+
export * from './const.js'
|
|
7
|
+
export * as schemas from './schemas.js'
|
|
8
|
+
|
|
9
|
+
export type { Manifest } from './manifest.js'
|
|
10
|
+
export type { Annotation, Entry, Instance, Values } from './deployment.js'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { resolve } from 'node:path'
|
|
2
|
+
import * as schemas from '@toa.io/schemas'
|
|
3
|
+
import type { Schema } from '@toa.io/schemas'
|
|
4
|
+
|
|
5
|
+
const path = resolve(import.meta.dirname, '../../schemas/extensions.configuration')
|
|
6
|
+
const namespace = schemas.namespace(path)
|
|
7
|
+
|
|
8
|
+
export const manifest: Schema<any> = namespace.schema('manifest')
|
|
9
|
+
export const annotation: Schema<any> = namespace.schema('annotation')
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { Resources } from '@toa.io/operations'
|
|
2
|
+
|
|
3
|
+
/** What the gateway speaks upstream. */
|
|
4
|
+
export type Protocol = 'h1' | 'h2c'
|
|
5
|
+
|
|
6
|
+
export interface Annotation {
|
|
7
|
+
authorities: Record<string, string>
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `h2c` requires an ingress controller that proxies cleartext HTTP/2 upstream.
|
|
11
|
+
* See `documentation/protocol.md`.
|
|
12
|
+
*/
|
|
13
|
+
protocol?: Protocol
|
|
14
|
+
class?: string
|
|
15
|
+
resources?: Resources
|
|
16
|
+
annotations?: Record<string, string>
|
|
17
|
+
|
|
18
|
+
/** The Service, as opposed to the Ingress that `annotations` above describes. */
|
|
19
|
+
service?: { annotations?: Record<string, string> }
|
|
20
|
+
|
|
21
|
+
debug?: boolean
|
|
22
|
+
|
|
23
|
+
/** The header the client address is read from; the connection's without one. See `ip.md`. */
|
|
24
|
+
ip?: string
|
|
25
|
+
|
|
26
|
+
/** Failed authentications an address may make; none are metered unless set. See `identity.md`. */
|
|
27
|
+
bouncer?: Bouncer
|
|
28
|
+
|
|
29
|
+
/** The authorization server this context exposes; none is exposed without it. */
|
|
30
|
+
oauth?: OAuth
|
|
31
|
+
|
|
32
|
+
/** JSON-RPC at `/.rpc`; none is served without it. See `documentation/rpc.md`. */
|
|
33
|
+
rpc?: RPC
|
|
34
|
+
|
|
35
|
+
/** MCP at `/.mcp`; none is served without it. See `documentation/mcp.md`. */
|
|
36
|
+
mcp?: MCP
|
|
37
|
+
'/'?: object // parsed and validated by RTD.syntax.parse
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface OAuth {
|
|
41
|
+
/**
|
|
42
|
+
* Where a client sends the user to consent. The one endpoint of the flow that needs a
|
|
43
|
+
* person, and so the one this extension does not serve: an application builds it.
|
|
44
|
+
*/
|
|
45
|
+
authorize: string
|
|
46
|
+
|
|
47
|
+
/** Paths a token may be restricted to, each advertised as a protected resource. */
|
|
48
|
+
resources?: string[]
|
|
49
|
+
|
|
50
|
+
/** What a client may ask for. Each is a role, or a scope within one. */
|
|
51
|
+
scopes?: string[]
|
|
52
|
+
|
|
53
|
+
/** Origins whose Client ID Metadata Documents may be read. None are without it. */
|
|
54
|
+
trust?: string[]
|
|
55
|
+
|
|
56
|
+
/** Dynamic Client Registration, off unless opened. */
|
|
57
|
+
registration?: 'open' | 'closed'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface RPC {
|
|
61
|
+
/**
|
|
62
|
+
* Calls one request may carry, 32 by default. One request is one authentication and one
|
|
63
|
+
* reply however many calls it makes, so what a caller may ask for at once is bounded.
|
|
64
|
+
*/
|
|
65
|
+
batch?: number
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface MCP {
|
|
69
|
+
/** What the server calls itself, which a client shows a user. */
|
|
70
|
+
name: string
|
|
71
|
+
|
|
72
|
+
/** What a model is told before it calls anything here. */
|
|
73
|
+
instructions?: string
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Browser origins the endpoint answers, which the revision requires against DNS rebinding.
|
|
77
|
+
* None are admitted without it; a request carrying no `Origin` is not a browser's.
|
|
78
|
+
*/
|
|
79
|
+
origins?: string[]
|
|
80
|
+
|
|
81
|
+
/** Whether the endpoint answers without a credential. It does not unless it says so. */
|
|
82
|
+
anonymous?: boolean
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface Bouncer {
|
|
86
|
+
/** what an address may fail at once, 20 by default */
|
|
87
|
+
attempts?: number
|
|
88
|
+
|
|
89
|
+
/** seconds it takes to earn them back, 60 by default */
|
|
90
|
+
interval?: number
|
|
91
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const BRANCH_TTL = 1_800_000
|
|
2
|
+
|
|
3
|
+
/** The broadcast the gateway and its tenants share. */
|
|
4
|
+
export const CHANNEL = 'exposition'
|
|
5
|
+
|
|
6
|
+
/** The replicas of the gateway decide together, whatever context they serve. */
|
|
7
|
+
export const ATOM_GROUP = 'exposition'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Where JSON-RPC is served, for every procedure at once. Pinned rather than configured: a
|
|
11
|
+
* path an application could choose is a path it could collide with a route of its own.
|
|
12
|
+
*/
|
|
13
|
+
export const RPC = '/.rpc'
|
|
14
|
+
|
|
15
|
+
/** Calls one request may carry where the annotation does not say. */
|
|
16
|
+
export const BATCH = 32
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Where the Model Context Protocol is served. Pinned for the reason `/.rpc` is: a path an
|
|
20
|
+
* application could choose is a path it could collide with a route of its own.
|
|
21
|
+
*/
|
|
22
|
+
export const MCP = '/.mcp'
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Where the resource tree and the page that reads it are served. Pinned for the reason
|
|
26
|
+
* `/.rpc` is: a path an application could choose is a path it could collide with a route of
|
|
27
|
+
* its own. Unlike those two it is not annotated — every entry it carries is what `OPTIONS`
|
|
28
|
+
* on that path already answers to the same caller, and what it adds is the enumeration.
|
|
29
|
+
*/
|
|
30
|
+
export const DISCOVERY = '/.discovery'
|
|
31
|
+
|
|
32
|
+
/** Where the gateway serves. */
|
|
33
|
+
export const PORT = 8000
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Reserved for the readiness probe. `8001` is the Telemetry readiness probe's, and `toa export`
|
|
37
|
+
* refuses a port claimed twice — `toa mono` and a local run put every service in one process.
|
|
38
|
+
*/
|
|
39
|
+
export const PROBE = 8004
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The initial delay of the readiness probe. The server does not sleep for it: whoever
|
|
43
|
+
* probes is the one that waits, and doing it here as well only delayed the process twice.
|
|
44
|
+
*/
|
|
45
|
+
export const DELAY = 3 // seconds
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { type Dependency, type Service } from '@toa.io/operations'
|
|
3
|
+
import { type Annotation } from './Annotation.js'
|
|
4
|
+
import * as schemas from './schemas.js'
|
|
5
|
+
import { shortcuts } from './shortcuts.js'
|
|
6
|
+
import { components } from './components.js'
|
|
7
|
+
import { parse } from './syntax/index.js'
|
|
8
|
+
import { DELAY, PORT, PROBE } from './const.js'
|
|
9
|
+
import { version } from '../version.js'
|
|
10
|
+
|
|
11
|
+
/** Where Toa's release publishes this service's image. An application takes it
|
|
12
|
+
* instead of building one when its context says `registry.services: published`. */
|
|
13
|
+
export const image = 'ghcr.io/toa-io/extension-exposition-gateway'
|
|
14
|
+
|
|
15
|
+
export function deployment(_: unknown, annotation?: Annotation): Dependency {
|
|
16
|
+
assert.ok(annotation !== undefined, 'Exposition context annotation is required')
|
|
17
|
+
schemas.annotation.validate(annotation)
|
|
18
|
+
|
|
19
|
+
const labels = components().labels
|
|
20
|
+
|
|
21
|
+
const service: Service = {
|
|
22
|
+
group: 'exposition',
|
|
23
|
+
name: 'gateway',
|
|
24
|
+
image,
|
|
25
|
+
port: PORT,
|
|
26
|
+
version,
|
|
27
|
+
variables: [],
|
|
28
|
+
components: labels,
|
|
29
|
+
resources: annotation.resources,
|
|
30
|
+
ingress: { path: '/', hosts: [] },
|
|
31
|
+
probe: {
|
|
32
|
+
path: '/.ready',
|
|
33
|
+
port: PROBE,
|
|
34
|
+
delay: DELAY
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (annotation?.['/'] !== undefined) {
|
|
39
|
+
const tree = parse(annotation['/'], shortcuts)
|
|
40
|
+
|
|
41
|
+
service.variables!.push({
|
|
42
|
+
name: 'TOA_EXPOSITION',
|
|
43
|
+
value: JSON.stringify(tree)
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const { debug, authorities } = annotation
|
|
48
|
+
|
|
49
|
+
service.ingress!.hosts = Object.values(authorities)
|
|
50
|
+
|
|
51
|
+
// leaving these undefined lets the context's own ingress section supply them
|
|
52
|
+
if (annotation.class !== undefined) service.ingress!.class = annotation.class
|
|
53
|
+
|
|
54
|
+
if (annotation.annotations !== undefined)
|
|
55
|
+
service.ingress!.annotations = annotation.annotations
|
|
56
|
+
|
|
57
|
+
if (annotation.service?.annotations !== undefined)
|
|
58
|
+
service.annotations = annotation.service.annotations
|
|
59
|
+
|
|
60
|
+
const properties: Properties = { authorities }
|
|
61
|
+
|
|
62
|
+
if (debug === true) properties.debug = true
|
|
63
|
+
|
|
64
|
+
if (annotation.protocol !== undefined) properties.protocol = annotation.protocol
|
|
65
|
+
|
|
66
|
+
if (annotation.ip !== undefined) properties.ip = annotation.ip
|
|
67
|
+
|
|
68
|
+
if (annotation.bouncer !== undefined) properties.bouncer = annotation.bouncer
|
|
69
|
+
|
|
70
|
+
if (annotation.oauth !== undefined) properties.oauth = annotation.oauth
|
|
71
|
+
|
|
72
|
+
if (annotation.rpc !== undefined) properties.rpc = annotation.rpc
|
|
73
|
+
|
|
74
|
+
if (annotation.mcp !== undefined) properties.mcp = annotation.mcp
|
|
75
|
+
|
|
76
|
+
service.variables!.push({
|
|
77
|
+
name: 'TOA_EXPOSITION_PROPERTIES',
|
|
78
|
+
value: JSON.stringify(properties)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// The identity composition nested in this process connects before route discovery settles,
|
|
82
|
+
// so telemetry's probe — which tracks that composition — would report ready too early.
|
|
83
|
+
// The gateway answers for itself, on the same port telemetry would have used.
|
|
84
|
+
service.variables!.push({
|
|
85
|
+
name: 'TOA_TELEMETRY_READY',
|
|
86
|
+
value: JSON.stringify(false)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
return { services: [service] }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
type Properties = Pick<
|
|
93
|
+
Annotation,
|
|
94
|
+
'authorities' | 'debug' | 'protocol' | 'bouncer' | 'ip' | 'oauth' | 'rpc' | 'mcp'
|
|
95
|
+
>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { manifest } from './manifest.js'
|
|
2
|
+
export { components } from './components.js'
|
|
3
|
+
export { deployment, image } from './deployment.js'
|
|
4
|
+
export { shortcuts } from './shortcuts.js'
|
|
5
|
+
export * from './const.js'
|
|
6
|
+
export * as schemas from './schemas.js'
|
|
7
|
+
export * as syntax from './syntax/index.js'
|
|
8
|
+
|
|
9
|
+
export type {
|
|
10
|
+
Annotation,
|
|
11
|
+
Bouncer,
|
|
12
|
+
MCP as MCPAnnotation,
|
|
13
|
+
OAuth,
|
|
14
|
+
Protocol,
|
|
15
|
+
RPC as RPCAnnotation
|
|
16
|
+
} from './Annotation.js'
|