@appconda/nextjs 1.0.14 → 1.0.15

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 CHANGED
@@ -4,6 +4,7 @@ var nodeFetchNativeWithAgent = require('node-fetch-native-with-agent');
4
4
  var agent = require('node-fetch-native-with-agent/agent');
5
5
  var headers = require('next/headers');
6
6
  var redis = require('redis');
7
+ var nextSafeAction = require('next-safe-action');
7
8
 
8
9
  /******************************************************************************
9
10
  Copyright (c) Microsoft Corporation.
@@ -13233,6 +13234,48 @@ function getSDKForCurrentUser() {
13233
13234
  });
13234
13235
  }
13235
13236
 
13237
+ const actionClient = nextSafeAction.createSafeActionClient({
13238
+ handleServerError(e) {
13239
+ /* if (
13240
+ e instanceof ResourceNotFoundError ||
13241
+ e instanceof AuthorizationError ||
13242
+ e instanceof InvalidInputError ||
13243
+ e instanceof UnknownError ||
13244
+ e instanceof AuthenticationError ||
13245
+ e instanceof OperationNotAllowedError ||
13246
+ e instanceof AppcondaException
13247
+ ) {
13248
+ return e.message;
13249
+ } */
13250
+ // eslint-disable-next-line no-console -- This error needs to be logged for debugging server-side errors
13251
+ console.error("SERVER ERROR: ", e);
13252
+ return nextSafeAction.DEFAULT_SERVER_ERROR_MESSAGE;
13253
+ },
13254
+ });
13255
+ /* export const authenticatedActionClient = actionClient.use(async ({ next }) => {
13256
+ const session = await getServerSession(authOptions);
13257
+ if (!session?.user) {
13258
+ throw new AuthenticationError("Not authenticated");
13259
+ }
13260
+
13261
+ const userId = session.user.id;
13262
+
13263
+ const user = await getUser(userId);
13264
+ if (!user) {
13265
+ throw new AuthorizationError("User not found");
13266
+ }
13267
+
13268
+ return next({ ctx: { user } });
13269
+ });
13270
+ */
13271
+
13272
+ const getAllNodesAction = actionClient
13273
+ // .schema(listModelsSchema)
13274
+ .action((_a) => __awaiter(void 0, [_a], void 0, function* ({ parsedInput }) {
13275
+ const { node } = yield getSDKForCurrentUser();
13276
+ return yield node.GetAllNodes();
13277
+ }));
13278
+
13236
13279
  exports.Account = Account;
13237
13280
  exports.AppcondaException = AppcondaException;
13238
13281
  exports.Applets = Applets;
@@ -13252,5 +13295,6 @@ exports.Storage = Storage;
13252
13295
  exports.Teams = Teams;
13253
13296
  exports.Users = Users;
13254
13297
  exports.Waitlist = Waitlist;
13298
+ exports.getAllNodesAction = getAllNodesAction;
13255
13299
  exports.getSDKForCurrentUser = getSDKForCurrentUser;
13256
13300
  //# sourceMappingURL=sdk.js.map