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>
This commit is contained in:
parent
663dc479c2
commit
ea4980a5d7
6407 changed files with 1072847 additions and 18 deletions
51
node_modules/path-type/index.d.ts
generated
vendored
Normal file
51
node_modules/path-type/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
export type PathTypeFunction = (path: string) => Promise<boolean>;
|
||||
|
||||
/**
|
||||
Check whether the passed `path` is a file.
|
||||
|
||||
@param path - The path to check.
|
||||
@returns Whether the `path` is a file.
|
||||
*/
|
||||
export const isFile: PathTypeFunction;
|
||||
|
||||
/**
|
||||
Check whether the passed `path` is a directory.
|
||||
|
||||
@param path - The path to check.
|
||||
@returns Whether the `path` is a directory.
|
||||
*/
|
||||
export const isDirectory: PathTypeFunction;
|
||||
|
||||
/**
|
||||
Check whether the passed `path` is a symlink.
|
||||
|
||||
@param path - The path to check.
|
||||
@returns Whether the `path` is a symlink.
|
||||
*/
|
||||
export const isSymlink: PathTypeFunction;
|
||||
|
||||
export type PathTypeSyncFunction = (path: string) => boolean;
|
||||
|
||||
/**
|
||||
Synchronously check whether the passed `path` is a file.
|
||||
|
||||
@param path - The path to check.
|
||||
@returns Whether the `path` is a file.
|
||||
*/
|
||||
export const isFileSync: PathTypeSyncFunction;
|
||||
|
||||
/**
|
||||
Synchronously check whether the passed `path` is a directory.
|
||||
|
||||
@param path - The path to check.
|
||||
@returns Whether the `path` is a directory.
|
||||
*/
|
||||
export const isDirectorySync: PathTypeSyncFunction;
|
||||
|
||||
/**
|
||||
Synchronously check whether the passed `path` is a symlink.
|
||||
|
||||
@param path - The path to check.
|
||||
@returns Whether the `path` is a directory.
|
||||
*/
|
||||
export const isSymlinkSync: PathTypeSyncFunction;
|
||||
41
node_modules/path-type/index.js
generated
vendored
Normal file
41
node_modules/path-type/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import fs, {promises as fsPromises} from 'fs';
|
||||
|
||||
async function isType(fsStatType, statsMethodName, filePath) {
|
||||
if (typeof filePath !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
||||
}
|
||||
|
||||
try {
|
||||
const stats = await fsPromises[fsStatType](filePath);
|
||||
return stats[statsMethodName]();
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function isTypeSync(fsStatType, statsMethodName, filePath) {
|
||||
if (typeof filePath !== 'string') {
|
||||
throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
||||
}
|
||||
|
||||
try {
|
||||
return fs[fsStatType](filePath)[statsMethodName]();
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export const isFile = isType.bind(null, 'stat', 'isFile');
|
||||
export const isDirectory = isType.bind(null, 'stat', 'isDirectory');
|
||||
export const isSymlink = isType.bind(null, 'lstat', 'isSymbolicLink');
|
||||
export const isFileSync = isTypeSync.bind(null, 'statSync', 'isFile');
|
||||
export const isDirectorySync = isTypeSync.bind(null, 'statSync', 'isDirectory');
|
||||
export const isSymlinkSync = isTypeSync.bind(null, 'lstatSync', 'isSymbolicLink');
|
||||
9
node_modules/path-type/license
generated
vendored
Normal file
9
node_modules/path-type/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
47
node_modules/path-type/package.json
generated
vendored
Normal file
47
node_modules/path-type/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "path-type",
|
||||
"version": "5.0.0",
|
||||
"description": "Check if a path is a file, directory, or symlink",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/path-type",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"path",
|
||||
"fs",
|
||||
"type",
|
||||
"is",
|
||||
"check",
|
||||
"directory",
|
||||
"file",
|
||||
"filepath",
|
||||
"symlink",
|
||||
"symbolic",
|
||||
"link",
|
||||
"stat",
|
||||
"stats",
|
||||
"filesystem"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"nyc": "^15.1.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.37.1"
|
||||
}
|
||||
}
|
||||
74
node_modules/path-type/readme.md
generated
vendored
Normal file
74
node_modules/path-type/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# path-type
|
||||
|
||||
> Check if a path is a file, directory, or symlink
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install path-type
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import {isFile} from 'path-type';
|
||||
|
||||
console.log(await isFile('package.json'));
|
||||
//=> true
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### isFile(path)
|
||||
|
||||
Check whether the passed `path` is a file.
|
||||
|
||||
Returns a `Promise<boolean>`.
|
||||
|
||||
#### path
|
||||
|
||||
Type: `string`
|
||||
|
||||
The path to check.
|
||||
|
||||
### isDirectory(path)
|
||||
|
||||
Check whether the passed `path` is a directory.
|
||||
|
||||
Returns a `Promise<boolean>`.
|
||||
|
||||
### isSymlink(path)
|
||||
|
||||
Check whether the passed `path` is a symlink.
|
||||
|
||||
Returns a `Promise<boolean>`.
|
||||
|
||||
### isFileSync(path)
|
||||
|
||||
Synchronously check whether the passed `path` is a file.
|
||||
|
||||
Returns a `boolean`.
|
||||
|
||||
### isDirectorySync(path)
|
||||
|
||||
Synchronously check whether the passed `path` is a directory.
|
||||
|
||||
Returns a `boolean`.
|
||||
|
||||
### isSymlinkSync(path)
|
||||
|
||||
Synchronously check whether the passed `path` is a symlink.
|
||||
|
||||
Returns a `boolean`.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-path-type?utm_source=npm-path-type&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue