Support displaying players' and guilds' data' #2
8 changed files with 426 additions and 32 deletions
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
graphql linguist-vendored
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -0,0 +1 @@
|
|||
local.*
|
|
@ -1,11 +1,13 @@
|
|||
{
|
||||
"imports": {
|
||||
"@@npm/ioredis": "npm:ioredis@^5.4.1",
|
||||
"@fedify/fedify": "jsr:@fedify/fedify@^1.0.2",
|
||||
"@fedify/redis": "jsr:@fedify/redis@^0.3.0",
|
||||
"@logtape/logtape": "jsr:@logtape/logtape@^0.6.3",
|
||||
"@std/assert": "jsr:@std/assert@1",
|
||||
"@hongminhee/x-forwarded-fetch": "jsr:@hongminhee/x-forwarded-fetch@^0.2.0",
|
||||
"@@npm/ioredis": "npm:ioredis@^5.4.1"
|
||||
"@logtape/logtape": "jsr:@logtape/logtape@^0.6.3",
|
||||
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
|
||||
"@std/assert": "jsr:@std/assert@1",
|
||||
"@@x/escape": "https://deno.land/x/escape@1.3.0/mod.ts"
|
||||
},
|
||||
"unstable": [
|
||||
"temporal"
|
||||
|
|
173
deno.lock
173
deno.lock
|
@ -2,6 +2,7 @@
|
|||
"version": "3",
|
||||
"packages": {
|
||||
"specifiers": {
|
||||
"jsr:@fedify/fedify@^1.0.0": "jsr:@fedify/fedify@1.0.2",
|
||||
"jsr:@fedify/fedify@^1.0.2": "jsr:@fedify/fedify@1.0.2",
|
||||
"jsr:@fedify/redis@^0.3.0": "jsr:@fedify/redis@0.3.0",
|
||||
"jsr:@hongminhee/x-forwarded-fetch@^0.2.0": "jsr:@hongminhee/x-forwarded-fetch@0.2.0",
|
||||
|
@ -9,11 +10,15 @@
|
|||
"jsr:@hugoalh/is-string-singleline@1.0.2": "jsr:@hugoalh/is-string-singleline@1.0.2",
|
||||
"jsr:@logtape/logtape@^0.6.2": "jsr:@logtape/logtape@0.6.3",
|
||||
"jsr:@logtape/logtape@^0.6.3": "jsr:@logtape/logtape@0.6.3",
|
||||
"jsr:@std/assert@1": "jsr:@std/assert@1.0.6",
|
||||
"jsr:@std/bytes@^1.0.2": "jsr:@std/bytes@1.0.2",
|
||||
"jsr:@std/encoding@^1.0.5": "jsr:@std/encoding@1.0.5",
|
||||
"jsr:@std/http@^1.0.6": "jsr:@std/http@1.0.8",
|
||||
"jsr:@std/internal@^1.0.4": "jsr:@std/internal@1.0.4",
|
||||
"jsr:@std/semver@^1.0.3": "jsr:@std/semver@1.0.3",
|
||||
"npm:@opentelemetry/api@^1.9.0": "npm:@opentelemetry/api@1.9.0",
|
||||
"npm:@phensley/language-tag@^1.9.0": "npm:@phensley/language-tag@1.9.0",
|
||||
"npm:@types/node": "npm:@types/node@18.16.19",
|
||||
"npm:asn1js@^3.0.5": "npm:asn1js@3.0.5",
|
||||
"npm:ioredis@^5.4.1": "npm:ioredis@5.4.1",
|
||||
"npm:json-canon@^1.0.1": "npm:json-canon@1.0.1",
|
||||
|
@ -48,7 +53,9 @@
|
|||
"@fedify/redis@0.3.0": {
|
||||
"integrity": "48068af7ad24d4f6c6935d6f869659faeb92281a9e796921f9ba7d94e74f8cfc",
|
||||
"dependencies": [
|
||||
"jsr:@logtape/logtape@^0.6.3"
|
||||
"jsr:@fedify/fedify@^1.0.0",
|
||||
"jsr:@logtape/logtape@^0.6.3",
|
||||
"npm:ioredis@^5.4.1"
|
||||
]
|
||||
},
|
||||
"@hongminhee/x-forwarded-fetch@0.2.0": {
|
||||
|
@ -66,6 +73,12 @@
|
|||
"@logtape/logtape@0.6.3": {
|
||||
"integrity": "64cac3459fddf0455b85d36c8ca3e21764d6b2965c426fb40a0e4a98be436d2b"
|
||||
},
|
||||
"@std/assert@1.0.6": {
|
||||
"integrity": "1904c05806a25d94fe791d6d883b685c9e2dcd60e4f9fc30f4fc5cf010c72207",
|
||||
"dependencies": [
|
||||
"jsr:@std/internal@^1.0.4"
|
||||
]
|
||||
},
|
||||
"@std/bytes@1.0.2": {
|
||||
"integrity": "fbdee322bbd8c599a6af186a1603b3355e59a5fb1baa139f8f4c3c9a1b3e3d57"
|
||||
},
|
||||
|
@ -75,6 +88,9 @@
|
|||
"@std/http@1.0.8": {
|
||||
"integrity": "6ea1b2e8d33929967754a3b6d6c6f399ad6647d7bbb5a466c1eaf9b294a6ebcd"
|
||||
},
|
||||
"@std/internal@1.0.4": {
|
||||
"integrity": "62e8e4911527e5e4f307741a795c0b0a9e6958d0b3790716ae71ce085f755422"
|
||||
},
|
||||
"@std/semver@1.0.3": {
|
||||
"integrity": "7c139c6076a080eeaa4252c78b95ca5302818d7eafab0470d34cafd9930c13c8"
|
||||
}
|
||||
|
@ -104,12 +120,20 @@
|
|||
"integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"@opentelemetry/api@1.9.0": {
|
||||
"integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"@phensley/language-tag@1.9.0": {
|
||||
"integrity": "sha512-nj2uFsnp2SSD/DEGvLqcrpTXerIe9yShGndnwY7p3Z6Ep4m6+GkrgZCNJUc8rKcXWgQmRGC2TUzwG/LlBVtuCA==",
|
||||
"dependencies": {
|
||||
"tslib": "tslib@2.7.0"
|
||||
}
|
||||
},
|
||||
"@types/node@18.16.19": {
|
||||
"integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==",
|
||||
"dependencies": {}
|
||||
},
|
||||
"abort-controller@3.0.0": {
|
||||
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
|
||||
"dependencies": {
|
||||
|
@ -336,7 +360,151 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"remote": {},
|
||||
"redirects": {
|
||||
"https://cdn.esm.sh/extract-files@12.0.0/extractFiles.mjs": "https://esm.sh/extract-files@12.0.0/extractFiles.mjs",
|
||||
"https://cdn.esm.sh/extract-files@12.0.0/isExtractableFile.mjs": "https://esm.sh/extract-files@12.0.0/isExtractableFile.mjs",
|
||||
"https://esm.sh/v135/@types/extract-files@latest/extractFiles~.d.ts": "https://esm.sh/v135/@types/extract-files@13.0.1/extractFiles~.d.ts",
|
||||
"https://esm.sh/v135/@types/extract-files@latest/isExtractableFile~.d.ts": "https://esm.sh/v135/@types/extract-files@13.0.1/isExtractableFile~.d.ts"
|
||||
},
|
||||
"remote": {
|
||||
"https://deno.land/x/escape@1.3.0/mod.ts": "cd9ff4e962fcafc310858edc8b839065fea328da42b5bf1727a2d760a65c4c2d",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/error/GraphQLError.js": "18adbba7aa651770e0876d0c7df4e6e2ab647a9f09d4b5c107c57d6fa157be9d",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/error/formatError.js": "aec87433c501df6d6272b64974e8edf53b2ed192e66782b827328d635ed55df8",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/error/index.js": "7557dcea8830550f82dd7b1984fdc216e14327d094f501bd2a03f80bf609a768",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/error/locatedError.js": "65ad5e9246747d2b63cd2ea48fa22db617e1c7c2b796a27b8ce32bfb0f2a401c",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/error/syntaxError.js": "9c53411030cf5f4e874e9d1c1926f242e4acc4b469197b395ae1a9a7a9092055",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/execution/execute.js": "2d3114e49268a50195195039cc14629b0fe3dff7afeafed9876f1532a95ed4e7",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/execution/index.js": "064615af63e0da1584c557ce130b3ca42acab750289a085ebcc3107aa024ce52",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/execution/values.js": "e9a42ff1593db210a47504eebcc145f70f8d97cfe53c4cce345116bb420fbf95",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/graphql.js": "c34b19e78a57ad0a0ac9b39ec2766ab755b23e61ea08edf124dda1d60104ae54",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/index.js": "ab428112340017d5b1f74e62f958cf0c50c17b664a33be53974ab8738a531c1c",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/Path.js": "28322158c8208f92d376969de58c30ea393aada1beb44223d40584d8d89285c0",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/defineToJSON.js": "5423bbfe56faf7c3b0cda65b515c7fcc0e111bef46da9f76fed93eaba1859149",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/devAssert.js": "7493987e163c294b31f354091b6ca5e87849a132aa3aad8e3c173ac008c8e970",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/didYouMean.js": "9b83a8fe7bdd5b02012c097de14a0fe08a5e33662624ce55eb0019f46067b974",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/identityFunc.js": "204f973b6a5fc6f60ea62641e58eed254f0bb7d76b2b05e9c0bae54dc7cd324a",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/inspect.js": "bb756ad067f23b137b63bb2dabc4e50b070255da2ff10068d9f0a174dd5f3aae",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/instanceOf.js": "c2940e2f0c71ed73390ab03ceb04484c40a4f5f28973709702c8279b1b6f96cd",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/invariant.js": "b8d3e8438abe0ec591fdc3a3f0f9c2d7750925738ee146ba7a18173a8f2dc1cb",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/isCollection.js": "42ffc930d5982ec031b4a7f29db9fd7f3a9e488ca0ceb73183a51a67ad146e2b",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/isObjectLike.js": "96403248d91ae55fa67ce81d339bec098aa51e5fc7132eae3f8dcce91ac340ce",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/isPromise.js": "dbe9979b7d4ffd920d8a608a9ce7127b943b130822cd907d78b9e56e66843509",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/keyMap.js": "4e54790d45a13998d198b0b7b1bc20ae17259e8131c29821d67e64b96dcb249e",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/keyValMap.js": "515ebb0c4be9c26f8fa38b7e0db4f2ebf96057196a8fcd52078046f05bf4e4e0",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/mapValue.js": "5df0be208d71e372a693ef305287a8f041b061a293cff030aa10bef4c2735981",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/memoize3.js": "4212fbf3f75fc8625a8312b18e0b2907efaf9cf6b8131c78a731a707ba638c74",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/nodejsCustomInspectSymbol.js": "eb85744be5bab6c4511556b095198b45259b2c020ff2f88f3b04197acc9feb01",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/printPathArray.js": "15110572999ddb82bcde2e42a35092d18fa601f5b8312e5823bd43d48f9b773f",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/promiseForObject.js": "b82720027d9bf3b81f302baa8d72f80b5d04f2069ebb538875f22993be83ee11",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/promiseReduce.js": "178a7c704a3c124a68a60aa71f29fb078268e403dab310b41937d10f5bb55e01",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/suggestionList.js": "4504e10e0e9b230cd697ebcf1ffae9b2ae420db2927a44dfbab452558e2f4b4a",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/toObjMap.js": "482c18508c808bca6a8e657ab7e3dfacadbf9f78603ce452700199d02f1b9d32",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/ast.js": "faa944fc543e4997c82302a6230c190eaf72bfcca1b8db3b29502826bdf9e9bb",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/blockString.js": "413ad9886dee36a96875cea8bbb51763b1ab8f1c3e82b8468330e8a5ca877852",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/directiveLocation.js": "8500c3878eafe0142f1b1255a998e76b20d3f859d9016ef9f7252878926dfdd8",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/index.js": "9289b05fbe173c54e727465996239a3bce6057fb727677ca44af37d60409480d",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/kinds.js": "7bdebb8110e7345fe6c14f255225d7c9b5448fb2dd53ea91d035a4b2e1e8f72b",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/lexer.js": "68bf4d832a8d1b4af3a0432ad308bc6f3ffbf60eb1c4e786503b30aff7e17564",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/location.js": "9994a20bee8d97ff69781b35477f596a3e6bee9ac1d914340e435bc0298922ee",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/parser.js": "53af901714fda7e62137fe2fe9eccecb4945a8648cffbb93ace439a0e445f05e",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/predicates.js": "cfd7e10b724590b618f67845ce1d1ca712b7da5943622b40881e7653f5557ab7",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/printLocation.js": "26b21c32abaee20e11a072984c381384dd5645be50bcbbdb59bac435490a60e9",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/printer.js": "a2da61f578725d78182fadfdc0ce809c30ed7d6b8369b98b1606b68b0e949b39",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/source.js": "e2a870f2446abf092996453d87f98214f12898e83980b76706cc8160993f16a8",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/tokenKind.js": "ad57e9dddaca5336e49a715b710c8142d9ff963270f3d4d6b63348a482922a74",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/language/visitor.js": "47b0a0f0d2f1e1edbf18a4b26861d371c41c0bfebf7c3f9ccb2e423663184dcd",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/arrayFrom.js": "b57194d34b98ac5926ae83e0a83e884d63ee9ec2d2ae3e846f1783cb26f6dbf8",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/find.js": "30ebdb4e2cd0ed5b0e3e4a00877f2bd2ac62de6d70a4c63152021fe724e41911",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/flatMap.js": "29d62564cd9745536e366e09b7f6cbe8860d8423c00ca253ae6cbfba839f2fc6",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/isFinite.js": "231e2d149aa58e8288b6cf86f588a1597f3f8d432928a17af9c348b48bd8ddde",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/isInteger.js": "0b68164ae12c46b16e439a5384af0c8c395f5c941e0f03fb71ee2ee9cb45fae6",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/objectEntries.js": "c261873f15f88ecb1497427844a9afc541168a92b7d75d69446732a0d381c819",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/objectValues.js": "7c3ed07793a1685cf018fa028275ff556213ba953c43dd2410bb549a86ee801b",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/polyfills/symbols.js": "bbe907378637a4264484590815d80563cfbd8a8a5f396ac9d2be4107658e5bf7",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/subscription/index.js": "3c2e03b8225f66a541d870fb6729ad2e3afbd923a0d07713a087c22d134097b3",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/subscription/mapAsyncIterator.js": "ff581dcfccf8aeedfefe1c42a8f01c7898c1a2b093e5f6fb4d2e62b2f83ab8c8",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/subscription/subscribe.js": "f4d316d4f7e3e60cc3f9f8371e6122396653ff1836a27d44a3e8bf1cfa3d5def",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/type/definition.js": "94ef1069f5e034f9dc34ca7f25370fe81a58365acbb6e932ab9e0db92efe8287",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/type/directives.js": "d4614736de1997413a4970b73865c99d3b01922eda3de1e587c27c25c24e8892",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/type/index.js": "4a7d837f30c56cf3074ee527f4b9388d160ad20cd545d4fdebac500acdf102b0",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/type/introspection.js": "c63b4c5a578d76f8d159837ce531e1193dd3a2629148aedb895b511141303afd",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/type/scalars.js": "d447913dbdcaaa32f2eaa5d86bd39b5342bfcf78d9ddd6b2173ad717ae7fa734",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/type/schema.js": "1c92f80cc2c1f0a14a5b3fcb13d55f215f14e1b2bb7b92c2674ede22f969f033",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/type/validate.js": "f8300538e4327b46959ff83a7dabd55e42148ef07fa66c79f72b308a46cfd369",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/TypeInfo.js": "03276253d0ab3d4947f7bf63ca4ccc4fe0073f73063952103530f8193a98e546",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/assertValidName.js": "d6b44f4dddcc50ebe92c7cb9b94ecc9b27627994b3c156ce63d33279c7f7d0e4",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/astFromValue.js": "d460204b065b8e1036e215faa9a617a20c268e687ed424208dabc5cd5f40f2d1",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/buildASTSchema.js": "d4aeade98d0a1bc6ffdc160fdc78e9edf22a9efdc550cdc6121d1c83ff1e6c84",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/buildClientSchema.js": "1ac64f6aacdf57e9b552a0c45e7176c988c0d97310f646d7d048899524856d3a",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/coerceInputValue.js": "ee59bf0ed0857af92c4f40a309365fd57770821b3c788b6b13d0d1051ffec0da",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/concatAST.js": "bf410b42f7aa015ff0cd938623894906ac19329d9cd9a2298cf97de7cb01442a",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/extendSchema.js": "802fbd291d21cfa97c1ebea4fa6528ac6cddbbcc27c169942c975ce708a9f295",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/findBreakingChanges.js": "2c8dfd8acf617e5d8a96e389ba6bccb0845fc4470f680957a1ca64514337574a",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/findDeprecatedUsages.js": "5a5366e6ed3c99e16d73b1235ee9062ac10d3ec16afafc4d6c4f635cc12370f6",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/getIntrospectionQuery.js": "81125e8afec11871bf532dff9dd523016292c5a57f84d0c04a142a6704ba1572",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/getOperationAST.js": "5fef27e56f708c5336a78e611f08627122a6673d10ea1db6f5466c6f984ad9a2",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/getOperationRootType.js": "58addddae7feabecce40191d836f7e65a9478cf0d9df6c360c4c30e6f5f6f09c",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/index.js": "d0e34dcf95627362527e93e7eaa970caee63b40ed04ff1da320b6426484c8278",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/introspectionFromSchema.js": "50a2202f28b25e98bc496f151de8fc6b2feeb81bab9739fee97f66ac30ef8652",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/lexicographicSortSchema.js": "ad2b935289966fc75700a3b511b86e79130d505399b0c2de052e9915624e2c2a",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/printSchema.js": "104a4666bf3e745ad1fbd30c227d3e06902a2b255c95e29183dcd6d98fad76be",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/separateOperations.js": "ac7e7789fddc0fcf2b439897fce86601a16c6d3f4e20b7f6837278bcf1c36a56",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/stripIgnoredCharacters.js": "be44c652bfa218b18e5d4387a068d2e431d75e770ddc38ced6eb95a0b8854eab",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/typeComparators.js": "dcda7fffeaf3999bfd993a4faac36547dace3ec3f78d7686f4334f86a6c3aec0",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/typeFromAST.js": "99cd615599626259b8e2b9974e22bf8beb495f541b20d78f4a01d48de2f97942",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/valueFromAST.js": "26098b7e5074d408f877f8b4566e6183cd77f076ee2e3f1413e53c4677e150ce",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/utilities/valueFromASTUntyped.js": "9db575f95392635bb02dc417d920e9ae6552b2fa871b19e94ad0cc9ceb83c892",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/ValidationContext.js": "52808fc712f4ef50f79edcb30cb907721e449b55c54225551d2ad09660351dba",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/index.js": "1b91224c90bae4b49c6b8227c190c34cb3600433423c257a672801e12910c06d",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/ExecutableDefinitionsRule.js": "f94c0c866335d1c249d08efa55da0dd6e5954844fa7851b6a0d6b3cd86383819",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/FieldsOnCorrectTypeRule.js": "587eb8a9e7376e58ea6a0bbb12585ca45621a0be102dc7e6c641adee9652e91d",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/FragmentsOnCompositeTypesRule.js": "6a6172831b4e7e6431af810505e23bdf82b7f46d92cfe719226c549a36a75b92",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/KnownArgumentNamesRule.js": "2ab0571f6a6b9c5486b76a09955efde97ef3ff7e9cc06ecfcec8e1f830b8e79b",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/KnownDirectivesRule.js": "57f4c9df617702d3695c3010f6822641b4c7343c65a4873bab6b29c911424e2c",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/KnownFragmentNamesRule.js": "24273c31aa208652113a2e635853c336227a2756fc642ece6e977bd9c4ccb094",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/KnownTypeNamesRule.js": "b600453083f32688c43f2225399439b4f6312903397572b947ea4fc80ac17b52",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/LoneAnonymousOperationRule.js": "ec860c3ce338509b1e407c5cea36aa6e97e34ed207e5cdf719d6f7fa4026398c",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/LoneSchemaDefinitionRule.js": "d3e40186003d89bd45c751156a6df69af6970beb5493c891cd79e1eaab734968",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/NoFragmentCyclesRule.js": "1445f37ad14819d117371c70acdc725459d89b9a8773dd2c15e131f5d71b92ac",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/NoUndefinedVariablesRule.js": "7aaf4409398526fef667fa6cede56b60824166409247b62c2f74b2c4a1ea5497",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/NoUnusedFragmentsRule.js": "9d1c9b11d6287f077cff8661c704f9aa0fdf53de0b4894c4e7fe29597a32a704",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/NoUnusedVariablesRule.js": "8d477bdbc19eb02556e7899b97b147511ccb69777ae29136c12e2f49d6c7a264",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/OverlappingFieldsCanBeMergedRule.js": "5f74a4c076f8c18ce6371bfda2d213c4461655f830fb506569a1cc71faa56e96",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/PossibleFragmentSpreadsRule.js": "0bf927e91d4103c630ef3a10b586586ababb1412874917fed1b5b908d40bc54b",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/PossibleTypeExtensionsRule.js": "2c1f8a1371656ff8c992d0e4df5500ecb36475286b5f131d9a880018baf00c73",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/ProvidedRequiredArgumentsRule.js": "03d3af937d5e08c544a10911770f0660ed6eb18d2b8877acc677aac90583f86e",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/ScalarLeafsRule.js": "374bba26d4e9e085560ef20179604955ae191e7c68c85f2f1905fb68686bc079",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/SingleFieldSubscriptionsRule.js": "8a748eb20d1b21fee38aaeae7b368893f113b5b35bbd0fd94c22df072d23e0be",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueArgumentNamesRule.js": "fe7fafd8d4a5efe66f0d690ef868f55f46c78512cf98abc1bd6ab4c175b86d79",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueDirectiveNamesRule.js": "6664f72231dfa4fa4337ffeed4868a95e91970825bd45f77d7d4f92bcb49bb50",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueDirectivesPerLocationRule.js": "0aedfb8194bd8630b84e344a8ff0f6572bb169ad290a18c8391000324c4d8a03",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueEnumValueNamesRule.js": "fbfec070d1c6ca58514f0e459b7dc5c8fe505d81bd1323509802d65db1463272",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueFieldDefinitionNamesRule.js": "3da7356eaaf7ae41bf5b86c7c55c4049b962bd9d5339252a90cc46538714b694",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueFragmentNamesRule.js": "523f0dfeb1ab059bd396d240376e3b602d32405826dd53d8b2e575aaebd7c055",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueInputFieldNamesRule.js": "433e878697932b4b5cd82dc9282f10650d568360afcd68a6130b9a54ef21e7f1",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueOperationNamesRule.js": "1de59fc010ff56ef74c856d23f949c523de78f299e9aa7c6d882f1f49959e3be",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueOperationTypesRule.js": "2faa2b9c0e9c0197f053162e1356dbfa819e02f0c294271873576ac4ea5786fc",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueTypeNamesRule.js": "d01564b48843b9a316b314f1f9079a25d381bbe02bb47bc47dca0a144fdb596f",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/UniqueVariableNamesRule.js": "5522d2278b64aaf70c30d0dc5e37f70bdbde0201bd6c06c136e0d9d50b0a3c4a",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/ValuesOfCorrectTypeRule.js": "f50002aac89fa875cfb594c7696d0d6eaa8ad39d699e3d0550cda34799797faa",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/VariablesAreInputTypesRule.js": "13337bf58985546627c8060c3ff1201dd21bb6d67e5293819ad0eefa8196a144",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/rules/VariablesInAllowedPositionRule.js": "3032c0af7f9287cb10230685807e1460f12775e24ac76f88496769ad0acc43f0",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/specifiedRules.js": "0e2f6954eb79701a15731f528209a5616ee028133cbf7d4fbecb4e88ac5028c5",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/validation/validate.js": "44bf2bc96845af0bf77e4421f0a05ee57cdc2a688abb32ff6270eacc501327d1",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/lib/version.js": "a135d0beee3fa1405733453e86f1c887e4771d56357504dd78eaa872c0a2b482",
|
||||
"https://deno.land/x/graphql_deno@v15.0.0/mod.ts": "c85d6ab2a9c22ff494bfaa5f662507249650419af6c6c27a7a5c8175de61870d",
|
||||
"https://deno.land/x/graphql_request@v4.1.0/mod.ts": "a24c6f401b8253bb84c773583bf2b37b1b74eec960639f36eb874ca17972f9e7",
|
||||
"https://deno.land/x/graphql_request@v4.1.0/src/createRequestBody.ts": "80b40c902de346622c222a068c4f96679a1bb3233c9b31d728518566ca4e679a",
|
||||
"https://deno.land/x/graphql_request@v4.1.0/src/index.ts": "15194aba3fdfc1ba896e7fcf9c11227dd1962b635c7d2101e23ed2e0a57cd900",
|
||||
"https://deno.land/x/graphql_request@v4.1.0/src/parseArgs.ts": "d00abde98728be96c902debd7ee5032b05f69fb6bb00f86a2b5adf09159541aa",
|
||||
"https://deno.land/x/graphql_request@v4.1.0/src/types.dom.ts": "56432fd7ce0aff31542ec7198ff1a3ea5e3d62fda009510f78bf9c0fc47af13e",
|
||||
"https://deno.land/x/graphql_request@v4.1.0/src/types.ts": "63a98d9f8efb1d6a580bbef62861c764f0f0b0d3dda04674f4d9a32d6490440b",
|
||||
"https://esm.sh/extract-files@12.0.0/extractFiles.mjs": "58e5f1fcf50e3a362d9bde0e2c1a624a7d89d60ac2de005afd895d0d452cca62",
|
||||
"https://esm.sh/extract-files@12.0.0/isExtractableFile.mjs": "2757358bbc9141b93cb27d7e0ba98c1e703172dd58fb7d533a31476419d2416f",
|
||||
"https://esm.sh/v135/extract-files@12.0.0/denonext/extractFiles.js": "59b30d503c5d9ce135dd76c34ac92cf7e9f85cd129d6be2ff61553bb612ac75f",
|
||||
"https://esm.sh/v135/extract-files@12.0.0/denonext/isExtractableFile.js": "93462c162e29fc0e8fd7e9de3665dfd7705f03d41d2721d654f177bc2a7fe305",
|
||||
"https://esm.sh/v135/is-plain-obj@4.1.0/denonext/is-plain-obj.mjs": "d3d86a7174ad7935de7b00f904b6424c103bce530c502efb7f42114cbb1a555f"
|
||||
},
|
||||
"workspace": {
|
||||
"dependencies": [
|
||||
"jsr:@fedify/fedify@^1.0.2",
|
||||
|
@ -344,6 +512,7 @@
|
|||
"jsr:@hongminhee/x-forwarded-fetch@^0.2.0",
|
||||
"jsr:@logtape/logtape@^0.6.3",
|
||||
"jsr:@std/assert@1",
|
||||
"npm:@opentelemetry/api@^1.9.0",
|
||||
"npm:ioredis@^5.4.1"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,42 +1,140 @@
|
|||
import { createFederation, Follow, Service } from "@fedify/fedify"
|
||||
import { createFederation, Person, Application, Image, PropertyValue, Organization, Group } from "@fedify/fedify"
|
||||
import { kv } from "./redis.ts"
|
||||
import { getLogger } from "https://jsr.io/@logtape/logtape/0.6.3/logtape/logger.ts"
|
||||
import { doQueryGuild, doQueryPlayer } from "./graphql/stratz.ts"
|
||||
import { escapeHtml } from "@@x/escape"
|
||||
|
||||
const l = getLogger(["dotino-veloce", "federation"])
|
||||
|
||||
l.debug`Creating federation object...`
|
||||
export const federation = createFederation<void>({ kv })
|
||||
|
||||
const userMatcher = /u([0-9]+)/
|
||||
const guildMatcher = /g([0-9]+)/
|
||||
|
||||
l.debug`Creating actor dispatcher...`
|
||||
// deno-lint-ignore require-await
|
||||
async function actorDispatcher(ctx: any, handle: string) {
|
||||
l.debug`Received request for actor ${handle}, handling...`
|
||||
|
||||
if (handle !== "service") {
|
||||
l.debug`No match found for ${handle}, returning null.`
|
||||
return null
|
||||
}
|
||||
|
||||
l.debug`Determining id of actor ${handle}...`
|
||||
l.debug`Determining id of requested actor: ${handle}`
|
||||
const id = ctx.getActorUri(handle)
|
||||
l.debug`Requested actor is: ${id.href}`
|
||||
|
||||
l.info`Returning actor: ${id.href}`
|
||||
return new Service({
|
||||
if (handle === "service") {
|
||||
l.info`Dispatching service account...`
|
||||
return new Application({
|
||||
id,
|
||||
name: "[TEST] Dotino Veloce",
|
||||
summary: "Core account of a Dotino Veloce instance.",
|
||||
preferredUsername: id.href,
|
||||
// Akkoma expects URL to be equal to ID
|
||||
// https://akkoma.dev/AkkomaGang/akkoma/src/commit/f1018867097e6f293d8b2b5b6935f0a7ebf99bd0/lib/pleroma/object/fetcher.ex#L287
|
||||
url: id,
|
||||
// Akkoma requires inboxes to be setup to display profiles
|
||||
// https://akkoma.dev/AkkomaGang/akkoma/src/commit/f1018867097e6f293d8b2b5b6935f0a7ebf99bd0/lib/pleroma/web/activity_pub/object_validators/user_validator.ex#L72
|
||||
inbox: ctx.getInboxUri(handle),
|
||||
|
||||
name: "[TEST] Dotino Veloce",
|
||||
summary: "Service account of a Dotino Veloce instance.",
|
||||
})
|
||||
}
|
||||
|
||||
const steamId = Number.parseInt(handle.match(userMatcher)?.[1] as any)
|
||||
if(Number.isFinite(steamId)) {
|
||||
l.info`Dispatching user account with Steam ID: ${steamId}`
|
||||
|
||||
const player = await doQueryPlayer(steamId)
|
||||
|
||||
if(player === null) {
|
||||
l.warn`No Steam account was found with ID: ${steamId}`
|
||||
return null
|
||||
}
|
||||
|
||||
return new Person({
|
||||
id,
|
||||
preferredUsername: id.href,
|
||||
// Akkoma expects URL to be equal to ID
|
||||
// https://akkoma.dev/AkkomaGang/akkoma/src/commit/f1018867097e6f293d8b2b5b6935f0a7ebf99bd0/lib/pleroma/object/fetcher.ex#L287
|
||||
url: id,
|
||||
// Akkoma requires inboxes to be setup to display profiles
|
||||
// https://akkoma.dev/AkkomaGang/akkoma/src/commit/f1018867097e6f293d8b2b5b6935f0a7ebf99bd0/lib/pleroma/web/activity_pub/object_validators/user_validator.ex#L72
|
||||
inbox: ctx.getInboxUri(handle),
|
||||
|
||||
name: `[TEST] ${escapeHtml(player.name)}`,
|
||||
icon: new Image({
|
||||
url: new URL(player.avatar),
|
||||
mediaType: "image/jpeg"
|
||||
}),
|
||||
attachments: [
|
||||
new PropertyValue({
|
||||
name: "Steam",
|
||||
value: `<a href="https://steamcommunity.com/profiles/[U:1:${player.id}]">https://steamcommunity.com/profiles/[U:1:${player.id}]</a>`,
|
||||
}),
|
||||
new PropertyValue({
|
||||
name: "STRATZ",
|
||||
value: `<a href="https://stratz.com/players/${player.id}">https://stratz.com/players/${player.id}</a>`,
|
||||
}),
|
||||
new PropertyValue({
|
||||
name: "OpenDota",
|
||||
value: `<a href="https://www.opendota.com/players/${player.id}">https://www.opendota.com/players/${player.id}</a>`,
|
||||
}),
|
||||
new PropertyValue({
|
||||
name: "DOTABUFF",
|
||||
value: `<a href="https://www.dotabuff.com/players/${player.id}">https://www.dotabuff.com/players/${player.id}</a>`,
|
||||
}),
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
const guildId = Number.parseInt(handle.match(guildMatcher)?.[1] as any)
|
||||
if(Number.isFinite(guildId)) {
|
||||
l.info`Dispatching guild with Guild ID: ${guildId}`
|
||||
|
||||
const guild = await doQueryGuild(guildId)
|
||||
|
||||
if(guild === null) {
|
||||
l.warn`No guild was found with ID: ${guildId}`
|
||||
return null
|
||||
}
|
||||
|
||||
return new Group({
|
||||
id,
|
||||
preferredUsername: id.href,
|
||||
// Akkoma expects URL to be equal to ID
|
||||
// https://akkoma.dev/AkkomaGang/akkoma/src/commit/f1018867097e6f293d8b2b5b6935f0a7ebf99bd0/lib/pleroma/object/fetcher.ex#L287
|
||||
url: id,
|
||||
// Akkoma requires inboxes to be setup to display profiles
|
||||
// https://akkoma.dev/AkkomaGang/akkoma/src/commit/f1018867097e6f293d8b2b5b6935f0a7ebf99bd0/lib/pleroma/web/activity_pub/object_validators/user_validator.ex#L72
|
||||
inbox: ctx.getInboxUri(handle),
|
||||
|
||||
name: `[TEST] ${escapeHtml(guild.name)}`,
|
||||
summary: escapeHtml(guild.description),
|
||||
icon: new Image({
|
||||
url: new URL(`https://steamusercontent-a.akamaihd.net/ugc/${guild.logo}`),
|
||||
mediaType: "image/jpeg"
|
||||
}),
|
||||
published: Temporal.Instant.fromEpochMilliseconds(guild.createdDateTime * 1000),
|
||||
attachments: [
|
||||
new PropertyValue({
|
||||
name: "Tag",
|
||||
value: `[<b>${escapeHtml(guild.tag)}</b>]`,
|
||||
}),
|
||||
new PropertyValue({
|
||||
name: "Message of the day",
|
||||
value: escapeHtml(guild.motd),
|
||||
}),
|
||||
new PropertyValue({
|
||||
name: "STRATZ",
|
||||
value: `<a href="https://stratz.com/guilds/${guild.id}">https://stratz.com/guilds/${guild.id}</a>`,
|
||||
}),
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
l.warn`No dispatcher was found for handle: ${handle}`
|
||||
return null
|
||||
|
||||
}
|
||||
|
||||
l.debug`Connecting actor dispatcher to federation object...`
|
||||
federation.setActorDispatcher("/users/{identifier}", actorDispatcher)
|
||||
|
||||
// Akkoma requires inboxes to be setup to display profiles
|
||||
// https://akkoma.dev/AkkomaGang/akkoma/src/commit/f1018867097e6f293d8b2b5b6935f0a7ebf99bd0/lib/pleroma/web/activity_pub/object_validators/user_validator.ex#L72
|
||||
l.debug`Initializing inbox listener...`
|
||||
federation.setInboxListeners("/inbox/{identifier}") // I don't really care about the shared inbox for this project
|
||||
|
|
99
src/graphql/stratz.ts
Normal file
99
src/graphql/stratz.ts
Normal file
|
@ -0,0 +1,99 @@
|
|||
import { getLogger } from "@logtape/logtape"
|
||||
|
||||
const l = getLogger(["dotino-veloce", "graphql"])
|
||||
|
||||
l.debug`Getting Stratz API URL from environment variable DOTINO_STRATZ_URL...`
|
||||
const urlString = Deno.env.get("DOTINO_STRATZ_URL")
|
||||
if(!urlString) {
|
||||
l.error`DOTINO_STRATZ_URL is unset.`
|
||||
throw new Error("DOTINO_STRATZ_URL is unset.")
|
||||
}
|
||||
|
||||
l.debug`Attempting to parse Stratz API URL...`
|
||||
const url = new URL(urlString)
|
||||
|
||||
l.debug`Getting Stratz API key from environment variable DOTINO_STRATZ_KEY...`
|
||||
const key = Deno.env.get("DOTINO_STRATZ_KEY")
|
||||
if(!key) {
|
||||
l.error`DOTINO_STRATZ_KEY is unset.`
|
||||
throw new Error("DOTINO_STRATZ_KEY is unset.")
|
||||
}
|
||||
|
||||
// Little trick to get VSCode to highlight queries!
|
||||
const graphql = String.raw
|
||||
|
||||
export async function doQuery(query: string, variables: object) {
|
||||
const request = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
"Authorization": `Bearer ${key}`,
|
||||
"User-Agent": "STRATZ_API",
|
||||
},
|
||||
body: JSON.stringify({query, variables})
|
||||
})
|
||||
const data = await request.json()
|
||||
|
||||
if(data["error"]) {
|
||||
throw new Error("GraphQL query failed.", data["error"])
|
||||
}
|
||||
|
||||
return data["data"]
|
||||
}
|
||||
|
||||
export async function doQueryPlayer(steamId: number): Promise<{
|
||||
communityVisibleState: number,
|
||||
isAnonymous: boolean,
|
||||
id: number,
|
||||
name: string,
|
||||
avatar: string,
|
||||
} | null> {
|
||||
l.info`Querying player ${steamId} on the Stratz API...`
|
||||
const response = await doQuery(
|
||||
graphql`
|
||||
query ($steamId: Long!) {
|
||||
player (steamAccountId: $steamId) {
|
||||
steamAccount {
|
||||
communityVisibleState
|
||||
isAnonymous
|
||||
id
|
||||
name
|
||||
avatar
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
{steamId}
|
||||
)
|
||||
return response?.player?.steamAccount ?? null
|
||||
}
|
||||
|
||||
export async function doQueryGuild(guildId: number): Promise<{
|
||||
id: number,
|
||||
motd: string,
|
||||
name: string,
|
||||
tag: string,
|
||||
logo: string,
|
||||
description: string,
|
||||
createdDateTime: number,
|
||||
} | null> {
|
||||
l.info`Querying guild ${guildId} on the Stratz API...`
|
||||
const response = await doQuery(
|
||||
graphql`
|
||||
query ($guildId: Int!) {
|
||||
guild(id: $guildId) {
|
||||
id,
|
||||
motd,
|
||||
name,
|
||||
tag,
|
||||
logo,
|
||||
description,
|
||||
createdDateTime,
|
||||
}
|
||||
}
|
||||
`,
|
||||
{guildId}
|
||||
)
|
||||
return response?.guild ?? null
|
||||
}
|
30
tests/graphql_test.ts
Normal file
30
tests/graphql_test.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { configure, getConsoleSink } from "@logtape/logtape"
|
||||
import { doQueryPlayer } from "../src/graphql/stratz.ts"
|
||||
import { assert, assertEquals} from "@std/assert"
|
||||
|
||||
|
||||
await configure({
|
||||
sinks: { console: getConsoleSink() },
|
||||
filters: {},
|
||||
loggers: [
|
||||
{ category: ["logtape", "meta"], sinks: ["console"], level: "warning" },
|
||||
{ category: ["fedify"], sinks: ["console"], level: "info" },
|
||||
{ category: ["dotino-veloce"], sinks: ["console"], level: "debug" },
|
||||
],
|
||||
})
|
||||
|
||||
Deno.test(async function querySteffo() {
|
||||
const user = await doQueryPlayer(74048532)
|
||||
assert(user)
|
||||
assertEquals(user.id, 74048532)
|
||||
})
|
||||
|
||||
Deno.test(async function queryOne() {
|
||||
const user = await doQueryPlayer(1)
|
||||
assertEquals(user, null)
|
||||
})
|
||||
|
||||
Deno.test(async function queryMinusOne() {
|
||||
const user = await doQueryPlayer(-1)
|
||||
assertEquals(user, null)
|
||||
})
|
|
@ -1,6 +0,0 @@
|
|||
import { assertEquals } from "@std/assert"
|
||||
import { add } from "../src/main.ts"
|
||||
|
||||
Deno.test(function addTest() {
|
||||
assertEquals(add(2, 3), 5)
|
||||
})
|
Loading…
Reference in a new issue