@appconda/nextjs 1.0.71 → 1.0.73

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/index.d.ts CHANGED
@@ -36,5 +36,6 @@ export { PasswordHash } from './enums/password-hash';
36
36
  export { MessagingProviderType } from './enums/messaging-provider-type';
37
37
  export { getSDKForCurrentUser } from './getSDKForCurrentUser';
38
38
  export { getSDKForService } from './getSDKForService';
39
+ export { getAppcondaClient } from './getAppcondaClient';
39
40
  export * from './modules';
40
41
  export type { SafeActionFn } from 'next-safe-action';
package/dist/index.js CHANGED
@@ -34,4 +34,5 @@ export { PasswordHash } from './enums/password-hash';
34
34
  export { MessagingProviderType } from './enums/messaging-provider-type';
35
35
  export { getSDKForCurrentUser } from './getSDKForCurrentUser';
36
36
  export { getSDKForService } from './getSDKForService';
37
+ export { getAppcondaClient } from './getAppcondaClient';
37
38
  export * from './modules';
@@ -1,4 +1,4 @@
1
- import { Agent } from './types';
1
+ import { Agent, AIModel } from './types';
2
2
  export declare const ListAgents: import("next-safe-action").SafeActionFn<string, undefined, readonly [], {
3
3
  formErrors: string[];
4
4
  fieldErrors: {};
@@ -39,3 +39,15 @@ export declare const ListModelProviders: import("next-safe-action").SafeActionFn
39
39
  formErrors: string[];
40
40
  fieldErrors: {};
41
41
  }, readonly [], Agent[]>;
42
+ export declare const ListModels: import("next-safe-action").SafeActionFn<string, import("zod").ZodObject<{
43
+ modelProviderId: import("zod").ZodString;
44
+ }, "strip", import("zod").ZodTypeAny, {
45
+ modelProviderId?: string;
46
+ }, {
47
+ modelProviderId?: string;
48
+ }>, readonly [], {
49
+ formErrors: string[];
50
+ fieldErrors: {
51
+ modelProviderId?: string[];
52
+ };
53
+ }, readonly [], AIModel[]>;
@@ -1,7 +1,7 @@
1
1
  'use server';
2
2
  import { actionClient } from '../../actions/actionClient';
3
3
  import { getSDKForCurrentUser } from '../../getSDKForCurrentUser';
4
- import { CreateAgentSchema, GetAgentSchema } from './schema';
4
+ import { CreateAgentSchema, GetAgentSchema, ListModelsSchema } from './schema';
5
5
  export const ListAgents = actionClient
6
6
  //.schema(ListWaitlistSignupsSchema)
7
7
  .action(async ({ parsedInput }) => {
@@ -49,3 +49,15 @@ export const ListModelProviders = actionClient
49
49
  throw new Error('Failed to fetch ListModelProviders');
50
50
  }
51
51
  });
52
+ export const ListModels = actionClient
53
+ .schema(ListModelsSchema)
54
+ .action(async ({ parsedInput }) => {
55
+ try {
56
+ const { agent } = await getSDKForCurrentUser();
57
+ return await agent.ListModels(parsedInput);
58
+ }
59
+ catch (error) {
60
+ console.error('Error in ListModels:', error);
61
+ throw new Error('Failed to fetch ListModels');
62
+ }
63
+ });
@@ -39,3 +39,10 @@ export declare const DeleteAgentSchema: z.ZodObject<{
39
39
  }, {
40
40
  id?: string;
41
41
  }>;
