@burdenoff/microfe-support 2026.830.2 → 2026.902.2
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/generated/global-operations.d.ts +85 -0
- package/dist/generated/global-operations.js +154 -127
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.d.ts +51 -0
- package/dist/generated/global-types.js +1 -1
- package/dist/generated/global-types.js.map +1 -1
- package/dist/support/components/careers/BulkCandidateDialogs.d.ts +2 -0
- package/dist/support/components/careers/BulkCandidateDialogs.js +486 -222
- package/dist/support/components/careers/BulkCandidateDialogs.js.map +1 -1
- package/dist/support/components/careers/BulkOperationFeedback.d.ts +7 -1
- package/dist/support/components/careers/BulkOperationFeedback.js +80 -1
- package/dist/support/components/careers/BulkOperationFeedback.js.map +1 -1
- package/dist/support/constants/pipeline.js +3 -0
- package/dist/support/constants/pipeline.js.map +1 -1
- package/dist/support/pages/JobApplicationsPage.js +543 -509
- package/dist/support/pages/JobApplicationsPage.js.map +1 -1
- package/dist/support/utils/bulkCandidateOperations.d.ts +30 -0
- package/dist/support/utils/bulkCandidateOperations.js +34 -4
- package/dist/support/utils/bulkCandidateOperations.js.map +1 -1
- package/package.json +1 -1
|
@@ -222,17 +222,47 @@ function C(e, t) {
|
|
|
222
222
|
failed: [...e.failed, ...t.failed]
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
function w(
|
|
225
|
+
function w() {
|
|
226
|
+
return {
|
|
227
|
+
succeeded: [],
|
|
228
|
+
failed: []
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function T(e, t) {
|
|
232
|
+
v(e, [...t.succeeded.map((e) => e.applicationId), ...t.failed.map((e) => e.applicationId)], "The bulk custom email request");
|
|
233
|
+
}
|
|
234
|
+
function E(e, t) {
|
|
235
|
+
return {
|
|
236
|
+
succeeded: [...e.succeeded, ...t.succeeded],
|
|
237
|
+
failed: [...e.failed, ...t.failed]
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function D() {
|
|
241
|
+
return {
|
|
242
|
+
succeeded: [],
|
|
243
|
+
failed: []
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function O(e, t) {
|
|
247
|
+
v(e, [...t.succeeded.map((e) => e.applicationId), ...t.failed.map((e) => e.applicationId)], "The bulk status update request");
|
|
248
|
+
}
|
|
249
|
+
function k(e, t) {
|
|
250
|
+
return {
|
|
251
|
+
succeeded: [...e.succeeded, ...t.succeeded],
|
|
252
|
+
failed: [...e.failed, ...t.failed]
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function A(e, t) {
|
|
226
256
|
return e.emailLogs.some((e) => e.emailType === t);
|
|
227
257
|
}
|
|
228
|
-
function
|
|
258
|
+
function j() {
|
|
229
259
|
return {
|
|
230
260
|
succeeded: [],
|
|
231
261
|
skipped: [],
|
|
232
262
|
failed: []
|
|
233
263
|
};
|
|
234
264
|
}
|
|
235
|
-
function
|
|
265
|
+
function M(e, t) {
|
|
236
266
|
return {
|
|
237
267
|
succeeded: [...e.succeeded, ...t.succeeded],
|
|
238
268
|
skipped: [...e.skipped, ...t.skipped],
|
|
@@ -240,6 +270,6 @@ function E(e, t) {
|
|
|
240
270
|
};
|
|
241
271
|
}
|
|
242
272
|
//#endregion
|
|
243
|
-
export { f as CandidateChunkPreconditionError, e as CandidateMaterializationError, b as aggregateCandidateEmailResult,
|
|
273
|
+
export { f as CandidateChunkPreconditionError, e as CandidateMaterializationError, E as aggregateBulkCustomEmailResult, k as aggregateBulkStatusUpdateResult, b as aggregateCandidateEmailResult, M as aggregateDuplicateNoticeResult, C as aggregateEnsureRoundResult, T as assertCompleteBulkCustomEmailChunkResult, O as assertCompleteBulkStatusUpdateChunkResult, y as assertCompleteCandidateEmailChunkResult, S as assertCompleteEnsureRoundChunkResult, p as chunkCandidateRequests, w as createEmptyBulkCustomEmailAggregate, D as createEmptyBulkStatusUpdateAggregate, g as createEmptyCandidateEmailAggregate, i as createEmptyCandidateSelection, j as createEmptyDuplicateNoticeAggregate, x as createEmptyEnsureRoundAggregate, m as executeSequentialCandidateChunks, h as getBulkOperationNotificationSeverity, s as getCandidateSelectionCount, u as getCandidateSelectionSummary, o as getSelectedCandidateIds, A as hasCandidateEmailType, r as materializeCandidateTargets, d as resolveExactCandidateRounds, a as selectAllMaterializedCandidates, l as setVisibleCandidateSelection, c as toggleCandidateSelection };
|
|
244
274
|
|
|
245
275
|
//# sourceMappingURL=bulkCandidateOperations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulkCandidateOperations.js","names":[],"sources":["../../../src/support/utils/bulkCandidateOperations.ts"],"sourcesContent":["export const BULK_CANDIDATE_REQUEST_LIMIT = 100;\n\nexport interface CandidateRoundPreview {\n id: string;\n roundConfigId: string | null;\n name: string;\n roundType: string;\n emailLogs: ReadonlyArray<{\n emailType: string;\n }>;\n}\n\nexport interface BulkCandidateTarget {\n id: string;\n jobPostingId: string | null;\n interviewRounds: ReadonlyArray<CandidateRoundPreview>;\n}\n\nexport interface CandidateTargetPage<TTarget extends { id: string }> {\n items: ReadonlyArray<TTarget>;\n total: number;\n hasMore: boolean;\n}\n\nexport type CandidateMaterializationErrorCode =\n | 'STALE_SCOPE'\n | 'TOTAL_DRIFT'\n | 'EMPTY_PAGE_WITH_MORE'\n | 'INVALID_PAGE_LENGTH'\n | 'UNIQUE_COUNT_MISMATCH'\n | 'MEMBERSHIP_DRIFT';\n\nexport class CandidateMaterializationError extends Error {\n constructor(\n public readonly code: CandidateMaterializationErrorCode,\n message: string\n ) {\n super(message);\n this.name = 'CandidateMaterializationError';\n }\n}\n\ninterface MaterializeCandidateTargetsOptions<TTarget extends { id: string }> {\n scopeKey: string;\n expectedTotal: number;\n fetchPage: (limit: number, offset: number) => Promise<CandidateTargetPage<TTarget>>;\n getCurrentScopeKey: () => string;\n pageSize?: number;\n}\n\nfunction assertCurrentScope(scopeKey: string, currentScopeKey: string): void {\n if (scopeKey !== currentScopeKey) {\n throw new CandidateMaterializationError(\n 'STALE_SCOPE',\n 'The application filters changed while candidates were loading.'\n );\n }\n}\n\nasync function materializeCandidateTargetPass<TTarget extends { id: string }>({\n scopeKey,\n expectedTotal,\n fetchPage,\n getCurrentScopeKey,\n pageSize,\n}: Required<MaterializeCandidateTargetsOptions<TTarget>>): Promise<TTarget[]> {\n const targetsById = new Map<string, TTarget>();\n let offset = 0;\n\n while (true) {\n assertCurrentScope(scopeKey, getCurrentScopeKey());\n const page = await fetchPage(pageSize, offset);\n assertCurrentScope(scopeKey, getCurrentScopeKey());\n\n if (page.total !== expectedTotal) {\n throw new CandidateMaterializationError(\n 'TOTAL_DRIFT',\n `The matching application total changed from ${expectedTotal} to ${page.total}. Refresh and select again.`\n );\n }\n\n const rawPageLength = page.items.length;\n if (rawPageLength > pageSize) {\n throw new CandidateMaterializationError(\n 'INVALID_PAGE_LENGTH',\n `The server returned ${rawPageLength} applications for a page limited to ${pageSize}.`\n );\n }\n if (page.hasMore && rawPageLength === 0) {\n throw new CandidateMaterializationError(\n 'EMPTY_PAGE_WITH_MORE',\n 'The server reported more applications but returned an empty page.'\n );\n }\n\n for (const target of page.items) {\n if (!targetsById.has(target.id)) {\n targetsById.set(target.id, target);\n }\n }\n\n offset += rawPageLength;\n\n if (!page.hasMore) {\n if (targetsById.size !== expectedTotal) {\n throw new CandidateMaterializationError(\n 'UNIQUE_COUNT_MISMATCH',\n `Expected ${expectedTotal} unique applications but loaded ${targetsById.size}. Refresh and select again.`\n );\n }\n return [...targetsById.values()];\n }\n\n if (offset >= expectedTotal) {\n throw new CandidateMaterializationError(\n 'TOTAL_DRIFT',\n 'The server reported more applications after the frozen total had already been loaded.'\n );\n }\n }\n}\n\n/**\n * Materializes a frozen application-filter scope without trusting cached pages.\n * Two independent passes must return the same ordered target snapshots. This\n * catches offset-page membership shifts while preserving the 100-item page cap.\n */\nexport async function materializeCandidateTargets<TTarget extends { id: string }>({\n scopeKey,\n expectedTotal,\n fetchPage,\n getCurrentScopeKey,\n pageSize = BULK_CANDIDATE_REQUEST_LIMIT,\n}: MaterializeCandidateTargetsOptions<TTarget>): Promise<TTarget[]> {\n if (!Number.isInteger(expectedTotal) || expectedTotal < 0) {\n throw new CandidateMaterializationError(\n 'TOTAL_DRIFT',\n 'The application total is invalid. Refresh the list and try again.'\n );\n }\n if (!Number.isInteger(pageSize) || pageSize <= 0) {\n throw new CandidateMaterializationError(\n 'INVALID_PAGE_LENGTH',\n 'The candidate page size must be a positive integer.'\n );\n }\n\n const options = {\n scopeKey,\n expectedTotal,\n fetchPage,\n getCurrentScopeKey,\n pageSize,\n };\n const firstPass = await materializeCandidateTargetPass(options);\n const secondPass = await materializeCandidateTargetPass(options);\n\n if (JSON.stringify(firstPass) !== JSON.stringify(secondPass)) {\n throw new CandidateMaterializationError(\n 'MEMBERSHIP_DRIFT',\n 'Matching applications changed while candidates were loading. Refresh and select again.'\n );\n }\n\n return secondPass;\n}\n\ninterface MaterializeCandidateTargetsByIdsOptions<TTarget extends { id: string }> {\n scopeKey: string;\n applicationIds: ReadonlyArray<string>;\n fetchChunkPage: (\n applicationIds: ReadonlyArray<string>,\n limit: number,\n offset: number\n ) => Promise<CandidateTargetPage<TTarget>>;\n getCurrentScopeKey: () => string;\n}\n\n/**\n * Revalidates selected candidates in bounded ID chunks. Each chunk is filtered\n * by both its IDs and the frozen list filter, so earlier mutations cannot make\n * later validation rescan or reinterpret the full result set.\n */\nexport async function materializeCandidateTargetsByIds<TTarget extends { id: string }>({\n scopeKey,\n applicationIds,\n fetchChunkPage,\n getCurrentScopeKey,\n}: MaterializeCandidateTargetsByIdsOptions<TTarget>): Promise<TTarget[]> {\n if (applicationIds.length === 0) return [];\n if (new Set(applicationIds).size !== applicationIds.length) {\n throw new CandidateMaterializationError(\n 'UNIQUE_COUNT_MISMATCH',\n 'Selected applications must have unique IDs.'\n );\n }\n\n const targetsById = new Map<string, TTarget>();\n for (const applicationIdChunk of chunkCandidateRequests(applicationIds)) {\n const targets = await materializeCandidateTargets({\n scopeKey,\n expectedTotal: applicationIdChunk.length,\n getCurrentScopeKey,\n fetchPage: (limit, offset) => fetchChunkPage(applicationIdChunk, limit, offset),\n });\n for (const target of targets) targetsById.set(target.id, target);\n }\n\n return applicationIds.map((applicationId) => {\n const target = targetsById.get(applicationId);\n if (!target) {\n throw new CandidateMaterializationError(\n 'UNIQUE_COUNT_MISMATCH',\n 'A selected application was not returned by its bounded validation query.'\n );\n }\n return target;\n });\n}\n\nexport interface CandidateSelectionState {\n mode: 'explicit' | 'all';\n explicitIds: ReadonlySet<string>;\n allTargetIds: ReadonlySet<string>;\n excludedIds: ReadonlySet<string>;\n}\n\nexport function createEmptyCandidateSelection(): CandidateSelectionState {\n return {\n mode: 'explicit',\n explicitIds: new Set<string>(),\n allTargetIds: new Set<string>(),\n excludedIds: new Set<string>(),\n };\n}\n\nexport function selectAllMaterializedCandidates(\n applicationIds: ReadonlyArray<string>\n): CandidateSelectionState {\n return {\n mode: 'all',\n explicitIds: new Set<string>(),\n allTargetIds: new Set(applicationIds),\n excludedIds: new Set<string>(),\n };\n}\n\nexport function getSelectedCandidateIds(selection: CandidateSelectionState): Set<string> {\n if (selection.mode === 'explicit') {\n return new Set(selection.explicitIds);\n }\n\n const selectedIds = new Set(selection.allTargetIds);\n for (const excludedId of selection.excludedIds) {\n selectedIds.delete(excludedId);\n }\n return selectedIds;\n}\n\nexport function getCandidateSelectionCount(selection: CandidateSelectionState): number {\n return getSelectedCandidateIds(selection).size;\n}\n\nexport function toggleCandidateSelection(\n selection: CandidateSelectionState,\n applicationId: string\n): CandidateSelectionState {\n if (selection.mode === 'all') {\n if (!selection.allTargetIds.has(applicationId)) {\n return selection;\n }\n const excludedIds = new Set(selection.excludedIds);\n if (excludedIds.has(applicationId)) {\n excludedIds.delete(applicationId);\n } else {\n excludedIds.add(applicationId);\n }\n return { ...selection, excludedIds };\n }\n\n const explicitIds = new Set(selection.explicitIds);\n if (explicitIds.has(applicationId)) {\n explicitIds.delete(applicationId);\n } else {\n explicitIds.add(applicationId);\n }\n return { ...selection, explicitIds };\n}\n\nexport function setVisibleCandidateSelection(\n selection: CandidateSelectionState,\n visibleApplicationIds: ReadonlyArray<string>,\n selected: boolean\n): CandidateSelectionState {\n if (selection.mode === 'all') {\n const excludedIds = new Set(selection.excludedIds);\n for (const applicationId of visibleApplicationIds) {\n if (!selection.allTargetIds.has(applicationId)) continue;\n if (selected) {\n excludedIds.delete(applicationId);\n } else {\n excludedIds.add(applicationId);\n }\n }\n return { ...selection, excludedIds };\n }\n\n const explicitIds = new Set(selection.explicitIds);\n for (const applicationId of visibleApplicationIds) {\n if (selected) {\n explicitIds.add(applicationId);\n } else {\n explicitIds.delete(applicationId);\n }\n }\n return { ...selection, explicitIds };\n}\n\nexport function getCandidateSelectionSummary(selection: CandidateSelectionState): string | null {\n const selectedCount = getCandidateSelectionCount(selection);\n if (selectedCount === 0) return null;\n\n if (selection.mode === 'all') {\n const totalCount = selection.allTargetIds.size;\n const excludedCount = totalCount - selectedCount;\n if (excludedCount === 0) {\n return `All ${totalCount} matching applications selected`;\n }\n return `${selectedCount} of ${totalCount} matching applications selected (${excludedCount} excluded)`;\n }\n\n return `${selectedCount} ${selectedCount === 1 ? 'application' : 'applications'} selected`;\n}\n\nexport interface ExactRoundPair {\n applicationId: string;\n roundId: string;\n target: BulkCandidateTarget;\n round: CandidateRoundPreview;\n}\n\nexport interface UnresolvedCandidateRound {\n target: BulkCandidateTarget;\n reason: 'MISSING' | 'AMBIGUOUS';\n}\n\nexport interface ExactRoundResolution {\n pairs: ExactRoundPair[];\n unresolved: UnresolvedCandidateRound[];\n}\n\n/** Resolve only concrete rounds with the requested config ID; never guess by name or type. */\nexport function resolveExactCandidateRounds(\n targets: ReadonlyArray<BulkCandidateTarget>,\n roundConfigId: string\n): ExactRoundResolution {\n const pairs: ExactRoundPair[] = [];\n const unresolved: UnresolvedCandidateRound[] = [];\n\n for (const target of targets) {\n const matches = target.interviewRounds.filter((round) => round.roundConfigId === roundConfigId);\n if (matches.length !== 1) {\n unresolved.push({\n target,\n reason: matches.length === 0 ? 'MISSING' : 'AMBIGUOUS',\n });\n continue;\n }\n\n const round = matches[0];\n pairs.push({ applicationId: target.id, roundId: round.id, target, round });\n }\n\n return { pairs, unresolved };\n}\n\nexport class CandidateChunkPreconditionError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CandidateChunkPreconditionError';\n }\n}\n\nexport function assertCandidateChunkMatchesCurrentScope(\n applicationIds: ReadonlyArray<string>,\n currentTargets: ReadonlyArray<BulkCandidateTarget>,\n jobPostingId: string\n): void {\n const currentById = new Map(currentTargets.map((target) => [target.id, target]));\n\n for (const applicationId of applicationIds) {\n const target = currentById.get(applicationId);\n if (!target || target.jobPostingId !== jobPostingId) {\n throw new CandidateChunkPreconditionError(\n 'A selected application no longer matches the frozen filter and posting. No request was sent for this chunk.'\n );\n }\n }\n}\n\nexport function assertCandidateEmailChunkMatchesCurrentScope(\n items: ReadonlyArray<{ applicationId: string; roundId: string }>,\n currentTargets: ReadonlyArray<BulkCandidateTarget>,\n jobPostingId: string,\n roundConfigId: string\n): void {\n assertCandidateChunkMatchesCurrentScope(\n items.map((item) => item.applicationId),\n currentTargets,\n jobPostingId\n );\n\n const currentById = new Map(currentTargets.map((target) => [target.id, target]));\n for (const item of items) {\n const target = currentById.get(item.applicationId);\n const matchingRounds = target?.interviewRounds.filter(\n (round) => round.roundConfigId === roundConfigId\n );\n if (matchingRounds?.length !== 1 || matchingRounds[0]?.id !== item.roundId) {\n throw new CandidateChunkPreconditionError(\n 'A selected candidate round changed after preview. No request was sent for this chunk.'\n );\n }\n }\n}\n\nexport function chunkCandidateRequests<T>(\n items: ReadonlyArray<T>,\n chunkSize = BULK_CANDIDATE_REQUEST_LIMIT\n): T[][] {\n if (!Number.isInteger(chunkSize) || chunkSize <= 0) {\n throw new Error('Chunk size must be a positive integer.');\n }\n\n const chunks: T[][] = [];\n for (let index = 0; index < items.length; index += chunkSize) {\n chunks.push(items.slice(index, index + chunkSize));\n }\n return chunks;\n}\n\nexport interface SequentialExecutionProgress {\n processed: number;\n total: number;\n}\n\nexport interface SequentialExecutionResult<TItem, TAggregate> {\n aggregate: TAggregate;\n processedItems: TItem[];\n ambiguousItems: TItem[];\n notStartedItems: TItem[];\n error: unknown | null;\n}\n\ninterface ExecuteSequentialCandidateChunksOptions<TItem, TBatchResult, TAggregate> {\n items: ReadonlyArray<TItem>;\n initialAggregate: TAggregate;\n executeChunk: (chunk: ReadonlyArray<TItem>, chunkIndex: number) => Promise<TBatchResult>;\n mergeResult: (aggregate: TAggregate, result: TBatchResult) => TAggregate;\n onProgress?: (progress: SequentialExecutionProgress) => void;\n chunkSize?: number;\n}\n\n/**\n * Executes each request once and in order. A thrown transport/missing-data error\n * makes the current chunk ambiguous and prevents every later chunk from starting.\n */\nexport async function executeSequentialCandidateChunks<TItem, TBatchResult, TAggregate>({\n items,\n initialAggregate,\n executeChunk,\n mergeResult,\n onProgress,\n chunkSize = BULK_CANDIDATE_REQUEST_LIMIT,\n}: ExecuteSequentialCandidateChunksOptions<TItem, TBatchResult, TAggregate>): Promise<\n SequentialExecutionResult<TItem, TAggregate>\n> {\n const chunks = chunkCandidateRequests(items, chunkSize);\n const processedItems: TItem[] = [];\n let aggregate = initialAggregate;\n\n onProgress?.({ processed: 0, total: items.length });\n\n for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex += 1) {\n const chunk = chunks[chunkIndex];\n try {\n const result = await executeChunk(chunk, chunkIndex);\n aggregate = mergeResult(aggregate, result);\n processedItems.push(...chunk);\n onProgress?.({ processed: processedItems.length, total: items.length });\n } catch (error) {\n const failedBeforeMutation = error instanceof CandidateChunkPreconditionError;\n return {\n aggregate,\n processedItems,\n ambiguousItems: failedBeforeMutation ? [] : [...chunk],\n notStartedItems: failedBeforeMutation\n ? chunks.slice(chunkIndex).flat()\n : chunks.slice(chunkIndex + 1).flat(),\n error,\n };\n }\n }\n\n return {\n aggregate,\n processedItems,\n ambiguousItems: [],\n notStartedItems: [],\n error: null,\n };\n}\n\nexport type BulkOperationNotificationSeverity = 'success' | 'warning' | 'error';\n\nexport function getBulkOperationNotificationSeverity({\n succeeded,\n skipped,\n failed,\n ambiguous = false,\n}: {\n succeeded: number;\n skipped: number;\n failed: number;\n ambiguous?: boolean;\n}): BulkOperationNotificationSeverity {\n if (ambiguous) return 'error';\n if (failed > 0 && succeeded === 0 && skipped === 0) return 'error';\n if (failed > 0 || skipped > 0) return 'warning';\n return 'success';\n}\n\nexport interface CandidateEmailSuccess {\n applicationId: string;\n roundId: string;\n}\n\nexport interface CandidateEmailSkip {\n applicationId: string;\n roundId: string;\n reason: string;\n message: string;\n}\n\nexport interface CandidateEmailFailure {\n applicationId: string;\n roundId: string;\n message: string;\n}\n\nexport interface CandidateEmailAggregate {\n succeeded: CandidateEmailSuccess[];\n skipped: CandidateEmailSkip[];\n failed: CandidateEmailFailure[];\n}\n\nexport function createEmptyCandidateEmailAggregate(): CandidateEmailAggregate {\n return { succeeded: [], skipped: [], failed: [] };\n}\n\nfunction candidateRoundKey(applicationId: string, roundId: string): string {\n return `${applicationId}\\0${roundId}`;\n}\n\nfunction assertExactResultKeys(\n expectedKeys: ReadonlyArray<string>,\n actualKeys: ReadonlyArray<string>,\n operationLabel: string\n): void {\n const expected = new Set(expectedKeys);\n const actual = new Set(actualKeys);\n if (\n expected.size !== expectedKeys.length ||\n actual.size !== actualKeys.length ||\n expected.size !== actual.size ||\n [...expected].some((key) => !actual.has(key))\n ) {\n throw new Error(\n `${operationLabel} returned an incomplete, duplicate, or unexpected item result. The current chunk is ambiguous and later chunks were stopped.`\n );\n }\n}\n\nexport function assertCompleteCandidateEmailChunkResult(\n requested: ReadonlyArray<{ applicationId: string; roundId: string }>,\n result: CandidateEmailAggregate\n): void {\n assertExactResultKeys(\n requested.map((item) => candidateRoundKey(item.applicationId, item.roundId)),\n [\n ...result.succeeded.map((item) => candidateRoundKey(item.applicationId, item.roundId)),\n ...result.skipped.map((item) => candidateRoundKey(item.applicationId, item.roundId)),\n ...result.failed.map((item) => candidateRoundKey(item.applicationId, item.roundId)),\n ],\n 'The candidate email request'\n );\n}\n\nexport function aggregateCandidateEmailResult(\n aggregate: CandidateEmailAggregate,\n result: CandidateEmailAggregate\n): CandidateEmailAggregate {\n return {\n succeeded: [...aggregate.succeeded, ...result.succeeded],\n skipped: [...aggregate.skipped, ...result.skipped],\n failed: [...aggregate.failed, ...result.failed],\n };\n}\n\nexport interface EnsuredRoundSummary {\n id: string;\n applicationId: string;\n}\n\nexport interface EnsureRoundFailure {\n applicationId: string;\n code: string;\n message: string;\n}\n\nexport interface EnsureRoundAggregate {\n created: EnsuredRoundSummary[];\n alreadyPresent: EnsuredRoundSummary[];\n failed: EnsureRoundFailure[];\n}\n\nexport function createEmptyEnsureRoundAggregate(): EnsureRoundAggregate {\n return { created: [], alreadyPresent: [], failed: [] };\n}\n\nexport function assertCompleteEnsureRoundChunkResult(\n requestedApplicationIds: ReadonlyArray<string>,\n result: EnsureRoundAggregate\n): void {\n assertExactResultKeys(\n requestedApplicationIds,\n [\n ...result.created.map((item) => item.applicationId),\n ...result.alreadyPresent.map((item) => item.applicationId),\n ...result.failed.map((item) => item.applicationId),\n ],\n 'The add-to-round request'\n );\n}\n\nexport function aggregateEnsureRoundResult(\n aggregate: EnsureRoundAggregate,\n result: EnsureRoundAggregate\n): EnsureRoundAggregate {\n return {\n created: [...aggregate.created, ...result.created],\n alreadyPresent: [...aggregate.alreadyPresent, ...result.alreadyPresent],\n failed: [...aggregate.failed, ...result.failed],\n };\n}\n\nexport function hasCandidateEmailType(round: CandidateRoundPreview, emailType: string): boolean {\n return round.emailLogs.some((log) => log.emailType === emailType);\n}\n\nexport interface DuplicateNoticeSuccess {\n email: string;\n}\n\nexport interface DuplicateNoticeSkip {\n email: string;\n reason: string;\n message: string;\n}\n\nexport interface DuplicateNoticeFailure {\n email: string;\n message: string;\n}\n\nexport interface DuplicateNoticeAggregate {\n succeeded: DuplicateNoticeSuccess[];\n skipped: DuplicateNoticeSkip[];\n failed: DuplicateNoticeFailure[];\n}\n\nexport function createEmptyDuplicateNoticeAggregate(): DuplicateNoticeAggregate {\n return { succeeded: [], skipped: [], failed: [] };\n}\n\nexport function aggregateDuplicateNoticeResult(\n aggregate: DuplicateNoticeAggregate,\n result: DuplicateNoticeAggregate\n): DuplicateNoticeAggregate {\n return {\n succeeded: [...aggregate.succeeded, ...result.succeeded],\n skipped: [...aggregate.skipped, ...result.skipped],\n failed: [...aggregate.failed, ...result.failed],\n };\n}\n"],"mappings":"AAgCA,IAAa,IAAb,cAAmD,MAAM;CAErC;CADlB,YACE,GACA,GACA;EAEA,AADA,MAAM,CAAO,GAHG,KAAA,OAAA,GAIhB,KAAK,OAAO;CACd;AACF;AAUA,SAAS,EAAmB,GAAkB,GAA+B;CAC3E,IAAI,MAAa,GACf,MAAM,IAAI,EACR,eACA,gEACF;AAEJ;AAEA,eAAe,EAA+D,EAC5E,aACA,kBACA,cACA,uBACA,eAC4E;CAC5E,IAAM,oBAAc,IAAI,IAAqB,GACzC,IAAS;CAEb,SAAa;EACX,EAAmB,GAAU,EAAmB,CAAC;EACjD,IAAM,IAAO,MAAM,EAAU,GAAU,CAAM;EAG7C,IAFA,EAAmB,GAAU,EAAmB,CAAC,GAE7C,EAAK,UAAU,GACjB,MAAM,IAAI,EACR,eACA,+CAA+C,EAAc,MAAM,EAAK,MAAM,4BAChF;EAGF,IAAM,IAAgB,EAAK,MAAM;EACjC,IAAI,IAAgB,GAClB,MAAM,IAAI,EACR,uBACA,uBAAuB,EAAc,sCAAsC,EAAS,EACtF;EAEF,IAAI,EAAK,WAAW,MAAkB,GACpC,MAAM,IAAI,EACR,wBACA,mEACF;EAGF,KAAK,IAAM,KAAU,EAAK,OACxB,AAAK,EAAY,IAAI,EAAO,EAAE,KAC5B,EAAY,IAAI,EAAO,IAAI,CAAM;EAMrC,IAFA,KAAU,GAEN,CAAC,EAAK,SAAS;GACjB,IAAI,EAAY,SAAS,GACvB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idateOperations.ts"],"sourcesContent":["export const BULK_CANDIDATE_REQUEST_LIMIT = 100;\n\nexport interface CandidateRoundPreview {\n id: string;\n roundConfigId: string | null;\n name: string;\n roundType: string;\n emailLogs: ReadonlyArray<{\n emailType: string;\n }>;\n}\n\nexport interface BulkCandidateTarget {\n id: string;\n jobPostingId: string | null;\n interviewRounds: ReadonlyArray<CandidateRoundPreview>;\n}\n\nexport interface CandidateTargetPage<TTarget extends { id: string }> {\n items: ReadonlyArray<TTarget>;\n total: number;\n hasMore: boolean;\n}\n\nexport type CandidateMaterializationErrorCode =\n | 'STALE_SCOPE'\n | 'TOTAL_DRIFT'\n | 'EMPTY_PAGE_WITH_MORE'\n | 'INVALID_PAGE_LENGTH'\n | 'UNIQUE_COUNT_MISMATCH'\n | 'MEMBERSHIP_DRIFT';\n\nexport class CandidateMaterializationError extends Error {\n constructor(\n public readonly code: CandidateMaterializationErrorCode,\n message: string\n ) {\n super(message);\n this.name = 'CandidateMaterializationError';\n }\n}\n\ninterface MaterializeCandidateTargetsOptions<TTarget extends { id: string }> {\n scopeKey: string;\n expectedTotal: number;\n fetchPage: (limit: number, offset: number) => Promise<CandidateTargetPage<TTarget>>;\n getCurrentScopeKey: () => string;\n pageSize?: number;\n}\n\nfunction assertCurrentScope(scopeKey: string, currentScopeKey: string): void {\n if (scopeKey !== currentScopeKey) {\n throw new CandidateMaterializationError(\n 'STALE_SCOPE',\n 'The application filters changed while candidates were loading.'\n );\n }\n}\n\nasync function materializeCandidateTargetPass<TTarget extends { id: string }>({\n scopeKey,\n expectedTotal,\n fetchPage,\n getCurrentScopeKey,\n pageSize,\n}: Required<MaterializeCandidateTargetsOptions<TTarget>>): Promise<TTarget[]> {\n const targetsById = new Map<string, TTarget>();\n let offset = 0;\n\n while (true) {\n assertCurrentScope(scopeKey, getCurrentScopeKey());\n const page = await fetchPage(pageSize, offset);\n assertCurrentScope(scopeKey, getCurrentScopeKey());\n\n if (page.total !== expectedTotal) {\n throw new CandidateMaterializationError(\n 'TOTAL_DRIFT',\n `The matching application total changed from ${expectedTotal} to ${page.total}. Refresh and select again.`\n );\n }\n\n const rawPageLength = page.items.length;\n if (rawPageLength > pageSize) {\n throw new CandidateMaterializationError(\n 'INVALID_PAGE_LENGTH',\n `The server returned ${rawPageLength} applications for a page limited to ${pageSize}.`\n );\n }\n if (page.hasMore && rawPageLength === 0) {\n throw new CandidateMaterializationError(\n 'EMPTY_PAGE_WITH_MORE',\n 'The server reported more applications but returned an empty page.'\n );\n }\n\n for (const target of page.items) {\n if (!targetsById.has(target.id)) {\n targetsById.set(target.id, target);\n }\n }\n\n offset += rawPageLength;\n\n if (!page.hasMore) {\n if (targetsById.size !== expectedTotal) {\n throw new CandidateMaterializationError(\n 'UNIQUE_COUNT_MISMATCH',\n `Expected ${expectedTotal} unique applications but loaded ${targetsById.size}. Refresh and select again.`\n );\n }\n return [...targetsById.values()];\n }\n\n if (offset >= expectedTotal) {\n throw new CandidateMaterializationError(\n 'TOTAL_DRIFT',\n 'The server reported more applications after the frozen total had already been loaded.'\n );\n }\n }\n}\n\n/**\n * Materializes a frozen application-filter scope without trusting cached pages.\n * Two independent passes must return the same ordered target snapshots. This\n * catches offset-page membership shifts while preserving the 100-item page cap.\n */\nexport async function materializeCandidateTargets<TTarget extends { id: string }>({\n scopeKey,\n expectedTotal,\n fetchPage,\n getCurrentScopeKey,\n pageSize = BULK_CANDIDATE_REQUEST_LIMIT,\n}: MaterializeCandidateTargetsOptions<TTarget>): Promise<TTarget[]> {\n if (!Number.isInteger(expectedTotal) || expectedTotal < 0) {\n throw new CandidateMaterializationError(\n 'TOTAL_DRIFT',\n 'The application total is invalid. Refresh the list and try again.'\n );\n }\n if (!Number.isInteger(pageSize) || pageSize <= 0) {\n throw new CandidateMaterializationError(\n 'INVALID_PAGE_LENGTH',\n 'The candidate page size must be a positive integer.'\n );\n }\n\n const options = {\n scopeKey,\n expectedTotal,\n fetchPage,\n getCurrentScopeKey,\n pageSize,\n };\n const firstPass = await materializeCandidateTargetPass(options);\n const secondPass = await materializeCandidateTargetPass(options);\n\n if (JSON.stringify(firstPass) !== JSON.stringify(secondPass)) {\n throw new CandidateMaterializationError(\n 'MEMBERSHIP_DRIFT',\n 'Matching applications changed while candidates were loading. Refresh and select again.'\n );\n }\n\n return secondPass;\n}\n\ninterface MaterializeCandidateTargetsByIdsOptions<TTarget extends { id: string }> {\n scopeKey: string;\n applicationIds: ReadonlyArray<string>;\n fetchChunkPage: (\n applicationIds: ReadonlyArray<string>,\n limit: number,\n offset: number\n ) => Promise<CandidateTargetPage<TTarget>>;\n getCurrentScopeKey: () => string;\n}\n\n/**\n * Revalidates selected candidates in bounded ID chunks. Each chunk is filtered\n * by both its IDs and the frozen list filter, so earlier mutations cannot make\n * later validation rescan or reinterpret the full result set.\n */\nexport async function materializeCandidateTargetsByIds<TTarget extends { id: string }>({\n scopeKey,\n applicationIds,\n fetchChunkPage,\n getCurrentScopeKey,\n}: MaterializeCandidateTargetsByIdsOptions<TTarget>): Promise<TTarget[]> {\n if (applicationIds.length === 0) return [];\n if (new Set(applicationIds).size !== applicationIds.length) {\n throw new CandidateMaterializationError(\n 'UNIQUE_COUNT_MISMATCH',\n 'Selected applications must have unique IDs.'\n );\n }\n\n const targetsById = new Map<string, TTarget>();\n for (const applicationIdChunk of chunkCandidateRequests(applicationIds)) {\n const targets = await materializeCandidateTargets({\n scopeKey,\n expectedTotal: applicationIdChunk.length,\n getCurrentScopeKey,\n fetchPage: (limit, offset) => fetchChunkPage(applicationIdChunk, limit, offset),\n });\n for (const target of targets) targetsById.set(target.id, target);\n }\n\n return applicationIds.map((applicationId) => {\n const target = targetsById.get(applicationId);\n if (!target) {\n throw new CandidateMaterializationError(\n 'UNIQUE_COUNT_MISMATCH',\n 'A selected application was not returned by its bounded validation query.'\n );\n }\n return target;\n });\n}\n\nexport interface CandidateSelectionState {\n mode: 'explicit' | 'all';\n explicitIds: ReadonlySet<string>;\n allTargetIds: ReadonlySet<string>;\n excludedIds: ReadonlySet<string>;\n}\n\nexport function createEmptyCandidateSelection(): CandidateSelectionState {\n return {\n mode: 'explicit',\n explicitIds: new Set<string>(),\n allTargetIds: new Set<string>(),\n excludedIds: new Set<string>(),\n };\n}\n\nexport function selectAllMaterializedCandidates(\n applicationIds: ReadonlyArray<string>\n): CandidateSelectionState {\n return {\n mode: 'all',\n explicitIds: new Set<string>(),\n allTargetIds: new Set(applicationIds),\n excludedIds: new Set<string>(),\n };\n}\n\nexport function getSelectedCandidateIds(selection: CandidateSelectionState): Set<string> {\n if (selection.mode === 'explicit') {\n return new Set(selection.explicitIds);\n }\n\n const selectedIds = new Set(selection.allTargetIds);\n for (const excludedId of selection.excludedIds) {\n selectedIds.delete(excludedId);\n }\n return selectedIds;\n}\n\nexport function getCandidateSelectionCount(selection: CandidateSelectionState): number {\n return getSelectedCandidateIds(selection).size;\n}\n\nexport function toggleCandidateSelection(\n selection: CandidateSelectionState,\n applicationId: string\n): CandidateSelectionState {\n if (selection.mode === 'all') {\n if (!selection.allTargetIds.has(applicationId)) {\n return selection;\n }\n const excludedIds = new Set(selection.excludedIds);\n if (excludedIds.has(applicationId)) {\n excludedIds.delete(applicationId);\n } else {\n excludedIds.add(applicationId);\n }\n return { ...selection, excludedIds };\n }\n\n const explicitIds = new Set(selection.explicitIds);\n if (explicitIds.has(applicationId)) {\n explicitIds.delete(applicationId);\n } else {\n explicitIds.add(applicationId);\n }\n return { ...selection, explicitIds };\n}\n\nexport function setVisibleCandidateSelection(\n selection: CandidateSelectionState,\n visibleApplicationIds: ReadonlyArray<string>,\n selected: boolean\n): CandidateSelectionState {\n if (selection.mode === 'all') {\n const excludedIds = new Set(selection.excludedIds);\n for (const applicationId of visibleApplicationIds) {\n if (!selection.allTargetIds.has(applicationId)) continue;\n if (selected) {\n excludedIds.delete(applicationId);\n } else {\n excludedIds.add(applicationId);\n }\n }\n return { ...selection, excludedIds };\n }\n\n const explicitIds = new Set(selection.explicitIds);\n for (const applicationId of visibleApplicationIds) {\n if (selected) {\n explicitIds.add(applicationId);\n } else {\n explicitIds.delete(applicationId);\n }\n }\n return { ...selection, explicitIds };\n}\n\nexport function getCandidateSelectionSummary(selection: CandidateSelectionState): string | null {\n const selectedCount = getCandidateSelectionCount(selection);\n if (selectedCount === 0) return null;\n\n if (selection.mode === 'all') {\n const totalCount = selection.allTargetIds.size;\n const excludedCount = totalCount - selectedCount;\n if (excludedCount === 0) {\n return `All ${totalCount} matching applications selected`;\n }\n return `${selectedCount} of ${totalCount} matching applications selected (${excludedCount} excluded)`;\n }\n\n return `${selectedCount} ${selectedCount === 1 ? 'application' : 'applications'} selected`;\n}\n\nexport interface ExactRoundPair {\n applicationId: string;\n roundId: string;\n target: BulkCandidateTarget;\n round: CandidateRoundPreview;\n}\n\nexport interface UnresolvedCandidateRound {\n target: BulkCandidateTarget;\n reason: 'MISSING' | 'AMBIGUOUS';\n}\n\nexport interface ExactRoundResolution {\n pairs: ExactRoundPair[];\n unresolved: UnresolvedCandidateRound[];\n}\n\n/** Resolve only concrete rounds with the requested config ID; never guess by name or type. */\nexport function resolveExactCandidateRounds(\n targets: ReadonlyArray<BulkCandidateTarget>,\n roundConfigId: string\n): ExactRoundResolution {\n const pairs: ExactRoundPair[] = [];\n const unresolved: UnresolvedCandidateRound[] = [];\n\n for (const target of targets) {\n const matches = target.interviewRounds.filter((round) => round.roundConfigId === roundConfigId);\n if (matches.length !== 1) {\n unresolved.push({\n target,\n reason: matches.length === 0 ? 'MISSING' : 'AMBIGUOUS',\n });\n continue;\n }\n\n const round = matches[0];\n pairs.push({ applicationId: target.id, roundId: round.id, target, round });\n }\n\n return { pairs, unresolved };\n}\n\nexport class CandidateChunkPreconditionError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CandidateChunkPreconditionError';\n }\n}\n\nexport function assertCandidateChunkMatchesCurrentScope(\n applicationIds: ReadonlyArray<string>,\n currentTargets: ReadonlyArray<BulkCandidateTarget>,\n jobPostingId: string\n): void {\n const currentById = new Map(currentTargets.map((target) => [target.id, target]));\n\n for (const applicationId of applicationIds) {\n const target = currentById.get(applicationId);\n if (!target || target.jobPostingId !== jobPostingId) {\n throw new CandidateChunkPreconditionError(\n 'A selected application no longer matches the frozen filter and posting. No request was sent for this chunk.'\n );\n }\n }\n}\n\nexport function assertCandidateEmailChunkMatchesCurrentScope(\n items: ReadonlyArray<{ applicationId: string; roundId: string }>,\n currentTargets: ReadonlyArray<BulkCandidateTarget>,\n jobPostingId: string,\n roundConfigId: string\n): void {\n assertCandidateChunkMatchesCurrentScope(\n items.map((item) => item.applicationId),\n currentTargets,\n jobPostingId\n );\n\n const currentById = new Map(currentTargets.map((target) => [target.id, target]));\n for (const item of items) {\n const target = currentById.get(item.applicationId);\n const matchingRounds = target?.interviewRounds.filter(\n (round) => round.roundConfigId === roundConfigId\n );\n if (matchingRounds?.length !== 1 || matchingRounds[0]?.id !== item.roundId) {\n throw new CandidateChunkPreconditionError(\n 'A selected candidate round changed after preview. No request was sent for this chunk.'\n );\n }\n }\n}\n\nexport function chunkCandidateRequests<T>(\n items: ReadonlyArray<T>,\n chunkSize = BULK_CANDIDATE_REQUEST_LIMIT\n): T[][] {\n if (!Number.isInteger(chunkSize) || chunkSize <= 0) {\n throw new Error('Chunk size must be a positive integer.');\n }\n\n const chunks: T[][] = [];\n for (let index = 0; index < items.length; index += chunkSize) {\n chunks.push(items.slice(index, index + chunkSize));\n }\n return chunks;\n}\n\nexport interface SequentialExecutionProgress {\n processed: number;\n total: number;\n}\n\nexport interface SequentialExecutionResult<TItem, TAggregate> {\n aggregate: TAggregate;\n processedItems: TItem[];\n ambiguousItems: TItem[];\n notStartedItems: TItem[];\n error: unknown | null;\n}\n\ninterface ExecuteSequentialCandidateChunksOptions<TItem, TBatchResult, TAggregate> {\n items: ReadonlyArray<TItem>;\n initialAggregate: TAggregate;\n executeChunk: (chunk: ReadonlyArray<TItem>, chunkIndex: number) => Promise<TBatchResult>;\n mergeResult: (aggregate: TAggregate, result: TBatchResult) => TAggregate;\n onProgress?: (progress: SequentialExecutionProgress) => void;\n chunkSize?: number;\n}\n\n/**\n * Executes each request once and in order. A thrown transport/missing-data error\n * makes the current chunk ambiguous and prevents every later chunk from starting.\n */\nexport async function executeSequentialCandidateChunks<TItem, TBatchResult, TAggregate>({\n items,\n initialAggregate,\n executeChunk,\n mergeResult,\n onProgress,\n chunkSize = BULK_CANDIDATE_REQUEST_LIMIT,\n}: ExecuteSequentialCandidateChunksOptions<TItem, TBatchResult, TAggregate>): Promise<\n SequentialExecutionResult<TItem, TAggregate>\n> {\n const chunks = chunkCandidateRequests(items, chunkSize);\n const processedItems: TItem[] = [];\n let aggregate = initialAggregate;\n\n onProgress?.({ processed: 0, total: items.length });\n\n for (let chunkIndex = 0; chunkIndex < chunks.length; chunkIndex += 1) {\n const chunk = chunks[chunkIndex];\n try {\n const result = await executeChunk(chunk, chunkIndex);\n aggregate = mergeResult(aggregate, result);\n processedItems.push(...chunk);\n onProgress?.({ processed: processedItems.length, total: items.length });\n } catch (error) {\n const failedBeforeMutation = error instanceof CandidateChunkPreconditionError;\n return {\n aggregate,\n processedItems,\n ambiguousItems: failedBeforeMutation ? [] : [...chunk],\n notStartedItems: failedBeforeMutation\n ? chunks.slice(chunkIndex).flat()\n : chunks.slice(chunkIndex + 1).flat(),\n error,\n };\n }\n }\n\n return {\n aggregate,\n processedItems,\n ambiguousItems: [],\n notStartedItems: [],\n error: null,\n };\n}\n\nexport type BulkOperationNotificationSeverity = 'success' | 'warning' | 'error';\n\nexport function getBulkOperationNotificationSeverity({\n succeeded,\n skipped,\n failed,\n ambiguous = false,\n}: {\n succeeded: number;\n skipped: number;\n failed: number;\n ambiguous?: boolean;\n}): BulkOperationNotificationSeverity {\n if (ambiguous) return 'error';\n if (failed > 0 && succeeded === 0 && skipped === 0) return 'error';\n if (failed > 0 || skipped > 0) return 'warning';\n return 'success';\n}\n\nexport interface CandidateEmailSuccess {\n applicationId: string;\n roundId: string;\n}\n\nexport interface CandidateEmailSkip {\n applicationId: string;\n roundId: string;\n reason: string;\n message: string;\n}\n\nexport interface CandidateEmailFailure {\n applicationId: string;\n roundId: string;\n message: string;\n}\n\nexport interface CandidateEmailAggregate {\n succeeded: CandidateEmailSuccess[];\n skipped: CandidateEmailSkip[];\n failed: CandidateEmailFailure[];\n}\n\nexport function createEmptyCandidateEmailAggregate(): CandidateEmailAggregate {\n return { succeeded: [], skipped: [], failed: [] };\n}\n\nfunction candidateRoundKey(applicationId: string, roundId: string): string {\n return `${applicationId}\\0${roundId}`;\n}\n\nfunction assertExactResultKeys(\n expectedKeys: ReadonlyArray<string>,\n actualKeys: ReadonlyArray<string>,\n operationLabel: string\n): void {\n const expected = new Set(expectedKeys);\n const actual = new Set(actualKeys);\n if (\n expected.size !== expectedKeys.length ||\n actual.size !== actualKeys.length ||\n expected.size !== actual.size ||\n [...expected].some((key) => !actual.has(key))\n ) {\n throw new Error(\n `${operationLabel} returned an incomplete, duplicate, or unexpected item result. The current chunk is ambiguous and later chunks were stopped.`\n );\n }\n}\n\nexport function assertCompleteCandidateEmailChunkResult(\n requested: ReadonlyArray<{ applicationId: string; roundId: string }>,\n result: CandidateEmailAggregate\n): void {\n assertExactResultKeys(\n requested.map((item) => candidateRoundKey(item.applicationId, item.roundId)),\n [\n ...result.succeeded.map((item) => candidateRoundKey(item.applicationId, item.roundId)),\n ...result.skipped.map((item) => candidateRoundKey(item.applicationId, item.roundId)),\n ...result.failed.map((item) => candidateRoundKey(item.applicationId, item.roundId)),\n ],\n 'The candidate email request'\n );\n}\n\nexport function aggregateCandidateEmailResult(\n aggregate: CandidateEmailAggregate,\n result: CandidateEmailAggregate\n): CandidateEmailAggregate {\n return {\n succeeded: [...aggregate.succeeded, ...result.succeeded],\n skipped: [...aggregate.skipped, ...result.skipped],\n failed: [...aggregate.failed, ...result.failed],\n };\n}\n\nexport interface EnsuredRoundSummary {\n id: string;\n applicationId: string;\n}\n\nexport interface EnsureRoundFailure {\n applicationId: string;\n code: string;\n message: string;\n}\n\nexport interface EnsureRoundAggregate {\n created: EnsuredRoundSummary[];\n alreadyPresent: EnsuredRoundSummary[];\n failed: EnsureRoundFailure[];\n}\n\nexport function createEmptyEnsureRoundAggregate(): EnsureRoundAggregate {\n return { created: [], alreadyPresent: [], failed: [] };\n}\n\nexport function assertCompleteEnsureRoundChunkResult(\n requestedApplicationIds: ReadonlyArray<string>,\n result: EnsureRoundAggregate\n): void {\n assertExactResultKeys(\n requestedApplicationIds,\n [\n ...result.created.map((item) => item.applicationId),\n ...result.alreadyPresent.map((item) => item.applicationId),\n ...result.failed.map((item) => item.applicationId),\n ],\n 'The add-to-round request'\n );\n}\n\nexport function aggregateEnsureRoundResult(\n aggregate: EnsureRoundAggregate,\n result: EnsureRoundAggregate\n): EnsureRoundAggregate {\n return {\n created: [...aggregate.created, ...result.created],\n alreadyPresent: [...aggregate.alreadyPresent, ...result.alreadyPresent],\n failed: [...aggregate.failed, ...result.failed],\n };\n}\n\nexport interface BulkCustomEmailSuccess {\n applicationId: string;\n email: string;\n}\n\nexport interface BulkCustomEmailFailureItem {\n applicationId: string;\n message: string;\n}\n\nexport interface BulkCustomEmailAggregate {\n succeeded: BulkCustomEmailSuccess[];\n failed: BulkCustomEmailFailureItem[];\n}\n\nexport function createEmptyBulkCustomEmailAggregate(): BulkCustomEmailAggregate {\n return { succeeded: [], failed: [] };\n}\n\nexport function assertCompleteBulkCustomEmailChunkResult(\n requestedApplicationIds: ReadonlyArray<string>,\n result: BulkCustomEmailAggregate\n): void {\n assertExactResultKeys(\n requestedApplicationIds,\n [\n ...result.succeeded.map((item) => item.applicationId),\n ...result.failed.map((item) => item.applicationId),\n ],\n 'The bulk custom email request'\n );\n}\n\nexport function aggregateBulkCustomEmailResult(\n aggregate: BulkCustomEmailAggregate,\n result: BulkCustomEmailAggregate\n): BulkCustomEmailAggregate {\n return {\n succeeded: [...aggregate.succeeded, ...result.succeeded],\n failed: [...aggregate.failed, ...result.failed],\n };\n}\n\nexport interface BulkStatusUpdateSuccess {\n applicationId: string;\n status: string;\n}\n\nexport interface BulkStatusUpdateFailureItem {\n applicationId: string;\n message: string;\n}\n\nexport interface BulkStatusUpdateAggregate {\n succeeded: BulkStatusUpdateSuccess[];\n failed: BulkStatusUpdateFailureItem[];\n}\n\nexport function createEmptyBulkStatusUpdateAggregate(): BulkStatusUpdateAggregate {\n return { succeeded: [], failed: [] };\n}\n\nexport function assertCompleteBulkStatusUpdateChunkResult(\n requestedApplicationIds: ReadonlyArray<string>,\n result: BulkStatusUpdateAggregate\n): void {\n assertExactResultKeys(\n requestedApplicationIds,\n [\n ...result.succeeded.map((item) => item.applicationId),\n ...result.failed.map((item) => item.applicationId),\n ],\n 'The bulk status update request'\n );\n}\n\nexport function aggregateBulkStatusUpdateResult(\n aggregate: BulkStatusUpdateAggregate,\n result: BulkStatusUpdateAggregate\n): BulkStatusUpdateAggregate {\n return {\n succeeded: [...aggregate.succeeded, ...result.succeeded],\n failed: [...aggregate.failed, ...result.failed],\n };\n}\n\nexport function hasCandidateEmailType(round: CandidateRoundPreview, emailType: string): boolean {\n return round.emailLogs.some((log) => log.emailType === emailType);\n}\n\nexport interface DuplicateNoticeSuccess {\n email: string;\n}\n\nexport interface DuplicateNoticeSkip {\n email: string;\n reason: string;\n message: string;\n}\n\nexport interface DuplicateNoticeFailure {\n email: string;\n message: string;\n}\n\nexport interface DuplicateNoticeAggregate {\n succeeded: DuplicateNoticeSuccess[];\n skipped: DuplicateNoticeSkip[];\n failed: DuplicateNoticeFailure[];\n}\n\nexport function createEmptyDuplicateNoticeAggregate(): DuplicateNoticeAggregate {\n return { succeeded: [], skipped: [], failed: [] };\n}\n\nexport function aggregateDuplicateNoticeResult(\n aggregate: DuplicateNoticeAggregate,\n result: DuplicateNoticeAggregate\n): DuplicateNoticeAggregate {\n return {\n succeeded: [...aggregate.succeeded, ...result.succeeded],\n skipped: [...aggregate.skipped, ...result.skipped],\n failed: [...aggregate.failed, ...result.failed],\n };\n}\n"],"mappings":"AAgCA,IAAa,IAAb,cAAmD,MAAM;CA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