@hapaul/api 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -476,13 +476,15 @@ interface components {
476
476
  code: string;
477
477
  };
478
478
  LoginParamsDto: components["schemas"]["LoginMethod"] & {
479
- /** @description Login platform (e.g. web,ios,android,mp) */
480
- platform?: string | null;
479
+ platform?: null | components["schemas"]["LoginPlatform"];
481
480
  };
481
+ /** @enum {string} */
482
+ LoginPlatform: "web" | "ios" | "android" | "weapp";
482
483
  LoginResponseDto: {
483
484
  /** Format: uuid */
484
485
  userId: string;
485
486
  account: string;
487
+ accessToken: string;
486
488
  };
487
489
  MergeFileChunksDto: {
488
490
  /** Format: uuid */
@@ -561,13 +563,14 @@ interface components {
561
563
  account: string;
562
564
  password: string;
563
565
  ip?: string | null;
564
- platform?: string | null;
566
+ platform?: null | components["schemas"]["LoginPlatform"];
565
567
  };
566
568
  ResponseJson: components["schemas"]["Null"];
567
569
  ResponseJson_LoginResponseDto: {
568
570
  /** Format: uuid */
569
571
  userId: string;
570
572
  account: string;
573
+ accessToken: string;
571
574
  };
572
575
  /** @default null */
573
576
  ResponseJson_Null: unknown;
@@ -1422,7 +1425,7 @@ type ResponseError<T extends PathsWithMethod<paths, M>, M extends Methods> = Err
1422
1425
  type ClientConfig = {
1423
1426
  baseUrl?: string;
1424
1427
  fetch?: typeof fetch;
1425
- bodySerializer?: (data: any, headers: Headers) => any;
1428
+ bodySerializer?: (data: any, headers: Headers) => Promise<any> | any;
1426
1429
  };
1427
1430
  type RequestConfig<T extends PathsWithMethod<paths, M>, M extends Methods, C = {}> = ClientConfig & {
1428
1431
  method: M;
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var Client = class {
31
31
  const body = requestConfig.body;
32
32
  if (!contentType) headers.set("Content-Type", "application/json");
33
33
  try {
34
- const serializedBody = this.bodySerializer(body, headers);
34
+ const serializedBody = await this.bodySerializer(body, headers);
35
35
  let response = await this.fetch(url, {
36
36
  ...requestConfig,
37
37
  body: serializedBody,
@@ -113,7 +113,7 @@ function mergeHeaders(...allHeaders) {
113
113
  function defaultQuerySerializer(query) {
114
114
  return new URLSearchParams(query).toString();
115
115
  }
116
- function defaultBodySerializer(body, headers) {
116
+ async function defaultBodySerializer(body, headers) {
117
117
  if (body instanceof FormData) return body;
118
118
  if (headers) {
119
119
  const contentType = headers.get("Content-Type");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hapaul/api",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [