@akanjs/ui 0.9.60-canary.8 → 1.0.0
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/README.md +1 -1
- package/cjs/Model/EditModal.js +9 -2
- package/cjs/Signal/GraphQL.js +2 -2
- package/cjs/Signal/RestApi.js +9 -3
- package/esm/Model/EditModal.js +9 -2
- package/esm/Signal/GraphQL.js +3 -3
- package/esm/Signal/RestApi.js +9 -3
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
이 패키지는 akanjs의 서브 라이브러리입니다. 더 자세한 내용은 [@akanjs/cli](https://www.npmjs.com/package/@akanjs/cli)와 [Akan.js Github](https://github.com/akan-team/akanjs)를 참고하세요.
|
package/cjs/Model/EditModal.js
CHANGED
|
@@ -176,8 +176,15 @@ function EditModal({
|
|
|
176
176
|
await storeDo[names.submitModel]({
|
|
177
177
|
...submitOption,
|
|
178
178
|
sliceName,
|
|
179
|
-
onError
|
|
180
|
-
|
|
179
|
+
onError: (e) => {
|
|
180
|
+
onError?.(e);
|
|
181
|
+
submitOption?.onError?.(e);
|
|
182
|
+
},
|
|
183
|
+
onSuccess: (model) => {
|
|
184
|
+
if (typeof onSubmit === "function")
|
|
185
|
+
onSubmit(model);
|
|
186
|
+
void submitOption?.onSuccess?.(model);
|
|
187
|
+
}
|
|
181
188
|
});
|
|
182
189
|
if (onSubmit === "back")
|
|
183
190
|
import_client.router.back();
|
package/cjs/Signal/GraphQL.js
CHANGED
|
@@ -56,7 +56,7 @@ const GraphQLEndpoints = ({ refName, openAll }) => {
|
|
|
56
56
|
const gqlInfos = global.Object.entries(signal.endpoint).sort(([keyA], [keyB]) => keyA > keyB ? 1 : -1).filter(([key, gqlMeta]) => gqlMeta.signalOption?.onlyFor !== "restapi").filter(([key, gqlMeta]) => {
|
|
57
57
|
if (gqlMeta.type !== "query" && gqlMeta.type !== "mutation")
|
|
58
58
|
return false;
|
|
59
|
-
if (gqlMeta.signalOption?.guards
|
|
59
|
+
if ((!gqlMeta.signalOption?.guards || gqlMeta.signalOption.guards.includes("Public")) && tryRoles.includes("Public"))
|
|
60
60
|
return true;
|
|
61
61
|
if ((gqlMeta.signalOption?.guards?.includes("User") || gqlMeta.signalOption?.guards?.includes("Every")) && tryRoles.includes("User"))
|
|
62
62
|
return true;
|
|
@@ -188,7 +188,7 @@ const GraphQLTry = ({ gqlKey, gqlMeta }) => {
|
|
|
188
188
|
setResponse({ status: "loading", data: null });
|
|
189
189
|
const request = { ...JSON.parse(gqlRequest), ...uploadRequest };
|
|
190
190
|
const argData = gqlMeta.args.map((argMeta) => request[argMeta.name]);
|
|
191
|
-
const fetchFn =
|
|
191
|
+
const fetchFn = import_client.fetch[gqlKey].bind(import_client.fetch);
|
|
192
192
|
const data = await fetchFn(...argData, {
|
|
193
193
|
token: tryJwt,
|
|
194
194
|
onError: (data2) => {
|
package/cjs/Signal/RestApi.js
CHANGED
|
@@ -235,7 +235,7 @@ const RestApiTry = ({ prefix, refName, gqlKey, gqlMeta, httpUri = import_base.ba
|
|
|
235
235
|
).toString();
|
|
236
236
|
const requestPath = paramArgMetas.reduce(
|
|
237
237
|
(path2, argMeta) => path2.replace(`:${argMeta.name}`, paramRequest[argMeta.name]),
|
|
238
|
-
`${prefix ? `/${prefix}` : ""}/${path}`
|
|
238
|
+
`${prefix ? `/${prefix}` : ""}/${refName}/${path}`
|
|
239
239
|
) + (queryString.length ? `?${queryString}` : "");
|
|
240
240
|
const requestUrl = `${httpUri}${requestPath}`;
|
|
241
241
|
const getBody = () => {
|
|
@@ -267,8 +267,14 @@ const RestApiTry = ({ prefix, refName, gqlKey, gqlMeta, httpUri = import_base.ba
|
|
|
267
267
|
},
|
|
268
268
|
...method === "POST" ? { body: getBody() } : {}
|
|
269
269
|
});
|
|
270
|
-
const
|
|
271
|
-
|
|
270
|
+
const contentType = res.headers.get("content-type");
|
|
271
|
+
if (contentType?.includes("application/json")) {
|
|
272
|
+
const data = await res.json();
|
|
273
|
+
setResponse({ status: "success", data });
|
|
274
|
+
} else {
|
|
275
|
+
const data = await res.text();
|
|
276
|
+
setResponse({ status: "success", data });
|
|
277
|
+
}
|
|
272
278
|
};
|
|
273
279
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
|
|
274
280
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 text-lg", children: [
|
package/esm/Model/EditModal.js
CHANGED
|
@@ -154,8 +154,15 @@ function EditModal({
|
|
|
154
154
|
await storeDo[names.submitModel]({
|
|
155
155
|
...submitOption,
|
|
156
156
|
sliceName,
|
|
157
|
-
onError
|
|
158
|
-
|
|
157
|
+
onError: (e) => {
|
|
158
|
+
onError?.(e);
|
|
159
|
+
submitOption?.onError?.(e);
|
|
160
|
+
},
|
|
161
|
+
onSuccess: (model) => {
|
|
162
|
+
if (typeof onSubmit === "function")
|
|
163
|
+
onSubmit(model);
|
|
164
|
+
void submitOption?.onSuccess?.(model);
|
|
165
|
+
}
|
|
159
166
|
});
|
|
160
167
|
if (onSubmit === "back")
|
|
161
168
|
router.back();
|
package/esm/Signal/GraphQL.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { isGqlScalar } from "@akanjs/base";
|
|
4
|
-
import { usePage } from "@akanjs/client";
|
|
4
|
+
import { fetch, usePage } from "@akanjs/client";
|
|
5
5
|
import { constantInfo } from "@akanjs/constant";
|
|
6
|
-
import {
|
|
6
|
+
import { getGqlStr, makeRequestExample } from "@akanjs/signal";
|
|
7
7
|
import { st } from "@akanjs/store";
|
|
8
8
|
import { useMemo, useState } from "react";
|
|
9
9
|
import { AiOutlineFileWord, AiOutlineSend } from "react-icons/ai";
|
|
@@ -24,7 +24,7 @@ const GraphQLEndpoints = ({ refName, openAll }) => {
|
|
|
24
24
|
const gqlInfos = global.Object.entries(signal.endpoint).sort(([keyA], [keyB]) => keyA > keyB ? 1 : -1).filter(([key, gqlMeta]) => gqlMeta.signalOption?.onlyFor !== "restapi").filter(([key, gqlMeta]) => {
|
|
25
25
|
if (gqlMeta.type !== "query" && gqlMeta.type !== "mutation")
|
|
26
26
|
return false;
|
|
27
|
-
if (gqlMeta.signalOption?.guards
|
|
27
|
+
if ((!gqlMeta.signalOption?.guards || gqlMeta.signalOption.guards.includes("Public")) && tryRoles.includes("Public"))
|
|
28
28
|
return true;
|
|
29
29
|
if ((gqlMeta.signalOption?.guards?.includes("User") || gqlMeta.signalOption?.guards?.includes("Every")) && tryRoles.includes("User"))
|
|
30
30
|
return true;
|
package/esm/Signal/RestApi.js
CHANGED
|
@@ -203,7 +203,7 @@ const RestApiTry = ({ prefix, refName, gqlKey, gqlMeta, httpUri = baseClientEnv.
|
|
|
203
203
|
).toString();
|
|
204
204
|
const requestPath = paramArgMetas.reduce(
|
|
205
205
|
(path2, argMeta) => path2.replace(`:${argMeta.name}`, paramRequest[argMeta.name]),
|
|
206
|
-
`${prefix ? `/${prefix}` : ""}/${path}`
|
|
206
|
+
`${prefix ? `/${prefix}` : ""}/${refName}/${path}`
|
|
207
207
|
) + (queryString.length ? `?${queryString}` : "");
|
|
208
208
|
const requestUrl = `${httpUri}${requestPath}`;
|
|
209
209
|
const getBody = () => {
|
|
@@ -235,8 +235,14 @@ const RestApiTry = ({ prefix, refName, gqlKey, gqlMeta, httpUri = baseClientEnv.
|
|
|
235
235
|
},
|
|
236
236
|
...method === "POST" ? { body: getBody() } : {}
|
|
237
237
|
});
|
|
238
|
-
const
|
|
239
|
-
|
|
238
|
+
const contentType = res.headers.get("content-type");
|
|
239
|
+
if (contentType?.includes("application/json")) {
|
|
240
|
+
const data = await res.json();
|
|
241
|
+
setResponse({ status: "success", data });
|
|
242
|
+
} else {
|
|
243
|
+
const data = await res.text();
|
|
244
|
+
setResponse({ status: "success", data });
|
|
245
|
+
}
|
|
240
246
|
};
|
|
241
247
|
return /* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-4", children: [
|
|
242
248
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-lg", children: [
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akanjs/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"sourceType": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
+
"homepage": "https://akanjs.com",
|
|
8
9
|
"repository": {
|
|
9
10
|
"type": "git",
|
|
10
11
|
"url": "https://github.com/akan-team/akanjs.git",
|
|
@@ -25,13 +26,13 @@
|
|
|
25
26
|
"jsonwebtoken": "^9.0.2",
|
|
26
27
|
"lodash-move": "^1.1.1",
|
|
27
28
|
"lodash.clamp": "^4.0.3",
|
|
28
|
-
"next": "16.0.
|
|
29
|
+
"next": "16.0.10",
|
|
29
30
|
"next-themes": "0.4.4",
|
|
30
|
-
"react": "19.2.
|
|
31
|
+
"react": "19.2.3",
|
|
31
32
|
"react-copy-to-clipboard": "5.1.0",
|
|
32
33
|
"react-datepicker": "7.5.0",
|
|
33
34
|
"react-device-detect": "^2.2.3",
|
|
34
|
-
"react-dom": "19.2.
|
|
35
|
+
"react-dom": "19.2.3",
|
|
35
36
|
"react-easy-crop": "^5.2.0",
|
|
36
37
|
"react-icons": "^5.4.0",
|
|
37
38
|
"react-simple-pull-to-refresh": "^1.3.3",
|