@crowdedkingdoms/crowdyjs 18.4.1 → 18.6.0-dev.1

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.
@@ -0,0 +1,74 @@
1
+ import { InputLogMessagesDocument, InputLogSessionsDocument, } from '../generated/graphql.js';
2
+ /**
3
+ * The input log: the client inputs the realtime servers recorded for an app with
4
+ * replay logging on (`App.replayLoggingEnabled`, set with {@link AppsAPI.update}).
5
+ * Exposed as `client.inputLog`.
6
+ *
7
+ * **Game plane.** Call it on the app-scoped client for the app (`portal.mintAppToken`
8
+ * or hosted sign-in). An identity session token is refused, and the client follows
9
+ * the app to its datacenter like any gameplay call.
10
+ *
11
+ * **Who sees what.** A player reads only the sessions and inputs they sent. A holder of
12
+ * `manage_apps` on the app reads every session and may filter by `userId`.
13
+ *
14
+ * Inputs are kept for the input log's published retention (crowdedkingdoms.com/pricing)
15
+ * and then deleted, so an old session can still be listed after its inputs are gone.
16
+ * Without input logging on the deployment, both calls throw
17
+ * {@link CrowdyGraphQLError} `INPUT_LOG_UNAVAILABLE`; `messages` also throws it, retryable
18
+ * with the same cursor, when the log cannot be read right now.
19
+ */
20
+ export class InputLogAPI {
21
+ constructor(gql) {
22
+ this.gql = gql;
23
+ }
24
+ /**
25
+ * Recorded sessions of an app, newest first. A session is one game token's inputs.
26
+ *
27
+ * @param appId - Numeric app id.
28
+ * @param opts - Paging, and {@link InputLogSessionFilter}: `userId` (another user's
29
+ * needs `manage_apps`), `from` / `to`, and `messageType` (sessions containing it).
30
+ * @returns One page: `edges[].node` are the sessions, `pageInfo.endCursor` the next
31
+ * page's `after`, `totalCount` the matching sessions.
32
+ * @throws {CrowdyGraphQLError} `FORBIDDEN` for another user's sessions without
33
+ * `manage_apps`, or `INPUT_LOG_UNAVAILABLE`.
34
+ */
35
+ async sessions(appId, opts = {}) {
36
+ const data = await this.gql.request(InputLogSessionsDocument, {
37
+ appId,
38
+ first: opts.first,
39
+ after: opts.after,
40
+ filter: opts.filter,
41
+ });
42
+ return data.inputLogSessions;
43
+ }
44
+ /**
45
+ * The recorded inputs of one session, oldest first, each as the client sent it.
46
+ *
47
+ * `body` is the message in base64, from its type byte up to its authentication tail,
48
+ * which is not recorded (`decodeBase64` gives the bytes). `sizeBytes` is what stored
49
+ * input logs are billed on. Spatial inputs also carry their chunk and actor, and
50
+ * channel inputs their channel.
51
+ *
52
+ * **Keep paging while `pageInfo.hasNextPage` is true.** A page can hold fewer than
53
+ * `first` inputs, or none, when it reached the server's time or scan limit.
54
+ *
55
+ * @param appId - Numeric app id.
56
+ * @param gameTokenId - The session: {@link InputLogSessionRecord.gameTokenId}.
57
+ * @param opts - Paging, and {@link InputLogMessageFilter}: `from` / `to`, and
58
+ * `messageTypes` (at most 64).
59
+ * @returns One page of inputs.
60
+ * @throws {CrowdyGraphQLError} `NOT_FOUND` for a session that is not yours without
61
+ * `manage_apps`, `BAD_USER_INPUT` for a cursor from another session, or
62
+ * `INPUT_LOG_UNAVAILABLE`.
63
+ */
64
+ async messages(appId, gameTokenId, opts = {}) {
65
+ const data = await this.gql.request(InputLogMessagesDocument, {
66
+ appId,
67
+ gameTokenId,
68
+ first: opts.first,
69
+ after: opts.after,
70
+ filter: opts.filter,
71
+ });
72
+ return data.inputLogMessages;
73
+ }
74
+ }
@@ -1,6 +1,6 @@
1
1
  import type { GraphQLClient } from '../client.js';
2
2
  import type { SubscriptionManager, UdpNotificationHandlers } from '../subscriptions.js';
