@appconda/sdk 1.0.602 → 1.0.606
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/client.d.ts +8 -0
- package/dist/client.js +75 -8
- package/dist/getAppcondaClient.d.ts +14 -3
- package/dist/getAppcondaClient.js +51 -59
- package/dist/getSDKForService.d.ts +3 -1
- package/dist/getSDKForService.js +4 -4
- package/dist/index.d.ts +5 -1
- package/dist/index.js +3 -1
- package/dist/modules/accounv1/schema.d.ts +1 -1
- package/dist/modules/accounv1/schema.js +2 -2
- package/dist/modules/accounv1/types.d.ts +1 -1
- package/dist/modules/accounv1/types.js +1 -1
- package/dist/modules/emploid/schema.d.ts +69 -9
- package/dist/modules/emploid/schema.js +71 -11
- package/dist/modules/emploid/service.d.ts +23 -4
- package/dist/modules/emploid/service.js +129 -3
- package/dist/modules/emploid/types.d.ts +91 -5
- package/dist/modules/emploid/types.js +1 -1
- package/dist/modules/organization/schema.d.ts +35 -1
- package/dist/modules/organization/schema.js +31 -2
- package/dist/modules/organization/service.d.ts +9 -2
- package/dist/modules/organization/service.js +29 -8
- package/dist/modules/organization/types.d.ts +45 -1
- package/dist/modules/organization/types.js +1 -1
- package/package.json +1 -1
- package/src/client.ts +96 -8
- package/src/getAppcondaClient.ts +69 -58
- package/src/getSDKForService.ts +7 -4
- package/src/index.ts +5 -2
- package/src/modules/accounv1/schema.ts +2 -2
- package/src/modules/accounv1/types.ts +2 -2
- package/src/modules/emploid/schema.ts +83 -11
- package/src/modules/emploid/service.ts +179 -5
- package/src/modules/emploid/types.ts +99 -5
- package/src/modules/organization/schema.ts +38 -2
- package/src/modules/organization/service.ts +67 -13
- package/src/modules/organization/types.ts +51 -2
- package/dist/inputFile.d.ts +0 -6
- package/dist/inputFile.js +0 -16
- package/dist/modules/agent/action.d.ts +0 -29
- package/dist/modules/agent/action.js +0 -53
- package/dist/modules/ai/node/actions.d.ts +0 -4
- package/dist/modules/ai/node/actions.js +0 -14
- package/dist/modules/builder/action.d.ts +0 -18
- package/dist/modules/builder/action.js +0 -214
- package/dist/modules/datasource/action.d.ts +0 -14
- package/dist/modules/datasource/action.js +0 -172
- package/dist/modules/emploid/action.d.ts +0 -73
- package/dist/modules/emploid/action.js +0 -984
- package/dist/modules/google/action.d.ts +0 -5
- package/dist/modules/google/action.js +0 -46
- package/dist/modules/hooks/lib/handler.d.ts +0 -3
- package/dist/modules/hooks/lib/handler.js +0 -23
- package/dist/modules/mail/action.d.ts +0 -3
- package/dist/modules/mail/action.js +0 -18
- package/dist/modules/notion/action.d.ts +0 -5
- package/dist/modules/notion/action.js +0 -46
- package/dist/modules/organization/action.d.ts +0 -7
- package/dist/modules/organization/action.js +0 -60
- package/dist/modules/scheduled-job/action.d.ts +0 -70
- package/dist/modules/scheduled-job/action.js +0 -173
- package/dist/modules/scheduled-job/lib/handler.d.ts +0 -3
- package/dist/modules/scheduled-job/lib/handler.js +0 -23
- package/dist/modules/task/action.d.ts +0 -64
- package/dist/modules/task/action.js +0 -758
- package/dist/modules/tenant/actions.d.ts +0 -10
- package/dist/modules/tenant/actions.js +0 -160
- package/dist/modules/waitlist/action.d.ts +0 -6
- package/dist/modules/waitlist/action.js +0 -78
package/src/getAppcondaClient.ts
CHANGED
|
@@ -1,73 +1,84 @@
|
|
|
1
|
-
import { Client } from
|
|
1
|
+
import { Client } from './client';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
18
|
+
function normalizeEndpoint(endpoint: string): string {
|
|
19
|
+
return endpoint.replace(/\/+$/, '');
|
|
20
|
+
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
|
|
40
|
+
return APPCONDA_NODE_DEFAULT_ENDPOINT;
|
|
41
|
+
}
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
63
|
-
|
|
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
|
-
|
|
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
|
+
}
|
package/src/getSDKForService.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getAppcondaClient } from
|
|
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
|
|
39
|
-
|
|
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
|
|
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
|
-
|
|
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
|
+
});
|
|
@@ -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
|
-
|
|
102
|
-
|
|
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
|
-
|
|
109
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(),
|
|
@@ -1294,7 +1352,21 @@ export const PublishEmploidSchema = z.object({
|
|
|
1294
1352
|
emploidId: z.string(),
|
|
1295
1353
|
});
|
|
1296
1354
|
|
|
1297
|
-
export const
|
|
1355
|
+
export const PublishWorkerToMarketStoreSchema = z.object({
|
|
1298
1356
|
tenantId: z.string(),
|
|
1299
1357
|
workerId: z.string(),
|
|
1300
|
-
});
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
export const ListMarketStoreItemsSchema = z.object({
|
|
1361
|
+
tenantId: z.string(),
|
|
1362
|
+
});
|
|
1363
|
+
|
|
1364
|
+
export const GetMarketStoreItemSchema = z.object({
|
|
1365
|
+
id: z.string(),
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
export const EnhanceTopicSchema = z.object({
|
|
1369
|
+
entityName: z.string(),
|
|
1370
|
+
entityDescription: z.string(),
|
|
1371
|
+
categories: z.string().array().optional()
|
|
1372
|
+
})
|
|
@@ -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,
|
|
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,
|
|
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, GetMarketStoreItemSchema, 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, ListMarketStoreItemsSchema, ListOccupationsSchema, ListRecordPermissionsSchema, ListRecordsSchema, ListScopesSchema, ListSkillsSchema, ListTaskTemplatesSchema, ListTeamsSchema, ListTopicsSchema, ListWikiCommentsSchema, ListWikiPagesSchema, ListWorkersSchema, ListWorkerTopicsSchema, PreviewValidationErrorsSchema, PublishDomainSchema, PublishEmploidSchema, PublishWorkerToMarketStoreSchema, 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, TMarketStoreItem, TOccupation, TPaginatedEmploidsResult, TPublishEmploid, TPublishWorkerToMarketStore, 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
|
|
351
|
+
public async ListAssistantConstraints(payload: z.infer<typeof ListAssistantConstraintsSchema>): Promise<TAssistantConstraint[]> {
|
|
244
352
|
return await this.actionCall('assistant', 'ListAssistantConstraints', payload);
|
|
245
353
|
}
|
|
246
354
|
|
|
@@ -383,8 +491,8 @@ export class EmploidService extends ServiceClient {
|
|
|
383
491
|
return await this.actionCall('worker', 'DeleteWorker', payload);
|
|
384
492
|
}
|
|
385
493
|
|
|
386
|
-
public async
|
|
387
|
-
return await this.actionCall('
|
|
494
|
+
public async PublishWorkerToMarketStore(payload: z.infer<typeof PublishWorkerToMarketStoreSchema>): Promise<TPublishWorkerToMarketStore> {
|
|
495
|
+
return await this.actionCall('marketStore', 'PublishWorkerToMarketStore', payload);
|
|
388
496
|
}
|
|
389
497
|
|
|
390
498
|
public async ListWorkers(payload: z.infer<typeof ListWorkersSchema>): Promise<TWorker[]> {
|
|
@@ -407,6 +515,14 @@ export class EmploidService extends ServiceClient {
|
|
|
407
515
|
return await this.actionCall('worker', 'ListWorkerTopics', payload);
|
|
408
516
|
}
|
|
409
517
|
|
|
518
|
+
public async ListMarketStoreItems(payload: z.infer<typeof ListMarketStoreItemsSchema>): Promise<TMarketStoreItem[]> {
|
|
519
|
+
return await this.actionCall('marketStore', 'ListMarketStoreItems', payload);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
public async GetMarketStoreItem(payload: z.infer<typeof GetMarketStoreItemSchema>): Promise<TMarketStoreItem | null> {
|
|
523
|
+
return await this.actionCall('marketStore', 'GetMarketStoreItem', payload);
|
|
524
|
+
}
|
|
525
|
+
|
|
410
526
|
//--------------------------------------------
|
|
411
527
|
|
|
412
528
|
//--------------------Topics-------------------
|
|
@@ -427,6 +543,10 @@ export class EmploidService extends ServiceClient {
|
|
|
427
543
|
return await this.actionCall('topic', 'ListTopics', payload);
|
|
428
544
|
}
|
|
429
545
|
|
|
546
|
+
public async EnhanceTopic(payload: z.infer<typeof EnhanceTopicSchema>): Promise<TEnhanceTopic> {
|
|
547
|
+
return await this.actionCall('topic', 'EnhanceTopic', payload);
|
|
548
|
+
}
|
|
549
|
+
|
|
430
550
|
//---------------------------------------------
|
|
431
551
|
|
|
432
552
|
public async CreateInput(payload: z.infer<typeof CreateInputSchema>): Promise<TInput> {
|
|
@@ -987,6 +1107,60 @@ export class EmploidService extends ServiceClient {
|
|
|
987
1107
|
return await this.actionCall("wiki", "ListWikiPages", payload);
|
|
988
1108
|
}
|
|
989
1109
|
|
|
1110
|
+
public async UploadWikiFile(
|
|
1111
|
+
payload: z.infer<typeof UploadEditorFileSchema>
|
|
1112
|
+
): Promise<TUploadedFile> {
|
|
1113
|
+
return await this.actionCall("wiki", "UploadFile", payload);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
public async ResolveWikiFileView(
|
|
1117
|
+
payload: z.infer<typeof ResolveWikiFileViewSchema>
|
|
1118
|
+
): Promise<TWikiFileViewResolution> {
|
|
1119
|
+
const result = await this.actionCall<any>("wiki", "ResolveWikiFileView", payload);
|
|
1120
|
+
const storagePath =
|
|
1121
|
+
this.normalizeStoragePath(String(result?.path || result?.filePath || result?.url || ""));
|
|
1122
|
+
const resolvedUrl = this.resolveStorageViewUrl(storagePath);
|
|
1123
|
+
|
|
1124
|
+
return {
|
|
1125
|
+
...result,
|
|
1126
|
+
fileId: String(result?.fileId || payload.fileId || ""),
|
|
1127
|
+
path: storagePath,
|
|
1128
|
+
filePath: resolvedUrl || storagePath,
|
|
1129
|
+
url: resolvedUrl || storagePath,
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
public async CreateWikiComment(
|
|
1134
|
+
payload: z.infer<typeof CreateWikiCommentSchema>
|
|
1135
|
+
): Promise<TWikiComment> {
|
|
1136
|
+
return await this.actionCall("wiki", "CreateWikiComment", payload);
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
public async UpdateWikiComment(
|
|
1140
|
+
payload: z.infer<typeof UpdateWikiCommentSchema>
|
|
1141
|
+
): Promise<TWikiComment> {
|
|
1142
|
+
const normalizedPayload = {
|
|
1143
|
+
...payload,
|
|
1144
|
+
...(typeof payload.resolved === "boolean"
|
|
1145
|
+
? { resolved: payload.resolved ? "true" : "false" }
|
|
1146
|
+
: {}),
|
|
1147
|
+
} as any;
|
|
1148
|
+
|
|
1149
|
+
return await this.actionCall("wiki", "UpdateWikiComment", normalizedPayload);
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
public async DeleteWikiComment(
|
|
1153
|
+
payload: z.infer<typeof DeleteWikiCommentSchema>
|
|
1154
|
+
): Promise<{ id: string; deletedAt: string }> {
|
|
1155
|
+
return await this.actionCall("wiki", "DeleteWikiComment", payload);
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
public async ListWikiComments(
|
|
1159
|
+
payload: z.infer<typeof ListWikiCommentsSchema>
|
|
1160
|
+
): Promise<TWikiCommentPagination> {
|
|
1161
|
+
return await this.actionCall("wiki", "ListWikiComments", payload);
|
|
1162
|
+
}
|
|
1163
|
+
|
|
990
1164
|
public async RestoreWikiPage(
|
|
991
1165
|
payload: z.infer<typeof RestoreWikiPageSchema>
|
|
992
1166
|
): Promise<any> {
|