@burgan-tech/morph-idm-runtime 0.0.2 → 0.0.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.
Files changed (24) hide show
  1. package/burgan-tech-morph-idm-runtime-0.0.3.tgz +0 -0
  2. package/morph-idm/Schemas/client/client-update-1.0.0.json +263 -0
  3. package/morph-idm/Tasks/{user/send-push-task.json → user-login/push-send-task.json} +2 -2
  4. package/morph-idm/Workflows/client/client-1.0.0.json +7 -2
  5. package/morph-idm/Workflows/client/execute/client-update.http +763 -0
  6. package/morph-idm/Workflows/client/execute/client.http +12 -4
  7. package/morph-idm/Workflows/client/src/CreateRsaByHttpCallMapping.csx +10 -14
  8. package/morph-idm/Workflows/user/src/SendOtpSmsMapping.csx +3 -2
  9. package/morph-idm/Workflows/user-login/src/DeviceSearchMapping.csx +11 -3
  10. package/morph-idm/Workflows/user-login/src/PasswordVerifyMapping.csx +7 -4
  11. package/morph-idm/Workflows/user-login/src/PushSendMapping.csx +101 -0
  12. package/morph-idm/Workflows/user-login/src/ScopesByUserGetMapping.csx +7 -5
  13. package/morph-idm/Workflows/user-login/user-login.1.0.0.json +8 -7
  14. package/package.json +1 -1
  15. package/vnext.config.json +1 -1
  16. package/burgan-tech-morph-idm-runtime-0.0.2.tgz +0 -0
  17. package/morph-idm/Schemas/client/client-update-master-1.0.0.json +0 -201
  18. package/morph-idm/Workflows/client/client-update-1.0.0.json +0 -202
  19. package/morph-idm/Workflows/client-manager/client-manager-1.0.0.json +0 -217
  20. package/morph-idm/Workflows/client-manager/execute/client-manager.http +0 -214
  21. package/morph-idm/Workflows/client-manager/src/ClientCreatedRule.csx +0 -28
  22. package/morph-idm/Workflows/client-manager/src/ClientExistsRule.csx +0 -25
  23. package/morph-idm/Workflows/client-manager/src/CreateClientSubFlowMapping.csx +0 -63
  24. package/morph-idm/Workflows/client-manager/src/GetClientForManagerMapping.csx +0 -59
