fix(integrations): address code-review findings
n8n: throw on FAILED memory events (was silently returned), poll on any non-terminal status (PENDING or RUNNING), use top_k (not limit) for search, coerce search/getAll responses to arrays, guard invalid-JSON metadata, reject empty updates, mark user_id required; lint clean. Zapier: coerce boolean fields (String(x) !== 'false') + boolean defaults so "Wait"/"Infer = No" are honored, throw on HTTP >= 400 (was silent empty/fake-success), throw on FAILED events, use top_k, numeric coercion with clamping, mark user_id required.
This commit is contained in:
@@ -7,7 +7,7 @@ const perform = async (z, bundle) => {
|
||||
const response = await z.request({
|
||||
url: '/v3/memories/',
|
||||
method: 'POST',
|
||||
params: { page: 1, page_size: bundle.inputData.limit || 50 },
|
||||
params: { page: 1, page_size: Math.max(1, Math.floor(Number(bundle.inputData.limit) || 50)) },
|
||||
body,
|
||||
});
|
||||
const data = response.data;
|
||||
@@ -24,8 +24,8 @@ module.exports = {
|
||||
operation: {
|
||||
perform,
|
||||
inputFields: [
|
||||
{ key: 'user_id', label: 'User ID', type: 'string' },
|
||||
{ key: 'limit', label: 'Limit', type: 'integer', default: '50' },
|
||||
{ key: 'user_id', label: 'User ID', type: 'string', required: true },
|
||||
{ key: 'limit', label: 'Limit', type: 'integer', default: 50 },
|
||||
],
|
||||
sample: { id: '00000000-0000-0000-0000-000000000000', memory: 'User loves hiking' },
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@ const perform = async (z, bundle) => {
|
||||
const body = {
|
||||
query: bundle.inputData.query,
|
||||
output_format: 'v1.1',
|
||||
limit: bundle.inputData.limit || 10,
|
||||
top_k: Math.max(1, Math.floor(Number(bundle.inputData.limit) || 10)),
|
||||
};
|
||||
if (bundle.inputData.user_id) body.filters = { user_id: bundle.inputData.user_id };
|
||||
|
||||
@@ -29,8 +29,8 @@ module.exports = {
|
||||
perform,
|
||||
inputFields: [
|
||||
{ key: 'query', label: 'Query', type: 'string', required: true },
|
||||
{ key: 'user_id', label: 'User ID', type: 'string' },
|
||||
{ key: 'limit', label: 'Limit', type: 'integer', default: '10' },
|
||||
{ key: 'user_id', label: 'User ID', type: 'string', required: true },
|
||||
{ key: 'limit', label: 'Limit', type: 'integer', default: 10 },
|
||||
],
|
||||
sample: { id: '00000000-0000-0000-0000-000000000000', memory: 'User loves hiking' },
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user