From eb299afb53c5be0013c787aa87e4dde8616d5114 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Tue, 28 Apr 2026 12:08:44 +0000 Subject: [PATCH] feat: add platform desired state contracts --- package.json | 2 +- test/test.node.ts | 3 + ts/requests/config.ts | 5 ++ ts/requests/index.ts | 4 +- ts/requests/platform.ts | 148 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 ts/requests/platform.ts diff --git a/package.json b/package.json index 2c0f92d..aeff629 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@serve.zone/interfaces", - "version": "5.4.4", + "version": "5.4.5", "private": false, "description": "Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.", "exports": { diff --git a/test/test.node.ts b/test/test.node.ts index 5a9c5f6..b96f093 100644 --- a/test/test.node.ts +++ b/test/test.node.ts @@ -8,6 +8,9 @@ tap.test('exports public namespaces', async () => { if (!interfaces.requests) { throw new Error('Missing requests namespace'); } + if (!interfaces.requests.platform) { + throw new Error('Missing platform request namespace'); + } if (!interfaces.platform) { throw new Error('Missing platform namespace'); } diff --git a/ts/requests/config.ts b/ts/requests/config.ts index b53a831..b400800 100644 --- a/ts/requests/config.ts +++ b/ts/requests/config.ts @@ -3,6 +3,7 @@ import * as clusterInterfaces from '../data/cluster.js'; import * as serverInterfaces from '../data/server.js'; import * as userInterfaces from '../data/user.js'; import type { IService } from '../data/service.js'; +import type { IPlatformBinding, IPlatformProviderConfig } from '../platform/types.js'; export interface IRequest_Any_Cloudly_GetServerConfig extends plugins.typedrequestInterfaces.implementsTR< @@ -31,6 +32,8 @@ extends plugins.typedrequestInterfaces.implementsTR< response: { configData: clusterInterfaces.ICluster; services: IService[]; + platformProviderConfigs?: IPlatformProviderConfig[]; + platformBindings?: IPlatformBinding[]; }; } @@ -43,6 +46,8 @@ extends plugins.typedrequestInterfaces.implementsTR< request: { configData: clusterInterfaces.ICluster; services: IService[]; + platformProviderConfigs?: IPlatformProviderConfig[]; + platformBindings?: IPlatformBinding[]; }; response: {}; } diff --git a/ts/requests/index.ts b/ts/requests/index.ts index f3799a3..29e81c9 100644 --- a/ts/requests/index.ts +++ b/ts/requests/index.ts @@ -15,6 +15,7 @@ import * as informRequests from './inform.js'; import * as logRequests from './log.js'; import * as networkRequests from './network.js'; import * as nodeRequests from './node.js'; +import * as platformRequests from './platform.js'; import * as routingRequests from './routing.js'; import * as secretBundleRequests from './secretbundle.js'; import * as secretGroupRequests from './secretgroup.js'; @@ -41,6 +42,7 @@ export { logRequests as log, networkRequests as network, nodeRequests as node, + platformRequests as platform, routingRequests as routing, secretBundleRequests as secretbundle, secretGroupRequests as secretgroup, @@ -52,4 +54,4 @@ export { versionRequests as version, }; -export * from './inform.js'; \ No newline at end of file +export * from './inform.js'; diff --git a/ts/requests/platform.ts b/ts/requests/platform.ts new file mode 100644 index 0000000..f15411b --- /dev/null +++ b/ts/requests/platform.ts @@ -0,0 +1,148 @@ +import * as plugins from '../plugins.js'; +import type { IIdentity } from '../data/user.js'; +import type { + IPlatformBinding, + IPlatformCapability, + IPlatformProviderConfig, + TPlatformBindingStatus, +} from '../platform/types.js'; + +export interface IReq_Any_Cloudly_GetPlatformDesiredState +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_GetPlatformDesiredState +> { + method: 'getPlatformDesiredState'; + request: { + identity: IIdentity; + }; + response: { + capabilities: IPlatformCapability[]; + providerConfigs: IPlatformProviderConfig[]; + bindings: IPlatformBinding[]; + }; +} + +export interface IReq_Any_Cloudly_GetPlatformCapabilities +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_GetPlatformCapabilities +> { + method: 'getPlatformCapabilities'; + request: { + identity: IIdentity; + }; + response: { + capabilities: IPlatformCapability[]; + }; +} + +export interface IReq_Any_Cloudly_GetPlatformProviderConfigs +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_GetPlatformProviderConfigs +> { + method: 'getPlatformProviderConfigs'; + request: { + identity: IIdentity; + capability?: IPlatformProviderConfig['capability']; + }; + response: { + providerConfigs: IPlatformProviderConfig[]; + }; +} + +export interface IReq_Any_Cloudly_UpsertPlatformProviderConfig +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_UpsertPlatformProviderConfig +> { + method: 'upsertPlatformProviderConfig'; + request: { + identity: IIdentity; + providerConfig: IPlatformProviderConfig; + }; + response: { + providerConfig: IPlatformProviderConfig; + }; +} + +export interface IReq_Any_Cloudly_DeletePlatformProviderConfigById +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_DeletePlatformProviderConfigById +> { + method: 'deletePlatformProviderConfigById'; + request: { + identity: IIdentity; + providerConfigId: string; + }; + response: { + success: boolean; + }; +} + +export interface IReq_Any_Cloudly_GetPlatformBindings +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_GetPlatformBindings +> { + method: 'getPlatformBindings'; + request: { + identity: IIdentity; + serviceId?: string; + capability?: IPlatformBinding['capability']; + }; + response: { + bindings: IPlatformBinding[]; + }; +} + +export interface IReq_Any_Cloudly_UpsertPlatformBinding +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_UpsertPlatformBinding +> { + method: 'upsertPlatformBinding'; + request: { + identity: IIdentity; + binding: IPlatformBinding; + }; + response: { + binding: IPlatformBinding; + }; +} + +export interface IReq_Any_Cloudly_UpdatePlatformBindingStatus +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_UpdatePlatformBindingStatus +> { + method: 'updatePlatformBindingStatus'; + request: { + identity: IIdentity; + bindingId: string; + status: TPlatformBindingStatus; + endpoints?: IPlatformBinding['endpoints']; + credentials?: IPlatformBinding['credentials']; + errorText?: string; + }; + response: { + binding: IPlatformBinding; + }; +} + +export interface IReq_Any_Cloudly_DeletePlatformBindingById +extends plugins.typedrequestInterfaces.implementsTR< + plugins.typedrequestInterfaces.ITypedRequest, + IReq_Any_Cloudly_DeletePlatformBindingById +> { + method: 'deletePlatformBindingById'; + request: { + identity: IIdentity; + bindingId: string; + }; + response: { + success: boolean; + }; +}