@appconda/nextjs 1.0.65 → 1.0.66

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.
@@ -14,6 +14,7 @@ import { Permissions } from "./services/permissions";
14
14
  import { WaitlistService } from "./modules/waitlist/service";
15
15
  import { Account } from "./modules/account/service";
16
16
  import { Node } from "./modules/ai/node/service";
17
+ import { AgentService } from "./modules/agent/service";
17
18
  export declare function getSDKForCurrentUser(): Promise<{
18
19
  currentUser: import("./modules/account/types").User<import("./modules/account/types").Preferences>;
19
20
  accounts: Account;
@@ -32,4 +33,5 @@ export declare function getSDKForCurrentUser(): Promise<{
32
33
  configuration: Configuration;
33
34
  node: Node;
34
35
  waitlist: WaitlistService;
36
+ agent: AgentService;
35
37
  }>;
@@ -16,6 +16,7 @@ import { Permissions } from "./services/permissions";
16
16
  import { WaitlistService } from "./modules/waitlist/service";
17
17
  import { Account } from "./modules/account/service";
18
18
  import { Node } from "./modules/ai/node/service";
19
+ import { AgentService } from "./modules/agent/service";
19
20
  export async function getSDKForCurrentUser() {
20
21
  const adminClient = await getAppcondaClient();
21
22
  const c = await cookies();
@@ -42,6 +43,7 @@ export async function getSDKForCurrentUser() {
42
43
  //const acl = new Acl(adminClient);
43
44
  const node = new Node(adminClient);
44
45
  const waitlist = new WaitlistService(adminClient);
46
+ const agent = new AgentService(adminClient);
45
47
  return {
46
48
  currentUser,
47
49
  accounts,
@@ -60,6 +62,7 @@ export async function getSDKForCurrentUser() {
60
62
  configuration,
61
63
  // acl,
62
64
  node,
63
- waitlist
65
+ waitlist,
66
+ agent
64
67
  };
65
68
  }
@@ -0,0 +1,25 @@
1
+ import { Agent } from './types';
2
+ export declare const ListAgents: import("next-safe-action").SafeActionFn<string, undefined, readonly [], {
3
+ formErrors: string[];
4
+ fieldErrors: {};
5
+ }, readonly [], Agent[]>;
6
+ export declare const CreateAgent: import("next-safe-action").SafeActionFn<string, import("zod").ZodObject<{
7
+ id: import("zod").ZodOptional<import("zod").ZodString>;
8
+ name: import("zod").ZodString;
9
+ modelId: import("zod").ZodString;
10
+ }, "strip", import("zod").ZodTypeAny, {
11
+ name?: string;
12
+ id?: string;
13
+ modelId?: string;
14
+ }, {
15
+ name?: string;
16
+ id?: string;
17
+ modelId?: string;
18
+ }>, readonly [], {
19
+ formErrors: string[];
20
+ fieldErrors: {
21
+ name?: string[];
22
+ id?: string[];
23
+ modelId?: string[];
24
+ };
25
+ }, readonly [], Agent>;
@@ -0,0 +1,28 @@
1
+ 'use server';
2
+ import { actionClient } from '../../actions/actionClient';
3
+ import { getSDKForCurrentUser } from '../../getSDKForCurrentUser';
4
+ import { CreateAgentSchema } from './schema';
5
+ export const ListAgents = actionClient
6
+ //.schema(ListWaitlistSignupsSchema)
7
+ .action(async ({ parsedInput }) => {
8
+ try {
9
+ const { agent } = await getSDKForCurrentUser();
10
+ return await agent.ListAgents(); // typo: Wiatlist mi?
11
+ }
12
+ catch (error) {
13
+ console.error('Error in ListWaitlistSignups:', error);
14
+ throw new Error('Failed to fetch ListWaitlistSignups');
15
+ }
16
+ });
17
+ export const CreateAgent = actionClient
18
+ .schema(CreateAgentSchema)
19
+ .action(async ({ parsedInput }) => {
20
+ try {
21
+ const { agent } = await getSDKForCurrentUser();
22
+ return await agent.CreateAgent(parsedInput);
23
+ }
24
+ catch (error) {
25
+ console.error('Error in ListWaitlists:', error);
26
+ throw new Error('Failed to fetch ListWaitlists');
27
+ }
28
+ });
@@ -0,0 +1,4 @@
1
+ export * from './action';
2
+ export * from './schema';
3
+ export * from './service';
4
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ export * from './action';
2
+ export * from './schema';
3
+ export * from './service';
4
+ export * from './types';
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ export declare const CreateAgentSchema: z.ZodObject<{
3
+ id: z.ZodOptional<z.ZodString>;
4
+ name: z.ZodString;
5
+ modelId: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ name?: string;
8
+ id?: string;
9
+ modelId?: string;
10
+ }, {
11
+ name?: string;
12
+ id?: string;
13
+ modelId?: string;
14
+ }>;
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export const CreateAgentSchema = z.object({
3
+ id: z.string().optional(),
4
+ name: z.string(),
5
+ modelId: z.string()
6
+ });
@@ -0,0 +1,9 @@
1
+ import z from "zod";
2
+ import { ServiceClient } from "../../service-client";
3
+ import { CreateAgentSchema } from "./schema";
4
+ import { Agent } from "./types";
5
+ export declare class AgentService extends ServiceClient {
6
+ protected getServiceName(): string;
7
+ CreateAgent(payload: z.infer<typeof CreateAgentSchema>): Promise<Agent>;
8
+ ListAgents(): Promise<Agent[]>;
9
+ }
@@ -0,0 +1,12 @@
1
+ import { ServiceClient } from "../../service-client";
2
+ export class AgentService extends ServiceClient {
3
+ getServiceName() {
4
+ return 'com.appconda.service.agent';
5
+ }
6
+ async CreateAgent(payload) {
7
+ return await this.actionCall('CreateAgent', payload);
8
+ }
9
+ async ListAgents() {
10
+ return await this.actionCall('CreateAgent', {});
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ export type Agent = {
2
+ id: string;
3
+ agent_key: string;
4
+ name: string;
5
+ description: string;
6
+ aiModelId: string;
7
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
1
  export * from './waitlist';
2
2
  export * from './account';
3
3
  export * from './ai';
4
+ export * from './agent';
@@ -1,3 +1,4 @@
1
1
  export * from './waitlist';
2
2
  export * from './account';
3
3
  export * from './ai';
4
+ export * from './agent';
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.65",
5
+ "version": "1.0.66",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -16,6 +16,7 @@ import { Permissions } from "./services/permissions";
16
16
  import { WaitlistService } from "./modules/waitlist/service";
17
17
  import { Account } from "./modules/account/service";
18
18
  import { Node } from "./modules/ai/node/service";
19
+ import { AgentService } from "./modules/agent/service";
19
20
 
20
21
  export async function getSDKForCurrentUser() {
21
22
  const adminClient = await getAppcondaClient();
@@ -54,6 +55,7 @@ export async function getSDKForCurrentUser() {
54
55
 
55
56
  const node = new Node(adminClient);
56
57
  const waitlist = new WaitlistService(adminClient);
58
+ const agent = new AgentService(adminClient);
57
59
 
58
60
  return {
59
61
  currentUser,
@@ -73,6 +75,7 @@ export async function getSDKForCurrentUser() {
73
75
  configuration,
74
76
  // acl,
75
77
  node,
76
- waitlist
78
+ waitlist,
79
+ agent
77
80
  }
78
81
  }
@@ -0,0 +1,39 @@
1
+ 'use server';
2
+
3
+
4
+ import { actionClient } from '../../actions/actionClient';
5
+ import { getSDKForCurrentUser } from '../../getSDKForCurrentUser';
6
+ import { getSDKForService } from '../../getSDKForService';
7
+ import { CreateAgentSchema } from './schema';
8
+ import { Agent } from './types';
9
+
10
+
11
+ export const ListAgents = actionClient
12
+ //.schema(ListWaitlistSignupsSchema)
13
+ .action(async ({ parsedInput }): Promise<Agent[]> => {
14
+ try {
15
+
16
+ const { agent } = await getSDKForCurrentUser();
17
+ return await agent.ListAgents(); // typo: Wiatlist mi?
18
+ } catch (error) {
19
+ console.error('Error in ListWaitlistSignups:', error);
20
+ throw new Error('Failed to fetch ListWaitlistSignups');
21
+ }
22
+ });
23
+
24
+
25
+
26
+ export const CreateAgent = actionClient
27
+ .schema(CreateAgentSchema)
28
+ .action(async ({ parsedInput }): Promise<Agent> => {
29
+ try {
30
+
31
+ const { agent } = await getSDKForCurrentUser();
32
+ return await agent.CreateAgent(parsedInput);
33
+
34
+ } catch (error) {
35
+ console.error('Error in ListWaitlists:', error);
36
+ throw new Error('Failed to fetch ListWaitlists');
37
+ }
38
+ });
39
+
@@ -0,0 +1,4 @@
1
+ export * from './action';
2
+ export * from './schema';
3
+ export * from './service';
4
+ export * from './types';
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+
3
+ export const CreateAgentSchema = z.object({
4
+ id: z.string().optional(),
5
+ name: z.string(),
6
+ modelId: z.string()
7
+ });
@@ -0,0 +1,21 @@
1
+
2
+ import z from "zod";
3
+ import { ServiceClient } from "../../service-client";
4
+ import { CreateAgentSchema } from "./schema";
5
+ import { Agent } from "./types";
6
+
7
+
8
+ export class AgentService extends ServiceClient {
9
+ protected getServiceName(): string {
10
+ return 'com.appconda.service.agent';
11
+ }
12
+
13
+ public async CreateAgent(payload: z.infer<typeof CreateAgentSchema>): Promise<Agent> {
14
+ return await this.actionCall('CreateAgent', payload);
15
+ }
16
+
17
+ public async ListAgents(): Promise<Agent[]> {
18
+ return await this.actionCall('CreateAgent', {});
19
+ }
20
+
21
+ }
@@ -0,0 +1,9 @@
1
+
2
+ export type Agent = {
3
+ id: string;
4
+ agent_key: string;
5
+ name: string;
6
+ description: string;
7
+ aiModelId: string;
8
+ }
9
+
@@ -1,3 +1,4 @@
1
1
  export * from './waitlist';
2
2
  export * from './account';
3
- export * from './ai';
3
+ export * from './ai';
4
+ export * from './agent';