@peopl-health/nexus 5.12.4 → 5.12.5
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.
|
@@ -216,7 +216,6 @@ const submitForApproval = async (req, res) => {
|
|
|
216
216
|
$set: {
|
|
217
217
|
status: 'PENDING',
|
|
218
218
|
approvalRequest: {
|
|
219
|
-
sid: response.sid,
|
|
220
219
|
dateSubmitted: validSubmittedDate,
|
|
221
220
|
dateUpdated: validUpdatedDate,
|
|
222
221
|
rejectionReason: response.rejection_reason || ''
|
|
@@ -270,7 +269,6 @@ const checkApprovalStatus = async (req, res) => {
|
|
|
270
269
|
status.approvalRequest.date_created || status.approvalRequest.dateCreated || status.content.dateCreated
|
|
271
270
|
);
|
|
272
271
|
dbTemplate.approvalRequest = {
|
|
273
|
-
sid: status.approvalRequest.sid,
|
|
274
272
|
dateSubmitted,
|
|
275
273
|
dateUpdated: parseDate(
|
|
276
274
|
status.approvalRequest.date_updated || status.approvalRequest.dateUpdated || status.content.dateUpdated,
|
|
@@ -288,7 +286,7 @@ const checkApprovalStatus = async (req, res) => {
|
|
|
288
286
|
contentSid,
|
|
289
287
|
content: status.content,
|
|
290
288
|
approvalRequest: status.approvalRequest,
|
|
291
|
-
template: dbTemplate
|
|
289
|
+
template: dbTemplate ? _formatTemplate(dbTemplate) : null
|
|
292
290
|
});
|
|
293
291
|
} catch (err) {
|
|
294
292
|
// If Twilio check fails but we have DB record, return what we know
|
|
@@ -301,7 +299,7 @@ const checkApprovalStatus = async (req, res) => {
|
|
|
301
299
|
status: dbTemplate.status
|
|
302
300
|
},
|
|
303
301
|
approvalRequest: dbTemplate.approvalRequest,
|
|
304
|
-
template: dbTemplate,
|
|
302
|
+
template: _formatTemplate(dbTemplate),
|
|
305
303
|
warning: 'Could not fetch latest status from Twilio'
|
|
306
304
|
});
|
|
307
305
|
}
|
|
@@ -412,7 +410,7 @@ const getCompleteTemplate = async (req, res) => {
|
|
|
412
410
|
|
|
413
411
|
return res.status(200).json({
|
|
414
412
|
success: true,
|
|
415
|
-
template
|
|
413
|
+
template: _formatTemplate(template)
|
|
416
414
|
});
|
|
417
415
|
} catch (error) {
|
|
418
416
|
return handleApiError(res, error, 'Failed to get complete template');
|
package/lib/index.d.ts
CHANGED
|
@@ -116,13 +116,13 @@ declare module '@peopl-health/nexus' {
|
|
|
116
116
|
name: string;
|
|
117
117
|
description?: string;
|
|
118
118
|
parameters?: any;
|
|
119
|
-
handler: (args: any) =>
|
|
119
|
+
handler: (args: any) => string | Promise<string>;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export interface AssistantConfigDefinition {
|
|
123
123
|
extends?: typeof BaseAssistant;
|
|
124
124
|
create?: (this: BaseAssistant, code: string, context?: any) => Promise<any>;
|
|
125
|
-
tools?: Array<AssistantToolDefinition | { name: string; definition?: any; handler: (args: any) =>
|
|
125
|
+
tools?: Array<AssistantToolDefinition | { name: string; definition?: any; handler: (args: any) => string | Promise<string> }>;
|
|
126
126
|
setup?: (this: BaseAssistant, context: { assistantId: string; thread?: any; options?: any }) => void;
|
|
127
127
|
}
|
|
128
128
|
|
|
@@ -138,7 +138,7 @@ declare module '@peopl-health/nexus' {
|
|
|
138
138
|
assistantId?: string;
|
|
139
139
|
thread?: any;
|
|
140
140
|
client?: any;
|
|
141
|
-
tools?: Array<AssistantToolDefinition | { name: string; definition?: any; handler: (args: any) =>
|
|
141
|
+
tools?: Array<AssistantToolDefinition | { name: string; definition?: any; handler: (args: any) => string | Promise<string> }>;
|
|
142
142
|
setup?: (context: { assistantId: string; thread?: any; options?: any }) => void;
|
|
143
143
|
status?: string;
|
|
144
144
|
} | any);
|
|
@@ -146,9 +146,9 @@ declare module '@peopl-health/nexus' {
|
|
|
146
146
|
thread: any;
|
|
147
147
|
status: string;
|
|
148
148
|
createdAt: Date;
|
|
149
|
-
registerTool(definition: AssistantToolDefinition | string, schema?: any, handler?: (args: any) =>
|
|
149
|
+
registerTool(definition: AssistantToolDefinition | string, schema?: any, handler?: (args: any) => string | Promise<string>): void;
|
|
150
150
|
getToolSchemas(): any[];
|
|
151
|
-
executeTool(name: string, args: any): Promise<
|
|
151
|
+
executeTool(name: string, args: any): Promise<string>;
|
|
152
152
|
getPreviousMessages(thread?: any): Promise<Array<{ role: string; content: any }>>;
|
|
153
153
|
createThread(code: string, context?: any): Promise<any>;
|
|
154
154
|
sendMessage(userId: string, message: string, options?: any): Promise<any>;
|
|
@@ -15,7 +15,6 @@ const refreshApprovalStatuses = async (templates) => {
|
|
|
15
15
|
const reqData = approvalInfo.approvalRequest;
|
|
16
16
|
const updateFields = {
|
|
17
17
|
approvalRequest: {
|
|
18
|
-
sid: reqData.sid,
|
|
19
18
|
dateSubmitted: reqData.dateCreated ? new Date(reqData.dateCreated) : new Date(),
|
|
20
19
|
dateUpdated: reqData.dateUpdated ? new Date(reqData.dateUpdated) : new Date(),
|
|
21
20
|
rejectionReason: reqData.rejectionReason || ''
|