Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -3,17 +3,46 @@ import { getQueueNamesForGroup, isWorkerQueueGroup, queueNames, type QueueName }
|
||||
|
||||
export const defaultWorkerQueueNames = [queueNames.email, queueNames.notifications] as const satisfies readonly QueueName[];
|
||||
|
||||
export function getWorkerQueueNames(
|
||||
env: EnvRecord & {
|
||||
EXPORT_RETENTION_QUEUE_ENABLED?: string;
|
||||
IMPORT_QUEUE_ENABLED?: string;
|
||||
IMPORT_QUEUE_RUNTIME_READY?: string;
|
||||
SCAN_QUEUE_ENABLED?: string;
|
||||
WORKER_QUEUE_GROUP?: string;
|
||||
} = process.env as EnvRecord
|
||||
): readonly QueueName[] {
|
||||
export type ImportQueueRuntimeMode = "not-import" | "idle" | "full" | "portal-gdpr-export" | "invalid";
|
||||
|
||||
type WorkerQueueSelectionEnv = EnvRecord & {
|
||||
EXPORT_RETENTION_QUEUE_ENABLED?: string;
|
||||
IMPORT_QUEUE_ENABLED?: string;
|
||||
IMPORT_QUEUE_RUNTIME_READY?: string;
|
||||
PORTAL_GDPR_EXPORT_QUEUE_ENABLED?: string;
|
||||
SCAN_QUEUE_ENABLED?: string;
|
||||
WORKER_QUEUE_GROUP?: string;
|
||||
};
|
||||
|
||||
export function resolveImportQueueRuntimeMode(env: WorkerQueueSelectionEnv): ImportQueueRuntimeMode {
|
||||
if (env.WORKER_QUEUE_GROUP !== "import") return "not-import";
|
||||
|
||||
const gateValues = [
|
||||
env.IMPORT_QUEUE_ENABLED,
|
||||
env.IMPORT_QUEUE_RUNTIME_READY,
|
||||
env.PORTAL_GDPR_EXPORT_QUEUE_ENABLED,
|
||||
];
|
||||
if (gateValues.some((value) => value !== undefined && value !== "true" && value !== "false")) {
|
||||
return "invalid";
|
||||
}
|
||||
|
||||
const importEnabled = env.IMPORT_QUEUE_ENABLED === "true";
|
||||
const importRuntimeReady = env.IMPORT_QUEUE_RUNTIME_READY === "true";
|
||||
const portalGdprExportEnabled = env.PORTAL_GDPR_EXPORT_QUEUE_ENABLED === "true";
|
||||
|
||||
if (importEnabled && importRuntimeReady && !portalGdprExportEnabled) return "full";
|
||||
if (!importEnabled && !importRuntimeReady && portalGdprExportEnabled) return "portal-gdpr-export";
|
||||
if (!importEnabled && !importRuntimeReady) return "idle";
|
||||
return "invalid";
|
||||
}
|
||||
|
||||
export function getWorkerQueueNames(env: WorkerQueueSelectionEnv = process.env as EnvRecord): readonly QueueName[] {
|
||||
if (typeof env.WORKER_QUEUE_GROUP === "string" && isWorkerQueueGroup(env.WORKER_QUEUE_GROUP)) {
|
||||
if (env.WORKER_QUEUE_GROUP === "import" && (env.IMPORT_QUEUE_ENABLED !== "true" || env.IMPORT_QUEUE_RUNTIME_READY !== "true")) {
|
||||
if (env.WORKER_QUEUE_GROUP === "import") {
|
||||
const mode = resolveImportQueueRuntimeMode(env);
|
||||
if (mode === "full") return getQueueNamesForGroup("import");
|
||||
if (mode === "portal-gdpr-export") return [queueNames.kwpImports, queueNames.exports];
|
||||
if (mode === "idle") return [queueNames.kwpImports];
|
||||
return [];
|
||||
}
|
||||
return getQueueNamesForGroup(env.WORKER_QUEUE_GROUP);
|
||||
|
||||
Reference in new issue
Block a user