@toa.io/extensions.exposition 1.0.0-alpha.272 → 1.0.0-alpha.274

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 (156) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/components/exposition.atom/manifest.toa.yaml +3 -1
  3. package/components/exposition.octets/manifest.toa.yaml +28 -10
  4. package/components/exposition.octets/operations/put.js +20 -5
  5. package/components/identity.bans/manifest.toa.yaml +26 -7
  6. package/components/identity.bans/operations/tsconfig.tsbuildinfo +1 -1
  7. package/components/identity.basic/manifest.toa.yaml +106 -30
  8. package/components/identity.basic/operations/authenticate.js +7 -4
  9. package/components/identity.basic/operations/authenticate.js.map +1 -1
  10. package/components/identity.basic/operations/incept.js +3 -2
  11. package/components/identity.basic/operations/incept.js.map +1 -1
  12. package/components/identity.basic/operations/transit.js +17 -6
  13. package/components/identity.basic/operations/transit.js.map +1 -1
  14. package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
  15. package/components/identity.basic/operations/types.d.ts +2 -2
  16. package/components/identity.basic/source/authenticate.ts +8 -4
  17. package/components/identity.basic/source/incept.ts +3 -2
  18. package/components/identity.basic/source/transit.ts +20 -6
  19. package/components/identity.basic/source/types.ts +2 -2
  20. package/components/identity.credentials/manifest.toa.yaml +34 -13
  21. package/components/identity.credentials/operations/tsconfig.tsbuildinfo +1 -1
  22. package/components/identity.federation/manifest.toa.yaml +120 -28
  23. package/components/identity.federation/operations/authenticate.js +3 -2
  24. package/components/identity.federation/operations/authenticate.js.map +1 -1
  25. package/components/identity.federation/operations/create.js +4 -2
  26. package/components/identity.federation/operations/create.js.map +1 -1
  27. package/components/identity.federation/operations/lib/errors.d.ts +70 -11
  28. package/components/identity.federation/operations/lib/errors.js +40 -11
  29. package/components/identity.federation/operations/lib/errors.js.map +1 -1
  30. package/components/identity.federation/operations/lib/exchange.js +2 -2
  31. package/components/identity.federation/operations/lib/exchange.js.map +1 -1
  32. package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
  33. package/components/identity.federation/operations/types/configuration.d.ts +3 -2
  34. package/components/identity.federation/source/authenticate.ts +3 -2
  35. package/components/identity.federation/source/create.ts +4 -2
  36. package/components/identity.federation/source/lib/errors.ts +49 -12
  37. package/components/identity.federation/source/lib/exchange.ts +2 -2
  38. package/components/identity.federation/source/types/configuration.ts +4 -2
  39. package/components/identity.keys/manifest.toa.yaml +14 -6
  40. package/components/identity.keys/operations/tsconfig.tsbuildinfo +1 -1
  41. package/components/identity.otp/manifest.toa.yaml +44 -15
  42. package/components/identity.otp/operations/authenticate.js +9 -4
  43. package/components/identity.otp/operations/authenticate.js.map +1 -1
  44. package/components/identity.otp/operations/tsconfig.tsbuildinfo +1 -1
  45. package/components/identity.otp/source/authenticate.ts +11 -4
  46. package/components/identity.passkeys/manifest.toa.yaml +38 -8
  47. package/components/identity.passkeys/operations/authenticate.js +3 -2
  48. package/components/identity.passkeys/operations/authenticate.js.map +1 -1
  49. package/components/identity.passkeys/operations/create.js +6 -3
  50. package/components/identity.passkeys/operations/create.js.map +1 -1
  51. package/components/identity.passkeys/operations/tsconfig.tsbuildinfo +1 -1
  52. package/components/identity.passkeys/operations/use.js +6 -3
  53. package/components/identity.passkeys/operations/use.js.map +1 -1
  54. package/components/identity.passkeys/source/authenticate.ts +3 -2
  55. package/components/identity.passkeys/source/create.ts +7 -3
  56. package/components/identity.passkeys/source/use.ts +7 -3
  57. package/components/identity.roles/manifest.toa.yaml +41 -10
  58. package/components/identity.roles/operations/grant.js +3 -2
  59. package/components/identity.roles/operations/grant.js.map +1 -1
  60. package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
  61. package/components/identity.roles/source/grant.ts +3 -2
  62. package/components/identity.tokens/manifest.toa.yaml +99 -39
  63. package/components/identity.tokens/operations/authenticate.js +6 -3
  64. package/components/identity.tokens/operations/authenticate.js.map +1 -1
  65. package/components/identity.tokens/operations/decrypt.js +10 -5
  66. package/components/identity.tokens/operations/decrypt.js.map +1 -1
  67. package/components/identity.tokens/operations/encrypt.js +4 -3
  68. package/components/identity.tokens/operations/encrypt.js.map +1 -1
  69. package/components/identity.tokens/operations/lib/types.d.ts +3 -2
  70. package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
  71. package/components/identity.tokens/source/authenticate.test.ts +7 -2
  72. package/components/identity.tokens/source/authenticate.ts +7 -3
  73. package/components/identity.tokens/source/decrypt.test.ts +13 -7
  74. package/components/identity.tokens/source/decrypt.ts +12 -5
  75. package/components/identity.tokens/source/encrypt.test.ts +9 -4
  76. package/components/identity.tokens/source/encrypt.ts +4 -3
  77. package/components/identity.tokens/source/lib/types.ts +3 -2
  78. package/context.toa.yaml +2 -2
  79. package/documentation/components.md +1 -1
  80. package/documentation/identity.md +4 -1
  81. package/features/configuration.feature +207 -0
  82. package/features/cors.feature +1 -1
  83. package/features/dev.feature +1 -1
  84. package/features/identity.federation.feature +18 -9
  85. package/features/{identtiy.tokens.custom.feature → identity.tokens.custom.feature} +39 -0
  86. package/features/introspection.map.feature +16 -0
  87. package/features/map.feature +1 -1
  88. package/features/octets.download.feature +1 -1
  89. package/features/octets.meta.feature +1 -1
  90. package/features/passkeys.feature +8 -8
  91. package/features/require.feature +2 -2
  92. package/features/response.feature +3 -3
  93. package/features/steps/Components.ts +41 -4
  94. package/features/steps/Gateway.ts +61 -23
  95. package/features/steps/HTTP.ts +3 -5
  96. package/features/steps/Parameters.ts +2 -3
  97. package/features/steps/Realtime.ts +4 -4
  98. package/features/steps/Workspace.ts +8 -3
  99. package/features/steps/components/audit/manifest.toa.yaml +12 -5
  100. package/features/steps/components/echo/manifest.toa.yaml +33 -8
  101. package/features/steps/components/notify/manifest.toa.yaml +12 -5
  102. package/features/steps/components/octets.tester/manifest.toa.yaml +43 -14
  103. package/features/steps/components/orders/manifest.toa.yaml +22 -5
  104. package/features/steps/components/pots/manifest.toa.yaml +71 -17
  105. package/features/steps/components/pricing/manifest.toa.yaml +8 -2
  106. package/features/steps/components/sequences/manifest.toa.yaml +3 -1
  107. package/features/steps/components/users/manifest.toa.yaml +18 -3
  108. package/features/steps/components/users.properties/manifest.toa.yaml +12 -2
  109. package/package.json +5 -6
  110. package/schemas/annotation.cos.yaml +37 -17
  111. package/schemas/directive.cos.yaml +7 -3
  112. package/schemas/io/throttle.cos.yaml +47 -8
  113. package/schemas/method.cos.yaml +21 -9
  114. package/schemas/node.cos.yaml +22 -7
  115. package/schemas/octets/delete.cos.yaml +15 -2
  116. package/schemas/octets/get.cos.yaml +5 -2
  117. package/schemas/octets/put.cos.yaml +6 -3
  118. package/schemas/octets/workflow.cos.yaml +0 -1
  119. package/schemas/query.cos.yaml +31 -14
  120. package/schemas/querystring.cos.yaml +19 -9
  121. package/schemas/range.cos.yaml +10 -2
  122. package/schemas/route.cos.yaml +6 -2
  123. package/source/Branch.test.ts +37 -0
  124. package/source/Branch.ts +37 -0
  125. package/source/Factory.ts +5 -5
  126. package/source/Gateway.ts +20 -13
  127. package/source/HTTP/formats/yaml.test.ts +10 -2
  128. package/source/HTTP/formats/yaml.ts +21 -1
  129. package/source/RTD/Tree.ts +4 -1
  130. package/source/Tenant.ts +3 -3
  131. package/source/deployment.ts +3 -4
  132. package/source/directives/map/Headers.ts +8 -1
  133. package/source/directives/octets/Put.ts +6 -3
  134. package/source/root.ts +2 -2
  135. package/transpiled/Branch.d.ts +23 -0
  136. package/transpiled/Branch.js +16 -0
  137. package/transpiled/Branch.js.map +1 -1
  138. package/transpiled/Factory.js +4 -4
  139. package/transpiled/Factory.js.map +1 -1
  140. package/transpiled/Gateway.js +17 -7
  141. package/transpiled/Gateway.js.map +1 -1
  142. package/transpiled/HTTP/formats/yaml.js +15 -1
  143. package/transpiled/HTTP/formats/yaml.js.map +1 -1
  144. package/transpiled/RTD/Tree.js +4 -1
  145. package/transpiled/RTD/Tree.js.map +1 -1
  146. package/transpiled/Tenant.d.ts +1 -1
  147. package/transpiled/Tenant.js +1 -1
  148. package/transpiled/Tenant.js.map +1 -1
  149. package/transpiled/deployment.js +3 -4
  150. package/transpiled/deployment.js.map +1 -1
  151. package/transpiled/directives/map/Headers.js +7 -1
  152. package/transpiled/directives/map/Headers.js.map +1 -1
  153. package/transpiled/directives/octets/Put.js.map +1 -1
  154. package/transpiled/root.js +1 -1
  155. package/transpiled/root.js.map +1 -1
  156. package/transpiled/tsconfig.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
