@toa.io/extensions.exposition 0.20.0-dev.9 → 0.20.0

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.
Files changed (191) hide show
  1. package/components/context.toa.yaml +15 -0
  2. package/components/identity.bans/manifest.toa.yaml +18 -0
  3. package/components/identity.basic/events/principal.js +9 -0
  4. package/components/identity.basic/manifest.toa.yaml +50 -0
  5. package/components/identity.basic/source/authenticate.ts +29 -0
  6. package/components/identity.basic/source/create.ts +19 -0
  7. package/components/identity.basic/source/transit.ts +64 -0
  8. package/components/identity.basic/source/types.ts +42 -0
  9. package/components/identity.basic/tsconfig.json +9 -0
  10. package/components/identity.roles/manifest.toa.yaml +31 -0
  11. package/components/identity.roles/source/list.ts +7 -0
  12. package/components/identity.roles/source/principal.ts +20 -0
  13. package/components/identity.roles/tsconfig.json +9 -0
  14. package/components/identity.tokens/manifest.toa.yaml +39 -0
  15. package/components/identity.tokens/receivers/identity.bans.updated.js +3 -0
  16. package/components/identity.tokens/source/authenticate.test.ts +56 -0
  17. package/components/identity.tokens/source/authenticate.ts +38 -0
  18. package/components/identity.tokens/source/decrypt.test.ts +59 -0
  19. package/components/identity.tokens/source/decrypt.ts +25 -0
  20. package/components/identity.tokens/source/encrypt.test.ts +35 -0
  21. package/components/identity.tokens/source/encrypt.ts +25 -0
  22. package/components/identity.tokens/source/revoke.ts +5 -0
  23. package/components/identity.tokens/source/types.ts +48 -0
  24. package/components/identity.tokens/tsconfig.json +9 -0
  25. package/cucumber.js +9 -0
  26. package/documentation/.assets/ia3-dark.jpg +0 -0
  27. package/documentation/.assets/ia3-light.jpg +0 -0
  28. package/documentation/.assets/overview-dark.jpg +0 -0
  29. package/documentation/.assets/overview-light.jpg +0 -0
  30. package/documentation/.assets/role-scopes-dark.jpg +0 -0
  31. package/documentation/.assets/role-scopes-light.jpg +0 -0
  32. package/documentation/.assets/rtd-dark.jpg +0 -0
  33. package/documentation/.assets/rtd-light.jpg +0 -0
  34. package/documentation/access.md +256 -0
  35. package/documentation/components.md +276 -0
  36. package/documentation/identity.md +156 -0
  37. package/documentation/notes/sse.md +71 -0
  38. package/documentation/protocol.md +18 -0
  39. package/documentation/query.md +226 -0
  40. package/documentation/tree.md +169 -0
  41. package/features/access.feature +448 -0
  42. package/features/annotation.feature +30 -0
  43. package/features/body.feature +45 -0
  44. package/features/directives.feature +56 -0
  45. package/features/dynamic.feature +99 -0
  46. package/features/errors.feature +193 -0
  47. package/features/identity.basic.feature +276 -0
  48. package/features/identity.feature +61 -0
  49. package/features/identity.roles.feature +51 -0
  50. package/features/identity.tokens.feature +119 -0
  51. package/features/queries.feature +214 -0
  52. package/features/routes.feature +49 -0
  53. package/features/steps/Common.ts +10 -0
  54. package/features/steps/Components.ts +43 -0
  55. package/features/steps/Database.ts +58 -0
  56. package/features/steps/Gateway.ts +113 -0
  57. package/features/steps/HTTP.ts +71 -0
  58. package/features/steps/Parameters.ts +12 -0
  59. package/features/steps/Workspace.ts +40 -0
  60. package/features/steps/components/echo/manifest.toa.yaml +9 -0
  61. package/features/steps/components/echo/operations/affect.js +7 -0
  62. package/features/steps/components/echo/operations/compute.js +7 -0
  63. package/features/steps/components/greeter/manifest.toa.yaml +5 -0
  64. package/features/steps/components/greeter/operations/greet.js +7 -0
  65. package/features/steps/components/pots/manifest.toa.yaml +20 -0
  66. package/features/steps/components/sequences/manifest.toa.yaml +10 -0
  67. package/features/steps/components/sequences/operations/numbers.js +7 -0
  68. package/features/steps/components/sequences/operations/tokens.js +16 -0
  69. package/features/steps/components/users/manifest.toa.yaml +11 -0
  70. package/features/steps/tsconfig.json +9 -0
  71. package/features/streams.feature +26 -0
  72. package/package.json +32 -17
  73. package/readme.md +183 -0
  74. package/schemas/annotation.cos.yaml +5 -0
  75. package/schemas/directive.cos.yaml +3 -0
  76. package/schemas/method.cos.yaml +8 -0
  77. package/schemas/node.cos.yaml +5 -0
  78. package/schemas/query.cos.yaml +17 -0
  79. package/schemas/querystring.cos.yaml +5 -0
  80. package/schemas/range.cos.yaml +2 -0
  81. package/schemas/route.cos.yaml +2 -0
  82. package/source/Annotation.ts +7 -0
  83. package/source/Branch.ts +8 -0
  84. package/source/Composition.ts +57 -0
  85. package/source/Context.ts +6 -0
  86. package/source/Directive.test.ts +91 -0
  87. package/source/Directive.ts +120 -0
  88. package/source/Endpoint.ts +59 -0
  89. package/source/Factory.ts +51 -0
  90. package/source/Gateway.ts +93 -0
  91. package/source/HTTP/Server.fixtures.ts +45 -0
  92. package/source/HTTP/Server.test.ts +221 -0
  93. package/source/HTTP/Server.ts +135 -0
  94. package/source/HTTP/exceptions.ts +77 -0
  95. package/source/HTTP/formats/index.ts +19 -0
  96. package/source/HTTP/formats/json.ts +13 -0
  97. package/source/HTTP/formats/msgpack.ts +10 -0
  98. package/source/HTTP/formats/text.ts +9 -0
  99. package/source/HTTP/formats/yaml.ts +14 -0
  100. package/source/HTTP/index.ts +3 -0
  101. package/source/HTTP/messages.test.ts +116 -0
  102. package/source/HTTP/messages.ts +89 -0
  103. package/source/Mapping.ts +51 -0
  104. package/source/Query.test.ts +37 -0
  105. package/source/Query.ts +105 -0
  106. package/source/RTD/Context.ts +16 -0
  107. package/source/RTD/Directives.ts +9 -0
  108. package/source/RTD/Endpoint.ts +11 -0
  109. package/source/RTD/Match.ts +16 -0
  110. package/source/RTD/Method.ts +24 -0
  111. package/source/RTD/Node.ts +85 -0
  112. package/source/RTD/Route.ts +59 -0
  113. package/source/RTD/Tree.ts +54 -0
  114. package/source/RTD/factory.ts +47 -0
  115. package/source/RTD/index.ts +8 -0
  116. package/source/RTD/segment.test.ts +32 -0
  117. package/source/RTD/segment.ts +25 -0
  118. package/source/RTD/syntax/index.ts +2 -0
  119. package/source/RTD/syntax/parse.test.ts +188 -0
  120. package/source/RTD/syntax/parse.ts +153 -0
  121. package/source/RTD/syntax/types.ts +48 -0
  122. package/source/Remotes.test.ts +42 -0
  123. package/source/Remotes.ts +22 -0
  124. package/source/Tenant.ts +38 -0
  125. package/source/deployment.ts +49 -0
  126. package/source/directives/auth/Anonymous.ts +14 -0
  127. package/source/directives/auth/Echo.ts +12 -0
  128. package/source/directives/auth/Family.ts +145 -0
  129. package/source/directives/auth/Id.ts +19 -0
  130. package/source/directives/auth/Incept.ts +42 -0
  131. package/source/directives/auth/Role.test.ts +62 -0
  132. package/source/directives/auth/Role.ts +56 -0
  133. package/source/directives/auth/Rule.ts +28 -0
  134. package/source/directives/auth/Scheme.ts +26 -0
  135. package/source/directives/auth/index.ts +3 -0
  136. package/source/directives/auth/schemes.ts +8 -0
  137. package/source/directives/auth/split.ts +15 -0
  138. package/source/directives/auth/types.ts +37 -0
  139. package/source/directives/dev/Family.ts +36 -0
  140. package/source/directives/dev/Stub.ts +14 -0
  141. package/source/directives/dev/Throw.ts +14 -0
  142. package/source/directives/dev/index.ts +3 -0
  143. package/source/directives/dev/types.ts +5 -0
  144. package/source/directives/index.ts +5 -0
  145. package/source/discovery.ts +1 -0
  146. package/source/exceptions.ts +17 -0
  147. package/source/index.test.ts +9 -0
  148. package/source/index.ts +6 -0
  149. package/source/manifest.test.ts +59 -0
  150. package/source/manifest.ts +48 -0
  151. package/source/root.ts +38 -0
  152. package/source/schemas.ts +9 -0
  153. package/tsconfig.json +12 -0
  154. package/src/.manifest/index.js +0 -7
  155. package/src/.manifest/normalize.js +0 -58
  156. package/src/.manifest/schema.yaml +0 -71
  157. package/src/.manifest/validate.js +0 -17
  158. package/src/constants.js +0 -3
  159. package/src/deployment.js +0 -23
  160. package/src/exposition.js +0 -68
  161. package/src/factory.js +0 -76
  162. package/src/index.js +0 -9
  163. package/src/manifest.js +0 -12
  164. package/src/query/criteria.js +0 -55
  165. package/src/query/enum.js +0 -35
  166. package/src/query/index.js +0 -17
  167. package/src/query/query.js +0 -60
  168. package/src/query/range.js +0 -28
  169. package/src/query/sort.js +0 -19
  170. package/src/remote.js +0 -88
  171. package/src/server.js +0 -83
  172. package/src/tenant.js +0 -29
  173. package/src/translate/etag.js +0 -14
  174. package/src/translate/index.js +0 -7
  175. package/src/translate/request.js +0 -68
  176. package/src/translate/response.js +0 -62
  177. package/src/tree.js +0 -109
  178. package/test/manifest.normalize.fixtures.js +0 -37
  179. package/test/manifest.normalize.test.js +0 -37
  180. package/test/manifest.validate.test.js +0 -40
  181. package/test/query.range.test.js +0 -18
  182. package/test/tree.fixtures.js +0 -21
  183. package/test/tree.test.js +0 -44
  184. package/types/annotations.d.ts +0 -10
  185. package/types/declarations.d.ts +0 -31
  186. package/types/exposition.d.ts +0 -13
  187. package/types/http.d.ts +0 -13
  188. package/types/query.d.ts +0 -16
  189. package/types/remote.d.ts +0 -19
  190. package/types/server.d.ts +0 -13
  191. package/types/tree.d.ts +0 -33
