@appconda/sdk 1.0.601 → 1.0.605

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.
Files changed (69) hide show
  1. package/dist/client.d.ts +8 -0
  2. package/dist/client.js +75 -8
  3. package/dist/getAppcondaClient.d.ts +14 -3
  4. package/dist/getAppcondaClient.js +51 -59
  5. package/dist/getSDKForService.d.ts +3 -1
  6. package/dist/getSDKForService.js +4 -4
  7. package/dist/index.d.ts +5 -1
  8. package/dist/index.js +3 -1
  9. package/dist/modules/accounv1/schema.d.ts +1 -1
  10. package/dist/modules/accounv1/schema.js +2 -2
  11. package/dist/modules/accounv1/types.d.ts +1 -1
  12. package/dist/modules/accounv1/types.js +1 -1
  13. package/dist/modules/emploid/schema.d.ts +62 -8
  14. package/dist/modules/emploid/schema.js +64 -10
  15. package/dist/modules/emploid/service.d.ts +20 -3
  16. package/dist/modules/emploid/service.js +121 -1
  17. package/dist/modules/emploid/types.d.ts +67 -1
  18. package/dist/modules/emploid/types.js +1 -1
  19. package/dist/modules/organization/schema.d.ts +35 -1
  20. package/dist/modules/organization/schema.js +31 -2
  21. package/dist/modules/organization/service.d.ts +9 -2
  22. package/dist/modules/organization/service.js +29 -8
  23. package/dist/modules/organization/types.d.ts +45 -1
  24. package/dist/modules/organization/types.js +1 -1
  25. package/package.json +1 -1
  26. package/src/client.ts +96 -8
  27. package/src/getAppcondaClient.ts +69 -58
  28. package/src/getSDKForService.ts +7 -4
  29. package/src/index.ts +5 -2
  30. package/src/modules/accounv1/schema.ts +2 -2
  31. package/src/modules/accounv1/types.ts +2 -2
  32. package/src/modules/emploid/schema.ts +74 -10
  33. package/src/modules/emploid/service.ts +169 -3
  34. package/src/modules/emploid/types.ts +74 -1
  35. package/src/modules/organization/schema.ts +38 -2
  36. package/src/modules/organization/service.ts +67 -13
  37. package/src/modules/organization/types.ts +51 -2
  38. package/dist/inputFile.d.ts +0 -6
  39. package/dist/inputFile.js +0 -16
  40. package/dist/modules/agent/action.d.ts +0 -29
  41. package/dist/modules/agent/action.js +0 -53
  42. package/dist/modules/ai/node/actions.d.ts +0 -4
  43. package/dist/modules/ai/node/actions.js +0 -14
  44. package/dist/modules/builder/action.d.ts +0 -18
  45. package/dist/modules/builder/action.js +0 -214
  46. package/dist/modules/datasource/action.d.ts +0 -14
  47. package/dist/modules/datasource/action.js +0 -172
  48. package/dist/modules/emploid/action.d.ts +0 -73
  49. package/dist/modules/emploid/action.js +0 -984
  50. package/dist/modules/google/action.d.ts +0 -5
  51. package/dist/modules/google/action.js +0 -46
  52. package/dist/modules/hooks/lib/handler.d.ts +0 -3
  53. package/dist/modules/hooks/lib/handler.js +0 -23
  54. package/dist/modules/mail/action.d.ts +0 -3
  55. package/dist/modules/mail/action.js +0 -18
  56. package/dist/modules/notion/action.d.ts +0 -5
  57. package/dist/modules/notion/action.js +0 -46
  58. package/dist/modules/organization/action.d.ts +0 -7
  59. package/dist/modules/organization/action.js +0 -60
  60. package/dist/modules/scheduled-job/action.d.ts +0 -70
  61. package/dist/modules/scheduled-job/action.js +0 -173
  62. package/dist/modules/scheduled-job/lib/handler.d.ts +0 -3
  63. package/dist/modules/scheduled-job/lib/handler.js +0 -23
  64. package/dist/modules/task/action.d.ts +0 -64
  65. package/dist/modules/task/action.js +0 -758
  66. package/dist/modules/tenant/actions.d.ts +0 -10
  67. package/dist/modules/tenant/actions.js +0 -160
  68. package/dist/modules/waitlist/action.d.ts +0 -6
  69. package/dist/modules/waitlist/action.js +0 -78
@@ -1,73 +1,84 @@
1
- import { Client } from "./client";
1
+ import { Client } from './client';
2
2
 
3
- function getPortAndHostname(urlString: string): { hostname: string; port: string; protocol: string } {
4
- try {
5
- const url = new URL(urlString);
6
- return {
7
- hostname: url.hostname,
8
- port: url.port || (url.protocol === 'https:' ? '443' : '80'), // Default ports if not specified
9
- protocol: url.protocol
10
- };
11
- } catch (error) {
12
- console.error('Invalid URL:', error);
13
- return { hostname: '', port: '', protocol: '' };
14
- }
15
- }
3
+ const APPCONDA_DEFAULT_PATH = '/api/appconda/v1';
4
+ const APPCONDA_NODE_DEFAULT_ENDPOINT = 'http://localhost:3000/api/appconda/v1';
16
5
 
17
- const APPCONDA_ENDPOINT = 'api/appconda/v1';
6
+ export type AppcondaClientOptions = {
7
+ endpoint?: string;
8
+ project?: string;
9
+ mode?: string;
10
+ key?: string;
11
+ jwt?: string;
12
+ session?: string;
13
+ locale?: string;
14
+ forwardedUserAgent?: string;
15
+ headers?: Record<string, string>;
16
+ }
18
17
 