- import { type Call, type Maybe, type Observation, type Query, type Transition } from '@toa.io/types';
1
+ import { type Call, type Maybe, type Observation, type Query, type Secret, type Transition } from '@toa.io/types';
2
2
  export interface Context {
3
3
  local: {
4
4
  observe: Observation<Maybe<Entity>>;
@@ -15,7 +15,7 @@ export interface Context {
15
15
  };
16
16
  configuration: {
17
17
  readonly rounds: number;
18
- readonly pepper: string;
18
+ readonly pepper?: Secret;
19
19
  readonly principal?: string;
20
20
  readonly username: string[];
21
21
  readonly password: string[];
@@ -1,6 +1,5 @@
1
1
  import { compare } from 'bcryptjs'
2
2
  import { type Query, type Maybe } from '@toa.io/types'
3
- import { Err } from 'error-value'
4
3
  import { type Context } from './types'
5
4
 
6
5
  export async function computation (input: Input, context: Context): Promise<Maybe<Output>> {
@@ -18,7 +17,7 @@ export async function computation (input: Input, context: Context): Promise<Mayb
18
17
  if (credentials === null)
19
18
  return ERR_NOT_FOUND
20
19
 
21
- const spicy = password + context.configuration.pepper
20
+ const spicy = password + (context.configuration.pepper?.unwrap() ?? '')
22
21
  const match = await compare(spicy, credentials.password)
23
22
 
24
23
  if (match)
@@ -27,8 +26,13 @@ export async function computation (input: Input, context: Context): Promise<Mayb
27
26
  return ERR_PASSWORD_MISMATCH
28
27
  }
29
28
 
30
- const ERR_NOT_FOUND = new Err('NOT_FOUND')
31
- const ERR_PASSWORD_MISMATCH = new Err('PASSWORD_MISMATCH')
29
+ const ERR_NOT_FOUND = new (class NotFoundError extends Error {
30
+ public readonly code = 'NOT_FOUND'
31
+ })()
32
+
33
+ const ERR_PASSWORD_MISMATCH = new (class PasswordMismatchError extends Error {
34
+ public readonly code = 'PASSWORD_MISMATCH'
35
+ })()
32
36
 
33
37
  interface Input {
34
38
  authority: string
@@ -1,4 +1,3 @@
1
- import { Err } from 'error-value'
2
1
  import type { Context } from './types'
3
2
  import type { Maybe } from '@toa.io/types'
4
3
 
@@ -25,7 +24,9 @@ export async function effect (input: Input, context: Context): Promise<Maybe<Out
25
24
  return await context.local.transit(request)
26
25
  }
27
26
 
28
- const INVALID_CREDENTIALS = new Err('INVALID_CREDENTIALS')
27
+ const INVALID_CREDENTIALS = new (class InvalidCredentialsError extends Error {
28
+ public readonly code = 'INVALID_CREDENTIALS'
29
+ })()
29
30
 
30
31
  interface Input {
31
32
  authority: string
@@ -1,5 +1,4 @@
1
1
  import { genSalt, hash } from 'bcryptjs'
2
- import { Err } from 'error-value'
3
2
  import type { Maybe, Operation } from '@toa.io/types'
4
3
  import type { Context, Entity, TransitInput, IdOutput } from './types'
5
4
 
@@ -13,7 +12,7 @@ export class Transition implements Operation {
13
12
 
14
13
  public mount (context: Context): void {
15
14
  this.rounds = context.configuration.rounds
16
- this.pepper = context.configuration.pepper
15
+ this.pepper = context.configuration.pepper?.unwrap() ?? ''
17
16
  this.principal = context.configuration.principal
18
17
  this.tokens = context.remote.identity.tokens
19
18
 
@@ -65,9 +64,24 @@ function invalid (value: string, expressions: RegExp[]): boolean {
65
64
  return expressions.some((expression) => !expression.test(value))
66
65
  }
67
66
 
68
- const ERR_PRINCIPAL_LOCKED = new Err('PRINCIPAL_LOCKED', 'Principal username cannot be changed')
69
- const ERR_INVALID_USERNAME = new Err('INVALID_USERNAME', 'Username is not meeting the requirements')
70
- const ERR_INVALID_PASSWORD = new Err('INVALID_PASSWORD', 'Password is not meeting the requirements')
71
- const ERR_EXISTS = new Err('EXISTS', 'Basic credentials already exist')
67
+ const ERR_PRINCIPAL_LOCKED = new (class PrincipalLockedError extends Error {
68
+ public readonly code = 'PRINCIPAL_LOCKED'
69
+ public override readonly message = 'Principal username cannot be changed'
70
+ })()
71
+
72
+ const ERR_INVALID_USERNAME = new (class InvalidUsernameError extends Error {
73
+ public readonly code = 'INVALID_USERNAME'
74
+ public override readonly message = 'Username is not meeting the requirements'
75
+ })()
76
+
77
+ const ERR_INVALID_PASSWORD = new (class InvalidPasswordError extends Error {
78
+ public readonly code = 'INVALID_PASSWORD'
79
+ public override readonly message = 'Password is not meeting the requirements'
80
+ })()
81
+
82
+ const ERR_EXISTS = new (class ExistsError extends Error {
83
+ public readonly code = 'EXISTS'
84
+ public override readonly message = 'Basic credentials already exist'
85
+ })()
72
86
 
73
87
  type Tokens = Context['remote']['identity']['tokens']
@@ -1,4 +1,4 @@
1
- import { type Call, type Maybe, type Observation, type Query, type Transition } from '@toa.io/types'
1
+ import { type Call, type Maybe, type Observation, type Query, type Secret, type Transition } from '@toa.io/types'
2
2
 
3
3
  export interface Context {
4
4
  local: {
@@ -16,7 +16,7 @@ export interface Context {
16
16
  }
17
17
  configuration: {
18
18
  readonly rounds: number
19
- readonly pepper: string
19
+ readonly pepper?: Secret
20
20
  readonly principal?: string
21
21
  readonly username: string[]
22
22
  readonly password: string[]
@@ -10,7 +10,9 @@ operations:
10
10
  type: string
11
11
  identity:
12
12
  type: string
13
- required: [authority, identity]
13
+ required:
14
+ - authority
15
+ - identity
14
16
  output:
15
17
  type: object
16
18
  properties:
@@ -21,30 +23,49 @@ operations:
21
23
  properties:
22
24
  username:
23
25
  type: string
24
- required: [username]
26
+ required:
27
+ - username
25
28
  federation:
26
29
  type: array
27
30
  items:
28
31
  type: object
29
32
  additionalProperties: false
30
33
  properties:
31
- id: { type: string }
32
- iss: { type: string }
33
- _created: { type: number }
34
- required: [id, iss, _created]
34
+ id:
35
+ type: string
36
+ iss:
37
+ type: string
38
+ _created:
39
+ type: number
40
+ required:
41
+ - id
42
+ - iss
43
+ - _created
35
44
  passkeys:
36
45
  type: array
37
46
  items:
38
47
  type: object
39
48
  additionalProperties: false
40
49
  properties:
41
- id: { type: string }
42
- aid: { type: string }
43
- synced: { type: boolean }
44
- label: { type: string }
45
- _created: { type: number }
46
- required: [id, aid, synced, _created]
47
- required: [basic, federation, passkeys]
50
+ id:
51
+ type: string
52
+ aid:
53
+ type: string
54
+ synced:
55
+ type: boolean
56
+ label:
57
+ type: string
58
+ _created:
59
+ type: number
60
+ required:
61
+ - id
62
+ - aid
63
+ - synced
64
+ - _created
65
+ required:
66
+ - basic
67
+ - federation
68
+ - passkeys
48
69
 
49
70
  exposition:
50
71
  /:identity: