@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,10 @@
|
|
|
1
|
+
import type { Contribution } from '@toa.io/core/types'
|
|
2
|
+
|
|
3
|
+
/** What this extension puts on the context of a component that declares it. */
|
|
4
|
+
export function context(): Contribution {
|
|
5
|
+
return {
|
|
6
|
+
name: 'stash',
|
|
7
|
+
type: 'Stash',
|
|
8
|
+
imports: { '@toa.io/extensions.stash': ['Stash'] }
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createVariables, type URIMap, type Request } from '@toa.io/pointer'
|
|
2
|
+
import type { context } from '@toa.io/norm'
|
|
3
|
+
import type { Dependency } from '@toa.io/operations'
|
|
4
|
+
|
|
5
|
+
export function deployment(
|
|
6
|
+
instances: context.Dependency[],
|
|
7
|
+
annotation: URIMap
|
|
8
|
+
): Dependency {
|
|
9
|
+
const requests: Request[] = instances.map((instance) => createRequest(instance))
|
|
10
|
+
const variables = createVariables(ID, annotation, requests)
|
|
11
|
+
|
|
12
|
+
return { variables }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function createRequest(instance: context.Dependency): Request {
|
|
16
|
+
return {
|
|
17
|
+
group: instance.locator.label,
|
|
18
|
+
selectors: [instance.locator.id]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const ID = 'stash'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Contribution } from '@toa.io/core/types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What this extension puts on the context of a component that declares it. What a component
|
|
5
|
+
* keeps there is its own, and nothing declares it.
|
|
6
|
+
*/
|
|
7
|
+
export function context(): Contribution {
|
|
8
|
+
return { name: 'state', type: 'Record<string, any>' }
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { context } from './context.js'
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { secrets } from './secrets.js'
|
|
3
|
+
import * as schemas from './schemas.js'
|
|
4
|
+
import type { Provider } from './secrets.js'
|
|
5
|
+
import type { Schema } from '@toa.io/schemas'
|
|
6
|
+
|
|
7
|
+
export type Annotation = Record<string, Declaration>
|
|
8
|
+
|
|
9
|
+
/** What a storage is declared as; what else it takes is the provider's, stated in its schema. */
|
|
10
|
+
export type Declaration = { provider: Provider } & Record<string, any>
|
|
11
|
+
|
|
12
|
+
export type { Provider }
|
|
13
|
+
|
|
14
|
+
export function validateAnnotation(
|
|
15
|
+
annotation: unknown
|
|
16
|
+
): asserts annotation is Annotation {
|
|
17
|
+
try {
|
|
18
|
+
schemas.annotation.validate(annotation)
|
|
19
|
+
} catch (error) {
|
|
20
|
+
explain(annotation)
|
|
21
|
+
|
|
22
|
+
// if all declarations are valid, re-throw the error
|
|
23
|
+
throw error
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
It is required because `oneOf` schema is used for the annotation validation.
|
|
29
|
+
*/
|
|
30
|
+
function explain(annotation: unknown): void {
|
|
31
|
+
assert.ok(
|
|
32
|
+
typeof annotation === 'object' && annotation !== null,
|
|
33
|
+
'TOA_STORAGES is not an object'
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
for (const declaration of Object.values(annotation)) {
|
|
37
|
+
assert.ok(
|
|
38
|
+
typeof declaration === 'object' &&
|
|
39
|
+
declaration !== null &&
|
|
40
|
+
declaration.provider in secrets,
|
|
41
|
+
`Unknown provider '${declaration.provider}'`
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
assert.ok(
|
|
45
|
+
declaration.provider in schemas,
|
|
46
|
+
`No schema for provider '${declaration.provider}'`
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const provider = declaration.provider as Provider
|
|
50
|
+
|
|
51
|
+
// the declaration names the provider
|
|
52
|
+
// oxlint-disable-next-line import/namespace
|
|
53
|
+
const schema: Schema<Declaration> = schemas[provider]
|
|
54
|
+
|
|
55
|
+
schema.validate(declaration, `Storage '${declaration.provider}' annotation`)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Contribution } from '@toa.io/core/types'
|
|
2
|
+
|
|
3
|
+
/** What this extension puts on the context of a component that declares it. */
|
|
4
|
+
export function context(declaration: string[]): Contribution | null {
|
|
5
|
+
if (!Array.isArray(declaration) || declaration.length === 0) return null
|
|
6
|
+
|
|
7
|
+
const names = declaration.map((name) => JSON.stringify(name)).join(' | ')
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
name: 'storages',
|
|
11
|
+
type: `Record<${names}, Storage>`,
|
|
12
|
+
imports: { '@toa.io/extensions.storages': ['Storage'] }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as assert from 'node:assert'
|
|
2
|
+
import { secrets as declared } from './secrets.js'
|
|
3
|
+
import { validateAnnotation } from './Annotation.js'
|
|
4
|
+
import type { Annotation } from './Annotation.js'
|
|
5
|
+
import type { Dependency, Variable, Mounts } from '@toa.io/operations'
|
|
6
|
+
import type { context } from '@toa.io/norm'
|
|
7
|
+
|
|
8
|
+
export const ENV_PREFIX = 'TOA_STORAGES'
|
|
9
|
+
|
|
10
|
+
export function deployment(instances: Instance[], annotation: unknown): Dependency {
|
|
11
|
+
validate(instances, annotation)
|
|
12
|
+
|
|
13
|
+
const value = JSON.stringify(annotation)
|
|
14
|
+
const pointer: Variable = { name: ENV_PREFIX, value }
|
|
15
|
+
const secrets = getSecrets(annotation)
|
|
16
|
+
const mounts = getMounts(instances, annotation)
|
|
17
|
+
|
|
18
|
+
const dependency: Dependency = { variables: { global: [pointer, ...secrets] } }
|
|
19
|
+
|
|
20
|
+
if (mounts !== null) dependency.mounts = mounts
|
|
21
|
+
|
|
22
|
+
return dependency
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function validate(
|
|
26
|
+
instances: Instance[],
|
|
27
|
+
annotation: unknown
|
|
28
|
+
): asserts annotation is Annotation {
|
|
29
|
+
validateAnnotation(annotation)
|
|
30
|
+
|
|
31
|
+
for (const instance of instances) {
|
|
32
|
+
instance.manifest ??= []
|
|
33
|
+
|
|
34
|
+
contains(instance, annotation)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function contains(instance: Instance, annotation: Annotation): void {
|
|
39
|
+
for (const name of instance.manifest)
|
|
40
|
+
assert.ok(
|
|
41
|
+
name in annotation,
|
|
42
|
+
`Missing '${name}' storage annotation ` +
|
|
43
|
+
`declared in '${instance.component.locator.id}'`
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function getSecrets(annotation: Annotation): Variable[] {
|
|
48
|
+
const secrets: Variable[] = []
|
|
49
|
+
|
|
50
|
+
for (const [name, declaration] of Object.entries(annotation)) {
|
|
51
|
+
for (const secret of declared[declaration.provider])
|
|
52
|
+
secrets.push({
|
|
53
|
+
name: `${ENV_PREFIX}_${name}_${secret.name}`.toUpperCase(),
|
|
54
|
+
secret: {
|
|
55
|
+
name: `toa-storages-${name}`,
|
|
56
|
+
key: secret.name,
|
|
57
|
+
optional: secret.optional
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return secrets
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function getMounts(instances: Instance[], annotation: Annotation): Mounts | null {
|
|
66
|
+
let mounts: Mounts | null = null
|
|
67
|
+
|
|
68
|
+
for (const { locator, manifest } of instances)
|
|
69
|
+
for (const name of manifest) {
|
|
70
|
+
const declaration = annotation[name]
|
|
71
|
+
|
|
72
|
+
// eslint-disable-next-line max-depth
|
|
73
|
+
if (declaration.provider !== 'fs') continue
|
|
74
|
+
|
|
75
|
+
// eslint-disable-next-line max-depth
|
|
76
|
+
if (declaration.claim !== undefined) {
|
|
77
|
+
mounts ??= {}
|
|
78
|
+
mounts[locator.label] ??= []
|
|
79
|
+
|
|
80
|
+
mounts[locator.label].push({
|
|
81
|
+
name,
|
|
82
|
+
path: declaration.path,
|
|
83
|
+
claim: declaration.claim
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return mounts
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type Instance = context.Dependency<string[]>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { deployment, ENV_PREFIX } from './deployment.js'
|
|
2
|
+
export { manifest } from './manifest.js'
|
|
3
|
+
export { validateAnnotation } from './Annotation.js'
|
|
4
|
+
export { secrets } from './secrets.js'
|
|
5
|
+
export { context } from './context.js'
|
|
6
|
+
export * as schemas from './schemas.js'
|
|
7
|
+
|
|
8
|
+
export type { Annotation, Declaration, Provider } from './Annotation.js'
|
|
9
|
+
export type { Secret } from './secrets.js'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { resolve } from 'node:path'
|
|
2
|
+
import { namespace } from '@toa.io/schemas'
|
|
3
|
+
import type { Schema } from '@toa.io/schemas'
|
|
4
|
+
import type { Annotation, Declaration } from './Annotation.js'
|
|
5
|
+
|
|
6
|
+
const path = resolve(import.meta.dirname, '../../schemas/extensions.storages')
|
|
7
|
+
const ns = namespace(path)
|
|
8
|
+
|
|
9
|
+
export const annotation: Schema<Annotation> = ns.schema<Annotation>('annotation')
|
|
10
|
+
export const s3: Schema<Declaration> = ns.schema<Declaration>('s3')
|
|
11
|
+
export const spaces: Schema<Declaration> = ns.schema<Declaration>('spaces')
|
|
12
|
+
export const cloudinary: Schema<Declaration> = ns.schema<Declaration>('cloudinary')
|
|
13
|
+
export const fs: Schema<Declaration> = ns.schema<Declaration>('fs')
|
|
14
|
+
export const tmp: Schema<Declaration> = ns.schema<Declaration>('tmp')
|
|
15
|
+
export const test: Schema<Declaration> = ns.schema<Declaration>('test')
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What each provider reads from the environment, stated apart from the provider so that a
|
|
3
|
+
* deployment enumerates them without loading the SDK the provider is written against.
|
|
4
|
+
*/
|
|
5
|
+
export const secrets: Record<Provider, readonly Secret[]> = {
|
|
6
|
+
s3: [
|
|
7
|
+
{ name: 'ACCESS_KEY_ID', optional: true },
|
|
8
|
+
{ name: 'SECRET_ACCESS_KEY', optional: true }
|
|
9
|
+
],
|
|
10
|
+
spaces: [{ name: 'ACCESS_KEY_ID' }, { name: 'SECRET_ACCESS_KEY' }],
|
|
11
|
+
cloudinary: [{ name: 'API_KEY' }, { name: 'API_SECRET' }],
|
|
12
|
+
fs: [],
|
|
13
|
+
tmp: [],
|
|
14
|
+
test: [{ name: 'USERNAME' }, { name: 'PASSWORD' }]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type Provider = 's3' | 'spaces' | 'cloudinary' | 'fs' | 'tmp' | 'test'
|
|
18
|
+
|
|
19
|
+
export interface Secret {
|
|
20
|
+
readonly name: string
|
|
21
|
+
readonly optional?: boolean
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Contribution } from '@toa.io/core/types'
|
|
2
|
+
|
|
3
|
+
/** What this extension puts on the context of every component, being declared for all. */
|
|
4
|
+
export function context(): Contribution[] {
|
|
5
|
+
const imports = { '@toa.io/extensions.telemetry': ['Logs', 'Span'] }
|
|
6
|
+
|
|
7
|
+
return [
|
|
8
|
+
{ name: 'logs', type: 'Logs', imports },
|
|
9
|
+
{ name: 'span', type: 'Span', imports }
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import assert from 'node:assert'
|
|
2
|
+
import { LOGS_PREFIX, READY_ENV, TRACES_ENV } from './const.js'
|
|
3
|
+
import { DEFAULT_ANNOTATION, normalizeAnnotation, type ReadyAnnotation } from './ready.js'
|
|
4
|
+
import type { Dependency, Probe, Variables } from '@toa.io/operations'
|
|
5
|
+
import type { ExportersConfig, LevelName } from 'openspan'
|
|
6
|
+
|
|
7
|
+
export function deployment(_: unknown, annotation?: Annotation): Dependency {
|
|
8
|
+
const variables: Variables = { global: [] }
|
|
9
|
+
|
|
10
|
+
if (annotation?.logs !== undefined) addLogsVariables(annotation.logs, variables)
|
|
11
|
+
|
|
12
|
+
if (annotation?.traces !== undefined) addTracesVariables(annotation.traces, variables)
|
|
13
|
+
|
|
14
|
+
const ready = normalizeAnnotation(annotation?.ready)
|
|
15
|
+
|
|
16
|
+
if (ready === false) {
|
|
17
|
+
variables.global.push({ name: READY_ENV, value: JSON.stringify(false) })
|
|
18
|
+
|
|
19
|
+
return { variables, probe: false }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
variables.global.push({ name: READY_ENV, value: JSON.stringify(ready) })
|
|
23
|
+
|
|
24
|
+
const probe: Probe = {
|
|
25
|
+
path: ready.path ?? DEFAULT_ANNOTATION.path,
|
|
26
|
+
port: ready.port ?? DEFAULT_ANNOTATION.port
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return { variables, probe }
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function addLogsVariables(annotation: LogsAnnotation, variables: Variables): void {
|
|
33
|
+
const { level, ...components } = annotation
|
|
34
|
+
const global = { level }
|
|
35
|
+
|
|
36
|
+
if (level !== undefined)
|
|
37
|
+
variables.global.push({ name: LOGS_PREFIX, value: JSON.stringify(global) })
|
|
38
|
+
|
|
39
|
+
for (const [id, override] of Object.entries(components)) {
|
|
40
|
+
const [namespace, name] = id.split('.')
|
|
41
|
+
const value = Object.assign({}, global, override)
|
|
42
|
+
|
|
43
|
+
variables.global.push({
|
|
44
|
+
name: `${LOGS_PREFIX}_${namespace.toUpperCase()}_${name.toUpperCase()}`,
|
|
45
|
+
value: JSON.stringify(value)
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function addTracesVariables(annotation: TracesAnnotation, variables: Variables): void {
|
|
51
|
+
const { sample, rate, exporters } = annotation
|
|
52
|
+
|
|
53
|
+
if (sample !== undefined)
|
|
54
|
+
assert.ok(
|
|
55
|
+
typeof sample === 'number' && sample >= 0 && sample <= 1,
|
|
56
|
+
'telemetry.traces.sample must be a number within [0, 1]'
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if (rate !== undefined)
|
|
60
|
+
assert.ok(
|
|
61
|
+
typeof rate === 'number' && rate > 0,
|
|
62
|
+
'telemetry.traces.rate must be a positive number'
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
if (exporters?.otlp !== undefined)
|
|
66
|
+
assert.ok(
|
|
67
|
+
typeof exporters.otlp.endpoint === 'string',
|
|
68
|
+
'telemetry.traces.exporters.otlp.endpoint is required'
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
variables.global.push({
|
|
72
|
+
name: TRACES_ENV,
|
|
73
|
+
value: JSON.stringify({ sample, rate, exporters })
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface Annotation {
|
|
78
|
+
logs?: LogsAnnotation & Record<string, LogsAnnotation>
|
|
79
|
+
traces?: TracesAnnotation
|
|
80
|
+
ready?: ReadyAnnotation
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface LogsAnnotation {
|
|
84
|
+
level: LevelName
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface TracesAnnotation {
|
|
88
|
+
sample?: number
|
|
89
|
+
rate?: number
|
|
90
|
+
exporters?: ExportersConfig
|
|
91
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { deployment } from './deployment.js'
|
|
2
|
+
export { ID, LOGS_PREFIX, TRACES_ENV, READY_ENV } from './const.js'
|
|
3
|
+
export { DEFAULT_ANNOTATION, normalizeAnnotation } from './ready.js'
|
|
4
|
+
export type { ReadyAnnotation, ReadyConfig } from './ready.js'
|
|
5
|
+
export { context } from './context.js'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function normalizeAnnotation(
|
|
2
|
+
ready: ReadyAnnotation | undefined
|
|
3
|
+
): ReadyConfig | false {
|
|
4
|
+
if (ready === false) return false
|
|
5
|
+
|
|
6
|
+
if (ready === undefined) return { enabled: true, ...DEFAULT_ANNOTATION }
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
enabled: true,
|
|
10
|
+
path: ready.path ?? DEFAULT_ANNOTATION.path,
|
|
11
|
+
port: ready.port ?? DEFAULT_ANNOTATION.port
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const DEFAULT_ANNOTATION = {
|
|
16
|
+
path: '/.ready',
|
|
17
|
+
port: 8001
|
|
18
|
+
} as const
|
|
19
|
+
|
|
20
|
+
export type ReadyAnnotation =
|
|
21
|
+
| false
|
|
22
|
+
| {
|
|
23
|
+
path?: string
|
|
24
|
+
port?: number
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ReadyConfig =
|
|
28
|
+
| false
|
|
29
|
+
| {
|
|
30
|
+
enabled?: boolean
|
|
31
|
+
path?: string
|
|
32
|
+
port?: number
|
|
33
|
+
}
|
package/source/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createVariables, type Request, type URIMap } from '@toa.io/pointer'
|
|
2
|
+
import type { context } from '@toa.io/norm'
|
|
3
|
+
import type { Dependency } from '@toa.io/operations'
|
|
4
|
+
|
|
5
|
+
export function deployment(
|
|
6
|
+
instances: context.Dependency[],
|
|
7
|
+
annotation: URIMap
|
|
8
|
+
): Dependency {
|
|
9
|
+
const requests = instances.map((instance) => createRequest(instance))
|
|
10
|
+
const variables = createVariables(ID, annotation, requests)
|
|
11
|
+
|
|
12
|
+
return { variables }
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function createRequest(instance: context.Dependency): Request {
|
|
16
|
+
return {
|
|
17
|
+
group: instance.locator.label,
|
|
18
|
+
selectors: [instance.locator.id]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const ID = 'mongodb'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { deployment, ID } from './deployment.js'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs'
|
|
2
|
+
import { join } from 'node:path'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The version of Toa. This package is versioned with every release, so its version
|
|
6
|
+
* is the runtime's, whether or not the runtime is installed beside it.
|
|
7
|
+
*/
|
|
8
|
+
export const version: string = JSON.parse(
|
|
9
|
+
readFileSync(join(import.meta.dirname, '../package.json'), 'utf8')
|
|
10
|
+
).version
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type URIMap } from '@toa.io/pointer';
|
|
2
|
+
export declare function normalize(declaration: string | Declaration): Annotation;
|
|
3
|
+
export interface Annotation {
|
|
4
|
+
context: URIMap;
|
|
5
|
+
sources?: URIMap;
|
|
6
|
+
}
|
|
7
|
+
export interface Declaration {
|
|
8
|
+
context: string | Record<string, string | string[]>;
|
|
9
|
+
sources?: Record<string, string | string[]>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as pointer from '@toa.io/pointer';
|
|
2
|
+
export function normalize(declaration) {
|
|
3
|
+
const annotation = expand(declaration);
|
|
4
|
+
const context = pointer.normalize(annotation.context);
|
|
5
|
+
const sources = pointer.normalize(annotation.sources);
|
|
6
|
+
return { context, sources };
|
|
7
|
+
}
|
|
8
|
+
function expand(declaration) {
|
|
9
|
+
if (typeof declaration === 'string')
|
|
10
|
+
return { context: { '.': [declaration] } };
|
|
11
|
+
else if (Array.isArray(declaration))
|
|
12
|
+
return { context: { '.': declaration } };
|
|
13
|
+
else
|
|
14
|
+
return declaration;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=annotation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation.js","sourceRoot":"","sources":["../../source/bindings.amqp/annotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAG1C,MAAM,UAAU,SAAS,CAAC,WAAiC;IACzD,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,CAAA;IACtC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IACrD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IAErD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAC7B,CAAC;AAED,SAAS,MAAM,CAAC,WAAiC;IAC/C,IAAI,OAAO,WAAW,KAAK,QAAQ;QAAE,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,CAAA;SAC1E,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE,CAAA;;QACxE,OAAO,WAAW,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
import { generate } from 'randomstring';
|
|
4
|
+
import { normalize } from './annotation.js';
|
|
5
|
+
it('should expand string', async () => {
|
|
6
|
+
const declaration = uri();
|
|
7
|
+
const annotation = normalize(declaration);
|
|
8
|
+
assert.partialDeepStrictEqual(annotation, {
|
|
9
|
+
context: {
|
|
10
|
+
'.': [declaration]
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
it('should expand context default', async () => {
|
|
15
|
+
const declaration = { context: uri() };
|
|
16
|
+
const annotation = normalize(declaration);
|
|
17
|
+
assert.partialDeepStrictEqual(annotation, {
|
|
18
|
+
context: {
|
|
19
|
+
'.': [declaration.context]
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
it('should expand context with sources', async () => {
|
|
24
|
+
const declaration = { context: uri(), sources: { foo: [uri()] } };
|
|
25
|
+
const annotation = normalize(declaration);
|
|
26
|
+
assert.partialDeepStrictEqual(annotation, {
|
|
27
|
+
context: {
|
|
28
|
+
'.': [declaration.context]
|
|
29
|
+
},
|
|
30
|
+
sources: declaration.sources
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
function uri() {
|
|
34
|
+
return 'http://host-' + generate();
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=annotation.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotation.test.js","sourceRoot":"","sources":["../../source/bindings.amqp/annotation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;IACpC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAA;IACzB,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC,CAAA;IAEzC,MAAM,CAAC,sBAAsB,CAAC,UAAU,EAAE;QACxC,OAAO,EAAE;YACP,GAAG,EAAE,CAAC,WAAW,CAAC;SACnB;KACF,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;IAC7C,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,CAAA;IACtC,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC,CAAA;IAEzC,MAAM,CAAC,sBAAsB,CAAC,UAAU,EAAE;QACxC,OAAO,EAAE;YACP,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;SAC3B;KACF,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;IAClD,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAA;IACjE,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC,CAAA;IAEzC,MAAM,CAAC,sBAAsB,CAAC,UAAU,EAAE;QACxC,OAAO,EAAE;YACP,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;SAC3B;QACD,OAAO,EAAE,WAAW,CAAC,OAAO;KAC7B,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,SAAS,GAAG;IACV,OAAO,cAAc,GAAG,QAAQ,EAAE,CAAA;AACpC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Dependency } from '@toa.io/operations';
|
|
2
|
+
import { type Annotation } from './annotation.js';
|
|
3
|
+
export declare function createDependency(context: Context): Dependency;
|
|
4
|
+
export declare const ID = "amqp-context";
|
|
5
|
+
export declare const VARIABLE = "TOA_AMQP_CONTEXT";
|
|
6
|
+
type Context = Annotation['context'];
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { naming } from '@toa.io/pointer';
|
|
2
|
+
export function createDependency(context) {
|
|
3
|
+
const global = [];
|
|
4
|
+
const variables = { global };
|
|
5
|
+
const contextVariables = createVariables(context);
|
|
6
|
+
global.push(...contextVariables);
|
|
7
|
+
return { variables };
|
|
8
|
+
}
|
|
9
|
+
function createVariables(context) {
|
|
10
|
+
const variables = [];
|
|
11
|
+
const uris = JSON.stringify(context);
|
|
12
|
+
const contextVariable = {
|
|
13
|
+
name: VARIABLE,
|
|
14
|
+
value: uris
|
|
15
|
+
};
|
|
16
|
+
const secrets = createSecrets(context);
|
|
17
|
+
variables.push(contextVariable, ...secrets);
|
|
18
|
+
return variables;
|
|
19
|
+
}
|
|
20
|
+
function createSecrets(context) {
|
|
21
|
+
const secrets = [];
|
|
22
|
+
for (const key of Object.keys(context)) {
|
|
23
|
+
const keySecrets = createKeySecrets(key);
|
|
24
|
+
secrets.push(...keySecrets);
|
|
25
|
+
}
|
|
26
|
+
return secrets;
|
|
27
|
+
}
|
|
28
|
+
function createKeySecrets(key) {
|
|
29
|
+
const username = createSecretVariable(key, 'username');
|
|
30
|
+
const password = createSecretVariable(key, 'password');
|
|
31
|
+
return [username, password];
|
|
32
|
+
}
|
|
33
|
+
function createSecretVariable(key, secretKey) {
|
|
34
|
+
const varKey = key === '.' ? '' : key;
|
|
35
|
+
const varName = naming.nameVariable(ID, varKey, secretKey.toUpperCase());
|
|
36
|
+
const secName = naming.nameSecret(ID, key);
|
|
37
|
+
return {
|
|
38
|
+
name: varName,
|
|
39
|
+
secret: {
|
|
40
|
+
name: secName,
|
|
41
|
+
key: secretKey
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export const ID = 'amqp-context';
|
|
46
|
+
export const VARIABLE = 'TOA_AMQP_CONTEXT';
|
|
47
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../source/bindings.amqp/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAGxC,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,MAAM,GAAe,EAAE,CAAA;IAC7B,MAAM,SAAS,GAAG,EAAE,MAAM,EAAE,CAAA;IAE5B,MAAM,gBAAgB,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;IAEjD,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAA;IAEhC,OAAO,EAAE,SAAS,EAAE,CAAA;AACtB,CAAC;AAED,SAAS,eAAe,CAAC,OAAgB;IACvC,MAAM,SAAS,GAAe,EAAE,CAAA;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAEpC,MAAM,eAAe,GAAa;QAChC,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;KACZ,CAAA;IAED,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IAEtC,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,OAAO,CAAC,CAAA;IAE3C,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,aAAa,CAAC,OAAgB;IACrC,MAAM,OAAO,GAAe,EAAE,CAAA;IAE9B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,UAAU,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAExC,OAAO,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAA;IAC7B,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,QAAQ,GAAG,oBAAoB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;IACtD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;IAEtD,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAC7B,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAW,EAAE,SAAiB;IAC1D,MAAM,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;IACrC,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,CAAA;IACxE,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;IAE1C,OAAO;QACL,IAAI,EAAE,OAAO;QACb,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,GAAG,EAAE,SAAS;SACf;KACF,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,EAAE,GAAG,cAAc,CAAA;AAChC,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { merge } from '@toa.io/generic';
|
|
2
|
+
import { normalize } from './annotation.js';
|
|
3
|
+
import * as sources from './sources.js';
|
|
4
|
+
import * as context from './context.js';
|
|
5
|
+
export function deployment(instances, declaration) {
|
|
6
|
+
const annotation = normalize(declaration);
|
|
7
|
+
const contextDependency = context.createDependency(annotation.context);
|
|
8
|
+
const sourcesDependency = sources.createDependency(annotation.sources, instances);
|
|
9
|
+
return merge(contextDependency, sourcesDependency);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=deployment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../source/bindings.amqp/deployment.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAoB,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC,MAAM,UAAU,UAAU,CAAC,SAAqB,EAAE,WAAwB;IACxE,MAAM,UAAU,GAAG,SAAS,CAAC,WAAW,CAAC,CAAA;IACzC,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IACtE,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAEjF,OAAO,KAAK,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { bindings } from '@toa.io/core/types';
|
|
2
|
+
export declare const properties: bindings.Properties;
|
|
3
|
+
export { deployment } from './deployment.js';
|
|
4
|
+
export { ID as CONTEXT, VARIABLE as CONTEXT_VARIABLE } from './context.js';
|
|
5
|
+
export { ID as SOURCES } from './sources.js';
|
|
6
|
+
export type { Annotation, Declaration } from './annotation.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/bindings.amqp/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAwB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,EAAE,IAAI,OAAO,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAE,EAAE,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA"}
|