Browse Source

fix: init

master
高志龙 1 year ago
parent
commit
b8c6fa8e63
  1. 21
      node_modules/.bin/vite
  2. 41
      node_modules/.bin/vite.ps1
  3. 25
      node_modules/.pnpm-workspace-state.json
  4. 21
      node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/LICENSE
  5. 607
      node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/dist/alova-shared.common.cjs
  6. 529
      node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/dist/alova-shared.esm.js
  7. 32
      node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/package.json
  8. 387
      node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/typings/alova-shared.d.ts
  9. 3
      node_modules/.pnpm/@esbuild+win32-x64@0.21.5/node_modules/@esbuild/win32-x64/README.md
  10. 20
      node_modules/.pnpm/@esbuild+win32-x64@0.21.5/node_modules/@esbuild/win32-x64/package.json
  11. 3
      node_modules/.pnpm/@rollup+rollup-win32-x64-msvc@4.40.2/node_modules/@rollup/rollup-win32-x64-msvc/README.md
  12. 19
      node_modules/.pnpm/@rollup+rollup-win32-x64-msvc@4.40.2/node_modules/@rollup/rollup-win32-x64-msvc/package.json
  13. BIN
      node_modules/.pnpm/@rollup+rollup-win32-x64-msvc@4.40.2/node_modules/@rollup/rollup-win32-x64-msvc/rollup.win32-x64-msvc.node
  14. 21
      node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/LICENSE
  15. 15
      node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/README.md
  16. 167
      node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/flow.d.ts
  17. 694
      node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/index.d.ts
  18. 27
      node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/package.json
  19. 32
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/application.js
  20. 20
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/browser.js
  21. 144
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/callable.js
  22. 194
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/calls.js
  23. 792
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/cancellable.js
  24. 30
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/clipboard.js
  25. 80
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/contextmenu.js
  26. 94
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/create.js
  27. 134
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/dialogs.js
  28. 222
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/drag.js
  29. 229
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/event_types.js
  30. 101
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/events.js
  31. 23
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/flags.js
  32. 38
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/index.js
  33. 44
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/listener.js
  34. 38
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/nanoid.js
  35. 63
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/runtime.js
  36. 38
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/screens.js
  37. 116
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/system.js
  38. 95
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/utils.js
  39. 438
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/window.js
  40. 179
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/wml.js
  41. 62
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/package.json
  42. 12
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/application.d.ts
  43. 6
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/browser.d.ts
  44. 3
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/callable.d.ts
  45. 63
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/calls.d.ts
  46. 434
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/cancellable.d.ts
  47. 13
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/clipboard.d.ts
  48. 1
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/contextmenu.d.ts
  49. 31
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/create.d.ts
  50. 140
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/dialogs.d.ts
  51. 1
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/drag.d.ts
  52. 218
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/event_types.d.ts
  53. 66
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/events.d.ts
  54. 7
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/flags.d.ts
  55. 16
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/index.d.ts
  56. 9
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/listener.d.ts
  57. 1
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/nanoid.d.ts
  58. 22
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/runtime.d.ts
  59. 60
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/screens.d.ts
  60. 83
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/system.d.ts
  61. 21
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/utils.d.ts
  62. 292
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/window.d.ts
  63. 8
      node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/wml.d.ts
  64. 21
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/LICENSE
  65. 77
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/README.md
  66. 75
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/README.zh-CN.md
  67. 92
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/adapter/fetch.common.cjs
  68. 90
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/adapter/fetch.esm.js
  69. 150
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/adapter/fetch.umd.js
  70. 1
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/adapter/fetch.umd.min.js
  71. 930
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/alova.common.cjs
  72. 921
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/alova.esm.js
  73. 1207
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/alova.umd.js
  74. 1
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/alova.umd.min.js
  75. 3463
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/clienthook/index.common.cjs
  76. 3430
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/clienthook/index.esm.js
  77. 3897
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/clienthook/index.umd.js
  78. 1
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/clienthook/index.umd.min.js
  79. 865
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/serverhook/index.common.cjs
  80. 861
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/serverhook/index.esm.js
  81. 86
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/react.common.cjs
  82. 84
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/react.esm.js
  83. 117
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/react.umd.js
  84. 1
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/react.umd.min.js
  85. 48
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/solid.common.cjs
  86. 46
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/solid.esm.js
  87. 51
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/solid.umd.js
  88. 1
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/solid.umd.min.js
  89. 63
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/svelte.common.cjs
  90. 61
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/svelte.esm.js
  91. 47
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue-demi.common.cjs
  92. 45
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue-demi.esm.js
  93. 66
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue-demi.umd.js
  94. 1
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue-demi.umd.min.js
  95. 52
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue.common.cjs
  96. 50
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue.esm.js
  97. 72
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue.umd.js
  98. 1
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue.umd.min.js
  99. 153
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/package.json
  100. 5
      node_modules/.pnpm/alova@3.2.10/node_modules/alova/typings/additional.d.ts

21
node_modules/.bin/vite

@ -1,21 +0,0 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=`cygpath -w "$basedir"`
fi
;;
esac
if [ -z "$NODE_PATH" ]; then
export NODE_PATH="/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules/vite/bin/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules/vite/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/node_modules"
else
export NODE_PATH="/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules/vite/bin/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules/vite/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/node_modules:$NODE_PATH"
fi
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@"
else
exec node "$basedir/../vite/bin/vite.js" "$@"
fi

41
node_modules/.bin/vite.ps1

@ -1,41 +0,0 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
$pathsep=":"
$env_node_path=$env:NODE_PATH
$new_node_path="F:\htmlWork\项目\德基demo\deji_demo\node_modules\.pnpm\vite@5.4.19\node_modules\vite\bin\node_modules;F:\htmlWork\项目\德基demo\deji_demo\node_modules\.pnpm\vite@5.4.19\node_modules\vite\node_modules;F:\htmlWork\项目\德基demo\deji_demo\node_modules\.pnpm\vite@5.4.19\node_modules;F:\htmlWork\项目\德基demo\deji_demo\node_modules\.pnpm\node_modules"
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
$pathsep=";"
} else {
$new_node_path="/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules/vite/bin/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules/vite/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/vite@5.4.19/node_modules:/mnt/f/htmlWork/项目/德基demo/deji_demo/node_modules/.pnpm/node_modules"
}
if ([string]::IsNullOrEmpty($env_node_path)) {
$env:NODE_PATH=$new_node_path
} else {
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
} else {
& "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args
}
$ret=$LASTEXITCODE
} else {
# Support pipeline input
if ($MyInvocation.ExpectingInput) {
$input | & "node$exe" "$basedir/../vite/bin/vite.js" $args
} else {
& "node$exe" "$basedir/../vite/bin/vite.js" $args
}
$ret=$LASTEXITCODE
}
$env:NODE_PATH=$env_node_path
exit $ret

25
node_modules/.pnpm-workspace-state.json

@ -1,25 +0,0 @@
{
"lastValidatedTimestamp": 1747389434647,
"projects": {},
"pnpmfileExists": false,
"settings": {
"autoInstallPeers": true,
"dedupeDirectDeps": false,
"dedupeInjectedDeps": true,
"dedupePeerDependents": true,
"dev": true,
"excludeLinksFromLockfile": false,
"hoistPattern": [
"*"
],
"hoistWorkspacePackages": true,
"injectWorkspacePackages": false,
"linkWorkspacePackages": false,
"nodeLinker": "isolated",
"optional": true,
"preferWorkspacePackages": false,
"production": true,
"publicHoistPattern": []
},
"filteredInstall": false
}

21
node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/LICENSE

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 JOU Amjs
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.

607
node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/dist/alova-shared.common.cjs

@ -1,607 +0,0 @@
/**
* @alova/shared 1.1.2 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2024 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
const undefStr = 'undefined';
// The following unified processing functions or variables added to reduce the amount of compiled code
const PromiseCls = Promise;
const promiseResolve = (value) => PromiseCls.resolve(value);
const promiseReject = (value) => PromiseCls.reject(value);
const ObjectCls = Object;
const RegExpCls = RegExp;
const undefinedValue = undefined;
const nullValue = null;
const trueValue = true;
const falseValue = false;
const promiseThen = (promise, onFulfilled, onrejected) => promise.then(onFulfilled, onrejected);
const promiseCatch = (promise, onrejected) => promise.catch(onrejected);
const promiseFinally = (promise, onfinally) => promise.finally(onfinally);
const JSONStringify = (value, replacer, space) => JSON.stringify(value, replacer, space);
const JSONParse = (value) => JSON.parse(value);
const setTimeoutFn = (fn, delay = 0) => setTimeout(fn, delay);
const clearTimeoutTimer = (timer) => clearTimeout(timer);
const objectKeys = (obj) => ObjectCls.keys(obj);
const objectValues = (obj) => ObjectCls.values(obj);
const forEach = (ary, fn) => ary.forEach(fn);
const pushItem = (ary, ...item) => ary.push(...item);
const mapItem = (ary, callbackfn) => ary.map(callbackfn);
const filterItem = (ary, predicate) => ary.filter(predicate);
const shift = (ary) => ary.shift();
const slice = (ary, start, end) => ary.slice(start, end);
const splice = (ary, start, deleteCount = 0, ...items) => ary.splice(start, deleteCount, ...items);
const len = (data) => data.length;
const isArray = (arg) => Array.isArray(arg);
const deleteAttr = (arg, attr) => delete arg[attr];
const typeOf = (arg) => typeof arg;
const regexpTest = (reg, str) => reg.test(`${str}`);
const includes = (ary, target) => ary.includes(target);
const valueObject = (value, writable = falseValue) => ({ value, writable });
const defineProperty = (o, key, value, isDescriptor = falseValue) => ObjectCls.defineProperty(o, key, isDescriptor ? value : valueObject(value, falseValue));
// Whether it is running on the server side, node and bun are judged by process, and deno is judged by Deno.
// Some frameworks (such as Alipay and uniapp) will inject the process object as a global variable.
// Therefore, the process.cwd function unique to the server is used as the basis for judgment.
const isSSR = typeof window === undefStr &&
(typeof process !== undefStr ? typeof process.cwd === 'function' : typeof Deno !== undefStr);
/** cache mode */
// only cache in memory, it's default option
const MEMORY = 'memory';
// persistent cache, and will be read to memory when page is refreshed, it means that the memory cache always exist until cache is expired.
const STORAGE_RESTORE = 'restore';
/**
* Empty function for compatibility processing
*/
const noop = () => { };
/**
* A function that returns the parameter itself, used for compatibility processing
* Since some systems use self as a reserved word, $self is used to distinguish it.
* @param arg any parameter
* @returns return parameter itself
*/
const $self = (arg) => arg;
/**
* Determine whether the parameter is a function any parameter
* @returns Whether the parameter is a function
*/
const isFn = (arg) => typeOf(arg) === 'function';
/**
* Determine whether the parameter is a number any parameter
* @returns Whether the parameter is a number
*/
const isNumber = (arg) => typeOf(arg) === 'number' && !Number.isNaN(arg);
/**
* Determine whether the parameter is a string any parameter
* @returns Whether the parameter is a string
*/
const isString = (arg) => typeOf(arg) === 'string';
/**
* Determine whether the parameter is an object any parameter
* @returns Whether the parameter is an object
*/
const isObject = (arg) => arg !== nullValue && typeOf(arg) === 'object';
/**
* Global toString any parameter stringified parameters
*/
const globalToString = (arg) => ObjectCls.prototype.toString.call(arg);
/**
* Determine whether it is a normal object any parameter
* @returns Judgment result
*/
const isPlainObject = (arg) => globalToString(arg) === '[object Object]';
/**
* Determine whether it is an instance of a certain class any parameter
* @returns Judgment result
*/
const instanceOf = (arg, cls) => arg instanceof cls;
/**
* Unified timestamp acquisition function
* @returns Timestamp
*/
const getTime = (date) => (date ? date.getTime() : Date.now());
/**
* Get the alova instance through the method instance alova example
*/
const getContext = (methodInstance) => methodInstance.context;
/**
* Get method instance configuration data
* @returns Configuration object
*/
const getConfig = (methodInstance) => methodInstance.config;
/**
* Get alova configuration data alova configuration object
*/
const getContextOptions = (alovaInstance) => alovaInstance.options;
/**
* Get alova configuration data through method instance alova configuration object
*/
const getOptions = (methodInstance) => getContextOptions(getContext(methodInstance));
/**
* Get the key value of the request method
* @returns The key value of this request method
*/
const key = (methodInstance) => {
const { params, headers } = getConfig(methodInstance);
return JSONStringify([methodInstance.type, methodInstance.url, params, methodInstance.data, headers]);
};
/**
* Create uuid simple version uuid
*/
const uuid = () => {
const timestamp = new Date().getTime();
return Math.floor(Math.random() * timestamp).toString(36);
};
/**
* Get the key value of the method instance method instance
* @returns The key value of this method instance
*/
const getMethodInternalKey = (methodInstance) => methodInstance.key;
/**
* Get the request method object
* @param methodHandler Request method handle
* @param args Method call parameters request method object
*/
const getHandlerMethod = (methodHandler, assert, args = []) => {
const methodInstance = isFn(methodHandler) ? methodHandler(...args) : methodHandler;
assert(!!methodInstance.key, 'hook handler must be a method instance or a function that returns method instance');
return methodInstance;
};
/**
* Is it special data
* @param data Submit data
* @returns Judgment result
*/
const isSpecialRequestBody = (data) => {
const dataTypeString = globalToString(data);
return (/^\[object (Blob|FormData|ReadableStream|URLSearchParams)\]$/i.test(dataTypeString) || instanceOf(data, ArrayBuffer));
};
const objAssign = (target, ...sources) => ObjectCls.assign(target, ...sources);
/**
* Excludes specified attributes from a data collection and returns a new data collection data collection
* @param keys Excluded keys new data collection
*/
const omit = (obj, ...keys) => {
const result = {};
for (const key in obj) {
if (!keys.includes(key)) {
result[key] = obj[key];
}
}
return result;
};
/**
* the same as `Promise.withResolvers`
* @returns promise with resolvers.
*/
function usePromise() {
let retResolve;
let retReject;
const promise = new Promise((resolve, reject) => {
retResolve = resolve;
retReject = reject;
});
return { promise, resolve: retResolve, reject: retReject };
}
/**
* Get cached configuration parameters, fixedly returning an object in the format { e: function, c: any, f: any, m: number, s: boolean, t: string } e is the abbreviation of expire, which returns the cache expiration time point (timestamp) in milliseconds.
* c is controlled, indicating whether it is a controlled cache
* f is the original value of cacheFor, which is used to call to obtain cached data when c is true.
* m is the abbreviation of mode, storage mode
* s is the abbreviation of storage, whether to store it locally
* t is the abbreviation of tag, which stores tags persistently.
* @param methodInstance method instance
* @returns Unified cache parameter object
*/
const getLocalCacheConfigParam = (methodInstance) => {
const { cacheFor } = getConfig(methodInstance);
const getCacheExpireTs = (cacheExpire) => isNumber(cacheExpire) ? getTime() + cacheExpire : getTime(cacheExpire || undefinedValue);
let cacheMode = MEMORY;
let expire = () => 0;
let store = falseValue;
let tag = undefinedValue;
const controlled = isFn(cacheFor);
if (!controlled) {
let expireColumn = cacheFor;
if (isPlainObject(cacheFor)) {
const { mode = MEMORY, expire, tag: configTag } = cacheFor || {};
cacheMode = mode;
store = mode === STORAGE_RESTORE;
tag = configTag ? configTag.toString() : undefinedValue;
expireColumn = expire;
}
expire = (mode) => getCacheExpireTs(isFn(expireColumn) ? expireColumn({ method: methodInstance, mode }) : expireColumn);
}
return {
f: cacheFor,
c: controlled,
e: expire,
m: cacheMode,
s: store,
t: tag
};
};
/**
* Create class instance
* @param Cls Constructor
* @param args Constructor parameters class instance
*/
const newInstance = (Cls, ...args) => new Cls(...args);
/**
* Unified configuration
* @param data
* @returns unified configuration
*/
const sloughConfig = (config, args = []) => isFn(config) ? config(...args) : config;
const sloughFunction = (arg, defaultFn) => isFn(arg) ? arg : ![falseValue, nullValue].includes(arg) ? defaultFn : noop;
/**
* Create an executor that calls multiple times synchronously and only executes it once asynchronously
*/
const createSyncOnceRunner = (delay = 0) => {
let timer = undefinedValue;
// Executing multiple calls to this function will execute once asynchronously
return (fn) => {
if (timer) {
clearTimeout(timer);
}
timer = setTimeoutFn(fn, delay);
};
};
/**
* Create an asynchronous function queue, the asynchronous function will be executed serially queue add function
*/
const createAsyncQueue = (catchError = falseValue) => {
const queue = [];
let completedHandler = undefinedValue;
let executing = false;
const executeQueue = async () => {
executing = true;
while (len(queue) > 0) {
const asyncFunc = shift(queue);
if (asyncFunc) {
await asyncFunc();
}
}
completedHandler && completedHandler();
executing = false;
};
const addQueue = (asyncFunc) => newInstance((PromiseCls), (resolve, reject) => {
const wrappedFunc = () => promiseThen(asyncFunc(), resolve, err => {
catchError ? resolve(undefinedValue) : reject(err);
});
pushItem(queue, wrappedFunc);
if (!executing) {
executeQueue();
}
});
const onComplete = (fn) => {
completedHandler = fn;
};
return {
addQueue,
onComplete
};
};
/**
* Traverse the target object deeply target audience
* @param callback Traversal callback
* @param preorder Whether to traverse in preorder, the default is true
* @param key The currently traversed key
* @param parent The parent node currently traversed
*/
const walkObject = (target, callback, preorder = trueValue, key, parent) => {
const callCallback = () => {
if (parent && key) {
target = callback(target, key, parent);
if (target !== parent[key]) {
parent[key] = target;
}
}
};
// Preorder traversal
preorder && callCallback();
if (isObject(target)) {
for (const i in target) {
if (!instanceOf(target, String)) {
walkObject(target[i], callback, preorder, i, target);
}
}
}
// Postal order traversal
!preorder && callCallback();
return target;
};
const cacheKeyPrefix = '$a.';
/**
* build common cache key.
*/
const buildNamespacedCacheKey = (namespace, key) => cacheKeyPrefix + namespace + key;
/**
* Calculate retry delay time based on avoidance strategy and number of retries avoid parameters
* @param retryTimes Number of retries
* @returns Retry delay time
*/
const delayWithBackoff = (backoff, retryTimes) => {
let { startQuiver, endQuiver } = backoff;
const { delay, multiplier = 1 } = backoff;
let retryDelayFinally = (delay || 0) * multiplier ** (retryTimes - 1);
// If start quiver or end quiver has a value, you need to increase the random jitter value in the specified range
if (startQuiver || endQuiver) {
startQuiver = startQuiver || 0;
endQuiver = endQuiver || 1;
retryDelayFinally +=
retryDelayFinally * startQuiver + Math.random() * retryDelayFinally * (endQuiver - startQuiver);
retryDelayFinally = Math.floor(retryDelayFinally); // round delay
}
return retryDelayFinally;
};
/**
* Build the complete url baseURL path url parameters complete url
*/
const buildCompletedURL = (baseURL, url, params) => {
// If the Base url ends with /, remove /
baseURL = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL;
// If it does not start with /or http protocol, you need to add /
// Compatible with some RESTful usage fix: https://github.com/alovajs/alova/issues/382
if (url !== '') {
url = url.match(/^(\/|https?:\/\/)/) ? url : `/${url}`;
}
const completeURL = baseURL + url;
// Convert params object to get string
// Filter out those whose value is undefined
const paramsStr = mapItem(filterItem(objectKeys(params), key => params[key] !== undefinedValue), key => `${key}=${params[key]}`).join('&');
// Splice the get parameters behind the url. Note that the url may already have parameters.
return paramsStr
? +completeURL.includes('?')
? `${completeURL}&${paramsStr}`
: `${completeURL}?${paramsStr}`
: completeURL;
};
/**
* Deep clone an object.
*
* @param obj The object to be cloned.
* @returns The cloned object.
*/
const deepClone = (obj) => {
if (isArray(obj)) {
return mapItem(obj, deepClone);
}
if (isPlainObject(obj) && obj.constructor === ObjectCls) {
const clone = {};
forEach(objectKeys(obj), key => {
clone[key] = deepClone(obj[key]);
});
return clone;
}
return obj;
};
/**
* alova error class
*/
class AlovaError extends Error {
constructor(prefix, message, errorCode) {
super(message + (errorCode ? `\n\nFor detailed: https://alova.js.org/error#${errorCode}` : ''));
this.name = `[alova${prefix ? `/${prefix}` : ''}]`;
}
}
/**
* Custom assertion function that throws an error when the expression is false
* When errorCode is passed in, a link to the error document will be provided to guide the user to correct it.
* @param expression Judgment expression, true or false
* @param message Assert message
*/
const createAssert = (prefix = '') => (expression, message, errorCode) => {
if (!expression) {
throw newInstance(AlovaError, prefix, message, errorCode);
}
};
const createEventManager = () => {
const eventMap = {};
return {
eventMap,
on(type, handler) {
const eventTypeItem = (eventMap[type] = eventMap[type] || []);
pushItem(eventTypeItem, handler);
// return the off function
return () => {
eventMap[type] = filterItem(eventTypeItem, item => item !== handler);
};
},
off(type, handler) {
const handlers = eventMap[type];
if (!handlers) {
return;
}
if (handler) {
const index = handlers.indexOf(handler);
index > -1 && handlers.splice(index, 1);
}
else {
delete eventMap[type];
}
},
emit(type, event) {
const handlers = eventMap[type] || [];
return mapItem(handlers, handler => handler(event));
}
};
};
const decorateEvent = (onEvent, decoratedHandler) => {
const emitter = createEventManager();
const eventType = uuid();
const eventReturn = onEvent(event => emitter.emit(eventType, event));
return (handler) => {
emitter.on(eventType, event => {
decoratedHandler(handler, event);
});
return eventReturn;
};
};
class FrameworkReadableState {
constructor(state, key, dehydrate, exportState) {
this.s = state;
this.k = key;
this.$dhy = dehydrate;
this.$exp = exportState;
}
get v() {
return this.$dhy(this.s);
}
get e() {
return this.$exp(this.s);
}
}
class FrameworkState extends FrameworkReadableState {
constructor(state, key, dehydrate, exportState, update) {
super(state, key, dehydrate, exportState);
this.$upd = update;
}
set v(newValue) {
this.$upd(this.s, newValue);
}
get v() {
return super.v;
}
}
class QueueCallback {
/**
* @param [limit=null] no limit if set undefined or null
* @param [initialProcessing=false]
*/
constructor(limit, initialProcessing = false) {
this.limit = limit;
this.callbackQueue = [];
this.isProcessing = false;
this.interrupt = false;
this.isProcessing = initialProcessing;
}
/**
* Adds a callback function to the callback queue.
* If a limit is set and the queue has reached its limit, the callback will not be added.
* @param callback The callback function to be added to the queue.
*/
queueCallback(callback) {
if (this.limit && this.callbackQueue.length >= this.limit) {
return;
}
this.callbackQueue.push(callback);
if (!this.isProcessing) {
this.tryRunQueueCallback();
}
}
/**
* Tries to run the callbacks in the queue.
* If there are callbacks in the queue, it removes the first callback and executes it.
* This method is called recursively until there are no more callbacks in the queue.
*/
async tryRunQueueCallback() {
this.isProcessing = true;
this.interrupt = false;
while (this.callbackQueue.length > 0 && !this.interrupt) {
const cb = this.callbackQueue.shift();
await (cb === null || cb === void 0 ? void 0 : cb());
}
this.isProcessing = false;
}
/**
* If set the param `state` to true, it will interrupt the current job (whether or not the current processing state is true)
* If set the param `state` to false, then get on with the rest of the work
*/
setProcessingState(state) {
this.isProcessing = state;
if (!state) {
this.tryRunQueueCallback();
}
else {
this.interrupt = true;
}
}
}
const type = {};
exports.$self = $self;
exports.AlovaError = AlovaError;
exports.FrameworkReadableState = FrameworkReadableState;
exports.FrameworkState = FrameworkState;
exports.JSONParse = JSONParse;
exports.JSONStringify = JSONStringify;
exports.MEMORY = MEMORY;
exports.ObjectCls = ObjectCls;
exports.PromiseCls = PromiseCls;
exports.QueueCallback = QueueCallback;
exports.RegExpCls = RegExpCls;
exports.STORAGE_RESTORE = STORAGE_RESTORE;
exports.buildCompletedURL = buildCompletedURL;
exports.buildNamespacedCacheKey = buildNamespacedCacheKey;
exports.clearTimeoutTimer = clearTimeoutTimer;
exports.createAssert = createAssert;
exports.createAsyncQueue = createAsyncQueue;
exports.createEventManager = createEventManager;
exports.createSyncOnceRunner = createSyncOnceRunner;
exports.decorateEvent = decorateEvent;
exports.deepClone = deepClone;
exports.defineProperty = defineProperty;
exports.delayWithBackoff = delayWithBackoff;
exports.deleteAttr = deleteAttr;
exports.falseValue = falseValue;
exports.filterItem = filterItem;
exports.forEach = forEach;
exports.getConfig = getConfig;
exports.getContext = getContext;
exports.getContextOptions = getContextOptions;
exports.getHandlerMethod = getHandlerMethod;
exports.getLocalCacheConfigParam = getLocalCacheConfigParam;
exports.getMethodInternalKey = getMethodInternalKey;
exports.getOptions = getOptions;
exports.getTime = getTime;
exports.globalToString = globalToString;
exports.includes = includes;
exports.instanceOf = instanceOf;
exports.isArray = isArray;
exports.isFn = isFn;
exports.isNumber = isNumber;
exports.isObject = isObject;
exports.isPlainObject = isPlainObject;
exports.isSSR = isSSR;
exports.isSpecialRequestBody = isSpecialRequestBody;
exports.isString = isString;
exports.key = key;
exports.len = len;
exports.mapItem = mapItem;
exports.newInstance = newInstance;
exports.noop = noop;
exports.nullValue = nullValue;
exports.objAssign = objAssign;
exports.objectKeys = objectKeys;
exports.objectValues = objectValues;
exports.omit = omit;
exports.promiseCatch = promiseCatch;
exports.promiseFinally = promiseFinally;
exports.promiseReject = promiseReject;
exports.promiseResolve = promiseResolve;
exports.promiseThen = promiseThen;
exports.pushItem = pushItem;
exports.regexpTest = regexpTest;
exports.setTimeoutFn = setTimeoutFn;
exports.shift = shift;
exports.slice = slice;
exports.sloughConfig = sloughConfig;
exports.sloughFunction = sloughFunction;
exports.splice = splice;
exports.trueValue = trueValue;
exports.type = type;
exports.typeOf = typeOf;
exports.undefinedValue = undefinedValue;
exports.usePromise = usePromise;
exports.uuid = uuid;
exports.valueObject = valueObject;
exports.walkObject = walkObject;

529
node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/dist/alova-shared.esm.js

@ -1,529 +0,0 @@
/**
* @alova/shared 1.1.2 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2024 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
const undefStr = 'undefined';
// The following unified processing functions or variables added to reduce the amount of compiled code
const PromiseCls = Promise;
const promiseResolve = (value) => PromiseCls.resolve(value);
const promiseReject = (value) => PromiseCls.reject(value);
const ObjectCls = Object;
const RegExpCls = RegExp;
const undefinedValue = undefined;
const nullValue = null;
const trueValue = true;
const falseValue = false;
const promiseThen = (promise, onFulfilled, onrejected) => promise.then(onFulfilled, onrejected);
const promiseCatch = (promise, onrejected) => promise.catch(onrejected);
const promiseFinally = (promise, onfinally) => promise.finally(onfinally);
const JSONStringify = (value, replacer, space) => JSON.stringify(value, replacer, space);
const JSONParse = (value) => JSON.parse(value);
const setTimeoutFn = (fn, delay = 0) => setTimeout(fn, delay);
const clearTimeoutTimer = (timer) => clearTimeout(timer);
const objectKeys = (obj) => ObjectCls.keys(obj);
const objectValues = (obj) => ObjectCls.values(obj);
const forEach = (ary, fn) => ary.forEach(fn);
const pushItem = (ary, ...item) => ary.push(...item);
const mapItem = (ary, callbackfn) => ary.map(callbackfn);
const filterItem = (ary, predicate) => ary.filter(predicate);
const shift = (ary) => ary.shift();
const slice = (ary, start, end) => ary.slice(start, end);
const splice = (ary, start, deleteCount = 0, ...items) => ary.splice(start, deleteCount, ...items);
const len = (data) => data.length;
const isArray = (arg) => Array.isArray(arg);
const deleteAttr = (arg, attr) => delete arg[attr];
const typeOf = (arg) => typeof arg;
const regexpTest = (reg, str) => reg.test(`${str}`);
const includes = (ary, target) => ary.includes(target);
const valueObject = (value, writable = falseValue) => ({ value, writable });
const defineProperty = (o, key, value, isDescriptor = falseValue) => ObjectCls.defineProperty(o, key, isDescriptor ? value : valueObject(value, falseValue));
// Whether it is running on the server side, node and bun are judged by process, and deno is judged by Deno.
// Some frameworks (such as Alipay and uniapp) will inject the process object as a global variable.
// Therefore, the process.cwd function unique to the server is used as the basis for judgment.
const isSSR = typeof window === undefStr &&
(typeof process !== undefStr ? typeof process.cwd === 'function' : typeof Deno !== undefStr);
/** cache mode */
// only cache in memory, it's default option
const MEMORY = 'memory';
// persistent cache, and will be read to memory when page is refreshed, it means that the memory cache always exist until cache is expired.
const STORAGE_RESTORE = 'restore';
/**
* Empty function for compatibility processing
*/
const noop = () => { };
/**
* A function that returns the parameter itself, used for compatibility processing
* Since some systems use self as a reserved word, $self is used to distinguish it.
* @param arg any parameter
* @returns return parameter itself
*/
const $self = (arg) => arg;
/**
* Determine whether the parameter is a function any parameter
* @returns Whether the parameter is a function
*/
const isFn = (arg) => typeOf(arg) === 'function';
/**
* Determine whether the parameter is a number any parameter
* @returns Whether the parameter is a number
*/
const isNumber = (arg) => typeOf(arg) === 'number' && !Number.isNaN(arg);
/**
* Determine whether the parameter is a string any parameter
* @returns Whether the parameter is a string
*/
const isString = (arg) => typeOf(arg) === 'string';
/**
* Determine whether the parameter is an object any parameter
* @returns Whether the parameter is an object
*/
const isObject = (arg) => arg !== nullValue && typeOf(arg) === 'object';
/**
* Global toString any parameter stringified parameters
*/
const globalToString = (arg) => ObjectCls.prototype.toString.call(arg);
/**
* Determine whether it is a normal object any parameter
* @returns Judgment result
*/
const isPlainObject = (arg) => globalToString(arg) === '[object Object]';
/**
* Determine whether it is an instance of a certain class any parameter
* @returns Judgment result
*/
const instanceOf = (arg, cls) => arg instanceof cls;
/**
* Unified timestamp acquisition function
* @returns Timestamp
*/
const getTime = (date) => (date ? date.getTime() : Date.now());
/**
* Get the alova instance through the method instance alova example
*/
const getContext = (methodInstance) => methodInstance.context;
/**
* Get method instance configuration data
* @returns Configuration object
*/
const getConfig = (methodInstance) => methodInstance.config;
/**
* Get alova configuration data alova configuration object
*/
const getContextOptions = (alovaInstance) => alovaInstance.options;
/**
* Get alova configuration data through method instance alova configuration object
*/
const getOptions = (methodInstance) => getContextOptions(getContext(methodInstance));
/**
* Get the key value of the request method
* @returns The key value of this request method
*/
const key = (methodInstance) => {
const { params, headers } = getConfig(methodInstance);
return JSONStringify([methodInstance.type, methodInstance.url, params, methodInstance.data, headers]);
};
/**
* Create uuid simple version uuid
*/
const uuid = () => {
const timestamp = new Date().getTime();
return Math.floor(Math.random() * timestamp).toString(36);
};
/**
* Get the key value of the method instance method instance
* @returns The key value of this method instance
*/
const getMethodInternalKey = (methodInstance) => methodInstance.key;
/**
* Get the request method object
* @param methodHandler Request method handle
* @param args Method call parameters request method object
*/
const getHandlerMethod = (methodHandler, assert, args = []) => {
const methodInstance = isFn(methodHandler) ? methodHandler(...args) : methodHandler;
assert(!!methodInstance.key, 'hook handler must be a method instance or a function that returns method instance');
return methodInstance;
};
/**
* Is it special data
* @param data Submit data
* @returns Judgment result
*/
const isSpecialRequestBody = (data) => {
const dataTypeString = globalToString(data);
return (/^\[object (Blob|FormData|ReadableStream|URLSearchParams)\]$/i.test(dataTypeString) || instanceOf(data, ArrayBuffer));
};
const objAssign = (target, ...sources) => ObjectCls.assign(target, ...sources);
/**
* Excludes specified attributes from a data collection and returns a new data collection data collection
* @param keys Excluded keys new data collection
*/
const omit = (obj, ...keys) => {
const result = {};
for (const key in obj) {
if (!keys.includes(key)) {
result[key] = obj[key];
}
}
return result;
};
/**
* the same as `Promise.withResolvers`
* @returns promise with resolvers.
*/
function usePromise() {
let retResolve;
let retReject;
const promise = new Promise((resolve, reject) => {
retResolve = resolve;
retReject = reject;
});
return { promise, resolve: retResolve, reject: retReject };
}
/**
* Get cached configuration parameters, fixedly returning an object in the format { e: function, c: any, f: any, m: number, s: boolean, t: string } e is the abbreviation of expire, which returns the cache expiration time point (timestamp) in milliseconds.
* c is controlled, indicating whether it is a controlled cache
* f is the original value of cacheFor, which is used to call to obtain cached data when c is true.
* m is the abbreviation of mode, storage mode
* s is the abbreviation of storage, whether to store it locally
* t is the abbreviation of tag, which stores tags persistently.
* @param methodInstance method instance
* @returns Unified cache parameter object
*/
const getLocalCacheConfigParam = (methodInstance) => {
const { cacheFor } = getConfig(methodInstance);
const getCacheExpireTs = (cacheExpire) => isNumber(cacheExpire) ? getTime() + cacheExpire : getTime(cacheExpire || undefinedValue);
let cacheMode = MEMORY;
let expire = () => 0;
let store = falseValue;
let tag = undefinedValue;
const controlled = isFn(cacheFor);
if (!controlled) {
let expireColumn = cacheFor;
if (isPlainObject(cacheFor)) {
const { mode = MEMORY, expire, tag: configTag } = cacheFor || {};
cacheMode = mode;
store = mode === STORAGE_RESTORE;
tag = configTag ? configTag.toString() : undefinedValue;
expireColumn = expire;
}
expire = (mode) => getCacheExpireTs(isFn(expireColumn) ? expireColumn({ method: methodInstance, mode }) : expireColumn);
}
return {
f: cacheFor,
c: controlled,
e: expire,
m: cacheMode,
s: store,
t: tag
};
};
/**
* Create class instance
* @param Cls Constructor
* @param args Constructor parameters class instance
*/
const newInstance = (Cls, ...args) => new Cls(...args);
/**
* Unified configuration
* @param data
* @returns unified configuration
*/
const sloughConfig = (config, args = []) => isFn(config) ? config(...args) : config;
const sloughFunction = (arg, defaultFn) => isFn(arg) ? arg : ![falseValue, nullValue].includes(arg) ? defaultFn : noop;
/**
* Create an executor that calls multiple times synchronously and only executes it once asynchronously
*/
const createSyncOnceRunner = (delay = 0) => {
let timer = undefinedValue;
// Executing multiple calls to this function will execute once asynchronously
return (fn) => {
if (timer) {
clearTimeout(timer);
}
timer = setTimeoutFn(fn, delay);
};
};
/**
* Create an asynchronous function queue, the asynchronous function will be executed serially queue add function
*/
const createAsyncQueue = (catchError = falseValue) => {
const queue = [];
let completedHandler = undefinedValue;
let executing = false;
const executeQueue = async () => {
executing = true;
while (len(queue) > 0) {
const asyncFunc = shift(queue);
if (asyncFunc) {
await asyncFunc();
}
}
completedHandler && completedHandler();
executing = false;
};
const addQueue = (asyncFunc) => newInstance((PromiseCls), (resolve, reject) => {
const wrappedFunc = () => promiseThen(asyncFunc(), resolve, err => {
catchError ? resolve(undefinedValue) : reject(err);
});
pushItem(queue, wrappedFunc);
if (!executing) {
executeQueue();
}
});
const onComplete = (fn) => {
completedHandler = fn;
};
return {
addQueue,
onComplete
};
};
/**
* Traverse the target object deeply target audience
* @param callback Traversal callback
* @param preorder Whether to traverse in preorder, the default is true
* @param key The currently traversed key
* @param parent The parent node currently traversed
*/
const walkObject = (target, callback, preorder = trueValue, key, parent) => {
const callCallback = () => {
if (parent && key) {
target = callback(target, key, parent);
if (target !== parent[key]) {
parent[key] = target;
}
}
};
// Preorder traversal
preorder && callCallback();
if (isObject(target)) {
for (const i in target) {
if (!instanceOf(target, String)) {
walkObject(target[i], callback, preorder, i, target);
}
}
}
// Postal order traversal
!preorder && callCallback();
return target;
};
const cacheKeyPrefix = '$a.';
/**
* build common cache key.
*/
const buildNamespacedCacheKey = (namespace, key) => cacheKeyPrefix + namespace + key;
/**
* Calculate retry delay time based on avoidance strategy and number of retries avoid parameters
* @param retryTimes Number of retries
* @returns Retry delay time
*/
const delayWithBackoff = (backoff, retryTimes) => {
let { startQuiver, endQuiver } = backoff;
const { delay, multiplier = 1 } = backoff;
let retryDelayFinally = (delay || 0) * multiplier ** (retryTimes - 1);
// If start quiver or end quiver has a value, you need to increase the random jitter value in the specified range
if (startQuiver || endQuiver) {
startQuiver = startQuiver || 0;
endQuiver = endQuiver || 1;
retryDelayFinally +=
retryDelayFinally * startQuiver + Math.random() * retryDelayFinally * (endQuiver - startQuiver);
retryDelayFinally = Math.floor(retryDelayFinally); // round delay
}
return retryDelayFinally;
};
/**
* Build the complete url baseURL path url parameters complete url
*/
const buildCompletedURL = (baseURL, url, params) => {
// If the Base url ends with /, remove /
baseURL = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL;
// If it does not start with /or http protocol, you need to add /
// Compatible with some RESTful usage fix: https://github.com/alovajs/alova/issues/382
if (url !== '') {
url = url.match(/^(\/|https?:\/\/)/) ? url : `/${url}`;
}
const completeURL = baseURL + url;
// Convert params object to get string
// Filter out those whose value is undefined
const paramsStr = mapItem(filterItem(objectKeys(params), key => params[key] !== undefinedValue), key => `${key}=${params[key]}`).join('&');
// Splice the get parameters behind the url. Note that the url may already have parameters.
return paramsStr
? +completeURL.includes('?')
? `${completeURL}&${paramsStr}`
: `${completeURL}?${paramsStr}`
: completeURL;
};
/**
* Deep clone an object.
*
* @param obj The object to be cloned.
* @returns The cloned object.
*/
const deepClone = (obj) => {
if (isArray(obj)) {
return mapItem(obj, deepClone);
}
if (isPlainObject(obj) && obj.constructor === ObjectCls) {
const clone = {};
forEach(objectKeys(obj), key => {
clone[key] = deepClone(obj[key]);
});
return clone;
}
return obj;
};
/**
* alova error class
*/
class AlovaError extends Error {
constructor(prefix, message, errorCode) {
super(message + (errorCode ? `\n\nFor detailed: https://alova.js.org/error#${errorCode}` : ''));
this.name = `[alova${prefix ? `/${prefix}` : ''}]`;
}
}
/**
* Custom assertion function that throws an error when the expression is false
* When errorCode is passed in, a link to the error document will be provided to guide the user to correct it.
* @param expression Judgment expression, true or false
* @param message Assert message
*/
const createAssert = (prefix = '') => (expression, message, errorCode) => {
if (!expression) {
throw newInstance(AlovaError, prefix, message, errorCode);
}
};
const createEventManager = () => {
const eventMap = {};
return {
eventMap,
on(type, handler) {
const eventTypeItem = (eventMap[type] = eventMap[type] || []);
pushItem(eventTypeItem, handler);
// return the off function
return () => {
eventMap[type] = filterItem(eventTypeItem, item => item !== handler);
};
},
off(type, handler) {
const handlers = eventMap[type];
if (!handlers) {
return;
}
if (handler) {
const index = handlers.indexOf(handler);
index > -1 && handlers.splice(index, 1);
}
else {
delete eventMap[type];
}
},
emit(type, event) {
const handlers = eventMap[type] || [];
return mapItem(handlers, handler => handler(event));
}
};
};
const decorateEvent = (onEvent, decoratedHandler) => {
const emitter = createEventManager();
const eventType = uuid();
const eventReturn = onEvent(event => emitter.emit(eventType, event));
return (handler) => {
emitter.on(eventType, event => {
decoratedHandler(handler, event);
});
return eventReturn;
};
};
class FrameworkReadableState {
constructor(state, key, dehydrate, exportState) {
this.s = state;
this.k = key;
this.$dhy = dehydrate;
this.$exp = exportState;
}
get v() {
return this.$dhy(this.s);
}
get e() {
return this.$exp(this.s);
}
}
class FrameworkState extends FrameworkReadableState {
constructor(state, key, dehydrate, exportState, update) {
super(state, key, dehydrate, exportState);
this.$upd = update;
}
set v(newValue) {
this.$upd(this.s, newValue);
}
get v() {
return super.v;
}
}
class QueueCallback {
/**
* @param [limit=null] no limit if set undefined or null
* @param [initialProcessing=false]
*/
constructor(limit, initialProcessing = false) {
this.limit = limit;
this.callbackQueue = [];
this.isProcessing = false;
this.interrupt = false;
this.isProcessing = initialProcessing;
}
/**
* Adds a callback function to the callback queue.
* If a limit is set and the queue has reached its limit, the callback will not be added.
* @param callback The callback function to be added to the queue.
*/
queueCallback(callback) {
if (this.limit && this.callbackQueue.length >= this.limit) {
return;
}
this.callbackQueue.push(callback);
if (!this.isProcessing) {
this.tryRunQueueCallback();
}
}
/**
* Tries to run the callbacks in the queue.
* If there are callbacks in the queue, it removes the first callback and executes it.
* This method is called recursively until there are no more callbacks in the queue.
*/
async tryRunQueueCallback() {
this.isProcessing = true;
this.interrupt = false;
while (this.callbackQueue.length > 0 && !this.interrupt) {
const cb = this.callbackQueue.shift();
await (cb === null || cb === void 0 ? void 0 : cb());
}
this.isProcessing = false;
}
/**
* If set the param `state` to true, it will interrupt the current job (whether or not the current processing state is true)
* If set the param `state` to false, then get on with the rest of the work
*/
setProcessingState(state) {
this.isProcessing = state;
if (!state) {
this.tryRunQueueCallback();
}
else {
this.interrupt = true;
}
}
}
const type = {};
export { $self, AlovaError, FrameworkReadableState, FrameworkState, JSONParse, JSONStringify, MEMORY, ObjectCls, PromiseCls, QueueCallback, RegExpCls, STORAGE_RESTORE, buildCompletedURL, buildNamespacedCacheKey, clearTimeoutTimer, createAssert, createAsyncQueue, createEventManager, createSyncOnceRunner, decorateEvent, deepClone, defineProperty, delayWithBackoff, deleteAttr, falseValue, filterItem, forEach, getConfig, getContext, getContextOptions, getHandlerMethod, getLocalCacheConfigParam, getMethodInternalKey, getOptions, getTime, globalToString, includes, instanceOf, isArray, isFn, isNumber, isObject, isPlainObject, isSSR, isSpecialRequestBody, isString, key, len, mapItem, newInstance, noop, nullValue, objAssign, objectKeys, objectValues, omit, promiseCatch, promiseFinally, promiseReject, promiseResolve, promiseThen, pushItem, regexpTest, setTimeoutFn, shift, slice, sloughConfig, sloughFunction, splice, trueValue, type, typeOf, undefinedValue, usePromise, uuid, valueObject, walkObject };

32
node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/package.json

@ -1,32 +0,0 @@
{
"name": "@alova/shared",
"version": "1.1.2",
"type": "module",
"author": "Scott Hu",
"main": "dist/alova-shared.common.cjs",
"module": "dist/alova-shared.esm.js",
"types": "typings/alova-shared.d.ts",
"license": "MIT",
"homepage": "https://alova.js.org",
"repository": {
"type": "git",
"url": "https://github.com/alovajs/alova.git"
},
"bugs": {
"url": "https://github.com/alovajs/alova/issues"
},
"files": [
"dist",
"typings"
],
"devDependencies": {
"@alova/scripts": "1.1.1"
},
"scripts": {
"clean": "rimraf ./dist",
"test": "vitest run",
"lint": "eslint",
"lint:fix": "eslint --fix",
"build": "pnpm run clean && alova-scripts build"
}
}

387
node_modules/.pnpm/@alova+shared@1.1.2/node_modules/@alova/shared/typings/alova-shared.d.ts

@ -1,387 +0,0 @@
/**
* @alova/shared 1.1.2 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2024 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
/**
* alova error class
*/
declare class AlovaError extends Error {
constructor(prefix: string, message: string, errorCode?: number);
}
/**
* Custom assertion function that throws an error when the expression is false
* When errorCode is passed in, a link to the error document will be provided to guide the user to correct it.
* @param expression Judgment expression, true or false
* @param message Assert message
*/
declare const createAssert: (prefix?: string) => (expression: boolean, message: string, errorCode?: number) => void;
interface EventManager<E extends object> {
on<K extends keyof E>(type: K, handler: (event: E[K]) => void): () => void;
off<K extends keyof E>(type: K, handler?: (event: E[K]) => void): () => void;
/**
* @param type
* @param event
* @param sync Whether to synchronize emit events, if set to `true`, this will wait for all listeners to return results using Promise.all
*/
emit<K extends keyof E>(type: K, event: E[K]): any[];
eventMap: EventMap<E>;
}
type EventMap<E extends object> = {
[K in keyof E]?: ((event: E[K]) => void)[];
};
declare const createEventManager: <E extends object>() => EventManager<E>;
declare const decorateEvent: <OnEvent extends (handler: (event: any) => void) => any>(onEvent: OnEvent, decoratedHandler: (handler: Parameters<OnEvent>[0], event: Parameters<Parameters<OnEvent>[0]>[0]) => void) => (handler: Parameters<OnEvent>[0]) => any;
type GeneralFn = (...args: any[]) => any;
/**
* common UI framework state type
*/
interface GeneralState<T = unknown> {
[x: string]: T;
}
/**
* is any type
*/
type IsAny<T, P, N> = 0 extends 1 & T ? P : N;
/**
* is unknown type
*/
type IsUnknown<T, P, N> = IsAny<T, P, N> extends P ? N : unknown extends T ? P : N;
type IsAssignable<T, T2> = T2 extends T ? true : false;
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
type UsePromiseExposure<T> = {
promise: Promise<T>;
resolve: (value: T | PromiseLike<T>) => void;
reject: (reason?: any) => void;
};
interface BackoffPolicy {
/**
* Delay time for re-request, in milliseconds
* @default 1000
*/
delay?: number;
/**
* Specify the delay multiple. For example, if the multiplier is set to 1.5 and the delay is 2 seconds, the first retry will be 2 seconds, the second will be 3 seconds, and the third will be 4.5 seconds
* @default 1
*/
multiplier?: number;
/**
* The jitter starting percentage value of the delay request, ranging from 0-1
* When only startQuiver is set, endQuiver defaults to 1
* For example, if it is set to 0.5, it will add a random time of 50% to 100% to the current delay time
* If endQuiver has a value, the delay time will increase by a random value in the range of startQuiver and endQuiver
*/
startQuiver?: number;
/**
* The jitter ending percentage value of the delay request, ranging from 0-1
* When only endQuiver is set, startQuiver defaults to 0
* For example, if it is set to 0.5, it will add a random time from 0% to 50% to the current delay time
* If startQuiver has a value, the delay time will increase by a random value between startQuiver and endQuiver
*/
endQuiver?: number;
}
declare const type: {};
type UpdateFn<Data> = (state: GeneralState<Data>, newValue: Data) => void;
type DehydrateFn<Data> = (state: GeneralState<Data>) => Data;
type ExportFn<Data> = (state: GeneralState<Data>) => GeneralState<Data>;
declare class FrameworkReadableState<Data, Key extends string> {
s: GeneralState<Data>;
k: Key;
protected $dhy: DehydrateFn<Data>;
protected $exp: ExportFn<Data>;
constructor(state: GeneralState<Data>, key: Key, dehydrate: DehydrateFn<Data>, exportState: ExportFn<Data>);
get v(): Data;
get e(): GeneralState<Data>;
}
declare class FrameworkState<Data, Key extends string> extends FrameworkReadableState<Data, Key> {
private $upd;
constructor(state: GeneralState<Data>, key: Key, dehydrate: DehydrateFn<Data>, exportState: ExportFn<Data>, update: UpdateFn<Data>);
set v(newValue: Data);
get v(): Data;
}
/**
* Request cache settings
* expire: expiration time
* 1. When set to a number: if it is greater than 0, the cached data will be returned first, the expiration time unit is milliseconds, if it is less than or equal to 0, it will not be cached, and Infinity will never expire;
* 2. When set to a Date object, it means
* mode: cache mode, optional values are memory, restore
*/
type CacheExpire = number | Date | null;
type CacheMode = 'memory' | 'restore';
/**
* Empty function for compatibility processing
*/
declare const noop: () => void;
/**
* A function that returns the parameter itself, used for compatibility processing
* Since some systems use self as a reserved word, $self is used to distinguish it.
* @param arg any parameter
* @returns return parameter itself
*/
declare const $self: <T>(arg: T) => T;
/**
* Determine whether the parameter is a function any parameter
* @returns Whether the parameter is a function
*/
declare const isFn: (arg: any) => arg is GeneralFn;
/**
* Determine whether the parameter is a number any parameter
* @returns Whether the parameter is a number
*/
declare const isNumber: (arg: any) => arg is number;
/**
* Determine whether the parameter is a string any parameter
* @returns Whether the parameter is a string
*/
declare const isString: (arg: any) => arg is string;
/**
* Determine whether the parameter is an object any parameter
* @returns Whether the parameter is an object
*/
declare const isObject: <T = any>(arg: any) => arg is T;
/**
* Global toString any parameter stringified parameters
*/
declare const globalToString: (arg: any) => string;
/**
* Determine whether it is a normal object any parameter
* @returns Judgment result
*/
declare const isPlainObject: (arg: any) => arg is Record<any, any>;
/**
* Determine whether it is an instance of a certain class any parameter
* @returns Judgment result
*/
declare const instanceOf: <T>(arg: any, cls: new (...args: any[]) => T) => arg is T;
/**
* Unified timestamp acquisition function
* @returns Timestamp
*/
declare const getTime: (date?: Date) => number;
/**
* Get the alova instance through the method instance alova example
*/
declare const getContext: <T extends {
context: any;
}>(methodInstance: T) => T["context"];
/**
* Get method instance configuration data
* @returns Configuration object
*/
declare const getConfig: <T extends {
config: any;
}>(methodInstance: T) => T["config"];
/**
* Get alova configuration data alova configuration object
*/
declare const getContextOptions: <T extends {
options: any;
}>(alovaInstance: T) => T["options"];
/**
* Get alova configuration data through method instance alova configuration object
*/
declare const getOptions: <T extends {
context: any;
}>(methodInstance: T) => T["context"]["options"];
/**
* Get the key value of the request method
* @returns The key value of this request method
*/
declare const key: <T extends {
config: any;
type: string;
url: string;
data?: any;
}>(methodInstance: T) => string;
/**
* Create uuid simple version uuid
*/
declare const uuid: () => string;
/**
* Get the key value of the method instance method instance
* @returns The key value of this method instance
*/
declare const getMethodInternalKey: <T extends {
key: string;
}>(methodInstance: T) => T["key"];
/**
* Get the request method object
* @param methodHandler Request method handle
* @param args Method call parameters request method object
*/
declare const getHandlerMethod: <T extends {
key: string;
}>(methodHandler: T | ((...args: any[]) => T), assert: (expression: boolean, msg: string) => void, args?: any[]) => T;
/**
* Is it special data
* @param data Submit data
* @returns Judgment result
*/
declare const isSpecialRequestBody: (data: any) => boolean;
declare const objAssign: <T extends Record<string, any>, U extends Record<string, any>[]>(target: T, ...sources: U) => T & U[number];
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
/**
* Excludes specified attributes from a data collection and returns a new data collection data collection
* @param keys Excluded keys new data collection
*/
declare const omit: <T extends Record<string, any>, K extends keyof T>(obj: T, ...keys: K[]) => Pick<T, Exclude<keyof T, K>>;
/**
* the same as `Promise.withResolvers`
* @returns promise with resolvers.
*/
declare function usePromise<T = any>(): UsePromiseExposure<T>;
/**
* Get cached configuration parameters, fixedly returning an object in the format { e: function, c: any, f: any, m: number, s: boolean, t: string } e is the abbreviation of expire, which returns the cache expiration time point (timestamp) in milliseconds.
* c is controlled, indicating whether it is a controlled cache
* f is the original value of cacheFor, which is used to call to obtain cached data when c is true.
* m is the abbreviation of mode, storage mode
* s is the abbreviation of storage, whether to store it locally
* t is the abbreviation of tag, which stores tags persistently.
* @param methodInstance method instance
* @returns Unified cache parameter object
*/
declare const getLocalCacheConfigParam: <T extends {
config: any;
}>(methodInstance: T) => {
f: any;
c: boolean;
e: (mode: CacheMode) => ReturnType<(cacheExpire: CacheExpire) => number>;
m: CacheMode;
s: boolean;
t: string | undefined;
};
/**
* Create class instance
* @param Cls Constructor
* @param args Constructor parameters class instance
*/
declare const newInstance: <T extends {
new (...args: any[]): InstanceType<T>;
}>(Cls: T, ...args: ConstructorParameters<T>) => InstanceType<T>;
/**
* Unified configuration
* @param data
* @returns unified configuration
*/
declare const sloughConfig: <T>(config: T | ((...args: any[]) => T), args?: any[]) => T;
declare const sloughFunction: <T, U>(arg: T | undefined, defaultFn: U) => (() => void) | U | (T & GeneralFn);
/**
* Create an executor that calls multiple times synchronously and only executes it once asynchronously
*/
declare const createSyncOnceRunner: (delay?: number) => (fn: () => void) => void;
/**
* Create an asynchronous function queue, the asynchronous function will be executed serially queue add function
*/
declare const createAsyncQueue: (catchError?: boolean) => {
addQueue: <T>(asyncFunc: (...args: any[]) => Promise<T>) => Promise<T>;
onComplete: (fn: GeneralFn) => void;
};
/**
* Traverse the target object deeply target audience
* @param callback Traversal callback
* @param preorder Whether to traverse in preorder, the default is true
* @param key The currently traversed key
* @param parent The parent node currently traversed
*/
declare const walkObject: (target: any, callback: (value: any, key: string | number | symbol, parent: any) => void, preorder?: boolean, key?: string | number | symbol, parent?: any) => any;
/**
* build common cache key.
*/
declare const buildNamespacedCacheKey: (namespace: string, key: string) => string;
/**
* Calculate retry delay time based on avoidance strategy and number of retries avoid parameters
* @param retryTimes Number of retries
* @returns Retry delay time
*/
declare const delayWithBackoff: (backoff: BackoffPolicy, retryTimes: number) => number;
/**
* Build the complete url baseURL path url parameters complete url
*/
declare const buildCompletedURL: (baseURL: string, url: string, params: Record<string, any>) => string;
/**
* Deep clone an object.
*
* @param obj The object to be cloned.
* @returns The cloned object.
*/
declare const deepClone: <T>(obj: T) => T;
type CallbackFn = () => void | Promise<void>;
declare class QueueCallback {
protected limit?: (number | null) | undefined;
private callbackQueue;
private isProcessing;
private interrupt;
/**
* @param [limit=null] no limit if set undefined or null
* @param [initialProcessing=false]
*/
constructor(limit?: (number | null) | undefined, initialProcessing?: boolean);
/**
* Adds a callback function to the callback queue.
* If a limit is set and the queue has reached its limit, the callback will not be added.
* @param callback The callback function to be added to the queue.
*/
queueCallback(callback: CallbackFn): void;
/**
* Tries to run the callbacks in the queue.
* If there are callbacks in the queue, it removes the first callback and executes it.
* This method is called recursively until there are no more callbacks in the queue.
*/
tryRunQueueCallback(): Promise<void>;
/**
* If set the param `state` to true, it will interrupt the current job (whether or not the current processing state is true)
* If set the param `state` to false, then get on with the rest of the work
*/
setProcessingState(state: boolean): void;
}
declare const PromiseCls: PromiseConstructor;
declare const promiseResolve: <T = void>(value?: T) => Promise<Awaited<T> | undefined>;
declare const promiseReject: <T>(value: T) => Promise<never>;
declare const ObjectCls: ObjectConstructor;
declare const RegExpCls: RegExpConstructor;
declare const undefinedValue: undefined;
declare const nullValue: null;
declare const trueValue = true;
declare const falseValue = false;
declare const promiseThen: <T, TResult1 = T, TResult2 = never>(promise: Promise<T>, onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null) => Promise<TResult1 | TResult2>;
declare const promiseCatch: <T, TResult = never>(promise: Promise<T>, onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null) => Promise<T | TResult>;
declare const promiseFinally: <T>(promise: Promise<T>, onfinally?: (() => void) | undefined | null) => Promise<T>;
declare const JSONStringify: <T>(value: T, replacer?: (this: any, key: string, value: any) => any, space?: string | number) => string;
declare const JSONParse: (value: string) => any;
declare const setTimeoutFn: (fn: GeneralFn, delay?: number) => number;
declare const clearTimeoutTimer: (timer: NodeJS.Timeout | string | number) => void;
declare const objectKeys: (obj: object) => string[];
declare const objectValues: (obj: object) => any[];
declare const forEach: <T>(ary: T[], fn: (item: T, index: number, ary: T[]) => void) => void;
declare const pushItem: <T>(ary: T[], ...item: T[]) => number;
declare const mapItem: <T, R>(ary: T[], callbackfn: (value: T, index: number, array: T[]) => R) => R[];
declare const filterItem: <T>(ary: T[], predicate: (value: T, index: number, array: T[]) => unknown) => T[];
declare const shift: <T>(ary: T[]) => T | undefined;
declare const slice: <T>(ary: T[], start?: number, end?: number) => T[];
declare const splice: <T>(ary: T[], start: number, deleteCount?: number, ...items: T[]) => T[];
declare const len: (data: any[] | Uint8Array | string) => number;
declare const isArray: (arg: any) => arg is any[];
declare const deleteAttr: <T extends Record<any, any>>(arg: T, attr: keyof T) => boolean;
declare const typeOf: (arg: any) => "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
declare const regexpTest: (reg: RegExp, str: string | number) => boolean;
declare const includes: <T>(ary: T[], target: T) => boolean;
declare const valueObject: <T>(value: T, writable?: boolean) => {
value: T;
writable: boolean;
};
declare const defineProperty: (o: object, key: string | symbol, value: any, isDescriptor?: boolean) => object;
declare const isSSR: boolean;
/** cache mode */
declare const MEMORY = "memory";
declare const STORAGE_RESTORE = "restore";
export { $self, AlovaError, type BackoffPolicy, type CallbackFn, type Equal, type EventManager, FrameworkReadableState, FrameworkState, type GeneralFn, type GeneralState, type IsAny, type IsAssignable, type IsUnknown, JSONParse, JSONStringify, MEMORY, ObjectCls, type Omit, PromiseCls, QueueCallback, RegExpCls, STORAGE_RESTORE, type UsePromiseExposure, buildCompletedURL, buildNamespacedCacheKey, clearTimeoutTimer, createAssert, createAsyncQueue, createEventManager, createSyncOnceRunner, decorateEvent, deepClone, defineProperty, delayWithBackoff, deleteAttr, falseValue, filterItem, forEach, getConfig, getContext, getContextOptions, getHandlerMethod, getLocalCacheConfigParam, getMethodInternalKey, getOptions, getTime, globalToString, includes, instanceOf, isArray, isFn, isNumber, isObject, isPlainObject, isSSR, isSpecialRequestBody, isString, key, len, mapItem, newInstance, noop, nullValue, objAssign, objectKeys, objectValues, omit, promiseCatch, promiseFinally, promiseReject, promiseResolve, promiseThen, pushItem, regexpTest, setTimeoutFn, shift, slice, sloughConfig, sloughFunction, splice, trueValue, type, typeOf, undefinedValue, usePromise, uuid, valueObject, walkObject };

3
node_modules/.pnpm/@esbuild+win32-x64@0.21.5/node_modules/@esbuild/win32-x64/README.md

@ -1,3 +0,0 @@
# esbuild
This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.

20
node_modules/.pnpm/@esbuild+win32-x64@0.21.5/node_modules/@esbuild/win32-x64/package.json

@ -1,20 +0,0 @@
{
"name": "@esbuild/win32-x64",
"version": "0.21.5",
"description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
"repository": {
"type": "git",
"url": "git+https://github.com/evanw/esbuild.git"
},
"license": "MIT",
"preferUnplugged": true,
"engines": {
"node": ">=12"
},
"os": [
"win32"
],
"cpu": [
"x64"
]
}

3
node_modules/.pnpm/@rollup+rollup-win32-x64-msvc@4.40.2/node_modules/@rollup/rollup-win32-x64-msvc/README.md

@ -1,3 +0,0 @@
# `@rollup/rollup-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `rollup`

19
node_modules/.pnpm/@rollup+rollup-win32-x64-msvc@4.40.2/node_modules/@rollup/rollup-win32-x64-msvc/package.json

@ -1,19 +0,0 @@
{
"name": "@rollup/rollup-win32-x64-msvc",
"version": "4.40.2",
"os": [
"win32"
],
"cpu": [
"x64"
],
"files": [
"rollup.win32-x64-msvc.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": "rollup/rollup",
"main": "./rollup.win32-x64-msvc.node"
}

BIN
node_modules/.pnpm/@rollup+rollup-win32-x64-msvc@4.40.2/node_modules/@rollup/rollup-win32-x64-msvc/rollup.win32-x64-msvc.node

Binary file not shown.

21
node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/LICENSE

@ -1,21 +0,0 @@
MIT License
Copyright (c) Microsoft Corporation.
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

15
node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/README.md

@ -1,15 +0,0 @@
# Installation
> `npm install --save @types/estree`
# Summary
This package contains type definitions for estree (https://github.com/estree/estree).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree.
### Additional Details
* Last updated: Mon, 24 Mar 2025 07:34:10 GMT
* Dependencies: none
# Credits
These definitions were written by [RReverser](https://github.com/RReverser).

167
node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/flow.d.ts

@ -1,167 +0,0 @@
declare namespace ESTree {
interface FlowTypeAnnotation extends Node {}
interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {}
interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {}
interface FlowDeclaration extends Declaration {}
interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {}
interface ArrayTypeAnnotation extends FlowTypeAnnotation {
elementType: FlowTypeAnnotation;
}
interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {}
interface ClassImplements extends Node {
id: Identifier;
typeParameters?: TypeParameterInstantiation | null;
}
interface ClassProperty {
key: Expression;
value?: Expression | null;
typeAnnotation?: TypeAnnotation | null;
computed: boolean;
static: boolean;
}
interface DeclareClass extends FlowDeclaration {
id: Identifier;
typeParameters?: TypeParameterDeclaration | null;
body: ObjectTypeAnnotation;
extends: InterfaceExtends[];
}
interface DeclareFunction extends FlowDeclaration {
id: Identifier;
}
interface DeclareModule extends FlowDeclaration {
id: Literal | Identifier;
body: BlockStatement;
}
interface DeclareVariable extends FlowDeclaration {
id: Identifier;
}
interface FunctionTypeAnnotation extends FlowTypeAnnotation {
params: FunctionTypeParam[];
returnType: FlowTypeAnnotation;
rest?: FunctionTypeParam | null;
typeParameters?: TypeParameterDeclaration | null;
}
interface FunctionTypeParam {
name: Identifier;
typeAnnotation: FlowTypeAnnotation;
optional: boolean;
}
interface GenericTypeAnnotation extends FlowTypeAnnotation {
id: Identifier | QualifiedTypeIdentifier;
typeParameters?: TypeParameterInstantiation | null;
}
interface InterfaceExtends extends Node {
id: Identifier | QualifiedTypeIdentifier;
typeParameters?: TypeParameterInstantiation | null;
}
interface InterfaceDeclaration extends FlowDeclaration {
id: Identifier;
typeParameters?: TypeParameterDeclaration | null;
extends: InterfaceExtends[];
body: ObjectTypeAnnotation;
}
interface IntersectionTypeAnnotation extends FlowTypeAnnotation {
types: FlowTypeAnnotation[];
}
interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {}
interface NullableTypeAnnotation extends FlowTypeAnnotation {
typeAnnotation: TypeAnnotation;
}
interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {}
interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {}
interface StringTypeAnnotation extends FlowBaseTypeAnnotation {}
interface TupleTypeAnnotation extends FlowTypeAnnotation {
types: FlowTypeAnnotation[];
}
interface TypeofTypeAnnotation extends FlowTypeAnnotation {
argument: FlowTypeAnnotation;
}
interface TypeAlias extends FlowDeclaration {
id: Identifier;
typeParameters?: TypeParameterDeclaration | null;
right: FlowTypeAnnotation;
}
interface TypeAnnotation extends Node {
typeAnnotation: FlowTypeAnnotation;
}
interface TypeCastExpression extends Expression {
expression: Expression;
typeAnnotation: TypeAnnotation;
}
interface TypeParameterDeclaration extends Node {
params: Identifier[];
}
interface TypeParameterInstantiation extends Node {
params: FlowTypeAnnotation[];
}
interface ObjectTypeAnnotation extends FlowTypeAnnotation {
properties: ObjectTypeProperty[];
indexers: ObjectTypeIndexer[];
callProperties: ObjectTypeCallProperty[];
}
interface ObjectTypeCallProperty extends Node {
value: FunctionTypeAnnotation;
static: boolean;
}
interface ObjectTypeIndexer extends Node {
id: Identifier;
key: FlowTypeAnnotation;
value: FlowTypeAnnotation;
static: boolean;
}
interface ObjectTypeProperty extends Node {
key: Expression;
value: FlowTypeAnnotation;
optional: boolean;
static: boolean;
}
interface QualifiedTypeIdentifier extends Node {
qualification: Identifier | QualifiedTypeIdentifier;
id: Identifier;
}
interface UnionTypeAnnotation extends FlowTypeAnnotation {
types: FlowTypeAnnotation[];
}
interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {}
}

694
node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/index.d.ts

@ -1,694 +0,0 @@
// This definition file follows a somewhat unusual format. ESTree allows
// runtime type checks based on the `type` parameter. In order to explain this
// to typescript we want to use discriminated union types:
// https://github.com/Microsoft/TypeScript/pull/9163
//
// For ESTree this is a bit tricky because the high level interfaces like
// Node or Function are pulling double duty. We want to pass common fields down
// to the interfaces that extend them (like Identifier or
// ArrowFunctionExpression), but you can't extend a type union or enforce
// common fields on them. So we've split the high level interfaces into two
// types, a base type which passes down inherited fields, and a type union of
// all types which extend the base type. Only the type union is exported, and
// the union is how other types refer to the collection of inheriting types.
//
// This makes the definitions file here somewhat more difficult to maintain,
// but it has the notable advantage of making ESTree much easier to use as
// an end user.
export interface BaseNodeWithoutComments {
// Every leaf interface that extends BaseNode must specify a type property.
// The type property should be a string literal. For example, Identifier
// has: `type: "Identifier"`
type: string;
loc?: SourceLocation | null | undefined;
range?: [number, number] | undefined;
}
export interface BaseNode extends BaseNodeWithoutComments {
leadingComments?: Comment[] | undefined;
trailingComments?: Comment[] | undefined;
}
export interface NodeMap {
AssignmentProperty: AssignmentProperty;
CatchClause: CatchClause;
Class: Class;
ClassBody: ClassBody;
Expression: Expression;
Function: Function;
Identifier: Identifier;
Literal: Literal;
MethodDefinition: MethodDefinition;
ModuleDeclaration: ModuleDeclaration;
ModuleSpecifier: ModuleSpecifier;
Pattern: Pattern;
PrivateIdentifier: PrivateIdentifier;
Program: Program;
Property: Property;
PropertyDefinition: PropertyDefinition;
SpreadElement: SpreadElement;
Statement: Statement;
Super: Super;
SwitchCase: SwitchCase;
TemplateElement: TemplateElement;
VariableDeclarator: VariableDeclarator;
}
export type Node = NodeMap[keyof NodeMap];
export interface Comment extends BaseNodeWithoutComments {
type: "Line" | "Block";
value: string;
}
export interface SourceLocation {
source?: string | null | undefined;
start: Position;
end: Position;
}
export interface Position {
/** >= 1 */
line: number;
/** >= 0 */
column: number;
}
export interface Program extends BaseNode {
type: "Program";
sourceType: "script" | "module";
body: Array<Directive | Statement | ModuleDeclaration>;
comments?: Comment[] | undefined;
}
export interface Directive extends BaseNode {
type: "ExpressionStatement";
expression: Literal;
directive: string;
}
export interface BaseFunction extends BaseNode {
params: Pattern[];
generator?: boolean | undefined;
async?: boolean | undefined;
// The body is either BlockStatement or Expression because arrow functions
// can have a body that's either. FunctionDeclarations and
// FunctionExpressions have only BlockStatement bodies.
body: BlockStatement | Expression;
}
export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
export type Statement =
| ExpressionStatement
| BlockStatement
| StaticBlock
| EmptyStatement
| DebuggerStatement
| WithStatement
| ReturnStatement
| LabeledStatement
| BreakStatement
| ContinueStatement
| IfStatement
| SwitchStatement
| ThrowStatement
| TryStatement
| WhileStatement
| DoWhileStatement
| ForStatement
| ForInStatement
| ForOfStatement
| Declaration;
export interface BaseStatement extends BaseNode {}
export interface EmptyStatement extends BaseStatement {
type: "EmptyStatement";
}
export interface BlockStatement extends BaseStatement {
type: "BlockStatement";
body: Statement[];
innerComments?: Comment[] | undefined;
}
export interface StaticBlock extends Omit<BlockStatement, "type"> {
type: "StaticBlock";
}
export interface ExpressionStatement extends BaseStatement {
type: "ExpressionStatement";
expression: Expression;
}
export interface IfStatement extends BaseStatement {
type: "IfStatement";
test: Expression;
consequent: Statement;
alternate?: Statement | null | undefined;
}
export interface LabeledStatement extends BaseStatement {
type: "LabeledStatement";
label: Identifier;
body: Statement;
}
export interface BreakStatement extends BaseStatement {
type: "BreakStatement";
label?: Identifier | null | undefined;
}
export interface ContinueStatement extends BaseStatement {
type: "ContinueStatement";
label?: Identifier | null | undefined;
}
export interface WithStatement extends BaseStatement {
type: "WithStatement";
object: Expression;
body: Statement;
}
export interface SwitchStatement extends BaseStatement {
type: "SwitchStatement";
discriminant: Expression;
cases: SwitchCase[];
}
export interface ReturnStatement extends BaseStatement {
type: "ReturnStatement";
argument?: Expression | null | undefined;
}
export interface ThrowStatement extends BaseStatement {
type: "ThrowStatement";
argument: Expression;
}
export interface TryStatement extends BaseStatement {
type: "TryStatement";
block: BlockStatement;
handler?: CatchClause | null | undefined;
finalizer?: BlockStatement | null | undefined;
}
export interface WhileStatement extends BaseStatement {
type: "WhileStatement";
test: Expression;
body: Statement;
}
export interface DoWhileStatement extends BaseStatement {
type: "DoWhileStatement";
body: Statement;
test: Expression;
}
export interface ForStatement extends BaseStatement {
type: "ForStatement";
init?: VariableDeclaration | Expression | null | undefined;
test?: Expression | null | undefined;
update?: Expression | null | undefined;
body: Statement;
}
export interface BaseForXStatement extends BaseStatement {
left: VariableDeclaration | Pattern;
right: Expression;
body: Statement;
}
export interface ForInStatement extends BaseForXStatement {
type: "ForInStatement";
}
export interface DebuggerStatement extends BaseStatement {
type: "DebuggerStatement";
}
export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
export interface BaseDeclaration extends BaseStatement {}
export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
type: "FunctionDeclaration";
/** It is null when a function declaration is a part of the `export default function` statement */
id: Identifier | null;
body: BlockStatement;
}
export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
id: Identifier;
}
export interface VariableDeclaration extends BaseDeclaration {
type: "VariableDeclaration";
declarations: VariableDeclarator[];
kind: "var" | "let" | "const";
}
export interface VariableDeclarator extends BaseNode {
type: "VariableDeclarator";
id: Pattern;
init?: Expression | null | undefined;
}
export interface ExpressionMap {
ArrayExpression: ArrayExpression;
ArrowFunctionExpression: ArrowFunctionExpression;
AssignmentExpression: AssignmentExpression;
AwaitExpression: AwaitExpression;
BinaryExpression: BinaryExpression;
CallExpression: CallExpression;
ChainExpression: ChainExpression;
ClassExpression: ClassExpression;
ConditionalExpression: ConditionalExpression;
FunctionExpression: FunctionExpression;
Identifier: Identifier;
ImportExpression: ImportExpression;
Literal: Literal;
LogicalExpression: LogicalExpression;
MemberExpression: MemberExpression;
MetaProperty: MetaProperty;
NewExpression: NewExpression;
ObjectExpression: ObjectExpression;
SequenceExpression: SequenceExpression;
TaggedTemplateExpression: TaggedTemplateExpression;
TemplateLiteral: TemplateLiteral;
ThisExpression: ThisExpression;
UnaryExpression: UnaryExpression;
UpdateExpression: UpdateExpression;
YieldExpression: YieldExpression;
}
export type Expression = ExpressionMap[keyof ExpressionMap];
export interface BaseExpression extends BaseNode {}
export type ChainElement = SimpleCallExpression | MemberExpression;
export interface ChainExpression extends BaseExpression {
type: "ChainExpression";
expression: ChainElement;
}
export interface ThisExpression extends BaseExpression {
type: "ThisExpression";
}
export interface ArrayExpression extends BaseExpression {
type: "ArrayExpression";
elements: Array<Expression | SpreadElement | null>;
}
export interface ObjectExpression extends BaseExpression {
type: "ObjectExpression";
properties: Array<Property | SpreadElement>;
}
export interface PrivateIdentifier extends BaseNode {
type: "PrivateIdentifier";
name: string;
}
export interface Property extends BaseNode {
type: "Property";
key: Expression | PrivateIdentifier;
value: Expression | Pattern; // Could be an AssignmentProperty
kind: "init" | "get" | "set";
method: boolean;
shorthand: boolean;
computed: boolean;
}
export interface PropertyDefinition extends BaseNode {
type: "PropertyDefinition";
key: Expression | PrivateIdentifier;
value?: Expression | null | undefined;
computed: boolean;
static: boolean;
}
export interface FunctionExpression extends BaseFunction, BaseExpression {
id?: Identifier | null | undefined;
type: "FunctionExpression";
body: BlockStatement;
}
export interface SequenceExpression extends BaseExpression {
type: "SequenceExpression";
expressions: Expression[];
}
export interface UnaryExpression extends BaseExpression {
type: "UnaryExpression";
operator: UnaryOperator;
prefix: true;
argument: Expression;
}
export interface BinaryExpression extends BaseExpression {
type: "BinaryExpression";
operator: BinaryOperator;
left: Expression | PrivateIdentifier;
right: Expression;
}
export interface AssignmentExpression extends BaseExpression {
type: "AssignmentExpression";
operator: AssignmentOperator;
left: Pattern | MemberExpression;
right: Expression;
}
export interface UpdateExpression extends BaseExpression {
type: "UpdateExpression";
operator: UpdateOperator;
argument: Expression;
prefix: boolean;
}
export interface LogicalExpression extends BaseExpression {
type: "LogicalExpression";
operator: LogicalOperator;
left: Expression;
right: Expression;
}
export interface ConditionalExpression extends BaseExpression {
type: "ConditionalExpression";
test: Expression;
alternate: Expression;
consequent: Expression;
}
export interface BaseCallExpression extends BaseExpression {
callee: Expression | Super;
arguments: Array<Expression | SpreadElement>;
}
export type CallExpression = SimpleCallExpression | NewExpression;
export interface SimpleCallExpression extends BaseCallExpression {
type: "CallExpression";
optional: boolean;
}
export interface NewExpression extends BaseCallExpression {
type: "NewExpression";
}
export interface MemberExpression extends BaseExpression, BasePattern {
type: "MemberExpression";
object: Expression | Super;
property: Expression | PrivateIdentifier;
computed: boolean;
optional: boolean;
}
export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
export interface BasePattern extends BaseNode {}
export interface SwitchCase extends BaseNode {
type: "SwitchCase";
test?: Expression | null | undefined;
consequent: Statement[];
}
export interface CatchClause extends BaseNode {
type: "CatchClause";
param: Pattern | null;
body: BlockStatement;
}
export interface Identifier extends BaseNode, BaseExpression, BasePattern {
type: "Identifier";
name: string;
}
export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
export interface SimpleLiteral extends BaseNode, BaseExpression {
type: "Literal";
value: string | boolean | number | null;
raw?: string | undefined;
}
export interface RegExpLiteral extends BaseNode, BaseExpression {
type: "Literal";
value?: RegExp | null | undefined;
regex: {
pattern: string;
flags: string;
};
raw?: string | undefined;
}
export interface BigIntLiteral extends BaseNode, BaseExpression {
type: "Literal";
value?: bigint | null | undefined;
bigint: string;
raw?: string | undefined;
}
export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
export type BinaryOperator =
| "=="
| "!="
| "==="
| "!=="
| "<"
| "<="
| ">"
| ">="
| "<<"
| ">>"
| ">>>"
| "+"
| "-"
| "*"
| "/"
| "%"
| "**"
| "|"
| "^"
| "&"
| "in"
| "instanceof";
export type LogicalOperator = "||" | "&&" | "??";
export type AssignmentOperator =
| "="
| "+="
| "-="
| "*="
| "/="
| "%="
| "**="
| "<<="
| ">>="
| ">>>="
| "|="
| "^="
| "&="
| "||="
| "&&="
| "??=";
export type UpdateOperator = "++" | "--";
export interface ForOfStatement extends BaseForXStatement {
type: "ForOfStatement";
await: boolean;
}
export interface Super extends BaseNode {
type: "Super";
}
export interface SpreadElement extends BaseNode {
type: "SpreadElement";
argument: Expression;
}
export interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
type: "ArrowFunctionExpression";
expression: boolean;
body: BlockStatement | Expression;
}
export interface YieldExpression extends BaseExpression {
type: "YieldExpression";
argument?: Expression | null | undefined;
delegate: boolean;
}
export interface TemplateLiteral extends BaseExpression {
type: "TemplateLiteral";
quasis: TemplateElement[];
expressions: Expression[];
}
export interface TaggedTemplateExpression extends BaseExpression {
type: "TaggedTemplateExpression";
tag: Expression;
quasi: TemplateLiteral;
}
export interface TemplateElement extends BaseNode {
type: "TemplateElement";
tail: boolean;
value: {
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */
cooked?: string | null | undefined;
raw: string;
};
}
export interface AssignmentProperty extends Property {
value: Pattern;
kind: "init";
method: boolean; // false
}
export interface ObjectPattern extends BasePattern {
type: "ObjectPattern";
properties: Array<AssignmentProperty | RestElement>;
}
export interface ArrayPattern extends BasePattern {
type: "ArrayPattern";
elements: Array<Pattern | null>;
}
export interface RestElement extends BasePattern {
type: "RestElement";
argument: Pattern;
}
export interface AssignmentPattern extends BasePattern {
type: "AssignmentPattern";
left: Pattern;
right: Expression;
}
export type Class = ClassDeclaration | ClassExpression;
export interface BaseClass extends BaseNode {
superClass?: Expression | null | undefined;
body: ClassBody;
}
export interface ClassBody extends BaseNode {
type: "ClassBody";
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
}
export interface MethodDefinition extends BaseNode {
type: "MethodDefinition";
key: Expression | PrivateIdentifier;
value: FunctionExpression;
kind: "constructor" | "method" | "get" | "set";
computed: boolean;
static: boolean;
}
export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
type: "ClassDeclaration";
/** It is null when a class declaration is a part of the `export default class` statement */
id: Identifier | null;
}
export interface ClassDeclaration extends MaybeNamedClassDeclaration {
id: Identifier;
}
export interface ClassExpression extends BaseClass, BaseExpression {
type: "ClassExpression";
id?: Identifier | null | undefined;
}
export interface MetaProperty extends BaseExpression {
type: "MetaProperty";
meta: Identifier;
property: Identifier;
}
export type ModuleDeclaration =
| ImportDeclaration
| ExportNamedDeclaration
| ExportDefaultDeclaration
| ExportAllDeclaration;
export interface BaseModuleDeclaration extends BaseNode {}
export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
export interface BaseModuleSpecifier extends BaseNode {
local: Identifier;
}
export interface ImportDeclaration extends BaseModuleDeclaration {
type: "ImportDeclaration";
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
attributes: ImportAttribute[];
source: Literal;
}
export interface ImportSpecifier extends BaseModuleSpecifier {
type: "ImportSpecifier";
imported: Identifier | Literal;
}
export interface ImportAttribute extends BaseNode {
type: "ImportAttribute";
key: Identifier | Literal;
value: Literal;
}
export interface ImportExpression extends BaseExpression {
type: "ImportExpression";
source: Expression;
options?: Expression | null | undefined;
}
export interface ImportDefaultSpecifier extends BaseModuleSpecifier {
type: "ImportDefaultSpecifier";
}
export interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
type: "ImportNamespaceSpecifier";
}
export interface ExportNamedDeclaration extends BaseModuleDeclaration {
type: "ExportNamedDeclaration";
declaration?: Declaration | null | undefined;
specifiers: ExportSpecifier[];
attributes: ImportAttribute[];
source?: Literal | null | undefined;
}
export interface ExportSpecifier extends Omit<BaseModuleSpecifier, "local"> {
type: "ExportSpecifier";
local: Identifier | Literal;
exported: Identifier | Literal;
}
export interface ExportDefaultDeclaration extends BaseModuleDeclaration {
type: "ExportDefaultDeclaration";
declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression;
}
export interface ExportAllDeclaration extends BaseModuleDeclaration {
type: "ExportAllDeclaration";
exported: Identifier | Literal | null;
attributes: ImportAttribute[];
source: Literal;
}
export interface AwaitExpression extends BaseExpression {
type: "AwaitExpression";
argument: Expression;
}

27
node_modules/.pnpm/@types+estree@1.0.7/node_modules/@types/estree/package.json

@ -1,27 +0,0 @@
{
"name": "@types/estree",
"version": "1.0.7",
"description": "TypeScript definitions for estree",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree",
"license": "MIT",
"contributors": [
{
"name": "RReverser",
"githubUsername": "RReverser",
"url": "https://github.com/RReverser"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/estree"
},
"scripts": {},
"dependencies": {},
"peerDependencies": {},
"typesPublisherContentHash": "1ab11f4e78319f80655b4ca20a073da0dc035be5f3290fb0bfa1e08a055d0c7d",
"typeScriptVersion": "5.0",
"nonNpm": true
}

32
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/application.js

@ -1,32 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
const call = newRuntimeCaller(objectNames.Application);
const HideMethod = 0;
const ShowMethod = 1;
const QuitMethod = 2;
/**
* Hides a certain method by calling the HideMethod function.
*/
export function Hide() {
return call(HideMethod);
}
/**
* Calls the ShowMethod and returns the result.
*/
export function Show() {
return call(ShowMethod);
}
/**
* Calls the QuitMethod to terminate the program.
*/
export function Quit() {
return call(QuitMethod);
}

20
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/browser.js

@ -1,20 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
const call = newRuntimeCaller(objectNames.Browser);
const BrowserOpenURL = 0;
/**
* Open a browser window to the given URL.
*
* @param url - The URL to open
*/
export function OpenURL(url) {
return call(BrowserOpenURL, { url: url.toString() });
}

144
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/callable.js

@ -1,144 +0,0 @@
// Source: https://github.com/inspect-js/is-callable
// The MIT License (MIT)
//
// Copyright (c) 2015 Jordan Harband
//
// 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.
var fnToStr = Function.prototype.toString;
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
var badArrayLike;
var isCallableMarker;
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
try {
badArrayLike = Object.defineProperty({}, 'length', {
get: function () {
throw isCallableMarker;
}
});
isCallableMarker = {};
// eslint-disable-next-line no-throw-literal
reflectApply(function () { throw 42; }, null, badArrayLike);
}
catch (_) {
if (_ !== isCallableMarker) {
reflectApply = null;
}
}
}
else {
reflectApply = null;
}
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
try {
var fnStr = fnToStr.call(value);
return constructorRegex.test(fnStr);
}
catch (e) {
return false; // not a function
}
};
var tryFunctionObject = function tryFunctionToStr(value) {
try {
if (isES6ClassFn(value)) {
return false;
}
fnToStr.call(value);
return true;
}
catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var objectClass = '[object Object]';
var fnClass = '[object Function]';
var genClass = '[object GeneratorFunction]';
var ddaClass = '[object HTMLAllCollection]'; // IE 11
var ddaClass2 = '[object HTML document.all class]';
var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
var isDDA = function isDocumentDotAll() { return false; };
if (typeof document === 'object') {
// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
var all = document.all;
if (toStr.call(all) === toStr.call(document.all)) {
isDDA = function isDocumentDotAll(value) {
/* globals document: false */
// in IE 6-8, typeof document.all is "object" and it's truthy
if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
try {
var str = toStr.call(value);
return (str === ddaClass
|| str === ddaClass2
|| str === ddaClass3 // opera 12.16
|| str === objectClass // IE 6-8
) && value('') == null; // eslint-disable-line eqeqeq
}
catch (e) { /**/ }
}
return false;
};
}
}
function isCallableRefApply(value) {
if (isDDA(value)) {
return true;
}
if (!value) {
return false;
}
if (typeof value !== 'function' && typeof value !== 'object') {
return false;
}
try {
reflectApply(value, null, badArrayLike);
}
catch (e) {
if (e !== isCallableMarker) {
return false;
}
}
return !isES6ClassFn(value) && tryFunctionObject(value);
}
function isCallableNoRefApply(value) {
if (isDDA(value)) {
return true;
}
if (!value) {
return false;
}
if (typeof value !== 'function' && typeof value !== 'object') {
return false;
}
if (hasToStringTag) {
return tryFunctionObject(value);
}
if (isES6ClassFn(value)) {
return false;
}
var strClass = toStr.call(value);
if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) {
return false;
}
return tryFunctionObject(value);
}
;
export default reflectApply ? isCallableRefApply : isCallableNoRefApply;

194
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/calls.js

@ -1,194 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { CancellablePromise } from "./cancellable.js";
import { newRuntimeCaller, objectNames } from "./runtime.js";
import { nanoid } from "./nanoid.js";
// Setup
window._wails = window._wails || {};
window._wails.callResultHandler = resultHandler;
window._wails.callErrorHandler = errorHandler;
const call = newRuntimeCaller(objectNames.Call);
const cancelCall = newRuntimeCaller(objectNames.CancelCall);
const callResponses = new Map();
const CallBinding = 0;
const CancelMethod = 0;
/**
* Exception class that will be thrown in case the bound method returns an error.
* The value of the {@link RuntimeError#name} property is "RuntimeError".
*/
export class RuntimeError extends Error {
/**
* Constructs a new RuntimeError instance.
* @param message - The error message.
* @param options - Options to be forwarded to the Error constructor.
*/
constructor(message, options) {
super(message, options);
this.name = "RuntimeError";
}
}
/**
* Handles the result of a call request.
*
* @param id - The id of the request to handle the result for.
* @param data - The result data of the request.
* @param isJSON - Indicates whether the data is JSON or not.
*/
function resultHandler(id, data, isJSON) {
const resolvers = getAndDeleteResponse(id);
if (!resolvers) {
return;
}
if (!data) {
resolvers.resolve(undefined);
}
else if (!isJSON) {
resolvers.resolve(data);
}
else {
try {
resolvers.resolve(JSON.parse(data));
}
catch (err) {
resolvers.reject(new TypeError("could not parse result: " + err.message, { cause: err }));
}
}
}
/**
* Handles the error from a call request.
*
* @param id - The id of the promise handler.
* @param data - The error data to reject the promise handler with.
* @param isJSON - Indicates whether the data is JSON or not.
*/
function errorHandler(id, data, isJSON) {
const resolvers = getAndDeleteResponse(id);
if (!resolvers) {
return;
}
if (!isJSON) {
resolvers.reject(new Error(data));
}
else {
let error;
try {
error = JSON.parse(data);
}
catch (err) {
resolvers.reject(new TypeError("could not parse error: " + err.message, { cause: err }));
return;
}
let options = {};
if (error.cause) {
options.cause = error.cause;
}
let exception;
switch (error.kind) {
case "ReferenceError":
exception = new ReferenceError(error.message, options);
break;
case "TypeError":
exception = new TypeError(error.message, options);
break;
case "RuntimeError":
exception = new RuntimeError(error.message, options);
break;
default:
exception = new Error(error.message, options);
break;
}
resolvers.reject(exception);
}
}
/**
* Retrieves and removes the response associated with the given ID from the callResponses map.
*
* @param id - The ID of the response to be retrieved and removed.
* @returns The response object associated with the given ID, if any.
*/
function getAndDeleteResponse(id) {
const response = callResponses.get(id);
callResponses.delete(id);
return response;
}
/**
* Generates a unique ID using the nanoid library.
*
* @returns A unique ID that does not exist in the callResponses set.
*/
function generateID() {
let result;
do {
result = nanoid();
} while (callResponses.has(result));
return result;
}
/**
* Call a bound method according to the given call options.
*
* In case of failure, the returned promise will reject with an exception
* among ReferenceError (unknown method), TypeError (wrong argument count or type),
* {@link RuntimeError} (method returned an error), or other (network or internal errors).
* The exception might have a "cause" field with the value returned
* by the application- or service-level error marshaling functions.
*
* @param options - A method call descriptor.
* @returns The result of the call.
*/
export function Call(options) {
const id = generateID();
const result = CancellablePromise.withResolvers();
callResponses.set(id, { resolve: result.resolve, reject: result.reject });
const request = call(CallBinding, Object.assign({ "call-id": id }, options));
let running = false;
request.then(() => {
running = true;
}, (err) => {
callResponses.delete(id);
result.reject(err);
});
const cancel = () => {
callResponses.delete(id);
return cancelCall(CancelMethod, { "call-id": id }).catch((err) => {
console.error("Error while requesting binding call cancellation:", err);
});
};
result.oncancelled = () => {
if (running) {
return cancel();
}
else {
return request.then(cancel);
}
};
return result.promise;
}
/**
* Calls a bound method by name with the specified arguments.
* See {@link Call} for details.
*
* @param methodName - The name of the method in the format 'package.struct.method'.
* @param args - The arguments to pass to the method.
* @returns The result of the method call.
*/
export function ByName(methodName, ...args) {
return Call({ methodName, args });
}
/**
* Calls a method by its numeric ID with the specified arguments.
* See {@link Call} for details.
*
* @param methodID - The ID of the method to call.
* @param args - The arguments to pass to the method.
* @return The result of the method call.
*/
export function ByID(methodID, ...args) {
return Call({ methodID, args });
}

792
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/cancellable.js

@ -1,792 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
var _a;
import isCallable from "./callable.js";
/**
* Exception class that will be used as rejection reason
* in case a {@link CancellablePromise} is cancelled successfully.
*
* The value of the {@link name} property is the string `"CancelError"`.
* The value of the {@link cause} property is the cause passed to the cancel method, if any.
*/
export class CancelError extends Error {
/**
* Constructs a new `CancelError` instance.
* @param message - The error message.
* @param options - Options to be forwarded to the Error constructor.
*/
constructor(message, options) {
super(message, options);
this.name = "CancelError";
}
}
/**
* Exception class that will be reported as an unhandled rejection
* in case a {@link CancellablePromise} rejects after being cancelled,
* or when the `oncancelled` callback throws or rejects.
*
* The value of the {@link name} property is the string `"CancelledRejectionError"`.
* The value of the {@link cause} property is the reason the promise rejected with.
*
* Because the original promise was cancelled,
* a wrapper promise will be passed to the unhandled rejection listener instead.
* The {@link promise} property holds a reference to the original promise.
*/
export class CancelledRejectionError extends Error {
/**
* Constructs a new `CancelledRejectionError` instance.
* @param promise - The promise that caused the error originally.
* @param reason - The rejection reason.
* @param info - An optional informative message specifying the circumstances in which the error was thrown.
* Defaults to the string `"Unhandled rejection in cancelled promise."`.
*/
constructor(promise, reason, info) {
super((info !== null && info !== void 0 ? info : "Unhandled rejection in cancelled promise.") + " Reason: " + errorMessage(reason), { cause: reason });
this.promise = promise;
this.name = "CancelledRejectionError";
}
}
// Private field names.
const barrierSym = Symbol("barrier");
const cancelImplSym = Symbol("cancelImpl");
const species = (_a = Symbol.species) !== null && _a !== void 0 ? _a : Symbol("speciesPolyfill");
/**
* A promise with an attached method for cancelling long-running operations (see {@link CancellablePromise#cancel}).
* Cancellation can optionally be bound to an {@link AbortSignal}
* for better composability (see {@link CancellablePromise#cancelOn}).
*
* Cancelling a pending promise will result in an immediate rejection
* with an instance of {@link CancelError} as reason,
* but whoever started the promise will be responsible
* for actually aborting the underlying operation.
* To this purpose, the constructor and all chaining methods
* accept optional cancellation callbacks.
*
* If a `CancellablePromise` still resolves after having been cancelled,
* the result will be discarded. If it rejects, the reason
* will be reported as an unhandled rejection,
* wrapped in a {@link CancelledRejectionError} instance.
* To facilitate the handling of cancellation requests,
* cancelled `CancellablePromise`s will _not_ report unhandled `CancelError`s
* whose `cause` field is the same as the one with which the current promise was cancelled.
*
* All usual promise methods are defined and return a `CancellablePromise`
* whose cancel method will cancel the parent operation as well, propagating the cancellation reason
* upwards through promise chains.
* Conversely, cancelling a promise will not automatically cancel dependent promises downstream:
* ```ts
* let root = new CancellablePromise((resolve, reject) => { ... });
* let child1 = root.then(() => { ... });
* let child2 = child1.then(() => { ... });
* let child3 = root.catch(() => { ... });
* child1.cancel(); // Cancels child1 and root, but not child2 or child3
* ```
* Cancelling a promise that has already settled is safe and has no consequence.
*
* The `cancel` method returns a promise that _always fulfills_
* after the whole chain has processed the cancel request
* and all attached callbacks up to that moment have run.
*
* All ES2024 promise methods (static and instance) are defined on CancellablePromise,
* but actual availability may vary with OS/webview version.
*
* In line with the proposal at https://github.com/tc39/proposal-rm-builtin-subclassing,
* `CancellablePromise` does not support transparent subclassing.
* Extenders should take care to provide their own method implementations.
* This might be reconsidered in case the proposal is retired.
*
* CancellablePromise is a wrapper around the DOM Promise object
* and is compliant with the [Promises/A+ specification](https://promisesaplus.com/)
* (it passes the [compliance suite](https://github.com/promises-aplus/promises-tests))
* if so is the underlying implementation.
*/
export class CancellablePromise extends Promise {
/**
* Creates a new `CancellablePromise`.
*
* @param executor - A callback used to initialize the promise. This callback is passed two arguments:
* a `resolve` callback used to resolve the promise with a value
* or the result of another promise (possibly cancellable),
* and a `reject` callback used to reject the promise with a provided reason or error.
* If the value provided to the `resolve` callback is a thenable _and_ cancellable object
* (it has a `then` _and_ a `cancel` method),
* cancellation requests will be forwarded to that object and the oncancelled will not be invoked anymore.
* If any one of the two callbacks is called _after_ the promise has been cancelled,
* the provided values will be cancelled and resolved as usual,
* but their results will be discarded.
* However, if the resolution process ultimately ends up in a rejection
* that is not due to cancellation, the rejection reason
* will be wrapped in a {@link CancelledRejectionError}
* and bubbled up as an unhandled rejection.
* @param oncancelled - It is the caller's responsibility to ensure that any operation
* started by the executor is properly halted upon cancellation.
* This optional callback can be used to that purpose.
* It will be called _synchronously_ with a cancellation cause
* when cancellation is requested, _after_ the promise has already rejected
* with a {@link CancelError}, but _before_
* any {@link then}/{@link catch}/{@link finally} callback runs.
* If the callback returns a thenable, the promise returned from {@link cancel}
* will only fulfill after the former has settled.
* Unhandled exceptions or rejections from the callback will be wrapped
* in a {@link CancelledRejectionError} and bubbled up as unhandled rejections.
* If the `resolve` callback is called before cancellation with a cancellable promise,
* cancellation requests on this promise will be diverted to that promise,
* and the original `oncancelled` callback will be discarded.
*/
constructor(executor, oncancelled) {
let resolve;
let reject;
super((res, rej) => { resolve = res; reject = rej; });
if (this.constructor[species] !== Promise) {
throw new TypeError("CancellablePromise does not support transparent subclassing. Please refrain from overriding the [Symbol.species] static property.");
}
let promise = {
promise: this,
resolve,
reject,
get oncancelled() { return oncancelled !== null && oncancelled !== void 0 ? oncancelled : null; },
set oncancelled(cb) { oncancelled = cb !== null && cb !== void 0 ? cb : undefined; }
};
const state = {
get root() { return state; },
resolving: false,
settled: false
};
// Setup cancellation system.
void Object.defineProperties(this, {
[barrierSym]: {
configurable: false,
enumerable: false,
writable: true,
value: null
},
[cancelImplSym]: {
configurable: false,
enumerable: false,
writable: false,
value: cancellerFor(promise, state)
}
});
// Run the actual executor.
const rejector = rejectorFor(promise, state);
try {
executor(resolverFor(promise, state), rejector);
}
catch (err) {
if (state.resolving) {
console.log("Unhandled exception in CancellablePromise executor.", err);
}
else {
rejector(err);
}
}
}
/**
* Cancels immediately the execution of the operation associated with this promise.
* The promise rejects with a {@link CancelError} instance as reason,
* with the {@link CancelError#cause} property set to the given argument, if any.
*
* Has no effect if called after the promise has already settled;
* repeated calls in particular are safe, but only the first one
* will set the cancellation cause.
*
* The `CancelError` exception _need not_ be handled explicitly _on the promises that are being cancelled:_
* cancelling a promise with no attached rejection handler does not trigger an unhandled rejection event.
* Therefore, the following idioms are all equally correct:
* ```ts
* new CancellablePromise((resolve, reject) => { ... }).cancel();
* new CancellablePromise((resolve, reject) => { ... }).then(...).cancel();
* new CancellablePromise((resolve, reject) => { ... }).then(...).catch(...).cancel();
* ```
* Whenever some cancelled promise in a chain rejects with a `CancelError`
* with the same cancellation cause as itself, the error will be discarded silently.
* However, the `CancelError` _will still be delivered_ to all attached rejection handlers
* added by {@link then} and related methods:
* ```ts
* let cancellable = new CancellablePromise((resolve, reject) => { ... });
* cancellable.then(() => { ... }).catch(console.log);
* cancellable.cancel(); // A CancelError is printed to the console.
* ```
* If the `CancelError` is not handled downstream by the time it reaches
* a _non-cancelled_ promise, it _will_ trigger an unhandled rejection event,
* just like normal rejections would:
* ```ts
* let cancellable = new CancellablePromise((resolve, reject) => { ... });
* let chained = cancellable.then(() => { ... }).then(() => { ... }); // No catch...
* cancellable.cancel(); // Unhandled rejection event on chained!
* ```
* Therefore, it is important to either cancel whole promise chains from their tail,
* as shown in the correct idioms above, or take care of handling errors everywhere.
*
* @returns A cancellable promise that _fulfills_ after the cancel callback (if any)
* and all handlers attached up to the call to cancel have run.
* If the cancel callback returns a thenable, the promise returned by `cancel`
* will also wait for that thenable to settle.
* This enables callers to wait for the cancelled operation to terminate
* without being forced to handle potential errors at the call site.
* ```ts
* cancellable.cancel().then(() => {
* // Cleanup finished, it's safe to do something else.
* }, (err) => {
* // Unreachable: the promise returned from cancel will never reject.
* });
* ```
* Note that the returned promise will _not_ handle implicitly any rejection
* that might have occurred already in the cancelled chain.
* It will just track whether registered handlers have been executed or not.
* Therefore, unhandled rejections will never be silently handled by calling cancel.
*/
cancel(cause) {
return new CancellablePromise((resolve) => {
// INVARIANT: the result of this[cancelImplSym] and the barrier do not ever reject.
// Unfortunately macOS High Sierra does not support Promise.allSettled.
Promise.all([
this[cancelImplSym](new CancelError("Promise cancelled.", { cause })),
currentBarrier(this)
]).then(() => resolve(), () => resolve());
});
}
/**
* Binds promise cancellation to the abort event of the given {@link AbortSignal}.
* If the signal has already aborted, the promise will be cancelled immediately.
* When either condition is verified, the cancellation cause will be set
* to the signal's abort reason (see {@link AbortSignal#reason}).
*
* Has no effect if called (or if the signal aborts) _after_ the promise has already settled.
* Only the first signal to abort will set the cancellation cause.
*
* For more details about the cancellation process,
* see {@link cancel} and the `CancellablePromise` constructor.
*
* This method enables `await`ing cancellable promises without having
* to store them for future cancellation, e.g.:
* ```ts
* await longRunningOperation().cancelOn(signal);
* ```
* instead of:
* ```ts
* let promiseToBeCancelled = longRunningOperation();
* await promiseToBeCancelled;
* ```
*
* @returns This promise, for method chaining.
*/
cancelOn(signal) {
if (signal.aborted) {
void this.cancel(signal.reason);
}
else {
signal.addEventListener('abort', () => void this.cancel(signal.reason), { capture: true });
}
return this;
}
/**
* Attaches callbacks for the resolution and/or rejection of the `CancellablePromise`.
*
* The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
* with the same semantics as the `oncancelled` argument of the constructor.
* When the parent promise rejects or is cancelled, the `onrejected` callback will run,
* _even after the returned promise has been cancelled:_
* in that case, should it reject or throw, the reason will be wrapped
* in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
*
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A `CancellablePromise` for the completion of whichever callback is executed.
* The returned promise is hooked up to propagate cancellation requests up the chain, but not down:
*
* - if the parent promise is cancelled, the `onrejected` handler will be invoked with a `CancelError`
* and the returned promise _will resolve regularly_ with its result;
* - conversely, if the returned promise is cancelled, _the parent promise is cancelled too;_
* the `onrejected` handler will still be invoked with the parent's `CancelError`,
* but its result will be discarded
* and the returned promise will reject with a `CancelError` as well.
*
* The promise returned from {@link cancel} will fulfill only after all attached handlers
* up the entire promise chain have been run.
*
* If either callback returns a cancellable promise,
* cancellation requests will be diverted to it,
* and the specified `oncancelled` callback will be discarded.
*/
then(onfulfilled, onrejected, oncancelled) {
if (!(this instanceof CancellablePromise)) {
throw new TypeError("CancellablePromise.prototype.then called on an invalid object.");
}
// NOTE: TypeScript's built-in type for then is broken,
// as it allows specifying an arbitrary TResult1 != T even when onfulfilled is not a function.
// We cannot fix it if we want to CancellablePromise to implement PromiseLike<T>.
if (!isCallable(onfulfilled)) {
onfulfilled = identity;
}
if (!isCallable(onrejected)) {
onrejected = thrower;
}
if (onfulfilled === identity && onrejected == thrower) {
// Shortcut for trivial arguments.
return new CancellablePromise((resolve) => resolve(this));
}
const barrier = {};
this[barrierSym] = barrier;
return new CancellablePromise((resolve, reject) => {
void super.then((value) => {
var _a;
if (this[barrierSym] === barrier) {
this[barrierSym] = null;
}
(_a = barrier.resolve) === null || _a === void 0 ? void 0 : _a.call(barrier);
try {
resolve(onfulfilled(value));
}
catch (err) {
reject(err);
}
}, (reason) => {
var _a;
if (this[barrierSym] === barrier) {
this[barrierSym] = null;
}
(_a = barrier.resolve) === null || _a === void 0 ? void 0 : _a.call(barrier);
try {
resolve(onrejected(reason));
}
catch (err) {
reject(err);
}
});
}, async (cause) => {
//cancelled = true;
try {
return oncancelled === null || oncancelled === void 0 ? void 0 : oncancelled(cause);
}
finally {
await this.cancel(cause);
}
});
}
/**
* Attaches a callback for only the rejection of the Promise.
*
* The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
* with the same semantics as the `oncancelled` argument of the constructor.
* When the parent promise rejects or is cancelled, the `onrejected` callback will run,
* _even after the returned promise has been cancelled:_
* in that case, should it reject or throw, the reason will be wrapped
* in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
*
* It is equivalent to
* ```ts
* cancellablePromise.then(undefined, onrejected, oncancelled);
* ```
* and the same caveats apply.
*
* @returns A Promise for the completion of the callback.
* Cancellation requests on the returned promise
* will propagate up the chain to the parent promise,
* but not in the other direction.
*
* The promise returned from {@link cancel} will fulfill only after all attached handlers
* up the entire promise chain have been run.
*
* If `onrejected` returns a cancellable promise,
* cancellation requests will be diverted to it,
* and the specified `oncancelled` callback will be discarded.
* See {@link then} for more details.
*/
catch(onrejected, oncancelled) {
return this.then(undefined, onrejected, oncancelled);
}
/**
* Attaches a callback that is invoked when the CancellablePromise is settled (fulfilled or rejected). The
* resolved value cannot be accessed or modified from the callback.
* The returned promise will settle in the same state as the original one
* after the provided callback has completed execution,
* unless the callback throws or returns a rejecting promise,
* in which case the returned promise will reject as well.
*
* The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
* with the same semantics as the `oncancelled` argument of the constructor.
* Once the parent promise settles, the `onfinally` callback will run,
* _even after the returned promise has been cancelled:_
* in that case, should it reject or throw, the reason will be wrapped
* in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
*
* This method is implemented in terms of {@link then} and the same caveats apply.
* It is polyfilled, hence available in every OS/webview version.
*
* @returns A Promise for the completion of the callback.
* Cancellation requests on the returned promise
* will propagate up the chain to the parent promise,
* but not in the other direction.
*
* The promise returned from {@link cancel} will fulfill only after all attached handlers
* up the entire promise chain have been run.
*
* If `onfinally` returns a cancellable promise,
* cancellation requests will be diverted to it,
* and the specified `oncancelled` callback will be discarded.
* See {@link then} for more details.
*/
finally(onfinally, oncancelled) {
if (!(this instanceof CancellablePromise)) {
throw new TypeError("CancellablePromise.prototype.finally called on an invalid object.");
}
if (!isCallable(onfinally)) {
return this.then(onfinally, onfinally, oncancelled);
}
return this.then((value) => CancellablePromise.resolve(onfinally()).then(() => value), (reason) => CancellablePromise.resolve(onfinally()).then(() => { throw reason; }), oncancelled);
}
/**
* We use the `[Symbol.species]` static property, if available,
* to disable the built-in automatic subclassing features from {@link Promise}.
* It is critical for performance reasons that extenders do not override this.
* Once the proposal at https://github.com/tc39/proposal-rm-builtin-subclassing
* is either accepted or retired, this implementation will have to be revised accordingly.
*
* @ignore
* @internal
*/
static get [species]() {
return Promise;
}
static all(values) {
let collected = Array.from(values);
const promise = collected.length === 0
? CancellablePromise.resolve(collected)
: new CancellablePromise((resolve, reject) => {
void Promise.all(collected).then(resolve, reject);
}, (cause) => cancelAll(promise, collected, cause));
return promise;
}
static allSettled(values) {
let collected = Array.from(values);
const promise = collected.length === 0
? CancellablePromise.resolve(collected)
: new CancellablePromise((resolve, reject) => {
void Promise.allSettled(collected).then(resolve, reject);
}, (cause) => cancelAll(promise, collected, cause));
return promise;
}
static any(values) {
let collected = Array.from(values);
const promise = collected.length === 0
? CancellablePromise.resolve(collected)
: new CancellablePromise((resolve, reject) => {
void Promise.any(collected).then(resolve, reject);
}, (cause) => cancelAll(promise, collected, cause));
return promise;
}
static race(values) {
let collected = Array.from(values);
const promise = new CancellablePromise((resolve, reject) => {
void Promise.race(collected).then(resolve, reject);
}, (cause) => cancelAll(promise, collected, cause));
return promise;
}
/**
* Creates a new cancelled CancellablePromise for the provided cause.
*
* @group Static Methods
*/
static cancel(cause) {
const p = new CancellablePromise(() => { });
p.cancel(cause);
return p;
}
/**
* Creates a new CancellablePromise that cancels
* after the specified timeout, with the provided cause.
*
* If the {@link AbortSignal.timeout} factory method is available,
* it is used to base the timeout on _active_ time rather than _elapsed_ time.
* Otherwise, `timeout` falls back to {@link setTimeout}.
*
* @group Static Methods
*/
static timeout(milliseconds, cause) {
const promise = new CancellablePromise(() => { });
if (AbortSignal && typeof AbortSignal === 'function' && AbortSignal.timeout && typeof AbortSignal.timeout === 'function') {
AbortSignal.timeout(milliseconds).addEventListener('abort', () => void promise.cancel(cause));
}
else {
setTimeout(() => void promise.cancel(cause), milliseconds);
}
return promise;
}
static sleep(milliseconds, value) {
return new CancellablePromise((resolve) => {
setTimeout(() => resolve(value), milliseconds);
});
}
/**
* Creates a new rejected CancellablePromise for the provided reason.
*
* @group Static Methods
*/
static reject(reason) {
return new CancellablePromise((_, reject) => reject(reason));
}
static resolve(value) {
if (value instanceof CancellablePromise) {
// Optimise for cancellable promises.
return value;
}
return new CancellablePromise((resolve) => resolve(value));
}
/**
* Creates a new CancellablePromise and returns it in an object, along with its resolve and reject functions
* and a getter/setter for the cancellation callback.
*
* This method is polyfilled, hence available in every OS/webview version.
*
* @group Static Methods
*/
static withResolvers() {
let result = { oncancelled: null };
result.promise = new CancellablePromise((resolve, reject) => {
result.resolve = resolve;
result.reject = reject;
}, (cause) => { var _a; (_a = result.oncancelled) === null || _a === void 0 ? void 0 : _a.call(result, cause); });
return result;
}
}
/**
* Returns a callback that implements the cancellation algorithm for the given cancellable promise.
* The promise returned from the resulting function does not reject.
*/
function cancellerFor(promise, state) {
let cancellationPromise = undefined;
return (reason) => {
if (!state.settled) {
state.settled = true;
state.reason = reason;
promise.reject(reason);
// Attach an error handler that ignores this specific rejection reason and nothing else.
// In theory, a sane underlying implementation at this point
// should always reject with our cancellation reason,
// hence the handler will never throw.
void Promise.prototype.then.call(promise.promise, undefined, (err) => {
if (err !== reason) {
throw err;
}
});
}
// If reason is not set, the promise resolved regularly, hence we must not call oncancelled.
// If oncancelled is unset, no need to go any further.
if (!state.reason || !promise.oncancelled) {
return;
}
cancellationPromise = new Promise((resolve) => {
try {
resolve(promise.oncancelled(state.reason.cause));
}
catch (err) {
Promise.reject(new CancelledRejectionError(promise.promise, err, "Unhandled exception in oncancelled callback."));
}
}).catch((reason) => {
Promise.reject(new CancelledRejectionError(promise.promise, reason, "Unhandled rejection in oncancelled callback."));
});
// Unset oncancelled to prevent repeated calls.
promise.oncancelled = null;
return cancellationPromise;
};
}
/**
* Returns a callback that implements the resolution algorithm for the given cancellable promise.
*/
function resolverFor(promise, state) {
return (value) => {
if (state.resolving) {
return;
}
state.resolving = true;
if (value === promise.promise) {
if (state.settled) {
return;
}
state.settled = true;
promise.reject(new TypeError("A promise cannot be resolved with itself."));
return;
}
if (value != null && (typeof value === 'object' || typeof value === 'function')) {
let then;
try {
then = value.then;
}
catch (err) {
state.settled = true;
promise.reject(err);
return;
}
if (isCallable(then)) {
try {
let cancel = value.cancel;
if (isCallable(cancel)) {
const oncancelled = (cause) => {
Reflect.apply(cancel, value, [cause]);
};
if (state.reason) {
// If already cancelled, propagate cancellation.
// The promise returned from the canceller algorithm does not reject
// so it can be discarded safely.
void cancellerFor(Object.assign(Object.assign({}, promise), { oncancelled }), state)(state.reason);
}
else {
promise.oncancelled = oncancelled;
}
}
}
catch (_a) { }
const newState = {
root: state.root,
resolving: false,
get settled() { return this.root.settled; },
set settled(value) { this.root.settled = value; },
get reason() { return this.root.reason; }
};
const rejector = rejectorFor(promise, newState);
try {
Reflect.apply(then, value, [resolverFor(promise, newState), rejector]);
}
catch (err) {
rejector(err);
}
return; // IMPORTANT!
}
}
if (state.settled) {
return;
}
state.settled = true;
promise.resolve(value);
};
}
/**
* Returns a callback that implements the rejection algorithm for the given cancellable promise.
*/
function rejectorFor(promise, state) {
return (reason) => {
if (state.resolving) {
return;
}
state.resolving = true;
if (state.settled) {
try {
if (reason instanceof CancelError && state.reason instanceof CancelError && Object.is(reason.cause, state.reason.cause)) {
// Swallow late rejections that are CancelErrors whose cancellation cause is the same as ours.
return;
}
}
catch (_a) { }
void Promise.reject(new CancelledRejectionError(promise.promise, reason));
}
else {
state.settled = true;
promise.reject(reason);
}
};
}
/**
* Cancels all values in an array that look like cancellable thenables.
* Returns a promise that fulfills once all cancellation procedures for the given values have settled.
*/
function cancelAll(parent, values, cause) {
const results = [];
for (const value of values) {
let cancel;
try {
if (!isCallable(value.then)) {
continue;
}
cancel = value.cancel;
if (!isCallable(cancel)) {
continue;
}
}
catch (_a) {
continue;
}
let result;
try {
result = Reflect.apply(cancel, value, [cause]);
}
catch (err) {
Promise.reject(new CancelledRejectionError(parent, err, "Unhandled exception in cancel method."));
continue;
}
if (!result) {
continue;
}
results.push((result instanceof Promise ? result : Promise.resolve(result)).catch((reason) => {
Promise.reject(new CancelledRejectionError(parent, reason, "Unhandled rejection in cancel method."));
}));
}
return Promise.all(results);
}
/**
* Returns its argument.
*/
function identity(x) {
return x;
}
/**
* Throws its argument.
*/
function thrower(reason) {
throw reason;
}
/**
* Attempts various strategies to convert an error to a string.
*/
function errorMessage(err) {
try {
if (err instanceof Error || typeof err !== 'object' || err.toString !== Object.prototype.toString) {
return "" + err;
}
}
catch (_a) { }
try {
return JSON.stringify(err);
}
catch (_b) { }
try {
return Object.prototype.toString.call(err);
}
catch (_c) { }
return "<could not convert error to string>";
}
/**
* Gets the current barrier promise for the given cancellable promise. If necessary, initialises the barrier.
*/
function currentBarrier(promise) {
var _a;
let pwr = (_a = promise[barrierSym]) !== null && _a !== void 0 ? _a : {};
if (!('promise' in pwr)) {
Object.assign(pwr, promiseWithResolvers());
}
if (promise[barrierSym] == null) {
pwr.resolve();
promise[barrierSym] = pwr;
}
return pwr.promise;
}
// Polyfill Promise.withResolvers.
let promiseWithResolvers = Promise.withResolvers;
if (promiseWithResolvers && typeof promiseWithResolvers === 'function') {
promiseWithResolvers = promiseWithResolvers.bind(Promise);
}
else {
promiseWithResolvers = function () {
let resolve;
let reject;
const promise = new Promise((res, rej) => { resolve = res; reject = rej; });
return { promise, resolve, reject };
};
}

30
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/clipboard.js

@ -1,30 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
const call = newRuntimeCaller(objectNames.Clipboard);
const ClipboardSetText = 0;
const ClipboardText = 1;
/**
* Sets the text to the Clipboard.
*
* @param text - The text to be set to the Clipboard.
* @return A Promise that resolves when the operation is successful.
*/
export function SetText(text) {
return call(ClipboardSetText, { text });
}
/**
* Get the Clipboard text
*
* @returns A promise that resolves with the text from the Clipboard.
*/
export function Text() {
return call(ClipboardText);
}

80
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/contextmenu.js

@ -1,80 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
import { IsDebug } from "./system.js";
import { eventTarget } from "./utils";
// setup
window.addEventListener('contextmenu', contextMenuHandler);
const call = newRuntimeCaller(objectNames.ContextMenu);
const ContextMenuOpen = 0;
function openContextMenu(id, x, y, data) {
void call(ContextMenuOpen, { id, x, y, data });
}
function contextMenuHandler(event) {
const target = eventTarget(event);
// Check for custom context menu
const customContextMenu = window.getComputedStyle(target).getPropertyValue("--custom-contextmenu").trim();
if (customContextMenu) {
event.preventDefault();
const data = window.getComputedStyle(target).getPropertyValue("--custom-contextmenu-data");
openContextMenu(customContextMenu, event.clientX, event.clientY, data);
}
else {
processDefaultContextMenu(event, target);
}
}
/*
--default-contextmenu: auto; (default) will show the default context menu if contentEditable is true OR text has been selected OR element is input or textarea
--default-contextmenu: show; will always show the default context menu
--default-contextmenu: hide; will always hide the default context menu
This rule is inherited like normal CSS rules, so nesting works as expected
*/
function processDefaultContextMenu(event, target) {
// Debug builds always show the menu
if (IsDebug()) {
return;
}
// Process default context menu
switch (window.getComputedStyle(target).getPropertyValue("--default-contextmenu").trim()) {
case 'show':
return;
case 'hide':
event.preventDefault();
return;
}
// Check if contentEditable is true
if (target.isContentEditable) {
return;
}
// Check if text has been selected
const selection = window.getSelection();
const hasSelection = selection && selection.toString().length > 0;
if (hasSelection) {
for (let i = 0; i < selection.rangeCount; i++) {
const range = selection.getRangeAt(i);
const rects = range.getClientRects();
for (let j = 0; j < rects.length; j++) {
const rect = rects[j];
if (document.elementFromPoint(rect.left, rect.top) === target) {
return;
}
}
}
}
// Check if tag is input or textarea.
if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
if (hasSelection || (!target.readOnly && !target.disabled)) {
return;
}
}
// hide default context menu
event.preventDefault();
}

94
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/create.js

@ -1,94 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
/**
* Any is a dummy creation function for simple or unknown types.
*/
export function Any(source) {
return source;
}
/**
* ByteSlice is a creation function that replaces
* null strings with empty strings.
*/
export function ByteSlice(source) {
return ((source == null) ? "" : source);
}
/**
* Array takes a creation function for an arbitrary type
* and returns an in-place creation function for an array
* whose elements are of that type.
*/
export function Array(element) {
if (element === Any) {
return (source) => (source === null ? [] : source);
}
return (source) => {
if (source === null) {
return [];
}
for (let i = 0; i < source.length; i++) {
source[i] = element(source[i]);
}
return source;
};
}
/**
* Map takes creation functions for two arbitrary types
* and returns an in-place creation function for an object
* whose keys and values are of those types.
*/
export function Map(key, value) {
if (value === Any) {
return (source) => (source === null ? {} : source);
}
return (source) => {
if (source === null) {
return {};
}
for (const key in source) {
source[key] = value(source[key]);
}
return source;
};
}
/**
* Nullable takes a creation function for an arbitrary type
* and returns a creation function for a nullable value of that type.
*/
export function Nullable(element) {
if (element === Any) {
return Any;
}
return (source) => (source === null ? null : element(source));
}
/**
* Struct takes an object mapping field names to creation functions
* and returns an in-place creation function for a struct.
*/
export function Struct(createField) {
let allAny = true;
for (const name in createField) {
if (createField[name] !== Any) {
allAny = false;
break;
}
}
if (allAny) {
return Any;
}
return (source) => {
for (const name in createField) {
if (name in source) {
source[name] = createField[name](source[name]);
}
}
return source;
};
}

134
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/dialogs.js

@ -1,134 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
import { nanoid } from './nanoid.js';
// setup
window._wails = window._wails || {};
window._wails.dialogErrorCallback = dialogErrorCallback;
window._wails.dialogResultCallback = dialogResultCallback;
const call = newRuntimeCaller(objectNames.Dialog);
const dialogResponses = new Map();
// Define constants from the `methods` object in Title Case
const DialogInfo = 0;
const DialogWarning = 1;
const DialogError = 2;
const DialogQuestion = 3;
const DialogOpenFile = 4;
const DialogSaveFile = 5;
/**
* Handles the result of a dialog request.
*
* @param id - The id of the request to handle the result for.
* @param data - The result data of the request.
* @param isJSON - Indicates whether the data is JSON or not.
*/
function dialogResultCallback(id, data, isJSON) {
let resolvers = getAndDeleteResponse(id);
if (!resolvers) {
return;
}
if (isJSON) {
try {
resolvers.resolve(JSON.parse(data));
}
catch (err) {
resolvers.reject(new TypeError("could not parse result: " + err.message, { cause: err }));
}
}
else {
resolvers.resolve(data);
}
}
/**
* Handles the error from a dialog request.
*
* @param id - The id of the promise handler.
* @param message - An error message.
*/
function dialogErrorCallback(id, message) {
var _a;
(_a = getAndDeleteResponse(id)) === null || _a === void 0 ? void 0 : _a.reject(new window.Error(message));
}
/**
* Retrieves and removes the response associated with the given ID from the dialogResponses map.
*
* @param id - The ID of the response to be retrieved and removed.
* @returns The response object associated with the given ID, if any.
*/
function getAndDeleteResponse(id) {
const response = dialogResponses.get(id);
dialogResponses.delete(id);
return response;
}
/**
* Generates a unique ID using the nanoid library.
*
* @returns A unique ID that does not exist in the dialogResponses set.
*/
function generateID() {
let result;
do {
result = nanoid();
} while (dialogResponses.has(result));
return result;
}
/**
* Presents a dialog of specified type with the given options.
*
* @param type - Dialog type.
* @param options - Options for the dialog.
* @returns A promise that resolves with result of dialog.
*/
function dialog(type, options = {}) {
const id = generateID();
return new Promise((resolve, reject) => {
dialogResponses.set(id, { resolve, reject });
call(type, Object.assign({ "dialog-id": id }, options)).catch((err) => {
dialogResponses.delete(id);
reject(err);
});
});
}
/**
* Presents an info dialog.
*
* @param options - Dialog options
* @returns A promise that resolves with the label of the chosen button.
*/
export function Info(options) { return dialog(DialogInfo, options); }
/**
* Presents a warning dialog.
*
* @param options - Dialog options.
* @returns A promise that resolves with the label of the chosen button.
*/
export function Warning(options) { return dialog(DialogWarning, options); }
/**
* Presents an error dialog.
*
* @param options - Dialog options.
* @returns A promise that resolves with the label of the chosen button.
*/
export function Error(options) { return dialog(DialogError, options); }
/**
* Presents a question dialog.
*
* @param options - Dialog options.
* @returns A promise that resolves with the label of the chosen button.
*/
export function Question(options) { return dialog(DialogQuestion, options); }
export function OpenFile(options) { var _a; return (_a = dialog(DialogOpenFile, options)) !== null && _a !== void 0 ? _a : []; }
/**
* Presents a file selection dialog to pick a file to save.
*
* @param options - Dialog options.
* @returns Selected file, or a blank string if no file has been selected.
*/
export function SaveFile(options) { return dialog(DialogSaveFile, options); }

222
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/drag.js

@ -1,222 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { invoke, IsWindows } from "./system.js";
import { GetFlag } from "./flags.js";
import { canTrackButtons, eventTarget } from "./utils.js";
// Setup
let canDrag = false;
let dragging = false;
let resizable = false;
let canResize = false;
let resizing = false;
let resizeEdge = "";
let defaultCursor = "auto";
let buttons = 0;
const buttonsTracked = canTrackButtons();
window._wails = window._wails || {};
window._wails.setResizable = (value) => {
resizable = value;
if (!resizable) {
// Stop resizing if in progress.
canResize = resizing = false;
setResize();
}
};
window.addEventListener('mousedown', update, { capture: true });
window.addEventListener('mousemove', update, { capture: true });
window.addEventListener('mouseup', update, { capture: true });
for (const ev of ['click', 'contextmenu', 'dblclick']) {
window.addEventListener(ev, suppressEvent, { capture: true });
}
function suppressEvent(event) {
// Suppress click events while resizing or dragging.
if (dragging || resizing) {
event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();
}
}
// Use constants to avoid comparing strings multiple times.
const MouseDown = 0;
const MouseUp = 1;
const MouseMove = 2;
function update(event) {
// Windows suppresses mouse events at the end of dragging or resizing,
// so we need to be smart and synthesize button events.
let eventType, eventButtons = event.buttons;
switch (event.type) {
case 'mousedown':
eventType = MouseDown;
if (!buttonsTracked) {
eventButtons = buttons | (1 << event.button);
}
break;
case 'mouseup':
eventType = MouseUp;
if (!buttonsTracked) {
eventButtons = buttons & ~(1 << event.button);
}
break;
default:
eventType = MouseMove;
if (!buttonsTracked) {
eventButtons = buttons;
}
break;
}
let released = buttons & ~eventButtons;
let pressed = eventButtons & ~buttons;
buttons = eventButtons;
// Synthesize a release-press sequence if we detect a press of an already pressed button.
if (eventType === MouseDown && !(pressed & event.button)) {
released |= (1 << event.button);
pressed |= (1 << event.button);
}
// Suppress all button events during dragging and resizing,
// unless this is a mouseup event that is ending a drag action.
if (eventType !== MouseMove // Fast path for mousemove
&& resizing
|| (dragging
&& (eventType === MouseDown
|| event.button !== 0))) {
event.stopImmediatePropagation();
event.stopPropagation();
event.preventDefault();
}
// Handle releases
if (released & 1) {
primaryUp(event);
}
// Handle presses
if (pressed & 1) {
primaryDown(event);
}
// Handle mousemove
if (eventType === MouseMove) {
onMouseMove(event);
}
;
}
function primaryDown(event) {
// Reset readiness state.
canDrag = false;
canResize = false;
// Ignore repeated clicks on macOS and Linux.
if (!IsWindows()) {
if (event.type === 'mousedown' && event.button === 0 && event.detail !== 1) {
return;
}
}
if (resizeEdge) {
// Ready to resize if the primary button was pressed for the first time.
canResize = true;
// Do not start drag operations when on resize edges.
return;
}
// Retrieve target element
const target = eventTarget(event);
// Ready to drag if the primary button was pressed for the first time on a draggable element.
// Ignore clicks on the scrollbar.
const style = window.getComputedStyle(target);
canDrag = (style.getPropertyValue("--wails-draggable").trim() === "drag"
&& (event.offsetX - parseFloat(style.paddingLeft) < target.clientWidth
&& event.offsetY - parseFloat(style.paddingTop) < target.clientHeight));
}
function primaryUp(event) {
// Stop dragging and resizing.
canDrag = false;
dragging = false;
canResize = false;
resizing = false;
}
const cursorForEdge = Object.freeze({
"se-resize": "nwse-resize",
"sw-resize": "nesw-resize",
"nw-resize": "nwse-resize",
"ne-resize": "nesw-resize",
"w-resize": "ew-resize",
"n-resize": "ns-resize",
"s-resize": "ns-resize",
"e-resize": "ew-resize",
});
function setResize(edge) {
if (edge) {
if (!resizeEdge) {
defaultCursor = document.body.style.cursor;
}
document.body.style.cursor = cursorForEdge[edge];
}
else if (!edge && resizeEdge) {
document.body.style.cursor = defaultCursor;
}
resizeEdge = edge || "";
}
function onMouseMove(event) {
if (canResize && resizeEdge) {
// Start resizing.
resizing = true;
invoke("wails:resize:" + resizeEdge);
}
else if (canDrag) {
// Start dragging.
dragging = true;
invoke("wails:drag");
}
if (dragging || resizing) {
// Either drag or resize is ongoing,
// reset readiness and stop processing.
canDrag = canResize = false;
return;
}
if (!resizable || !IsWindows()) {
if (resizeEdge) {
setResize();
}
return;
}
const resizeHandleHeight = GetFlag("system.resizeHandleHeight") || 5;
const resizeHandleWidth = GetFlag("system.resizeHandleWidth") || 5;
// Extra pixels for the corner areas.
const cornerExtra = GetFlag("resizeCornerExtra") || 10;
const rightBorder = (window.outerWidth - event.clientX) < resizeHandleWidth;
const leftBorder = event.clientX < resizeHandleWidth;
const topBorder = event.clientY < resizeHandleHeight;
const bottomBorder = (window.outerHeight - event.clientY) < resizeHandleHeight;
// Adjust for corner areas.
const rightCorner = (window.outerWidth - event.clientX) < (resizeHandleWidth + cornerExtra);
const leftCorner = event.clientX < (resizeHandleWidth + cornerExtra);
const topCorner = event.clientY < (resizeHandleHeight + cornerExtra);
const bottomCorner = (window.outerHeight - event.clientY) < (resizeHandleHeight + cornerExtra);
if (!leftCorner && !topCorner && !bottomCorner && !rightCorner) {
// Optimisation: out of all corner areas implies out of borders.
setResize();
}
// Detect corners.
else if (rightCorner && bottomCorner)
setResize("se-resize");
else if (leftCorner && bottomCorner)
setResize("sw-resize");
else if (leftCorner && topCorner)
setResize("nw-resize");
else if (topCorner && rightCorner)
setResize("ne-resize");
// Detect borders.
else if (leftBorder)
setResize("w-resize");
else if (topBorder)
setResize("n-resize");
else if (bottomBorder)
setResize("s-resize");
else if (rightBorder)
setResize("e-resize");
// Out of border area.
else
setResize();
}

229
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/event_types.js

@ -1,229 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export const Types = Object.freeze({
Windows: Object.freeze({
APMPowerSettingChange: "windows:APMPowerSettingChange",
APMPowerStatusChange: "windows:APMPowerStatusChange",
APMResumeAutomatic: "windows:APMResumeAutomatic",
APMResumeSuspend: "windows:APMResumeSuspend",
APMSuspend: "windows:APMSuspend",
ApplicationStarted: "windows:ApplicationStarted",
SystemThemeChanged: "windows:SystemThemeChanged",
WebViewNavigationCompleted: "windows:WebViewNavigationCompleted",
WindowActive: "windows:WindowActive",
WindowBackgroundErase: "windows:WindowBackgroundErase",
WindowClickActive: "windows:WindowClickActive",
WindowClosing: "windows:WindowClosing",
WindowDidMove: "windows:WindowDidMove",
WindowDidResize: "windows:WindowDidResize",
WindowDPIChanged: "windows:WindowDPIChanged",
WindowDragDrop: "windows:WindowDragDrop",
WindowDragEnter: "windows:WindowDragEnter",
WindowDragLeave: "windows:WindowDragLeave",
WindowDragOver: "windows:WindowDragOver",
WindowEndMove: "windows:WindowEndMove",
WindowEndResize: "windows:WindowEndResize",
WindowFullscreen: "windows:WindowFullscreen",
WindowHide: "windows:WindowHide",
WindowInactive: "windows:WindowInactive",
WindowKeyDown: "windows:WindowKeyDown",
WindowKeyUp: "windows:WindowKeyUp",
WindowKillFocus: "windows:WindowKillFocus",
WindowNonClientHit: "windows:WindowNonClientHit",
WindowNonClientMouseDown: "windows:WindowNonClientMouseDown",
WindowNonClientMouseLeave: "windows:WindowNonClientMouseLeave",
WindowNonClientMouseMove: "windows:WindowNonClientMouseMove",
WindowNonClientMouseUp: "windows:WindowNonClientMouseUp",
WindowPaint: "windows:WindowPaint",
WindowRestore: "windows:WindowRestore",
WindowSetFocus: "windows:WindowSetFocus",
WindowShow: "windows:WindowShow",
WindowStartMove: "windows:WindowStartMove",
WindowStartResize: "windows:WindowStartResize",
WindowUnFullscreen: "windows:WindowUnFullscreen",
WindowZOrderChanged: "windows:WindowZOrderChanged",
WindowMinimise: "windows:WindowMinimise",
WindowUnMinimise: "windows:WindowUnMinimise",
WindowMaximise: "windows:WindowMaximise",
WindowUnMaximise: "windows:WindowUnMaximise",
}),
Mac: Object.freeze({
ApplicationDidBecomeActive: "mac:ApplicationDidBecomeActive",
ApplicationDidChangeBackingProperties: "mac:ApplicationDidChangeBackingProperties",
ApplicationDidChangeEffectiveAppearance: "mac:ApplicationDidChangeEffectiveAppearance",
ApplicationDidChangeIcon: "mac:ApplicationDidChangeIcon",
ApplicationDidChangeOcclusionState: "mac:ApplicationDidChangeOcclusionState",
ApplicationDidChangeScreenParameters: "mac:ApplicationDidChangeScreenParameters",
ApplicationDidChangeStatusBarFrame: "mac:ApplicationDidChangeStatusBarFrame",
ApplicationDidChangeStatusBarOrientation: "mac:ApplicationDidChangeStatusBarOrientation",
ApplicationDidChangeTheme: "mac:ApplicationDidChangeTheme",
ApplicationDidFinishLaunching: "mac:ApplicationDidFinishLaunching",
ApplicationDidHide: "mac:ApplicationDidHide",
ApplicationDidResignActive: "mac:ApplicationDidResignActive",
ApplicationDidUnhide: "mac:ApplicationDidUnhide",
ApplicationDidUpdate: "mac:ApplicationDidUpdate",
ApplicationShouldHandleReopen: "mac:ApplicationShouldHandleReopen",
ApplicationWillBecomeActive: "mac:ApplicationWillBecomeActive",
ApplicationWillFinishLaunching: "mac:ApplicationWillFinishLaunching",
ApplicationWillHide: "mac:ApplicationWillHide",
ApplicationWillResignActive: "mac:ApplicationWillResignActive",
ApplicationWillTerminate: "mac:ApplicationWillTerminate",
ApplicationWillUnhide: "mac:ApplicationWillUnhide",
ApplicationWillUpdate: "mac:ApplicationWillUpdate",
MenuDidAddItem: "mac:MenuDidAddItem",
MenuDidBeginTracking: "mac:MenuDidBeginTracking",
MenuDidClose: "mac:MenuDidClose",
MenuDidDisplayItem: "mac:MenuDidDisplayItem",
MenuDidEndTracking: "mac:MenuDidEndTracking",
MenuDidHighlightItem: "mac:MenuDidHighlightItem",
MenuDidOpen: "mac:MenuDidOpen",
MenuDidPopUp: "mac:MenuDidPopUp",
MenuDidRemoveItem: "mac:MenuDidRemoveItem",
MenuDidSendAction: "mac:MenuDidSendAction",
MenuDidSendActionToItem: "mac:MenuDidSendActionToItem",
MenuDidUpdate: "mac:MenuDidUpdate",
MenuWillAddItem: "mac:MenuWillAddItem",
MenuWillBeginTracking: "mac:MenuWillBeginTracking",
MenuWillDisplayItem: "mac:MenuWillDisplayItem",
MenuWillEndTracking: "mac:MenuWillEndTracking",
MenuWillHighlightItem: "mac:MenuWillHighlightItem",
MenuWillOpen: "mac:MenuWillOpen",
MenuWillPopUp: "mac:MenuWillPopUp",
MenuWillRemoveItem: "mac:MenuWillRemoveItem",
MenuWillSendAction: "mac:MenuWillSendAction",
MenuWillSendActionToItem: "mac:MenuWillSendActionToItem",
MenuWillUpdate: "mac:MenuWillUpdate",
WebViewDidCommitNavigation: "mac:WebViewDidCommitNavigation",
WebViewDidFinishNavigation: "mac:WebViewDidFinishNavigation",
WebViewDidReceiveServerRedirectForProvisionalNavigation: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
WebViewDidStartProvisionalNavigation: "mac:WebViewDidStartProvisionalNavigation",
WindowDidBecomeKey: "mac:WindowDidBecomeKey",
WindowDidBecomeMain: "mac:WindowDidBecomeMain",
WindowDidBeginSheet: "mac:WindowDidBeginSheet",
WindowDidChangeAlpha: "mac:WindowDidChangeAlpha",
WindowDidChangeBackingLocation: "mac:WindowDidChangeBackingLocation",
WindowDidChangeBackingProperties: "mac:WindowDidChangeBackingProperties",
WindowDidChangeCollectionBehavior: "mac:WindowDidChangeCollectionBehavior",
WindowDidChangeEffectiveAppearance: "mac:WindowDidChangeEffectiveAppearance",
WindowDidChangeOcclusionState: "mac:WindowDidChangeOcclusionState",
WindowDidChangeOrderingMode: "mac:WindowDidChangeOrderingMode",
WindowDidChangeScreen: "mac:WindowDidChangeScreen",
WindowDidChangeScreenParameters: "mac:WindowDidChangeScreenParameters",
WindowDidChangeScreenProfile: "mac:WindowDidChangeScreenProfile",
WindowDidChangeScreenSpace: "mac:WindowDidChangeScreenSpace",
WindowDidChangeScreenSpaceProperties: "mac:WindowDidChangeScreenSpaceProperties",
WindowDidChangeSharingType: "mac:WindowDidChangeSharingType",
WindowDidChangeSpace: "mac:WindowDidChangeSpace",
WindowDidChangeSpaceOrderingMode: "mac:WindowDidChangeSpaceOrderingMode",
WindowDidChangeTitle: "mac:WindowDidChangeTitle",
WindowDidChangeToolbar: "mac:WindowDidChangeToolbar",
WindowDidDeminiaturize: "mac:WindowDidDeminiaturize",
WindowDidEndSheet: "mac:WindowDidEndSheet",
WindowDidEnterFullScreen: "mac:WindowDidEnterFullScreen",
WindowDidEnterVersionBrowser: "mac:WindowDidEnterVersionBrowser",
WindowDidExitFullScreen: "mac:WindowDidExitFullScreen",
WindowDidExitVersionBrowser: "mac:WindowDidExitVersionBrowser",
WindowDidExpose: "mac:WindowDidExpose",
WindowDidFocus: "mac:WindowDidFocus",
WindowDidMiniaturize: "mac:WindowDidMiniaturize",
WindowDidMove: "mac:WindowDidMove",
WindowDidOrderOffScreen: "mac:WindowDidOrderOffScreen",
WindowDidOrderOnScreen: "mac:WindowDidOrderOnScreen",
WindowDidResignKey: "mac:WindowDidResignKey",
WindowDidResignMain: "mac:WindowDidResignMain",
WindowDidResize: "mac:WindowDidResize",
WindowDidUpdate: "mac:WindowDidUpdate",
WindowDidUpdateAlpha: "mac:WindowDidUpdateAlpha",
WindowDidUpdateCollectionBehavior: "mac:WindowDidUpdateCollectionBehavior",
WindowDidUpdateCollectionProperties: "mac:WindowDidUpdateCollectionProperties",
WindowDidUpdateShadow: "mac:WindowDidUpdateShadow",
WindowDidUpdateTitle: "mac:WindowDidUpdateTitle",
WindowDidUpdateToolbar: "mac:WindowDidUpdateToolbar",
WindowDidZoom: "mac:WindowDidZoom",
WindowFileDraggingEntered: "mac:WindowFileDraggingEntered",
WindowFileDraggingExited: "mac:WindowFileDraggingExited",
WindowFileDraggingPerformed: "mac:WindowFileDraggingPerformed",
WindowHide: "mac:WindowHide",
WindowMaximise: "mac:WindowMaximise",
WindowUnMaximise: "mac:WindowUnMaximise",
WindowMinimise: "mac:WindowMinimise",
WindowUnMinimise: "mac:WindowUnMinimise",
WindowShouldClose: "mac:WindowShouldClose",
WindowShow: "mac:WindowShow",
WindowWillBecomeKey: "mac:WindowWillBecomeKey",
WindowWillBecomeMain: "mac:WindowWillBecomeMain",
WindowWillBeginSheet: "mac:WindowWillBeginSheet",
WindowWillChangeOrderingMode: "mac:WindowWillChangeOrderingMode",
WindowWillClose: "mac:WindowWillClose",
WindowWillDeminiaturize: "mac:WindowWillDeminiaturize",
WindowWillEnterFullScreen: "mac:WindowWillEnterFullScreen",
WindowWillEnterVersionBrowser: "mac:WindowWillEnterVersionBrowser",
WindowWillExitFullScreen: "mac:WindowWillExitFullScreen",
WindowWillExitVersionBrowser: "mac:WindowWillExitVersionBrowser",
WindowWillFocus: "mac:WindowWillFocus",
WindowWillMiniaturize: "mac:WindowWillMiniaturize",
WindowWillMove: "mac:WindowWillMove",
WindowWillOrderOffScreen: "mac:WindowWillOrderOffScreen",
WindowWillOrderOnScreen: "mac:WindowWillOrderOnScreen",
WindowWillResignMain: "mac:WindowWillResignMain",
WindowWillResize: "mac:WindowWillResize",
WindowWillUnfocus: "mac:WindowWillUnfocus",
WindowWillUpdate: "mac:WindowWillUpdate",
WindowWillUpdateAlpha: "mac:WindowWillUpdateAlpha",
WindowWillUpdateCollectionBehavior: "mac:WindowWillUpdateCollectionBehavior",
WindowWillUpdateCollectionProperties: "mac:WindowWillUpdateCollectionProperties",
WindowWillUpdateShadow: "mac:WindowWillUpdateShadow",
WindowWillUpdateTitle: "mac:WindowWillUpdateTitle",
WindowWillUpdateToolbar: "mac:WindowWillUpdateToolbar",
WindowWillUpdateVisibility: "mac:WindowWillUpdateVisibility",
WindowWillUseStandardFrame: "mac:WindowWillUseStandardFrame",
WindowZoomIn: "mac:WindowZoomIn",
WindowZoomOut: "mac:WindowZoomOut",
WindowZoomReset: "mac:WindowZoomReset",
}),
Linux: Object.freeze({
ApplicationStartup: "linux:ApplicationStartup",
SystemThemeChanged: "linux:SystemThemeChanged",
WindowDeleteEvent: "linux:WindowDeleteEvent",
WindowDidMove: "linux:WindowDidMove",
WindowDidResize: "linux:WindowDidResize",
WindowFocusIn: "linux:WindowFocusIn",
WindowFocusOut: "linux:WindowFocusOut",
WindowLoadChanged: "linux:WindowLoadChanged",
}),
Common: Object.freeze({
ApplicationOpenedWithFile: "common:ApplicationOpenedWithFile",
ApplicationStarted: "common:ApplicationStarted",
ThemeChanged: "common:ThemeChanged",
WindowClosing: "common:WindowClosing",
WindowDidMove: "common:WindowDidMove",
WindowDidResize: "common:WindowDidResize",
WindowDPIChanged: "common:WindowDPIChanged",
WindowFilesDropped: "common:WindowFilesDropped",
WindowFocus: "common:WindowFocus",
WindowFullscreen: "common:WindowFullscreen",
WindowHide: "common:WindowHide",
WindowLostFocus: "common:WindowLostFocus",
WindowMaximise: "common:WindowMaximise",
WindowMinimise: "common:WindowMinimise",
WindowRestore: "common:WindowRestore",
WindowRuntimeReady: "common:WindowRuntimeReady",
WindowShow: "common:WindowShow",
WindowUnFullscreen: "common:WindowUnFullscreen",
WindowUnMaximise: "common:WindowUnMaximise",
WindowUnMinimise: "common:WindowUnMinimise",
WindowZoom: "common:WindowZoom",
WindowZoomIn: "common:WindowZoomIn",
WindowZoomOut: "common:WindowZoomOut",
WindowZoomReset: "common:WindowZoomReset",
}),
});

101
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/events.js

@ -1,101 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
import { eventListeners, Listener, listenerOff } from "./listener.js";
// Setup
window._wails = window._wails || {};
window._wails.dispatchWailsEvent = dispatchWailsEvent;
const call = newRuntimeCaller(objectNames.Events);
const EmitMethod = 0;
export { Types } from "./event_types.js";
/**
* Represents a system event or a custom event emitted through wails-provided facilities.
*/
export class WailsEvent {
constructor(name, data = null) {
this.name = name;
this.data = data;
}
}
function dispatchWailsEvent(event) {
let listeners = eventListeners.get(event.name);
if (!listeners) {
return;
}
let wailsEvent = new WailsEvent(event.name, event.data);
if ('sender' in event) {
wailsEvent.sender = event.sender;
}
listeners = listeners.filter(listener => !listener.dispatch(wailsEvent));
if (listeners.length === 0) {
eventListeners.delete(event.name);
}
else {
eventListeners.set(event.name, listeners);
}
}
/**
* Register a callback function to be called multiple times for a specific event.
*
* @param eventName - The name of the event to register the callback for.
* @param callback - The callback function to be called when the event is triggered.
* @param maxCallbacks - The maximum number of times the callback can be called for the event. Once the maximum number is reached, the callback will no longer be called.
* @returns A function that, when called, will unregister the callback from the event.
*/
export function OnMultiple(eventName, callback, maxCallbacks) {
let listeners = eventListeners.get(eventName) || [];
const thisListener = new Listener(eventName, callback, maxCallbacks);
listeners.push(thisListener);
eventListeners.set(eventName, listeners);
return () => listenerOff(thisListener);
}
/**
* Registers a callback function to be executed when the specified event occurs.
*
* @param eventName - The name of the event to register the callback for.
* @param callback - The callback function to be called when the event is triggered.
* @returns A function that, when called, will unregister the callback from the event.
*/
export function On(eventName, callback) {
return OnMultiple(eventName, callback, -1);
}
/**
* Registers a callback function to be executed only once for the specified event.
*
* @param eventName - The name of the event to register the callback for.
* @param callback - The callback function to be called when the event is triggered.
* @returns A function that, when called, will unregister the callback from the event.
*/
export function Once(eventName, callback) {
return OnMultiple(eventName, callback, 1);
}
/**
* Removes event listeners for the specified event names.
*
* @param eventNames - The name of the events to remove listeners for.
*/
export function Off(...eventNames) {
eventNames.forEach(eventName => eventListeners.delete(eventName));
}
/**
* Removes all event listeners.
*/
export function OffAll() {
eventListeners.clear();
}
/**
* Emits the given event.
*
* @param event - The name of the event to emit.
* @returns A promise that will be fulfilled once the event has been emitted.
*/
export function Emit(event) {
return call(EmitMethod, event);
}

23
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/flags.js

@ -1,23 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
/**
* Retrieves the value associated with the specified key from the flag map.
*
* @param key - The key to retrieve the value for.
* @return The value associated with the specified key.
*/
export function GetFlag(key) {
try {
return window._wails.flags[key];
}
catch (e) {
throw new Error("Unable to retrieve flag '" + key + "': " + e, { cause: e });
}
}

38
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/index.js

@ -1,38 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
// Setup
window._wails = window._wails || {};
import "./contextmenu.js";
import "./drag.js";
// Re-export public API
import * as Application from "./application.js";
import * as Browser from "./browser.js";
import * as Call from "./calls.js";
import * as Clipboard from "./clipboard.js";
import * as Create from "./create.js";
import * as Dialogs from "./dialogs.js";
import * as Events from "./events.js";
import * as Flags from "./flags.js";
import * as Screens from "./screens.js";
import * as System from "./system.js";
import Window from "./window.js";
import * as WML from "./wml.js";
export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens, System, Window, WML };
/**
* An internal utility consumed by the binding generator.
*
* @ignore
* @internal
*/
export { Create };
export * from "./cancellable.js";
// Notify backend
window._wails.invoke = System.invoke;
System.invoke("wails:runtime:ready");

44
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/listener.js

@ -1,44 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
// The following utilities have been factored out of ./events.ts
// for testing purposes.
export const eventListeners = new Map();
export class Listener {
constructor(eventName, callback, maxCallbacks) {
this.eventName = eventName;
this.callback = callback;
this.maxCallbacks = maxCallbacks || -1;
}
dispatch(data) {
try {
this.callback(data);
}
catch (err) {
console.error(err);
}
if (this.maxCallbacks === -1)
return false;
this.maxCallbacks -= 1;
return this.maxCallbacks === 0;
}
}
export function listenerOff(listener) {
let listeners = eventListeners.get(listener.eventName);
if (!listeners) {
return;
}
listeners = listeners.filter(l => l !== listener);
if (listeners.length === 0) {
eventListeners.delete(listener.eventName);
}
else {
eventListeners.set(listener.eventName, listeners);
}
}

38
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/nanoid.js

@ -1,38 +0,0 @@
// Source: https://github.com/ai/nanoid
// The MIT License (MIT)
//
// Copyright 2017 Andrey Sitnik <andrey@sitnik.ru>
//
// 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.
// This alphabet uses `A-Za-z0-9_-` symbols.
// The order of characters is optimized for better gzip and brotli compression.
// References to the same file (works both for gzip and brotli):
// `'use`, `andom`, and `rict'`
// References to the brotli default dictionary:
// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
const urlAlphabet = 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
export function nanoid(size = 21) {
let id = '';
// A compact alternative for `for (var i = 0; i < step; i++)`.
let i = size | 0;
while (i--) {
// `| 0` is more compact and faster than `Math.floor()`.
id += urlAlphabet[(Math.random() * 64) | 0];
}
return id;
}

63
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/runtime.js

@ -1,63 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { nanoid } from './nanoid.js';
const runtimeURL = window.location.origin + "/wails/runtime";
// Object Names
export const objectNames = Object.freeze({
Call: 0,
Clipboard: 1,
Application: 2,
Events: 3,
ContextMenu: 4,
Dialog: 5,
Window: 6,
Screens: 7,
System: 8,
Browser: 9,
CancelCall: 10,
});
export let clientId = nanoid();
/**
* Creates a new runtime caller with specified ID.
*
* @param object - The object to invoke the method on.
* @param windowName - The name of the window.
* @return The new runtime caller function.
*/
export function newRuntimeCaller(object, windowName = '') {
return function (method, args = null) {
return runtimeCallWithID(object, method, windowName, args);
};
}
async function runtimeCallWithID(objectID, method, windowName, args) {
var _a, _b;
let url = new URL(runtimeURL);
url.searchParams.append("object", objectID.toString());
url.searchParams.append("method", method.toString());
if (args) {
url.searchParams.append("args", JSON.stringify(args));
}
let headers = {
["x-wails-client-id"]: clientId
};
if (windowName) {
headers["x-wails-window-name"] = windowName;
}
let response = await fetch(url, { headers });
if (!response.ok) {
throw new Error(await response.text());
}
if (((_b = (_a = response.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.indexOf("application/json")) !== null && _b !== void 0 ? _b : -1) !== -1) {
return response.json();
}
else {
return response.text();
}
}

38
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/screens.js

@ -1,38 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
const call = newRuntimeCaller(objectNames.Screens);
const getAll = 0;
const getPrimary = 1;
const getCurrent = 2;
/**
* Gets all screens.
*
* @returns A promise that resolves to an array of Screen objects.
*/
export function GetAll() {
return call(getAll);
}
/**
* Gets the primary screen.
*
* @returns A promise that resolves to the primary screen.
*/
export function GetPrimary() {
return call(getPrimary);
}
/**
* Gets the current active screen.
*
* @returns A promise that resolves with the current active screen.
*/
export function GetCurrent() {
return call(getCurrent);
}

116
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/system.js

@ -1,116 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
const call = newRuntimeCaller(objectNames.System);
const SystemIsDarkMode = 0;
const SystemEnvironment = 1;
const _invoke = (function () {
var _a, _b, _c, _d, _e;
try {
if ((_b = (_a = window.chrome) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.postMessage) {
return window.chrome.webview.postMessage.bind(window.chrome.webview);
}
else if ((_e = (_d = (_c = window.webkit) === null || _c === void 0 ? void 0 : _c.messageHandlers) === null || _d === void 0 ? void 0 : _d['external']) === null || _e === void 0 ? void 0 : _e.postMessage) {
return window.webkit.messageHandlers['external'].postMessage.bind(window.webkit.messageHandlers['external']);
}
}
catch (e) { }
console.warn('\n%c⚠️ Browser Environment Detected %c\n\n%cOnly UI previews are available in the browser. For full functionality, please run the application in desktop mode.\nMore information at: https://v3.wails.io/learn/build/#using-a-browser-for-development\n', 'background: #ffffff; color: #000000; font-weight: bold; padding: 4px 8px; border-radius: 4px; border: 2px solid #000000;', 'background: transparent;', 'color: #ffffff; font-style: italic; font-weight: bold;');
return null;
})();
export function invoke(msg) {
_invoke === null || _invoke === void 0 ? void 0 : _invoke(msg);
}
/**
* Retrieves the system dark mode status.
*
* @returns A promise that resolves to a boolean value indicating if the system is in dark mode.
*/
export function IsDarkMode() {
return call(SystemIsDarkMode);
}
/**
* Fetches the capabilities of the application from the server.
*
* @returns A promise that resolves to an object containing the capabilities.
*/
export async function Capabilities() {
let response = await fetch("/wails/capabilities");
if (response.ok) {
return response.json();
}
else {
throw new Error("could not fetch capabilities: " + response.statusText);
}
}
/**
* Retrieves environment details.
*
* @returns A promise that resolves to an object containing OS and system architecture.
*/
export function Environment() {
return call(SystemEnvironment);
}
/**
* Checks if the current operating system is Windows.
*
* @return True if the operating system is Windows, otherwise false.
*/
export function IsWindows() {
return window._wails.environment.OS === "windows";
}
/**
* Checks if the current operating system is Linux.
*
* @returns Returns true if the current operating system is Linux, false otherwise.
*/
export function IsLinux() {
return window._wails.environment.OS === "linux";
}
/**
* Checks if the current environment is a macOS operating system.
*
* @returns True if the environment is macOS, false otherwise.
*/
export function IsMac() {
return window._wails.environment.OS === "darwin";
}
/**
* Checks if the current environment architecture is AMD64.
*
* @returns True if the current environment architecture is AMD64, false otherwise.
*/
export function IsAMD64() {
return window._wails.environment.Arch === "amd64";
}
/**
* Checks if the current architecture is ARM.
*
* @returns True if the current architecture is ARM, false otherwise.
*/
export function IsARM() {
return window._wails.environment.Arch === "arm";
}
/**
* Checks if the current environment is ARM64 architecture.
*
* @returns Returns true if the environment is ARM64 architecture, otherwise returns false.
*/
export function IsARM64() {
return window._wails.environment.Arch === "arm64";
}
/**
* Reports whether the app is being run in debug mode.
*
* @returns True if the app is being run in debug mode.
*/
export function IsDebug() {
return Boolean(window._wails.environment.Debug);
}

95
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/utils.js

@ -1,95 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
/**
* Logs a message to the console with custom formatting.
*
* @param message - The message to be logged.
*/
export function debugLog(message) {
// eslint-disable-next-line
console.log('%c wails3 %c ' + message + ' ', 'background: #aa0000; color: #fff; border-radius: 3px 0px 0px 3px; padding: 1px; font-size: 0.7rem', 'background: #009900; color: #fff; border-radius: 0px 3px 3px 0px; padding: 1px; font-size: 0.7rem');
}
/**
* Checks whether the webview supports the {@link MouseEvent#buttons} property.
* Looking at you macOS High Sierra!
*/
export function canTrackButtons() {
return (new MouseEvent('mousedown')).buttons === 0;
}
/**
* Checks whether the browser supports removing listeners by triggering an AbortSignal
* (see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal).
*/
export function canAbortListeners() {
if (!EventTarget || !AbortSignal || !AbortController)
return false;
let result = true;
const target = new EventTarget();
const controller = new AbortController();
target.addEventListener('test', () => { result = false; }, { signal: controller.signal });
controller.abort();
target.dispatchEvent(new CustomEvent('test'));
return result;
}
/**
* Resolves the closest HTMLElement ancestor of an event's target.
*/
export function eventTarget(event) {
var _a;
if (event.target instanceof HTMLElement) {
return event.target;
}
else if (!(event.target instanceof HTMLElement) && event.target instanceof Node) {
return (_a = event.target.parentElement) !== null && _a !== void 0 ? _a : document.body;
}
else {
return document.body;
}
}
/***
This technique for proper load detection is taken from HTMX:
BSD 2-Clause License
Copyright (c) 2020, Big Sky Software
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***/
let isReady = false;
document.addEventListener('DOMContentLoaded', () => { isReady = true; });
export function whenReady(callback) {
if (isReady || document.readyState === 'complete') {
callback();
}
else {
document.addEventListener('DOMContentLoaded', callback);
}
}

438
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/window.js

@ -1,438 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { newRuntimeCaller, objectNames } from "./runtime.js";
const PositionMethod = 0;
const CenterMethod = 1;
const CloseMethod = 2;
const DisableSizeConstraintsMethod = 3;
const EnableSizeConstraintsMethod = 4;
const FocusMethod = 5;
const ForceReloadMethod = 6;
const FullscreenMethod = 7;
const GetScreenMethod = 8;
const GetZoomMethod = 9;
const HeightMethod = 10;
const HideMethod = 11;
const IsFocusedMethod = 12;
const IsFullscreenMethod = 13;
const IsMaximisedMethod = 14;
const IsMinimisedMethod = 15;
const MaximiseMethod = 16;
const MinimiseMethod = 17;
const NameMethod = 18;
const OpenDevToolsMethod = 19;
const RelativePositionMethod = 20;
const ReloadMethod = 21;
const ResizableMethod = 22;
const RestoreMethod = 23;
const SetPositionMethod = 24;
const SetAlwaysOnTopMethod = 25;
const SetBackgroundColourMethod = 26;
const SetFramelessMethod = 27;
const SetFullscreenButtonEnabledMethod = 28;
const SetMaxSizeMethod = 29;
const SetMinSizeMethod = 30;
const SetRelativePositionMethod = 31;
const SetResizableMethod = 32;
const SetSizeMethod = 33;
const SetTitleMethod = 34;
const SetZoomMethod = 35;
const ShowMethod = 36;
const SizeMethod = 37;
const ToggleFullscreenMethod = 38;
const ToggleMaximiseMethod = 39;
const UnFullscreenMethod = 40;
const UnMaximiseMethod = 41;
const UnMinimiseMethod = 42;
const WidthMethod = 43;
const ZoomMethod = 44;
const ZoomInMethod = 45;
const ZoomOutMethod = 46;
const ZoomResetMethod = 47;
// Private field names.
const callerSym = Symbol("caller");
class Window {
/**
* Initialises a window object with the specified name.
*
* @private
* @param name - The name of the target window.
*/
constructor(name = '') {
this[callerSym] = newRuntimeCaller(objectNames.Window, name);
// bind instance method to make them easily usable in event handlers
for (const method of Object.getOwnPropertyNames(Window.prototype)) {
if (method !== "constructor"
&& typeof this[method] === "function") {
this[method] = this[method].bind(this);
}
}
}
/**
* Gets the specified window.
*
* @param name - The name of the window to get.
* @returns The corresponding window object.
*/
Get(name) {
return new Window(name);
}
/**
* Returns the absolute position of the window.
*
* @returns The current absolute position of the window.
*/
Position() {
return this[callerSym](PositionMethod);
}
/**
* Centers the window on the screen.
*/
Center() {
return this[callerSym](CenterMethod);
}
/**
* Closes the window.
*/
Close() {
return this[callerSym](CloseMethod);
}
/**
* Disables min/max size constraints.
*/
DisableSizeConstraints() {
return this[callerSym](DisableSizeConstraintsMethod);
}
/**
* Enables min/max size constraints.
*/
EnableSizeConstraints() {
return this[callerSym](EnableSizeConstraintsMethod);
}
/**
* Focuses the window.
*/
Focus() {
return this[callerSym](FocusMethod);
}
/**
* Forces the window to reload the page assets.
*/
ForceReload() {
return this[callerSym](ForceReloadMethod);
}
/**
* Switches the window to fullscreen mode.
*/
Fullscreen() {
return this[callerSym](FullscreenMethod);
}
/**
* Returns the screen that the window is on.
*
* @returns The screen the window is currently on.
*/
GetScreen() {
return this[callerSym](GetScreenMethod);
}
/**
* Returns the current zoom level of the window.
*
* @returns The current zoom level.
*/
GetZoom() {
return this[callerSym](GetZoomMethod);
}
/**
* Returns the height of the window.
*
* @returns The current height of the window.
*/
Height() {
return this[callerSym](HeightMethod);
}
/**
* Hides the window.
*/
Hide() {
return this[callerSym](HideMethod);
}
/**
* Returns true if the window is focused.
*
* @returns Whether the window is currently focused.
*/
IsFocused() {
return this[callerSym](IsFocusedMethod);
}
/**
* Returns true if the window is fullscreen.
*
* @returns Whether the window is currently fullscreen.
*/
IsFullscreen() {
return this[callerSym](IsFullscreenMethod);
}
/**
* Returns true if the window is maximised.
*
* @returns Whether the window is currently maximised.
*/
IsMaximised() {
return this[callerSym](IsMaximisedMethod);
}
/**
* Returns true if the window is minimised.
*
* @returns Whether the window is currently minimised.
*/
IsMinimised() {
return this[callerSym](IsMinimisedMethod);
}
/**
* Maximises the window.
*/
Maximise() {
return this[callerSym](MaximiseMethod);
}
/**
* Minimises the window.
*/
Minimise() {
return this[callerSym](MinimiseMethod);
}
/**
* Returns the name of the window.
*
* @returns The name of the window.
*/
Name() {
return this[callerSym](NameMethod);
}
/**
* Opens the development tools pane.
*/
OpenDevTools() {
return this[callerSym](OpenDevToolsMethod);
}
/**
* Returns the relative position of the window to the screen.
*
* @returns The current relative position of the window.
*/
RelativePosition() {
return this[callerSym](RelativePositionMethod);
}
/**
* Reloads the page assets.
*/
Reload() {
return this[callerSym](ReloadMethod);
}
/**
* Returns true if the window is resizable.
*
* @returns Whether the window is currently resizable.
*/
Resizable() {
return this[callerSym](ResizableMethod);
}
/**
* Restores the window to its previous state if it was previously minimised, maximised or fullscreen.
*/
Restore() {
return this[callerSym](RestoreMethod);
}
/**
* Sets the absolute position of the window.
*
* @param x - The desired horizontal absolute position of the window.
* @param y - The desired vertical absolute position of the window.
*/
SetPosition(x, y) {
return this[callerSym](SetPositionMethod, { x, y });
}
/**
* Sets the window to be always on top.
*
* @param alwaysOnTop - Whether the window should stay on top.
*/
SetAlwaysOnTop(alwaysOnTop) {
return this[callerSym](SetAlwaysOnTopMethod, { alwaysOnTop });
}
/**
* Sets the background colour of the window.
*
* @param r - The desired red component of the window background.
* @param g - The desired green component of the window background.
* @param b - The desired blue component of the window background.
* @param a - The desired alpha component of the window background.
*/
SetBackgroundColour(r, g, b, a) {
return this[callerSym](SetBackgroundColourMethod, { r, g, b, a });
}
/**
* Removes the window frame and title bar.
*
* @param frameless - Whether the window should be frameless.
*/
SetFrameless(frameless) {
return this[callerSym](SetFramelessMethod, { frameless });
}
/**
* Disables the system fullscreen button.
*
* @param enabled - Whether the fullscreen button should be enabled.
*/
SetFullscreenButtonEnabled(enabled) {
return this[callerSym](SetFullscreenButtonEnabledMethod, { enabled });
}
/**
* Sets the maximum size of the window.
*
* @param width - The desired maximum width of the window.
* @param height - The desired maximum height of the window.
*/
SetMaxSize(width, height) {
return this[callerSym](SetMaxSizeMethod, { width, height });
}
/**
* Sets the minimum size of the window.
*
* @param width - The desired minimum width of the window.
* @param height - The desired minimum height of the window.
*/
SetMinSize(width, height) {
return this[callerSym](SetMinSizeMethod, { width, height });
}
/**
* Sets the relative position of the window to the screen.
*
* @param x - The desired horizontal relative position of the window.
* @param y - The desired vertical relative position of the window.
*/
SetRelativePosition(x, y) {
return this[callerSym](SetRelativePositionMethod, { x, y });
}
/**
* Sets whether the window is resizable.
*
* @param resizable - Whether the window should be resizable.
*/
SetResizable(resizable) {
return this[callerSym](SetResizableMethod, { resizable });
}
/**
* Sets the size of the window.
*
* @param width - The desired width of the window.
* @param height - The desired height of the window.
*/
SetSize(width, height) {
return this[callerSym](SetSizeMethod, { width, height });
}
/**
* Sets the title of the window.
*
* @param title - The desired title of the window.
*/
SetTitle(title) {
return this[callerSym](SetTitleMethod, { title });
}
/**
* Sets the zoom level of the window.
*
* @param zoom - The desired zoom level.
*/
SetZoom(zoom) {
return this[callerSym](SetZoomMethod, { zoom });
}
/**
* Shows the window.
*/
Show() {
return this[callerSym](ShowMethod);
}
/**
* Returns the size of the window.
*
* @returns The current size of the window.
*/
Size() {
return this[callerSym](SizeMethod);
}
/**
* Toggles the window between fullscreen and normal.
*/
ToggleFullscreen() {
return this[callerSym](ToggleFullscreenMethod);
}
/**
* Toggles the window between maximised and normal.
*/
ToggleMaximise() {
return this[callerSym](ToggleMaximiseMethod);
}
/**
* Un-fullscreens the window.
*/
UnFullscreen() {
return this[callerSym](UnFullscreenMethod);
}
/**
* Un-maximises the window.
*/
UnMaximise() {
return this[callerSym](UnMaximiseMethod);
}
/**
* Un-minimises the window.
*/
UnMinimise() {
return this[callerSym](UnMinimiseMethod);
}
/**
* Returns the width of the window.
*
* @returns The current width of the window.
*/
Width() {
return this[callerSym](WidthMethod);
}
/**
* Zooms the window.
*/
Zoom() {
return this[callerSym](ZoomMethod);
}
/**
* Increases the zoom level of the webview content.
*/
ZoomIn() {
return this[callerSym](ZoomInMethod);
}
/**
* Decreases the zoom level of the webview content.
*/
ZoomOut() {
return this[callerSym](ZoomOutMethod);
}
/**
* Resets the zoom level of the webview content.
*/
ZoomReset() {
return this[callerSym](ZoomResetMethod);
}
}
/**
* The window within which the script is running.
*/
const thisWindow = new Window('');
export default thisWindow;

179
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/dist/wml.js

@ -1,179 +0,0 @@
/*
_ __ _ __
| | / /___ _(_) /____
| | /| / / __ `/ / / ___/
| |/ |/ / /_/ / / (__ )
|__/|__/\__,_/_/_/____/
The electron alternative for Go
(c) Lea Anthony 2019-present
*/
import { OpenURL } from "./browser.js";
import { Question } from "./dialogs.js";
import { Emit, WailsEvent } from "./events.js";
import { canAbortListeners, whenReady } from "./utils.js";
import Window from "./window.js";
/**
* Sends an event with the given name and optional data.
*
* @param eventName - - The name of the event to send.
* @param [data=null] - - Optional data to send along with the event.
*/
function sendEvent(eventName, data = null) {
Emit(new WailsEvent(eventName, data));
}
/**
* Calls a method on a specified window.
*
* @param windowName - The name of the window to call the method on.
* @param methodName - The name of the method to call.
*/
function callWindowMethod(windowName, methodName) {
const targetWindow = Window.Get(windowName);
const method = targetWindow[methodName];
if (typeof method !== "function") {
console.error(`Window method '${methodName}' not found`);
return;
}
try {
method.call(targetWindow);
}
catch (e) {
console.error(`Error calling window method '${methodName}': `, e);
}
}
/**
* Responds to a triggering event by running appropriate WML actions for the current target.
*/
function onWMLTriggered(ev) {
const element = ev.currentTarget;
function runEffect(choice = "Yes") {
if (choice !== "Yes")
return;
const eventType = element.getAttribute('wml-event') || element.getAttribute('data-wml-event');
const targetWindow = element.getAttribute('wml-target-window') || element.getAttribute('data-wml-target-window') || "";
const windowMethod = element.getAttribute('wml-window') || element.getAttribute('data-wml-window');
const url = element.getAttribute('wml-openurl') || element.getAttribute('data-wml-openurl');
if (eventType !== null)
sendEvent(eventType);
if (windowMethod !== null)
callWindowMethod(targetWindow, windowMethod);
if (url !== null)
void OpenURL(url);
}
const confirm = element.getAttribute('wml-confirm') || element.getAttribute('data-wml-confirm');
if (confirm) {
Question({
Title: "Confirm",
Message: confirm,
Detached: false,
Buttons: [
{ Label: "Yes" },
{ Label: "No", IsDefault: true }
]
}).then(runEffect);
}
else {
runEffect();
}
}
// Private field names.
const controllerSym = Symbol("controller");
const triggerMapSym = Symbol("triggerMap");
const elementCountSym = Symbol("elementCount");
/**
* AbortControllerRegistry does not actually remember active event listeners: instead
* it ties them to an AbortSignal and uses an AbortController to remove them all at once.
*/
class AbortControllerRegistry {
constructor() {
this[controllerSym] = new AbortController();
}
/**
* Returns an options object for addEventListener that ties the listener
* to the AbortSignal from the current AbortController.
*
* @param element - An HTML element
* @param triggers - The list of active WML trigger events for the specified elements
*/
set(element, triggers) {
return { signal: this[controllerSym].signal };
}
/**
* Removes all registered event listeners and resets the registry.
*/
reset() {
this[controllerSym].abort();
this[controllerSym] = new AbortController();
}
}
/**
* WeakMapRegistry maps active trigger events to each DOM element through a WeakMap.
* This ensures that the mapping remains private to this module, while still allowing garbage
* collection of the involved elements.
*/
class WeakMapRegistry {
constructor() {
this[triggerMapSym] = new WeakMap();
this[elementCountSym] = 0;
}
/**
* Sets active triggers for the specified element.
*
* @param element - An HTML element
* @param triggers - The list of active WML trigger events for the specified element
*/
set(element, triggers) {
if (!this[triggerMapSym].has(element)) {
this[elementCountSym]++;
}
this[triggerMapSym].set(element, triggers);
return {};
}
/**
* Removes all registered event listeners.
*/
reset() {
if (this[elementCountSym] <= 0)
return;
for (const element of document.body.querySelectorAll('*')) {
if (this[elementCountSym] <= 0)
break;
const triggers = this[triggerMapSym].get(element);
if (triggers != null) {
this[elementCountSym]--;
}
for (const trigger of triggers || [])
element.removeEventListener(trigger, onWMLTriggered);
}
this[triggerMapSym] = new WeakMap();
this[elementCountSym] = 0;
}
}
const triggerRegistry = canAbortListeners() ? new AbortControllerRegistry() : new WeakMapRegistry();
/**
* Adds event listeners to the specified element.
*/
function addWMLListeners(element) {
const triggerRegExp = /\S+/g;
const triggerAttr = (element.getAttribute('wml-trigger') || element.getAttribute('data-wml-trigger') || "click");
const triggers = [];
let match;
while ((match = triggerRegExp.exec(triggerAttr)) !== null)
triggers.push(match[0]);
const options = triggerRegistry.set(element, triggers);
for (const trigger of triggers)
element.addEventListener(trigger, onWMLTriggered, options);
}
/**
* Schedules an automatic reload of WML to be performed as soon as the document is fully loaded.
*/
export function Enable() {
whenReady(Reload);
}
/**
* Reloads the WML page by adding necessary event listeners and browser listeners.
*/
export function Reload() {
triggerRegistry.reset();
document.body.querySelectorAll('[wml-event], [wml-window], [wml-openurl], [data-wml-event], [data-wml-window], [data-wml-openurl]').forEach(addWMLListeners);
}

62
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/package.json

@ -1,62 +0,0 @@
{
"name": "@wailsio/runtime",
"type": "module",
"version": "3.0.0-alpha.66",
"description": "Wails Runtime",
"types": "types/index.d.ts",
"exports": {
"types": "./types/index.d.ts",
"import": "./dist/index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/wailsapp/wails.git",
"directory": "v3/internal/runtime/desktop/@wailsio/runtime"
},
"author": "The Wails Team",
"license": "MIT",
"homepage": "https://v3.wails.io",
"bugs": {
"url": "https://github.com/wailsapp/wails/issues"
},
"files": [
"./dist",
"./types"
],
"sideEffects": [
"./dist/index.js",
"./dist/contextmenu.js",
"./dist/drag.js"
],
"scripts": {
"check": "npx tsc --noEmit",
"test": "npx vitest run",
"clean": "npx rimraf ./dist ./docs ./types ./tsconfig.tsbuildinfo",
"generate:events": "task generate:events",
"generate": "npm run generate:events",
"prebuild": "npm run clean && npm run generate",
"build:code": "npx tsc",
"build:docs": "npx typedoc --plugin typedoc-plugin-mdn-links --plugin typedoc-plugin-missing-exports ./src/index.ts",
"build:docs:md": "npx typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-mdn-links --plugin typedoc-plugin-missing-exports ./src/index.ts",
"build": "npm run build:code & npm run build:docs & wait",
"prepack": "npm run build"
},
"devDependencies": {
"happy-dom": "^17.1.1",
"promises-aplus-tests": "2.1.2",
"rimraf": "^5.0.5",
"typedoc": "^0.27.7",
"typedoc-plugin-markdown": "^4.4.2",
"typedoc-plugin-mdn-links": "^4.0.13",
"typedoc-plugin-missing-exports": "^3.1.0",
"typescript": "^5.7.3",
"vitest": "^3.0.6"
},
"overrides": {
"promises-aplus-tests": {
"mocha": "^11.1.0",
"sinon": "^19.0.2",
"underscore": "^1.13.7"
}
}
}

12
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/application.d.ts

@ -1,12 +0,0 @@
/**
* Hides a certain method by calling the HideMethod function.
*/
export declare function Hide(): Promise<void>;
/**
* Calls the ShowMethod and returns the result.
*/
export declare function Show(): Promise<void>;
/**
* Calls the QuitMethod to terminate the program.
*/
export declare function Quit(): Promise<void>;

6
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/browser.d.ts

@ -1,6 +0,0 @@
/**
* Open a browser window to the given URL.
*
* @param url - The URL to open
*/
export declare function OpenURL(url: string | URL): Promise<void>;

3
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/callable.d.ts

@ -1,3 +0,0 @@
declare function isCallableRefApply<T>(value: T | unknown): value is (...args: any[]) => any;
declare const _default: typeof isCallableRefApply;
export default _default;

63
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/calls.d.ts

@ -1,63 +0,0 @@
import { CancellablePromise } from "./cancellable.js";
/**
* Holds all required information for a binding call.
* May provide either a method ID or a method name, but not both.
*/
export type CallOptions = {
/** The numeric ID of the bound method to call. */
methodID: number;
/** The fully qualified name of the bound method to call. */
methodName?: never;
/** Arguments to be passed into the bound method. */
args: any[];
} | {
/** The numeric ID of the bound method to call. */
methodID?: never;
/** The fully qualified name of the bound method to call. */
methodName: string;
/** Arguments to be passed into the bound method. */
args: any[];
};
/**
* Exception class that will be thrown in case the bound method returns an error.
* The value of the {@link RuntimeError#name} property is "RuntimeError".
*/
export declare class RuntimeError extends Error {
/**
* Constructs a new RuntimeError instance.
* @param message - The error message.
* @param options - Options to be forwarded to the Error constructor.
*/
constructor(message?: string, options?: ErrorOptions);
}
/**
* Call a bound method according to the given call options.
*
* In case of failure, the returned promise will reject with an exception
* among ReferenceError (unknown method), TypeError (wrong argument count or type),
* {@link RuntimeError} (method returned an error), or other (network or internal errors).
* The exception might have a "cause" field with the value returned
* by the application- or service-level error marshaling functions.
*
* @param options - A method call descriptor.
* @returns The result of the call.
*/
export declare function Call(options: CallOptions): CancellablePromise<any>;
/**
* Calls a bound method by name with the specified arguments.
* See {@link Call} for details.
*
* @param methodName - The name of the method in the format 'package.struct.method'.
* @param args - The arguments to pass to the method.
* @returns The result of the method call.
*/
export declare function ByName(methodName: string, ...args: any[]): CancellablePromise<any>;
/**
* Calls a method by its numeric ID with the specified arguments.
* See {@link Call} for details.
*
* @param methodID - The ID of the method to call.
* @param args - The arguments to pass to the method.
* @return The result of the method call.
*/
export declare function ByID(methodID: number, ...args: any[]): CancellablePromise<any>;

434
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/cancellable.d.ts

@ -1,434 +0,0 @@
/**
* Exception class that will be used as rejection reason
* in case a {@link CancellablePromise} is cancelled successfully.
*
* The value of the {@link name} property is the string `"CancelError"`.
* The value of the {@link cause} property is the cause passed to the cancel method, if any.
*/
export declare class CancelError extends Error {
/**
* Constructs a new `CancelError` instance.
* @param message - The error message.
* @param options - Options to be forwarded to the Error constructor.
*/
constructor(message?: string, options?: ErrorOptions);
}
/**
* Exception class that will be reported as an unhandled rejection
* in case a {@link CancellablePromise} rejects after being cancelled,
* or when the `oncancelled` callback throws or rejects.
*
* The value of the {@link name} property is the string `"CancelledRejectionError"`.
* The value of the {@link cause} property is the reason the promise rejected with.
*
* Because the original promise was cancelled,
* a wrapper promise will be passed to the unhandled rejection listener instead.
* The {@link promise} property holds a reference to the original promise.
*/
export declare class CancelledRejectionError extends Error {
/**
* Holds a reference to the promise that was cancelled and then rejected.
*/
promise: CancellablePromise<unknown>;
/**
* Constructs a new `CancelledRejectionError` instance.
* @param promise - The promise that caused the error originally.
* @param reason - The rejection reason.
* @param info - An optional informative message specifying the circumstances in which the error was thrown.
* Defaults to the string `"Unhandled rejection in cancelled promise."`.
*/
constructor(promise: CancellablePromise<unknown>, reason?: any, info?: string);
}
type CancellablePromiseResolver<T> = (value: T | PromiseLike<T> | CancellablePromiseLike<T>) => void;
type CancellablePromiseRejector = (reason?: any) => void;
type CancellablePromiseCanceller = (cause?: any) => void | PromiseLike<void>;
type CancellablePromiseExecutor<T> = (resolve: CancellablePromiseResolver<T>, reject: CancellablePromiseRejector) => void;
export interface CancellablePromiseLike<T> {
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1> | CancellablePromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2> | CancellablePromiseLike<TResult2>) | undefined | null): CancellablePromiseLike<TResult1 | TResult2>;
cancel(cause?: any): void | PromiseLike<void>;
}
/**
* Wraps a cancellable promise along with its resolution methods.
* The `oncancelled` field will be null initially but may be set to provide a custom cancellation function.
*/
export interface CancellablePromiseWithResolvers<T> {
promise: CancellablePromise<T>;
resolve: CancellablePromiseResolver<T>;
reject: CancellablePromiseRejector;
oncancelled: CancellablePromiseCanceller | null;
}
/**
* A promise with an attached method for cancelling long-running operations (see {@link CancellablePromise#cancel}).
* Cancellation can optionally be bound to an {@link AbortSignal}
* for better composability (see {@link CancellablePromise#cancelOn}).
*
* Cancelling a pending promise will result in an immediate rejection
* with an instance of {@link CancelError} as reason,
* but whoever started the promise will be responsible
* for actually aborting the underlying operation.
* To this purpose, the constructor and all chaining methods
* accept optional cancellation callbacks.
*
* If a `CancellablePromise` still resolves after having been cancelled,
* the result will be discarded. If it rejects, the reason
* will be reported as an unhandled rejection,
* wrapped in a {@link CancelledRejectionError} instance.
* To facilitate the handling of cancellation requests,
* cancelled `CancellablePromise`s will _not_ report unhandled `CancelError`s
* whose `cause` field is the same as the one with which the current promise was cancelled.
*
* All usual promise methods are defined and return a `CancellablePromise`
* whose cancel method will cancel the parent operation as well, propagating the cancellation reason
* upwards through promise chains.
* Conversely, cancelling a promise will not automatically cancel dependent promises downstream:
* ```ts
* let root = new CancellablePromise((resolve, reject) => { ... });
* let child1 = root.then(() => { ... });
* let child2 = child1.then(() => { ... });
* let child3 = root.catch(() => { ... });
* child1.cancel(); // Cancels child1 and root, but not child2 or child3
* ```
* Cancelling a promise that has already settled is safe and has no consequence.
*
* The `cancel` method returns a promise that _always fulfills_
* after the whole chain has processed the cancel request
* and all attached callbacks up to that moment have run.
*
* All ES2024 promise methods (static and instance) are defined on CancellablePromise,
* but actual availability may vary with OS/webview version.
*
* In line with the proposal at https://github.com/tc39/proposal-rm-builtin-subclassing,
* `CancellablePromise` does not support transparent subclassing.
* Extenders should take care to provide their own method implementations.
* This might be reconsidered in case the proposal is retired.
*
* CancellablePromise is a wrapper around the DOM Promise object
* and is compliant with the [Promises/A+ specification](https://promisesaplus.com/)
* (it passes the [compliance suite](https://github.com/promises-aplus/promises-tests))
* if so is the underlying implementation.
*/
export declare class CancellablePromise<T> extends Promise<T> implements PromiseLike<T>, CancellablePromiseLike<T> {
static [x: symbol]: PromiseConstructor;
/**
* Creates a new `CancellablePromise`.
*
* @param executor - A callback used to initialize the promise. This callback is passed two arguments:
* a `resolve` callback used to resolve the promise with a value
* or the result of another promise (possibly cancellable),
* and a `reject` callback used to reject the promise with a provided reason or error.
* If the value provided to the `resolve` callback is a thenable _and_ cancellable object
* (it has a `then` _and_ a `cancel` method),
* cancellation requests will be forwarded to that object and the oncancelled will not be invoked anymore.
* If any one of the two callbacks is called _after_ the promise has been cancelled,
* the provided values will be cancelled and resolved as usual,
* but their results will be discarded.
* However, if the resolution process ultimately ends up in a rejection
* that is not due to cancellation, the rejection reason
* will be wrapped in a {@link CancelledRejectionError}
* and bubbled up as an unhandled rejection.
* @param oncancelled - It is the caller's responsibility to ensure that any operation
* started by the executor is properly halted upon cancellation.
* This optional callback can be used to that purpose.
* It will be called _synchronously_ with a cancellation cause
* when cancellation is requested, _after_ the promise has already rejected
* with a {@link CancelError}, but _before_
* any {@link then}/{@link catch}/{@link finally} callback runs.
* If the callback returns a thenable, the promise returned from {@link cancel}
* will only fulfill after the former has settled.
* Unhandled exceptions or rejections from the callback will be wrapped
* in a {@link CancelledRejectionError} and bubbled up as unhandled rejections.
* If the `resolve` callback is called before cancellation with a cancellable promise,
* cancellation requests on this promise will be diverted to that promise,
* and the original `oncancelled` callback will be discarded.
*/
constructor(executor: CancellablePromiseExecutor<T>, oncancelled?: CancellablePromiseCanceller);
/**
* Cancels immediately the execution of the operation associated with this promise.
* The promise rejects with a {@link CancelError} instance as reason,
* with the {@link CancelError#cause} property set to the given argument, if any.
*
* Has no effect if called after the promise has already settled;
* repeated calls in particular are safe, but only the first one
* will set the cancellation cause.
*
* The `CancelError` exception _need not_ be handled explicitly _on the promises that are being cancelled:_
* cancelling a promise with no attached rejection handler does not trigger an unhandled rejection event.
* Therefore, the following idioms are all equally correct:
* ```ts
* new CancellablePromise((resolve, reject) => { ... }).cancel();
* new CancellablePromise((resolve, reject) => { ... }).then(...).cancel();
* new CancellablePromise((resolve, reject) => { ... }).then(...).catch(...).cancel();
* ```
* Whenever some cancelled promise in a chain rejects with a `CancelError`
* with the same cancellation cause as itself, the error will be discarded silently.
* However, the `CancelError` _will still be delivered_ to all attached rejection handlers
* added by {@link then} and related methods:
* ```ts
* let cancellable = new CancellablePromise((resolve, reject) => { ... });
* cancellable.then(() => { ... }).catch(console.log);
* cancellable.cancel(); // A CancelError is printed to the console.
* ```
* If the `CancelError` is not handled downstream by the time it reaches
* a _non-cancelled_ promise, it _will_ trigger an unhandled rejection event,
* just like normal rejections would:
* ```ts
* let cancellable = new CancellablePromise((resolve, reject) => { ... });
* let chained = cancellable.then(() => { ... }).then(() => { ... }); // No catch...
* cancellable.cancel(); // Unhandled rejection event on chained!
* ```
* Therefore, it is important to either cancel whole promise chains from their tail,
* as shown in the correct idioms above, or take care of handling errors everywhere.
*
* @returns A cancellable promise that _fulfills_ after the cancel callback (if any)
* and all handlers attached up to the call to cancel have run.
* If the cancel callback returns a thenable, the promise returned by `cancel`
* will also wait for that thenable to settle.
* This enables callers to wait for the cancelled operation to terminate
* without being forced to handle potential errors at the call site.
* ```ts
* cancellable.cancel().then(() => {
* // Cleanup finished, it's safe to do something else.
* }, (err) => {
* // Unreachable: the promise returned from cancel will never reject.
* });
* ```
* Note that the returned promise will _not_ handle implicitly any rejection
* that might have occurred already in the cancelled chain.
* It will just track whether registered handlers have been executed or not.
* Therefore, unhandled rejections will never be silently handled by calling cancel.
*/
cancel(cause?: any): CancellablePromise<void>;
/**
* Binds promise cancellation to the abort event of the given {@link AbortSignal}.
* If the signal has already aborted, the promise will be cancelled immediately.
* When either condition is verified, the cancellation cause will be set
* to the signal's abort reason (see {@link AbortSignal#reason}).
*
* Has no effect if called (or if the signal aborts) _after_ the promise has already settled.
* Only the first signal to abort will set the cancellation cause.
*
* For more details about the cancellation process,
* see {@link cancel} and the `CancellablePromise` constructor.
*
* This method enables `await`ing cancellable promises without having
* to store them for future cancellation, e.g.:
* ```ts
* await longRunningOperation().cancelOn(signal);
* ```
* instead of:
* ```ts
* let promiseToBeCancelled = longRunningOperation();
* await promiseToBeCancelled;
* ```
*
* @returns This promise, for method chaining.
*/
cancelOn(signal: AbortSignal): CancellablePromise<T>;
/**
* Attaches callbacks for the resolution and/or rejection of the `CancellablePromise`.
*
* The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
* with the same semantics as the `oncancelled` argument of the constructor.
* When the parent promise rejects or is cancelled, the `onrejected` callback will run,
* _even after the returned promise has been cancelled:_
* in that case, should it reject or throw, the reason will be wrapped
* in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
*
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A `CancellablePromise` for the completion of whichever callback is executed.
* The returned promise is hooked up to propagate cancellation requests up the chain, but not down:
*
* - if the parent promise is cancelled, the `onrejected` handler will be invoked with a `CancelError`
* and the returned promise _will resolve regularly_ with its result;
* - conversely, if the returned promise is cancelled, _the parent promise is cancelled too;_
* the `onrejected` handler will still be invoked with the parent's `CancelError`,
* but its result will be discarded
* and the returned promise will reject with a `CancelError` as well.
*
* The promise returned from {@link cancel} will fulfill only after all attached handlers
* up the entire promise chain have been run.
*
* If either callback returns a cancellable promise,
* cancellation requests will be diverted to it,
* and the specified `oncancelled` callback will be discarded.
*/
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1> | CancellablePromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2> | CancellablePromiseLike<TResult2>) | undefined | null, oncancelled?: CancellablePromiseCanceller): CancellablePromise<TResult1 | TResult2>;
/**
* Attaches a callback for only the rejection of the Promise.
*
* The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
* with the same semantics as the `oncancelled` argument of the constructor.
* When the parent promise rejects or is cancelled, the `onrejected` callback will run,
* _even after the returned promise has been cancelled:_
* in that case, should it reject or throw, the reason will be wrapped
* in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
*
* It is equivalent to
* ```ts
* cancellablePromise.then(undefined, onrejected, oncancelled);
* ```
* and the same caveats apply.
*
* @returns A Promise for the completion of the callback.
* Cancellation requests on the returned promise
* will propagate up the chain to the parent promise,
* but not in the other direction.
*
* The promise returned from {@link cancel} will fulfill only after all attached handlers
* up the entire promise chain have been run.
*
* If `onrejected` returns a cancellable promise,
* cancellation requests will be diverted to it,
* and the specified `oncancelled` callback will be discarded.
* See {@link then} for more details.
*/
catch<TResult = never>(onrejected?: ((reason: any) => (PromiseLike<TResult> | TResult)) | undefined | null, oncancelled?: CancellablePromiseCanceller): CancellablePromise<T | TResult>;
/**
* Attaches a callback that is invoked when the CancellablePromise is settled (fulfilled or rejected). The
* resolved value cannot be accessed or modified from the callback.
* The returned promise will settle in the same state as the original one
* after the provided callback has completed execution,
* unless the callback throws or returns a rejecting promise,
* in which case the returned promise will reject as well.
*
* The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
* with the same semantics as the `oncancelled` argument of the constructor.
* Once the parent promise settles, the `onfinally` callback will run,
* _even after the returned promise has been cancelled:_
* in that case, should it reject or throw, the reason will be wrapped
* in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
*
* This method is implemented in terms of {@link then} and the same caveats apply.
* It is polyfilled, hence available in every OS/webview version.
*
* @returns A Promise for the completion of the callback.
* Cancellation requests on the returned promise
* will propagate up the chain to the parent promise,
* but not in the other direction.
*
* The promise returned from {@link cancel} will fulfill only after all attached handlers
* up the entire promise chain have been run.
*
* If `onfinally` returns a cancellable promise,
* cancellation requests will be diverted to it,
* and the specified `oncancelled` callback will be discarded.
* See {@link then} for more details.
*/
finally(onfinally?: (() => void) | undefined | null, oncancelled?: CancellablePromiseCanceller): CancellablePromise<T>;
/**
* Creates a CancellablePromise that is resolved with an array of results
* when all of the provided Promises resolve, or rejected when any Promise is rejected.
*
* Every one of the provided objects that is a thenable _and_ cancellable object
* will be cancelled when the returned promise is cancelled, with the same cause.
*
* @group Static Methods
*/
static all<T>(values: Iterable<T | PromiseLike<T>>): CancellablePromise<Awaited<T>[]>;
static all<T extends readonly unknown[] | []>(values: T): CancellablePromise<{
-readonly [P in keyof T]: Awaited<T[P]>;
}>;
/**
* Creates a CancellablePromise that is resolved with an array of results
* when all of the provided Promises resolve or reject.
*
* Every one of the provided objects that is a thenable _and_ cancellable object
* will be cancelled when the returned promise is cancelled, with the same cause.
*
* @group Static Methods
*/
static allSettled<T>(values: Iterable<T | PromiseLike<T>>): CancellablePromise<PromiseSettledResult<Awaited<T>>[]>;
static allSettled<T extends readonly unknown[] | []>(values: T): CancellablePromise<{
-readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>>;
}>;
/**
* The any function returns a promise that is fulfilled by the first given promise to be fulfilled,
* or rejected with an AggregateError containing an array of rejection reasons
* if all of the given promises are rejected.
* It resolves all elements of the passed iterable to promises as it runs this algorithm.
*
* Every one of the provided objects that is a thenable _and_ cancellable object
* will be cancelled when the returned promise is cancelled, with the same cause.
*
* @group Static Methods
*/
static any<T>(values: Iterable<T | PromiseLike<T>>): CancellablePromise<Awaited<T>>;
static any<T extends readonly unknown[] | []>(values: T): CancellablePromise<Awaited<T[number]>>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
*
* Every one of the provided objects that is a thenable _and_ cancellable object
* will be cancelled when the returned promise is cancelled, with the same cause.
*
* @group Static Methods
*/
static race<T>(values: Iterable<T | PromiseLike<T>>): CancellablePromise<Awaited<T>>;
static race<T extends readonly unknown[] | []>(values: T): CancellablePromise<Awaited<T[number]>>;
/**
* Creates a new cancelled CancellablePromise for the provided cause.
*
* @group Static Methods
*/
static cancel<T = never>(cause?: any): CancellablePromise<T>;
/**
* Creates a new CancellablePromise that cancels
* after the specified timeout, with the provided cause.
*
* If the {@link AbortSignal.timeout} factory method is available,
* it is used to base the timeout on _active_ time rather than _elapsed_ time.
* Otherwise, `timeout` falls back to {@link setTimeout}.
*
* @group Static Methods
*/
static timeout<T = never>(milliseconds: number, cause?: any): CancellablePromise<T>;
/**
* Creates a new CancellablePromise that resolves after the specified timeout.
* The returned promise can be cancelled without consequences.
*
* @group Static Methods
*/
static sleep(milliseconds: number): CancellablePromise<void>;
/**
* Creates a new CancellablePromise that resolves after
* the specified timeout, with the provided value.
* The returned promise can be cancelled without consequences.
*
* @group Static Methods
*/
static sleep<T>(milliseconds: number, value: T): CancellablePromise<T>;
/**
* Creates a new rejected CancellablePromise for the provided reason.
*
* @group Static Methods
*/
static reject<T = never>(reason?: any): CancellablePromise<T>;
/**
* Creates a new resolved CancellablePromise.
*
* @group Static Methods
*/
static resolve(): CancellablePromise<void>;
/**
* Creates a new resolved CancellablePromise for the provided value.
*
* @group Static Methods
*/
static resolve<T>(value: T): CancellablePromise<Awaited<T>>;
/**
* Creates a new resolved CancellablePromise for the provided value.
*
* @group Static Methods
*/
static resolve<T>(value: T | PromiseLike<T>): CancellablePromise<Awaited<T>>;
/**
* Creates a new CancellablePromise and returns it in an object, along with its resolve and reject functions
* and a getter/setter for the cancellation callback.
*
* This method is polyfilled, hence available in every OS/webview version.
*
* @group Static Methods
*/
static withResolvers<T>(): CancellablePromiseWithResolvers<T>;
}
export {};

13
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/clipboard.d.ts

@ -1,13 +0,0 @@
/**
* Sets the text to the Clipboard.
*
* @param text - The text to be set to the Clipboard.
* @return A Promise that resolves when the operation is successful.
*/
export declare function SetText(text: string): Promise<void>;
/**
* Get the Clipboard text
*
* @returns A promise that resolves with the text from the Clipboard.
*/
export declare function Text(): Promise<string>;

1
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/contextmenu.d.ts

@ -1 +0,0 @@
export {};

31
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/create.d.ts

@ -1,31 +0,0 @@
/**
* Any is a dummy creation function for simple or unknown types.
*/
export declare function Any<T = any>(source: any): T;
/**
* ByteSlice is a creation function that replaces
* null strings with empty strings.
*/
export declare function ByteSlice(source: any): string;
/**
* Array takes a creation function for an arbitrary type
* and returns an in-place creation function for an array
* whose elements are of that type.
*/
export declare function Array<T = any>(element: (source: any) => T): (source: any) => T[];
/**
* Map takes creation functions for two arbitrary types
* and returns an in-place creation function for an object
* whose keys and values are of those types.
*/
export declare function Map<V = any>(key: (source: any) => string, value: (source: any) => V): (source: any) => Record<string, V>;
/**
* Nullable takes a creation function for an arbitrary type
* and returns a creation function for a nullable value of that type.
*/
export declare function Nullable<T = any>(element: (source: any) => T): (source: any) => (T | null);
/**
* Struct takes an object mapping field names to creation functions
* and returns an in-place creation function for a struct.
*/
export declare function Struct(createField: Record<string, (source: any) => any>): <U extends Record<string, any> = any>(source: any) => U;

140
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/dialogs.d.ts

@ -1,140 +0,0 @@
export interface OpenFileDialogOptions {
/** Indicates if directories can be chosen. */
CanChooseDirectories?: boolean;
/** Indicates if files can be chosen. */
CanChooseFiles?: boolean;
/** Indicates if directories can be created. */
CanCreateDirectories?: boolean;
/** Indicates if hidden files should be shown. */
ShowHiddenFiles?: boolean;
/** Indicates if aliases should be resolved. */
ResolvesAliases?: boolean;
/** Indicates if multiple selection is allowed. */
AllowsMultipleSelection?: boolean;
/** Indicates if the extension should be hidden. */
HideExtension?: boolean;
/** Indicates if hidden extensions can be selected. */
CanSelectHiddenExtension?: boolean;
/** Indicates if file packages should be treated as directories. */
TreatsFilePackagesAsDirectories?: boolean;
/** Indicates if other file types are allowed. */
AllowsOtherFiletypes?: boolean;
/** Array of file filters. */
Filters?: FileFilter[];
/** Title of the dialog. */
Title?: string;
/** Message to show in the dialog. */
Message?: string;
/** Text to display on the button. */
ButtonText?: string;
/** Directory to open in the dialog. */
Directory?: string;
/** Indicates if the dialog should appear detached from the main window. */
Detached?: boolean;
}
export interface SaveFileDialogOptions {
/** Default filename to use in the dialog. */
Filename?: string;
/** Indicates if directories can be chosen. */
CanChooseDirectories?: boolean;
/** Indicates if files can be chosen. */
CanChooseFiles?: boolean;
/** Indicates if directories can be created. */
CanCreateDirectories?: boolean;
/** Indicates if hidden files should be shown. */
ShowHiddenFiles?: boolean;
/** Indicates if aliases should be resolved. */
ResolvesAliases?: boolean;
/** Indicates if the extension should be hidden. */
HideExtension?: boolean;
/** Indicates if hidden extensions can be selected. */
CanSelectHiddenExtension?: boolean;
/** Indicates if file packages should be treated as directories. */
TreatsFilePackagesAsDirectories?: boolean;
/** Indicates if other file types are allowed. */
AllowsOtherFiletypes?: boolean;
/** Array of file filters. */
Filters?: FileFilter[];
/** Title of the dialog. */
Title?: string;
/** Message to show in the dialog. */
Message?: string;
/** Text to display on the button. */
ButtonText?: string;
/** Directory to open in the dialog. */
Directory?: string;
/** Indicates if the dialog should appear detached from the main window. */
Detached?: boolean;
}
export interface MessageDialogOptions {
/** The title of the dialog window. */
Title?: string;
/** The main message to show in the dialog. */
Message?: string;
/** Array of button options to show in the dialog. */
Buttons?: Button[];
/** True if the dialog should appear detached from the main window (if applicable). */
Detached?: boolean;
}
export interface Button {
/** Text that appears within the button. */
Label?: string;
/** True if the button should cancel an operation when clicked. */
IsCancel?: boolean;
/** True if the button should be the default action when the user presses enter. */
IsDefault?: boolean;
}
export interface FileFilter {
/** Display name for the filter, it could be "Text Files", "Images" etc. */
DisplayName?: string;
/** Pattern to match for the filter, e.g. "*.txt;*.md" for text markdown files. */
Pattern?: string;
}
/**
* Presents an info dialog.
*
* @param options - Dialog options
* @returns A promise that resolves with the label of the chosen button.
*/
export declare function Info(options: MessageDialogOptions): Promise<string>;
/**
* Presents a warning dialog.
*
* @param options - Dialog options.
* @returns A promise that resolves with the label of the chosen button.
*/
export declare function Warning(options: MessageDialogOptions): Promise<string>;
/**
* Presents an error dialog.
*
* @param options - Dialog options.
* @returns A promise that resolves with the label of the chosen button.
*/
export declare function Error(options: MessageDialogOptions): Promise<string>;
/**
* Presents a question dialog.
*
* @param options - Dialog options.
* @returns A promise that resolves with the label of the chosen button.
*/
export declare function Question(options: MessageDialogOptions): Promise<string>;
/**
* Presents a file selection dialog to pick one or more files to open.
*
* @param options - Dialog options.
* @returns Selected file or list of files, or a blank string/empty list if no file has been selected.
*/
export declare function OpenFile(options: OpenFileDialogOptions & {
AllowsMultipleSelection: true;
}): Promise<string[]>;
export declare function OpenFile(options: OpenFileDialogOptions & {
AllowsMultipleSelection?: false | undefined;
}): Promise<string>;
export declare function OpenFile(options: OpenFileDialogOptions): Promise<string | string[]>;
/**
* Presents a file selection dialog to pick a file to save.
*
* @param options - Dialog options.
* @returns Selected file, or a blank string if no file has been selected.
*/
export declare function SaveFile(options: SaveFileDialogOptions): Promise<string>;

1
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/drag.d.ts

@ -1 +0,0 @@
export {};

218
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/event_types.d.ts

@ -1,218 +0,0 @@
export declare const Types: Readonly<{
Windows: Readonly<{
APMPowerSettingChange: "windows:APMPowerSettingChange";
APMPowerStatusChange: "windows:APMPowerStatusChange";
APMResumeAutomatic: "windows:APMResumeAutomatic";
APMResumeSuspend: "windows:APMResumeSuspend";
APMSuspend: "windows:APMSuspend";
ApplicationStarted: "windows:ApplicationStarted";
SystemThemeChanged: "windows:SystemThemeChanged";
WebViewNavigationCompleted: "windows:WebViewNavigationCompleted";
WindowActive: "windows:WindowActive";
WindowBackgroundErase: "windows:WindowBackgroundErase";
WindowClickActive: "windows:WindowClickActive";
WindowClosing: "windows:WindowClosing";
WindowDidMove: "windows:WindowDidMove";
WindowDidResize: "windows:WindowDidResize";
WindowDPIChanged: "windows:WindowDPIChanged";
WindowDragDrop: "windows:WindowDragDrop";
WindowDragEnter: "windows:WindowDragEnter";
WindowDragLeave: "windows:WindowDragLeave";
WindowDragOver: "windows:WindowDragOver";
WindowEndMove: "windows:WindowEndMove";
WindowEndResize: "windows:WindowEndResize";
WindowFullscreen: "windows:WindowFullscreen";
WindowHide: "windows:WindowHide";
WindowInactive: "windows:WindowInactive";
WindowKeyDown: "windows:WindowKeyDown";
WindowKeyUp: "windows:WindowKeyUp";
WindowKillFocus: "windows:WindowKillFocus";
WindowNonClientHit: "windows:WindowNonClientHit";
WindowNonClientMouseDown: "windows:WindowNonClientMouseDown";
WindowNonClientMouseLeave: "windows:WindowNonClientMouseLeave";
WindowNonClientMouseMove: "windows:WindowNonClientMouseMove";
WindowNonClientMouseUp: "windows:WindowNonClientMouseUp";
WindowPaint: "windows:WindowPaint";
WindowRestore: "windows:WindowRestore";
WindowSetFocus: "windows:WindowSetFocus";
WindowShow: "windows:WindowShow";
WindowStartMove: "windows:WindowStartMove";
WindowStartResize: "windows:WindowStartResize";
WindowUnFullscreen: "windows:WindowUnFullscreen";
WindowZOrderChanged: "windows:WindowZOrderChanged";
WindowMinimise: "windows:WindowMinimise";
WindowUnMinimise: "windows:WindowUnMinimise";
WindowMaximise: "windows:WindowMaximise";
WindowUnMaximise: "windows:WindowUnMaximise";
}>;
Mac: Readonly<{
ApplicationDidBecomeActive: "mac:ApplicationDidBecomeActive";
ApplicationDidChangeBackingProperties: "mac:ApplicationDidChangeBackingProperties";
ApplicationDidChangeEffectiveAppearance: "mac:ApplicationDidChangeEffectiveAppearance";
ApplicationDidChangeIcon: "mac:ApplicationDidChangeIcon";
ApplicationDidChangeOcclusionState: "mac:ApplicationDidChangeOcclusionState";
ApplicationDidChangeScreenParameters: "mac:ApplicationDidChangeScreenParameters";
ApplicationDidChangeStatusBarFrame: "mac:ApplicationDidChangeStatusBarFrame";
ApplicationDidChangeStatusBarOrientation: "mac:ApplicationDidChangeStatusBarOrientation";
ApplicationDidChangeTheme: "mac:ApplicationDidChangeTheme";
ApplicationDidFinishLaunching: "mac:ApplicationDidFinishLaunching";
ApplicationDidHide: "mac:ApplicationDidHide";
ApplicationDidResignActive: "mac:ApplicationDidResignActive";
ApplicationDidUnhide: "mac:ApplicationDidUnhide";
ApplicationDidUpdate: "mac:ApplicationDidUpdate";
ApplicationShouldHandleReopen: "mac:ApplicationShouldHandleReopen";
ApplicationWillBecomeActive: "mac:ApplicationWillBecomeActive";
ApplicationWillFinishLaunching: "mac:ApplicationWillFinishLaunching";
ApplicationWillHide: "mac:ApplicationWillHide";
ApplicationWillResignActive: "mac:ApplicationWillResignActive";
ApplicationWillTerminate: "mac:ApplicationWillTerminate";
ApplicationWillUnhide: "mac:ApplicationWillUnhide";
ApplicationWillUpdate: "mac:ApplicationWillUpdate";
MenuDidAddItem: "mac:MenuDidAddItem";
MenuDidBeginTracking: "mac:MenuDidBeginTracking";
MenuDidClose: "mac:MenuDidClose";
MenuDidDisplayItem: "mac:MenuDidDisplayItem";
MenuDidEndTracking: "mac:MenuDidEndTracking";
MenuDidHighlightItem: "mac:MenuDidHighlightItem";
MenuDidOpen: "mac:MenuDidOpen";
MenuDidPopUp: "mac:MenuDidPopUp";
MenuDidRemoveItem: "mac:MenuDidRemoveItem";
MenuDidSendAction: "mac:MenuDidSendAction";
MenuDidSendActionToItem: "mac:MenuDidSendActionToItem";
MenuDidUpdate: "mac:MenuDidUpdate";
MenuWillAddItem: "mac:MenuWillAddItem";
MenuWillBeginTracking: "mac:MenuWillBeginTracking";
MenuWillDisplayItem: "mac:MenuWillDisplayItem";
MenuWillEndTracking: "mac:MenuWillEndTracking";
MenuWillHighlightItem: "mac:MenuWillHighlightItem";
MenuWillOpen: "mac:MenuWillOpen";
MenuWillPopUp: "mac:MenuWillPopUp";
MenuWillRemoveItem: "mac:MenuWillRemoveItem";
MenuWillSendAction: "mac:MenuWillSendAction";
MenuWillSendActionToItem: "mac:MenuWillSendActionToItem";
MenuWillUpdate: "mac:MenuWillUpdate";
WebViewDidCommitNavigation: "mac:WebViewDidCommitNavigation";
WebViewDidFinishNavigation: "mac:WebViewDidFinishNavigation";
WebViewDidReceiveServerRedirectForProvisionalNavigation: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation";
WebViewDidStartProvisionalNavigation: "mac:WebViewDidStartProvisionalNavigation";
WindowDidBecomeKey: "mac:WindowDidBecomeKey";
WindowDidBecomeMain: "mac:WindowDidBecomeMain";
WindowDidBeginSheet: "mac:WindowDidBeginSheet";
WindowDidChangeAlpha: "mac:WindowDidChangeAlpha";
WindowDidChangeBackingLocation: "mac:WindowDidChangeBackingLocation";
WindowDidChangeBackingProperties: "mac:WindowDidChangeBackingProperties";
WindowDidChangeCollectionBehavior: "mac:WindowDidChangeCollectionBehavior";
WindowDidChangeEffectiveAppearance: "mac:WindowDidChangeEffectiveAppearance";
WindowDidChangeOcclusionState: "mac:WindowDidChangeOcclusionState";
WindowDidChangeOrderingMode: "mac:WindowDidChangeOrderingMode";
WindowDidChangeScreen: "mac:WindowDidChangeScreen";
WindowDidChangeScreenParameters: "mac:WindowDidChangeScreenParameters";
WindowDidChangeScreenProfile: "mac:WindowDidChangeScreenProfile";
WindowDidChangeScreenSpace: "mac:WindowDidChangeScreenSpace";
WindowDidChangeScreenSpaceProperties: "mac:WindowDidChangeScreenSpaceProperties";
WindowDidChangeSharingType: "mac:WindowDidChangeSharingType";
WindowDidChangeSpace: "mac:WindowDidChangeSpace";
WindowDidChangeSpaceOrderingMode: "mac:WindowDidChangeSpaceOrderingMode";
WindowDidChangeTitle: "mac:WindowDidChangeTitle";
WindowDidChangeToolbar: "mac:WindowDidChangeToolbar";
WindowDidDeminiaturize: "mac:WindowDidDeminiaturize";
WindowDidEndSheet: "mac:WindowDidEndSheet";
WindowDidEnterFullScreen: "mac:WindowDidEnterFullScreen";
WindowDidEnterVersionBrowser: "mac:WindowDidEnterVersionBrowser";
WindowDidExitFullScreen: "mac:WindowDidExitFullScreen";
WindowDidExitVersionBrowser: "mac:WindowDidExitVersionBrowser";
WindowDidExpose: "mac:WindowDidExpose";
WindowDidFocus: "mac:WindowDidFocus";
WindowDidMiniaturize: "mac:WindowDidMiniaturize";
WindowDidMove: "mac:WindowDidMove";
WindowDidOrderOffScreen: "mac:WindowDidOrderOffScreen";
WindowDidOrderOnScreen: "mac:WindowDidOrderOnScreen";
WindowDidResignKey: "mac:WindowDidResignKey";
WindowDidResignMain: "mac:WindowDidResignMain";
WindowDidResize: "mac:WindowDidResize";
WindowDidUpdate: "mac:WindowDidUpdate";
WindowDidUpdateAlpha: "mac:WindowDidUpdateAlpha";
WindowDidUpdateCollectionBehavior: "mac:WindowDidUpdateCollectionBehavior";
WindowDidUpdateCollectionProperties: "mac:WindowDidUpdateCollectionProperties";
WindowDidUpdateShadow: "mac:WindowDidUpdateShadow";
WindowDidUpdateTitle: "mac:WindowDidUpdateTitle";
WindowDidUpdateToolbar: "mac:WindowDidUpdateToolbar";
WindowDidZoom: "mac:WindowDidZoom";
WindowFileDraggingEntered: "mac:WindowFileDraggingEntered";
WindowFileDraggingExited: "mac:WindowFileDraggingExited";
WindowFileDraggingPerformed: "mac:WindowFileDraggingPerformed";
WindowHide: "mac:WindowHide";
WindowMaximise: "mac:WindowMaximise";
WindowUnMaximise: "mac:WindowUnMaximise";
WindowMinimise: "mac:WindowMinimise";
WindowUnMinimise: "mac:WindowUnMinimise";
WindowShouldClose: "mac:WindowShouldClose";
WindowShow: "mac:WindowShow";
WindowWillBecomeKey: "mac:WindowWillBecomeKey";
WindowWillBecomeMain: "mac:WindowWillBecomeMain";
WindowWillBeginSheet: "mac:WindowWillBeginSheet";
WindowWillChangeOrderingMode: "mac:WindowWillChangeOrderingMode";
WindowWillClose: "mac:WindowWillClose";
WindowWillDeminiaturize: "mac:WindowWillDeminiaturize";
WindowWillEnterFullScreen: "mac:WindowWillEnterFullScreen";
WindowWillEnterVersionBrowser: "mac:WindowWillEnterVersionBrowser";
WindowWillExitFullScreen: "mac:WindowWillExitFullScreen";
WindowWillExitVersionBrowser: "mac:WindowWillExitVersionBrowser";
WindowWillFocus: "mac:WindowWillFocus";
WindowWillMiniaturize: "mac:WindowWillMiniaturize";
WindowWillMove: "mac:WindowWillMove";
WindowWillOrderOffScreen: "mac:WindowWillOrderOffScreen";
WindowWillOrderOnScreen: "mac:WindowWillOrderOnScreen";
WindowWillResignMain: "mac:WindowWillResignMain";
WindowWillResize: "mac:WindowWillResize";
WindowWillUnfocus: "mac:WindowWillUnfocus";
WindowWillUpdate: "mac:WindowWillUpdate";
WindowWillUpdateAlpha: "mac:WindowWillUpdateAlpha";
WindowWillUpdateCollectionBehavior: "mac:WindowWillUpdateCollectionBehavior";
WindowWillUpdateCollectionProperties: "mac:WindowWillUpdateCollectionProperties";
WindowWillUpdateShadow: "mac:WindowWillUpdateShadow";
WindowWillUpdateTitle: "mac:WindowWillUpdateTitle";
WindowWillUpdateToolbar: "mac:WindowWillUpdateToolbar";
WindowWillUpdateVisibility: "mac:WindowWillUpdateVisibility";
WindowWillUseStandardFrame: "mac:WindowWillUseStandardFrame";
WindowZoomIn: "mac:WindowZoomIn";
WindowZoomOut: "mac:WindowZoomOut";
WindowZoomReset: "mac:WindowZoomReset";
}>;
Linux: Readonly<{
ApplicationStartup: "linux:ApplicationStartup";
SystemThemeChanged: "linux:SystemThemeChanged";
WindowDeleteEvent: "linux:WindowDeleteEvent";
WindowDidMove: "linux:WindowDidMove";
WindowDidResize: "linux:WindowDidResize";
WindowFocusIn: "linux:WindowFocusIn";
WindowFocusOut: "linux:WindowFocusOut";
WindowLoadChanged: "linux:WindowLoadChanged";
}>;
Common: Readonly<{
ApplicationOpenedWithFile: "common:ApplicationOpenedWithFile";
ApplicationStarted: "common:ApplicationStarted";
ThemeChanged: "common:ThemeChanged";
WindowClosing: "common:WindowClosing";
WindowDidMove: "common:WindowDidMove";
WindowDidResize: "common:WindowDidResize";
WindowDPIChanged: "common:WindowDPIChanged";
WindowFilesDropped: "common:WindowFilesDropped";
WindowFocus: "common:WindowFocus";
WindowFullscreen: "common:WindowFullscreen";
WindowHide: "common:WindowHide";
WindowLostFocus: "common:WindowLostFocus";
WindowMaximise: "common:WindowMaximise";
WindowMinimise: "common:WindowMinimise";
WindowRestore: "common:WindowRestore";
WindowRuntimeReady: "common:WindowRuntimeReady";
WindowShow: "common:WindowShow";
WindowUnFullscreen: "common:WindowUnFullscreen";
WindowUnMaximise: "common:WindowUnMaximise";
WindowUnMinimise: "common:WindowUnMinimise";
WindowZoom: "common:WindowZoom";
WindowZoomIn: "common:WindowZoomIn";
WindowZoomOut: "common:WindowZoomOut";
WindowZoomReset: "common:WindowZoomReset";
}>;
}>;

66
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/events.d.ts

@ -1,66 +0,0 @@
export { Types } from "./event_types.js";
/**
* The type of handlers for a given event.
*/
export type Callback = (ev: WailsEvent) => void;
/**
* Represents a system event or a custom event emitted through wails-provided facilities.
*/
export declare class WailsEvent {
/**
* The name of the event.
*/
name: string;
/**
* Optional data associated with the emitted event.
*/
data: any;
/**
* Name of the originating window. Omitted for application events.
* Will be overridden if set manually.
*/
sender?: string;
constructor(name: string, data?: any);
}
/**
* Register a callback function to be called multiple times for a specific event.
*
* @param eventName - The name of the event to register the callback for.
* @param callback - The callback function to be called when the event is triggered.
* @param maxCallbacks - The maximum number of times the callback can be called for the event. Once the maximum number is reached, the callback will no longer be called.
* @returns A function that, when called, will unregister the callback from the event.
*/
export declare function OnMultiple(eventName: string, callback: Callback, maxCallbacks: number): () => void;
/**
* Registers a callback function to be executed when the specified event occurs.
*
* @param eventName - The name of the event to register the callback for.
* @param callback - The callback function to be called when the event is triggered.
* @returns A function that, when called, will unregister the callback from the event.
*/
export declare function On(eventName: string, callback: Callback): () => void;
/**
* Registers a callback function to be executed only once for the specified event.
*
* @param eventName - The name of the event to register the callback for.
* @param callback - The callback function to be called when the event is triggered.
* @returns A function that, when called, will unregister the callback from the event.
*/
export declare function Once(eventName: string, callback: Callback): () => void;
/**
* Removes event listeners for the specified event names.
*
* @param eventNames - The name of the events to remove listeners for.
*/
export declare function Off(...eventNames: [string, ...string[]]): void;
/**
* Removes all event listeners.
*/
export declare function OffAll(): void;
/**
* Emits the given event.
*
* @param event - The name of the event to emit.
* @returns A promise that will be fulfilled once the event has been emitted.
*/
export declare function Emit(event: WailsEvent): Promise<void>;

7
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/flags.d.ts

@ -1,7 +0,0 @@
/**
* Retrieves the value associated with the specified key from the flag map.
*
* @param key - The key to retrieve the value for.
* @return The value associated with the specified key.
*/
export declare function GetFlag(key: string): any;

16
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/index.d.ts

@ -1,16 +0,0 @@
import "./contextmenu.js";
import "./drag.js";
import * as Application from "./application.js";
import * as Browser from "./browser.js";
import * as Call from "./calls.js";
import * as Clipboard from "./clipboard.js";
import * as Create from "./create.js";
import * as Dialogs from "./dialogs.js";
import * as Events from "./events.js";
import * as Flags from "./flags.js";
import * as Screens from "./screens.js";
import * as System from "./system.js";
import Window from "./window.js";
import * as WML from "./wml.js";
export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens, System, Window, WML };
export * from "./cancellable.js";

9
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/listener.d.ts

@ -1,9 +0,0 @@
export declare const eventListeners: Map<string, Listener[]>;
export declare class Listener {
eventName: string;
callback: (data: any) => void;
maxCallbacks: number;
constructor(eventName: string, callback: (data: any) => void, maxCallbacks: number);
dispatch(data: any): boolean;
}
export declare function listenerOff(listener: Listener): void;

1
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/nanoid.d.ts

@ -1 +0,0 @@
export declare function nanoid(size?: number): string;

22
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/runtime.d.ts

@ -1,22 +0,0 @@
export declare const objectNames: Readonly<{
Call: 0;
Clipboard: 1;
Application: 2;
Events: 3;
ContextMenu: 4;
Dialog: 5;
Window: 6;
Screens: 7;
System: 8;
Browser: 9;
CancelCall: 10;
}>;
export declare let clientId: string;
/**
* Creates a new runtime caller with specified ID.
*
* @param object - The object to invoke the method on.
* @param windowName - The name of the window.
* @return The new runtime caller function.
*/
export declare function newRuntimeCaller(object: number, windowName?: string): (method: number, args?: any) => Promise<any>;

60
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/screens.d.ts

@ -1,60 +0,0 @@
export interface Size {
/** The width of a rectangular area. */
Width: number;
/** The height of a rectangular area. */
Height: number;
}
export interface Rect {
/** The X coordinate of the origin. */
X: number;
/** The Y coordinate of the origin. */
Y: number;
/** The width of the rectangle. */
Width: number;
/** The height of the rectangle. */
Height: number;
}
export interface Screen {
/** Unique identifier for the screen. */
ID: string;
/** Human-readable name of the screen. */
Name: string;
/** The scale factor of the screen (DPI/96). 1 = standard DPI, 2 = HiDPI (Retina), etc. */
ScaleFactor: number;
/** The X coordinate of the screen. */
X: number;
/** The Y coordinate of the screen. */
Y: number;
/** Contains the width and height of the screen. */
Size: Size;
/** Contains the bounds of the screen in terms of X, Y, Width, and Height. */
Bounds: Rect;
/** Contains the physical bounds of the screen in terms of X, Y, Width, and Height (before scaling). */
PhysicalBounds: Rect;
/** Contains the area of the screen that is actually usable (excluding taskbar and other system UI). */
WorkArea: Rect;
/** Contains the physical WorkArea of the screen (before scaling). */
PhysicalWorkArea: Rect;
/** True if this is the primary monitor selected by the user in the operating system. */
IsPrimary: boolean;
/** The rotation of the screen. */
Rotation: number;
}
/**
* Gets all screens.
*
* @returns A promise that resolves to an array of Screen objects.
*/
export declare function GetAll(): Promise<Screen[]>;
/**
* Gets the primary screen.
*
* @returns A promise that resolves to the primary screen.
*/
export declare function GetPrimary(): Promise<Screen>;
/**
* Gets the current active screen.
*
* @returns A promise that resolves with the current active screen.
*/
export declare function GetCurrent(): Promise<Screen>;

83
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/system.d.ts

@ -1,83 +0,0 @@
export declare function invoke(msg: any): void;
/**
* Retrieves the system dark mode status.
*
* @returns A promise that resolves to a boolean value indicating if the system is in dark mode.
*/
export declare function IsDarkMode(): Promise<boolean>;
/**
* Fetches the capabilities of the application from the server.
*
* @returns A promise that resolves to an object containing the capabilities.
*/
export declare function Capabilities(): Promise<Record<string, any>>;
export interface OSInfo {
/** The branding of the OS. */
Branding: string;
/** The ID of the OS. */
ID: string;
/** The name of the OS. */
Name: string;
/** The version of the OS. */
Version: string;
}
export interface EnvironmentInfo {
/** The architecture of the system. */
Arch: string;
/** True if the application is running in debug mode, otherwise false. */
Debug: boolean;
/** The operating system in use. */
OS: string;
/** Details of the operating system. */
OSInfo: OSInfo;
/** Additional platform information. */
PlatformInfo: Record<string, any>;
}
/**
* Retrieves environment details.
*
* @returns A promise that resolves to an object containing OS and system architecture.
*/
export declare function Environment(): Promise<EnvironmentInfo>;
/**
* Checks if the current operating system is Windows.
*
* @return True if the operating system is Windows, otherwise false.
*/
export declare function IsWindows(): boolean;
/**
* Checks if the current operating system is Linux.
*
* @returns Returns true if the current operating system is Linux, false otherwise.
*/
export declare function IsLinux(): boolean;
/**
* Checks if the current environment is a macOS operating system.
*
* @returns True if the environment is macOS, false otherwise.
*/
export declare function IsMac(): boolean;
/**
* Checks if the current environment architecture is AMD64.
*
* @returns True if the current environment architecture is AMD64, false otherwise.
*/
export declare function IsAMD64(): boolean;
/**
* Checks if the current architecture is ARM.
*
* @returns True if the current architecture is ARM, false otherwise.
*/
export declare function IsARM(): boolean;
/**
* Checks if the current environment is ARM64 architecture.
*
* @returns Returns true if the environment is ARM64 architecture, otherwise returns false.
*/
export declare function IsARM64(): boolean;
/**
* Reports whether the app is being run in debug mode.
*
* @returns True if the app is being run in debug mode.
*/
export declare function IsDebug(): boolean;

21
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/utils.d.ts

@ -1,21 +0,0 @@
/**
* Logs a message to the console with custom formatting.
*
* @param message - The message to be logged.
*/
export declare function debugLog(message: any): void;
/**
* Checks whether the webview supports the {@link MouseEvent#buttons} property.
* Looking at you macOS High Sierra!
*/
export declare function canTrackButtons(): boolean;
/**
* Checks whether the browser supports removing listeners by triggering an AbortSignal
* (see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal).
*/
export declare function canAbortListeners(): boolean;
/**
* Resolves the closest HTMLElement ancestor of an event's target.
*/
export declare function eventTarget(event: Event): HTMLElement;
export declare function whenReady(callback: () => void): void;

292
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/window.d.ts

@ -1,292 +0,0 @@
import type { Screen } from "./screens.js";
/**
* A record describing the position of a window.
*/
interface Position {
/** The horizontal position of the window. */
x: number;
/** The vertical position of the window. */
y: number;
}
/**
* A record describing the size of a window.
*/
interface Size {
/** The width of the window. */
width: number;
/** The height of the window. */
height: number;
}
declare const callerSym: unique symbol;
declare class Window {
private [callerSym];
/**
* Initialises a window object with the specified name.
*
* @private
* @param name - The name of the target window.
*/
constructor(name?: string);
/**
* Gets the specified window.
*
* @param name - The name of the window to get.
* @returns The corresponding window object.
*/
Get(name: string): Window;
/**
* Returns the absolute position of the window.
*
* @returns The current absolute position of the window.
*/
Position(): Promise<Position>;
/**
* Centers the window on the screen.
*/
Center(): Promise<void>;
/**
* Closes the window.
*/
Close(): Promise<void>;
/**
* Disables min/max size constraints.
*/
DisableSizeConstraints(): Promise<void>;
/**
* Enables min/max size constraints.
*/
EnableSizeConstraints(): Promise<void>;
/**
* Focuses the window.
*/
Focus(): Promise<void>;
/**
* Forces the window to reload the page assets.
*/
ForceReload(): Promise<void>;
/**
* Switches the window to fullscreen mode.
*/
Fullscreen(): Promise<void>;
/**
* Returns the screen that the window is on.
*
* @returns The screen the window is currently on.
*/
GetScreen(): Promise<Screen>;
/**
* Returns the current zoom level of the window.
*
* @returns The current zoom level.
*/
GetZoom(): Promise<number>;
/**
* Returns the height of the window.
*
* @returns The current height of the window.
*/
Height(): Promise<number>;
/**
* Hides the window.
*/
Hide(): Promise<void>;
/**
* Returns true if the window is focused.
*
* @returns Whether the window is currently focused.
*/
IsFocused(): Promise<boolean>;
/**
* Returns true if the window is fullscreen.
*
* @returns Whether the window is currently fullscreen.
*/
IsFullscreen(): Promise<boolean>;
/**
* Returns true if the window is maximised.
*
* @returns Whether the window is currently maximised.
*/
IsMaximised(): Promise<boolean>;
/**
* Returns true if the window is minimised.
*
* @returns Whether the window is currently minimised.
*/
IsMinimised(): Promise<boolean>;
/**
* Maximises the window.
*/
Maximise(): Promise<void>;
/**
* Minimises the window.
*/
Minimise(): Promise<void>;
/**
* Returns the name of the window.
*
* @returns The name of the window.
*/
Name(): Promise<string>;
/**
* Opens the development tools pane.
*/
OpenDevTools(): Promise<void>;
/**
* Returns the relative position of the window to the screen.
*
* @returns The current relative position of the window.
*/
RelativePosition(): Promise<Position>;
/**
* Reloads the page assets.
*/
Reload(): Promise<void>;
/**
* Returns true if the window is resizable.
*
* @returns Whether the window is currently resizable.
*/
Resizable(): Promise<boolean>;
/**
* Restores the window to its previous state if it was previously minimised, maximised or fullscreen.
*/
Restore(): Promise<void>;
/**
* Sets the absolute position of the window.
*
* @param x - The desired horizontal absolute position of the window.
* @param y - The desired vertical absolute position of the window.
*/
SetPosition(x: number, y: number): Promise<void>;
/**
* Sets the window to be always on top.
*
* @param alwaysOnTop - Whether the window should stay on top.
*/
SetAlwaysOnTop(alwaysOnTop: boolean): Promise<void>;
/**
* Sets the background colour of the window.
*
* @param r - The desired red component of the window background.
* @param g - The desired green component of the window background.
* @param b - The desired blue component of the window background.
* @param a - The desired alpha component of the window background.
*/
SetBackgroundColour(r: number, g: number, b: number, a: number): Promise<void>;
/**
* Removes the window frame and title bar.
*
* @param frameless - Whether the window should be frameless.
*/
SetFrameless(frameless: boolean): Promise<void>;
/**
* Disables the system fullscreen button.
*
* @param enabled - Whether the fullscreen button should be enabled.
*/
SetFullscreenButtonEnabled(enabled: boolean): Promise<void>;
/**
* Sets the maximum size of the window.
*
* @param width - The desired maximum width of the window.
* @param height - The desired maximum height of the window.
*/
SetMaxSize(width: number, height: number): Promise<void>;
/**
* Sets the minimum size of the window.
*
* @param width - The desired minimum width of the window.
* @param height - The desired minimum height of the window.
*/
SetMinSize(width: number, height: number): Promise<void>;
/**
* Sets the relative position of the window to the screen.
*
* @param x - The desired horizontal relative position of the window.
* @param y - The desired vertical relative position of the window.
*/
SetRelativePosition(x: number, y: number): Promise<void>;
/**
* Sets whether the window is resizable.
*
* @param resizable - Whether the window should be resizable.
*/
SetResizable(resizable: boolean): Promise<void>;
/**
* Sets the size of the window.
*
* @param width - The desired width of the window.
* @param height - The desired height of the window.
*/
SetSize(width: number, height: number): Promise<void>;
/**
* Sets the title of the window.
*
* @param title - The desired title of the window.
*/
SetTitle(title: string): Promise<void>;
/**
* Sets the zoom level of the window.
*
* @param zoom - The desired zoom level.
*/
SetZoom(zoom: number): Promise<void>;
/**
* Shows the window.
*/
Show(): Promise<void>;
/**
* Returns the size of the window.
*
* @returns The current size of the window.
*/
Size(): Promise<Size>;
/**
* Toggles the window between fullscreen and normal.
*/
ToggleFullscreen(): Promise<void>;
/**
* Toggles the window between maximised and normal.
*/
ToggleMaximise(): Promise<void>;
/**
* Un-fullscreens the window.
*/
UnFullscreen(): Promise<void>;
/**
* Un-maximises the window.
*/
UnMaximise(): Promise<void>;
/**
* Un-minimises the window.
*/
UnMinimise(): Promise<void>;
/**
* Returns the width of the window.
*
* @returns The current width of the window.
*/
Width(): Promise<number>;
/**
* Zooms the window.
*/
Zoom(): Promise<void>;
/**
* Increases the zoom level of the webview content.
*/
ZoomIn(): Promise<void>;
/**
* Decreases the zoom level of the webview content.
*/
ZoomOut(): Promise<void>;
/**
* Resets the zoom level of the webview content.
*/
ZoomReset(): Promise<void>;
}
/**
* The window within which the script is running.
*/
declare const thisWindow: Window;
export default thisWindow;

8
node_modules/.pnpm/@wailsio+runtime@3.0.0-alpha.66/node_modules/@wailsio/runtime/types/wml.d.ts

@ -1,8 +0,0 @@
/**
* Schedules an automatic reload of WML to be performed as soon as the document is fully loaded.
*/
export declare function Enable(): void;
/**
* Reloads the WML page by adding necessary event listeners and browser listeners.
*/
export declare function Reload(): void;

21
node_modules/.pnpm/alova@3.2.10/node_modules/alova/LICENSE

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2022 JOU Amjs
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.

77
node_modules/.pnpm/alova@3.2.10/node_modules/alova/README.md

@ -1,77 +0,0 @@
<p align="center">
<img width="200px" src="https://alova.js.org/img/logo-text-vertical.svg" />
</p>
<p align="center"><b>Workflow-Streamlined next-generation request tools.<br />Extremely improve your API using efficiency and save brainpower Just one step</b></p>
<p align="center">English | <a href="./README.zh-CN.md">Chinese</a></p>
[![npm](https://img.shields.io/npm/v/alova)](https://www.npmjs.com/package/alova)
[![build](https://github.com/alovajs/alova/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/alovajs/alova/actions/workflows/release.yml)
[![coverage status](https://coveralls.io/repos/github/alovajs/alova/badge.svg?branch=main)](https://coveralls.io/github/alovajs/alova?branch=main)
[![stars](https://img.shields.io/github/stars/alovajs/alova?style=social)](https://github.com/alovajs/alova)
[![discord](https://img.shields.io/badge/chat-Discord-515ff1)](https://discord.gg/S47QGJgkVb)
[![wechat](https://img.shields.io/badge/chat_with_CH-Wechat-07c160)](https://alova.js.org/img/wechat_qrcode.jpg)
[![tree shaking](https://badgen.net/bundlephobia/tree-shaking/alova)](https://bundlephobia.com/package/alova)
![typescript](https://badgen.net/badge/icon/typescript?icon=typescript&label)
![license](https://img.shields.io/badge/license-MIT-blue.svg)
## What is alova?
alova(pronounced /əˈləʊva/) is a workflow-streamlined next-generation request tool. Starting from front-end and back-end collaboration and API integration, it streamline API integration workflow from 7 steps to only 1 step, extremely streamline API integration workflow and making network requests very simple. Let's see how alova can help you simplify your work.
![](https://alova.js.org/img/overview_flow_en.png)
## Is there any difference?
Unlike other request libraries, alova aims to make requests very simple and maintain more efficient data interaction.
We consider both developers and App users. For developers, alova provides them with the ultimate user experience, and for application users, they can enjoy the smooth experience brought by alova's high-performance data interaction.
In addition, let's take a look at the specific features:
- The API design similar to Axios makes the learning cost of users lower;
- High-performance client and server request strategies make the application smoother;
- High flexibility, Alova's adapter allows Alova to work with any UI framework in any JS environment, and provides a unified user experience and perfect code migration;
- 2 cache modes and request sharing mechanisms to improve request performance and reduce server pressure;
- High aggregation organization of API code, each API's request parameters, cache behavior, response data conversion, etc. will be gathered in the same code block, which is a great advantage for managing a large number of APIs;
> You can also check [Comparison with other request libraries](https://alova.js.org/about/comparison) to learn more about the differences of Alova.
## Documentation
Visit the [alova website](https://alova.js.org) for more information, or [check out the examples to try running](https://alova.js.org/category/examples).
## Join the community
- [Follow us on X to get the latest updates](https://x.com/alovajs)
- [Join the Discord](https://discord.gg/S47QGJgkVb)
- [Join the WeChat group](https://alova.js.org/img/wechat_qrcode.jpg)
## We need your support
If you like alova, we are very grateful for giving us a star in the upper right corner, which is a recognition and encouragement for our work.
## Welcome to contribute
We are honored to receive active participation from developers around the world in Issues and Discussions.
We hope to make alova a common project for everyone who is willing to participate, rather than the alova team. We encourage everyone to become a contributor to the alova community with an open and inclusive attitude. Even if you are a junior developer, as long as your ideas meet the development guidelines of alova, please participate generously.
Effective contributions will win you a certain reputation in the Alova community. Before contributing, please be sure to read the [Contribution Guide](https://github.com/alovajs/alova/blob/main/CONTRIBUTING.md) in detail to ensure your contribution is effective.
## Changelog
[Link](https://github.com/alovajs/alova/releases)
## Contributors
<a href="https://github.com/alovajs/alova/graphs/contributors">
<img src="https://contrib.rocks/image?repo=alovajs/alova&max=30&columns=10" />
</a>
## LICENSE
[MIT](https://en.wikipedia.org/wiki/MIT_License)

75
node_modules/.pnpm/alova@3.2.10/node_modules/alova/README.zh-CN.md

@ -1,75 +0,0 @@
<p align="center">
<img width="200px" src="https://alova.js.org/img/logo-text-vertical.svg" />
</p>
<p align="center"><b>工作流精简的下一代请求工具<br />极致地简化你的API集成工作流,仅需一步</b></p>
<p align="center"><a href="./README.md">📑English</a> | 中文</p>
[![npm](https://img.shields.io/npm/v/alova)](https://www.npmjs.com/package/alova)
[![build](https://github.com/alovajs/alova/actions/workflows/release.yml/badge.svg?branch=main)](https://github.com/alovajs/alova/actions/workflows/release.yml)
[![coverage status](https://coveralls.io/repos/github/alovajs/alova/badge.svg?branch=main)](https://coveralls.io/github/alovajs/alova?branch=main)
[![stars](https://img.shields.io/github/stars/alovajs/alova?style=social)](https://github.com/alovajs/alova)
[![discord](https://img.shields.io/badge/chat-Discord-515ff1)](https://discord.gg/S47QGJgkVb)
[![wechat](https://img.shields.io/badge/chat_with_CH-Wechat-07c160)](https://alova.js.org/img/wechat_qrcode.jpg)
[![tree shaking](https://badgen.net/bundlephobia/tree-shaking/alova)](https://bundlephobia.com/package/alova)
![typescript](https://badgen.net/badge/icon/typescript?icon=typescript&label)
![license](https://img.shields.io/badge/license-MIT-blue.svg)
## alova 是什么?
alova(读作/əˈləʊva/)是一个流程精简的下一代请求工具,从前后端协作和 API 集成作为出发点,将 API 集成步骤从 7 步简化为只有 1 步,极致地简化 API 集成工作流,让网络请求变得非常简单。我们来看看 alova 是如何帮你的简化工作的。
![](https://alova.js.org/img/overview_flow_cn.png)
## 有什么不同吗?
与其他请求库不同的是,alova 的目标是让请求变得非常简单,并且保持更高效的数据交互。
我们为开发者和 App 使用者双方考虑,对于开发者来说,alova 为他们提供了极致的使用体验,对于应用的用户来说,他们可以享受到 alova 的高性能数据交互带来的流畅体验。
此外,再从具体的特性来看看:
- 与 axios 相似的 api 设计,让使用者学习成本更低;
- 高性能的客户端和服务端请求策略,让应用更流畅;
- 灵活性高,alova 的适配器可以让 alova 在任何 js 环境下,与任何 UI 框架协作使用,并且提供了统一的使用体验和完美的代码迁移;
- 2 种缓存模式和请求共享机制,提升请求性能并降低服务端压力;
- api 代码的高聚合组织,每个 api 的请求参数、缓存行为、响应数据转换等都将聚集在相同的代码块中,这对于管理大量的 api 有很大的优势;
> 你还可以查看请[与其他请求库比较](https://alova.js.org/about/comparison)详细了解 alova 的不同之处。
## 文档
访问[alova 网站](https://alova.js.org)了解更多信息,或[查尝试运行的示例](https://alova.js.org/category/examples)。
## 加入交流社区
- [在 X 上关注我们,持续获得最新动态](https://x.com/alovajs)
- [加入在 Discord 社区参与交流](https://discord.gg/S47QGJgkVb)
- [加入微信群参与交流](https://alova.js.org/img/wechat_qrcode.jpg)
## 我们需要你的支持
如果你喜欢 alova,我们非常感谢您在右上角给我们 star,这是对我们工作的认可和鼓励。
## 欢迎参与贡献
我们在 Issues 和 Disscussion 中收到了来自世界各地的开发者积极参与的信息,深感荣幸。
我们期望将 alova 打造成每位愿意参与的人的共同项目,而不是 alova 团队的,我们以开放包容的态度鼓励每个人成为 alova 社区的贡献者,即使你是一位初级开发者,只要想法符合 alova 的发展准则,也请大方地参与进来。
有效的贡献将为你赢得一定的 alova 社区名望。在参与贡献前,请务必详细阅读 [贡献指南](https://github.com/alovajs/alova/blob/main/CONTRIBUTING.zh-CN.md),以保证你的有效贡献。
## Changelog
[前往查看](https://github.com/alovajs/alova/releases)
## Contributors
<a href="https://github.com/alovajs/alova/graphs/contributors">
<img src="https://contrib.rocks/image?repo=alovajs/alova&max=30&columns=10" />
</a>
## LICENSE
[MIT](https://en.wikipedia.org/wiki/MIT_License)

92
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/adapter/fetch.common.cjs

@ -1,92 +0,0 @@
/**
* alova 3.2.10 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
var shared = require('@alova/shared');
const isBodyData = (data) => shared.isString(data) || shared.isSpecialRequestBody(data);
function adapterFetch() {
return (elements, method) => {
const adapterConfig = method.config;
const timeout = adapterConfig.timeout || 0;
const ctrl = new AbortController();
const { data, headers } = elements;
const isContentTypeSet = /content-type/i.test(shared.ObjectCls.keys(headers).join());
const isDataFormData = data && data.toString() === '[object FormData]';
// When the content type is not set and the data is not a form data object, the content type is set to application/json by default.
if (!isContentTypeSet && !isDataFormData) {
headers['Content-Type'] = 'application/json;charset=UTF-8';
}
const fetchPromise = fetch(elements.url, {
...adapterConfig,
method: elements.type,
signal: ctrl.signal,
body: isBodyData(data) ? data : shared.JSONStringify(data)
});
// If the interruption time is set, the request will be interrupted after the specified time.
let abortTimer;
let isTimeout = shared.falseValue;
if (timeout > 0) {
abortTimer = shared.setTimeoutFn(() => {
isTimeout = shared.trueValue;
ctrl.abort();
}, timeout);
}
return {
response: () => fetchPromise.then(response => {
// Clear interrupt processing after successful request
shared.clearTimeoutTimer(abortTimer);
// Response's readable can only be read once and needs to be cloned before it can be reused.
return response.clone();
}, err => shared.promiseReject(isTimeout ? shared.newInstance(Error, 'fetchError: network timeout') : err)),
// The then in the Headers function needs to catch exceptions, otherwise the correct error object will not be obtained internally.
headers: () => fetchPromise.then(({ headers: responseHeaders }) => responseHeaders, () => ({})),
// Due to limitations of the node fetch library, this code cannot be unit tested, but it has passed the test in the browser.
/* c8 ignore start */
onDownload: async (cb) => {
let isAborted = shared.falseValue;
const response = await fetchPromise.catch(() => {
isAborted = shared.trueValue;
});
if (!response)
return;
const { headers: responseHeaders, body } = response.clone();
const reader = body ? body.getReader() : shared.undefinedValue;
const total = Number(responseHeaders.get('Content-Length') || responseHeaders.get('content-length') || 0);
if (total <= 0) {
return;
}
let loaded = 0;
if (reader) {
const pump = () => reader.read().then(({ done, value = new Uint8Array() }) => {
if (done || isAborted) {
isAborted && cb(total, 0);
}
else {
loaded += value.byteLength;
cb(total, loaded);
return pump();
}
});
pump();
}
},
onUpload() {
// eslint-disable-next-line no-console
console.error("fetch API does'nt support uploading progress. please consider to change `@alova/adapter-xhr` or `@alova/adapter-axios`");
},
/* c8 ignore stop */
abort: () => {
ctrl.abort();
shared.clearTimeoutTimer(abortTimer);
}
};
};
}
module.exports = adapterFetch;

90
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/adapter/fetch.esm.js

@ -1,90 +0,0 @@
/**
* alova 3.2.10 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
import { ObjectCls, JSONStringify, setTimeoutFn, clearTimeoutTimer, promiseReject, newInstance, undefinedValue, isString, isSpecialRequestBody, falseValue, trueValue } from '@alova/shared';
const isBodyData = (data) => isString(data) || isSpecialRequestBody(data);
function adapterFetch() {
return (elements, method) => {
const adapterConfig = method.config;
const timeout = adapterConfig.timeout || 0;
const ctrl = new AbortController();
const { data, headers } = elements;
const isContentTypeSet = /content-type/i.test(ObjectCls.keys(headers).join());
const isDataFormData = data && data.toString() === '[object FormData]';
// When the content type is not set and the data is not a form data object, the content type is set to application/json by default.
if (!isContentTypeSet && !isDataFormData) {
headers['Content-Type'] = 'application/json;charset=UTF-8';
}
const fetchPromise = fetch(elements.url, {
...adapterConfig,
method: elements.type,
signal: ctrl.signal,
body: isBodyData(data) ? data : JSONStringify(data)
});
// If the interruption time is set, the request will be interrupted after the specified time.
let abortTimer;
let isTimeout = falseValue;
if (timeout > 0) {
abortTimer = setTimeoutFn(() => {
isTimeout = trueValue;
ctrl.abort();
}, timeout);
}
return {
response: () => fetchPromise.then(response => {
// Clear interrupt processing after successful request
clearTimeoutTimer(abortTimer);
// Response's readable can only be read once and needs to be cloned before it can be reused.
return response.clone();
}, err => promiseReject(isTimeout ? newInstance(Error, 'fetchError: network timeout') : err)),
// The then in the Headers function needs to catch exceptions, otherwise the correct error object will not be obtained internally.
headers: () => fetchPromise.then(({ headers: responseHeaders }) => responseHeaders, () => ({})),
// Due to limitations of the node fetch library, this code cannot be unit tested, but it has passed the test in the browser.
/* c8 ignore start */
onDownload: async (cb) => {
let isAborted = falseValue;
const response = await fetchPromise.catch(() => {
isAborted = trueValue;
});
if (!response)
return;
const { headers: responseHeaders, body } = response.clone();
const reader = body ? body.getReader() : undefinedValue;
const total = Number(responseHeaders.get('Content-Length') || responseHeaders.get('content-length') || 0);
if (total <= 0) {
return;
}
let loaded = 0;
if (reader) {
const pump = () => reader.read().then(({ done, value = new Uint8Array() }) => {
if (done || isAborted) {
isAborted && cb(total, 0);
}
else {
loaded += value.byteLength;
cb(total, loaded);
return pump();
}
});
pump();
}
},
onUpload() {
// eslint-disable-next-line no-console
console.error("fetch API does'nt support uploading progress. please consider to change `@alova/adapter-xhr` or `@alova/adapter-axios`");
},
/* c8 ignore stop */
abort: () => {
ctrl.abort();
clearTimeoutTimer(abortTimer);
}
};
};
}
export { adapterFetch as default };

150
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/adapter/fetch.umd.js

@ -1,150 +0,0 @@
/**
* alova 3.2.10 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.alovaFetch = factory());
})(this, (function () { 'use strict';
/**
* @alova/shared 1.1.2 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
const undefStr = 'undefined';
// The following unified processing functions or variables added to reduce the amount of compiled code
const PromiseCls = Promise;
const promiseReject = (value) => PromiseCls.reject(value);
const ObjectCls = Object;
const undefinedValue = undefined;
const trueValue = true;
const falseValue = false;
const JSONStringify = (value, replacer, space) => JSON.stringify(value, replacer, space);
const setTimeoutFn = (fn, delay = 0) => setTimeout(fn, delay);
const clearTimeoutTimer = (timer) => clearTimeout(timer);
const typeOf = (arg) => typeof arg;
// Whether it is running on the server side, node and bun are judged by process, and deno is judged by Deno.
// Some frameworks (such as Alipay and uniapp) will inject the process object as a global variable.
// Therefore, the process.cwd function unique to the server is used as the basis for judgment.
typeof window === undefStr &&
(typeof process !== undefStr ? typeof process.cwd === 'function' : typeof Deno !== undefStr);
/**
* Determine whether the parameter is a string any parameter
* @returns Whether the parameter is a string
*/
const isString = (arg) => typeOf(arg) === 'string';
/**
* Global toString any parameter stringified parameters
*/
const globalToString = (arg) => ObjectCls.prototype.toString.call(arg);
/**
* Determine whether it is an instance of a certain class any parameter
* @returns Judgment result
*/
const instanceOf = (arg, cls) => arg instanceof cls;
/**
* Is it special data
* @param data Submit data
* @returns Judgment result
*/
const isSpecialRequestBody = (data) => {
const dataTypeString = globalToString(data);
return (/^\[object (Blob|FormData|ReadableStream|URLSearchParams)\]$/i.test(dataTypeString) || instanceOf(data, ArrayBuffer));
};
/**
* Create class instance
* @param Cls Constructor
* @param args Constructor parameters class instance
*/
const newInstance = (Cls, ...args) => new Cls(...args);
const isBodyData = (data) => isString(data) || isSpecialRequestBody(data);
function adapterFetch() {
return (elements, method) => {
const adapterConfig = method.config;
const timeout = adapterConfig.timeout || 0;
const ctrl = new AbortController();
const { data, headers } = elements;
const isContentTypeSet = /content-type/i.test(ObjectCls.keys(headers).join());
const isDataFormData = data && data.toString() === '[object FormData]';
// When the content type is not set and the data is not a form data object, the content type is set to application/json by default.
if (!isContentTypeSet && !isDataFormData) {
headers['Content-Type'] = 'application/json;charset=UTF-8';
}
const fetchPromise = fetch(elements.url, {
...adapterConfig,
method: elements.type,
signal: ctrl.signal,
body: isBodyData(data) ? data : JSONStringify(data)
});
// If the interruption time is set, the request will be interrupted after the specified time.
let abortTimer;
let isTimeout = falseValue;
if (timeout > 0) {
abortTimer = setTimeoutFn(() => {
isTimeout = trueValue;
ctrl.abort();
}, timeout);
}
return {
response: () => fetchPromise.then(response => {
// Clear interrupt processing after successful request
clearTimeoutTimer(abortTimer);
// Response's readable can only be read once and needs to be cloned before it can be reused.
return response.clone();
}, err => promiseReject(isTimeout ? newInstance(Error, 'fetchError: network timeout') : err)),
// The then in the Headers function needs to catch exceptions, otherwise the correct error object will not be obtained internally.
headers: () => fetchPromise.then(({ headers: responseHeaders }) => responseHeaders, () => ({})),
// Due to limitations of the node fetch library, this code cannot be unit tested, but it has passed the test in the browser.
/* c8 ignore start */
onDownload: async (cb) => {
let isAborted = falseValue;
const response = await fetchPromise.catch(() => {
isAborted = trueValue;
});
if (!response)
return;
const { headers: responseHeaders, body } = response.clone();
const reader = body ? body.getReader() : undefinedValue;
const total = Number(responseHeaders.get('Content-Length') || responseHeaders.get('content-length') || 0);
if (total <= 0) {
return;
}
let loaded = 0;
if (reader) {
const pump = () => reader.read().then(({ done, value = new Uint8Array() }) => {
if (done || isAborted) {
isAborted && cb(total, 0);
}
else {
loaded += value.byteLength;
cb(total, loaded);
return pump();
}
});
pump();
}
},
onUpload() {
// eslint-disable-next-line no-console
console.error("fetch API does'nt support uploading progress. please consider to change `@alova/adapter-xhr` or `@alova/adapter-axios`");
},
/* c8 ignore stop */
abort: () => {
ctrl.abort();
clearTimeoutTimer(abortTimer);
}
};
};
}
return adapterFetch;
}));

1
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/adapter/fetch.umd.min.js

@ -1 +0,0 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).alovaFetch=t()}(this,(function(){"use strict";const e="undefined",t=Promise,o=Object,n=!0,r=!1,a=e=>clearTimeout(e);typeof window===e&&typeof process!==e&&process.cwd;const s=e=>{const t=(n=e,o.prototype.toString.call(n));var n;return/^\[object (Blob|FormData|ReadableStream|URLSearchParams)\]$/i.test(t)||((e,t)=>e instanceof t)(e,ArrayBuffer)},i=e=>"string"===(e=>typeof e)(e)||s(e);return function(){return(e,s)=>{const c=s.config,d=c.timeout||0,l=new AbortController,{data:f,headers:u}=e,p=/content-type/i.test(o.keys(u).join()),h=f&&"[object FormData]"===f.toString();p||h||(u["Content-Type"]="application/json;charset=UTF-8");const y=fetch(e.url,{...c,method:e.type,signal:l.signal,body:i(f)?f:(g=f,JSON.stringify(g,b,m))});var g,b,m;let w,j=r;return d>0&&(w=((e,t=0)=>setTimeout(e,t))((()=>{j=n,l.abort()}),d)),{response:()=>y.then((e=>(a(w),e.clone())),(e=>(e=>t.reject(e))(j?((e,...t)=>new e(...t))(Error,"fetchError: network timeout"):e))),headers:()=>y.then((({headers:e})=>e),(()=>({}))),onDownload:async e=>{let t=r;const o=await y.catch((()=>{t=n}));if(!o)return;const{headers:a,body:s}=o.clone(),i=s?s.getReader():undefined,c=Number(a.get("Content-Length")||a.get("content-length")||0);if(c<=0)return;let d=0;if(i){const o=()=>i.read().then((({done:n,value:r=new Uint8Array})=>{if(!n&&!t)return d+=r.byteLength,e(c,d),o();t&&e(c,0)}));o()}},onUpload(){console.error("fetch API does'nt support uploading progress. please consider to change `@alova/adapter-xhr` or `@alova/adapter-axios`")},abort:()=>{l.abort(),a(w)}}}}}));

930
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/alova.common.cjs

@ -1,930 +0,0 @@
/**
* alova 3.2.10 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
var shared = require('@alova/shared');
exports.globalConfigMap = {
autoHitCache: 'global',
ssr: shared.isSSR
};
/**
* Set global configuration
* @param config
*/
var globalConfig = (config) => {
exports.globalConfigMap = {
...exports.globalConfigMap,
...config
};
};
const titleStyle = 'color: black; font-size: 12px; font-weight: bolder';
/**
* Default cacheLogger function
*/
var defaultCacheLogger = (response, methodInstance, cacheMode, tag) => {
const cole = console;
// eslint-disable-next-line
const log = (...args) => console.log(...args);
const { url } = methodInstance;
const isRestoreMode = cacheMode === shared.STORAGE_RESTORE;
const hdStyle = '\x1B[42m%s\x1B[49m';
const labelStyle = '\x1B[32m%s\x1B[39m';
const startSep = ` [HitCache]${url} `;
const endSepFn = () => Array(shared.len(startSep) + 1).join('^');
if (exports.globalConfigMap.ssr) {
log(hdStyle, startSep);
log(labelStyle, ' Cache ', response);
log(labelStyle, ' Mode ', cacheMode);
isRestoreMode && log(labelStyle, ' Tag ', tag);
log(labelStyle, endSepFn());
}
else {
cole.groupCollapsed
? cole.groupCollapsed('%cHitCache', 'padding: 2px 6px; background: #c4fcd3; color: #53b56d;', url)
: log(hdStyle, startSep);
log('%c[Cache]', titleStyle, response);
log('%c[Mode]', titleStyle, cacheMode);
isRestoreMode && log('%c[Tag]', titleStyle, tag);
log('%c[Method]', titleStyle, methodInstance);
cole.groupEnd ? cole.groupEnd() : log(labelStyle, endSepFn());
}
};
const hitSourceStringCacheKey = (key) => `hss.${key}`;
const hitSourceRegexpPrefix = 'hsr.';
const hitSourceRegexpCacheKey = (regexpStr) => hitSourceRegexpPrefix + regexpStr;
const unifiedHitSourceRegexpCacheKey = '$$hsrs';
const regexpSourceFlagSeparator = '__$<>$__';
const addItem = (obj, item) => {
obj[item] = 0;
};
/**
* set or update cache
* @param namespace namespace
* @param key stored key
* @param response Stored response content
* @param expireTimestamp Timestamp representation of expiration time point
* @param storage storage object
* @param tag Storage tags, used to distinguish different storage tags
*/
const setWithCacheAdapter = async (namespace, key, data, expireTimestamp, cacheAdapter, hitSource, tag) => {
// not to cache if expireTimestamp is less than current timestamp
if (expireTimestamp > shared.getTime() && data) {
const methodCacheKey = shared.buildNamespacedCacheKey(namespace, key);
await cacheAdapter.set(methodCacheKey, shared.filterItem([data, expireTimestamp === Infinity ? shared.undefinedValue : expireTimestamp, tag], Boolean));
// save the relationship between this method and its hitSources.
// cache structure is like this:
/*
{
"$a.[namespace][methodKey]": [cache data],
...
"hss.[sourceMethodKey]": "{
[targetMethodKey1]: 0,
[targetMethodKey2]: 0,
...
}",
"hss.[sourceMethodName]": "{
[targetMethodKey3]: 0,
[targetMethodKey4]: 0,
...
}",
"hsr.[sourceMethodNameRegexpSource]": "{
[targetMethodKey5]: 0,
[targetMethodKey6]: 0,
...
}",
"hsr.regexp1": ["hss.key1", "hss.key2"],
"hsr.regexp2": ["hss.key1", "hss.key2"]
}
*/
if (hitSource) {
// filter repeat items and categorize the regexp, to prevent unnecessary cost of IO
const hitSourceKeys = {};
const hitSourceRegexpSources = [];
shared.forEach(hitSource, sourceItem => {
const isRegexp = shared.instanceOf(sourceItem, shared.RegExpCls);
const targetHitSourceKey = isRegexp
? sourceItem.source + (sourceItem.flags ? regexpSourceFlagSeparator + sourceItem.flags : '')
: sourceItem;
if (targetHitSourceKey) {
if (isRegexp && !hitSourceKeys[targetHitSourceKey]) {
shared.pushItem(hitSourceRegexpSources, targetHitSourceKey);
}
addItem(hitSourceKeys, isRegexp ? hitSourceRegexpCacheKey(targetHitSourceKey) : hitSourceStringCacheKey(targetHitSourceKey));
}
});
// save the relationship. Minimize IO as much as possible
const promises = shared.mapItem(shared.objectKeys(hitSourceKeys), async (hitSourceKey) => {
// filter the empty strings.
const targetMethodKeys = (await cacheAdapter.get(hitSourceKey)) || {};
addItem(targetMethodKeys, methodCacheKey);
await cacheAdapter.set(hitSourceKey, targetMethodKeys);
});
const saveRegexp = async () => {
// save the regexp source if regexp exists.
if (shared.len(hitSourceRegexpSources)) {
const regexpList = (await cacheAdapter.get(unifiedHitSourceRegexpCacheKey)) || [];
// TODO: hitSourceRegexpSources needs to be deduplicated
shared.pushItem(regexpList, ...hitSourceRegexpSources);
await cacheAdapter.set(unifiedHitSourceRegexpCacheKey, regexpList);
}
};
// parallel executing all async tasks.
await shared.PromiseCls.all([...promises, saveRegexp()]);
}
}
};
/**
* Delete stored response data
* @param namespace namespace
* @param key stored key
* @param storage storage object
*/
const removeWithCacheAdapter = async (namespace, key, cacheAdapter) => {
const methodStoreKey = shared.buildNamespacedCacheKey(namespace, key);
await cacheAdapter.remove(methodStoreKey);
};
/**
* Get stored response data
* @param namespace namespace
* @param key stored key
* @param storage storage object
* @param tag Store tags. If the tag changes, the data will become invalid.
*/
const getRawWithCacheAdapter = async (namespace, key, cacheAdapter, tag) => {
const storagedData = await cacheAdapter.get(shared.buildNamespacedCacheKey(namespace, key));
if (storagedData) {
// Eslint disable next line
const [dataUnused, expireTimestamp, storedTag] = storagedData;
// If there is no expiration time, it means that the data will never expire. Otherwise, you need to determine whether it has expired.
if (storedTag === tag && (!expireTimestamp || expireTimestamp > shared.getTime())) {
return storagedData;
}
// If expired, delete cache
await removeWithCacheAdapter(namespace, key, cacheAdapter);
}
};
/**
* Get stored response data
* @param namespace namespace
* @param key stored key
* @param storage storage object
* @param tag Store tags. If the tag changes, the data will become invalid.
*/
const getWithCacheAdapter = async (namespace, key, cacheAdapter, tag) => {
const rawData = await getRawWithCacheAdapter(namespace, key, cacheAdapter, tag);
return rawData ? rawData[0] : shared.undefinedValue;
};
/**
* clear all cached data
*/
const clearWithCacheAdapter = async (cacheAdapters) => shared.PromiseCls.all(cacheAdapters.map(cacheAdapter => cacheAdapter.clear()));
/**
* query and delete target cache with key and name of source method instance.
* @param sourceKey source method instance key
* @param sourceName source method instance name
* @param cacheAdapter cache adapter
*/
const hitTargetCacheWithCacheAdapter = async (sourceKey, sourceName, cacheAdapter) => {
const sourceNameStr = `${sourceName}`;
// map that recording the source key and target method keys.
const sourceTargetKeyMap = {};
// get hit key by method key.
const hitSourceKey = hitSourceStringCacheKey(sourceKey);
sourceTargetKeyMap[hitSourceKey] = await cacheAdapter.get(hitSourceKey);
let unifiedHitSourceRegexpChannel;
if (sourceName) {
const hitSourceName = hitSourceStringCacheKey(sourceNameStr);
// get hit key by method name if it is exists.
sourceTargetKeyMap[hitSourceName] = await cacheAdapter.get(hitSourceName);
// match regexped key by source method name and get hit key by method name.
unifiedHitSourceRegexpChannel = await cacheAdapter.get(unifiedHitSourceRegexpCacheKey);
const matchedRegexpStrings = [];
if (unifiedHitSourceRegexpChannel && shared.len(unifiedHitSourceRegexpChannel)) {
shared.forEach(unifiedHitSourceRegexpChannel, regexpStr => {
const [source, flag] = regexpStr.split(regexpSourceFlagSeparator);
if (shared.newInstance(shared.RegExpCls, source, flag).test(sourceNameStr)) {
shared.pushItem(matchedRegexpStrings, regexpStr);
}
});
// parallel get hit key by matched regexps.
await shared.PromiseCls.all(shared.mapItem(matchedRegexpStrings, async (regexpString) => {
const hitSourceRegexpString = hitSourceRegexpCacheKey(regexpString);
sourceTargetKeyMap[hitSourceRegexpString] = await cacheAdapter.get(hitSourceRegexpString);
}));
}
}
const removeWithTargetKey = async (targetKey) => {
try {
await cacheAdapter.remove(targetKey);
// loop sourceTargetKeyMap and remove this key to prevent unnecessary cost of IO.
for (const sourceKey in sourceTargetKeyMap) {
const targetKeys = sourceTargetKeyMap[sourceKey];
if (targetKeys) {
shared.deleteAttr(targetKeys, targetKey);
}
}
}
catch (_a) {
// the try-catch is used to prevent throwing error, cause throwing error in `Promise.all` below.
}
};
// now let's start to delete target caches.
// and filter the finished keys.
const accessedKeys = {};
await shared.PromiseCls.all(shared.mapItem(shared.objectKeys(sourceTargetKeyMap), async (sourceKey) => {
const targetKeys = sourceTargetKeyMap[sourceKey];
if (targetKeys) {
const removingPromises = [];
for (const key in targetKeys) {
if (!accessedKeys[key]) {
addItem(accessedKeys, key);
shared.pushItem(removingPromises, removeWithTargetKey(key));
}
}
await shared.PromiseCls.all(removingPromises);
}
}));
// update source key if there is still has keys.
// remove source key if its keys is empty.
const unifiedHitSourceRegexpChannelLen = shared.len(unifiedHitSourceRegexpChannel || []);
await shared.PromiseCls.all(shared.mapItem(shared.objectKeys(sourceTargetKeyMap), async (sourceKey) => {
const targetKeys = sourceTargetKeyMap[sourceKey];
if (targetKeys) {
if (shared.len(shared.objectKeys(targetKeys))) {
await cacheAdapter.set(sourceKey, targetKeys);
}
else {
await cacheAdapter.remove(sourceKey);
// if this is a regexped key, need to remove it from unified regexp channel.
if (sourceKey.includes(hitSourceRegexpPrefix) && unifiedHitSourceRegexpChannel) {
unifiedHitSourceRegexpChannel = shared.filterItem(unifiedHitSourceRegexpChannel, rawRegexpStr => hitSourceRegexpCacheKey(rawRegexpStr) !== sourceKey);
}
}
}
}));
// update unified hit source regexp channel if its length was changed.
if (unifiedHitSourceRegexpChannelLen !== shared.len(unifiedHitSourceRegexpChannel || [])) {
await cacheAdapter.set(unifiedHitSourceRegexpCacheKey, unifiedHitSourceRegexpChannel);
}
};
var cloneMethod = (methodInstance) => {
const { data, config } = methodInstance;
const newConfig = { ...config };
const { headers = {}, params = {} } = newConfig;
const ctx = shared.getContext(methodInstance);
newConfig.headers = { ...headers };
newConfig.params = { ...params };
const newMethod = shared.newInstance((Method), methodInstance.type, ctx, methodInstance.url, newConfig, data);
return shared.objAssign(newMethod, {
...methodInstance,
config: newConfig
});
};
/*
* The matchers in the following three functions are Method instance matchers, which are divided into three situations:
* 1. If the matcher is a Method instance, clear the cache of the Method instance.
* 2. If matcher is a string or regular expression, clear the cache of all Method instances that meet the conditions.
* 3. If no matcher is passed in, all caches will be cleared.
*/
/**
* Query cache
* @param matcher Method instance matcher
* @returns Cache data, return undefined if not found
*/
const queryCache = async (matcher, { policy = 'all' } = {}) => {
// if key exists, that means it's a method instance.
if (matcher && matcher.key) {
const { id, l1Cache, l2Cache } = shared.getContext(matcher);
const methodKey = shared.getMethodInternalKey(matcher);
const { f: cacheFor, c: controlled, s: store, e: expireMilliseconds, t: tag } = shared.getLocalCacheConfigParam(matcher);
// if it's controlled cache, it will return the result of cacheFor function.
if (controlled) {
return cacheFor();
}
let cachedData = policy !== 'l2' ? await getWithCacheAdapter(id, methodKey, l1Cache) : shared.undefinedValue;
if (policy === 'l2') {
cachedData = await getWithCacheAdapter(id, methodKey, l2Cache, tag);
}
else if (policy === 'all' && !cachedData) {
if (store && expireMilliseconds(shared.STORAGE_RESTORE) > shared.getTime()) {
cachedData = await getWithCacheAdapter(id, methodKey, l2Cache, tag);
}
}
return cachedData;
}
};
/**
* Manually set cache response data. If the corresponding methodInstance sets persistent storage, the cache in the persistent storage will also be checked out.
* @param matcher Method instance matcher cache data
*/
const setCache = async (matcher, dataOrUpdater, { policy = 'all' } = {}) => {
const methodInstances = shared.isArray(matcher) ? matcher : [matcher];
const batchPromises = methodInstances.map(async (methodInstance) => {
const { hitSource } = methodInstance;
const { id, l1Cache, l2Cache } = shared.getContext(methodInstance);
const methodKey = shared.getMethodInternalKey(methodInstance);
const { e: expireMilliseconds, s: toStore, t: tag, c: controlled } = shared.getLocalCacheConfigParam(methodInstance);
// don't set cache when it's controlled cache.
if (controlled) {
return;
}
let data = dataOrUpdater;
if (shared.isFn(dataOrUpdater)) {
let cachedData = policy !== 'l2' ? await getWithCacheAdapter(id, methodKey, l1Cache) : shared.undefinedValue;
if (policy === 'l2' ||
(policy === 'all' && !cachedData && toStore && expireMilliseconds(shared.STORAGE_RESTORE) > shared.getTime())) {
cachedData = await getWithCacheAdapter(id, methodKey, l2Cache, tag);
}
data = dataOrUpdater(cachedData);
if (data === shared.undefinedValue) {
return;
}
}
return shared.PromiseCls.all([
policy !== 'l2' && setWithCacheAdapter(id, methodKey, data, expireMilliseconds(shared.MEMORY), l1Cache, hitSource),
policy === 'l2' || (policy === 'all' && toStore)
? setWithCacheAdapter(id, methodKey, data, expireMilliseconds(shared.STORAGE_RESTORE), l2Cache, hitSource, tag)
: shared.undefinedValue
]);
});
return shared.PromiseCls.all(batchPromises);
};
/**
* invalid cache
* @param matcher Method instance matcher
*/
const invalidateCache = async (matcher) => {
if (!matcher) {
await shared.PromiseCls.all([clearWithCacheAdapter(usingL1CacheAdapters), clearWithCacheAdapter(usingL2CacheAdapters)]);
return;
}
const methodInstances = shared.isArray(matcher) ? matcher : [matcher];
const batchPromises = methodInstances.map(methodInstance => {
const { id, l1Cache, l2Cache } = shared.getContext(methodInstance);
const { c: controlled, m: cacheMode } = shared.getLocalCacheConfigParam(methodInstance);
// don't invalidate cache when it's controlled cache.
if (controlled) {
return;
}
const methodKey = shared.getMethodInternalKey(methodInstance);
return shared.PromiseCls.all([
removeWithCacheAdapter(id, methodKey, l1Cache),
cacheMode === shared.STORAGE_RESTORE ? removeWithCacheAdapter(id, methodKey, l2Cache) : shared.promiseResolve()
]);
});
await shared.PromiseCls.all(batchPromises);
};
/**
* hit(invalidate) target caches by source method
* this is the implementation of auto invalidate cache
* @param sourceMethod source method instance
*/
const hitCacheBySource = async (sourceMethod) => {
// Find the hit target cache and invalidate its cache
// Control the automatic cache invalidation range through global configuration `autoHitCache`
const { autoHitCache } = exports.globalConfigMap;
const { l1Cache, l2Cache } = shared.getContext(sourceMethod);
const sourceKey = shared.getMethodInternalKey(sourceMethod);
const { name: sourceName } = shared.getConfig(sourceMethod);
const cacheAdaptersInvolved = {
global: [...usingL1CacheAdapters, ...usingL2CacheAdapters],
self: [l1Cache, l2Cache],
close: []
}[autoHitCache];
if (cacheAdaptersInvolved && shared.len(cacheAdaptersInvolved)) {
await shared.PromiseCls.all(shared.mapItem(cacheAdaptersInvolved, involvedCacheAdapter => hitTargetCacheWithCacheAdapter(sourceKey, sourceName, involvedCacheAdapter)));
}
};
const adapterReturnMap = {};
/**
* actual request function
* @param method request method object
* @param forceRequest Ignore cache
* @returns response data
*/
function sendRequest(methodInstance, forceRequest) {
let fromCache = shared.trueValue;
let requestAdapterCtrlsPromiseResolveFn;
const requestAdapterCtrlsPromise = shared.newInstance(shared.PromiseCls, resolve => {
requestAdapterCtrlsPromiseResolveFn = resolve;
});
const response = async () => {
const { beforeRequest = shared.noop, responded, requestAdapter, cacheLogger } = shared.getOptions(methodInstance);
const methodKey = shared.getMethodInternalKey(methodInstance);
const { s: toStorage, t: tag, m: cacheMode, e: expireMilliseconds } = shared.getLocalCacheConfigParam(methodInstance);
const { id, l1Cache, l2Cache, snapshots } = shared.getContext(methodInstance);
// Get controlled cache or uncontrolled cache
const { cacheFor } = shared.getConfig(methodInstance);
const { hitSource: methodHitSource } = methodInstance;
// If the current method sets a controlled cache, check whether there is custom data
let cachedResponse = await (shared.isFn(cacheFor)
? cacheFor()
: // If it is a forced request, skip the step of getting it from the cache
// Otherwise, determine whether to use cached data
forceRequest
? shared.undefinedValue
: getWithCacheAdapter(id, methodKey, l1Cache));
// If it is storage restore mode and there is no data in the cache, the persistent data needs to be restored to the cache, and the cached expiration time must be used.
if (cacheMode === shared.STORAGE_RESTORE && !cachedResponse && !forceRequest) {
const rawL2CacheData = await getRawWithCacheAdapter(id, methodKey, l2Cache, tag);
if (rawL2CacheData) {
const [l2Response, l2ExpireMilliseconds] = rawL2CacheData;
await setWithCacheAdapter(id, methodKey, l2Response, l2ExpireMilliseconds, l1Cache, methodHitSource);
cachedResponse = l2Response;
}
}
// Clone the method as a parameter and pass it to beforeRequest to prevent side effects when using the original method instance request multiple times.
// Place it after `let cachedResponse = await...` to solve the problem of first assigning promise to the method instance in method.send, otherwise the promise will be undefined in clonedMethod.
const clonedMethod = cloneMethod(methodInstance);
// Call the hook function before sending the request
// beforeRequest supports synchronous functions and asynchronous functions
await beforeRequest(clonedMethod);
const { baseURL, url: newUrl, type, data } = clonedMethod;
const { params = {}, headers = {}, transform = shared.$self, shareRequest } = shared.getConfig(clonedMethod);
const namespacedAdapterReturnMap = (adapterReturnMap[id] = adapterReturnMap[id] || {});
const requestBody = clonedMethod.data;
const requestBodyIsSpecial = shared.isSpecialRequestBody(requestBody);
// Will not share the request when requestBody is special data
let requestAdapterCtrls = requestBodyIsSpecial ? shared.undefinedValue : namespacedAdapterReturnMap[methodKey];
let responseSuccessHandler = shared.$self;
let responseErrorHandler = shared.undefinedValue;
let responseCompleteHandler = shared.noop;
// uniform handler of onSuccess, onError, onComplete
if (shared.isFn(responded)) {
responseSuccessHandler = responded;
}
else if (shared.isPlainObject(responded)) {
const { onSuccess: successHandler, onError: errorHandler, onComplete: completeHandler } = responded;
responseSuccessHandler = shared.isFn(successHandler) ? successHandler : responseSuccessHandler;
responseErrorHandler = shared.isFn(errorHandler) ? errorHandler : responseErrorHandler;
responseCompleteHandler = shared.isFn(completeHandler) ? completeHandler : responseCompleteHandler;
}
// If there is no cache, make a request
if (cachedResponse !== shared.undefinedValue) {
requestAdapterCtrlsPromiseResolveFn(); // Ctrls will not be passed in when cache is encountered
// Print cache log
clonedMethod.fromCache = shared.trueValue;
shared.sloughFunction(cacheLogger, defaultCacheLogger)(cachedResponse, clonedMethod, cacheMode, tag);
responseCompleteHandler(clonedMethod);
return cachedResponse;
}
fromCache = shared.falseValue;
if (!shareRequest || !requestAdapterCtrls) {
// Request data
const ctrls = requestAdapter({
url: shared.buildCompletedURL(baseURL, newUrl, params),
type,
data,
headers
}, clonedMethod);
requestAdapterCtrls = namespacedAdapterReturnMap[methodKey] = ctrls;
}
// Pass request adapter ctrls to promise for use in on download, on upload and abort
requestAdapterCtrlsPromiseResolveFn(requestAdapterCtrls);
/**
* Process response tasks and do not cache data on failure
* @param responsePromise Respond to promise instances
* @param responseHeaders Request header
* @param callInSuccess Whether to call in success callback
* @returns Processed response
*/
const handleResponseTask = async (handlerReturns, responseHeaders, callInSuccess = shared.trueValue) => {
const responseData = await handlerReturns;
const transformedData = await transform(responseData, responseHeaders || {});
snapshots.save(methodInstance);
// Even if the cache operation fails, the response structure will be returned normally to avoid request errors caused by cache operation problems.
// The cache operation results can be obtained through `cacheAdapter.emitter.on('success' | 'fail', event => {})`
try {
// Automatic cache invalidation
await hitCacheBySource(clonedMethod);
}
catch (_a) { }
// Do not save cache when requestBody is special data
// Reason 1: Special data is generally submitted and requires interaction with the server.
// Reason 2: Special data is not convenient for generating cache keys
const toCache = !requestBody || !requestBodyIsSpecial;
// Use the latest expiration time after the response to cache data to avoid the problem of expiration time loss due to too long response time
if (toCache && callInSuccess) {
try {
await shared.PromiseCls.all([
setWithCacheAdapter(id, methodKey, transformedData, expireMilliseconds(shared.MEMORY), l1Cache, methodHitSource),
toStorage &&
setWithCacheAdapter(id, methodKey, transformedData, expireMilliseconds(shared.STORAGE_RESTORE), l2Cache, methodHitSource, tag)
]);
}
catch (_b) { }
}
// Deep clone the transformed data before returning to avoid reference issues
// the `deepClone` will only clone array and plain object
return shared.deepClone(transformedData);
};
return shared.promiseFinally(shared.promiseThen(shared.PromiseCls.all([requestAdapterCtrls.response(), requestAdapterCtrls.headers()]), ([rawResponse, rawHeaders]) => {
// Regardless of whether the request succeeds or fails, the shared request needs to be removed first
shared.deleteAttr(namespacedAdapterReturnMap, methodKey);
return handleResponseTask(responseSuccessHandler(rawResponse, clonedMethod), rawHeaders);
}, (error) => {
// Regardless of whether the request succeeds or fails, the shared request needs to be removed first
shared.deleteAttr(namespacedAdapterReturnMap, methodKey);
return shared.isFn(responseErrorHandler)
? // When responding to an error, if no error is thrown, the successful response process will be processed, but the data will not be cached.
handleResponseTask(responseErrorHandler(error, clonedMethod), shared.undefinedValue, shared.falseValue)
: shared.promiseReject(error);
}), () => {
responseCompleteHandler(clonedMethod);
});
};
return {
// request interrupt function
abort: () => {
shared.promiseThen(requestAdapterCtrlsPromise, requestAdapterCtrls => requestAdapterCtrls && requestAdapterCtrls.abort());
},
onDownload: (handler) => {
shared.promiseThen(requestAdapterCtrlsPromise, requestAdapterCtrls => requestAdapterCtrls && requestAdapterCtrls.onDownload && requestAdapterCtrls.onDownload(handler));
},
onUpload: (handler) => {
shared.promiseThen(requestAdapterCtrlsPromise, requestAdapterCtrls => requestAdapterCtrls && requestAdapterCtrls.onUpload && requestAdapterCtrls.onUpload(handler));
},
response,
fromCache: () => fromCache
};
}
const offEventCallback = (offHandler, handlers) => () => {
const index = handlers.indexOf(offHandler);
index >= 0 && handlers.splice(index, 1);
};
class Method {
constructor(type, context, url, config, data) {
this.dhs = [];
this.uhs = [];
this.fromCache = shared.undefinedValue;
const abortRequest = () => {
abortRequest.a();
};
abortRequest.a = shared.noop;
const instance = this;
const contextOptions = shared.getContextOptions(context);
instance.abort = abortRequest;
instance.baseURL = contextOptions.baseURL || '';
instance.url = url;
instance.type = type;
instance.context = context;
// Merge request-related global configuration into the method object
const contextConcatConfig = {};
const mergedLocalCacheKey = 'cacheFor';
const globalLocalCache = shared.isPlainObject(contextOptions[mergedLocalCacheKey])
? contextOptions[mergedLocalCacheKey][type]
: shared.undefinedValue;
const hitSource = config && config.hitSource;
// Merge parameters
shared.forEach(['timeout', 'shareRequest'], mergedKey => {
if (contextOptions[mergedKey] !== shared.undefinedValue) {
contextConcatConfig[mergedKey] = contextOptions[mergedKey];
}
});
// Merge local cache
if (globalLocalCache !== shared.undefinedValue) {
contextConcatConfig[mergedLocalCacheKey] = globalLocalCache;
}
// Unify hit sources into arrays and convert them into method keys when there are method instances
if (hitSource) {
instance.hitSource = shared.mapItem(shared.isArray(hitSource) ? hitSource : [hitSource], sourceItem => shared.instanceOf(sourceItem, Method) ? shared.getMethodInternalKey(sourceItem) : sourceItem);
shared.deleteAttr(config, 'hitSource');
}
instance.config = {
...contextConcatConfig,
headers: {},
params: {},
...(config || {})
};
instance.data = data;
instance.meta = config ? config.meta : instance.meta;
// The original key needs to be used externally instead of generating the key in real time.
// The reason is that the parameters of the method may pass in reference type values, but when the reference type value changes externally, the key generated in real time also changes, so it is more accurate to use the initial key.
instance.key = instance.generateKey();
}
/**
* Bind download progress callback function
* @param progressHandler Download progress callback function
* @version 2.17.0
* @return unbind function
*/
onDownload(downloadHandler) {
shared.pushItem(this.dhs, downloadHandler);
return offEventCallback(downloadHandler, this.dhs);
}
/**
* Bind upload progress callback function
* @param progressHandler Upload progress callback function
* @version 2.17.0
* @return unbind function
*/
onUpload(uploadHandler) {
shared.pushItem(this.uhs, uploadHandler);
return offEventCallback(uploadHandler, this.uhs);
}
/**
* Send a request through a method instance and return a promise object
*/
send(forceRequest = shared.falseValue) {
const instance = this;
const { response, onDownload, onUpload, abort, fromCache } = sendRequest(instance, forceRequest);
shared.len(instance.dhs) > 0 &&
onDownload((loaded, total) => shared.forEach(instance.dhs, handler => handler({ loaded, total })));
shared.len(instance.uhs) > 0 && onUpload((loaded, total) => shared.forEach(instance.uhs, handler => handler({ loaded, total })));
// The interrupt function is bound to the method instance for each request. The user can also interrupt the current request through method instance.abort()
instance.abort.a = abort;
instance.fromCache = shared.undefinedValue;
instance.promise = shared.promiseThen(response(), r => {
instance.fromCache = fromCache();
return r;
});
return instance.promise;
}
/**
* Set the method name, if there is already a name it will be overwritten
* @param name method name
*/
setName(name) {
shared.getConfig(this).name = name;
}
generateKey() {
return shared.key(this);
}
/**
* Bind callbacks for resolve and/or reject Promise
* @param onfulfilled The callback to be executed when resolving the Promise
* @param onrejected The callback to be executed when the Promise is rejected
* @returns Returns a Promise for executing any callbacks
*/
then(onfulfilled, onrejected) {
return shared.promiseThen(this.send(), onfulfilled, onrejected);
}
/**
* Bind a callback only for reject Promise
* @param onrejected The callback to be executed when the Promise is rejected
* @returns Returns a Promise that completes the callback
*/
catch(onrejected) {
return shared.promiseCatch(this.send(), onrejected);
}
/**
* Bind a callback that is called when the Promise is resolved (resolve or reject)
* @param onfinally Callback executed when Promise is resolved (resolve or reject).
* @return Returns a Promise that completes the callback.
*/
finally(onfinally) {
return shared.promiseFinally(this.send(), onfinally);
}
}
/**
* Custom assertion function, throws an error when the expression is false
* @param expression Judgment expression, true or false
* @param msg assert message
*/
const myAssert = shared.createAssert();
// local storage will not fail the operation.
const EVENT_SUCCESS_KEY = 'success';
const memoryAdapter = () => {
let l1Cache = {};
const l1CacheEmitter = shared.createEventManager();
const adapter = {
set(key, value) {
l1Cache[key] = value;
l1CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'set', key, value, container: l1Cache });
},
get: key => {
const value = l1Cache[key];
l1CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'get', key, value, container: l1Cache });
return value;
},
remove(key) {
shared.deleteAttr(l1Cache, key);
l1CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'remove', key, container: l1Cache });
},
clear: () => {
l1Cache = {};
l1CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'clear', key: '', container: l1Cache });
},
emitter: l1CacheEmitter
};
return adapter;
};
const localStorageAdapter = () => {
const l2CacheEmitter = shared.createEventManager();
const instance = localStorage;
const adapter = {
set: (key, value) => {
instance.setItem(key, shared.JSONStringify(value));
l2CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'set', key, value, container: instance });
},
get: key => {
const data = instance.getItem(key);
const value = data ? shared.JSONParse(data) : data;
l2CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'get', key, value, container: instance });
return value;
},
remove: key => {
instance.removeItem(key);
l2CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'remove', key, container: instance });
},
clear: () => {
instance.clear();
l2CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'clear', key: '', container: instance });
},
emitter: l2CacheEmitter
};
return adapter;
};
const placeholderAdapter = () => {
const l2CacheNotDefinedAssert = () => {
myAssert(shared.falseValue, 'l2Cache is not defined.');
};
return {
set: () => {
l2CacheNotDefinedAssert();
},
get: () => {
l2CacheNotDefinedAssert();
return shared.undefinedValue;
},
remove: () => {
l2CacheNotDefinedAssert();
},
clear: () => { }
};
};
const SetCls = Set;
class MethodSnapshotContainer {
constructor(capacity) {
/**
* Method instance snapshot collection, method instances that have sent requests will be saved
*/
this.records = {};
this.occupy = 0;
myAssert(capacity >= 0, 'expected snapshots limit to be >= 0');
this.capacity = capacity;
}
/**
* Save method instance snapshot
* @param methodInstance method instance
*/
save(methodInstance) {
const { name } = shared.getConfig(methodInstance);
const { records, occupy, capacity } = this;
if (name && occupy < capacity) {
// Using the name of the method as the key, save the method instance to the snapshot
const targetSnapshots = (records[name] = records[name] || shared.newInstance(SetCls));
targetSnapshots.add(methodInstance);
// Statistical quantity
this.occupy += 1;
}
}
/**
* Get a Method instance snapshot, which will filter out the corresponding Method instance based on the matcher
* @param matcher Matching snapshot name, which can be a string or regular expression, or an object with a filter function
* @returns Array of matched Method instance snapshots
*/
match(matcher, matchAll = true) {
// Unify the filter parameters into name matcher and match handler
let nameString;
let nameReg;
let matchHandler;
let nameMatcher = matcher;
if (shared.isPlainObject(matcher)) {
nameMatcher = matcher.name;
matchHandler = matcher.filter;
}
if (shared.instanceOf(nameMatcher, shared.RegExpCls)) {
nameReg = nameMatcher;
}
else if (shared.isString(nameMatcher)) {
nameString = nameMatcher;
}
const { records } = this;
// Get the corresponding method instance snapshot through the deconstructed name matcher and filter handler
let matches = shared.newInstance((SetCls));
// If the namespace parameter is provided, it will only be searched in this namespace, otherwise it will be searched in all cached data.
if (nameString) {
matches = records[nameString] || matches;
}
else if (nameReg) {
shared.forEach(shared.filterItem(shared.objectKeys(records), methodName => nameReg.test(methodName)), methodName => {
records[methodName].forEach(method => matches.add(method));
});
}
const fromMatchesArray = shared.isFn(matchHandler) ? shared.filterItem([...matches], matchHandler) : [...matches];
return (matchAll ? fromMatchesArray : fromMatchesArray[0]);
}
}
const typeGet = 'GET';
const typeHead = 'HEAD';
const typePost = 'POST';
const typePut = 'PUT';
const typePatch = 'PATCH';
const typeDelete = 'DELETE';
const typeOptions = 'OPTIONS';
const defaultAlovaOptions = {
/**
* GET requests are cached for 5 minutes (300000 milliseconds) by default, and other requests are not cached by default.
*/
cacheFor: {
[typeGet]: 300000
},
/**
* Share requests default to true
*/
shareRequest: shared.trueValue,
/**
* Number of method snapshots, default is 1000
*/
snapshots: 1000
};
let idCount = 0;
class Alova {
constructor(options) {
var _a, _b;
const instance = this;
instance.id = (options.id || (idCount += 1)).toString();
// If storage is not specified, local storage is used by default.
instance.l1Cache = options.l1Cache || memoryAdapter();
instance.l2Cache =
options.l2Cache || (typeof localStorage !== 'undefined' ? localStorageAdapter() : placeholderAdapter());
// Merge default options
instance.options = {
...defaultAlovaOptions,
...options
};
instance.snapshots = shared.newInstance((MethodSnapshotContainer), (_b = (_a = options.snapshots) !== null && _a !== void 0 ? _a : defaultAlovaOptions.snapshots) !== null && _b !== void 0 ? _b : 0);
}
Get(url, config) {
return shared.newInstance((Method), typeGet, this, url, config);
}
Post(url, data, config) {
return shared.newInstance((Method), typePost, this, url, config, data);
}
Delete(url, data, config) {
return shared.newInstance((Method), typeDelete, this, url, config, data);
}
Put(url, data, config) {
return shared.newInstance((Method), typePut, this, url, config, data);
}
Head(url, config) {
return shared.newInstance((Method), typeHead, this, url, config);
}
Patch(url, data, config) {
return shared.newInstance((Method), typePatch, this, url, config, data);
}
Options(url, config) {
return shared.newInstance((Method), typeOptions, this, url, config);
}
}
let boundStatesHook = shared.undefinedValue;
const usingL1CacheAdapters = [];
const usingL2CacheAdapters = [];
/**
* create an alova instance.
* @param options alova configuration.
* @returns alova instance.
*/
const createAlova = (options) => {
const alovaInstance = shared.newInstance((Alova), options);
const newStatesHook = alovaInstance.options.statesHook;
if (boundStatesHook) {
myAssert(boundStatesHook === newStatesHook, 'expected to use the same `statesHook`');
}
boundStatesHook = newStatesHook;
const { l1Cache, l2Cache } = alovaInstance;
!usingL1CacheAdapters.includes(l1Cache) && shared.pushItem(usingL1CacheAdapters, l1Cache);
!usingL2CacheAdapters.includes(l2Cache) && shared.pushItem(usingL2CacheAdapters, l2Cache);
return alovaInstance;
};
const promiseStatesHook = () => {
myAssert(!!boundStatesHook, '`statesHook` is not set in alova instance');
return boundStatesHook;
};
exports.Method = Method;
exports.createAlova = createAlova;
exports.globalConfig = globalConfig;
exports.hitCacheBySource = hitCacheBySource;
exports.invalidateCache = invalidateCache;
exports.promiseStatesHook = promiseStatesHook;
exports.queryCache = queryCache;
exports.setCache = setCache;

921
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/alova.esm.js

@ -1,921 +0,0 @@
/**
* alova 3.2.10 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
import { isSSR, STORAGE_RESTORE, len, getTime, buildNamespacedCacheKey, filterItem, undefinedValue, forEach, instanceOf, RegExpCls, pushItem, mapItem, objectKeys, PromiseCls, newInstance, deleteAttr, getContext, objAssign, getMethodInternalKey, getLocalCacheConfigParam, isArray, isFn, MEMORY, promiseResolve, getConfig, promiseThen, trueValue, getOptions, isSpecialRequestBody, isPlainObject, sloughFunction, falseValue, buildCompletedURL, promiseFinally, promiseReject, noop, $self, deepClone, getContextOptions, key, promiseCatch, createAssert, createEventManager, JSONStringify, JSONParse, isString } from '@alova/shared';
let globalConfigMap = {
autoHitCache: 'global',
ssr: isSSR
};
/**
* Set global configuration
* @param config
*/
var globalConfig = (config) => {
globalConfigMap = {
...globalConfigMap,
...config
};
};
const titleStyle = 'color: black; font-size: 12px; font-weight: bolder';
/**
* Default cacheLogger function
*/
var defaultCacheLogger = (response, methodInstance, cacheMode, tag) => {
const cole = console;
// eslint-disable-next-line
const log = (...args) => console.log(...args);
const { url } = methodInstance;
const isRestoreMode = cacheMode === STORAGE_RESTORE;
const hdStyle = '\x1B[42m%s\x1B[49m';
const labelStyle = '\x1B[32m%s\x1B[39m';
const startSep = ` [HitCache]${url} `;
const endSepFn = () => Array(len(startSep) + 1).join('^');
if (globalConfigMap.ssr) {
log(hdStyle, startSep);
log(labelStyle, ' Cache ', response);
log(labelStyle, ' Mode ', cacheMode);
isRestoreMode && log(labelStyle, ' Tag ', tag);
log(labelStyle, endSepFn());
}
else {
cole.groupCollapsed
? cole.groupCollapsed('%cHitCache', 'padding: 2px 6px; background: #c4fcd3; color: #53b56d;', url)
: log(hdStyle, startSep);
log('%c[Cache]', titleStyle, response);
log('%c[Mode]', titleStyle, cacheMode);
isRestoreMode && log('%c[Tag]', titleStyle, tag);
log('%c[Method]', titleStyle, methodInstance);
cole.groupEnd ? cole.groupEnd() : log(labelStyle, endSepFn());
}
};
const hitSourceStringCacheKey = (key) => `hss.${key}`;
const hitSourceRegexpPrefix = 'hsr.';
const hitSourceRegexpCacheKey = (regexpStr) => hitSourceRegexpPrefix + regexpStr;
const unifiedHitSourceRegexpCacheKey = '$$hsrs';
const regexpSourceFlagSeparator = '__$<>$__';
const addItem = (obj, item) => {
obj[item] = 0;
};
/**
* set or update cache
* @param namespace namespace
* @param key stored key
* @param response Stored response content
* @param expireTimestamp Timestamp representation of expiration time point
* @param storage storage object
* @param tag Storage tags, used to distinguish different storage tags
*/
const setWithCacheAdapter = async (namespace, key, data, expireTimestamp, cacheAdapter, hitSource, tag) => {
// not to cache if expireTimestamp is less than current timestamp
if (expireTimestamp > getTime() && data) {
const methodCacheKey = buildNamespacedCacheKey(namespace, key);
await cacheAdapter.set(methodCacheKey, filterItem([data, expireTimestamp === Infinity ? undefinedValue : expireTimestamp, tag], Boolean));
// save the relationship between this method and its hitSources.
// cache structure is like this:
/*
{
"$a.[namespace][methodKey]": [cache data],
...
"hss.[sourceMethodKey]": "{
[targetMethodKey1]: 0,
[targetMethodKey2]: 0,
...
}",
"hss.[sourceMethodName]": "{
[targetMethodKey3]: 0,
[targetMethodKey4]: 0,
...
}",
"hsr.[sourceMethodNameRegexpSource]": "{
[targetMethodKey5]: 0,
[targetMethodKey6]: 0,
...
}",
"hsr.regexp1": ["hss.key1", "hss.key2"],
"hsr.regexp2": ["hss.key1", "hss.key2"]
}
*/
if (hitSource) {
// filter repeat items and categorize the regexp, to prevent unnecessary cost of IO
const hitSourceKeys = {};
const hitSourceRegexpSources = [];
forEach(hitSource, sourceItem => {
const isRegexp = instanceOf(sourceItem, RegExpCls);
const targetHitSourceKey = isRegexp
? sourceItem.source + (sourceItem.flags ? regexpSourceFlagSeparator + sourceItem.flags : '')
: sourceItem;
if (targetHitSourceKey) {
if (isRegexp && !hitSourceKeys[targetHitSourceKey]) {
pushItem(hitSourceRegexpSources, targetHitSourceKey);
}
addItem(hitSourceKeys, isRegexp ? hitSourceRegexpCacheKey(targetHitSourceKey) : hitSourceStringCacheKey(targetHitSourceKey));
}
});
// save the relationship. Minimize IO as much as possible
const promises = mapItem(objectKeys(hitSourceKeys), async (hitSourceKey) => {
// filter the empty strings.
const targetMethodKeys = (await cacheAdapter.get(hitSourceKey)) || {};
addItem(targetMethodKeys, methodCacheKey);
await cacheAdapter.set(hitSourceKey, targetMethodKeys);
});
const saveRegexp = async () => {
// save the regexp source if regexp exists.
if (len(hitSourceRegexpSources)) {
const regexpList = (await cacheAdapter.get(unifiedHitSourceRegexpCacheKey)) || [];
// TODO: hitSourceRegexpSources needs to be deduplicated
pushItem(regexpList, ...hitSourceRegexpSources);
await cacheAdapter.set(unifiedHitSourceRegexpCacheKey, regexpList);
}
};
// parallel executing all async tasks.
await PromiseCls.all([...promises, saveRegexp()]);
}
}
};
/**
* Delete stored response data
* @param namespace namespace
* @param key stored key
* @param storage storage object
*/
const removeWithCacheAdapter = async (namespace, key, cacheAdapter) => {
const methodStoreKey = buildNamespacedCacheKey(namespace, key);
await cacheAdapter.remove(methodStoreKey);
};
/**
* Get stored response data
* @param namespace namespace
* @param key stored key
* @param storage storage object
* @param tag Store tags. If the tag changes, the data will become invalid.
*/
const getRawWithCacheAdapter = async (namespace, key, cacheAdapter, tag) => {
const storagedData = await cacheAdapter.get(buildNamespacedCacheKey(namespace, key));
if (storagedData) {
// Eslint disable next line
const [dataUnused, expireTimestamp, storedTag] = storagedData;
// If there is no expiration time, it means that the data will never expire. Otherwise, you need to determine whether it has expired.
if (storedTag === tag && (!expireTimestamp || expireTimestamp > getTime())) {
return storagedData;
}
// If expired, delete cache
await removeWithCacheAdapter(namespace, key, cacheAdapter);
}
};
/**
* Get stored response data
* @param namespace namespace
* @param key stored key
* @param storage storage object
* @param tag Store tags. If the tag changes, the data will become invalid.
*/
const getWithCacheAdapter = async (namespace, key, cacheAdapter, tag) => {
const rawData = await getRawWithCacheAdapter(namespace, key, cacheAdapter, tag);
return rawData ? rawData[0] : undefinedValue;
};
/**
* clear all cached data
*/
const clearWithCacheAdapter = async (cacheAdapters) => PromiseCls.all(cacheAdapters.map(cacheAdapter => cacheAdapter.clear()));
/**
* query and delete target cache with key and name of source method instance.
* @param sourceKey source method instance key
* @param sourceName source method instance name
* @param cacheAdapter cache adapter
*/
const hitTargetCacheWithCacheAdapter = async (sourceKey, sourceName, cacheAdapter) => {
const sourceNameStr = `${sourceName}`;
// map that recording the source key and target method keys.
const sourceTargetKeyMap = {};
// get hit key by method key.
const hitSourceKey = hitSourceStringCacheKey(sourceKey);
sourceTargetKeyMap[hitSourceKey] = await cacheAdapter.get(hitSourceKey);
let unifiedHitSourceRegexpChannel;
if (sourceName) {
const hitSourceName = hitSourceStringCacheKey(sourceNameStr);
// get hit key by method name if it is exists.
sourceTargetKeyMap[hitSourceName] = await cacheAdapter.get(hitSourceName);
// match regexped key by source method name and get hit key by method name.
unifiedHitSourceRegexpChannel = await cacheAdapter.get(unifiedHitSourceRegexpCacheKey);
const matchedRegexpStrings = [];
if (unifiedHitSourceRegexpChannel && len(unifiedHitSourceRegexpChannel)) {
forEach(unifiedHitSourceRegexpChannel, regexpStr => {
const [source, flag] = regexpStr.split(regexpSourceFlagSeparator);
if (newInstance(RegExpCls, source, flag).test(sourceNameStr)) {
pushItem(matchedRegexpStrings, regexpStr);
}
});
// parallel get hit key by matched regexps.
await PromiseCls.all(mapItem(matchedRegexpStrings, async (regexpString) => {
const hitSourceRegexpString = hitSourceRegexpCacheKey(regexpString);
sourceTargetKeyMap[hitSourceRegexpString] = await cacheAdapter.get(hitSourceRegexpString);
}));
}
}
const removeWithTargetKey = async (targetKey) => {
try {
await cacheAdapter.remove(targetKey);
// loop sourceTargetKeyMap and remove this key to prevent unnecessary cost of IO.
for (const sourceKey in sourceTargetKeyMap) {
const targetKeys = sourceTargetKeyMap[sourceKey];
if (targetKeys) {
deleteAttr(targetKeys, targetKey);
}
}
}
catch (_a) {
// the try-catch is used to prevent throwing error, cause throwing error in `Promise.all` below.
}
};
// now let's start to delete target caches.
// and filter the finished keys.
const accessedKeys = {};
await PromiseCls.all(mapItem(objectKeys(sourceTargetKeyMap), async (sourceKey) => {
const targetKeys = sourceTargetKeyMap[sourceKey];
if (targetKeys) {
const removingPromises = [];
for (const key in targetKeys) {
if (!accessedKeys[key]) {
addItem(accessedKeys, key);
pushItem(removingPromises, removeWithTargetKey(key));
}
}
await PromiseCls.all(removingPromises);
}
}));
// update source key if there is still has keys.
// remove source key if its keys is empty.
const unifiedHitSourceRegexpChannelLen = len(unifiedHitSourceRegexpChannel || []);
await PromiseCls.all(mapItem(objectKeys(sourceTargetKeyMap), async (sourceKey) => {
const targetKeys = sourceTargetKeyMap[sourceKey];
if (targetKeys) {
if (len(objectKeys(targetKeys))) {
await cacheAdapter.set(sourceKey, targetKeys);
}
else {
await cacheAdapter.remove(sourceKey);
// if this is a regexped key, need to remove it from unified regexp channel.
if (sourceKey.includes(hitSourceRegexpPrefix) && unifiedHitSourceRegexpChannel) {
unifiedHitSourceRegexpChannel = filterItem(unifiedHitSourceRegexpChannel, rawRegexpStr => hitSourceRegexpCacheKey(rawRegexpStr) !== sourceKey);
}
}
}
}));
// update unified hit source regexp channel if its length was changed.
if (unifiedHitSourceRegexpChannelLen !== len(unifiedHitSourceRegexpChannel || [])) {
await cacheAdapter.set(unifiedHitSourceRegexpCacheKey, unifiedHitSourceRegexpChannel);
}
};
var cloneMethod = (methodInstance) => {
const { data, config } = methodInstance;
const newConfig = { ...config };
const { headers = {}, params = {} } = newConfig;
const ctx = getContext(methodInstance);
newConfig.headers = { ...headers };
newConfig.params = { ...params };
const newMethod = newInstance((Method), methodInstance.type, ctx, methodInstance.url, newConfig, data);
return objAssign(newMethod, {
...methodInstance,
config: newConfig
});
};
/*
* The matchers in the following three functions are Method instance matchers, which are divided into three situations:
* 1. If the matcher is a Method instance, clear the cache of the Method instance.
* 2. If matcher is a string or regular expression, clear the cache of all Method instances that meet the conditions.
* 3. If no matcher is passed in, all caches will be cleared.
*/
/**
* Query cache
* @param matcher Method instance matcher
* @returns Cache data, return undefined if not found
*/
const queryCache = async (matcher, { policy = 'all' } = {}) => {
// if key exists, that means it's a method instance.
if (matcher && matcher.key) {
const { id, l1Cache, l2Cache } = getContext(matcher);
const methodKey = getMethodInternalKey(matcher);
const { f: cacheFor, c: controlled, s: store, e: expireMilliseconds, t: tag } = getLocalCacheConfigParam(matcher);
// if it's controlled cache, it will return the result of cacheFor function.
if (controlled) {
return cacheFor();
}
let cachedData = policy !== 'l2' ? await getWithCacheAdapter(id, methodKey, l1Cache) : undefinedValue;
if (policy === 'l2') {
cachedData = await getWithCacheAdapter(id, methodKey, l2Cache, tag);
}
else if (policy === 'all' && !cachedData) {
if (store && expireMilliseconds(STORAGE_RESTORE) > getTime()) {
cachedData = await getWithCacheAdapter(id, methodKey, l2Cache, tag);
}
}
return cachedData;
}
};
/**
* Manually set cache response data. If the corresponding methodInstance sets persistent storage, the cache in the persistent storage will also be checked out.
* @param matcher Method instance matcher cache data
*/
const setCache = async (matcher, dataOrUpdater, { policy = 'all' } = {}) => {
const methodInstances = isArray(matcher) ? matcher : [matcher];
const batchPromises = methodInstances.map(async (methodInstance) => {
const { hitSource } = methodInstance;
const { id, l1Cache, l2Cache } = getContext(methodInstance);
const methodKey = getMethodInternalKey(methodInstance);
const { e: expireMilliseconds, s: toStore, t: tag, c: controlled } = getLocalCacheConfigParam(methodInstance);
// don't set cache when it's controlled cache.
if (controlled) {
return;
}
let data = dataOrUpdater;
if (isFn(dataOrUpdater)) {
let cachedData = policy !== 'l2' ? await getWithCacheAdapter(id, methodKey, l1Cache) : undefinedValue;
if (policy === 'l2' ||
(policy === 'all' && !cachedData && toStore && expireMilliseconds(STORAGE_RESTORE) > getTime())) {
cachedData = await getWithCacheAdapter(id, methodKey, l2Cache, tag);
}
data = dataOrUpdater(cachedData);
if (data === undefinedValue) {
return;
}
}
return PromiseCls.all([
policy !== 'l2' && setWithCacheAdapter(id, methodKey, data, expireMilliseconds(MEMORY), l1Cache, hitSource),
policy === 'l2' || (policy === 'all' && toStore)
? setWithCacheAdapter(id, methodKey, data, expireMilliseconds(STORAGE_RESTORE), l2Cache, hitSource, tag)
: undefinedValue
]);
});
return PromiseCls.all(batchPromises);
};
/**
* invalid cache
* @param matcher Method instance matcher
*/
const invalidateCache = async (matcher) => {
if (!matcher) {
await PromiseCls.all([clearWithCacheAdapter(usingL1CacheAdapters), clearWithCacheAdapter(usingL2CacheAdapters)]);
return;
}
const methodInstances = isArray(matcher) ? matcher : [matcher];
const batchPromises = methodInstances.map(methodInstance => {
const { id, l1Cache, l2Cache } = getContext(methodInstance);
const { c: controlled, m: cacheMode } = getLocalCacheConfigParam(methodInstance);
// don't invalidate cache when it's controlled cache.
if (controlled) {
return;
}
const methodKey = getMethodInternalKey(methodInstance);
return PromiseCls.all([
removeWithCacheAdapter(id, methodKey, l1Cache),
cacheMode === STORAGE_RESTORE ? removeWithCacheAdapter(id, methodKey, l2Cache) : promiseResolve()
]);
});
await PromiseCls.all(batchPromises);
};
/**
* hit(invalidate) target caches by source method
* this is the implementation of auto invalidate cache
* @param sourceMethod source method instance
*/
const hitCacheBySource = async (sourceMethod) => {
// Find the hit target cache and invalidate its cache
// Control the automatic cache invalidation range through global configuration `autoHitCache`
const { autoHitCache } = globalConfigMap;
const { l1Cache, l2Cache } = getContext(sourceMethod);
const sourceKey = getMethodInternalKey(sourceMethod);
const { name: sourceName } = getConfig(sourceMethod);
const cacheAdaptersInvolved = {
global: [...usingL1CacheAdapters, ...usingL2CacheAdapters],
self: [l1Cache, l2Cache],
close: []
}[autoHitCache];
if (cacheAdaptersInvolved && len(cacheAdaptersInvolved)) {
await PromiseCls.all(mapItem(cacheAdaptersInvolved, involvedCacheAdapter => hitTargetCacheWithCacheAdapter(sourceKey, sourceName, involvedCacheAdapter)));
}
};
const adapterReturnMap = {};
/**
* actual request function
* @param method request method object
* @param forceRequest Ignore cache
* @returns response data
*/
function sendRequest(methodInstance, forceRequest) {
let fromCache = trueValue;
let requestAdapterCtrlsPromiseResolveFn;
const requestAdapterCtrlsPromise = newInstance(PromiseCls, resolve => {
requestAdapterCtrlsPromiseResolveFn = resolve;
});
const response = async () => {
const { beforeRequest = noop, responded, requestAdapter, cacheLogger } = getOptions(methodInstance);
const methodKey = getMethodInternalKey(methodInstance);
const { s: toStorage, t: tag, m: cacheMode, e: expireMilliseconds } = getLocalCacheConfigParam(methodInstance);
const { id, l1Cache, l2Cache, snapshots } = getContext(methodInstance);
// Get controlled cache or uncontrolled cache
const { cacheFor } = getConfig(methodInstance);
const { hitSource: methodHitSource } = methodInstance;
// If the current method sets a controlled cache, check whether there is custom data
let cachedResponse = await (isFn(cacheFor)
? cacheFor()
: // If it is a forced request, skip the step of getting it from the cache
// Otherwise, determine whether to use cached data
forceRequest
? undefinedValue
: getWithCacheAdapter(id, methodKey, l1Cache));
// If it is storage restore mode and there is no data in the cache, the persistent data needs to be restored to the cache, and the cached expiration time must be used.
if (cacheMode === STORAGE_RESTORE && !cachedResponse && !forceRequest) {
const rawL2CacheData = await getRawWithCacheAdapter(id, methodKey, l2Cache, tag);
if (rawL2CacheData) {
const [l2Response, l2ExpireMilliseconds] = rawL2CacheData;
await setWithCacheAdapter(id, methodKey, l2Response, l2ExpireMilliseconds, l1Cache, methodHitSource);
cachedResponse = l2Response;
}
}
// Clone the method as a parameter and pass it to beforeRequest to prevent side effects when using the original method instance request multiple times.
// Place it after `let cachedResponse = await...` to solve the problem of first assigning promise to the method instance in method.send, otherwise the promise will be undefined in clonedMethod.
const clonedMethod = cloneMethod(methodInstance);
// Call the hook function before sending the request
// beforeRequest supports synchronous functions and asynchronous functions
await beforeRequest(clonedMethod);
const { baseURL, url: newUrl, type, data } = clonedMethod;
const { params = {}, headers = {}, transform = $self, shareRequest } = getConfig(clonedMethod);
const namespacedAdapterReturnMap = (adapterReturnMap[id] = adapterReturnMap[id] || {});
const requestBody = clonedMethod.data;
const requestBodyIsSpecial = isSpecialRequestBody(requestBody);
// Will not share the request when requestBody is special data
let requestAdapterCtrls = requestBodyIsSpecial ? undefinedValue : namespacedAdapterReturnMap[methodKey];
let responseSuccessHandler = $self;
let responseErrorHandler = undefinedValue;
let responseCompleteHandler = noop;
// uniform handler of onSuccess, onError, onComplete
if (isFn(responded)) {
responseSuccessHandler = responded;
}
else if (isPlainObject(responded)) {
const { onSuccess: successHandler, onError: errorHandler, onComplete: completeHandler } = responded;
responseSuccessHandler = isFn(successHandler) ? successHandler : responseSuccessHandler;
responseErrorHandler = isFn(errorHandler) ? errorHandler : responseErrorHandler;
responseCompleteHandler = isFn(completeHandler) ? completeHandler : responseCompleteHandler;
}
// If there is no cache, make a request
if (cachedResponse !== undefinedValue) {
requestAdapterCtrlsPromiseResolveFn(); // Ctrls will not be passed in when cache is encountered
// Print cache log
clonedMethod.fromCache = trueValue;
sloughFunction(cacheLogger, defaultCacheLogger)(cachedResponse, clonedMethod, cacheMode, tag);
responseCompleteHandler(clonedMethod);
return cachedResponse;
}
fromCache = falseValue;
if (!shareRequest || !requestAdapterCtrls) {
// Request data
const ctrls = requestAdapter({
url: buildCompletedURL(baseURL, newUrl, params),
type,
data,
headers
}, clonedMethod);
requestAdapterCtrls = namespacedAdapterReturnMap[methodKey] = ctrls;
}
// Pass request adapter ctrls to promise for use in on download, on upload and abort
requestAdapterCtrlsPromiseResolveFn(requestAdapterCtrls);
/**
* Process response tasks and do not cache data on failure
* @param responsePromise Respond to promise instances
* @param responseHeaders Request header
* @param callInSuccess Whether to call in success callback
* @returns Processed response
*/
const handleResponseTask = async (handlerReturns, responseHeaders, callInSuccess = trueValue) => {
const responseData = await handlerReturns;
const transformedData = await transform(responseData, responseHeaders || {});
snapshots.save(methodInstance);
// Even if the cache operation fails, the response structure will be returned normally to avoid request errors caused by cache operation problems.
// The cache operation results can be obtained through `cacheAdapter.emitter.on('success' | 'fail', event => {})`
try {
// Automatic cache invalidation
await hitCacheBySource(clonedMethod);
}
catch (_a) { }
// Do not save cache when requestBody is special data
// Reason 1: Special data is generally submitted and requires interaction with the server.
// Reason 2: Special data is not convenient for generating cache keys
const toCache = !requestBody || !requestBodyIsSpecial;
// Use the latest expiration time after the response to cache data to avoid the problem of expiration time loss due to too long response time
if (toCache && callInSuccess) {
try {
await PromiseCls.all([
setWithCacheAdapter(id, methodKey, transformedData, expireMilliseconds(MEMORY), l1Cache, methodHitSource),
toStorage &&
setWithCacheAdapter(id, methodKey, transformedData, expireMilliseconds(STORAGE_RESTORE), l2Cache, methodHitSource, tag)
]);
}
catch (_b) { }
}
// Deep clone the transformed data before returning to avoid reference issues
// the `deepClone` will only clone array and plain object
return deepClone(transformedData);
};
return promiseFinally(promiseThen(PromiseCls.all([requestAdapterCtrls.response(), requestAdapterCtrls.headers()]), ([rawResponse, rawHeaders]) => {
// Regardless of whether the request succeeds or fails, the shared request needs to be removed first
deleteAttr(namespacedAdapterReturnMap, methodKey);
return handleResponseTask(responseSuccessHandler(rawResponse, clonedMethod), rawHeaders);
}, (error) => {
// Regardless of whether the request succeeds or fails, the shared request needs to be removed first
deleteAttr(namespacedAdapterReturnMap, methodKey);
return isFn(responseErrorHandler)
? // When responding to an error, if no error is thrown, the successful response process will be processed, but the data will not be cached.
handleResponseTask(responseErrorHandler(error, clonedMethod), undefinedValue, falseValue)
: promiseReject(error);
}), () => {
responseCompleteHandler(clonedMethod);
});
};
return {
// request interrupt function
abort: () => {
promiseThen(requestAdapterCtrlsPromise, requestAdapterCtrls => requestAdapterCtrls && requestAdapterCtrls.abort());
},
onDownload: (handler) => {
promiseThen(requestAdapterCtrlsPromise, requestAdapterCtrls => requestAdapterCtrls && requestAdapterCtrls.onDownload && requestAdapterCtrls.onDownload(handler));
},
onUpload: (handler) => {
promiseThen(requestAdapterCtrlsPromise, requestAdapterCtrls => requestAdapterCtrls && requestAdapterCtrls.onUpload && requestAdapterCtrls.onUpload(handler));
},
response,
fromCache: () => fromCache
};
}
const offEventCallback = (offHandler, handlers) => () => {
const index = handlers.indexOf(offHandler);
index >= 0 && handlers.splice(index, 1);
};
class Method {
constructor(type, context, url, config, data) {
this.dhs = [];
this.uhs = [];
this.fromCache = undefinedValue;
const abortRequest = () => {
abortRequest.a();
};
abortRequest.a = noop;
const instance = this;
const contextOptions = getContextOptions(context);
instance.abort = abortRequest;
instance.baseURL = contextOptions.baseURL || '';
instance.url = url;
instance.type = type;
instance.context = context;
// Merge request-related global configuration into the method object
const contextConcatConfig = {};
const mergedLocalCacheKey = 'cacheFor';
const globalLocalCache = isPlainObject(contextOptions[mergedLocalCacheKey])
? contextOptions[mergedLocalCacheKey][type]
: undefinedValue;
const hitSource = config && config.hitSource;
// Merge parameters
forEach(['timeout', 'shareRequest'], mergedKey => {
if (contextOptions[mergedKey] !== undefinedValue) {
contextConcatConfig[mergedKey] = contextOptions[mergedKey];
}
});
// Merge local cache
if (globalLocalCache !== undefinedValue) {
contextConcatConfig[mergedLocalCacheKey] = globalLocalCache;
}
// Unify hit sources into arrays and convert them into method keys when there are method instances
if (hitSource) {
instance.hitSource = mapItem(isArray(hitSource) ? hitSource : [hitSource], sourceItem => instanceOf(sourceItem, Method) ? getMethodInternalKey(sourceItem) : sourceItem);
deleteAttr(config, 'hitSource');
}
instance.config = {
...contextConcatConfig,
headers: {},
params: {},
...(config || {})
};
instance.data = data;
instance.meta = config ? config.meta : instance.meta;
// The original key needs to be used externally instead of generating the key in real time.
// The reason is that the parameters of the method may pass in reference type values, but when the reference type value changes externally, the key generated in real time also changes, so it is more accurate to use the initial key.
instance.key = instance.generateKey();
}
/**
* Bind download progress callback function
* @param progressHandler Download progress callback function
* @version 2.17.0
* @return unbind function
*/
onDownload(downloadHandler) {
pushItem(this.dhs, downloadHandler);
return offEventCallback(downloadHandler, this.dhs);
}
/**
* Bind upload progress callback function
* @param progressHandler Upload progress callback function
* @version 2.17.0
* @return unbind function
*/
onUpload(uploadHandler) {
pushItem(this.uhs, uploadHandler);
return offEventCallback(uploadHandler, this.uhs);
}
/**
* Send a request through a method instance and return a promise object
*/
send(forceRequest = falseValue) {
const instance = this;
const { response, onDownload, onUpload, abort, fromCache } = sendRequest(instance, forceRequest);
len(instance.dhs) > 0 &&
onDownload((loaded, total) => forEach(instance.dhs, handler => handler({ loaded, total })));
len(instance.uhs) > 0 && onUpload((loaded, total) => forEach(instance.uhs, handler => handler({ loaded, total })));
// The interrupt function is bound to the method instance for each request. The user can also interrupt the current request through method instance.abort()
instance.abort.a = abort;
instance.fromCache = undefinedValue;
instance.promise = promiseThen(response(), r => {
instance.fromCache = fromCache();
return r;
});
return instance.promise;
}
/**
* Set the method name, if there is already a name it will be overwritten
* @param name method name
*/
setName(name) {
getConfig(this).name = name;
}
generateKey() {
return key(this);
}
/**
* Bind callbacks for resolve and/or reject Promise
* @param onfulfilled The callback to be executed when resolving the Promise
* @param onrejected The callback to be executed when the Promise is rejected
* @returns Returns a Promise for executing any callbacks
*/
then(onfulfilled, onrejected) {
return promiseThen(this.send(), onfulfilled, onrejected);
}
/**
* Bind a callback only for reject Promise
* @param onrejected The callback to be executed when the Promise is rejected
* @returns Returns a Promise that completes the callback
*/
catch(onrejected) {
return promiseCatch(this.send(), onrejected);
}
/**
* Bind a callback that is called when the Promise is resolved (resolve or reject)
* @param onfinally Callback executed when Promise is resolved (resolve or reject).
* @return Returns a Promise that completes the callback.
*/
finally(onfinally) {
return promiseFinally(this.send(), onfinally);
}
}
/**
* Custom assertion function, throws an error when the expression is false
* @param expression Judgment expression, true or false
* @param msg assert message
*/
const myAssert = createAssert();
// local storage will not fail the operation.
const EVENT_SUCCESS_KEY = 'success';
const memoryAdapter = () => {
let l1Cache = {};
const l1CacheEmitter = createEventManager();
const adapter = {
set(key, value) {
l1Cache[key] = value;
l1CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'set', key, value, container: l1Cache });
},
get: key => {
const value = l1Cache[key];
l1CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'get', key, value, container: l1Cache });
return value;
},
remove(key) {
deleteAttr(l1Cache, key);
l1CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'remove', key, container: l1Cache });
},
clear: () => {
l1Cache = {};
l1CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'clear', key: '', container: l1Cache });
},
emitter: l1CacheEmitter
};
return adapter;
};
const localStorageAdapter = () => {
const l2CacheEmitter = createEventManager();
const instance = localStorage;
const adapter = {
set: (key, value) => {
instance.setItem(key, JSONStringify(value));
l2CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'set', key, value, container: instance });
},
get: key => {
const data = instance.getItem(key);
const value = data ? JSONParse(data) : data;
l2CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'get', key, value, container: instance });
return value;
},
remove: key => {
instance.removeItem(key);
l2CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'remove', key, container: instance });
},
clear: () => {
instance.clear();
l2CacheEmitter.emit(EVENT_SUCCESS_KEY, { type: 'clear', key: '', container: instance });
},
emitter: l2CacheEmitter
};
return adapter;
};
const placeholderAdapter = () => {
const l2CacheNotDefinedAssert = () => {
myAssert(falseValue, 'l2Cache is not defined.');
};
return {
set: () => {
l2CacheNotDefinedAssert();
},
get: () => {
l2CacheNotDefinedAssert();
return undefinedValue;
},
remove: () => {
l2CacheNotDefinedAssert();
},
clear: () => { }
};
};
const SetCls = Set;
class MethodSnapshotContainer {
constructor(capacity) {
/**
* Method instance snapshot collection, method instances that have sent requests will be saved
*/
this.records = {};
this.occupy = 0;
myAssert(capacity >= 0, 'expected snapshots limit to be >= 0');
this.capacity = capacity;
}
/**
* Save method instance snapshot
* @param methodInstance method instance
*/
save(methodInstance) {
const { name } = getConfig(methodInstance);
const { records, occupy, capacity } = this;
if (name && occupy < capacity) {
// Using the name of the method as the key, save the method instance to the snapshot
const targetSnapshots = (records[name] = records[name] || newInstance(SetCls));
targetSnapshots.add(methodInstance);
// Statistical quantity
this.occupy += 1;
}
}
/**
* Get a Method instance snapshot, which will filter out the corresponding Method instance based on the matcher
* @param matcher Matching snapshot name, which can be a string or regular expression, or an object with a filter function
* @returns Array of matched Method instance snapshots
*/
match(matcher, matchAll = true) {
// Unify the filter parameters into name matcher and match handler
let nameString;
let nameReg;
let matchHandler;
let nameMatcher = matcher;
if (isPlainObject(matcher)) {
nameMatcher = matcher.name;
matchHandler = matcher.filter;
}
if (instanceOf(nameMatcher, RegExpCls)) {
nameReg = nameMatcher;
}
else if (isString(nameMatcher)) {
nameString = nameMatcher;
}
const { records } = this;
// Get the corresponding method instance snapshot through the deconstructed name matcher and filter handler
let matches = newInstance((SetCls));
// If the namespace parameter is provided, it will only be searched in this namespace, otherwise it will be searched in all cached data.
if (nameString) {
matches = records[nameString] || matches;
}
else if (nameReg) {
forEach(filterItem(objectKeys(records), methodName => nameReg.test(methodName)), methodName => {
records[methodName].forEach(method => matches.add(method));
});
}
const fromMatchesArray = isFn(matchHandler) ? filterItem([...matches], matchHandler) : [...matches];
return (matchAll ? fromMatchesArray : fromMatchesArray[0]);
}
}
const typeGet = 'GET';
const typeHead = 'HEAD';
const typePost = 'POST';
const typePut = 'PUT';
const typePatch = 'PATCH';
const typeDelete = 'DELETE';
const typeOptions = 'OPTIONS';
const defaultAlovaOptions = {
/**
* GET requests are cached for 5 minutes (300000 milliseconds) by default, and other requests are not cached by default.
*/
cacheFor: {
[typeGet]: 300000
},
/**
* Share requests default to true
*/
shareRequest: trueValue,
/**
* Number of method snapshots, default is 1000
*/
snapshots: 1000
};
let idCount = 0;
class Alova {
constructor(options) {
var _a, _b;
const instance = this;
instance.id = (options.id || (idCount += 1)).toString();
// If storage is not specified, local storage is used by default.
instance.l1Cache = options.l1Cache || memoryAdapter();
instance.l2Cache =
options.l2Cache || (typeof localStorage !== 'undefined' ? localStorageAdapter() : placeholderAdapter());
// Merge default options
instance.options = {
...defaultAlovaOptions,
...options
};
instance.snapshots = newInstance((MethodSnapshotContainer), (_b = (_a = options.snapshots) !== null && _a !== void 0 ? _a : defaultAlovaOptions.snapshots) !== null && _b !== void 0 ? _b : 0);
}
Get(url, config) {
return newInstance((Method), typeGet, this, url, config);
}
Post(url, data, config) {
return newInstance((Method), typePost, this, url, config, data);
}
Delete(url, data, config) {
return newInstance((Method), typeDelete, this, url, config, data);
}
Put(url, data, config) {
return newInstance((Method), typePut, this, url, config, data);
}
Head(url, config) {
return newInstance((Method), typeHead, this, url, config);
}
Patch(url, data, config) {
return newInstance((Method), typePatch, this, url, config, data);
}
Options(url, config) {
return newInstance((Method), typeOptions, this, url, config);
}
}
let boundStatesHook = undefinedValue;
const usingL1CacheAdapters = [];
const usingL2CacheAdapters = [];
/**
* create an alova instance.
* @param options alova configuration.
* @returns alova instance.
*/
const createAlova = (options) => {
const alovaInstance = newInstance((Alova), options);
const newStatesHook = alovaInstance.options.statesHook;
if (boundStatesHook) {
myAssert(boundStatesHook === newStatesHook, 'expected to use the same `statesHook`');
}
boundStatesHook = newStatesHook;
const { l1Cache, l2Cache } = alovaInstance;
!usingL1CacheAdapters.includes(l1Cache) && pushItem(usingL1CacheAdapters, l1Cache);
!usingL2CacheAdapters.includes(l2Cache) && pushItem(usingL2CacheAdapters, l2Cache);
return alovaInstance;
};
const promiseStatesHook = () => {
myAssert(!!boundStatesHook, '`statesHook` is not set in alova instance');
return boundStatesHook;
};
export { Method, createAlova, globalConfig, globalConfigMap, hitCacheBySource, invalidateCache, promiseStatesHook, queryCache, setCache };

1207
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/alova.umd.js

File diff suppressed because it is too large

1
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/alova.umd.min.js

File diff suppressed because one or more lines are too long

3463
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/clienthook/index.common.cjs

File diff suppressed because it is too large

3430
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/clienthook/index.esm.js

File diff suppressed because it is too large

3897
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/clienthook/index.umd.js

File diff suppressed because it is too large

1
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/clienthook/index.umd.min.js

File diff suppressed because one or more lines are too long

865
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/serverhook/index.common.cjs

@ -1,865 +0,0 @@
/**
* @alova/server 1.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
var shared = require('@alova/shared');
var alova = require('alova');
var rateLimiterFlexible = require('rate-limiter-flexible');
class HookedMethod extends alova.Method {
constructor(entity, requestHandler) {
super(entity.type, entity.context, entity.url, { ...entity.config });
this.handler = requestHandler;
shared.objAssign(this, {
config: { ...entity.config },
uhs: entity.uhs,
dhs: entity.dhs
});
}
send(forceRequest) {
return this.handler(forceRequest);
}
}
const createServerHook = (hookHandler) => hookHandler;
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
var RateLimiterAbstract_1 = class RateLimiterAbstract {
/**
*
* @param opts Object Defaults {
* points: 4, // Number of points
* duration: 1, // Per seconds
* blockDuration: 0, // Block if consumed more than points in current duration for blockDuration seconds
* execEvenly: false, // Execute allowed actions evenly over duration
* execEvenlyMinDelayMs: duration * 1000 / points, // ms, works with execEvenly=true option
* keyPrefix: 'rlflx',
* }
*/
constructor(opts = {}) {
this.points = opts.points;
this.duration = opts.duration;
this.blockDuration = opts.blockDuration;
this.execEvenly = opts.execEvenly;
this.execEvenlyMinDelayMs = opts.execEvenlyMinDelayMs;
this.keyPrefix = opts.keyPrefix;
}
get points() {
return this._points;
}
set points(value) {
this._points = value >= 0 ? value : 4;
}
get duration() {
return this._duration;
}
set duration(value) {
this._duration = typeof value === 'undefined' ? 1 : value;
}
get msDuration() {
return this.duration * 1000;
}
get blockDuration() {
return this._blockDuration;
}
set blockDuration(value) {
this._blockDuration = typeof value === 'undefined' ? 0 : value;
}
get msBlockDuration() {
return this.blockDuration * 1000;
}
get execEvenly() {
return this._execEvenly;
}
set execEvenly(value) {
this._execEvenly = typeof value === 'undefined' ? false : Boolean(value);
}
get execEvenlyMinDelayMs() {
return this._execEvenlyMinDelayMs;
}
set execEvenlyMinDelayMs(value) {
this._execEvenlyMinDelayMs = typeof value === 'undefined' ? Math.ceil(this.msDuration / this.points) : value;
}
get keyPrefix() {
return this._keyPrefix;
}
set keyPrefix(value) {
if (typeof value === 'undefined') {
value = 'rlflx';
}
if (typeof value !== 'string') {
throw new Error('keyPrefix must be string');
}
this._keyPrefix = value;
}
_getKeySecDuration(options = {}) {
return options && options.customDuration >= 0
? options.customDuration
: this.duration;
}
getKey(key) {
return this.keyPrefix.length > 0 ? `${this.keyPrefix}:${key}` : key;
}
parseKey(rlKey) {
return rlKey.substring(this.keyPrefix.length);
}
consume() {
throw new Error("You have to implement the method 'consume'!");
}
penalty() {
throw new Error("You have to implement the method 'penalty'!");
}
reward() {
throw new Error("You have to implement the method 'reward'!");
}
get() {
throw new Error("You have to implement the method 'get'!");
}
set() {
throw new Error("You have to implement the method 'set'!");
}
block() {
throw new Error("You have to implement the method 'block'!");
}
delete() {
throw new Error("You have to implement the method 'delete'!");
}
};
var BlockedKeys_1$1 = class BlockedKeys {
constructor() {
this._keys = {}; // {'key': 1526279430331}
this._addedKeysAmount = 0;
}
collectExpired() {
const now = Date.now();
Object.keys(this._keys).forEach((key) => {
if (this._keys[key] <= now) {
delete this._keys[key];
}
});
this._addedKeysAmount = Object.keys(this._keys).length;
}
/**
* Add new blocked key
*
* @param key String
* @param sec Number
*/
add(key, sec) {
this.addMs(key, sec * 1000);
}
/**
* Add new blocked key for ms
*
* @param key String
* @param ms Number
*/
addMs(key, ms) {
this._keys[key] = Date.now() + ms;
this._addedKeysAmount++;
if (this._addedKeysAmount > 999) {
this.collectExpired();
}
}
/**
* 0 means not blocked
*
* @param key
* @returns {number}
*/
msBeforeExpire(key) {
const expire = this._keys[key];
if (expire && expire >= Date.now()) {
this.collectExpired();
const now = Date.now();
return expire >= now ? expire - now : 0;
}
return 0;
}
/**
* If key is not given, delete all data in memory
*
* @param {string|undefined} key
*/
delete(key) {
if (key) {
delete this._keys[key];
} else {
Object.keys(this._keys).forEach((key) => {
delete this._keys[key];
});
}
}
};
const BlockedKeys$1 = BlockedKeys_1$1;
var BlockedKeys_1 = BlockedKeys$1;
var RateLimiterRes_1 = class RateLimiterRes {
constructor(remainingPoints, msBeforeNext, consumedPoints, isFirstInDuration) {
this.remainingPoints = typeof remainingPoints === 'undefined' ? 0 : remainingPoints; // Remaining points in current duration
this.msBeforeNext = typeof msBeforeNext === 'undefined' ? 0 : msBeforeNext; // Milliseconds before next action
this.consumedPoints = typeof consumedPoints === 'undefined' ? 0 : consumedPoints; // Consumed points in current duration
this.isFirstInDuration = typeof isFirstInDuration === 'undefined' ? false : isFirstInDuration;
}
get msBeforeNext() {
return this._msBeforeNext;
}
set msBeforeNext(ms) {
this._msBeforeNext = ms;
return this;
}
get remainingPoints() {
return this._remainingPoints;
}
set remainingPoints(p) {
this._remainingPoints = p;
return this;
}
get consumedPoints() {
return this._consumedPoints;
}
set consumedPoints(p) {
this._consumedPoints = p;
return this;
}
get isFirstInDuration() {
return this._isFirstInDuration;
}
set isFirstInDuration(value) {
this._isFirstInDuration = Boolean(value);
}
_getDecoratedProperties() {
return {
remainingPoints: this.remainingPoints,
msBeforeNext: this.msBeforeNext,
consumedPoints: this.consumedPoints,
isFirstInDuration: this.isFirstInDuration,
};
}
[Symbol.for("nodejs.util.inspect.custom")]() {
return this._getDecoratedProperties();
}
toString() {
return JSON.stringify(this._getDecoratedProperties());
}
toJSON() {
return this._getDecoratedProperties();
}
};
const RateLimiterAbstract = RateLimiterAbstract_1;
const BlockedKeys = BlockedKeys_1;
const RateLimiterRes = RateLimiterRes_1;
var RateLimiterStoreAbstract_1 = class RateLimiterStoreAbstract extends RateLimiterAbstract {
/**
*
* @param opts Object Defaults {
* ... see other in RateLimiterAbstract
*
* inMemoryBlockOnConsumed: 40, // Number of points when key is blocked
* inMemoryBlockDuration: 10, // Block duration in seconds
* insuranceLimiter: RateLimiterAbstract
* }
*/
constructor(opts = {}) {
super(opts);
this.inMemoryBlockOnConsumed = opts.inMemoryBlockOnConsumed;
this.inMemoryBlockDuration = opts.inMemoryBlockDuration;
this.insuranceLimiter = opts.insuranceLimiter;
this._inMemoryBlockedKeys = new BlockedKeys();
}
get client() {
return this._client;
}
set client(value) {
if (typeof value === 'undefined') {
throw new Error('storeClient is not set');
}
this._client = value;
}
/**
* Have to be launched after consume
* It blocks key and execute evenly depending on result from store
*
* It uses _getRateLimiterRes function to prepare RateLimiterRes from store result
*
* @param resolve
* @param reject
* @param rlKey
* @param changedPoints
* @param storeResult
* @param {Object} options
* @private
*/
_afterConsume(resolve, reject, rlKey, changedPoints, storeResult, options = {}) {
const res = this._getRateLimiterRes(rlKey, changedPoints, storeResult);
if (this.inMemoryBlockOnConsumed > 0 && !(this.inMemoryBlockDuration > 0)
&& res.consumedPoints >= this.inMemoryBlockOnConsumed
) {
this._inMemoryBlockedKeys.addMs(rlKey, res.msBeforeNext);
if (res.consumedPoints > this.points) {
return reject(res);
} else {
return resolve(res)
}
} else if (res.consumedPoints > this.points) {
let blockPromise = Promise.resolve();
// Block only first time when consumed more than points
if (this.blockDuration > 0 && res.consumedPoints <= (this.points + changedPoints)) {
res.msBeforeNext = this.msBlockDuration;
blockPromise = this._block(rlKey, res.consumedPoints, this.msBlockDuration, options);
}
if (this.inMemoryBlockOnConsumed > 0 && res.consumedPoints >= this.inMemoryBlockOnConsumed) {
// Block key for this.inMemoryBlockDuration seconds
this._inMemoryBlockedKeys.add(rlKey, this.inMemoryBlockDuration);
res.msBeforeNext = this.msInMemoryBlockDuration;
}
blockPromise
.then(() => {
reject(res);
})
.catch((err) => {
reject(err);
});
} else if (this.execEvenly && res.msBeforeNext > 0 && !res.isFirstInDuration) {
let delay = Math.ceil(res.msBeforeNext / (res.remainingPoints + 2));
if (delay < this.execEvenlyMinDelayMs) {
delay = res.consumedPoints * this.execEvenlyMinDelayMs;
}
setTimeout(resolve, delay, res);
} else {
resolve(res);
}
}
_handleError(err, funcName, resolve, reject, key, data = false, options = {}) {
if (!(this.insuranceLimiter instanceof RateLimiterAbstract)) {
reject(err);
} else {
this.insuranceLimiter[funcName](key, data, options)
.then((res) => {
resolve(res);
})
.catch((res) => {
reject(res);
});
}
}
getInMemoryBlockMsBeforeExpire(rlKey) {
if (this.inMemoryBlockOnConsumed > 0) {
return this._inMemoryBlockedKeys.msBeforeExpire(rlKey);
}
return 0;
}
get inMemoryBlockOnConsumed() {
return this._inMemoryBlockOnConsumed;
}
set inMemoryBlockOnConsumed(value) {
this._inMemoryBlockOnConsumed = value ? parseInt(value) : 0;
if (this.inMemoryBlockOnConsumed > 0 && this.points > this.inMemoryBlockOnConsumed) {
throw new Error('inMemoryBlockOnConsumed option must be greater or equal "points" option');
}
}
get inMemoryBlockDuration() {
return this._inMemoryBlockDuration;
}
set inMemoryBlockDuration(value) {
this._inMemoryBlockDuration = value ? parseInt(value) : 0;
if (this.inMemoryBlockDuration > 0 && this.inMemoryBlockOnConsumed === 0) {
throw new Error('inMemoryBlockOnConsumed option must be set up');
}
}
get msInMemoryBlockDuration() {
return this._inMemoryBlockDuration * 1000;
}
get insuranceLimiter() {
return this._insuranceLimiter;
}
set insuranceLimiter(value) {
if (typeof value !== 'undefined' && !(value instanceof RateLimiterAbstract)) {
throw new Error('insuranceLimiter must be instance of RateLimiterAbstract');
}
this._insuranceLimiter = value;
if (this._insuranceLimiter) {
this._insuranceLimiter.blockDuration = this.blockDuration;
this._insuranceLimiter.execEvenly = this.execEvenly;
}
}
/**
* Block any key for secDuration seconds
*
* @param key
* @param secDuration
* @param {Object} options
*
* @return Promise<RateLimiterRes>
*/
block(key, secDuration, options = {}) {
const msDuration = secDuration * 1000;
return this._block(this.getKey(key), this.points + 1, msDuration, options);
}
/**
* Set points by key for any duration
*
* @param key
* @param points
* @param secDuration
* @param {Object} options
*
* @return Promise<RateLimiterRes>
*/
set(key, points, secDuration, options = {}) {
const msDuration = (secDuration >= 0 ? secDuration : this.duration) * 1000;
return this._block(this.getKey(key), points, msDuration, options);
}
/**
*
* @param key
* @param pointsToConsume
* @param {Object} options
* @returns Promise<RateLimiterRes>
*/
consume(key, pointsToConsume = 1, options = {}) {
return new Promise((resolve, reject) => {
const rlKey = this.getKey(key);
const inMemoryBlockMsBeforeExpire = this.getInMemoryBlockMsBeforeExpire(rlKey);
if (inMemoryBlockMsBeforeExpire > 0) {
return reject(new RateLimiterRes(0, inMemoryBlockMsBeforeExpire));
}
this._upsert(rlKey, pointsToConsume, this._getKeySecDuration(options) * 1000, false, options)
.then((res) => {
this._afterConsume(resolve, reject, rlKey, pointsToConsume, res);
})
.catch((err) => {
this._handleError(err, 'consume', resolve, reject, key, pointsToConsume, options);
});
});
}
/**
*
* @param key
* @param points
* @param {Object} options
* @returns Promise<RateLimiterRes>
*/
penalty(key, points = 1, options = {}) {
const rlKey = this.getKey(key);
return new Promise((resolve, reject) => {
this._upsert(rlKey, points, this._getKeySecDuration(options) * 1000, false, options)
.then((res) => {
resolve(this._getRateLimiterRes(rlKey, points, res));
})
.catch((err) => {
this._handleError(err, 'penalty', resolve, reject, key, points, options);
});
});
}
/**
*
* @param key
* @param points
* @param {Object} options
* @returns Promise<RateLimiterRes>
*/
reward(key, points = 1, options = {}) {
const rlKey = this.getKey(key);
return new Promise((resolve, reject) => {
this._upsert(rlKey, -points, this._getKeySecDuration(options) * 1000, false, options)
.then((res) => {
resolve(this._getRateLimiterRes(rlKey, -points, res));
})
.catch((err) => {
this._handleError(err, 'reward', resolve, reject, key, points, options);
});
});
}
/**
*
* @param key
* @param {Object} options
* @returns Promise<RateLimiterRes>|null
*/
get(key, options = {}) {
const rlKey = this.getKey(key);
return new Promise((resolve, reject) => {
this._get(rlKey, options)
.then((res) => {
if (res === null || typeof res === 'undefined') {
resolve(null);
} else {
resolve(this._getRateLimiterRes(rlKey, 0, res));
}
})
.catch((err) => {
this._handleError(err, 'get', resolve, reject, key, options);
});
});
}
/**
*
* @param key
* @param {Object} options
* @returns Promise<boolean>
*/
delete(key, options = {}) {
const rlKey = this.getKey(key);
return new Promise((resolve, reject) => {
this._delete(rlKey, options)
.then((res) => {
this._inMemoryBlockedKeys.delete(rlKey);
resolve(res);
})
.catch((err) => {
this._handleError(err, 'delete', resolve, reject, key, options);
});
});
}
/**
* Cleanup keys no-matter expired or not.
*/
deleteInMemoryBlockedAll() {
this._inMemoryBlockedKeys.delete();
}
/**
* Get RateLimiterRes object filled depending on storeResult, which specific for exact store
*
* @param rlKey
* @param changedPoints
* @param storeResult
* @private
*/
_getRateLimiterRes(rlKey, changedPoints, storeResult) { // eslint-disable-line no-unused-vars
throw new Error("You have to implement the method '_getRateLimiterRes'!");
}
/**
* Block key for this.msBlockDuration milliseconds
* Usually, it just prolongs lifetime of key
*
* @param rlKey
* @param initPoints
* @param msDuration
* @param {Object} options
*
* @return Promise<any>
*/
_block(rlKey, initPoints, msDuration, options = {}) {
return new Promise((resolve, reject) => {
this._upsert(rlKey, initPoints, msDuration, true, options)
.then(() => {
resolve(new RateLimiterRes(0, msDuration > 0 ? msDuration : -1, initPoints));
})
.catch((err) => {
this._handleError(err, 'block', resolve, reject, this.parseKey(rlKey), msDuration / 1000, options);
});
});
}
/**
* Have to be implemented in every limiter
* Resolve with raw result from Store OR null if rlKey is not set
* or Reject with error
*
* @param rlKey
* @param {Object} options
* @private
*
* @return Promise<any>
*/
_get(rlKey, options = {}) { // eslint-disable-line no-unused-vars
throw new Error("You have to implement the method '_get'!");
}
/**
* Have to be implemented
* Resolve with true OR false if rlKey doesn't exist
* or Reject with error
*
* @param rlKey
* @param {Object} options
* @private
*
* @return Promise<any>
*/
_delete(rlKey, options = {}) { // eslint-disable-line no-unused-vars
throw new Error("You have to implement the method '_delete'!");
}
/**
* Have to be implemented
* Resolve with object used for {@link _getRateLimiterRes} to generate {@link RateLimiterRes}
*
* @param {string} rlKey
* @param {number} points
* @param {number} msDuration
* @param {boolean} forceExpire
* @param {Object} options
* @abstract
*
* @return Promise<Object>
*/
_upsert(rlKey, points, msDuration, forceExpire = false, options = {}) {
throw new Error("You have to implement the method '_upsert'!");
}
};
var RateLimiterStoreAbstract = /*@__PURE__*/getDefaultExportFromCjs(RateLimiterStoreAbstract_1);
const assert = shared.createAssert('RateLimit');
class RateLimiterStore extends RateLimiterStoreAbstract {
constructor(storage, options) {
super(options);
this.storage = storage;
}
/**
* parses raw data from store to RateLimiterRes object.
*/
_getRateLimiterRes(key, changedPoints, result) {
const [consumed = 0, expireTime = 0] = result !== null && result !== void 0 ? result : [];
const msBeforeNext = expireTime > 0 ? Math.max(expireTime - Date.now(), 0) : -1;
const isFirstInDuration = !consumed || changedPoints === consumed;
const currentConsumedPoints = isFirstInDuration ? changedPoints : consumed;
const res = new rateLimiterFlexible.RateLimiterRes(Math.max(0, this.points - currentConsumedPoints), msBeforeNext, isFirstInDuration ? changedPoints : consumed, isFirstInDuration);
return res;
}
async _upsert(key, points, msDuration, forceExpire = false) {
var _a;
key = key.toString();
const isNeverExpired = msDuration <= 0;
const expireTime = isNeverExpired ? -1 : Date.now() + msDuration;
const newRecord = [points, expireTime];
if (!forceExpire) {
const [oldPoints = 0, oldExpireTime = 0] = ((_a = (await this.storage.get(key))) !== null && _a !== void 0 ? _a : []);
// if haven't expired yet
if (isNeverExpired || (!isNeverExpired && oldExpireTime > Date.now())) {
newRecord[0] += oldPoints;
}
if (!isNeverExpired && oldExpireTime > Date.now()) {
newRecord[1] = oldExpireTime;
}
}
await this.storage.set(key.toString(), newRecord);
// need to return the record after upsert
return newRecord;
}
/**
* returns raw data by key or null if there is no key or expired.
*/
async _get(key) {
return Promise.resolve(this.storage.get(key.toString())).then(res => {
if (!res) {
return null;
}
const [, expireTime] = res;
// if have expire time and it has expired
if (expireTime > 0 && expireTime <= Date.now()) {
return null;
}
return res;
});
}
/**
* returns true on deleted, false if key is not found.
*/
async _delete(key) {
try {
await this.storage.remove(key.toString());
}
catch (_a) {
return false;
}
return true;
}
}
/**
* The method instance modified by rateLimit, its extension method corresponds to the method of creating an instance in rate-limit-flexible, and the key is the key specified by calling rateLimit.
* AlovaServerHook can currently only return unextended method types. It has not been changed to customizable returned extended method types.
*/
class LimitedMethod extends HookedMethod {
constructor(method, limiterKey, limiter) {
super(method, force => this.consume().then(() => method.send(force)));
this.limiter = limiter;
this.keyGetter = shared.isFn(limiterKey) ? () => limiterKey(method) : () => limiterKey;
}
getLimiterKey() {
return this.keyGetter();
}
/**
* Get RateLimiterRes or null.
*/
get(options) {
return this.limiter.get(this.getLimiterKey(), options);
}
/**
* Set points by key.
*/
set(points, msDuration) {
return this.limiter.set(this.getLimiterKey(), points, msDuration / 1000);
}
/**
* @param points default is 1
*/
consume(points) {
return this.limiter.consume(this.getLimiterKey(), points);
}
/**
* Increase number of consumed points in current duration.
* @param points penalty points
*/
penalty(points) {
return this.limiter.penalty(this.getLimiterKey(), points);
}
/**
* Decrease number of consumed points in current duration.
* @param points reward points
*/
reward(points) {
return this.limiter.reward(this.getLimiterKey(), points);
}
/**
* Block key for ms.
*/
block(msDuration) {
return this.limiter.block(this.getLimiterKey(), msDuration / 1000);
}
/**
* Reset consumed points.
*/
delete() {
return this.limiter.delete(this.getLimiterKey());
}
}
function createRateLimiter(options = {}) {
const { points = 4, duration = 4 * 1000, keyPrefix, execEvenly, execEvenlyMinDelayMs, blockDuration } = options;
const limitedMethodWrapper = createServerHook((method, handlerOptions = {}) => {
var _a;
const { key = shared.uuid() } = handlerOptions;
const storage = (_a = options.storage) !== null && _a !== void 0 ? _a : shared.getOptions(method).l2Cache;
assert(!!storage, 'storage is not define');
const limiter = new RateLimiterStore(storage, {
points,
duration: Math.floor(duration / 1000),
keyPrefix,
execEvenly,
execEvenlyMinDelayMs,
blockDuration: blockDuration ? Math.floor(blockDuration / 1000) : blockDuration,
storeClient: {}
});
return new LimitedMethod(method, key, limiter);
});
return limitedMethodWrapper;
}
const retry = createServerHook((method, options = {}) => {
const { retry = 3, backoff = { delay: 1000 } } = options;
let retryTimes = 0;
return new HookedMethod(method, forceRequest => new Promise((resolve, reject) => {
const sendRequest = () => {
method
.send(forceRequest)
.then(resolve)
.catch(error => {
// when not reach retry times or return true from retry function, it will retry again.
if (shared.isNumber(retry) ? retryTimes < retry : retry(error)) {
retryTimes += 1;
// calculate retry delay time with pram `backoff` and current retry times.
const retryDelay = shared.delayWithBackoff(backoff, retryTimes);
setTimeout(sendRequest, retryDelay);
}
else {
reject(error);
}
});
};
sendRequest();
}));
});
exports.HookedMethod = HookedMethod;
exports.createRateLimiter = createRateLimiter;
exports.retry = retry;

861
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/serverhook/index.esm.js

@ -1,861 +0,0 @@
/**
* @alova/server 1.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
import { objAssign, createAssert, uuid, getOptions, isFn, isNumber, delayWithBackoff } from '@alova/shared';
import { Method } from 'alova';
import { RateLimiterRes as RateLimiterRes$1 } from 'rate-limiter-flexible';
class HookedMethod extends Method {
constructor(entity, requestHandler) {
super(entity.type, entity.context, entity.url, { ...entity.config });
this.handler = requestHandler;
objAssign(this, {
config: { ...entity.config },
uhs: entity.uhs,
dhs: entity.dhs
});
}
send(forceRequest) {
return this.handler(forceRequest);
}
}
const createServerHook = (hookHandler) => hookHandler;
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
var RateLimiterAbstract_1 = class RateLimiterAbstract {
/**
*
* @param opts Object Defaults {
* points: 4, // Number of points
* duration: 1, // Per seconds
* blockDuration: 0, // Block if consumed more than points in current duration for blockDuration seconds
* execEvenly: false, // Execute allowed actions evenly over duration
* execEvenlyMinDelayMs: duration * 1000 / points, // ms, works with execEvenly=true option
* keyPrefix: 'rlflx',
* }
*/
constructor(opts = {}) {
this.points = opts.points;
this.duration = opts.duration;
this.blockDuration = opts.blockDuration;
this.execEvenly = opts.execEvenly;
this.execEvenlyMinDelayMs = opts.execEvenlyMinDelayMs;
this.keyPrefix = opts.keyPrefix;
}
get points() {
return this._points;
}
set points(value) {
this._points = value >= 0 ? value : 4;
}
get duration() {
return this._duration;
}
set duration(value) {
this._duration = typeof value === 'undefined' ? 1 : value;
}
get msDuration() {
return this.duration * 1000;
}
get blockDuration() {
return this._blockDuration;
}
set blockDuration(value) {
this._blockDuration = typeof value === 'undefined' ? 0 : value;
}
get msBlockDuration() {
return this.blockDuration * 1000;
}
get execEvenly() {
return this._execEvenly;
}
set execEvenly(value) {
this._execEvenly = typeof value === 'undefined' ? false : Boolean(value);
}
get execEvenlyMinDelayMs() {
return this._execEvenlyMinDelayMs;
}
set execEvenlyMinDelayMs(value) {
this._execEvenlyMinDelayMs = typeof value === 'undefined' ? Math.ceil(this.msDuration / this.points) : value;
}
get keyPrefix() {
return this._keyPrefix;
}
set keyPrefix(value) {
if (typeof value === 'undefined') {
value = 'rlflx';
}
if (typeof value !== 'string') {
throw new Error('keyPrefix must be string');
}
this._keyPrefix = value;
}
_getKeySecDuration(options = {}) {
return options && options.customDuration >= 0
? options.customDuration
: this.duration;
}
getKey(key) {
return this.keyPrefix.length > 0 ? `${this.keyPrefix}:${key}` : key;
}
parseKey(rlKey) {
return rlKey.substring(this.keyPrefix.length);
}
consume() {
throw new Error("You have to implement the method 'consume'!");
}
penalty() {
throw new Error("You have to implement the method 'penalty'!");
}
reward() {
throw new Error("You have to implement the method 'reward'!");
}
get() {
throw new Error("You have to implement the method 'get'!");
}
set() {
throw new Error("You have to implement the method 'set'!");
}
block() {
throw new Error("You have to implement the method 'block'!");
}
delete() {
throw new Error("You have to implement the method 'delete'!");
}
};
var BlockedKeys_1$1 = class BlockedKeys {
constructor() {
this._keys = {}; // {'key': 1526279430331}
this._addedKeysAmount = 0;
}
collectExpired() {
const now = Date.now();
Object.keys(this._keys).forEach((key) => {
if (this._keys[key] <= now) {
delete this._keys[key];
}
});
this._addedKeysAmount = Object.keys(this._keys).length;
}
/**
* Add new blocked key
*
* @param key String
* @param sec Number
*/
add(key, sec) {
this.addMs(key, sec * 1000);
}
/**
* Add new blocked key for ms
*
* @param key String
* @param ms Number
*/
addMs(key, ms) {
this._keys[key] = Date.now() + ms;
this._addedKeysAmount++;
if (this._addedKeysAmount > 999) {
this.collectExpired();
}
}
/**
* 0 means not blocked
*
* @param key
* @returns {number}
*/
msBeforeExpire(key) {
const expire = this._keys[key];
if (expire && expire >= Date.now()) {
this.collectExpired();
const now = Date.now();
return expire >= now ? expire - now : 0;
}
return 0;
}
/**
* If key is not given, delete all data in memory
*
* @param {string|undefined} key
*/
delete(key) {
if (key) {
delete this._keys[key];
} else {
Object.keys(this._keys).forEach((key) => {
delete this._keys[key];
});
}
}
};
const BlockedKeys$1 = BlockedKeys_1$1;
var BlockedKeys_1 = BlockedKeys$1;
var RateLimiterRes_1 = class RateLimiterRes {
constructor(remainingPoints, msBeforeNext, consumedPoints, isFirstInDuration) {
this.remainingPoints = typeof remainingPoints === 'undefined' ? 0 : remainingPoints; // Remaining points in current duration
this.msBeforeNext = typeof msBeforeNext === 'undefined' ? 0 : msBeforeNext; // Milliseconds before next action
this.consumedPoints = typeof consumedPoints === 'undefined' ? 0 : consumedPoints; // Consumed points in current duration
this.isFirstInDuration = typeof isFirstInDuration === 'undefined' ? false : isFirstInDuration;
}
get msBeforeNext() {
return this._msBeforeNext;
}
set msBeforeNext(ms) {
this._msBeforeNext = ms;
return this;
}
get remainingPoints() {
return this._remainingPoints;
}
set remainingPoints(p) {
this._remainingPoints = p;
return this;
}
get consumedPoints() {
return this._consumedPoints;
}
set consumedPoints(p) {
this._consumedPoints = p;
return this;
}
get isFirstInDuration() {
return this._isFirstInDuration;
}
set isFirstInDuration(value) {
this._isFirstInDuration = Boolean(value);
}
_getDecoratedProperties() {
return {
remainingPoints: this.remainingPoints,
msBeforeNext: this.msBeforeNext,
consumedPoints: this.consumedPoints,
isFirstInDuration: this.isFirstInDuration,
};
}
[Symbol.for("nodejs.util.inspect.custom")]() {
return this._getDecoratedProperties();
}
toString() {
return JSON.stringify(this._getDecoratedProperties());
}
toJSON() {
return this._getDecoratedProperties();
}
};
const RateLimiterAbstract = RateLimiterAbstract_1;
const BlockedKeys = BlockedKeys_1;
const RateLimiterRes = RateLimiterRes_1;
var RateLimiterStoreAbstract_1 = class RateLimiterStoreAbstract extends RateLimiterAbstract {
/**
*
* @param opts Object Defaults {
* ... see other in RateLimiterAbstract
*
* inMemoryBlockOnConsumed: 40, // Number of points when key is blocked
* inMemoryBlockDuration: 10, // Block duration in seconds
* insuranceLimiter: RateLimiterAbstract
* }
*/
constructor(opts = {}) {
super(opts);
this.inMemoryBlockOnConsumed = opts.inMemoryBlockOnConsumed;
this.inMemoryBlockDuration = opts.inMemoryBlockDuration;
this.insuranceLimiter = opts.insuranceLimiter;
this._inMemoryBlockedKeys = new BlockedKeys();
}
get client() {
return this._client;
}
set client(value) {
if (typeof value === 'undefined') {
throw new Error('storeClient is not set');
}
this._client = value;
}
/**
* Have to be launched after consume
* It blocks key and execute evenly depending on result from store
*
* It uses _getRateLimiterRes function to prepare RateLimiterRes from store result
*
* @param resolve
* @param reject
* @param rlKey
* @param changedPoints
* @param storeResult
* @param {Object} options
* @private
*/
_afterConsume(resolve, reject, rlKey, changedPoints, storeResult, options = {}) {
const res = this._getRateLimiterRes(rlKey, changedPoints, storeResult);
if (this.inMemoryBlockOnConsumed > 0 && !(this.inMemoryBlockDuration > 0)
&& res.consumedPoints >= this.inMemoryBlockOnConsumed
) {
this._inMemoryBlockedKeys.addMs(rlKey, res.msBeforeNext);
if (res.consumedPoints > this.points) {
return reject(res);
} else {
return resolve(res)
}
} else if (res.consumedPoints > this.points) {
let blockPromise = Promise.resolve();
// Block only first time when consumed more than points
if (this.blockDuration > 0 && res.consumedPoints <= (this.points + changedPoints)) {
res.msBeforeNext = this.msBlockDuration;
blockPromise = this._block(rlKey, res.consumedPoints, this.msBlockDuration, options);
}
if (this.inMemoryBlockOnConsumed > 0 && res.consumedPoints >= this.inMemoryBlockOnConsumed) {
// Block key for this.inMemoryBlockDuration seconds
this._inMemoryBlockedKeys.add(rlKey, this.inMemoryBlockDuration);
res.msBeforeNext = this.msInMemoryBlockDuration;
}
blockPromise
.then(() => {
reject(res);
})
.catch((err) => {
reject(err);
});
} else if (this.execEvenly && res.msBeforeNext > 0 && !res.isFirstInDuration) {
let delay = Math.ceil(res.msBeforeNext / (res.remainingPoints + 2));
if (delay < this.execEvenlyMinDelayMs) {
delay = res.consumedPoints * this.execEvenlyMinDelayMs;
}
setTimeout(resolve, delay, res);
} else {
resolve(res);
}
}
_handleError(err, funcName, resolve, reject, key, data = false, options = {}) {
if (!(this.insuranceLimiter instanceof RateLimiterAbstract)) {
reject(err);
} else {
this.insuranceLimiter[funcName](key, data, options)
.then((res) => {
resolve(res);
})
.catch((res) => {
reject(res);
});
}
}
getInMemoryBlockMsBeforeExpire(rlKey) {
if (this.inMemoryBlockOnConsumed > 0) {
return this._inMemoryBlockedKeys.msBeforeExpire(rlKey);
}
return 0;
}
get inMemoryBlockOnConsumed() {
return this._inMemoryBlockOnConsumed;
}
set inMemoryBlockOnConsumed(value) {
this._inMemoryBlockOnConsumed = value ? parseInt(value) : 0;
if (this.inMemoryBlockOnConsumed > 0 && this.points > this.inMemoryBlockOnConsumed) {
throw new Error('inMemoryBlockOnConsumed option must be greater or equal "points" option');
}
}
get inMemoryBlockDuration() {
return this._inMemoryBlockDuration;
}
set inMemoryBlockDuration(value) {
this._inMemoryBlockDuration = value ? parseInt(value) : 0;
if (this.inMemoryBlockDuration > 0 && this.inMemoryBlockOnConsumed === 0) {
throw new Error('inMemoryBlockOnConsumed option must be set up');
}
}
get msInMemoryBlockDuration() {
return this._inMemoryBlockDuration * 1000;
}
get insuranceLimiter() {
return this._insuranceLimiter;
}
set insuranceLimiter(value) {
if (typeof value !== 'undefined' && !(value instanceof RateLimiterAbstract)) {
throw new Error('insuranceLimiter must be instance of RateLimiterAbstract');
}
this._insuranceLimiter = value;
if (this._insuranceLimiter) {
this._insuranceLimiter.blockDuration = this.blockDuration;
this._insuranceLimiter.execEvenly = this.execEvenly;
}
}
/**
* Block any key for secDuration seconds
*
* @param key
* @param secDuration
* @param {Object} options
*
* @return Promise<RateLimiterRes>
*/
block(key, secDuration, options = {}) {
const msDuration = secDuration * 1000;
return this._block(this.getKey(key), this.points + 1, msDuration, options);
}
/**
* Set points by key for any duration
*
* @param key
* @param points
* @param secDuration
* @param {Object} options
*
* @return Promise<RateLimiterRes>
*/
set(key, points, secDuration, options = {}) {
const msDuration = (secDuration >= 0 ? secDuration : this.duration) * 1000;
return this._block(this.getKey(key), points, msDuration, options);
}
/**
*
* @param key
* @param pointsToConsume
* @param {Object} options
* @returns Promise<RateLimiterRes>
*/
consume(key, pointsToConsume = 1, options = {}) {
return new Promise((resolve, reject) => {
const rlKey = this.getKey(key);
const inMemoryBlockMsBeforeExpire = this.getInMemoryBlockMsBeforeExpire(rlKey);
if (inMemoryBlockMsBeforeExpire > 0) {
return reject(new RateLimiterRes(0, inMemoryBlockMsBeforeExpire));
}
this._upsert(rlKey, pointsToConsume, this._getKeySecDuration(options) * 1000, false, options)
.then((res) => {
this._afterConsume(resolve, reject, rlKey, pointsToConsume, res);
})
.catch((err) => {
this._handleError(err, 'consume', resolve, reject, key, pointsToConsume, options);
});
});
}
/**
*
* @param key
* @param points
* @param {Object} options
* @returns Promise<RateLimiterRes>
*/
penalty(key, points = 1, options = {}) {
const rlKey = this.getKey(key);
return new Promise((resolve, reject) => {
this._upsert(rlKey, points, this._getKeySecDuration(options) * 1000, false, options)
.then((res) => {
resolve(this._getRateLimiterRes(rlKey, points, res));
})
.catch((err) => {
this._handleError(err, 'penalty', resolve, reject, key, points, options);
});
});
}
/**
*
* @param key
* @param points
* @param {Object} options
* @returns Promise<RateLimiterRes>
*/
reward(key, points = 1, options = {}) {
const rlKey = this.getKey(key);
return new Promise((resolve, reject) => {
this._upsert(rlKey, -points, this._getKeySecDuration(options) * 1000, false, options)
.then((res) => {
resolve(this._getRateLimiterRes(rlKey, -points, res));
})
.catch((err) => {
this._handleError(err, 'reward', resolve, reject, key, points, options);
});
});
}
/**
*
* @param key
* @param {Object} options
* @returns Promise<RateLimiterRes>|null
*/
get(key, options = {}) {
const rlKey = this.getKey(key);
return new Promise((resolve, reject) => {
this._get(rlKey, options)
.then((res) => {
if (res === null || typeof res === 'undefined') {
resolve(null);
} else {
resolve(this._getRateLimiterRes(rlKey, 0, res));
}
})
.catch((err) => {
this._handleError(err, 'get', resolve, reject, key, options);
});
});
}
/**
*
* @param key
* @param {Object} options
* @returns Promise<boolean>
*/
delete(key, options = {}) {
const rlKey = this.getKey(key);
return new Promise((resolve, reject) => {
this._delete(rlKey, options)
.then((res) => {
this._inMemoryBlockedKeys.delete(rlKey);
resolve(res);
})
.catch((err) => {
this._handleError(err, 'delete', resolve, reject, key, options);
});
});
}
/**
* Cleanup keys no-matter expired or not.
*/
deleteInMemoryBlockedAll() {
this._inMemoryBlockedKeys.delete();
}
/**
* Get RateLimiterRes object filled depending on storeResult, which specific for exact store
*
* @param rlKey
* @param changedPoints
* @param storeResult
* @private
*/
_getRateLimiterRes(rlKey, changedPoints, storeResult) { // eslint-disable-line no-unused-vars
throw new Error("You have to implement the method '_getRateLimiterRes'!");
}
/**
* Block key for this.msBlockDuration milliseconds
* Usually, it just prolongs lifetime of key
*
* @param rlKey
* @param initPoints
* @param msDuration
* @param {Object} options
*
* @return Promise<any>
*/
_block(rlKey, initPoints, msDuration, options = {}) {
return new Promise((resolve, reject) => {
this._upsert(rlKey, initPoints, msDuration, true, options)
.then(() => {
resolve(new RateLimiterRes(0, msDuration > 0 ? msDuration : -1, initPoints));
})
.catch((err) => {
this._handleError(err, 'block', resolve, reject, this.parseKey(rlKey), msDuration / 1000, options);
});
});
}
/**
* Have to be implemented in every limiter
* Resolve with raw result from Store OR null if rlKey is not set
* or Reject with error
*
* @param rlKey
* @param {Object} options
* @private
*
* @return Promise<any>
*/
_get(rlKey, options = {}) { // eslint-disable-line no-unused-vars
throw new Error("You have to implement the method '_get'!");
}
/**
* Have to be implemented
* Resolve with true OR false if rlKey doesn't exist
* or Reject with error
*
* @param rlKey
* @param {Object} options
* @private
*
* @return Promise<any>
*/
_delete(rlKey, options = {}) { // eslint-disable-line no-unused-vars
throw new Error("You have to implement the method '_delete'!");
}
/**
* Have to be implemented
* Resolve with object used for {@link _getRateLimiterRes} to generate {@link RateLimiterRes}
*
* @param {string} rlKey
* @param {number} points
* @param {number} msDuration
* @param {boolean} forceExpire
* @param {Object} options
* @abstract
*
* @return Promise<Object>
*/
_upsert(rlKey, points, msDuration, forceExpire = false, options = {}) {
throw new Error("You have to implement the method '_upsert'!");
}
};
var RateLimiterStoreAbstract = /*@__PURE__*/getDefaultExportFromCjs(RateLimiterStoreAbstract_1);
const assert = createAssert('RateLimit');
class RateLimiterStore extends RateLimiterStoreAbstract {
constructor(storage, options) {
super(options);
this.storage = storage;
}
/**
* parses raw data from store to RateLimiterRes object.
*/
_getRateLimiterRes(key, changedPoints, result) {
const [consumed = 0, expireTime = 0] = result !== null && result !== void 0 ? result : [];
const msBeforeNext = expireTime > 0 ? Math.max(expireTime - Date.now(), 0) : -1;
const isFirstInDuration = !consumed || changedPoints === consumed;
const currentConsumedPoints = isFirstInDuration ? changedPoints : consumed;
const res = new RateLimiterRes$1(Math.max(0, this.points - currentConsumedPoints), msBeforeNext, isFirstInDuration ? changedPoints : consumed, isFirstInDuration);
return res;
}
async _upsert(key, points, msDuration, forceExpire = false) {
var _a;
key = key.toString();
const isNeverExpired = msDuration <= 0;
const expireTime = isNeverExpired ? -1 : Date.now() + msDuration;
const newRecord = [points, expireTime];
if (!forceExpire) {
const [oldPoints = 0, oldExpireTime = 0] = ((_a = (await this.storage.get(key))) !== null && _a !== void 0 ? _a : []);
// if haven't expired yet
if (isNeverExpired || (!isNeverExpired && oldExpireTime > Date.now())) {
newRecord[0] += oldPoints;
}
if (!isNeverExpired && oldExpireTime > Date.now()) {
newRecord[1] = oldExpireTime;
}
}
await this.storage.set(key.toString(), newRecord);
// need to return the record after upsert
return newRecord;
}
/**
* returns raw data by key or null if there is no key or expired.
*/
async _get(key) {
return Promise.resolve(this.storage.get(key.toString())).then(res => {
if (!res) {
return null;
}
const [, expireTime] = res;
// if have expire time and it has expired
if (expireTime > 0 && expireTime <= Date.now()) {
return null;
}
return res;
});
}
/**
* returns true on deleted, false if key is not found.
*/
async _delete(key) {
try {
await this.storage.remove(key.toString());
}
catch (_a) {
return false;
}
return true;
}
}
/**
* The method instance modified by rateLimit, its extension method corresponds to the method of creating an instance in rate-limit-flexible, and the key is the key specified by calling rateLimit.
* AlovaServerHook can currently only return unextended method types. It has not been changed to customizable returned extended method types.
*/
class LimitedMethod extends HookedMethod {
constructor(method, limiterKey, limiter) {
super(method, force => this.consume().then(() => method.send(force)));
this.limiter = limiter;
this.keyGetter = isFn(limiterKey) ? () => limiterKey(method) : () => limiterKey;
}
getLimiterKey() {
return this.keyGetter();
}
/**
* Get RateLimiterRes or null.
*/
get(options) {
return this.limiter.get(this.getLimiterKey(), options);
}
/**
* Set points by key.
*/
set(points, msDuration) {
return this.limiter.set(this.getLimiterKey(), points, msDuration / 1000);
}
/**
* @param points default is 1
*/
consume(points) {
return this.limiter.consume(this.getLimiterKey(), points);
}
/**
* Increase number of consumed points in current duration.
* @param points penalty points
*/
penalty(points) {
return this.limiter.penalty(this.getLimiterKey(), points);
}
/**
* Decrease number of consumed points in current duration.
* @param points reward points
*/
reward(points) {
return this.limiter.reward(this.getLimiterKey(), points);
}
/**
* Block key for ms.
*/
block(msDuration) {
return this.limiter.block(this.getLimiterKey(), msDuration / 1000);
}
/**
* Reset consumed points.
*/
delete() {
return this.limiter.delete(this.getLimiterKey());
}
}
function createRateLimiter(options = {}) {
const { points = 4, duration = 4 * 1000, keyPrefix, execEvenly, execEvenlyMinDelayMs, blockDuration } = options;
const limitedMethodWrapper = createServerHook((method, handlerOptions = {}) => {
var _a;
const { key = uuid() } = handlerOptions;
const storage = (_a = options.storage) !== null && _a !== void 0 ? _a : getOptions(method).l2Cache;
assert(!!storage, 'storage is not define');
const limiter = new RateLimiterStore(storage, {
points,
duration: Math.floor(duration / 1000),
keyPrefix,
execEvenly,
execEvenlyMinDelayMs,
blockDuration: blockDuration ? Math.floor(blockDuration / 1000) : blockDuration,
storeClient: {}
});
return new LimitedMethod(method, key, limiter);
});
return limitedMethodWrapper;
}
const retry = createServerHook((method, options = {}) => {
const { retry = 3, backoff = { delay: 1000 } } = options;
let retryTimes = 0;
return new HookedMethod(method, forceRequest => new Promise((resolve, reject) => {
const sendRequest = () => {
method
.send(forceRequest)
.then(resolve)
.catch(error => {
// when not reach retry times or return true from retry function, it will retry again.
if (isNumber(retry) ? retryTimes < retry : retry(error)) {
retryTimes += 1;
// calculate retry delay time with pram `backoff` and current retry times.
const retryDelay = delayWithBackoff(backoff, retryTimes);
setTimeout(sendRequest, retryDelay);
}
else {
reject(error);
}
});
};
sendRequest();
}));
});
export { HookedMethod, createRateLimiter, retry };

86
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/react.common.cjs

@ -1,86 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
var shared = require('@alova/shared');
var react$1 = require('react');
const stateToData = (reactState) => (2 in reactState ? reactState[2] : reactState[0]);
const refCurrent = (ref) => ref.current;
const setRef = (ref, newVal) => {
ref.current = newVal;
};
// the react predefined hooks
var react = {
name: 'React',
create: initialValue => react$1.useState(initialValue),
export: stateToData,
dehydrate: stateToData,
update: (newVal, state) => {
// update value synchronously so that we can access the new value synchronously.
state[2] = newVal;
state[1](newVal);
},
memorize: fn => {
// use `useCallback` to ensure the same reference, and refer the newest function with `useRef`
const fnRef = react$1.useRef(shared.noop);
setRef(fnRef, fn);
return react$1.useCallback((...args) => refCurrent(fnRef)(...args), []);
},
ref: initialValue => {
const refObj = react$1.useRef(initialValue);
refCurrent(refObj) === shared.undefinedValue && setRef(refObj, initialValue);
return refObj;
},
effectRequest({ handler, removeStates, saveStates, immediate, frontStates, watchingStates = [] }) {
// `handler` is called when some states change are detected
const oldStates = react$1.useRef(watchingStates);
react$1.useEffect(() => {
const oldStatesValue = refCurrent(oldStates);
// compare the old and new value, and get the index of changed state
let changedIndex = shared.undefinedValue;
for (const index in watchingStates) {
if (!Object.is(oldStatesValue[index], watchingStates[index])) {
changedIndex = Number(index);
break;
}
}
setRef(oldStates, watchingStates);
if (immediate || shared.isNumber(changedIndex)) {
handler(changedIndex);
}
// remove states when component is unmounted
return removeStates;
}, watchingStates);
// Because react will call usehook again every time it refreshes, the state cache will be invalidated every time
// Therefore, the managed state needs to be updated every time
const needSave = react$1.useRef(false);
react$1.useEffect(() => {
refCurrent(needSave) ? saveStates(frontStates) : setRef(needSave, shared.trueValue);
});
},
computed: (getter, depList) => {
const memo = react$1.useMemo(getter, depList);
return [memo, shared.noop];
},
watch: (states, callback) => {
// When there is a monitoring state, the state changes and then triggers
const needEmit = react$1.useRef(shared.falseValue);
react$1.useEffect(() => {
needEmit.current ? callback() : (needEmit.current = true);
}, states);
},
onMounted: callback => {
react$1.useEffect(callback, []);
},
onUnmounted: callback => {
react$1.useEffect(() => callback, []);
}
};
module.exports = react;

84
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/react.esm.js

@ -1,84 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
import { noop, undefinedValue, isNumber, falseValue, trueValue } from '@alova/shared';
import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
const stateToData = (reactState) => (2 in reactState ? reactState[2] : reactState[0]);
const refCurrent = (ref) => ref.current;
const setRef = (ref, newVal) => {
ref.current = newVal;
};
// the react predefined hooks
var react = {
name: 'React',
create: initialValue => useState(initialValue),
export: stateToData,
dehydrate: stateToData,
update: (newVal, state) => {
// update value synchronously so that we can access the new value synchronously.
state[2] = newVal;
state[1](newVal);
},
memorize: fn => {
// use `useCallback` to ensure the same reference, and refer the newest function with `useRef`
const fnRef = useRef(noop);
setRef(fnRef, fn);
return useCallback((...args) => refCurrent(fnRef)(...args), []);
},
ref: initialValue => {
const refObj = useRef(initialValue);
refCurrent(refObj) === undefinedValue && setRef(refObj, initialValue);
return refObj;
},
effectRequest({ handler, removeStates, saveStates, immediate, frontStates, watchingStates = [] }) {
// `handler` is called when some states change are detected
const oldStates = useRef(watchingStates);
useEffect(() => {
const oldStatesValue = refCurrent(oldStates);
// compare the old and new value, and get the index of changed state
let changedIndex = undefinedValue;
for (const index in watchingStates) {
if (!Object.is(oldStatesValue[index], watchingStates[index])) {
changedIndex = Number(index);
break;
}
}
setRef(oldStates, watchingStates);
if (immediate || isNumber(changedIndex)) {
handler(changedIndex);
}
// remove states when component is unmounted
return removeStates;
}, watchingStates);
// Because react will call usehook again every time it refreshes, the state cache will be invalidated every time
// Therefore, the managed state needs to be updated every time
const needSave = useRef(false);
useEffect(() => {
refCurrent(needSave) ? saveStates(frontStates) : setRef(needSave, trueValue);
});
},
computed: (getter, depList) => {
const memo = useMemo(getter, depList);
return [memo, noop];
},
watch: (states, callback) => {
// When there is a monitoring state, the state changes and then triggers
const needEmit = useRef(falseValue);
useEffect(() => {
needEmit.current ? callback() : (needEmit.current = true);
}, states);
},
onMounted: callback => {
useEffect(callback, []);
},
onUnmounted: callback => {
useEffect(() => callback, []);
}
};
export { react as default };

117
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/react.umd.js

@ -1,117 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) :
typeof define === 'function' && define.amd ? define(['react'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.reactHook = factory(global.React));
})(this, (function (react$1) { 'use strict';
/**
* @alova/shared 1.1.2 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
const undefStr = 'undefined';
const undefinedValue = undefined;
const trueValue = true;
const falseValue = false;
const typeOf = (arg) => typeof arg;
// Whether it is running on the server side, node and bun are judged by process, and deno is judged by Deno.
// Some frameworks (such as Alipay and uniapp) will inject the process object as a global variable.
// Therefore, the process.cwd function unique to the server is used as the basis for judgment.
typeof window === undefStr &&
(typeof process !== undefStr ? typeof process.cwd === 'function' : typeof Deno !== undefStr);
/**
* Empty function for compatibility processing
*/
const noop = () => { };
/**
* Determine whether the parameter is a number any parameter
* @returns Whether the parameter is a number
*/
const isNumber = (arg) => typeOf(arg) === 'number' && !Number.isNaN(arg);
const stateToData = (reactState) => (2 in reactState ? reactState[2] : reactState[0]);
const refCurrent = (ref) => ref.current;
const setRef = (ref, newVal) => {
ref.current = newVal;
};
// the react predefined hooks
var react = {
name: 'React',
create: initialValue => react$1.useState(initialValue),
export: stateToData,
dehydrate: stateToData,
update: (newVal, state) => {
// update value synchronously so that we can access the new value synchronously.
state[2] = newVal;
state[1](newVal);
},
memorize: fn => {
// use `useCallback` to ensure the same reference, and refer the newest function with `useRef`
const fnRef = react$1.useRef(noop);
setRef(fnRef, fn);
return react$1.useCallback((...args) => refCurrent(fnRef)(...args), []);
},
ref: initialValue => {
const refObj = react$1.useRef(initialValue);
refCurrent(refObj) === undefinedValue && setRef(refObj, initialValue);
return refObj;
},
effectRequest({ handler, removeStates, saveStates, immediate, frontStates, watchingStates = [] }) {
// `handler` is called when some states change are detected
const oldStates = react$1.useRef(watchingStates);
react$1.useEffect(() => {
const oldStatesValue = refCurrent(oldStates);
// compare the old and new value, and get the index of changed state
let changedIndex = undefinedValue;
for (const index in watchingStates) {
if (!Object.is(oldStatesValue[index], watchingStates[index])) {
changedIndex = Number(index);
break;
}
}
setRef(oldStates, watchingStates);
if (immediate || isNumber(changedIndex)) {
handler(changedIndex);
}
// remove states when component is unmounted
return removeStates;
}, watchingStates);
// Because react will call usehook again every time it refreshes, the state cache will be invalidated every time
// Therefore, the managed state needs to be updated every time
const needSave = react$1.useRef(false);
react$1.useEffect(() => {
refCurrent(needSave) ? saveStates(frontStates) : setRef(needSave, trueValue);
});
},
computed: (getter, depList) => {
const memo = react$1.useMemo(getter, depList);
return [memo, noop];
},
watch: (states, callback) => {
// When there is a monitoring state, the state changes and then triggers
const needEmit = react$1.useRef(falseValue);
react$1.useEffect(() => {
needEmit.current ? callback() : (needEmit.current = true);
}, states);
},
onMounted: callback => {
react$1.useEffect(callback, []);
},
onUnmounted: callback => {
react$1.useEffect(() => callback, []);
}
};
return react;
}));

1
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/react.umd.min.js

@ -1 +0,0 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).reactHook=t(e.React)}(this,(function(e){"use strict";const t="undefined",n=void 0;typeof window===t&&typeof process!==t&&process.cwd;const o=()=>{},s=e=>2 in e?e[2]:e[0],r=e=>e.current,u=(e,t)=>{e.current=t};return{name:"React",create:t=>e.useState(t),export:s,dehydrate:s,update:(e,t)=>{t[2]=e,t[1](e)},memorize:t=>{const n=e.useRef(o);return u(n,t),e.useCallback(((...e)=>r(n)(...e)),[])},ref:t=>{const o=e.useRef(t);return r(o)===n&&u(o,t),o},effectRequest({handler:t,removeStates:o,saveStates:s,immediate:f,frontStates:c,watchingStates:a=[]}){const i=e.useRef(a);e.useEffect((()=>{const e=r(i);let s=n;for(const t in a)if(!Object.is(e[t],a[t])){s=Number(t);break}var c;return u(i,a),!f&&("number"!==(e=>typeof e)(c=s)||Number.isNaN(c))||t(s),o}),a);const d=e.useRef(!1);e.useEffect((()=>{r(d)?s(c):u(d,true)}))},computed:(t,n)=>[e.useMemo(t,n),o],watch:(t,n)=>{const o=e.useRef(false);e.useEffect((()=>{o.current?n():o.current=!0}),t)},onMounted:t=>{e.useEffect(t,[])},onUnmounted:t=>{e.useEffect((()=>t),[])}}}));

48
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/solid.common.cjs

@ -1,48 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
var shared = require('@alova/shared');
var solidJs = require('solid-js');
// solid hooks predefined
var solid = {
name: 'Solid',
create: data => solidJs.createSignal(data),
export: state => state[0],
dehydrate: state => state[0](),
update: (newVal, state) => {
state[1](newVal);
},
effectRequest: ({ handler, removeStates, immediate, watchingStates = [] }) => {
// remove states when component unmounted
solidJs.onCleanup(removeStates);
immediate && handler();
shared.forEach(watchingStates, (state, i) => {
solidJs.createEffect(solidJs.on(state, () => {
handler(i);
}, { defer: true }));
});
},
computed: getter => [solidJs.createMemo(getter), shared.noop],
watch: (states, callback) => {
const curStates = Array.isArray(states) ? states : [states];
const syncRunner = shared.createSyncOnceRunner();
solidJs.createEffect(solidJs.on(curStates.map(state => state), () => syncRunner(() => {
callback();
}), { defer: true }));
},
onMounted: callback => {
solidJs.onMount(callback);
},
onUnmounted: callback => {
solidJs.onCleanup(callback);
}
};
module.exports = solid;

46
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/solid.esm.js

@ -1,46 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
import { forEach, noop, createSyncOnceRunner } from '@alova/shared';
import { createSignal, onCleanup, createEffect, on, createMemo, onMount } from 'solid-js';
// solid hooks predefined
var solid = {
name: 'Solid',
create: data => createSignal(data),
export: state => state[0],
dehydrate: state => state[0](),
update: (newVal, state) => {
state[1](newVal);
},
effectRequest: ({ handler, removeStates, immediate, watchingStates = [] }) => {
// remove states when component unmounted
onCleanup(removeStates);
immediate && handler();
forEach(watchingStates, (state, i) => {
createEffect(on(state, () => {
handler(i);
}, { defer: true }));
});
},
computed: getter => [createMemo(getter), noop],
watch: (states, callback) => {
const curStates = Array.isArray(states) ? states : [states];
const syncRunner = createSyncOnceRunner();
createEffect(on(curStates.map(state => state), () => syncRunner(() => {
callback();
}), { defer: true }));
},
onMounted: callback => {
onMount(callback);
},
onUnmounted: callback => {
onCleanup(callback);
}
};
export { solid as default };

51
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/solid.umd.js

@ -1,51 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@alova/shared'), require('solid-js')) :
typeof define === 'function' && define.amd ? define(['@alova/shared', 'solid-js'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.solidHook = factory(global.shared, global.Solid));
})(this, (function (shared, solidJs) { 'use strict';
// solid hooks predefined
var solid = {
name: 'Solid',
create: data => solidJs.createSignal(data),
export: state => state[0],
dehydrate: state => state[0](),
update: (newVal, state) => {
state[1](newVal);
},
effectRequest: ({ handler, removeStates, immediate, watchingStates = [] }) => {
// remove states when component unmounted
solidJs.onCleanup(removeStates);
immediate && handler();
shared.forEach(watchingStates, (state, i) => {
solidJs.createEffect(solidJs.on(state, () => {
handler(i);
}, { defer: true }));
});
},
computed: getter => [solidJs.createMemo(getter), shared.noop],
watch: (states, callback) => {
const curStates = Array.isArray(states) ? states : [states];
const syncRunner = shared.createSyncOnceRunner();
solidJs.createEffect(solidJs.on(curStates.map(state => state), () => syncRunner(() => {
callback();
}), { defer: true }));
},
onMounted: callback => {
solidJs.onMount(callback);
},
onUnmounted: callback => {
solidJs.onCleanup(callback);
}
};
return solid;
}));

1
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/solid.umd.min.js

@ -1 +0,0 @@
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o(require("@alova/shared"),require("solid-js")):"function"==typeof define&&define.amd?define(["@alova/shared","solid-js"],o):(e="undefined"!=typeof globalThis?globalThis:e||self).solidHook=o(e.shared,e.Solid)}(this,(function(e,o){"use strict";return{name:"Solid",create:e=>o.createSignal(e),export:e=>e[0],dehydrate:e=>e[0](),update:(e,o)=>{o[1](e)},effectRequest:({handler:t,removeStates:n,immediate:a,watchingStates:r=[]})=>{o.onCleanup(n),a&&t(),e.forEach(r,((e,n)=>{o.createEffect(o.on(e,(()=>{t(n)}),{defer:!0}))}))},computed:t=>[o.createMemo(t),e.noop],watch:(t,n)=>{const a=Array.isArray(t)?t:[t],r=e.createSyncOnceRunner();o.createEffect(o.on(a.map((e=>e)),(()=>r((()=>{n()}))),{defer:!0}))},onMounted:e=>{o.onMount(e)},onUnmounted:e=>{o.onCleanup(e)}}}));

63
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/svelte.common.cjs

@ -1,63 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
var shared = require('@alova/shared');
var svelte$1 = require('svelte');
var store = require('svelte/store');
// the svelte predefined hooks
var svelte = {
name: 'Svelte',
create: data => store.writable(data),
dehydrate: state => {
let raw;
// The function will be executed once when subscribing, and the unsubscribe function will be called immediately after the value is obtained
state.subscribe(value => {
raw = value;
})();
return raw;
},
update: (newVal, state) => {
state.set(newVal);
},
effectRequest({ handler, removeStates, immediate, watchingStates }) {
// Remove the corresponding state when the component is unmounted
svelte$1.onDestroy(removeStates);
svelte$1.onMount(() => {
immediate && handler();
});
shared.forEach(watchingStates || [], (state, i) => {
let needEmit = shared.falseValue;
state.subscribe(() => {
// Svelte's `writable` will trigger once by default, so when immediate is false, you need to filter out the first trigger call
needEmit ? handler(i) : (needEmit = shared.trueValue);
});
});
},
computed: (getter, depList) => store.derived(depList, getter),
watch: (states, callback) => {
let needEmit = shared.falseValue;
const syncRunner = shared.createSyncOnceRunner();
states.forEach(state => {
state.subscribe(() => {
syncRunner(() => {
needEmit ? callback() : (needEmit = shared.trueValue);
});
});
});
},
onMounted: callback => {
svelte$1.onMount(callback);
},
onUnmounted: callback => {
svelte$1.onDestroy(callback);
}
};
module.exports = svelte;

61
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/svelte.esm.js

@ -1,61 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
import { forEach, trueValue, createSyncOnceRunner, falseValue } from '@alova/shared';
import { onDestroy, onMount } from 'svelte';
import { writable, derived } from 'svelte/store';
// the svelte predefined hooks
var svelte = {
name: 'Svelte',
create: data => writable(data),
dehydrate: state => {
let raw;
// The function will be executed once when subscribing, and the unsubscribe function will be called immediately after the value is obtained
state.subscribe(value => {
raw = value;
})();
return raw;
},
update: (newVal, state) => {
state.set(newVal);
},
effectRequest({ handler, removeStates, immediate, watchingStates }) {
// Remove the corresponding state when the component is unmounted
onDestroy(removeStates);
onMount(() => {
immediate && handler();
});
forEach(watchingStates || [], (state, i) => {
let needEmit = falseValue;
state.subscribe(() => {
// Svelte's `writable` will trigger once by default, so when immediate is false, you need to filter out the first trigger call
needEmit ? handler(i) : (needEmit = trueValue);
});
});
},
computed: (getter, depList) => derived(depList, getter),
watch: (states, callback) => {
let needEmit = falseValue;
const syncRunner = createSyncOnceRunner();
states.forEach(state => {
state.subscribe(() => {
syncRunner(() => {
needEmit ? callback() : (needEmit = trueValue);
});
});
});
},
onMounted: callback => {
onMount(callback);
},
onUnmounted: callback => {
onDestroy(callback);
}
};
export { svelte as default };

47
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue-demi.common.cjs

@ -1,47 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
var shared = require('@alova/shared');
var vueDemi$1 = require('vue-demi');
// Vue’s predefined hooks
var vueDemi = {
name: 'VueDemi',
create: data => vueDemi$1.ref(data),
dehydrate: state => state.value,
update: (newVal, state) => {
state.value = newVal;
},
effectRequest({ handler, removeStates, immediate, watchingStates }) {
// When used inside a component, the corresponding state is removed when the component is unloaded.
if (vueDemi$1.getCurrentInstance()) {
vueDemi$1.onUnmounted(removeStates);
}
immediate && handler();
shared.forEach(watchingStates || [], (state, i) => {
vueDemi$1.watch(state, () => {
handler(i);
}, { deep: shared.trueValue });
});
},
computed: getter => vueDemi$1.computed(getter),
watch: (states, callback) => {
vueDemi$1.watch(states, callback, {
deep: shared.trueValue
});
},
onMounted: callback => {
vueDemi$1.onMounted(callback);
},
onUnmounted: callback => {
vueDemi$1.onUnmounted(callback);
}
};
module.exports = vueDemi;

45
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue-demi.esm.js

@ -1,45 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
import { forEach, trueValue } from '@alova/shared';
import { ref, getCurrentInstance, onUnmounted, watch, computed, onMounted } from 'vue-demi';
// Vue’s predefined hooks
var vueDemi = {
name: 'VueDemi',
create: data => ref(data),
dehydrate: state => state.value,
update: (newVal, state) => {
state.value = newVal;
},
effectRequest({ handler, removeStates, immediate, watchingStates }) {
// When used inside a component, the corresponding state is removed when the component is unloaded.
if (getCurrentInstance()) {
onUnmounted(removeStates);
}
immediate && handler();
forEach(watchingStates || [], (state, i) => {
watch(state, () => {
handler(i);
}, { deep: trueValue });
});
},
computed: getter => computed(getter),
watch: (states, callback) => {
watch(states, callback, {
deep: trueValue
});
},
onMounted: callback => {
onMounted(callback);
},
onUnmounted: callback => {
onUnmounted(callback);
}
};
export { vueDemi as default };

66
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue-demi.umd.js

@ -1,66 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vue-demi')) :
typeof define === 'function' && define.amd ? define(['vue-demi'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.vueHook = factory(global.Vue));
})(this, (function (vueDemi$1) { 'use strict';
/**
* @alova/shared 1.1.2 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
const undefStr = 'undefined';
const trueValue = true;
const forEach = (ary, fn) => ary.forEach(fn);
// Whether it is running on the server side, node and bun are judged by process, and deno is judged by Deno.
// Some frameworks (such as Alipay and uniapp) will inject the process object as a global variable.
// Therefore, the process.cwd function unique to the server is used as the basis for judgment.
typeof window === undefStr &&
(typeof process !== undefStr ? typeof process.cwd === 'function' : typeof Deno !== undefStr);
// Vue’s predefined hooks
var vueDemi = {
name: 'VueDemi',
create: data => vueDemi$1.ref(data),
dehydrate: state => state.value,
update: (newVal, state) => {
state.value = newVal;
},
effectRequest({ handler, removeStates, immediate, watchingStates }) {
// When used inside a component, the corresponding state is removed when the component is unloaded.
if (vueDemi$1.getCurrentInstance()) {
vueDemi$1.onUnmounted(removeStates);
}
immediate && handler();
forEach(watchingStates || [], (state, i) => {
vueDemi$1.watch(state, () => {
handler(i);
}, { deep: trueValue });
});
},
computed: getter => vueDemi$1.computed(getter),
watch: (states, callback) => {
vueDemi$1.watch(states, callback, {
deep: trueValue
});
},
onMounted: callback => {
vueDemi$1.onMounted(callback);
},
onUnmounted: callback => {
vueDemi$1.onUnmounted(callback);
}
};
return vueDemi;
}));

1
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue-demi.umd.min.js

@ -1 +0,0 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue-demi")):"function"==typeof define&&define.amd?define(["vue-demi"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).vueHook=t(e.Vue)}(this,(function(e){"use strict";const t="undefined",n=!0;return typeof window===t&&typeof process!==t&&process.cwd,{name:"VueDemi",create:t=>e.ref(t),dehydrate:e=>e.value,update:(e,t)=>{t.value=e},effectRequest({handler:t,removeStates:o,immediate:d,watchingStates:u}){var i;e.getCurrentInstance()&&e.onUnmounted(o),d&&t(),i=(o,d)=>{e.watch(o,(()=>{t(d)}),{deep:n})},(u||[]).forEach(i)},computed:t=>e.computed(t),watch:(t,o)=>{e.watch(t,o,{deep:n})},onMounted:t=>{e.onMounted(t)},onUnmounted:t=>{e.onUnmounted(t)}}}));

52
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue.common.cjs

@ -1,52 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
'use strict';
var shared = require('@alova/shared');
var vue$1 = require('vue');
// the vue's predefined hooks
var vue = {
name: 'Vue',
create: data => vue$1.ref(data),
dehydrate: state => state.value,
update: (newVal, state) => {
state.value = newVal;
},
effectRequest({ handler, removeStates, immediate, watchingStates }) {
// if call in component, remove current hook states when unmounting component
if (vue$1.getCurrentInstance()) {
vue$1.onUnmounted(removeStates);
}
immediate && handler();
shared.forEach(watchingStates || [], (state, i) => {
vue$1.watch(state, () => {
handler(i);
}, { deep: shared.trueValue });
});
},
computed: getter => vue$1.computed(getter),
watch: (states, callback) => {
vue$1.watch(states, callback, {
deep: shared.trueValue
});
},
onMounted: callback => {
if (vue$1.getCurrentInstance()) {
vue$1.onMounted(callback);
}
else {
shared.setTimeoutFn(callback, 10);
}
},
onUnmounted: callback => {
vue$1.getCurrentInstance() && vue$1.onUnmounted(callback);
}
};
module.exports = vue;

50
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue.esm.js

@ -1,50 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
import { forEach, trueValue, setTimeoutFn } from '@alova/shared';
import { ref, getCurrentInstance, onUnmounted, watch, computed, onMounted } from 'vue';
// the vue's predefined hooks
var vue = {
name: 'Vue',
create: data => ref(data),
dehydrate: state => state.value,
update: (newVal, state) => {
state.value = newVal;
},
effectRequest({ handler, removeStates, immediate, watchingStates }) {
// if call in component, remove current hook states when unmounting component
if (getCurrentInstance()) {
onUnmounted(removeStates);
}
immediate && handler();
forEach(watchingStates || [], (state, i) => {
watch(state, () => {
handler(i);
}, { deep: trueValue });
});
},
computed: getter => computed(getter),
watch: (states, callback) => {
watch(states, callback, {
deep: trueValue
});
},
onMounted: callback => {
if (getCurrentInstance()) {
onMounted(callback);
}
else {
setTimeoutFn(callback, 10);
}
},
onUnmounted: callback => {
getCurrentInstance() && onUnmounted(callback);
}
};
export { vue as default };

72
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue.umd.js

@ -1,72 +0,0 @@
/**
* @alova/client 2.0.0 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott hu. All Rights Reserved
* Licensed under MIT (git://github.com/alovajs/alova/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vue')) :
typeof define === 'function' && define.amd ? define(['vue'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.vueHook = factory(global.Vue));
})(this, (function (vue$1) { 'use strict';
/**
* @alova/shared 1.1.2 (https://alova.js.org)
* Document https://alova.js.org
* Copyright 2025 Scott Hu. All Rights Reserved
* Licensed under MIT (https://github.com/alovajs/alova/blob/main/LICENSE)
*/
const undefStr = 'undefined';
const trueValue = true;
const setTimeoutFn = (fn, delay = 0) => setTimeout(fn, delay);
const forEach = (ary, fn) => ary.forEach(fn);
// Whether it is running on the server side, node and bun are judged by process, and deno is judged by Deno.
// Some frameworks (such as Alipay and uniapp) will inject the process object as a global variable.
// Therefore, the process.cwd function unique to the server is used as the basis for judgment.
typeof window === undefStr &&
(typeof process !== undefStr ? typeof process.cwd === 'function' : typeof Deno !== undefStr);
// the vue's predefined hooks
var vue = {
name: 'Vue',
create: data => vue$1.ref(data),
dehydrate: state => state.value,
update: (newVal, state) => {
state.value = newVal;
},
effectRequest({ handler, removeStates, immediate, watchingStates }) {
// if call in component, remove current hook states when unmounting component
if (vue$1.getCurrentInstance()) {
vue$1.onUnmounted(removeStates);
}
immediate && handler();
forEach(watchingStates || [], (state, i) => {
vue$1.watch(state, () => {
handler(i);
}, { deep: trueValue });
});
},
computed: getter => vue$1.computed(getter),
watch: (states, callback) => {
vue$1.watch(states, callback, {
deep: trueValue
});
},
onMounted: callback => {
if (vue$1.getCurrentInstance()) {
vue$1.onMounted(callback);
}
else {
setTimeoutFn(callback, 10);
}
},
onUnmounted: callback => {
vue$1.getCurrentInstance() && vue$1.onUnmounted(callback);
}
};
return vue;
}));

1
node_modules/.pnpm/alova@3.2.10/node_modules/alova/dist/stateshook/vue.umd.min.js

@ -1 +0,0 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).vueHook=t(e.Vue)}(this,(function(e){"use strict";const t="undefined",n=!0;return typeof window===t&&typeof process!==t&&process.cwd,{name:"Vue",create:t=>e.ref(t),dehydrate:e=>e.value,update:(e,t)=>{t.value=e},effectRequest({handler:t,removeStates:o,immediate:u,watchingStates:d}){var a;e.getCurrentInstance()&&e.onUnmounted(o),u&&t(),a=(o,u)=>{e.watch(o,(()=>{t(u)}),{deep:n})},(d||[]).forEach(a)},computed:t=>e.computed(t),watch:(t,o)=>{e.watch(t,o,{deep:n})},onMounted:t=>{e.getCurrentInstance()?e.onMounted(t):((e,t=0)=>{setTimeout(e,t)})(t,10)},onUnmounted:t=>{e.getCurrentInstance()&&e.onUnmounted(t)}}}));

153
node_modules/.pnpm/alova@3.2.10/node_modules/alova/package.json

@ -1,153 +0,0 @@
{
"name": "alova",
"version": "3.2.10",
"description": "Request strategy library for MVVM libraries such as Vue.js, React.js and Svelte.js",
"main": "dist/alova.common.cjs",
"module": "dist/alova.esm.js",
"types": "typings/index.d.ts",
"type": "module",
"sideEffects": false,
"homepage": "https://alova.js.org",
"keywords": [
"react",
"hooks",
"xmlhttprequest",
"vuejs",
"typescript",
"vue",
"reactjs",
"svelte",
"axios",
"request",
"fetch-api",
"vue3",
"react-hooks",
"superagent",
"alova"
],
"jsdelivr": "dist/alova.umd.min.js",
"unpkg": "dist/alova.umd.min.js",
"author": "Scott Hu",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/alovajs/alova.git"
},
"bugs": {
"url": "https://github.com/alovajs/alova/issues"
},
"files": [
"dist",
"typings"
],
"engines": {
"node": ">= 18.0.0"
},
"exports": {
".": {
"types": "./typings/index.d.ts",
"require": "./dist/alova.common.cjs",
"default": "./dist/alova.esm.js"
},
"./client": {
"types": "./typings/clienthook/index.d.ts",
"require": "./dist/clienthook/index.common.cjs",
"default": "./dist/clienthook/index.esm.js"
},
"./server": {
"types": "./typings/serverhook.d.ts",
"require": "./dist/serverhook/index.common.cjs",
"default": "./dist/serverhook/index.esm.js"
},
"./fetch": {
"types": {
"require": "./typings/fetch.d.cts",
"default": "./typings/fetch.d.ts"
},
"require": "./dist/adapter/fetch.common.cjs",
"default": "./dist/adapter/fetch.esm.js"
},
"./vue": {
"types": "./typings/stateshook/vue.d.ts",
"require": "./dist/stateshook/vue.common.cjs",
"default": "./dist/stateshook/vue.esm.js"
},
"./vue-demi": {
"types": "./typings/stateshook/vue-demi.d.ts",
"require": "./dist/stateshook/vue-demi.common.cjs",
"default": "./dist/stateshook/vue-demi.esm.js"
},
"./react": {
"types": "./typings/stateshook/react.d.ts",
"require": "./dist/stateshook/react.common.cjs",
"default": "./dist/stateshook/react.esm.js"
},
"./svelte": {
"types": "./typings/stateshook/svelte.d.ts",
"require": "./dist/stateshook/svelte.common.cjs",
"default": "./dist/stateshook/svelte.esm.js"
},
"./solid": {
"types": "./typings/stateshook/solid.d.ts",
"require": "./dist/stateshook/solid.common.cjs",
"default": "./dist/stateshook/solid.esm.js"
}
},
"typesVersions": {
"*": {
"client": [
"typings/clienthook/index.d.ts"
],
"server": [
"typings/serverhook.d.ts"
],
"fetch": [
"typings/fetch.d.ts"
],
"vue": [
"typings/stateshook/vue.d.ts"
],
"vue-demi": [
"typings/stateshook/vue-demi.d.ts"
],
"react": [
"typings/stateshook/react.d.ts"
],
"svelte": [
"typings/stateshook/svelte.d.ts"
],
"solid": [
"typings/stateshook/solid.d.ts"
]
}
},
"dependencies": {
"rate-limiter-flexible": "^5.0.3",
"@alova/shared": "1.1.2"
},
"devDependencies": {
"@alova/scripts": "1.1.1"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"scripts": {
"clean": "rimraf ./dist",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"release": "semantic-release",
"lint": "eslint --ext .ts,.js src",
"lint:fix": "pnpm lint --fix",
"build:core": "alova-scripts build core",
"build:fetch": "alova-scripts build fetch",
"build:client": "pnpm --filter=@alova/client run build",
"build:server": "pnpm --filter=@alova/server run build",
"build": "pnpm clean && alova-scripts build && pnpm build:client && pnpm build:server",
"coveralls": "pnpm test:coverage && coveralls < coverage/lcov.info",
"changelog": "conventional-changelog -p angular -u -i CHANGELOG.md -s -r 0",
"commit": "git-cz && git push",
"format": "prettier . --write"
}
}

5
node_modules/.pnpm/alova@3.2.10/node_modules/alova/typings/additional.d.ts

@ -1,5 +0,0 @@
declare module 'rate-limiter-flexible/lib/RateLimiterStoreAbstract.js' {
import { RateLimiterStoreAbstract } from 'rate-limiter-flexible';
export default RateLimiterStoreAbstract;
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save