UNPKG

longcelot-sheet-db

Version:

Google Sheets-backed staging database adapter for Node.js with schema-first design

25 lines 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.computeSchemaHash = computeSchemaHash; const crypto_1 = require("crypto"); function computeSchemaHash(schema) { const normalized = { name: schema.name, actor: schema.actor, timestamps: schema.timestamps ?? false, softDelete: schema.softDelete ?? false, columns: Object.fromEntries(Object.entries(schema.columns) .filter(([k]) => !k.startsWith('_')) // exclude auto-fields (_id, _created_at…) .sort(([a], [b]) => a.localeCompare(b)) .map(([k, v]) => [k, { type: v.type, required: v.required ?? false, unique: v.unique ?? false, primary: v.primary ?? false, enum: v.enum ?? null, booleanFormat: v.booleanFormat ?? null, }])), }; return (0, crypto_1.createHash)('sha256').update(JSON.stringify(normalized)).digest('hex'); } //# sourceMappingURL=schemaHash.js.map