42
+ export declare const ListModelsSchema: z.ZodObject<{
43
+ modelProviderId: z.ZodString;
44
+ }, "strip", z.ZodTypeAny, {
45
+ modelProviderId?: string;
46
+ }, {
47
+ modelProviderId?: string;
48
+ }>;
@@ -15,3 +15,6 @@ export const UpdateAgentSchema = z.object({
15
15
  export const DeleteAgentSchema = z.object({
16
16
  id: z.string()
17
17
  });
18
+ export const ListModelsSchema = z.object({
19
+ modelProviderId: z.string()
20
+ });
@@ -1,11 +1,12 @@
1
1
  import z from "zod";
2
2
  import { ServiceClient } from "../../service-client";
3
- import { CreateAgentSchema, GetAgentSchema } from "./schema";
4
- import { Agent } from "./types";
3
+ import { CreateAgentSchema, GetAgentSchema, ListModelsSchema } from "./schema";
4
+ import { Agent, AIModel } from "./types";
5
5
  export declare class AgentService extends ServiceClient {
6
6
  protected getServiceName(): string;
7
7
  CreateAgent(payload: z.infer<typeof CreateAgentSchema>): Promise<Agent>;
8
8
  GetAgent(payload: z.infer<typeof GetAgentSchema>): Promise<Agent>;
9
9
  ListAgents(): Promise<Agent[]>;
10
10
  ListModelProviders(): Promise<Agent[]>;
11
+ ListModels(payload: z.infer<typeof ListModelsSchema>): Promise<AIModel[]>;
11
12
  }
@@ -15,4 +15,7 @@ export class AgentService extends ServiceClient {
15
15
  async ListModelProviders() {
16
16
  return await this.actionCall('ListModelProviders', {});
17
17
  }
18
+ async ListModels(payload) {
19
+ return await this.actionCall('ListModels', payload);
20
+ }
18
21
  }
@@ -5,3 +5,7 @@ export type Agent = {
5
5
  description: string;
6
6
  aiModelId: string;
7
7
  };
8
+ export type AIModel = {
9
+ id: string;
10
+ name: string;
11
+ };
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.71",
5
+ "version": "1.0.73",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -36,5 +36,6 @@ export { PasswordHash } from './enums/password-hash';
36
36
  export { MessagingProviderType } from './enums/messaging-provider-type';
37
37
  export { getSDKForCurrentUser } from './getSDKForCurrentUser';
38
38
  export { getSDKForService } from './getSDKForService';
39
+ export { getAppcondaClient } from './getAppcondaClient';
39
40
  export * from './modules';
40
41
  export type { SafeActionFn } from 'next-safe-action';
@@ -4,15 +4,15 @@
4
4
  import { actionClient } from '../../actions/actionClient';
5
5
  import { getSDKForCurrentUser } from '../../getSDKForCurrentUser';
6
6
  import { getSDKForService } from '../../getSDKForService';
7
- import { CreateAgentSchema, GetAgentSchema } from './schema';
8
- import { Agent } from './types';
7
+ import { CreateAgentSchema, GetAgentSchema, ListModelsSchema } from './schema';
8
+ import { Agent, AIModel } from './types';
9
9
 
10
10
 
11
11
  export const ListAgents = actionClient
12
12
  //.schema(ListWaitlistSignupsSchema)
13
13
  .action(async ({ parsedInput }): Promise<Agent[]> => {
14
14
  try {
15
-
15
+
16
16
  const { agent } = await getSDKForCurrentUser();
17
17
  return await agent.ListAgents(); // typo: Wiatlist mi?
18
18
  } catch (error) {
@@ -37,7 +37,7 @@ export const CreateAgent = actionClient
37
37
  }
38
38
  });
39
39
 
40
- export const GetAgent = actionClient
40
+ export const GetAgent = actionClient
41
41
  .schema(GetAgentSchema)
42
42
  .action(async ({ parsedInput }): Promise<Agent> => {
43
43
  try {
@@ -51,14 +51,27 @@ export const CreateAgent = actionClient
51
51
  }
52
52
  });
53
53
 
54
- export const ListModelProviders = actionClient
54
+ export const ListModelProviders = actionClient
55
55
  .action(async ({ parsedInput }): Promise<Agent[]> => {
56
56
  try {
57
-
57
+
58
58
  const { agent } = await getSDKForCurrentUser();
59
- return await agent.ListModelProviders ();
59
+ return await agent.ListModelProviders();
60
60
  } catch (error) {
61
61
  console.error('Error in ListModelProviders:', error);
62
62
  throw new Error('Failed to fetch ListModelProviders');
63
63
  }
64
- });
64
+ });
65
+
66
+ export const ListModels = actionClient
67
+ .schema(ListModelsSchema)
68
+ .action(async ({ parsedInput }): Promise<AIModel[]> => {
69
+ try {
70
+
71
+ const { agent } = await getSDKForCurrentUser();
72
+ return await agent.ListModels(parsedInput);
73
+ } catch (error) {
74
+ console.error('Error in ListModels:', error);
75
+ throw new Error('Failed to fetch ListModels');
76
+ }
77
+ });
@@ -18,4 +18,8 @@ export const UpdateAgentSchema = z.object({
18
18
 
19
19
  export const DeleteAgentSchema = z.object({
20
20
  id: z.string()
21
+ });
22
+
23
+ export const ListModelsSchema = z.object({
24
+ modelProviderId: z.string()
21
25
  });
@@ -1,8 +1,8 @@
1
1
 
2
2
  import z from "zod";
3
3
  import { ServiceClient } from "../../service-client";
4
- import { CreateAgentSchema, GetAgentSchema } from "./schema";
5
- import { Agent } from "./types";
4
+ import { CreateAgentSchema, GetAgentSchema, ListModelsSchema } from "./schema";
5
+ import { Agent, AIModel } from "./types";
6
6
 
7
7
 
8
8
  export class AgentService extends ServiceClient {
@@ -26,5 +26,9 @@ export class AgentService extends ServiceClient {
26
26
  return await this.actionCall('ListModelProviders', {});
27
27
  }
28
28
 
29
+ public async ListModels(payload: z.infer<typeof ListModelsSchema>): Promise<AIModel[]> {
30
+ return await this.actionCall('ListModels', payload);
31
+ }
32
+
29
33
 
30
34
  }
@@ -7,3 +7,9 @@ export type Agent = {
7
7
  aiModelId: string;
8
8
  }
9
9
 
10
+
11
+ export type AIModel = {
12
+ id: string;
13
+ name:string;
14
+ }
15
+