cosmos-cloud-sdk 0.24.0-unstable012 → 0.24.0-unstable021

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/dist/index.d.mts CHANGED
@@ -6,6 +6,50 @@ interface ApiResponse<T = any> {
6
6
  }
7
7
  type ApiFetch = (path: string, options?: RequestInit) => Promise<Response>;
8
8
 
9
+ interface DNSZoneConfig {
10
+ Zone: string;
11
+ HTTPSCertificateMode: string;
12
+ TLSCert?: string;
13
+ TLSKey?: string;
14
+ UseWildcardCertificate: boolean;
15
+ DNSChallengeProvider: string;
16
+ DNSChallengeConfig?: Record<string, string>;
17
+ DNSChallengeResolvers: string;
18
+ DNSChallengePropagationWait: number;
19
+ DisablePropagationChecks: boolean;
20
+ ManageRecords: boolean;
21
+ WildcardRecord: boolean;
22
+ }
23
+ interface HostCertificate {
24
+ source: 'zone' | 'node' | 'selfsigned' | 'provided' | 'none';
25
+ zone?: string;
26
+ hosts: string[];
27
+ validUntil: string;
28
+ covered: boolean;
29
+ }
30
+ interface ZoneStatus extends DNSZoneConfig {
31
+ derived: boolean;
32
+ issuesCertificate: boolean;
33
+ hosts: string[];
34
+ certificate?: {
35
+ hosts: string[];
36
+ validUntil: string;
37
+ issuedBy?: string;
38
+ };
39
+ hostCertificates: Record<string, HostCertificate>;
40
+ recordsSupported: boolean;
41
+ records?: {
42
+ supported: boolean;
43
+ lastSync: string;
44
+ lastError?: string;
45
+ records: Record<string, string[]>;
46
+ };
47
+ }
48
+ interface AdvertisedAddressOption {
49
+ value: string;
50
+ address: string;
51
+ }
52
+
9
53
  interface ConstellationDevice {
10
54
  Nickname: string;
11
55
  DeviceName: string;
@@ -1360,6 +1404,12 @@ declare function createClient({ baseUrl, token }: {
1360
1404
  bans: () => Promise<ApiResponse>;
1361
1405
  unban: (clientID: string) => Promise<ApiResponse>;
1362
1406
  };
1407
+ zones: {
1408
+ addresses: () => Promise<ApiResponse<AdvertisedAddressOption[]>>;
1409
+ list: () => Promise<ApiResponse<ZoneStatus[]>>;
1410
+ set: (zone: string, config: Partial<DNSZoneConfig>) => Promise<ApiResponse>;
1411
+ remove: (zone: string) => Promise<ApiResponse>;
1412
+ };
1363
1413
  setup: (request: SetupRequest) => Promise<ApiResponse<any>>;
1364
1414
  getStatus: () => Promise<ApiResponse<any>>;
1365
1415
  isOnline: () => Promise<any>;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,50 @@ interface ApiResponse<T = any> {
6
6
  }
7
7
  type ApiFetch = (path: string, options?: RequestInit) => Promise<Response>;
8
8
 
9
+ interface DNSZoneConfig {
10
+ Zone: string;
11
+ HTTPSCertificateMode: string;
12
+ TLSCert?: string;
13
+ TLSKey?: string;
14
+ UseWildcardCertificate: boolean;
15
+ DNSChallengeProvider: string;
16
+ DNSChallengeConfig?: Record<string, string>;
17
+ DNSChallengeResolvers: string;
18
+ DNSChallengePropagationWait: number;
19
+ DisablePropagationChecks: boolean;
20
+ ManageRecords: boolean;
21
+ WildcardRecord: boolean;
22
+ }
23
+ interface HostCertificate {
24
+ source: 'zone' | 'node' | 'selfsigned' | 'provided' | 'none';
25
+ zone?: string;
26
+ hosts: string[];
27
+ validUntil: string;
28
+ covered: boolean;
29
+ }
30
+ interface ZoneStatus extends DNSZoneConfig {
31
+ derived: boolean;
32
+ issuesCertificate: boolean;
33
+ hosts: string[];
34
+ certificate?: {
35
+ hosts: string[];
36
+ validUntil: string;
37
+ issuedBy?: string;
38
+ };
39
+ hostCertificates: Record<string, HostCertificate>;
40
+ recordsSupported: boolean;
41
+ records?: {
42
+ supported: boolean;
43
+ lastSync: string;
44
+ lastError?: string;
45
+ records: Record<string, string[]>;
46
+ };
47
+ }
48
+ interface AdvertisedAddressOption {
49
+ value: string;
50
+ address: string;
51
+ }
52
+
9
53
  interface ConstellationDevice {
10
54
  Nickname: string;
11
55
  DeviceName: string;
@@ -1360,6 +1404,12 @@ declare function createClient({ baseUrl, token }: {
1360
1404
  bans: () => Promise<ApiResponse>;
1361
1405
  unban: (clientID: string) => Promise<ApiResponse>;
1362
1406
  };
1407
+ zones: {
1408
+ addresses: () => Promise<ApiResponse<AdvertisedAddressOption[]>>;
1409
+ list: () => Promise<ApiResponse<ZoneStatus[]>>;
1410
+ set: (zone: string, config: Partial<DNSZoneConfig>) => Promise<ApiResponse>;
1411
+ remove: (zone: string) => Promise<ApiResponse>;
1412
+ };
1363
1413
  setup: (request: SetupRequest) => Promise<ApiResponse<any>>;
1364
1414
  getStatus: () => Promise<ApiResponse<any>>;
1365
1415
  isOnline: () => Promise<any>;
package/dist/index.js CHANGED
@@ -2427,6 +2427,49 @@ function createShieldAPI(apiFetch) {
2427
2427
  };
2428
2428
  }
2429
2429
 
2430
+ // ../client/src/api/zones.ts
2431
+ function createZonesAPI(apiFetch) {
2432
+ function list() {
2433
+ return wrap(apiFetch("/cosmos/api/zones", {
2434
+ method: "GET",
2435
+ headers: {
2436
+ "Content-Type": "application/json"
2437
+ }
2438
+ }));
2439
+ }
2440
+ function set(zone, config) {
2441
+ return wrap(apiFetch(`/cosmos/api/zones/${encodeURIComponent(zone)}`, {
2442
+ method: "PUT",
2443
+ headers: {
2444
+ "Content-Type": "application/json"
2445
+ },
2446
+ body: JSON.stringify(config)
2447
+ }));
2448
+ }
2449
+ function remove(zone) {
2450
+ return wrap(apiFetch(`/cosmos/api/zones/${encodeURIComponent(zone)}`, {
2451
+ method: "DELETE",
2452
+ headers: {
2453
+ "Content-Type": "application/json"
2454
+ }
2455
+ }));
2456
+ }
2457
+ function addresses() {
2458
+ return wrap(apiFetch("/cosmos/api/zones-addresses", {
2459
+ method: "GET",
2460
+ headers: {
2461
+ "Content-Type": "application/json"
2462
+ }
2463
+ }));
2464
+ }
2465
+ return {
2466
+ addresses,
2467
+ list,
2468
+ set,
2469
+ remove
2470
+ };
2471
+ }
2472
+
2430
2473
  // src/index.ts
2431
2474
  function createClient({ baseUrl, token }) {
2432
2475
  const { apiFetch, createWs } = createApiClient(baseUrl, token);
@@ -2452,6 +2495,7 @@ function createClient({ baseUrl, token }) {
2452
2495
  functions: createFunctionsAPI(apiFetch),
2453
2496
  ci: createCIAPI(apiFetch),
2454
2497
  shield: createShieldAPI(apiFetch),
2498
+ zones: createZonesAPI(apiFetch),
2455
2499
  setup: (request) => {
2456
2500
  return wrap(apiFetch("/cosmos/api/setup", {
2457
2501
  method: "POST",
package/dist/index.mjs CHANGED
@@ -2401,6 +2401,49 @@ function createShieldAPI(apiFetch) {
2401
2401
  };
2402
2402
  }
2403
2403
 
2404
+ // ../client/src/api/zones.ts
2405
+ function createZonesAPI(apiFetch) {
2406
+ function list() {
2407
+ return wrap(apiFetch("/cosmos/api/zones", {
2408
+ method: "GET",
2409
+ headers: {
2410
+ "Content-Type": "application/json"
2411
+ }
2412
+ }));
2413
+ }
2414
+ function set(zone, config) {
2415
+ return wrap(apiFetch(`/cosmos/api/zones/${encodeURIComponent(zone)}`, {
2416
+ method: "PUT",
2417
+ headers: {
2418
+ "Content-Type": "application/json"
2419
+ },
2420
+ body: JSON.stringify(config)
2421
+ }));
2422
+ }
2423
+ function remove(zone) {
2424
+ return wrap(apiFetch(`/cosmos/api/zones/${encodeURIComponent(zone)}`, {
2425
+ method: "DELETE",
2426
+ headers: {
2427
+ "Content-Type": "application/json"
2428
+ }
2429
+ }));
2430
+ }
2431
+ function addresses() {
2432
+ return wrap(apiFetch("/cosmos/api/zones-addresses", {
2433
+ method: "GET",
2434
+ headers: {
2435
+ "Content-Type": "application/json"
2436
+ }
2437
+ }));
2438
+ }
2439
+ return {
2440
+ addresses,
2441
+ list,
2442
+ set,
2443
+ remove
2444
+ };
2445
+ }
2446
+
2404
2447
  // src/index.ts
2405
2448
  function createClient({ baseUrl, token }) {
2406
2449
  const { apiFetch, createWs } = createApiClient(baseUrl, token);
@@ -2426,6 +2469,7 @@ function createClient({ baseUrl, token }) {
2426
2469
  functions: createFunctionsAPI(apiFetch),
2427
2470
  ci: createCIAPI(apiFetch),
2428
2471
  shield: createShieldAPI(apiFetch),
2472
+ zones: createZonesAPI(apiFetch),
2429
2473
  setup: (request) => {
2430
2474
  return wrap(apiFetch("/cosmos/api/setup", {
2431
2475
  method: "POST",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cosmos-cloud-sdk",
3
- "version": "0.24.0-unstable012",
3
+ "version": "0.24.0-unstable021",
4
4
  "description": "JavaScript/TypeScript SDK for the Cosmos Server API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",