@noodleseed/one 0.97.0 → 0.98.0

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.
Files changed (71) hide show
  1. package/node_modules/@noodle-borg/service/dist/feedback-operations/bootstrap.d.ts +7 -0
  2. package/node_modules/@noodle-borg/service/dist/feedback-operations/bootstrap.d.ts.map +1 -0
  3. package/node_modules/@noodle-borg/service/dist/feedback-operations/bootstrap.js +23 -0
  4. package/node_modules/@noodle-borg/service/dist/feedback-operations/bootstrap.js.map +1 -0
  5. package/node_modules/@noodle-borg/service/dist/feedback-operations/config.d.ts +12 -0
  6. package/node_modules/@noodle-borg/service/dist/feedback-operations/config.d.ts.map +1 -0
  7. package/node_modules/@noodle-borg/service/dist/feedback-operations/config.js +47 -0
  8. package/node_modules/@noodle-borg/service/dist/feedback-operations/config.js.map +1 -0
  9. package/node_modules/@noodle-borg/service/dist/feedback-operations/contracts.d.ts +24 -0
  10. package/node_modules/@noodle-borg/service/dist/feedback-operations/contracts.d.ts.map +1 -0
  11. package/node_modules/@noodle-borg/service/dist/feedback-operations/contracts.js +2 -0
  12. package/node_modules/@noodle-borg/service/dist/feedback-operations/contracts.js.map +1 -0
  13. package/node_modules/@noodle-borg/service/dist/feedback-operations/delivery-worker.d.ts +29 -0
  14. package/node_modules/@noodle-borg/service/dist/feedback-operations/delivery-worker.d.ts.map +1 -0
  15. package/node_modules/@noodle-borg/service/dist/feedback-operations/delivery-worker.js +256 -0
  16. package/node_modules/@noodle-borg/service/dist/feedback-operations/delivery-worker.js.map +1 -0
  17. package/node_modules/@noodle-borg/service/dist/feedback-operations/linear-client.d.ts +39 -0
  18. package/node_modules/@noodle-borg/service/dist/feedback-operations/linear-client.d.ts.map +1 -0
  19. package/node_modules/@noodle-borg/service/dist/feedback-operations/linear-client.js +142 -0
  20. package/node_modules/@noodle-borg/service/dist/feedback-operations/linear-client.js.map +1 -0
  21. package/node_modules/@noodle-borg/service/dist/feedback-operations/reporter-email.d.ts +33 -0
  22. package/node_modules/@noodle-borg/service/dist/feedback-operations/reporter-email.d.ts.map +1 -0
  23. package/node_modules/@noodle-borg/service/dist/feedback-operations/reporter-email.js +142 -0
  24. package/node_modules/@noodle-borg/service/dist/feedback-operations/reporter-email.js.map +1 -0
  25. package/node_modules/@noodle-borg/service/dist/feedback-operations/slack-card.d.ts +138 -0
  26. package/node_modules/@noodle-borg/service/dist/feedback-operations/slack-card.d.ts.map +1 -0
  27. package/node_modules/@noodle-borg/service/dist/feedback-operations/slack-card.js +199 -0
  28. package/node_modules/@noodle-borg/service/dist/feedback-operations/slack-card.js.map +1 -0
  29. package/node_modules/@noodle-borg/service/dist/feedback-operations/slack-client.d.ts +44 -0
  30. package/node_modules/@noodle-borg/service/dist/feedback-operations/slack-client.d.ts.map +1 -0
  31. package/node_modules/@noodle-borg/service/dist/feedback-operations/slack-client.js +95 -0
  32. package/node_modules/@noodle-borg/service/dist/feedback-operations/slack-client.js.map +1 -0
  33. package/node_modules/@noodle-borg/service/dist/main.js +38 -3
  34. package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
  35. package/node_modules/@noodle-borg/service/dist/options.d.ts +14 -0
  36. package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
  37. package/node_modules/@noodle-borg/service/dist/routes/feedback-operations-dispatch.d.ts +9 -0
  38. package/node_modules/@noodle-borg/service/dist/routes/feedback-operations-dispatch.d.ts.map +1 -0
  39. package/node_modules/@noodle-borg/service/dist/routes/feedback-operations-dispatch.js +53 -0
  40. package/node_modules/@noodle-borg/service/dist/routes/feedback-operations-dispatch.js.map +1 -0
  41. package/node_modules/@noodle-borg/service/dist/routes/feedback.d.ts +2 -0
  42. package/node_modules/@noodle-borg/service/dist/routes/feedback.d.ts.map +1 -1
  43. package/node_modules/@noodle-borg/service/dist/routes/feedback.js +22 -0
  44. package/node_modules/@noodle-borg/service/dist/routes/feedback.js.map +1 -1
  45. package/node_modules/@noodle-borg/service/dist/routes/linear-feedback-webhook.d.ts +17 -0
  46. package/node_modules/@noodle-borg/service/dist/routes/linear-feedback-webhook.d.ts.map +1 -0
  47. package/node_modules/@noodle-borg/service/dist/routes/linear-feedback-webhook.js +141 -0
  48. package/node_modules/@noodle-borg/service/dist/routes/linear-feedback-webhook.js.map +1 -0
  49. package/node_modules/@noodle-borg/service/dist/routes/slack-feedback-actions.d.ts +13 -0
  50. package/node_modules/@noodle-borg/service/dist/routes/slack-feedback-actions.d.ts.map +1 -0
  51. package/node_modules/@noodle-borg/service/dist/routes/slack-feedback-actions.js +99 -0
  52. package/node_modules/@noodle-borg/service/dist/routes/slack-feedback-actions.js.map +1 -0
  53. package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
  54. package/node_modules/@noodle-borg/service/dist/serve.js +23 -0
  55. package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
  56. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts +1 -0
  57. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts.map +1 -1
  58. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +2 -0
  59. package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js.map +1 -1
  60. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  61. package/node_modules/@noodle-borg/service/dist/service.js +6 -0
  62. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  63. package/node_modules/@noodle-borg/service/dist/store/feedback-operations.d.ts +186 -0
  64. package/node_modules/@noodle-borg/service/dist/store/feedback-operations.d.ts.map +1 -0
  65. package/node_modules/@noodle-borg/service/dist/store/feedback-operations.js +483 -0
  66. package/node_modules/@noodle-borg/service/dist/store/feedback-operations.js.map +1 -0
  67. package/node_modules/@noodle-borg/service/dist/store/postgres-feedback-operations.d.ts +35 -0
  68. package/node_modules/@noodle-borg/service/dist/store/postgres-feedback-operations.d.ts.map +1 -0
  69. package/node_modules/@noodle-borg/service/dist/store/postgres-feedback-operations.js +172 -0
  70. package/node_modules/@noodle-borg/service/dist/store/postgres-feedback-operations.js.map +1 -0
  71. package/package.json +1 -1
