From 7f5cb4e247f801666d51adbe26d7c09f9b03c22a Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Tue, 28 Apr 2026 15:40:55 +0000 Subject: [PATCH] feat: add registry target contracts --- package.json | 2 +- ts/data/image.ts | 6 ++++++ ts/data/index.ts | 1 + ts/data/registry.ts | 25 +++++++++++++++++++++++++ ts/data/service.ts | 3 +++ ts/requests/service.ts | 17 +++++++++++++++++ 6 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 ts/data/registry.ts diff --git a/package.json b/package.json index aeff629..19cc74c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@serve.zone/interfaces", - "version": "5.4.5", + "version": "5.4.6", "private": false, "description": "Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.", "exports": { diff --git a/ts/data/image.ts b/ts/data/image.ts index 18314bf..69bb868 100644 --- a/ts/data/image.ts +++ b/ts/data/image.ts @@ -1,4 +1,5 @@ import * as plugins from '../plugins.js'; +import type { IRegistryPushEvent } from './registry.js'; export interface IImage { id: string; @@ -12,9 +13,14 @@ export interface IImage { description: string; versions: Array<{ versionString: string; + digest?: string; + registryRepository?: string; + registryTag?: string; + source?: 'upload' | 'registry'; storagePath?: string; size: number; createdAt: number; }>; + lastPushEvent?: IRegistryPushEvent; }; } diff --git a/ts/data/index.ts b/ts/data/index.ts index 0875717..8327451 100644 --- a/ts/data/index.ts +++ b/ts/data/index.ts @@ -8,6 +8,7 @@ export * from './domain.js'; export * from './event.js'; export * from './externalregistry.js'; export * from './image.js'; +export * from './registry.js'; export * from './secretbundle.js'; export * from './secretgroup.js'; export * from './baremetal.js'; diff --git a/ts/data/registry.ts b/ts/data/registry.ts new file mode 100644 index 0000000..af768e1 --- /dev/null +++ b/ts/data/registry.ts @@ -0,0 +1,25 @@ +export type TRegistryProtocol = 'oci'; + +export interface IRegistryTarget { + protocol: TRegistryProtocol; + registryHost: string; + repository: string; + tag: string; + imageUrl: string; + serviceId?: string; + imageId?: string; +} + +export interface IRegistryPushEvent { + protocol: TRegistryProtocol; + registryHost: string; + repository: string; + tag: string; + digest: string; + imageUrl: string; + pushedAt: number; + serviceId?: string; + imageId?: string; + actorUserId?: string; + manifestMediaType?: string; +} diff --git a/ts/data/service.ts b/ts/data/service.ts index 4d51429..a51b9e7 100644 --- a/ts/data/service.ts +++ b/ts/data/service.ts @@ -1,4 +1,5 @@ import type { IServiceRessources } from './docker.js'; +import type { IRegistryTarget } from './registry.js'; export interface IService { id: string; @@ -7,6 +8,8 @@ export interface IService { description: string; imageId: string; imageVersion: string; + registryTarget?: IRegistryTarget; + deployOnPush?: boolean; environment: { [key: string]: string }; /** * the main secret bundle id, exclusive to the service diff --git a/ts/requests/service.ts b/ts/requests/service.ts index 80549f3..6587cbe 100644 --- a/ts/requests/service.ts +++ b/ts/requests/service.ts @@ -1,5 +1,6 @@ import * as plugins from '../plugins.js'; import type { IService } from '../data/service.js'; +import type { IRegistryTarget } from '../data/registry.js'; import type { IIdentity } from '../data/user.js'; import type { IServiceRessources } from '../data/docker.js'; @@ -32,6 +33,22 @@ extends plugins.typedrequestInterfaces.implementsTR< }; } +export interface IRequest_Any_Cloudly_GetServiceRegistryTarget +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IRequest_Any_Cloudly_GetServiceRegistryTarget +> { + method: 'getServiceRegistryTarget'; + request: { + identity: IIdentity; + serviceId: string; + tag?: string; + }; + response: { + registryTarget: IRegistryTarget; + }; +} + export interface IRequest_Any_Cloudly_CreateService extends plugins.typedrequestInterfaces.implementsTR< plugins.typedrequestInterfaces.ITypedRequest,