Zapier: - Bound the poll budget under Zapier's step timeout and default Wait for Completion off; timeout message notes the add likely still succeeded - Add offline unit tests (mocked z.request) and run them in CI - Expose a Page input on Get Memories - Encode memory_id in the delete path - Update E2E to test the default no-wait path (add then search-retry) n8n: - Clarify the Infer description (controls extraction, not waiting) - Add an App ID field and require at least one entity id before add - Pass itemIndex into pollEvent errors - Unwrap event results so wait-path output matches search and get many
49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
const perform = async (z, bundle) => {
|
|
const body = {};
|
|
if (bundle.inputData.user_id) body.filters = { user_id: bundle.inputData.user_id };
|
|
|
|
const response = await z.request({
|
|
url: '/v3/memories/',
|
|
method: 'POST',
|
|
params: {
|
|
page: Math.max(1, Math.floor(Number(bundle.inputData.page) || 1)),
|
|
page_size: Math.max(1, Math.floor(Number(bundle.inputData.limit) || 50)),
|
|
},
|
|
body,
|
|
});
|
|
const data = response.data;
|
|
return Array.isArray(data) ? data : data.results || [];
|
|
};
|
|
|
|
module.exports = {
|
|
key: 'get_memories',
|
|
noun: 'Memory',
|
|
display: {
|
|
label: 'Get Memories',
|
|
description: 'List stored memories for a user.',
|
|
},
|
|
operation: {
|
|
perform,
|
|
inputFields: [
|
|
{ key: 'user_id', label: 'User ID', type: 'string', required: true },
|
|
{
|
|
key: 'limit',
|
|
label: 'Limit',
|
|
type: 'integer',
|
|
default: '50',
|
|
helpText: 'Max memories per page. Use Page to page through larger result sets.',
|
|
},
|
|
{
|
|
key: 'page',
|
|
label: 'Page',
|
|
type: 'integer',
|
|
default: '1',
|
|
helpText: 'Which page of results to return (1-based).',
|
|
},
|
|
],
|
|
sample: { id: '00000000-0000-0000-0000-000000000000', memory: 'User loves hiking' },
|
|
},
|
|
};
|