gomtm 0.0.221 → 0.0.223

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.
@@ -2,6 +2,7 @@ import { ServiceType } from "@bufbuild/protobuf";
2
2
  export declare function createMtmServiceClient<T extends ServiceType>(service: T, url?: string): import("@connectrpc/connect").PromiseClient<T>;
3
3
  export declare function createMtmServiceClientByName<T extends ServiceType>(svcName: string, url?: string): import("@connectrpc/connect").PromiseClient<ServiceType>;
4
4
  type CustomRequestInit = RequestInit & {
5
+ cookieStr?: string;
5
6
  enableCache?: boolean;
6
7
  enableLog?: boolean;
7
8
  };
@@ -1,6 +1,4 @@
1
1
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
2
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
3
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
4
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -16,7 +14,6 @@ var __spreadValues = (a, b) => {
16
14
  }
17
15
  return a;
18
16
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
17
  var __async = (__this, __arguments, generator) => {
21
18
  return new Promise((resolve, reject) => {
22
19
  var fulfilled = (value) => {
@@ -40,7 +37,6 @@ var __async = (__this, __arguments, generator) => {
40
37
  import { createPromiseClient } from "@connectrpc/connect";
41
38
  import { createConnectTransport } from "@connectrpc/connect-web";
42
39
  import { merge } from "lodash";
43
- import { fetchMiddleWithCache } from "mtxlib/http/fetchMiddleWithCache";
44
40
  import { MtmService } from "./gomtmpb/mtm/sppb/mtm_connect";
45
41
  function createMtmServiceClient(service, url) {
46
42
  const baseUrl = url || process.env.MTM_BACKEND;
@@ -89,25 +85,16 @@ const gomtmFetcher = (initGlobal) => {
89
85
  const req = merge(init, initGlobal, {
90
86
  redirect: "follow"
91
87
  }) || {};
92
- let headerCookie = "";
93
- if (typeof window == "undefined") {
94
- console.log("mtmFetcher.ts require next/headers");
95
- const reqHeaders = require("next/headers").headers();
96
- headerCookie = reqHeaders.get("Cookie");
97
- }
98
88
  if (!init) {
99
89
  init = {};
100
90
  }
101
91
  init = __spreadValues(__spreadValues({}, init), {
102
- headers: __spreadValues(__spreadProps(__spreadValues({}, init.headers), {
92
+ headers: __spreadValues({
93
+ // ...init.headers,
103
94
  "Content-Type": "application/json"
104
- }), headerCookie && { "Cookie": headerCookie })
95
+ }, (initGlobal == null ? void 0 : initGlobal.cookieStr) && { "Cookie": initGlobal == null ? void 0 : initGlobal.cookieStr })
105
96
  });
106
- let fetcher = fetch;
107
- req.enableCache = false;
108
- if (req.enableCache) {
109
- fetcher = fetchMiddleWithCache(fetch);
110
- }
97
+ const fetcher = fetch;
111
98
  try {
112
99
  console.info("[mtmfetch]", {
113
100
  input,
@@ -30,9 +30,16 @@ const cookiesAtom = atom((get) => {
30
30
  const transportAtom = atom((get) => {
31
31
  const baseUrl = get(curd3BackendUrlAtom);
32
32
  const baseUrl2 = new URL("/api", baseUrl).toString();
33
+ const cookiesStr = get(cookiesAtom);
34
+ console.log("transportAtom :", {
35
+ baseUrl2,
36
+ cookiesStr
37
+ });
33
38
  return createConnectTransport({
34
39
  baseUrl: baseUrl2,
35
- fetch: gomtmFetcher()
40
+ fetch: gomtmFetcher({
41
+ cookieStr: cookiesStr
42
+ })
36
43
  });
37
44
  });
38
45
  const useGomtmBackend = () => {