glitch-javascript-sdk 3.8.13 → 3.9.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.
@@ -0,0 +1,133 @@
1
+ import { AxiosPromise, AxiosProgressEvent } from 'axios';
2
+ import Response from '../util/Response';
3
+ export type HostingPlanKey = 'free' | 'launch' | 'growth' | 'scale' | 'studio';
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';
7
+ export type HostingDeliveryChannel = 'glitch_store' | 'glitch_hosted_subdomain' | 'glitch_hosted_custom_domain' | 'external';
8
+ export interface HostingAccount {
9
+ id: string;
10
+ community_id: string;
11
+ plan: HostingPlanKey;
12
+ status: string;
13
+ included_bandwidth_bytes: number;
14
+ used_bandwidth_bytes: number;
15
+ remaining_bandwidth_bytes: number;
16
+ bandwidth_overage_enabled: boolean;
17
+ bandwidth_spend_limit_cents?: number | null;
18
+ }
19
+ export interface HostingRelease {
20
+ id: string;
21
+ hosting_site_id: string;
22
+ game_build_id?: string | null;
23
+ version: string;
24
+ status: 'uploading' | 'processing' | 'ready' | 'failed' | 'active' | 'inactive';
25
+ source_type: 'upload' | 'cli' | 'game_build';
26
+ entry_point: string;
27
+ size_bytes: number;
28
+ checksum?: string | null;
29
+ error_message?: string | null;
30
+ promoted_at?: string | null;
31
+ }
32
+ export interface HostingDomain {
33
+ id: string;
34
+ hostname: string;
35
+ type: 'generated' | 'custom' | 'managed';
36
+ status: 'pending_verification' | 'provisioning' | 'active' | 'failed' | 'expired';
37
+ verification_record_type?: string | null;
38
+ verification_record_name?: string | null;
39
+ verification_record_value?: string | null;
40
+ certificate_status?: string | null;
41
+ annual_price_cents?: number | null;
42
+ auto_renew: boolean;
43
+ }
44
+ export interface HostingDatabase {
45
+ id: string;
46
+ hosting_site_id: string;
47
+ name: string;
48
+ engine: HostingDatabaseEngine;
49
+ plan: HostingDatabasePlan;
50
+ status: 'awaiting_payment' | 'requested' | 'provisioning' | 'ready' | 'resizing' | 'restoring' | 'failed' | 'deleting' | 'deleted';
51
+ deployment_model: 'shared' | 'dedicated' | 'serverless';
52
+ azure_region: string;
53
+ included_storage_bytes: number;
54
+ current_storage_bytes: number;
55
+ auto_grow_enabled: boolean;
56
+ backup_retention_days: number;
57
+ high_availability_enabled: boolean;
58
+ endpoint?: string | null;
59
+ port?: number | null;
60
+ binding_name: 'DATABASE_URL' | 'COSMOS_DATABASE';
61
+ last_error?: string | null;
62
+ }
63
+ export interface HostingSite {
64
+ id: string;
65
+ hosting_account_id: string;
66
+ community_id: string;
67
+ title_id: string;
68
+ name: string;
69
+ slug: string;
70
+ community_slug: string;
71
+ generated_hostname: string;
72
+ url: string;
73
+ mode: HostingMode;
74
+ status: 'draft' | 'provisioning' | 'live' | 'limited' | 'failed' | 'disabled';
75
+ server_mode_enabled: boolean;
76
+ azure_region?: string | null;
77
+ active_release?: HostingRelease | null;
78
+ domains?: HostingDomain[];
79
+ databases?: HostingDatabase[];
80
+ }
81
+ export interface CreateHostingSiteRequest {
82
+ name: string;
83
+ slug: string;
84
+ mode: HostingMode;
85
+ azure_region?: string;
86
+ }
87
+ export interface CreateHostingReleaseRequest {
88
+ version: string;
89
+ source_type: 'upload' | 'cli' | 'game_build';
90
+ blob_path?: string;
91
+ game_build_id?: string;
92
+ entry_point?: string;
93
+ }
94
+ export interface CreateHostingDatabaseRequest {
95
+ name: string;
96
+ engine: HostingDatabaseEngine;
97
+ plan: HostingDatabasePlan;
98
+ azure_region: string;
99
+ auto_grow_enabled?: boolean;
100
+ high_availability_enabled?: boolean;
101
+ }
102
+ /**
103
+ * Typed SDK for game website hosting, Azure database add-ons, domains, usage,
104
+ * deployment instructions, and hosted-play attribution.
105
+ */
106
+ declare class Hosting {
107
+ static catalog<T>(): AxiosPromise<Response<T>>;
108
+ static dashboard<T>(title_id: string): AxiosPromise<Response<T>>;
109
+ static channelAnalytics<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
110
+ static createSite<T>(title_id: string, data: CreateHostingSiteRequest): AxiosPromise<Response<T>>;
111
+ static updateSite<T>(title_id: string, site_id: string, data: Partial<CreateHostingSiteRequest> & Record<string, any>): AxiosPromise<Response<T>>;
112
+ static createUploadUrl<T>(title_id: string, site_id: string): AxiosPromise<Response<T>>;
113
+ /** Upload directly to the short-lived Azure URL returned by createUploadUrl. */
114
+ static uploadBuild(uploadUrl: string, file: Blob, requiredHeaders?: Record<string, string>, onUploadProgress?: (event: AxiosProgressEvent) => void): AxiosPromise<void>;
115
+ static releases<T>(title_id: string, site_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
116
+ static createRelease<T>(title_id: string, site_id: string, data: CreateHostingReleaseRequest): AxiosPromise<Response<T>>;
117
+ static promoteRelease<T>(title_id: string, site_id: string, release_id: string): AxiosPromise<Response<T>>;
118
+ static connectDomain<T>(title_id: string, site_id: string, hostname: string): AxiosPromise<Response<T>>;
119
+ static verifyDomain<T>(title_id: string, site_id: string, domain_id: string): AxiosPromise<Response<T>>;
120
+ static checkDomain<T>(hostname: string): AxiosPromise<Response<T>>;
121
+ static purchaseDomain<T>(title_id: string, site_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
122
+ static aiInstructions<T>(title_id: string, site_id: string, data?: Record<string, any>): AxiosPromise<Response<T>>;
123
+ static resolve<T>(hostname: string): AxiosPromise<Response<T>>;
124
+ static startPlaySession<T>(data: Record<string, any>): AxiosPromise<Response<T>>;
125
+ static heartbeatPlaySession<T>(session_id: string, sessionToken: string): AxiosPromise<Response<T>>;
126
+ static databases<T>(title_id: string, site_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
127
+ static createDatabase<T>(title_id: string, site_id: string, data: CreateHostingDatabaseRequest): AxiosPromise<Response<T>>;
128
+ static database<T>(title_id: string, site_id: string, database_id: string): AxiosPromise<Response<T>>;
129
+ static updateDatabase<T>(title_id: string, site_id: string, database_id: string, data: Record<string, any>): AxiosPromise<Response<T>>;
130
+ static retryDatabase<T>(title_id: string, site_id: string, database_id: string): AxiosPromise<Response<T>>;
131
+ static deleteDatabase<T>(title_id: string, site_id: string, database_id: string, confirmation: string): AxiosPromise<Response<T>>;
132
+ }
133
+ export default Hosting;
@@ -52,6 +52,7 @@ import AdminReports from "./AdminReports";
52
52
  import AdminUsers from "./AdminUsers";
53
53
  import MarketResearch from "./MarketResearch";
54
54
  import GameAdvertising from './GameAdvertising';
55
+ import Hosting from './Hosting';
55
56
  export { Ads };
56
57
  export { AccessKeys };
57
58
  export { Auth };
@@ -106,3 +107,4 @@ export { AdminReports };
106
107
  export { AdminUsers };
107
108
  export { MarketResearch };
108
109
  export { GameAdvertising };
110
+ export { Hosting };
@@ -52,6 +52,7 @@ import { AdminReports } from './api';
52
52
  import { AdminUsers } from './api';
53
53
  import { MarketResearch } from './api';
54
54
  import { GameAdvertising } from './api';
55
+ import { Hosting } from './api';
55
56
  import Requests from "./util/Requests";
56
57
  import Parser from "./util/Parser";
57
58
  import Session from "./util/Session";
@@ -125,6 +126,7 @@ declare class Glitch {
125
126
  AdminUsers: typeof AdminUsers;
126
127
  MarketResearch: typeof MarketResearch;
127
128
  GameAdvertising: typeof GameAdvertising;
129
+ Hosting: typeof Hosting;
128
130
  };
129
131
  static util: {
130
132
  Requests: typeof Requests;