From f22b6fd05711b6f7fabc36afaa168ce07941bc2b Mon Sep 17 00:00:00 2001 From: Phoebe Goldman Date: Thu, 12 Oct 2023 10:59:19 -0400 Subject: [PATCH] Client address support for TypeScript SDK (#23) See https://github.com/clockworklabs/SpacetimeDB/pull/299 --- .../client/src/module_bindings/message.ts | 17 +- .../module_bindings/send_message_reducer.ts | 3 +- .../src/module_bindings/set_name_reducer.ts | 3 +- .../client/src/module_bindings/user.ts | 15 +- package-lock.json | 393 +++++++++- src/address.ts | 85 +++ src/client_api.ts | 712 ++++++++++++++---- src/identity.ts | 2 +- src/index.ts | 1 + src/spacetimedb.ts | 41 +- 10 files changed, 1060 insertions(+), 212 deletions(-) create mode 100644 src/address.ts diff --git a/examples/quickstart/client/src/module_bindings/message.ts b/examples/quickstart/client/src/module_bindings/message.ts index 01f48b9..93f04fb 100644 --- a/examples/quickstart/client/src/module_bindings/message.ts +++ b/examples/quickstart/client/src/module_bindings/message.ts @@ -14,6 +14,7 @@ import { AlgebraicValue, ReducerEvent, Identity, + Address, } from "@clockworklabs/spacetimedb-sdk"; export class Message extends IDatabaseTable { @@ -36,7 +37,7 @@ export class Message extends IDatabaseTable { public static getAlgebraicType(): AlgebraicType { return AlgebraicType.createProductType([ new ProductTypeElement( - "Sender", + "sender", AlgebraicType.createProductType([ new ProductTypeElement( "__identity_bytes", @@ -47,11 +48,11 @@ export class Message extends IDatabaseTable { ]) ), new ProductTypeElement( - "Sent", - AlgebraicType.createPrimitiveType(BuiltinType.Type.I64) + "sent", + AlgebraicType.createPrimitiveType(BuiltinType.Type.U64) ), new ProductTypeElement( - "Text", + "text", AlgebraicType.createPrimitiveType(BuiltinType.Type.String) ), ]); @@ -59,12 +60,12 @@ export class Message extends IDatabaseTable { public static fromValue(value: AlgebraicValue): Message { let productValue = value.asProductValue(); - let __Sender = new Identity( + let __sender = new Identity( productValue.elements[0].asProductValue().elements[0].asBytes() ); - let __Sent = productValue.elements[1].asNumber(); - let __Text = productValue.elements[2].asString(); - return new this(__Sender, __Sent, __Text); + let __sent = productValue.elements[1].asNumber(); + let __text = productValue.elements[2].asString(); + return new this(__sender, __sent, __text); } public static count(): number { diff --git a/examples/quickstart/client/src/module_bindings/send_message_reducer.ts b/examples/quickstart/client/src/module_bindings/send_message_reducer.ts index 6c89464..1ba25b3 100644 --- a/examples/quickstart/client/src/module_bindings/send_message_reducer.ts +++ b/examples/quickstart/client/src/module_bindings/send_message_reducer.ts @@ -14,6 +14,7 @@ import { SumTypeVariant, Serializer, Identity, + Address, ReducerEvent, } from "@clockworklabs/spacetimedb-sdk"; @@ -25,7 +26,7 @@ export class SendMessageReducer { BuiltinType.Type.String ); serializer.write(_textType, _text); - __SPACETIMEDB__.spacetimeDBClient.call("SendMessage", serializer); + __SPACETIMEDB__.spacetimeDBClient.call("send_message", serializer); } } diff --git a/examples/quickstart/client/src/module_bindings/set_name_reducer.ts b/examples/quickstart/client/src/module_bindings/set_name_reducer.ts index 208c0d2..6bc900e 100644 --- a/examples/quickstart/client/src/module_bindings/set_name_reducer.ts +++ b/examples/quickstart/client/src/module_bindings/set_name_reducer.ts @@ -14,6 +14,7 @@ import { SumTypeVariant, Serializer, Identity, + Address, ReducerEvent, } from "@clockworklabs/spacetimedb-sdk"; @@ -25,7 +26,7 @@ export class SetNameReducer { BuiltinType.Type.String ); serializer.write(_nameType, _name); - __SPACETIMEDB__.spacetimeDBClient.call("SetName", serializer); + __SPACETIMEDB__.spacetimeDBClient.call("set_name", serializer); } } diff --git a/examples/quickstart/client/src/module_bindings/user.ts b/examples/quickstart/client/src/module_bindings/user.ts index ea9821f..3557b71 100644 --- a/examples/quickstart/client/src/module_bindings/user.ts +++ b/examples/quickstart/client/src/module_bindings/user.ts @@ -14,6 +14,7 @@ import { AlgebraicValue, ReducerEvent, Identity, + Address, } from "@clockworklabs/spacetimedb-sdk"; export class User extends IDatabaseTable { @@ -42,7 +43,7 @@ export class User extends IDatabaseTable { public static getAlgebraicType(): AlgebraicType { return AlgebraicType.createProductType([ new ProductTypeElement( - "Identity", + "identity", AlgebraicType.createProductType([ new ProductTypeElement( "__identity_bytes", @@ -53,7 +54,7 @@ export class User extends IDatabaseTable { ]) ), new ProductTypeElement( - "Name", + "name", AlgebraicType.createSumType([ new SumTypeVariant( "some", @@ -63,7 +64,7 @@ export class User extends IDatabaseTable { ]) ), new ProductTypeElement( - "Online", + "online", AlgebraicType.createPrimitiveType(BuiltinType.Type.Bool) ), ]); @@ -71,15 +72,15 @@ export class User extends IDatabaseTable { public static fromValue(value: AlgebraicValue): User { let productValue = value.asProductValue(); - let __Identity = new Identity( + let __identity = new Identity( productValue.elements[0].asProductValue().elements[0].asBytes() ); - let __Name = + let __name = productValue.elements[1].asSumValue().tag == 1 ? null : productValue.elements[1].asSumValue().value.asString(); - let __Online = productValue.elements[2].asBoolean(); - return new this(__Identity, __Name, __Online); + let __online = productValue.elements[2].asBoolean(); + return new this(__identity, __name, __online); } public static count(): number { diff --git a/package-lock.json b/package-lock.json index 1a18c4a..7f45811 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,20 @@ { "name": "@clockworklabs/spacetimedb-sdk", - "version": "0.4.0-next.1", + "version": "0.6.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@clockworklabs/spacetimedb-sdk", - "version": "0.4.0-next.1", + "version": "0.6.1", "dependencies": { "buffer": "^6.0.3", "events": "^3.3.0", - "prettier-eslint": "^15.0.1", - "websocket": "^1.0.34" + "isomorphic-ws": "^5.0.0", + "long": "^5.2.3", + "protobufjs": "^7.2.4", + "websocket": "^1.0.34", + "ws": "^8.13.0" }, "devDependencies": { "@types/jest": "^29.4.0", @@ -21,10 +24,13 @@ "jest": "^29.5.0", "lint-staged": ">=10", "prettier": "2.8.7", + "prettier-eslint": "^15.0.1", "pretty-quick": "^3.1.3", + "protobufjs": "^7.2.4", "rimraf": "^3.0.2", "ts-jest": "^29.0.5", "ts-node": "^10.9.1", + "ts-proto": "^1.150.1", "typescript": "^4.9.3" } }, @@ -32,6 +38,7 @@ "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -706,6 +713,7 @@ "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, "dependencies": { "eslint-visitor-keys": "^3.3.0" }, @@ -720,6 +728,7 @@ "version": "4.5.1", "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz", "integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==", + "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } @@ -728,6 +737,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.0.tgz", "integrity": "sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A==", + "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -749,12 +759,14 @@ "node_modules/@eslint/eslintrc/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true }, "node_modules/@eslint/eslintrc/node_modules/globals": { "version": "13.20.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, "dependencies": { "type-fest": "^0.20.2" }, @@ -769,6 +781,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, "dependencies": { "argparse": "^2.0.1" }, @@ -780,6 +793,7 @@ "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, "engines": { "node": ">=10" }, @@ -791,6 +805,7 @@ "version": "8.44.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.44.0.tgz", "integrity": "sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==", + "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -799,6 +814,7 @@ "version": "0.11.10", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", @@ -812,6 +828,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, "engines": { "node": ">=12.22" }, @@ -823,7 +840,8 @@ "node_modules/@humanwhocodes/object-schema": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==" + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", @@ -1218,6 +1236,7 @@ "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -1230,6 +1249,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, "engines": { "node": ">= 8" } @@ -1238,6 +1258,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -1246,6 +1267,70 @@ "node": ">= 8" } }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "dev": true + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "dev": true + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "dev": true + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "dev": true + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "dev": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "dev": true + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "dev": true + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "dev": true + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "dev": true + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "dev": true + }, "node_modules/@sinclair/typebox": { "version": "0.25.24", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.24.tgz", @@ -1350,6 +1435,7 @@ "version": "8.40.2", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.40.2.tgz", "integrity": "sha512-PRVjQ4Eh9z9pmmtaq8nTjZjQwKFk7YIHIud3lRoKRBgUQjgjRmoGxxGEPXQkF+lH7QkHJRNr5F4aBgYCW0lqpQ==", + "dev": true, "dependencies": { "@types/estree": "*", "@types/json-schema": "*" @@ -1358,7 +1444,8 @@ "node_modules/@types/estree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==" + "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", + "dev": true }, "node_modules/@types/graceful-fs": { "version": "4.1.6", @@ -1411,7 +1498,8 @@ "node_modules/@types/json-schema": { "version": "7.0.12", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", - "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==" + "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", + "dev": true }, "node_modules/@types/minimatch": { "version": "3.0.5", @@ -1431,6 +1519,7 @@ "version": "2.7.2", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", + "dev": true, "license": "MIT" }, "node_modules/@types/stack-utils": { @@ -1471,6 +1560,7 @@ "version": "5.61.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.61.0.tgz", "integrity": "sha512-yGr4Sgyh8uO6fSi9hw3jAFXNBHbCtKKFMdX2IkT3ZqpKmtAq3lHS4ixB/COFuAIJpwl9/AqF7j72ZDWYKmIfvg==", + "dev": true, "dependencies": { "@typescript-eslint/scope-manager": "5.61.0", "@typescript-eslint/types": "5.61.0", @@ -1497,6 +1587,7 @@ "version": "5.61.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.61.0.tgz", "integrity": "sha512-W8VoMjoSg7f7nqAROEmTt6LoBpn81AegP7uKhhW5KzYlehs8VV0ZW0fIDVbcZRcaP3aPSW+JZFua+ysQN+m/Nw==", + "dev": true, "dependencies": { "@typescript-eslint/types": "5.61.0", "@typescript-eslint/visitor-keys": "5.61.0" @@ -1513,6 +1604,7 @@ "version": "5.61.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.61.0.tgz", "integrity": "sha512-ldyueo58KjngXpzloHUog/h9REmHl59G1b3a5Sng1GfBo14BkS3ZbMEb3693gnP1k//97lh7bKsp6/V/0v1veQ==", + "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -1525,6 +1617,7 @@ "version": "5.61.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.61.0.tgz", "integrity": "sha512-Fud90PxONnnLZ36oR5ClJBLTLfU4pIWBmnvGwTbEa2cXIqj70AEDEmOmpkFComjBZ/037ueKrOdHuYmSFVD7Rw==", + "dev": true, "dependencies": { "@typescript-eslint/types": "5.61.0", "@typescript-eslint/visitor-keys": "5.61.0", @@ -1551,6 +1644,7 @@ "version": "7.5.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -1565,6 +1659,7 @@ "version": "5.61.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.61.0.tgz", "integrity": "sha512-50XQ5VdbWrX06mQXhy93WywSFZZGsv3EOjq+lqp6WC2t+j3mb6A9xYVdrRxafvK88vg9k9u+CT4l6D8PEatjKg==", + "dev": true, "dependencies": { "@typescript-eslint/types": "5.61.0", "eslint-visitor-keys": "^3.3.0" @@ -1581,6 +1676,7 @@ "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -1592,6 +1688,7 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } @@ -1624,6 +1721,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1655,6 +1753,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1664,6 +1763,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -1720,6 +1820,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1845,6 +1946,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, "license": "MIT" }, "node_modules/base64-js": { @@ -1871,6 +1973,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -1881,6 +1984,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "license": "MIT", "dependencies": { "fill-range": "^7.0.1" @@ -1989,6 +2093,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -2028,10 +2133,23 @@ ], "license": "CC-BY-4.0" }, + "node_modules/case-anything": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", + "dev": true, + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -2208,6 +2326,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -2220,6 +2339,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, "license": "MIT" }, "node_modules/colorette": { @@ -2243,6 +2363,7 @@ "version": "1.8.2", "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==", + "dev": true, "engines": { "node": ">=4.0.0" } @@ -2251,6 +2372,7 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, "license": "MIT" }, "node_modules/convert-source-map": { @@ -2271,6 +2393,7 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -2295,6 +2418,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "license": "MIT", "dependencies": { "ms": "2.1.2" @@ -2318,7 +2442,8 @@ "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true }, "node_modules/deepmerge": { "version": "4.3.1", @@ -2330,6 +2455,18 @@ "node": ">=0.10.0" } }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -2364,6 +2501,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, "dependencies": { "path-type": "^4.0.0" }, @@ -2374,12 +2512,14 @@ "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", - "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==" + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, "dependencies": { "esutils": "^2.0.2" }, @@ -2387,6 +2527,15 @@ "node": ">=6.0.0" } }, + "node_modules/dprint-node": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz", + "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==", + "dev": true, + "dependencies": { + "detect-libc": "^1.0.3" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -2501,6 +2650,7 @@ "version": "8.44.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.44.0.tgz", "integrity": "sha512-0wpHoUbDUHgNCyvFB5aXLiQVfK9B0at6gUvzy83k4kAsQ/u769TQDX6iKC+aO4upIHO9WSaA3QoXYQDHbNwf1A==", + "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.4.0", @@ -2556,6 +2706,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz", "integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==", + "dev": true, "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -2571,6 +2722,7 @@ "version": "3.4.1", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz", "integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==", + "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -2581,12 +2733,14 @@ "node_modules/eslint/node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true }, "node_modules/eslint/node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, "engines": { "node": ">=10" }, @@ -2598,6 +2752,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -2613,6 +2768,7 @@ "version": "13.20.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, "dependencies": { "type-fest": "^0.20.2" }, @@ -2627,6 +2783,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, "dependencies": { "argparse": "^2.0.1" }, @@ -2638,6 +2795,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, "dependencies": { "p-locate": "^5.0.0" }, @@ -2652,6 +2810,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, "dependencies": { "p-limit": "^3.0.2" }, @@ -2666,6 +2825,7 @@ "version": "0.20.2", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, "engines": { "node": ">=10" }, @@ -2677,6 +2837,7 @@ "version": "9.6.0", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.0.tgz", "integrity": "sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==", + "dev": true, "dependencies": { "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", @@ -2707,6 +2868,7 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, "dependencies": { "estraverse": "^5.1.0" }, @@ -2718,6 +2880,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, "dependencies": { "estraverse": "^5.2.0" }, @@ -2729,6 +2892,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, "engines": { "node": ">=4.0" } @@ -2737,6 +2901,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -2834,12 +2999,14 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "node_modules/fast-glob": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz", "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==", + "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -2855,6 +3022,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -2866,17 +3034,20 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, "dependencies": { "reusify": "^1.0.4" } @@ -2895,6 +3066,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, "dependencies": { "flat-cache": "^3.0.4" }, @@ -2906,6 +3078,7 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" @@ -2932,6 +3105,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, "dependencies": { "flatted": "^3.1.0", "rimraf": "^3.0.2" @@ -2943,12 +3117,14 @@ "node_modules/flatted": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==" + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, "license": "ISC" }, "node_modules/function-bind": { @@ -3005,6 +3181,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -3025,6 +3202,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, "dependencies": { "is-glob": "^4.0.3" }, @@ -3046,6 +3224,7 @@ "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -3071,7 +3250,8 @@ "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true }, "node_modules/has": { "version": "1.0.3", @@ -3090,6 +3270,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", "integrity": "sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==", + "dev": true, "dependencies": { "ansi-regex": "^2.0.0" }, @@ -3101,6 +3282,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -3109,6 +3291,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -3171,6 +3354,7 @@ "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, "license": "MIT", "engines": { "node": ">= 4" @@ -3180,6 +3364,7 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -3195,6 +3380,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, "engines": { "node": ">=4" } @@ -3223,6 +3409,7 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.19" @@ -3232,6 +3419,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -3241,6 +3429,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -3251,6 +3440,7 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, "license": "ISC" }, "node_modules/is-arrayish": { @@ -3277,6 +3467,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -3305,6 +3496,7 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -3316,6 +3508,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.12.0" @@ -3325,6 +3518,7 @@ "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, "engines": { "node": ">=8" } @@ -3352,8 +3546,17 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, "license": "ISC" }, + "node_modules/isomorphic-ws": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", + "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", + "peerDependencies": { + "ws": "*" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -4092,12 +4295,14 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true }, "node_modules/json5": { "version": "2.2.3", @@ -4136,6 +4341,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -4399,7 +4605,8 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "node_modules/lodash.memoize": { "version": "4.1.2", @@ -4411,7 +4618,8 @@ "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true }, "node_modules/log-update": { "version": "4.0.0", @@ -4469,6 +4677,7 @@ "version": "1.8.1", "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", "integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==", + "dev": true, "engines": { "node": ">= 0.6.0" }, @@ -4481,6 +4690,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/loglevel-colored-level-prefix/-/loglevel-colored-level-prefix-1.0.0.tgz", "integrity": "sha512-u45Wcxxc+SdAlh4yeF/uKlC1SPUPCy0gullSNKXod5I4bmifzk+Q4lSLExNEVn19tGaJipbZ4V4jbFn79/6mVA==", + "dev": true, "dependencies": { "chalk": "^1.1.3", "loglevel": "^1.4.1" @@ -4490,6 +4700,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -4498,6 +4709,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", "integrity": "sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -4506,6 +4718,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha512-U3lRVLMSlsCfjqYPbLyVv11M9CPW4I728d6TCKMAOJueEeB9/8o+eSsMnxPJD+Q+K909sdESg7C+tIkoH6on1A==", + "dev": true, "dependencies": { "ansi-styles": "^2.2.1", "escape-string-regexp": "^1.0.2", @@ -4521,6 +4734,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, "engines": { "node": ">=0.8.0" } @@ -4529,6 +4743,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==", + "dev": true, "dependencies": { "ansi-regex": "^2.0.0" }, @@ -4540,14 +4755,21 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha512-KKNVtd6pCYgPIKU4cp2733HWYCpplQhddZLBUryaAHou723x+FRzQ5Df824Fj+IyyuiQTRoub4SnIFfIcrp70g==", + "dev": true, "engines": { "node": ">=0.8.0" } }, + "node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -4600,6 +4822,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, "engines": { "node": ">= 8" } @@ -4608,6 +4831,7 @@ "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, "license": "MIT", "dependencies": { "braces": "^3.0.2", @@ -4631,6 +4855,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -4653,6 +4878,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true, "license": "MIT" }, "node_modules/multimatch": { @@ -4676,6 +4902,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, "license": "MIT" }, "node_modules/next-tick": { @@ -4746,6 +4973,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -4771,6 +4999,7 @@ "version": "0.9.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, "dependencies": { "@aashutoshrathi/word-wrap": "^1.2.3", "deep-is": "^0.1.3", @@ -4787,6 +5016,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" @@ -4857,6 +5087,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, "dependencies": { "callsites": "^3.0.0" }, @@ -4887,6 +5118,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -4896,6 +5128,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -4905,6 +5138,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -4921,6 +5155,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, "engines": { "node": ">=8" } @@ -4936,6 +5171,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "license": "MIT", "engines": { "node": ">=8.6" @@ -4984,6 +5220,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, "engines": { "node": ">= 0.8.0" } @@ -4992,6 +5229,7 @@ "version": "2.8.7", "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.7.tgz", "integrity": "sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==", + "dev": true, "license": "MIT", "bin": { "prettier": "bin-prettier.js" @@ -5007,6 +5245,7 @@ "version": "15.0.1", "resolved": "https://registry.npmjs.org/prettier-eslint/-/prettier-eslint-15.0.1.tgz", "integrity": "sha512-mGOWVHixSvpZWARqSDXbdtTL54mMBxc5oQYQ6RAqy8jecuNJBgN3t9E5a81G66F8x8fsKNiR1HWaBV66MJDOpg==", + "dev": true, "dependencies": { "@types/eslint": "^8.4.2", "@types/prettier": "^2.6.0", @@ -5031,6 +5270,7 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", + "dev": true, "engines": { "node": ">=4" } @@ -5039,6 +5279,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -5050,6 +5291,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "dependencies": { "color-name": "1.1.3" } @@ -5057,12 +5299,14 @@ "node_modules/prettier-eslint/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true }, "node_modules/prettier-eslint/node_modules/pretty-format": { "version": "23.6.0", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-23.6.0.tgz", "integrity": "sha512-zf9NV1NSlDLDjycnwm6hpFATCGl/K1lt0R/GdkAK2O5LN/rwJoB+Mh93gGJjut4YbmecbfgLWVGSTCr0Ewvvbw==", + "dev": true, "dependencies": { "ansi-regex": "^3.0.0", "ansi-styles": "^3.2.0" @@ -5148,6 +5392,30 @@ "node": ">= 6" } }, + "node_modules/protobufjs": { + "version": "7.2.5", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", + "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -5163,6 +5431,7 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, "engines": { "node": ">=6" } @@ -5188,6 +5457,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, "funding": [ { "type": "github", @@ -5223,7 +5493,8 @@ "node_modules/require-relative": { "version": "0.8.7", "resolved": "https://registry.npmjs.org/require-relative/-/require-relative-0.8.7.tgz", - "integrity": "sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg==" + "integrity": "sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg==", + "dev": true }, "node_modules/resolve": { "version": "1.22.1", @@ -5294,6 +5565,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -5310,6 +5582,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, "license": "ISC", "dependencies": { "glob": "^7.1.3" @@ -5325,6 +5598,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, "funding": [ { "type": "github", @@ -5367,6 +5641,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -5379,6 +5654,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -5402,6 +5678,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -5534,6 +5811,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -5566,6 +5844,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -5578,6 +5857,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -5617,7 +5897,8 @@ "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true }, "node_modules/through": { "version": "2.3.8", @@ -5647,6 +5928,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "license": "MIT", "dependencies": { "is-number": "^7.0.0" @@ -5759,6 +6041,40 @@ } } }, + "node_modules/ts-poet": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.6.0.tgz", + "integrity": "sha512-4vEH/wkhcjRPFOdBwIh9ItO6jOoumVLRF4aABDX5JSNEubSqwOulihxQPqai+OkuygJm3WYMInxXQX4QwVNMuw==", + "dev": true, + "dependencies": { + "dprint-node": "^1.0.7" + } + }, + "node_modules/ts-proto": { + "version": "1.158.0", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-1.158.0.tgz", + "integrity": "sha512-t5XcKYvdeeeinP4zBA+YXzRANMXacxPzqhs7hsmnD9RxfP1L+Ip858ii9Zdkp/UYW58N3q4wJKLdZfvnBmAk9w==", + "dev": true, + "dependencies": { + "case-anything": "^2.1.13", + "protobufjs": "^7.2.4", + "ts-poet": "^6.5.0", + "ts-proto-descriptors": "1.15.0" + }, + "bin": { + "protoc-gen-ts_proto": "protoc-gen-ts_proto" + } + }, + "node_modules/ts-proto-descriptors": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-1.15.0.tgz", + "integrity": "sha512-TYyJ7+H+7Jsqawdv+mfsEpZPTIj9siDHS6EMCzG/z3b/PZiphsX+mWtqFfFVe5/N0Th6V3elK9lQqjnrgTOfrg==", + "dev": true, + "dependencies": { + "long": "^5.2.3", + "protobufjs": "^7.2.4" + } + }, "node_modules/tslib": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", @@ -5770,6 +6086,7 @@ "version": "3.21.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, "dependencies": { "tslib": "^1.8.1" }, @@ -5783,7 +6100,8 @@ "node_modules/tsutils/node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true }, "node_modules/type": { "version": "1.2.0", @@ -5795,6 +6113,7 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, "dependencies": { "prelude-ls": "^1.2.1" }, @@ -5838,6 +6157,7 @@ "version": "4.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", + "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -5878,6 +6198,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -5921,6 +6242,7 @@ "version": "8.3.0", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-8.3.0.tgz", "integrity": "sha512-dzHGG3+sYwSf6zFBa0Gi9ZDshD7+ad14DGOdTLjruRVgZXe2J+DcZ9iUhyR48z5g1PqRa20yt3Njna/veLJL/g==", + "dev": true, "dependencies": { "debug": "^4.3.2", "eslint-scope": "^7.0.0", @@ -5944,6 +6266,7 @@ "version": "7.5.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", + "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -6000,6 +6323,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -6033,6 +6357,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, "license": "ISC" }, "node_modules/write-file-atomic": { @@ -6049,6 +6374,26 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/ws": { + "version": "8.14.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz", + "integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -6072,6 +6417,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, "license": "ISC" }, "node_modules/yaml": { @@ -6127,6 +6473,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, "license": "MIT", "engines": { "node": ">=10" diff --git a/src/address.ts b/src/address.ts new file mode 100644 index 0000000..23d36a6 --- /dev/null +++ b/src/address.ts @@ -0,0 +1,85 @@ +/** + * A unique public identifier for a client connected to a database. + */ +export class Address { + private data: Uint8Array; + + /** + * Creates a new `Address`. + */ + constructor(data: Uint8Array) { + this.data = data; + } + + private isZero(): boolean { + return this.data.every((b) => b == 0); + } + + static nullIfZero(data: Uint8Array): Address | null { + let addr = new Address(data); + if (addr.isZero()) { + return null; + } else { + return addr; + } + } + + static random(): Address { + function randomByte(): number { + return Math.floor(Math.random() * 255); + } + let data = new Uint8Array(16); + for (let i = 0; i < 16; i++) { + data[i] = randomByte(); + } + return new Address(data); + } + + /** + * Compare two addresses for equality. + */ + isEqual(other: Address): boolean { + if (this.data.length !== other.data.length) { + return false; + } + for (let i = 0; i < this.data.length; i++) { + if (this.data[i] !== other.data[i]) { + return false; + } + } + return true; + } + + /** + * Print the address as a hexadecimal string. + */ + toHexString(): string { + return Array.prototype.map + .call(this.data, (x) => ("00" + x.toString(16)).slice(-2)) + .join(""); + } + + toUint8Array(): Uint8Array { + return this.data; + } + + /** + * Parse an Address from a hexadecimal string. + */ + static fromString(str: string): Address { + let matches = str.match(/.{1,2}/g) || []; + let data = Uint8Array.from( + matches.map((byte: string) => parseInt(byte, 16)) + ); + return new Address(data); + } + + static fromStringOrNull(str: string): Address | null { + let addr = Address.fromString(str); + if (addr.isZero()) { + return null; + } else { + return addr; + } + } +} diff --git a/src/client_api.ts b/src/client_api.ts index 94d8382..530eeb6 100644 --- a/src/client_api.ts +++ b/src/client_api.ts @@ -1,6 +1,6 @@ /* eslint-disable */ import Long from "long"; -import * as _m0 from "protobufjs/minimal"; +import _m0 from "protobufjs/minimal"; export const protobufPackage = "client_api"; @@ -26,33 +26,38 @@ export interface Message { identityToken?: IdentityToken | undefined; /** client -> database, register SQL queries on which to receive updates. */ subscribe?: Subscribe | undefined; + /** client -> database, send a one-off SQL query without establishing a subscription. */ + oneOffQuery?: OneOffQuery | undefined; + /** database -> client, return results to a one off SQL query. */ + oneOffQueryResponse?: OneOffQueryResponse | undefined; } /** - * / Received by database from client to inform of user's identity and token. + * / Received by database from client to inform of user's identity, token and client address. * / - * / Do you receive this if you provide a token when connecting, or only if you connect - * / anonymously? Find out and document - pgoldman 2023-06-06. + * / The database will always send an `IdentityToken` message + * / as the first message for a new WebSocket connection. + * / If the client is re-connecting with existing credentials, + * / the message will include those credentials. + * / If the client connected anonymously, + * / the database will generate new credentials to identify it. */ export interface IdentityToken { identity: Uint8Array; token: string; + address: Uint8Array; } /** * / Sent by client to database to request a reducer runs. * / - * / `reducer` is the string name of a reducer to run. + * / - `reducer` is the string name of a reducer to run. * / - * / `argBytes` is the arguments to the reducer, encoded as BSATN. (Possibly as SATN if - * / you're in the text API? Find out and document - pgoldman 2023-06-05) + * / - `argBytes` is the arguments to the reducer, encoded as BSATN. * / * / SpacetimeDB models reducers as taking a single `AlgebraicValue` as an argument, which * / generally will be a `ProductValue` containing all of the args (except the * / `ReducerContext`, which is injected by the host, not provided in this API). - * / - * / I don't think clients will ever receive a `FunctionCall` from the database, except - * / wrapped in an `Event` - pgoldman 2023-06-05. */ export interface FunctionCall { /** TODO: Maybe this should be replaced with an int identifier for performance? */ @@ -77,9 +82,6 @@ export interface FunctionCall { * / will be subscribed to `B` but not `A`. In this case, the client will receive a * / `SubscriptionUpdate` containing every existing row that matches `B`, even if some were * / already in `A`. - * / - * / I don't think clients will ever receive a `Subscribe` from the database - pgoldman - * / 2023-06-05. */ export interface Subscribe { queryStrings: string[]; @@ -88,40 +90,44 @@ export interface Subscribe { /** * / Part of a `TransactionUpdate` received by client from database upon a reducer run. * / - * / `timestamp` is the time when the reducer ran (started? finished? Find out and document - * / - pgoldman 2023-06-05), as microseconds since the Unix epoch. - * / - * / `callerIdentity` is the identity token of the user who requested the reducer - * / run. (What if it's run by the database without a client request? Is - * / `callerIdentity` empty? Find out and document - pgoldman 2023-06-05). + * / - `timestamp` is the time when the reducer started, + * / as microseconds since the Unix epoch. * / - * / `functionCall` contains the name of the reducer which ran and the arguments it - * / received. + * / - `callerIdentity` is the identity of the user who requested the reducer run. + * / For event-driven and scheduled reducers, + * / it is the identity of the database owner. * / - * / `status` of `committed` means that the reducer ran successfully and its changes were - * / committed to the database. The rows altered in the database - * / will be recorded in the parent `TransactionUpdate`'s - * / `SubscriptionUpdate`. + * / - `functionCall` contains the name of the reducer which ran and the arguments it + * / received. * / - * / `status` of `failed` means that the reducer panicked, and any changes it attempted to - * / make were rolled back. + * / - `status` of `committed` means that the reducer ran successfully and its changes were + * / committed to the database. The rows altered in the database + * / will be recorded in the parent `TransactionUpdate`'s + * / `SubscriptionUpdate`. * / - * / `status` of `failed` means that the reducer was interrupted due to insufficient - * / energy/funds, and any changes it attempted to make were rolled - * / back. (Verify this - pgoldman 2023-06-05). + * / - `status` of `failed` means that the reducer panicked, and any changes it attempted to + * / make were rolled back. * / - * / `message` what does it do? Find out and document - pgoldman 2023-06-05. + * / - `status` of `out_of_energy` means that the reducer was interrupted + * / due to insufficient energy/funds, + * / and any changes it attempted to make were rolled back. * / - * / `energy_quanta_used` and `host_execution_duration_micros` seem self-explanatory; they - * / describe the amount of energy credits consumed by running the reducer, and how long it - * / took to run. + * / - `message` is the error message with which the reducer failed. + * / For `committed` or `out_of_energy` statuses, + * / it is the empty string. * / - * / Do clients receive `TransactionUpdate`s / `Event`s for reducer runs which don't touch - * / any of the client's subscribed rows? Find out and document - pgoldman 2023-06-05. + * / - `energy_quanta_used` and `host_execution_duration_micros` seem self-explanatory; + * / they describe the amount of energy credits consumed by running the reducer, + * / and how long it took to run. * / - * / Will a client ever receive an `Event` not wrapped in a `TransactionUpdate`? Possibly - * / when `status = failed` or `status = out_of_energy`? Find out and document - pgoldman - * / 2023-06-05. + * / - `callerAddress` is the 16-byte address of the user who requested the reducer run. + * / The all-zeros address is a sentinel which denotes no address. + * / `init` and `update` reducers will have a `callerAddress` + * / if and only if one was provided to the `publish` HTTP endpoint. + * / Scheduled reducers will never have a `callerAddress`. + * / Reducers invoked by HTTP will have a `callerAddress` + * / if and only if one was provided to the `call` HTTP endpoint. + * / Reducers invoked by WebSocket will always have a `callerAddress`. */ export interface Event { timestamp: number; @@ -135,6 +141,7 @@ export interface Event { message: string; energyQuantaUsed: number; hostExecutionDurationMicros: number; + callerAddress: Uint8Array; } export enum Event_Status { @@ -197,9 +204,6 @@ export interface SubscriptionUpdate { * / or may not change between runs. * / * / `tableRowOperations` are actual modified rows. - * / - * / Can a client send `TableUpdate`s to the database to alter the database? I don't think - * / so, but would be good to know for sure - pgoldman 2023-06-05. */ export interface TableUpdate { tableId: number; @@ -213,18 +217,17 @@ export interface TableUpdate { * / * / The table being altered is identified by the parent `TableUpdate`. * / - * / `op` of `DELETE` means that the row in question has been removed and is no longer - * / resident in the table. + * / - `op` of `DELETE` means that the row in question has been removed and is no longer + * / resident in the table. * / - * / `op` of `INSERT` means that the row in question has been either newly inserted or - * / updated, and is resident in the table. + * / - `op` of `INSERT` means that the row in question has been either newly inserted or + * / updated, and is resident in the table. * / - * / `row_pk` is a hash of the row computed by the database. As of 2023-06-13, even for - * / tables with a `#[primarykey]` annotation on one column, the `row_pk` is not - * / that primary key. + * / - `row_pk` is a hash of the row computed by the database. As of 2023-06-13, even for + * / tables with a `#[primarykey]` annotation on one column, the `row_pk` is not + * / that primary key. * / - * / `row` is the row itself, encoded as BSATN (or possibly SATN for the text api? Find out - * / and document - pgoldman 2023-06-05). + * / - `row` is the row itself, encoded as BSATN. */ export interface TableRowOperation { op: TableRowOperation_OperationType; @@ -272,18 +275,53 @@ export function tableRowOperation_OperationTypeToJSON( /** * / Received by client from database upon a reducer run. * / - * / Do clients receive `TransactionUpdate`s for reducer runs which do not alter any of the - * / client's subscribed rows? Find out and document - pgoldman 2023-06-05. + * / Clients receive `TransactionUpdate`s only for reducers + * / which update at least one of their subscribed rows, + * / or for their own `failed` or `out_of_energy` reducer invocations. * / - * / `event` contains information about the reducer. + * / - `event` contains information about the reducer. * / - * / `subscriptionUpdate` contains changes to subscribed rows. + * / - `subscriptionUpdate` contains changes to subscribed rows. */ export interface TransactionUpdate { event: Event | undefined; subscriptionUpdate: SubscriptionUpdate | undefined; } +/** + * / A one-off query submission. + * / + * / Query should be a "SELECT * FROM Table WHERE ...". Other types of queries will be rejected. + * / Multiple such semicolon-delimited queries are allowed. + * / + * / One-off queries are identified by a client-generated messageID. + * / To avoid data leaks, the server will NOT cache responses to messages based on UUID! + * / It also will not check for duplicate IDs. They are just a way to match responses to messages. + */ +export interface OneOffQuery { + messageId: Uint8Array; + queryString: string; +} + +/** + * / A one-off query response. + * / Will contain either one error or multiple response rows. + * / At most one of these messages will be sent in reply to any query. + * / + * / The messageId will be identical to the one sent in the original query. + */ +export interface OneOffQueryResponse { + messageId: Uint8Array; + error: string; + tables: OneOffTable[]; +} + +/** / A table included as part of a one-off query. */ +export interface OneOffTable { + tableName: string; + row: Uint8Array[]; +} + function createBaseMessage(): Message { return { functionCall: undefined, @@ -292,6 +330,8 @@ function createBaseMessage(): Message { transactionUpdate: undefined, identityToken: undefined, subscribe: undefined, + oneOffQuery: undefined, + oneOffQueryResponse: undefined, }; } @@ -330,6 +370,18 @@ export const Message = { if (message.subscribe !== undefined) { Subscribe.encode(message.subscribe, writer.uint32(50).fork()).ldelim(); } + if (message.oneOffQuery !== undefined) { + OneOffQuery.encode( + message.oneOffQuery, + writer.uint32(58).fork() + ).ldelim(); + } + if (message.oneOffQueryResponse !== undefined) { + OneOffQueryResponse.encode( + message.oneOffQueryResponse, + writer.uint32(66).fork() + ).ldelim(); + } return writer; }, @@ -389,6 +441,23 @@ export const Message = { message.subscribe = Subscribe.decode(reader, reader.uint32()); continue; + case 7: + if (tag !== 58) { + break; + } + + message.oneOffQuery = OneOffQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.oneOffQueryResponse = OneOffQueryResponse.decode( + reader, + reader.uint32() + ); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -416,40 +485,53 @@ export const Message = { subscribe: isSet(object.subscribe) ? Subscribe.fromJSON(object.subscribe) : undefined, + oneOffQuery: isSet(object.oneOffQuery) + ? OneOffQuery.fromJSON(object.oneOffQuery) + : undefined, + oneOffQueryResponse: isSet(object.oneOffQueryResponse) + ? OneOffQueryResponse.fromJSON(object.oneOffQueryResponse) + : undefined, }; }, toJSON(message: Message): unknown { const obj: any = {}; - message.functionCall !== undefined && - (obj.functionCall = message.functionCall - ? FunctionCall.toJSON(message.functionCall) - : undefined); - message.subscriptionUpdate !== undefined && - (obj.subscriptionUpdate = message.subscriptionUpdate - ? SubscriptionUpdate.toJSON(message.subscriptionUpdate) - : undefined); - message.event !== undefined && - (obj.event = message.event ? Event.toJSON(message.event) : undefined); - message.transactionUpdate !== undefined && - (obj.transactionUpdate = message.transactionUpdate - ? TransactionUpdate.toJSON(message.transactionUpdate) - : undefined); - message.identityToken !== undefined && - (obj.identityToken = message.identityToken - ? IdentityToken.toJSON(message.identityToken) - : undefined); - message.subscribe !== undefined && - (obj.subscribe = message.subscribe - ? Subscribe.toJSON(message.subscribe) - : undefined); + if (message.functionCall !== undefined) { + obj.functionCall = FunctionCall.toJSON(message.functionCall); + } + if (message.subscriptionUpdate !== undefined) { + obj.subscriptionUpdate = SubscriptionUpdate.toJSON( + message.subscriptionUpdate + ); + } + if (message.event !== undefined) { + obj.event = Event.toJSON(message.event); + } + if (message.transactionUpdate !== undefined) { + obj.transactionUpdate = TransactionUpdate.toJSON( + message.transactionUpdate + ); + } + if (message.identityToken !== undefined) { + obj.identityToken = IdentityToken.toJSON(message.identityToken); + } + if (message.subscribe !== undefined) { + obj.subscribe = Subscribe.toJSON(message.subscribe); + } + if (message.oneOffQuery !== undefined) { + obj.oneOffQuery = OneOffQuery.toJSON(message.oneOffQuery); + } + if (message.oneOffQueryResponse !== undefined) { + obj.oneOffQueryResponse = OneOffQueryResponse.toJSON( + message.oneOffQueryResponse + ); + } return obj; }, create, I>>(base?: I): Message { - return Message.fromPartial(base ?? {}); + return Message.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Message { const message = createBaseMessage(); message.functionCall = @@ -478,12 +560,21 @@ export const Message = { object.subscribe !== undefined && object.subscribe !== null ? Subscribe.fromPartial(object.subscribe) : undefined; + message.oneOffQuery = + object.oneOffQuery !== undefined && object.oneOffQuery !== null + ? OneOffQuery.fromPartial(object.oneOffQuery) + : undefined; + message.oneOffQueryResponse = + object.oneOffQueryResponse !== undefined && + object.oneOffQueryResponse !== null + ? OneOffQueryResponse.fromPartial(object.oneOffQueryResponse) + : undefined; return message; }, }; function createBaseIdentityToken(): IdentityToken { - return { identity: new Uint8Array(0), token: "" }; + return { identity: new Uint8Array(0), token: "", address: new Uint8Array(0) }; } export const IdentityToken = { @@ -497,6 +588,9 @@ export const IdentityToken = { if (message.token !== "") { writer.uint32(18).string(message.token); } + if (message.address.length !== 0) { + writer.uint32(26).bytes(message.address); + } return writer; }, @@ -522,6 +616,13 @@ export const IdentityToken = { message.token = reader.string(); continue; + case 3: + if (tag !== 26) { + break; + } + + message.address = reader.bytes(); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -537,31 +638,38 @@ export const IdentityToken = { ? bytesFromBase64(object.identity) : new Uint8Array(0), token: isSet(object.token) ? String(object.token) : "", + address: isSet(object.address) + ? bytesFromBase64(object.address) + : new Uint8Array(0), }; }, toJSON(message: IdentityToken): unknown { const obj: any = {}; - message.identity !== undefined && - (obj.identity = base64FromBytes( - message.identity !== undefined ? message.identity : new Uint8Array(0) - )); - message.token !== undefined && (obj.token = message.token); + if (message.identity.length !== 0) { + obj.identity = base64FromBytes(message.identity); + } + if (message.token !== "") { + obj.token = message.token; + } + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } return obj; }, create, I>>( base?: I ): IdentityToken { - return IdentityToken.fromPartial(base ?? {}); + return IdentityToken.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I ): IdentityToken { const message = createBaseIdentityToken(); message.identity = object.identity ?? new Uint8Array(0); message.token = object.token ?? ""; + message.address = object.address ?? new Uint8Array(0); return message; }, }; @@ -626,20 +734,20 @@ export const FunctionCall = { toJSON(message: FunctionCall): unknown { const obj: any = {}; - message.reducer !== undefined && (obj.reducer = message.reducer); - message.argBytes !== undefined && - (obj.argBytes = base64FromBytes( - message.argBytes !== undefined ? message.argBytes : new Uint8Array(0) - )); + if (message.reducer !== "") { + obj.reducer = message.reducer; + } + if (message.argBytes.length !== 0) { + obj.argBytes = base64FromBytes(message.argBytes); + } return obj; }, create, I>>( base?: I ): FunctionCall { - return FunctionCall.fromPartial(base ?? {}); + return FunctionCall.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I ): FunctionCall { @@ -699,18 +807,15 @@ export const Subscribe = { toJSON(message: Subscribe): unknown { const obj: any = {}; - if (message.queryStrings) { - obj.queryStrings = message.queryStrings.map((e) => e); - } else { - obj.queryStrings = []; + if (message.queryStrings?.length) { + obj.queryStrings = message.queryStrings; } return obj; }, create, I>>(base?: I): Subscribe { - return Subscribe.fromPartial(base ?? {}); + return Subscribe.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I ): Subscribe { @@ -729,6 +834,7 @@ function createBaseEvent(): Event { message: "", energyQuantaUsed: 0, hostExecutionDurationMicros: 0, + callerAddress: new Uint8Array(0), }; } @@ -758,6 +864,9 @@ export const Event = { if (message.hostExecutionDurationMicros !== 0) { writer.uint32(56).uint64(message.hostExecutionDurationMicros); } + if (message.callerAddress.length !== 0) { + writer.uint32(66).bytes(message.callerAddress); + } return writer; }, @@ -820,6 +929,13 @@ export const Event = { reader.uint64() as Long ); continue; + case 8: + if (tag !== 66) { + break; + } + + message.callerAddress = reader.bytes(); + continue; } if ((tag & 7) === 4 || tag === 0) { break; @@ -846,39 +962,46 @@ export const Event = { hostExecutionDurationMicros: isSet(object.hostExecutionDurationMicros) ? Number(object.hostExecutionDurationMicros) : 0, + callerAddress: isSet(object.callerAddress) + ? bytesFromBase64(object.callerAddress) + : new Uint8Array(0), }; }, toJSON(message: Event): unknown { const obj: any = {}; - message.timestamp !== undefined && - (obj.timestamp = Math.round(message.timestamp)); - message.callerIdentity !== undefined && - (obj.callerIdentity = base64FromBytes( - message.callerIdentity !== undefined - ? message.callerIdentity - : new Uint8Array(0) - )); - message.functionCall !== undefined && - (obj.functionCall = message.functionCall - ? FunctionCall.toJSON(message.functionCall) - : undefined); - message.status !== undefined && - (obj.status = event_StatusToJSON(message.status)); - message.message !== undefined && (obj.message = message.message); - message.energyQuantaUsed !== undefined && - (obj.energyQuantaUsed = Math.round(message.energyQuantaUsed)); - message.hostExecutionDurationMicros !== undefined && - (obj.hostExecutionDurationMicros = Math.round( + if (message.timestamp !== 0) { + obj.timestamp = Math.round(message.timestamp); + } + if (message.callerIdentity.length !== 0) { + obj.callerIdentity = base64FromBytes(message.callerIdentity); + } + if (message.functionCall !== undefined) { + obj.functionCall = FunctionCall.toJSON(message.functionCall); + } + if (message.status !== 0) { + obj.status = event_StatusToJSON(message.status); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.energyQuantaUsed !== 0) { + obj.energyQuantaUsed = Math.round(message.energyQuantaUsed); + } + if (message.hostExecutionDurationMicros !== 0) { + obj.hostExecutionDurationMicros = Math.round( message.hostExecutionDurationMicros - )); + ); + } + if (message.callerAddress.length !== 0) { + obj.callerAddress = base64FromBytes(message.callerAddress); + } return obj; }, create, I>>(base?: I): Event { - return Event.fromPartial(base ?? {}); + return Event.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>(object: I): Event { const message = createBaseEvent(); message.timestamp = object.timestamp ?? 0; @@ -892,6 +1015,7 @@ export const Event = { message.energyQuantaUsed = object.energyQuantaUsed ?? 0; message.hostExecutionDurationMicros = object.hostExecutionDurationMicros ?? 0; + message.callerAddress = object.callerAddress ?? new Uint8Array(0); return message; }, }; @@ -947,12 +1071,8 @@ export const SubscriptionUpdate = { toJSON(message: SubscriptionUpdate): unknown { const obj: any = {}; - if (message.tableUpdates) { - obj.tableUpdates = message.tableUpdates.map((e) => - e ? TableUpdate.toJSON(e) : undefined - ); - } else { - obj.tableUpdates = []; + if (message.tableUpdates?.length) { + obj.tableUpdates = message.tableUpdates.map((e) => TableUpdate.toJSON(e)); } return obj; }, @@ -960,9 +1080,8 @@ export const SubscriptionUpdate = { create, I>>( base?: I ): SubscriptionUpdate { - return SubscriptionUpdate.fromPartial(base ?? {}); + return SubscriptionUpdate.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I ): SubscriptionUpdate { @@ -1048,23 +1167,23 @@ export const TableUpdate = { toJSON(message: TableUpdate): unknown { const obj: any = {}; - message.tableId !== undefined && - (obj.tableId = Math.round(message.tableId)); - message.tableName !== undefined && (obj.tableName = message.tableName); - if (message.tableRowOperations) { + if (message.tableId !== 0) { + obj.tableId = Math.round(message.tableId); + } + if (message.tableName !== "") { + obj.tableName = message.tableName; + } + if (message.tableRowOperations?.length) { obj.tableRowOperations = message.tableRowOperations.map((e) => - e ? TableRowOperation.toJSON(e) : undefined + TableRowOperation.toJSON(e) ); - } else { - obj.tableRowOperations = []; } return obj; }, create, I>>(base?: I): TableUpdate { - return TableUpdate.fromPartial(base ?? {}); + return TableUpdate.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I ): TableUpdate { @@ -1151,25 +1270,23 @@ export const TableRowOperation = { toJSON(message: TableRowOperation): unknown { const obj: any = {}; - message.op !== undefined && - (obj.op = tableRowOperation_OperationTypeToJSON(message.op)); - message.rowPk !== undefined && - (obj.rowPk = base64FromBytes( - message.rowPk !== undefined ? message.rowPk : new Uint8Array(0) - )); - message.row !== undefined && - (obj.row = base64FromBytes( - message.row !== undefined ? message.row : new Uint8Array(0) - )); + if (message.op !== 0) { + obj.op = tableRowOperation_OperationTypeToJSON(message.op); + } + if (message.rowPk.length !== 0) { + obj.rowPk = base64FromBytes(message.rowPk); + } + if (message.row.length !== 0) { + obj.row = base64FromBytes(message.row); + } return obj; }, create, I>>( base?: I ): TableRowOperation { - return TableRowOperation.fromPartial(base ?? {}); + return TableRowOperation.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I ): TableRowOperation { @@ -1247,21 +1364,22 @@ export const TransactionUpdate = { toJSON(message: TransactionUpdate): unknown { const obj: any = {}; - message.event !== undefined && - (obj.event = message.event ? Event.toJSON(message.event) : undefined); - message.subscriptionUpdate !== undefined && - (obj.subscriptionUpdate = message.subscriptionUpdate - ? SubscriptionUpdate.toJSON(message.subscriptionUpdate) - : undefined); + if (message.event !== undefined) { + obj.event = Event.toJSON(message.event); + } + if (message.subscriptionUpdate !== undefined) { + obj.subscriptionUpdate = SubscriptionUpdate.toJSON( + message.subscriptionUpdate + ); + } return obj; }, create, I>>( base?: I ): TransactionUpdate { - return TransactionUpdate.fromPartial(base ?? {}); + return TransactionUpdate.fromPartial(base ?? ({} as any)); }, - fromPartial, I>>( object: I ): TransactionUpdate { @@ -1279,10 +1397,276 @@ export const TransactionUpdate = { }, }; -declare var self: any | undefined; -declare var window: any | undefined; -declare var global: any | undefined; -var tsProtoGlobalThis: any = (() => { +function createBaseOneOffQuery(): OneOffQuery { + return { messageId: new Uint8Array(0), queryString: "" }; +} + +export const OneOffQuery = { + encode( + message: OneOffQuery, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.messageId.length !== 0) { + writer.uint32(10).bytes(message.messageId); + } + if (message.queryString !== "") { + writer.uint32(18).string(message.queryString); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OneOffQuery { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneOffQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageId = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.queryString = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneOffQuery { + return { + messageId: isSet(object.messageId) + ? bytesFromBase64(object.messageId) + : new Uint8Array(0), + queryString: isSet(object.queryString) ? String(object.queryString) : "", + }; + }, + + toJSON(message: OneOffQuery): unknown { + const obj: any = {}; + if (message.messageId.length !== 0) { + obj.messageId = base64FromBytes(message.messageId); + } + if (message.queryString !== "") { + obj.queryString = message.queryString; + } + return obj; + }, + + create, I>>(base?: I): OneOffQuery { + return OneOffQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I + ): OneOffQuery { + const message = createBaseOneOffQuery(); + message.messageId = object.messageId ?? new Uint8Array(0); + message.queryString = object.queryString ?? ""; + return message; + }, +}; + +function createBaseOneOffQueryResponse(): OneOffQueryResponse { + return { messageId: new Uint8Array(0), error: "", tables: [] }; +} + +export const OneOffQueryResponse = { + encode( + message: OneOffQueryResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.messageId.length !== 0) { + writer.uint32(10).bytes(message.messageId); + } + if (message.error !== "") { + writer.uint32(18).string(message.error); + } + for (const v of message.tables) { + OneOffTable.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OneOffQueryResponse { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneOffQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messageId = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.error = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tables.push(OneOffTable.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneOffQueryResponse { + return { + messageId: isSet(object.messageId) + ? bytesFromBase64(object.messageId) + : new Uint8Array(0), + error: isSet(object.error) ? String(object.error) : "", + tables: Array.isArray(object?.tables) + ? object.tables.map((e: any) => OneOffTable.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneOffQueryResponse): unknown { + const obj: any = {}; + if (message.messageId.length !== 0) { + obj.messageId = base64FromBytes(message.messageId); + } + if (message.error !== "") { + obj.error = message.error; + } + if (message.tables?.length) { + obj.tables = message.tables.map((e) => OneOffTable.toJSON(e)); + } + return obj; + }, + + create, I>>( + base?: I + ): OneOffQueryResponse { + return OneOffQueryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I + ): OneOffQueryResponse { + const message = createBaseOneOffQueryResponse(); + message.messageId = object.messageId ?? new Uint8Array(0); + message.error = object.error ?? ""; + message.tables = + object.tables?.map((e) => OneOffTable.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseOneOffTable(): OneOffTable { + return { tableName: "", row: [] }; +} + +export const OneOffTable = { + encode( + message: OneOffTable, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.tableName !== "") { + writer.uint32(18).string(message.tableName); + } + for (const v of message.row) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): OneOffTable { + const reader = + input instanceof _m0.Reader ? input : _m0.Reader.create(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneOffTable(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.tableName = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.row.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skipType(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneOffTable { + return { + tableName: isSet(object.tableName) ? String(object.tableName) : "", + row: Array.isArray(object?.row) + ? object.row.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: OneOffTable): unknown { + const obj: any = {}; + if (message.tableName !== "") { + obj.tableName = message.tableName; + } + if (message.row?.length) { + obj.row = message.row.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): OneOffTable { + return OneOffTable.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I + ): OneOffTable { + const message = createBaseOneOffTable(); + message.tableName = object.tableName ?? ""; + message.row = object.row?.map((e) => e) || []; + return message; + }, +}; + +declare const self: any | undefined; +declare const window: any | undefined; +declare const global: any | undefined; +const tsProtoGlobalThis: any = (() => { if (typeof globalThis !== "undefined") { return globalThis; } @@ -1358,8 +1742,6 @@ function longToNumber(long: Long): number { return long.toNumber(); } -// If you get a compile-error about 'Constructor and ... have no overlap', -// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'. if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); diff --git a/src/identity.ts b/src/identity.ts index 204cf14..05122cb 100644 --- a/src/identity.ts +++ b/src/identity.ts @@ -1,5 +1,5 @@ /** - * A unique public identifier for a client connected to a database. + * A unique public identifier for a user connected to a database. */ export class Identity { private data: Uint8Array; diff --git a/src/index.ts b/src/index.ts index 772c4f0..c65359c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,3 @@ export * from "./spacetimedb"; export * from "./identity"; +export * from "./address"; diff --git a/src/spacetimedb.ts b/src/spacetimedb.ts index c06feae..14d6881 100644 --- a/src/spacetimedb.ts +++ b/src/spacetimedb.ts @@ -25,6 +25,7 @@ import { } from "./algebraic_type"; import { EventType } from "./types"; import { Identity } from "./identity"; +import { Address } from "./address"; import { Message as ProtobufMessage, event_StatusToJSON, @@ -76,6 +77,7 @@ export class IDatabaseTable {} export class ReducerEvent { public callerIdentity: Identity; + public callerAddress: Address | null; public reducerName: string; public status: string; public message: string; @@ -83,12 +85,14 @@ export class ReducerEvent { constructor( callerIdentity: Identity, + callerAddress: Address | null, reducerName: string, status: string, message: string, args: any ) { this.callerIdentity = callerIdentity; + this.callerAddress = callerAddress; this.reducerName = reducerName; this.status = status; this.message = message; @@ -406,6 +410,7 @@ class SubscriptionUpdateMessage { class TransactionUpdateEvent { public identity: Identity; + public address: Address | null; public originalReducerName: string; public reducerName: string; public args: any[] | Uint8Array; @@ -414,6 +419,7 @@ class TransactionUpdateEvent { constructor( identity: Identity, + address: Address | null, originalReducerName: string, reducerName: string, args: any[] | Uint8Array, @@ -421,6 +427,7 @@ class TransactionUpdateEvent { message: string ) { this.identity = identity; + this.address = address; this.originalReducerName = originalReducerName; this.reducerName = reducerName; this.args = args; @@ -442,10 +449,12 @@ class TransactionUpdateMessage { class IdentityTokenMessage { public identity: Identity; public token: string; + public address: Address; - constructor(identity: Identity, token: string) { + constructor(identity: Identity, token: string, address: Address) { this.identity = identity; this.token = token; + this.address = address; } } type Message = @@ -478,6 +487,7 @@ export class SpacetimeDBClient { * The user's private authentication token. */ token?: string = undefined; + /** * Reference to the database of the client. */ @@ -503,6 +513,7 @@ export class SpacetimeDBClient { private createWSFn: CreateWSFnType; private protocol: "binary" | "json"; private ssl: boolean = false; + private clientAddress: Address = Address.random(); /** * Creates a new `SpacetimeDBClient` database client and set the initial parameters. @@ -585,7 +596,7 @@ export class SpacetimeDBClient { const response = await fetch(tokenUrl, { method: "POST", headers }); if (response.ok) { const { token } = await response.json(); - url += "?token=" + btoa("token:" + token); + url += "&token=" + btoa("token:" + token); } return new WebSocket(url, protocol); } @@ -676,6 +687,7 @@ export class SpacetimeDBClient { reducerEvent = new ReducerEvent( message.event.identity, + message.event.address, message.event.originalReducerName, message.event.status, message.event.message, @@ -712,7 +724,13 @@ export class SpacetimeDBClient { } else { this.token = message.token; } - this.emitter.emit("connected", this.token, this.identity); + this.clientAddress = message.address; + this.emitter.emit( + "connected", + this.token, + this.identity, + this.clientAddress + ); } }); } @@ -829,6 +847,9 @@ export class SpacetimeDBClient { url = "ws://" + url; } + let clientAddress = this.clientAddress.toHexString(); + url += `?client_address=${clientAddress}`; + this.ssl = url.startsWith("wss"); this.runtime.host = this.runtime.host .replace("ws://", "") @@ -913,6 +934,7 @@ export class SpacetimeDBClient { const event = message["transactionUpdate"]["event"] as any; const functionCall = event["functionCall"] as any; const identity: Identity = new Identity(event["callerIdentity"]); + const address = Address.nullIfZero(event["callerAddress"]); const originalReducerName: string = functionCall["reducer"]; const reducerName: string = toPascalCase(originalReducerName); const args = functionCall["argBytes"]; @@ -922,6 +944,7 @@ export class SpacetimeDBClient { const transactionUpdateEvent: TransactionUpdateEvent = new TransactionUpdateEvent( identity, + address, originalReducerName, reducerName, args, @@ -938,8 +961,9 @@ export class SpacetimeDBClient { const identityToken = message["identityToken"] as any; const identity = new Identity(identityToken["identity"]); const token = identityToken["token"]; + const address = new Address(identityToken["address"]); const identityTokenMessage: IdentityTokenMessage = - new IdentityTokenMessage(identity, token); + new IdentityTokenMessage(identity, token, address); callback(identityTokenMessage); } }); @@ -992,6 +1016,7 @@ export class SpacetimeDBClient { const identity: Identity = Identity.fromString( event["caller_identity"] ); + const address = Address.fromStringOrNull(event["caller_address"]); const originalReducerName: string = functionCall["reducer"]; const reducerName: string = toPascalCase(originalReducerName); const args = JSON.parse(functionCall["args"]); @@ -1001,6 +1026,7 @@ export class SpacetimeDBClient { const transactionUpdateEvent: TransactionUpdateEvent = new TransactionUpdateEvent( identity, + address, originalReducerName, reducerName, args, @@ -1017,8 +1043,9 @@ export class SpacetimeDBClient { const identityToken = data["IdentityToken"]; const identity = new Identity(identityToken["identity"]); const token = identityToken["token"]; + const address = Address.fromString(identityToken["address"]); const identityTokenMessage: IdentityTokenMessage = - new IdentityTokenMessage(identity, token); + new IdentityTokenMessage(identity, token, address); callback(identityTokenMessage); } } @@ -1150,7 +1177,9 @@ export class SpacetimeDBClient { * }); * ``` */ - onConnect(callback: (token: string, identity: Identity) => void) { + onConnect( + callback: (token: string, identity: Identity, address: Address) => void + ) { this.on("connected", callback); }