diff --git a/package-lock.json b/package-lock.json index b23d35e..2b94306 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@ozmap/ozn-sdk", - "version": "0.0.1-1075-4", + "version": "0.0.1-1066-4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@ozmap/ozn-sdk", - "version": "0.0.1-1075-4", + "version": "0.0.1-1066-4", "license": "MIT", "dependencies": { "zod": "^3.24.2" diff --git a/package.json b/package.json index 489dd86..40f2309 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ozmap/ozn-sdk", - "version": "0.0.1-1075-4", + "version": "0.0.1-1066-4", "description": "OZN SDK is a powerful tool for developers to build their own applications on top of OZN using TMForum pattern.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/types/confirm-order.ts b/src/types/confirm-order.ts index aee27b3..615e204 100644 --- a/src/types/confirm-order.ts +++ b/src/types/confirm-order.ts @@ -3,8 +3,6 @@ import { z } from 'zod'; export const ConfirmOrderInputSchema = z.object({ port: z.object({ idExternal: z.string(), - idArea: z.string(), - idOperator: z.string(), nameExternal: z.string(), }), address: z.string(), diff --git a/src/types/service-inventory.ts b/src/types/service-inventory.ts new file mode 100644 index 0000000..ec330e1 --- /dev/null +++ b/src/types/service-inventory.ts @@ -0,0 +1,71 @@ +import { z } from 'zod'; +import { geographicAddressOutputSchema } from './geographic-address'; + +const ResourceLocationSchema = z.object({ + type: z.string(), + labelType: z.string(), + name: z.string(), + description: z.nullable(z.string()), + parentLocation: z.nullable(z.any()), // Assuming it can be null or a reference to another location + address: geographicAddressOutputSchema, +}); + +const CharacteristicSchema = z.object({ + id: z.nullable(z.string()), + name: z.string(), + valueType: z.string(), + value: z.string(), +}); + +const ResourceSchema = z.object({ + id: z.string(), + name: z.string(), + entityType: z.string(), + characteristic: z.array(CharacteristicSchema).nullable(), + resourceLocation: z.nullable(ResourceLocationSchema), +}); + +const SupportingResourceSchema = z.object({ + id: z.string(), + entityType: z.string(), + name: z.nullable(z.string()), + role: z.nullable(z.string()), + resource: z.array(ResourceSchema).nullable(), + characteristic: z.array(CharacteristicSchema).nullable(), + supportingResource: z.nullable(z.any()), // Recursive, will define later +}); + +// Update SupportingResourceSchema to handle recursion +SupportingResourceSchema.partial().extend({ + supportingResource: z.nullable(z.array(SupportingResourceSchema)), +}); + +const RelatedPartyPropertySchema = z.object({ + name: z.string(), + value: z.string(), +}); + +const RelatedPartySchema = z.object({ + role: z.string(), + property: z.array(RelatedPartyPropertySchema), +}); + +const PlaceSchema = z.object({ + id: z.string(), + type: z.string(), +}); + +const ServiceSchema = z.object({ + id: z.string(), + description: z.string(), + isServiceEnabled: z.boolean(), + name: z.string(), + serviceType: z.string(), + relatedParty: z.array(RelatedPartySchema), + place: z.array(PlaceSchema), + state: z.string(), + supportingResource: z.array(SupportingResourceSchema), +}); + +export const ServiceInventoryOutputSchema = z.array(ServiceSchema); +export type ServiceInventoryOutput = z.infer; diff --git a/src/types/service-qualification.ts b/src/types/service-qualification.ts index 341d078..7b899df 100644 --- a/src/types/service-qualification.ts +++ b/src/types/service-qualification.ts @@ -64,7 +64,7 @@ export const RelatedEntitySchema = z.object({ const ServiceSchema = z.object({ serviceCharacteristic: z.array(CharacteristicSchema), relatedEntity: z.array(RelatedEntitySchema), - iframeViability: z.boolean(), + iframeViability: z.string().optional(), }); const ServiceQualificationItemSchema = z.object({