@crowdedkingdomstudios/crowdyjs 2.1.1 → 3.0.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/MIGRATION.md +26 -0
- package/README.md +110 -772
- package/dist/auth-state.d.ts +6 -16
- package/dist/auth-state.d.ts.map +1 -1
- package/dist/auth-state.js +9 -26
- package/dist/client.d.ts +14 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +22 -17
- package/dist/crowdy-client.d.ts +21 -3
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +37 -20
- package/dist/domains/serverStatus.d.ts +2 -1
- package/dist/domains/serverStatus.d.ts.map +1 -1
- package/dist/domains/serverStatus.js +5 -1
- package/dist/domains/udp.d.ts +19 -2
- package/dist/domains/udp.d.ts.map +1 -1
- package/dist/domains/udp.js +38 -0
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +42 -0
- package/dist/generated/graphql.d.ts +404 -12
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +2 -0
- package/dist/index.d.ts +10 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/logger.d.ts +8 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +1 -0
- package/dist/realtime.d.ts +86 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +270 -0
- package/dist/session.d.ts +27 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +61 -0
- package/dist/subscriptions.d.ts +1 -48
- package/dist/subscriptions.d.ts.map +1 -1
- package/dist/subscriptions.js +1 -192
- package/dist/utils.d.ts +12 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +50 -0
- package/dist/world.d.ts +35 -0
- package/dist/world.d.ts.map +1 -0
- package/dist/world.js +88 -0
- package/package.json +13 -3
|
@@ -148,6 +148,7 @@ export const QuotasForAppDocument = { "kind": "Document", "definitions": [{ "kin
|
|
|
148
148
|
export const QuotasForOrgDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "QuotasForOrg" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "orgId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BigInt" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "quotasForOrg" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "orgId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "orgId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "quotaId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "orgId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tierId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "metric" } }, { "kind": "Field", "name": { "kind": "Name", "value": "limitValue" } }, { "kind": "Field", "name": { "kind": "Name", "value": "period" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionOnExceed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
|
|
149
149
|
export const SetQuotaDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "SetQuota" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "SetQuotaInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "setQuota" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "quotaId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "orgId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "tierId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "metric" } }, { "kind": "Field", "name": { "kind": "Name", "value": "limitValue" } }, { "kind": "Field", "name": { "kind": "Name", "value": "period" } }, { "kind": "Field", "name": { "kind": "Name", "value": "actionOnExceed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
|
|
150
150
|
export const ActiveGraphQlServersDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ActiveGraphQLServers" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "activeGraphQLServers" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "graphqlServerId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ip4" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ip6" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
|
|
151
|
+
export const GameClientBootstrapDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GameClientBootstrap" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "appId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BigInt" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "gameClientBootstrap" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "appId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "appId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "realtimeProtocol" } }, { "kind": "Field", "name": { "kind": "Name", "value": "subscriptionName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxReplicationDistance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "maxDecayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumberModulo" } }, { "kind": "Field", "name": { "kind": "Name", "value": "udpProxyConnectionStatus" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "connected" } }, { "kind": "Field", "name": { "kind": "Name", "value": "serverIp6" } }, { "kind": "Field", "name": { "kind": "Name", "value": "serverClientPort" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastMessageTime" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "versionInfo" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "serverVersion" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "major" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minor" } }, { "kind": "Field", "name": { "kind": "Name", "value": "patch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "build" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumClientVersion" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "major" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minor" } }, { "kind": "Field", "name": { "kind": "Name", "value": "patch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "build" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "me" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "userId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "email" } }, { "kind": "Field", "name": { "kind": "Name", "value": "gamertag" } }, { "kind": "Field", "name": { "kind": "Name", "value": "disambiguation" } }, { "kind": "Field", "name": { "kind": "Name", "value": "state" } }, { "kind": "Field", "name": { "kind": "Name", "value": "isConfirmed" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "grantEarlyAccess" } }, { "kind": "Field", "name": { "kind": "Name", "value": "grantEarlyAccessOverride" } }, { "kind": "Field", "name": { "kind": "Name", "value": "orgId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "externalId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "userType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "isSuperAdmin" } }] } }] } }] } }] };
|
|
151
152
|
export const GraphqlServersDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GraphqlServers" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "graphqlServers" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "graphqlServerId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ip4" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ip6" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }] } }] } }] };
|
|
152
153
|
export const ServerWithLeastClientsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "ServerWithLeastClients" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "serverWithLeastClients" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "serverId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ip4" } }, { "kind": "Field", "name": { "kind": "Name", "value": "ip6" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clientPort" } }, { "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "peers" } }, { "kind": "Field", "name": { "kind": "Name", "value": "clients" } }, { "kind": "Field", "name": { "kind": "Name", "value": "cpuPeakPct" } }, { "kind": "Field", "name": { "kind": "Name", "value": "updatedAt" } }, { "kind": "Field", "name": { "kind": "Name", "value": "createdAt" } }] } }] } }] };
|
|
153
154
|
export const VersionInfoDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "VersionInfo" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "versionInfo" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "serverVersion" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "major" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minor" } }, { "kind": "Field", "name": { "kind": "Name", "value": "patch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "build" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumClientVersion" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "major" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minor" } }, { "kind": "Field", "name": { "kind": "Name", "value": "patch" } }, { "kind": "Field", "name": { "kind": "Name", "value": "build" } }] } }] } }] } }] };
|
|
@@ -163,6 +164,7 @@ export const SendAudioPacketDocument = { "kind": "Document", "definitions": [{ "
|
|
|
163
164
|
export const SendClientEventDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "SendClientEvent" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ClientEventNotificationInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "sendClientEvent" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }] }] } }] };
|
|
164
165
|
export const SendTextPacketDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "SendTextPacket" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ClientTextPacketInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "sendTextPacket" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }] }] } }] };
|
|
165
166
|
export const SendVoxelUpdateDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "SendVoxelUpdate" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "VoxelUpdateRequestInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "sendVoxelUpdate" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }] }] } }] };
|
|
167
|
+
export const UdpNotificationsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "subscription", "name": { "kind": "Name", "value": "UdpNotifications" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "udpNotifications" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "__typename" } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ActorUpdateNotification" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "distance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "decayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uuid" } }, { "kind": "Field", "name": { "kind": "Name", "value": "state" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "epochMillis" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ActorUpdateResponse" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "distance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "decayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uuid" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "epochMillis" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "VoxelUpdateNotification" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "distance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "decayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uuid" } }, { "kind": "Field", "name": { "kind": "Name", "value": "voxelX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "voxelY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "voxelZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "voxelType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "voxelState" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "epochMillis" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "VoxelUpdateResponse" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "distance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "decayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uuid" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "epochMillis" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ClientAudioNotification" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "distance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "decayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uuid" } }, { "kind": "Field", "name": { "kind": "Name", "value": "audioData" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "epochMillis" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ClientTextNotification" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "distance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "decayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uuid" } }, { "kind": "Field", "name": { "kind": "Name", "value": "text" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "epochMillis" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ClientEventNotification" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "distance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "decayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uuid" } }, { "kind": "Field", "name": { "kind": "Name", "value": "eventType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "state" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "epochMillis" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "ServerEventNotification" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "appId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkX" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkY" } }, { "kind": "Field", "name": { "kind": "Name", "value": "chunkZ" } }, { "kind": "Field", "name": { "kind": "Name", "value": "distance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "decayRate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "uuid" } }, { "kind": "Field", "name": { "kind": "Name", "value": "eventType" } }, { "kind": "Field", "name": { "kind": "Name", "value": "state" } }, { "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "epochMillis" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "GenericErrorResponse" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "sequenceNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "errorCode" } }] } }, { "kind": "InlineFragment", "typeCondition": { "kind": "NamedType", "name": { "kind": "Name", "value": "RealtimeConnectionEvent" } }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "status" } }, { "kind": "Field", "name": { "kind": "Name", "value": "code" } }, { "kind": "Field", "name": { "kind": "Name", "value": "message" } }, { "kind": "Field", "name": { "kind": "Name", "value": "retryable" } }] } }] } }] } }] };
|
|
166
168
|
export const UdpProxyConnectionStatusDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "UdpProxyConnectionStatus" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "udpProxyConnectionStatus" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "connected" } }, { "kind": "Field", "name": { "kind": "Name", "value": "serverIp6" } }, { "kind": "Field", "name": { "kind": "Name", "value": "serverClientPort" } }, { "kind": "Field", "name": { "kind": "Name", "value": "lastMessageTime" } }] } }] } }] };
|
|
167
169
|
export const DeleteMyAccountDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "DeleteMyAccount" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "deleteMyAccount" } }] } }] };
|
|
168
170
|
export const ForceLogoutUserDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "ForceLogoutUser" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "BigInt" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "forceLogoutUser" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "userId" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "userId" } } }] }] } }] };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,12 +12,16 @@
|
|
|
12
12
|
* const checkout = await client.payments.createCheckout({ ... });
|
|
13
13
|
* const unsub = client.udp.subscribe({ onActorUpdate: (n) => { ... } });
|
|
14
14
|
*/
|
|
15
|
-
declare const VERSION
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
15
|
+
export declare const VERSION = "3.0.0";
|
|
16
|
+
export { CrowdyClient, createCrowdyClient, type CrowdyClientConfig, } from './crowdy-client.js';
|
|
17
|
+
export { BrowserLocalStorageTokenStore, SessionStore, type SessionListener, type TokenStore, } from './session.js';
|
|
18
|
+
export { GraphQLClient, GraphQLTransport, type GraphQLClientConfig, } from './client.js';
|
|
19
|
+
export { RealtimeClient, type RealtimeConfig, type RealtimeStatus, type SpatialNotification, type UdpNotification, type UdpNotificationHandlers, } from './realtime.js';
|
|
20
|
+
export { WorldClient, ActorClient, type ActorOptions } from './world.js';
|
|
21
|
+
export { CrowdyError, CrowdyGraphQLError, CrowdyHttpError, CrowdyNetworkError, CrowdyProtocolError, CrowdyRealtimeError, CrowdyTimeoutError, } from './errors.js';
|
|
22
|
+
export { SequenceAllocator, decodeBase64, encodeBase64, generateCrowdyUuid, validateChunkCoordinates, validateCrowdyUuid, } from './utils.js';
|
|
23
|
+
export type { BigInt, ChunkCoordinates, VoxelCoordinates, ActorUpdateNotification, ActorUpdateResponse, VoxelUpdateNotification, VoxelUpdateResponse, ClientAudioNotification, ClientTextNotification, ClientEventNotification, ServerEventNotification, GenericErrorResponse, ActorUpdateHandler, ActorUpdateResponseHandler, VoxelUpdateHandler, VoxelUpdateResponseHandler, ClientAudioHandler, ClientTextHandler, ClientEventHandler, ServerEventHandler, GenericErrorHandler, UnsubscribeFn, } from './types.js';
|
|
19
24
|
export { UdpErrorCode } from './types.js';
|
|
20
|
-
export type { UdpNotificationHandlers } from './subscriptions.js';
|
|
21
25
|
export { AuthAPI } from './domains/auth.js';
|
|
22
26
|
export { UsersAPI } from './domains/users.js';
|
|
23
27
|
export { OrganizationsAPI } from './domains/organizations.js';
|
|
@@ -33,6 +37,6 @@ export { TeleportAPI } from './domains/teleport.js';
|
|
|
33
37
|
export { StateAPI } from './domains/state.js';
|
|
34
38
|
export { ServerStatusAPI } from './domains/serverStatus.js';
|
|
35
39
|
export { UdpAPI } from './domains/udp.js';
|
|
36
|
-
export type { ChunkCoordinatesInput, VoxelCoordinatesInput, ActorUpdateRequestInput, VoxelUpdateRequestInput, ClientAudioPacketInput, ClientTextPacketInput, ClientEventNotificationInput, UdpProxyConnectionStatus, LoginUserInput, RegisterUserInput, ResetPasswordInput, CreateOrganizationInput, CreateOrgTokenInput, UpdateOrgTokenInput, CreateOrgRoleInput, UpdateOrgRoleInput, InviteOrgMemberInput, CreateAppInput, UpdateAppInput, AppMarketplaceFilterInput, CreateAccessTierInput, UpdateAccessTierInput, GrantAppAccessInput, CreateCheckoutInput, CheckoutFilterInput, SetQuotaInput, CreateActorInput, UpdateActorInput, ActorFilterInput, BatchActorLookupInput, CreateUserAppStateInput, UpdateUserStateInput, UpdateAvatarStateInput, UpdateActorStateInput, UpdateGamertagInput, UpdateChunkStateInput, UpdateChunkLodsInput, ChunkUpdateInput, UpdateVoxelInput, RollbackVoxelUpdatesInput, GetChunkInput, GetChunkLodsInput, GetChunksByDistanceInput, GetVoxelListInput, ListVoxelsInput, ListVoxelUpdatesByDistanceInput, TeleportRequestInput, LodDataInput, VoxelStateInput, Organization, OrgMember, OrgRole, OrgToken, OrgPermission, OrgMembership, App, AppsPage, AppAccessTier, AppUserAccess, AppBudget, OrgWallet, WalletTransaction, Checkout, CheckoutsPage, ServiceQuota, Chunk, ChunkLodsResponse, ChunksByDistanceResponse, ChunkVoxelResponse, ChunkVoxelUpdatesResponse, Voxel, VoxelUpdatesByDistanceResponse, VoxelUpdateHistoryEvent, RollbackVoxelEventResult, Actor, Avatar, AvatarDto, TeleportResponse, UserAppState, ServerStatus, GraphQlServer, ServerVersionInfo, VersionInfo, PageInfo, UsersPage, Scalars, } from './generated/graphql.js';
|
|
40
|
+
export type { ChunkCoordinatesInput, VoxelCoordinatesInput, ActorUpdateRequestInput, VoxelUpdateRequestInput, ClientAudioPacketInput, ClientTextPacketInput, ClientEventNotificationInput, UdpProxyConnectionStatus, RealtimeConnectionEvent, GameClientBootstrap, LoginUserInput, RegisterUserInput, ResetPasswordInput, CreateOrganizationInput, CreateOrgTokenInput, UpdateOrgTokenInput, CreateOrgRoleInput, UpdateOrgRoleInput, InviteOrgMemberInput, CreateAppInput, UpdateAppInput, AppMarketplaceFilterInput, CreateAccessTierInput, UpdateAccessTierInput, GrantAppAccessInput, CreateCheckoutInput, CheckoutFilterInput, SetQuotaInput, CreateActorInput, UpdateActorInput, ActorFilterInput, BatchActorLookupInput, CreateUserAppStateInput, UpdateUserStateInput, UpdateAvatarStateInput, UpdateActorStateInput, UpdateGamertagInput, UpdateChunkStateInput, UpdateChunkLodsInput, ChunkUpdateInput, UpdateVoxelInput, RollbackVoxelUpdatesInput, GetChunkInput, GetChunkLodsInput, GetChunksByDistanceInput, GetVoxelListInput, ListVoxelsInput, ListVoxelUpdatesByDistanceInput, TeleportRequestInput, LodDataInput, VoxelStateInput, Organization, OrgMember, OrgRole, OrgToken, OrgPermission, OrgMembership, App, AppsPage, AppAccessTier, AppUserAccess, AppBudget, OrgWallet, WalletTransaction, Checkout, CheckoutsPage, ServiceQuota, Chunk, ChunkLodsResponse, ChunksByDistanceResponse, ChunkVoxelResponse, ChunkVoxelUpdatesResponse, Voxel, VoxelUpdatesByDistanceResponse, VoxelUpdateHistoryEvent, RollbackVoxelEventResult, Actor, Avatar, AvatarDto, TeleportResponse, UserAppState, ServerStatus, GraphQlServer, ServerVersionInfo, VersionInfo, PageInfo, UsersPage, UdpNotificationsSubscription, Scalars, } from './generated/graphql.js';
|
|
37
41
|
export { PaymentProvider, CheckoutPurpose, CheckoutStatus, AppVisibility, AppStatus, ServerState, } from './generated/graphql.js';
|
|
38
42
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EACL,YAAY,EACZ,kBAAkB,EACl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B,EACzB,aAAa,EACb,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,+BAA+B,EAC/B,oBAAoB,EACpB,YAAY,EACZ,eAAe,EAGf,YAAY,EACZ,SAAS,EACT,OAAO,EACP,QAAQ,EACR,aAAa,EACb,aAAa,EACb,GAAG,EACH,QAAQ,EACR,aAAa,EACb,aAAa,EACb,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,KAAK,EACL,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,EACL,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,4BAA4B,EAG5B,OAAO,GACR,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,SAAS,EACT,WAAW,GACZ,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
* const checkout = await client.payments.createCheckout({ ... });
|
|
13
13
|
* const unsub = client.udp.subscribe({ onActorUpdate: (n) => { ... } });
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export {
|
|
19
|
-
|
|
20
|
-
export {
|
|
15
|
+
export const VERSION = '3.0.0';
|
|
16
|
+
export { CrowdyClient, createCrowdyClient, } from './crowdy-client.js';
|
|
17
|
+
export { BrowserLocalStorageTokenStore, SessionStore, } from './session.js';
|
|
18
|
+
export { GraphQLClient, GraphQLTransport, } from './client.js';
|
|
19
|
+
export { RealtimeClient, } from './realtime.js';
|
|
20
|
+
export { WorldClient, ActorClient } from './world.js';
|
|
21
|
+
export { CrowdyError, CrowdyGraphQLError, CrowdyHttpError, CrowdyNetworkError, CrowdyProtocolError, CrowdyRealtimeError, CrowdyTimeoutError, } from './errors.js';
|
|
22
|
+
export { SequenceAllocator, decodeBase64, encodeBase64, generateCrowdyUuid, validateChunkCoordinates, validateCrowdyUuid, } from './utils.js';
|
|
21
23
|
export { UdpErrorCode } from './types.js';
|
|
22
24
|
// -----------------------------------------------------------------------------
|
|
23
25
|
// Domain wrappers (exported so consumers can reference the API surface in
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CrowdyLogger {
|
|
2
|
+
debug?(message: string, meta?: unknown): void;
|
|
3
|
+
info?(message: string, meta?: unknown): void;
|
|
4
|
+
warn?(message: string, meta?: unknown): void;
|
|
5
|
+
error?(message: string, meta?: unknown): void;
|
|
6
|
+
}
|
|
7
|
+
export declare const silentLogger: CrowdyLogger;
|
|
8
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC9C,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7C,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7C,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/C;AAED,eAAO,MAAM,YAAY,EAAE,YAAiB,CAAC"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const silentLogger = {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { SessionStore } from './session.js';
|
|
2
|
+
import type { CrowdyLogger } from './logger.js';
|
|
3
|
+
import { CrowdyRealtimeError } from './errors.js';
|
|
4
|
+
import { type UdpNotificationsSubscription } from './generated/graphql.js';
|
|
5
|
+
export type RealtimeStatus = 'idle' | 'connecting' | 'connected' | 'reconnecting' | 'disconnected' | 'failed';
|
|
6
|
+
export type UdpNotification = NonNullable<UdpNotificationsSubscription['udpNotifications']>;
|
|
7
|
+
export type SpatialNotification = Extract<UdpNotification, {
|
|
8
|
+
sequenceNumber: number;
|
|
9
|
+
}>;
|
|
10
|
+
export interface UdpNotificationHandlers {
|
|
11
|
+
actorUpdate?: (notification: Extract<UdpNotification, {
|
|
12
|
+
__typename?: 'ActorUpdateNotification';
|
|
13
|
+
}>) => void;
|
|
14
|
+
actorUpdateResponse?: (notification: Extract<UdpNotification, {
|
|
15
|
+
__typename?: 'ActorUpdateResponse';
|
|
16
|
+
}>) => void;
|
|
17
|
+
voxelUpdate?: (notification: Extract<UdpNotification, {
|
|
18
|
+
__typename?: 'VoxelUpdateNotification';
|
|
19
|
+
}>) => void;
|
|
20
|
+
voxelUpdateResponse?: (notification: Extract<UdpNotification, {
|
|
21
|
+
__typename?: 'VoxelUpdateResponse';
|
|
22
|
+
}>) => void;
|
|
23
|
+
audio?: (notification: Extract<UdpNotification, {
|
|
24
|
+
__typename?: 'ClientAudioNotification';
|
|
25
|
+
}>) => void;
|
|
26
|
+
text?: (notification: Extract<UdpNotification, {
|
|
27
|
+
__typename?: 'ClientTextNotification';
|
|
28
|
+
}>) => void;
|
|
29
|
+
clientEvent?: (notification: Extract<UdpNotification, {
|
|
30
|
+
__typename?: 'ClientEventNotification';
|
|
31
|
+
}>) => void;
|
|
32
|
+
serverEvent?: (notification: Extract<UdpNotification, {
|
|
33
|
+
__typename?: 'ServerEventNotification';
|
|
34
|
+
}>) => void;
|
|
35
|
+
genericError?: (notification: Extract<UdpNotification, {
|
|
36
|
+
__typename?: 'GenericErrorResponse';
|
|
37
|
+
}>) => void;
|
|
38
|
+
connectionEvent?: (notification: Extract<UdpNotification, {
|
|
39
|
+
__typename?: 'RealtimeConnectionEvent';
|
|
40
|
+
}>) => void;
|
|
41
|
+
error?: (error: CrowdyRealtimeError) => void;
|
|
42
|
+
any?: (notification: UdpNotification) => void;
|
|
43
|
+
}
|
|
44
|
+
export interface RealtimeConfig {
|
|
45
|
+
wsUrl?: string;
|
|
46
|
+
wsEndpoint?: string;
|
|
47
|
+
retryAttempts?: number;
|
|
48
|
+
retryInitialDelayMs?: number;
|
|
49
|
+
retryMaxDelayMs?: number;
|
|
50
|
+
waitTimeoutMs?: number;
|
|
51
|
+
logger?: CrowdyLogger;
|
|
52
|
+
}
|
|
53
|
+
export declare class RealtimeClient {
|
|
54
|
+
private readonly session;
|
|
55
|
+
private readonly wsUrl;
|
|
56
|
+
private readonly logger;
|
|
57
|
+
private readonly retryAttempts;
|
|
58
|
+
private readonly retryInitialDelayMs;
|
|
59
|
+
private readonly retryMaxDelayMs;
|
|
60
|
+
private readonly waitTimeoutMs;
|
|
61
|
+
private client;
|
|
62
|
+
private release;
|
|
63
|
+
private desired;
|
|
64
|
+
private statusValue;
|
|
65
|
+
private readonly statusListeners;
|
|
66
|
+
private readonly subscribers;
|
|
67
|
+
private readonly pending;
|
|
68
|
+
private nextSubscriberId;
|
|
69
|
+
constructor(config: RealtimeConfig | undefined, session: SessionStore);
|
|
70
|
+
status(): RealtimeStatus;
|
|
71
|
+
onStatus(listener: (status: RealtimeStatus) => void): () => void;
|
|
72
|
+
connect(): void;
|
|
73
|
+
disconnect(): void;
|
|
74
|
+
close(): void;
|
|
75
|
+
subscribe(handlers: UdpNotificationHandlers): () => void;
|
|
76
|
+
waitForSequence(sequenceNumber: number, timeoutMs?: number): Promise<SpatialNotification>;
|
|
77
|
+
private ensureSubscription;
|
|
78
|
+
private restart;
|
|
79
|
+
private dispatch;
|
|
80
|
+
private resolvePending;
|
|
81
|
+
private removePending;
|
|
82
|
+
private rejectAllPending;
|
|
83
|
+
private dispatchError;
|
|
84
|
+
private setStatus;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=realtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../src/realtime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,YAAY,GACZ,WAAW,GACX,cAAc,GACd,cAAc,GACd,QAAQ,CAAC;AAEb,MAAM,MAAM,eAAe,GAAG,WAAW,CACvC,4BAA4B,CAAC,kBAAkB,CAAC,CACjD,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,eAAe,EACf;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAC3B,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,eAAe,EAAE;QAAE,UAAU,CAAC,EAAE,yBAAyB,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC3G,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,eAAe,EAAE;QAAE,UAAU,CAAC,EAAE,qBAAqB,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC/G,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,eAAe,EAAE;QAAE,UAAU,CAAC,EAAE,yBAAyB,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IAC3G,mBAAmB,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,eAAe,EAAE;QAAE,UAAU,CAAC,EAAE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xB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,SAAS;CAOlB"}
|
package/dist/realtime.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { print } from 'graphql';
|
|
2
|
+
import { createClient } from 'graphql-ws';
|
|
3
|
+
import { silentLogger } from './logger.js';
|
|
4
|
+
import { CrowdyRealtimeError } from './errors.js';
|
|
5
|
+
import { UdpNotificationsDocument, } from './generated/graphql.js';
|
|
6
|
+
export class RealtimeClient {
|
|
7
|
+
constructor(config = {}, session) {
|
|
8
|
+
this.session = session;
|
|
9
|
+
this.client = null;
|
|
10
|
+
this.release = null;
|
|
11
|
+
this.desired = false;
|
|
12
|
+
this.statusValue = 'idle';
|
|
13
|
+
this.statusListeners = new Set();
|
|
14
|
+
this.subscribers = new Map();
|
|
15
|
+
this.pending = new Map();
|
|
16
|
+
this.nextSubscriberId = 1;
|
|
17
|
+
this.wsUrl = config.wsUrl || config.wsEndpoint || 'ws://localhost:3000/graphql';
|
|
18
|
+
this.logger = config.logger ?? silentLogger;
|
|
19
|
+
this.retryAttempts = config.retryAttempts ?? 8;
|
|
20
|
+
this.retryInitialDelayMs = config.retryInitialDelayMs ?? 250;
|
|
21
|
+
this.retryMaxDelayMs = config.retryMaxDelayMs ?? 5000;
|
|
22
|
+
this.waitTimeoutMs = config.waitTimeoutMs ?? 5000;
|
|
23
|
+
this.session.onChange((token) => {
|
|
24
|
+
if (!this.desired)
|
|
25
|
+
return;
|
|
26
|
+
if (!token) {
|
|
27
|
+
this.disconnect();
|
|
28
|
+
this.dispatchError(new CrowdyRealtimeError('Realtime disconnected because the session token was cleared', {
|
|
29
|
+
code: 'AUTH_CLEARED',
|
|
30
|
+
retryable: false,
|
|
31
|
+
}));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.restart();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
status() {
|
|
38
|
+
return this.statusValue;
|
|
39
|
+
}
|
|
40
|
+
onStatus(listener) {
|
|
41
|
+
this.statusListeners.add(listener);
|
|
42
|
+
listener(this.statusValue);
|
|
43
|
+
return () => {
|
|
44
|
+
this.statusListeners.delete(listener);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
connect() {
|
|
48
|
+
this.desired = true;
|
|
49
|
+
this.ensureSubscription();
|
|
50
|
+
}
|
|
51
|
+
disconnect() {
|
|
52
|
+
this.desired = false;
|
|
53
|
+
this.release?.();
|
|
54
|
+
this.release = null;
|
|
55
|
+
this.client?.dispose();
|
|
56
|
+
this.client = null;
|
|
57
|
+
this.setStatus('disconnected');
|
|
58
|
+
}
|
|
59
|
+
close() {
|
|
60
|
+
this.disconnect();
|
|
61
|
+
this.subscribers.clear();
|
|
62
|
+
this.rejectAllPending(new CrowdyRealtimeError('Realtime client closed', { retryable: false }));
|
|
63
|
+
}
|
|
64
|
+
subscribe(handlers) {
|
|
65
|
+
const id = `s${this.nextSubscriberId++}`;
|
|
66
|
+
this.subscribers.set(id, handlers);
|
|
67
|
+
this.connect();
|
|
68
|
+
return () => {
|
|
69
|
+
this.subscribers.delete(id);
|
|
70
|
+
if (this.subscribers.size === 0 && this.desired) {
|
|
71
|
+
this.disconnect();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
waitForSequence(sequenceNumber, timeoutMs = this.waitTimeoutMs) {
|
|
76
|
+
return new Promise((resolve, reject) => {
|
|
77
|
+
const timer = setTimeout(() => {
|
|
78
|
+
this.removePending(sequenceNumber, wait);
|
|
79
|
+
reject(new CrowdyRealtimeError(`Timed out waiting for UDP response sequence ${sequenceNumber}`, { code: 'UDP_SEQUENCE_TIMEOUT', retryable: true }));
|
|
80
|
+
}, timeoutMs);
|
|
81
|
+
const wait = { resolve, reject, timer };
|
|
82
|
+
const waits = this.pending.get(sequenceNumber) ?? [];
|
|
83
|
+
waits.push(wait);
|
|
84
|
+
this.pending.set(sequenceNumber, waits);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
ensureSubscription() {
|
|
88
|
+
if (this.release)
|
|
89
|
+
return;
|
|
90
|
+
const token = this.session.getToken();
|
|
91
|
+
if (!token) {
|
|
92
|
+
const error = new CrowdyRealtimeError('Must be authenticated to subscribe', {
|
|
93
|
+
code: 'AUTH_REQUIRED',
|
|
94
|
+
retryable: false,
|
|
95
|
+
});
|
|
96
|
+
this.setStatus('failed');
|
|
97
|
+
this.dispatchError(error);
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
this.setStatus('connecting');
|
|
101
|
+
this.client = createClient({
|
|
102
|
+
url: this.wsUrl,
|
|
103
|
+
lazy: true,
|
|
104
|
+
retryAttempts: this.retryAttempts,
|
|
105
|
+
connectionParams: () => {
|
|
106
|
+
const currentToken = this.session.getToken();
|
|
107
|
+
return currentToken ? { Authorization: `Bearer ${currentToken}` } : {};
|
|
108
|
+
},
|
|
109
|
+
retryWait: async (retries) => {
|
|
110
|
+
this.setStatus('reconnecting');
|
|
111
|
+
const delay = Math.min(this.retryMaxDelayMs, this.retryInitialDelayMs * 2 ** retries);
|
|
112
|
+
const jitter = Math.floor(Math.random() * this.retryInitialDelayMs);
|
|
113
|
+
await new Promise((resolve) => setTimeout(resolve, delay + jitter));
|
|
114
|
+
},
|
|
115
|
+
on: {
|
|
116
|
+
connected: () => this.setStatus('connected'),
|
|
117
|
+
closed: () => {
|
|
118
|
+
if (this.desired) {
|
|
119
|
+
this.setStatus('reconnecting');
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.setStatus('disconnected');
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
error: (error) => {
|
|
126
|
+
this.logger.error?.('Realtime WebSocket error', error);
|
|
127
|
+
this.dispatchError(new CrowdyRealtimeError('Realtime WebSocket error', {
|
|
128
|
+
code: 'WEBSOCKET_ERROR',
|
|
129
|
+
retryable: true,
|
|
130
|
+
cause: error,
|
|
131
|
+
}));
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
this.release = this.client.subscribe({ query: print(UdpNotificationsDocument) }, {
|
|
136
|
+
next: (message) => {
|
|
137
|
+
const data = message.data;
|
|
138
|
+
const notification = data?.udpNotifications;
|
|
139
|
+
if (notification)
|
|
140
|
+
this.dispatch(notification);
|
|
141
|
+
if (message.errors?.length) {
|
|
142
|
+
this.dispatchError(new CrowdyRealtimeError(message.errors[0]?.message ?? 'Subscription error', {
|
|
143
|
+
code: 'SUBSCRIPTION_ERROR',
|
|
144
|
+
retryable: true,
|
|
145
|
+
cause: message.errors,
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
error: (error) => {
|
|
150
|
+
this.setStatus('failed');
|
|
151
|
+
this.dispatchError(new CrowdyRealtimeError('Realtime subscription failed', {
|
|
152
|
+
code: 'SUBSCRIPTION_FAILED',
|
|
153
|
+
retryable: true,
|
|
154
|
+
cause: error,
|
|
155
|
+
}));
|
|
156
|
+
},
|
|
157
|
+
complete: () => {
|
|
158
|
+
this.release = null;
|
|
159
|
+
if (this.desired) {
|
|
160
|
+
this.setStatus('reconnecting');
|
|
161
|
+
this.ensureSubscription();
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
restart() {
|
|
167
|
+
this.release?.();
|
|
168
|
+
this.release = null;
|
|
169
|
+
this.client?.dispose();
|
|
170
|
+
this.client = null;
|
|
171
|
+
this.ensureSubscription();
|
|
172
|
+
}
|
|
173
|
+
dispatch(notification) {
|
|
174
|
+
this.resolvePending(notification);
|
|
175
|
+
for (const handlers of [...this.subscribers.values()]) {
|
|
176
|
+
try {
|
|
177
|
+
handlers.any?.(notification);
|
|
178
|
+
switch (notification.__typename) {
|
|
179
|
+
case 'ActorUpdateNotification':
|
|
180
|
+
handlers.actorUpdate?.(notification);
|
|
181
|
+
break;
|
|
182
|
+
case 'ActorUpdateResponse':
|
|
183
|
+
handlers.actorUpdateResponse?.(notification);
|
|
184
|
+
break;
|
|
185
|
+
case 'VoxelUpdateNotification':
|
|
186
|
+
handlers.voxelUpdate?.(notification);
|
|
187
|
+
break;
|
|
188
|
+
case 'VoxelUpdateResponse':
|
|
189
|
+
handlers.voxelUpdateResponse?.(notification);
|
|
190
|
+
break;
|
|
191
|
+
case 'ClientAudioNotification':
|
|
192
|
+
handlers.audio?.(notification);
|
|
193
|
+
break;
|
|
194
|
+
case 'ClientTextNotification':
|
|
195
|
+
handlers.text?.(notification);
|
|
196
|
+
break;
|
|
197
|
+
case 'ClientEventNotification':
|
|
198
|
+
handlers.clientEvent?.(notification);
|
|
199
|
+
break;
|
|
200
|
+
case 'ServerEventNotification':
|
|
201
|
+
handlers.serverEvent?.(notification);
|
|
202
|
+
break;
|
|
203
|
+
case 'GenericErrorResponse':
|
|
204
|
+
handlers.genericError?.(notification);
|
|
205
|
+
break;
|
|
206
|
+
case 'RealtimeConnectionEvent':
|
|
207
|
+
handlers.connectionEvent?.(notification);
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
this.logger.error?.('Realtime notification handler threw', error);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
resolvePending(notification) {
|
|
217
|
+
if (!('sequenceNumber' in notification))
|
|
218
|
+
return;
|
|
219
|
+
const waits = this.pending.get(notification.sequenceNumber);
|
|
220
|
+
if (!waits?.length)
|
|
221
|
+
return;
|
|
222
|
+
this.pending.delete(notification.sequenceNumber);
|
|
223
|
+
for (const wait of waits) {
|
|
224
|
+
clearTimeout(wait.timer);
|
|
225
|
+
if (notification.__typename === 'GenericErrorResponse') {
|
|
226
|
+
wait.reject(new CrowdyRealtimeError(`UDP request failed: ${notification.errorCode}`, {
|
|
227
|
+
code: notification.errorCode,
|
|
228
|
+
retryable: false,
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
wait.resolve(notification);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
removePending(sequenceNumber, wait) {
|
|
237
|
+
const waits = this.pending.get(sequenceNumber);
|
|
238
|
+
if (!waits)
|
|
239
|
+
return;
|
|
240
|
+
const next = waits.filter((candidate) => candidate !== wait);
|
|
241
|
+
if (next.length) {
|
|
242
|
+
this.pending.set(sequenceNumber, next);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
this.pending.delete(sequenceNumber);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
rejectAllPending(error) {
|
|
249
|
+
for (const waits of this.pending.values()) {
|
|
250
|
+
for (const wait of waits) {
|
|
251
|
+
clearTimeout(wait.timer);
|
|
252
|
+
wait.reject(error);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
this.pending.clear();
|
|
256
|
+
}
|
|
257
|
+
dispatchError(error) {
|
|
258
|
+
for (const handlers of [...this.subscribers.values()]) {
|
|
259
|
+
handlers.error?.(error);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
setStatus(status) {
|
|
263
|
+
if (status === this.statusValue)
|
|
264
|
+
return;
|
|
265
|
+
this.statusValue = status;
|
|
266
|
+
for (const listener of [...this.statusListeners]) {
|
|
267
|
+
listener(status);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type SessionListener = (token: string | null) => void;
|
|
2
|
+
export interface TokenStore {
|
|
3
|
+
get(): string | null | Promise<string | null>;
|
|
4
|
+
set(token: string): void | Promise<void>;
|
|
5
|
+
clear(): void | Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class BrowserLocalStorageTokenStore implements TokenStore {
|
|
8
|
+
private readonly key;
|
|
9
|
+
constructor(key?: string);
|
|
10
|
+
get(): string | null;
|
|
11
|
+
set(token: string): void;
|
|
12
|
+
clear(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare class SessionStore {
|
|
15
|
+
private readonly tokenStore?;
|
|
16
|
+
private token;
|
|
17
|
+
private readonly listeners;
|
|
18
|
+
constructor(tokenStore?: TokenStore | undefined);
|
|
19
|
+
restore(): Promise<string | null>;
|
|
20
|
+
getToken(): string | null;
|
|
21
|
+
setToken(token: string | null, options?: {
|
|
22
|
+
persist?: boolean;
|
|
23
|
+
}): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
onChange(listener: SessionListener): () => void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,GAAG,IAAI,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9C,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,qBAAa,6BAA8B,YAAW,UAAU;IAClD,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,SAAmB;IAEnD,GAAG,IAAI,MAAM,GAAG,IAAI;IAKpB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKxB,KAAK,IAAI,IAAI;CAId;AAED,qBAAa,YAAY;IAIX,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAHxC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8B;gBAE3B,UAAU,CAAC,EAAE,UAAU,YAAA;IAE9C,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAMvC,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IAiBzE,KAAK,IAAI,IAAI;IAIb,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;CAOhD"}
|