@toa.io/extensions.exposition 1.0.0-alpha.251 → 1.0.0-alpha.253

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 (59) hide show
  1. package/components/identity.bans/operations/tsconfig.tsbuildinfo +1 -1
  2. package/components/identity.basic/manifest.toa.yaml +16 -0
  3. package/components/identity.basic/operations/delete.d.ts +7 -0
  4. package/components/identity.basic/operations/delete.js +11 -0
  5. package/components/identity.basic/operations/delete.js.map +1 -0
  6. package/components/identity.basic/operations/info.d.ts +10 -0
  7. package/components/identity.basic/operations/info.js +11 -0
  8. package/components/identity.basic/operations/info.js.map +1 -0
  9. package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
  10. package/components/identity.basic/operations/types.d.ts +2 -1
  11. package/components/identity.basic/source/delete.ts +15 -0
  12. package/components/identity.basic/source/info.ts +19 -0
  13. package/components/identity.basic/source/types.ts +2 -1
  14. package/components/identity.credentials/manifest.toa.yaml +57 -0
  15. package/components/identity.credentials/operations/list.d.ts +51 -0
  16. package/components/identity.credentials/operations/list.js +32 -0
  17. package/components/identity.credentials/operations/list.js.map +1 -0
  18. package/components/identity.credentials/operations/tsconfig.tsbuildinfo +1 -0
  19. package/components/identity.credentials/source/list.test.ts +47 -0
  20. package/components/identity.credentials/source/list.ts +87 -0
  21. package/components/identity.credentials/tsconfig.json +7 -0
  22. package/components/identity.federation/manifest.toa.yaml +35 -1
  23. package/components/identity.federation/operations/authenticate.js +1 -1
  24. package/components/identity.federation/operations/authenticate.js.map +1 -1
  25. package/components/identity.federation/operations/delete.d.ts +8 -0
  26. package/components/identity.federation/operations/delete.js +11 -0
  27. package/components/identity.federation/operations/delete.js.map +1 -0
  28. package/components/identity.federation/operations/incept.js +14 -4
  29. package/components/identity.federation/operations/incept.js.map +1 -1
  30. package/components/identity.federation/operations/list.d.ts +7 -0
  31. package/components/identity.federation/operations/list.js +18 -0
  32. package/components/identity.federation/operations/list.js.map +1 -0
  33. package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
  34. package/components/identity.federation/operations/types/context.d.ts +5 -5
  35. package/components/identity.federation/operations/types/entity.d.ts +2 -0
  36. package/components/identity.federation/source/authenticate.ts +1 -1
  37. package/components/identity.federation/source/delete.ts +16 -0
  38. package/components/identity.federation/source/incept.ts +18 -4
  39. package/components/identity.federation/source/list.test.ts +23 -0
  40. package/components/identity.federation/source/list.ts +23 -0
  41. package/components/identity.federation/source/types/context.ts +5 -6
  42. package/components/identity.federation/source/types/entity.ts +2 -0
  43. package/components/identity.keys/operations/tsconfig.tsbuildinfo +1 -1
  44. package/components/identity.otp/operations/tsconfig.tsbuildinfo +1 -1
  45. package/components/identity.passkeys/operations/tsconfig.tsbuildinfo +1 -1
  46. package/components/identity.roles/operations/tsconfig.tsbuildinfo +1 -1
  47. package/components/identity.tokens/operations/tsconfig.tsbuildinfo +1 -1
  48. package/documentation/components.md +3 -0
  49. package/documentation/credentials.md +85 -0
  50. package/documentation/identity.md +3 -0
  51. package/documentation/passkeys.md +1 -0
  52. package/features/credentials.feature +106 -0
  53. package/features/steps/Database.ts +6 -2
  54. package/package.json +6 -5
  55. package/readme.md +19 -0
  56. package/source/HTTP/Server.ts +1 -0
  57. package/transpiled/HTTP/Server.js +1 -0
  58. package/transpiled/HTTP/Server.js.map +1 -1
  59. package/transpiled/tsconfig.tsbuildinfo +1 -1
@@ -15,6 +15,9 @@ entity:
15
15
  sub:
