agenda/node_modules/ajv-formats/dist/index.js
Edward Betts ea4980a5d7 Fix European trip return heuristic for weekend location tracking
Adjust European short trip heuristic from >3 days to >1 day to correctly
detect when user has returned home from European trips. This fixes the
April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg"
instead of "Bristol" when the user was free (no events scheduled) after
the foss-north trip ended on April 27.

The previous logic required more than 3 days to pass before assuming
return home from European countries, but for short European trips by
rail/ferry, users typically return within 1-2 days.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-16 06:38:37 +02:00

37 lines
1.5 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const formats_1 = require("./formats");
const limit_1 = require("./limit");
const codegen_1 = require("ajv/dist/compile/codegen");
const fullName = new codegen_1.Name("fullFormats");
const fastName = new codegen_1.Name("fastFormats");
const formatsPlugin = (ajv, opts = { keywords: true }) => {
if (Array.isArray(opts)) {
addFormats(ajv, opts, formats_1.fullFormats, fullName);
return ajv;
}
const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
const list = opts.formats || formats_1.formatNames;
addFormats(ajv, list, formats, exportName);
if (opts.keywords)
limit_1.default(ajv);
return ajv;
};
formatsPlugin.get = (name, mode = "full") => {
const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats;
const f = formats[name];
if (!f)
throw new Error(`Unknown format "${name}"`);
return f;
};
function addFormats(ajv, list, fs, exportName) {
var _a;
var _b;
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : (_b.formats = codegen_1._ `require("ajv-formats/dist/formats").${exportName}`);
for (const f of list)
ajv.addFormat(f, fs[f]);
}
module.exports = exports = formatsPlugin;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = formatsPlugin;
//# sourceMappingURL=index.js.map