glitch-javascript-sdk 3.9.9 → 3.10.0

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.
@@ -2,8 +2,11 @@ import { AxiosPromise, AxiosProgressEvent } from 'axios';
2
2
  import Response from '../util/Response';
3
3
  export type HostingPlanKey = 'free' | 'launch' | 'growth' | 'scale' | 'studio';
4
4
  export type HostingMode = 'static' | 'server';
5
- export type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql';
6
- export type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated';
5
+ export type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql' | 'redis';
6
+ export type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated' | 'cache_sandbox' | 'cache_launch' | 'cache_growth' | 'cache_scale';
7
+ export type HostingServiceRole = 'web' | 'api' | 'game' | 'realtime' | 'simulation' | 'worker' | 'scheduled';
8
+ export type HostingServiceVisibility = 'public' | 'internal' | 'none';
9
+ export type HostingCapacityModel = 'singleton' | 'replicated' | 'serverless';
7
10
  export type HostingDeliveryChannel = 'glitch_store' | 'glitch_hosted_subdomain' | 'glitch_hosted_custom_domain' | 'external';
8
11
  export type HostingBillingProvider = 'direct' | 'microsoft_marketplace' | 'aws_marketplace';
9
12
  export interface HostingAccount {
@@ -27,12 +30,13 @@ export interface HostingRelease {
27
30
  game_build_id?: string | null;
28
31
  version: string;
29
32
  status: 'uploading' | 'processing' | 'ready' | 'failed' | 'active' | 'inactive';
30
- source_type: 'upload' | 'cli' | 'game_build';
33
+ source_type: 'upload' | 'cli' | 'game_build' | 'service_stack';
31
34
  entry_point: string;
32
35
  size_bytes: number;
33
36
  checksum?: string | null;
34
37
  error_message?: string | null;
35
38
  promoted_at?: string | null;
39
+ service_deployments?: HostingServiceDeployment[];
36
40
  }
37
41
  export interface HostingDomain {
38
42
  id: string;
@@ -54,7 +58,7 @@ export interface HostingDatabase {
54
58
  engine: HostingDatabaseEngine;
55
59
  plan: HostingDatabasePlan;
56
60
  status: 'awaiting_payment' | 'requested' | 'provisioning' | 'ready' | 'resizing' | 'restoring' | 'failed' | 'deleting' | 'deleted';
57
- deployment_model: 'shared' | 'dedicated' | 'serverless';
61
+ deployment_model: 'shared' | 'dedicated' | 'serverless' | 'managed_cache';
58
62
  azure_region: string;
59
63
  included_storage_bytes: number;
60
64
  current_storage_bytes: number;
@@ -107,6 +111,98 @@ export interface HostingSite {
107
111
  active_release?: HostingRelease | null;
108
112
  domains?: HostingDomain[];
109
113
  databases?: HostingDatabase[];
114
+ services?: HostingService[];
115
+ }
116
+ export interface HostingServiceDeployment {
117
+ id: string;
118
+ hosting_service_id: string;
119
+ hosting_release_id: string;
120
+ game_build_id?: string | null;
121
+ version: string;
122
+ status: 'queued' | 'deploying' | 'ready' | 'active' | 'inactive' | 'failed';
123
+ image?: string | null;
124
+ azure_fqdn?: string | null;
125
+ error_message?: string | null;
126
+ ready_at?: string | null;
127
+ promoted_at?: string | null;
128
+ }
129
+ export interface HostingService {
130
+ id: string;
131
+ hosting_site_id: string;
132
+ name: string;
133
+ slug: string;
134
+ role: HostingServiceRole;
135
+ runtime: 'node' | 'python' | 'rust' | 'container';
136
+ visibility: HostingServiceVisibility;
137
+ status: 'draft' | 'deploying' | 'active' | 'disabled' | 'failed';
138
+ is_primary: boolean;
139
+ target_port?: number | null;
140
+ transport: 'http' | 'http2' | 'tcp';
141
+ health_check_path?: string | null;
142
+ capacity_model: HostingCapacityModel;
143
+ container_cpu: number;
144
+ container_memory_mb: number;
145
+ min_replicas: number;
146
+ max_replicas: number;
147
+ schedule_cron?: string | null;
148
+ depends_on: string[];
149
+ database_bindings: string[];
150
+ secret_names: string[];
151
+ active_deployment?: HostingServiceDeployment | null;
152
+ deployments?: HostingServiceDeployment[];
153
+ }
154
+ export interface HostingServiceDefinition {
155
+ name?: string;
156
+ slug: string;
157
+ role?: HostingServiceRole;
158
+ runtime?: 'node' | 'python' | 'rust' | 'container';
159
+ visibility?: HostingServiceVisibility;
160
+ is_primary?: boolean;
161
+ target_port?: number;
162
+ transport?: 'http' | 'http2' | 'tcp';
163
+ health_check_path?: string;
164
+ capacity_model?: HostingCapacityModel;
165
+ container_cpu?: number;
166
+ container_memory_mb?: number;
167
+ min_replicas?: number;
168
+ max_replicas?: number;
169
+ schedule_cron?: string;
170
+ depends_on?: string[];
171
+ environment?: Record<string, string | number | boolean | null>;
172
+ database_bindings?: string[];
173
+ configuration?: Record<string, unknown>;
174
+ command?: string[];
175
+ arguments?: string[];
176
+ game_build_id?: string;
177
+ }
178
+ export interface HostingServiceStackRequest {
179
+ preset?: 'single_server' | 'web_and_api' | 'authoritative_world' | 'biomes_style';
180
+ game_build_id?: string;
181
+ builds?: Record<string, string>;
182
+ services?: HostingServiceDefinition[];
183
+ }
184
+ export interface ApplyHostingServiceStackRequest extends HostingServiceStackRequest {
185
+ version: string;
186
+ test?: {
187
+ service: string;
188
+ command: string[];
189
+ };
190
+ migration?: {
191
+ service: string;
192
+ command: string[];
193
+ };
194
+ }
195
+ export interface HostingServiceEstimate {
196
+ billing_provider: HostingBillingProvider;
197
+ estimated_monthly_floor_cents: number;
198
+ estimated_monthly_floor_dollars: number;
199
+ services: Array<Record<string, unknown>>;
200
+ rates: {
201
+ vcpu_hour_cents: number;
202
+ memory_gib_hour_cents: number;
203
+ requests_million_cents: number;
204
+ };
205
+ note: string;
110
206
  }
111
207
  export interface CreateHostingSiteRequest {
112
208
  name: string;
@@ -197,6 +293,14 @@ declare class Hosting {
197
293
  static checkDomain<T>(hostname: string): AxiosPromise<Response<T>>;
198
294
  static purchaseDomain<T>(title_id: string, site_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
199
295
  static aiInstructions<T>(title_id: string, site_id: string, data?: Record<string, any>): AxiosPromise<Response<T>>;
296
+ static services<T = HostingService[]>(title_id: string, site_id: string): AxiosPromise<Response<T>>;
297
+ /** Calculate the always-on floor without creating resources or charges. */
298
+ static estimateServices<T = HostingServiceEstimate>(title_id: string, site_id: string, data: HostingServiceStackRequest): AxiosPromise<Response<T>>;
299
+ /** Queue an immutable multi-service release. Publishing remains a separate operation. */
300
+ static applyServices<T>(title_id: string, site_id: string, data: ApplyHostingServiceStackRequest): AxiosPromise<Response<T>>;
301
+ /** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
302
+ static putServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string, value: string): AxiosPromise<Response<T>>;
303
+ static deleteServiceSecret<T>(title_id: string, site_id: string, service_id: string, name: string): AxiosPromise<Response<T>>;
200
304
  static resolve<T>(hostname: string, gatewayToken?: string): AxiosPromise<Response<T>>;
201
305
  static startPlaySession<T>(data: Record<string, any>): AxiosPromise<Response<T>>;
202
306
  static heartbeatPlaySession<T>(session_id: string, sessionToken: string): AxiosPromise<Response<T>>;
package/dist/esm/index.js CHANGED
@@ -21341,6 +21341,11 @@ HostingRoute.routes = {
21341
21341
  checkDomain: { url: '/hosting/domains/check', method: HTTP_METHODS.POST },
21342
21342
  purchaseDomain: { url: '/titles/{title_id}/hosting/sites/{site_id}/domains/purchase', method: HTTP_METHODS.POST },
21343
21343
  aiInstructions: { url: '/titles/{title_id}/hosting/sites/{site_id}/ai-instructions', method: HTTP_METHODS.POST },
21344
+ services: { url: '/titles/{title_id}/hosting/sites/{site_id}/services', method: HTTP_METHODS.GET },
21345
+ estimateServices: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/estimate', method: HTTP_METHODS.POST },
21346
+ applyServices: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/apply', method: HTTP_METHODS.POST },
21347
+ putServiceSecret: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/{service_id}/secrets/{name}', method: HTTP_METHODS.PUT },
21348
+ deleteServiceSecret: { url: '/titles/{title_id}/hosting/sites/{site_id}/services/{service_id}/secrets/{name}', method: HTTP_METHODS.DELETE },
21344
21349
  resolve: { url: '/hosting/resolve', method: HTTP_METHODS.GET },
21345
21350
  startPlaySession: { url: '/hosting/play-sessions', method: HTTP_METHODS.POST },
21346
21351
  heartbeatPlaySession: { url: '/hosting/play-sessions/{session_id}/heartbeat', method: HTTP_METHODS.POST },
@@ -21439,6 +21444,24 @@ class Hosting {
21439
21444
  static aiInstructions(title_id, site_id, data = {}) {
21440
21445
  return Requests.processRoute(HostingRoute.routes.aiInstructions, data, { title_id, site_id });
21441
21446
  }
21447
+ static services(title_id, site_id) {
21448
+ return Requests.processRoute(HostingRoute.routes.services, undefined, { title_id, site_id });
21449
+ }
21450
+ /** Calculate the always-on floor without creating resources or charges. */
21451
+ static estimateServices(title_id, site_id, data) {
21452
+ return Requests.processRoute(HostingRoute.routes.estimateServices, data, { title_id, site_id });
21453
+ }
21454
+ /** Queue an immutable multi-service release. Publishing remains a separate operation. */
21455
+ static applyServices(title_id, site_id, data) {
21456
+ return Requests.processRoute(HostingRoute.routes.applyServices, data, { title_id, site_id });
21457
+ }
21458
+ /** Store or rotate a secret. The API never returns the value. Interactive administrators only. */
21459
+ static putServiceSecret(title_id, site_id, service_id, name, value) {
21460
+ return Requests.processRoute(HostingRoute.routes.putServiceSecret, { value }, { title_id, site_id, service_id, name });
21461
+ }
21462
+ static deleteServiceSecret(title_id, site_id, service_id, name) {
21463
+ return Requests.processRoute(HostingRoute.routes.deleteServiceSecret, undefined, { title_id, site_id, service_id, name });
21464
+ }
21442
21465
  static resolve(hostname, gatewayToken) {
21443
21466
  if (!gatewayToken) {
21444
21467
  return Requests.processRoute(HostingRoute.routes.resolve, undefined, undefined, { hostname });