gomtm 0.0.178 → 0.0.180
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/esm/curd/CurdListView.js +1 -1
- package/dist/esm/providers/GomtmAppSS.js +1 -7
- package/dist/esm/providers/GomtmProvider.d.ts +14 -5
- package/dist/esm/providers/GomtmProvider.js +43 -4
- package/dist/esm/store/auth.atoms.d.ts +5 -0
- package/dist/esm/{providers/userContext.js → store/auth.atoms.js} +9 -1
- package/dist/esm/validations/spContentModi.d.ts +4 -4
- package/dist/esm/validations/spRoute.d.ts +4 -4
- package/dist/tsconfig.type.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/esm/clientlib.d.ts +0 -6
- package/dist/esm/clientlib.js +0 -44
- package/dist/esm/components/ListItem.d.ts +0 -6
- package/dist/esm/components/ListItem.js +0 -49
- package/dist/esm/components/blog/post.atoms.d.ts +0 -11
- package/dist/esm/components/blog/post.atoms.js +0 -9
- package/dist/esm/components/formFieldRender/SchemaFormView.d.ts +0 -14
- package/dist/esm/components/formFieldRender/SchemaFormView.js +0 -44
- package/dist/esm/curd/CurdListViewV3.d.ts +0 -16
- package/dist/esm/curd/CurdListViewV3.js +0 -99
- package/dist/esm/curd/CurdViewView.d.ts +0 -63
- package/dist/esm/curd/CurdViewView.js +0 -90
- package/dist/esm/gomtm-clients.d.ts +0 -1
- package/dist/esm/gomtm-clients.js +0 -9
- package/dist/esm/http/cors.d.ts +0 -15
- package/dist/esm/http/cors.js +0 -129
- package/dist/esm/jotai-helper.d.ts +0 -23
- package/dist/esm/jotai-helper.js +0 -96
- package/dist/esm/providers/MtConnectProvider.d.ts +0 -2
- package/dist/esm/providers/MtConnectProvider.js +0 -13
- package/dist/esm/providers/MtConnectProviderV2.d.ts +0 -4
- package/dist/esm/providers/MtConnectProviderV2.js +0 -17
- package/dist/esm/providers/userContext.d.ts +0 -1
- package/dist/esm/store/CurdListViewV3.d.ts +0 -13
- package/dist/esm/store/CurdListViewV3.js +0 -78
- package/dist/esm/store/GomtmBackendProvider.d.ts +0 -12
- package/dist/esm/store/GomtmBackendProvider.js +0 -49
- package/dist/esm/utils.d.ts +0 -1
- package/dist/esm/utils.js +0 -32
- package/dist/gomtm +0 -0
|
@@ -26,7 +26,7 @@ import { AtomsHydrator } from "mtxlib/jotai/jotai-helper";
|
|
|
26
26
|
import { MtUnaryCallErrorView } from "../components/MtUnaryCallErrorView";
|
|
27
27
|
import { callUnaryMethod } from "../connectquery";
|
|
28
28
|
import { ListViewLayout } from "../gomtmpb/mtm/sppb/mtm_pb";
|
|
29
|
-
import { gomtmBaseUrlAtom, transportAtom } from "../
|
|
29
|
+
import { gomtmBaseUrlAtom, transportAtom } from "../providers/GomtmProvider";
|
|
30
30
|
import { ListItemView } from "./list-item/ListItem";
|
|
31
31
|
const curdActivateIdAtom = atom("");
|
|
32
32
|
const curd3ListParamsAtom = atom({});
|
|
@@ -20,7 +20,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
20
|
};
|
|
21
21
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
22
22
|
import { MTM_SERVER_COOKIE_ACTIVATE_URL } from "../consts";
|
|
23
|
-
import { GomtmBackendProvider } from "../store/GomtmBackendProvider";
|
|
24
23
|
import { GomtmProvider } from "./GomtmProvider";
|
|
25
24
|
function GomtmAppSS(props) {
|
|
26
25
|
return __async(this, null, function* () {
|
|
@@ -29,12 +28,7 @@ function GomtmAppSS(props) {
|
|
|
29
28
|
if (!backend) {
|
|
30
29
|
return /* @__PURE__ */ jsx(Fragment, { children: "missing backend" });
|
|
31
30
|
}
|
|
32
|
-
return /* @__PURE__ */ jsx(
|
|
33
|
-
GomtmProvider,
|
|
34
|
-
{
|
|
35
|
-
children: /* @__PURE__ */ jsx(GomtmBackendProvider, { baseUrl: backend, children })
|
|
36
|
-
}
|
|
37
|
-
);
|
|
31
|
+
return /* @__PURE__ */ jsx(GomtmProvider, { backendUrl: backend, children });
|
|
38
32
|
});
|
|
39
33
|
}
|
|
40
34
|
const ssrGetBackendUrl = () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Dispatch, PropsWithChildren } from 'react';
|
|
2
|
+
import { Transport } from '@connectrpc/connect';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
export declare const mtmAppStore: {
|
|
4
5
|
get: <Value>(atom: import("jotai").Atom<Value>) => Value;
|
|
@@ -43,20 +44,27 @@ export type ActionHandler = (props: {
|
|
|
43
44
|
action: string;
|
|
44
45
|
values?: any;
|
|
45
46
|
}) => void;
|
|
47
|
+
export declare const gomtmBaseUrlAtom: import("jotai").PrimitiveAtom<string> & {
|
|
48
|
+
init: string;
|
|
49
|
+
};
|
|
50
|
+
export declare const transportAtom: import("jotai").Atom<Transport>;
|
|
51
|
+
export declare const useGomtmBackend: () => {
|
|
52
|
+
gomtmBaseUrl: string;
|
|
53
|
+
};
|
|
54
|
+
interface GomtmAppProps {
|
|
55
|
+
backendUrl?: string | null;
|
|
56
|
+
}
|
|
46
57
|
interface IAppContext {
|
|
47
|
-
extKv: Record<string, any>;
|
|
48
58
|
token?: string | null;
|
|
49
59
|
hostname?: string | null;
|
|
50
|
-
backendUrl?: string | null;
|
|
51
|
-
trpcBackendUrl?: string | null;
|
|
52
60
|
isDebug?: boolean;
|
|
53
61
|
debugData?: any;
|
|
54
62
|
setDebugData: Dispatch<any>;
|
|
55
63
|
isOpenDebugView?: boolean;
|
|
56
64
|
setOpenDebugView: Dispatch<React.SetStateAction<boolean>>;
|
|
57
65
|
}
|
|
58
|
-
export declare function GomtmProvider(props: {} & PropsWithChildren): React.JSX.Element;
|
|
59
|
-
export declare function useMtmApp(): IAppContext;
|
|
66
|
+
export declare function GomtmProvider(props: {} & GomtmAppProps & PropsWithChildren): React.JSX.Element;
|
|
67
|
+
export declare function useMtmApp(): IAppContext & GomtmAppProps;
|
|
60
68
|
export declare const useMtmBackendUrl: () => string | null | undefined;
|
|
61
69
|
export declare const useHostname: () => string;
|
|
62
70
|
export declare const useExtInfo: () => (key: string) => string | null | undefined;
|
|
@@ -64,4 +72,5 @@ export declare const useToken: () => {
|
|
|
64
72
|
token: string;
|
|
65
73
|
setToken: (newToken: string) => void;
|
|
66
74
|
};
|
|
75
|
+
export declare const MtConnectProvider: (props: PropsWithChildren) => React.JSX.Element;
|
|
67
76
|
export {};
|
|
@@ -1,22 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useCallback, useContext, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { createConnectTransport } from "@connectrpc/connect-web";
|
|
5
|
+
import { atom, createStore, useAtom } from "jotai";
|
|
5
6
|
import { getCookie } from "mtxlib/clientlib";
|
|
7
|
+
import { AtomsHydrator } from "mtxlib/jotai/jotai-helper";
|
|
6
8
|
import { isDebugAtom } from "mtxuilib/store/app.atoms";
|
|
7
9
|
import { useHotkeys } from "react-hotkeys-hook";
|
|
10
|
+
import { TransportProvider } from "../connectquery";
|
|
8
11
|
import { ExtKey_Hostname, ExtKey_SelfBackend, ExtKey_mtmaccessToken, ExtKey_mtmbackend, MtM_TOKEN_NAME } from "../consts";
|
|
9
|
-
import {
|
|
12
|
+
import { gomtmFetcher } from "../gomtm-clients-ss";
|
|
10
13
|
import { MtReactQueryProvider } from "./ReactQueryProvider";
|
|
11
14
|
const mtmAppStore = createStore();
|
|
15
|
+
const gomtmBaseUrlAtom = atom("");
|
|
16
|
+
const curd3BackendUrlAtom = atom((get) => {
|
|
17
|
+
const value1 = get(gomtmBaseUrlAtom);
|
|
18
|
+
if (value1) {
|
|
19
|
+
return value1;
|
|
20
|
+
}
|
|
21
|
+
if (typeof window == "undefined") {
|
|
22
|
+
console.log("get gomtm backendurl(SSR)", process.env.MTM_BACKEND);
|
|
23
|
+
return process.env.MTM_BACKEND || "";
|
|
24
|
+
}
|
|
25
|
+
return "";
|
|
26
|
+
});
|
|
27
|
+
const transportAtom = atom((get) => {
|
|
28
|
+
const baseUrl = get(curd3BackendUrlAtom);
|
|
29
|
+
return createConnectTransport({
|
|
30
|
+
baseUrl,
|
|
31
|
+
fetch: gomtmFetcher()
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
const useGomtmBackend = () => {
|
|
35
|
+
const [gomtmBaseUrl, setgomtmBaseUrl] = useAtom(gomtmBaseUrlAtom);
|
|
36
|
+
return {
|
|
37
|
+
gomtmBaseUrl
|
|
38
|
+
};
|
|
39
|
+
};
|
|
12
40
|
const AppContext = createContext(void 0);
|
|
13
41
|
function GomtmProvider(props) {
|
|
14
42
|
const { children } = props;
|
|
15
43
|
const [isDebug, setDebug] = useAtom(isDebugAtom);
|
|
16
44
|
useHotkeys("alt+j", () => {
|
|
17
45
|
setDebug(!isDebug);
|
|
18
|
-
}, []);
|
|
19
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
46
|
+
}, [isDebug, setDebug]);
|
|
47
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(AtomsHydrator, { atomValues: [
|
|
48
|
+
[gomtmBaseUrlAtom, props.backendUrl]
|
|
49
|
+
], children: /* @__PURE__ */ jsx(MtConnectProvider, { children: /* @__PURE__ */ jsx(MtReactQueryProvider, { children }) }) }) });
|
|
20
50
|
}
|
|
21
51
|
function useMtmApp() {
|
|
22
52
|
const mtappContext = useContext(AppContext);
|
|
@@ -69,10 +99,19 @@ const useToken = () => {
|
|
|
69
99
|
}
|
|
70
100
|
};
|
|
71
101
|
};
|
|
102
|
+
const MtConnectProvider = (props) => {
|
|
103
|
+
const { children } = props;
|
|
104
|
+
const [transport] = useAtom(transportAtom);
|
|
105
|
+
return /* @__PURE__ */ jsx(TransportProvider, { transport, children });
|
|
106
|
+
};
|
|
72
107
|
export {
|
|
73
108
|
GomtmProvider,
|
|
109
|
+
MtConnectProvider,
|
|
110
|
+
gomtmBaseUrlAtom,
|
|
74
111
|
mtmAppStore,
|
|
112
|
+
transportAtom,
|
|
75
113
|
useExtInfo,
|
|
114
|
+
useGomtmBackend,
|
|
76
115
|
useHostname,
|
|
77
116
|
useMtmApp,
|
|
78
117
|
useMtmBackendUrl,
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { atom, useAtom } from "jotai";
|
|
3
|
+
const isAdminAtom = atom(false);
|
|
4
|
+
const useIsAdmin = () => {
|
|
5
|
+
const [isAdmin, setisAdmin] = useAtom(isAdminAtom);
|
|
6
|
+
return isAdmin;
|
|
7
|
+
};
|
|
2
8
|
function isRoleMatch(currentRoles, allowRoles) {
|
|
3
9
|
if (!currentRoles) {
|
|
4
10
|
return true;
|
|
@@ -15,5 +21,7 @@ function isRoleMatch(currentRoles, allowRoles) {
|
|
|
15
21
|
return false;
|
|
16
22
|
}
|
|
17
23
|
export {
|
|
18
|
-
|
|
24
|
+
isAdminAtom,
|
|
25
|
+
isRoleMatch,
|
|
26
|
+
useIsAdmin
|
|
19
27
|
};
|
|
@@ -23,15 +23,15 @@ export declare const spContentModiCreateInput: z.ZodObject<{
|
|
|
23
23
|
}, "strip", z.ZodTypeAny, {
|
|
24
24
|
value: string;
|
|
25
25
|
action: string;
|
|
26
|
-
spRouteId: string;
|
|
27
26
|
sel: string;
|
|
27
|
+
spRouteId: string;
|
|
28
28
|
matchContentType: string;
|
|
29
29
|
title?: string | undefined;
|
|
30
30
|
}, {
|
|
31
31
|
value: string;
|
|
32
32
|
action: string;
|
|
33
|
-
spRouteId: string;
|
|
34
33
|
sel: string;
|
|
34
|
+
spRouteId: string;
|
|
35
35
|
matchContentType: string;
|
|
36
36
|
title?: string | undefined;
|
|
37
37
|
}>;
|
|
@@ -47,16 +47,16 @@ export declare const spContentModiSaveInput: z.ZodObject<{
|
|
|
47
47
|
value: string;
|
|
48
48
|
id: string;
|
|
49
49
|
action: string;
|
|
50
|
-
spRouteId: string;
|
|
51
50
|
sel: string;
|
|
51
|
+
spRouteId: string;
|
|
52
52
|
matchContentType: string;
|
|
53
53
|
title?: string | undefined;
|
|
54
54
|
}, {
|
|
55
55
|
value: string;
|
|
56
56
|
id: string;
|
|
57
57
|
action: string;
|
|
58
|
-
spRouteId: string;
|
|
59
58
|
sel: string;
|
|
59
|
+
spRouteId: string;
|
|
60
60
|
matchContentType: string;
|
|
61
61
|
title?: string | undefined;
|
|
62
62
|
}>;
|
|
@@ -22,15 +22,15 @@ export declare const spRouteCreateInput: z.ZodObject<{
|
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
23
|
value: string;
|
|
24
24
|
title: string;
|
|
25
|
+
spProjectId: string;
|
|
25
26
|
hostPattern: string;
|
|
26
27
|
pathPattern: string;
|
|
27
|
-
spProjectId: string;
|
|
28
28
|
}, {
|
|
29
29
|
value: string;
|
|
30
30
|
title: string;
|
|
31
|
+
spProjectId: string;
|
|
31
32
|
hostPattern: string;
|
|
32
33
|
pathPattern: string;
|
|
33
|
-
spProjectId: string;
|
|
34
34
|
}>;
|
|
35
35
|
export type SpRouteSaveInput = z.infer<typeof SpRouteSaveInput>;
|
|
36
36
|
export declare const SpRouteSaveInput: z.ZodObject<{
|
|
@@ -44,14 +44,14 @@ export declare const SpRouteSaveInput: z.ZodObject<{
|
|
|
44
44
|
value: string;
|
|
45
45
|
id: string;
|
|
46
46
|
title: string;
|
|
47
|
+
spProjectId: string;
|
|
47
48
|
hostPattern: string;
|
|
48
49
|
pathPattern: string;
|
|
49
|
-
spProjectId: string;
|
|
50
50
|
}, {
|
|
51
51
|
value: string;
|
|
52
52
|
id: string;
|
|
53
53
|
title: string;
|
|
54
|
+
spProjectId: string;
|
|
54
55
|
hostPattern: string;
|
|
55
56
|
pathPattern: string;
|
|
56
|
-
spProjectId: string;
|
|
57
57
|
}>;
|