19
- export function getAppcondaClient() {
18
+ function normalizeEndpoint(endpoint: string): string {
19
+ return endpoint.replace(/\/+$/, '');
20
+ }
20
21
 
21
- let url;
22
- if (typeof window !== 'undefined') {
23
- const hostInfo = getPortAndHostname(window.location.href);
24
- if (hostInfo.port) {
25
- url = `${hostInfo.protocol}//${hostInfo.hostname}:${hostInfo.port}/${APPCONDA_ENDPOINT}`
26
- } else {
27
- url = `${hostInfo.protocol}//${hostInfo.hostname}/${APPCONDA_ENDPOINT}`
28
- }
29
- } else {
30
- url = APPCONDA_ENDPOINT || 'http://appconda/v1'
22
+ function resolveEndpoint(overrideEndpoint?: string): string {
23
+ if (overrideEndpoint) {
24
+ return normalizeEndpoint(overrideEndpoint);
31
25
  }
32
26
 
33
- /* if (ApplicationConfig.Port == null) {
34
- url = `${ApplicationConfig.Protocol}://${ApplicationConfig.Domain}:${ApplicationConfig.Port}/v1`
35
- } else {
36
- url = `${ApplicationConfig.Protocol}://${ApplicationConfig.Domain}/v1`
37
- } */
38
- const adminClient = new Client()
39
- .setEndpoint(url) // Your API Endpoint
40
- .setProject('console');
27
+ const envEndpoint =
28
+ (typeof process !== 'undefined' && process?.env?.APPCONDA_ENDPOINT) ||
29
+ (typeof process !== 'undefined' && process?.env?.NEXT_PUBLIC_APPCONDA_ENDPOINT) ||
30
+ '';
41
31
 
42
- return adminClient
32
+ if (envEndpoint) {
33
+ return normalizeEndpoint(envEndpoint);
34
+ }
43
35
 
44
- }
36
+ if (typeof window !== 'undefined' && window?.location?.origin) {
37
+ return normalizeEndpoint(new URL(APPCONDA_DEFAULT_PATH, window.location.origin).toString());
38
+ }
45
39
 
46
- export function getAppcondaClientSync() {
40
+ return APPCONDA_NODE_DEFAULT_ENDPOINT;
41
+ }
47
42
 
48
- let url;
49
- if (APPCONDA_ENDPOINT) {
50
- url = APPCONDA_ENDPOINT;
51
- } else if (typeof window !== 'undefined') {
52
- const hostInfo = getPortAndHostname(window.location.href);
53
- if (hostInfo.port) {
54
- url = `${hostInfo.protocol}//${hostInfo.hostname}:${hostInfo.port}/v1`
55
- } else {
56
- url = `${hostInfo.protocol}//${hostInfo.hostname}/v1`
43
+ function applyClientOptions(client: Client, options: AppcondaClientOptions): Client {
44
+ if (options.project) {
45
+ client.setProject(options.project);
46
+ }
47
+ if (options.mode) {
48
+ client.setMode(options.mode);
49
+ }
50
+ if (options.key) {
51
+ client.setKey(options.key);
52
+ }
53
+ if (options.jwt) {
54
+ client.setJWT(options.jwt);
55
+ }
56
+ if (options.session) {
57
+ client.setSession(options.session);
58
+ }
59
+ if (options.locale) {
60
+ client.setLocale(options.locale);
61
+ }
62
+ if (options.forwardedUserAgent) {
63
+ client.setForwardedUserAgent(options.forwardedUserAgent);
64
+ }
65
+ if (options.headers) {
66
+ for (const [headerName, headerValue] of Object.entries(options.headers)) {
67
+ client.addHeader(headerName, headerValue);
57
68
  }
58
- } else {
59
- url = APPCONDA_ENDPOINT || 'http://appconda/v1'
60
69
  }
61
70
 
62
- /* if (ApplicationConfig.Port == null) {
63
- url = `${ApplicationConfig.Protocol}://${ApplicationConfig.Domain}:${ApplicationConfig.Port}/v1`
64
- } else {
65
- url = `${ApplicationConfig.Protocol}://${ApplicationConfig.Domain}/v1`
66
- } */
67
- const adminClient = new Client()
68
- .setEndpoint(url) // Your API Endpoint
69
- .setProject('console');
71
+ return client;
72
+ }
70
73
 
71
- return adminClient
74
+ export function getAppcondaClient(options: AppcondaClientOptions = {}): Client {
75
+ const client = new Client()
76
+ .setEndpoint(resolveEndpoint(options.endpoint))
77
+ .setProject(options.project ?? 'console');
72
78
 
73
- }
79
+ return applyClientOptions(client, options);
80
+ }
81
+
82
+ export function getAppcondaClientSync(options: AppcondaClientOptions = {}): Client {
83
+ return getAppcondaClient(options);
84
+ }
@@ -1,4 +1,5 @@
1
- import { getAppcondaClient } from "./getAppcondaClient";
1
+ import { getAppcondaClient } from './getAppcondaClient';
2
+ import type { AppcondaClientOptions } from './getAppcondaClient';
2
3
 
3
4
  import { Account, BuilderService, DataSourceService, ScrapflowService, WaitlistService } from "./modules";
4
5
  import { AccountService } from "./modules/accounv1";
@@ -35,8 +36,10 @@ export type AppcondaSDK = {
35
36
  configuration: Configuration
36
37
  }
37
38
 
38
- export function getSDKForService(token?: string): AppcondaSDK {
39
- const adminClient = getAppcondaClient();
39
+ export type AppcondaSDKOptions = AppcondaClientOptions;
40
+
41
+ export function getSDKForService(token?: string, options: AppcondaSDKOptions = {}): AppcondaSDK {
42
+ const adminClient = getAppcondaClient(options);
40
43
 
41
44
  adminClient.addHeader('x-service-token', '');
42
45
  if (token) {
@@ -101,4 +104,4 @@ export function getSDKForService(token?: string): AppcondaSDK {
101
104
  waitlist,
102
105
  configuration
103
106
  }
104
- }
107
+ }
package/src/index.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  export * from './modules';
2
- export { getSDKForService, AppcondaSDK } from './getSDKForService';
2
+ export { getSDKForService } from './getSDKForService';
3
+ export type { AppcondaSDK, AppcondaSDKOptions } from './getSDKForService';
3
4
  export * from './EmploidClient';
4
-
5
+ export { getAppcondaClient, getAppcondaClientSync } from './getAppcondaClient';
6
+ export type { AppcondaClientOptions } from './getAppcondaClient';
7
+ export { Client, AppcondaException, Query } from './client';
@@ -8,7 +8,7 @@ export const _CreateUserSchema = z.object({
8
8
  active: z.boolean().optional(),
9
9
  githubId: z.string().optional(),
10
10
  googleId: z.string().optional(),
11
- avatarURL: z.string().optional(),
11
+ avatar: z.string().optional(),
12
12
  locale: z.string().optional()
13
13
  });
14
14
 
@@ -47,4 +47,4 @@ export const CredentialLoginSchema = z.object({
47
47
 
48
48
  export const TokenLoginSchema = z.object({
49
49
  token: z.string()
50
- });
50
+ });
@@ -10,7 +10,7 @@ export type TUser = {
10
10
  active: boolean;
11
11
  githubId: string;
12
12
  googleId: string;
13
- avatarURL: string;
13
+ avatar: string;
14
14
  locale: string;
15
15
  emailVerified: boolean;
16
- }
16
+ }
@@ -96,17 +96,30 @@ export const ListDomainTopicsSchema = z.object({
96
96
  occupationId: z.string()
97
97
  });
98
98
 
99
+ export const ScopeTypeSchema = z.string().min(1);
100
+
99
101
  export const CreateScopeSchema = z.object({
100
102
  tenantId: z.string(),
101
- emploidId: z.string(),
102
- name: z.string(),
103
+ workerId: z.string(),
104
+ parentScopeId: z.string().nullable().optional(),
105
+ name: z.string().optional(),
106
+ type: ScopeTypeSchema.optional(),
107
+ isFolderType: z.boolean().optional(),
103
108
  description: z.string().optional()
104
109
  });
105
110
 
111
+ export const GetScopeByTypeSchema = z.object({
112
+ tenantId: z.string(),
113
+ workerId: z.string(),
114
+ type: ScopeTypeSchema
115
+ });
116
+
106
117
  export const UpdateScopeSchema = z.object({
107
118
  scopeId: z.string(),
108
- name: z.string(),
109
- description: z.string().optional()
119
+ parentScopeId: z.string().nullable().optional(),
120
+ name: z.string().optional(),
121
+ description: z.string().optional(),
122
+ isFolderType: z.boolean().optional()
110
123
  });
111
124
 
112
125
  export const DeleteScopeSchema = z.object({
@@ -115,7 +128,7 @@ export const DeleteScopeSchema = z.object({
115
128
 
116
129
  export const CreateJobDefinitionSchema = z.object({
117
130
  tenantId: z.string(),
118
- emploidId: z.string(),
131
+ workerId: z.string(),
119
132
  scopeId: z.string(),
120
133
  name: z.string(),
121
134
  description: z.string().optional(),
@@ -126,7 +139,7 @@ export const CreateJobDefinitionSchema = z.object({
126
139
 
127
140
  export const ListJobDefinitionSchema = z.object({
128
141
  tenantId: z.string(),
129
- emploidId: z.string().optional(),
142
+ workerId: z.string().optional(),
130
143
  scopeId: z.string().optional()
131
144
  });
132
145
 
@@ -145,7 +158,7 @@ export const DeleteJobDefinitionSchema = z.object({
145
158
 
146
159
  export const CreateCompetencySchema = z.object({
147
160
  tenantId: z.string(),
148
- emploidId: z.string(),
161
+ workerId: z.string(),
149
162
  scopeId: z.string(),
150
163
  jobDefinitionId: z.string(),
151
164
  name: z.string(),
@@ -155,7 +168,7 @@ export const CreateCompetencySchema = z.object({
155
168
 
156
169
  export const ListCompetenciesSchema = z.object({
157
170
  tenantId: z.string(),
158
- emploidId: z.string().optional(),
171
+ workerId: z.string().optional(),
159
172
  scopeId: z.string().optional(),
160
173
  jobDefinitionId: z.string().optional()
161
174
  });
@@ -375,7 +388,7 @@ export const DeleteAssistantChannelSchema = z.object({
375
388
 
376
389
  export const CreateWorkerSchema = z.object({
377
390
  tenantId: z.string(),
378
- emploidId: z.string(),
391
+ emploidId: z.string().optional(),
379
392
  name: z.string(),
380
393
  description: z.string().optional(),
381
394
  avatar: z.string().optional(),
@@ -1132,6 +1145,51 @@ export const ListWikiPagesSchema = z.object({
1132
1145
  workspaceId: z.string(),
1133
1146
  });
1134
1147
 
1148
+ export const UploadEditorFileSchema = z.object({
1149
+ fileName: z.string(),
1150
+ fileType: z.string().optional(),
1151
+ fileData: z.string(),
1152
+ pageId: z.string().optional(),
1153
+ attachmentId: z.string().optional(),
1154
+ });
1155
+
1156
+ export const ResolveWikiFileViewSchema = z.object({
1157
+ fileId: z.string(),
1158
+ });
1159
+
1160
+ export const ResolveScopeFileViewSchema = z.object({
1161
+ fileId: z.string(),
1162
+ });
1163
+
1164
+ export const CreateWikiCommentSchema = z.object({
1165
+ pageId: z.string(),
1166
+ content: z.string(),
1167
+ creatorId: z.string(),
1168
+ creatorName: z.string().optional(),
1169
+ creatorAvatarUrl: z.string().optional(),
1170
+ selection: z.string().optional(),
1171
+ parentCommentId: z.string().nullable().optional(),
1172
+ });
1173
+
1174
+ export const UpdateWikiCommentSchema = z.object({
1175
+ commentId: z.string(),
1176
+ content: z.string().optional(),
1177
+ resolved: z.boolean().optional(),
1178
+ resolvedById: z.string().optional(),
1179
+ resolvedByName: z.string().optional(),
1180
+ resolvedByAvatarUrl: z.string().optional(),
1181
+ });
1182
+
1183
+ export const DeleteWikiCommentSchema = z.object({
1184
+ commentId: z.string(),
1185
+ });
1186
+
1187
+ export const ListWikiCommentsSchema = z.object({
1188
+ pageId: z.string(),
1189
+ page: z.number().int().optional(),
1190
+ limit: z.number().int().optional(),
1191
+ });
1192
+
1135
1193
  export const CreateDatasourceSchema = z.object({
1136
1194
  tenantId: z.string(),
1137
1195
  entityId: z.string(),
@@ -1297,4 +1355,10 @@ export const PublishEmploidSchema = z.object({
1297
1355
  export const PublishWorkerSchema = z.object({
1298
1356
  tenantId: z.string(),
1299
1357
  workerId: z.string(),
1300
- });
1358
+ });
1359
+
1360
+ export const EnhanceTopicSchema = z.object({
1361
+ entityName: z.string(),
1362
+ entityDescription: z.string(),
1363
+ categories: z.string().array().optional()
1364
+ })
@@ -3,14 +3,84 @@ import z from "zod";
3
3
  import { ServiceClient } from "../../service-client";
4
4
 
5
5
 
6
- import { AggregateRecordsSchema, BulkCreateRecordsSchema, BulkDeleteRecordsSchema, BulkUpdateRecordsSchema, ChangeAgentflowProjectSchema, CheckRecordPermissionSchema, CountRecordsSchema, CreateAgentFlowFolderSchema, CreateAgentFlowSchema, CreateAssistantChannelSchema, CreateAssistantConstraintSchema, CreateAssistantDatasourceSchema, CreateAssistantInstructionSchema, CreateAssistantSchema, CreateAssistantSkillSchema, CreateChannelSchema, CreateCollectionFieldSchema, CreateCollectionSchema, CreateCommandSchema, CreateCompetencySchema, CreateConstraintSchema, CreateDataModelSchema, CreateDatasourceSchema, CreateDomainTopicSchema, CreateEmploidSchema, CreateExtensionSchema, CreateInputSchema, CreateInstructionSchema, CreateJobDefinitionSchema, CreateKnowledgeSchema, CreateOccupationSchema, CreateRecordSchema, CreateScopeSchema, CreateSkillSchema, CreateStreamIdSchema, CreateTaskTemplateSchema, CreateTeamSchema, CreateTopicSchema, CreateWikiPageSchema, CreateWikiRevisionSchema, CreateWorkerSchema, CreateWorkerTopicSchema, DeleteAgentFlowFolderSchema, DeleteAssistantChannelSchema, DeleteAssistantDatasourceSchema, DeleteAssistantSchema, DeleteAssistantSkillSchema, DeleteChannelSchema, DeleteChatByIdSchema, DeleteCollectionFieldSchema, DeleteCommandSchema, DeleteCompetencySchema, DeleteConstraintSchema, DeleteDataModelSchema, DeleteDatasourceSchema, DeleteDocumentsByIdAfterTimestampSchema, DeleteDomainTopicSchema, DeleteEmploidSchema, DeleteExtensionSchema, DeleteInputSchema, DeleteInstructionSchema, DeleteJobDefinitionSchema, DeleteKnowledgeSchema, DeleteMessagesByChatIdAfterTimestampSchema, DeleteOccupationSchema, DeleteRecordSchema, DeleteScopeSchema, DeleteSkillSchema, DeleteTaskTemplateSchema, DeleteTeamSchema, DeleteTopicSchema, DeleteWikiPageSchema, DeleteWorkerSchema, DeleteWorkerTopicSchema, DistinctFieldValuesSchema, DuplicateRecordSchema, GetChatByIdSchema, GetChatsByUserIdSchema, GetCollectionSchemaSchema, GetDataModelByIdSchema, GetDocumentByIdSchema, GetDocumentsByIdSchema, GetLatestWikiRevisionSchema, GetMessageByIdSchema, GetMessageCountByUserIdSchema, GetMessagesByChatIdSchema, GetRecordByIdSchema, GetStreamIdsByChatIdSchema, GetSuggestionsByDocumentIdSchema, GetVotesByChatIdSchema, GetWikiPageByIdSchema, GetWikiPageBySlugSchema, GetWikiRevisionByIdSchema, GetWikiTreeSchema, GrantRecordPermissionSchema, GroupRecordsSchema, HardDeleteDataModelSchema, ListAgentFlowFoldersSchema, ListAgentFlowsSchema, ListAssistantChannelsSchema, ListAssistantConstraintsSchema, ListAssistantDatasourcesSchema, ListAssistantInstructionsSchema, ListAssistantSkillsSchema, ListAssistantsSchema, ListChannelsSchema, ListChatHistorySchema, ListCollectionsSchema, ListCommandsSchema, ListCompetenciesSchema, ListConstraintsSchema, ListDataModelsSchema, ListDatasourcesSchema, ListDomainTopicsSchema, ListEmploidsPaginatedSchema, ListEmploidsSchema, ListExtensionsSchema, ListInputSchema, ListInstructionsSchema, ListJobDefinitionSchema, ListKnowledgesSchema, ListOccupationsSchema, ListRecordPermissionsSchema, ListRecordsSchema, ListScopesSchema, ListSkillsSchema, ListTaskTemplatesSchema, ListTeamsSchema, ListTopicsSchema, ListWikiPagesSchema, ListWorkersSchema, ListWorkerTopicsSchema, PreviewValidationErrorsSchema, PublishDomainSchema, PublishEmploidSchema, PublishWorkerSchema, QueryRecordsSchema, ReorderCollectionFieldsSchema, RestoreDataModelSchema, RestoreRecordSchema, RestoreWikiPageSchema, RevokeRecordPermissionSchema, SaveChatSchema, SaveDocumentSchema, SaveMessagesSchema, SaveSuggestionsSchema, SearchRecordsSchema, UpdateAgentFlowFolderSchema, UpdateAgentFlowSchema, UpdateAssistantChannelSchema, UpdateAssistantDatasourceSchema, UpdateAssistantSchema, UpdateAssistantSkillSchema, UpdateChannelSchema, UpdateChatLastContextByIdSchema, UpdateChatVisiblityByIdSchema, UpdateCollectionFieldSchema, UpdateCommandSchema, UpdateCompetencySchema, UpdateConstraintSchema, UpdateDataModelSchema, UpdateDatasourceSchema, UpdateDomainTopicSchema, UpdateEmploidSchema, UpdateInputSchema, UpdateInstructionSchema, UpdateJobDefinitionSchema, UpdateKnowledgeSchema, UpdateOccupationSchema, UpdateRecordSchema, UpdateScopeSchema, UpdateSkillSchema, UpdateTaskTemplateSchema, UpdateTeamSchema, UpdateTopicSchema, UpdateWikiPageSchema, UpdateWorkerSchema, UpdateWorkerTopicSchema, UpsertRecordSchema, ValidateRecordSchema, VoteMessageSchema } from "./schema";
7
- import { TAgentFlow, TAgentFlowFolder, TAssistant, TAssistantChannel, TAssistantConstraint, TAssistantDatasource, TAssistantInstruction, TAssistantSkill, TChannel, TChat, TCommand, TCompetency, TConstraint, TDatasource, TDocument, TDomainTopic, TEmploid, TExtension, TInput, TInstruction, TJobDefinition, TKnowledge, TOccupation, TPaginatedEmploidsResult, TPublishEmploid, TPublishWorker, TScope, TSkill, TStreamId, TTaskTemplate, TTeam, TTopic, TWorker, TWorkerTopic } from "./types";
6
+ import { AggregateRecordsSchema, BulkCreateRecordsSchema, BulkDeleteRecordsSchema, BulkUpdateRecordsSchema, ChangeAgentflowProjectSchema, CheckRecordPermissionSchema, CountRecordsSchema, CreateAgentFlowFolderSchema, CreateAgentFlowSchema, CreateAssistantChannelSchema, CreateAssistantConstraintSchema, CreateAssistantDatasourceSchema, CreateAssistantInstructionSchema, CreateAssistantSchema, CreateAssistantSkillSchema, CreateChannelSchema, CreateCollectionFieldSchema, CreateCollectionSchema, CreateCommandSchema, CreateCompetencySchema, CreateConstraintSchema, CreateDataModelSchema, CreateDatasourceSchema, CreateDomainTopicSchema, CreateEmploidSchema, CreateExtensionSchema, CreateInputSchema, CreateInstructionSchema, CreateJobDefinitionSchema, CreateKnowledgeSchema, CreateOccupationSchema, CreateRecordSchema, CreateScopeSchema, CreateSkillSchema, CreateStreamIdSchema, CreateTaskTemplateSchema, CreateTeamSchema, CreateTopicSchema, CreateWikiCommentSchema, CreateWikiPageSchema, CreateWikiRevisionSchema, CreateWorkerSchema, CreateWorkerTopicSchema, DeleteAgentFlowFolderSchema, DeleteAssistantChannelSchema, DeleteAssistantDatasourceSchema, DeleteAssistantSchema, DeleteAssistantSkillSchema, DeleteChannelSchema, DeleteChatByIdSchema, DeleteCollectionFieldSchema, DeleteCommandSchema, DeleteCompetencySchema, DeleteConstraintSchema, DeleteDataModelSchema, DeleteDatasourceSchema, DeleteDocumentsByIdAfterTimestampSchema, DeleteDomainTopicSchema, DeleteEmploidSchema, DeleteExtensionSchema, DeleteInputSchema, DeleteInstructionSchema, DeleteJobDefinitionSchema, DeleteKnowledgeSchema, DeleteMessagesByChatIdAfterTimestampSchema, DeleteOccupationSchema, DeleteRecordSchema, DeleteScopeSchema, DeleteSkillSchema, DeleteTaskTemplateSchema, DeleteTeamSchema, DeleteTopicSchema, DeleteWikiCommentSchema, DeleteWikiPageSchema, DeleteWorkerSchema, DeleteWorkerTopicSchema, DistinctFieldValuesSchema, DuplicateRecordSchema, EnhanceTopicSchema, GetChatByIdSchema, GetChatsByUserIdSchema, GetCollectionSchemaSchema, GetDataModelByIdSchema, GetDocumentByIdSchema, GetDocumentsByIdSchema, GetLatestWikiRevisionSchema, GetMessageByIdSchema, GetMessageCountByUserIdSchema, GetMessagesByChatIdSchema, GetRecordByIdSchema, GetScopeByTypeSchema, GetStreamIdsByChatIdSchema, GetSuggestionsByDocumentIdSchema, GetVotesByChatIdSchema, GetWikiPageByIdSchema, GetWikiPageBySlugSchema, GetWikiRevisionByIdSchema, GetWikiTreeSchema, GrantRecordPermissionSchema, GroupRecordsSchema, HardDeleteDataModelSchema, ListAgentFlowFoldersSchema, ListAgentFlowsSchema, ListAssistantChannelsSchema, ListAssistantConstraintsSchema, ListAssistantDatasourcesSchema, ListAssistantInstructionsSchema, ListAssistantSkillsSchema, ListAssistantsSchema, ListChannelsSchema, ListChatHistorySchema, ListCollectionsSchema, ListCommandsSchema, ListCompetenciesSchema, ListConstraintsSchema, ListDataModelsSchema, ListDatasourcesSchema, ListDomainTopicsSchema, ListEmploidsPaginatedSchema, ListEmploidsSchema, ListExtensionsSchema, ListInputSchema, ListInstructionsSchema, ListJobDefinitionSchema, ListKnowledgesSchema, ListOccupationsSchema, ListRecordPermissionsSchema, ListRecordsSchema, ListScopesSchema, ListSkillsSchema, ListTaskTemplatesSchema, ListTeamsSchema, ListTopicsSchema, ListWikiCommentsSchema, ListWikiPagesSchema, ListWorkersSchema, ListWorkerTopicsSchema, PreviewValidationErrorsSchema, PublishDomainSchema, PublishEmploidSchema, PublishWorkerSchema, QueryRecordsSchema, ReorderCollectionFieldsSchema, ResolveScopeFileViewSchema, ResolveWikiFileViewSchema, RestoreDataModelSchema, RestoreRecordSchema, RestoreWikiPageSchema, RevokeRecordPermissionSchema, SaveChatSchema, SaveDocumentSchema, SaveMessagesSchema, SaveSuggestionsSchema, SearchRecordsSchema, UpdateAgentFlowFolderSchema, UpdateAgentFlowSchema, UpdateAssistantChannelSchema, UpdateAssistantDatasourceSchema, UpdateAssistantSchema, UpdateAssistantSkillSchema, UpdateChannelSchema, UpdateChatLastContextByIdSchema, UpdateChatVisiblityByIdSchema, UpdateCollectionFieldSchema, UpdateCommandSchema, UpdateCompetencySchema, UpdateConstraintSchema, UpdateDataModelSchema, UpdateDatasourceSchema, UpdateDomainTopicSchema, UpdateEmploidSchema, UpdateInputSchema, UpdateInstructionSchema, UpdateJobDefinitionSchema, UpdateKnowledgeSchema, UpdateOccupationSchema, UpdateRecordSchema, UpdateScopeSchema, UpdateSkillSchema, UpdateTaskTemplateSchema, UpdateTeamSchema, UpdateTopicSchema, UpdateWikiCommentSchema, UpdateWikiPageSchema, UpdateWorkerSchema, UpdateWorkerTopicSchema, UploadEditorFileSchema, UpsertRecordSchema, ValidateRecordSchema, VoteMessageSchema } from "./schema";
7
+ import { TAgentFlow, TAgentFlowFolder, TAssistant, TAssistantChannel, TAssistantConstraint, TAssistantDatasource, TAssistantInstruction, TAssistantSkill, TChannel, TChat, TCommand, TCompetency, TConstraint, TDatasource, TDocument, TDomainTopic, TEmploid, TEnhanceTopic, TExtension, TInput, TInstruction, TJobDefinition, TKnowledge, TOccupation, TPaginatedEmploidsResult, TPublishEmploid, TPublishWorker, TScope, TSkill, TStreamId, TTaskTemplate, TTeam, TTopic, TUploadedFile, TWikiComment, TWikiCommentPagination, TWikiFileViewResolution, TWorker, TWorkerTopic } from "./types";
8
8
 
9
9
  export class EmploidService extends ServiceClient {
10
10
  protected getServiceName(): string {
11
11
  return 'com.appconda.service.emploid';
12
12
  }
13
13
 
14
+ private isHttpUrl(value: string): boolean {
15
+ return /^https?:\/\//i.test(value);
16
+ }
17
+
18
+ private normalizeStoragePath(pathLike: string): string {
19
+ const normalized = String(pathLike || "").trim();
20
+ if (!normalized) {
21
+ return "";
22
+ }
23
+
24
+ if (this.isHttpUrl(normalized)) {
25
+ return normalized;
26
+ }
27
+
28
+ return normalized.startsWith("/") ? normalized : `/${normalized}`;
29
+ }
30
+
31
+ private resolveEnvEndpoint(): string {
32
+ const envCandidates = [
33
+ typeof process !== "undefined" ? process?.env?.APPCONDA_ENDPOINT : "",
34
+ typeof process !== "undefined" ? process?.env?.NEXT_PUBLIC_APPCONDA_ENDPOINT : "",
35
+ typeof process !== "undefined" ? process?.env?._APP_APPCONDA_ENDPOINT : "",
36
+ ];
37
+
38
+ for (const candidate of envCandidates) {
39
+ const normalized = String(candidate || "").trim().replace(/\/+$/, "");
40
+ if (this.isHttpUrl(normalized)) {
41
+ return normalized;
42
+ }
43
+ }
44
+
45
+ return "";
46
+ }
47
+
48
+ private resolveStorageViewUrl(storagePath: string): string {
49
+ const normalizedPath = this.normalizeStoragePath(storagePath);
50
+ if (!normalizedPath) {
51
+ return "";
52
+ }
53
+
54
+ if (this.isHttpUrl(normalizedPath)) {
55
+ return normalizedPath;
56
+ }
57
+
58
+ const endpoint = String(this.client.config.endpoint || "").trim().replace(/\/+$/, "");
59
+ if (this.isHttpUrl(endpoint)) {
60
+ return `${endpoint}${normalizedPath}`;
61
+ }
62
+
63
+ if (typeof window !== "undefined") {
64
+ const protocol = window?.location?.protocol || "";
65
+ if (protocol && protocol !== "file:") {
66
+ const origin = String(window?.location?.origin || "").replace(/\/+$/, "");
67
+ if (origin) {
68
+ const normalizedEndpoint = endpoint
69
+ ? (endpoint.startsWith("/") ? endpoint : `/${endpoint}`)
70
+ : "";
71
+ return `${origin}${normalizedEndpoint}${normalizedPath}`;
72
+ }
73
+ }
74
+ }
75
+
76
+ const envEndpoint = this.resolveEnvEndpoint();
77
+ if (envEndpoint) {
78
+ return `${envEndpoint}${normalizedPath}`;
79
+ }
80
+
81
+ return normalizedPath;
82
+ }
83
+
14
84
  public async CreateEmploid(payload: z.infer<typeof CreateEmploidSchema>): Promise<TEmploid> {
15
85
  return await this.actionCall('emploid', 'CreateEmploid', payload);
16
86
  }
@@ -70,6 +140,10 @@ export class EmploidService extends ServiceClient {
70
140
  return await this.actionCall('emploid', 'ListScopes', payload);
71
141
  }
72
142
 
143
+ public async GetScopeByType(payload: z.infer<typeof GetScopeByTypeSchema>): Promise<TScope | null> {
144
+ return await this.actionCall('emploid', 'GetScopeByType', payload);
145
+ }
146
+
73
147
  public async CreateScope(payload: z.infer<typeof CreateScopeSchema>): Promise<TScope> {
74
148
  return await this.actionCall('emploid', 'CreateScope', payload);
75
149
  }
@@ -82,6 +156,40 @@ export class EmploidService extends ServiceClient {
82
156
  return await this.actionCall('emploid', 'DeleteScope', payload);
83
157
  }
84
158
 
159
+ public async UploadScopeFile(
160
+ payload: z.infer<typeof UploadEditorFileSchema>
161
+ ): Promise<TUploadedFile> {
162
+ const result = await this.actionCall<any>("scope", "UploadFile", payload);
163
+ const storagePath =
164
+ this.normalizeStoragePath(String(result?.path || result?.filePath || result?.url || ""));
165
+ const resolvedUrl = this.resolveStorageViewUrl(storagePath);
166
+
167
+ return {
168
+ ...result,
169
+ fileId: String(result?.fileId || result?.id || payload.attachmentId || ""),
170
+ path: storagePath,
171
+ filePath: resolvedUrl || storagePath,
172
+ url: resolvedUrl || storagePath,
173
+ };
174
+ }
175
+
176
+ public async ResolveScopeFileView(
177
+ payload: z.infer<typeof ResolveScopeFileViewSchema>
178
+ ): Promise<TWikiFileViewResolution> {
179
+ const result = await this.actionCall<any>("scope", "ResolveScopeFileView", payload);
180
+ const storagePath =
181
+ this.normalizeStoragePath(String(result?.path || result?.filePath || result?.url || ""));
182
+ const resolvedUrl = this.resolveStorageViewUrl(storagePath);
183
+
184
+ return {
185
+ ...result,
186
+ fileId: String(result?.fileId || payload.fileId || ""),
187
+ path: storagePath,
188
+ filePath: resolvedUrl || storagePath,
189
+ url: resolvedUrl || storagePath,
190
+ };
191
+ }
192
+
85
193
  public async CreateOccupation(payload: z.infer<typeof CreateOccupationSchema>): Promise<TOccupation> {
86
194
  return await this.actionCall('occupation', 'CreateOccupation', payload);
87
195
  }
@@ -240,7 +348,7 @@ export class EmploidService extends ServiceClient {
240
348
  return await this.actionCall('assistant', 'CreateAssistantConstraint', payload);
241
349
  }
242
350
 
243
- public async ListAssistantConstraints(payload: z.infer<typeof ListAssistantConstraintSchema>): Promise<TAssistantConstraint[]> {
351
+ public async ListAssistantConstraints(payload: z.infer<typeof ListAssistantConstraintsSchema>): Promise<TAssistantConstraint[]> {
244
352
  return await this.actionCall('assistant', 'ListAssistantConstraints', payload);
245
353
  }
246
354
 
@@ -427,6 +535,10 @@ export class EmploidService extends ServiceClient {
427
535
  return await this.actionCall('topic', 'ListTopics', payload);
428
536
  }
429
537
 
538
+ public async EnhanceTopic(payload: z.infer<typeof EnhanceTopicSchema>): Promise<TEnhanceTopic> {
539
+ return await this.actionCall('topic', 'EnhanceTopic', payload);
540
+ }
541
+
430
542
  //---------------------------------------------
431
543
 
432
544
  public async CreateInput(payload: z.infer<typeof CreateInputSchema>): Promise<TInput> {
@@ -987,6 +1099,60 @@ export class EmploidService extends ServiceClient {
987
1099
  return await this.actionCall("wiki", "ListWikiPages", payload);
988
1100
  }
989
1101
 
1102
+ public async UploadWikiFile(
1103
+ payload: z.infer<typeof UploadEditorFileSchema>
1104
+ ): Promise<TUploadedFile> {
1105
+ return await this.actionCall("wiki", "UploadFile", payload);
1106
+ }
1107
+
1108
+ public async ResolveWikiFileView(
1109
+ payload: z.infer<typeof ResolveWikiFileViewSchema>
1110
+ ): Promise<TWikiFileViewResolution> {
1111
+ const result = await this.actionCall<any>("wiki", "ResolveWikiFileView", payload);
1112
+ const storagePath =
1113
+ this.normalizeStoragePath(String(result?.path || result?.filePath || result?.url || ""));
1114
+ const resolvedUrl = this.resolveStorageViewUrl(storagePath);
1115
+
1116
+ return {
1117
+ ...result,
1118
+ fileId: String(result?.fileId || payload.fileId || ""),
1119
+ path: storagePath,
1120
+ filePath: resolvedUrl || storagePath,
1121
+ url: resolvedUrl || storagePath,
1122
+ };
1123
+ }
1124
+
1125
+ public async CreateWikiComment(
1126
+ payload: z.infer<typeof CreateWikiCommentSchema>
1127
+ ): Promise<TWikiComment> {
1128
+ return await this.actionCall("wiki", "CreateWikiComment", payload);
1129
+ }
1130
+
1131
+ public async UpdateWikiComment(
1132
+ payload: z.infer<typeof UpdateWikiCommentSchema>
1133
+ ): Promise<TWikiComment> {
1134
+ const normalizedPayload = {
1135
+ ...payload,
1136
+ ...(typeof payload.resolved === "boolean"
1137
+ ? { resolved: payload.resolved ? "true" : "false" }
1138
+ : {}),
1139
+ } as any;
1140
+
1141
+ return await this.actionCall("wiki", "UpdateWikiComment", normalizedPayload);
1142
+ }
1143
+
1144
+ public async DeleteWikiComment(
1145
+ payload: z.infer<typeof DeleteWikiCommentSchema>
1146
+ ): Promise<{ id: string; deletedAt: string }> {
1147
+ return await this.actionCall("wiki", "DeleteWikiComment", payload);
1148
+ }
1149
+
1150
+ public async ListWikiComments(
1151
+ payload: z.infer<typeof ListWikiCommentsSchema>
1152
+ ): Promise<TWikiCommentPagination> {
1153
+ return await this.actionCall("wiki", "ListWikiComments", payload);
1154
+ }
1155
+
990
1156
  public async RestoreWikiPage(
991
1157
  payload: z.infer<typeof RestoreWikiPageSchema>
992
1158
  ): Promise<any> {
@@ -18,9 +18,17 @@ export type TPaginatedEmploidsResult = {
18
18
 
19
19
  export type TScope = {
20
20
  id: string;
21
- emploidId: string;
21
+ tenantId: string;
22
+ workerId: string;
23
+ parentScopeId?: string | null;
22
24
  name: string;
23
25
  description: string;
26
+ type?: string;
27
+ isFolderType?: boolean;
28
+ content?: any;
29
+ markdownContent?: string;
30
+ createdAt?: string;
31
+ updatedAt?: string;
24
32
  }
25
33
 
26
34
  export type TOccupation = {
@@ -189,6 +197,33 @@ export type TDocument = {
189
197
  userId: string;
190
198
  }
191
199
 
200
+ export type TUploadedFile = {
201
+ id?: string;
202
+ fileId?: string;
203
+ bucketId?: string;
204
+ fileName?: string;
205
+ path?: string;
206
+ pathname?: string;
207
+ url?: string;
208
+ filePath?: string;
209
+ contentType?: string;
210
+ mimeType?: string;
211
+ fileSize?: number;
212
+ size?: number;
213
+ type?: string;
214
+ createdAt?: string;
215
+ updatedAt?: string;
216
+ [key: string]: any;
217
+ }
218
+
219
+ export type TWikiFileViewResolution = {
220
+ fileId: string;
221
+ path: string;
222
+ url: string;
223
+ filePath: string;
224
+ [key: string]: any;
225
+ }
226
+
192
227
  export type TStreamId = {
193
228
  id: string;
194
229
  chatId: string;
@@ -291,6 +326,39 @@ export interface TWikiRevision {
291
326
  createdAt: string;
292
327
  }
293
328
 
329
+ export interface TWikiCommentUser {
330
+ id: string;
331
+ name: string;
332
+ avatarUrl: string;
333
+ }
334
+
335
+ export interface TWikiComment {
336
+ id: string;
337
+ pageId: string;
338
+ parentCommentId?: string | null;
339
+ content: string;
340
+ selection?: string | null;
341
+ creatorId: string;
342
+ workspaceId: string;
343
+ resolvedAt?: string | null;
344
+ resolvedById?: string | null;
345
+ createdAt: string;
346
+ editedAt?: string | null;
347
+ deletedAt?: string | null;
348
+ creator: TWikiCommentUser;
349
+ resolvedBy?: TWikiCommentUser | null;
350
+ }
351
+
352
+ export interface TWikiCommentPagination {
353
+ items: TWikiComment[];
354
+ meta: {
355
+ page: number;
356
+ limit: number;
357
+ hasNextPage: boolean;
358
+ hasPrevPage: boolean;
359
+ };
360
+ }
361
+
294
362
 
295
363
  export type TDataModel = {
296
364
  id: string;
@@ -416,3 +484,8 @@ export type TPublishWorker = {
416
484
  prompt: string;
417
485
  data: any;
418
486
  }
487
+
488
+
489
+ export type TEnhanceTopic = {
490
+ tone: string[];
491
+ }