@shipfox/api-integration-core 12.2.0 → 12.3.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 (68) hide show
  1. package/.turbo/turbo-build.log +11 -8
  2. package/CHANGELOG.md +18 -0
  3. package/dist/core/secret-cleanup.d.ts +20 -0
  4. package/dist/core/secret-cleanup.d.ts.map +1 -0
  5. package/dist/core/secret-cleanup.js +178 -0
  6. package/dist/core/secret-cleanup.js.map +1 -0
  7. package/dist/db/db.d.ts +562 -0
  8. package/dist/db/db.d.ts.map +1 -1
  9. package/dist/db/db.js +2 -0
  10. package/dist/db/db.js.map +1 -1
  11. package/dist/db/schema/secret-cleanups.d.ts +284 -0
  12. package/dist/db/schema/secret-cleanups.d.ts.map +1 -0
  13. package/dist/db/schema/secret-cleanups.js +39 -0
  14. package/dist/db/schema/secret-cleanups.js.map +1 -0
  15. package/dist/db/secret-cleanups.d.ts +52 -0
  16. package/dist/db/secret-cleanups.d.ts.map +1 -0
  17. package/dist/db/secret-cleanups.js +105 -0
  18. package/dist/db/secret-cleanups.js.map +1 -0
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +8 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/presentation/routes/manage-connections.d.ts.map +1 -1
  23. package/dist/presentation/routes/manage-connections.js +57 -18
  24. package/dist/presentation/routes/manage-connections.js.map +1 -1
  25. package/dist/providers/jira.d.ts.map +1 -1
  26. package/dist/providers/jira.js +51 -14
  27. package/dist/providers/jira.js.map +1 -1
  28. package/dist/temporal/activities/index.d.ts +5 -1
  29. package/dist/temporal/activities/index.d.ts.map +1 -1
  30. package/dist/temporal/activities/index.js +8 -2
  31. package/dist/temporal/activities/index.js.map +1 -1
  32. package/dist/temporal/constants.d.ts +1 -0
  33. package/dist/temporal/constants.d.ts.map +1 -1
  34. package/dist/temporal/constants.js +1 -0
  35. package/dist/temporal/constants.js.map +1 -1
  36. package/dist/temporal/workflows/cleanup-integration-secrets-cron.d.ts +2 -0
  37. package/dist/temporal/workflows/cleanup-integration-secrets-cron.d.ts.map +1 -0
  38. package/dist/temporal/workflows/cleanup-integration-secrets-cron.js +21 -0
  39. package/dist/temporal/workflows/cleanup-integration-secrets-cron.js.map +1 -0
  40. package/dist/temporal/workflows/index.bundle.js +64 -3
  41. package/dist/temporal/workflows/index.d.ts +1 -0
  42. package/dist/temporal/workflows/index.d.ts.map +1 -1
  43. package/dist/temporal/workflows/index.js +1 -0
  44. package/dist/temporal/workflows/index.js.map +1 -1
  45. package/dist/tsconfig.test.tsbuildinfo +1 -1
  46. package/drizzle/0001_durable_secret_cleanup.sql +22 -0
  47. package/drizzle/meta/0001_snapshot.json +180 -2
  48. package/drizzle/meta/_journal.json +7 -0
  49. package/package.json +11 -10
  50. package/src/core/secret-cleanup.test.ts +129 -0
  51. package/src/core/secret-cleanup.ts +229 -0
  52. package/src/db/db.ts +2 -0
  53. package/src/db/schema/secret-cleanups.ts +42 -0
  54. package/src/db/secret-cleanups.test.ts +113 -0
  55. package/src/db/secret-cleanups.ts +209 -0
  56. package/src/index.ts +6 -1
  57. package/src/presentation/routes/manage-connections.test.ts +232 -0
  58. package/src/presentation/routes/manage-connections.ts +45 -11
  59. package/src/providers/jira.ts +61 -13
  60. package/src/temporal/activities/index.ts +11 -1
  61. package/src/temporal/constants.ts +2 -0
  62. package/src/temporal/workflows/cleanup-integration-secrets-cron.ts +20 -0
  63. package/src/temporal/workflows/index.ts +1 -0
  64. package/test/env.ts +3 -0
  65. package/test/globalSetup.ts +1 -0
  66. package/test/route-utils.ts +3 -0
  67. package/test/setup.ts +12 -0
  68. package/tsconfig.build.tsbuildinfo +1 -1