16
16
  description: The ID that represents the principal making the request
17
17
  type: string
18
+ identity:
19
+ description: Identity associated with these credentials
20
+ type: string
18
21
  required:
19
22
  - authority
20
23
  - iss
@@ -22,6 +25,11 @@ entity:
22
25
  additionalProperties: false
23
26
  unique:
24
27
  token: [authority, iss, sub]
28
+ index:
29
+ list:
30
+ authority: asc
31
+ identity: asc
32
+ _created: desc
25
33
 
26
34
  operations:
27
35
  transit:
@@ -30,6 +38,7 @@ operations:
30
38
  authority*: string
31
39
  iss*: string
32
40
  sub*: string
41
+ identity: string
33
42
  incept:
34
43
  input:
35
44
  scheme*: [bearer, code]
@@ -38,6 +47,8 @@ operations:
38
47
  id: string
39
48
  output:
40
49
  id: string
50
+ errors:
51
+ - EXISTS
41
52
  authenticate:
42
53
  input:
43
54
  scheme*: [bearer, code]
@@ -69,6 +80,15 @@ operations:
69
80
  decode:
70
81
  input: string
71
82
  output: *claims
83
+ list:
84
+ input:
85
+ authority*: string
86
+ identity*: string
87
+ delete:
88
+ input:
89
+ authority*: string
90
+ identity*: string
91
+ id*: string
72
92
 
73
93
  configuration:
74
94
  schema:
@@ -128,9 +148,23 @@ configuration:
128
148
  exposition:
129
149
  /:
130
150
  /:id:
151
+ auth:id: id
131
152
  POST:
132
153
  map:authority: authority
133
- auth:id: id
134
154
  io:input: [scheme, credentials]
135
155
  io:output: false
136
156
  endpoint: incept
157
+ GET:
158
+ map:authority: authority
159
+ map:segments:
160
+ id: identity
161
+ io:output: [id, iss, _created]
162
+ endpoint: list
163
+ /:credential:
164
+ DELETE:
165
+ map:authority: authority
166
+ map:segments:
167
+ id: identity
168
+ credential: id
169
+ io:output: false
170
+ endpoint: delete
@@ -23,7 +23,7 @@ async function effect({ scheme, authority, credentials }, context) {
23
23
  return ERR_NOT_FOUND;
24
24
  if (identity instanceof Error)
25
25
  return identity;
26
- return { identity: { id: identity.id, claims } };
26
+ return { identity: { id: identity.identity ?? identity.id, claims } };
27
27
  }
28
28
  exports.effect = effect;
29
29
  const ERR_NOT_FOUND = new error_value_1.Err('NOT_FOUND');
@@ -1 +1 @@
1
- {"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../source/authenticate.ts"],"names":[],"mappings":";;;AAAA,6CAAiC;AACjC,+BAAwC;AAMjC,KAAK,UAAU,MAAM,CAAE,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAS,EAAE,OAAgB;IACvF,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAA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EAAE,EAAE,EAAE,EAAE,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAA;AACvE,CAAC;AA9BD,wBA8BC;AAED,MAAM,aAAa,GAAG,IAAI,iBAAG,CAAC,WAAW,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { Context } from './types';
2
+ export declare function effect({ authority, identity, id }: Input, context: Context): Promise<void | null>;
3
+ interface Input {
4
+ authority: string;
5
+ identity: string;
6
+ id: string;
7
+ }
8
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.effect = void 0;
4
+ async function effect({ authority, identity, id }, context) {
5
+ const object = await context.local.observe({ query: { id } });
6
+ if (object === null || object.authority !== authority || (object.identity ?? object.id) !== identity)
7
+ return null;
8
+ return await context.local.terminate({ query: { id } });
9
+ }
10
+ exports.effect = effect;
11
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../source/delete.ts"],"names":[],"mappings":";;;AAEO,KAAK,UAAU,MAAM,CAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAS,EAAE,OAAgB;IAChF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;IAE7D,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,EAAE,CAAC,KAAK,QAAQ;QAClG,OAAO,IAAI,CAAA;IAEb,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AACzD,CAAC;AAPD,wBAOC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.effect = void 0;
4
+ const error_value_1 = require("error-value");
4
5
  const lib_1 = require("./lib");