@@ -0,0 +1,483 @@
1
+ import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { z } from 'zod';
4
+ const LINEAR_DELIVERY_REPLAY_WINDOW_MS = 48 * 60 * 60_000;
5
+ function emptyState() {
6
+ return { records: {}, linearDeliveries: {}, startWork: {} };
7
+ }
8
+ export class InMemoryFeedbackOperationsStore {
9
+ state;
10
+ persistState;
11
+ #tail = Promise.resolve();
12
+ constructor(options = {}) {
13
+ this.state = options.state ?? emptyState();
14
+ this.persistState = options.persist ?? (() => Promise.resolve());
15
+ }
16
+ snapshot() {
17
+ return this.#read(() => structuredClone(this.state));
18
+ }
19
+ createTrustedFeedback(input) {
20
+ return this.#write(() => {
21
+ const existing = this.#byGithub(input.githubIssueNumber);
22
+ if (existing !== undefined) {
23
+ if (existing.trustedReporter)
24
+ return existing;
25
+ const firstAcceptance = existing.firstInProgressAt !== undefined && existing.acceptedAt === undefined;
26
+ const upgraded = {
27
+ ...existing,
28
+ trustedReporter: true,
29
+ githubIssueUrl: input.githubIssueUrl,
30
+ title: input.title,
31
+ message: input.message,
32
+ reporterEmail: normalizeEmail(input.reporterEmail),
33
+ createdAt: input.createdAt,
34
+ ...(firstAcceptance
35
+ ? {
36
+ acceptedAt: existing.firstInProgressAt,
37
+ emailNextAttemptAt: input.createdAt,
38
+ }
39
+ : {}),
40
+ };
41
+ this.state.records[existing.id] = upgraded;
42
+ return upgraded;
43
+ }
44
+ const id = `github:${input.githubIssueNumber}`;
45
+ const record = {
46
+ id,
47
+ trustedReporter: true,
48
+ githubIssueNumber: input.githubIssueNumber,
49
+ githubIssueUrl: input.githubIssueUrl,
50
+ title: input.title,
51
+ message: input.message,
52
+ reporterEmail: normalizeEmail(input.reporterEmail),
53
+ createdAt: input.createdAt,
54
+ linearLabels: [],
55
+ slackAttemptCount: 0,
56
+ emailAttemptCount: 0,
57
+ };
58
+ this.state.records[id] = record;
59
+ return record;
60
+ });
61
+ }
62
+ getByGithubIssueNumber(issueNumber) {
63
+ return this.#read(() => this.#byGithub(issueNumber));
64
+ }
65
+ getByLinearIssueId(linearIssueId) {
66
+ return this.#read(() => Object.values(this.state.records).find((record) => record.linearIssueId === linearIssueId));
67
+ }
68
+ getBySlackMessage(channelId, messageTs) {
69
+ return this.#read(() => Object.values(this.state.records).find((record) => record.slackChannelId === channelId && record.slackMessageTs === messageTs));
70
+ }
71
+ applyLinearEvent(input) {
72
+ return this.#write(() => {
73
+ const cutoff = Date.parse(input.eventCreatedAt) - LINEAR_DELIVERY_REPLAY_WINDOW_MS;
74
+ for (const [deliveryId, createdAt] of Object.entries(this.state.linearDeliveries)) {
75
+ if (Date.parse(createdAt) < cutoff)
76
+ delete this.state.linearDeliveries[deliveryId];
77
+ }
78
+ if (this.state.linearDeliveries[input.deliveryId] !== undefined) {
79
+ return {
80
+ duplicate: true,
81
+ bindingConflict: false,
82
+ slackEnqueued: false,
83
+ emailEnqueued: false,
84
+ };
85
+ }
86
+ const byLinear = Object.values(this.state.records).find((record) => record.linearIssueId === input.issue.id);
87
+ const byGithub = input.githubIssueNumber === undefined ? undefined : this.#byGithub(input.githubIssueNumber);
88
+ const linearConflict = input.githubIssueNumber !== undefined &&
89
+ byLinear?.githubIssueNumber !== undefined &&
90
+ byLinear.githubIssueNumber !== input.githubIssueNumber;
91
+ const githubConflict = byGithub?.linearIssueId !== undefined && byGithub.linearIssueId !== input.issue.id;
92
+ if (linearConflict || githubConflict) {
93
+ return {
94
+ duplicate: false,
95
+ bindingConflict: true,
96
+ slackEnqueued: false,
97
+ emailEnqueued: false,
98
+ };
99
+ }
100
+ this.state.linearDeliveries[input.deliveryId] = input.eventCreatedAt;
101
+ let current = byGithub ?? byLinear;
102
+ if (byGithub !== undefined && byLinear !== undefined && byGithub.id !== byLinear.id) {
103
+ current = {
104
+ ...byGithub,
105
+ ...definedDeliveryState(byLinear),
106
+ slackAttemptCount: Math.max(byGithub.slackAttemptCount, byLinear.slackAttemptCount),
107
+ emailAttemptCount: Math.max(byGithub.emailAttemptCount, byLinear.emailAttemptCount),
108
+ };
109
+ delete this.state.records[byLinear.id];
110
+ }
111
+ current ??= {
112
+ id: `linear:${input.issue.id}`,
113
+ trustedReporter: false,
114
+ ...(input.githubIssueNumber !== undefined
115
+ ? { githubIssueNumber: input.githubIssueNumber }
116
+ : {}),
117
+ title: input.issue.title,
118
+ message: input.issue.description,
119
+ createdAt: input.eventCreatedAt,
120
+ linearLabels: [],
121
+ slackAttemptCount: 0,
122
+ emailAttemptCount: 0,
123
+ };
124
+ const firstInProgressAt = current.firstInProgressAt ?? (input.enteredInProgress ? input.eventCreatedAt : undefined);
125
+ const firstAcceptance = firstInProgressAt !== undefined &&
126
+ current.trustedReporter &&
127
+ current.reporterEmail !== undefined &&
128
+ current.acceptedAt === undefined;
129
+ const updated = {
130
+ ...current,
131
+ title: current.trustedReporter ? current.title : input.issue.title,
132
+ message: current.trustedReporter ? current.message : input.issue.description,
133
+ linearIssueId: input.issue.id,
134
+ linearIdentifier: input.issue.identifier,
135
+ linearUrl: input.issue.url,
136
+ linearStatus: input.issue.status,
137
+ ...(input.issue.assigneeName !== undefined
138
+ ? { linearAssigneeName: input.issue.assigneeName }
139
+ : {}),
140
+ linearLabels: [...input.issue.labels],
141
+ slackNextAttemptAt: input.eventCreatedAt,
142
+ ...(firstInProgressAt !== undefined ? { firstInProgressAt } : {}),
143
+ ...(firstAcceptance
144
+ ? { acceptedAt: firstInProgressAt, emailNextAttemptAt: input.eventCreatedAt }
145
+ : {}),
146
+ };
147
+ this.state.records[updated.id] = updated;
148
+ return {
149
+ duplicate: false,
150
+ bindingConflict: false,
151
+ slackEnqueued: true,
152
+ emailEnqueued: firstAcceptance,
153
+ record: updated,
154
+ };
155
+ });
156
+ }
157
+ claimSlackDelivery(input) {
158
+ return this.#claimRecord('slack', input);
159
+ }
160
+ markSlackDelivered(input) {
161
+ return this.#updateRecord(input.recordId, (record) => {
162
+ const { slackNextAttemptAt: _nextAttempt, slackLeaseExpiresAt: _lease, ...pendingCleared } = record;
163
+ return {
164
+ ...pendingCleared,
165
+ slackChannelId: input.channelId,
166
+ slackMessageTs: input.messageTs,
167
+ slackLastDeliveredAt: input.deliveredAt,
168
+ };
169
+ });
170
+ }
171
+ markSlackFailed(input) {
172
+ return this.#updateRecord(input.recordId, (record) => {
173
+ const { slackLeaseExpiresAt: _lease, ...leaseCleared } = record;
174
+ return { ...leaseCleared, slackNextAttemptAt: input.nextAttemptAt.toISOString() };
175
+ });
176
+ }
177
+ markSlackSuppressed(input) {
178
+ return this.#updateRecord(input.recordId, (record) => {
179
+ const { slackNextAttemptAt: _nextAttempt, slackLeaseExpiresAt: _lease, ...pendingCleared } = record;
180
+ return { ...pendingCleared, slackSuppressedAt: input.suppressedAt };
181
+ });
182
+ }
183
+ claimReporterEmail(input) {
184
+ return this.#claimRecord('email', input);
185
+ }
186
+ markReporterEmailSent(input) {
187
+ return this.#updateRecord(input.recordId, (record) => {
188
+ const { emailNextAttemptAt: _nextAttempt, emailLeaseExpiresAt: _lease, ...pendingCleared } = record;
189
+ return {
190
+ ...pendingCleared,
191
+ emailSentAt: input.sentAt,
192
+ emailProviderMessageId: input.providerMessageId,
193
+ slackNextAttemptAt: input.sentAt,
194
+ };
195
+ });
196
+ }
197
+ markReporterEmailFailed(input) {
198
+ return this.#updateRecord(input.recordId, (record) => {
199
+ const { emailLeaseExpiresAt: _lease, ...leaseCleared } = record;
200
+ const nextAttemptAt = input.nextAttemptAt.toISOString();
201
+ return {
202
+ ...leaseCleared,
203
+ emailNextAttemptAt: nextAttemptAt,
204
+ slackNextAttemptAt: nextAttemptAt,
205
+ };
206
+ });
207
+ }
208
+ markReporterEmailSuppressed(input) {
209
+ return this.#updateRecord(input.recordId, (record) => {
210
+ const { emailNextAttemptAt: _nextAttempt, emailLeaseExpiresAt: _lease, ...pendingCleared } = record;
211
+ return {
212
+ ...pendingCleared,
213
+ emailSuppressedAt: input.suppressedAt,
214
+ slackNextAttemptAt: input.suppressedAt,
215
+ };
216
+ });
217
+ }
218
+ markReporterEmailUnknown(input) {
219
+ return this.#updateRecord(input.recordId, (record) => {
220
+ const { emailNextAttemptAt: _nextAttempt, emailLeaseExpiresAt: _lease, ...pendingCleared } = record;
221
+ return {
222
+ ...pendingCleared,
223
+ emailDeliveryUnknownAt: input.unknownAt,
224
+ slackNextAttemptAt: input.unknownAt,
225
+ };
226
+ });
227
+ }
228
+ enqueueStartWork(input) {
229
+ return this.#write(() => {
230
+ const existing = this.state.startWork[input.actionKey];
231
+ if (existing !== undefined)
232
+ return { created: false, command: existing };
233
+ const command = {
234
+ ...input,
235
+ attemptCount: 0,
236
+ nextAttemptAt: input.createdAt,
237
+ };
238
+ this.state.startWork[input.actionKey] = command;
239
+ return { created: true, command };
240
+ });
241
+ }
242
+ claimStartWork(input) {
243
+ return this.#write(() => {
244
+ const nowMs = input.now.getTime();
245
+ const command = Object.values(this.state.startWork)
246
+ .filter((candidate) => candidate.completedAt === undefined &&
247
+ Date.parse(candidate.nextAttemptAt) <= nowMs &&
248
+ (candidate.leaseExpiresAt === undefined ||
249
+ Date.parse(candidate.leaseExpiresAt) <= nowMs))
250
+ .sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];
251
+ if (command === undefined)
252
+ return undefined;
253
+ const claimed = {
254
+ ...command,
255
+ attemptCount: command.attemptCount + 1,
256
+ leaseExpiresAt: new Date(nowMs + input.leaseMs).toISOString(),
257
+ };
258
+ this.state.startWork[command.actionKey] = claimed;
259
+ return claimed;
260
+ });
261
+ }
262
+ markStartWorkCompleted(input) {
263
+ return this.#updateCommand(input.actionKey, (command) => {
264
+ const { leaseExpiresAt: _lease, ...leaseCleared } = command;
265
+ return { ...leaseCleared, completedAt: input.completedAt };
266
+ });
267
+ }
268
+ markStartWorkFailed(input) {
269
+ return this.#updateCommand(input.actionKey, (command) => {
270
+ const { leaseExpiresAt: _lease, ...leaseCleared } = command;
271
+ return { ...leaseCleared, nextAttemptAt: input.nextAttemptAt.toISOString() };
272
+ });
273
+ }
274
+ #claimRecord(kind, input) {
275
+ return this.#write(() => {
276
+ const nowMs = input.now.getTime();
277
+ const record = Object.values(this.state.records)
278
+ .filter((candidate) => {
279
+ const next = kind === 'slack' ? candidate.slackNextAttemptAt : candidate.emailNextAttemptAt;
280
+ const lease = kind === 'slack' ? candidate.slackLeaseExpiresAt : candidate.emailLeaseExpiresAt;
281
+ const complete = kind === 'email' &&
282
+ (candidate.emailSentAt !== undefined ||
283
+ candidate.emailSuppressedAt !== undefined ||
284
+ candidate.emailDeliveryUnknownAt !== undefined);
285
+ return (!complete &&
286
+ next !== undefined &&
287
+ Date.parse(next) <= nowMs &&
288
+ (lease === undefined || Date.parse(lease) <= nowMs));
289
+ })
290
+ .sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];
291
+ if (record === undefined)
292
+ return undefined;
293
+ const leaseExpiresAt = new Date(nowMs + input.leaseMs).toISOString();
294
+ const claimed = kind === 'slack'
295
+ ? {
296
+ ...record,
297
+ slackAttemptCount: record.slackAttemptCount + 1,
298
+ slackLeaseExpiresAt: leaseExpiresAt,
299
+ }
300
+ : {
301
+ ...record,
302
+ emailAttemptCount: record.emailAttemptCount + 1,
303
+ emailLeaseExpiresAt: leaseExpiresAt,
304
+ emailFirstAttemptAt: record.emailFirstAttemptAt ?? input.now.toISOString(),
305
+ };
306
+ this.state.records[record.id] = claimed;
307
+ return claimed;
308
+ });
309
+ }
310
+ #updateRecord(recordId, update) {
311
+ return this.#write(() => {
312
+ const record = this.state.records[recordId];
313
+ if (record === undefined)
314
+ throw new Error('feedback operations record not found');
315
+ this.state.records[recordId] = update(record);
316
+ });
317
+ }
318
+ #updateCommand(actionKey, update) {
319
+ return this.#write(() => {
320
+ const command = this.state.startWork[actionKey];
321
+ if (command === undefined)
322
+ throw new Error('feedback start-work command not found');
323
+ this.state.startWork[actionKey] = update(command);
324
+ });
325
+ }
326
+ #byGithub(issueNumber) {
327
+ return Object.values(this.state.records).find((record) => record.githubIssueNumber === issueNumber);
328
+ }
329
+ #read(read) {
330
+ return this.#tail.then(read);
331
+ }
332
+ #write(write) {
333
+ const operation = this.#tail.then(async () => {
334
+ const previous = structuredClone(this.state);
335
+ try {
336
+ const result = write();
337
+ await this.persistState(this.state);
338
+ return result;
339
+ }
340
+ catch (error) {
341
+ this.state = previous;
342
+ throw error;
343
+ }
344
+ });
345
+ this.#tail = operation.then(() => undefined, () => undefined);
346
+ return operation;
347
+ }
348
+ }
349
+ export class JsonFileFeedbackOperationsStore extends InMemoryFeedbackOperationsStore {
350
+ #directory;
351
+ constructor(directory) {
352
+ super();
353
+ this.#directory = directory;
354
+ }
355
+ async ensureReady() {
356
+ await mkdir(this.#directory, { recursive: true });
357
+ const path = join(this.#directory, 'feedback-operations.json');
358
+ try {
359
+ this.state = validateFeedbackOperationsState(JSON.parse(await readFile(path, 'utf8')));
360
+ }
361
+ catch (error) {
362
+ if (error.code !== 'ENOENT')
363
+ throw error;
364
+ }
365
+ const directory = this.#directory;
366
+ this.persistState = async (next) => {
367
+ const target = join(directory, 'feedback-operations.json');
368
+ const temporary = `${target}.tmp`;
369
+ await writeFile(temporary, JSON.stringify(next), { encoding: 'utf8', mode: 0o600 });
370
+ await rename(temporary, target);
371
+ };
372
+ }
373
+ }
374
+ const TimestampSchema = z.iso.datetime();
375
+ const LinearStatusSchema = z.strictObject({
376
+ id: z.string().min(1),
377
+ name: z.string(),
378
+ type: z.enum(['backlog', 'unstarted', 'started', 'completed', 'canceled']),
379
+ });
380
+ const FeedbackOperationsRecordSchema = z.strictObject({
381
+ id: z.string().min(1),
382
+ trustedReporter: z.boolean(),
383
+ githubIssueNumber: z.number().int().positive().optional(),
384
+ githubIssueUrl: z.url().optional(),
385
+ title: z.string(),
386
+ message: z.string(),
387
+ reporterEmail: z.email().optional(),
388
+ createdAt: TimestampSchema,
389
+ linearIssueId: z.string().min(1).optional(),
390
+ linearIdentifier: z.string().min(1).optional(),
391
+ linearUrl: z.url().optional(),
392
+ linearStatus: LinearStatusSchema.optional(),
393
+ linearAssigneeName: z.string().optional(),
394
+ linearLabels: z.array(z.string()),
395
+ slackChannelId: z.string().min(1).optional(),
396
+ slackMessageTs: z.string().min(1).optional(),
397
+ slackAttemptCount: z.number().int().nonnegative(),
398
+ slackNextAttemptAt: TimestampSchema.optional(),
399
+ slackLeaseExpiresAt: TimestampSchema.optional(),
400
+ slackLastDeliveredAt: TimestampSchema.optional(),
401
+ slackSuppressedAt: TimestampSchema.optional(),
402
+ firstInProgressAt: TimestampSchema.optional(),
403
+ acceptedAt: TimestampSchema.optional(),
404
+ emailAttemptCount: z.number().int().nonnegative(),
405
+ emailNextAttemptAt: TimestampSchema.optional(),
406
+ emailLeaseExpiresAt: TimestampSchema.optional(),
407
+ emailFirstAttemptAt: TimestampSchema.optional(),
408
+ emailSentAt: TimestampSchema.optional(),
409
+ emailProviderMessageId: z.string().min(1).optional(),
410
+ emailSuppressedAt: TimestampSchema.optional(),
411
+ emailDeliveryUnknownAt: TimestampSchema.optional(),
412
+ });
413
+ const StartWorkCommandSchema = z.strictObject({
414
+ actionKey: z.string().min(1),
415
+ linearIssueId: z.string().min(1),
416
+ slackUserId: z.string().min(1),
417
+ responseUrl: z.url(),
418
+ createdAt: TimestampSchema,
419
+ attemptCount: z.number().int().nonnegative(),
420
+ nextAttemptAt: TimestampSchema,
421
+ leaseExpiresAt: TimestampSchema.optional(),
422
+ completedAt: TimestampSchema.optional(),
423
+ });
424
+ const FeedbackOperationsStateSchema = z.strictObject({
425
+ records: z.record(z.string(), FeedbackOperationsRecordSchema),
426
+ linearDeliveries: z.record(z.string(), TimestampSchema),
427
+ startWork: z.record(z.string(), StartWorkCommandSchema),
428
+ });
429
+ export function validateFeedbackOperationsState(value) {
430
+ const parsed = FeedbackOperationsStateSchema.safeParse(value);
431
+ if (!parsed.success)
432
+ throw new Error('invalid feedback operations state');
433
+ return parsed.data;
434
+ }
435
+ function normalizeEmail(value) {
436
+ const normalized = value.trim().toLowerCase();
437
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalized)) {
438
+ throw new Error('invalid feedback reporter email');
439
+ }
440
+ return normalized;
441
+ }
442
+ function definedDeliveryState(record) {
443
+ return {
444
+ ...(record.slackChannelId !== undefined ? { slackChannelId: record.slackChannelId } : {}),
445
+ ...(record.slackMessageTs !== undefined ? { slackMessageTs: record.slackMessageTs } : {}),
446
+ ...(record.slackNextAttemptAt !== undefined
447
+ ? { slackNextAttemptAt: record.slackNextAttemptAt }
448
+ : {}),
449
+ ...(record.slackLeaseExpiresAt !== undefined
450
+ ? { slackLeaseExpiresAt: record.slackLeaseExpiresAt }
451
+ : {}),
452
+ ...(record.slackLastDeliveredAt !== undefined
453
+ ? { slackLastDeliveredAt: record.slackLastDeliveredAt }
454
+ : {}),
455
+ ...(record.slackSuppressedAt !== undefined
456
+ ? { slackSuppressedAt: record.slackSuppressedAt }
457
+ : {}),
458
+ ...(record.firstInProgressAt !== undefined
459
+ ? { firstInProgressAt: record.firstInProgressAt }
460
+ : {}),
461
+ ...(record.acceptedAt !== undefined ? { acceptedAt: record.acceptedAt } : {}),
462
+ ...(record.emailNextAttemptAt !== undefined
463
+ ? { emailNextAttemptAt: record.emailNextAttemptAt }
464
+ : {}),
465
+ ...(record.emailLeaseExpiresAt !== undefined
466
+ ? { emailLeaseExpiresAt: record.emailLeaseExpiresAt }
467
+ : {}),
468
+ ...(record.emailFirstAttemptAt !== undefined
469
+ ? { emailFirstAttemptAt: record.emailFirstAttemptAt }
470
+ : {}),
471
+ ...(record.emailSentAt !== undefined ? { emailSentAt: record.emailSentAt } : {}),
472
+ ...(record.emailProviderMessageId !== undefined
473
+ ? { emailProviderMessageId: record.emailProviderMessageId }
474
+ : {}),
475
+ ...(record.emailSuppressedAt !== undefined
476
+ ? { emailSuppressedAt: record.emailSuppressedAt }
477
+ : {}),
478
+ ...(record.emailDeliveryUnknownAt !== undefined
479
+ ? { emailDeliveryUnknownAt: record.emailDeliveryUnknownAt }
480
+ : {}),
481
+ };
482
+ }
483
+ //# sourceMappingURL=feedback-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback-operations.js","sourceRoot":"","sources":["../../src/store/feedback-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,gCAAgC,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;AAqI1D,SAAS,UAAU;IACjB,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,gBAAgB,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAC9D,CAAC;AAED,MAAM,OAAO,+BAA+B;IAChC,KAAK,CAAkC;IACvC,YAAY,CAA4D;IAClF,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAE1B,YACE,UAGI,EAAE;QAEN,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,EAAE,CAAC;QAC3C,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,qBAAqB,CACnB,KAAsE;QAEtE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;YACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACzD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,IA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1C,CAAC,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,EAAE;YACrD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,MAAM,CAAC,mBAAmB,KAAK,SAAS;YAC1C,CAAC,CAAC,EAAE,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,EAAE;YACrD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,GAAG,CAAC,MAAM,CAAC,sBAAsB,KAAK,SAAS;YAC7C,CAAC,CAAC,EAAE,sBAAsB,EAAE,MAAM,CAAC,sBAAsB,EAAE;YAC3D,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,MAAM,CAAC,iBAAiB,KAAK,SAAS;YACxC,CAAC,CAAC,EAAE,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,EAAE;YACjD,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,MAAM,CAAC,sBAAsB,KAAK,SAAS;YAC7C,CAAC,CAAC,EAAE,sBAAsB,EAAE,MAAM,CAAC,sBAAsB,EAAE;YAC3D,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { Pool } from 'pg';
2
+ import { type FeedbackOperationsRecord, type FeedbackOperationsStore, type StartWorkCommand } from './feedback-operations.js';
3
+ /**
4
+ * Low-volume feedback operations are intentionally serialized through one locked JSONB state row.
5
+ * This keeps every provider delivery, first-accept claim, and outbox lease in the same transaction
6
+ * without widening the general control-plane schema. The row can be normalized later without
7
+ * changing the store contract if volume ever justifies it.
8
+ */
9
+ export declare class PostgresFeedbackOperationsStore implements FeedbackOperationsStore {
10
+ #private;
11
+ constructor(pool: Pool);
12
+ ensureSchema(): Promise<void>;
13
+ createTrustedFeedback(input: Parameters<FeedbackOperationsStore['createTrustedFeedback']>[0]): Promise<FeedbackOperationsRecord>;
14
+ getByGithubIssueNumber(issueNumber: number): Promise<FeedbackOperationsRecord | undefined>;
15
+ getByLinearIssueId(linearIssueId: string): Promise<FeedbackOperationsRecord | undefined>;
16
+ getBySlackMessage(channelId: string, messageTs: string): Promise<FeedbackOperationsRecord | undefined>;
17
+ applyLinearEvent(input: Parameters<FeedbackOperationsStore['applyLinearEvent']>[0]): ReturnType<FeedbackOperationsStore['applyLinearEvent']>;
18
+ claimSlackDelivery(input: Parameters<FeedbackOperationsStore['claimSlackDelivery']>[0]): Promise<FeedbackOperationsRecord | undefined>;
19
+ markSlackDelivered(input: Parameters<FeedbackOperationsStore['markSlackDelivered']>[0]): Promise<void>;
20
+ markSlackFailed(input: Parameters<FeedbackOperationsStore['markSlackFailed']>[0]): Promise<void>;
21
+ markSlackSuppressed(input: Parameters<FeedbackOperationsStore['markSlackSuppressed']>[0]): Promise<void>;
22
+ claimReporterEmail(input: Parameters<FeedbackOperationsStore['claimReporterEmail']>[0]): Promise<FeedbackOperationsRecord | undefined>;
23
+ markReporterEmailSent(input: Parameters<FeedbackOperationsStore['markReporterEmailSent']>[0]): Promise<void>;
24
+ markReporterEmailFailed(input: Parameters<FeedbackOperationsStore['markReporterEmailFailed']>[0]): Promise<void>;
25
+ markReporterEmailSuppressed(input: Parameters<FeedbackOperationsStore['markReporterEmailSuppressed']>[0]): Promise<void>;
26
+ markReporterEmailUnknown(input: Parameters<FeedbackOperationsStore['markReporterEmailUnknown']>[0]): Promise<void>;
27
+ enqueueStartWork(input: Parameters<FeedbackOperationsStore['enqueueStartWork']>[0]): Promise<{
28
+ created: boolean;
29
+ command: StartWorkCommand;
30
+ }>;
31
+ claimStartWork(input: Parameters<FeedbackOperationsStore['claimStartWork']>[0]): Promise<StartWorkCommand | undefined>;
32
+ markStartWorkCompleted(input: Parameters<FeedbackOperationsStore['markStartWorkCompleted']>[0]): Promise<void>;
33
+ markStartWorkFailed(input: Parameters<FeedbackOperationsStore['markStartWorkFailed']>[0]): Promise<void>;
34
+ }
35
+ //# sourceMappingURL=postgres-feedback-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres-feedback-operations.d.ts","sourceRoot":"","sources":["../../src/store/postgres-feedback-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,IAAI,CAAC;AAC3C,OAAO,EACL,KAAK,wBAAwB,EAE7B,KAAK,uBAAuB,EAE5B,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAWlC;;;;;GAKG;AACH,qBAAa,+BAAgC,YAAW,uBAAuB;;gBAGjE,IAAI,EAAE,IAAI;IAIhB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAiCnC,qBAAqB,CACnB,KAAK,EAAE,UAAU,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,GACrE,OAAO,CAAC,wBAAwB,CAAC;IAIpC,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAI1F,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAIxF,iBAAiB,CACf,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAIhD,gBAAgB,CACd,KAAK,EAAE,UAAU,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,GAChE,UAAU,CAAC,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;IAI1D,kBAAkB,CAChB,KAAK,EAAE,UAAU,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,GAClE,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAIhD,kBAAkB,CAChB,KAAK,EAAE,UAAU,CAAC,uB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