@owlmeans/flow 0.1.18-rc.9 → 0.1.18

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 (55) hide show
  1. package/README.md +20 -15
  2. package/agent-meta/manifest.json +3 -3
  3. package/agent-meta/skills/flow/SKILL.md +51 -15
  4. package/build/flows/auth/consts.d.ts +19 -0
  5. package/build/flows/auth/consts.d.ts.map +1 -0
  6. package/build/flows/auth/consts.js +146 -0
  7. package/build/flows/auth/consts.js.map +1 -0
  8. package/build/flows/index.d.ts +4 -4
  9. package/build/flows/index.d.ts.map +1 -1
  10. package/build/flows/index.js +4 -4
  11. package/build/flows/index.js.map +1 -1
  12. package/build/flows/oidc/consts.d.ts +15 -0
  13. package/build/flows/oidc/consts.d.ts.map +1 -0
  14. package/build/flows/oidc/consts.js +147 -0
  15. package/build/flows/oidc/consts.js.map +1 -0
  16. package/build/flows/oidp/consts.d.ts +13 -0
  17. package/build/flows/oidp/consts.d.ts.map +1 -0
  18. package/build/flows/oidp/consts.js +189 -0
  19. package/build/flows/oidp/consts.js.map +1 -0
  20. package/build/flows/stab/consts.d.ts +3 -0
  21. package/build/flows/stab/consts.d.ts.map +1 -0
  22. package/build/flows/stab/consts.js +16 -0
  23. package/build/flows/stab/consts.js.map +1 -0
  24. package/build/helper.js +2 -2
  25. package/build/helper.js.map +1 -1
  26. package/build/i18n/fr.json +8 -0
  27. package/build/i18n.js +10 -8
  28. package/build/i18n.js.map +1 -1
  29. package/build/state.js +4 -4
  30. package/build/state.js.map +1 -1
  31. package/build/utils/flow/types.d.ts +13 -0
  32. package/build/utils/flow/types.d.ts.map +1 -0
  33. package/build/utils/flow/types.js +2 -0
  34. package/build/utils/flow/types.js.map +1 -0
  35. package/build/utils/flow.d.ts +3 -3
  36. package/build/utils/flow.d.ts.map +1 -1
  37. package/build/utils/flow.js +61 -57
  38. package/build/utils/flow.js.map +1 -1
  39. package/build/utils/index.d.ts +1 -0
  40. package/build/utils/index.d.ts.map +1 -1
  41. package/build/utils/index.js.map +1 -1
  42. package/package.json +8 -8
  43. package/src/flows/{auth.ts → auth/consts.ts} +2 -2
  44. package/src/flows/index.ts +4 -4
  45. package/src/flows/{oidc.ts → oidc/consts.ts} +2 -2
  46. package/src/flows/{oidp.ts → oidp/consts.ts} +2 -2
  47. package/src/flows/{stab.ts → stab/consts.ts} +2 -2
  48. package/src/helper.ts +2 -2
  49. package/src/i18n/fr.json +8 -0
  50. package/src/i18n.ts +10 -8
  51. package/src/state.ts +4 -4
  52. package/src/utils/flow/types.ts +13 -0
  53. package/src/utils/flow.ts +65 -58
  54. package/src/utils/index.ts +1 -0
  55. package/build/.gitkeep +0 -0
package/README.md CHANGED
@@ -6,13 +6,13 @@ State machine for multi-step user flows, primarily used for OIDC authentication
6
6
 
7
7
  - Defines flow configurations as sequences of steps and transitions
8
8
  - `STD_OIDC_FLOW` is the standard OIDC authentication flow constant
9
- - `stdOidcFlow()` creates the preconfigured OIDC flow definition
9
+ - `stdOidcFlow` is the preconfigured OIDC flow definition
10
10
  - Flows are started via `flowService.begin(flowAlias)` and progress through steps as the user authenticates
