feat: add platform capability contracts
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import * as data from './data/index.js';
|
||||
import * as platform from './platform/index.js';
|
||||
import * as platformservice from './platformservice/index.js';
|
||||
import * as requests from './requests/index.js';
|
||||
|
||||
export {
|
||||
data,
|
||||
platform,
|
||||
platformservice,
|
||||
requests
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
|
||||
export interface IChat {
|
||||
systemMessage: string;
|
||||
messages: {
|
||||
role: 'assistant' | 'user';
|
||||
content: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface IReq_Chat extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_Chat
|
||||
> {
|
||||
method: 'chat';
|
||||
request: {
|
||||
chat: IChat;
|
||||
};
|
||||
response: {
|
||||
chat: IChat;
|
||||
latestMessage: string;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export type TPlatformBackupTarget = 'volume' | 'database' | 'bucket';
|
||||
|
||||
export interface IPlatformBackupBindingConfig {
|
||||
targets: Array<{
|
||||
type: TPlatformBackupTarget;
|
||||
name: string;
|
||||
}>;
|
||||
schedule: string;
|
||||
retentionDays?: number;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export type TPlatformDatabaseEngine = 'postgres' | 'mongodb' | 'mysql' | 'redis';
|
||||
|
||||
export interface IPlatformDatabaseBindingConfig {
|
||||
engine: TPlatformDatabaseEngine;
|
||||
databaseName?: string;
|
||||
version?: string;
|
||||
extensions?: string[];
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
|
||||
export type TTemplates = 'default' | 'linkaction' | 'notification';
|
||||
|
||||
export interface IReq_SendEmail extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_SendEmail
|
||||
> {
|
||||
method: 'sendEmail';
|
||||
request: {
|
||||
title: string;
|
||||
from: string;
|
||||
to: string;
|
||||
body: string;
|
||||
attachments?: Array<{
|
||||
name: string;
|
||||
binaryAttachmentString: string;
|
||||
}>;
|
||||
};
|
||||
response: {
|
||||
responseId: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface IReq_RegisterRecipient extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_RegisterRecipient
|
||||
> {
|
||||
method: 'registerRecipient';
|
||||
request: {
|
||||
emailAddress: string;
|
||||
};
|
||||
response: {
|
||||
status: 'ok' | 'not ok';
|
||||
};
|
||||
}
|
||||
|
||||
export interface IReq_CheckEmailStatus extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_CheckEmailStatus
|
||||
> {
|
||||
method: 'checkEmailStatus';
|
||||
request: {
|
||||
emailId: string;
|
||||
};
|
||||
response: {
|
||||
status: string;
|
||||
details?: { message: string };
|
||||
};
|
||||
}
|
||||
|
||||
export interface IReq_GetEmailStats extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetEmailStats
|
||||
> {
|
||||
method: 'getEmailStats';
|
||||
request: {
|
||||
jwt: string;
|
||||
};
|
||||
response: {
|
||||
totalEmailsSent: number;
|
||||
totalEmailsDelivered: number;
|
||||
totalEmailsBounced: number;
|
||||
averageDeliveryTimeMs: number;
|
||||
lastUpdated: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type IReq_GetEMailStats = IReq_GetEmailStats;
|
||||
export type IRequest_SendEmail = IReq_SendEmail;
|
||||
export type IRequest_RegisterRecipient = IReq_RegisterRecipient;
|
||||
export type IRequest_CheckEmailStatus = IReq_CheckEmailStatus;
|
||||
export type IRequest_GetEMailStats = IReq_GetEmailStats;
|
||||
@@ -0,0 +1,27 @@
|
||||
import * as ai from './ai.js';
|
||||
import * as backup from './backup.js';
|
||||
import * as database from './database.js';
|
||||
import * as email from './email.js';
|
||||
import * as letter from './letter.js';
|
||||
import * as logging from './logging.js';
|
||||
import * as objectstorage from './objectstorage.js';
|
||||
import * as pushnotification from './pushnotification.js';
|
||||
import * as sip from './sip.js';
|
||||
import * as sms from './sms.js';
|
||||
import * as types from './types.js';
|
||||
|
||||
export {
|
||||
ai,
|
||||
backup,
|
||||
database,
|
||||
email,
|
||||
letter,
|
||||
logging,
|
||||
objectstorage,
|
||||
pushnotification,
|
||||
sip,
|
||||
sms,
|
||||
types,
|
||||
};
|
||||
|
||||
export * from './types.js';
|
||||
@@ -0,0 +1,26 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
|
||||
export interface IReq_SendLetter extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_SendLetter
|
||||
> {
|
||||
method: 'sendLetter';
|
||||
request: {
|
||||
description: string;
|
||||
needsCover: boolean;
|
||||
title?: string;
|
||||
from?: plugins.tsclass.business.IAddress;
|
||||
to?: plugins.tsclass.business.IAddress;
|
||||
coverBody?: string;
|
||||
service: 'Einschreiben'[];
|
||||
pdfAttachments?: Array<{
|
||||
name: string;
|
||||
binaryAttachmentString: string;
|
||||
}>;
|
||||
};
|
||||
response: {
|
||||
processId: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type IRequest_SendLetter = IReq_SendLetter;
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface IPlatformLoggingBindingConfig {
|
||||
streams?: string[];
|
||||
retentionDays?: number;
|
||||
exposeQueryEndpoint?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface IPlatformObjectStorageBindingConfig {
|
||||
bucketName?: string;
|
||||
region?: string;
|
||||
publicRead?: boolean;
|
||||
versioning?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
|
||||
export interface IReq_SendPushNotification extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_SendPushNotification
|
||||
> {
|
||||
method: 'sendPushNotification';
|
||||
request: {
|
||||
deviceToken: string;
|
||||
message: string;
|
||||
};
|
||||
response: {
|
||||
ok: boolean;
|
||||
status: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type IRequest_SendPushNotification = IReq_SendPushNotification;
|
||||
@@ -0,0 +1,6 @@
|
||||
export interface IPlatformSipBindingConfig {
|
||||
trunkId?: string;
|
||||
extension?: string;
|
||||
inboundNumbers?: string[];
|
||||
outboundCallerId?: string;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
|
||||
export interface IReq_SendSms extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_SendSms
|
||||
> {
|
||||
method: 'sendSms';
|
||||
request: {
|
||||
toNumber: number;
|
||||
fromName: string;
|
||||
messageText: string;
|
||||
};
|
||||
response: {
|
||||
status: 'ok' | 'not ok';
|
||||
};
|
||||
}
|
||||
|
||||
export interface IReq_SendVerificationCode extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_SendVerificationCode
|
||||
> {
|
||||
method: 'sendVerificationCode';
|
||||
request: {
|
||||
toNumber: number;
|
||||
fromName: string;
|
||||
};
|
||||
response: {
|
||||
status: 'ok' | 'not ok';
|
||||
verificationCode: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type IRequest_SendSms = IReq_SendSms;
|
||||
export type IRequest_SendVerificationCode = IReq_SendVerificationCode;
|
||||
@@ -0,0 +1,82 @@
|
||||
export type TPlatformCapability =
|
||||
| 'email'
|
||||
| 'sms'
|
||||
| 'pushnotification'
|
||||
| 'letter'
|
||||
| 'ai'
|
||||
| 'database'
|
||||
| 'objectstorage'
|
||||
| 'logging'
|
||||
| 'backup'
|
||||
| 'sip';
|
||||
|
||||
export type TPlatformAccessMode = 'rpc' | 'binding' | 'sidecar' | 'internal';
|
||||
export type TPlatformBindingStatus = 'requested' | 'provisioning' | 'ready' | 'degraded' | 'failed' | 'disabled';
|
||||
export type TPlatformDesiredState = 'enabled' | 'disabled';
|
||||
export type TPlatformEndpointProtocol =
|
||||
| 'typedrequest'
|
||||
| 'http'
|
||||
| 'tcp'
|
||||
| 'udp'
|
||||
| 'smtp'
|
||||
| 's3'
|
||||
| 'postgres'
|
||||
| 'mongodb'
|
||||
| 'sip';
|
||||
|
||||
export type TPlatformConfigValue =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| TPlatformConfigValue[]
|
||||
| { [key: string]: TPlatformConfigValue };
|
||||
|
||||
export interface IPlatformCapability {
|
||||
id: TPlatformCapability;
|
||||
title: string;
|
||||
description?: string;
|
||||
accessMode: TPlatformAccessMode;
|
||||
defaultProviderType?: string;
|
||||
}
|
||||
|
||||
export interface IPlatformProviderConfig {
|
||||
id: string;
|
||||
capability: TPlatformCapability;
|
||||
providerType: string;
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
config?: { [key: string]: TPlatformConfigValue };
|
||||
secretBundleId?: string;
|
||||
}
|
||||
|
||||
export interface IPlatformCredentialRef {
|
||||
secretBundleId?: string;
|
||||
secretGroupIds?: string[];
|
||||
dockerSecretName?: string;
|
||||
env?: { [key: string]: string };
|
||||
}
|
||||
|
||||
export interface IPlatformServiceEndpoint {
|
||||
name: string;
|
||||
capability: TPlatformCapability;
|
||||
protocol: TPlatformEndpointProtocol;
|
||||
internalUrl?: string;
|
||||
externalUrl?: string;
|
||||
networkAlias?: string;
|
||||
port?: number;
|
||||
}
|
||||
|
||||
export interface IPlatformBinding {
|
||||
id: string;
|
||||
serviceId: string;
|
||||
capability: TPlatformCapability;
|
||||
desiredState: TPlatformDesiredState;
|
||||
status: TPlatformBindingStatus;
|
||||
providerConfigId?: string;
|
||||
config?: { [key: string]: TPlatformConfigValue };
|
||||
endpoints?: IPlatformServiceEndpoint[];
|
||||
credentials?: IPlatformCredentialRef[];
|
||||
createdAt?: number;
|
||||
updatedAt?: number;
|
||||
}
|
||||
@@ -20,4 +20,6 @@ export interface IReq_Chat extends plugins.typedrequestInterfaces.implementsTR<
|
||||
chat: IChat;
|
||||
latestMessage: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type IRequest_Chat = IReq_Chat;
|
||||
|
||||
@@ -31,4 +31,6 @@ export interface IRequest_SendLetter extends plugins.typedrequestInterfaces.impl
|
||||
*/
|
||||
processId: string;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export type IReq_SendLetter = IRequest_SendLetter;
|
||||
|
||||
@@ -68,3 +68,8 @@ export interface IReq_GetEMailStats extends plugins.typedrequestInterfaces.imple
|
||||
lastUpdated: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type IRequest_SendEmail = IReq_SendEmail;
|
||||
export type IRequest_RegisterRecipient = IReq_RegisterRecipient;
|
||||
export type IRequest_CheckEmailStatus = IReq_CheckEmailStatus;
|
||||
export type IRequest_GetEMailStats = IReq_GetEMailStats;
|
||||
|
||||
@@ -13,4 +13,6 @@ export interface IRequest_SendPushNotification extends plugins.typedrequestInter
|
||||
ok: boolean;
|
||||
status: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type IReq_SendPushNotification = IRequest_SendPushNotification;
|
||||
|
||||
@@ -31,3 +31,6 @@ export interface IRequest_SendSms
|
||||
verificationCode: string;
|
||||
}
|
||||
}
|
||||
|
||||
export type IReq_SendSms = IRequest_SendSms;
|
||||
export type IReq_SendVerificationCode = IRequest_SendVerificationCode;
|
||||
|
||||
Reference in New Issue
Block a user