gdc-common-utils-ts 2.9.9 → 2.9.10

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
@@ -554,8 +554,12 @@ The canonical API contract should live in JSDoc on exported code. The README act
554
554
  the document author; a registered PractitionerRole or RelatedPerson is the
555
555
  attester, including for content entered by that authenticated person.
556
556
  - [`normalizeClinicalCreatorBinding(...)`](src/utils/fhir-ips-creator-identity.ts)
557
- - Accept stable UUIDs and governed bare role codes at the BFF boundary, then
558
- add canonical UUID URNs and HL7/ISCO coding systems before transport.
557
+ - Accept stable person, assignment and owner UUIDs plus governed bare role
558
+ codes at the BFF boundary, then add canonical UUID URNs and HL7/ISCO coding
559
+ systems before transport. Use `assignmentIdentifier` for the registered
560
+ `RelatedPerson`/`PractitionerRole`; the deprecated wire property
561
+ `authorIdentifier` names that assignment and does not decide
562
+ `Composition.author`.
559
563
  - [`src/examples/frontend-session.ts`](src/examples/frontend-session.ts)
560
564
  - Frontend profile/session bootstrap examples.
561
565
  - [`src/examples/lifecycle.ts`](src/examples/lifecycle.ts)
@@ -12,7 +12,11 @@ export type FhirIpsCreatorBundleEntry = Readonly<{
12
12
  type FhirIpsCreatorBase = Readonly<{
13
13
  /** Stable imported or locally generated actor identifier. */
14
14
  actorIdentifier: string;
15
- /** Stable identifier referenced by Composition.author for this role/relationship. */
15
+ /**
16
+ * Historical API name for the stable role/relationship assignment identifier.
17
+ * Provenance uses this assignment as `Composition.attester.party`; it is not
18
+ * automatically the `Composition.author`.
19
+ */
16
20
  authorIdentifier: string;
17
21
  }>;
18
22
  export type FhirIpsCreatorAuthorInput = (FhirIpsCreatorBase & Readonly<{
@@ -93,8 +97,11 @@ type ClinicalCreatorChannelAliases = Readonly<{
93
97
  }>;
94
98
  /**
95
99
  * Durable clinical-creator identity stored behind the authenticated profile.
96
- * `actorIdentifier` identifies the person/member. `authorIdentifier` identifies
97
- * the concrete role or relationship assignment used as the FHIR author.
100
+ * `actorIdentifier` identifies the person/member. The historical wire property
101
+ * `authorIdentifier` identifies the concrete PractitionerRole/RelatedPerson
102
+ * assignment used as `Composition.attester.party`; it does not decide
103
+ * `Composition.author`. `ownerIdentifier` identifies the legal organization or
104
+ * individual organization/subject that owns that assignment.
98
105
  * Contacts, DCR clients, keys and operational DIDs are aliases only.
99
106
  */
100
107
  export type ClinicalCreatorBinding = ClinicalCreatorChannelAliases & Readonly<{
@@ -117,7 +124,10 @@ export type ClinicalCreatorBinding = ClinicalCreatorChannelAliases & Readonly<{
117
124
  export type ClinicalCreatorBindingInput = ClinicalCreatorChannelAliases & Readonly<{
118
125
  kind: FhirIpsCreatorKind;
119
126
  actorIdentifier: string;
120
- authorIdentifier: string;
127
+ /** Preferred high-level name for the PractitionerRole/RelatedPerson UUID. */
128
+ assignmentIdentifier?: string;
129
+ /** @deprecated Historical DCR/profile wire name; use `assignmentIdentifier`. */
130
+ authorIdentifier?: string;
121
131
  ownerIdentifier: string;
122
132
  role: string;
123
133
  }>;
@@ -129,13 +129,26 @@ export function buildFhirIpsCreatorAuthor(input) {
129
129
  */
130
130
  export function normalizeClinicalCreatorBinding(input) {
131
131
  const actorIdentifier = canonicalUuidUrn(input.actorIdentifier, 'actorIdentifier');
132
- const authorIdentifier = canonicalUuidUrn(input.authorIdentifier, 'authorIdentifier');
132
+ const preferredAssignment = input.assignmentIdentifier
133
+ ? canonicalUuidUrn(input.assignmentIdentifier, 'assignmentIdentifier')
134
+ : undefined;
135
+ const legacyAssignment = input.authorIdentifier
136
+ ? canonicalUuidUrn(input.authorIdentifier, 'authorIdentifier')
137
+ : undefined;
138
+ if (preferredAssignment && legacyAssignment && preferredAssignment !== legacyAssignment) {
139
+ throw new TypeError('assignmentIdentifier and deprecated authorIdentifier must identify the same assignment.');
140
+ }
141
+ const authorIdentifier = preferredAssignment || legacyAssignment;
142
+ if (!authorIdentifier) {
143
+ throw new TypeError('assignmentIdentifier is required.');
144
+ }
133
145
  const ownerIdentifier = input.kind === FhirIpsCreatorKinds.Professional
134
146
  ? requireReference(input.ownerIdentifier, 'ownerIdentifier')
135
147
  : canonicalUuidUrn(input.ownerIdentifier, 'ownerIdentifier');
136
148
  const role = canonicalRoleClaim(input.role);
149
+ const { assignmentIdentifier: _assignmentIdentifier, ...wireInput } = input;
137
150
  return {
138
- ...input,
151
+ ...wireInput,
139
152
  actorIdentifier,
140
153
  authorIdentifier,
141
154
  ownerIdentifier,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdc-common-utils-ts",
3
- "version": "2.9.9",
3
+ "version": "2.9.10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },