20 lines
847 B
JavaScript
20 lines
847 B
JavaScript
function createOfflineIssueClose({ enqueueDurably, completeToday, createOperationId = () =>
|
|
globalThis.crypto?.randomUUID?.() || String(Date.now()) + '-' + Math.random().toString(16).slice(2) }) {
|
|
return async function closeOfflineIssue(item) {
|
|
const admission = await enqueueDurably({
|
|
kind: 'issue-close',
|
|
repository: String(item.repository || ''),
|
|
number: Number(item.number || 0),
|
|
body: '',
|
|
operationId: String(createOperationId()).slice(0, 128),
|
|
});
|
|
const advanced = Boolean(completeToday(item, {
|
|
successMessage: 'Issue closure queued. Next Today item opened.',
|
|
failureMessage: 'Issue closure queued, but Today still needs completion.',
|
|
}));
|
|
return { admission, advanced };
|
|
};
|
|
}
|
|
|
|
if (typeof module !== 'undefined' && module.exports) module.exports = createOfflineIssueClose;
|