I ran into an issue where when fieldIds is undefined on the build input, I get the error "TypeError: this.fileIds is not a function".
The behavior I'm expecting is that the fileIds field is ignored.
const template = {
// ...and other values
fileIds: undefined
};
const nylasDraft = this.connection.drafts.build(template) as Draft; // Ok here
await nylasDraft.save(); // Error Thrown within here.
TypeError: this.fileIds is not a function
optimiser-node-server_1 | at Draft.toJSON (/parent/server/node_modules/nylas/lib/models/draft.js:42:30)
optimiser-node-server_1 | at Draft.RestfulModel.saveRequestBody (/parent/server/node_modules/nylas/lib/models/restful-model.js:57:21)
optimiser-node-server_1 | at Draft.Message.saveRequestBody (/parent/server/node_modules/nylas/lib/models/message.js:86:53)
optimiser-node-server_1 | at Draft.saveRequestBody (/parent/server/node_modules/nylas/lib/models/draft.js:61:49)
optimiser-node-server_1 | at Draft.RestfulModel._save (/parent/server/node_modules/nylas/lib/models/restful-model.js:90:24)
optimiser-node-server_1 | at Draft.save (/parent/server/node_modules/nylas/lib/models/draft.js:55:21)
For now I'm sanitizing the input and removing all keys with undefined values from the template.
I ran into an issue where when fieldIds is undefined on the build input, I get the error "TypeError: this.fileIds is not a function".
The behavior I'm expecting is that the fileIds field is ignored.
For now I'm sanitizing the input and removing all keys with undefined values from the template.