async-playfab-web-sdk 1.192.250526
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/Addon.d.mts +591 -0
- package/dist/Addon.js.map +1 -0
- package/dist/Addon.mjs +452 -0
- package/dist/Addon.mjs.map +1 -0
- package/dist/Admin.d.mts +3484 -0
- package/dist/Admin.js.map +1 -0
- package/dist/Admin.mjs +1112 -0
- package/dist/Admin.mjs.map +1 -0
- package/dist/Authentication.d.mts +109 -0
- package/dist/Authentication.js.map +1 -0
- package/dist/Authentication.mjs +290 -0
- package/dist/Authentication.mjs.map +1 -0
- package/dist/Client.d.mts +4482 -0
- package/dist/Client.js.map +1 -0
- package/dist/Client.mjs +1893 -0
- package/dist/Client.mjs.map +1 -0
- package/dist/CloudScript.d.mts +511 -0
- package/dist/CloudScript.js.map +1 -0
- package/dist/CloudScript.mjs +349 -0
- package/dist/CloudScript.mjs.map +1 -0
- package/dist/Data.d.mts +228 -0
- package/dist/Data.js.map +1 -0
- package/dist/Data.mjs +291 -0
- package/dist/Data.mjs.map +1 -0
- package/dist/Economy.d.mts +1865 -0
- package/dist/Economy.js.map +1 -0
- package/dist/Economy.mjs +614 -0
- package/dist/Economy.mjs.map +1 -0
- package/dist/Events.d.mts +307 -0
- package/dist/Events.js.map +1 -0
- package/dist/Events.mjs +327 -0
- package/dist/Events.mjs.map +1 -0
- package/dist/Experimentation.d.mts +357 -0
- package/dist/Experimentation.js.map +1 -0
- package/dist/Experimentation.mjs +333 -0
- package/dist/Experimentation.mjs.map +1 -0
- package/dist/Groups.d.mts +546 -0
- package/dist/Groups.js.map +1 -0
- package/dist/Groups.mjs +417 -0
- package/dist/Groups.mjs.map +1 -0
- package/dist/Insights.d.mts +141 -0
- package/dist/Insights.js.map +1 -0
- package/dist/Insights.mjs +286 -0
- package/dist/Insights.mjs.map +1 -0
- package/dist/Localization.d.mts +20 -0
- package/dist/Localization.js.map +1 -0
- package/dist/Localization.mjs +249 -0
- package/dist/Localization.mjs.map +1 -0
- package/dist/Multiplayer.d.mts +3059 -0
- package/dist/Multiplayer.js.map +1 -0
- package/dist/Multiplayer.mjs +862 -0
- package/dist/Multiplayer.mjs.map +1 -0
- package/dist/PlayFabCommon-BUv4zqXf.d.mts +72 -0
- package/dist/Profiles.d.mts +278 -0
- package/dist/Profiles.js.map +1 -0
- package/dist/Profiles.mjs +306 -0
- package/dist/Profiles.mjs.map +1 -0
- package/dist/Progression.d.mts +598 -0
- package/dist/Progression.js.map +1 -0
- package/dist/Progression.mjs +404 -0
- package/dist/Progression.mjs.map +1 -0
- package/dist/Server.d.mts +3889 -0
- package/dist/Server.js.map +1 -0
- package/dist/Server.mjs +1377 -0
- package/dist/Server.mjs.map +1 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6007 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +22 -0
- package/readme.md +25 -0
@@ -0,0 +1,511 @@
|
|
1
|
+
import { I as IPlayFabRequestCommon, a as IPlayFabResultCommon, P as PlayFabCommon } from './PlayFabCommon-BUv4zqXf.mjs';
|
2
|
+
|
3
|
+
interface AdCampaignAttributionModel {
|
4
|
+
/** UTC time stamp of attribution */
|
5
|
+
AttributedAt: string;
|
6
|
+
/** Attribution campaign identifier */
|
7
|
+
CampaignId?: string;
|
8
|
+
/** Attribution network name */
|
9
|
+
Platform?: string;
|
10
|
+
}
|
11
|
+
interface ContactEmailInfoModel {
|
12
|
+
/** The email address */
|
13
|
+
EmailAddress?: string;
|
14
|
+
/** The name of the email info data */
|
15
|
+
Name?: string;
|
16
|
+
/** The verification status of the email */
|
17
|
+
VerificationStatus?: string;
|
18
|
+
}
|
19
|
+
interface EmptyResult extends IPlayFabResultCommon {
|
20
|
+
}
|
21
|
+
interface EntityKey {
|
22
|
+
/** Unique ID of the entity. */
|
23
|
+
Id: string;
|
24
|
+
/** Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types */
|
25
|
+
Type?: string;
|
26
|
+
}
|
27
|
+
interface EventHubFunctionModel {
|
28
|
+
/** The connection string for the event hub. */
|
29
|
+
ConnectionString?: string;
|
30
|
+
/** The name of the event hub that triggers the Azure Function. */
|
31
|
+
EventHubName?: string;
|
32
|
+
/** The name the function was registered under. */
|
33
|
+
FunctionName?: string;
|
34
|
+
}
|
35
|
+
interface ExecuteCloudScriptResult extends IPlayFabResultCommon {
|
36
|
+
/** Number of PlayFab API requests issued by the CloudScript function */
|
37
|
+
APIRequestsIssued: number;
|
38
|
+
/** Information about the error, if any, that occurred during execution */
|
39
|
+
Error?: ScriptExecutionError;
|
40
|
+
ExecutionTimeSeconds: number;
|
41
|
+
/** The name of the function that executed */
|
42
|
+
FunctionName?: string;
|
43
|
+
/** The object returned from the CloudScript function, if any */
|
44
|
+
FunctionResult?: any;
|
45
|
+
/**
|
46
|
+
* Flag indicating if the FunctionResult was too large and was subsequently dropped from this event. This only occurs if
|
47
|
+
* the total event size is larger than 350KB.
|
48
|
+
*/
|
49
|
+
FunctionResultTooLarge?: boolean;
|
50
|
+
/** Number of external HTTP requests issued by the CloudScript function */
|
51
|
+
HttpRequestsIssued: number;
|
52
|
+
/**
|
53
|
+
* Entries logged during the function execution. These include both entries logged in the function code using log.info()
|
54
|
+
* and log.error() and error entries for API and HTTP request failures.
|
55
|
+
*/
|
56
|
+
Logs?: LogStatement[];
|
57
|
+
/**
|
58
|
+
* Flag indicating if the logs were too large and were subsequently dropped from this event. This only occurs if the total
|
59
|
+
* event size is larger than 350KB after the FunctionResult was removed.
|
60
|
+
*/
|
61
|
+
LogsTooLarge?: boolean;
|
62
|
+
MemoryConsumedBytes: number;
|
63
|
+
/**
|
64
|
+
* Processor time consumed while executing the function. This does not include time spent waiting on API calls or HTTP
|
65
|
+
* requests.
|
66
|
+
*/
|
67
|
+
ProcessorTimeSeconds: number;
|
68
|
+
/** The revision of the CloudScript that executed */
|
69
|
+
Revision: number;
|
70
|
+
}
|
71
|
+
interface ExecuteEntityCloudScriptRequest extends IPlayFabRequestCommon {
|
72
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
73
|
+
CustomTags?: Record<string, string | null>;
|
74
|
+
/** The optional entity to perform this action on. Defaults to the currently logged in entity. */
|
75
|
+
Entity?: EntityKey;
|
76
|
+
/** The name of the CloudScript function to execute */
|
77
|
+
FunctionName: string;
|
78
|
+
/** Object that is passed in to the function as the first argument */
|
79
|
+
FunctionParameter?: any;
|
80
|
+
/**
|
81
|
+
* Generate a 'entity_executed_cloudscript' PlayStream event containing the results of the function execution and other
|
82
|
+
* contextual information. This event will show up in the PlayStream debugger console for the player in Game Manager.
|
83
|
+
*/
|
84
|
+
GeneratePlayStreamEvent?: boolean;
|
85
|
+
/**
|
86
|
+
* Option for which revision of the CloudScript to execute. 'Latest' executes the most recently created revision, 'Live'
|
87
|
+
* executes the current live, published revision, and 'Specific' executes the specified revision. The default value is
|
88
|
+
* 'Specific', if the SpecificRevision parameter is specified, otherwise it is 'Live'.
|
89
|
+
*/
|
90
|
+
RevisionSelection?: string;
|
91
|
+
/** The specific revision to execute, when RevisionSelection is set to 'Specific' */
|
92
|
+
SpecificRevision?: number;
|
93
|
+
}
|
94
|
+
interface ExecuteFunctionRequest extends IPlayFabRequestCommon {
|
95
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
96
|
+
CustomTags?: Record<string, string | null>;
|
97
|
+
/** The optional entity to perform this action on. Defaults to the currently logged in entity. */
|
98
|
+
Entity?: EntityKey;
|
99
|
+
/** The name of the CloudScript function to execute */
|
100
|
+
FunctionName: string;
|
101
|
+
/** Object that is passed in to the function as the FunctionArgument field of the FunctionExecutionContext data structure */
|
102
|
+
FunctionParameter?: any;
|
103
|
+
/**
|
104
|
+
* Generate a 'entity_executed_cloudscript_function' PlayStream event containing the results of the function execution and
|
105
|
+
* other contextual information. This event will show up in the PlayStream debugger console for the player in Game Manager.
|
106
|
+
*/
|
107
|
+
GeneratePlayStreamEvent?: boolean;
|
108
|
+
}
|
109
|
+
interface ExecuteFunctionResult extends IPlayFabResultCommon {
|
110
|
+
/** Error from the CloudScript Azure Function. */
|
111
|
+
Error?: FunctionExecutionError;
|
112
|
+
/** The amount of time the function took to execute */
|
113
|
+
ExecutionTimeMilliseconds: number;
|
114
|
+
/** The name of the function that executed */
|
115
|
+
FunctionName?: string;
|
116
|
+
/** The object returned from the function, if any */
|
117
|
+
FunctionResult?: any;
|
118
|
+
/** Flag indicating if the FunctionResult was too large and was subsequently dropped from this event. */
|
119
|
+
FunctionResultTooLarge?: boolean;
|
120
|
+
}
|
121
|
+
interface FunctionExecutionError {
|
122
|
+
/**
|
123
|
+
* Error code, such as CloudScriptAzureFunctionsExecutionTimeLimitExceeded, CloudScriptAzureFunctionsArgumentSizeExceeded,
|
124
|
+
* CloudScriptAzureFunctionsReturnSizeExceeded or CloudScriptAzureFunctionsHTTPRequestError
|
125
|
+
*/
|
126
|
+
Error?: string;
|
127
|
+
/** Details about the error */
|
128
|
+
Message?: string;
|
129
|
+
/** Point during the execution of the function at which the error occurred, if any */
|
130
|
+
StackTrace?: string;
|
131
|
+
}
|
132
|
+
interface FunctionModel {
|
133
|
+
/** The address of the function. */
|
134
|
+
FunctionAddress?: string;
|
135
|
+
/** The name the function was registered under. */
|
136
|
+
FunctionName?: string;
|
137
|
+
/** The trigger type for the function. */
|
138
|
+
TriggerType?: string;
|
139
|
+
}
|
140
|
+
interface GetFunctionRequest extends IPlayFabRequestCommon {
|
141
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
142
|
+
CustomTags?: Record<string, string | null>;
|
143
|
+
/** The name of the function to register */
|
144
|
+
FunctionName: string;
|
145
|
+
}
|
146
|
+
interface GetFunctionResult extends IPlayFabResultCommon {
|
147
|
+
/** The connection string for the storage account containing the queue for a queue trigger Azure Function. */
|
148
|
+
ConnectionString?: string;
|
149
|
+
/** The URL to be invoked to execute an HTTP triggered function. */
|
150
|
+
FunctionUrl?: string;
|
151
|
+
/** The name of the queue for a queue trigger Azure Function. */
|
152
|
+
QueueName?: string;
|
153
|
+
/** The trigger type for the function. */
|
154
|
+
TriggerType?: string;
|
155
|
+
}
|
156
|
+
interface HttpFunctionModel {
|
157
|
+
/** The name the function was registered under. */
|
158
|
+
FunctionName?: string;
|
159
|
+
/** The URL of the function. */
|
160
|
+
FunctionUrl?: string;
|
161
|
+
}
|
162
|
+
interface LinkedPlatformAccountModel {
|
163
|
+
/** Linked account email of the user on the platform, if available */
|
164
|
+
Email?: string;
|
165
|
+
/** Authentication platform */
|
166
|
+
Platform?: string;
|
167
|
+
/** Unique account identifier of the user on the platform */
|
168
|
+
PlatformUserId?: string;
|
169
|
+
/** Linked account username of the user on the platform, if available */
|
170
|
+
Username?: string;
|
171
|
+
}
|
172
|
+
interface ListEventHubFunctionsResult extends IPlayFabResultCommon {
|
173
|
+
/** The list of EventHub triggered functions that are currently registered for the title. */
|
174
|
+
Functions?: EventHubFunctionModel[];
|
175
|
+
}
|
176
|
+
interface ListFunctionsRequest extends IPlayFabRequestCommon {
|
177
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
178
|
+
CustomTags?: Record<string, string | null>;
|
179
|
+
}
|
180
|
+
interface ListFunctionsResult extends IPlayFabResultCommon {
|
181
|
+
/** The list of functions that are currently registered for the title. */
|
182
|
+
Functions?: FunctionModel[];
|
183
|
+
}
|
184
|
+
interface ListHttpFunctionsResult extends IPlayFabResultCommon {
|
185
|
+
/** The list of HTTP triggered functions that are currently registered for the title. */
|
186
|
+
Functions?: HttpFunctionModel[];
|
187
|
+
}
|
188
|
+
interface ListQueuedFunctionsResult extends IPlayFabResultCommon {
|
189
|
+
/** The list of Queue triggered functions that are currently registered for the title. */
|
190
|
+
Functions?: QueuedFunctionModel[];
|
191
|
+
}
|
192
|
+
interface LocationModel {
|
193
|
+
/** City name. */
|
194
|
+
City?: string;
|
195
|
+
/** The two-character continent code for this location */
|
196
|
+
ContinentCode?: string;
|
197
|
+
/** The two-character ISO 3166-1 country code for the country associated with the location */
|
198
|
+
CountryCode?: string;
|
199
|
+
/** Latitude coordinate of the geographic location. */
|
200
|
+
Latitude?: number;
|
201
|
+
/** Longitude coordinate of the geographic location. */
|
202
|
+
Longitude?: number;
|
203
|
+
}
|
204
|
+
interface LogStatement {
|
205
|
+
/** Optional object accompanying the message as contextual information */
|
206
|
+
Data?: any;
|
207
|
+
/** 'Debug', 'Info', or 'Error' */
|
208
|
+
Level?: string;
|
209
|
+
Message?: string;
|
210
|
+
}
|
211
|
+
interface MembershipModel {
|
212
|
+
/** Whether this membership is active. That is, whether the MembershipExpiration time has been reached. */
|
213
|
+
IsActive: boolean;
|
214
|
+
/** The time this membership expires */
|
215
|
+
MembershipExpiration: string;
|
216
|
+
/** The id of the membership */
|
217
|
+
MembershipId?: string;
|
218
|
+
/**
|
219
|
+
* Membership expirations can be explicitly overridden (via game manager or the admin api). If this membership has been
|
220
|
+
* overridden, this will be the new expiration time.
|
221
|
+
*/
|
222
|
+
OverrideExpiration?: string;
|
223
|
+
/** The list of subscriptions that this player has for this membership */
|
224
|
+
Subscriptions?: SubscriptionModel[];
|
225
|
+
}
|
226
|
+
interface NameIdentifier {
|
227
|
+
/** Id Identifier, if present */
|
228
|
+
Id?: string;
|
229
|
+
/** Name Identifier, if present */
|
230
|
+
Name?: string;
|
231
|
+
}
|
232
|
+
interface PlayerProfileModel {
|
233
|
+
/** List of advertising campaigns the player has been attributed to */
|
234
|
+
AdCampaignAttributions?: AdCampaignAttributionModel[];
|
235
|
+
/** URL of the player's avatar image */
|
236
|
+
AvatarUrl?: string;
|
237
|
+
/** If the player is currently banned, the UTC Date when the ban expires */
|
238
|
+
BannedUntil?: string;
|
239
|
+
/** List of all contact email info associated with the player account */
|
240
|
+
ContactEmailAddresses?: ContactEmailInfoModel[];
|
241
|
+
/** Player record created */
|
242
|
+
Created?: string;
|
243
|
+
/** Player display name */
|
244
|
+
DisplayName?: string;
|
245
|
+
/**
|
246
|
+
* List of experiment variants for the player. Note that these variants are not guaranteed to be up-to-date when returned
|
247
|
+
* during login because the player profile is updated only after login. Instead, use the LoginResult.TreatmentAssignment
|
248
|
+
* property during login to get the correct variants and variables.
|
249
|
+
*/
|
250
|
+
ExperimentVariants?: string[];
|
251
|
+
/** UTC time when the player most recently logged in to the title */
|
252
|
+
LastLogin?: string;
|
253
|
+
/** List of all authentication systems linked to this player account */
|
254
|
+
LinkedAccounts?: LinkedPlatformAccountModel[];
|
255
|
+
/** List of geographic locations from which the player has logged in to the title */
|
256
|
+
Locations?: LocationModel[];
|
257
|
+
/** List of memberships for the player, along with whether are expired. */
|
258
|
+
Memberships?: MembershipModel[];
|
259
|
+
/** Player account origination */
|
260
|
+
Origination?: string;
|
261
|
+
/** PlayFab player account unique identifier */
|
262
|
+
PlayerId?: string;
|
263
|
+
/** Publisher this player belongs to */
|
264
|
+
PublisherId?: string;
|
265
|
+
/** List of configured end points registered for sending the player push notifications */
|
266
|
+
PushNotificationRegistrations?: PushNotificationRegistrationModel[];
|
267
|
+
/** List of leaderboard statistic values for the player */
|
268
|
+
Statistics?: StatisticModel[];
|
269
|
+
/** List of player's tags for segmentation */
|
270
|
+
Tags?: TagModel[];
|
271
|
+
/** Title ID this player profile applies to */
|
272
|
+
TitleId?: string;
|
273
|
+
/**
|
274
|
+
* Sum of the player's purchases made with real-money currencies, converted to US dollars equivalent and represented as a
|
275
|
+
* whole number of cents (1/100 USD). For example, 999 indicates nine dollars and ninety-nine cents.
|
276
|
+
*/
|
277
|
+
TotalValueToDateInUSD?: number;
|
278
|
+
/** List of the player's lifetime purchase totals, summed by real-money currency */
|
279
|
+
ValuesToDate?: ValueToDateModel[];
|
280
|
+
}
|
281
|
+
interface PlayStreamEventEnvelopeModel {
|
282
|
+
/** The ID of the entity the event is about. */
|
283
|
+
EntityId?: string;
|
284
|
+
/** The type of the entity the event is about. */
|
285
|
+
EntityType?: string;
|
286
|
+
/** Data specific to this event. */
|
287
|
+
EventData?: string;
|
288
|
+
/** The name of the event. */
|
289
|
+
EventName?: string;
|
290
|
+
/** The namespace of the event. */
|
291
|
+
EventNamespace?: string;
|
292
|
+
/** Settings for the event. */
|
293
|
+
EventSettings?: string;
|
294
|
+
}
|
295
|
+
interface PostFunctionResultForEntityTriggeredActionRequest extends IPlayFabRequestCommon {
|
296
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
297
|
+
CustomTags?: Record<string, string | null>;
|
298
|
+
/** The entity to perform this action on. */
|
299
|
+
Entity: EntityKey;
|
300
|
+
/** The result of the function execution. */
|
301
|
+
FunctionResult: ExecuteFunctionResult;
|
302
|
+
}
|
303
|
+
interface PostFunctionResultForFunctionExecutionRequest extends IPlayFabRequestCommon {
|
304
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
305
|
+
CustomTags?: Record<string, string | null>;
|
306
|
+
/** The entity to perform this action on. */
|
307
|
+
Entity: EntityKey;
|
308
|
+
/** The result of the function execution. */
|
309
|
+
FunctionResult: ExecuteFunctionResult;
|
310
|
+
}
|
311
|
+
interface PostFunctionResultForPlayerTriggeredActionRequest extends IPlayFabRequestCommon {
|
312
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
313
|
+
CustomTags?: Record<string, string | null>;
|
314
|
+
/** The result of the function execution. */
|
315
|
+
FunctionResult: ExecuteFunctionResult;
|
316
|
+
/** The player profile the function was invoked with. */
|
317
|
+
PlayerProfile: PlayerProfileModel;
|
318
|
+
/** The triggering PlayStream event, if any, that caused the function to be invoked. */
|
319
|
+
PlayStreamEventEnvelope?: PlayStreamEventEnvelopeModel;
|
320
|
+
}
|
321
|
+
interface PostFunctionResultForScheduledTaskRequest extends IPlayFabRequestCommon {
|
322
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
323
|
+
CustomTags?: Record<string, string | null>;
|
324
|
+
/** The result of the function execution */
|
325
|
+
FunctionResult: ExecuteFunctionResult;
|
326
|
+
/** The id of the scheduled task that invoked the function. */
|
327
|
+
ScheduledTaskId: NameIdentifier;
|
328
|
+
}
|
329
|
+
interface PushNotificationRegistrationModel {
|
330
|
+
/** Notification configured endpoint */
|
331
|
+
NotificationEndpointARN?: string;
|
332
|
+
/** Push notification platform */
|
333
|
+
Platform?: string;
|
334
|
+
}
|
335
|
+
interface QueuedFunctionModel {
|
336
|
+
/** The connection string for the Azure Storage Account that hosts the queue. */
|
337
|
+
ConnectionString?: string;
|
338
|
+
/** The name the function was registered under. */
|
339
|
+
FunctionName?: string;
|
340
|
+
/** The name of the queue that triggers the Azure Function. */
|
341
|
+
QueueName?: string;
|
342
|
+
}
|
343
|
+
interface RegisterEventHubFunctionRequest extends IPlayFabRequestCommon {
|
344
|
+
/** A connection string for the namespace of the event hub for the Azure Function. */
|
345
|
+
ConnectionString: string;
|
346
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
347
|
+
CustomTags?: Record<string, string | null>;
|
348
|
+
/** The name of the event hub for the Azure Function. */
|
349
|
+
EventHubName: string;
|
350
|
+
/** The name of the function to register */
|
351
|
+
FunctionName: string;
|
352
|
+
}
|
353
|
+
interface RegisterHttpFunctionRequest extends IPlayFabRequestCommon {
|
354
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
355
|
+
CustomTags?: Record<string, string | null>;
|
356
|
+
/** The name of the function to register */
|
357
|
+
FunctionName: string;
|
358
|
+
/** Full URL for Azure Function that implements the function. */
|
359
|
+
FunctionUrl: string;
|
360
|
+
}
|
361
|
+
interface RegisterQueuedFunctionRequest extends IPlayFabRequestCommon {
|
362
|
+
/** A connection string for the storage account that hosts the queue for the Azure Function. */
|
363
|
+
ConnectionString: string;
|
364
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
365
|
+
CustomTags?: Record<string, string | null>;
|
366
|
+
/** The name of the function to register */
|
367
|
+
FunctionName: string;
|
368
|
+
/** The name of the queue for the Azure Function. */
|
369
|
+
QueueName: string;
|
370
|
+
}
|
371
|
+
interface ScriptExecutionError {
|
372
|
+
/**
|
373
|
+
* Error code, such as CloudScriptNotFound, JavascriptException, CloudScriptFunctionArgumentSizeExceeded,
|
374
|
+
* CloudScriptAPIRequestCountExceeded, CloudScriptAPIRequestError, or CloudScriptHTTPRequestError
|
375
|
+
*/
|
376
|
+
Error?: string;
|
377
|
+
/** Details about the error */
|
378
|
+
Message?: string;
|
379
|
+
/** Point during the execution of the script at which the error occurred, if any */
|
380
|
+
StackTrace?: string;
|
381
|
+
}
|
382
|
+
interface StatisticModel {
|
383
|
+
/** Statistic name */
|
384
|
+
Name?: string;
|
385
|
+
/** Statistic value */
|
386
|
+
Value: number;
|
387
|
+
/** Statistic version (0 if not a versioned statistic) */
|
388
|
+
Version: number;
|
389
|
+
}
|
390
|
+
interface SubscriptionModel {
|
391
|
+
/** When this subscription expires. */
|
392
|
+
Expiration: string;
|
393
|
+
/** The time the subscription was orignially purchased */
|
394
|
+
InitialSubscriptionTime: string;
|
395
|
+
/** Whether this subscription is currently active. That is, if Expiration > now. */
|
396
|
+
IsActive: boolean;
|
397
|
+
/** The status of this subscription, according to the subscription provider. */
|
398
|
+
Status?: string;
|
399
|
+
/** The id for this subscription */
|
400
|
+
SubscriptionId?: string;
|
401
|
+
/** The item id for this subscription from the primary catalog */
|
402
|
+
SubscriptionItemId?: string;
|
403
|
+
/** The provider for this subscription. Apple or Google Play are supported today. */
|
404
|
+
SubscriptionProvider?: string;
|
405
|
+
}
|
406
|
+
interface TagModel {
|
407
|
+
/** Full value of the tag, including namespace */
|
408
|
+
TagValue?: string;
|
409
|
+
}
|
410
|
+
interface UnregisterFunctionRequest extends IPlayFabRequestCommon {
|
411
|
+
/** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */
|
412
|
+
CustomTags?: Record<string, string | null>;
|
413
|
+
/** The name of the function to register */
|
414
|
+
FunctionName: string;
|
415
|
+
}
|
416
|
+
interface ValueToDateModel {
|
417
|
+
/** ISO 4217 code of the currency used in the purchases */
|
418
|
+
Currency?: string;
|
419
|
+
/**
|
420
|
+
* Total value of the purchases in a whole number of 1/100 monetary units. For example, 999 indicates nine dollars and
|
421
|
+
* ninety-nine cents when Currency is 'USD')
|
422
|
+
*/
|
423
|
+
TotalValue: number;
|
424
|
+
/**
|
425
|
+
* Total value of the purchases in a string representation of decimal monetary units. For example, '9.99' indicates nine
|
426
|
+
* dollars and ninety-nine cents when Currency is 'USD'.
|
427
|
+
*/
|
428
|
+
TotalValueAsDecimal?: string;
|
429
|
+
}
|
430
|
+
|
431
|
+
declare class PlayFabCloudScriptApi extends PlayFabCommon {
|
432
|
+
/**
|
433
|
+
* Cloud Script is one of PlayFab's most versatile features. It allows client code to request execution of any kind of
|
434
|
+
* custom server-side functionality you can implement, and it can be used in conjunction with virtually anything.
|
435
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/executeentitycloudscript
|
436
|
+
*/
|
437
|
+
ExecuteEntityCloudScript(request: ExecuteEntityCloudScriptRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<ExecuteCloudScriptResult>;
|
438
|
+
/**
|
439
|
+
* Cloud Script is one of PlayFab's most versatile features. It allows client code to request execution of any kind of
|
440
|
+
* custom server-side functionality you can implement, and it can be used in conjunction with virtually anything.
|
441
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/executefunction
|
442
|
+
*/
|
443
|
+
ExecuteFunction(request: ExecuteFunctionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<ExecuteFunctionResult>;
|
444
|
+
/**
|
445
|
+
* Gets registered Azure Functions for a given title id and function name.
|
446
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/getfunction
|
447
|
+
*/
|
448
|
+
GetFunction(request: GetFunctionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<GetFunctionResult>;
|
449
|
+
/**
|
450
|
+
* Lists all currently registered Event Hub triggered Azure Functions for a given title.
|
451
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listeventhubfunctions
|
452
|
+
*/
|
453
|
+
ListEventHubFunctions(request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<ListEventHubFunctionsResult>;
|
454
|
+
/**
|
455
|
+
* Lists all currently registered Azure Functions for a given title.
|
456
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listfunctions
|
457
|
+
*/
|
458
|
+
ListFunctions(request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<ListFunctionsResult>;
|
459
|
+
/**
|
460
|
+
* Lists all currently registered HTTP triggered Azure Functions for a given title.
|
461
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listhttpfunctions
|
462
|
+
*/
|
463
|
+
ListHttpFunctions(request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<ListHttpFunctionsResult>;
|
464
|
+
/**
|
465
|
+
* Lists all currently registered Queue triggered Azure Functions for a given title.
|
466
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listqueuedfunctions
|
467
|
+
*/
|
468
|
+
ListQueuedFunctions(request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<ListQueuedFunctionsResult>;
|
469
|
+
/**
|
470
|
+
* Generate an entity PlayStream event for the provided function result.
|
471
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforentitytriggeredaction
|
472
|
+
*/
|
473
|
+
PostFunctionResultForEntityTriggeredAction(request: PostFunctionResultForEntityTriggeredActionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<EmptyResult>;
|
474
|
+
/**
|
475
|
+
* Generate an entity PlayStream event for the provided function result.
|
476
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforfunctionexecution
|
477
|
+
*/
|
478
|
+
PostFunctionResultForFunctionExecution(request: PostFunctionResultForFunctionExecutionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<EmptyResult>;
|
479
|
+
/**
|
480
|
+
* Generate a player PlayStream event for the provided function result.
|
481
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforplayertriggeredaction
|
482
|
+
*/
|
483
|
+
PostFunctionResultForPlayerTriggeredAction(request: PostFunctionResultForPlayerTriggeredActionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<EmptyResult>;
|
484
|
+
/**
|
485
|
+
* Generate a PlayStream event for the provided function result.
|
486
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforscheduledtask
|
487
|
+
*/
|
488
|
+
PostFunctionResultForScheduledTask(request: PostFunctionResultForScheduledTaskRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<EmptyResult>;
|
489
|
+
/**
|
490
|
+
* Registers an event hub triggered Azure Function with a title.
|
491
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registereventhubfunction
|
492
|
+
*/
|
493
|
+
RegisterEventHubFunction(request: RegisterEventHubFunctionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<EmptyResult>;
|
494
|
+
/**
|
495
|
+
* Registers an HTTP triggered Azure function with a title.
|
496
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registerhttpfunction
|
497
|
+
*/
|
498
|
+
RegisterHttpFunction(request: RegisterHttpFunctionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<EmptyResult>;
|
499
|
+
/**
|
500
|
+
* Registers a queue triggered Azure Function with a title.
|
501
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registerqueuedfunction
|
502
|
+
*/
|
503
|
+
RegisterQueuedFunction(request: RegisterQueuedFunctionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<EmptyResult>;
|
504
|
+
/**
|
505
|
+
* Unregisters an Azure Function with a title.
|
506
|
+
* https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/unregisterfunction
|
507
|
+
*/
|
508
|
+
UnregisterFunction(request: UnregisterFunctionRequest, customData?: any, extraHeaders?: Record<string, string>): Promise<EmptyResult>;
|
509
|
+
}
|
510
|
+
|
511
|
+
export { PlayFabCloudScriptApi as default };
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/apis/PlayFabCloudScriptApi.ts","../src/constants.ts","../src/PlayFabContext.ts","../src/PlayFabCommon.ts"],"sourcesContent":["import type {\n\n ExecuteEntityCloudScriptRequest,\n ExecuteFunctionRequest,\n GetFunctionRequest,\n ListFunctionsRequest,\n PostFunctionResultForEntityTriggeredActionRequest,\n PostFunctionResultForFunctionExecutionRequest,\n PostFunctionResultForPlayerTriggeredActionRequest,\n PostFunctionResultForScheduledTaskRequest,\n RegisterEventHubFunctionRequest,\n RegisterHttpFunctionRequest,\n RegisterQueuedFunctionRequest,\n UnregisterFunctionRequest,\n ExecuteCloudScriptResult,\n ExecuteFunctionResult,\n GetFunctionResult,\n ListEventHubFunctionsResult,\n ListFunctionsResult,\n ListHttpFunctionsResult,\n ListQueuedFunctionsResult,\n EmptyResult,\n} from \"../types/PlayFabCloudScriptApi\";\nimport { PlayFabCommon } from \"../PlayFabCommon\";\n\nexport default class PlayFabCloudScriptApi extends PlayFabCommon {\n\n /**\n * Cloud Script is one of PlayFab's most versatile features. It allows client code to request execution of any kind of\n * custom server-side functionality you can implement, and it can be used in conjunction with virtually anything.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/executeentitycloudscript\n */\n ExecuteEntityCloudScript (request: ExecuteEntityCloudScriptRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ExecuteCloudScriptResult>(\"/CloudScript/ExecuteEntityCloudScript\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Cloud Script is one of PlayFab's most versatile features. It allows client code to request execution of any kind of\n * custom server-side functionality you can implement, and it can be used in conjunction with virtually anything.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/executefunction\n */\n ExecuteFunction (request: ExecuteFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ExecuteFunctionResult>(\"/CloudScript/ExecuteFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Gets registered Azure Functions for a given title id and function name.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/getfunction\n */\n GetFunction (request: GetFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<GetFunctionResult>(\"/CloudScript/GetFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Lists all currently registered Event Hub triggered Azure Functions for a given title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listeventhubfunctions\n */\n ListEventHubFunctions (request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ListEventHubFunctionsResult>(\"/CloudScript/ListEventHubFunctions\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Lists all currently registered Azure Functions for a given title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listfunctions\n */\n ListFunctions (request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ListFunctionsResult>(\"/CloudScript/ListFunctions\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Lists all currently registered HTTP triggered Azure Functions for a given title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listhttpfunctions\n */\n ListHttpFunctions (request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ListHttpFunctionsResult>(\"/CloudScript/ListHttpFunctions\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Lists all currently registered Queue triggered Azure Functions for a given title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/listqueuedfunctions\n */\n ListQueuedFunctions (request: ListFunctionsRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<ListQueuedFunctionsResult>(\"/CloudScript/ListQueuedFunctions\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Generate an entity PlayStream event for the provided function result.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforentitytriggeredaction\n */\n PostFunctionResultForEntityTriggeredAction (request: PostFunctionResultForEntityTriggeredActionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/PostFunctionResultForEntityTriggeredAction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Generate an entity PlayStream event for the provided function result.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforfunctionexecution\n */\n PostFunctionResultForFunctionExecution (request: PostFunctionResultForFunctionExecutionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/PostFunctionResultForFunctionExecution\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Generate a player PlayStream event for the provided function result.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforplayertriggeredaction\n */\n PostFunctionResultForPlayerTriggeredAction (request: PostFunctionResultForPlayerTriggeredActionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/PostFunctionResultForPlayerTriggeredAction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Generate a PlayStream event for the provided function result.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/postfunctionresultforscheduledtask\n */\n PostFunctionResultForScheduledTask (request: PostFunctionResultForScheduledTaskRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/PostFunctionResultForScheduledTask\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Registers an event hub triggered Azure Function with a title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registereventhubfunction\n */\n RegisterEventHubFunction (request: RegisterEventHubFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/RegisterEventHubFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Registers an HTTP triggered Azure function with a title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registerhttpfunction\n */\n RegisterHttpFunction (request: RegisterHttpFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/RegisterHttpFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Registers a queue triggered Azure Function with a title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/registerqueuedfunction\n */\n RegisterQueuedFunction (request: RegisterQueuedFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/RegisterQueuedFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n /**\n * Unregisters an Azure Function with a title.\n * https://docs.microsoft.com/rest/api/playfab/cloudscript/server-side-cloud-script/unregisterfunction\n */\n UnregisterFunction (request: UnregisterFunctionRequest, customData?: any, extraHeaders?: Record<string, string>) {\n return this.ExecuteRequestWrapper<EmptyResult>(\"/CloudScript/UnregisterFunction\", request, \"X-EntityToken\", customData, extraHeaders);\n }\n\n};\n","export interface ISettings {\n /** You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) */\n titleId: string;\n /** For security reasons you must never expose this value to the client or players - You must set this value for Server-APIs to work properly (Found in the Game Manager for your title, at the PlayFab Website) */\n developerSecretKey: string;\n productionServerUrl: string;\n GlobalHeaderInjection?: { [key: string]: string };\n /** The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this */\n verticalName?: string | null;\n}\n\nexport const AuthInfoMap = {\n \"X-EntityToken\": {\n authAttr: \"entityToken\",\n authError: \"errorEntityToken\",\n },\n \"X-Authorization\": {\n authAttr: \"sessionTicket\",\n authError: \"errorLoggedIn\",\n },\n \"X-SecretKey\": {\n authAttr: \"developerSecretKey\",\n authError: \"errorSecretKey\",\n },\n};\n\nexport default {\n sdkVersion: \"1.192.250526\",\n sdkFingerprint: \"JavaScriptSDK-1.192.250526\",\n buildIdentifier: \"custom_async-javascriptsdk\",\n defaultSettings: {\n titleId: \"\",\n developerSecretKey: \"\",\n GlobalHeaderInjection: {},\n productionServerUrl: \".playfabapi.com\",\n verticalName: null\n } as ISettings\n};\n","import constants, { type ISettings } from \"./constants\";\n\nexport type AuthContext = {\n PlayFabId: string | null;\n EntityId: string | null;\n EntityType: string | null;\n SessionTicket: string | null;\n EntityToken: string | null;\n};\n\nexport class PlayFabContext {\n private static _instance: PlayFabContext;\n\n settings: ISettings = constants.defaultSettings;\n\n authenticationContext: AuthContext = {\n PlayFabId: null,\n EntityId: null,\n EntityType: null,\n SessionTicket: null,\n EntityToken: null,\n };\n\n sessionTicket: string | null = null;\n\n entityToken: string | null = null;\n\n private constructor() {}\n\n public static get instance(): PlayFabContext {\n if (!PlayFabContext._instance) {\n PlayFabContext._instance = new PlayFabContext();\n }\n\n return PlayFabContext._instance;\n }\n}\n","import constants, { ISettings, AuthInfoMap } from \"./constants\";\nimport { AuthContext, PlayFabContext } from \"./PlayFabContext\";\nimport { IPlayFabError, IPlayFabResultCommon } from \"./types/PlayFab\";\n\nexport class PlayFabCommon {\n buildIdentifier: string = constants.buildIdentifier;\n requestGetParams = {\n sdk: constants.sdkFingerprint,\n } as const;\n errorTitleId = \"Must be have settings.titleId set to call this method\";\n errorLoggedIn = \"Must be logged in to call this method\";\n errorEntityToken =\n \"You must successfully call GetEntityToken before calling this\";\n errorSecretKey =\n \"Must have settings.developerSecretKey set to call this method\";\n private _context = PlayFabContext.instance;\n\n constructor(settings: Partial<ISettings> | undefined = undefined) {\n if (settings) {\n Object.assign(this._context.settings, settings);\n }\n }\n\n get settings() {\n return this._context.settings;\n }\n\n get authenticationContext() {\n return this._context.authenticationContext;\n }\n\n get sessionTicket() {\n return this._context.sessionTicket;\n }\n\n set sessionTicket(value: string | null) {\n this._context.sessionTicket = value;\n }\n\n get entityToken() {\n return this._context.entityToken;\n }\n\n set entityToken(value: string | null) {\n this._context.entityToken = value;\n }\n\n GetServerUrl() {\n if (!(this.settings.productionServerUrl.substring(0, 4) === \"http\")) {\n return `https://${this.settings.verticalName || this.settings.titleId}${\n this.settings.productionServerUrl\n }`;\n } else {\n return this.settings.productionServerUrl;\n }\n }\n\n InjectHeaders(\n xhr: XMLHttpRequest,\n headersObj: Record<string, string> | undefined\n ) {\n if (!headersObj) return;\n\n for (const headerKey in headersObj) {\n try {\n xhr.setRequestHeader(headerKey, headersObj[headerKey]);\n } catch (e) {\n console.log(\n `Failed to append header: ${headerKey} = ${headersObj[headerKey]} Error: ${e}`\n );\n }\n }\n }\n\n ExecuteRequest<T extends IPlayFabResultCommon>(\n url: string,\n body: any,\n authkey: string | null,\n authValue: string | null,\n customData: any,\n extraHeaders?: Record<string, string>\n ): Promise<T> {\n return new Promise((resolve, reject) => {\n if (body == null) body = {};\n\n var startTime = new Date().getTime();\n var requestBody = JSON.stringify(body);\n\n var urlArr = [url];\n var getParams = this.requestGetParams;\n if (getParams != null) {\n var firstParam = true;\n for (var key in getParams) {\n if (firstParam) {\n urlArr.push(\"?\");\n firstParam = false;\n } else {\n urlArr.push(\"&\");\n }\n urlArr.push(key);\n urlArr.push(\"=\");\n urlArr.push(getParams[key as keyof typeof getParams]);\n }\n }\n\n var completeUrl = urlArr.join(\"\");\n\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", completeUrl, true);\n\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.setRequestHeader(\n \"X-PlayFabSDK\",\n \"JavaScriptSDK-\" + constants.sdkVersion\n );\n if (authkey != null) {\n xhr.setRequestHeader(authkey, authValue!);\n }\n this.InjectHeaders(xhr, this.settings.GlobalHeaderInjection);\n this.InjectHeaders(xhr, extraHeaders);\n\n xhr.onloadend = () => {\n var result = this.GetPlayFabResponse(body, xhr, startTime, customData);\n if (result.code === 200) {\n resolve(result.data || result);\n } else {\n reject(result);\n }\n };\n\n xhr.onerror = () => {\n var result = this.GetPlayFabResponse(body, xhr, startTime, customData);\n reject(result);\n };\n\n xhr.send(requestBody);\n });\n }\n\n GetPlayFabResponse(\n request: any,\n xhr: XMLHttpRequest,\n startTime: number,\n customData: any\n ) {\n var result = null as any;\n try {\n // window.console.log(\"parsing json result: \" + xhr.responseText);\n result = JSON.parse(xhr.responseText);\n } catch (e) {\n result = {\n code: 503, // Service Unavailable\n status: \"Service Unavailable\",\n error: \"Connection error\",\n errorCode: 2, // PlayFabErrorCode.ConnectionError\n errorMessage: xhr.responseText,\n };\n }\n\n result.CallBackTimeMS = new Date().getTime() - startTime;\n result.Request = request;\n result.CustomData = customData;\n return result;\n }\n\n UpdateAuthenticationContext(currentAuthContext: AuthContext, result: any) {\n var authenticationContextUpdates = {} as AuthContext;\n if (result?.PlayFabId) {\n authenticationContextUpdates.PlayFabId = result.PlayFabId;\n }\n if (result?.SessionTicket) {\n authenticationContextUpdates.SessionTicket = result.SessionTicket;\n }\n if (result?.EntityToken) {\n authenticationContextUpdates.EntityId = result.EntityToken.Entity.Id;\n authenticationContextUpdates.EntityType = result.EntityToken.Entity.Type;\n authenticationContextUpdates.EntityToken = result.EntityToken.EntityToken;\n }\n // Update the authenticationContext with values from the result\n currentAuthContext = Object.assign(\n currentAuthContext,\n authenticationContextUpdates\n );\n\n this._context.authenticationContext = currentAuthContext;\n\n return currentAuthContext;\n }\n\n GetAuthInfo(request: any, authKey: string) {\n // Use the most-recently saved authKey, unless one was provided in the request via the AuthenticationContext\n var authError = AuthInfoMap[authKey as keyof typeof AuthInfoMap].authError;\n var authAttr = AuthInfoMap[authKey as keyof typeof AuthInfoMap].authAttr;\n var defaultAuthValue: string | null = null;\n if (authAttr === \"entityToken\") defaultAuthValue = this.entityToken;\n else if (authAttr === \"sessionTicket\")\n defaultAuthValue = this.sessionTicket;\n else if (authAttr === \"developerSecretKey\")\n defaultAuthValue = this.settings.developerSecretKey;\n var authValue = request.AuthenticationContext\n ? request.AuthenticationContext[authAttr]\n : defaultAuthValue;\n return { authKey, authValue, authError };\n }\n\n ExecuteRequestWrapper<T extends IPlayFabResultCommon>(\n apiURL: string,\n request: any,\n authKey: string | null,\n customData: any,\n extraHeaders?: Record<string, string>\n ) {\n var authValue = null;\n if (authKey !== null) {\n const { authError, ...authInfo } = this.GetAuthInfo(request, authKey);\n authKey = authInfo.authKey;\n authValue = authInfo.authValue;\n if (!authValue) throw authError;\n }\n return this.ExecuteRequest<T>(\n this.GetServerUrl() + apiURL,\n request,\n authKey,\n authValue,\n customData,\n extraHeaders\n );\n }\n\n GenerateErrorReport(error: IPlayFabError | null): string {\n if (error == null) return \"\";\n var fullErrors = error.errorMessage;\n for (var paramName in error.errorDetails)\n for (var msgIdx in error.errorDetails[paramName])\n fullErrors +=\n \"\\n\" + paramName + \": \" + error.errorDetails[paramName][msgIdx];\n return fullErrors;\n }\n\n ForgetAllCredentials() {\n this._context.sessionTicket = null;\n this._context.entityToken = null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,cAAc;AAAA,EACzB,iBAAiB;AAAA,IACf,UAAU;AAAA,IACV,WAAW;AAAA,EACb;AAAA,EACA,mBAAmB;AAAA,IACjB,UAAU;AAAA,IACV,WAAW;AAAA,EACb;AAAA,EACA,eAAe;AAAA,I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