11
11
 
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/flow
15
+ bun add @owlmeans/flow@^0.1.18
16
16
  ```
17
17
 
18
18
  ## Usage
@@ -20,14 +20,11 @@ bun add @owlmeans/flow
20
20
  Register the OIDC flow in app config:
21
21
 
22
22
  ```typescript
23
- import { STD_OIDC_FLOW, stdOidcFlow } from '@owlmeans/flow'
24
-
25
- // In app config (added as a config record)
26
- const appConfig = config(
27
- AppType.Frontend,
28
- 'manager-web',
29
- // ... other config
30
- { [FLOW_RECORD]: [stdOidcFlow()] }
23
+ import { flow, configureFlows, stdOidcFlow } from '@owlmeans/flow'
24
+
25
+ const appConfig = configureFlows(
26
+ flow(config(AppType.Frontend, 'manager-web'), stdOidcFlow),
27
+ { defaultFlow: STD_OIDC_FLOW }
31
28
  )
32
29
  ```
33
30
 
@@ -47,17 +44,25 @@ await flowService.begin(STD_OIDC_FLOW)
47
44
 
48
45
  Constant: `'_oidc'` — alias for the standard OIDC flow.
49
46
 
50
- ### `stdOidcFlow(): FlowConfig`
47
+ ### `stdOidcFlow: ShallowFlow`
48
+
49
+ The pre-built standard OIDC authentication flow.
50
+
51
+ ### `flow(cfg, flow): C` / `configureFlows(cfg, config): C`
52
+
53
+ Add a flow to an application config, and set the flow subsystem's own configuration on it.
54
+
55
+ ### `ShallowFlow`
51
56
 
52
- Returns a pre-built `FlowConfig` for the standard OIDC authentication flow.
57
+ A flow declaration: `flow` (its alias), `initialStep`, and `steps` keyed by step name.
53
58
 
54
59
  ### `FlowConfig`
55
60
 
56
- A flow configuration object with `alias`, `steps: FlowStep[]`, and `transitions: FlowTransition[]`.
61
+ The subsystem's configuration: `queryParam`, `services`, `modules`, `pathes`, `defaultFlow`.
57
62
 
58
63
  ### `FlowStep`
59
64
 
60
- A named step in a flow with optional `service` and `module` references.
65
+ A named step: `index`, `step`, `service`, its `transitions`, and optional `path` / `module`.
61
66
 
62
67
  ### `FLOW_RECORD`
63
68
 
@@ -76,7 +81,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
76
81
  your project's skill store (`.agents/skills/`):
77
82
 
78
83
  ```sh
79
- npx @owlmeans/agent-skills
84
+ npx @owlmeans/agent-skills@^0.1.18
80
85
  ```
81
86
 
82
87
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
- "schemaVersion": 2,
2
+ "schemaVersion": 3,
3
3
  "package": "@owlmeans/flow",
4
- "version": "0.1.18-rc.8",
5
- "generatedAt": "2026-08-27T21:16:47.143Z",
4
+ "version": "0.1.18",
5
+ "generatedAt": "2026-10-28T00:31:34.765Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,12 +8,12 @@ user-invocable: false
8
8
  # @owlmeans/flow
9
9
 
10
10
  **Layer:** Cross-cutting domain
11
- **Install:** `"@owlmeans/flow": "^0.1.18-rc.8"` in `dependencies`
11
+ **Install:** `"@owlmeans/flow": "^0.1.18"` in `dependencies`
12
12
 
13
13
  A flow is a set of named **steps**, each offering named **transitions** to other steps. What makes
14
- it worth using over a hand-rolled switch is that the whole live state — flow, step, previous step,
15
- entity, payload, message, ok — serializes to a single compact string and restores from it. That is
16
- what lets a workflow survive a redirect, a page load, or a process.
14
+ it worth using over a hand-rolled switch is that the whole live state — `flow`, `step`, `previous`,
15
+ `service`, `entityId`, `payload`, `message`, `ok` — serializes to a single compact string and
16
+ restores from it. That is what lets a workflow survive a redirect, a page load, or a process.
17
17
 
18
18
  ## Key exports
19
19
 
@@ -21,11 +21,15 @@ what lets a workflow survive a redirect, a page load, or a process.
21
21
  |---|---|
22
22
  | `makeFlowModel(flow, provider?)` | Build a driver. `flow` is a `ShallowFlow` **object** (no provider needed) or a **string** — tried as a flow name first, then as a serialized token. |
23
23
  | `FlowModel` | `target` `entity` `enter` `steps` `state` `setState` `payload` `updatePayload` `step` `transitions` `transition` `next` `transit` `serialize` |
24
- | `ShallowFlow` / `FlowStep` / `FlowTransition` / `FlowState` / `FlowPayload` | The definition and state shapes |
24
+ | `ShallowFlow` / `FlowStep` / `FlowTransition` / `FlowState` / `FlowPayload` / `SerializedFlow` | The definition, the live state, and the compact shape the token encodes |
25
+ | `Flow` | A `ShallowFlow` a provider resolved: it also carries the resolved `config` and the `prefabs` — one serialized entry state per initial step |
25
26
  | `FlowProvider` | `(flow: string) => Promise<Flow>` — resolves a flow by name |
26
- | `flow(cfg, shallowFlow)` · `configureFlows(cfg, config)` | Register a flow as a config record / set `FlowConfig` |
27
- | `stdStabFlow`, `stdAuthFlow` (deprecated), the OIDC/OIDP flows | Built-in flows |
28
- | `FlowError`, `UnknownFlow`, `UnknownFlowStep`, `UnknownTransition`, … | The error family |
27
+ | `FlowConfig` / `WithFlowConfig` / `FlowConfigRecord` | `{ queryParam, services, modules, pathes, defaultFlow }`, the `flowConfig` field it sits on, and the config-record form of a definition |
28
+ | `flow(cfg, flow)` · `configureFlows(cfg, config)` | Register a definition as a `FLOW_RECORD` config record / set `FlowConfig` |
29
+ | `stdStabFlow`, `stdOidcFlow`, `stdOidpFlow`, `stdAuthFlow` (deprecated) | Built-in flows, with `StdAuthStep` / `OidcAuthStep` / `OidpAuthStep` naming their steps |
30
+ | `STD_STAB_FLOW` `STD_OIDC_FLOW` `STD_OIDP_FLOW` `STD_AUTH_FLOW` | Their names — deliberately short, because every one of them is spent inside a URL |
31
+ | `FLOW_RECORD` (`flow`) · `CFG_FLOW_PREFIX` (`flow`) · `TARGET_SERVICE` (`-`) · `FLOW_PLACEHOLDER` (`?`) · `FLOW_SEP` · `PAYLOAD_SEP` | Constants |
32
+ | `FlowError`, `FlowUnsupported`, `FlowTargetError`, `UnknownFlow`, `FlowStepError`, `FlowStepMissconfigured`, `UnknownFlowStep`, `UnknownTransition` | The error family, all registered with `ResilientError` |
29
33
 
30
34
  ## Defining a flow
31
35
 
@@ -87,22 +91,49 @@ returns `null`/`undefined` for an unknown name therefore breaks every restore
87
91
  **Passing a `ShallowFlow` object needs no provider at all.** That is the server-friendly path: a
88
92
  runtime whose flows are code it declares itself needs no registry to start one, only to restore one.
89
93
 
90
- **`next()` requires exactly one non-explicit outgoing transition.** It is what lets a driver advance
91
- without knowing the vocabulary; mark every user-chosen or exceptional edge `explicit` so it can
92
- never become the automatic answer.
94
+ **`next()` answers with the first non-explicit outgoing transition**, and throws
95
+ `UnknownFlowStep('next')` when the step offers none. It is what lets a driver advance without
96
+ knowing the vocabulary, so mark every user-chosen or exceptional edge `explicit` — an unmarked
97
+ second edge silently becomes reachable as the automatic answer.
98
+
99
+ **`enter(step?)` only accepts a step marked `initial`**, and throws `FlowStepError('initial:<step>')`
100
+ otherwise. That is what makes a flow's entry points an explicit part of its definition rather than
101
+ whatever the caller happens to name.
93
102
 
94
103
  **`FlowPayload` holds flat scalars only** — `string | number | boolean | null | undefined`. Anything
95
104
  richer belongs in a record the payload points at. Payload is projected through the step's
96
- `payloadMap` on serialization, so an unmapped key does not survive a round trip.
105
+ `payloadMap` on serialization, so an unmapped key does not survive a round trip and a step with no
106
+ `payloadMap` at all carries no payload across.
107
+
108
+ **`updatePayload` merges; `transit` also merges.** Neither replaces the payload, so a key set early
109
+ in a flow keeps arriving at every later step whose `payloadMap` names it.
110
+
111
+ **The live state is `flow` `step` `previous` `entityId` `service` `payload` `message` `ok`.**
112
+ `service` is the target the flow is running *for*, set through `target()`; `entityId` is set through
113
+ `entity()` and survives serialization even when it is explicitly `null`.
97
114
 
98
115
  **`reversible` is what keeps `previous`**, and is what a "back" transition needs to return to where
99
116
  it came from.
100
117
 
101
118
  ## Where it runs
102
119
 
103
- Client drivers are `@owlmeans/client-flow` (`makeFlowService`) and `@owlmeans/web-flow`; they load
120
+ Client drivers are `@owlmeans/client-flow` (`makeBasicFlowService`) and `@owlmeans/web-flow`
121
+ (`makeFlowService`, which supplies the browser redirect the basic service refuses); they load
104
122
  definitions from `FLOW_RECORD` config records through the config resource and carry the serialized
105
- state in a query parameter (`FlowConfig.queryParam`).
123
+ state in a query parameter (`FlowConfig.queryParam`, defaulting to `flow`).
124
+
125
+ A step addresses its screen through `module` — the alias of the entrypoint the driver navigates to,
126
+ which is why a step is portable between apps that mount it at different paths. `service`, `module`
127
+ and `path` are plain strings, and a value prefixed with `$` is a reference resolved at load time
128
+ against `FlowConfig.services` / `modules` / `pathes` — which is how one definition is reused by
129
+ deployments that address different services. `TARGET_SERVICE` (`-`) in a step's `service` means
130
+ "whatever the state's own target is" rather than a named one.
131
+
132
+ A step with no `module` cannot be addressed, and the two client drivers raise
133
+ `FlowStepMissconfigured` at different moments: `FlowClient.proceed` in `@owlmeans/client-flow`
134
+ checks the step it is about to **enter**, before it transits; `FlowService.proceed` in
135
+ `@owlmeans/web-flow` checks the step the model is **standing on**. Either way the step named in the
136
+ error is the one missing the `module`.
106
137
 
107
138
  There is **no server-side driver in this package**. A server or worker builds models directly from
108
139
  `ShallowFlow` objects and supplies its own `FlowProvider` for restores — `@owlmeans/agent`'s
@@ -111,4 +142,9 @@ There is **no server-side driver in this package**. A server or worker builds mo
111
142
  ## Depends on
112
143
 
113
144
  `@owlmeans/auth`, `@owlmeans/config`, `@owlmeans/error`, `@owlmeans/i18n`, `@owlmeans/resource`,
114
- `@scure/base` (the token codec).
145
+ `@scure/base` (the token codec — base64url, no padding, over the JSON of `SerializedFlow`).
146
+
147
+ ## Related
148
+
149
+ - [[client-flow]] — the client service and the runner a screen drives
150
+ - [[web-flow]] — the browser half: the `flow` query parameter and cross-service redirects
@@ -0,0 +1,19 @@
1
+ import type { ShallowFlow } from '../../types.js';
2
+ export declare enum StdAuthStep {
3
+ Choice = "choice",
4
+ Signup = "signup",
5
+ Signin = "signin",
6
+ New = "new",
7
+ Existing = "existing",
8
+ Payment = "payment",
9
+ Success = "success",
10
+ Target = "target"
11
+ }
12
+ /**
13
+ * @TODO Actually this thing is kept here for the iteration when
14
+ * OwlMeans ID account may be used without owlmeans.net account.
15
+ *
16
+ * @deprecated
17
+ */
18
+ export declare const stdAuthFlow: ShallowFlow;
19
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/flows/auth/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAGjD,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAGD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,WAuIzB,CAAA"}
@@ -0,0 +1,146 @@
1
+ import { STD_AUTH_FLOW } from '../../consts.js';
2
+ export var StdAuthStep;
3
+ (function (StdAuthStep) {
4
+ StdAuthStep["Choice"] = "choice";
5
+ StdAuthStep["Signup"] = "signup";
6
+ StdAuthStep["Signin"] = "signin";
7
+ StdAuthStep["New"] = "new";
8
+ StdAuthStep["Existing"] = "existing";
9
+ StdAuthStep["Payment"] = "payment";
10
+ StdAuthStep["Success"] = "success";
11
+ StdAuthStep["Target"] = "target";
12
+ })(StdAuthStep || (StdAuthStep = {}));
13
+ // OwlMeans Authentication Standard Flow
14
+ /**
15
+ * @TODO Actually this thing is kept here for the iteration when
16
+ * OwlMeans ID account may be used without owlmeans.net account.
17
+ *
18
+ * @deprecated
19
+ */
20
+ export const stdAuthFlow = {
21
+ // naming - preserve space in serialized state
22
+ flow: STD_AUTH_FLOW,
23
+ initialStep: StdAuthStep.Choice,
24
+ steps: {
25
+ [StdAuthStep.Choice]: {
26
+ index: 0,
27
+ step: StdAuthStep.Choice,
28
+ service: '$auth',
29
+ initial: true,
30
+ module: '$auth.choice',
31
+ transitions: {
32
+ [StdAuthStep.Signup]: {
33
+ transition: StdAuthStep.Signup,
34
+ step: StdAuthStep.Signup,
35
+ explicit: true,
36
+ reversible: true
37
+ },
38
+ [StdAuthStep.Signin]: {
39
+ transition: StdAuthStep.Signin,
40
+ step: StdAuthStep.Signin,
41
+ explicit: true,
42
+ reversible: true
43
+ },
44
+ },
45
+ },
46
+ [StdAuthStep.Signup]: {
47
+ index: 1,
48
+ step: StdAuthStep.Signup,
49
+ service: '$auth',
50
+ module: '$auth.flow',
51
+ initial: true,
52
+ transitions: {
53
+ [StdAuthStep.New]: {
54
+ transition: StdAuthStep.New,
55
+ step: StdAuthStep.New,
56
+ explicit: true,
57
+ reversible: true,
58
+ },
59
+ [StdAuthStep.Existing]: {
60
+ transition: StdAuthStep.Existing,
61
+ step: StdAuthStep.Existing,
62
+ explicit: true,
63
+ reversible: true
64
+ },
65
+ [StdAuthStep.Signin]: {
66
+ transition: StdAuthStep.Signin,
67
+ step: StdAuthStep.Signin,
68
+ explicit: true,
69
+ reversible: true
70
+ },
71
+ }
72
+ },
73
+ [StdAuthStep.Signin]: {
74
+ index: 2,
75
+ step: StdAuthStep.Signin,
76
+ service: '$auth',
77
+ module: '$auth.flow',
78
+ initial: true,
79
+ transitions: {
80
+ [StdAuthStep.Target]: {
81
+ transition: StdAuthStep.Target,
82
+ step: StdAuthStep.Target,
83
+ }
84
+ }
85
+ },
86
+ [StdAuthStep.New]: {
87
+ index: 3,
88
+ step: StdAuthStep.New,
89
+ service: '$auth',
90
+ module: '$auth.flow',
91
+ initial: true,
92
+ transitions: {
93
+ [StdAuthStep.Payment]: {
94
+ transition: StdAuthStep.Payment,
95
+ step: StdAuthStep.Payment,
96
+ }
97
+ }
98
+ },
99
+ [StdAuthStep.Existing]: {
100
+ index: 4,
101
+ step: StdAuthStep.Existing,
102
+ service: '$auth',
103
+ module: '$auth.flow',
104
+ transitions: {
105
+ [StdAuthStep.Payment]: {
106
+ transition: StdAuthStep.Payment,
107
+ step: StdAuthStep.Payment,
108
+ }
109
+ }
110
+ },
111
+ [StdAuthStep.Payment]: {
112
+ index: 5,
113
+ step: StdAuthStep.Payment,
114
+ service: '$payment',
115
+ module: '$payment.plan',
116
+ transitions: {
117
+ [StdAuthStep.Success]: {
118
+ transition: StdAuthStep.Success,
119
+ step: StdAuthStep.Success,
120
+ }
121
+ }
122
+ },
123
+ [StdAuthStep.Success]: {
124
+ index: 6,
125
+ step: StdAuthStep.Success,
126
+ service: '$payment',
127
+ module: '$payment.success',
128
+ transitions: {
129
+ [StdAuthStep.Target]: {
130
+ transition: StdAuthStep.Target,
131
+ step: StdAuthStep.Target,
132
+ }
133
+ }
134
+ },
135
+ // @TODO This doesn't work anymore
136
+ // The auth dispatcher will require an additional step to proceed
137
+ [StdAuthStep.Target]: {
138
+ index: 7,
139
+ step: StdAuthStep.Target,
140
+ service: '$auth',
141
+ module: '$dispatcher',
142
+ transitions: {}
143
+ }
144
+ }
145
+ };
146
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../src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B,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,WAAW,CAAC,QAAQ;YAC1B,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,YAAY;YACpB,WAAW,EAAE;gBACX,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;oBACrB,UAAU,EAAE,WAAW,CAAC,OAAO;oBAC/B,IAAI,EAAE,WAAW,CAAC,OAAO;iBAC1B;aACF;SACF;QAED,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;YACrB,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,WAAW,CAAC,OAAO;YACzB,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,eAAe;YACvB,WAAW,EAAE;gBACX,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;oBACrB,UAAU,EAAE,WAAW,CAAC,OAAO;oBAC/B,IAAI,EAAE,WAAW,CAAC,OAAO;iBAC1B;aACF;SACF;QAED,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;YACrB,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,WAAW,CAAC,OAAO;YACzB,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,kBAAkB;YAC1B,WAAW,EAAE;gBACX,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;oBACpB,UAAU,EAAE,WAAW,CAAC,MAAM;oBAC9B,IAAI,EAAE,WAAW,CAAC,MAAM;iBACzB;aACF;SACF;QAED,kCAAkC;QAClC,iEAAiE;QACjE,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;YACpB,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,WAAW,CAAC,MAAM;YACxB,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,aAAa;YACrB,WAAW,EAAE,EAAE;SAChB;KAEF;CACF,CAAA"}
@@ -1,5 +1,5 @@
1
- export * from './auth.js';
2
- export * from './stab.js';
3
- export * from './oidc.js';
4
- export * from './oidp.js';
1
+ export * from './auth/consts.js';
2
+ export * from './stab/consts.js';
3
+ export * from './oidc/consts.js';
4
+ export * from './oidp/consts.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flows/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flows/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA"}
@@ -1,5 +1,5 @@
1
- export * from './auth.js';
2
- export * from './stab.js';
3
- export * from './oidc.js';
4
- export * from './oidp.js';
1
+ export * from './auth/consts.js';
2
+ export * from './stab/consts.js';
3
+ export * from './oidc/consts.js';
4
+ export * from './oidp/consts.js';
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/flows/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/flows/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { ShallowFlow } from '../../types.js';
2
+ export declare enum OidcAuthStep {
3
+ Dispatch = "dispatch",
4
+ Authen = "authen",
5
+ PostAuthen = "post-authen",
6
+ OrgChoice = "org-choice",
7
+ Payment = "payment",
8
+ Success = "success",
9
+ Target = "target",
10
+ Ephemeral = "ephemeral"
11
+ }
12
+ export declare const PURPOSE_PAYLOAD = "purpose";
13
+ export declare const SIMPLIFIED_PAYLOAD = "simplified";
14
+ export declare const stdOidcFlow: ShallowFlow;
15
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/flows/oidc/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAIjD,oBAAY,YAAY;IACtB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,UAAU,gBAAgB;IAC1B,SAAS,eAAe;IACxB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,eAAO,MAAM,eAAe,YAAY,CAAA;AACxC,eAAO,MAAM,kBAAkB,eAAe,CAAA;AAG9C,eAAO,MAAM,WAAW,EAAE,WA2IzB,CAAA"}
@@ -0,0 +1,147 @@
1
+ import { STD_OIDC_FLOW, TARGET_SERVICE } from '../../consts.js';
2
+ import { AUTH_QUERY } from '@owlmeans/auth';
3
+ export var OidcAuthStep;
4
+ (function (OidcAuthStep) {
5
+ OidcAuthStep["Dispatch"] = "dispatch";
6
+ OidcAuthStep["Authen"] = "authen";
7
+ OidcAuthStep["PostAuthen"] = "post-authen";
8
+ OidcAuthStep["OrgChoice"] = "org-choice";
9
+ OidcAuthStep["Payment"] = "payment";
10
+ OidcAuthStep["Success"] = "success";
11
+ OidcAuthStep["Target"] = "target";
12
+ OidcAuthStep["Ephemeral"] = "ephemeral";
13
+ })(OidcAuthStep || (OidcAuthStep = {}));
14
+ export const PURPOSE_PAYLOAD = 'purpose';
15
+ export const SIMPLIFIED_PAYLOAD = 'simplified';
16
+ // OwlMeans OIDC Based Auth Flow
17
+ export const stdOidcFlow = {
18
+ // naming - preserve space in serialized state
19
+ flow: STD_OIDC_FLOW,
20
+ initialStep: OidcAuthStep.Dispatch,
21
+ steps: {
22
+ [OidcAuthStep.Dispatch]: {
23
+ index: 0,
24
+ step: OidcAuthStep.Dispatch,
25
+ service: '$auth',
26
+ initial: true,
27
+ module: '$auth.choice',
28
+ transitions: {
29
+ [OidcAuthStep.Authen]: {
30
+ transition: OidcAuthStep.Authen,
31
+ step: OidcAuthStep.Authen,
32
+ },
33
+ [OidcAuthStep.Ephemeral]: {
34
+ transition: OidcAuthStep.Ephemeral,
35
+ step: OidcAuthStep.Ephemeral,
36
+ },
37
+ },
38
+ payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
39
+ },
40
+ [OidcAuthStep.Authen]: {
41
+ index: 1,
42
+ step: OidcAuthStep.Authen,
43
+ service: '$iam',
44
+ module: '$iam.authen',
45
+ transitions: {
46
+ [OidcAuthStep.PostAuthen]: {
47
+ transition: OidcAuthStep.PostAuthen,
48
+ step: OidcAuthStep.PostAuthen,
49
+ },
50
+ },
51
+ payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
52
+ },
53
+ [OidcAuthStep.PostAuthen]: {
54
+ index: 2,
55
+ step: OidcAuthStep.PostAuthen,
56
+ service: '$auth',
57
+ module: '$auth.flow-param',
58
+ transitions: {
59
+ [OidcAuthStep.OrgChoice]: {
60
+ transition: OidcAuthStep.OrgChoice,
61
+ step: OidcAuthStep.OrgChoice,
62
+ },
63
+ [OidcAuthStep.Payment]: {
64
+ transition: OidcAuthStep.Payment,
65
+ step: OidcAuthStep.Payment,
66
+ },
67
+ [OidcAuthStep.Target]: {
68
+ transition: OidcAuthStep.Target,
69
+ step: OidcAuthStep.Target,
70
+ },
71
+ },
72
+ payloadMap: {
73
+ [PURPOSE_PAYLOAD]: 0,
74
+ [SIMPLIFIED_PAYLOAD]: 1,
75
+ }
76
+ },
77
+ [OidcAuthStep.OrgChoice]: {
78
+ index: 3,
79
+ step: OidcAuthStep.OrgChoice,
80
+ service: '$auth',
81
+ module: '$auth.flow',
82
+ transitions: {
83
+ [OidcAuthStep.Payment]: {
84
+ transition: OidcAuthStep.Payment,
85
+ step: OidcAuthStep.Payment,
86
+ },
87
+ [OidcAuthStep.Target]: {
88
+ transition: OidcAuthStep.Target,
89
+ step: OidcAuthStep.Target,
90
+ },
91
+ },
92
+ payloadMap: {
93
+ [AUTH_QUERY]: 0,
94
+ [PURPOSE_PAYLOAD]: 1,
95
+ [SIMPLIFIED_PAYLOAD]: 1,
96
+ }
97
+ },
98
+ [OidcAuthStep.Payment]: {
99
+ index: 4,
100
+ step: OidcAuthStep.Payment,
101
+ service: '$payment',
102
+ module: '$payment.plan',
103
+ transitions: {
104
+ [OidcAuthStep.Success]: {
105
+ transition: OidcAuthStep.Success,
106
+ step: OidcAuthStep.Success,
107
+ }
108
+ },
109
+ payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
110
+ },
111
+ [OidcAuthStep.Success]: {
112
+ index: 5,
113
+ step: OidcAuthStep.Success,
114
+ service: '$payment',
115
+ module: '$payment.success',
116
+ transitions: {
117
+ [OidcAuthStep.Target]: {
118
+ transition: OidcAuthStep.Target,
119
+ step: OidcAuthStep.Target,
120
+ }
121
+ },
122
+ payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
123
+ },
124
+ [OidcAuthStep.Target]: {
125
+ index: 6,
126
+ step: OidcAuthStep.Target,
127
+ service: '$auth',
128
+ module: '$auth.flow',
129
+ transitions: {
130
+ [OidcAuthStep.Ephemeral]: {
131
+ transition: OidcAuthStep.Ephemeral,
132
+ step: OidcAuthStep.Ephemeral,
133
+ }
134
+ },
135
+ payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
136
+ },
137
+ [OidcAuthStep.Ephemeral]: {
138
+ index: 7,
139
+ step: OidcAuthStep.Ephemeral,
140
+ service: TARGET_SERVICE,
141
+ module: '$dispatcher',
142
+ transitions: {},
143
+ payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
144
+ }
145
+ }
146
+ };
147
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../src/flows/oidc/consts.ts"],"names":[],"mappings":"AACA,OAAO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AE,YAAY,CAAC,SAAS;iBAC7B;aACF;YACD,UAAU,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAAE;SACxC;QAED,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;YACxB,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,YAAY,CAAC,SAAS;YAC5B,OAAO,EAAE,cAAc;YACvB,MAAM,EAAE,aAAa;YACrB,WAAW,EAAE,EAAE;YACf,UAAU,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,EAAE;SACxC;KAEF;CACF,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { ShallowFlow } from '../../types.js';
2
+ export declare enum OidpAuthStep {
3
+ Unknown = "unknown",
4
+ CreateId = "create-id",
5
+ Auth = "auth",
6
+ PostAuth = "post-auth",
7
+ LinkId = "link-id",
8
+ Denied = "denied",
9
+ Dispatch = "dispatch",
10
+ Target = "target"
11
+ }
12
+ export declare const stdOidpFlow: ShallowFlow;
13
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../src/flows/oidp/consts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAGjD,oBAAY,YAAY;IACtB,OAAO,YAAY;IAEnB,QAAQ,cAAc;IAEtB,IAAI,SAAS;IACb,QAAQ,cAAc;IACtB,MAAM,YAAY;IAClB,MAAM,WAAW;IACjB,QAAQ,aAAa;IAErB,MAAM,WAAW;CAKlB;AAED,eAAO,MAAM,WAAW,EAAE,WAsLzB,CAAA"}