@toa.io/extensions.exposition 1.0.0-alpha.4 → 1.0.0-alpha.41
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/components/context.toa.yaml +2 -2
- package/components/identity.bans/manifest.toa.yaml +15 -7
- package/components/identity.bans/operations/transit.d.ts +14 -0
- package/components/identity.bans/operations/transit.js +11 -0
- package/components/identity.bans/operations/transit.js.map +1 -0
- package/components/identity.bans/operations/tsconfig.tsbuildinfo +1 -0
- package/components/identity.bans/source/transit.ts +21 -0
- package/components/identity.bans/tsconfig.json +9 -0
- package/components/identity.basic/manifest.toa.yaml +22 -9
- package/components/identity.basic/operations/authenticate.d.ts +5 -1
- package/components/identity.basic/operations/authenticate.js +5 -2
- package/components/identity.basic/operations/authenticate.js.map +1 -1
- package/components/identity.basic/operations/incept.d.ts +12 -0
- package/components/identity.basic/operations/incept.js +26 -0
- package/components/identity.basic/operations/incept.js.map +1 -0
- package/components/identity.basic/operations/transit.d.ts +4 -4
- package/components/identity.basic/operations/transit.js +5 -3
- package/components/identity.basic/operations/transit.js.map +1 -1
- package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/operations/types.d.ts +8 -4
- package/components/identity.basic/source/authenticate.ts +16 -5
- package/components/identity.basic/source/incept.ts +38 -0
- package/components/identity.basic/source/transit.ts +8 -6
- package/components/identity.basic/source/types.ts +8 -4
- package/components/identity.federation/manifest.toa.yaml +28 -22
- package/components/identity.federation/operations/authenticate.d.ts +2 -2
- package/components/identity.federation/operations/authenticate.js +3 -10
- package/components/identity.federation/operations/authenticate.js.map +1 -1
- package/components/identity.federation/operations/incept.d.ts +11 -0
- package/components/identity.federation/operations/{create.js → incept.js} +6 -7
- package/components/identity.federation/operations/incept.js.map +1 -0
- package/components/identity.federation/operations/lib/jwt.d.ts +4 -5
- package/components/identity.federation/operations/lib/jwt.js +3 -3
- package/components/identity.federation/operations/lib/jwt.js.map +1 -1
- package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/operations/types/configuration.d.ts +14 -0
- package/components/identity.federation/operations/types/configuration.js +3 -0
- package/components/identity.federation/operations/types/configuration.js.map +1 -0
- package/components/identity.federation/operations/{types.d.ts → types/context.d.ts} +13 -6
- package/components/identity.federation/operations/types/context.js +3 -0
- package/components/identity.federation/operations/types/context.js.map +1 -0
- package/components/identity.federation/operations/types/entity.d.ts +6 -0
- package/components/identity.federation/operations/{types.js → types/entity.js} +1 -1
- package/components/identity.federation/operations/types/entity.js.map +1 -0
- package/components/identity.federation/operations/types/index.d.ts +3 -0
- package/components/identity.federation/operations/types/index.js +20 -0
- package/components/identity.federation/operations/types/index.js.map +1 -0
- package/components/identity.federation/source/authenticate.ts +5 -18
- package/components/identity.federation/source/{create.ts → incept.ts} +10 -9
- package/components/identity.federation/source/lib/jwt.test.ts +2 -2
- package/components/identity.federation/source/lib/jwt.ts +7 -8
- package/components/identity.federation/source/types/configuration.ts +15 -0
- package/components/identity.federation/source/{types.ts → types/context.ts} +15 -5
- package/components/identity.federation/source/types/entity.ts +6 -0
- package/components/identity.federation/source/types/index.ts +3 -0
- package/components/identity.federation/tsconfig.json +2 -2
- package/components/identity.roles/manifest.toa.yaml +18 -6
- package/components/identity.roles/operations/grant.d.ts +10 -0
- package/components/identity.roles/operations/grant.js +21 -0
- package/components/identity.roles/operations/grant.js.map +1 -0
- package/components/identity.roles/operations/lib/Entity.d.ts +5 -0
- package/components/identity.roles/operations/lib/Entity.js +3 -0
- package/components/identity.roles/operations/lib/Entity.js.map +1 -0
- package/components/identity.roles/operations/list.d.ts +1 -4
- package/components/identity.roles/operations/list.js.map +1 -1
- package/components/identity.roles/operations/principal.d.ts +4 -6
- package/components/identity.roles/operations/principal.js +6 -1
- package/components/identity.roles/operations/principal.js.map +1 -1
- package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.roles/source/grant.ts +32 -0
- package/components/identity.roles/source/lib/Entity.ts +5 -0
- package/components/identity.roles/source/list.ts +2 -4
- package/components/identity.roles/source/principal.ts +10 -8
- package/components/identity.tokens/manifest.toa.yaml +19 -5
- package/components/identity.tokens/operations/authenticate.d.ts +2 -2
- package/components/identity.tokens/operations/authenticate.js +10 -4
- package/components/identity.tokens/operations/authenticate.js.map +1 -1
- package/components/identity.tokens/operations/decrypt.js +1 -0
- package/components/identity.tokens/operations/decrypt.js.map +1 -1
- package/components/identity.tokens/operations/encrypt.js +5 -1
- package/components/identity.tokens/operations/encrypt.js.map +1 -1
- package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.tokens/operations/types.d.ts +8 -2
- package/components/identity.tokens/receivers/identity.bans.created.js +3 -0
- package/components/identity.tokens/source/authenticate.test.ts +11 -4
- package/components/identity.tokens/source/authenticate.ts +12 -5
- package/components/identity.tokens/source/decrypt.test.ts +5 -3
- package/components/identity.tokens/source/decrypt.ts +9 -8
- package/components/identity.tokens/source/encrypt.test.ts +26 -2
- package/components/identity.tokens/source/encrypt.ts +5 -1
- package/components/identity.tokens/source/types.ts +9 -2
- package/components/octets.storage/manifest.toa.yaml +0 -7
- package/documentation/access.md +27 -16
- package/documentation/authorities.md +53 -0
- package/documentation/cache.md +8 -1
- package/documentation/components.md +47 -22
- package/documentation/identity.md +17 -22
- package/documentation/io.md +56 -0
- package/documentation/protocol.md +3 -0
- package/documentation/query.md +17 -11
- package/documentation/require.md +15 -0
- package/documentation/tree.md +22 -4
- package/documentation/vary.md +14 -14
- package/features/access.feature +89 -47
- package/features/annotation.feature +2 -0
- package/features/authorities.basic.feature +141 -0
- package/features/authorities.feature +32 -0
- package/features/authorities.federation.feature +99 -0
- package/features/authorities.tokens.feature +118 -0
- package/features/body.feature +4 -0
- package/features/cache.feature +112 -5
- package/features/cors.feature +7 -2
- package/features/debug.feature +34 -0
- package/features/directives.feature +5 -0
- package/features/dynamic.feature +18 -7
- package/features/errors.feature +18 -4
- package/features/etag.feature +18 -1
- package/features/identity.bans.feature +137 -0
- package/features/identity.basic.feature +142 -19
- package/features/identity.feature +7 -2
- package/features/identity.federation.feature +67 -14
- package/features/identity.roles.feature +220 -4
- package/features/identity.tokens.feature +57 -4
- package/features/io.feature +205 -0
- package/features/octets.entries.feature +10 -0
- package/features/octets.feature +60 -64
- package/features/octets.meta.feature +7 -3
- package/features/octets.workflows.feature +14 -0
- package/features/probes.feature +14 -0
- package/features/{queries.feature → query.feature} +50 -3
- package/features/require.feature +67 -0
- package/features/response.feature +12 -3
- package/features/routes.feature +25 -12
- package/features/steps/Database.ts +17 -10
- package/features/steps/Gateway.ts +23 -6
- package/features/steps/IdP.ts +28 -23
- package/features/steps/components/echo/manifest.toa.yaml +5 -1
- package/features/steps/components/echo/operations/identity.js +7 -0
- package/features/steps/components/pots/manifest.toa.yaml +2 -0
- package/features/steps/components/users.properties/manifest.toa.yaml +2 -1
- package/features/streams.feature +1 -0
- package/features/timing.feature +27 -1
- package/features/vary.feature +105 -3
- package/package.json +12 -11
- package/readme.md +19 -14
- package/schemas/annotation.cos.yaml +1 -1
- package/schemas/io/input.cos.yaml +3 -0
- package/schemas/io/message.cos.yaml +5 -0
- package/schemas/io/output.cos.yaml +5 -0
- package/source/Annotation.ts +3 -3
- package/source/Context.ts +6 -4
- package/source/Directive.test.ts +4 -4
- package/source/Directive.ts +11 -38
- package/source/Endpoint.ts +43 -8
- package/source/Factory.ts +11 -7
- package/source/Gateway.ts +16 -44
- package/source/HTTP/Context.ts +24 -2
- package/source/HTTP/Server.ts +56 -43
- package/source/HTTP/exceptions.ts +7 -1
- package/source/HTTP/messages.test.ts +38 -2
- package/source/HTTP/messages.ts +7 -3
- package/source/Mapping.ts +6 -1
- package/source/Query.test.ts +1 -1
- package/source/Query.ts +35 -24
- package/source/RTD/Context.ts +7 -10
- package/source/RTD/Directives.ts +28 -4
- package/source/RTD/Endpoint.ts +6 -4
- package/source/RTD/Match.ts +2 -7
- package/source/RTD/Method.ts +7 -13
- package/source/RTD/Node.ts +13 -14
- package/source/RTD/Tree.ts +17 -16
- package/source/RTD/factory.ts +3 -6
- package/source/Tenant.ts +0 -8
- package/source/deployment.ts +32 -22
- package/source/directives/auth/Authorization.ts +38 -19
- package/source/directives/auth/Delegate.ts +42 -0
- package/source/directives/auth/Incept.ts +3 -2
- package/source/directives/auth/Role.test.ts +53 -6
- package/source/directives/auth/Role.ts +22 -14
- package/source/directives/auth/types.ts +1 -1
- package/source/directives/cache/Cache.ts +15 -8
- package/source/directives/cache/Control.ts +42 -16
- package/source/directives/cors/CORS.ts +13 -7
- package/source/directives/dev/Development.ts +4 -4
- package/source/directives/index.ts +6 -4
- package/source/directives/io/Directive.ts +11 -0
- package/source/directives/io/IO.ts +43 -0
- package/source/directives/io/Input.ts +50 -0
- package/source/directives/io/Message.ts +1 -0
- package/source/directives/io/Output.ts +69 -0
- package/source/directives/io/index.ts +3 -0
- package/source/directives/io/schemas.ts +12 -0
- package/source/directives/octets/Context.ts +4 -3
- package/source/directives/octets/Delete.ts +4 -2
- package/source/directives/octets/Directive.ts +10 -0
- package/source/directives/octets/Fetch.ts +4 -3
- package/source/directives/octets/List.ts +4 -2
- package/source/directives/octets/Octets.ts +6 -8
- package/source/directives/octets/Store.ts +12 -4
- package/source/directives/octets/Workflow.ts +10 -3
- package/source/directives/octets/types.ts +0 -7
- package/source/directives/require/Directive.ts +5 -0
- package/source/directives/require/Headers.ts +20 -0
- package/source/directives/require/Require.ts +28 -0
- package/source/directives/require/index.ts +3 -0
- package/source/directives/vary/Directive.ts +2 -1
- package/source/directives/vary/Embed.ts +14 -8
- package/source/directives/vary/Vary.ts +7 -5
- package/source/directives/vary/embeddings/Authority.ts +8 -0
- package/source/directives/vary/embeddings/Embedding.ts +2 -1
- package/source/directives/vary/embeddings/Header.ts +8 -6
- package/source/directives/vary/embeddings/Language.ts +1 -1
- package/source/directives/vary/embeddings/Parameter.ts +14 -0
- package/source/directives/vary/embeddings/index.ts +6 -4
- package/source/exceptions.ts +22 -11
- package/source/root.ts +5 -0
- package/source/schemas.ts +1 -1
- package/transpiled/Annotation.d.ts +3 -3
- package/transpiled/Context.d.ts +6 -4
- package/transpiled/Directive.d.ts +4 -17
- package/transpiled/Directive.js +4 -7
- package/transpiled/Directive.js.map +1 -1
- package/transpiled/Endpoint.d.ts +5 -3
- package/transpiled/Endpoint.js +30 -5
- package/transpiled/Endpoint.js.map +1 -1
- package/transpiled/Factory.js +9 -4
- package/transpiled/Factory.js.map +1 -1
- package/transpiled/Gateway.d.ts +1 -4
- package/transpiled/Gateway.js +10 -26
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Context.d.ts +8 -1
- package/transpiled/HTTP/Context.js +15 -2
- package/transpiled/HTTP/Context.js.map +1 -1
- package/transpiled/HTTP/Server.d.ts +13 -2
- package/transpiled/HTTP/Server.js +41 -35
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/HTTP/exceptions.d.ts +4 -1
- package/transpiled/HTTP/exceptions.js +7 -1
- package/transpiled/HTTP/exceptions.js.map +1 -1
- package/transpiled/HTTP/messages.d.ts +1 -0
- package/transpiled/HTTP/messages.js +9 -3
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/Mapping.js +4 -1
- package/transpiled/Mapping.js.map +1 -1
- package/transpiled/Query.d.ts +1 -0
- package/transpiled/Query.js +21 -20
- package/transpiled/Query.js.map +1 -1
- package/transpiled/RTD/Context.d.ts +7 -6
- package/transpiled/RTD/Directives.d.ts +19 -4
- package/transpiled/RTD/Endpoint.d.ts +6 -4
- package/transpiled/RTD/Match.d.ts +2 -4
- package/transpiled/RTD/Method.d.ts +7 -7
- package/transpiled/RTD/Method.js.map +1 -1
- package/transpiled/RTD/Node.d.ts +4 -6
- package/transpiled/RTD/Node.js +2 -1
- package/transpiled/RTD/Node.js.map +1 -1
- package/transpiled/RTD/Tree.d.ts +6 -6
- package/transpiled/RTD/Tree.js +4 -1
- package/transpiled/RTD/Tree.js.map +1 -1
- package/transpiled/RTD/factory.d.ts +2 -4
- package/transpiled/RTD/factory.js +1 -1
- package/transpiled/RTD/factory.js.map +1 -1
- package/transpiled/Tenant.d.ts +0 -1
- package/transpiled/Tenant.js +0 -6
- package/transpiled/Tenant.js.map +1 -1
- package/transpiled/deployment.d.ts +1 -1
- package/transpiled/deployment.js +28 -20
- package/transpiled/deployment.js.map +1 -1
- package/transpiled/directives/auth/Authorization.d.ts +2 -3
- package/transpiled/directives/auth/Authorization.js +26 -12
- package/transpiled/directives/auth/Authorization.js.map +1 -1
- package/transpiled/directives/auth/Delegate.d.ts +10 -0
- package/transpiled/directives/auth/Delegate.js +34 -0
- package/transpiled/directives/auth/Delegate.js.map +1 -0
- package/transpiled/directives/auth/Incept.js +3 -2
- package/transpiled/directives/auth/Incept.js.map +1 -1
- package/transpiled/directives/auth/Role.d.ts +4 -1
- package/transpiled/directives/auth/Role.js +20 -14
- package/transpiled/directives/auth/Role.js.map +1 -1
- package/transpiled/directives/cache/Cache.d.ts +5 -5
- package/transpiled/directives/cache/Cache.js +10 -4
- package/transpiled/directives/cache/Cache.js.map +1 -1
- package/transpiled/directives/cache/Control.d.ts +2 -1
- package/transpiled/directives/cache/Control.js +29 -12
- package/transpiled/directives/cache/Control.js.map +1 -1
- package/transpiled/directives/cors/CORS.d.ts +2 -3
- package/transpiled/directives/cors/CORS.js +13 -7
- package/transpiled/directives/cors/CORS.js.map +1 -1
- package/transpiled/directives/dev/Development.d.ts +3 -3
- package/transpiled/directives/dev/Development.js +1 -1
- package/transpiled/directives/dev/Development.js.map +1 -1
- package/transpiled/directives/index.d.ts +2 -2
- package/transpiled/directives/index.js +5 -3
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/io/Directive.d.ts +8 -0
- package/transpiled/directives/io/Directive.js +3 -0
- package/transpiled/directives/io/Directive.js.map +1 -0
- package/transpiled/directives/io/IO.d.ts +9 -0
- package/transpiled/directives/io/IO.js +33 -0
- package/transpiled/directives/io/IO.js.map +1 -0
- package/transpiled/directives/io/Input.d.ts +11 -0
- package/transpiled/directives/{octets/Permute.js → io/Input.js} +33 -26
- package/transpiled/directives/io/Input.js.map +1 -0
- package/transpiled/directives/io/Message.d.ts +1 -0
- package/transpiled/directives/io/Message.js +3 -0
- package/transpiled/directives/io/Message.js.map +1 -0
- package/transpiled/directives/io/Output.d.ts +13 -0
- package/transpiled/directives/io/Output.js +76 -0
- package/transpiled/directives/io/Output.js.map +1 -0
- package/transpiled/directives/io/index.d.ts +2 -0
- package/transpiled/directives/io/index.js +6 -0
- package/transpiled/directives/io/index.js.map +1 -0
- package/transpiled/directives/io/schemas.d.ts +7 -0
- package/transpiled/directives/io/schemas.js +14 -0
- package/transpiled/directives/io/schemas.js.map +1 -0
- package/transpiled/directives/octets/Context.d.ts +3 -3
- package/transpiled/directives/octets/Context.js +4 -2
- package/transpiled/directives/octets/Context.js.map +1 -1
- package/transpiled/directives/octets/Delete.d.ts +3 -2
- package/transpiled/directives/octets/Delete.js +3 -1
- package/transpiled/directives/octets/Delete.js.map +1 -1
- package/transpiled/directives/octets/Directive.d.ts +8 -0
- package/transpiled/directives/octets/Directive.js +8 -0
- package/transpiled/directives/octets/Directive.js.map +1 -0
- package/transpiled/directives/octets/Fetch.d.ts +3 -2
- package/transpiled/directives/octets/Fetch.js +3 -1
- package/transpiled/directives/octets/Fetch.js.map +1 -1
- package/transpiled/directives/octets/List.d.ts +3 -2
- package/transpiled/directives/octets/List.js +3 -1
- package/transpiled/directives/octets/List.js.map +1 -1
- package/transpiled/directives/octets/Octets.d.ts +4 -4
- package/transpiled/directives/octets/Octets.js +2 -4
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/octets/Store.d.ts +3 -2
- package/transpiled/directives/octets/Store.js +10 -3
- package/transpiled/directives/octets/Store.js.map +1 -1
- package/transpiled/directives/octets/Workflow.d.ts +3 -2
- package/transpiled/directives/octets/Workflow.js +9 -2
- package/transpiled/directives/octets/Workflow.js.map +1 -1
- package/transpiled/directives/octets/types.d.ts +0 -5
- package/transpiled/directives/require/Directive.d.ts +4 -0
- package/transpiled/directives/require/Directive.js +3 -0
- package/transpiled/directives/require/Directive.js.map +1 -0
- package/transpiled/directives/require/Headers.d.ts +7 -0
- package/transpiled/directives/require/Headers.js +19 -0
- package/transpiled/directives/require/Headers.js.map +1 -0
- package/transpiled/directives/require/Require.d.ts +9 -0
- package/transpiled/directives/require/Require.js +27 -0
- package/transpiled/directives/require/Require.js.map +1 -0
- package/transpiled/directives/require/index.d.ts +2 -0
- package/transpiled/directives/require/index.js +6 -0
- package/transpiled/directives/require/index.js.map +1 -0
- package/transpiled/directives/vary/Directive.d.ts +2 -1
- package/transpiled/directives/vary/Embed.d.ts +2 -1
- package/transpiled/directives/vary/Embed.js +8 -6
- package/transpiled/directives/vary/Embed.js.map +1 -1
- package/transpiled/directives/vary/Vary.d.ts +3 -3
- package/transpiled/directives/vary/Vary.js +3 -3
- package/transpiled/directives/vary/Vary.js.map +1 -1
- package/transpiled/directives/vary/embeddings/Authority.d.ts +5 -0
- package/transpiled/directives/vary/embeddings/Authority.js +10 -0
- package/transpiled/directives/vary/embeddings/Authority.js.map +1 -0
- package/transpiled/directives/vary/embeddings/Embedding.d.ts +2 -1
- package/transpiled/directives/vary/embeddings/Header.js +8 -6
- package/transpiled/directives/vary/embeddings/Header.js.map +1 -1
- package/transpiled/directives/vary/embeddings/Language.js +1 -1
- package/transpiled/directives/vary/embeddings/Language.js.map +1 -1
- package/transpiled/directives/vary/embeddings/Parameter.d.ts +7 -0
- package/transpiled/directives/vary/embeddings/Parameter.js +14 -0
- package/transpiled/directives/vary/embeddings/Parameter.js.map +1 -0
- package/transpiled/directives/vary/embeddings/index.d.ts +2 -2
- package/transpiled/directives/vary/embeddings/index.js +8 -4
- package/transpiled/directives/vary/embeddings/index.js.map +1 -1
- package/transpiled/exceptions.d.ts +3 -2
- package/transpiled/exceptions.js +13 -7
- package/transpiled/exceptions.js.map +1 -1
- package/transpiled/root.js +5 -0
- package/transpiled/root.js.map +1 -1
- package/transpiled/schemas.d.ts +1 -1
- package/transpiled/schemas.js +2 -2
- package/transpiled/schemas.js.map +1 -1
- package/transpiled/tsconfig.tsbuildinfo +1 -1
- package/components/identity.basic/operations/create.d.ts +0 -10
- package/components/identity.basic/operations/create.js +0 -10
- package/components/identity.basic/operations/create.js.map +0 -1
- package/components/identity.basic/source/create.ts +0 -18
- package/components/identity.federation/operations/create.d.ts +0 -10
- package/components/identity.federation/operations/create.js.map +0 -1
- package/components/identity.federation/operations/schemas.d.ts +0 -59
- package/components/identity.federation/operations/schemas.js +0 -9
- package/components/identity.federation/operations/schemas.js.map +0 -1
- package/components/identity.federation/operations/types.js.map +0 -1
- package/components/identity.federation/source/schemas.ts +0 -61
- package/components/octets.storage/operations/permute.js +0 -7
- package/source/HTTP/Server.test.ts +0 -126
- package/source/directives/octets/Permute.ts +0 -43
- package/transpiled/directives/octets/Permute.d.ts +0 -10
- package/transpiled/directives/octets/Permute.js.map +0 -1
package/transpiled/Query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../source/Query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA8B;AAE9B,mDAAoC;AAIpC,MAAa,KAAK;IACC,KAAK,CAAc;IACnB,MAAM,GAAY,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../source/Query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA8B;AAE9B,mDAAoC;AAIpC,MAAa,KAAK;IACC,KAAK,CAAc;IACnB,MAAM,GAAY,KAAK,CAAA;IACvB,OAAO,GAAc,GAAG,CAAA;IAEzC,YAAoB,KAAmB;QACrC,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YACjC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAC9B,KAAK,CAAC,QAAQ,GAAG,KAAK,CAA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AK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAA;IAE5C,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,QAAQ,GAAG,GAAG,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
|
|
1
|
+
import { type DirectiveFactory } from './Directives';
|
|
2
|
+
import { type EndpointsFactory } from './Endpoint';
|
|
3
|
+
import type { Directive } from './syntax';
|
|
4
|
+
export interface Context<TExtension = any> {
|
|
4
5
|
readonly protected: boolean;
|
|
5
|
-
readonly endpoints: EndpointsFactory
|
|
6
|
+
readonly endpoints: EndpointsFactory;
|
|
6
7
|
readonly directives: {
|
|
7
|
-
readonly factory:
|
|
8
|
-
stack:
|
|
8
|
+
readonly factory: DirectiveFactory;
|
|
9
|
+
stack: Directive[];
|
|
9
10
|
};
|
|
10
11
|
readonly extension?: TExtension;
|
|
11
12
|
}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
import type { Parameter } from './Match';
|
|
1
2
|
import type * as syntax from './syntax';
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
import type { Context, OutgoingMessage } from '../HTTP';
|
|
4
|
+
import type { Output } from '../io';
|
|
5
|
+
export interface Directives {
|
|
6
|
+
preflight: (context: Context, parameters: Parameter[]) => Promise<Output>;
|
|
7
|
+
settle: (context: Context, response: OutgoingMessage) => Promise<void>;
|
|
4
8
|
}
|
|
5
|
-
export interface
|
|
6
|
-
create: (directives: syntax.Directive[]) =>
|
|
9
|
+
export interface DirectiveFactory {
|
|
10
|
+
create: (directives: syntax.Directive[]) => Directives;
|
|
11
|
+
}
|
|
12
|
+
export interface DirectiveSet {
|
|
13
|
+
family: DirectiveFamily;
|
|
14
|
+
directives: any[];
|
|
15
|
+
}
|
|
16
|
+
export interface DirectiveFamily<TDirective = any, TExtension = any> {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly mandatory: boolean;
|
|
19
|
+
create: (name: string, ...rest: any[]) => TDirective;
|
|
20
|
+
preflight?: (directives: TDirective[], request: Context & TExtension, parameters: Parameter[]) => Output | Promise<Output>;
|
|
21
|
+
settle?: (directives: TDirective[], request: Context & TExtension, response: OutgoingMessage) => void | Promise<void>;
|
|
7
22
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type Context } from './Context';
|
|
2
|
+
import type * as http from '../HTTP';
|
|
2
3
|
import type * as syntax from './syntax';
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
import type * as RTD from './index';
|
|
5
|
+
export interface Endpoint {
|
|
6
|
+
call: (context: http.Context, parameters: RTD.Parameter[]) => Promise<http.OutgoingMessage>;
|
|
5
7
|
close: () => Promise<void>;
|
|
6
8
|
}
|
|
7
|
-
export interface EndpointsFactory
|
|
8
|
-
create: (method: syntax.Method, context: Context) =>
|
|
9
|
+
export interface EndpointsFactory {
|
|
10
|
+
create: (method: syntax.Method, context: Context) => Endpoint;
|
|
9
11
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type Node } from './Node';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface Match<TEndpoint extends Endpoint<TEndpoint> = any, TDirectives extends Directives<TDirectives> = any> {
|
|
5
|
-
node: Node<TEndpoint, TDirectives>;
|
|
2
|
+
export interface Match {
|
|
3
|
+
node: Node;
|
|
6
4
|
parameters: Parameter[];
|
|
7
5
|
}
|
|
8
6
|
export interface Parameter {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export declare class Method
|
|
4
|
-
readonly endpoint:
|
|
5
|
-
readonly directives:
|
|
6
|
-
constructor(endpoint:
|
|
1
|
+
import type { Endpoint } from './Endpoint';
|
|
2
|
+
import type { Directives } from './Directives';
|
|
3
|
+
export declare class Method {
|
|
4
|
+
readonly endpoint: Endpoint | null;
|
|
5
|
+
readonly directives: Directives;
|
|
6
|
+
constructor(endpoint: Endpoint | null, directives: Directives);
|
|
7
7
|
close(): Promise<void>;
|
|
8
8
|
}
|
|
9
|
-
export type Methods
|
|
9
|
+
export type Methods = Record<string, Method>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Method.js","sourceRoot":"","sources":["../../source/RTD/Method.ts"],"names":[],"mappings":";;;AAGA,MAAa,MAAM;
|
|
1
|
+
{"version":3,"file":"Method.js","sourceRoot":"","sources":["../../source/RTD/Method.ts"],"names":[],"mappings":";;;AAGA,MAAa,MAAM;IACD,QAAQ,CAAiB;IACzB,UAAU,CAAY;IAEtC,YAAoB,QAAyB,EAAE,UAAsB;QACnE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC9B,CAAC;CACF;AAZD,wBAYC"}
|
package/transpiled/RTD/Node.d.ts
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { type Route } from './Route';
|
|
2
2
|
import { type Methods } from './Method';
|
|
3
3
|
import { type Match, type Parameter } from './Match';
|
|
4
|
-
|
|
5
|
-
import { type Endpoint } from './Endpoint';
|
|
6
|
-
export declare class Node<TEndpoint extends Endpoint<TEndpoint> = any, TDirectives extends Directives<TDirectives> = any> {
|
|
4
|
+
export declare class Node {
|
|
7
5
|
intermediate: boolean;
|
|
8
|
-
methods: Methods
|
|
6
|
+
methods: Methods;
|
|
9
7
|
private readonly protected;
|
|
10
8
|
private routes;
|
|
11
|
-
constructor(routes: Route[], methods: Methods
|
|
9
|
+
constructor(routes: Route[], methods: Methods, properties: Properties);
|
|
12
10
|
match(fragments: string[], parameters?: Parameter[]): Match | null;
|
|
13
|
-
merge(node: Node
|
|
11
|
+
merge(node: Node): void;
|
|
14
12
|
private replace;
|
|
15
13
|
private append;
|
|
16
14
|
private mergeRoute;
|
package/transpiled/RTD/Node.js
CHANGED
|
@@ -34,7 +34,8 @@ class Node {
|
|
|
34
34
|
this.routes = node.routes;
|
|
35
35
|
this.methods = node.methods;
|
|
36
36
|
for (const method of methods)
|
|
37
|
-
void method.close();
|
|
37
|
+
void method.close();
|
|
38
|
+
// race condition is really unlikely
|
|
38
39
|
}
|
|
39
40
|
append(node) {
|
|
40
41
|
for (const route of node.routes)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Node.js","sourceRoot":"","sources":["../../source/RTD/Node.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Node.js","sourceRoot":"","sources":["../../source/RTD/Node.ts"],"names":[],"mappings":";;;AAIA,MAAa,IAAI;IACR,YAAY,CAAS;IACrB,OAAO,CAAS;IACN,SAAS,CAAS;IAC3B,MAAM,CAAS;IAEvB,YACC,MAAe,EAAE,OAAgB,EAAE,UAAsB;QACxD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;QACrC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAA;QAEvE,IAAI,CAAC,IAAI,EAAE,CAAA;IACb,CAAC;IAEM,KAAK,CAAE,SAAmB,EAAE,aAA0B,EAAE;QAC7D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;YAEhD,IAAI,KAAK,KAAK,IAAI;gBAChB,OAAO,KAAK,CAAA;QAChB,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,KAAK,CAAE,IAAU;QACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA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C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAA;IACvD,CAAC;CACF;AA3ED,oBA2EC"}
|
package/transpiled/RTD/Tree.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import type { Match } from './Match';
|
|
2
|
+
import type { DirectiveFactory } from './Directives';
|
|
3
|
+
import type { EndpointsFactory } from './Endpoint';
|
|
4
4
|
import type * as syntax from './syntax';
|
|
5
|
-
export declare class Tree
|
|
5
|
+
export declare class Tree {
|
|
6
6
|
private readonly root;
|
|
7
7
|
private readonly trunk;
|
|
8
8
|
private readonly endpoints;
|
|
9
9
|
private readonly directives;
|
|
10
|
-
constructor(node: syntax.Node, endpoints: EndpointsFactory, directives:
|
|
11
|
-
match(path: string): Match
|
|
10
|
+
constructor(node: syntax.Node, endpoints: EndpointsFactory, directives: DirectiveFactory);
|
|
11
|
+
match(path: string): Match | null;
|
|
12
12
|
merge(node: syntax.Node, extension: any): void;
|
|
13
13
|
private createNode;
|
|
14
14
|
}
|
package/transpiled/RTD/Tree.js
CHANGED
|
@@ -16,7 +16,10 @@ class Tree {
|
|
|
16
16
|
}
|
|
17
17
|
match(path) {
|
|
18
18
|
if (path === '/')
|
|
19
|
-
return {
|
|
19
|
+
return {
|
|
20
|
+
node: this.trunk,
|
|
21
|
+
parameters: []
|
|
22
|
+
};
|
|
20
23
|
const fragments = (0, segment_1.fragment)(path);
|
|
21
24
|
return this.trunk.match(fragments);
|
|
22
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../source/RTD/Tree.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../source/RTD/Tree.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AACtC,uC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AED,MAAM,SAAS,GAAG,IAAI,CAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Node } from './Node';
|
|
2
|
-
import {
|
|
3
|
-
import { type Endpoint } from './Endpoint';
|
|
4
|
-
import { type Directives } from './Directives';
|
|
2
|
+
import type { Context } from './Context';
|
|
5
3
|
import type * as syntax from './syntax';
|
|
6
|
-
export declare function createNode
|
|
4
|
+
export declare function createNode(node: syntax.Node, context: Context): Node;
|
|
@@ -26,7 +26,7 @@ function createRoute(route, context) {
|
|
|
26
26
|
return new Route_1.Route(segments, node);
|
|
27
27
|
}
|
|
28
28
|
function createMethod(method, context) {
|
|
29
|
-
const stack =
|
|
29
|
+
const stack = method.directives.concat(context.directives.stack);
|
|
30
30
|
const directives = context.directives.factory.create(stack);
|
|
31
31
|
const endpoint = method.mapping?.endpoint === undefined
|
|
32
32
|
? null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../source/RTD/factory.ts"],"names":[],"mappings":";;;AAAA,iCAA8C;AAC9C,mCAA+B;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../source/RTD/factory.ts"],"names":[],"mappings":";;;AAAA,iCAA8C;AAC9C,mCAA+B;AAC/B,uCAAmC;AACnC,qCAA+C;AAI/C,SAAgB,UAAU,CAAE,IAAiB,EAAE,OAAgB;IAC7D,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI;QACxB,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAA;;QAE1C,OAAO,CAAC,UAAU,CAAC,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IAE7E,MAAM,MAAM,GAAY,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAA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M,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;AACzC,CAAC"}
|
package/transpiled/Tenant.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export declare class Tenant extends Connector {
|
|
|
6
6
|
private readonly branch;
|
|
7
7
|
constructor(broadcast: Broadcast, locator: Locator, node: RTD.Node);
|
|
8
8
|
open(): Promise<void>;
|
|
9
|
-
dispose(): Promise<void>;
|
|
10
9
|
private expose;
|
|
11
10
|
}
|
|
12
11
|
type Broadcast = bindings.Broadcast<Label>;
|
package/transpiled/Tenant.js
CHANGED
|
@@ -19,12 +19,6 @@ class Tenant extends core_1.Connector {
|
|
|
19
19
|
async open() {
|
|
20
20
|
await this.expose();
|
|
21
21
|
await this.broadcast.receive('ping', this.expose.bind(this));
|
|
22
|
-
console.info('Exposition Tenant for ' +
|
|
23
|
-
`'${this.branch.namespace}.${this.branch.component}' has started.`);
|
|
24
|
-
}
|
|
25
|
-
async dispose() {
|
|
26
|
-
console.info('Exposition Tenant for ' +
|
|
27
|
-
`'${this.branch.namespace}.${this.branch.component}' has been stopped.`);
|
|
28
22
|
}
|
|
29
23
|
async expose() {
|
|
30
24
|
await this.broadcast.transmit('expose', this.branch);
|
package/transpiled/Tenant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tenant.js","sourceRoot":"","sources":["../source/Tenant.ts"],"names":[],"mappings":";;;AAAA,uCAAqE;AAKrE,MAAa,MAAO,SAAQ,gBAAS;IAClB,SAAS,CAAW;IACpB,MAAM,CAAQ;IAE/B,YAAoB,SAAoB,EAAE,OAAgB,EAAE,IAAc;QACxE,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAE1B,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,IAAI;YACvB,QAAQ,EAAE,OAAO,CAAC,SAAS,KAAK,UAAU;YAC1C,IAAI;SACL,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,MAAM,IAAI,CAAC,MAAM,EAAE,CAAA;QACnB,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"Tenant.js","sourceRoot":"","sources":["../source/Tenant.ts"],"names":[],"mappings":";;;AAAA,uCAAqE;AAKrE,MAAa,MAAO,SAAQ,gBAAS;IAClB,SAAS,CAAW;IACpB,MAAM,CAAQ;IAE/B,YAAoB,SAAoB,EAAE,OAAgB,EAAE,IAAc;QACxE,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAE1B,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,SAAS,EAAE,OAAO,CAAC,IAAI;YACvB,QAAQ,EAAE,OAAO,CAAC,SAAS,KAAK,UAAU;YAC1C,IAAI;SACL,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAEe,KAAK,CAAC,IAAI;QACxB,MAAM,IAAI,CAAC,MAAM,EAAE,CAAA;QACnB,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9D,CAAC;IAEO,KAAK,CAAC,MAAM;QAClB,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACtD,CAAC;CACF;AA3BD,wBA2BC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type Dependency } from '@toa.io/operations';
|
|
2
2
|
import { type Annotation } from './Annotation';
|
|
3
|
-
export declare function deployment(_: unknown, annotation
|
|
3
|
+
export declare function deployment(_: unknown, annotation?: Annotation): Dependency;
|
package/transpiled/deployment.js
CHANGED
|
@@ -22,30 +22,37 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.deployment = void 0;
|
|
30
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
27
31
|
const generic_1 = require("@toa.io/generic");
|
|
28
32
|
const schemas = __importStar(require("./schemas"));
|
|
29
33
|
const Directive_1 = require("./Directive");
|
|
30
34
|
const Composition_1 = require("./Composition");
|
|
31
35
|
const syntax_1 = require("./RTD/syntax");
|
|
36
|
+
const Server_1 = require("./HTTP/Server");
|
|
32
37
|
function deployment(_, annotation) {
|
|
38
|
+
node_assert_1.default.ok(annotation !== undefined, 'Exposition context annotation is required');
|
|
39
|
+
schemas.annotation.validate(annotation);
|
|
33
40
|
const labels = (0, Composition_1.components)().labels;
|
|
34
41
|
const service = {
|
|
35
42
|
group: 'exposition',
|
|
36
43
|
name: 'gateway',
|
|
37
|
-
port:
|
|
44
|
+
port: Server_1.PORT,
|
|
38
45
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
39
46
|
version: require('../package.json').version,
|
|
40
47
|
variables: [],
|
|
41
|
-
components: labels
|
|
48
|
+
components: labels,
|
|
49
|
+
ingress: { hosts: [] },
|
|
50
|
+
probe: {
|
|
51
|
+
path: '/.ready',
|
|
52
|
+
port: Server_1.PORT,
|
|
53
|
+
delay: Server_1.DELAY
|
|
54
|
+
}
|
|
42
55
|
};
|
|
43
|
-
if (annotation?.host !== undefined)
|
|
44
|
-
service.ingress = {
|
|
45
|
-
host: annotation.host,
|
|
46
|
-
class: annotation.class,
|
|
47
|
-
annotations: annotation.annotations
|
|
48
|
-
};
|
|
49
56
|
if (annotation?.['/'] !== undefined) {
|
|
50
57
|
const tree = (0, syntax_1.parse)(annotation['/'], Directive_1.shortcuts);
|
|
51
58
|
service.variables.push({
|
|
@@ -53,18 +60,19 @@ function deployment(_, annotation) {
|
|
|
53
60
|
value: (0, generic_1.encode)(tree)
|
|
54
61
|
});
|
|
55
62
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
const { debug, trace, authorities } = annotation;
|
|
64
|
+
service.ingress.hosts = Object.values(authorities);
|
|
65
|
+
service.ingress.class = annotation.class;
|
|
66
|
+
service.ingress.annotations = annotation.annotations;
|
|
67
|
+
const properties = { authorities };
|
|
68
|
+
if (debug === true)
|
|
69
|
+
properties.debug = true;
|
|
70
|
+
if (trace === true)
|
|
71
|
+
properties.trace = true;
|
|
72
|
+
service.variables.push({
|
|
73
|
+
name: 'TOA_EXPOSITION_PROPERTIES',
|
|
74
|
+
value: (0, generic_1.encode)(properties)
|
|
75
|
+
});
|
|
68
76
|
return { services: [service] };
|
|
69
77
|
}
|
|
70
78
|
exports.deployment = deployment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../source/deployment.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../source/deployment.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAEhC,6CAAwC;AAExC,mDAAoC;AACpC,2CAAuC;AACvC,+CAA0C;AAC1C,yCAAoC;AACpC,0CAA2C;AAE3C,SAAgB,UAAU,CAAE,CAAU,EAAE,UAAuB;IAC7D,qBAAM,CAAC,EAAE,CAAC,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GAAG,IAAI,CAAA;IAEzB,IAAI,KAAK,KAAK,IAAI;QAChB,UAAU,CAAC,KAAK,GAAG,IAAI,CAAA;IAEzB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;QACrB,IAAI,EAAE,2BAA2B;QACjC,KAAK,EAAE,IAAA,gBAAM,EAAC,UAAU,CAAC;KAC1B,CAAC,CAAA;IAEF,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAA;AAChC,CAAC;AAnDD,gCAmDC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as http from '../../HTTP';
|
|
2
2
|
import type { Output } from '../../io';
|
|
3
3
|
import type { Remotes } from '../../Remotes';
|
|
4
|
-
import type {
|
|
5
|
-
import type { Parameter } from '../../RTD';
|
|
4
|
+
import type { Parameter, DirectiveFamily } from '../../RTD';
|
|
6
5
|
import type { Directive, Extension, Input } from './types';
|
|
7
|
-
export declare class Authorization implements
|
|
6
|
+
export declare class Authorization implements DirectiveFamily<Directive, Extension> {
|
|
8
7
|
readonly depends: string[];
|
|
9
8
|
readonly name: string;
|
|
10
9
|
readonly mandatory: boolean;
|
|
@@ -36,8 +36,9 @@ const Role_1 = require("./Role");
|
|
|
36
36
|
const Rule_1 = require("./Rule");
|
|
37
37
|
const Incept_1 = require("./Incept");
|
|
38
38
|
const Echo_1 = require("./Echo");
|
|
39
|
-
const split_1 = require("./split");
|
|
40
39
|
const Scheme_1 = require("./Scheme");
|
|
40
|
+
const Delegate_1 = require("./Delegate");
|
|
41
|
+
const split_1 = require("./split");
|
|
41
42
|
const schemes_1 = require("./schemes");
|
|
42
43
|
class Authorization {
|
|
43
44
|
depends = ['Vary'];
|
|
@@ -48,14 +49,22 @@ class Authorization {
|
|
|
48
49
|
tokens = null;
|
|
49
50
|
bans = null;
|
|
50
51
|
create(name, value, remotes) {
|
|
51
|
-
node_assert_1.default.ok(name in
|
|
52
|
-
const Class =
|
|
52
|
+
node_assert_1.default.ok(name in constructors, `Directive 'auth:${name}' is not implemented.`);
|
|
53
|
+
const Class = constructors[name];
|
|
53
54
|
for (const name of REMOTES)
|
|
54
55
|
this.discovery[name] ??= remotes.discover('identity', name);
|
|
55
|
-
return (0, matchacho_1.match)(Class, Role_1.Role, () => new Role_1.Role(value, this.discovery.roles), Rule_1.Rule, () => new Rule_1.Rule(value, this.create.bind(this)), Incept_1.Incept, () => new Incept_1.Incept(value, this.discovery), () => new Class(value));
|
|
56
|
+
return (0, matchacho_1.match)(Class, Role_1.Role, () => new Role_1.Role(value, this.discovery.roles), Rule_1.Rule, () => new Rule_1.Rule(value, this.create.bind(this)), Incept_1.Incept, () => new Incept_1.Incept(value, this.discovery), Delegate_1.Delegate, () => new Delegate_1.Delegate(value, this.discovery.roles), () => new Class(value));
|
|
56
57
|
}
|
|
57
58
|
async preflight(directives, input, parameters) {
|
|
58
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Some authentication scheme providers may create identity during authentication;
|
|
61
|
+
* therefore, we need to skip the authentication process if the Incept directive is present.
|
|
62
|
+
*
|
|
63
|
+
* If the provided credentials already exist,
|
|
64
|
+
* the inception will cause a unique constraint violation on the settle stage.
|
|
65
|
+
*/
|
|
66
|
+
const inception = directives.reduce((yes, directive) => yes || directive instanceof Incept_1.Incept, false);
|
|
67
|
+
const identity = inception ? null : await this.resolve(input.authority, input.request.headers.authorization);
|
|
59
68
|
input.identity = identity;
|
|
60
69
|
for (const directive of directives) {
|
|
61
70
|
const allow = await directive.authorize(identity, input, parameters);
|
|
@@ -79,13 +88,14 @@ class Authorization {
|
|
|
79
88
|
if (identity.roles === undefined)
|
|
80
89
|
await Role_1.Role.set(identity, this.discovery.roles);
|
|
81
90
|
this.tokens ??= await this.discovery.tokens;
|
|
82
|
-
const token = await this.tokens.invoke('encrypt', {
|
|
91
|
+
const token = await this.tokens.invoke('encrypt', {
|
|
92
|
+
input: { authority: request.authority, identity }
|
|
93
|
+
});
|
|
83
94
|
const authorization = `Token ${token}`;
|
|
84
|
-
|
|
85
|
-
response.headers = new Headers();
|
|
95
|
+
response.headers ??= new Headers();
|
|
86
96
|
response.headers.set('authorization', authorization);
|
|
87
97
|
}
|
|
88
|
-
async resolve(authorization) {
|
|
98
|
+
async resolve(authority, authorization) {
|
|
89
99
|
if (authorization === undefined)
|
|
90
100
|
return null;
|
|
91
101
|
const [scheme, credentials] = (0, split_1.split)(authorization);
|
|
@@ -94,7 +104,10 @@ class Authorization {
|
|
|
94
104
|
throw new http.Unauthorized(`Unknown authentication scheme '${scheme}'.`);
|
|
95
105
|
this.schemes[scheme] ??= await this.discovery[provider];
|
|
96
106
|
const result = await this.schemes[scheme].invoke('authenticate', {
|
|
97
|
-
input:
|
|
107
|
+
input: {
|
|
108
|
+
authority,
|
|
109
|
+
credentials
|
|
110
|
+
}
|
|
98
111
|
});
|
|
99
112
|
if (result instanceof Error)
|
|
100
113
|
return null;
|
|
@@ -112,14 +125,15 @@ class Authorization {
|
|
|
112
125
|
}
|
|
113
126
|
}
|
|
114
127
|
exports.Authorization = Authorization;
|
|
115
|
-
const
|
|
128
|
+
const constructors = {
|
|
116
129
|
anonymous: Anonymous_1.Anonymous,
|
|
117
130
|
id: Id_1.Id,
|
|
118
131
|
role: Role_1.Role,
|
|
119
132
|
rule: Rule_1.Rule,
|
|
120
133
|
incept: Incept_1.Incept,
|
|
121
134
|
scheme: Scheme_1.Scheme,
|
|
122
|
-
echo: Echo_1.Echo
|
|
135
|
+
echo: Echo_1.Echo,
|
|
136
|
+
delegate: Delegate_1.Delegate
|
|
123
137
|
};
|
|
124
138
|
const REMOTES = ['basic', 'federation', 'tokens', 'roles', 'bans'];
|
|
125
139
|
//# sourceMappingURL=Authorization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authorization.js","sourceRoot":"","sources":["../../../source/directives/auth/Authorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAChC,yCAAiC;AACjC,iDAAkC;AAClC,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;AAED,MAAM,OAAO,GAAa,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Directive, type Identity } from './types';
|
|
2
|
+
import type { Component } from '@toa.io/core';
|
|
3
|
+
import type { Input } from '../../io';
|
|
4
|
+
export declare class Delegate implements Directive {
|
|
5
|
+
private readonly property;
|
|
6
|
+
private readonly discovery;
|
|
7
|
+
constructor(property: string, discovery: Promise<Component>);
|
|
8
|
+
authorize(identity: Identity | null, context: Input): Promise<boolean>;
|
|
9
|
+
private embed;
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Delegate = void 0;
|
|
4
|
+
const HTTP_1 = require("../../HTTP");
|
|
5
|
+
const Role_1 = require("./Role");
|
|
6
|
+
class Delegate {
|
|
7
|
+
property;
|
|
8
|
+
discovery;
|
|
9
|
+
constructor(property, discovery) {
|
|
10
|
+
this.property = property;
|
|
11
|
+
this.discovery = discovery;
|
|
12
|
+
}
|
|
13
|
+
async authorize(identity, context) {
|
|
14
|
+
if (identity === null)
|
|
15
|
+
return false;
|
|
16
|
+
if (identity.roles === undefined)
|
|
17
|
+
await Role_1.Role.set(identity, this.discovery);
|
|
18
|
+
context.pipelines.body.push((body) => this.embed(body, identity));
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
embed(body, identity) {
|
|
22
|
+
if (body === undefined)
|
|
23
|
+
body = {};
|
|
24
|
+
check(body);
|
|
25
|
+
body[this.property] = structuredClone(identity);
|
|
26
|
+
return body;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Delegate = Delegate;
|
|
30
|
+
function check(body) {
|
|
31
|
+
if (typeof body !== 'object' || body === null)
|
|
32
|
+
throw new HTTP_1.BadRequest('Invalid request body');
|
|
33
|
+
}
|
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@@ class Incept {
|
|
|
47
47
|
const provider = schemes_1.PROVIDERS[scheme];
|
|
48
48
|
this.schemes[scheme] ??= await this.discovery[provider];
|
|
49
49
|
const identity = await this.schemes[scheme]
|
|
50
|
-
.invoke('
|
|
50
|
+
.invoke('incept', {
|
|
51
51
|
input: {
|
|
52
|
+
authority: input.authority,
|
|
52
53
|
id,
|
|
53
54
|
credentials
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
57
|
if (identity instanceof Error)
|
|
57
|
-
throw new http.
|
|
58
|
+
throw new http.UnprocessableEntity(identity);
|
|
58
59
|
input.identity = identity;
|
|
59
60
|
input.identity.scheme = scheme;
|
|
60
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Incept.js","sourceRoot":"","sources":["../../../source/directives/auth/Incept.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAkC;AAElC,mCAA+B;AAC/B,uCAAqC;AAErC,MAAa,MAAM;IACA,QAAQ,CAAQ;IAChB,SAAS,CAAW;IACpB,OAAO,GAAY,EAAwB,CAAA;IAE5D,YAAoB,QAAgB,EAAE,SAAoB;QACxD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEM,SAAS,CAAE,QAAyB,EAAE,KAAY;QACvD,OAAO,QAAQ,KAAK,IAAI,IAAI,eAAe,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAA;IACtE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAE,KAAY,EAAE,QAA8B;QAC/D,MAAM,EAAE,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAEzC,IAAI,EAAE,KAAK,SAAS;YAClB,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,qDAAqD;gBAC3E,0BAA0B,IAAI,CAAC,QAAQ,aAAa,CAAC,CAAA;QAEzD,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BAC3E,0BAA0B,IAAI,CAAC,QAAQ,aAAa,CAAC,CAAA;QAEzD,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,IAAA,aAAK,EAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,aAAc,CAAC,CAAA;QACzE,MAAM,QAAQ,GAAG,mBAAS,CAAC,MAAM,CAAC,CAAA;QAElC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QAEvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;aACxC,MAAM,CAAkB,QAAQ,EAAE;YACnC,KAAK,EAAE;gBACL,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,EAAE;gBACF,WAAW;aACZ;SACF,CAAC,CAAA;QAEF,IAAI,QAAQ,YAAY,KAAK;YAC3B,MAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QAE9C,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACzB,KAAK,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAA;IAChC,CAAC;CACF;AAzCD,wBAyCC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type Component } from '@toa.io/core';
|
|
2
2
|
import { type Directive, type Identity } from './types';
|
|
3
|
+
import type { Parameter } from '../../RTD';
|
|
3
4
|
export declare class Role implements Directive {
|
|
4
5
|
static remote: Component | null;
|
|
5
6
|
private readonly roles;
|
|
6
7
|
private readonly discovery;
|
|
8
|
+
private readonly dynamic;
|
|
7
9
|
constructor(roles: string | string[], discovery: Promise<Component>);
|
|
8
10
|
static set(identity: Identity, discovery: Promise<Component>): Promise<void>;
|
|
9
|
-
authorize(identity: Identity | null): Promise<boolean>;
|
|
11
|
+
authorize(identity: Identity | null, _: unknown, parameters: Parameter[]): Promise<boolean>;
|
|
10
12
|
private match;
|
|
13
|
+
private substitute;
|
|
11
14
|
}
|