diff --git a/@sammo/api_def/package.json b/@sammo/api_def/package.json index d49ada0..ee3ef5d 100644 --- a/@sammo/api_def/package.json +++ b/@sammo/api_def/package.json @@ -5,6 +5,7 @@ "main": "dist/index.js", "exports": { ".": "./dist/index.js", + "./gateway": "./dist/gateway.js", "./def": "./dist/def/index.js" }, "scripts": { diff --git a/@sammo/api_def/src/gateway.ts b/@sammo/api_def/src/gateway.ts new file mode 100644 index 0000000..d6d87ec --- /dev/null +++ b/@sammo/api_def/src/gateway.ts @@ -0,0 +1,72 @@ +import { GET, POST, type DefAPINamespace } from "@strpc/def"; + +//굳이 할 필요는 없지만, d.ts가 깔끔해짐 +import type { + InvalidResponse, ValidResponse +} from "@strpc/def"; +import type { + ArgDeleteAPI, + ArgGetAPI, + ArgHeadAPI, + ArgPatchAPI, + ArgPostAPI, + ArgPutAPI, + EmptyDeleteAPI, + EmptyGetAPI, + EmptyHeadAPI, + EmptyPatchAPI, + EmptyPostAPI, + EmptyPutAPI, +} from "@strpc/def/types"; + + +export type LoginResponse = { + result: true, + nextToken: [number, string] | undefined, +} + +export type LoginFailed = { + result: false, + reqOTP: boolean, + reason: string, +} + + +export type AutoLoginNonceResponse = { + result: true, + loginNonce: string, +}; + +export type AutoLoginResponse = { + result: true, + nextToken: [number, string] | undefined, +} + + +export type AutoLoginFailed = { + result: false, + silent: boolean, + reason: string, +} + +/** @internal */ +export const structure = { + Login: { + LoginByID: POST<{ + id: string, + password: string, + }, LoginResponse, LoginFailed>(), + LoginByToken: POST<{ + hashedToken: string, + token_id: number, + }, AutoLoginResponse, AutoLoginFailed>(), + ReqNonce: GET(), + test: GET<{result: true, hello:'world'}>(), + }, + GetGameLoginToken: GET<{ + result: true, + gameLoginToken: string, + userID: number, + }>(), + +} satisfies DefAPINamespace; \ No newline at end of file diff --git a/@sammo/api_def/src/index.ts b/@sammo/api_def/src/index.ts index 1994fbe..cc4d393 100644 --- a/@sammo/api_def/src/index.ts +++ b/@sammo/api_def/src/index.ts @@ -22,10 +22,6 @@ import type { } from "@strpc/def/types"; import { GET, POST } from '@strpc/def'; -import type { Base64String, WrappedBuffer } from "@sammo/util"; -import type { ECDSASignatureBSON, ECDSASignatureJSON, ECDSASignatureRaw, ECDSA_P384_VerifyKey, ECDSA_PKCS8_P384_SignKey } from "@sammo/crypto/RawTypes"; -import type { PEMString } from "@sammo/crypto"; - export type { InferResponse, InferError, diff --git a/package.json b/package.json index b9c6f0e..6f97327 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "tslib": "^2.6.1", "vue": "^3.3.4", "vue-router": "^4.2.4", - "zod": "^3.22.1" + "zod": "^3.22.1", + "@sammo/api_def": "workspace:^" }, "devDependencies": { "@rushstack/eslint-patch": "^1.3.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 712c6a1..f6f9853 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@popperjs/core': specifier: ^2.11.8 version: 2.11.8 + '@sammo/api_def': + specifier: workspace:^ + version: link:@sammo/api_def async-lock: specifier: ^1.4.0 version: 1.4.0