3
- import { type ConnectUdpProxyMutation, type UdpProxyConnectionStatusQuery, type SendActorUpdateMutationVariables, type SendVoxelUpdateMutationVariables, type SendAudioPacketMutationVariables, type SendVideoPacketMutationVariables, type SendTextPacketMutationVariables, type SendClientEventMutationVariables, type SendSingleActorMessageMutationVariables, type SendChannelMessageMutationVariables } from '../generated/graphql.js';
3
+ import { type ConnectUdpProxyMutation, type UdpProxyConnectionStatusQuery, type SendActorUpdateMutationVariables, type SendVoxelUpdateMutationVariables, type SendAudioPacketMutationVariables, type SendVideoPacketMutationVariables, type SendTextPacketMutationVariables, type SendClientEventMutationVariables, type SendSingleActorMessageMutationVariables, type SendChannelMessageMutationVariables, type SendRangedChannelMessageMutationVariables } from '../generated/graphql.js';
4
4
  import type { RealtimeMetrics } from '../metrics.js';
5
5
  import type { SpatialNotification } from '../realtime.js';
6
6
  import { type VideoCodec } from '../media/video-frames.js';
@@ -466,6 +466,34 @@ export declare class UdpAPI {
466
466
  * @throws {CrowdyGraphQLError} on auth/validation failures.
467
467
  */
468
468
  sendChannelMessage(input: SendChannelMessageMutationVariables['input']): Promise<boolean>;
469
+ /**
470
+ * Publish a message to a channel that only members near an origin chunk
471
+ * receive (needs ck-api with `sendRangedChannelMessage` and Buddy v0.35.0).
472
+ * A member receives it, through the same `channelMessage` handler as
473
+ * {@link sendChannelMessage}, when one of its live actors is in `appId`
474
+ * within `maxDistance` chunks of `chunk`, measured as the straight-line
475
+ * distance between chunk coordinates, boundary included. A member with no
476
+ * live actor does not receive it. Same send right as `sendChannelMessage`;
477
+ * the sender receives no echo.
478
+ *
479
+ * @param input - {@link RangedChannelMessageInput}:
480
+ * - `channelId` — the channel id (`groups.group_id`) as a `BigInt` decimal
481
+ * string.
482
+ * - `uuid` — the sender's own actor id: exactly 32 ASCII characters.
483
+ * - `payload` — message body, base64-encoded; opaque to the server, max
484
+ * 1024 bytes.
485
+ * - `appId` — the origin's app; must be this token's app.
486
+ * - `chunk` — the origin chunk `{ x, y, z }` (`BigInt` decimal strings),
487
+ * usually the sender's own chunk.
488
+ * - `maxDistance` — integer chunks, 0 (the origin chunk only) to
489
+ * 2147483647. Not the 0-8 Chebyshev ring count spatial sends take.
490
+ * - `sequenceNumber` — optional uint8 (0-255) correlation id.
491
+ * @returns `true` when accepted for sending — **not** confirmation of
492
+ * delivery. A refusal (no send right: `UNAUTHORIZED`; another app:
493
+ * `INVALID_APP_ID`) arrives as a `genericError` notification.
494
+ * @throws {CrowdyGraphQLError} on auth/validation failures.
495
+ */
496
+ sendRangedChannelMessage(input: SendRangedChannelMessageMutationVariables['input']): Promise<boolean>;
469
497
  /**
470
498
  * Subscribe to udpNotifications for a single app. Pass any combination of
471
499
  * typename handlers; the returned function detaches all of them. The first
@@ -1 +1 @@
1
- {"version":3,"file":"udp.d.ts","sourceRoot":"","sources":["../../src/domains/udp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,KAAK,uBAAuB,EAG5B,KAAK,6BAA6B,EAElC,KAAK,gCAAgC,EAErC,KAAK,gCAAgC,EAErC,KAAK,gCAAgC,EAErC,KAAK,gCAAgC,EAErC,KAAK,+BAA+B,EAEpC,KAAK,gCAAgC,EAErC,KAAK,uCAAuC,EAE5C,KAAK,mCAAmC,EACzC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAa1D,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBAAa,MAAM;IAKf,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,2BAA2B,CAAC;IAZtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;IACrD,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAA+B;gBAG1D,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE,eAAe,YAAA;IACjC;;;;OAIG;IACK,2BAA2B,CAAC,GAAE,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,aA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;;;;;;;;OA0BG;IACG,wBAAwB,CAC5B,KAAK,EAAE,yCAAyC,CAAC,OAAO,CAAC,GACxD,OAAO,CAAC,OAAO,CAAC;IAcnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,SAAS,CAAC,QAAQ,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,IAAI;IAIvE,OAAO,CAAC,YAAY;CAQrB"}
@@ -1,7 +1,7 @@
1
- import { ConnectUdpProxyDocument, DisconnectUdpProxyDocument, UdpProxyConnectionStatusDocument, SendActorUpdateDocument, SendVoxelUpdateDocument, SendAudioPacketDocument, SendVideoPacketDocument, SendTextPacketDocument, SendClientEventDocument, SendSingleActorMessageDocument, SendChannelMessageDocument, } from '../generated/graphql.js';
1
+ import { ConnectUdpProxyDocument, DisconnectUdpProxyDocument, UdpProxyConnectionStatusDocument, SendActorUpdateDocument, SendVoxelUpdateDocument, SendAudioPacketDocument, SendVideoPacketDocument, SendTextPacketDocument, SendClientEventDocument, SendSingleActorMessageDocument, SendChannelMessageDocument, SendRangedChannelMessageDocument, } from '../generated/graphql.js';
2
2
  import { payloadBytesOf } from '../metrics.js';
3
3
  import { SequenceAllocator } from '../utils.js';
4
- import { serializeActorUpdate, serializeAudioPacket, serializeChannelMessage, serializeClientEvent, serializeSingleActorMessage, serializeTextPacket, serializeVideoPacket, serializeVoxelUpdate, } from '../binary-wire.js';
4
+ import { serializeActorUpdate, serializeAudioPacket, serializeChannelMessage, serializeClientEvent, serializeRangedChannelMessage, serializeSingleActorMessage, serializeTextPacket, serializeVideoPacket, serializeVoxelUpdate, } from '../binary-wire.js';
5
5
  import { fragmentFrame } from '../media/video-frames.js';
6
6
  import { encodeBase64 } from '../utils.js';
7
7
  /**
@@ -669,6 +669,44 @@ export class UdpAPI {
669
669
  this.record('channelMessage', input);
670
670
  return data.sendChannelMessage;
671
671
  }
672
+ /**
673
+ * Publish a message to a channel that only members near an origin chunk
674
+ * receive (needs ck-api with `sendRangedChannelMessage` and Buddy v0.35.0).
675
+ * A member receives it, through the same `channelMessage` handler as
676
+ * {@link sendChannelMessage}, when one of its live actors is in `appId`
677
+ * within `maxDistance` chunks of `chunk`, measured as the straight-line
678
+ * distance between chunk coordinates, boundary included. A member with no
679
+ * live actor does not receive it. Same send right as `sendChannelMessage`;
680
+ * the sender receives no echo.
681
+ *
682
+ * @param input - {@link RangedChannelMessageInput}:
683
+ * - `channelId` — the channel id (`groups.group_id`) as a `BigInt` decimal
684
+ * string.
685
+ * - `uuid` — the sender's own actor id: exactly 32 ASCII characters.
686
+ * - `payload` — message body, base64-encoded; opaque to the server, max
687
+ * 1024 bytes.
688
+ * - `appId` — the origin's app; must be this token's app.
689
+ * - `chunk` — the origin chunk `{ x, y, z }` (`BigInt` decimal strings),
690
+ * usually the sender's own chunk.
691
+ * - `maxDistance` — integer chunks, 0 (the origin chunk only) to
692
+ * 2147483647. Not the 0-8 Chebyshev ring count spatial sends take.
693
+ * - `sequenceNumber` — optional uint8 (0-255) correlation id.
694
+ * @returns `true` when accepted for sending — **not** confirmation of
695
+ * delivery. A refusal (no send right: `UNAUTHORIZED`; another app:
696
+ * `INVALID_APP_ID`) arrives as a `genericError` notification.
697
+ * @throws {CrowdyGraphQLError} on auth/validation failures.
698
+ */
699
+ async sendRangedChannelMessage(input) {
700
+ await this.awaitGameplayTokenReady();
701
+ const viaRelay = await this.sendViaRelay((ctx) => serializeRangedChannelMessage(ctx, input));
702
+ if (viaRelay !== null) {
703
+ this.record('rangedChannelMessage', input);
704
+ return viaRelay;
705
+ }
706
+ const data = await this.gql.request(SendRangedChannelMessageDocument, { input });
707
+ this.record('rangedChannelMessage', input);
708
+ return data.sendRangedChannelMessage;
709
+ }
672
710
  /**
673
711
  * Subscribe to udpNotifications for a single app. Pass any combination of
674
712
  * typename handlers; the returned function detaches all of them. The first