@hadoku/platform-wire 0.1.95 → 0.1.97
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/telemetry.d.ts +2 -0
- package/dist/telemetry.js +11 -3
- package/package.json +2 -2
package/dist/telemetry.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ export declare const UsageBatchSchema: z.ZodObject<{
|
|
|
40
40
|
}>;
|
|
41
41
|
screen: z.ZodString;
|
|
42
42
|
target: z.ZodOptional<z.ZodString>;
|
|
43
|
+
at: z.ZodOptional<z.ZodNumber>;
|
|
43
44
|
}, z.core.$strict>>;
|
|
45
|
+
sentAt: z.ZodOptional<z.ZodNumber>;
|
|
44
46
|
}, z.core.$strict>;
|
|
45
47
|
export type UsageBatch = z.output<typeof UsageBatchSchema>;
|
package/dist/telemetry.js
CHANGED
|
@@ -30,9 +30,17 @@ export const USAGE_BATCH_MAX = 200;
|
|
|
30
30
|
* label, a name or anything a player typed.
|
|
31
31
|
*/
|
|
32
32
|
const UsageNameSchema = z.string().min(1).max(64).regex(/^[a-z0-9][a-z0-9_.:/-]*$/);
|
|
33
|
+
/** A page's own `Date.now()`: only ever read relative to the batch's `sentAt`. */
|
|
34
|
+
const PageClockSchema = z.number().int().nonnegative();
|
|
33
35
|
/**
|
|
34
36
|
* What the browser reports about how the app is used: each screen it shows and each named control
|
|
35
|
-
* pressed, batched
|
|
37
|
+
* pressed, batched, each stamped with the page's clock (`at`) and the batch with when it left
|
|
38
|
+
* (`sentAt`). The server counts them for everyone and keeps each person's own ordered trail.
|
|
39
|
+
* `at`/`sentAt` are optional only for a tab opened before they existed.
|
|
36
40
|
*/
|
|
37
|
-
const UsageEntrySchema = z
|
|
38
|
-
|
|
41
|
+
const UsageEntrySchema = z
|
|
42
|
+
.object({ kind: z.enum(['view', 'click']), screen: UsageNameSchema, target: UsageNameSchema.optional(), at: PageClockSchema.optional() })
|
|
43
|
+
.strict();
|
|
44
|
+
export const UsageBatchSchema = z
|
|
45
|
+
.object({ entries: z.array(UsageEntrySchema).min(1).max(USAGE_BATCH_MAX), sentAt: PageClockSchema.optional() })
|
|
46
|
+
.strict();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/platform-wire",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.97",
|
|
4
|
+
"gitHead": "155c8c9335e64b29e1c0f0c9c18a8c79509093fb",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "The wire any game speaks: room ids, telemetry, presence, events and tables, the Discord relay, looks, the restart notice, secure random and a generic server envelope. Knows no game; a game's own part rides as a type parameter. MIT; imports only zod.",
|