feat(pda): connect online picking workflow

This commit is contained in:
2026-08-11 11:31:05 +08:00
parent fc1944fb7e
commit be776c8efa
16 changed files with 440 additions and 82 deletions
+19
View File
@@ -0,0 +1,19 @@
function hash32(value, seed) {
let hash = seed >>> 0
for (let index = 0; index < value.length; index += 1) {
hash ^= value.charCodeAt(index)
hash = Math.imul(hash, 0x01000193) >>> 0
}
return hash.toString(16).padStart(8, '0')
}
export function shortStableHash(value) {
const input = String(value ?? '')
return `${hash32(input, 0x811c9dc5)}${hash32(input, 0x9e3779b9)}`
}
export function stableOperationId(scope, identity, payload) {
const safeScope = String(scope || 'operation').replace(/[^A-Za-z0-9_-]/g, '-').slice(0, 24)
const safeIdentity = String(identity || 'unknown').replace(/[^A-Za-z0-9_-]/g, '-').slice(0, 48)
return `${safeScope}-${safeIdentity}-${shortStableHash(JSON.stringify(payload ?? null))}`.slice(0, 120)
}