gdc-sdk-front-ts 0.10.1 → 2.0.2

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
@@ -1,5 +1,15 @@
1
1
  # gdc-sdk-front-ts
2
2
 
3
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) and
4
+ [CONTRIBUTING.md](./CONTRIBUTING.md) before adding frontend facades,
5
+ profile/session runtime logic, or orchestration tests.
6
+
7
+ Short rule:
8
+
9
+ - `101` tests must stay didactic and step by step
10
+ - reusable fixtures/types must come from `gdc-common-utils-ts` instead of
11
+ being repeated as frontend-local literals
12
+
3
13
  Frontend runtime package for consuming the shared GDC SDK contracts in web or
4
14
  mobile apps.
5
15
 
@@ -28,6 +38,13 @@ If you are integrating this package for the first time, open these in order:
28
38
  1. [gdc-sdk-core-ts/docs/101-SDK_PACKAGE_BOUNDARIES.md](https://github.com/Global-DataCare/gdc-sdk-core-ts/blob/main/docs/101-SDK_PACKAGE_BOUNDARIES.md)
29
39
  Why `core`, `node`, and `front` are separate packages, what each one owns,
30
40
  and why frontend facades should mirror backend actor boundaries.
41
+ 1. [tests/101-frontend-profile-runtime.test.mjs](./tests/101-frontend-profile-runtime.test.mjs)
42
+ Minimal frontend-generic walkthrough for loading one actor profile,
43
+ registering one trusted device/runtime context, connecting to one subject
44
+ index, and reading one subject index composition.
45
+ 1. [tests/101-individual-controller-frontend-runtime.test.mjs](./tests/101-individual-controller-frontend-runtime.test.mjs)
46
+ First pragmatic frontend wrapper over the generic profile runtime for the
47
+ current individual-controller baseline.
31
48
  1. [docs/101-SDK_INTEGRATION.md](./docs/101-SDK_INTEGRATION.md)
32
49
  Real frontend/native setup, imports, `new ClientSDK(...)`,
33
50
  `initializeCommunicationIdentity(...)`, provider discovery, and
@@ -0,0 +1,63 @@
1
+ import type { LoadedActorProfile, ProfileLoadRequest, SubjectIndexCompositionRequest, SubjectIndexConnectionRequest, TrustedDeviceRegistrationRequest } from 'gdc-sdk-core-ts';
2
+ /**
3
+ * Result of registering one trusted frontend device/runtime context.
4
+ */
5
+ export type FrontendTrustedDeviceRegistrationResult = {
6
+ trustedDeviceId: string;
7
+ status: 'registered' | 'already-trusted';
8
+ };
9
+ /**
10
+ * Result of connecting one loaded actor profile to one subject index from a
11
+ * frontend runtime.
12
+ */
13
+ export type FrontendSubjectIndexConnectionResult = {
14
+ subjectId: string;
15
+ userId: string;
16
+ userRoleCode: string;
17
+ status: 'connected' | 'already-connected';
18
+ };
19
+ /**
20
+ * Result of reading one subject index composition from a frontend runtime.
21
+ */
22
+ export type FrontendSubjectIndexCompositionResult = {
23
+ subjectId: string;
24
+ userId: string;
25
+ userRoleCode: string;
26
+ composition: unknown;
27
+ };
28
+ /**
29
+ * Canonical frontend runtime contract for:
30
+ * - loading one actor profile,
31
+ * - registering one trusted device/runtime context,
32
+ * - connecting one actor to one subject index, and
33
+ * - reading the resulting subject index composition.
34
+ */
35
+ export type FrontendProfileRuntimeClient = {
36
+ loadProfile?: (input: ProfileLoadRequest) => Promise<LoadedActorProfile>;
37
+ registerTrustedDevice?: (input: TrustedDeviceRegistrationRequest) => Promise<FrontendTrustedDeviceRegistrationResult>;
38
+ connectToSubjectIndex?: (input: SubjectIndexConnectionRequest) => Promise<FrontendSubjectIndexConnectionResult>;
39
+ getSubjectIndexComposition?: (input: SubjectIndexCompositionRequest) => Promise<FrontendSubjectIndexCompositionResult>;
40
+ };
41
+ export type FrontendProfileRuntimeAdapters = {
42
+ loadProfile(input: ProfileLoadRequest): Promise<LoadedActorProfile>;
43
+ registerTrustedDevice(input: TrustedDeviceRegistrationRequest): Promise<FrontendTrustedDeviceRegistrationResult>;
44
+ connectToSubjectIndex(input: SubjectIndexConnectionRequest): Promise<FrontendSubjectIndexConnectionResult>;
45
+ getSubjectIndexComposition(input: SubjectIndexCompositionRequest): Promise<FrontendSubjectIndexCompositionResult>;
46
+ };
47
+ /**
48
+ * Default frontend-generic profile runtime implementation backed by injected
49
+ * adapters.
50
+ */
51
+ export declare class FrontendProfileRuntime implements FrontendProfileRuntimeClient {
52
+ private readonly adapters;
53
+ constructor(adapters: FrontendProfileRuntimeAdapters);
54
+ loadProfile(input: ProfileLoadRequest): Promise<LoadedActorProfile>;
55
+ registerTrustedDevice(input: TrustedDeviceRegistrationRequest): Promise<FrontendTrustedDeviceRegistrationResult>;
56
+ connectToSubjectIndex(input: SubjectIndexConnectionRequest): Promise<FrontendSubjectIndexConnectionResult>;
57
+ getSubjectIndexComposition(input: SubjectIndexCompositionRequest): Promise<FrontendSubjectIndexCompositionResult>;
58
+ }
59
+ export declare function requireFrontendProfileRuntimeMethod<T extends keyof FrontendProfileRuntimeClient>(client: FrontendProfileRuntimeClient, method: T): NonNullable<FrontendProfileRuntimeClient[T]>;
60
+ export declare function loadFrontendProfile(client: FrontendProfileRuntimeClient, input: ProfileLoadRequest): Promise<LoadedActorProfile>;
61
+ export declare function registerFrontendTrustedDevice(client: FrontendProfileRuntimeClient, input: TrustedDeviceRegistrationRequest): Promise<FrontendTrustedDeviceRegistrationResult>;
62
+ export declare function connectFrontendToSubjectIndex(client: FrontendProfileRuntimeClient, input: SubjectIndexConnectionRequest): Promise<FrontendSubjectIndexConnectionResult>;
63
+ export declare function getFrontendSubjectIndexComposition(client: FrontendProfileRuntimeClient, input: SubjectIndexCompositionRequest): Promise<FrontendSubjectIndexCompositionResult>;
@@ -0,0 +1,41 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ /**
3
+ * Default frontend-generic profile runtime implementation backed by injected
4
+ * adapters.
5
+ */
6
+ export class FrontendProfileRuntime {
7
+ constructor(adapters) {
8
+ this.adapters = adapters;
9
+ }
10
+ async loadProfile(input) {
11
+ return this.adapters.loadProfile(input);
12
+ }
13
+ async registerTrustedDevice(input) {
14
+ return this.adapters.registerTrustedDevice(input);
15
+ }
16
+ async connectToSubjectIndex(input) {
17
+ return this.adapters.connectToSubjectIndex(input);
18
+ }
19
+ async getSubjectIndexComposition(input) {
20
+ return this.adapters.getSubjectIndexComposition(input);
21
+ }
22
+ }
23
+ export function requireFrontendProfileRuntimeMethod(client, method) {
24
+ const candidate = client[method];
25
+ if (typeof candidate !== 'function') {
26
+ throw new Error(`FrontendProfileRuntimeClient does not implement '${String(method)}'.`);
27
+ }
28
+ return candidate.bind(client);
29
+ }
30
+ export async function loadFrontendProfile(client, input) {
31
+ return requireFrontendProfileRuntimeMethod(client, 'loadProfile')(input);
32
+ }
33
+ export async function registerFrontendTrustedDevice(client, input) {
34
+ return requireFrontendProfileRuntimeMethod(client, 'registerTrustedDevice')(input);
35
+ }
36
+ export async function connectFrontendToSubjectIndex(client, input) {
37
+ return requireFrontendProfileRuntimeMethod(client, 'connectToSubjectIndex')(input);
38
+ }
39
+ export async function getFrontendSubjectIndexComposition(client, input) {
40
+ return requireFrontendProfileRuntimeMethod(client, 'getSubjectIndexComposition')(input);
41
+ }
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@ export * from './VerifierService.js';
11
11
  export * from './ProfileManager.js';
12
12
  export * from './ProfileRegistry.js';
13
13
  export * from './ClientSDK.js';
14
+ export * from './frontend-profile-runtime.js';
15
+ export * from './individual-controller-frontend-runtime.js';
14
16
  export * from './discovery/index.js';
15
17
  export * from './orchestration/client-port.js';
16
18
  export * from './orchestration/host-onboarding-sdk.js';
package/dist/index.js CHANGED
@@ -12,6 +12,8 @@ export * from './VerifierService.js';
12
12
  export * from './ProfileManager.js';
13
13
  export * from './ProfileRegistry.js';
14
14
  export * from './ClientSDK.js';
15
+ export * from './frontend-profile-runtime.js';
16
+ export * from './individual-controller-frontend-runtime.js';
15
17
  export * from './discovery/index.js';
16
18
  export * from './orchestration/client-port.js';
17
19
  export * from './orchestration/host-onboarding-sdk.js';
@@ -0,0 +1,50 @@
1
+ import type { SubmitAndPollResult } from 'gdc-sdk-core-ts';
2
+ import type { ProfileLoadRequest } from 'gdc-sdk-core-ts';
3
+ import { type FrontendProfileRuntimeClient } from './frontend-profile-runtime.js';
4
+ import { IndividualControllerSdk } from './orchestration/individual-controller-sdk.js';
5
+ import type { FrontClinicalBundleSearchInput, FrontIndividualOrganizationBootstrapInput, FrontIndividualOrganizationConfirmOrderInput, FrontIndividualOrganizationStartResult, FrontRouteContext, FrontRuntimeClient } from './orchestration/client-port.js';
6
+ import type { LoadedActorProfile } from 'gdc-sdk-core-ts';
7
+ export type FrontendIndividualControllerProfile = {
8
+ profile: LoadedActorProfile;
9
+ sdk: IndividualControllerSdk;
10
+ };
11
+ /**
12
+ * First pragmatic frontend use-case wrapper on top of the generic v2 profile
13
+ * runtime.
14
+ *
15
+ * It keeps the generic `loadProfile(...)` contract intact while giving portal
16
+ * or app code one narrower surface for the current individual-controller
17
+ * baseline.
18
+ */
19
+ export declare class IndividualControllerFrontendRuntime {
20
+ private readonly profileRuntime;
21
+ private readonly facadeClient;
22
+ constructor(profileRuntime: FrontendProfileRuntimeClient, facadeClient: FrontRuntimeClient);
23
+ /**
24
+ * Loads one frontend profile and ensures it exposes the individual-controller
25
+ * actor capability before materializing the facade.
26
+ */
27
+ loadProfile(input: ProfileLoadRequest): Promise<FrontendIndividualControllerProfile>;
28
+ /**
29
+ * Starts the current individual/family bootstrap flow from frontend code.
30
+ */
31
+ startIndividualOrganization(profile: FrontendIndividualControllerProfile, ctx: FrontRouteContext, input: FrontIndividualOrganizationBootstrapInput): Promise<FrontIndividualOrganizationStartResult>;
32
+ /**
33
+ * Confirms the order returned by the frontend bootstrap flow.
34
+ */
35
+ confirmIndividualOrganizationOrder(profile: FrontendIndividualControllerProfile, ctx: FrontRouteContext, input: FrontIndividualOrganizationConfirmOrderInput): Promise<SubmitAndPollResult>;
36
+ /**
37
+ * Searches the subject clinical index from the frontend individual-controller
38
+ * facade.
39
+ */
40
+ searchClinicalBundle(profile: FrontendIndividualControllerProfile, ctx: FrontRouteContext, input: FrontClinicalBundleSearchInput): Promise<{
41
+ thid: string;
42
+ }>;
43
+ /**
44
+ * Reads the latest IPS-oriented bundle from the frontend individual-controller
45
+ * facade.
46
+ */
47
+ getLatestIps(profile: FrontendIndividualControllerProfile, ctx: FrontRouteContext, subject: string): Promise<{
48
+ thid: string;
49
+ }>;
50
+ }
@@ -0,0 +1,58 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ import { ActorKinds } from 'gdc-common-utils-ts/constants/actor-session';
3
+ import { loadFrontendProfile, } from './frontend-profile-runtime.js';
4
+ import { IndividualControllerSdk } from './orchestration/individual-controller-sdk.js';
5
+ /**
6
+ * First pragmatic frontend use-case wrapper on top of the generic v2 profile
7
+ * runtime.
8
+ *
9
+ * It keeps the generic `loadProfile(...)` contract intact while giving portal
10
+ * or app code one narrower surface for the current individual-controller
11
+ * baseline.
12
+ */
13
+ export class IndividualControllerFrontendRuntime {
14
+ constructor(profileRuntime, facadeClient) {
15
+ this.profileRuntime = profileRuntime;
16
+ this.facadeClient = facadeClient;
17
+ }
18
+ /**
19
+ * Loads one frontend profile and ensures it exposes the individual-controller
20
+ * actor capability before materializing the facade.
21
+ */
22
+ async loadProfile(input) {
23
+ const profile = await loadFrontendProfile(this.profileRuntime, input);
24
+ if (!profile.session.actorKinds.includes(ActorKinds.IndividualController)) {
25
+ throw new Error('Loaded frontend profile does not expose actor kind \'individual_controller\'.');
26
+ }
27
+ return {
28
+ profile,
29
+ sdk: new IndividualControllerSdk(this.facadeClient),
30
+ };
31
+ }
32
+ /**
33
+ * Starts the current individual/family bootstrap flow from frontend code.
34
+ */
35
+ startIndividualOrganization(profile, ctx, input) {
36
+ return profile.sdk.startIndividualOrganization(ctx, input);
37
+ }
38
+ /**
39
+ * Confirms the order returned by the frontend bootstrap flow.
40
+ */
41
+ confirmIndividualOrganizationOrder(profile, ctx, input) {
42
+ return profile.sdk.confirmIndividualOrganizationOrder(ctx, input);
43
+ }
44
+ /**
45
+ * Searches the subject clinical index from the frontend individual-controller
46
+ * facade.
47
+ */
48
+ searchClinicalBundle(profile, ctx, input) {
49
+ return profile.sdk.searchClinicalBundle(ctx, input);
50
+ }
51
+ /**
52
+ * Reads the latest IPS-oriented bundle from the frontend individual-controller
53
+ * facade.
54
+ */
55
+ getLatestIps(profile, ctx, subject) {
56
+ return profile.sdk.getLatestIps(ctx, subject);
57
+ }
58
+ }
@@ -1,7 +1,8 @@
1
1
  import type { DeviceAppType, DeviceUserClass } from 'gdc-common-utils-ts/constants';
2
- import type { LicenseListSearchDraft, LicenseOfferSearchDraft, LicenseOrderSearchDraft } from 'gdc-common-utils-ts';
2
+ import type { LicenseListSearchState } from 'gdc-common-utils-ts/utils/license-list-search';
3
+ import type { LicenseOfferSearchState, LicenseOrderSearchState } from 'gdc-common-utils-ts/utils/license-commercial-search';
3
4
  import type { IndividualOnboardingDraftInput, IndividualOnboardingDraftResult } from 'gdc-common-utils-ts/models/individual-onboarding';
4
- import type { BundleSearchQuery, CommunicationInput, EmployeeSearchValue, HostLifecycleInput, HostRouteContext, HostedTenantLifecycleInput, LegalOrganizationOrderInput, PollOptions, SubmitAndPollResult, SubmitPayload } from 'gdc-sdk-core-ts';
5
+ import type { BundleSearchQuery, CommunicationInput, EmployeeSearchValue, HostLifecycleInput, HostRouteContext, HostedTenantLifecycleInput, OrganizationDidBindingInput, LegalOrganizationOrderInput, PollOptions, SubmitAndPollResult, SubmitPayload } from 'gdc-sdk-core-ts';
5
6
  export type FrontRouteContext = {
6
7
  providerDid: string;
7
8
  idToken: string;
@@ -22,6 +23,7 @@ export type FrontOrganizationActivationInput = {
22
23
  service?: Record<string, unknown>;
23
24
  additionalClaims?: Record<string, unknown>;
24
25
  };
26
+ export type FrontOrganizationDidBindingInput = OrganizationDidBindingInput;
25
27
  export type FrontLegalOrganizationOrderInput = {
26
28
  offerId: string;
27
29
  orderClaims?: Record<string, unknown>;
@@ -46,7 +48,7 @@ export type FrontOrganizationEmployeeSearchInput = {
46
48
  * Frontend/runtime search/list input for license seats.
47
49
  */
48
50
  export type FrontLicenseListSearchInput = {
49
- licenseQuery?: Partial<LicenseListSearchDraft>;
51
+ licenseQuery?: Partial<LicenseListSearchState>;
50
52
  requestThid?: string;
51
53
  pollOptions?: PollOptions;
52
54
  };
@@ -54,7 +56,7 @@ export type FrontLicenseListSearchInput = {
54
56
  * Frontend/runtime search/list input for commercial offer read-models.
55
57
  */
56
58
  export type FrontLicenseOfferSearchInput = {
57
- offerQuery?: Partial<LicenseOfferSearchDraft>;
59
+ offerQuery?: Partial<LicenseOfferSearchState>;
58
60
  requestThid?: string;
59
61
  pollOptions?: PollOptions;
60
62
  };
@@ -62,7 +64,7 @@ export type FrontLicenseOfferSearchInput = {
62
64
  * Frontend/runtime search/list input for commercial order/payment read-models.
63
65
  */
64
66
  export type FrontLicenseOrderSearchInput = {
65
- orderQuery?: Partial<LicenseOrderSearchDraft>;
67
+ orderQuery?: Partial<LicenseOrderSearchState>;
66
68
  requestThid?: string;
67
69
  pollOptions?: PollOptions;
68
70
  };
@@ -169,6 +171,7 @@ export type FrontRuntimeClient = {
169
171
  disableHost?: (hostCtx: HostRouteContext, input: HostLifecycleInput, pollOptions?: PollOptions) => Promise<SubmitAndPollResult>;
170
172
  purgeHost?: (hostCtx: HostRouteContext, input: HostLifecycleInput, pollOptions?: PollOptions) => Promise<SubmitAndPollResult>;
171
173
  createOrganizationEmployee?: (ctx: FrontRouteContext, input: FrontOrganizationEmployeeCreationInput, pollOptions?: PollOptions) => Promise<SubmitAndPollResult>;
174
+ submitOrganizationDidBinding?: (ctx: FrontRouteContext, input: FrontOrganizationDidBindingInput, pollOptions?: PollOptions) => Promise<SubmitAndPollResult>;
172
175
  disableEmployee?: (ctx: FrontRouteContext, input: FrontOrganizationEmployeeLifecycleInput, pollOptions?: PollOptions) => Promise<SubmitAndPollResult>;
173
176
  searchOrganizationEmployees?: (ctx: FrontRouteContext, input: FrontOrganizationEmployeeSearchInput) => Promise<SubmitAndPollResult>;
174
177
  searchOrganizationLicenses?: (ctx: FrontRouteContext, input: FrontLicenseListSearchInput) => Promise<SubmitAndPollResult>;
@@ -1,8 +1,21 @@
1
1
  import type { HostRouteContext, HostedTenantLifecycleInput, PollOptions, SubmitAndPollResult } from 'gdc-sdk-core-ts';
2
- import { type FrontEmployeeDeviceActivationRequestInput, type FrontLicenseListSearchInput, type FrontLicenseOfferSearchInput, type FrontLicenseOrderSearchInput, type FrontOrganizationEmployeeCreationInput, type FrontOrganizationEmployeeLifecycleInput, type FrontOrganizationEmployeeSearchInput, type FrontRouteContext, type FrontRuntimeClient, type FrontSmartTokenExchangeResult, type FrontSmartTokenRequestInput } from './client-port.js';
2
+ import { type FrontEmployeeDeviceActivationRequestInput, type FrontLicenseListSearchInput, type FrontLicenseOfferSearchInput, type FrontLicenseOrderSearchInput, type FrontOrganizationDidBindingInput, type FrontOrganizationEmployeeCreationInput, type FrontOrganizationEmployeeLifecycleInput, type FrontOrganizationEmployeeSearchInput, type FrontRouteContext, type FrontRuntimeClient, type FrontSmartTokenExchangeResult, type FrontSmartTokenRequestInput } from './client-port.js';
3
3
  export declare class OrganizationControllerSdk {
4
4
  private readonly client;
5
5
  constructor(client: FrontRuntimeClient);
6
+ /**
7
+ * Binds the current tenant organization DID document to one public alias
8
+ * view.
9
+ *
10
+ * Alias contract:
11
+ * - the current tenant path identifies the organization
12
+ * - `organization.url` carries the public alias/domain list
13
+ * - `controller.sameAs` is optional corroborating identity evidence
14
+ *
15
+ * Current version limits:
16
+ * - this binding flow does not accept new organization public keys
17
+ */
18
+ submitOrganizationDidBinding(ctx: FrontRouteContext, input: FrontOrganizationDidBindingInput, pollOptions?: PollOptions): Promise<SubmitAndPollResult>;
6
19
  createOrganizationEmployee(ctx: FrontRouteContext, input: FrontOrganizationEmployeeCreationInput, pollOptions?: PollOptions): Promise<SubmitAndPollResult>;
7
20
  disableEmployee(ctx: FrontRouteContext, input: FrontOrganizationEmployeeLifecycleInput, pollOptions?: PollOptions): Promise<SubmitAndPollResult>;
8
21
  searchOrganizationEmployees(ctx: FrontRouteContext, input: FrontOrganizationEmployeeSearchInput): Promise<SubmitAndPollResult>;
@@ -4,6 +4,21 @@ export class OrganizationControllerSdk {
4
4
  constructor(client) {
5
5
  this.client = client;
6
6
  }
7
+ /**
8
+ * Binds the current tenant organization DID document to one public alias
9
+ * view.
10
+ *
11
+ * Alias contract:
12
+ * - the current tenant path identifies the organization
13
+ * - `organization.url` carries the public alias/domain list
14
+ * - `controller.sameAs` is optional corroborating identity evidence
15
+ *
16
+ * Current version limits:
17
+ * - this binding flow does not accept new organization public keys
18
+ */
19
+ submitOrganizationDidBinding(ctx, input, pollOptions) {
20
+ return requireClientMethod(this.client, 'submitOrganizationDidBinding')(ctx, input, pollOptions);
21
+ }
7
22
  createOrganizationEmployee(ctx, input, pollOptions) {
8
23
  return requireClientMethod(this.client, 'createOrganizationEmployee')(ctx, input, pollOptions);
9
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-sdk-front-ts",
3
- "version": "0.10.1",
3
+ "version": "2.0.2",
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.24.1",
21
- "gdc-sdk-core-ts": "^0.11.1"
20
+ "gdc-common-utils-ts": "^2.0.4",
21
+ "gdc-sdk-core-ts": "^2.0.3"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^20.14.10",