diff --git a/amnet-shared/dist/index.d.mts b/amnet-shared/dist/index.d.mts index a76d7c7..1eb7924 100644 --- a/amnet-shared/dist/index.d.mts +++ b/amnet-shared/dist/index.d.mts @@ -5,19 +5,27 @@ declare const AMNET_API_VERSION = 1; interface AMCardInRequest { cardId: string; } -interface AMServerInfoResponse { - serverAddress: string; - serverName: string; +/** + * Information needed to perform a request against an AMNet server + */ +interface AMServerConnectionInfo { apiVersion: number; - gameId: string; + serverAddress: string; +} +/** + * Received metadata from an AMNet server + */ +interface AMServerInfoResponse extends AMServerConnectionInfo { + serverName: string; + gameId?: string | null | undefined; } /** * Performs the card-in request to the specified server - * @param serverAddress The origin address of the server to perform the request against + * @param server The server to perform the request against * @param request The card-in request to send * @param signal The abort signal to use for the request */ -declare function performCardIn(serverAddress: string, request: AMCardInRequest, signal: AbortSignal): Promise; +declare function performCardIn(server: AMServerConnectionInfo, request: AMCardInRequest, signal: AbortSignal): Promise; /** * Attempts to connect to the specified server and fetch its info * @param serverAddress The origin address of the server to connect to @@ -51,4 +59,4 @@ declare enum GameIds { DivaFT = "SBZV" } -export { type AMCardInRequest, AMNET_API_VERSION, type AMServerInfoResponse, CARD_ID_REGEX, GameIds, fetchServerInfo, generateCardNumber, performCardIn, validateCardId }; +export { type AMCardInRequest, AMNET_API_VERSION, type AMServerConnectionInfo, type AMServerInfoResponse, CARD_ID_REGEX, GameIds, fetchServerInfo, generateCardNumber, performCardIn, validateCardId }; diff --git a/amnet-shared/dist/index.d.ts b/amnet-shared/dist/index.d.ts index a76d7c7..1eb7924 100644 --- a/amnet-shared/dist/index.d.ts +++ b/amnet-shared/dist/index.d.ts @@ -5,19 +5,27 @@ declare const AMNET_API_VERSION = 1; interface AMCardInRequest { cardId: string; } -interface AMServerInfoResponse { - serverAddress: string; - serverName: string; +/** + * Information needed to perform a request against an AMNet server + */ +interface AMServerConnectionInfo { apiVersion: number; - gameId: string; + serverAddress: string; +} +/** + * Received metadata from an AMNet server + */ +interface AMServerInfoResponse extends AMServerConnectionInfo { + serverName: string; + gameId?: string | null | undefined; } /** * Performs the card-in request to the specified server - * @param serverAddress The origin address of the server to perform the request against + * @param server The server to perform the request against * @param request The card-in request to send * @param signal The abort signal to use for the request */ -declare function performCardIn(serverAddress: string, request: AMCardInRequest, signal: AbortSignal): Promise; +declare function performCardIn(server: AMServerConnectionInfo, request: AMCardInRequest, signal: AbortSignal): Promise; /** * Attempts to connect to the specified server and fetch its info * @param serverAddress The origin address of the server to connect to @@ -51,4 +59,4 @@ declare enum GameIds { DivaFT = "SBZV" } -export { type AMCardInRequest, AMNET_API_VERSION, type AMServerInfoResponse, CARD_ID_REGEX, GameIds, fetchServerInfo, generateCardNumber, performCardIn, validateCardId }; +export { type AMCardInRequest, AMNET_API_VERSION, type AMServerConnectionInfo, type AMServerInfoResponse, CARD_ID_REGEX, GameIds, fetchServerInfo, generateCardNumber, performCardIn, validateCardId }; diff --git a/amnet-shared/dist/index.js b/amnet-shared/dist/index.js index 2da0045..1ae69d6 100644 --- a/amnet-shared/dist/index.js +++ b/amnet-shared/dist/index.js @@ -69,10 +69,10 @@ module.exports = __toCommonJS(src_exports); // src/api.ts var AMNET_API_VERSION = 1; -function performCardIn(serverAddress, request, signal) { +function performCardIn(server, request, signal) { return __async(this, null, function* () { try { - const response = yield fetch(`${new URL(serverAddress).origin}/amnet/signin`, { + const response = yield fetch(`${new URL(server.serverAddress).origin}/amnet/signin`, { method: "POST", headers: { "Content-Type": "application/json" diff --git a/amnet-shared/dist/index.js.map b/amnet-shared/dist/index.js.map index 1904fc2..88861b3 100644 --- a/amnet-shared/dist/index.js.map +++ b/amnet-shared/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.ts","../src/api.ts","../src/card.ts","../src/gameIds.ts"],"sourcesContent":["export * from './api';\nexport * from './card';\nexport * from './gameIds';","/**\n * The latest version of the AMNet API this library supports\n */\nexport const AMNET_API_VERSION = 1;\n\nexport interface AMCardInRequest {\n cardId: string;\n}\n\nexport interface AMServerInfoResponse {\n serverAddress: string;\n serverName: string;\n apiVersion: number;\n gameId: string;\n}\n\n/**\n * Performs the card-in request to the specified server\n * @param serverAddress The origin address of the server to perform the request against\n * @param request The card-in request to send\n * @param signal The abort signal to use for the request\n */\nexport async function performCardIn(serverAddress: string, request: AMCardInRequest, signal: AbortSignal) {\n try {\n const response = await fetch(`${new URL(serverAddress).origin}/amnet/signin`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(request),\n signal: signal\n });\n\n return response.ok;\n } catch {\n return false;\n }\n}\n\n/**\n * Attempts to connect to the specified server and fetch its info\n * @param serverAddress The origin address of the server to connect to\n * @param abort The abort signal to use for the request (for cancellation)\n */\nexport async function fetchServerInfo(serverAddress: string, abort: AbortSignal): Promise {\n try {\n const response = await fetch(`${new URL(serverAddress).origin}/amnet/info`, {\n signal: abort\n });\n\n return {\n ...await response.json(),\n serverAddress: serverAddress\n } satisfies AMServerInfoResponse;\n } catch {\n return null;\n }\n}\n","export const CARD_ID_REGEX = /^(?:[0-9]{4} ?){5}$/i;\n\nexport function generateCardNumber(): string {\n let cardId = '';\n\n while (true) {\n // don't start with a 3\n const firstDigit = Math.floor(Math.random() * 10);\n\n if (firstDigit !== 3) {\n cardId = firstDigit.toString();\n break;\n }\n }\n\n for (let i = 0; i < 19; i++) {\n cardId += Math.floor(Math.random() * 10).toString();\n }\n\n return cardId;\n}\n\n/**\n * Validates the provided card id by known parameters\n * @param id The card id to validate\n */\nexport function validateCardId(id: string): boolean {\n return id[0] !== '3' && CARD_ID_REGEX.test(id);\n}\n","export enum GameIds {\n /**\n * Initial D The Arcade\n */\n IDAC = \"SDGT\",\n\n /**\n * Chunithm (Paradise Lost)\n */\n Chuni = \"SDBT\",\n\n /**\n * Chunithm NEW onwards\n */\n Chusan = \"SDHD\",\n\n ONGEKI = \"SDDT\",\n maimaiDX = \"SDEZ\",\n DivaFT = \"SBZV\"\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;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L;AAIL,EAAAA,SAAA,UAAO;AAKP,EAAAA,SAAA,WAAQ;AAKR,EAAAA,SAAA,YAAS;AAET,EAAAA,SAAA,YAAS;AACT,EAAAA,SAAA,cAAW;AACX,EAAAA,SAAA,YAAS;AAlBC,SAAAA;AAAA,GAAA;","names":["GameIds"]} \ No newline at end of file +{"version":3,"sources":["../src/index.ts","../src/api.ts","../src/card.ts","../src/gameIds.ts"],"sourcesContent":["export * from './api';\nexport * from './card';\nexport * from './gameIds';","/**\n * The latest version of the AMNet API this library supports\n */\nexport const AMNET_API_VERSION = 1;\n\nexport interface AMCardInRequest {\n cardId: string;\n}\n\n/**\n * Information needed to perform a request against an AMNet server\n */\nexport interface AMServerConnectionInfo {\n apiVersion: number;\n serverAddress: string;\n}\n\n/**\n * Received metadata from an AMNet server \n */\nexport interface AMServerInfoResponse extends AMServerConnectionInfo {\n serverName: string;\n gameId?: string | null | undefined;\n}\n\n/**\n * Performs the card-in request to the specified server\n * @param server The server to perform the request against\n * @param request The card-in request to send\n * @param signal The abort signal to use for the request\n */\nexport async function performCardIn(server: AMServerConnectionInfo, request: AMCardInRequest, signal: AbortSignal) {\n try {\n const response = await fetch(`${new URL(server.serverAddress).origin}/amnet/signin`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(request),\n signal: signal\n });\n\n return response.ok;\n } catch {\n return false;\n }\n}\n\n/**\n * Attempts to connect to the specified server and fetch its info\n * @param serverAddress The origin address of the server to connect to\n * @param abort The abort signal to use for the request (for cancellation)\n */\nexport async function fetchServerInfo(serverAddress: string, abort: AbortSignal): Promise {\n try {\n const response = await fetch(`${new URL(serverAddress).origin}/amnet/info`, {\n signal: abort\n });\n\n return {\n ...await response.json(),\n serverAddress: serverAddress\n } satisfies AMServerInfoResponse;\n } catch {\n return null;\n }\n}\n","export const CARD_ID_REGEX = /^(?:[0-9]{4} ?){5}$/i;\n\nexport function generateCardNumber(): string {\n let cardId = '';\n\n while (true) {\n // don't start with a 3\n const firstDigit = Math.floor(Math.random() * 10);\n\n if (firstDigit !== 3) {\n cardId = firstDigit.toString();\n break;\n }\n }\n\n for (let i = 0; i < 19; i++) {\n cardId += Math.floor(Math.random() * 10).toString();\n }\n\n return cardId;\n}\n\n/**\n * Validates the provided card id by known parameters\n * @param id The card id to validate\n */\nexport function validateCardId(id: string): boolean {\n return id[0] !== '3' && CARD_ID_REGEX.test(id);\n}\n","export enum GameIds {\n /**\n * Initial D The Arcade\n */\n IDAC = \"SDGT\",\n\n /**\n * Chunithm (Paradise Lost)\n */\n Chuni = \"SDBT\",\n\n /**\n * Chunithm NEW onwards\n */\n Chusan = \"SDHD\",\n\n ONGEKI = \"SDDT\",\n maimaiDX = \"SDEZ\",\n DivaFT = \"SBZV\"\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,IAAM,oBAAoB;AA4BjC,SAAsB,cAAc,QAAgC,SAA0B,QAAqB;AAAA;AAC/G,QAAI;AACA,YAAM,WAAW,MAAM,MAAM,GAAG,IAAI,IAAI,OAAO,aAAa,EAAE,MAAM,iBAAiB;AAAA,QACjF,QAAQ;AAAA,QACR,SAAS;AAAA,UACL,gBAAgB;AAAA,QACpB;AAAA,QACA,MAAM,KAAK,UAAU,OAAO;AAAA,QAC5B;AAAA,MACJ,CAAC;AAED,aAAO,SAAS;AAAA,IACpB,SAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AAAA;AAOA,SAAsB,gBAAgB,eAAuB,OAA0D;AAAA;AACnH,QAAI;AACA,YAAM,WAAW,MAAM,MAAM,GAAG,IAAI,IAAI,aAAa,EAAE,MAAM,eAAe;AAAA,QACxE,QAAQ;AAAA,MACZ,CAAC;AAED,aAAO,iCACA,MAAM,SAAS,KAAK,IADpB;AAAA,QAEH;AAAA,MACJ;AAAA,IACJ,SAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AAAA;;;AClEO,IAAM,gBAAgB;AAEtB,SAAS,qBAA6B;AACzC,MAAI,SAAS;AAEb,SAAO,MAAM;AAET,UAAM,aAAa,KAAK,MAAM,KAAK,OAAO,IAAI,EAAE;AAEhD,QAAI,eAAe,GAAG;AAClB,eAAS,WAAW,SAAS;AAC7B;AAAA,IACJ;AAAA,EACJ;AAEA,WAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AACzB,cAAU,KAAK,MAAM,KAAK,OAAO,IAAI,EAAE,EAAE,SAAS;AAAA,EACtD;AAEA,SAAO;AACX;AAMO,SAAS,eAAe,IAAqB;AAChD,SAAO,GAAG,CAAC,MAAM,OAAO,cAAc,KAAK,EAAE;AACjD;;;AC5BO,IAAK,UAAL,kBAAKA,aAAL;AAIL,EAAAA,SAAA,UAAO;AAKP,EAAAA,SAAA,WAAQ;AAKR,EAAAA,SAAA,YAAS;AAET,EAAAA,SAAA,YAAS;AACT,EAAAA,SAAA,cAAW;AACX,EAAAA,SAAA,YAAS;AAlBC,SAAAA;AAAA,GAAA;","names":["GameIds"]} \ No newline at end of file diff --git a/amnet-shared/dist/index.mjs b/amnet-shared/dist/index.mjs index 62ddf57..24dcb46 100644 --- a/amnet-shared/dist/index.mjs +++ b/amnet-shared/dist/index.mjs @@ -40,10 +40,10 @@ var __async = (__this, __arguments, generator) => { // src/api.ts var AMNET_API_VERSION = 1; -function performCardIn(serverAddress, request, signal) { +function performCardIn(server, request, signal) { return __async(this, null, function* () { try { - const response = yield fetch(`${new URL(serverAddress).origin}/amnet/signin`, { + const response = yield fetch(`${new URL(server.serverAddress).origin}/amnet/signin`, { method: "POST", headers: { "Content-Type": "application/json" diff --git a/amnet-shared/dist/index.mjs.map b/amnet-shared/dist/index.mjs.map index 6363ff3..99a7d93 100644 --- a/amnet-shared/dist/index.mjs.map +++ b/amnet-shared/dist/index.mjs.map @@ -1 +1 @@ -{"version":3,"sources":["../src/api.ts","../src/card.ts","../src/gameIds.ts"],"sourcesContent":["/**\n * The latest version of the AMNet API this library supports\n */\nexport const AMNET_API_VERSION = 1;\n\nexport interface AMCardInRequest {\n cardId: string;\n}\n\nexport interface AMServerInfoResponse {\n serverAddress: string;\n serverName: string;\n apiVersion: number;\n gameId: string;\n}\n\n/**\n * Performs the card-in request to the specified server\n * @param serverAddress The origin address of the server to perform the request against\n * @param request The card-in request to send\n * @param signal The abort signal to use for the request\n */\nexport async function performCardIn(serverAddress: string, request: AMCardInRequest, signal: AbortSignal) {\n try {\n const response = await fetch(`${new URL(serverAddress).origin}/amnet/signin`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(request),\n signal: signal\n });\n\n return response.ok;\n } catch {\n return false;\n }\n}\n\n/**\n * Attempts to connect to the specified server and fetch its info\n * @param serverAddress The origin address of the server to connect to\n * @param abort The abort signal to use for the request (for cancellation)\n */\nexport async function fetchServerInfo(serverAddress: string, abort: AbortSignal): Promise {\n try {\n const response = await fetch(`${new URL(serverAddress).origin}/amnet/info`, {\n signal: abort\n });\n\n return {\n ...await response.json(),\n serverAddress: serverAddress\n } satisfies AMServerInfoResponse;\n } catch {\n return null;\n }\n}\n","export const CARD_ID_REGEX = /^(?:[0-9]{4} ?){5}$/i;\n\nexport function generateCardNumber(): string {\n let cardId = '';\n\n while (true) {\n // don't start with a 3\n const firstDigit = Math.floor(Math.random() * 10);\n\n if (firstDigit !== 3) {\n cardId = firstDigit.toString();\n break;\n }\n }\n\n for (let i = 0; i < 19; i++) {\n cardId += Math.floor(Math.random() * 10).toString();\n }\n\n return cardId;\n}\n\n/**\n * Validates the provided card id by known parameters\n * @param id The card id to validate\n */\nexport function validateCardId(id: string): boolean {\n return id[0] !== '3' && CARD_ID_REGEX.test(id);\n}\n","export enum GameIds {\n /**\n * Initial D The Arcade\n */\n IDAC = \"SDGT\",\n\n /**\n * Chunithm (Paradise Lost)\n */\n Chuni = \"SDBT\",\n\n /**\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AAK,EAAE;AACjD;;;AC5BO,IAAK,UAAL,kBAAKA,aAAL;AAIL,EAAAA,SAAA,UAAO;AAKP,EAAAA,SAAA,WAAQ;AAKR,EAAAA,SAAA,YAAS;AAET,EAAAA,SAAA,YAAS;AACT,EAAAA,SAAA,cAAW;AACX,EAAAA,SAAA,YAAS;AAlBC,SAAAA;AAAA,GAAA;","names":["GameIds"]} \ No newline at end of file +{"version":3,"sources":["../src/api.ts","../src/card.ts","../src/gameIds.ts"],"sourcesContent":["/**\n * The latest version of the AMNet API this library supports\n */\nexport const AMNET_API_VERSION = 1;\n\nexport interface AMCardInRequest {\n cardId: string;\n}\n\n/**\n * Information needed to perform a request against an AMNet server\n */\nexport interface AMServerConnectionInfo {\n apiVersion: number;\n serverAddress: string;\n}\n\n/**\n * Received metadata from an AMNet server \n */\nexport interface AMServerInfoResponse extends AMServerConnectionInfo {\n serverName: string;\n gameId?: string | null | undefined;\n}\n\n/**\n * Performs the card-in request to the specified server\n * @param server The server to perform the request against\n * @param request The card-in request to send\n * @param signal The abort signal to use for the request\n */\nexport async function performCardIn(server: AMServerConnectionInfo, request: AMCardInRequest, signal: AbortSignal) {\n try {\n const response = await fetch(`${new URL(server.serverAddress).origin}/amnet/signin`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(request),\n signal: signal\n });\n\n return response.ok;\n } catch {\n return false;\n }\n}\n\n/**\n * Attempts to connect to the specified server and fetch its info\n * @param serverAddress The origin address of the server to connect to\n * @param abort The abort signal to use for the request (for cancellation)\n */\nexport async function fetchServerInfo(serverAddress: string, abort: AbortSignal): Promise {\n try {\n const response = await fetch(`${new URL(serverAddress).origin}/amnet/info`, {\n signal: abort\n });\n\n return {\n ...await response.json(),\n serverAddress: serverAddress\n } satisfies AMServerInfoResponse;\n } catch {\n return null;\n }\n}\n","export const CARD_ID_REGEX = /^(?:[0-9]{4} ?){5}$/i;\n\nexport function generateCardNumber(): string {\n let cardId = '';\n\n while (true) {\n // don't start with a 3\n const firstDigit = Math.floor(Math.random() * 10);\n\n if (firstDigit !== 3) {\n cardId = firstDigit.toString();\n break;\n }\n }\n\n for (let i = 0; i < 19; i++) {\n cardId += Math.floor(Math.random() * 10).toString();\n }\n\n return cardId;\n}\n\n/**\n * Validates the provided card id by known parameters\n * @param id The card id to validate\n */\nexport function validateCardId(id: string): boolean {\n return id[0] !== '3' && CARD_ID_REGEX.test(id);\n}\n","export enum GameIds {\n /**\n * Initial D The Arcade\n */\n IDAC = \"SDGT\",\n\n /**\n * Chunithm (Paradise Lost)\n */\n Chuni = \"SDBT\",\n\n /**\n * Chunithm NEW onwards\n */\n Chusan = \"SDHD\",\n\n ONGEKI = \"SDDT\",\n maimaiDX = \"SDEZ\",\n DivaFT = \"SBZV\"\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,oBAAoB;AA4BjC,SAAsB,cAAc,QAAgC,SAA0B,QAAqB;AAAA;AAC/G,QAAI;AACA,YAAM,WAAW,MAAM,MAAM,GAAG,IAAI,IAAI,OAAO,aAAa,EAAE,MAAM,iBAAiB;AAAA,QACjF,QAAQ;AAAA,QACR,SAAS;AAAA,UACL,gBAAgB;AAAA,QACpB;AAAA,QACA,MAAM,KAAK,UAAU,OAAO;AAAA,QAC5B;AAAA,MACJ,CAAC;AAED,aAAO,SAAS;AAAA,IACpB,SAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AAAA;AAOA,SAAsB,gBAAgB,eAAuB,OAA0D;AAAA;AACnH,QAAI;AACA,YAAM,WAAW,MAAM,MAAM,GAAG,IAAI,IAAI,aAAa,EAAE,MAAM,eAAe;AAAA,QACxE,QAAQ;AAAA,MACZ,CAAC;AAED,aAAO,iCACA,MAAM,SAAS,KAAK,IADpB;AAAA,QAEH;AAAA,MACJ;AAAA,IACJ,SAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AAAA;;;AClEO,IAAM,gBAAgB;AAEt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