sos-sdk-core-ts 0.1.5 → 0.1.6

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Consume emergency evidence, Group/ServiceRequest and card-target contracts
6
+ from `sos-data-utils-ts@0.3.0` instead of maintaining SDK-local copies.
7
+ - Preserve the existing SDK root and subpath exports as compatibility aliases.
8
+ - Pin `uhc-sdk-core-ts@0.6.1` so the complete tree deduplicates to one
9
+ `sos-data-utils-ts@0.3.0` installation.
5
10
  - Pin the first registry release to `uhc-sdk-core-ts@0.6.0` so SOSChain
6
11
  consumers can remove the historical vendored package from staging builds.
7
12
 
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # SOSChain SDK Core
2
2
 
3
- Runtime-neutral SOSChain extension of `uhc-sdk-core-ts`.
3
+ Runtime-neutral SOSChain extension of `uhc-sdk-core-ts`. Deterministic record
4
+ types and builders come from `sos-data-utils-ts`; this SDK owns authorization
5
+ and orchestration.
4
6
 
5
7
  It consumes the exact published `uhc-sdk-core-ts` contract. Git, workspace,
6
8
  vendored and `file:` dependencies are forbidden in committed or deployed
@@ -1,17 +1,5 @@
1
- export type SoschainEmergencyCapability = 'sos:call' | 'sos:request';
2
- export type SoschainEvidenceDomain = 'SOS' | 'Health' | 'TrainingAndEducation';
3
- /** A verified evidence reference; the source VC/PDF stays outside call and audit logs. */
4
- export type SoschainEmergencyAuthorizationEvidence = Readonly<{
5
- evidenceId: string;
6
- issuerId: string;
7
- holderId: string;
8
- subjectIds: readonly string[];
9
- capabilities: readonly SoschainEmergencyCapability[];
10
- domains: readonly SoschainEvidenceDomain[];
11
- relationship: 'self' | 'guardian' | 'professional' | 'institution' | 'incident-reporter';
12
- verifiedAt: string;
13
- validUntil?: string;
14
- }>;
1
+ import type { SoschainEmergencyAuthorizationEvidence, SoschainEmergencyCapability } from 'sos-data-utils-ts/emergency-evidence';
2
+ export type { SoschainEmergencyAuthorizationEvidence, SoschainEmergencyCapability, SoschainEvidenceDomain, } from 'sos-data-utils-ts/emergency-evidence';
15
3
  export type SoschainEmergencyDeliveryTarget = Readonly<{
16
4
  tenantId: string;
17
5
  jurisdiction: string;
@@ -1,46 +1,2 @@
1
- export declare const SOSCHAIN_FHIR_CLAIMS_CONTEXT: "org.hl7.fhir.api";
2
- export declare const SOSCHAIN_EMERGENCY_ASSISTANCE_CODE_SYSTEM = "https://soschain.org/fhir/CodeSystem/emergency-assistance";
3
- /** Canonical claims-first group record stored under resource.meta.claims. */
4
- export type SoschainEmergencyGroupClaims = Readonly<{
5
- '@context': typeof SOSCHAIN_FHIR_CLAIMS_CONTEXT;
6
- 'Group.identifier': string;
7
- 'Group.name': string;
8
- 'Group.member-subject': readonly string[];
9
- 'Group.soschain-caller': string;
10
- 'Group.period-start': string;
11
- }>;
12
- /** Canonical claims-first request; FHIR version projection happens later. */
13
- export type SoschainEmergencyServiceRequestClaims = Readonly<{
14
- '@context': typeof SOSCHAIN_FHIR_CLAIMS_CONTEXT;
15
- 'ServiceRequest.identifier': string;
16
- 'ServiceRequest.status': 'active';
17
- 'ServiceRequest.intent': 'order';
18
- 'ServiceRequest.code': string;
19
- 'ServiceRequest.code-system': typeof SOSCHAIN_EMERGENCY_ASSISTANCE_CODE_SYSTEM;
20
- 'ServiceRequest.code-display'?: string;
21
- 'ServiceRequest.subject': string;
22
- 'ServiceRequest.subject-type': 'Group';
23
- 'ServiceRequest.requester': string;
24
- 'ServiceRequest.authored-on': string;
25
- 'ServiceRequest.soschain-member-subject': readonly string[];
26
- }>;
27
- /** Builds flat, version-neutral FHIR claims without interpreting identifier syntax. */
28
- export declare function buildSoschainEmergencyGroupClaims(input: Readonly<{
29
- emergencyGroupId: string;
30
- displayName: string;
31
- memberSubjectIds: readonly string[];
32
- callerId: string;
33
- createdAt?: string;
34
- }>): SoschainEmergencyGroupClaims;
35
- /**
36
- * Builds one flat ServiceRequest claim set for all members of one emergency
37
- * group. It deliberately does not construct a FHIR R5/R6 resource.
38
- */
39
- export declare function buildSoschainEmergencyServiceRequestClaims(input: Readonly<{
40
- requestId: string;
41
- groupClaims: SoschainEmergencyGroupClaims;
42
- assistanceCode?: string;
43
- assistanceDisplay?: string;
44
- authoredOn?: string;
45
- }>): SoschainEmergencyServiceRequestClaims;
46
- export declare function readSoschainEmergencySubjectIds(claims: SoschainEmergencyServiceRequestClaims): readonly string[];
1
+ /** Compatibility subpath for the canonical shared emergency record contracts. */
2
+ export * from 'sos-data-utils-ts/emergency-group';
@@ -1,48 +1,2 @@
1
- export const SOSCHAIN_FHIR_CLAIMS_CONTEXT = 'org.hl7.fhir.api';
2
- export const SOSCHAIN_EMERGENCY_ASSISTANCE_CODE_SYSTEM = 'https://soschain.org/fhir/CodeSystem/emergency-assistance';
3
- function requiredIdentifier(value, name) {
4
- const normalized = String(value).trim();
5
- if (!normalized)
6
- throw new TypeError(`${name} is required.`);
7
- return normalized;
8
- }
9
- function uniqueIdentifiers(values) {
10
- const identifiers = [...new Set(values.map((value) => requiredIdentifier(value, 'memberSubjectId')))];
11
- if (identifiers.length === 0)
12
- throw new TypeError('At least one memberSubjectId is required.');
13
- return identifiers;
14
- }
15
- /** Builds flat, version-neutral FHIR claims without interpreting identifier syntax. */
16
- export function buildSoschainEmergencyGroupClaims(input) {
17
- return {
18
- '@context': SOSCHAIN_FHIR_CLAIMS_CONTEXT,
19
- 'Group.identifier': requiredIdentifier(input.emergencyGroupId, 'emergencyGroupId'),
20
- 'Group.name': requiredIdentifier(input.displayName, 'displayName'),
21
- 'Group.member-subject': uniqueIdentifiers(input.memberSubjectIds),
22
- 'Group.soschain-caller': requiredIdentifier(input.callerId, 'callerId'),
23
- 'Group.period-start': input.createdAt ?? new Date().toISOString(),
24
- };
25
- }
26
- /**
27
- * Builds one flat ServiceRequest claim set for all members of one emergency
28
- * group. It deliberately does not construct a FHIR R5/R6 resource.
29
- */
30
- export function buildSoschainEmergencyServiceRequestClaims(input) {
31
- return {
32
- '@context': SOSCHAIN_FHIR_CLAIMS_CONTEXT,
33
- 'ServiceRequest.identifier': requiredIdentifier(input.requestId, 'requestId'),
34
- 'ServiceRequest.status': 'active',
35
- 'ServiceRequest.intent': 'order',
36
- 'ServiceRequest.code': input.assistanceCode?.trim() || 'emergency-assistance',
37
- 'ServiceRequest.code-system': SOSCHAIN_EMERGENCY_ASSISTANCE_CODE_SYSTEM,
38
- ...(input.assistanceDisplay ? { 'ServiceRequest.code-display': input.assistanceDisplay } : {}),
39
- 'ServiceRequest.subject': input.groupClaims['Group.identifier'],
40
- 'ServiceRequest.subject-type': 'Group',
41
- 'ServiceRequest.requester': input.groupClaims['Group.soschain-caller'],
42
- 'ServiceRequest.authored-on': input.authoredOn ?? new Date().toISOString(),
43
- 'ServiceRequest.soschain-member-subject': uniqueIdentifiers(input.groupClaims['Group.member-subject']),
44
- };
45
- }
46
- export function readSoschainEmergencySubjectIds(claims) {
47
- return claims['ServiceRequest.soschain-member-subject'];
48
- }
1
+ /** Compatibility subpath for the canonical shared emergency record contracts. */
2
+ export * from 'sos-data-utils-ts/emergency-group';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /** SOSChain extends UHC without moving product-specific contracts into UHC. */
2
2
  export * from 'uhc-sdk-core-ts';
3
+ export * from 'sos-data-utils-ts/emergency-evidence';
3
4
  export * from './emergency-group.js';
4
5
  export * from './emergency-authorization.js';
5
6
  export * from './place-card-association.js';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /** SOSChain extends UHC without moving product-specific contracts into UHC. */
2
2
  export * from 'uhc-sdk-core-ts';
3
+ export * from 'sos-data-utils-ts/emergency-evidence';
3
4
  export * from './emergency-group.js';
4
5
  export * from './emergency-authorization.js';
5
6
  export * from './place-card-association.js';
@@ -1,35 +1,2 @@
1
- import { SOSCHAIN_FHIR_CLAIMS_CONTEXT } from './emergency-group.js';
2
- export type SoschainAssociationTargetType = 'Place' | 'Vehicle';
3
- export type SoschainAssociationRole = 'controller' | 'occupant' | 'employee' | 'guardian';
4
- /** Flat association record stored under resource.meta.claims. */
5
- export type SoschainPlaceCardAssociationClaims = Readonly<{
6
- '@context': typeof SOSCHAIN_FHIR_CLAIMS_CONTEXT;
7
- 'Basic.identifier': string;
8
- 'Basic.code': 'soschain-card-target-association';
9
- 'Basic.subject': string;
10
- 'Basic.soschain-target': string;
11
- 'Basic.soschain-target-hash': string;
12
- 'Basic.soschain-target-type': SoschainAssociationTargetType;
13
- 'Basic.soschain-role': SoschainAssociationRole;
14
- 'Basic.period-start': string;
15
- }>;
16
- export type SoschainCanonicalTargetMatch = Readonly<{
17
- status: 'created' | 'existing';
18
- canonicalTargetId: string;
19
- targetType: SoschainAssociationTargetType;
20
- }>;
21
- export declare function buildSoschainPlaceCardAssociationClaims(input: Readonly<{
22
- associationId: string;
23
- cardId: string;
24
- canonicalTargetId: string;
25
- canonicalTargetHash: string;
26
- targetType: SoschainAssociationTargetType;
27
- role: SoschainAssociationRole;
28
- createdAt?: string;
29
- }>): SoschainPlaceCardAssociationClaims;
30
- /** Public deterministic SHA3-384/CID lookup key for smart-contract deduplication. */
31
- export declare function buildSoschainCanonicalTargetHash(input: Readonly<{
32
- targetType: SoschainAssociationTargetType;
33
- countryCode: string;
34
- canonicalValue: string;
35
- }>): string;
1
+ /** Compatibility subpath for the canonical shared card-target contracts. */
2
+ export * from 'sos-data-utils-ts/place-card-association';
@@ -1,30 +1,2 @@
1
- import { SOSCHAIN_FHIR_CLAIMS_CONTEXT } from './emergency-group.js';
2
- import { buildRawCidV1FromUtf8String } from 'gdc-common-utils-ts/utils/multiformat-profile';
3
- function required(value, name) {
4
- const normalized = String(value).trim();
5
- if (!normalized)
6
- throw new TypeError(`${name} is required.`);
7
- return normalized;
8
- }
9
- export function buildSoschainPlaceCardAssociationClaims(input) {
10
- return {
11
- '@context': SOSCHAIN_FHIR_CLAIMS_CONTEXT,
12
- 'Basic.identifier': required(input.associationId, 'associationId'),
13
- 'Basic.code': 'soschain-card-target-association',
14
- 'Basic.subject': required(input.cardId, 'cardId'),
15
- 'Basic.soschain-target': required(input.canonicalTargetId, 'canonicalTargetId'),
16
- 'Basic.soschain-target-hash': required(input.canonicalTargetHash, 'canonicalTargetHash'),
17
- 'Basic.soschain-target-type': input.targetType,
18
- 'Basic.soschain-role': input.role,
19
- 'Basic.period-start': input.createdAt ?? new Date().toISOString(),
20
- };
21
- }
22
- /** Public deterministic SHA3-384/CID lookup key for smart-contract deduplication. */
23
- export function buildSoschainCanonicalTargetHash(input) {
24
- const canonical = [
25
- input.targetType,
26
- required(input.countryCode, 'countryCode').toUpperCase(),
27
- required(input.canonicalValue, 'canonicalValue').normalize('NFC').trim().replace(/\s+/g, ' ').toLowerCase(),
28
- ].join('|');
29
- return buildRawCidV1FromUtf8String(canonical);
30
- }
1
+ /** Compatibility subpath for the canonical shared card-target contracts. */
2
+ export * from 'sos-data-utils-ts/place-card-association';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sos-sdk-core-ts",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Runtime-neutral SOSChain contracts extending uhc-sdk-core-ts",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Connecting Solution & Applications Ltd",
@@ -39,8 +39,8 @@
39
39
  "prepack": "npm run check"
40
40
  },
41
41
  "dependencies": {
42
- "gdc-common-utils-ts": "^2.3.28",
43
- "uhc-sdk-core-ts": "0.6.0"
42
+ "sos-data-utils-ts": "0.3.0",
43
+ "uhc-sdk-core-ts": "0.6.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^22.5.0",