@owlmeans/flow 0.1.1 → 0.1.3
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/LICENSE +1 -1
- package/README.md +35 -480
- package/build/flows/oidc.d.ts +1 -0
- package/build/flows/oidc.d.ts.map +1 -1
- package/build/flows/oidc.js +17 -6
- package/build/flows/oidc.js.map +1 -1
- package/build/state.d.ts.map +1 -1
- package/build/state.js +14 -5
- package/build/state.js.map +1 -1
- package/build/types.d.ts +1 -0
- package/build/types.d.ts.map +1 -1
- package/package.json +9 -7
- package/src/flows/oidc.ts +18 -7
- package/src/state.ts +14 -4
- package/src/types.ts +1 -0
- package/tsconfig.json +5 -10
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 OwlMeans Common — Fullstack typescript framework
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,514 +1,69 @@
|
|
|
1
1
|
# @owlmeans/flow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
State machine for multi-step user flows, primarily used for OIDC authentication flows.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- **Cross-Service Coordination**: Coordinate workflows across different microservices
|
|
12
|
-
- **Configurable Transitions**: Define conditional transitions between workflow steps
|
|
13
|
-
- **Payload Management**: Handle data passing between workflow steps
|
|
14
|
-
- **Reversible Steps**: Support for backward navigation in workflows
|
|
15
|
-
- **Serialization**: Persistent workflow state through URL parameters or storage
|
|
16
|
-
- **Internationalization**: Built-in i18n support for workflow content
|
|
7
|
+
- Defines flow configurations as sequences of steps and transitions
|
|
8
|
+
- `STD_OIDC_FLOW` is the standard OIDC authentication flow constant
|
|
9
|
+
- `stdOidcFlow()` creates the preconfigured OIDC flow definition
|
|
10
|
+
- Flows are started via `flowService.begin(flowAlias)` and progress through steps as the user authenticates
|
|
17
11
|
|
|
18
12
|
## Installation
|
|
19
13
|
|
|
20
14
|
```bash
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Core Concepts
|
|
25
|
-
|
|
26
|
-
### Flow Definition
|
|
27
|
-
|
|
28
|
-
A flow is a structured definition of a multi-step process with:
|
|
29
|
-
- **Steps**: Individual stages in the workflow
|
|
30
|
-
- **Transitions**: Connections between steps with conditions
|
|
31
|
-
- **Configuration**: Global settings and service mappings
|
|
32
|
-
- **Payload Mapping**: Data transformation rules between steps
|
|
33
|
-
|
|
34
|
-
### Flow State
|
|
35
|
-
|
|
36
|
-
The current state of a workflow execution including:
|
|
37
|
-
- Current step
|
|
38
|
-
- Previous step (for reversible flows)
|
|
39
|
-
- Payload data
|
|
40
|
-
- Target service
|
|
41
|
-
- Status information
|
|
42
|
-
|
|
43
|
-
### Flow Model
|
|
44
|
-
|
|
45
|
-
A runtime instance that provides methods to:
|
|
46
|
-
- Navigate between steps
|
|
47
|
-
- Execute transitions
|
|
48
|
-
- Manage state and payload
|
|
49
|
-
- Serialize/deserialize flow state
|
|
50
|
-
|
|
51
|
-
## API Reference
|
|
52
|
-
|
|
53
|
-
### Types
|
|
54
|
-
|
|
55
|
-
#### `Flow`
|
|
56
|
-
Complete flow definition with configuration and prefabs.
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
interface Flow extends ShallowFlow {
|
|
60
|
-
config: FlowConfig
|
|
61
|
-
prefabs: { [step: string]: string }
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
#### `ShallowFlow`
|
|
66
|
-
Basic flow structure without configuration.
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
interface ShallowFlow {
|
|
70
|
-
flow: string
|
|
71
|
-
initialStep: string
|
|
72
|
-
steps: { [key: string]: FlowStep }
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
#### `FlowStep`
|
|
77
|
-
Individual step definition in a workflow.
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
interface FlowStep {
|
|
81
|
-
index: number
|
|
82
|
-
step: string
|
|
83
|
-
service: string
|
|
84
|
-
path?: string
|
|
85
|
-
module?: string
|
|
86
|
-
initial?: boolean
|
|
87
|
-
payloadMap?: { [key: string]: number }
|
|
88
|
-
transitions: { [key: string]: FlowTransition }
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
#### `FlowTransition`
|
|
93
|
-
Transition between workflow steps.
|
|
94
|
-
|
|
95
|
-
```typescript
|
|
96
|
-
interface FlowTransition {
|
|
97
|
-
transition: string
|
|
98
|
-
step: string
|
|
99
|
-
explicit?: boolean // User can choose this transition
|
|
100
|
-
reversible?: boolean // User can go back
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
#### `FlowState`
|
|
105
|
-
Current state of workflow execution.
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
interface FlowState {
|
|
109
|
-
flow: string
|
|
110
|
-
step: string
|
|
111
|
-
previous?: string
|
|
112
|
-
entityId?: string | null
|
|
113
|
-
service: string
|
|
114
|
-
payload?: FlowPayload
|
|
115
|
-
message?: string
|
|
116
|
-
ok: boolean
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### `FlowConfig`
|
|
121
|
-
Global configuration for flow behavior.
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
interface FlowConfig {
|
|
125
|
-
queryParam?: string // URL parameter name for flow state
|
|
126
|
-
services?: { [ref: string]: string } // Service reference mappings
|
|
127
|
-
modules?: { [ref: string]: string } // Module reference mappings
|
|
128
|
-
pathes?: { [ref: string]: string } // Path reference mappings
|
|
129
|
-
defaultFlow?: string // Default flow to use
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
#### `FlowModel`
|
|
134
|
-
Runtime workflow management interface.
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
interface FlowModel {
|
|
138
|
-
target: (service: string) => FlowModel
|
|
139
|
-
entity: (entityId: string) => FlowModel
|
|
140
|
-
enter: (step?: string) => FlowModel
|
|
141
|
-
steps: (enter?: boolean) => FlowStep[]
|
|
142
|
-
state: () => FlowState
|
|
143
|
-
setState: (state: FlowState | null) => FlowModel
|
|
144
|
-
payload: <T extends FlowPayload>() => T
|
|
145
|
-
step: (step?: string) => FlowStep
|
|
146
|
-
transitions: (explicit?: boolean) => FlowTransition[]
|
|
147
|
-
transition: (transition: string) => FlowTransition
|
|
148
|
-
next: () => FlowTransition
|
|
149
|
-
transit: (transition: string, ok: boolean, message?: string | FlowPayload, payload?: FlowPayload) => string
|
|
150
|
-
serialize: () => string
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Factory Functions
|
|
155
|
-
|
|
156
|
-
#### `makeFlowModel(flow: string | ShallowFlow, provider?: FlowProvider): Promise<FlowModel>`
|
|
157
|
-
Creates a flow model instance from flow definition or serialized state.
|
|
158
|
-
|
|
159
|
-
**Parameters:**
|
|
160
|
-
- `flow`: Flow name, definition, or serialized state
|
|
161
|
-
- `provider`: Optional flow provider function
|
|
162
|
-
|
|
163
|
-
**Returns:** Promise resolving to FlowModel instance
|
|
164
|
-
|
|
165
|
-
### Helper Functions
|
|
166
|
-
|
|
167
|
-
#### `flow<C>(cfg: C, flow: ShallowFlow): C`
|
|
168
|
-
Adds a flow definition to configuration.
|
|
169
|
-
|
|
170
|
-
#### `configureFlows<C>(cfg: C & WithFlowConfig, config: FlowConfig): C & WithFlowConfig`
|
|
171
|
-
Adds flow configuration to application config.
|
|
172
|
-
|
|
173
|
-
### Error Types
|
|
174
|
-
|
|
175
|
-
The package provides specialized error types for flow operations:
|
|
176
|
-
|
|
177
|
-
#### `FlowError`
|
|
178
|
-
Base error class for all flow-related errors.
|
|
179
|
-
|
|
180
|
-
#### `FlowUnsupported`
|
|
181
|
-
Error for unsupported flow operations.
|
|
182
|
-
|
|
183
|
-
#### `FlowTargetError`
|
|
184
|
-
Error related to flow target service issues.
|
|
185
|
-
|
|
186
|
-
#### `UnknownFlow`
|
|
187
|
-
Error when referenced flow doesn't exist.
|
|
188
|
-
|
|
189
|
-
#### `FlowStepError`
|
|
190
|
-
Base error for step-related issues.
|
|
191
|
-
|
|
192
|
-
#### `FlowStepMissconfigured`
|
|
193
|
-
Error for misconfigured flow steps.
|
|
194
|
-
|
|
195
|
-
#### `UnknownFlowStep`
|
|
196
|
-
Error when referenced step doesn't exist.
|
|
197
|
-
|
|
198
|
-
#### `UnknownTransition`
|
|
199
|
-
Error when referenced transition doesn't exist.
|
|
200
|
-
|
|
201
|
-
### Constants
|
|
202
|
-
|
|
203
|
-
```typescript
|
|
204
|
-
// Standard flow types
|
|
205
|
-
const STD_AUTH_FLOW = '_oa' // Authentication flow
|
|
206
|
-
const STD_OIDC_FLOW = '_oidc' // OIDC flow
|
|
207
|
-
const STD_STAB_FLOW = '_stb' // Stabilization flow
|
|
208
|
-
const STD_OIDP_FLOW = '_oidp' // OIDC Provider flow
|
|
209
|
-
|
|
210
|
-
// Configuration
|
|
211
|
-
const CFG_FLOW_PREFIX = 'flow'
|
|
212
|
-
const FLOW_RECORD = 'flow'
|
|
213
|
-
const TARGET_SERVICE = '-'
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## Usage Examples
|
|
217
|
-
|
|
218
|
-
### Basic Flow Definition
|
|
219
|
-
|
|
220
|
-
```typescript
|
|
221
|
-
import { flow, makeFlowModel } from '@owlmeans/flow'
|
|
222
|
-
|
|
223
|
-
const registrationFlow: ShallowFlow = {
|
|
224
|
-
flow: 'user-registration',
|
|
225
|
-
initialStep: 'start',
|
|
226
|
-
steps: {
|
|
227
|
-
start: {
|
|
228
|
-
index: 0,
|
|
229
|
-
step: 'start',
|
|
230
|
-
service: 'auth-service',
|
|
231
|
-
path: '/register/start',
|
|
232
|
-
initial: true,
|
|
233
|
-
transitions: {
|
|
234
|
-
next: { transition: 'next', step: 'credentials' },
|
|
235
|
-
cancel: { transition: 'cancel', step: 'cancelled' }
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
credentials: {
|
|
239
|
-
index: 1,
|
|
240
|
-
step: 'credentials',
|
|
241
|
-
service: 'auth-service',
|
|
242
|
-
path: '/register/credentials',
|
|
243
|
-
transitions: {
|
|
244
|
-
submit: { transition: 'submit', step: 'verify' },
|
|
245
|
-
back: { transition: 'back', step: 'start', reversible: true }
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
verify: {
|
|
249
|
-
index: 2,
|
|
250
|
-
step: 'verify',
|
|
251
|
-
service: 'auth-service',
|
|
252
|
-
path: '/register/verify',
|
|
253
|
-
transitions: {
|
|
254
|
-
confirmed: { transition: 'confirmed', step: 'complete' },
|
|
255
|
-
resend: { transition: 'resend', step: 'verify' }
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
complete: {
|
|
259
|
-
index: 3,
|
|
260
|
-
step: 'complete',
|
|
261
|
-
service: 'auth-service',
|
|
262
|
-
path: '/register/complete',
|
|
263
|
-
transitions: {}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Add to configuration
|
|
269
|
-
const config = flow(baseConfig, registrationFlow)
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### Flow Execution
|
|
273
|
-
|
|
274
|
-
```typescript
|
|
275
|
-
// Create flow model
|
|
276
|
-
const flowModel = await makeFlowModel('user-registration', flowProvider)
|
|
277
|
-
|
|
278
|
-
// Target a specific service
|
|
279
|
-
flowModel.target('auth-service')
|
|
280
|
-
|
|
281
|
-
// Set entity context
|
|
282
|
-
flowModel.entity('user123')
|
|
283
|
-
|
|
284
|
-
// Get current step
|
|
285
|
-
const currentStep = flowModel.step()
|
|
286
|
-
console.log(`Current step: ${currentStep.step}`)
|
|
287
|
-
|
|
288
|
-
// Get available transitions
|
|
289
|
-
const transitions = flowModel.transitions(true) // Only explicit transitions
|
|
290
|
-
console.log('Available actions:', transitions.map(t => t.transition))
|
|
291
|
-
|
|
292
|
-
// Execute transition
|
|
293
|
-
const nextState = flowModel.transit('submit', true, 'Success', {
|
|
294
|
-
username: 'john_doe',
|
|
295
|
-
email: 'john@example.com'
|
|
296
|
-
})
|
|
297
|
-
|
|
298
|
-
// Serialize state for URL or storage
|
|
299
|
-
const serializedState = flowModel.serialize()
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
### Flow State Management
|
|
303
|
-
|
|
304
|
-
```typescript
|
|
305
|
-
// Load from serialized state
|
|
306
|
-
const flowModel = await makeFlowModel(serializedState, flowProvider)
|
|
307
|
-
|
|
308
|
-
// Check if flow completed successfully
|
|
309
|
-
const state = flowModel.state()
|
|
310
|
-
if (state.ok && state.step === 'complete') {
|
|
311
|
-
console.log('Registration completed successfully')
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// Handle errors
|
|
315
|
-
if (!state.ok && state.message) {
|
|
316
|
-
console.error('Flow error:', state.message)
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// Access payload data
|
|
320
|
-
const payload = flowModel.payload<{username: string, email: string}>()
|
|
321
|
-
console.log('User data:', payload)
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### Cross-Service Flow
|
|
325
|
-
|
|
326
|
-
```typescript
|
|
327
|
-
const crossServiceFlow: ShallowFlow = {
|
|
328
|
-
flow: 'order-fulfillment',
|
|
329
|
-
initialStep: 'create-order',
|
|
330
|
-
steps: {
|
|
331
|
-
'create-order': {
|
|
332
|
-
index: 0,
|
|
333
|
-
step: 'create-order',
|
|
334
|
-
service: 'order-service',
|
|
335
|
-
transitions: {
|
|
336
|
-
created: { transition: 'created', step: 'process-payment' }
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
'process-payment': {
|
|
340
|
-
index: 1,
|
|
341
|
-
step: 'process-payment',
|
|
342
|
-
service: 'payment-service',
|
|
343
|
-
transitions: {
|
|
344
|
-
paid: { transition: 'paid', step: 'ship-order' },
|
|
345
|
-
failed: { transition: 'failed', step: 'payment-failed' }
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
'ship-order': {
|
|
349
|
-
index: 2,
|
|
350
|
-
step: 'ship-order',
|
|
351
|
-
service: 'shipping-service',
|
|
352
|
-
transitions: {
|
|
353
|
-
shipped: { transition: 'shipped', step: 'complete' }
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
15
|
+
bun add @owlmeans/flow
|
|
358
16
|
```
|
|
359
17
|
|
|
360
|
-
|
|
18
|
+
## Usage
|
|
361
19
|
|
|
362
|
-
|
|
363
|
-
import { configureFlows } from '@owlmeans/flow'
|
|
364
|
-
|
|
365
|
-
const config = configureFlows(baseConfig, {
|
|
366
|
-
queryParam: 'flow',
|
|
367
|
-
defaultFlow: 'user-registration',
|
|
368
|
-
services: {
|
|
369
|
-
auth: 'auth-service',
|
|
370
|
-
payment: 'payment-service'
|
|
371
|
-
},
|
|
372
|
-
modules: {
|
|
373
|
-
login: 'auth:login',
|
|
374
|
-
register: 'auth:register'
|
|
375
|
-
},
|
|
376
|
-
pathes: {
|
|
377
|
-
home: '/dashboard',
|
|
378
|
-
login: '/auth/login'
|
|
379
|
-
}
|
|
380
|
-
})
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
### Flow Provider Implementation
|
|
20
|
+
Register the OIDC flow in app config:
|
|
384
21
|
|
|
385
22
|
```typescript
|
|
386
|
-
import {
|
|
387
|
-
|
|
388
|
-
const flowProvider: FlowProvider = async (flowName: string) => {
|
|
389
|
-
// Load from database, configuration, or static definitions
|
|
390
|
-
const flowRecord = await flowRepository.get(flowName)
|
|
391
|
-
|
|
392
|
-
return {
|
|
393
|
-
...flowRecord,
|
|
394
|
-
config: {
|
|
395
|
-
queryParam: 'f',
|
|
396
|
-
services: { auth: 'auth-service' }
|
|
397
|
-
},
|
|
398
|
-
prefabs: {
|
|
399
|
-
start: 'welcome-template',
|
|
400
|
-
complete: 'success-template'
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
### Error Handling
|
|
23
|
+
import { STD_OIDC_FLOW, stdOidcFlow } from '@owlmeans/flow'
|
|
407
24
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
console.error('Flow not found')
|
|
416
|
-
} else if (error instanceof FlowStepError) {
|
|
417
|
-
console.error('Step configuration error:', error.message)
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
## Advanced Features
|
|
423
|
-
|
|
424
|
-
### Payload Mapping
|
|
425
|
-
|
|
426
|
-
Configure how data flows between steps:
|
|
427
|
-
|
|
428
|
-
```typescript
|
|
429
|
-
const step: FlowStep = {
|
|
430
|
-
index: 1,
|
|
431
|
-
step: 'credentials',
|
|
432
|
-
service: 'auth-service',
|
|
433
|
-
payloadMap: {
|
|
434
|
-
username: 0, // Map to first payload parameter
|
|
435
|
-
email: 1, // Map to second payload parameter
|
|
436
|
-
phone: 2 // Map to third payload parameter
|
|
437
|
-
},
|
|
438
|
-
transitions: { /* ... */ }
|
|
439
|
-
}
|
|
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()] }
|
|
31
|
+
)
|
|
440
32
|
```
|
|
441
33
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
Implement business logic in transitions:
|
|
34
|
+
Start a flow in a component:
|
|
445
35
|
|
|
446
36
|
```typescript
|
|
447
|
-
|
|
37
|
+
import { STD_OIDC_FLOW } from '@owlmeans/flow'
|
|
448
38
|
|
|
449
|
-
//
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
canProceed ? 'submit' : 'error',
|
|
453
|
-
canProceed,
|
|
454
|
-
canProceed ? 'Validation passed' : 'Please fix errors'
|
|
455
|
-
)
|
|
39
|
+
// In a UI action handler
|
|
40
|
+
const flowService = context.service(FLOW_SERVICE_ALIAS)
|
|
41
|
+
await flowService.begin(STD_OIDC_FLOW)
|
|
456
42
|
```
|
|
457
43
|
|
|
458
|
-
|
|
44
|
+
## API
|
|
459
45
|
|
|
460
|
-
|
|
461
|
-
// Extract flow state from URL
|
|
462
|
-
const urlParams = new URLSearchParams(window.location.search)
|
|
463
|
-
const flowState = urlParams.get('flow')
|
|
46
|
+
### `STD_OIDC_FLOW`
|
|
464
47
|
|
|
465
|
-
|
|
466
|
-
const flowModel = await makeFlowModel(flowState, flowProvider)
|
|
467
|
-
// Resume flow from URL state
|
|
468
|
-
}
|
|
48
|
+
Constant: `'_oidc'` — alias for the standard OIDC flow.
|
|
469
49
|
|
|
470
|
-
|
|
471
|
-
const currentState = flowModel.serialize()
|
|
472
|
-
const newUrl = `${window.location.pathname}?flow=${currentState}`
|
|
473
|
-
window.history.pushState({}, '', newUrl)
|
|
474
|
-
```
|
|
50
|
+
### `stdOidcFlow(): FlowConfig`
|
|
475
51
|
|
|
476
|
-
|
|
52
|
+
Returns a pre-built `FlowConfig` for the standard OIDC authentication flow.
|
|
477
53
|
|
|
478
|
-
|
|
54
|
+
### `FlowConfig`
|
|
479
55
|
|
|
480
|
-
|
|
481
|
-
- **@owlmeans/error**: Resilient error handling system
|
|
482
|
-
- **@owlmeans/resource**: Flow state persistence and retrieval
|
|
483
|
-
- **@owlmeans/i18n**: Internationalization for flow content
|
|
484
|
-
- **@owlmeans/client-flow**: Client-side flow execution
|
|
485
|
-
- **@owlmeans/server-flow**: Server-side flow management
|
|
486
|
-
- **@owlmeans/web-flow**: Web-specific flow features
|
|
56
|
+
A flow configuration object with `alias`, `steps: FlowStep[]`, and `transitions: FlowTransition[]`.
|
|
487
57
|
|
|
488
|
-
|
|
58
|
+
### `FlowStep`
|
|
489
59
|
|
|
490
|
-
|
|
491
|
-
- Keep steps focused on single responsibilities
|
|
492
|
-
- Design for both forward and backward navigation
|
|
493
|
-
- Use meaningful step and transition names
|
|
494
|
-
- Plan for error scenarios and recovery paths
|
|
60
|
+
A named step in a flow with optional `service` and `module` references.
|
|
495
61
|
|
|
496
|
-
###
|
|
497
|
-
- Minimize payload size for URL serialization
|
|
498
|
-
- Use appropriate TTL for flow state persistence
|
|
499
|
-
- Handle state corruption gracefully
|
|
500
|
-
- Implement proper cleanup for abandoned flows
|
|
62
|
+
### `FLOW_RECORD`
|
|
501
63
|
|
|
502
|
-
|
|
503
|
-
- Validate payload data at each step
|
|
504
|
-
- Implement proper authorization for step access
|
|
505
|
-
- Sanitize flow state when exposing in URLs
|
|
506
|
-
- Use secure channels for sensitive flow data
|
|
64
|
+
Config record type key for registering flows in the application config.
|
|
507
65
|
|
|
508
|
-
|
|
509
|
-
- Cache flow definitions for better performance
|
|
510
|
-
- Implement efficient flow provider lookups
|
|
511
|
-
- Use pagination for large step lists
|
|
512
|
-
- Optimize serialization for large payloads
|
|
66
|
+
## Related Packages
|
|
513
67
|
|
|
514
|
-
|
|
68
|
+
- [`@owlmeans/client-flow`](../client-flow) — client-side flow service that executes flow steps
|
|
69
|
+
- [`@owlmeans/web-flow`](../web-flow) — React components for flow UI rendering
|
package/build/flows/oidc.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ export declare enum OidcAuthStep {
|
|
|
10
10
|
Ephemeral = "ephemeral"
|
|
11
11
|
}
|
|
12
12
|
export declare const PURPOSE_PAYLOAD = "purpose";
|
|
13
|
+
export declare const SIMPLIFIED_PAYLOAD = "simplified";
|
|
13
14
|
export declare const stdOidcFlow: ShallowFlow;
|
|
14
15
|
//# sourceMappingURL=oidc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["../../src/flows/oidc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAI9C,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;
|
|
1
|
+
{"version":3,"file":"oidc.d.ts","sourceRoot":"","sources":["../../src/flows/oidc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAI9C,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"}
|
package/build/flows/oidc.js
CHANGED
|
@@ -12,6 +12,7 @@ export var OidcAuthStep;
|
|
|
12
12
|
OidcAuthStep["Ephemeral"] = "ephemeral";
|
|
13
13
|
})(OidcAuthStep || (OidcAuthStep = {}));
|
|
14
14
|
export const PURPOSE_PAYLOAD = 'purpose';
|
|
15
|
+
export const SIMPLIFIED_PAYLOAD = 'simplified';
|
|
15
16
|
// OwlMeans OIDC Based Auth Flow
|
|
16
17
|
export const stdOidcFlow = {
|
|
17
18
|
// naming - preserve space in serialized state
|
|
@@ -34,6 +35,7 @@ export const stdOidcFlow = {
|
|
|
34
35
|
step: OidcAuthStep.Ephemeral,
|
|
35
36
|
},
|
|
36
37
|
},
|
|
38
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
37
39
|
},
|
|
38
40
|
[OidcAuthStep.Authen]: {
|
|
39
41
|
index: 1,
|
|
@@ -45,7 +47,8 @@ export const stdOidcFlow = {
|
|
|
45
47
|
transition: OidcAuthStep.PostAuthen,
|
|
46
48
|
step: OidcAuthStep.PostAuthen,
|
|
47
49
|
},
|
|
48
|
-
}
|
|
50
|
+
},
|
|
51
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
49
52
|
},
|
|
50
53
|
[OidcAuthStep.PostAuthen]: {
|
|
51
54
|
index: 2,
|
|
@@ -66,7 +69,10 @@ export const stdOidcFlow = {
|
|
|
66
69
|
step: OidcAuthStep.Target,
|
|
67
70
|
},
|
|
68
71
|
},
|
|
69
|
-
payloadMap: {
|
|
72
|
+
payloadMap: {
|
|
73
|
+
[PURPOSE_PAYLOAD]: 0,
|
|
74
|
+
[SIMPLIFIED_PAYLOAD]: 1,
|
|
75
|
+
}
|
|
70
76
|
},
|
|
71
77
|
[OidcAuthStep.OrgChoice]: {
|
|
72
78
|
index: 3,
|
|
@@ -86,6 +92,7 @@ export const stdOidcFlow = {
|
|
|
86
92
|
payloadMap: {
|
|
87
93
|
[AUTH_QUERY]: 0,
|
|
88
94
|
[PURPOSE_PAYLOAD]: 1,
|
|
95
|
+
[SIMPLIFIED_PAYLOAD]: 1,
|
|
89
96
|
}
|
|
90
97
|
},
|
|
91
98
|
[OidcAuthStep.Payment]: {
|
|
@@ -98,7 +105,8 @@ export const stdOidcFlow = {
|
|
|
98
105
|
transition: OidcAuthStep.Success,
|
|
99
106
|
step: OidcAuthStep.Success,
|
|
100
107
|
}
|
|
101
|
-
}
|
|
108
|
+
},
|
|
109
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
102
110
|
},
|
|
103
111
|
[OidcAuthStep.Success]: {
|
|
104
112
|
index: 5,
|
|
@@ -110,7 +118,8 @@ export const stdOidcFlow = {
|
|
|
110
118
|
transition: OidcAuthStep.Target,
|
|
111
119
|
step: OidcAuthStep.Target,
|
|
112
120
|
}
|
|
113
|
-
}
|
|
121
|
+
},
|
|
122
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
114
123
|
},
|
|
115
124
|
[OidcAuthStep.Target]: {
|
|
116
125
|
index: 6,
|
|
@@ -122,14 +131,16 @@ export const stdOidcFlow = {
|
|
|
122
131
|
transition: OidcAuthStep.Ephemeral,
|
|
123
132
|
step: OidcAuthStep.Ephemeral,
|
|
124
133
|
}
|
|
125
|
-
}
|
|
134
|
+
},
|
|
135
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
126
136
|
},
|
|
127
137
|
[OidcAuthStep.Ephemeral]: {
|
|
128
138
|
index: 7,
|
|
129
139
|
step: OidcAuthStep.Ephemeral,
|
|
130
140
|
service: TARGET_SERVICE,
|
|
131
141
|
module: '$dispatcher',
|
|
132
|
-
transitions: {}
|
|
142
|
+
transitions: {},
|
|
143
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
133
144
|
}
|
|
134
145
|
}
|
|
135
146
|
};
|
package/build/flows/oidc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidc.js","sourceRoot":"","sources":["../../src/flows/oidc.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,qCAAqB,CAAA;IACrB,iCAAiB,CAAA;IACjB,0CAA0B,CAAA;IAC1B,wCAAwB,CAAA;IACxB,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,uCAAuB,CAAA;AACzB,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AAED,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AM,EAAE,YAAY;YACpB,WAAW,EAAE;gBACX,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;oBACxB,UAAU,EAAE,YAAY,CAAC,SAAS;oBAClC,IAAI,EAAE,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"}
|
package/build/state.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAa,WAAW,EAAE,MAAM,YAAY,CAAA;AAGjF,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,GAAG,WAAW,EAAE,WAAW,YAAY,KAAG,OAAO,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAa,WAAW,EAAE,MAAM,YAAY,CAAA;AAGjF,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,GAAG,WAAW,EAAE,WAAW,YAAY,KAAG,OAAO,CAAC,SAAS,CAiJ1G,CAAA"}
|
package/build/state.js
CHANGED
|
@@ -43,6 +43,15 @@ export const makeFlowModel = async (flow, provider) => {
|
|
|
43
43
|
return model;
|
|
44
44
|
},
|
|
45
45
|
payload: () => state.payload ?? {},
|
|
46
|
+
updatePayload: payload => {
|
|
47
|
+
if (state.payload == null) {
|
|
48
|
+
state.payload = payload;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
Object.assign(state.payload, payload);
|
|
52
|
+
}
|
|
53
|
+
return model;
|
|
54
|
+
},
|
|
46
55
|
step: step => flow.steps[step ?? state.step],
|
|
47
56
|
enter: step => {
|
|
48
57
|
step = step ?? flow.initialStep;
|
|
@@ -105,11 +114,11 @@ export const makeFlowModel = async (flow, provider) => {
|
|
|
105
114
|
delete state.message;
|
|
106
115
|
}
|
|
107
116
|
if (payload != null) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
else if (state
|
|
111
|
-
|
|
112
|
-
}
|
|
117
|
+
model.updatePayload(payload);
|
|
118
|
+
// state!.payload = payload
|
|
119
|
+
} /*else if (state!.payload != null) {
|
|
120
|
+
delete state!.payload
|
|
121
|
+
}*/
|
|
113
122
|
return serializeState(flow, state);
|
|
114
123
|
},
|
|
115
124
|
serialize: () => serializeState(flow, state)
|
package/build/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE5F,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElE,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,EAAE,IAA0B,EAAE,QAAuB,EAAsB,EAAE;IAC7G,IAAI,KAAK,GAAqB,IAAI,CAAA;IAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,WAAW,CAAC,WAAW,CAAC,CAAA;QACpC,CAAC;QACD,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;YAC3B,KAAK,GAAG;gBACN,IAAI,EAAE,IAAI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C,OAAO,CAAC,CAAA;gBAC5B,2BAA2B;YAC7B,CAAC,CAAC;;eAEC;YAEH,OAAO,cAAc,CAAC,IAAI,EAAE,KAAM,CAAC,CAAA;QACrC,CAAC;QAED,SAAS,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,KAAM,CAAC;KAC9C,CAAA;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
|
package/build/types.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ export interface FlowModel {
|
|
|
80
80
|
state: () => FlowState;
|
|
81
81
|
setState: (state: FlowState | null) => FlowModel;
|
|
82
82
|
payload: <T extends FlowPayload>() => T;
|
|
83
|
+
updatePayload: (payload: FlowPayload) => FlowModel;
|
|
83
84
|
step: (step?: string) => FlowStep;
|
|
84
85
|
transitions: (explicit?: boolean) => FlowTransition[];
|
|
85
86
|
transition: (transition: string) => FlowTransition;
|
package/build/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACpC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;KAAE,CAAA;CACnC;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MA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4
5
|
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"build": "tsc -b",
|
|
@@ -20,17 +21,18 @@
|
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@owlmeans/auth": "^0.1.
|
|
24
|
-
"@owlmeans/config": "^0.1.
|
|
25
|
-
"@owlmeans/error": "^0.1.
|
|
26
|
-
"@owlmeans/i18n": "^0.1.
|
|
27
|
-
"@owlmeans/resource": "^0.1.
|
|
24
|
+
"@owlmeans/auth": "^0.1.3",
|
|
25
|
+
"@owlmeans/config": "^0.1.3",
|
|
26
|
+
"@owlmeans/error": "^0.1.3",
|
|
27
|
+
"@owlmeans/i18n": "^0.1.3",
|
|
28
|
+
"@owlmeans/resource": "^0.1.3",
|
|
28
29
|
"@scure/base": "^1.1.9"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
32
|
+
"@owlmeans/dep-config": "workspace:*",
|
|
31
33
|
"nodemon": "^3.1.11",
|
|
32
34
|
"npm-check": "^6.0.1",
|
|
33
|
-
"typescript": "^
|
|
35
|
+
"typescript": "^6.0.2"
|
|
34
36
|
},
|
|
35
37
|
"publishConfig": {
|
|
36
38
|
"access": "public"
|
package/src/flows/oidc.ts
CHANGED
|
@@ -14,6 +14,7 @@ export enum OidcAuthStep {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export const PURPOSE_PAYLOAD = 'purpose'
|
|
17
|
+
export const SIMPLIFIED_PAYLOAD = 'simplified'
|
|
17
18
|
|
|
18
19
|
// OwlMeans OIDC Based Auth Flow
|
|
19
20
|
export const stdOidcFlow: ShallowFlow = {
|
|
@@ -39,6 +40,7 @@ export const stdOidcFlow: ShallowFlow = {
|
|
|
39
40
|
step: OidcAuthStep.Ephemeral,
|
|
40
41
|
},
|
|
41
42
|
},
|
|
43
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
42
44
|
},
|
|
43
45
|
|
|
44
46
|
[OidcAuthStep.Authen]: {
|
|
@@ -51,7 +53,8 @@ export const stdOidcFlow: ShallowFlow = {
|
|
|
51
53
|
transition: OidcAuthStep.PostAuthen,
|
|
52
54
|
step: OidcAuthStep.PostAuthen,
|
|
53
55
|
},
|
|
54
|
-
}
|
|
56
|
+
},
|
|
57
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
55
58
|
},
|
|
56
59
|
|
|
57
60
|
[OidcAuthStep.PostAuthen]: {
|
|
@@ -73,7 +76,10 @@ export const stdOidcFlow: ShallowFlow = {
|
|
|
73
76
|
step: OidcAuthStep.Target,
|
|
74
77
|
},
|
|
75
78
|
},
|
|
76
|
-
payloadMap: {
|
|
79
|
+
payloadMap: {
|
|
80
|
+
[PURPOSE_PAYLOAD]: 0,
|
|
81
|
+
[SIMPLIFIED_PAYLOAD]: 1,
|
|
82
|
+
}
|
|
77
83
|
},
|
|
78
84
|
|
|
79
85
|
[OidcAuthStep.OrgChoice]: {
|
|
@@ -91,9 +97,10 @@ export const stdOidcFlow: ShallowFlow = {
|
|
|
91
97
|
step: OidcAuthStep.Target,
|
|
92
98
|
},
|
|
93
99
|
},
|
|
94
|
-
payloadMap: {
|
|
100
|
+
payloadMap: {
|
|
95
101
|
[AUTH_QUERY]: 0,
|
|
96
102
|
[PURPOSE_PAYLOAD]: 1,
|
|
103
|
+
[SIMPLIFIED_PAYLOAD]: 1,
|
|
97
104
|
}
|
|
98
105
|
},
|
|
99
106
|
|
|
@@ -107,7 +114,8 @@ export const stdOidcFlow: ShallowFlow = {
|
|
|
107
114
|
transition: OidcAuthStep.Success,
|
|
108
115
|
step: OidcAuthStep.Success,
|
|
109
116
|
}
|
|
110
|
-
}
|
|
117
|
+
},
|
|
118
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
111
119
|
},
|
|
112
120
|
|
|
113
121
|
[OidcAuthStep.Success]: {
|
|
@@ -120,7 +128,8 @@ export const stdOidcFlow: ShallowFlow = {
|
|
|
120
128
|
transition: OidcAuthStep.Target,
|
|
121
129
|
step: OidcAuthStep.Target,
|
|
122
130
|
}
|
|
123
|
-
}
|
|
131
|
+
},
|
|
132
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
124
133
|
},
|
|
125
134
|
|
|
126
135
|
[OidcAuthStep.Target]: {
|
|
@@ -133,7 +142,8 @@ export const stdOidcFlow: ShallowFlow = {
|
|
|
133
142
|
transition: OidcAuthStep.Ephemeral,
|
|
134
143
|
step: OidcAuthStep.Ephemeral,
|
|
135
144
|
}
|
|
136
|
-
}
|
|
145
|
+
},
|
|
146
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
137
147
|
},
|
|
138
148
|
|
|
139
149
|
[OidcAuthStep.Ephemeral]: {
|
|
@@ -141,7 +151,8 @@ export const stdOidcFlow: ShallowFlow = {
|
|
|
141
151
|
step: OidcAuthStep.Ephemeral,
|
|
142
152
|
service: TARGET_SERVICE,
|
|
143
153
|
module: '$dispatcher',
|
|
144
|
-
transitions: {}
|
|
154
|
+
transitions: {},
|
|
155
|
+
payloadMap: { [SIMPLIFIED_PAYLOAD]: 0 }
|
|
145
156
|
}
|
|
146
157
|
|
|
147
158
|
}
|
package/src/state.ts
CHANGED
|
@@ -45,11 +45,20 @@ export const makeFlowModel = async (flow: string | ShallowFlow, provider?: FlowP
|
|
|
45
45
|
|
|
46
46
|
setState: _state => {
|
|
47
47
|
state = _state
|
|
48
|
-
return model
|
|
48
|
+
return model
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
payload: () => state!.payload ?? {} as any,
|
|
52
52
|
|
|
53
|
+
updatePayload: payload => {
|
|
54
|
+
if (state!.payload == null) {
|
|
55
|
+
state!.payload = payload
|
|
56
|
+
} else {
|
|
57
|
+
Object.assign(state!.payload, payload)
|
|
58
|
+
}
|
|
59
|
+
return model
|
|
60
|
+
},
|
|
61
|
+
|
|
53
62
|
step: step => flow.steps[step ?? state!.step],
|
|
54
63
|
|
|
55
64
|
enter: step => {
|
|
@@ -125,10 +134,11 @@ export const makeFlowModel = async (flow: string | ShallowFlow, provider?: FlowP
|
|
|
125
134
|
delete state!.message
|
|
126
135
|
}
|
|
127
136
|
if (payload != null) {
|
|
128
|
-
|
|
129
|
-
|
|
137
|
+
model.updatePayload(payload)
|
|
138
|
+
// state!.payload = payload
|
|
139
|
+
} /*else if (state!.payload != null) {
|
|
130
140
|
delete state!.payload
|
|
131
|
-
}
|
|
141
|
+
}*/
|
|
132
142
|
|
|
133
143
|
return serializeState(flow, state!)
|
|
134
144
|
},
|
package/src/types.ts
CHANGED
|
@@ -81,6 +81,7 @@ export interface FlowModel {
|
|
|
81
81
|
state: () => FlowState
|
|
82
82
|
setState: (state: FlowState | null) => FlowModel
|
|
83
83
|
payload: <T extends FlowPayload>() => T
|
|
84
|
+
updatePayload: (payload: FlowPayload) => FlowModel
|
|
84
85
|
step: (step?: string) => FlowStep
|
|
85
86
|
transitions: (explicit?: boolean) => FlowTransition[]
|
|
86
87
|
transition: (transition: string) => FlowTransition
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": [
|
|
3
|
-
"
|
|
3
|
+
"@owlmeans/dep-config/tsconfig.base.json"
|
|
4
4
|
],
|
|
5
5
|
"compilerOptions": {
|
|
6
|
-
"rootDir": "./src/",
|
|
7
|
-
"outDir": "./build/"
|
|
8
|
-
"moduleResolution": "Bundler"
|
|
6
|
+
"rootDir": "./src/",
|
|
7
|
+
"outDir": "./build/"
|
|
9
8
|
},
|
|
10
|
-
"exclude": [
|
|
11
|
-
|
|
12
|
-
"./build/**/*",
|
|
13
|
-
"./*.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
|
9
|
+
"exclude": ["./dist/**/*", "./build/**/*", "./*.ts"]
|
|
10
|
+
}
|