gdc-common-utils-ts 2.3.18 → 2.3.19
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.
|
@@ -38,6 +38,8 @@ export declare enum ClaimsSoftwareApplicationSchemaorg {
|
|
|
38
38
|
* based on Schema.org vocabulary.
|
|
39
39
|
*/
|
|
40
40
|
export declare enum ClaimsOrganizationSchemaorg {
|
|
41
|
+
/** Schema.org type discriminator for the indexed organization/member profile. */
|
|
42
|
+
additionalType = "org.schema.Organization.additionalType",
|
|
41
43
|
/** Public aliases used for exact organization or individual resolution. */
|
|
42
44
|
sameAs = "org.schema.Organization.sameAs",
|
|
43
45
|
/** ISO 3166-1 alpha-2 (two-letter country code). The jurisdiction could be the country or the region (county, province or state) */
|
|
@@ -88,6 +90,16 @@ export declare enum ClaimsOrganizationSchemaorg {
|
|
|
88
90
|
ownerIdentifierValue = "org.schema.Organization.owner.identifier.value",
|
|
89
91
|
/** Individual/family indexed member friendly name used by onboarding draft helpers. */
|
|
90
92
|
memberAlternateName = "org.schema.Organization.member.alternateName",
|
|
93
|
+
/** Public display name of the indexed member. */
|
|
94
|
+
memberName = "org.schema.Organization.member.name",
|
|
95
|
+
/**
|
|
96
|
+
* Semantic type of the indexed member.
|
|
97
|
+
*
|
|
98
|
+
* Animal onboarding uses the canonical NCBI Taxonomy OBO URI here. This
|
|
99
|
+
* distinguishes an animal without inferring species from a FHIR resource
|
|
100
|
+
* name or from an application-local flag.
|
|
101
|
+
*/
|
|
102
|
+
memberAdditionalType = "org.schema.Organization.member.additionalType",
|
|
91
103
|
memberGivenName = "org.schema.Organization.member.givenName",
|
|
92
104
|
memberFamilyName = "org.schema.Organization.member.familyName",
|
|
93
105
|
memberBirthDate = "org.schema.Organization.member.birthDate",
|
|
@@ -42,6 +42,8 @@ export var ClaimsSoftwareApplicationSchemaorg;
|
|
|
42
42
|
*/
|
|
43
43
|
export var ClaimsOrganizationSchemaorg;
|
|
44
44
|
(function (ClaimsOrganizationSchemaorg) {
|
|
45
|
+
/** Schema.org type discriminator for the indexed organization/member profile. */
|
|
46
|
+
ClaimsOrganizationSchemaorg["additionalType"] = "org.schema.Organization.additionalType";
|
|
45
47
|
/** Public aliases used for exact organization or individual resolution. */
|
|
46
48
|
ClaimsOrganizationSchemaorg["sameAs"] = "org.schema.Organization.sameAs";
|
|
47
49
|
/** ISO 3166-1 alpha-2 (two-letter country code). The jurisdiction could be the country or the region (county, province or state) */
|
|
@@ -92,6 +94,16 @@ export var ClaimsOrganizationSchemaorg;
|
|
|
92
94
|
ClaimsOrganizationSchemaorg["ownerIdentifierValue"] = "org.schema.Organization.owner.identifier.value";
|
|
93
95
|
/** Individual/family indexed member friendly name used by onboarding draft helpers. */
|
|
94
96
|
ClaimsOrganizationSchemaorg["memberAlternateName"] = "org.schema.Organization.member.alternateName";
|
|
97
|
+
/** Public display name of the indexed member. */
|
|
98
|
+
ClaimsOrganizationSchemaorg["memberName"] = "org.schema.Organization.member.name";
|
|
99
|
+
/**
|
|
100
|
+
* Semantic type of the indexed member.
|
|
101
|
+
*
|
|
102
|
+
* Animal onboarding uses the canonical NCBI Taxonomy OBO URI here. This
|
|
103
|
+
* distinguishes an animal without inferring species from a FHIR resource
|
|
104
|
+
* name or from an application-local flag.
|
|
105
|
+
*/
|
|
106
|
+
ClaimsOrganizationSchemaorg["memberAdditionalType"] = "org.schema.Organization.member.additionalType";
|
|
95
107
|
ClaimsOrganizationSchemaorg["memberGivenName"] = "org.schema.Organization.member.givenName";
|
|
96
108
|
ClaimsOrganizationSchemaorg["memberFamilyName"] = "org.schema.Organization.member.familyName";
|
|
97
109
|
ClaimsOrganizationSchemaorg["memberBirthDate"] = "org.schema.Organization.member.birthDate";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const AnimalSubjectKinds: Readonly<{
|
|
2
|
+
readonly Animal: "animal";
|
|
3
|
+
}>;
|
|
4
|
+
export declare const NcbiTaxonomy: Readonly<{
|
|
5
|
+
readonly Dog: "9615";
|
|
6
|
+
readonly Cat: "9685";
|
|
7
|
+
readonly Horse: "9796";
|
|
8
|
+
}>;
|
|
9
|
+
export type NcbiTaxonomyId = string;
|
|
10
|
+
export type AnimalOnboardingInput = Readonly<{
|
|
11
|
+
subjectId: string;
|
|
12
|
+
cardDidWeb: string;
|
|
13
|
+
alternateName: string;
|
|
14
|
+
legalName?: string;
|
|
15
|
+
birthDate?: string;
|
|
16
|
+
birthYear?: number;
|
|
17
|
+
gender?: 'female' | 'male' | 'other' | 'unknown';
|
|
18
|
+
ncbiTaxonomyId: NcbiTaxonomyId;
|
|
19
|
+
controllerEmail?: string;
|
|
20
|
+
controllerTelephone?: string;
|
|
21
|
+
sector?: string;
|
|
22
|
+
}>;
|
|
23
|
+
export type AnimalOnboardingClaims = Readonly<Record<string, string>>;
|
|
24
|
+
/**
|
|
25
|
+
* Builds the canonical OBO URI for one NCBI Taxonomy numeric identifier.
|
|
26
|
+
*
|
|
27
|
+
* The URI is public taxonomy metadata, not an animal identifier. Callers must
|
|
28
|
+
* keep microchip, registry and controller identifiers in their separately
|
|
29
|
+
* typed confidential/index contracts.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildNcbiTaxonomyUri(id: NcbiTaxonomyId): string;
|
|
32
|
+
/**
|
|
33
|
+
* Projects one controller-authorized animal card request to the existing
|
|
34
|
+
* schema.org individual-organization claim envelope.
|
|
35
|
+
*
|
|
36
|
+
* The indexed subject is always an animal and its human actor is always a
|
|
37
|
+
* responsible controller. Login identity proves only the application session;
|
|
38
|
+
* GW must still verify the enrollment grant before accepting the request. A
|
|
39
|
+
* card must not be shown as active until the authoritative GW transaction
|
|
40
|
+
* returns success.
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildAnimalOnboardingClaims(input: AnimalOnboardingInput): AnimalOnboardingClaims;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ClaimsOrganizationSchemaorg, ClaimsServiceSchemaorg } from '../constants/schemaorg.js';
|
|
2
|
+
import { DataspaceSectors } from '../constants/sectors.js';
|
|
3
|
+
export const AnimalSubjectKinds = Object.freeze({
|
|
4
|
+
Animal: 'animal',
|
|
5
|
+
});
|
|
6
|
+
export const NcbiTaxonomy = Object.freeze({
|
|
7
|
+
Dog: '9615',
|
|
8
|
+
Cat: '9685',
|
|
9
|
+
Horse: '9796',
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Builds the canonical OBO URI for one NCBI Taxonomy numeric identifier.
|
|
13
|
+
*
|
|
14
|
+
* The URI is public taxonomy metadata, not an animal identifier. Callers must
|
|
15
|
+
* keep microchip, registry and controller identifiers in their separately
|
|
16
|
+
* typed confidential/index contracts.
|
|
17
|
+
*/
|
|
18
|
+
export function buildNcbiTaxonomyUri(id) {
|
|
19
|
+
const normalized = id.trim();
|
|
20
|
+
if (!/^[1-9]\d*$/.test(normalized)) {
|
|
21
|
+
throw new TypeError('ncbiTaxonomyId must be a positive numeric NCBI Taxonomy identifier.');
|
|
22
|
+
}
|
|
23
|
+
if (normalized === '9606') {
|
|
24
|
+
throw new TypeError('Human NCBI Taxonomy 9606 is not valid for animal onboarding.');
|
|
25
|
+
}
|
|
26
|
+
return `http://purl.obolibrary.org/obo/NCBITaxon_${normalized}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Projects one controller-authorized animal card request to the existing
|
|
30
|
+
* schema.org individual-organization claim envelope.
|
|
31
|
+
*
|
|
32
|
+
* The indexed subject is always an animal and its human actor is always a
|
|
33
|
+
* responsible controller. Login identity proves only the application session;
|
|
34
|
+
* GW must still verify the enrollment grant before accepting the request. A
|
|
35
|
+
* card must not be shown as active until the authoritative GW transaction
|
|
36
|
+
* returns success.
|
|
37
|
+
*/
|
|
38
|
+
export function buildAnimalOnboardingClaims(input) {
|
|
39
|
+
const subjectId = input.subjectId.trim();
|
|
40
|
+
const cardDidWeb = input.cardDidWeb.trim();
|
|
41
|
+
const alternateName = input.alternateName.trim();
|
|
42
|
+
if (!subjectId || !cardDidWeb || !alternateName) {
|
|
43
|
+
throw new TypeError('subjectId, cardDidWeb and alternateName are required.');
|
|
44
|
+
}
|
|
45
|
+
const birthDate = input.birthDate?.trim()
|
|
46
|
+
|| (Number.isInteger(input.birthYear) ? String(input.birthYear) : '');
|
|
47
|
+
const legalName = input.legalName?.trim();
|
|
48
|
+
const gender = input.gender && input.gender !== 'unknown' ? input.gender : '';
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
'@context': 'org.schema',
|
|
51
|
+
[ClaimsOrganizationSchemaorg.identifierValue]: subjectId,
|
|
52
|
+
[ClaimsOrganizationSchemaorg.additionalType]: AnimalSubjectKinds.Animal,
|
|
53
|
+
[ClaimsOrganizationSchemaorg.alternateName]: alternateName,
|
|
54
|
+
...(legalName ? { [ClaimsOrganizationSchemaorg.legalName]: legalName } : {}),
|
|
55
|
+
[ClaimsOrganizationSchemaorg.sameAs]: cardDidWeb,
|
|
56
|
+
[ClaimsOrganizationSchemaorg.memberName]: alternateName,
|
|
57
|
+
[ClaimsOrganizationSchemaorg.memberAdditionalType]: buildNcbiTaxonomyUri(input.ncbiTaxonomyId),
|
|
58
|
+
[ClaimsOrganizationSchemaorg.memberRole]: 'RESPRSN',
|
|
59
|
+
...(birthDate ? { [ClaimsOrganizationSchemaorg.memberBirthDate]: birthDate } : {}),
|
|
60
|
+
...(gender ? { [ClaimsOrganizationSchemaorg.memberGender]: gender } : {}),
|
|
61
|
+
[ClaimsOrganizationSchemaorg.ownerEmail]: input.controllerEmail?.trim() || '',
|
|
62
|
+
[ClaimsOrganizationSchemaorg.ownerTelephone]: input.controllerTelephone?.trim() || '',
|
|
63
|
+
[ClaimsServiceSchemaorg.category]: input.sector?.trim() || DataspaceSectors.AnimalCare,
|
|
64
|
+
});
|
|
65
|
+
}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export * from './interoperable-claims';
|
|
|
26
26
|
export * from './indexing';
|
|
27
27
|
export * from './identity-bootstrap';
|
|
28
28
|
export * from './individual-onboarding';
|
|
29
|
+
export * from './animal-onboarding';
|
|
29
30
|
export * from './inter-tenant-access-contract';
|
|
30
31
|
export * from './issue';
|
|
31
32
|
export * from './jsonapi';
|
package/dist/models/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export * from './interoperable-claims.js';
|
|
|
26
26
|
export * from './indexing.js';
|
|
27
27
|
export * from './identity-bootstrap.js';
|
|
28
28
|
export * from './individual-onboarding.js';
|
|
29
|
+
export * from './animal-onboarding.js';
|
|
29
30
|
export * from './inter-tenant-access-contract.js';
|
|
30
31
|
export * from './issue.js';
|
|
31
32
|
export * from './jsonapi.js';
|