@serve.zone/interfaces 5.3.0 → 5.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.smartconfig.json +32 -0
- package/changelog.md +26 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/{dist_ts_interfaces → dist_ts}/data/baremetal.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/cloudlyconfig.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/cluster.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/clusternode.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/config.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/deployment.js +1 -1
- package/dist_ts/data/dns.d.ts +85 -0
- package/dist_ts/data/dns.js +2 -0
- package/{dist_ts_interfaces → dist_ts}/data/docker.js +1 -1
- package/dist_ts/data/domain.d.ts +102 -0
- package/dist_ts/data/domain.js +2 -0
- package/{dist_ts_interfaces → dist_ts}/data/event.js +1 -1
- package/dist_ts/data/externalregistry.d.ts +92 -0
- package/{dist_ts_interfaces → dist_ts}/data/externalregistry.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/image.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/index.d.ts +3 -0
- package/dist_ts/data/index.js +22 -0
- package/{dist_ts_interfaces → dist_ts}/data/secretbundle.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/secretgroup.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/server.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/service.d.ts +14 -0
- package/{dist_ts_interfaces → dist_ts}/data/service.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/settings.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/status.js +1 -1
- package/dist_ts/data/taskexecution.d.ts +72 -0
- package/dist_ts/data/taskexecution.js +2 -0
- package/{dist_ts_interfaces → dist_ts}/data/traffic.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/user.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/data/version.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/index.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/platformservice/aibridge.js +1 -1
- package/dist_ts/platformservice/index.js +7 -0
- package/{dist_ts_interfaces → dist_ts}/platformservice/letter.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/platformservice/mta.js +1 -1
- package/dist_ts/platformservice/pushnotification.js +2 -0
- package/{dist_ts_interfaces → dist_ts}/platformservice/sms.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/plugins.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/admin.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/baremetal.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/certificate.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/cluster.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/config.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/deployment.js +1 -1
- package/dist_ts/requests/dns.d.ts +63 -0
- package/dist_ts/requests/dns.js +2 -0
- package/dist_ts/requests/domain.d.ts +69 -0
- package/dist_ts/requests/domain.js +2 -0
- package/{dist_ts_interfaces → dist_ts}/requests/externalregistry.d.ts +13 -0
- package/dist_ts/requests/externalregistry.js +4 -0
- package/{dist_ts_interfaces → dist_ts}/requests/identity.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/image.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/index.d.ts +5 -1
- package/dist_ts/requests/index.js +28 -0
- package/{dist_ts_interfaces → dist_ts}/requests/inform.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/log.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/network.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/node.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/routing.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/secretbundle.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/secretgroup.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/server.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/service.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/settings.js +1 -1
- package/{dist_ts_interfaces → dist_ts}/requests/status.js +1 -1
- package/dist_ts/requests/task.d.ts +65 -0
- package/dist_ts/requests/task.js +4 -0
- package/{dist_ts_interfaces → dist_ts}/requests/version.js +1 -1
- package/license +1 -1
- package/package.json +42 -17
- package/readme.md +13 -375
- package/{ts_interfaces → ts}/00_commitinfo_data.ts +2 -2
- package/ts/data/dns.ts +100 -0
- package/ts/data/domain.ts +124 -0
- package/ts/data/externalregistry.ts +110 -0
- package/{ts_interfaces → ts}/data/index.ts +3 -0
- package/{ts_interfaces → ts}/data/service.ts +14 -0
- package/ts/data/taskexecution.ts +84 -0
- package/ts/requests/dns.ts +93 -0
- package/ts/requests/domain.ts +99 -0
- package/{ts_interfaces → ts}/requests/externalregistry.ts +17 -0
- package/{ts_interfaces → ts}/requests/index.ts +8 -0
- package/ts/requests/task.ts +95 -0
- package/cli.js +0 -4
- package/dist_ts_interfaces/00_commitinfo_data.js +0 -9
- package/dist_ts_interfaces/data/externalregistry.d.ts +0 -10
- package/dist_ts_interfaces/data/index.js +0 -19
- package/dist_ts_interfaces/platformservice/index.js +0 -7
- package/dist_ts_interfaces/platformservice/pushnotification.js +0 -2
- package/dist_ts_interfaces/requests/externalregistry.js +0 -4
- package/dist_ts_interfaces/requests/index.js +0 -24
- package/ts_interfaces/data/externalregistry.ts +0 -12
- package/ts_interfaces/readme.md +0 -391
- package/ts_interfaces/tspublish.json +0 -13
- /package/{dist_ts_interfaces → dist_ts}/00_commitinfo_data.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/baremetal.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/cloudlyconfig.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/cluster.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/clusternode.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/config.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/deployment.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/docker.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/event.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/image.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/secretbundle.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/secretgroup.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/server.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/settings.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/status.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/traffic.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/user.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/data/version.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/index.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/platformservice/aibridge.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/platformservice/index.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/platformservice/letter.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/platformservice/mta.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/platformservice/pushnotification.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/platformservice/sms.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/plugins.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/admin.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/baremetal.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/certificate.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/cluster.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/config.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/deployment.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/identity.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/image.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/inform.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/log.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/network.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/node.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/routing.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/secretbundle.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/secretgroup.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/server.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/service.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/settings.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/status.d.ts +0 -0
- /package/{dist_ts_interfaces → dist_ts}/requests/version.d.ts +0 -0
- /package/{ts_interfaces → ts}/data/baremetal.ts +0 -0
- /package/{ts_interfaces → ts}/data/cloudlyconfig.ts +0 -0
- /package/{ts_interfaces → ts}/data/cluster.ts +0 -0
- /package/{ts_interfaces → ts}/data/clusternode.ts +0 -0
- /package/{ts_interfaces → ts}/data/config.ts +0 -0
- /package/{ts_interfaces → ts}/data/deployment.ts +0 -0
- /package/{ts_interfaces → ts}/data/docker.ts +0 -0
- /package/{ts_interfaces → ts}/data/event.ts +0 -0
- /package/{ts_interfaces → ts}/data/image.ts +0 -0
- /package/{ts_interfaces → ts}/data/secretbundle.ts +0 -0
- /package/{ts_interfaces → ts}/data/secretgroup.ts +0 -0
- /package/{ts_interfaces → ts}/data/server.ts +0 -0
- /package/{ts_interfaces → ts}/data/settings.ts +0 -0
- /package/{ts_interfaces → ts}/data/status.ts +0 -0
- /package/{ts_interfaces → ts}/data/traffic.ts +0 -0
- /package/{ts_interfaces → ts}/data/user.ts +0 -0
- /package/{ts_interfaces → ts}/data/version.ts +0 -0
- /package/{ts_interfaces → ts}/index.ts +0 -0
- /package/{ts_interfaces → ts}/platformservice/00readme.md +0 -0
- /package/{ts_interfaces → ts}/platformservice/aibridge.ts +0 -0
- /package/{ts_interfaces → ts}/platformservice/index.ts +0 -0
- /package/{ts_interfaces → ts}/platformservice/letter.ts +0 -0
- /package/{ts_interfaces → ts}/platformservice/mta.ts +0 -0
- /package/{ts_interfaces → ts}/platformservice/pushnotification.ts +0 -0
- /package/{ts_interfaces → ts}/platformservice/sms.ts +0 -0
- /package/{ts_interfaces → ts}/plugins.ts +0 -0
- /package/{ts_interfaces → ts}/requests/admin.ts +0 -0
- /package/{ts_interfaces → ts}/requests/baremetal.ts +0 -0
- /package/{ts_interfaces → ts}/requests/certificate.ts +0 -0
- /package/{ts_interfaces → ts}/requests/cluster.ts +0 -0
- /package/{ts_interfaces → ts}/requests/config.ts +0 -0
- /package/{ts_interfaces → ts}/requests/deployment.ts +0 -0
- /package/{ts_interfaces → ts}/requests/identity.ts +0 -0
- /package/{ts_interfaces → ts}/requests/image.ts +0 -0
- /package/{ts_interfaces → ts}/requests/inform.ts +0 -0
- /package/{ts_interfaces → ts}/requests/log.ts +0 -0
- /package/{ts_interfaces → ts}/requests/network.ts +0 -0
- /package/{ts_interfaces → ts}/requests/node.ts +0 -0
- /package/{ts_interfaces → ts}/requests/routing.ts +0 -0
- /package/{ts_interfaces → ts}/requests/secretbundle.ts +0 -0
- /package/{ts_interfaces → ts}/requests/secretgroup.ts +0 -0
- /package/{ts_interfaces → ts}/requests/server.ts +0 -0
- /package/{ts_interfaces → ts}/requests/service.ts +0 -0
- /package/{ts_interfaces → ts}/requests/settings.ts +0 -0
- /package/{ts_interfaces → ts}/requests/status.ts +0 -0
- /package/{ts_interfaces → ts}/requests/version.ts +0 -0
package/readme.md
CHANGED
|
@@ -1,391 +1,29 @@
|
|
|
1
|
-
# @serve.zone/interfaces
|
|
1
|
+
# @serve.zone/interfaces
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This package contains the public contracts consumed by Cloudly, Spark, Coreflow, Coretraffic, Platformclient, and external integrations. It is intentionally dependency-light and should not contain runtime implementation code.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## ✨ Features
|
|
10
|
-
|
|
11
|
-
- **🔒 Type Safety** - Comprehensive TypeScript interfaces for all Cloudly operations
|
|
12
|
-
- **📦 Modular Structure** - Organized by domain for easy navigation
|
|
13
|
-
- **🔄 Version Compatibility** - Interfaces versioned with the platform
|
|
14
|
-
- **📚 Well Documented** - Each interface includes JSDoc comments
|
|
15
|
-
- **🎭 Multi-Purpose** - Used by API clients, CLI tools, and web interfaces
|
|
16
|
-
- **✅ Validation Ready** - Compatible with runtime type checking libraries
|
|
17
|
-
|
|
18
|
-
## 🚀 Installation
|
|
7
|
+
## Install
|
|
19
8
|
|
|
20
9
|
```bash
|
|
21
10
|
pnpm add @serve.zone/interfaces
|
|
22
11
|
```
|
|
23
12
|
|
|
24
|
-
##
|
|
25
|
-
|
|
26
|
-
### 📡 Request/Response Interfaces
|
|
27
|
-
|
|
28
|
-
Typed contracts for API communication:
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
import {
|
|
32
|
-
IRequest_GetAllImages,
|
|
33
|
-
IRequest_CreateCluster,
|
|
34
|
-
IRequest_DeployService
|
|
35
|
-
} from '@serve.zone/interfaces';
|
|
36
|
-
|
|
37
|
-
// Type-safe request
|
|
38
|
-
const request: IRequest_GetAllImages['request'] = {
|
|
39
|
-
identity: userIdentity,
|
|
40
|
-
filters: {
|
|
41
|
-
tag: 'production'
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// Type-safe response
|
|
46
|
-
const response: IRequest_GetAllImages['response'] = {
|
|
47
|
-
images: [...]
|
|
48
|
-
};
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 📦 Data Models
|
|
52
|
-
|
|
53
|
-
Core data structures for Cloudly entities:
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
import {
|
|
57
|
-
ICluster,
|
|
58
|
-
IService,
|
|
59
|
-
IImage,
|
|
60
|
-
ISecret,
|
|
61
|
-
IServer
|
|
62
|
-
} from '@serve.zone/interfaces';
|
|
63
|
-
|
|
64
|
-
// Define a service
|
|
65
|
-
const service: IService = {
|
|
66
|
-
id: 'service-123',
|
|
67
|
-
data: {
|
|
68
|
-
name: 'api-service',
|
|
69
|
-
imageId: 'image-456',
|
|
70
|
-
imageVersion: '2.0.0',
|
|
71
|
-
environment: {
|
|
72
|
-
NODE_ENV: 'production'
|
|
73
|
-
},
|
|
74
|
-
scaleFactor: 3,
|
|
75
|
-
balancingStrategy: 'round-robin',
|
|
76
|
-
ports: {
|
|
77
|
-
web: 80,
|
|
78
|
-
metrics: 9090
|
|
79
|
-
},
|
|
80
|
-
domains: [
|
|
81
|
-
{ name: 'api.example.com' }
|
|
82
|
-
],
|
|
83
|
-
deploymentIds: [],
|
|
84
|
-
deploymentDirectiveIds: []
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### 🔐 Authentication & Identity
|
|
90
|
-
|
|
91
|
-
Identity management interfaces:
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
import {
|
|
95
|
-
IIdentity,
|
|
96
|
-
IServiceToken,
|
|
97
|
-
IPermission
|
|
98
|
-
} from '@serve.zone/interfaces';
|
|
99
|
-
|
|
100
|
-
const identity: IIdentity = {
|
|
101
|
-
id: 'user-789',
|
|
102
|
-
name: 'service-account',
|
|
103
|
-
type: 'service',
|
|
104
|
-
permissions: ['cluster:read', 'service:write'],
|
|
105
|
-
tokenHash: 'hashed-token',
|
|
106
|
-
metadata: {
|
|
107
|
-
createdAt: new Date(),
|
|
108
|
-
lastAccess: new Date()
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### 🌐 Network Configuration
|
|
114
|
-
|
|
115
|
-
Networking and routing interfaces:
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
import {
|
|
119
|
-
IReverseProxyConfig,
|
|
120
|
-
IDomainConfig,
|
|
121
|
-
ILoadBalancerConfig
|
|
122
|
-
} from '@serve.zone/interfaces';
|
|
123
|
-
|
|
124
|
-
const proxyConfig: IReverseProxyConfig = {
|
|
125
|
-
domain: 'app.example.com',
|
|
126
|
-
path: '/api',
|
|
127
|
-
serviceAddress: 'http://api-service:3000',
|
|
128
|
-
ssl: true,
|
|
129
|
-
headers: {
|
|
130
|
-
'X-Real-IP': '$remote_addr'
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### 📊 Monitoring & Metrics
|
|
136
|
-
|
|
137
|
-
Observability interfaces:
|
|
13
|
+
## Usage
|
|
138
14
|
|
|
139
15
|
```typescript
|
|
140
|
-
import {
|
|
141
|
-
IServerMetrics,
|
|
142
|
-
IServiceMetrics,
|
|
143
|
-
IClusterHealth
|
|
144
|
-
} from '@serve.zone/interfaces';
|
|
145
|
-
|
|
146
|
-
const metrics: IServerMetrics = {
|
|
147
|
-
serverId: 'server-001',
|
|
148
|
-
cpuUsageInPercent: 65,
|
|
149
|
-
memoryUsageinMB: 3072,
|
|
150
|
-
memoryAvailableInMB: 8192,
|
|
151
|
-
diskUsageInPercent: 40,
|
|
152
|
-
networkInMbps: 100,
|
|
153
|
-
networkOutMbps: 150,
|
|
154
|
-
containerCount: 12,
|
|
155
|
-
containerMetrics: [...]
|
|
156
|
-
};
|
|
16
|
+
import { data, requests, platformservice } from '@serve.zone/interfaces';
|
|
157
17
|
```
|
|
158
18
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
Security and credential interfaces:
|
|
19
|
+
## Development
|
|
162
20
|
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
IEncryptedData
|
|
168
|
-
} from '@serve.zone/interfaces';
|
|
169
|
-
|
|
170
|
-
const secretGroup: ISecretGroup = {
|
|
171
|
-
id: 'secrets-123',
|
|
172
|
-
name: 'database-credentials',
|
|
173
|
-
secrets: [
|
|
174
|
-
{
|
|
175
|
-
key: 'DB_HOST',
|
|
176
|
-
value: 'encrypted-value',
|
|
177
|
-
encrypted: true
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
key: 'DB_PASSWORD',
|
|
181
|
-
value: 'encrypted-value',
|
|
182
|
-
encrypted: true
|
|
183
|
-
}
|
|
184
|
-
],
|
|
185
|
-
metadata: {
|
|
186
|
-
environment: 'production',
|
|
187
|
-
service: 'api'
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
## 📚 Common Usage Patterns
|
|
193
|
-
|
|
194
|
-
### Creating Type-Safe API Clients
|
|
195
|
-
|
|
196
|
-
```typescript
|
|
197
|
-
import {
|
|
198
|
-
IRequest_CreateService,
|
|
199
|
-
IService
|
|
200
|
-
} from '@serve.zone/interfaces';
|
|
201
|
-
|
|
202
|
-
class ServiceClient {
|
|
203
|
-
async createService(
|
|
204
|
-
serviceData: IService['data']
|
|
205
|
-
): Promise<IService> {
|
|
206
|
-
const request: IRequest_CreateService['request'] = {
|
|
207
|
-
identity: this.identity,
|
|
208
|
-
serviceData
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const response = await this.client.send<IRequest_CreateService>(
|
|
212
|
-
'createService',
|
|
213
|
-
request
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
return response.service;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### Validating Incoming Data
|
|
222
|
-
|
|
223
|
-
```typescript
|
|
224
|
-
import { ICluster } from '@serve.zone/interfaces';
|
|
225
|
-
import { validateType } from 'your-validation-library';
|
|
226
|
-
|
|
227
|
-
function validateClusterData(data: unknown): ICluster {
|
|
228
|
-
if (!validateType<ICluster>(data)) {
|
|
229
|
-
throw new Error('Invalid cluster data');
|
|
230
|
-
}
|
|
231
|
-
return data;
|
|
232
|
-
}
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Building Configuration Objects
|
|
236
|
-
|
|
237
|
-
```typescript
|
|
238
|
-
import {
|
|
239
|
-
ICloudlyConfig,
|
|
240
|
-
IMongoDescriptor
|
|
241
|
-
} from '@serve.zone/interfaces';
|
|
242
|
-
|
|
243
|
-
const config: ICloudlyConfig = {
|
|
244
|
-
cfToken: process.env.CF_TOKEN!,
|
|
245
|
-
hetznerToken: process.env.HETZNER_TOKEN!,
|
|
246
|
-
environment: 'production',
|
|
247
|
-
letsEncryptEmail: 'certs@example.com',
|
|
248
|
-
publicUrl: 'cloudly.example.com',
|
|
249
|
-
publicPort: 443,
|
|
250
|
-
mongoDescriptor: {
|
|
251
|
-
mongoDbUrl: process.env.MONGO_URL!,
|
|
252
|
-
mongoDbName: 'cloudly',
|
|
253
|
-
mongoDbUser: process.env.MONGO_USER!,
|
|
254
|
-
mongoDbPass: process.env.MONGO_PASS!
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
## 🎯 Advanced Features
|
|
260
|
-
|
|
261
|
-
### Generic Request Handler
|
|
262
|
-
|
|
263
|
-
```typescript
|
|
264
|
-
import { ITypedRequest } from '@serve.zone/interfaces';
|
|
265
|
-
|
|
266
|
-
class RequestHandler {
|
|
267
|
-
async handle<T extends ITypedRequest>(
|
|
268
|
-
request: T['request']
|
|
269
|
-
): Promise<T['response']> {
|
|
270
|
-
// Type-safe request handling
|
|
271
|
-
return this.processRequest(request);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Discriminated Unions
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
import { IDeploymentStatus } from '@serve.zone/interfaces';
|
|
280
|
-
|
|
281
|
-
function handleStatus(status: IDeploymentStatus) {
|
|
282
|
-
switch (status.type) {
|
|
283
|
-
case 'pending':
|
|
284
|
-
console.log('Deployment pending...');
|
|
285
|
-
break;
|
|
286
|
-
case 'running':
|
|
287
|
-
console.log(`Running on ${status.serverId}`);
|
|
288
|
-
break;
|
|
289
|
-
case 'failed':
|
|
290
|
-
console.log(`Failed: ${status.error}`);
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
### Extending Interfaces
|
|
297
|
-
|
|
298
|
-
```typescript
|
|
299
|
-
import { IService } from '@serve.zone/interfaces';
|
|
300
|
-
|
|
301
|
-
interface IExtendedService extends IService {
|
|
302
|
-
customMetadata: {
|
|
303
|
-
team: string;
|
|
304
|
-
costCenter: string;
|
|
305
|
-
sla: 'standard' | 'premium';
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
## 🔄 Version Compatibility
|
|
311
|
-
|
|
312
|
-
| @serve.zone/interfaces | @serve.zone/cloudly | @serve.zone/api | @serve.zone/cli |
|
|
313
|
-
|------------------------|---------------------|-----------------|-----------------|
|
|
314
|
-
| 5.x | 5.x | 5.x | 5.x |
|
|
315
|
-
| 4.x | 4.x | 4.x | 4.x |
|
|
316
|
-
| 3.x | 3.x | 3.x | 3.x |
|
|
317
|
-
|
|
318
|
-
## 📖 Interface Documentation
|
|
319
|
-
|
|
320
|
-
All interfaces include comprehensive JSDoc comments:
|
|
321
|
-
|
|
322
|
-
```typescript
|
|
323
|
-
/**
|
|
324
|
-
* Represents a cluster configuration
|
|
325
|
-
* @interface ICluster
|
|
326
|
-
*/
|
|
327
|
-
export interface ICluster {
|
|
328
|
-
/**
|
|
329
|
-
* Unique identifier for the cluster
|
|
330
|
-
* @type {string}
|
|
331
|
-
*/
|
|
332
|
-
id: string;
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Cluster configuration data
|
|
336
|
-
* @type {IClusterData}
|
|
337
|
-
*/
|
|
338
|
-
data: IClusterData;
|
|
339
|
-
}
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
## 🛠️ Development Tips
|
|
343
|
-
|
|
344
|
-
### Import Organization
|
|
345
|
-
|
|
346
|
-
```typescript
|
|
347
|
-
// Group imports by category
|
|
348
|
-
import {
|
|
349
|
-
// Data models
|
|
350
|
-
ICluster,
|
|
351
|
-
IService,
|
|
352
|
-
IImage,
|
|
353
|
-
|
|
354
|
-
// Requests
|
|
355
|
-
IRequest_CreateCluster,
|
|
356
|
-
IRequest_DeployService,
|
|
357
|
-
|
|
358
|
-
// Configuration
|
|
359
|
-
ICloudlyConfig,
|
|
360
|
-
IReverseProxyConfig
|
|
361
|
-
} from '@serve.zone/interfaces';
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
### Type Guards
|
|
365
|
-
|
|
366
|
-
```typescript
|
|
367
|
-
import { IService, ICluster } from '@serve.zone/interfaces';
|
|
368
|
-
|
|
369
|
-
function isService(entity: IService | ICluster): entity is IService {
|
|
370
|
-
return 'imageId' in entity.data;
|
|
371
|
-
}
|
|
21
|
+
```bash
|
|
22
|
+
pnpm install
|
|
23
|
+
pnpm run build
|
|
24
|
+
pnpm test
|
|
372
25
|
```
|
|
373
26
|
|
|
374
|
-
##
|
|
375
|
-
|
|
376
|
-
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
|
377
|
-
|
|
378
|
-
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
379
|
-
|
|
380
|
-
### Trademarks
|
|
381
|
-
|
|
382
|
-
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
|
383
|
-
|
|
384
|
-
### Company Information
|
|
385
|
-
|
|
386
|
-
Task Venture Capital GmbH
|
|
387
|
-
Registered at District court Bremen HRB 35230 HB, Germany
|
|
388
|
-
|
|
389
|
-
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
|
27
|
+
## Ownership
|
|
390
28
|
|
|
391
|
-
|
|
29
|
+
Only ecosystem-wide public contracts belong here. Cloudly-internal implementation types should stay in Cloudly.
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@serve.zone/interfaces',
|
|
6
|
-
version: '
|
|
7
|
-
description: 'interfaces for
|
|
6
|
+
version: '5.4.3',
|
|
7
|
+
description: 'Shared TypeScript interfaces and TypedRequest contracts for the serve.zone ecosystem.'
|
|
8
8
|
}
|
package/ts/data/dns.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export type TDnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS' | 'SOA' | 'SRV' | 'CAA' | 'PTR';
|
|
2
|
+
|
|
3
|
+
export interface IDnsEntry {
|
|
4
|
+
id: string;
|
|
5
|
+
data: {
|
|
6
|
+
/**
|
|
7
|
+
* The DNS record type
|
|
8
|
+
*/
|
|
9
|
+
type: TDnsRecordType;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The DNS record name (e.g., www, @, mail)
|
|
13
|
+
* @ represents the root domain
|
|
14
|
+
*/
|
|
15
|
+
name: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The value of the DNS record
|
|
19
|
+
* - For A/AAAA: IP address
|
|
20
|
+
* - For CNAME: Target domain
|
|
21
|
+
* - For MX: Mail server hostname
|
|
22
|
+
* - For TXT: Text value
|
|
23
|
+
* - For NS: Nameserver hostname
|
|
24
|
+
* - For SRV: Target hostname
|
|
25
|
+
* - For CAA: CAA record value
|
|
26
|
+
* - For PTR: Domain name
|
|
27
|
+
*/
|
|
28
|
+
value: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Time to live in seconds
|
|
32
|
+
* Default: 3600 (1 hour)
|
|
33
|
+
*/
|
|
34
|
+
ttl: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Priority (used for MX and SRV records)
|
|
38
|
+
* Lower values have higher priority
|
|
39
|
+
*/
|
|
40
|
+
priority?: number;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The DNS zone this entry belongs to
|
|
44
|
+
* e.g., example.com
|
|
45
|
+
* @deprecated Use domainId instead
|
|
46
|
+
*/
|
|
47
|
+
zone: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The domain ID this DNS entry belongs to
|
|
51
|
+
* Links to the Domain entity
|
|
52
|
+
*/
|
|
53
|
+
domainId?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Additional fields for SRV records
|
|
57
|
+
*/
|
|
58
|
+
weight?: number;
|
|
59
|
+
port?: number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Whether this DNS entry is active
|
|
63
|
+
*/
|
|
64
|
+
active: boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Optional description for documentation
|
|
68
|
+
*/
|
|
69
|
+
description?: string;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Timestamp when the entry was created
|
|
73
|
+
*/
|
|
74
|
+
createdAt?: number;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Timestamp when the entry was last updated
|
|
78
|
+
*/
|
|
79
|
+
updatedAt?: number;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Whether this DNS entry was auto-generated
|
|
83
|
+
*/
|
|
84
|
+
isAutoGenerated?: boolean;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The service ID that created this DNS entry (for auto-generated entries)
|
|
88
|
+
*/
|
|
89
|
+
sourceServiceId?: string;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The source type of this DNS entry
|
|
93
|
+
* - manual: Created by user through UI/API
|
|
94
|
+
* - service: Auto-generated from service configuration
|
|
95
|
+
* - system: Created by system processes
|
|
96
|
+
* - external: Synced from external DNS providers
|
|
97
|
+
*/
|
|
98
|
+
sourceType?: 'manual' | 'service' | 'system' | 'external';
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export type TDomainStatus = 'active' | 'pending' | 'expired' | 'suspended' | 'transferred';
|
|
2
|
+
export type TDomainVerificationStatus = 'verified' | 'pending' | 'failed' | 'not_required';
|
|
3
|
+
|
|
4
|
+
export interface IDomain {
|
|
5
|
+
id: string;
|
|
6
|
+
data: {
|
|
7
|
+
/**
|
|
8
|
+
* The domain name (e.g., example.com)
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Description or notes about the domain
|
|
14
|
+
*/
|
|
15
|
+
description?: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Current status of the domain
|
|
19
|
+
*/
|
|
20
|
+
status: TDomainStatus;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Domain verification status
|
|
24
|
+
*/
|
|
25
|
+
verificationStatus: TDomainVerificationStatus;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Nameservers for the domain
|
|
29
|
+
*/
|
|
30
|
+
nameservers: string[];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Domain registrar information
|
|
34
|
+
*/
|
|
35
|
+
registrar?: {
|
|
36
|
+
name: string;
|
|
37
|
+
url?: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Domain registration date (timestamp)
|
|
42
|
+
*/
|
|
43
|
+
registeredAt?: number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Domain expiration date (timestamp)
|
|
47
|
+
*/
|
|
48
|
+
expiresAt?: number;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Whether auto-renewal is enabled
|
|
52
|
+
*/
|
|
53
|
+
autoRenew: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* DNSSEC enabled
|
|
57
|
+
*/
|
|
58
|
+
dnssecEnabled?: boolean;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Tags for categorization
|
|
62
|
+
*/
|
|
63
|
+
tags?: string[];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Whether this domain is primary for the organization
|
|
67
|
+
*/
|
|
68
|
+
isPrimary?: boolean;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* SSL certificate status
|
|
72
|
+
*/
|
|
73
|
+
sslStatus?: 'active' | 'pending' | 'expired' | 'none';
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Cloudly activation state controls whether we actively manage DNS/certificates
|
|
77
|
+
* - available: discovered/imported, not actively managed
|
|
78
|
+
* - activated: actively managed (DNS edits allowed, certs considered)
|
|
79
|
+
* - ignored: explicitly ignored from management/automation
|
|
80
|
+
*/
|
|
81
|
+
activationState?: 'available' | 'activated' | 'ignored';
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Last verification attempt timestamp
|
|
85
|
+
*/
|
|
86
|
+
lastVerificationAt?: number;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Verification method used
|
|
90
|
+
*/
|
|
91
|
+
verificationMethod?: 'dns' | 'http' | 'email' | 'manual';
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Verification token (for DNS/HTTP verification)
|
|
95
|
+
*/
|
|
96
|
+
verificationToken?: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Cloudflare zone ID if managed by Cloudflare
|
|
100
|
+
*/
|
|
101
|
+
cloudflareZoneId?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Sync metadata
|
|
105
|
+
*/
|
|
106
|
+
syncSource?: 'cloudflare' | 'manual' | null;
|
|
107
|
+
lastSyncAt?: number;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Whether domain is managed externally
|
|
111
|
+
*/
|
|
112
|
+
isExternal?: boolean;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Creation timestamp
|
|
116
|
+
*/
|
|
117
|
+
createdAt?: number;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Last update timestamp
|
|
121
|
+
*/
|
|
122
|
+
updatedAt?: number;
|
|
123
|
+
};
|
|
124
|
+
}
|