gomtm 0.0.179 → 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/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/providers/userContext.js +0 -19
- 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
package/dist/esm/jotai-helper.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { atom, useSetAtom } from "jotai";
|
|
3
|
-
import { useHydrateAtoms } from "jotai/utils";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
function AtomsHydrator({
|
|
6
|
-
atomValues,
|
|
7
|
-
store,
|
|
8
|
-
children
|
|
9
|
-
}) {
|
|
10
|
-
useHydrateAtoms(new Map(atomValues), { store });
|
|
11
|
-
return children;
|
|
12
|
-
}
|
|
13
|
-
function atomWithDebounce(initialValue, delayMilliseconds = 500, shouldDebounceOnReset = false) {
|
|
14
|
-
const prevTimeoutAtom = atom(
|
|
15
|
-
void 0
|
|
16
|
-
);
|
|
17
|
-
const _currentValueAtom = atom(initialValue);
|
|
18
|
-
const isDebouncingAtom = atom(false);
|
|
19
|
-
const debouncedValueAtom = atom(
|
|
20
|
-
initialValue,
|
|
21
|
-
(get, set, update) => {
|
|
22
|
-
clearTimeout(get(prevTimeoutAtom));
|
|
23
|
-
const prevValue = get(_currentValueAtom);
|
|
24
|
-
const nextValue = typeof update === "function" ? update(prevValue) : update;
|
|
25
|
-
const onDebounceStart = () => {
|
|
26
|
-
set(_currentValueAtom, nextValue);
|
|
27
|
-
set(isDebouncingAtom, true);
|
|
28
|
-
};
|
|
29
|
-
const onDebounceEnd = () => {
|
|
30
|
-
set(debouncedValueAtom, nextValue);
|
|
31
|
-
set(isDebouncingAtom, false);
|
|
32
|
-
};
|
|
33
|
-
onDebounceStart();
|
|
34
|
-
if (!shouldDebounceOnReset && nextValue === initialValue) {
|
|
35
|
-
onDebounceEnd();
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const nextTimeoutId = setTimeout(() => {
|
|
39
|
-
onDebounceEnd();
|
|
40
|
-
}, delayMilliseconds);
|
|
41
|
-
set(prevTimeoutAtom, nextTimeoutId);
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
const clearTimeoutAtom = atom(null, (get, set, _arg) => {
|
|
45
|
-
clearTimeout(get(prevTimeoutAtom));
|
|
46
|
-
set(isDebouncingAtom, false);
|
|
47
|
-
});
|
|
48
|
-
return {
|
|
49
|
-
currentValueAtom: atom((get) => get(_currentValueAtom)),
|
|
50
|
-
isDebouncingAtom,
|
|
51
|
-
clearTimeoutAtom,
|
|
52
|
-
debouncedValueAtom
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function atomWithRefresh(fn) {
|
|
56
|
-
const refreshCounter = atom(0);
|
|
57
|
-
return atom(
|
|
58
|
-
(get) => {
|
|
59
|
-
get(refreshCounter);
|
|
60
|
-
return fn(get);
|
|
61
|
-
},
|
|
62
|
-
(_, set) => set(refreshCounter, (i) => i + 1)
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
function atomWithListeners(initialValue) {
|
|
66
|
-
const baseAtom = atom(initialValue);
|
|
67
|
-
const listenersAtom = atom([]);
|
|
68
|
-
const anAtom = atom(
|
|
69
|
-
(get) => get(baseAtom),
|
|
70
|
-
(get, set, arg) => {
|
|
71
|
-
const prevVal = get(baseAtom);
|
|
72
|
-
set(baseAtom, arg);
|
|
73
|
-
const newVal = get(baseAtom);
|
|
74
|
-
get(listenersAtom).forEach((callback) => {
|
|
75
|
-
callback(get, set, newVal, prevVal);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
const useListener = (callback) => {
|
|
80
|
-
const setListeners = useSetAtom(listenersAtom);
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
setListeners((prev) => [...prev, callback]);
|
|
83
|
-
return () => setListeners((prev) => {
|
|
84
|
-
const index = prev.indexOf(callback);
|
|
85
|
-
return [...prev.slice(0, index), ...prev.slice(index + 1)];
|
|
86
|
-
});
|
|
87
|
-
}, [setListeners, callback]);
|
|
88
|
-
};
|
|
89
|
-
return [anAtom, useListener];
|
|
90
|
-
}
|
|
91
|
-
export {
|
|
92
|
-
AtomsHydrator,
|
|
93
|
-
atomWithListeners,
|
|
94
|
-
atomWithRefresh,
|
|
95
|
-
atomWithDebounce as default
|
|
96
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useAtom } from "jotai";
|
|
4
|
-
import { TransportProvider } from "../connectquery";
|
|
5
|
-
import { transportAtom } from "../store/GomtmBackendProvider";
|
|
6
|
-
const MtConnectProvider = (props) => {
|
|
7
|
-
const { children } = props;
|
|
8
|
-
const [transport] = useAtom(transportAtom);
|
|
9
|
-
return /* @__PURE__ */ jsx(TransportProvider, { transport, children });
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
MtConnectProvider
|
|
13
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { TransportProvider } from "../connectquery";
|
|
5
|
-
import { createMtConnectTransport } from "../mtmFetcher";
|
|
6
|
-
import { useExtInfo } from "./GomtmProvider";
|
|
7
|
-
const MtConnectProviderV2 = (props) => {
|
|
8
|
-
const { url, children } = props;
|
|
9
|
-
const extInfo = useExtInfo();
|
|
10
|
-
const transport = useMemo(() => {
|
|
11
|
-
return createMtConnectTransport(url || "", extInfo);
|
|
12
|
-
}, [url, extInfo]);
|
|
13
|
-
return /* @__PURE__ */ jsx(TransportProvider, { transport, children });
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
MtConnectProviderV2
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isRoleMatch(currentRoles: string[], allowRoles?: string[]): boolean;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
function isRoleMatch(currentRoles, allowRoles) {
|
|
3
|
-
if (!currentRoles) {
|
|
4
|
-
return true;
|
|
5
|
-
}
|
|
6
|
-
if (!(allowRoles == null ? void 0 : allowRoles.length)) {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
for (const roleName of allowRoles) {
|
|
10
|
-
const ok = currentRoles.find((x) => x == roleName);
|
|
11
|
-
if (ok) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
isRoleMatch
|
|
19
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AnyMessage, Message, PlainMessage } from "@bufbuild/protobuf";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
3
|
-
import { MethodUnaryDescriptor } from "../connectquery";
|
|
4
|
-
export declare function Curd3ListProvider<I extends Message<I>, O extends Message<O>>(props: {
|
|
5
|
-
params: Partial<PlainMessage<I>>;
|
|
6
|
-
methodList: MethodUnaryDescriptor<I, O>;
|
|
7
|
-
} & PropsWithChildren): import("react").JSX.Element;
|
|
8
|
-
export declare const useCurd3List: () => {
|
|
9
|
-
params: PlainMessage<AnyMessage>;
|
|
10
|
-
curd3MethodList: MethodUnaryDescriptor<AnyMessage, AnyMessage> | null;
|
|
11
|
-
};
|
|
12
|
-
export declare const Curd3ListViewDebug: () => import("react").JSX.Element;
|
|
13
|
-
export declare const Curd2ListView: () => import("react").JSX.Element;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __async = (__this, __arguments, generator) => {
|
|
3
|
-
return new Promise((resolve, reject) => {
|
|
4
|
-
var fulfilled = (value) => {
|
|
5
|
-
try {
|
|
6
|
-
step(generator.next(value));
|
|
7
|
-
} catch (e) {
|
|
8
|
-
reject(e);
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
var rejected = (value) => {
|
|
12
|
-
try {
|
|
13
|
-
step(generator.throw(value));
|
|
14
|
-
} catch (e) {
|
|
15
|
-
reject(e);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
-
import { atom, useAtom } from "jotai";
|
|
24
|
-
import { ScopeProvider } from "mtxlib/jotai/ScopeProvider";
|
|
25
|
-
import { AtomsHydrator } from "mtxlib/jotai/jotai-helper";
|
|
26
|
-
import { callUnaryMethod } from "../connectquery";
|
|
27
|
-
import { gomtmBaseUrlAtom, transportAtom } from "./GomtmBackendProvider";
|
|
28
|
-
const curd3ListParamsAtom = atom({});
|
|
29
|
-
const curd3MethodListAtom = atom(null);
|
|
30
|
-
const curd3ItemsAtom = atom((get) => __async(void 0, null, function* () {
|
|
31
|
-
const params = get(curd3ListParamsAtom);
|
|
32
|
-
const methodList = get(curd3MethodListAtom);
|
|
33
|
-
if (!methodList) {
|
|
34
|
-
throw new Error("curd3ItemsAtom, missing methodList");
|
|
35
|
-
}
|
|
36
|
-
const transport = get(transportAtom);
|
|
37
|
-
return yield callUnaryMethod(methodList, params, { transport });
|
|
38
|
-
}));
|
|
39
|
-
function Curd3ListProvider(props) {
|
|
40
|
-
const { params, methodList, children } = props;
|
|
41
|
-
return /* @__PURE__ */ jsx(ScopeProvider, { atoms: [curd3ListParamsAtom, curd3MethodListAtom], children: /* @__PURE__ */ jsx(AtomsHydrator, { atomValues: [
|
|
42
|
-
[curd3ListParamsAtom, params],
|
|
43
|
-
[curd3MethodListAtom, methodList]
|
|
44
|
-
], children }) });
|
|
45
|
-
}
|
|
46
|
-
const useCurd3List = () => {
|
|
47
|
-
const [curd3ListParams] = useAtom(curd3ListParamsAtom);
|
|
48
|
-
const [curd3MethodList] = useAtom(curd3MethodListAtom);
|
|
49
|
-
return {
|
|
50
|
-
params: curd3ListParams,
|
|
51
|
-
curd3MethodList
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
const Curd3ListViewDebug = () => {
|
|
55
|
-
const curd3 = useCurd3List();
|
|
56
|
-
const [gomtmBaseUrl] = useAtom(gomtmBaseUrlAtom);
|
|
57
|
-
return /* @__PURE__ */ jsxs("div", { className: "bg-slate-200 p-2", children: [
|
|
58
|
-
/* @__PURE__ */ jsx("h1", { children: "Curd3ListViewDebug" }),
|
|
59
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
60
|
-
"params: ",
|
|
61
|
-
/* @__PURE__ */ jsx("pre", { children: JSON.stringify(curd3, null, 2) })
|
|
62
|
-
] }),
|
|
63
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
64
|
-
"gomtmBaseUrl:",
|
|
65
|
-
gomtmBaseUrl
|
|
66
|
-
] })
|
|
67
|
-
] });
|
|
68
|
-
};
|
|
69
|
-
const Curd2ListView = () => {
|
|
70
|
-
const [items] = useAtom(curd3ItemsAtom);
|
|
71
|
-
return /* @__PURE__ */ jsx("div", { className: "bg-blue-100 p-2", children: /* @__PURE__ */ jsx("pre", { children: JSON.stringify(items, null, 2) }) });
|
|
72
|
-
};
|
|
73
|
-
export {
|
|
74
|
-
Curd2ListView,
|
|
75
|
-
Curd3ListProvider,
|
|
76
|
-
Curd3ListViewDebug,
|
|
77
|
-
useCurd3List
|
|
78
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Transport } from "@connectrpc/connect";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
3
|
-
export declare const gomtmBaseUrlAtom: import("jotai").PrimitiveAtom<string> & {
|
|
4
|
-
init: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const transportAtom: import("jotai").Atom<Transport>;
|
|
7
|
-
export declare const GomtmBackendProvider: (props: {
|
|
8
|
-
baseUrl?: string;
|
|
9
|
-
} & PropsWithChildren) => import("react").JSX.Element;
|
|
10
|
-
export declare const useGomtmBackend: () => {
|
|
11
|
-
gomtmBaseUrl: string;
|
|
12
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createConnectTransport } from "@connectrpc/connect-web";
|
|
4
|
-
import { Provider, atom, createStore, useAtom } from "jotai";
|
|
5
|
-
import { AtomsHydrator } from "mtxlib/jotai/jotai-helper";
|
|
6
|
-
import { useMemo } from "react";
|
|
7
|
-
import { gomtmFetcher } from "../gomtm-clients-ss";
|
|
8
|
-
const gomtmBaseUrlAtom = atom("");
|
|
9
|
-
const curd3BackendUrlAtom = atom((get) => {
|
|
10
|
-
const value1 = get(gomtmBaseUrlAtom);
|
|
11
|
-
if (value1) {
|
|
12
|
-
return value1;
|
|
13
|
-
}
|
|
14
|
-
if (typeof window == "undefined") {
|
|
15
|
-
console.log("get gomtm backendurl(SSR)", process.env.MTM_BACKEND);
|
|
16
|
-
return process.env.MTM_BACKEND || "";
|
|
17
|
-
}
|
|
18
|
-
return "";
|
|
19
|
-
});
|
|
20
|
-
const transportAtom = atom((get) => {
|
|
21
|
-
const baseUrl = get(curd3BackendUrlAtom);
|
|
22
|
-
return createConnectTransport({
|
|
23
|
-
baseUrl,
|
|
24
|
-
fetch: gomtmFetcher()
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
const GomtmBackendProvider = (props) => {
|
|
28
|
-
const { baseUrl, children } = props;
|
|
29
|
-
const store = useMemo(() => {
|
|
30
|
-
const _store = createStore();
|
|
31
|
-
_store.set(gomtmBaseUrlAtom, baseUrl || "");
|
|
32
|
-
return _store;
|
|
33
|
-
}, [baseUrl]);
|
|
34
|
-
return /* @__PURE__ */ jsx(Provider, { store, children: /* @__PURE__ */ jsx(AtomsHydrator, { atomValues: [
|
|
35
|
-
[gomtmBaseUrlAtom, baseUrl]
|
|
36
|
-
], children }) });
|
|
37
|
-
};
|
|
38
|
-
const useGomtmBackend = () => {
|
|
39
|
-
const [gomtmBaseUrl, setgomtmBaseUrl] = useAtom(gomtmBaseUrlAtom);
|
|
40
|
-
return {
|
|
41
|
-
gomtmBaseUrl
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
export {
|
|
45
|
-
GomtmBackendProvider,
|
|
46
|
-
gomtmBaseUrlAtom,
|
|
47
|
-
transportAtom,
|
|
48
|
-
useGomtmBackend
|
|
49
|
-
};
|
package/dist/esm/utils.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function sha256WithAlphabets(message: any): Promise<string>;
|
package/dist/esm/utils.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __async = (__this, __arguments, generator) => {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
function sha256WithAlphabets(message) {
|
|
22
|
-
return __async(this, null, function* () {
|
|
23
|
-
const buffer = new TextEncoder().encode(message);
|
|
24
|
-
const hashBuffer = yield crypto.subtle.digest("SHA-256", buffer);
|
|
25
|
-
const hashBase64 = btoa(String.fromCharCode(...new Uint8Array(hashBuffer)));
|
|
26
|
-
const alphabetsOnly = hashBase64.replace(/[^a-zA-Z]/g, "");
|
|
27
|
-
return alphabetsOnly;
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
export {
|
|
31
|
-
sha256WithAlphabets
|
|
32
|
-
};
|
package/dist/gomtm
DELETED
|
Binary file
|