gdc-sdk-front-ts 0.7.0 → 0.8.0
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/README.md +53 -19
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ Main references:
|
|
|
86
86
|
|
|
87
87
|
Use:
|
|
88
88
|
|
|
89
|
-
- `BundleEditor` for employee create/search/disable/purge payloads
|
|
89
|
+
- `BundleEditor` plus `EmployeeEntryEditor` for employee create/search/disable/purge payloads
|
|
90
90
|
- `CommunicationAttachedBundleSession` for `Communication`-carried bundles
|
|
91
91
|
- `createConsentAccessEditor(...)` for consent editing inside a communication bundle
|
|
92
92
|
|
|
@@ -114,7 +114,7 @@ Those actor families should start from their own business flow:
|
|
|
114
114
|
|
|
115
115
|
### Create
|
|
116
116
|
|
|
117
|
-
Use `BundleEditor` to prepare one employee create bundle. The browser
|
|
117
|
+
Use `BundleEditor` plus one employee entry editor to prepare one employee create bundle. The browser
|
|
118
118
|
does not send it directly to GW CORE.
|
|
119
119
|
The portal backend wraps it into its own request/envelope, then applies KMS,
|
|
120
120
|
DIDComm, submit, and poll.
|
|
@@ -126,14 +126,19 @@ import {
|
|
|
126
126
|
EXAMPLE_PROVIDER_ORGANIZATION_DID,
|
|
127
127
|
} from 'gdc-common-utils-ts/examples';
|
|
128
128
|
import { ClaimsPersonSchemaorg } from 'gdc-common-utils-ts/constants/schemaorg';
|
|
129
|
-
import {
|
|
129
|
+
import {
|
|
130
|
+
EmployeeBundleOperations,
|
|
131
|
+
EmployeeResourceTypes,
|
|
132
|
+
} from 'gdc-common-utils-ts/utils/employee';
|
|
130
133
|
|
|
131
134
|
// This editor lives only in frontend memory.
|
|
132
135
|
// It helps the UI build the canonical employee payload before sending it to
|
|
133
136
|
// the portal backend.
|
|
134
|
-
const
|
|
137
|
+
const employeeEntry = new BundleEditor()
|
|
135
138
|
.setBundleOperation(EmployeeBundleOperations.create)
|
|
139
|
+
.setAllowedResourceType(EmployeeResourceTypes.employee)
|
|
136
140
|
.newEntry()
|
|
141
|
+
.asEmployee()
|
|
137
142
|
.setEmail(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
|
|
138
143
|
.setRole(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.role)
|
|
139
144
|
.addClaim(ClaimsPersonSchemaorg.memberOf, EXAMPLE_PROVIDER_ORGANIZATION_DID);
|
|
@@ -141,8 +146,8 @@ const bundle = new BundleEditor()
|
|
|
141
146
|
// `employeeCreateBatchBundle` is the canonical one-entry employee `_batch` bundle.
|
|
142
147
|
// Your Vite frontend normally sends this bundle to its own backend, not
|
|
143
148
|
// directly to GW CORE.
|
|
144
|
-
const generatedEmployeeIdentifier =
|
|
145
|
-
const employeeCreateBatchBundle =
|
|
149
|
+
const generatedEmployeeIdentifier = employeeEntry.getIdentifier();
|
|
150
|
+
const employeeCreateBatchBundle = employeeEntry.doneEntry().build();
|
|
146
151
|
console.log(employeeCreateBatchBundle);
|
|
147
152
|
```
|
|
148
153
|
|
|
@@ -152,14 +157,16 @@ flow can generate one and keep it in the same editor:
|
|
|
152
157
|
```ts
|
|
153
158
|
import { EmployeeBundleOperations } from 'gdc-common-utils-ts/utils/employee';
|
|
154
159
|
|
|
155
|
-
const
|
|
160
|
+
const employeeEntry = new BundleEditor()
|
|
156
161
|
.setBundleOperation(EmployeeBundleOperations.create)
|
|
162
|
+
.setAllowedResourceType(EmployeeResourceTypes.employee)
|
|
157
163
|
.newEntry()
|
|
164
|
+
.asEmployee()
|
|
158
165
|
.setEmail(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
|
|
159
166
|
.setRole(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.role);
|
|
160
167
|
|
|
161
|
-
const
|
|
162
|
-
const
|
|
168
|
+
const generatedEmployeeIdentifier = employeeEntry.getIdentifier();
|
|
169
|
+
const employeeCreateBatchBundle = employeeEntry.doneEntry().build();
|
|
163
170
|
```
|
|
164
171
|
|
|
165
172
|
If a frontend needs explicit claim-level control instead of only `setEmail()` /
|
|
@@ -172,18 +179,23 @@ import {
|
|
|
172
179
|
EXAMPLE_PROVIDER_ORGANIZATION_DID,
|
|
173
180
|
} from 'gdc-common-utils-ts/examples';
|
|
174
181
|
import { ClaimsPersonSchemaorg } from 'gdc-common-utils-ts/constants/schemaorg';
|
|
175
|
-
import {
|
|
182
|
+
import {
|
|
183
|
+
EmployeeBundleOperations,
|
|
184
|
+
EmployeeResourceTypes,
|
|
185
|
+
} from 'gdc-common-utils-ts/utils/employee';
|
|
176
186
|
|
|
177
|
-
const
|
|
187
|
+
const employeeEntry = new BundleEditor()
|
|
178
188
|
.setBundleOperation(EmployeeBundleOperations.create)
|
|
189
|
+
.setAllowedResourceType(EmployeeResourceTypes.employee)
|
|
179
190
|
.newEntry(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.identifier)
|
|
191
|
+
.asEmployee()
|
|
180
192
|
.setClaim(ClaimsPersonSchemaorg.email, EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
|
|
181
193
|
.setClaim(ClaimsPersonSchemaorg.hasOccupationalRoleValue, EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.role)
|
|
182
194
|
.addClaim(ClaimsPersonSchemaorg.memberOf, EXAMPLE_PROVIDER_ORGANIZATION_DID);
|
|
183
195
|
|
|
184
|
-
console.log(
|
|
196
|
+
console.log(employeeEntry.getClaim(ClaimsPersonSchemaorg.email));
|
|
185
197
|
|
|
186
|
-
const employeeCreateBatchBundle =
|
|
198
|
+
const employeeCreateBatchBundle = employeeEntry.doneEntry().build();
|
|
187
199
|
```
|
|
188
200
|
|
|
189
201
|
### Search
|
|
@@ -195,11 +207,16 @@ Search is a different operation and should be built separately.
|
|
|
195
207
|
```ts
|
|
196
208
|
import { BundleEditor } from 'gdc-sdk-core-ts';
|
|
197
209
|
import { EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE } from 'gdc-common-utils-ts/examples';
|
|
198
|
-
import {
|
|
210
|
+
import {
|
|
211
|
+
EmployeeBundleOperations,
|
|
212
|
+
EmployeeResourceTypes,
|
|
213
|
+
} from 'gdc-common-utils-ts/utils/employee';
|
|
199
214
|
|
|
200
215
|
const employeeSearchBundle = new BundleEditor()
|
|
201
216
|
.setBundleOperation(EmployeeBundleOperations.search)
|
|
217
|
+
.setAllowedResourceType(EmployeeResourceTypes.employee)
|
|
202
218
|
.newEntry()
|
|
219
|
+
.asEmployee()
|
|
203
220
|
.setEmail(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
|
|
204
221
|
.setRole(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.role)
|
|
205
222
|
.doneEntry()
|
|
@@ -223,11 +240,16 @@ produces the canonical `_batch` bundle with inner `request.method = DELETE`.
|
|
|
223
240
|
```ts
|
|
224
241
|
import { BundleEditor } from 'gdc-sdk-core-ts';
|
|
225
242
|
import { EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE } from 'gdc-common-utils-ts/examples';
|
|
226
|
-
import {
|
|
243
|
+
import {
|
|
244
|
+
EmployeeBundleOperations,
|
|
245
|
+
EmployeeResourceTypes,
|
|
246
|
+
} from 'gdc-common-utils-ts/utils/employee';
|
|
227
247
|
|
|
228
248
|
const employeeDisableBatchBundle = new BundleEditor()
|
|
229
249
|
.setBundleOperation(EmployeeBundleOperations.disable)
|
|
250
|
+
.setAllowedResourceType(EmployeeResourceTypes.employee)
|
|
230
251
|
.newEntry(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.identifier)
|
|
252
|
+
.asEmployee()
|
|
231
253
|
.doneEntry()
|
|
232
254
|
.build();
|
|
233
255
|
|
|
@@ -250,7 +272,9 @@ import { EmployeeBundleOperations } from 'gdc-common-utils-ts/utils/employee';
|
|
|
250
272
|
|
|
251
273
|
const employeeDisablePatchBatchBundle = new BundleEditor()
|
|
252
274
|
.setBundleOperation(EmployeeBundleOperations.disable)
|
|
253
|
-
.
|
|
275
|
+
.setAllowedResourceType(EmployeeResourceTypes.employee)
|
|
276
|
+
.newEntry(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.identifier)
|
|
277
|
+
.asEmployee();
|
|
254
278
|
```
|
|
255
279
|
|
|
256
280
|
Business meaning:
|
|
@@ -270,11 +294,16 @@ the employee `identifier`.
|
|
|
270
294
|
```ts
|
|
271
295
|
import { BundleEditor } from 'gdc-sdk-core-ts';
|
|
272
296
|
import { EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE } from 'gdc-common-utils-ts/examples';
|
|
273
|
-
import {
|
|
297
|
+
import {
|
|
298
|
+
EmployeeBundleOperations,
|
|
299
|
+
EmployeeResourceTypes,
|
|
300
|
+
} from 'gdc-common-utils-ts/utils/employee';
|
|
274
301
|
|
|
275
302
|
const employeePurgeBundle = new BundleEditor()
|
|
276
303
|
.setBundleOperation(EmployeeBundleOperations.purge)
|
|
304
|
+
.setAllowedResourceType(EmployeeResourceTypes.employee)
|
|
277
305
|
.newEntry(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.identifier)
|
|
306
|
+
.asEmployee()
|
|
278
307
|
.doneEntry()
|
|
279
308
|
.build();
|
|
280
309
|
|
|
@@ -328,7 +357,10 @@ import {
|
|
|
328
357
|
EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE,
|
|
329
358
|
EXAMPLE_PROFILE_SESSION_INPUT,
|
|
330
359
|
} from 'gdc-common-utils-ts/examples';
|
|
331
|
-
import {
|
|
360
|
+
import {
|
|
361
|
+
EmployeeBundleOperations,
|
|
362
|
+
EmployeeResourceTypes,
|
|
363
|
+
} from 'gdc-common-utils-ts/utils/employee';
|
|
332
364
|
|
|
333
365
|
const appId = frontendAppConfig.appId;
|
|
334
366
|
const client = new ClientSDK({ appId });
|
|
@@ -338,10 +370,12 @@ const client = new ClientSDK({ appId });
|
|
|
338
370
|
// can later expose organization-controller/professional capabilities.
|
|
339
371
|
const session = await client.initializeSession(EXAMPLE_PROFILE_SESSION_INPUT);
|
|
340
372
|
|
|
341
|
-
// The shared editor from sdk-core is still used to model the employee bundle.
|
|
373
|
+
// The shared bundle editor from sdk-core is still used to model the employee bundle.
|
|
342
374
|
const employeeSearchBundle = new BundleEditor()
|
|
343
375
|
.setBundleOperation(EmployeeBundleOperations.search)
|
|
376
|
+
.setAllowedResourceType(EmployeeResourceTypes.employee)
|
|
344
377
|
.newEntry()
|
|
378
|
+
.asEmployee()
|
|
345
379
|
.setEmail(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
|
|
346
380
|
.setRole(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.role)
|
|
347
381
|
.doneEntry()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdc-sdk-front-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Next-generation frontend runtime package for the GDC SDK family",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Antifraud Services Inc.",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.28.4",
|
|
20
|
-
"gdc-common-utils-ts": "^1.
|
|
21
|
-
"gdc-sdk-core-ts": "^0.
|
|
20
|
+
"gdc-common-utils-ts": "^1.16.0",
|
|
21
|
+
"gdc-sdk-core-ts": "^0.8.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^20.14.10",
|