glitch-javascript-sdk 3.9.4 → 3.9.6
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/browser/hosting-runtime.js +16 -1
- package/dist/browser/hosting-runtime.js.map +1 -1
- package/dist/cjs/index.js +16 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Hosting.d.ts +27 -0
- package/dist/esm/api/Titles.d.ts +28 -5
- package/dist/esm/index.js +16 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/HostingRoute.d.ts +1 -1
- package/dist/index.d.ts +34 -5
- package/package.json +1 -1
- package/src/api/Hosting.ts +37 -0
- package/src/api/Titles.ts +41 -4
- package/src/routes/HostingRoute.ts +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -4107,6 +4107,31 @@ type GameReviewRecommendation = 'recommended' | 'not_recommended' | 'neutral';
|
|
|
4107
4107
|
type GameReviewSentiment = 'positive' | 'mixed' | 'negative';
|
|
4108
4108
|
type GameReviewVoteType = 'helpful' | 'funny' | 'detailed' | 'not_helpful';
|
|
4109
4109
|
type GameReviewReportReason = 'abuse' | 'spam' | 'off_topic' | 'manipulation' | 'hate' | 'personal_info' | 'other';
|
|
4110
|
+
type TitleTokenPurpose = 'install' | 'deploy' | 'hosting';
|
|
4111
|
+
type TitleTokenAbility = 'deployments:*' | 'deployments:create' | 'deployments:read' | 'deployments:activate' | 'hosting:*' | 'hosting:read' | 'hosting:deploy' | 'hosting:promote';
|
|
4112
|
+
interface CreateTitleTokenRequest {
|
|
4113
|
+
expires_at?: string;
|
|
4114
|
+
name?: string;
|
|
4115
|
+
purpose?: TitleTokenPurpose;
|
|
4116
|
+
abilities?: TitleTokenAbility[];
|
|
4117
|
+
}
|
|
4118
|
+
interface TitleToken {
|
|
4119
|
+
id: string;
|
|
4120
|
+
title_id: string;
|
|
4121
|
+
name?: string | null;
|
|
4122
|
+
purpose: TitleTokenPurpose;
|
|
4123
|
+
token_prefix: string;
|
|
4124
|
+
abilities: TitleTokenAbility[];
|
|
4125
|
+
expires_at?: string | null;
|
|
4126
|
+
revoked: boolean;
|
|
4127
|
+
last_used_at?: string | null;
|
|
4128
|
+
created_at?: string;
|
|
4129
|
+
}
|
|
4130
|
+
interface CreatedTitleToken {
|
|
4131
|
+
/** Full secret value. Returned once and never retrievable again. */
|
|
4132
|
+
full_token: string;
|
|
4133
|
+
token: TitleToken;
|
|
4134
|
+
}
|
|
4110
4135
|
interface GameReviewRatings {
|
|
4111
4136
|
gameplay?: GameReviewSentiment;
|
|
4112
4137
|
performance?: GameReviewSentiment;
|
|
@@ -4315,17 +4340,15 @@ declare class Titles {
|
|
|
4315
4340
|
* Create a new API token for a title.
|
|
4316
4341
|
* Returns { full_token: string, token: TitleToken }.
|
|
4317
4342
|
*/
|
|
4318
|
-
static createTitleToken<T>(title_id: string, data?:
|
|
4319
|
-
expires_at?: string;
|
|
4320
|
-
}): AxiosPromise<Response<T>>;
|
|
4343
|
+
static createTitleToken<T = CreatedTitleToken>(title_id: string, data?: CreateTitleTokenRequest): AxiosPromise<Response<T>>;
|
|
4321
4344
|
/**
|
|
4322
4345
|
* List all tokens for a title.
|
|
4323
4346
|
*/
|
|
4324
|
-
static listTitleTokens<T>(title_id: string): AxiosPromise<Response<T>>;
|
|
4347
|
+
static listTitleTokens<T = TitleToken[]>(title_id: string): AxiosPromise<Response<T>>;
|
|
4325
4348
|
/**
|
|
4326
4349
|
* Revoke a specific token by ID.
|
|
4327
4350
|
*/
|
|
4328
|
-
static revokeTitleToken<T>(title_id: string, token_id: string): AxiosPromise<Response<T>>;
|
|
4351
|
+
static revokeTitleToken<T = TitleToken>(title_id: string, token_id: string): AxiosPromise<Response<T>>;
|
|
4329
4352
|
/**
|
|
4330
4353
|
* Search for Titles using Meilisearch or fallback based on the query and filters.
|
|
4331
4354
|
*
|
|
@@ -11562,6 +11585,12 @@ declare class Hosting {
|
|
|
11562
11585
|
static billingCheckout<T>(title_id: string, plan: HostingPlanKey): AxiosPromise<Response<T>>;
|
|
11563
11586
|
/** Confirm a paid Stripe Checkout session before provisioning its Azure resource. */
|
|
11564
11587
|
static confirmBillingCheckout<T>(title_id: string, checkout_session_id: string): AxiosPromise<Response<T>>;
|
|
11588
|
+
/** Resolve the one-hour purchase token passed to Glitch by Microsoft Marketplace. */
|
|
11589
|
+
static resolveMarketplacePurchase<T>(token: string): AxiosPromise<Response<T>>;
|
|
11590
|
+
/** Link a resolved Microsoft Marketplace subscription to a billable Glitch business account. */
|
|
11591
|
+
static activateMarketplaceSubscription<T>(subscription_id: string, community_id: string): AxiosPromise<Response<T>>;
|
|
11592
|
+
/** Retrieve safe Microsoft Marketplace entitlement and lifecycle status. */
|
|
11593
|
+
static marketplaceSubscription<T>(subscription_id: string): AxiosPromise<Response<T>>;
|
|
11565
11594
|
static createSite<T>(title_id: string, data: CreateHostingSiteRequest): AxiosPromise<Response<T>>;
|
|
11566
11595
|
static updateSite<T>(title_id: string, site_id: string, data: Partial<CreateHostingSiteRequest> & Record<string, any>): AxiosPromise<Response<T>>;
|
|
11567
11596
|
static createUploadUrl<T>(title_id: string, site_id: string): AxiosPromise<Response<T>>;
|
package/package.json
CHANGED
package/src/api/Hosting.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type HostingMode = 'static' | 'server';
|
|
|
9
9
|
export type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql';
|
|
10
10
|
export type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated';
|
|
11
11
|
export type HostingDeliveryChannel = 'glitch_store' | 'glitch_hosted_subdomain' | 'glitch_hosted_custom_domain' | 'external';
|
|
12
|
+
export type HostingBillingProvider = 'direct' | 'microsoft_marketplace';
|
|
12
13
|
|
|
13
14
|
export interface HostingAccount {
|
|
14
15
|
id: string;
|
|
@@ -16,6 +17,8 @@ export interface HostingAccount {
|
|
|
16
17
|
plan: HostingPlanKey;
|
|
17
18
|
pending_plan?: HostingPlanKey | null;
|
|
18
19
|
status: string;
|
|
20
|
+
billing_provider: HostingBillingProvider;
|
|
21
|
+
microsoft_marketplace_subscription_id?: string | null;
|
|
19
22
|
included_bandwidth_bytes: number;
|
|
20
23
|
used_bandwidth_bytes: number;
|
|
21
24
|
remaining_bandwidth_bytes: number;
|
|
@@ -69,6 +72,7 @@ export interface HostingDatabase {
|
|
|
69
72
|
port?: number | null;
|
|
70
73
|
binding_name: string;
|
|
71
74
|
billing_status: 'awaiting_payment' | 'active' | 'past_due' | 'unpaid' | 'cancelled' | 'expired' | 'failed';
|
|
75
|
+
billing_provider: HostingBillingProvider;
|
|
72
76
|
billing_active: boolean;
|
|
73
77
|
last_error?: string | null;
|
|
74
78
|
}
|
|
@@ -116,6 +120,24 @@ export interface CreateHostingDatabaseRequest {
|
|
|
116
120
|
high_availability_enabled?: boolean;
|
|
117
121
|
}
|
|
118
122
|
|
|
123
|
+
export interface HostingMarketplaceSubscription {
|
|
124
|
+
id: string;
|
|
125
|
+
marketplace_subscription_id: string;
|
|
126
|
+
subscription_name?: string | null;
|
|
127
|
+
offer_id: string;
|
|
128
|
+
plan_id: string;
|
|
129
|
+
plan_key: HostingPlanKey;
|
|
130
|
+
status: 'PendingFulfillmentStart' | 'Subscribed' | 'Suspended' | 'Unsubscribed';
|
|
131
|
+
quantity: number;
|
|
132
|
+
community_id?: string | null;
|
|
133
|
+
is_test: boolean;
|
|
134
|
+
is_free_trial: boolean;
|
|
135
|
+
auto_renew: boolean;
|
|
136
|
+
term_starts_at?: string | null;
|
|
137
|
+
term_ends_at?: string | null;
|
|
138
|
+
activated_at?: string | null;
|
|
139
|
+
}
|
|
140
|
+
|
|
119
141
|
/**
|
|
120
142
|
* Typed SDK for game website hosting, Azure database add-ons, domains, usage,
|
|
121
143
|
* deployment instructions, and hosted-play attribution.
|
|
@@ -143,6 +165,21 @@ class Hosting {
|
|
|
143
165
|
return Requests.processRoute(HostingRoute.routes.confirmBillingCheckout, { checkout_session_id }, { title_id });
|
|
144
166
|
}
|
|
145
167
|
|
|
168
|
+
/** Resolve the one-hour purchase token passed to Glitch by Microsoft Marketplace. */
|
|
169
|
+
public static resolveMarketplacePurchase<T>(token: string): AxiosPromise<Response<T>> {
|
|
170
|
+
return Requests.processRoute(HostingRoute.routes.resolveMarketplacePurchase, { token });
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Link a resolved Microsoft Marketplace subscription to a billable Glitch business account. */
|
|
174
|
+
public static activateMarketplaceSubscription<T>(subscription_id: string, community_id: string): AxiosPromise<Response<T>> {
|
|
175
|
+
return Requests.processRoute(HostingRoute.routes.activateMarketplaceSubscription, { community_id }, { subscription_id });
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Retrieve safe Microsoft Marketplace entitlement and lifecycle status. */
|
|
179
|
+
public static marketplaceSubscription<T>(subscription_id: string): AxiosPromise<Response<T>> {
|
|
180
|
+
return Requests.processRoute(HostingRoute.routes.marketplaceSubscription, undefined, { subscription_id });
|
|
181
|
+
}
|
|
182
|
+
|
|
146
183
|
public static createSite<T>(title_id: string, data: CreateHostingSiteRequest): AxiosPromise<Response<T>> {
|
|
147
184
|
return Requests.processRoute(HostingRoute.routes.createSite, data, { title_id });
|
|
148
185
|
}
|
package/src/api/Titles.ts
CHANGED
|
@@ -8,6 +8,43 @@ export type GameReviewSentiment = 'positive' | 'mixed' | 'negative';
|
|
|
8
8
|
export type GameReviewVoteType = 'helpful' | 'funny' | 'detailed' | 'not_helpful';
|
|
9
9
|
export type GameReviewReportReason = 'abuse' | 'spam' | 'off_topic' | 'manipulation' | 'hate' | 'personal_info' | 'other';
|
|
10
10
|
|
|
11
|
+
export type TitleTokenPurpose = 'install' | 'deploy' | 'hosting';
|
|
12
|
+
export type TitleTokenAbility =
|
|
13
|
+
| 'deployments:*'
|
|
14
|
+
| 'deployments:create'
|
|
15
|
+
| 'deployments:read'
|
|
16
|
+
| 'deployments:activate'
|
|
17
|
+
| 'hosting:*'
|
|
18
|
+
| 'hosting:read'
|
|
19
|
+
| 'hosting:deploy'
|
|
20
|
+
| 'hosting:promote';
|
|
21
|
+
|
|
22
|
+
export interface CreateTitleTokenRequest {
|
|
23
|
+
expires_at?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
purpose?: TitleTokenPurpose;
|
|
26
|
+
abilities?: TitleTokenAbility[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface TitleToken {
|
|
30
|
+
id: string;
|
|
31
|
+
title_id: string;
|
|
32
|
+
name?: string | null;
|
|
33
|
+
purpose: TitleTokenPurpose;
|
|
34
|
+
token_prefix: string;
|
|
35
|
+
abilities: TitleTokenAbility[];
|
|
36
|
+
expires_at?: string | null;
|
|
37
|
+
revoked: boolean;
|
|
38
|
+
last_used_at?: string | null;
|
|
39
|
+
created_at?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface CreatedTitleToken {
|
|
43
|
+
/** Full secret value. Returned once and never retrievable again. */
|
|
44
|
+
full_token: string;
|
|
45
|
+
token: TitleToken;
|
|
46
|
+
}
|
|
47
|
+
|
|
11
48
|
export interface GameReviewRatings {
|
|
12
49
|
gameplay?: GameReviewSentiment;
|
|
13
50
|
performance?: GameReviewSentiment;
|
|
@@ -305,9 +342,9 @@ class Titles {
|
|
|
305
342
|
* Create a new API token for a title.
|
|
306
343
|
* Returns { full_token: string, token: TitleToken }.
|
|
307
344
|
*/
|
|
308
|
-
public static createTitleToken<T>(
|
|
345
|
+
public static createTitleToken<T = CreatedTitleToken>(
|
|
309
346
|
title_id: string,
|
|
310
|
-
data?:
|
|
347
|
+
data?: CreateTitleTokenRequest
|
|
311
348
|
): AxiosPromise<Response<T>> {
|
|
312
349
|
return Requests.processRoute(
|
|
313
350
|
TitlesRoute.routes.createToken,
|
|
@@ -319,7 +356,7 @@ class Titles {
|
|
|
319
356
|
/**
|
|
320
357
|
* List all tokens for a title.
|
|
321
358
|
*/
|
|
322
|
-
public static listTitleTokens<T>(
|
|
359
|
+
public static listTitleTokens<T = TitleToken[]>(
|
|
323
360
|
title_id: string
|
|
324
361
|
): AxiosPromise<Response<T>> {
|
|
325
362
|
return Requests.processRoute(
|
|
@@ -332,7 +369,7 @@ class Titles {
|
|
|
332
369
|
/**
|
|
333
370
|
* Revoke a specific token by ID.
|
|
334
371
|
*/
|
|
335
|
-
public static revokeTitleToken<T>(
|
|
372
|
+
public static revokeTitleToken<T = TitleToken>(
|
|
336
373
|
title_id: string,
|
|
337
374
|
token_id: string
|
|
338
375
|
): AxiosPromise<Response<T>> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Route from './interface';
|
|
2
2
|
import HTTP_METHODS from '../constants/HttpMethods';
|
|
3
3
|
|
|
4
|
-
/** Route catalog for
|
|
4
|
+
/** Route catalog for game website hosting and its direct or Marketplace billing. */
|
|
5
5
|
class HostingRoute {
|
|
6
6
|
public static routes: { [key: string]: Route } = {
|
|
7
7
|
catalog: { url: '/hosting/catalog', method: HTTP_METHODS.GET },
|
|
@@ -9,6 +9,9 @@ class HostingRoute {
|
|
|
9
9
|
channelAnalytics: { url: '/titles/{title_id}/hosting/analytics/channels', method: HTTP_METHODS.GET },
|
|
10
10
|
billingCheckout: { url: '/titles/{title_id}/hosting/billing/checkout', method: HTTP_METHODS.POST },
|
|
11
11
|
confirmBillingCheckout: { url: '/titles/{title_id}/hosting/billing/confirm', method: HTTP_METHODS.POST },
|
|
12
|
+
resolveMarketplacePurchase: { url: '/hosting/marketplace/resolve', method: HTTP_METHODS.POST },
|
|
13
|
+
activateMarketplaceSubscription: { url: '/hosting/marketplace/subscriptions/{subscription_id}/activate', method: HTTP_METHODS.POST },
|
|
14
|
+
marketplaceSubscription: { url: '/hosting/marketplace/subscriptions/{subscription_id}', method: HTTP_METHODS.GET },
|
|
12
15
|
createSite: { url: '/titles/{title_id}/hosting/sites', method: HTTP_METHODS.POST },
|
|
13
16
|
updateSite: { url: '/titles/{title_id}/hosting/sites/{site_id}', method: HTTP_METHODS.PUT },
|
|
14
17
|
uploadUrl: { url: '/titles/{title_id}/hosting/sites/{site_id}/upload-url', method: HTTP_METHODS.POST },
|