merchi_sdk_js 0.1.9 → 0.2.0
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/package.json +1 -1
- package/src/agent_skill.js +74 -0
- package/src/agent_skill_approval.js +26 -0
- package/src/agent_skill_version.js +49 -0
- package/src/merchi.js +9 -0
package/package.json
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { generateUUID } from './uuid.js';
|
|
2
|
+
import {
|
|
3
|
+
addPropertyTo,
|
|
4
|
+
serialise,
|
|
5
|
+
fromJson,
|
|
6
|
+
create,
|
|
7
|
+
enumerateFiles,
|
|
8
|
+
getOne,
|
|
9
|
+
getList,
|
|
10
|
+
fromJsonList,
|
|
11
|
+
} from './model.js';
|
|
12
|
+
import { AgentSkillVersion } from './agent_skill_version.js';
|
|
13
|
+
|
|
14
|
+
export function AgentSkill() {
|
|
15
|
+
this.resource = '/agent_skills';
|
|
16
|
+
this.json = 'agentSkill';
|
|
17
|
+
this.temporaryId = generateUUID();
|
|
18
|
+
|
|
19
|
+
addPropertyTo(this, 'id');
|
|
20
|
+
addPropertyTo(this, 'slug');
|
|
21
|
+
addPropertyTo(this, 'title');
|
|
22
|
+
addPropertyTo(this, 'description');
|
|
23
|
+
addPropertyTo(this, 'priority');
|
|
24
|
+
addPropertyTo(this, 'createdAt');
|
|
25
|
+
addPropertyTo(this, 'disabledAt');
|
|
26
|
+
addPropertyTo(this, 'currentDraftVersionId');
|
|
27
|
+
addPropertyTo(this, 'currentPublishedVersionId');
|
|
28
|
+
addPropertyTo(this, 'versions', AgentSkillVersion);
|
|
29
|
+
|
|
30
|
+
this.create = function (success, error, embed, as_domain) {
|
|
31
|
+
var data = serialise(this),
|
|
32
|
+
self = this;
|
|
33
|
+
function handleResponse(result) {
|
|
34
|
+
success(fromJson(self, result[self.json]));
|
|
35
|
+
}
|
|
36
|
+
create({
|
|
37
|
+
resource: this.resource,
|
|
38
|
+
parameters: data[0],
|
|
39
|
+
files: enumerateFiles(data[1]),
|
|
40
|
+
as_domain: as_domain,
|
|
41
|
+
success: handleResponse,
|
|
42
|
+
error: error,
|
|
43
|
+
embed: embed,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
this.get = function (success, error, embed) {
|
|
48
|
+
var self = this;
|
|
49
|
+
function handleResponse(result) {
|
|
50
|
+
success(fromJson(self, result[self.json], {makesDirty: false}));
|
|
51
|
+
}
|
|
52
|
+
getOne({
|
|
53
|
+
resource: this.resource,
|
|
54
|
+
id: this.id(),
|
|
55
|
+
success: handleResponse,
|
|
56
|
+
error: error,
|
|
57
|
+
embed: embed,
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function AgentSkills() {
|
|
63
|
+
this.resource = '/agent_skills';
|
|
64
|
+
this.json = 'agentSkills';
|
|
65
|
+
this.single = AgentSkill;
|
|
66
|
+
|
|
67
|
+
this.get = function (success, error, parameters, withUpdates) {
|
|
68
|
+
var self = this;
|
|
69
|
+
function handleResponse(result) {
|
|
70
|
+
success(fromJsonList(self, result, {makesDirty: false}));
|
|
71
|
+
}
|
|
72
|
+
getList(this.resource, handleResponse, error, parameters || {}, withUpdates);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { generateUUID } from './uuid.js';
|
|
2
|
+
import { addPropertyTo, fromJsonList } from './model.js';
|
|
3
|
+
import { User } from './user.js';
|
|
4
|
+
|
|
5
|
+
export function AgentSkillApproval() {
|
|
6
|
+
this.resource = '/agent_skill_approvals';
|
|
7
|
+
this.json = 'agentSkillApproval';
|
|
8
|
+
this.temporaryId = generateUUID();
|
|
9
|
+
|
|
10
|
+
addPropertyTo(this, 'id');
|
|
11
|
+
addPropertyTo(this, 'skillVersionId');
|
|
12
|
+
addPropertyTo(this, 'superUser', User);
|
|
13
|
+
addPropertyTo(this, 'decision');
|
|
14
|
+
addPropertyTo(this, 'comment');
|
|
15
|
+
addPropertyTo(this, 'createdAt');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function AgentSkillApprovals() {
|
|
19
|
+
this.resource = '/agent_skill_approvals';
|
|
20
|
+
this.json = 'agentSkillApprovals';
|
|
21
|
+
this.single = AgentSkillApproval;
|
|
22
|
+
|
|
23
|
+
this.fromJson = function (result, options) {
|
|
24
|
+
return fromJsonList(this, result, options);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { generateUUID } from './uuid.js';
|
|
2
|
+
import {
|
|
3
|
+
addPropertyTo,
|
|
4
|
+
fromJson,
|
|
5
|
+
fromJsonList,
|
|
6
|
+
getOne,
|
|
7
|
+
} from './model.js';
|
|
8
|
+
import { AgentSkillApproval } from './agent_skill_approval.js';
|
|
9
|
+
|
|
10
|
+
export function AgentSkillVersion() {
|
|
11
|
+
this.resource = '/agent_skill_versions';
|
|
12
|
+
this.json = 'agentSkillVersion';
|
|
13
|
+
this.temporaryId = generateUUID();
|
|
14
|
+
|
|
15
|
+
addPropertyTo(this, 'id');
|
|
16
|
+
addPropertyTo(this, 'skillId');
|
|
17
|
+
addPropertyTo(this, 'versionNumber');
|
|
18
|
+
addPropertyTo(this, 'contentMd');
|
|
19
|
+
addPropertyTo(this, 'contentHash');
|
|
20
|
+
addPropertyTo(this, 'status');
|
|
21
|
+
addPropertyTo(this, 'requestedAt');
|
|
22
|
+
addPropertyTo(this, 'publishedAt');
|
|
23
|
+
addPropertyTo(this, 'disabledAt');
|
|
24
|
+
addPropertyTo(this, 'approvals', AgentSkillApproval);
|
|
25
|
+
|
|
26
|
+
this.get = function (success, error, embed) {
|
|
27
|
+
var self = this;
|
|
28
|
+
function handleResponse(result) {
|
|
29
|
+
success(fromJson(self, result[self.json], {makesDirty: false}));
|
|
30
|
+
}
|
|
31
|
+
getOne({
|
|
32
|
+
resource: this.resource,
|
|
33
|
+
id: this.id(),
|
|
34
|
+
success: handleResponse,
|
|
35
|
+
error: error,
|
|
36
|
+
embed: embed,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function AgentSkillVersions() {
|
|
42
|
+
this.resource = '/agent_skill_versions';
|
|
43
|
+
this.json = 'agentSkillVersions';
|
|
44
|
+
this.single = AgentSkillVersion;
|
|
45
|
+
|
|
46
|
+
this.fromJson = function (result, options) {
|
|
47
|
+
return fromJsonList(this, result, options);
|
|
48
|
+
};
|
|
49
|
+
}
|
package/src/merchi.js
CHANGED
|
@@ -81,6 +81,9 @@ import { Quotes, Quote } from './quote.js';
|
|
|
81
81
|
import { Reminder, Reminders } from './reminder.js';
|
|
82
82
|
import { InternalTag, InternalTags } from './internal_tag.js';
|
|
83
83
|
import { AgentConversation, AgentConversations } from './agent_conversation.js';
|
|
84
|
+
import { AgentSkill, AgentSkills } from './agent_skill.js';
|
|
85
|
+
import { AgentSkillVersion, AgentSkillVersions } from './agent_skill_version.js';
|
|
86
|
+
import { AgentSkillApproval, AgentSkillApprovals } from './agent_skill_approval.js';
|
|
84
87
|
import { DomainChatSettings, DomainChatSettingsList } from './domain_chat_settings.js';
|
|
85
88
|
import { SupportConversation, SupportConversations } from './support_conversation.js';
|
|
86
89
|
import { SupportMessage, SupportMessages } from './support_message.js';
|
|
@@ -1007,6 +1010,12 @@ export function merchi(backendUri, websocketUri) {
|
|
|
1007
1010
|
'notifications': new Notifications(),
|
|
1008
1011
|
'AgentConversation': AgentConversation,
|
|
1009
1012
|
'agentConversations': new AgentConversations(),
|
|
1013
|
+
'AgentSkill': AgentSkill,
|
|
1014
|
+
'agentSkills': new AgentSkills(),
|
|
1015
|
+
'AgentSkillVersion': AgentSkillVersion,
|
|
1016
|
+
'agentSkillVersions': new AgentSkillVersions(),
|
|
1017
|
+
'AgentSkillApproval': AgentSkillApproval,
|
|
1018
|
+
'agentSkillApprovals': new AgentSkillApprovals(),
|
|
1010
1019
|
'DomainChatSettings': DomainChatSettings,
|
|
1011
1020
|
'domainChatSettingsList': new DomainChatSettingsList(),
|
|
1012
1021
|
'SupportConversation': SupportConversation,
|