@kokimoki/app 1.8.2 → 1.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.
- package/dist/kokimoki-client.d.ts +6 -0
- package/dist/kokimoki-client.js +15 -2
- package/dist/kokimoki.min.d.ts +6 -0
- package/dist/kokimoki.min.js +16 -3
- package/dist/kokimoki.min.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -130,5 +130,11 @@ export declare class KokimokiClient<ClientContextT = any> extends KokimokiClient
|
|
|
130
130
|
score: number;
|
|
131
131
|
metadata: MetadataT;
|
|
132
132
|
}>;
|
|
133
|
+
/**
|
|
134
|
+
* Send app data via webhook
|
|
135
|
+
*/
|
|
136
|
+
sendWebhook<T>(event: string, data: T): Promise<{
|
|
137
|
+
jobId: string;
|
|
138
|
+
}>;
|
|
133
139
|
}
|
|
134
140
|
export {};
|
package/dist/kokimoki-client.js
CHANGED
|
@@ -662,7 +662,8 @@ export class KokimokiClient extends EventEmitter {
|
|
|
662
662
|
* @returns
|
|
663
663
|
*/
|
|
664
664
|
async listLeaderboardEntries(leaderboardName, sortDir, skip = 0, limit = 100) {
|
|
665
|
-
const
|
|
665
|
+
const encodedLeaderboardName = encodeURIComponent(leaderboardName);
|
|
666
|
+
const res = await fetch(`${this._apiUrl}/leaderboard-entries?leaderboardName=${encodedLeaderboardName}&sortDir=${sortDir}&skip=${skip}&limit=${limit}`, {
|
|
666
667
|
headers: this.apiHeaders,
|
|
667
668
|
});
|
|
668
669
|
return await res.json();
|
|
@@ -674,9 +675,21 @@ export class KokimokiClient extends EventEmitter {
|
|
|
674
675
|
* @param clientId
|
|
675
676
|
*/
|
|
676
677
|
async getBestLeaderboardEntry(leaderboardName, sortDir, clientId) {
|
|
677
|
-
const
|
|
678
|
+
const encodedLeaderboardName = encodeURIComponent(leaderboardName);
|
|
679
|
+
const res = await fetch(`${this._apiUrl}/leaderboard-entries/best?leaderboardName=${encodedLeaderboardName}&sortDir=${sortDir}&clientId=${clientId || this.id}`, {
|
|
678
680
|
headers: this._apiHeaders,
|
|
679
681
|
});
|
|
680
682
|
return await res.json();
|
|
681
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* Send app data via webhook
|
|
686
|
+
*/
|
|
687
|
+
async sendWebhook(event, data) {
|
|
688
|
+
const res = await fetch(`${this._apiUrl}/webhooks`, {
|
|
689
|
+
method: "POST",
|
|
690
|
+
headers: this.apiHeaders,
|
|
691
|
+
body: JSON.stringify({ event, data }),
|
|
692
|
+
});
|
|
693
|
+
return await res.json();
|
|
694
|
+
}
|
|
682
695
|
}
|
package/dist/kokimoki.min.d.ts
CHANGED
|
@@ -353,6 +353,12 @@ declare class KokimokiClient<ClientContextT = any> extends KokimokiClient_base {
|
|
|
353
353
|
score: number;
|
|
354
354
|
metadata: MetadataT;
|
|
355
355
|
}>;
|
|
356
|
+
/**
|
|
357
|
+
* Send app data via webhook
|
|
358
|
+
*/
|
|
359
|
+
sendWebhook<T>(event: string, data: T): Promise<{
|
|
360
|
+
jobId: string;
|
|
361
|
+
}>;
|
|
356
362
|
}
|
|
357
363
|
|
|
358
364
|
declare class RoomSubscription {
|
package/dist/kokimoki.min.js
CHANGED
|
@@ -486,7 +486,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
|
|
|
486
486
|
var eventsExports = events.exports;
|
|
487
487
|
var EventEmitter$1 = /*@__PURE__*/getDefaultExportFromCjs(eventsExports);
|
|
488
488
|
|
|
489
|
-
const KOKIMOKI_APP_VERSION = "1.
|
|
489
|
+
const KOKIMOKI_APP_VERSION = "1.9.0";
|
|
490
490
|
|
|
491
491
|
/**
|
|
492
492
|
* Utility module to work with key-value stores.
|
|
@@ -15292,7 +15292,8 @@ class KokimokiClient extends EventEmitter$1 {
|
|
|
15292
15292
|
* @returns
|
|
15293
15293
|
*/
|
|
15294
15294
|
async listLeaderboardEntries(leaderboardName, sortDir, skip = 0, limit = 100) {
|
|
15295
|
-
const
|
|
15295
|
+
const encodedLeaderboardName = encodeURIComponent(leaderboardName);
|
|
15296
|
+
const res = await fetch(`${this._apiUrl}/leaderboard-entries?leaderboardName=${encodedLeaderboardName}&sortDir=${sortDir}&skip=${skip}&limit=${limit}`, {
|
|
15296
15297
|
headers: this.apiHeaders,
|
|
15297
15298
|
});
|
|
15298
15299
|
return await res.json();
|
|
@@ -15304,11 +15305,23 @@ class KokimokiClient extends EventEmitter$1 {
|
|
|
15304
15305
|
* @param clientId
|
|
15305
15306
|
*/
|
|
15306
15307
|
async getBestLeaderboardEntry(leaderboardName, sortDir, clientId) {
|
|
15307
|
-
const
|
|
15308
|
+
const encodedLeaderboardName = encodeURIComponent(leaderboardName);
|
|
15309
|
+
const res = await fetch(`${this._apiUrl}/leaderboard-entries/best?leaderboardName=${encodedLeaderboardName}&sortDir=${sortDir}&clientId=${clientId || this.id}`, {
|
|
15308
15310
|
headers: this._apiHeaders,
|
|
15309
15311
|
});
|
|
15310
15312
|
return await res.json();
|
|
15311
15313
|
}
|
|
15314
|
+
/**
|
|
15315
|
+
* Send app data via webhook
|
|
15316
|
+
*/
|
|
15317
|
+
async sendWebhook(event, data) {
|
|
15318
|
+
const res = await fetch(`${this._apiUrl}/webhooks`, {
|
|
15319
|
+
method: "POST",
|
|
15320
|
+
headers: this.apiHeaders,
|
|
15321
|
+
body: JSON.stringify({ event, data }),
|
|
15322
|
+
});
|
|
15323
|
+
return await res.json();
|
|
15324
|
+
}
|
|
15312
15325
|
}
|
|
15313
15326
|
|
|
15314
15327
|
export { KokimokiAwareness, KokimokiClient, KokimokiQueue, KokimokiSchema, KokimokiStore, RoomSubscription, RoomSubscriptionMode };
|