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.
@@ -5,12 +5,15 @@ export type HostingMode = 'static' | 'server';
5
5
  export type HostingDatabaseEngine = 'postgresql' | 'mysql' | 'azure_sql' | 'cosmos_nosql';
6
6
  export type HostingDatabasePlan = 'sandbox' | 'launch' | 'growth' | 'scale' | 'dedicated';
7
7
  export type HostingDeliveryChannel = 'glitch_store' | 'glitch_hosted_subdomain' | 'glitch_hosted_custom_domain' | 'external';
8
+ export type HostingBillingProvider = 'direct' | 'microsoft_marketplace';
8
9
  export interface HostingAccount {
9
10
  id: string;
10
11
  community_id: string;
11
12
  plan: HostingPlanKey;
12
13
  pending_plan?: HostingPlanKey | null;
13
14
  status: string;
15
+ billing_provider: HostingBillingProvider;
16
+ microsoft_marketplace_subscription_id?: string | null;
14
17
  included_bandwidth_bytes: number;
15
18
  used_bandwidth_bytes: number;
16
19
  remaining_bandwidth_bytes: number;
@@ -61,6 +64,7 @@ export interface HostingDatabase {
61
64
  port?: number | null;
62
65
  binding_name: string;
63
66
  billing_status: 'awaiting_payment' | 'active' | 'past_due' | 'unpaid' | 'cancelled' | 'expired' | 'failed';
67
+ billing_provider: HostingBillingProvider;
64
68
  billing_active: boolean;
65
69
  last_error?: string | null;
66
70
  }
@@ -103,6 +107,23 @@ export interface CreateHostingDatabaseRequest {
103
107
  auto_grow_enabled?: boolean;
104
108
  high_availability_enabled?: boolean;
105
109
  }
110
+ export interface HostingMarketplaceSubscription {
111
+ id: string;
112
+ marketplace_subscription_id: string;
113
+ subscription_name?: string | null;
114
+ offer_id: string;
115
+ plan_id: string;
116
+ plan_key: HostingPlanKey;
117
+ status: 'PendingFulfillmentStart' | 'Subscribed' | 'Suspended' | 'Unsubscribed';
118
+ quantity: number;
119
+ community_id?: string | null;
120
+ is_test: boolean;
121
+ is_free_trial: boolean;
122
+ auto_renew: boolean;
123
+ term_starts_at?: string | null;
124
+ term_ends_at?: string | null;
125
+ activated_at?: string | null;
126
+ }
106
127
  /**
107
128
  * Typed SDK for game website hosting, Azure database add-ons, domains, usage,
108
129
  * deployment instructions, and hosted-play attribution.
@@ -115,6 +136,12 @@ declare class Hosting {
115
136
  static billingCheckout<T>(title_id: string, plan: HostingPlanKey): AxiosPromise<Response<T>>;
116
137
  /** Confirm a paid Stripe Checkout session before provisioning its Azure resource. */
117
138
  static confirmBillingCheckout<T>(title_id: string, checkout_session_id: string): AxiosPromise<Response<T>>;
139
+ /** Resolve the one-hour purchase token passed to Glitch by Microsoft Marketplace. */
140
+ static resolveMarketplacePurchase<T>(token: string): AxiosPromise<Response<T>>;
141
+ /** Link a resolved Microsoft Marketplace subscription to a billable Glitch business account. */
142
+ static activateMarketplaceSubscription<T>(subscription_id: string, community_id: string): AxiosPromise<Response<T>>;
143
+ /** Retrieve safe Microsoft Marketplace entitlement and lifecycle status. */
144
+ static marketplaceSubscription<T>(subscription_id: string): AxiosPromise<Response<T>>;
118
145
  static createSite<T>(title_id: string, data: CreateHostingSiteRequest): AxiosPromise<Response<T>>;
119
146
  static updateSite<T>(title_id: string, site_id: string, data: Partial<CreateHostingSiteRequest> & Record<string, any>): AxiosPromise<Response<T>>;
120
147
  static createUploadUrl<T>(title_id: string, site_id: string): AxiosPromise<Response<T>>;
@@ -4,6 +4,31 @@ export type GameReviewRecommendation = 'recommended' | 'not_recommended' | 'neut
4
4
  export type GameReviewSentiment = 'positive' | 'mixed' | 'negative';
5
5
  export type GameReviewVoteType = 'helpful' | 'funny' | 'detailed' | 'not_helpful';
6
6
  export type GameReviewReportReason = 'abuse' | 'spam' | 'off_topic' | 'manipulation' | 'hate' | 'personal_info' | 'other';
7
+ export type TitleTokenPurpose = 'install' | 'deploy' | 'hosting';
8
+ export type TitleTokenAbility = 'deployments:*' | 'deployments:create' | 'deployments:read' | 'deployments:activate' | 'hosting:*' | 'hosting:read' | 'hosting:deploy' | 'hosting:promote';
9
+ export interface CreateTitleTokenRequest {
10
+ expires_at?: string;
11
+ name?: string;
12
+ purpose?: TitleTokenPurpose;
13
+ abilities?: TitleTokenAbility[];
14
+ }
15
+ export interface TitleToken {
16
+ id: string;
17
+ title_id: string;
18
+ name?: string | null;
19
+ purpose: TitleTokenPurpose;
20
+ token_prefix: string;
21
+ abilities: TitleTokenAbility[];
22
+ expires_at?: string | null;
23
+ revoked: boolean;
24
+ last_used_at?: string | null;
25
+ created_at?: string;
26
+ }
27
+ export interface CreatedTitleToken {
28
+ /** Full secret value. Returned once and never retrievable again. */
29
+ full_token: string;
30
+ token: TitleToken;
31
+ }
7
32
  export interface GameReviewRatings {
8
33
  gameplay?: GameReviewSentiment;
9
34
  performance?: GameReviewSentiment;
@@ -212,17 +237,15 @@ declare class Titles {
212
237
  * Create a new API token for a title.
213
238
  * Returns { full_token: string, token: TitleToken }.
214
239
  */
215
- static createTitleToken<T>(title_id: string, data?: {
216
- expires_at?: string;
217
- }): AxiosPromise<Response<T>>;
240
+ static createTitleToken<T = CreatedTitleToken>(title_id: string, data?: CreateTitleTokenRequest): AxiosPromise<Response<T>>;
218
241
  /**
219
242
  * List all tokens for a title.
220
243
  */
221
- static listTitleTokens<T>(title_id: string): AxiosPromise<Response<T>>;
244
+ static listTitleTokens<T = TitleToken[]>(title_id: string): AxiosPromise<Response<T>>;
222
245
  /**
223
246
  * Revoke a specific token by ID.
224
247
  */
225
- static revokeTitleToken<T>(title_id: string, token_id: string): AxiosPromise<Response<T>>;
248
+ static revokeTitleToken<T = TitleToken>(title_id: string, token_id: string): AxiosPromise<Response<T>>;
226
249
  /**
227
250
  * Search for Titles using Meilisearch or fallback based on the query and filters.
228
251
  *
package/dist/esm/index.js CHANGED
@@ -21315,7 +21315,7 @@ class GameAdvertising {
21315
21315
  }
21316
21316
  }
21317
21317
 
21318
- /** Route catalog for Azure-backed game website hosting. */
21318
+ /** Route catalog for game website hosting and its direct or Marketplace billing. */
21319
21319
  class HostingRoute {
21320
21320
  }
21321
21321
  HostingRoute.routes = {
@@ -21324,6 +21324,9 @@ HostingRoute.routes = {
21324
21324
  channelAnalytics: { url: '/titles/{title_id}/hosting/analytics/channels', method: HTTP_METHODS.GET },
21325
21325
  billingCheckout: { url: '/titles/{title_id}/hosting/billing/checkout', method: HTTP_METHODS.POST },
21326
21326
  confirmBillingCheckout: { url: '/titles/{title_id}/hosting/billing/confirm', method: HTTP_METHODS.POST },
21327
+ resolveMarketplacePurchase: { url: '/hosting/marketplace/resolve', method: HTTP_METHODS.POST },
21328
+ activateMarketplaceSubscription: { url: '/hosting/marketplace/subscriptions/{subscription_id}/activate', method: HTTP_METHODS.POST },
21329
+ marketplaceSubscription: { url: '/hosting/marketplace/subscriptions/{subscription_id}', method: HTTP_METHODS.GET },
21327
21330
  createSite: { url: '/titles/{title_id}/hosting/sites', method: HTTP_METHODS.POST },
21328
21331
  updateSite: { url: '/titles/{title_id}/hosting/sites/{site_id}', method: HTTP_METHODS.PUT },
21329
21332
  uploadUrl: { url: '/titles/{title_id}/hosting/sites/{site_id}/upload-url', method: HTTP_METHODS.POST },
@@ -21368,6 +21371,18 @@ class Hosting {
21368
21371
  static confirmBillingCheckout(title_id, checkout_session_id) {
21369
21372
  return Requests.processRoute(HostingRoute.routes.confirmBillingCheckout, { checkout_session_id }, { title_id });
21370
21373
  }
21374
+ /** Resolve the one-hour purchase token passed to Glitch by Microsoft Marketplace. */
21375
+ static resolveMarketplacePurchase(token) {
21376
+ return Requests.processRoute(HostingRoute.routes.resolveMarketplacePurchase, { token });
21377
+ }
21378
+ /** Link a resolved Microsoft Marketplace subscription to a billable Glitch business account. */
21379
+ static activateMarketplaceSubscription(subscription_id, community_id) {
21380
+ return Requests.processRoute(HostingRoute.routes.activateMarketplaceSubscription, { community_id }, { subscription_id });
21381
+ }
21382
+ /** Retrieve safe Microsoft Marketplace entitlement and lifecycle status. */
21383
+ static marketplaceSubscription(subscription_id) {
21384
+ return Requests.processRoute(HostingRoute.routes.marketplaceSubscription, undefined, { subscription_id });
21385
+ }
21371
21386
  static createSite(title_id, data) {
21372
21387
  return Requests.processRoute(HostingRoute.routes.createSite, data, { title_id });
21373
21388
  }