5
6
  async function effect(input, context) {
6
7
  const ctx = {
@@ -13,10 +14,19 @@ async function effect(input, context) {
13
14
  if (claims instanceof Error)
14
15
  return claims;
15
16
  const { iss, sub } = claims;
16
- const request = { input: { authority: input.authority, iss, sub } };
17
- if (input.id !== undefined)
18
- request.query = { id: input.id };
19
- return await context.local.transit(request);
17
+ if (input.id === undefined) {
18
+ const request = { input: { authority: input.authority, iss, sub } };
19
+ return await context.local.transit(request);
20
+ }
21
+ const existent = await context.local.observe({
22
+ query: { criteria: `authority==${input.authority};iss==${iss};sub==${sub}` }
23
+ });
24
+ if (existent !== null)
25
+ return (existent.identity ?? existent.id) === input.id ? { id: input.id } : ERR_EXISTS;
26
+ return await context.local.transit({
27
+ input: { authority: input.authority, iss, sub, identity: input.id }
28
+ });
20
29
  }
21
30
  exports.effect = effect;
31
+ const ERR_EXISTS = new error_value_1.Err('EXISTS', 'Federation credentials are associated with another Identity');
22
32
  //# sourceMappingURL=incept.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"incept.js","sourceRoot":"","sources":["../source/incept.ts"],"names":[],"mappings":";;;AAAA,+BAAkD;AAI3C,KAAK,UAAU,MAAM,CAAE,KAAY,EAAE,OAAgB;IAC1D,MAAM,GAAG,GAAQ;QACf,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK;QAClC,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAA;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,KAAK,QAAQ;QACtC,CAAC,CAAC,MAAM,IAAA,YAAM,EAAC,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC;QACtC,CAAC,CAAC,MAAM,IAAA,cAAQ,EAAC,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC,CAAA;IAE1C,IAAI,MAAM,YAAY,KAAK;QACzB,OAAO,MAAM,C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,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7C,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QAC3C,KAAK,EAAE,EAAE,QAAQ,EAAE,cAAc,KAAK,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,EAAE,EAAE;KAC7E,CAAC,CAAA;IAEF,IAAI,QAAQ,KAAK,IAAI;QACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAA;IAExF,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC;QACjC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE;KACpE,CAAC,CAAA;AACJ,CAAC;AA/BD,wBA+BC;AAaD,MAAM,UAAU,GAAG,IAAI,iBAAG,CAAC,QAAQ,EAAE,6DAA6D,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { Context, Entity } from './types';
2
+ export declare function computation({ authority, identity }: Input, context: Context): Promise<Entity[]>;
3
+ interface Input {
4
+ authority: string;
5
+ identity: string;
6
+ }
7
+ export {};
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.computation = void 0;
4
+ async function computation({ authority, identity }, context) {
5
+ const objects = await context.local.enumerate({
6
+ query: {
7
+ criteria: `authority==${authority};identity==${identity}`,
8
+ projection: ['iss'],
9
+ sort: ['_created:desc']
10
+ }
11
+ });
12
+ const legacy = await context.local.observe({ query: { id: identity } });
13
+ if (legacy !== null && legacy.authority === authority && legacy.identity === undefined)
14
+ objects.push(legacy);
15
+ return objects.sort((a, b) => b._created - a._created);
16
+ }
17
+ exports.computation = computation;
18
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../source/list.ts"],"names":[],"mappings":";;;AAEO,KAAK,UAAU,WAAW,CAAE,EAAE,SAAS,EAAE,QAAQ,EAAS,EAAE,OAAgB;IACjF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QAC5C,KAAK,EAAE;YACL,QAAQ,EAAE,cAAc,SAAS,cAAc,QAAQ,EAAE;YACzD,UAAU,EAAE,CAAC,KAAK,CAAC;YACnB,IAAI,EAAE,CAAC,eAAe,CAAC;SACxB;KACF,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAA;IAEvE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS;QACpF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAEtB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAA;AACxD,CAAC;AAfD,kCAeC"}