This commit is contained in:
2026-03-29 10:26:38 -05:00
parent 05d4f6e78b
commit b1c99893a6
1628 changed files with 67782 additions and 60143 deletions

View File

@@ -1,17 +1,17 @@
const sanitizeSeed = (value: string): string => {
return value
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '')
.slice(0, 36);
};
export const createIdempotencyKey = (scope: string, seed?: string): string => {
const base = sanitizeSeed(scope || 'action') || 'action';
const seedPart = seed ? sanitizeSeed(seed) : '';
const timestamp = Date.now().toString(36);
const random = Math.random().toString(36).slice(2, 10);
return seedPart
? `${base}-${seedPart}-${timestamp}-${random}`
: `${base}-${timestamp}-${random}`;
};
const sanitizeSeed = (value: string): string => {
return value
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '')
.slice(0, 36);
};
export const createIdempotencyKey = (scope: string, seed?: string): string => {
const base = sanitizeSeed(scope || 'action') || 'action';
const seedPart = seed ? sanitizeSeed(seed) : '';
const timestamp = Date.now().toString(36);
const random = Math.random().toString(36).slice(2, 10);
return seedPart
? `${base}-${seedPart}-${timestamp}-${random}`
: `${base}-${timestamp}-${random}`;
};