@appconda/nextjs 1.0.14 → 1.0.16
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/cjs/sdk.js +44 -0
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +44 -1
- package/dist/esm/sdk.js.map +1 -1
- package/dist/iife/sdk.js +45 -2
- package/package.json +2 -1
- package/src/actions/actionClient.ts +42 -0
- package/src/actions/index.ts +1 -0
- package/src/actions/nodes.ts +12 -0
- package/src/index.ts +1 -0
package/dist/iife/sdk.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
(function (exports, nodeFetchNativeWithAgent, agent, headers, redis) {
|
1
|
+
(function (exports, nodeFetchNativeWithAgent, agent, headers, redis, nextSafeAction) {
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
/******************************************************************************
|
@@ -13229,6 +13229,48 @@
|
|
13229
13229
|
});
|
13230
13230
|
}
|
13231
13231
|
|
13232
|
+
const actionClient = nextSafeAction.createSafeActionClient({
|
13233
|
+
handleServerError(e) {
|
13234
|
+
/* if (
|
13235
|
+
e instanceof ResourceNotFoundError ||
|
13236
|
+
e instanceof AuthorizationError ||
|
13237
|
+
e instanceof InvalidInputError ||
|
13238
|
+
e instanceof UnknownError ||
|
13239
|
+
e instanceof AuthenticationError ||
|
13240
|
+
e instanceof OperationNotAllowedError ||
|
13241
|
+
e instanceof AppcondaException
|
13242
|
+
) {
|
13243
|
+
return e.message;
|
13244
|
+
} */
|
13245
|
+
// eslint-disable-next-line no-console -- This error needs to be logged for debugging server-side errors
|
13246
|
+
console.error("SERVER ERROR: ", e);
|
13247
|
+
return nextSafeAction.DEFAULT_SERVER_ERROR_MESSAGE;
|
13248
|
+
},
|
13249
|
+
});
|
13250
|
+
/* export const authenticatedActionClient = actionClient.use(async ({ next }) => {
|
13251
|
+
const session = await getServerSession(authOptions);
|
13252
|
+
if (!session?.user) {
|
13253
|
+
throw new AuthenticationError("Not authenticated");
|
13254
|
+
}
|
13255
|
+
|
13256
|
+
const userId = session.user.id;
|
13257
|
+
|
13258
|
+
const user = await getUser(userId);
|
13259
|
+
if (!user) {
|
13260
|
+
throw new AuthorizationError("User not found");
|
13261
|
+
}
|
13262
|
+
|
13263
|
+
return next({ ctx: { user } });
|
13264
|
+
});
|
13265
|
+
*/
|
13266
|
+
|
13267
|
+
const getAllNodesAction = actionClient
|
13268
|
+
// .schema(listModelsSchema)
|
13269
|
+
.action((_a) => __awaiter(void 0, [_a], void 0, function* ({ parsedInput }) {
|
13270
|
+
const { node } = yield getSDKForCurrentUser();
|
13271
|
+
return yield node.GetAllNodes();
|
13272
|
+
}));
|
13273
|
+
|
13232
13274
|
exports.Account = Account;
|
13233
13275
|
exports.AppcondaException = AppcondaException;
|
13234
13276
|
exports.Applets = Applets;
|
@@ -13248,8 +13290,9 @@
|
|
13248
13290
|
exports.Teams = Teams;
|
13249
13291
|
exports.Users = Users;
|
13250
13292
|
exports.Waitlist = Waitlist;
|
13293
|
+
exports.getAllNodesAction = getAllNodesAction;
|
13251
13294
|
exports.getSDKForCurrentUser = getSDKForCurrentUser;
|
13252
13295
|
|
13253
13296
|
Object.defineProperty(exports, '__esModule', { value: true });
|
13254
13297
|
|
13255
|
-
})(this.Appconda = this.Appconda || {}, nodeFetchNativeWithAgent, agent, headers, redis);
|
13298
|
+
})(this.Appconda = this.Appconda || {}, nodeFetchNativeWithAgent, agent, headers, redis, nextSafeAction);
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@appconda/nextjs",
|
3
3
|
"homepage": "https://appconda.io/support",
|
4
4
|
"description": "Appconda is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
5
|
-
"version": "1.0.
|
5
|
+
"version": "1.0.16",
|
6
6
|
"license": "BSD-3-Clause",
|
7
7
|
"main": "dist/cjs/sdk.js",
|
8
8
|
"exports": {
|
@@ -36,6 +36,7 @@
|
|
36
36
|
"unpkg": "dist/iife/sdk.js",
|
37
37
|
"dependencies": {
|
38
38
|
"next": "^15.2.3",
|
39
|
+
"next-safe-action": "^7.10.4",
|
39
40
|
"node-fetch-native-with-agent": "^1.7.2",
|
40
41
|
"redis": "^4.7.0",
|
41
42
|
"zod": "^3.24.2"
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
import { DEFAULT_SERVER_ERROR_MESSAGE, createSafeActionClient } from "next-safe-action";
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
export const actionClient = createSafeActionClient({
|
8
|
+
handleServerError(e: Error) {
|
9
|
+
/* if (
|
10
|
+
e instanceof ResourceNotFoundError ||
|
11
|
+
e instanceof AuthorizationError ||
|
12
|
+
e instanceof InvalidInputError ||
|
13
|
+
e instanceof UnknownError ||
|
14
|
+
e instanceof AuthenticationError ||
|
15
|
+
e instanceof OperationNotAllowedError ||
|
16
|
+
e instanceof AppcondaException
|
17
|
+
) {
|
18
|
+
return e.message;
|
19
|
+
} */
|
20
|
+
|
21
|
+
// eslint-disable-next-line no-console -- This error needs to be logged for debugging server-side errors
|
22
|
+
console.error("SERVER ERROR: ", e);
|
23
|
+
return DEFAULT_SERVER_ERROR_MESSAGE;
|
24
|
+
},
|
25
|
+
});
|
26
|
+
|
27
|
+
/* export const authenticatedActionClient = actionClient.use(async ({ next }) => {
|
28
|
+
const session = await getServerSession(authOptions);
|
29
|
+
if (!session?.user) {
|
30
|
+
throw new AuthenticationError("Not authenticated");
|
31
|
+
}
|
32
|
+
|
33
|
+
const userId = session.user.id;
|
34
|
+
|
35
|
+
const user = await getUser(userId);
|
36
|
+
if (!user) {
|
37
|
+
throw new AuthorizationError("User not found");
|
38
|
+
}
|
39
|
+
|
40
|
+
return next({ ctx: { user } });
|
41
|
+
});
|
42
|
+
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './nodes';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
'use server';
|
2
|
+
|
3
|
+
import { z } from "zod";
|
4
|
+
import { actionClient } from "./actionClient";
|
5
|
+
import { getSDKForCurrentUser } from "@/getSDKForCurrentUser";
|
6
|
+
|
7
|
+
export const getAllNodesAction = actionClient
|
8
|
+
// .schema(listModelsSchema)
|
9
|
+
.action(async ({ parsedInput }) => {
|
10
|
+
const { node } = await getSDKForCurrentUser();
|
11
|
+
return await node.GetAllNodes();
|
12
|
+
});
|
package/src/index.ts
CHANGED
@@ -36,3 +36,4 @@ export { ImageFormat } from './enums/image-format';
|
|
36
36
|
export { PasswordHash } from './enums/password-hash';
|
37
37
|
export { MessagingProviderType } from './enums/messaging-provider-type';
|
38
38
|
export { getSDKForCurrentUser } from './getSDKForCurrentUser';
|
39
|
+
export * from './actions';
|