@appconda/nextjs 1.0.23 → 1.0.25

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.
@@ -1,4 +1,4 @@
1
- import { Registry } from "@/lib/Registry";
1
+ import { Registry } from "./lib/Registry";
2
2
  import { Cache } from "./Cache";
3
3
  export declare const registry: Registry;
4
4
  export declare class Services {
package/dist/Services.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Registry } from "@/lib/Registry";
1
+ import { Registry } from "./lib/Registry";
2
2
  import { createClient } from 'redis';
3
3
  import { Redis } from "./Cache/Adapters/Redis";
4
4
  import { Cache } from "./Cache";
@@ -1,9 +1,15 @@
1
1
  'use server';
2
2
  import { actionClient } from "./actionClient";
3
- import { getSDKForCurrentUser } from "@/getSDKForCurrentUser";
3
+ import { getSDKForCurrentUser } from '../getSDKForCurrentUser';
4
4
  export const getAllNodesAction = actionClient
5
5
  // .schema(listModelsSchema)
6
6
  .action(async ({ parsedInput }) => {
7
- const { node } = await getSDKForCurrentUser();
8
- return await node.GetAllNodes();
7
+ try {
8
+ const { node } = await getSDKForCurrentUser();
9
+ return await node.GetAllNodes();
10
+ }
11
+ catch (error) {
12
+ console.error('Error in getAllNodesAction:', error);
13
+ throw new Error('Failed to fetch nodes');
14
+ }
9
15
  });
@@ -1,4 +1,4 @@
1
- import { Services } from "@/Services";
1
+ import { Services } from '../Services';
2
2
  function stableStringify(obj) {
3
3
  if (obj && typeof obj === "object" && !Array.isArray(obj)) {
4
4
  return `{${Object.keys(obj).sort().map(key => `"${key}":${stableStringify(obj[key])}`).join(",")}}`;
@@ -1,4 +1,4 @@
1
- import { Services } from "@/Services";
1
+ import { Services } from '../Services';
2
2
  export function Invalidate(keys) {
3
3
  return function (target, propertyKey, descriptor) {
4
4
  const originalMethod = descriptor.value;
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.23",
5
+ "version": "1.0.25",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -30,7 +30,9 @@
30
30
  "next": "^15.2.3",
31
31
  "next-safe-action": "^7.10.4",
32
32
  "node-fetch-native-with-agent": "^1.7.2",
33
- "redis": "^4.7.0",
34
33
  "zod": "^3.24.2"
34
+ },
35
+ "peerDependencies": {
36
+ "redis": "^4.7.0"
35
37
  }
36
38
  }
package/src/Services.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Registry } from "@/lib/Registry";
1
+ import { Registry } from "./lib/Registry";
2
2
  import { createClient } from 'redis';
3
3
  import { Redis } from "./Cache/Adapters/Redis";
4
4
  import { Cache } from "./Cache";
@@ -2,11 +2,16 @@
2
2
 
3
3
  import { z } from "zod";
4
4
  import { actionClient } from "./actionClient";
5
- import { getSDKForCurrentUser } from "@/getSDKForCurrentUser";
5
+ import { getSDKForCurrentUser } from '../getSDKForCurrentUser';
6
6
 
7
7
  export const getAllNodesAction = actionClient
8
8
  // .schema(listModelsSchema)
9
9
  .action(async ({ parsedInput }) => {
10
- const { node } = await getSDKForCurrentUser();
11
- return await node.GetAllNodes();
10
+ try {
11
+ const { node } = await getSDKForCurrentUser();
12
+ return await node.GetAllNodes();
13
+ } catch (error) {
14
+ console.error('Error in getAllNodesAction:', error);
15
+ throw new Error('Failed to fetch nodes');
16
+ }
12
17
  });
@@ -1,22 +1,22 @@
1
- import { Services } from "@/Services";
1
+ import { Services } from '../Services';
2
2
 
3
3
  function stableStringify(obj: any): string {
4
4
  if (obj && typeof obj === "object" && !Array.isArray(obj)) {
5
- return `{${Object.keys(obj).sort().map(key => `"${key}":${stableStringify(obj[key])}`).join(",")}}`;
5
+ return `{${Object.keys(obj).sort().map(key => `"${key}":${stableStringify(obj[key])}`).join(",")}}`;
6
6
  }
7
7
  return JSON.stringify(obj);
8
- }
9
-
10
- function generateCacheKey(...args: any[]): string {
8
+ }
9
+
10
+ function generateCacheKey(...args: any[]): string {
11
11
  return stableStringify(args);
12
- }
13
-
14
-
15
- // console.log(generateCacheKey("user", 123, true, { role: "admin", permissions: ["read", "write"] }));
16
- // console.log(generateCacheKey("user", 123, true, { permissions: ["read", "write"], role: "admin" }));
12
+ }
13
+
14
+
15
+ // console.log(generateCacheKey("user", 123, true, { role: "admin", permissions: ["read", "write"] }));
16
+ // console.log(generateCacheKey("user", 123, true, { permissions: ["read", "write"], role: "admin" }));
17
+
17
18
 
18
19
 
19
-
20
20
  export function Cache(/* cacheKey?: string | string[] */) {
21
21
  return function (
22
22
  target: any,
@@ -1,4 +1,4 @@
1
- import { Services } from "@/Services";
1
+ import { Services } from '../Services';
2
2
 
3
3
  export function Invalidate(keys: string | string[]) {
4
4
  return function (
package/tsconfig.json CHANGED
@@ -20,9 +20,6 @@
20
20
  "experimentalDecorators": true,
21
21
  "emitDecoratorMetadata": true,
22
22
  "outDir": "./dist",
23
- "paths": {
24
- "@/*": ["./*"]
25
- }
26
23
  },
27
24
  "compileOnSave": false,
28
25
  "exclude": ["node_modules", "dist"],
@@ -1,4 +1,4 @@
1
- import { Registry } from "@/lib/Registry";
1
+ import { Registry } from "./lib/Registry";
2
2
  import { Cache } from "./Cache";
3
3
  export declare const registry: Registry;
4
4
  export declare class Services {
package/rollup.config.js DELETED
@@ -1,27 +0,0 @@
1
- import pkg from "./package.json";
2
- import typescript from "@rollup/plugin-typescript";
3
-
4
- export default {
5
- external: Object.keys(pkg.dependencies ?? {}),
6
- input: "src/index.ts",
7
- plugins: [typescript()],
8
- output: [
9
- {
10
- format: "cjs",
11
- file: pkg.main,
12
- esModule: false,
13
- sourcemap: true,
14
- },
15
- {
16
- format: "es",
17
- file: pkg.module,
18
- sourcemap: true,
19
- },
20
- {
21
- format: "iife",
22
- file: pkg.jsdelivr,
23
- name: "Appconda",
24
- extend: true,
25
- },
26
- ],
27
- };