refactor: service address
Build Test / test (pull_request) Successful in 37s
JS Unit Tests / test (pull_request) Failing after 37s
PHP Unit Tests / test (pull_request) Successful in 59s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-16 13:31:23 -04:00
parent 0e4bd905a2
commit bea7c1d0fb
10 changed files with 168 additions and 44 deletions
+9 -8
View File
@@ -8,6 +8,7 @@ import type {
ServiceLocation,
ServiceModelInterface
} from "@/types/service";
import { ServiceAddressObject } from './address';
import { Identity } from './identity';
import { Location } from './location';
import { MutationProxy } from './mutation-proxy';
@@ -118,20 +119,20 @@ export class ServiceObject implements ServiceModelInterface {
return this._data.capabilities ?? {};
}
get primaryAddress(): string | null {
return this._data.primaryAddress ?? null;
get primaryAddress(): ServiceAddressObject | null {
return this._data.primaryAddress ? ServiceAddressObject.fromJson(this._data.primaryAddress) : null;
}
set primaryAddress(value: string | null) {
this._data.primaryAddress = value;
set primaryAddress(value: ServiceAddressObject | null) {
this._data.primaryAddress = value ? value.toJson() : null;
}
get secondaryAddresses(): string[] {
return this._data.secondaryAddresses ?? [];
get secondaryAddresses(): ServiceAddressObject[] {
return (this._data.secondaryAddresses ?? []).map(entry => ServiceAddressObject.fromJson(entry));
}
set secondaryAddresses(value: string[] | null) {
this._data.secondaryAddresses = value;
set secondaryAddresses(value: ServiceAddressObject[] | null) {
this._data.secondaryAddresses = value ? value.map(entry => entry.toJson()) : null;
}
/** Mutable Properties */