gdc-sdk-front-ts 0.8.0 → 0.8.1

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 CHANGED
@@ -78,6 +78,7 @@ Recommended entry point:
78
78
 
79
79
  Main references:
80
80
 
81
+ - [gdc-common-utils-ts/docs/101-EMPLOYEE_ENTRY_EDITOR.md](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/main/docs/101-EMPLOYEE_ENTRY_EDITOR.md)
81
82
  - [gdc-sdk-core-ts/docs/101-EMPLOYEES.md](https://github.com/Global-DataCare/gdc-sdk-core-ts/blob/main/docs/101-EMPLOYEES.md)
82
83
  - [gdc-sdk-core-ts/docs/101-CONSENT_COMMUNICATION.md](https://github.com/Global-DataCare/gdc-sdk-core-ts/blob/main/docs/101-CONSENT_COMMUNICATION.md)
83
84
  - [gdc-common-utils-ts/docs/101-CONSENT_ACCESS.md](https://github.com/Global-DataCare/gdc-common-utils-ts/blob/main/docs/101-CONSENT_ACCESS.md)
@@ -134,9 +135,11 @@ import {
134
135
  // This editor lives only in frontend memory.
135
136
  // It helps the UI build the canonical employee payload before sending it to
136
137
  // the portal backend.
137
- const employeeEntry = new BundleEditor()
138
+ const bundle = new BundleEditor()
138
139
  .setBundleOperation(EmployeeBundleOperations.create)
139
- .setAllowedResourceType(EmployeeResourceTypes.employee)
140
+ .setAllowedResourceType(EmployeeResourceTypes.employee);
141
+
142
+ const employeeEntry = bundle
140
143
  .newEntry()
141
144
  .asEmployee()
142
145
  .setEmail(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
@@ -147,7 +150,9 @@ const employeeEntry = new BundleEditor()
147
150
  // Your Vite frontend normally sends this bundle to its own backend, not
148
151
  // directly to GW CORE.
149
152
  const generatedEmployeeIdentifier = employeeEntry.getIdentifier();
150
- const employeeCreateBatchBundle = employeeEntry.doneEntry().build();
153
+ employeeEntry.doneEntry();
154
+
155
+ const employeeCreateBatchBundle = bundle.build();
151
156
  console.log(employeeCreateBatchBundle);
152
157
  ```
153
158
 
@@ -157,16 +162,20 @@ flow can generate one and keep it in the same editor:
157
162
  ```ts
158
163
  import { EmployeeBundleOperations } from 'gdc-common-utils-ts/utils/employee';
159
164
 
160
- const employeeEntry = new BundleEditor()
165
+ const bundle = new BundleEditor()
161
166
  .setBundleOperation(EmployeeBundleOperations.create)
162
- .setAllowedResourceType(EmployeeResourceTypes.employee)
167
+ .setAllowedResourceType(EmployeeResourceTypes.employee);
168
+
169
+ const employeeEntry = bundle
163
170
  .newEntry()
164
171
  .asEmployee()
165
172
  .setEmail(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
166
173
  .setRole(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.role);
167
174
 
168
175
  const generatedEmployeeIdentifier = employeeEntry.getIdentifier();
169
- const employeeCreateBatchBundle = employeeEntry.doneEntry().build();
176
+ employeeEntry.doneEntry();
177
+
178
+ const employeeCreateBatchBundle = bundle.build();
170
179
  ```
171
180
 
172
181
  If a frontend needs explicit claim-level control instead of only `setEmail()` /
@@ -184,9 +193,11 @@ import {
184
193
  EmployeeResourceTypes,
185
194
  } from 'gdc-common-utils-ts/utils/employee';
186
195
 
187
- const employeeEntry = new BundleEditor()
196
+ const bundle = new BundleEditor()
188
197
  .setBundleOperation(EmployeeBundleOperations.create)
189
- .setAllowedResourceType(EmployeeResourceTypes.employee)
198
+ .setAllowedResourceType(EmployeeResourceTypes.employee);
199
+
200
+ const employeeEntry = bundle
190
201
  .newEntry(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.identifier)
191
202
  .asEmployee()
192
203
  .setClaim(ClaimsPersonSchemaorg.email, EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
@@ -195,7 +206,9 @@ const employeeEntry = new BundleEditor()
195
206
 
196
207
  console.log(employeeEntry.getClaim(ClaimsPersonSchemaorg.email));
197
208
 
198
- const employeeCreateBatchBundle = employeeEntry.doneEntry().build();
209
+ employeeEntry.doneEntry();
210
+
211
+ const employeeCreateBatchBundle = bundle.build();
199
212
  ```
200
213
 
201
214
  ### Search
@@ -212,15 +225,18 @@ import {
212
225
  EmployeeResourceTypes,
213
226
  } from 'gdc-common-utils-ts/utils/employee';
214
227
 
215
- const employeeSearchBundle = new BundleEditor()
228
+ const bundle = new BundleEditor()
216
229
  .setBundleOperation(EmployeeBundleOperations.search)
217
- .setAllowedResourceType(EmployeeResourceTypes.employee)
230
+ .setAllowedResourceType(EmployeeResourceTypes.employee);
231
+
232
+ bundle
218
233
  .newEntry()
219
234
  .asEmployee()
220
235
  .setEmail(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.email)
221
236
  .setRole(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.role)
222
- .doneEntry()
223
- .build();
237
+ .doneEntry();
238
+
239
+ const employeeSearchBundle = bundle.build();
224
240
 
225
241
  console.log(employeeSearchBundle);
226
242
  ```
@@ -245,13 +261,16 @@ import {
245
261
  EmployeeResourceTypes,
246
262
  } from 'gdc-common-utils-ts/utils/employee';
247
263
 
248
- const employeeDisableBatchBundle = new BundleEditor()
264
+ const bundle = new BundleEditor()
249
265
  .setBundleOperation(EmployeeBundleOperations.disable)
250
- .setAllowedResourceType(EmployeeResourceTypes.employee)
266
+ .setAllowedResourceType(EmployeeResourceTypes.employee);
267
+
268
+ bundle
251
269
  .newEntry(EXAMPLE_EMPLOYEE_DOCTOR_ACTIVE.identifier)
252
270
  .asEmployee()
253
- .doneEntry()
254
- .build();
271
+ .doneEntry();
272
+
273
+ const employeeDisableBatchBundle = bundle.build();
255
274
 
256
275
  console.log(employeeDisableBatchBundle);
257
276
  ```
@@ -198,6 +198,9 @@ export class ProfileManager {
198
198
  return new OrganizationControllerSdk(this.runtimeClient);
199
199
  }
200
200
  asOrganizationEmployee() {
201
+ if (this.profile.appType !== 'Organization') {
202
+ throw new Error('OrganizationEmployeeSdk is not available for this profile.');
203
+ }
201
204
  return new OrganizationEmployeeSdk(this.runtimeClient);
202
205
  }
203
206
  asIndividualController() {
@@ -217,7 +220,7 @@ export class ProfileManager {
217
220
  return new PersonalSdk(this.runtimeClient);
218
221
  }
219
222
  asProfessional() {
220
- if (!this.professional?.physician && !this.professional?.paramedic && !this.individual?.service) {
223
+ if (!this.professional?.physician && !this.professional?.paramedic) {
221
224
  throw new Error('ProfessionalSdk is not available for this profile.');
222
225
  }
223
226
  return new ProfessionalSdk(this.runtimeClient);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-sdk-front-ts",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
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.",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@babel/runtime": "^7.28.4",
20
20
  "gdc-common-utils-ts": "^1.16.0",
21
- "gdc-sdk-core-ts": "^0.8.0"
21
+ "gdc-sdk-core-ts": "^0.8.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^20.14.10",