@@ -0,0 +1,284 @@
1
+ import type { IntegrationConnectionLifecycleStatus } from '#core/entities/connection.js';
2
+ export declare const integrationSecretCleanups: import("drizzle-orm/pg-core").PgTableWithColumns<{
3
+ name: "secret_cleanups";
4
+ schema: undefined;
5
+ columns: {
6
+ id: import("drizzle-orm/pg-core").PgColumn<{
7
+ name: "id";
8
+ tableName: "secret_cleanups";
9
+ dataType: "string";
10
+ columnType: "PgUUID";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: true;
15
+ isPrimaryKey: true;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: undefined;
19
+ baseColumn: never;
20
+ identity: undefined;
21
+ generated: undefined;
22
+ }, {}, {}>;
23
+ workspaceId: import("drizzle-orm/pg-core").PgColumn<{
24
+ name: "workspace_id";
25
+ tableName: "secret_cleanups";
26
+ dataType: "string";
27
+ columnType: "PgUUID";
28
+ data: string;
29
+ driverParam: string;
30
+ notNull: true;
31
+ hasDefault: false;
32
+ isPrimaryKey: false;
33
+ isAutoincrement: false;
34
+ hasRuntimeDefault: false;
35
+ enumValues: undefined;
36
+ baseColumn: never;
37
+ identity: undefined;
38
+ generated: undefined;
39
+ }, {}, {}>;
40
+ provider: import("drizzle-orm/pg-core").PgColumn<{
41
+ name: "provider";
42
+ tableName: "secret_cleanups";
43
+ dataType: "string";
44
+ columnType: "PgText";
45
+ data: string;
46
+ driverParam: string;
47
+ notNull: true;
48
+ hasDefault: false;
49
+ isPrimaryKey: false;
50
+ isAutoincrement: false;
51
+ hasRuntimeDefault: false;
52
+ enumValues: [string, ...string[]];
53
+ baseColumn: never;
54
+ identity: undefined;
55
+ generated: undefined;
56
+ }, {}, {}>;
57
+ connectionId: import("drizzle-orm/pg-core").PgColumn<{
58
+ name: "connection_id";
59
+ tableName: "secret_cleanups";
60
+ dataType: "string";
61
+ columnType: "PgUUID";
62
+ data: string;
63
+ driverParam: string;
64
+ notNull: true;
65
+ hasDefault: false;
66
+ isPrimaryKey: false;
67
+ isAutoincrement: false;
68
+ hasRuntimeDefault: false;
69
+ enumValues: undefined;
70
+ baseColumn: never;
71
+ identity: undefined;
72
+ generated: undefined;
73
+ }, {}, {}>;
74
+ externalAccountId: import("drizzle-orm/pg-core").PgColumn<{
75
+ name: "external_account_id";
76
+ tableName: "secret_cleanups";
77
+ dataType: "string";
78
+ columnType: "PgText";
79
+ data: string;
80
+ driverParam: string;
81
+ notNull: true;
82
+ hasDefault: false;
83
+ isPrimaryKey: false;
84
+ isAutoincrement: false;
85
+ hasRuntimeDefault: false;
86
+ enumValues: [string, ...string[]];
87
+ baseColumn: never;
88
+ identity: undefined;
89
+ generated: undefined;
90
+ }, {}, {}>;
91
+ slug: import("drizzle-orm/pg-core").PgColumn<{
92
+ name: "slug";
93
+ tableName: "secret_cleanups";
94
+ dataType: "string";
95
+ columnType: "PgText";
96
+ data: string;
97
+ driverParam: string;
98
+ notNull: true;
99
+ hasDefault: false;
100
+ isPrimaryKey: false;
101
+ isAutoincrement: false;
102
+ hasRuntimeDefault: false;
103
+ enumValues: [string, ...string[]];
104
+ baseColumn: never;
105
+ identity: undefined;
106
+ generated: undefined;
107
+ }, {}, {}>;
108
+ displayName: import("drizzle-orm/pg-core").PgColumn<{
109
+ name: "display_name";
110
+ tableName: "secret_cleanups";
111
+ dataType: "string";
112
+ columnType: "PgText";
113
+ data: string;
114
+ driverParam: string;
115
+ notNull: true;
116
+ hasDefault: false;
117
+ isPrimaryKey: false;
118
+ isAutoincrement: false;
119
+ hasRuntimeDefault: false;
120
+ enumValues: [string, ...string[]];
121
+ baseColumn: never;
122
+ identity: undefined;
123
+ generated: undefined;
124
+ }, {}, {}>;
125
+ lifecycleStatus: import("drizzle-orm/pg-core").PgColumn<{
126
+ name: "lifecycle_status";
127
+ tableName: "secret_cleanups";
128
+ dataType: "string";
129
+ columnType: "PgText";
130
+ data: IntegrationConnectionLifecycleStatus;
131
+ driverParam: string;
132
+ notNull: true;
133
+ hasDefault: false;
134
+ isPrimaryKey: false;
135
+ isAutoincrement: false;
136
+ hasRuntimeDefault: false;
137
+ enumValues: [string, ...string[]];
138
+ baseColumn: never;
139
+ identity: undefined;
140
+ generated: undefined;
141
+ }, {}, {
142
+ $type: IntegrationConnectionLifecycleStatus;
143
+ }>;
144
+ connectionCreatedAt: import("drizzle-orm/pg-core").PgColumn<{
145
+ name: "connection_created_at";
146
+ tableName: "secret_cleanups";
147
+ dataType: "date";
148
+ columnType: "PgTimestamp";
149
+ data: Date;
150
+ driverParam: string;
151
+ notNull: true;
152
+ hasDefault: false;
153
+ isPrimaryKey: false;
154
+ isAutoincrement: false;
155
+ hasRuntimeDefault: false;
156
+ enumValues: undefined;
157
+ baseColumn: never;
158
+ identity: undefined;
159
+ generated: undefined;
160
+ }, {}, {}>;
161
+ connectionUpdatedAt: import("drizzle-orm/pg-core").PgColumn<{
162
+ name: "connection_updated_at";
163
+ tableName: "secret_cleanups";
164
+ dataType: "date";
165
+ columnType: "PgTimestamp";
166
+ data: Date;
167
+ driverParam: string;
168
+ notNull: true;
169
+ hasDefault: false;
170
+ isPrimaryKey: false;
171
+ isAutoincrement: false;
172
+ hasRuntimeDefault: false;
173
+ enumValues: undefined;
174
+ baseColumn: never;
175
+ identity: undefined;
176
+ generated: undefined;
177
+ }, {}, {}>;
178
+ attemptCount: import("drizzle-orm/pg-core").PgColumn<{
179
+ name: "attempt_count";
180
+ tableName: "secret_cleanups";
181
+ dataType: "number";
182
+ columnType: "PgInteger";
183
+ data: number;
184
+ driverParam: string | number;
185
+ notNull: true;
186
+ hasDefault: true;
187
+ isPrimaryKey: false;
188
+ isAutoincrement: false;
189
+ hasRuntimeDefault: false;
190
+ enumValues: undefined;
191
+ baseColumn: never;
192
+ identity: undefined;
193
+ generated: undefined;
194
+ }, {}, {}>;
195
+ nextAttemptAt: import("drizzle-orm/pg-core").PgColumn<{
196
+ name: "next_attempt_at";
197
+ tableName: "secret_cleanups";
198
+ dataType: "date";
199
+ columnType: "PgTimestamp";
200
+ data: Date;
201
+ driverParam: string;
202
+ notNull: true;
203
+ hasDefault: true;
204
+ isPrimaryKey: false;
205
+ isAutoincrement: false;
206
+ hasRuntimeDefault: false;
207
+ enumValues: undefined;
208
+ baseColumn: never;
209
+ identity: undefined;
210
+ generated: undefined;
211
+ }, {}, {}>;
212
+ leaseToken: import("drizzle-orm/pg-core").PgColumn<{
213
+ name: "lease_token";
214
+ tableName: "secret_cleanups";
215
+ dataType: "string";
216
+ columnType: "PgUUID";
217
+ data: string;
218
+ driverParam: string;
219
+ notNull: false;
220
+ hasDefault: false;
221
+ isPrimaryKey: false;
222
+ isAutoincrement: false;
223
+ hasRuntimeDefault: false;
224
+ enumValues: undefined;
225
+ baseColumn: never;
226
+ identity: undefined;
227
+ generated: undefined;
228
+ }, {}, {}>;
229
+ leaseExpiresAt: import("drizzle-orm/pg-core").PgColumn<{
230
+ name: "lease_expires_at";
231
+ tableName: "secret_cleanups";
232
+ dataType: "date";
233
+ columnType: "PgTimestamp";
234
+ data: Date;
235
+ driverParam: string;
236
+ notNull: false;
237
+ hasDefault: false;
238
+ isPrimaryKey: false;
239
+ isAutoincrement: false;
240
+ hasRuntimeDefault: false;
241
+ enumValues: undefined;
242
+ baseColumn: never;
243
+ identity: undefined;
244
+ generated: undefined;
245
+ }, {}, {}>;
246
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
247
+ name: "created_at";
248
+ tableName: "secret_cleanups";
249
+ dataType: "date";
250
+ columnType: "PgTimestamp";
251
+ data: Date;
252
+ driverParam: string;
253
+ notNull: true;
254
+ hasDefault: true;
255
+ isPrimaryKey: false;
256
+ isAutoincrement: false;
257
+ hasRuntimeDefault: false;
258
+ enumValues: undefined;
259
+ baseColumn: never;
260
+ identity: undefined;
261
+ generated: undefined;
262
+ }, {}, {}>;
263
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
264
+ name: "updated_at";
265
+ tableName: "secret_cleanups";
266
+ dataType: "date";
267
+ columnType: "PgTimestamp";
268
+ data: Date;
269
+ driverParam: string;
270
+ notNull: true;
271
+ hasDefault: true;
272
+ isPrimaryKey: false;
273
+ isAutoincrement: false;
274
+ hasRuntimeDefault: false;
275
+ enumValues: undefined;
276
+ baseColumn: never;
277
+ identity: undefined;
278
+ generated: undefined;
279
+ }, {}, {}>;
280
+ };
281
+ dialect: 'pg';
282
+ }>;
283
+ export type IntegrationSecretCleanupDb = typeof integrationSecretCleanups.$inferSelect;
284
+ //# sourceMappingURL=secret-cleanups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret-cleanups.d.ts","sourceRoot":"","sources":["../../../src/db/schema/secret-cleanups.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,oCAAoC,EAAC,MAAM,8BAA8B,CAAC;AAGvF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkCrC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,OAAO,yBAAyB,CAAC,YAAY,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { uuidv7PrimaryKey } from '@shipfox/node-drizzle';
2
+ import { index, integer, text, timestamp, uniqueIndex, uuid } from 'drizzle-orm/pg-core';
3
+ import { pgTable } from './common.js';
4
+ export const integrationSecretCleanups = pgTable('secret_cleanups', {
5
+ id: uuidv7PrimaryKey(),
6
+ workspaceId: uuid('workspace_id').notNull(),
7
+ provider: text('provider').notNull(),
8
+ connectionId: uuid('connection_id').notNull(),
9
+ externalAccountId: text('external_account_id').notNull(),
10
+ slug: text('slug').notNull(),
11
+ displayName: text('display_name').notNull(),
12
+ lifecycleStatus: text('lifecycle_status').$type().notNull(),
13
+ connectionCreatedAt: timestamp('connection_created_at', {
14
+ withTimezone: true
15
+ }).notNull(),
16
+ connectionUpdatedAt: timestamp('connection_updated_at', {
17
+ withTimezone: true
18
+ }).notNull(),
19
+ attemptCount: integer('attempt_count').notNull().default(0),
20
+ nextAttemptAt: timestamp('next_attempt_at', {
21
+ withTimezone: true
22
+ }).notNull().defaultNow(),
23
+ leaseToken: uuid('lease_token'),
24
+ leaseExpiresAt: timestamp('lease_expires_at', {
25
+ withTimezone: true
26
+ }),
27
+ createdAt: timestamp('created_at', {
28
+ withTimezone: true
29
+ }).notNull().defaultNow(),
30
+ updatedAt: timestamp('updated_at', {
31
+ withTimezone: true
32
+ }).notNull().defaultNow()
33
+ }, (table)=>[
34
+ uniqueIndex('integrations_secret_cleanups_provider_connection_unique').on(table.provider, table.connectionId),
35
+ index('integrations_secret_cleanups_connection_id_idx').on(table.connectionId),
36
+ index('integrations_secret_cleanups_pending_idx').on(table.nextAttemptAt, table.createdAt, table.id)
37
+ ]);
38
+
39
+ //# sourceMappingURL=secret-cleanups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/db/schema/secret-cleanups.ts"],"sourcesContent":["import {uuidv7PrimaryKey} from '@shipfox/node-drizzle';\nimport {index, integer, text, timestamp, uniqueIndex, uuid} from 'drizzle-orm/pg-core';\nimport type {IntegrationConnectionLifecycleStatus} from '#core/entities/connection.js';\nimport {pgTable} from './common.js';\n\nexport const integrationSecretCleanups = pgTable(\n 'secret_cleanups',\n {\n id: uuidv7PrimaryKey(),\n workspaceId: uuid('workspace_id').notNull(),\n provider: text('provider').notNull(),\n connectionId: uuid('connection_id').notNull(),\n externalAccountId: text('external_account_id').notNull(),\n slug: text('slug').notNull(),\n displayName: text('display_name').notNull(),\n lifecycleStatus: text('lifecycle_status')\n .$type<IntegrationConnectionLifecycleStatus>()\n .notNull(),\n connectionCreatedAt: timestamp('connection_created_at', {withTimezone: true}).notNull(),\n connectionUpdatedAt: timestamp('connection_updated_at', {withTimezone: true}).notNull(),\n attemptCount: integer('attempt_count').notNull().default(0),\n nextAttemptAt: timestamp('next_attempt_at', {withTimezone: true}).notNull().defaultNow(),\n leaseToken: uuid('lease_token'),\n leaseExpiresAt: timestamp('lease_expires_at', {withTimezone: true}),\n createdAt: timestamp('created_at', {withTimezone: true}).notNull().defaultNow(),\n updatedAt: timestamp('updated_at', {withTimezone: true}).notNull().defaultNow(),\n },\n (table) => [\n uniqueIndex('integrations_secret_cleanups_provider_connection_unique').on(\n table.provider,\n table.connectionId,\n ),\n index('integrations_secret_cleanups_connection_id_idx').on(table.connectionId),\n index('integrations_secret_cleanups_pending_idx').on(\n table.nextAttemptAt,\n table.createdAt,\n table.id,\n ),\n ],\n);\n\nexport type IntegrationSecretCleanupDb = typeof integrationSecretCleanups.$inferSelect;\n"],"names":["uuidv7PrimaryKey","index","integer","text","timestamp","uniqueIndex","uuid","pgTable","integrationSecretCleanups","id","workspaceId","notNull","provider","connectionId","externalAccountId","slug","displayName","lifecycleStatus","$type","connectionCreatedAt","withTimezone","connectionUpdatedAt","attemptCount","default","nextAttemptAt","defaultNow","leaseToken","leaseExpiresAt","createdAt","updatedAt","table","on"],"mappings":"AAAA,SAAQA,gBAAgB,QAAO,wBAAwB;AACvD,SAAQC,KAAK,EAAEC,OAAO,EAAEC,IAAI,EAAEC,SAAS,EAAEC,WAAW,EAAEC,IAAI,QAAO,sBAAsB;AAEvF,SAAQC,OAAO,QAAO,cAAc;AAEpC,OAAO,MAAMC,4BAA4BD,QACvC,mBACA;IACEE,IAAIT;IACJU,aAAaJ,KAAK,gBAAgBK,OAAO;IACzCC,UAAUT,KAAK,YAAYQ,OAAO;IAClCE,cAAcP,KAAK,iBAAiBK,OAAO;IAC3CG,mBAAmBX,KAAK,uBAAuBQ,OAAO;IACtDI,MAAMZ,KAAK,QAAQQ,OAAO;IAC1BK,aAAab,KAAK,gBAAgBQ,OAAO;IACzCM,iBAAiBd,KAAK,oBACnBe,KAAK,GACLP,OAAO;IACVQ,qBAAqBf,UAAU,yBAAyB;QAACgB,cAAc;IAAI,GAAGT,OAAO;IACrFU,qBAAqBjB,UAAU,yBAAyB;QAACgB,cAAc;IAAI,GAAGT,OAAO;IACrFW,cAAcpB,QAAQ,iBAAiBS,OAAO,GAAGY,OAAO,CAAC;IACzDC,eAAepB,UAAU,mBAAmB;QAACgB,cAAc;IAAI,GAAGT,OAAO,GAAGc,UAAU;IACtFC,YAAYpB,KAAK;IACjBqB,gBAAgBvB,UAAU,oBAAoB;QAACgB,cAAc;IAAI;IACjEQ,WAAWxB,UAAU,cAAc;QAACgB,cAAc;IAAI,GAAGT,OAAO,GAAGc,UAAU;IAC7EI,WAAWzB,UAAU,cAAc;QAACgB,cAAc;IAAI,GAAGT,OAAO,GAAGc,UAAU;AAC/E,GACA,CAACK,QAAU;QACTzB,YAAY,2DAA2D0B,EAAE,CACvED,MAAMlB,QAAQ,EACdkB,MAAMjB,YAAY;QAEpBZ,MAAM,kDAAkD8B,EAAE,CAACD,MAAMjB,YAAY;QAC7EZ,MAAM,4CAA4C8B,EAAE,CAClDD,MAAMN,aAAa,EACnBM,MAAMF,SAAS,EACfE,MAAMrB,EAAE;KAEX,EACD"}
@@ -0,0 +1,52 @@
1
+ import type { IntegrationConnection } from '#core/entities/connection.js';
2
+ import { db } from './db.js';
3
+ export interface EnqueueIntegrationSecretCleanupParams {
4
+ connection: IntegrationConnection;
5
+ now?: Date | undefined;
6
+ }
7
+ export interface IntegrationSecretCleanup {
8
+ id: string;
9
+ workspaceId: string;
10
+ provider: string;
11
+ connectionId: string;
12
+ externalAccountId: string;
13
+ slug: string;
14
+ displayName: string;
15
+ lifecycleStatus: IntegrationConnection['lifecycleStatus'];
16
+ connectionCreatedAt: Date;
17
+ connectionUpdatedAt: Date;
18
+ attemptCount: number;
19
+ nextAttemptAt: Date;
20
+ leaseToken: string | null;
21
+ leaseExpiresAt: Date | null;
22
+ createdAt: Date;
23
+ updatedAt: Date;
24
+ }
25
+ type IntegrationDb = ReturnType<typeof db>;
26
+ type IntegrationTx = Parameters<Parameters<IntegrationDb['transaction']>[0]>[0];
27
+ export declare function enqueueIntegrationSecretCleanup(params: EnqueueIntegrationSecretCleanupParams, options?: {
28
+ tx?: IntegrationDb | IntegrationTx | undefined;
29
+ }): Promise<void>;
30
+ export interface ClaimIntegrationSecretCleanupsParams {
31
+ limit: number;
32
+ connectionId?: string | undefined;
33
+ now?: Date | undefined;
34
+ leaseDurationMs?: number | undefined;
35
+ }
36
+ export declare function claimIntegrationSecretCleanups(params: ClaimIntegrationSecretCleanupsParams): Promise<IntegrationSecretCleanup[]>;
37
+ export declare function completeIntegrationSecretCleanup(params: {
38
+ id: string;
39
+ leaseToken: string;
40
+ now?: Date | undefined;
41
+ }): Promise<boolean>;
42
+ export declare function retryIntegrationSecretCleanup(params: {
43
+ id: string;
44
+ leaseToken: string;
45
+ delayMs: number;
46
+ now?: Date | undefined;
47
+ }): Promise<boolean>;
48
+ export declare function listIntegrationSecretCleanups(params?: {
49
+ connectionId?: string | undefined;
50
+ }): Promise<IntegrationSecretCleanup[]>;
51
+ export {};
52
+ //# sourceMappingURL=secret-cleanups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret-cleanups.d.ts","sourceRoot":"","sources":["../../src/db/secret-cleanups.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAC,EAAE,EAAC,MAAM,SAAS,CAAC;AAU3B,MAAM,WAAW,qCAAqC;IACpD,UAAU,EAAE,qBAAqB,CAAC;IAClC,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;IAC1D,mBAAmB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EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CACxB,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBnB;AAED,wBAAsB,6BAA6B,CACjD,MAAM,GAAE;IAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAM,GAC/C,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAWrC"}
@@ -0,0 +1,105 @@
1
+ import { and, asc, eq, gt, inArray, isNull, lte, or, sql } from 'drizzle-orm';
2
+ import { db } from './db.js';
3
+ import { integrationSecretCleanups } from './schema/secret-cleanups.js';
4
+ // Keep the lease longer than cleanupIntegrationSecretsCron's 5-minute activity timeout so
5
+ // a timed-out sweep cannot have its claimed rows reclaimed while it is still running.
6
+ const DEFAULT_LEASE_DURATION_MS = 10 * 60 * 1_000;
7
+ export async function enqueueIntegrationSecretCleanup(params, options = {}) {
8
+ const executor = options.tx ?? db();
9
+ await executor.insert(integrationSecretCleanups).values({
10
+ workspaceId: params.connection.workspaceId,
11
+ provider: params.connection.provider,
12
+ connectionId: params.connection.id,
13
+ externalAccountId: params.connection.externalAccountId,
14
+ slug: params.connection.slug,
15
+ displayName: params.connection.displayName,
16
+ lifecycleStatus: params.connection.lifecycleStatus,
17
+ connectionCreatedAt: params.connection.createdAt,
18
+ connectionUpdatedAt: params.connection.updatedAt,
19
+ // Claims compare against the application clock, so the first due time must come
20
+ // from that clock too. A database clock even milliseconds ahead would otherwise
21
+ // hide the row from the sweep that runs right after this insert commits.
22
+ nextAttemptAt: params.now ?? new Date()
23
+ }).onConflictDoNothing({
24
+ target: [
25
+ integrationSecretCleanups.provider,
26
+ integrationSecretCleanups.connectionId
27
+ ]
28
+ });
29
+ }
30
+ export async function claimIntegrationSecretCleanups(params) {
31
+ if (!Number.isInteger(params.limit) || params.limit <= 0) {
32
+ throw new Error('Secret cleanup claim limit must be a positive integer');
33
+ }
34
+ const now = params.now ?? new Date();
35
+ const leaseDurationMs = params.leaseDurationMs ?? DEFAULT_LEASE_DURATION_MS;
36
+ if (!Number.isInteger(leaseDurationMs) || leaseDurationMs <= 0) {
37
+ throw new Error('Secret cleanup lease duration must be a positive integer');
38
+ }
39
+ return await db().transaction(async (tx)=>{
40
+ const conditions = [
41
+ lte(integrationSecretCleanups.nextAttemptAt, now),
42
+ or(isNull(integrationSecretCleanups.leaseExpiresAt), lte(integrationSecretCleanups.leaseExpiresAt, now)),
43
+ ...params.connectionId ? [
44
+ eq(integrationSecretCleanups.connectionId, params.connectionId)
45
+ ] : []
46
+ ];
47
+ const candidates = await tx.select({
48
+ id: integrationSecretCleanups.id
49
+ }).from(integrationSecretCleanups).where(and(...conditions)).orderBy(asc(integrationSecretCleanups.nextAttemptAt), asc(integrationSecretCleanups.createdAt), asc(integrationSecretCleanups.id)).limit(params.limit).for('update', {
50
+ skipLocked: true
51
+ });
52
+ if (candidates.length === 0) return [];
53
+ const rows = await tx.update(integrationSecretCleanups).set({
54
+ attemptCount: sql`${integrationSecretCleanups.attemptCount} + 1`,
55
+ leaseToken: sql`gen_random_uuid()`,
56
+ leaseExpiresAt: new Date(now.getTime() + leaseDurationMs),
57
+ updatedAt: now
58
+ }).where(inArray(integrationSecretCleanups.id, candidates.map((candidate)=>candidate.id))).returning();
59
+ return rows.map(toIntegrationSecretCleanup);
60
+ });
61
+ }
62
+ export async function completeIntegrationSecretCleanup(params) {
63
+ const now = params.now ?? new Date();
64
+ const result = await db().delete(integrationSecretCleanups).where(and(eq(integrationSecretCleanups.id, params.id), eq(integrationSecretCleanups.leaseToken, params.leaseToken), gt(integrationSecretCleanups.leaseExpiresAt, now)));
65
+ return (result.rowCount ?? 0) > 0;
66
+ }
67
+ export async function retryIntegrationSecretCleanup(params) {
68
+ if (!Number.isInteger(params.delayMs) || params.delayMs < 0) {
69
+ throw new Error('Secret cleanup retry delay must be a non-negative integer');
70
+ }
71
+ const now = params.now ?? new Date();
72
+ const result = await db().update(integrationSecretCleanups).set({
73
+ nextAttemptAt: new Date(now.getTime() + params.delayMs),
74
+ leaseToken: null,
75
+ leaseExpiresAt: null,
76
+ updatedAt: now
77
+ }).where(and(eq(integrationSecretCleanups.id, params.id), eq(integrationSecretCleanups.leaseToken, params.leaseToken), gt(integrationSecretCleanups.leaseExpiresAt, now)));
78
+ return (result.rowCount ?? 0) > 0;
79
+ }
80
+ export async function listIntegrationSecretCleanups(params = {}) {
81
+ const rows = await db().select().from(integrationSecretCleanups).where(params.connectionId ? eq(integrationSecretCleanups.connectionId, params.connectionId) : undefined).orderBy(asc(integrationSecretCleanups.createdAt), asc(integrationSecretCleanups.id));
82
+ return rows.map(toIntegrationSecretCleanup);
83
+ }
84
+ function toIntegrationSecretCleanup(row) {
85
+ return {
86
+ id: row.id,
87
+ workspaceId: row.workspaceId,
88
+ provider: row.provider,
89
+ connectionId: row.connectionId,
90
+ externalAccountId: row.externalAccountId,
91
+ slug: row.slug,
92
+ displayName: row.displayName,
93
+ lifecycleStatus: row.lifecycleStatus,
94
+ connectionCreatedAt: row.connectionCreatedAt,
95
+ connectionUpdatedAt: row.connectionUpdatedAt,
96
+ attemptCount: row.attemptCount,
97
+ nextAttemptAt: row.nextAttemptAt,
98
+ leaseToken: row.leaseToken,
99
+ leaseExpiresAt: row.leaseExpiresAt,
100
+ createdAt: row.createdAt,
101
+ updatedAt: row.updatedAt
102
+ };
103
+ }
104
+
105
+ //# sourceMappingURL=secret-cleanups.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/db/secret-cleanups.ts"],"sourcesContent":["import {and, asc, eq, gt, inArray, isNull, lte, or, sql} from 'drizzle-orm';\nimport type {IntegrationConnection} from '#core/entities/connection.js';\nimport {db} from './db.js';\nimport {\n type IntegrationSecretCleanupDb,\n integrationSecretCleanups,\n} from './schema/secret-cleanups.js';\n\n// Keep the lease longer than cleanupIntegrationSecretsCron's 5-minute activity timeout so\n// a timed-out sweep cannot have its claimed rows reclaimed while it is still running.\nconst DEFAULT_LEASE_DURATION_MS = 10 * 60 * 1_000;\n\nexport interface EnqueueIntegrationSecretCleanupParams {\n connection: IntegrationConnection;\n now?: Date | undefined;\n}\n\nexport interface IntegrationSecretCleanup {\n id: string;\n workspaceId: string;\n provider: string;\n connectionId: string;\n externalAccountId: string;\n slug: string;\n displayName: string;\n lifecycleStatus: IntegrationConnection['lifecycleStatus'];\n connectionCreatedAt: Date;\n connectionUpdatedAt: Date;\n attemptCount: number;\n nextAttemptAt: Date;\n leaseToken: string | null;\n leaseExpiresAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\ntype IntegrationDb = ReturnType<typeof db>;\ntype IntegrationTx = Parameters<Parameters<IntegrationDb['transaction']>[0]>[0];\n\nexport async function enqueueIntegrationSecretCleanup(\n params: EnqueueIntegrationSecretCleanupParams,\n options: {tx?: IntegrationDb | IntegrationTx | undefined} = {},\n): Promise<void> {\n const executor = options.tx ?? db();\n await executor\n .insert(integrationSecretCleanups)\n .values({\n workspaceId: params.connection.workspaceId,\n provider: params.connection.provider,\n connectionId: params.connection.id,\n externalAccountId: params.connection.externalAccountId,\n slug: params.connection.slug,\n displayName: params.connection.displayName,\n lifecycleStatus: params.connection.lifecycleStatus,\n connectionCreatedAt: params.connection.createdAt,\n connectionUpdatedAt: params.connection.updatedAt,\n // Claims compare against the application clock, so the first due time must come\n // from that clock too. A database clock even milliseconds ahead would otherwise\n // hide the row from the sweep that runs right after this insert commits.\n nextAttemptAt: params.now ?? new Date(),\n })\n .onConflictDoNothing({\n target: [integrationSecretCleanups.provider, integrationSecretCleanups.connectionId],\n });\n}\n\nexport interface ClaimIntegrationSecretCleanupsParams {\n limit: number;\n connectionId?: string | undefined;\n now?: Date | undefined;\n leaseDurationMs?: number | undefined;\n}\n\nexport async function claimIntegrationSecretCleanups(\n params: ClaimIntegrationSecretCleanupsParams,\n): Promise<IntegrationSecretCleanup[]> {\n if (!Number.isInteger(params.limit) || params.limit <= 0) {\n throw new Error('Secret cleanup claim limit must be a positive integer');\n }\n const now = params.now ?? new Date();\n const leaseDurationMs = params.leaseDurationMs ?? DEFAULT_LEASE_DURATION_MS;\n if (!Number.isInteger(leaseDurationMs) || leaseDurationMs <= 0) {\n throw new Error('Secret cleanup lease duration must be a positive integer');\n }\n\n return await db().transaction(async (tx) => {\n const conditions = [\n lte(integrationSecretCleanups.nextAttemptAt, now),\n or(\n isNull(integrationSecretCleanups.leaseExpiresAt),\n lte(integrationSecretCleanups.leaseExpiresAt, now),\n ),\n ...(params.connectionId\n ? [eq(integrationSecretCleanups.connectionId, params.connectionId)]\n : []),\n ];\n const candidates = await tx\n .select({id: integrationSecretCleanups.id})\n .from(integrationSecretCleanups)\n .where(and(...conditions))\n .orderBy(\n asc(integrationSecretCleanups.nextAttemptAt),\n asc(integrationSecretCleanups.createdAt),\n asc(integrationSecretCleanups.id),\n )\n .limit(params.limit)\n .for('update', {skipLocked: true});\n if (candidates.length === 0) return [];\n\n const rows = await tx\n .update(integrationSecretCleanups)\n .set({\n attemptCount: sql`${integrationSecretCleanups.attemptCount} + 1`,\n leaseToken: sql`gen_random_uuid()`,\n leaseExpiresAt: new Date(now.getTime() + leaseDurationMs),\n updatedAt: now,\n })\n .where(\n inArray(\n integrationSecretCleanups.id,\n candidates.map((candidate) => candidate.id),\n ),\n )\n .returning();\n return rows.map(toIntegrationSecretCleanup);\n });\n}\n\nexport async function completeIntegrationSecretCleanup(params: {\n id: string;\n leaseToken: string;\n now?: Date | undefined;\n}): Promise<boolean> {\n const now = params.now ?? new Date();\n const result = await db()\n .delete(integrationSecretCleanups)\n .where(\n and(\n eq(integrationSecretCleanups.id, params.id),\n eq(integrationSecretCleanups.leaseToken, params.leaseToken),\n gt(integrationSecretCleanups.leaseExpiresAt, now),\n ),\n );\n return (result.rowCount ?? 0) > 0;\n}\n\nexport async function retryIntegrationSecretCleanup(params: {\n id: string;\n leaseToken: string;\n delayMs: number;\n now?: Date | undefined;\n}): Promise<boolean> {\n if (!Number.isInteger(params.delayMs) || params.delayMs < 0) {\n throw new Error('Secret cleanup retry delay must be a non-negative integer');\n }\n const now = params.now ?? new Date();\n const result = await db()\n .update(integrationSecretCleanups)\n .set({\n nextAttemptAt: new Date(now.getTime() + params.delayMs),\n leaseToken: null,\n leaseExpiresAt: null,\n updatedAt: now,\n })\n .where(\n and(\n eq(integrationSecretCleanups.id, params.id),\n eq(integrationSecretCleanups.leaseToken, params.leaseToken),\n gt(integrationSecretCleanups.leaseExpiresAt, now),\n ),\n );\n return (result.rowCount ?? 0) > 0;\n}\n\nexport async function listIntegrationSecretCleanups(\n params: {connectionId?: string | undefined} = {},\n): Promise<IntegrationSecretCleanup[]> {\n const rows = await db()\n .select()\n .from(integrationSecretCleanups)\n .where(\n params.connectionId\n ? eq(integrationSecretCleanups.connectionId, params.connectionId)\n : undefined,\n )\n .orderBy(asc(integrationSecretCleanups.createdAt), asc(integrationSecretCleanups.id));\n return rows.map(toIntegrationSecretCleanup);\n}\n\nfunction toIntegrationSecretCleanup(row: IntegrationSecretCleanupDb): IntegrationSecretCleanup {\n return {\n id: row.id,\n workspaceId: row.workspaceId,\n provider: row.provider,\n connectionId: row.connectionId,\n externalAccountId: row.externalAccountId,\n slug: row.slug,\n displayName: row.displayName,\n lifecycleStatus: row.lifecycleStatus,\n connectionCreatedAt: row.connectionCreatedAt,\n connectionUpdatedAt: row.connectionUpdatedAt,\n attemptCount: row.attemptCount,\n nextAttemptAt: row.nextAttemptAt,\n leaseToken: row.leaseToken,\n leaseExpiresAt: row.leaseExpiresAt,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n}\n"],"names":["and","asc","eq","gt","inArray","isNull","lte","or","sql","db","integrationSecretCleanups","DEFAULT_LEASE_DURATION_MS","enqueueIntegrationSecretCleanup","params","options","executor","tx","insert","values","workspaceId","connection","provider","connectionId","id","externalAccountId","slug","displayName","lifecycleStatus","connectionCreatedAt","createdAt","connectionUpdatedAt","updatedAt","nextAttemptAt","now","Date","onConflictDoNothing","target","claimIntegrationSecretCleanups","Number","isInteger","limit","Error","leaseDurationMs","transaction","conditions","leaseExpiresAt","candidates","select","from","where","orderBy","for","skipLocked","length","rows","update","set","attemptCount","leaseToken","getTime","map","candidate","returning","toIntegrationSecretCleanup","completeIntegrationSecretCleanup","result","delete","rowCount","retryIntegrationSecretCleanup","delayMs","listIntegrationSecretCleanups","undefined","row"],"mappings":"AAAA,SAAQA,GAAG,EAAEC,GAAG,EAAEC,EAAE,EAAEC,EAAE,EAAEC,OAAO,EAAEC,MAAM,EAAEC,GAAG,EAAEC,EAAE,EAAEC,GAAG,QAAO,cAAc;AAE5E,SAAQC,EAAE,QAAO,UAAU;AAC3B,SAEEC,yBAAyB,QACpB,8BAA8B;AAErC,0FAA0F;AAC1F,sFAAsF;AACtF,MAAMC,4BAA4B,KAAK,KAAK;AA6B5C,OAAO,eAAeC,gCACpBC,MAA6C,EAC7CC,UAA4D,CAAC,CAAC;IAE9D,MAAMC,WAAWD,QAAQE,EAAE,IAAIP;IAC/B,MAAMM,SACHE,MAAM,CAACP,2BACPQ,MAAM,CAAC;QACNC,aAAaN,OAAOO,UAAU,CAACD,WAAW;QAC1CE,UAAUR,OAAOO,UAAU,CAACC,QAAQ;QACpCC,cAAcT,OAAOO,UAAU,CAACG,EAAE;QAClCC,mBAAmBX,OAAOO,UAAU,CAACI,iBAAiB;QACtDC,MAAMZ,OAAOO,UAAU,CAACK,IAAI;QAC5BC,aAAab,OAAOO,UAAU,CAACM,WAAW;QAC1CC,iBAAiBd,OAAOO,UAAU,CAACO,eAAe;QAClDC,qBAAqBf,OAAOO,UAAU,CAACS,SAAS;QAChDC,qBAAqBjB,OAAOO,UAAU,CAACW,SAAS;QAChD,gFAAgF;QAChF,gFAAgF;QAChF,yEAAyE;QACzEC,eAAenB,OAAOoB,GAAG,IAAI,IAAIC;IACnC,GACCC,mBAAmB,CAAC;QACnBC,QAAQ;YAAC1B,0BAA0BW,QAAQ;YAAEX,0BAA0BY,YAAY;SAAC;IACtF;AACJ;AASA,OAAO,eAAee,+BACpBxB,MAA4C;I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AI,CAAC,CAAC;CACtC;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,aAAa,CAAC,CAExB;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,mBAAmB,CAAC,CAwG9B"}
package/dist/index.js CHANGED
@@ -103,12 +103,19 @@ export async function createIntegrationsContext(options = {}) {
103
103
  {
104
104
  taskQueue: INTEGRATIONS_MAINTENANCE_TASK_QUEUE,
105
105
  workflowsPath: maintenanceWorkflowsPath,
106
- activities: createIntegrationsMaintenanceActivities,
106
+ activities: ()=>createIntegrationsMaintenanceActivities({
107
+ registry
108
+ }),
107
109
  workflows: [
108
110
  {
109
111
  name: 'pruneWebhookDeliveriesCron',
110
112
  id: 'integrations-prune-webhook-deliveries',
111
113
  cronSchedule: '0 3 * * *'
114
+ },
115
+ {
116
+ name: 'cleanupIntegrationSecretsCron',
117
+ id: 'integrations-cleanup-secret-namespaces',
118
+ cronSchedule: '*/5 * * * *'
112
119
  }
113
120
  ]
114
121
  },