@@ -1,214 +0,0 @@
1
- ### Variables
2
- @workflow = client-manager
3
-
4
- ### ==========================================
5
- ### SCENARIO 1: Client Exists - Get Existing
6
- ### ==========================================
7
-
8
- @existingClientId = IbWeb
9
-
10
- ### Get or Create Client - Existing Client
11
- # @name getExistingClient
12
- POST {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/start?sync=true
13
- Accept-Language: tr-TR
14
- X-Request-Id: {{$guid}}
15
- X-Device-Id: {{$guid}}
16
- X-Token-Id: {{$guid}}
17
- X-Device-Info: Admin Portal/1.0
18
- X-Forwarded-For: 192.168.1.100
19
- user_reference: admin-001
20
- Content-Type: application/json
21
-
22
- {
23
- "key": "manager-{{existingClientId}}-{{$timestamp}}",
24
- "tags": [
25
- "client-manager",
26
- "get-existing"
27
- ],
28
- "attributes": {
29
- "clientId": "{{existingClientId}}"
30
- }
31
- }
32
-
33
- ###
34
- @existingInstanceId = {{getExistingClient.response.body.id}}
35
-
36
- ### Get Manager Instance State (Should be: client-ready)
37
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{existingInstanceId}}/functions/state
38
- Accept-Language: tr-TR
39
- X-Request-Id: {{$guid}}
40
- X-Device-Id: {{$guid}}
41
- X-Token-Id: {{$guid}}
42
- user_reference: admin-001
43
-
44
- ### Get Manager Instance Data (Should contain existingClient)
45
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{existingInstanceId}}/functions/data
46
- Accept-Language: tr-TR
47
- X-Request-Id: {{$guid}}
48
- X-Device-Id: {{$guid}}
49
- X-Token-Id: {{$guid}}
50
- user_reference: admin-001
51
-
52
-
53
- ### ==========================================
54
- ### SCENARIO 2: Client Not Exists - Create New
55
- ### ==========================================
56
-
57
- @newClientId = NewMobileApp
58
-
59
- ### Get or Create Client - New Client with Default Config
60
- # @name createNewClientDefault
61
- POST {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/start?sync=true
62
- Accept-Language: tr-TR
63
- X-Request-Id: {{$guid}}
64
- X-Device-Id: {{$guid}}
65
- X-Token-Id: {{$guid}}
66
- X-Device-Info: Admin Portal/1.0
67
- X-Forwarded-For: 192.168.1.100
68
- user_reference: admin-001
69
- Content-Type: application/json
70
-
71
- {
72
- "key": "manager-{{newClientId}}-{{$timestamp}}",
73
- "tags": [
74
- "client-manager",
75
- "create-new"
76
- ],
77
- "attributes": {
78
- "clientId": "{{newClientId}}"
79
- }
80
- }
81
-
82
- ###
83
- @newClientInstanceId = {{createNewClientDefault.response.body.id}}
84
-
85
- ### Get Manager Instance State (Should be: client-ready after creation)
86
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{newClientInstanceId}}/functions/state
87
- Accept-Language: tr-TR
88
- X-Request-Id: {{$guid}}
89
- X-Device-Id: {{$guid}}
90
- X-Token-Id: {{$guid}}
91
- user_reference: admin-001
92
-
93
- ### Get Manager Instance Data (Should contain createdClient)
94
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{newClientInstanceId}}/functions/data
95
- Accept-Language: tr-TR
96
- X-Request-Id: {{$guid}}
97
- X-Device-Id: {{$guid}}
98
- X-Token-Id: {{$guid}}
99
- user_reference: admin-001
100
-
101
-
102
- ### ==========================================
103
- ### SCENARIO 3: Create New Client with Full Config
104
- ### ==========================================
105
-
106
- @customClientId = CustomWebApp
107
-
108
- ### Get or Create Client - New Client with Custom Config
109
- # @name createNewClientCustom
110
- POST {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/start?sync=true
111
- Accept-Language: tr-TR
112
- X-Request-Id: {{$guid}}
113
- X-Device-Id: {{$guid}}
114
- X-Token-Id: {{$guid}}
115
- X-Device-Info: Admin Portal/1.0
116
- X-Forwarded-For: 192.168.1.100
117
- user_reference: admin-001
118
- Content-Type: application/json
119
-
120
- {
121
- "key": "manager-{{customClientId}}-{{$timestamp}}",
122
- "tags": [
123
- "client-manager",
124
- "create-custom"
125
- ],
126
- "attributes": {
127
- "clientId": "{{customClientId}}",
128
- "tags": ["web", "spa", "custom"],
129
- "clientConfig": {
130
- "allowedGrants": [
131
- "authorization_code",
132
- "refresh_token",
133
- "client_credentials"
134
- ],
135
- "clientType": "public",
136
- "applicationType": "spa",
137
- "allowedScopeGroups": [
138
- "IbCustomer",
139
- "CorporateCustomer"
140
- ],
141
- "redirectUris": [
142
- "https://myapp.com/callback",
143
- "https://myapp.com/silent-callback"
144
- ],
145
- "allowedOrigins": [
146
- "https://myapp.com"
147
- ],
148
- "tokens": [
149
- {
150
- "type": "access",
151
- "duration": "PT15M"
152
- },
153
- {
154
- "type": "refresh",
155
- "duration": "P7D"
156
- },
157
- {
158
- "type": "identity",
159
- "duration": "PT1H"
160
- }
161
- ],
162
- "pkce": {
163
- "mode": "must",
164
- "codeChallengeMethods": ["S256"],
165
- "defaultMethod": "S256"
166
- },
167
- "clientName": "Custom Web Application",
168
- "clientUri": "https://myapp.com",
169
- "logoUri": "https://myapp.com/logo.png"
170
- }
171
- }
172
- }
173
-
174
- ###
175
- @customClientInstanceId = {{createNewClientCustom.response.body.id}}
176
-
177
- ### Get Manager Instance State
178
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{customClientInstanceId}}/functions/state
179
- Accept-Language: tr-TR
180
- X-Request-Id: {{$guid}}
181
- X-Device-Id: {{$guid}}
182
- X-Token-Id: {{$guid}}
183
- user_reference: admin-001
184
-
185
- ### Get Manager Instance Data
186
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances/{{customClientInstanceId}}/functions/data
187
- Accept-Language: tr-TR
188
- X-Request-Id: {{$guid}}
189
- X-Device-Id: {{$guid}}
190
- X-Token-Id: {{$guid}}
191
- user_reference: admin-001
192
-
193
- ### Verify the created client directly
194
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/client/instances/{{customClientId}}/functions/data
195
- Accept-Language: tr-TR
196
- X-Request-Id: {{$guid}}
197
- X-Device-Id: {{$guid}}
198
- X-Token-Id: {{$guid}}
199
- user_reference: admin-001
200
-
201
-
202
- ### ==========================================
203
- ### UTILITY ENDPOINTS
204
- ### ==========================================
205
-
206
- ### Get All Client Manager Instances
207
- GET {{baseUrl}}/api/{{apiVersion}}/{{domain}}/workflows/{{workflow}}/instances
208
- Accept-Language: tr-TR
209
- X-Request-Id: {{$guid}}
210
- X-Device-Id: {{$guid}}
211
- X-Token-Id: {{$guid}}
212
- user_reference: admin-001
213
-
214
-
@@ -1,28 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Scripting;
3
- using BBT.Workflow.Scripting.Functions;
4
-
5
- public class ClientCreatedRule : ScriptBase, IConditionMapping
6
- {
7
- public async Task<bool> Handler(ScriptContext context)
8
- {
9
- // Check if client workflow completed successfully
10
- var createdClient = context.Instance?.Data?.createdClient;
11
-
12
- if (createdClient == null)
13
- {
14
- LogWarning("ClientCreatedRule: createdClient is null");
15
- return false;
16
- }
17
-
18
- // Check if client reached a valid state (draft or active)
19
- var clientState = createdClient?.attributes?.state?.key?.ToString();
20
-
21
- bool isCreated = clientState == "draft" || clientState == "active";
22
-
23
- LogInformation($"ClientCreatedRule: Client state = '{clientState}', isCreated = {isCreated}");
24
-
25
- return isCreated;
26
- }
27
- }
28
-
@@ -1,25 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Scripting;
3
- using BBT.Workflow.Scripting.Functions;
4
-
5
- public class ClientExistsRule : ScriptBase, IConditionMapping
6
- {
7
- public async Task<bool> Handler(ScriptContext context)
8
- {
9
- // Check if client was found in the database
10
- var clientFound = context.Instance?.Data?.clientFound;
11
-
12
- if (clientFound == null)
13
- {
14
- LogWarning("ClientExistsRule: clientFound flag not set");
15
- return false;
16
- }
17
-
18
- bool exists = (bool)clientFound;
19
-
20
- LogInformation($"ClientExistsRule: Client exists = {exists}");
21
-
22
- return exists;
23
- }
24
- }
25
-
@@ -1,63 +0,0 @@
1
- using System;
2
- using System.Dynamic;
3
- using System.Threading.Tasks;
4
- using BBT.Workflow.Definitions;
5
- using BBT.Workflow.Scripting;
6
- using BBT.Workflow.Scripting.Functions;
7
-
8
- public class CreateClientSubFlowMapping : ScriptBase, ISubFlowMapping
9
- {
10
- public Task<ScriptResponse> InputHandler(ScriptContext context)
11
- {
12
- // Pass through all client configuration from input
13
- // The caller should provide full client configuration in clientConfig
14
-
15
- dynamic expandoObject = new ExpandoObject();
16
-
17
- // Get client key
18
- expandoObject.key = context.Instance?.Data?.clientId?.ToString() ?? $"client-{Guid.NewGuid()}";
19
-
20
- // Get tags if provided
21
- expandoObject.tags = context.Instance?.Data?.tags ?? new[] { "auto-created" };
22
-
23
- // Get client configuration - this should be provided by caller
24
- if (HasProperty(context.Instance?.Data, "clientConfig"))
25
- {
26
- expandoObject.attributes = context.Instance.Data.clientConfig;
27
- }
28
- else
29
- {
30
- // Default minimal client configuration
31
- expandoObject.attributes = new
32
- {
33
- allowedGrants = new[] { "authorization_code", "refresh_token" },
34
- clientType = "confidential",
35
- allowedScopeGroups = new[] { "IbCustomer" }
36
- };
37
- }
38
-
39
- LogInformation($"CreateClientSubFlowMapping: Starting client workflow with key '{expandoObject.key}'");
40
-
41
- return Task.FromResult(new ScriptResponse
42
- {
43
- Data = expandoObject,
44
- Headers = null
45
- });
46
- }
47
-
48
- public async Task<ScriptResponse> OutputHandler(ScriptContext context)
49
- {
50
- // Store the created client information
51
- LogInformation("CreateClientSubFlowMapping: Client subflow completed");
52
-
53
- return new ScriptResponse
54
- {
55
- Data = new
56
- {
57
- createdClient = context.Body
58
- },
59
- Headers = null
60
- };
61
- }
62
- }
63
-
@@ -1,59 +0,0 @@
1
- using System.Threading.Tasks;
2
- using BBT.Workflow.Definitions;
3
- using BBT.Workflow.Scripting;
4
- using BBT.Workflow.Scripting.Functions;
5
-
6
- public class GetClientForManagerMapping : ScriptBase, IMapping
7
- {
8
- public Task<ScriptResponse> InputHandler(WorkflowTask task, ScriptContext context)
9
- {
10
- var triggerTask = (task as GetInstanceDataTask)!;
11
-
12
- // Get clientId from input
13
- var clientId = context.Instance?.Data?.clientId?.ToString() ?? string.Empty;
14
-
15
- LogInformation($"GetClientForManagerMapping: Looking for client '{clientId}'");
16
-
17
- triggerTask.SetKey(clientId);
18
- return Task.FromResult(new ScriptResponse());
19
- }
20
-
21
- public async Task<ScriptResponse> OutputHandler(ScriptContext context)
22
- {
23
- // Check if client was found
24
- if (HasProperty(context.Body, "data") && HasProperty(context.Body.data, "data"))
25
- {
26
- var clientData = context.Body.data.data;
27
-
28
- LogInformation($"GetClientForManagerMapping: Client found");
29
-
30
- return new ScriptResponse
31
- {
32
- Data = new
33
- {
34
- clientFound = true,
35
- existingClient = new
36
- {
37
- key = context.Body.data.key,
38
- state = context.Body.data.attributes?.state?.key,
39
- data = clientData
40
- }
41
- }
42
- };
43
- }
44
- else
45
- {
46
- LogInformation("GetClientForManagerMapping: Client not found, will create new one");
47
-
48
- return new ScriptResponse
49
- {
50
- Data = new
51
- {
52
- clientFound = false,
53
- existingClient = (object)null
54
- }
55
- };
56
- }
57
- }
58
- }
59
-