@openleaderboard/sdk 0.2.0 → 0.3.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/index.d.ts CHANGED
@@ -30,6 +30,13 @@ export interface QueryOpts {
30
30
  export interface SubmitOpts {
31
31
  segments?: string[];
32
32
  idem?: string;
33
+ /**
34
+ * Event time of the score. Determines which time-window bucket it lands in
35
+ * (e.g. the daily board) — set it to the session start so a run that crosses
36
+ * midnight counts for the day it began, rather than when it was submitted.
37
+ * Accepts a Date or an ISO-8601 string; defaults to server receive time.
38
+ */
39
+ time?: Date | string;
33
40
  }
34
41
  export interface WindowDef {
35
42
  kind: string;
package/dist/index.js CHANGED
@@ -58,6 +58,7 @@ export class LeaderboardClient {
58
58
  score,
59
59
  segments: opts.segments,
60
60
  idem: opts.idem,
61
+ time: opts.time instanceof Date ? opts.time.toISOString() : opts.time,
61
62
  };
62
63
  if (this.opts.signingSecret) {
63
64
  const ts = Math.floor(Date.now() / 1000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openleaderboard/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "TypeScript client for the OpenLeaderboard API (browser + Node 18+).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",