package/test/tree.test.js DELETED
@@ -1,44 +0,0 @@
1
- 'use strict'
2
-
3
- const { Tree } = require('../src/tree')
4
- const fixtures = require('./tree.fixtures')
5
-
6
- let tree
7
-
8
- beforeEach(() => {
9
- tree = new Tree(() => null)
10
- tree.update(fixtures.declaration)
11
- })
12
-
13
- it('should find node', () => {
14
- expect(tree.match('/12/')).toBeDefined()
15
- expect(tree.match('/12/segment/')).toBeDefined()
16
- })
17
-
18
- it('should return undefined on mismatch', () => {
19
- expect(tree.match('/12')).not.toBeDefined()
20
- expect(tree.match('/non/existent/')).not.toBeDefined()
21
- })
22
-
23
- it('should throw on resource conflicts on local dev env', () => {
24
- const declaration = {
25
- '/:id': {
26
- operations: ['observe']
27
- },
28
- '/ok': {
29
- operations: ['transit']
30
- }
31
- }
32
-
33
- const env = process.env.TOA_ENV
34
-
35
- process.env.TOA_ENV = 'local'
36
-
37
- tree = new Tree(() => null)
38
-
39
- tree.update(declaration)
40
-
41
- expect(() => tree.match('/ok/')).toThrow(/Ambiguous routes/)
42
-
43
- process.env.TOA_ENV = env
44
- })
@@ -1,10 +0,0 @@
1
- declare namespace toa.extensions.exposition {
2
-
3
- interface Annotations {
4
- host: string
5
- class: string
6
- annotations: Record<string, string>
7
- }
8
-
9
-
10
- }
@@ -1,31 +0,0 @@
1
- declare namespace toa.extensions.exposition.declarations {
2
-
3
- interface Operation {
4
- operation: string
5
- type: 'transition' | 'observation' | 'assignment'
6
- scope: 'object' | 'objects' | 'changeset'
7
- query?: boolean
8
- }
9
-
10
- interface Query {
11
- criteria?: string
12
- sort?: string[]
13
- projection?: string[]
14
- }
15
-
16
- type Node = {
17
- query?: Query
18
- operations?: Operation[]
19
- } & {
20
- [key: string]: Node
21
- }
22
-
23
- interface Exposition {
24
- namespace: string
25
- name: string
26
- resources: Node
27
- }
28
- }
29
-
30
- export type Node = toa.extensions.exposition.declarations.Node
31
- export type Operation = toa.extensions.exposition.declarations.Operation
@@ -1,13 +0,0 @@
1
- // noinspection ES6UnusedImports
2
-
3
- import type { Remote } from './remote'
4
-
5
- declare namespace toa.extensions.exposition {
6
-
7
- namespace exposition {
8
-
9
- type Remotes = Record<string, Promise<Remote>>
10
-
11
- }
12
-
13
- }
package/types/http.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type * as express from 'express'
2
-
3
- declare namespace toa.extensions.exposition.http {
4
- type Method = 'GET' | 'POST' | 'PUT' | 'PATCH'
5
-
6
- interface Request extends express.Request {
7
- }
8
-
9
- interface Response extends express.Response {
10
- }
11
- }
12
-
13
- export type Method = toa.extensions.exposition.http.Method
package/types/query.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import type { Query as RequestQuery } from '@toa.io/core/types/request'
2
- import type { Node, Operation } from './declarations'
3
-
4
- declare namespace toa.extensions.exposition {
5
-
6
- namespace query {
7
- type Factory = (node: Node) => Query
8
- }
9
-
10
- interface Query {
11
- parse(query: RequestQuery, operation: Operation): RequestQuery
12
- }
13
-
14
- }
15
-
16
- export type Query = toa.extensions.exposition.Query
package/types/remote.d.ts DELETED
@@ -1,19 +0,0 @@
1
- // noinspection ES6UnusedImports
2
-
3
- import type * as declarations from './declarations'
4
-
5
- declare namespace toa.extensions.exposition {
6
-
7
- namespace remotes {
8
-
9
- type Factory = (namespace: string, name: string) => Promise<Remote>
10
-
11
- }
12
-
13
- interface Remote {
14
- update(declaration: declarations.Node): void
15
- }
16
-
17
- }
18
-
19
- export type Remote = toa.extensions.exposition.Remote
package/types/server.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { Request, Response } from 'express'
2
-
3
- declare namespace toa.extensions.exposition {
4
-
5
- namespace server {
6
- type Callback = (req: Request, res: Response) => void
7
- }
8
-
9
- interface Server {
10
- route(route: string, callback: server.Callback)
11
- }
12
-
13
- }
package/types/tree.d.ts DELETED
@@ -1,33 +0,0 @@
1
- // noinspection ES6UnusedImports
2
-
3
- import type * as declarations from './declarations'
4
- import type { Method } from './http'
5
- import type { Query } from './query'
6
- import type { Match as PathMatch } from 'path-to-regexp'
7
-
8
- declare namespace toa.extensions.exposition {
9
-
10
- namespace tree {
11
-
12
- interface Node {
13
- route: string
14
- match: (route: string) => PathMatch<object>
15
- operations: Record<Method, declarations.Operation>
16
- query: Query
17
- }
18
-
19
- interface Match {
20
- node: Node
21
- params: Record<string, string>
22
- }
23
-
24
- }
25
-
26
- interface Tree {
27
- match(path: string): tree.Match
28
-
29
- update(tree: declarations.Node): void
30
- }
31
-
32
- }
33
-