@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/esm/sdk.js CHANGED
@@ -2,6 +2,7 @@ import { FormData, File, fetch } from 'node-fetch-native-with-agent';
2
2
  import { createAgent } from 'node-fetch-native-with-agent/agent';
3
3
  import { cookies } from 'next/headers';
4
4
  import { createClient } from 'redis';
5
+ import { createSafeActionClient, DEFAULT_SERVER_ERROR_MESSAGE } from 'next-safe-action';
5
6
 
6
7
  /******************************************************************************
7
8
  Copyright (c) Microsoft Corporation.
@@ -13231,5 +13232,47 @@ function getSDKForCurrentUser() {
13231
13232
  });
13232
13233
  }
13233
13234
 
13234
- export { Account, AppcondaException, Applets, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, Compression, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, Health, ID, ImageFormat, ImageGravity, IndexType, Locale, Messaging, MessagingProviderType, Name, OAuthProvider, PasswordHash, Permission, Query, RelationMutate, RelationshipType, Role, Runtime, SmtpEncryption, Storage, Teams, Users, Waitlist, getSDKForCurrentUser };
13235
+ const actionClient = createSafeActionClient({
13236
+ handleServerError(e) {
13237
+ /* if (
13238
+ e instanceof ResourceNotFoundError ||
13239
+ e instanceof AuthorizationError ||
13240
+ e instanceof InvalidInputError ||
13241
+ e instanceof UnknownError ||
13242
+ e instanceof AuthenticationError ||
13243
+ e instanceof OperationNotAllowedError ||
13244
+ e instanceof AppcondaException
13245
+ ) {
13246
+ return e.message;
13247
+ } */
13248
+ // eslint-disable-next-line no-console -- This error needs to be logged for debugging server-side errors
13249
+ console.error("SERVER ERROR: ", e);
13250
+ return DEFAULT_SERVER_ERROR_MESSAGE;
13251
+ },
13252
+ });
13253
+ /* export const authenticatedActionClient = actionClient.use(async ({ next }) => {
13254
+ const session = await getServerSession(authOptions);
13255
+ if (!session?.user) {
13256
+ throw new AuthenticationError("Not authenticated");
13257
+ }
13258
+
13259
+ const userId = session.user.id;
13260
+
13261
+ const user = await getUser(userId);
13262
+ if (!user) {
13263
+ throw new AuthorizationError("User not found");
13264
+ }
13265
+
13266
+ return next({ ctx: { user } });
13267
+ });
13268
+ */
13269
+
13270
+ const getAllNodesAction = actionClient
13271
+ // .schema(listModelsSchema)
13272
+ .action((_a) => __awaiter(void 0, [_a], void 0, function* ({ parsedInput }) {
13273
+ const { node } = yield getSDKForCurrentUser();
13274
+ return yield node.GetAllNodes();
13275
+ }));
13276
+
13277
+ export { Account, AppcondaException, Applets, AuthenticationFactor, AuthenticatorType, Avatars, Browser, Client, Compression, CreditCard, Databases, ExecutionMethod, Flag, Functions, Graphql, Health, ID, ImageFormat, ImageGravity, IndexType, Locale, Messaging, MessagingProviderType, Name, OAuthProvider, PasswordHash, Permission, Query, RelationMutate, RelationshipType, Role, Runtime, SmtpEncryption, Storage, Teams, Users, Waitlist, getAllNodesAction, getSDKForCurrentUser };
13235
13278
  //# sourceMappingURL=sdk.js.map