@opengeni/db 0.16.2 → 0.17.1

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.
package/dist/index.d.ts CHANGED
@@ -1135,6 +1135,162 @@ export declare function listConnectionsMetadata(db: Database, workspaceId: strin
1135
1135
  export declare function getConnectionMetadata(db: Database, workspaceId: string, connectionId: string, subjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
1136
1136
  export declare function updateConnection(db: Database, input: UpdateConnectionInput): Promise<ConnectionMetadataWithVerification | null>;
1137
1137
  export declare function revokeConnection(db: Database, workspaceId: string, connectionId: string, updatedBySubjectId?: string | null): Promise<ConnectionMetadataWithVerification | null>;
1138
+ export type SlackInstallationRoute = {
1139
+ accountId: string;
1140
+ workspaceId: string;
1141
+ connectionId: string;
1142
+ botId: string;
1143
+ botUserId: string;
1144
+ };
1145
+ export type SlackBotUserLink = {
1146
+ id: string;
1147
+ accountId: string;
1148
+ workspaceId: string;
1149
+ connectionId: string;
1150
+ slackTeamId: string;
1151
+ slackUserId: string;
1152
+ subjectId: string;
1153
+ linkedBySubjectId: string;
1154
+ createdAt: Date;
1155
+ updatedAt: Date;
1156
+ };
1157
+ export type SlackInteractionTriggerKind = "app_mention" | "dm" | "slash_command" | "message_shortcut" | "thread_reply";
1158
+ export type SlackInteractionInboxEntry = {
1159
+ id: string;
1160
+ accountId: string;
1161
+ workspaceId: string;
1162
+ connectionId: string;
1163
+ providerEventId: string;
1164
+ providerMessageId: string;
1165
+ slackTeamId: string;
1166
+ slackUserId: string;
1167
+ slackChannelId: string;
1168
+ slackMessageTs: string;
1169
+ slackThreadTs: string | null;
1170
+ triggerKind: SlackInteractionTriggerKind;
1171
+ text: string;
1172
+ status: "pending" | "processing" | "processed" | "failed";
1173
+ claimHolderId: string | null;
1174
+ claimExpiresAt: Date | null;
1175
+ attemptCount: number;
1176
+ lastErrorCode: string | null;
1177
+ processedAt: Date | null;
1178
+ createdAt: Date;
1179
+ updatedAt: Date;
1180
+ };
1181
+ export type SlackInteraction = {
1182
+ id: string;
1183
+ accountId: string;
1184
+ workspaceId: string;
1185
+ connectionId: string;
1186
+ slackTeamId: string;
1187
+ slackChannelId: string;
1188
+ slackThreadTs: string;
1189
+ routeKey: string;
1190
+ triggeringProviderEventId: string;
1191
+ owningSubjectId: string;
1192
+ visibility: "private" | "workspace";
1193
+ sessionReservationId: string;
1194
+ sessionId: string | null;
1195
+ lastDeliveredSessionEventSequence: number;
1196
+ deliveryClaimHolderId: string | null;
1197
+ deliveryClaimExpiresAt: Date | null;
1198
+ ackSlackMessageTs: string | null;
1199
+ progressCount: number;
1200
+ terminalDeliveryState: "open" | "completed" | "failed" | "cancelled" | "blocked";
1201
+ createdAt: Date;
1202
+ updatedAt: Date;
1203
+ };
1204
+ export type SlackInteractionProgressDelivery = {
1205
+ id: string;
1206
+ accountId: string;
1207
+ workspaceId: string;
1208
+ interactionId: string;
1209
+ sessionEventSequence: number;
1210
+ slot: number;
1211
+ operationId: string;
1212
+ createdAt: Date;
1213
+ };
1214
+ export declare function resolveSlackInstallationRoute(db: Database, slackTeamId: string): Promise<SlackInstallationRoute | null>;
1215
+ export declare function saveSlackBotUserLink(db: Database, input: Omit<SlackBotUserLink, "id" | "createdAt" | "updatedAt">): Promise<SlackBotUserLink>;
1216
+ export declare function getSlackBotUserLink(db: Database, workspaceId: string, connectionId: string, slackUserId: string): Promise<SlackBotUserLink | null>;
1217
+ export declare function deleteSlackBotUserLink(db: Database, workspaceId: string, connectionId: string, slackUserId: string): Promise<boolean>;
1218
+ export declare function enqueueSlackInteractionInbox(db: Database, input: Omit<SlackInteractionInboxEntry, "id" | "status" | "claimHolderId" | "claimExpiresAt" | "attemptCount" | "lastErrorCode" | "processedAt" | "createdAt" | "updatedAt">): Promise<{
1219
+ inserted: boolean;
1220
+ entry: SlackInteractionInboxEntry;
1221
+ }>;
1222
+ export declare function claimSlackInteractionInbox(db: Database, claimHolderId: string, claimLeaseMs: number): Promise<SlackInteractionInboxEntry | null>;
1223
+ export declare function settleSlackInteractionInbox(db: Database, input: {
1224
+ entry: Pick<SlackInteractionInboxEntry, "id" | "accountId" | "workspaceId">;
1225
+ claimHolderId: string;
1226
+ outcome: "processed" | "failed";
1227
+ errorCode?: string | null;
1228
+ }): Promise<boolean>;
1229
+ export declare function releaseSlackInteractionInbox(db: Database, input: {
1230
+ entry: Pick<SlackInteractionInboxEntry, "id" | "accountId" | "workspaceId">;
1231
+ claimHolderId: string;
1232
+ errorCode: string;
1233
+ }): Promise<boolean>;
1234
+ export declare function getOrCreateSlackInteraction(db: Database, input: Omit<SlackInteraction, "id" | "sessionReservationId" | "sessionId" | "lastDeliveredSessionEventSequence" | "deliveryClaimHolderId" | "deliveryClaimExpiresAt" | "ackSlackMessageTs" | "progressCount" | "terminalDeliveryState" | "createdAt" | "updatedAt">): Promise<{
1235
+ created: boolean;
1236
+ interaction: SlackInteraction;
1237
+ }>;
1238
+ export declare function getSlackInteractionByRoute(db: Database, workspaceId: string, connectionId: string, routeKey: string): Promise<SlackInteraction | null>;
1239
+ export declare function getSlackInteractionSessionAccess(db: Database, workspaceId: string, rootSessionId: string): Promise<Pick<SlackInteraction, "owningSubjectId" | "visibility"> | null>;
1240
+ export declare function getSlackInteractionSessionAccessForSession(db: Database, input: {
1241
+ accountId: string;
1242
+ workspaceId: string;
1243
+ sessionId: string;
1244
+ }): Promise<(Pick<SlackInteraction, "owningSubjectId" | "visibility"> & {
1245
+ rootSessionId: string;
1246
+ }) | null>;
1247
+ export declare function bindSlackInteractionSession(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId" | "owningSubjectId"> & {
1248
+ sessionId: string;
1249
+ }): Promise<SlackInteraction | null>;
1250
+ export type SlackInteractionProgressClaim = {
1251
+ kind: "claimed";
1252
+ created: boolean;
1253
+ progressCount: number;
1254
+ delivery: SlackInteractionProgressDelivery;
1255
+ } | {
1256
+ kind: "limit_reached";
1257
+ progressCount: number;
1258
+ } | {
1259
+ kind: "not_owned";
1260
+ };
1261
+ /**
1262
+ * Reserve one globally bounded progress slot before any Slack provider call.
1263
+ * The interaction row lock serializes replicas and expired delivery claim
1264
+ * successors; the event row preserves one operation UUID across every retry.
1265
+ */
1266
+ export declare function claimSlackInteractionProgressDelivery(db: Database, input: {
1267
+ accountId: string;
1268
+ workspaceId: string;
1269
+ interactionId: string;
1270
+ claimHolderId: string;
1271
+ sessionEventSequence: number;
1272
+ maxProgress: number;
1273
+ }): Promise<SlackInteractionProgressClaim>;
1274
+ export declare function rekeySlackInteractionRoute(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
1275
+ routeKey: string;
1276
+ slackThreadTs: string;
1277
+ ackSlackMessageTs: string;
1278
+ }): Promise<SlackInteraction | null>;
1279
+ export declare function claimSlackInteractionDelivery(db: Database, claimHolderId: string, claimLeaseMs: number): Promise<SlackInteraction | null>;
1280
+ export declare function reopenSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId">): Promise<boolean>;
1281
+ export declare function advanceSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
1282
+ claimHolderId: string;
1283
+ sequence: number;
1284
+ ackSlackMessageTs?: string | null;
1285
+ }): Promise<boolean>;
1286
+ export declare function releaseSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
1287
+ claimHolderId: string;
1288
+ }): Promise<boolean>;
1289
+ export declare function closeSlackInteractionDelivery(db: Database, input: Pick<SlackInteraction, "id" | "accountId" | "workspaceId"> & {
1290
+ claimHolderId: string;
1291
+ sequence: number;
1292
+ state: Exclude<SlackInteraction["terminalDeliveryState"], "open">;
1293
+ }): Promise<boolean>;
1138
1294
  export declare class SlackBotLifecycleSuccessAuditError extends Error {
1139
1295
  constructor();
1140
1296
  }
@@ -6215,3 +6371,4 @@ export declare function appendSessionEventsWithLockedSessionUpdate(db: Database,
6215
6371
  export declare function sessionSubject(workspaceId: string, sessionId: string): string;
6216
6372
  export * from "./codex-token-resolver";
6217
6373
  export * from "./connection-token-resolver";
6374
+ export * from "./workspace-artifacts";