Add files using upload-large-folder tool
Browse files- backend/node_modules/.bin/giget +112 -0
- backend/node_modules/.bin/prisma +0 -0
- backend/node_modules/c12/LICENSE +21 -0
- backend/node_modules/c12/README.md +467 -0
- backend/node_modules/c12/package.json +70 -0
- backend/node_modules/chokidar/LICENSE +21 -0
- backend/node_modules/chokidar/README.md +305 -0
- backend/node_modules/chokidar/handler.d.ts +90 -0
- backend/node_modules/chokidar/handler.js +635 -0
- backend/node_modules/chokidar/index.d.ts +215 -0
- backend/node_modules/chokidar/index.js +804 -0
- backend/node_modules/chokidar/package.json +69 -0
- backend/node_modules/dotenv/CHANGELOG.md +520 -0
- backend/node_modules/dotenv/LICENSE +23 -0
- backend/node_modules/dotenv/README-es.md +411 -0
- backend/node_modules/dotenv/README.md +645 -0
- backend/node_modules/dotenv/SECURITY.md +1 -0
- backend/node_modules/dotenv/config.d.ts +1 -0
- backend/node_modules/dotenv/config.js +9 -0
- backend/node_modules/dotenv/package.json +62 -0
- backend/node_modules/effect/LICENSE +21 -0
- backend/node_modules/effect/README.md +53 -0
- backend/node_modules/effect/package.json +1451 -0
- backend/node_modules/giget/LICENSE +184 -0
- backend/node_modules/giget/README.md +248 -0
- backend/node_modules/giget/package.json +62 -0
- backend/node_modules/perfect-debounce/LICENSE +21 -0
- backend/node_modules/perfect-debounce/README.md +92 -0
- backend/node_modules/perfect-debounce/package.json +44 -0
- backend/node_modules/prisma/LICENSE +201 -0
- backend/node_modules/prisma/README.md +86 -0
- backend/node_modules/prisma/config.d.ts +1 -0
- backend/node_modules/prisma/config.js +30 -0
- backend/node_modules/prisma/package.json +180 -0
- backend/node_modules/readdirp/LICENSE +21 -0
- backend/node_modules/readdirp/README.md +120 -0
- backend/node_modules/readdirp/index.js +263 -0
- backend/node_modules/readdirp/package.json +70 -0
- backend/prisma/migrations/20260516071158_init_auth/migration.sql +105 -0
- backend/prisma/migrations/20260516072006_remove_user_role/migration.sql +24 -0
- backend/prisma/migrations/migration_lock.toml +3 -0
- backend/src/positions/positions.controller.js +39 -0
- backend/src/positions/positions.validators.js +27 -0
- backend/src/socket/broadcaster.js +32 -0
- backend/src/stats/stats.routes.js +42 -0
- backend/src/watchlist/watchlist.controller.js +33 -0
- backend/src/watchlist/watchlist.repository.js +46 -0
- backend/src/watchlist/watchlist.routes.js +26 -0
- backend/src/watchlist/watchlist.service.js +41 -0
- backend/src/watchlist/watchlist.validators.js +21 -0
backend/node_modules/.bin/giget
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
import { relative } from 'node:path';
|
| 3 |
+
import { defineCommand, runMain } from 'citty';
|
| 4 |
+
import { consola } from 'consola';
|
| 5 |
+
import { d as downloadTemplate, s as startShell } from './shared/giget.OCaTp9b-.mjs';
|
| 6 |
+
import 'node:fs/promises';
|
| 7 |
+
import 'node:fs';
|
| 8 |
+
import 'assert';
|
| 9 |
+
import 'path';
|
| 10 |
+
import 'events';
|
| 11 |
+
import 'stream';
|
| 12 |
+
import 'string_decoder';
|
| 13 |
+
import 'buffer';
|
| 14 |
+
import 'zlib';
|
| 15 |
+
import 'process';
|
| 16 |
+
import 'fs';
|
| 17 |
+
import 'util';
|
| 18 |
+
import 'crypto';
|
| 19 |
+
import 'pathe';
|
| 20 |
+
import 'defu';
|
| 21 |
+
import 'nypm';
|
| 22 |
+
import 'node:stream';
|
| 23 |
+
import 'node:child_process';
|
| 24 |
+
import 'node:os';
|
| 25 |
+
import 'node:util';
|
| 26 |
+
import 'node-fetch-native/proxy';
|
| 27 |
+
|
| 28 |
+
const name = "giget";
|
| 29 |
+
const version = "2.0.0";
|
| 30 |
+
const description = "Download templates and git repositories with pleasure!";
|
| 31 |
+
const pkg = {
|
| 32 |
+
name: name,
|
| 33 |
+
version: version,
|
| 34 |
+
description: description};
|
| 35 |
+
|
| 36 |
+
const mainCommand = defineCommand({
|
| 37 |
+
meta: {
|
| 38 |
+
name: pkg.name,
|
| 39 |
+
version: pkg.version,
|
| 40 |
+
description: pkg.description
|
| 41 |
+
},
|
| 42 |
+
args: {
|
| 43 |
+
// TODO: Make it `-t` in the next major version
|
| 44 |
+
template: {
|
| 45 |
+
type: "positional",
|
| 46 |
+
description: "Template name or a a URI describing provider, repository, subdir, and branch/ref"
|
| 47 |
+
},
|
| 48 |
+
dir: {
|
| 49 |
+
type: "positional",
|
| 50 |
+
description: "A relative or absolute path where to extract the template",
|
| 51 |
+
required: false
|
| 52 |
+
},
|
| 53 |
+
auth: {
|
| 54 |
+
type: "string",
|
| 55 |
+
description: "Custom Authorization token to use for downloading template. (Can be overriden with `GIGET_AUTH` environment variable)"
|
| 56 |
+
},
|
| 57 |
+
cwd: {
|
| 58 |
+
type: "string",
|
| 59 |
+
description: "Set current working directory to resolve dirs relative to it"
|
| 60 |
+
},
|
| 61 |
+
force: {
|
| 62 |
+
type: "boolean",
|
| 63 |
+
description: "Clone to existing directory even if exists"
|
| 64 |
+
},
|
| 65 |
+
forceClean: {
|
| 66 |
+
type: "boolean",
|
| 67 |
+
description: "Remove any existing directory or file recusively before cloning"
|
| 68 |
+
},
|
| 69 |
+
offline: {
|
| 70 |
+
type: "boolean",
|
| 71 |
+
description: "o not attempt to download and use cached version"
|
| 72 |
+
},
|
| 73 |
+
preferOffline: {
|
| 74 |
+
type: "boolean",
|
| 75 |
+
description: "Use cache if exists otherwise try to download"
|
| 76 |
+
},
|
| 77 |
+
shell: {
|
| 78 |
+
type: "boolean",
|
| 79 |
+
description: "Open a new shell with current working "
|
| 80 |
+
},
|
| 81 |
+
install: {
|
| 82 |
+
type: "boolean",
|
| 83 |
+
description: "Install dependencies after cloning"
|
| 84 |
+
},
|
| 85 |
+
verbose: {
|
| 86 |
+
type: "boolean",
|
| 87 |
+
description: "Show verbose debugging info"
|
| 88 |
+
}
|
| 89 |
+
},
|
| 90 |
+
run: async ({ args }) => {
|
| 91 |
+
if (args.verbose) {
|
| 92 |
+
process.env.DEBUG = process.env.DEBUG || "true";
|
| 93 |
+
}
|
| 94 |
+
const r = await downloadTemplate(args.template, {
|
| 95 |
+
dir: args.dir,
|
| 96 |
+
force: args.force,
|
| 97 |
+
forceClean: args.forceClean,
|
| 98 |
+
offline: args.offline,
|
| 99 |
+
preferOffline: args.preferOffline,
|
| 100 |
+
auth: args.auth,
|
| 101 |
+
install: args.install
|
| 102 |
+
});
|
| 103 |
+
const _from = r.name || r.url;
|
| 104 |
+
const _to = relative(process.cwd(), r.dir) || "./";
|
| 105 |
+
consola.log(`\u2728 Successfully cloned \`${_from}\` to \`${_to}\`
|
| 106 |
+
`);
|
| 107 |
+
if (args.shell) {
|
| 108 |
+
startShell(r.dir);
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
});
|
| 112 |
+
runMain(mainCommand);
|
backend/node_modules/.bin/prisma
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
backend/node_modules/c12/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
backend/node_modules/c12/README.md
ADDED
|
@@ -0,0 +1,467 @@
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# βοΈ c12
|
| 2 |
+
|
| 3 |
+
<!-- automd:badges color=yellow codecov -->
|
| 4 |
+
|
| 5 |
+
[](https://npmjs.com/package/c12)
|
| 6 |
+
[](https://npm.chart.dev/c12)
|
| 7 |
+
[](https://codecov.io/gh/unjs/c12)
|
| 8 |
+
|
| 9 |
+
<!-- /automd -->
|
| 10 |
+
|
| 11 |
+
c12 (pronounced as /siΛtwelv/, like c-twelve) is a smart configuration loader.
|
| 12 |
+
|
| 13 |
+
## β
Features
|
| 14 |
+
|
| 15 |
+
- `.js`, `.ts`, `.mjs`, `.cjs`, `.mts`, `.cts` `.json` config loader with [unjs/jiti](https://jiti.unjs.io)
|
| 16 |
+
- `.jsonc`, `.json5`, `.yaml`, `.yml`, `.toml` config loader with [unjs/confbox](https://confbox.unjs.io)
|
| 17 |
+
- `.config/` directory support following [config dir proposal](https://github.com/pi0/config-dir)
|
| 18 |
+
- `.rc` config support with [unjs/rc9](https://github.com/unjs/rc9)
|
| 19 |
+
- `.env` support with [dotenv](https://www.npmjs.com/package/dotenv)
|
| 20 |
+
- Multiple sources merged with [unjs/defu](https://github.com/unjs/defu)
|
| 21 |
+
- Reads config from the nearest `package.json` file
|
| 22 |
+
- [Extends configurations](https://github.com/unjs/c12#extending-configuration) from multiple local or git sources
|
| 23 |
+
- Overwrite with [environment-specific configuration](#environment-specific-configuration)
|
| 24 |
+
- Config watcher with auto-reload and HMR support
|
| 25 |
+
- Create or update configuration files with [magicast](https://github.com/unjs/magicast)
|
| 26 |
+
|
| 27 |
+
## 𦴠Used by
|
| 28 |
+
|
| 29 |
+
- [Nuxt](https://nuxt.com/)
|
| 30 |
+
- [Nitro](https://nitro.build/)
|
| 31 |
+
- [Unbuild](https://unbuild.unjs.io)
|
| 32 |
+
- [Automd](https://automd.unjs.io)
|
| 33 |
+
- [Changelogen](https://changelogen.unjs.io)
|
| 34 |
+
- [RemixKit](https://github.com/jrestall/remix-kit)
|
| 35 |
+
- [Hey API](https://github.com/hey-api/openapi-ts)
|
| 36 |
+
- [kysely-ctl](https://github.com/kysely-org/kysely-ctl)
|
| 37 |
+
|
| 38 |
+
## Usage
|
| 39 |
+
|
| 40 |
+
Install package:
|
| 41 |
+
|
| 42 |
+
<!-- automd:pm-install -->
|
| 43 |
+
|
| 44 |
+
```sh
|
| 45 |
+
# β¨ Auto-detect
|
| 46 |
+
npx nypm install c12
|
| 47 |
+
|
| 48 |
+
# npm
|
| 49 |
+
npm install c12
|
| 50 |
+
|
| 51 |
+
# yarn
|
| 52 |
+
yarn add c12
|
| 53 |
+
|
| 54 |
+
# pnpm
|
| 55 |
+
pnpm install c12
|
| 56 |
+
|
| 57 |
+
# bun
|
| 58 |
+
bun install c12
|
| 59 |
+
|
| 60 |
+
# deno
|
| 61 |
+
deno install c12
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
<!-- /automd -->
|
| 65 |
+
|
| 66 |
+
Import:
|
| 67 |
+
|
| 68 |
+
```js
|
| 69 |
+
// ESM import
|
| 70 |
+
import { loadConfig, watchConfig } from "c12";
|
| 71 |
+
|
| 72 |
+
// or using dynamic import
|
| 73 |
+
const { loadConfig, watchConfig } = await import("c12");
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
Load configuration:
|
| 77 |
+
|
| 78 |
+
```js
|
| 79 |
+
// Get loaded config
|
| 80 |
+
const { config } = await loadConfig({});
|
| 81 |
+
|
| 82 |
+
// Get resolved config and extended layers
|
| 83 |
+
const { config, configFile, layers } = await loadConfig({});
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
## Loading priority
|
| 87 |
+
|
| 88 |
+
c12 merged config sources with [unjs/defu](https://github.com/unjs/defu) by below order:
|
| 89 |
+
|
| 90 |
+
1. Config overrides passed by options
|
| 91 |
+
2. Config file in CWD
|
| 92 |
+
3. RC file in CWD
|
| 93 |
+
4. Global RC file in the user's home directory
|
| 94 |
+
5. Config from `package.json`
|
| 95 |
+
6. Default config passed by options
|
| 96 |
+
7. Extended config layers
|
| 97 |
+
|
| 98 |
+
## Options
|
| 99 |
+
|
| 100 |
+
### `cwd`
|
| 101 |
+
|
| 102 |
+
Resolve configuration from this working directory. The default is `process.cwd()`
|
| 103 |
+
|
| 104 |
+
### `name`
|
| 105 |
+
|
| 106 |
+
Configuration base name. The default is `config`.
|
| 107 |
+
|
| 108 |
+
### `configFile`
|
| 109 |
+
|
| 110 |
+
Configuration file name without extension. Default is generated from `name` (f.e., if `name` is `foo`, the config file will be => `foo.config`).
|
| 111 |
+
|
| 112 |
+
### `rcFile`
|
| 113 |
+
|
| 114 |
+
RC Config file name. Default is generated from `name` (name=foo => `.foorc`).
|
| 115 |
+
|
| 116 |
+
Set to `false` to disable loading RC config.
|
| 117 |
+
|
| 118 |
+
### `globalRC`
|
| 119 |
+
|
| 120 |
+
Load RC config from the workspace directory and the user's home directory. Only enabled when `rcFile` is provided. Set to `false` to disable this functionality.
|
| 121 |
+
|
| 122 |
+
### `dotenv`
|
| 123 |
+
|
| 124 |
+
Loads `.env` file if enabled. It is disabled by default.
|
| 125 |
+
|
| 126 |
+
### `packageJson`
|
| 127 |
+
|
| 128 |
+
Loads config from nearest `package.json` file. It is disabled by default.
|
| 129 |
+
|
| 130 |
+
If `true` value is passed, c12 uses `name` field from `package.json`.
|
| 131 |
+
|
| 132 |
+
You can also pass either a string or an array of strings as a value to use those fields.
|
| 133 |
+
|
| 134 |
+
### `defaults`
|
| 135 |
+
|
| 136 |
+
Specify default configuration. It has the **lowest** priority and is applied **after extending** config.
|
| 137 |
+
|
| 138 |
+
### `defaultConfig`
|
| 139 |
+
|
| 140 |
+
Specify default configuration. It is applied **before** extending config.
|
| 141 |
+
|
| 142 |
+
### `overrides`
|
| 143 |
+
|
| 144 |
+
Specify override configuration. It has the **highest** priority and is applied **before extending** config.
|
| 145 |
+
|
| 146 |
+
### `omit$Keys`
|
| 147 |
+
|
| 148 |
+
Exclude environment-specific and built-in keys start with `$` in the resolved config. The default is `false`.
|
| 149 |
+
|
| 150 |
+
### `jiti`
|
| 151 |
+
|
| 152 |
+
Custom [unjs/jiti](https://github.com/unjs/jiti) instance used to import configuration files.
|
| 153 |
+
|
| 154 |
+
### `jitiOptions`
|
| 155 |
+
|
| 156 |
+
Custom [unjs/jiti](https://github.com/unjs/jiti) options to import configuration files.
|
| 157 |
+
|
| 158 |
+
### `giget`
|
| 159 |
+
|
| 160 |
+
Options passed to [unjs/giget](https://github.com/unjs/giget) when extending layer from git source.
|
| 161 |
+
|
| 162 |
+
### `merger`
|
| 163 |
+
|
| 164 |
+
Custom options merger function. Default is [defu](https://github.com/unjs/defu).
|
| 165 |
+
|
| 166 |
+
**Note:** Custom merge function should deeply merge options with arguments high -> low priority.
|
| 167 |
+
|
| 168 |
+
### `envName`
|
| 169 |
+
|
| 170 |
+
Environment name used for [environment specific configuration](#environment-specific-configuration).
|
| 171 |
+
|
| 172 |
+
The default is `process.env.NODE_ENV`. You can set `envName` to `false` or an empty string to disable the feature.
|
| 173 |
+
|
| 174 |
+
### `resolve`
|
| 175 |
+
|
| 176 |
+
You can define a custom function that resolves the config.
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
## Extending configuration
|
| 180 |
+
|
| 181 |
+
If resolved config contains a `extends` key, it will be used to extend the configuration.
|
| 182 |
+
|
| 183 |
+
Extending can be nested and each layer can extend from one base or more.
|
| 184 |
+
|
| 185 |
+
The final config is merged result of extended options and user options with [unjs/defu](https://github.com/unjs/defu).
|
| 186 |
+
|
| 187 |
+
Each item in extends is a string that can be either an absolute or relative path to the current config file pointing to a config file for extending or the directory containing the config file.
|
| 188 |
+
If it starts with either `github:`, `gitlab:`, `bitbucket:`, or `https:`, c12 automatically clones it.
|
| 189 |
+
|
| 190 |
+
For custom merging strategies, you can directly access each layer with `layers` property.
|
| 191 |
+
|
| 192 |
+
**Example:**
|
| 193 |
+
|
| 194 |
+
```js
|
| 195 |
+
// config.ts
|
| 196 |
+
export default {
|
| 197 |
+
colors: {
|
| 198 |
+
primary: "user_primary",
|
| 199 |
+
},
|
| 200 |
+
extends: ["./theme"],
|
| 201 |
+
};
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
```js
|
| 205 |
+
// config.dev.ts
|
| 206 |
+
export default {
|
| 207 |
+
dev: true,
|
| 208 |
+
};
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
```js
|
| 212 |
+
// theme/config.ts
|
| 213 |
+
export default {
|
| 214 |
+
extends: "../base",
|
| 215 |
+
colors: {
|
| 216 |
+
primary: "theme_primary",
|
| 217 |
+
secondary: "theme_secondary",
|
| 218 |
+
},
|
| 219 |
+
};
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
```js
|
| 223 |
+
// base/config.ts
|
| 224 |
+
export default {
|
| 225 |
+
colors: {
|
| 226 |
+
primary: "base_primary",
|
| 227 |
+
text: "base_text",
|
| 228 |
+
},
|
| 229 |
+
};
|
| 230 |
+
```
|
| 231 |
+
|
| 232 |
+
The loaded configuration would look like this:
|
| 233 |
+
|
| 234 |
+
```js
|
| 235 |
+
const config = {
|
| 236 |
+
dev: true,
|
| 237 |
+
colors: {
|
| 238 |
+
primary: "user_primary",
|
| 239 |
+
secondary: "theme_secondary",
|
| 240 |
+
text: "base_text",
|
| 241 |
+
},
|
| 242 |
+
};
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
+
Layers:
|
| 246 |
+
|
| 247 |
+
```js
|
| 248 |
+
[
|
| 249 |
+
{
|
| 250 |
+
config: {
|
| 251 |
+
/* theme config */
|
| 252 |
+
},
|
| 253 |
+
configFile: "/path/to/theme/config.ts",
|
| 254 |
+
cwd: "/path/to/theme ",
|
| 255 |
+
},
|
| 256 |
+
{
|
| 257 |
+
config: {
|
| 258 |
+
/* base config */
|
| 259 |
+
},
|
| 260 |
+
configFile: "/path/to/base/config.ts",
|
| 261 |
+
cwd: "/path/to/base",
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
config: {
|
| 265 |
+
/* dev config */
|
| 266 |
+
},
|
| 267 |
+
configFile: "/path/to/config.dev.ts",
|
| 268 |
+
cwd: "/path/",
|
| 269 |
+
},
|
| 270 |
+
];
|
| 271 |
+
```
|
| 272 |
+
|
| 273 |
+
## Extending config layer from remote sources
|
| 274 |
+
|
| 275 |
+
You can also extend configuration from remote sources such as npm or github.
|
| 276 |
+
|
| 277 |
+
In the repo, there should be a `config.ts` (or `config.{name}.ts`) file to be considered as a valid config layer.
|
| 278 |
+
|
| 279 |
+
**Example:** Extend from a github repository
|
| 280 |
+
|
| 281 |
+
```js
|
| 282 |
+
// config.ts
|
| 283 |
+
export default {
|
| 284 |
+
extends: "gh:user/repo",
|
| 285 |
+
};
|
| 286 |
+
```
|
| 287 |
+
|
| 288 |
+
**Example:** Extend from a github repository with branch and subpath
|
| 289 |
+
|
| 290 |
+
```js
|
| 291 |
+
// config.ts
|
| 292 |
+
export default {
|
| 293 |
+
extends: "gh:user/repo/theme#dev",
|
| 294 |
+
};
|
| 295 |
+
```
|
| 296 |
+
|
| 297 |
+
**Example:** Extend a private repository and install dependencies:
|
| 298 |
+
|
| 299 |
+
```js
|
| 300 |
+
// config.ts
|
| 301 |
+
export default {
|
| 302 |
+
extends: ["gh:user/repo", { auth: process.env.GITHUB_TOKEN, install: true }],
|
| 303 |
+
};
|
| 304 |
+
```
|
| 305 |
+
|
| 306 |
+
You can pass more options to `giget: {}` in layer config or disable it by setting it to `false`.
|
| 307 |
+
|
| 308 |
+
Refer to [unjs/giget](https://giget.unjs.io) for more information.
|
| 309 |
+
|
| 310 |
+
## Environment-specific configuration
|
| 311 |
+
|
| 312 |
+
Users can define environment-specific configuration using these config keys:
|
| 313 |
+
|
| 314 |
+
- `$test: {...}`
|
| 315 |
+
- `$development: {...}`
|
| 316 |
+
- `$production: {...}`
|
| 317 |
+
- `$env: { [env]: {...} }`
|
| 318 |
+
|
| 319 |
+
c12 tries to match [`envName`](#envname) and override environment config if specified.
|
| 320 |
+
|
| 321 |
+
**Note:** Environment will be applied when extending each configuration layer. This way layers can provide environment-specific configuration.
|
| 322 |
+
|
| 323 |
+
**Example:**
|
| 324 |
+
|
| 325 |
+
```js
|
| 326 |
+
export default {
|
| 327 |
+
// Default configuration
|
| 328 |
+
logLevel: "info",
|
| 329 |
+
|
| 330 |
+
// Environment overrides
|
| 331 |
+
$test: { logLevel: "silent" },
|
| 332 |
+
$development: { logLevel: "warning" },
|
| 333 |
+
$production: { logLevel: "error" },
|
| 334 |
+
$env: {
|
| 335 |
+
staging: { logLevel: "debug" },
|
| 336 |
+
},
|
| 337 |
+
};
|
| 338 |
+
```
|
| 339 |
+
|
| 340 |
+
## Watching configuration
|
| 341 |
+
|
| 342 |
+
you can use `watchConfig` instead of `loadConfig` to load config and watch for changes, add and removals in all expected configuration paths and auto reload with new config.
|
| 343 |
+
|
| 344 |
+
### Lifecycle hooks
|
| 345 |
+
|
| 346 |
+
- `onWatch`: This function is always called when config is updated, added, or removed before attempting to reload the config.
|
| 347 |
+
- `acceptHMR`: By implementing this function, you can compare old and new functions and return `true` if a full reload is not needed.
|
| 348 |
+
- `onUpdate`: This function is always called after the new config is updated. If `acceptHMR` returns true, it will be skipped.
|
| 349 |
+
|
| 350 |
+
```ts
|
| 351 |
+
import { watchConfig } from "c12";
|
| 352 |
+
|
| 353 |
+
const config = watchConfig({
|
| 354 |
+
cwd: ".",
|
| 355 |
+
// chokidarOptions: {}, // Default is { ignoreInitial: true }
|
| 356 |
+
// debounce: 200 // Default is 100. You can set it to false to disable debounced watcher
|
| 357 |
+
onWatch: (event) => {
|
| 358 |
+
console.log("[watcher]", event.type, event.path);
|
| 359 |
+
},
|
| 360 |
+
acceptHMR({ oldConfig, newConfig, getDiff }) {
|
| 361 |
+
const diff = getDiff();
|
| 362 |
+
if (diff.length === 0) {
|
| 363 |
+
console.log("No config changed detected!");
|
| 364 |
+
return true; // No changes!
|
| 365 |
+
}
|
| 366 |
+
},
|
| 367 |
+
onUpdate({ oldConfig, newConfig, getDiff }) {
|
| 368 |
+
const diff = getDiff();
|
| 369 |
+
console.log("Config updated:\n" + diff.map((i) => i.toJSON()).join("\n"));
|
| 370 |
+
},
|
| 371 |
+
});
|
| 372 |
+
|
| 373 |
+
console.log("watching config files:", config.watchingFiles);
|
| 374 |
+
console.log("initial config", config.config);
|
| 375 |
+
|
| 376 |
+
// Stop watcher when not needed anymore
|
| 377 |
+
// await config.unwatch();
|
| 378 |
+
```
|
| 379 |
+
|
| 380 |
+
## Updating config
|
| 381 |
+
|
| 382 |
+
> [!NOTE]
|
| 383 |
+
> This feature is experimental
|
| 384 |
+
|
| 385 |
+
Update or create a new configuration files.
|
| 386 |
+
|
| 387 |
+
Add `magicast` peer dependency:
|
| 388 |
+
|
| 389 |
+
<!-- automd:pm-install name="magicast" dev -->
|
| 390 |
+
|
| 391 |
+
```sh
|
| 392 |
+
# β¨ Auto-detect
|
| 393 |
+
npx nypm install -D magicast
|
| 394 |
+
|
| 395 |
+
# npm
|
| 396 |
+
npm install -D magicast
|
| 397 |
+
|
| 398 |
+
# yarn
|
| 399 |
+
yarn add -D magicast
|
| 400 |
+
|
| 401 |
+
# pnpm
|
| 402 |
+
pnpm install -D magicast
|
| 403 |
+
|
| 404 |
+
# bun
|
| 405 |
+
bun install -D magicast
|
| 406 |
+
|
| 407 |
+
# deno
|
| 408 |
+
deno install --dev magicast
|
| 409 |
+
```
|
| 410 |
+
|
| 411 |
+
<!-- /automd -->
|
| 412 |
+
|
| 413 |
+
Import util from `c12/update`
|
| 414 |
+
|
| 415 |
+
```js
|
| 416 |
+
const { configFile, created } = await updateConfig({
|
| 417 |
+
cwd: ".",
|
| 418 |
+
configFile: "foo.config",
|
| 419 |
+
onCreate: ({ configFile }) => {
|
| 420 |
+
// You can prompt user if wants to create a new config file and return false to cancel
|
| 421 |
+
console.log(`Creating new config file in ${configFile}...`);
|
| 422 |
+
return "export default { test: true }";
|
| 423 |
+
},
|
| 424 |
+
onUpdate: (config) => {
|
| 425 |
+
// You can update the config contents just like an object
|
| 426 |
+
config.test2 = false;
|
| 427 |
+
},
|
| 428 |
+
});
|
| 429 |
+
|
| 430 |
+
console.log(`Config file ${created ? "created" : "updated"} in ${configFile}`);
|
| 431 |
+
```
|
| 432 |
+
|
| 433 |
+
## Contribution
|
| 434 |
+
|
| 435 |
+
<details>
|
| 436 |
+
<summary>Local development</summary>
|
| 437 |
+
|
| 438 |
+
- Clone this repository
|
| 439 |
+
- Install the latest LTS version of [Node.js](https://nodejs.org/en/)
|
| 440 |
+
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
| 441 |
+
- Install dependencies using `pnpm install`
|
| 442 |
+
- Run tests using `pnpm dev` or `pnpm test`
|
| 443 |
+
|
| 444 |
+
</details>
|
| 445 |
+
|
| 446 |
+
<!-- /automd -->
|
| 447 |
+
|
| 448 |
+
## License
|
| 449 |
+
|
| 450 |
+
<!-- automd:contributors license=MIT author="pi0" -->
|
| 451 |
+
|
| 452 |
+
Published under the [MIT](https://github.com/unjs/c12/blob/main/LICENSE) license.
|
| 453 |
+
Made by [@pi0](https://github.com/pi0) and [community](https://github.com/unjs/c12/graphs/contributors) π
|
| 454 |
+
<br><br>
|
| 455 |
+
<a href="https://github.com/unjs/c12/graphs/contributors">
|
| 456 |
+
<img src="https://contrib.rocks/image?repo=unjs/c12" />
|
| 457 |
+
</a>
|
| 458 |
+
|
| 459 |
+
<!-- /automd -->
|
| 460 |
+
|
| 461 |
+
<!-- automd:with-automd -->
|
| 462 |
+
|
| 463 |
+
---
|
| 464 |
+
|
| 465 |
+
_π€ auto updated with [automd](https://automd.unjs.io)_
|
| 466 |
+
|
| 467 |
+
<!-- /automd -->
|
backend/node_modules/c12/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "c12",
|
| 3 |
+
"version": "3.1.0",
|
| 4 |
+
"description": "Smart Config Loader",
|
| 5 |
+
"repository": "unjs/c12",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"sideEffects": false,
|
| 8 |
+
"type": "module",
|
| 9 |
+
"exports": {
|
| 10 |
+
".": {
|
| 11 |
+
"types": "./dist/index.d.mts",
|
| 12 |
+
"default": "./dist/index.mjs"
|
| 13 |
+
},
|
| 14 |
+
"./update": {
|
| 15 |
+
"types": "./dist/update.d.mts",
|
| 16 |
+
"default": "./dist/update.mjs"
|
| 17 |
+
}
|
| 18 |
+
},
|
| 19 |
+
"types": "./dist/index.d.mts",
|
| 20 |
+
"files": [
|
| 21 |
+
"dist"
|
| 22 |
+
],
|
| 23 |
+
"scripts": {
|
| 24 |
+
"build": "automd && unbuild",
|
| 25 |
+
"dev": "vitest dev",
|
| 26 |
+
"lint": "eslint . && prettier -c src test",
|
| 27 |
+
"lint:fix": "eslint . --fix && prettier -w src test",
|
| 28 |
+
"prepack": "unbuild",
|
| 29 |
+
"release": "pnpm build && pnpm test && changelogen --release --push --publish",
|
| 30 |
+
"test": "pnpm lint && vitest run --coverage && pnpm test:types",
|
| 31 |
+
"test:types": "tsc --noEmit"
|
| 32 |
+
},
|
| 33 |
+
"dependencies": {
|
| 34 |
+
"chokidar": "^4.0.3",
|
| 35 |
+
"confbox": "^0.2.2",
|
| 36 |
+
"defu": "^6.1.4",
|
| 37 |
+
"dotenv": "^16.6.1",
|
| 38 |
+
"exsolve": "^1.0.7",
|
| 39 |
+
"giget": "^2.0.0",
|
| 40 |
+
"jiti": "^2.4.2",
|
| 41 |
+
"ohash": "^2.0.11",
|
| 42 |
+
"pathe": "^2.0.3",
|
| 43 |
+
"perfect-debounce": "^1.0.0",
|
| 44 |
+
"pkg-types": "^2.2.0",
|
| 45 |
+
"rc9": "^2.1.2"
|
| 46 |
+
},
|
| 47 |
+
"devDependencies": {
|
| 48 |
+
"@types/node": "^24.0.13",
|
| 49 |
+
"@vitest/coverage-v8": "^3.2.4",
|
| 50 |
+
"automd": "^0.4.0",
|
| 51 |
+
"changelogen": "^0.6.2",
|
| 52 |
+
"eslint": "^9.31.0",
|
| 53 |
+
"eslint-config-unjs": "^0.5.0",
|
| 54 |
+
"expect-type": "^1.2.2",
|
| 55 |
+
"magicast": "^0.3.5",
|
| 56 |
+
"prettier": "^3.6.2",
|
| 57 |
+
"typescript": "^5.8.3",
|
| 58 |
+
"unbuild": "^3.5.0",
|
| 59 |
+
"vitest": "^3.2.4"
|
| 60 |
+
},
|
| 61 |
+
"peerDependencies": {
|
| 62 |
+
"magicast": "^0.3.5"
|
| 63 |
+
},
|
| 64 |
+
"peerDependenciesMeta": {
|
| 65 |
+
"magicast": {
|
| 66 |
+
"optional": true
|
| 67 |
+
}
|
| 68 |
+
},
|
| 69 |
+
"packageManager": "pnpm@10.13.1"
|
| 70 |
+
}
|
backend/node_modules/chokidar/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2012 Paul Miller (https://paulmillr.com), Elan Shanker
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the βSoftwareβ), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED βAS ISβ, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
backend/node_modules/chokidar/README.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Chokidar [](https://github.com/paulmillr/chokidar)
|
| 2 |
+
|
| 3 |
+
> Minimal and efficient cross-platform file watching library
|
| 4 |
+
|
| 5 |
+
## Why?
|
| 6 |
+
|
| 7 |
+
There are many reasons to prefer Chokidar to raw fs.watch / fs.watchFile in 2024:
|
| 8 |
+
|
| 9 |
+
- Events are properly reported
|
| 10 |
+
- macOS events report filenames
|
| 11 |
+
- events are not reported twice
|
| 12 |
+
- changes are reported as add / change / unlink instead of useless `rename`
|
| 13 |
+
- Atomic writes are supported, using `atomic` option
|
| 14 |
+
- Some file editors use them
|
| 15 |
+
- Chunked writes are supported, using `awaitWriteFinish` option
|
| 16 |
+
- Large files are commonly written in chunks
|
| 17 |
+
- File / dir filtering is supported
|
| 18 |
+
- Symbolic links are supported
|
| 19 |
+
- Recursive watching is always supported, instead of partial when using raw events
|
| 20 |
+
- Includes a way to limit recursion depth
|
| 21 |
+
|
| 22 |
+
Chokidar relies on the Node.js core `fs` module, but when using
|
| 23 |
+
`fs.watch` and `fs.watchFile` for watching, it normalizes the events it
|
| 24 |
+
receives, often checking for truth by getting file stats and/or dir contents.
|
| 25 |
+
The `fs.watch`-based implementation is the default, which
|
| 26 |
+
avoids polling and keeps CPU usage down. Be advised that chokidar will initiate
|
| 27 |
+
watchers recursively for everything within scope of the paths that have been
|
| 28 |
+
specified, so be judicious about not wasting system resources by watching much
|
| 29 |
+
more than needed. For some cases, `fs.watchFile`, which utilizes polling and uses more resources, is used.
|
| 30 |
+
|
| 31 |
+
Made for [Brunch](https://brunch.io/) in 2012,
|
| 32 |
+
it is now used in [~30 million repositories](https://www.npmjs.com/browse/depended/chokidar) and
|
| 33 |
+
has proven itself in production environments.
|
| 34 |
+
|
| 35 |
+
**Sep 2024 update:** v4 is out! It decreases dependency count from 13 to 1, removes
|
| 36 |
+
support for globs, adds support for ESM / Common.js modules, and bumps minimum node.js version from v8 to v14.
|
| 37 |
+
Check out [upgrading](#upgrading).
|
| 38 |
+
|
| 39 |
+
## Getting started
|
| 40 |
+
|
| 41 |
+
Install with npm:
|
| 42 |
+
|
| 43 |
+
```sh
|
| 44 |
+
npm install chokidar
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Use it in your code:
|
| 48 |
+
|
| 49 |
+
```javascript
|
| 50 |
+
import chokidar from 'chokidar';
|
| 51 |
+
|
| 52 |
+
// One-liner for current directory
|
| 53 |
+
chokidar.watch('.').on('all', (event, path) => {
|
| 54 |
+
console.log(event, path);
|
| 55 |
+
});
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
// Extended options
|
| 59 |
+
// ----------------
|
| 60 |
+
|
| 61 |
+
// Initialize watcher.
|
| 62 |
+
const watcher = chokidar.watch('file, dir, or array', {
|
| 63 |
+
ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'), // only watch js files
|
| 64 |
+
persistent: true
|
| 65 |
+
});
|
| 66 |
+
|
| 67 |
+
// Something to use when events are received.
|
| 68 |
+
const log = console.log.bind(console);
|
| 69 |
+
// Add event listeners.
|
| 70 |
+
watcher
|
| 71 |
+
.on('add', path => log(`File ${path} has been added`))
|
| 72 |
+
.on('change', path => log(`File ${path} has been changed`))
|
| 73 |
+
.on('unlink', path => log(`File ${path} has been removed`));
|
| 74 |
+
|
| 75 |
+
// More possible events.
|
| 76 |
+
watcher
|
| 77 |
+
.on('addDir', path => log(`Directory ${path} has been added`))
|
| 78 |
+
.on('unlinkDir', path => log(`Directory ${path} has been removed`))
|
| 79 |
+
.on('error', error => log(`Watcher error: ${error}`))
|
| 80 |
+
.on('ready', () => log('Initial scan complete. Ready for changes'))
|
| 81 |
+
.on('raw', (event, path, details) => { // internal
|
| 82 |
+
log('Raw event info:', event, path, details);
|
| 83 |
+
});
|
| 84 |
+
|
| 85 |
+
// 'add', 'addDir' and 'change' events also receive stat() results as second
|
| 86 |
+
// argument when available: https://nodejs.org/api/fs.html#fs_class_fs_stats
|
| 87 |
+
watcher.on('change', (path, stats) => {
|
| 88 |
+
if (stats) console.log(`File ${path} changed size to ${stats.size}`);
|
| 89 |
+
});
|
| 90 |
+
|
| 91 |
+
// Watch new files.
|
| 92 |
+
watcher.add('new-file');
|
| 93 |
+
watcher.add(['new-file-2', 'new-file-3']);
|
| 94 |
+
|
| 95 |
+
// Get list of actual paths being watched on the filesystem
|
| 96 |
+
let watchedPaths = watcher.getWatched();
|
| 97 |
+
|
| 98 |
+
// Un-watch some files.
|
| 99 |
+
await watcher.unwatch('new-file');
|
| 100 |
+
|
| 101 |
+
// Stop watching. The method is async!
|
| 102 |
+
await watcher.close().then(() => console.log('closed'));
|
| 103 |
+
|
| 104 |
+
// Full list of options. See below for descriptions.
|
| 105 |
+
// Do not use this example!
|
| 106 |
+
chokidar.watch('file', {
|
| 107 |
+
persistent: true,
|
| 108 |
+
|
| 109 |
+
// ignore .txt files
|
| 110 |
+
ignored: (file) => file.endsWith('.txt'),
|
| 111 |
+
// watch only .txt files
|
| 112 |
+
// ignored: (file, _stats) => _stats?.isFile() && !file.endsWith('.txt'),
|
| 113 |
+
|
| 114 |
+
awaitWriteFinish: true, // emit single event when chunked writes are completed
|
| 115 |
+
atomic: true, // emit proper events when "atomic writes" (mv _tmp file) are used
|
| 116 |
+
|
| 117 |
+
// The options also allow specifying custom intervals in ms
|
| 118 |
+
// awaitWriteFinish: {
|
| 119 |
+
// stabilityThreshold: 2000,
|
| 120 |
+
// pollInterval: 100
|
| 121 |
+
// },
|
| 122 |
+
// atomic: 100,
|
| 123 |
+
|
| 124 |
+
interval: 100,
|
| 125 |
+
binaryInterval: 300,
|
| 126 |
+
|
| 127 |
+
cwd: '.',
|
| 128 |
+
depth: 99,
|
| 129 |
+
|
| 130 |
+
followSymlinks: true,
|
| 131 |
+
ignoreInitial: false,
|
| 132 |
+
ignorePermissionErrors: false,
|
| 133 |
+
usePolling: false,
|
| 134 |
+
alwaysStat: false,
|
| 135 |
+
});
|
| 136 |
+
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
`chokidar.watch(paths, [options])`
|
| 140 |
+
|
| 141 |
+
* `paths` (string or array of strings). Paths to files, dirs to be watched
|
| 142 |
+
recursively.
|
| 143 |
+
* `options` (object) Options object as defined below:
|
| 144 |
+
|
| 145 |
+
#### Persistence
|
| 146 |
+
|
| 147 |
+
* `persistent` (default: `true`). Indicates whether the process
|
| 148 |
+
should continue to run as long as files are being watched.
|
| 149 |
+
|
| 150 |
+
#### Path filtering
|
| 151 |
+
|
| 152 |
+
* `ignored` function, regex, or path. Defines files/paths to be ignored.
|
| 153 |
+
The whole relative or absolute path is tested, not just filename. If a function with two arguments
|
| 154 |
+
is provided, it gets called twice per path - once with a single argument (the path), second
|
| 155 |
+
time with two arguments (the path and the
|
| 156 |
+
[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
|
| 157 |
+
object of that path).
|
| 158 |
+
* `ignoreInitial` (default: `false`). If set to `false` then `add`/`addDir` events are also emitted for matching paths while
|
| 159 |
+
instantiating the watching as chokidar discovers these file paths (before the `ready` event).
|
| 160 |
+
* `followSymlinks` (default: `true`). When `false`, only the
|
| 161 |
+
symlinks themselves will be watched for changes instead of following
|
| 162 |
+
the link references and bubbling events through the link's path.
|
| 163 |
+
* `cwd` (no default). The base directory from which watch `paths` are to be
|
| 164 |
+
derived. Paths emitted with events will be relative to this.
|
| 165 |
+
|
| 166 |
+
#### Performance
|
| 167 |
+
|
| 168 |
+
* `usePolling` (default: `false`).
|
| 169 |
+
Whether to use fs.watchFile (backed by polling), or fs.watch. If polling
|
| 170 |
+
leads to high CPU utilization, consider setting this to `false`. It is
|
| 171 |
+
typically necessary to **set this to `true` to successfully watch files over
|
| 172 |
+
a network**, and it may be necessary to successfully watch files in other
|
| 173 |
+
non-standard situations. Setting to `true` explicitly on MacOS overrides the
|
| 174 |
+
`useFsEvents` default. You may also set the CHOKIDAR_USEPOLLING env variable
|
| 175 |
+
to true (1) or false (0) in order to override this option.
|
| 176 |
+
* _Polling-specific settings_ (effective when `usePolling: true`)
|
| 177 |
+
* `interval` (default: `100`). Interval of file system polling, in milliseconds. You may also
|
| 178 |
+
set the CHOKIDAR_INTERVAL env variable to override this option.
|
| 179 |
+
* `binaryInterval` (default: `300`). Interval of file system
|
| 180 |
+
polling for binary files.
|
| 181 |
+
([see list of binary extensions](https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
|
| 182 |
+
* `alwaysStat` (default: `false`). If relying upon the
|
| 183 |
+
[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)
|
| 184 |
+
object that may get passed with `add`, `addDir`, and `change` events, set
|
| 185 |
+
this to `true` to ensure it is provided even in cases where it wasn't
|
| 186 |
+
already available from the underlying watch events.
|
| 187 |
+
* `depth` (default: `undefined`). If set, limits how many levels of
|
| 188 |
+
subdirectories will be traversed.
|
| 189 |
+
* `awaitWriteFinish` (default: `false`).
|
| 190 |
+
By default, the `add` event will fire when a file first appears on disk, before
|
| 191 |
+
the entire file has been written. Furthermore, in some cases some `change`
|
| 192 |
+
events will be emitted while the file is being written. In some cases,
|
| 193 |
+
especially when watching for large files there will be a need to wait for the
|
| 194 |
+
write operation to finish before responding to a file creation or modification.
|
| 195 |
+
Setting `awaitWriteFinish` to `true` (or a truthy value) will poll file size,
|
| 196 |
+
holding its `add` and `change` events until the size does not change for a
|
| 197 |
+
configurable amount of time. The appropriate duration setting is heavily
|
| 198 |
+
dependent on the OS and hardware. For accurate detection this parameter should
|
| 199 |
+
be relatively high, making file watching much less responsive.
|
| 200 |
+
Use with caution.
|
| 201 |
+
* *`options.awaitWriteFinish` can be set to an object in order to adjust
|
| 202 |
+
timing params:*
|
| 203 |
+
* `awaitWriteFinish.stabilityThreshold` (default: 2000). Amount of time in
|
| 204 |
+
milliseconds for a file size to remain constant before emitting its event.
|
| 205 |
+
* `awaitWriteFinish.pollInterval` (default: 100). File size polling interval, in milliseconds.
|
| 206 |
+
|
| 207 |
+
#### Errors
|
| 208 |
+
|
| 209 |
+
* `ignorePermissionErrors` (default: `false`). Indicates whether to watch files
|
| 210 |
+
that don't have read permissions if possible. If watching fails due to `EPERM`
|
| 211 |
+
or `EACCES` with this set to `true`, the errors will be suppressed silently.
|
| 212 |
+
* `atomic` (default: `true` if `useFsEvents` and `usePolling` are `false`).
|
| 213 |
+
Automatically filters out artifacts that occur when using editors that use
|
| 214 |
+
"atomic writes" instead of writing directly to the source file. If a file is
|
| 215 |
+
re-added within 100 ms of being deleted, Chokidar emits a `change` event
|
| 216 |
+
rather than `unlink` then `add`. If the default of 100 ms does not work well
|
| 217 |
+
for you, you can override it by setting `atomic` to a custom value, in
|
| 218 |
+
milliseconds.
|
| 219 |
+
|
| 220 |
+
### Methods & Events
|
| 221 |
+
|
| 222 |
+
`chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`:
|
| 223 |
+
|
| 224 |
+
* `.add(path / paths)`: Add files, directories for tracking.
|
| 225 |
+
Takes an array of strings or just one string.
|
| 226 |
+
* `.on(event, callback)`: Listen for an FS event.
|
| 227 |
+
Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`,
|
| 228 |
+
`raw`, `error`.
|
| 229 |
+
Additionally `all` is available which gets emitted with the underlying event
|
| 230 |
+
name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully.
|
| 231 |
+
* `.unwatch(path / paths)`: Stop watching files or directories.
|
| 232 |
+
Takes an array of strings or just one string.
|
| 233 |
+
* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. Use with `await` to ensure bugs don't happen.
|
| 234 |
+
* `.getWatched()`: Returns an object representing all the paths on the file
|
| 235 |
+
system being watched by this `FSWatcher` instance. The object's keys are all the
|
| 236 |
+
directories (using absolute paths unless the `cwd` option was used), and the
|
| 237 |
+
values are arrays of the names of the items contained in each directory.
|
| 238 |
+
|
| 239 |
+
### CLI
|
| 240 |
+
|
| 241 |
+
Check out third party [chokidar-cli](https://github.com/open-cli-tools/chokidar-cli),
|
| 242 |
+
which allows to execute a command on each change, or get a stdio stream of change events.
|
| 243 |
+
|
| 244 |
+
## Troubleshooting
|
| 245 |
+
|
| 246 |
+
Sometimes, Chokidar runs out of file handles, causing `EMFILE` and `ENOSP` errors:
|
| 247 |
+
|
| 248 |
+
* `bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell`
|
| 249 |
+
* `Error: watch /home/ ENOSPC`
|
| 250 |
+
|
| 251 |
+
There are two things that can cause it.
|
| 252 |
+
|
| 253 |
+
1. Exhausted file handles for generic fs operations
|
| 254 |
+
- Can be solved by using [graceful-fs](https://www.npmjs.com/package/graceful-fs),
|
| 255 |
+
which can monkey-patch native `fs` module used by chokidar: `let fs = require('fs'); let grfs = require('graceful-fs'); grfs.gracefulify(fs);`
|
| 256 |
+
- Can also be solved by tuning OS: `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`.
|
| 257 |
+
2. Exhausted file handles for `fs.watch`
|
| 258 |
+
- Can't seem to be solved by graceful-fs or OS tuning
|
| 259 |
+
- It's possible to start using `usePolling: true`, which will switch backend to resource-intensive `fs.watchFile`
|
| 260 |
+
|
| 261 |
+
All fsevents-related issues (`WARN optional dep failed`, `fsevents is not a constructor`) are solved by upgrading to v4+.
|
| 262 |
+
|
| 263 |
+
## Changelog
|
| 264 |
+
|
| 265 |
+
- **v4 (Sep 2024):** remove glob support and bundled fsevents. Decrease dependency count from 13 to 1. Rewrite in typescript. Bumps minimum node.js requirement to v14+
|
| 266 |
+
- **v3 (Apr 2019):** massive CPU & RAM consumption improvements; reduces deps / package size by a factor of 17x and bumps Node.js requirement to v8.16+.
|
| 267 |
+
- **v2 (Dec 2017):** globs are now posix-style-only. Tons of bugfixes.
|
| 268 |
+
- **v1 (Apr 2015):** glob support, symlink support, tons of bugfixes. Node 0.8+ is supported
|
| 269 |
+
- **v0.1 (Apr 2012):** Initial release, extracted from [Brunch](https://github.com/brunch/brunch/blob/9847a065aea300da99bd0753f90354cde9de1261/src/helpers.coffee#L66)
|
| 270 |
+
|
| 271 |
+
### Upgrading
|
| 272 |
+
|
| 273 |
+
If you've used globs before and want do replicate the functionality with v4:
|
| 274 |
+
|
| 275 |
+
```js
|
| 276 |
+
// v3
|
| 277 |
+
chok.watch('**/*.js');
|
| 278 |
+
chok.watch("./directory/**/*");
|
| 279 |
+
|
| 280 |
+
// v4
|
| 281 |
+
chok.watch('.', {
|
| 282 |
+
ignored: (path, stats) => stats?.isFile() && !path.endsWith('.js'), // only watch js files
|
| 283 |
+
});
|
| 284 |
+
chok.watch('./directory');
|
| 285 |
+
|
| 286 |
+
// other way
|
| 287 |
+
import { glob } from 'node:fs/promises';
|
| 288 |
+
const watcher = watch(await Array.fromAsync(glob('**/*.js')));
|
| 289 |
+
|
| 290 |
+
// unwatching
|
| 291 |
+
// v3
|
| 292 |
+
chok.unwatch('**/*.js');
|
| 293 |
+
// v4
|
| 294 |
+
chok.unwatch(await glob('**/*.js'));
|
| 295 |
+
```
|
| 296 |
+
|
| 297 |
+
## Also
|
| 298 |
+
|
| 299 |
+
Why was chokidar named this way? What's the meaning behind it?
|
| 300 |
+
|
| 301 |
+
>Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', ΰ€ΰ₯ΰ€ΰ₯ΰ€¦ΰ€Ύΰ€°. This ultimately comes from Sanskrit _ ΰ€ΰ€€ΰ₯ΰ€·ΰ₯ΰ€_ (crossway, quadrangle, consisting-of-four). This word is also used in other languages like Urdu as (ΪΩΪ©ΫΨ―Ψ§Ψ±) which is widely used in Pakistan and India.
|
| 302 |
+
|
| 303 |
+
## License
|
| 304 |
+
|
| 305 |
+
MIT (c) Paul Miller (<https://paulmillr.com>), see [LICENSE](LICENSE) file.
|
backend/node_modules/chokidar/handler.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import type { WatchEventType, Stats, FSWatcher as NativeFsWatcher } from 'fs';
|
| 2 |
+
import type { FSWatcher, WatchHelper, Throttler } from './index.js';
|
| 3 |
+
import type { EntryInfo } from 'readdirp';
|
| 4 |
+
export type Path = string;
|
| 5 |
+
export declare const STR_DATA = "data";
|
| 6 |
+
export declare const STR_END = "end";
|
| 7 |
+
export declare const STR_CLOSE = "close";
|
| 8 |
+
export declare const EMPTY_FN: () => void;
|
| 9 |
+
export declare const IDENTITY_FN: (val: unknown) => unknown;
|
| 10 |
+
export declare const isWindows: boolean;
|
| 11 |
+
export declare const isMacos: boolean;
|
| 12 |
+
export declare const isLinux: boolean;
|
| 13 |
+
export declare const isFreeBSD: boolean;
|
| 14 |
+
export declare const isIBMi: boolean;
|
| 15 |
+
export declare const EVENTS: {
|
| 16 |
+
readonly ALL: "all";
|
| 17 |
+
readonly READY: "ready";
|
| 18 |
+
readonly ADD: "add";
|
| 19 |
+
readonly CHANGE: "change";
|
| 20 |
+
readonly ADD_DIR: "addDir";
|
| 21 |
+
readonly UNLINK: "unlink";
|
| 22 |
+
readonly UNLINK_DIR: "unlinkDir";
|
| 23 |
+
readonly RAW: "raw";
|
| 24 |
+
readonly ERROR: "error";
|
| 25 |
+
};
|
| 26 |
+
export type EventName = (typeof EVENTS)[keyof typeof EVENTS];
|
| 27 |
+
export type FsWatchContainer = {
|
| 28 |
+
listeners: (path: string) => void | Set<any>;
|
| 29 |
+
errHandlers: (err: unknown) => void | Set<any>;
|
| 30 |
+
rawEmitters: (ev: WatchEventType, path: string, opts: unknown) => void | Set<any>;
|
| 31 |
+
watcher: NativeFsWatcher;
|
| 32 |
+
watcherUnusable?: boolean;
|
| 33 |
+
};
|
| 34 |
+
export interface WatchHandlers {
|
| 35 |
+
listener: (path: string) => void;
|
| 36 |
+
errHandler: (err: unknown) => void;
|
| 37 |
+
rawEmitter: (ev: WatchEventType, path: string, opts: unknown) => void;
|
| 38 |
+
}
|
| 39 |
+
/**
|
| 40 |
+
* @mixin
|
| 41 |
+
*/
|
| 42 |
+
export declare class NodeFsHandler {
|
| 43 |
+
fsw: FSWatcher;
|
| 44 |
+
_boundHandleError: (error: unknown) => void;
|
| 45 |
+
constructor(fsW: FSWatcher);
|
| 46 |
+
/**
|
| 47 |
+
* Watch file for changes with fs_watchFile or fs_watch.
|
| 48 |
+
* @param path to file or dir
|
| 49 |
+
* @param listener on fs change
|
| 50 |
+
* @returns closer for the watcher instance
|
| 51 |
+
*/
|
| 52 |
+
_watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
|
| 53 |
+
/**
|
| 54 |
+
* Watch a file and emit add event if warranted.
|
| 55 |
+
* @returns closer for the watcher instance
|
| 56 |
+
*/
|
| 57 |
+
_handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
|
| 58 |
+
/**
|
| 59 |
+
* Handle symlinks encountered while reading a dir.
|
| 60 |
+
* @param entry returned by readdirp
|
| 61 |
+
* @param directory path of dir being read
|
| 62 |
+
* @param path of this item
|
| 63 |
+
* @param item basename of this item
|
| 64 |
+
* @returns true if no more processing is needed for this entry.
|
| 65 |
+
*/
|
| 66 |
+
_handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
|
| 67 |
+
_handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
|
| 68 |
+
/**
|
| 69 |
+
* Read directory to add / remove files from `@watched` list and re-read it on change.
|
| 70 |
+
* @param dir fs path
|
| 71 |
+
* @param stats
|
| 72 |
+
* @param initialAdd
|
| 73 |
+
* @param depth relative to user-supplied path
|
| 74 |
+
* @param target child path targeted for watch
|
| 75 |
+
* @param wh Common watch helpers for this path
|
| 76 |
+
* @param realpath
|
| 77 |
+
* @returns closer for the watcher instance.
|
| 78 |
+
*/
|
| 79 |
+
_handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
|
| 80 |
+
/**
|
| 81 |
+
* Handle added file, directory, or glob pattern.
|
| 82 |
+
* Delegates call to _handleFile / _handleDir after checks.
|
| 83 |
+
* @param path to file or ir
|
| 84 |
+
* @param initialAdd was the file added at watch instantiation?
|
| 85 |
+
* @param priorWh depth relative to user-supplied path
|
| 86 |
+
* @param depth Child path actually targeted for watch
|
| 87 |
+
* @param target Child path actually targeted for watch
|
| 88 |
+
*/
|
| 89 |
+
_addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
|
| 90 |
+
}
|
backend/node_modules/chokidar/handler.js
ADDED
|
@@ -0,0 +1,635 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.NodeFsHandler = exports.EVENTS = exports.isIBMi = exports.isFreeBSD = exports.isLinux = exports.isMacos = exports.isWindows = exports.IDENTITY_FN = exports.EMPTY_FN = exports.STR_CLOSE = exports.STR_END = exports.STR_DATA = void 0;
|
| 4 |
+
const fs_1 = require("fs");
|
| 5 |
+
const promises_1 = require("fs/promises");
|
| 6 |
+
const sysPath = require("path");
|
| 7 |
+
const os_1 = require("os");
|
| 8 |
+
exports.STR_DATA = 'data';
|
| 9 |
+
exports.STR_END = 'end';
|
| 10 |
+
exports.STR_CLOSE = 'close';
|
| 11 |
+
const EMPTY_FN = () => { };
|
| 12 |
+
exports.EMPTY_FN = EMPTY_FN;
|
| 13 |
+
const IDENTITY_FN = (val) => val;
|
| 14 |
+
exports.IDENTITY_FN = IDENTITY_FN;
|
| 15 |
+
const pl = process.platform;
|
| 16 |
+
exports.isWindows = pl === 'win32';
|
| 17 |
+
exports.isMacos = pl === 'darwin';
|
| 18 |
+
exports.isLinux = pl === 'linux';
|
| 19 |
+
exports.isFreeBSD = pl === 'freebsd';
|
| 20 |
+
exports.isIBMi = (0, os_1.type)() === 'OS400';
|
| 21 |
+
exports.EVENTS = {
|
| 22 |
+
ALL: 'all',
|
| 23 |
+
READY: 'ready',
|
| 24 |
+
ADD: 'add',
|
| 25 |
+
CHANGE: 'change',
|
| 26 |
+
ADD_DIR: 'addDir',
|
| 27 |
+
UNLINK: 'unlink',
|
| 28 |
+
UNLINK_DIR: 'unlinkDir',
|
| 29 |
+
RAW: 'raw',
|
| 30 |
+
ERROR: 'error',
|
| 31 |
+
};
|
| 32 |
+
const EV = exports.EVENTS;
|
| 33 |
+
const THROTTLE_MODE_WATCH = 'watch';
|
| 34 |
+
const statMethods = { lstat: promises_1.lstat, stat: promises_1.stat };
|
| 35 |
+
const KEY_LISTENERS = 'listeners';
|
| 36 |
+
const KEY_ERR = 'errHandlers';
|
| 37 |
+
const KEY_RAW = 'rawEmitters';
|
| 38 |
+
const HANDLER_KEYS = [KEY_LISTENERS, KEY_ERR, KEY_RAW];
|
| 39 |
+
// prettier-ignore
|
| 40 |
+
const binaryExtensions = new Set([
|
| 41 |
+
'3dm', '3ds', '3g2', '3gp', '7z', 'a', 'aac', 'adp', 'afdesign', 'afphoto', 'afpub', 'ai',
|
| 42 |
+
'aif', 'aiff', 'alz', 'ape', 'apk', 'appimage', 'ar', 'arj', 'asf', 'au', 'avi',
|
| 43 |
+
'bak', 'baml', 'bh', 'bin', 'bk', 'bmp', 'btif', 'bz2', 'bzip2',
|
| 44 |
+
'cab', 'caf', 'cgm', 'class', 'cmx', 'cpio', 'cr2', 'cur', 'dat', 'dcm', 'deb', 'dex', 'djvu',
|
| 45 |
+
'dll', 'dmg', 'dng', 'doc', 'docm', 'docx', 'dot', 'dotm', 'dra', 'DS_Store', 'dsk', 'dts',
|
| 46 |
+
'dtshd', 'dvb', 'dwg', 'dxf',
|
| 47 |
+
'ecelp4800', 'ecelp7470', 'ecelp9600', 'egg', 'eol', 'eot', 'epub', 'exe',
|
| 48 |
+
'f4v', 'fbs', 'fh', 'fla', 'flac', 'flatpak', 'fli', 'flv', 'fpx', 'fst', 'fvt',
|
| 49 |
+
'g3', 'gh', 'gif', 'graffle', 'gz', 'gzip',
|
| 50 |
+
'h261', 'h263', 'h264', 'icns', 'ico', 'ief', 'img', 'ipa', 'iso',
|
| 51 |
+
'jar', 'jpeg', 'jpg', 'jpgv', 'jpm', 'jxr', 'key', 'ktx',
|
| 52 |
+
'lha', 'lib', 'lvp', 'lz', 'lzh', 'lzma', 'lzo',
|
| 53 |
+
'm3u', 'm4a', 'm4v', 'mar', 'mdi', 'mht', 'mid', 'midi', 'mj2', 'mka', 'mkv', 'mmr', 'mng',
|
| 54 |
+
'mobi', 'mov', 'movie', 'mp3',
|
| 55 |
+
'mp4', 'mp4a', 'mpeg', 'mpg', 'mpga', 'mxu',
|
| 56 |
+
'nef', 'npx', 'numbers', 'nupkg',
|
| 57 |
+
'o', 'odp', 'ods', 'odt', 'oga', 'ogg', 'ogv', 'otf', 'ott',
|
| 58 |
+
'pages', 'pbm', 'pcx', 'pdb', 'pdf', 'pea', 'pgm', 'pic', 'png', 'pnm', 'pot', 'potm',
|
| 59 |
+
'potx', 'ppa', 'ppam',
|
| 60 |
+
'ppm', 'pps', 'ppsm', 'ppsx', 'ppt', 'pptm', 'pptx', 'psd', 'pya', 'pyc', 'pyo', 'pyv',
|
| 61 |
+
'qt',
|
| 62 |
+
'rar', 'ras', 'raw', 'resources', 'rgb', 'rip', 'rlc', 'rmf', 'rmvb', 'rpm', 'rtf', 'rz',
|
| 63 |
+
's3m', 's7z', 'scpt', 'sgi', 'shar', 'snap', 'sil', 'sketch', 'slk', 'smv', 'snk', 'so',
|
| 64 |
+
'stl', 'suo', 'sub', 'swf',
|
| 65 |
+
'tar', 'tbz', 'tbz2', 'tga', 'tgz', 'thmx', 'tif', 'tiff', 'tlz', 'ttc', 'ttf', 'txz',
|
| 66 |
+
'udf', 'uvh', 'uvi', 'uvm', 'uvp', 'uvs', 'uvu',
|
| 67 |
+
'viv', 'vob',
|
| 68 |
+
'war', 'wav', 'wax', 'wbmp', 'wdp', 'weba', 'webm', 'webp', 'whl', 'wim', 'wm', 'wma',
|
| 69 |
+
'wmv', 'wmx', 'woff', 'woff2', 'wrm', 'wvx',
|
| 70 |
+
'xbm', 'xif', 'xla', 'xlam', 'xls', 'xlsb', 'xlsm', 'xlsx', 'xlt', 'xltm', 'xltx', 'xm',
|
| 71 |
+
'xmind', 'xpi', 'xpm', 'xwd', 'xz',
|
| 72 |
+
'z', 'zip', 'zipx',
|
| 73 |
+
]);
|
| 74 |
+
const isBinaryPath = (filePath) => binaryExtensions.has(sysPath.extname(filePath).slice(1).toLowerCase());
|
| 75 |
+
// TODO: emit errors properly. Example: EMFILE on Macos.
|
| 76 |
+
const foreach = (val, fn) => {
|
| 77 |
+
if (val instanceof Set) {
|
| 78 |
+
val.forEach(fn);
|
| 79 |
+
}
|
| 80 |
+
else {
|
| 81 |
+
fn(val);
|
| 82 |
+
}
|
| 83 |
+
};
|
| 84 |
+
const addAndConvert = (main, prop, item) => {
|
| 85 |
+
let container = main[prop];
|
| 86 |
+
if (!(container instanceof Set)) {
|
| 87 |
+
main[prop] = container = new Set([container]);
|
| 88 |
+
}
|
| 89 |
+
container.add(item);
|
| 90 |
+
};
|
| 91 |
+
const clearItem = (cont) => (key) => {
|
| 92 |
+
const set = cont[key];
|
| 93 |
+
if (set instanceof Set) {
|
| 94 |
+
set.clear();
|
| 95 |
+
}
|
| 96 |
+
else {
|
| 97 |
+
delete cont[key];
|
| 98 |
+
}
|
| 99 |
+
};
|
| 100 |
+
const delFromSet = (main, prop, item) => {
|
| 101 |
+
const container = main[prop];
|
| 102 |
+
if (container instanceof Set) {
|
| 103 |
+
container.delete(item);
|
| 104 |
+
}
|
| 105 |
+
else if (container === item) {
|
| 106 |
+
delete main[prop];
|
| 107 |
+
}
|
| 108 |
+
};
|
| 109 |
+
const isEmptySet = (val) => (val instanceof Set ? val.size === 0 : !val);
|
| 110 |
+
const FsWatchInstances = new Map();
|
| 111 |
+
/**
|
| 112 |
+
* Instantiates the fs_watch interface
|
| 113 |
+
* @param path to be watched
|
| 114 |
+
* @param options to be passed to fs_watch
|
| 115 |
+
* @param listener main event handler
|
| 116 |
+
* @param errHandler emits info about errors
|
| 117 |
+
* @param emitRaw emits raw event data
|
| 118 |
+
* @returns {NativeFsWatcher}
|
| 119 |
+
*/
|
| 120 |
+
function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
| 121 |
+
const handleEvent = (rawEvent, evPath) => {
|
| 122 |
+
listener(path);
|
| 123 |
+
emitRaw(rawEvent, evPath, { watchedPath: path });
|
| 124 |
+
// emit based on events occurring for files from a directory's watcher in
|
| 125 |
+
// case the file's watcher misses it (and rely on throttling to de-dupe)
|
| 126 |
+
if (evPath && path !== evPath) {
|
| 127 |
+
fsWatchBroadcast(sysPath.resolve(path, evPath), KEY_LISTENERS, sysPath.join(path, evPath));
|
| 128 |
+
}
|
| 129 |
+
};
|
| 130 |
+
try {
|
| 131 |
+
return (0, fs_1.watch)(path, {
|
| 132 |
+
persistent: options.persistent,
|
| 133 |
+
}, handleEvent);
|
| 134 |
+
}
|
| 135 |
+
catch (error) {
|
| 136 |
+
errHandler(error);
|
| 137 |
+
return undefined;
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
/**
|
| 141 |
+
* Helper for passing fs_watch event data to a collection of listeners
|
| 142 |
+
* @param fullPath absolute path bound to fs_watch instance
|
| 143 |
+
*/
|
| 144 |
+
const fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
|
| 145 |
+
const cont = FsWatchInstances.get(fullPath);
|
| 146 |
+
if (!cont)
|
| 147 |
+
return;
|
| 148 |
+
foreach(cont[listenerType], (listener) => {
|
| 149 |
+
listener(val1, val2, val3);
|
| 150 |
+
});
|
| 151 |
+
};
|
| 152 |
+
/**
|
| 153 |
+
* Instantiates the fs_watch interface or binds listeners
|
| 154 |
+
* to an existing one covering the same file system entry
|
| 155 |
+
* @param path
|
| 156 |
+
* @param fullPath absolute path
|
| 157 |
+
* @param options to be passed to fs_watch
|
| 158 |
+
* @param handlers container for event listener functions
|
| 159 |
+
*/
|
| 160 |
+
const setFsWatchListener = (path, fullPath, options, handlers) => {
|
| 161 |
+
const { listener, errHandler, rawEmitter } = handlers;
|
| 162 |
+
let cont = FsWatchInstances.get(fullPath);
|
| 163 |
+
let watcher;
|
| 164 |
+
if (!options.persistent) {
|
| 165 |
+
watcher = createFsWatchInstance(path, options, listener, errHandler, rawEmitter);
|
| 166 |
+
if (!watcher)
|
| 167 |
+
return;
|
| 168 |
+
return watcher.close.bind(watcher);
|
| 169 |
+
}
|
| 170 |
+
if (cont) {
|
| 171 |
+
addAndConvert(cont, KEY_LISTENERS, listener);
|
| 172 |
+
addAndConvert(cont, KEY_ERR, errHandler);
|
| 173 |
+
addAndConvert(cont, KEY_RAW, rawEmitter);
|
| 174 |
+
}
|
| 175 |
+
else {
|
| 176 |
+
watcher = createFsWatchInstance(path, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, // no need to use broadcast here
|
| 177 |
+
fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
|
| 178 |
+
if (!watcher)
|
| 179 |
+
return;
|
| 180 |
+
watcher.on(EV.ERROR, async (error) => {
|
| 181 |
+
const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
|
| 182 |
+
if (cont)
|
| 183 |
+
cont.watcherUnusable = true; // documented since Node 10.4.1
|
| 184 |
+
// Workaround for https://github.com/joyent/node/issues/4337
|
| 185 |
+
if (exports.isWindows && error.code === 'EPERM') {
|
| 186 |
+
try {
|
| 187 |
+
const fd = await (0, promises_1.open)(path, 'r');
|
| 188 |
+
await fd.close();
|
| 189 |
+
broadcastErr(error);
|
| 190 |
+
}
|
| 191 |
+
catch (err) {
|
| 192 |
+
// do nothing
|
| 193 |
+
}
|
| 194 |
+
}
|
| 195 |
+
else {
|
| 196 |
+
broadcastErr(error);
|
| 197 |
+
}
|
| 198 |
+
});
|
| 199 |
+
cont = {
|
| 200 |
+
listeners: listener,
|
| 201 |
+
errHandlers: errHandler,
|
| 202 |
+
rawEmitters: rawEmitter,
|
| 203 |
+
watcher,
|
| 204 |
+
};
|
| 205 |
+
FsWatchInstances.set(fullPath, cont);
|
| 206 |
+
}
|
| 207 |
+
// const index = cont.listeners.indexOf(listener);
|
| 208 |
+
// removes this instance's listeners and closes the underlying fs_watch
|
| 209 |
+
// instance if there are no more listeners left
|
| 210 |
+
return () => {
|
| 211 |
+
delFromSet(cont, KEY_LISTENERS, listener);
|
| 212 |
+
delFromSet(cont, KEY_ERR, errHandler);
|
| 213 |
+
delFromSet(cont, KEY_RAW, rawEmitter);
|
| 214 |
+
if (isEmptySet(cont.listeners)) {
|
| 215 |
+
// Check to protect against issue gh-730.
|
| 216 |
+
// if (cont.watcherUnusable) {
|
| 217 |
+
cont.watcher.close();
|
| 218 |
+
// }
|
| 219 |
+
FsWatchInstances.delete(fullPath);
|
| 220 |
+
HANDLER_KEYS.forEach(clearItem(cont));
|
| 221 |
+
// @ts-ignore
|
| 222 |
+
cont.watcher = undefined;
|
| 223 |
+
Object.freeze(cont);
|
| 224 |
+
}
|
| 225 |
+
};
|
| 226 |
+
};
|
| 227 |
+
// fs_watchFile helpers
|
| 228 |
+
// object to hold per-process fs_watchFile instances
|
| 229 |
+
// (may be shared across chokidar FSWatcher instances)
|
| 230 |
+
const FsWatchFileInstances = new Map();
|
| 231 |
+
/**
|
| 232 |
+
* Instantiates the fs_watchFile interface or binds listeners
|
| 233 |
+
* to an existing one covering the same file system entry
|
| 234 |
+
* @param path to be watched
|
| 235 |
+
* @param fullPath absolute path
|
| 236 |
+
* @param options options to be passed to fs_watchFile
|
| 237 |
+
* @param handlers container for event listener functions
|
| 238 |
+
* @returns closer
|
| 239 |
+
*/
|
| 240 |
+
const setFsWatchFileListener = (path, fullPath, options, handlers) => {
|
| 241 |
+
const { listener, rawEmitter } = handlers;
|
| 242 |
+
let cont = FsWatchFileInstances.get(fullPath);
|
| 243 |
+
// let listeners = new Set();
|
| 244 |
+
// let rawEmitters = new Set();
|
| 245 |
+
const copts = cont && cont.options;
|
| 246 |
+
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
| 247 |
+
// "Upgrade" the watcher to persistence or a quicker interval.
|
| 248 |
+
// This creates some unlikely edge case issues if the user mixes
|
| 249 |
+
// settings in a very weird way, but solving for those cases
|
| 250 |
+
// doesn't seem worthwhile for the added complexity.
|
| 251 |
+
// listeners = cont.listeners;
|
| 252 |
+
// rawEmitters = cont.rawEmitters;
|
| 253 |
+
(0, fs_1.unwatchFile)(fullPath);
|
| 254 |
+
cont = undefined;
|
| 255 |
+
}
|
| 256 |
+
if (cont) {
|
| 257 |
+
addAndConvert(cont, KEY_LISTENERS, listener);
|
| 258 |
+
addAndConvert(cont, KEY_RAW, rawEmitter);
|
| 259 |
+
}
|
| 260 |
+
else {
|
| 261 |
+
// TODO
|
| 262 |
+
// listeners.add(listener);
|
| 263 |
+
// rawEmitters.add(rawEmitter);
|
| 264 |
+
cont = {
|
| 265 |
+
listeners: listener,
|
| 266 |
+
rawEmitters: rawEmitter,
|
| 267 |
+
options,
|
| 268 |
+
watcher: (0, fs_1.watchFile)(fullPath, options, (curr, prev) => {
|
| 269 |
+
foreach(cont.rawEmitters, (rawEmitter) => {
|
| 270 |
+
rawEmitter(EV.CHANGE, fullPath, { curr, prev });
|
| 271 |
+
});
|
| 272 |
+
const currmtime = curr.mtimeMs;
|
| 273 |
+
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
| 274 |
+
foreach(cont.listeners, (listener) => listener(path, curr));
|
| 275 |
+
}
|
| 276 |
+
}),
|
| 277 |
+
};
|
| 278 |
+
FsWatchFileInstances.set(fullPath, cont);
|
| 279 |
+
}
|
| 280 |
+
// const index = cont.listeners.indexOf(listener);
|
| 281 |
+
// Removes this instance's listeners and closes the underlying fs_watchFile
|
| 282 |
+
// instance if there are no more listeners left.
|
| 283 |
+
return () => {
|
| 284 |
+
delFromSet(cont, KEY_LISTENERS, listener);
|
| 285 |
+
delFromSet(cont, KEY_RAW, rawEmitter);
|
| 286 |
+
if (isEmptySet(cont.listeners)) {
|
| 287 |
+
FsWatchFileInstances.delete(fullPath);
|
| 288 |
+
(0, fs_1.unwatchFile)(fullPath);
|
| 289 |
+
cont.options = cont.watcher = undefined;
|
| 290 |
+
Object.freeze(cont);
|
| 291 |
+
}
|
| 292 |
+
};
|
| 293 |
+
};
|
| 294 |
+
/**
|
| 295 |
+
* @mixin
|
| 296 |
+
*/
|
| 297 |
+
class NodeFsHandler {
|
| 298 |
+
constructor(fsW) {
|
| 299 |
+
this.fsw = fsW;
|
| 300 |
+
this._boundHandleError = (error) => fsW._handleError(error);
|
| 301 |
+
}
|
| 302 |
+
/**
|
| 303 |
+
* Watch file for changes with fs_watchFile or fs_watch.
|
| 304 |
+
* @param path to file or dir
|
| 305 |
+
* @param listener on fs change
|
| 306 |
+
* @returns closer for the watcher instance
|
| 307 |
+
*/
|
| 308 |
+
_watchWithNodeFs(path, listener) {
|
| 309 |
+
const opts = this.fsw.options;
|
| 310 |
+
const directory = sysPath.dirname(path);
|
| 311 |
+
const basename = sysPath.basename(path);
|
| 312 |
+
const parent = this.fsw._getWatchedDir(directory);
|
| 313 |
+
parent.add(basename);
|
| 314 |
+
const absolutePath = sysPath.resolve(path);
|
| 315 |
+
const options = {
|
| 316 |
+
persistent: opts.persistent,
|
| 317 |
+
};
|
| 318 |
+
if (!listener)
|
| 319 |
+
listener = exports.EMPTY_FN;
|
| 320 |
+
let closer;
|
| 321 |
+
if (opts.usePolling) {
|
| 322 |
+
const enableBin = opts.interval !== opts.binaryInterval;
|
| 323 |
+
options.interval = enableBin && isBinaryPath(basename) ? opts.binaryInterval : opts.interval;
|
| 324 |
+
closer = setFsWatchFileListener(path, absolutePath, options, {
|
| 325 |
+
listener,
|
| 326 |
+
rawEmitter: this.fsw._emitRaw,
|
| 327 |
+
});
|
| 328 |
+
}
|
| 329 |
+
else {
|
| 330 |
+
closer = setFsWatchListener(path, absolutePath, options, {
|
| 331 |
+
listener,
|
| 332 |
+
errHandler: this._boundHandleError,
|
| 333 |
+
rawEmitter: this.fsw._emitRaw,
|
| 334 |
+
});
|
| 335 |
+
}
|
| 336 |
+
return closer;
|
| 337 |
+
}
|
| 338 |
+
/**
|
| 339 |
+
* Watch a file and emit add event if warranted.
|
| 340 |
+
* @returns closer for the watcher instance
|
| 341 |
+
*/
|
| 342 |
+
_handleFile(file, stats, initialAdd) {
|
| 343 |
+
if (this.fsw.closed) {
|
| 344 |
+
return;
|
| 345 |
+
}
|
| 346 |
+
const dirname = sysPath.dirname(file);
|
| 347 |
+
const basename = sysPath.basename(file);
|
| 348 |
+
const parent = this.fsw._getWatchedDir(dirname);
|
| 349 |
+
// stats is always present
|
| 350 |
+
let prevStats = stats;
|
| 351 |
+
// if the file is already being watched, do nothing
|
| 352 |
+
if (parent.has(basename))
|
| 353 |
+
return;
|
| 354 |
+
const listener = async (path, newStats) => {
|
| 355 |
+
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5))
|
| 356 |
+
return;
|
| 357 |
+
if (!newStats || newStats.mtimeMs === 0) {
|
| 358 |
+
try {
|
| 359 |
+
const newStats = await (0, promises_1.stat)(file);
|
| 360 |
+
if (this.fsw.closed)
|
| 361 |
+
return;
|
| 362 |
+
// Check that change event was not fired because of changed only accessTime.
|
| 363 |
+
const at = newStats.atimeMs;
|
| 364 |
+
const mt = newStats.mtimeMs;
|
| 365 |
+
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
|
| 366 |
+
this.fsw._emit(EV.CHANGE, file, newStats);
|
| 367 |
+
}
|
| 368 |
+
if ((exports.isMacos || exports.isLinux || exports.isFreeBSD) && prevStats.ino !== newStats.ino) {
|
| 369 |
+
this.fsw._closeFile(path);
|
| 370 |
+
prevStats = newStats;
|
| 371 |
+
const closer = this._watchWithNodeFs(file, listener);
|
| 372 |
+
if (closer)
|
| 373 |
+
this.fsw._addPathCloser(path, closer);
|
| 374 |
+
}
|
| 375 |
+
else {
|
| 376 |
+
prevStats = newStats;
|
| 377 |
+
}
|
| 378 |
+
}
|
| 379 |
+
catch (error) {
|
| 380 |
+
// Fix issues where mtime is null but file is still present
|
| 381 |
+
this.fsw._remove(dirname, basename);
|
| 382 |
+
}
|
| 383 |
+
// add is about to be emitted if file not already tracked in parent
|
| 384 |
+
}
|
| 385 |
+
else if (parent.has(basename)) {
|
| 386 |
+
// Check that change event was not fired because of changed only accessTime.
|
| 387 |
+
const at = newStats.atimeMs;
|
| 388 |
+
const mt = newStats.mtimeMs;
|
| 389 |
+
if (!at || at <= mt || mt !== prevStats.mtimeMs) {
|
| 390 |
+
this.fsw._emit(EV.CHANGE, file, newStats);
|
| 391 |
+
}
|
| 392 |
+
prevStats = newStats;
|
| 393 |
+
}
|
| 394 |
+
};
|
| 395 |
+
// kick off the watcher
|
| 396 |
+
const closer = this._watchWithNodeFs(file, listener);
|
| 397 |
+
// emit an add event if we're supposed to
|
| 398 |
+
if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) {
|
| 399 |
+
if (!this.fsw._throttle(EV.ADD, file, 0))
|
| 400 |
+
return;
|
| 401 |
+
this.fsw._emit(EV.ADD, file, stats);
|
| 402 |
+
}
|
| 403 |
+
return closer;
|
| 404 |
+
}
|
| 405 |
+
/**
|
| 406 |
+
* Handle symlinks encountered while reading a dir.
|
| 407 |
+
* @param entry returned by readdirp
|
| 408 |
+
* @param directory path of dir being read
|
| 409 |
+
* @param path of this item
|
| 410 |
+
* @param item basename of this item
|
| 411 |
+
* @returns true if no more processing is needed for this entry.
|
| 412 |
+
*/
|
| 413 |
+
async _handleSymlink(entry, directory, path, item) {
|
| 414 |
+
if (this.fsw.closed) {
|
| 415 |
+
return;
|
| 416 |
+
}
|
| 417 |
+
const full = entry.fullPath;
|
| 418 |
+
const dir = this.fsw._getWatchedDir(directory);
|
| 419 |
+
if (!this.fsw.options.followSymlinks) {
|
| 420 |
+
// watch symlink directly (don't follow) and detect changes
|
| 421 |
+
this.fsw._incrReadyCount();
|
| 422 |
+
let linkPath;
|
| 423 |
+
try {
|
| 424 |
+
linkPath = await (0, promises_1.realpath)(path);
|
| 425 |
+
}
|
| 426 |
+
catch (e) {
|
| 427 |
+
this.fsw._emitReady();
|
| 428 |
+
return true;
|
| 429 |
+
}
|
| 430 |
+
if (this.fsw.closed)
|
| 431 |
+
return;
|
| 432 |
+
if (dir.has(item)) {
|
| 433 |
+
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
| 434 |
+
this.fsw._symlinkPaths.set(full, linkPath);
|
| 435 |
+
this.fsw._emit(EV.CHANGE, path, entry.stats);
|
| 436 |
+
}
|
| 437 |
+
}
|
| 438 |
+
else {
|
| 439 |
+
dir.add(item);
|
| 440 |
+
this.fsw._symlinkPaths.set(full, linkPath);
|
| 441 |
+
this.fsw._emit(EV.ADD, path, entry.stats);
|
| 442 |
+
}
|
| 443 |
+
this.fsw._emitReady();
|
| 444 |
+
return true;
|
| 445 |
+
}
|
| 446 |
+
// don't follow the same symlink more than once
|
| 447 |
+
if (this.fsw._symlinkPaths.has(full)) {
|
| 448 |
+
return true;
|
| 449 |
+
}
|
| 450 |
+
this.fsw._symlinkPaths.set(full, true);
|
| 451 |
+
}
|
| 452 |
+
_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
|
| 453 |
+
// Normalize the directory name on Windows
|
| 454 |
+
directory = sysPath.join(directory, '');
|
| 455 |
+
throttler = this.fsw._throttle('readdir', directory, 1000);
|
| 456 |
+
if (!throttler)
|
| 457 |
+
return;
|
| 458 |
+
const previous = this.fsw._getWatchedDir(wh.path);
|
| 459 |
+
const current = new Set();
|
| 460 |
+
let stream = this.fsw._readdirp(directory, {
|
| 461 |
+
fileFilter: (entry) => wh.filterPath(entry),
|
| 462 |
+
directoryFilter: (entry) => wh.filterDir(entry),
|
| 463 |
+
});
|
| 464 |
+
if (!stream)
|
| 465 |
+
return;
|
| 466 |
+
stream
|
| 467 |
+
.on(exports.STR_DATA, async (entry) => {
|
| 468 |
+
if (this.fsw.closed) {
|
| 469 |
+
stream = undefined;
|
| 470 |
+
return;
|
| 471 |
+
}
|
| 472 |
+
const item = entry.path;
|
| 473 |
+
let path = sysPath.join(directory, item);
|
| 474 |
+
current.add(item);
|
| 475 |
+
if (entry.stats.isSymbolicLink() &&
|
| 476 |
+
(await this._handleSymlink(entry, directory, path, item))) {
|
| 477 |
+
return;
|
| 478 |
+
}
|
| 479 |
+
if (this.fsw.closed) {
|
| 480 |
+
stream = undefined;
|
| 481 |
+
return;
|
| 482 |
+
}
|
| 483 |
+
// Files that present in current directory snapshot
|
| 484 |
+
// but absent in previous are added to watch list and
|
| 485 |
+
// emit `add` event.
|
| 486 |
+
if (item === target || (!target && !previous.has(item))) {
|
| 487 |
+
this.fsw._incrReadyCount();
|
| 488 |
+
// ensure relativeness of path is preserved in case of watcher reuse
|
| 489 |
+
path = sysPath.join(dir, sysPath.relative(dir, path));
|
| 490 |
+
this._addToNodeFs(path, initialAdd, wh, depth + 1);
|
| 491 |
+
}
|
| 492 |
+
})
|
| 493 |
+
.on(EV.ERROR, this._boundHandleError);
|
| 494 |
+
return new Promise((resolve, reject) => {
|
| 495 |
+
if (!stream)
|
| 496 |
+
return reject();
|
| 497 |
+
stream.once(exports.STR_END, () => {
|
| 498 |
+
if (this.fsw.closed) {
|
| 499 |
+
stream = undefined;
|
| 500 |
+
return;
|
| 501 |
+
}
|
| 502 |
+
const wasThrottled = throttler ? throttler.clear() : false;
|
| 503 |
+
resolve(undefined);
|
| 504 |
+
// Files that absent in current directory snapshot
|
| 505 |
+
// but present in previous emit `remove` event
|
| 506 |
+
// and are removed from @watched[directory].
|
| 507 |
+
previous
|
| 508 |
+
.getChildren()
|
| 509 |
+
.filter((item) => {
|
| 510 |
+
return item !== directory && !current.has(item);
|
| 511 |
+
})
|
| 512 |
+
.forEach((item) => {
|
| 513 |
+
this.fsw._remove(directory, item);
|
| 514 |
+
});
|
| 515 |
+
stream = undefined;
|
| 516 |
+
// one more time for any missed in case changes came in extremely quickly
|
| 517 |
+
if (wasThrottled)
|
| 518 |
+
this._handleRead(directory, false, wh, target, dir, depth, throttler);
|
| 519 |
+
});
|
| 520 |
+
});
|
| 521 |
+
}
|
| 522 |
+
/**
|
| 523 |
+
* Read directory to add / remove files from `@watched` list and re-read it on change.
|
| 524 |
+
* @param dir fs path
|
| 525 |
+
* @param stats
|
| 526 |
+
* @param initialAdd
|
| 527 |
+
* @param depth relative to user-supplied path
|
| 528 |
+
* @param target child path targeted for watch
|
| 529 |
+
* @param wh Common watch helpers for this path
|
| 530 |
+
* @param realpath
|
| 531 |
+
* @returns closer for the watcher instance.
|
| 532 |
+
*/
|
| 533 |
+
async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) {
|
| 534 |
+
const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
|
| 535 |
+
const tracked = parentDir.has(sysPath.basename(dir));
|
| 536 |
+
if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
|
| 537 |
+
this.fsw._emit(EV.ADD_DIR, dir, stats);
|
| 538 |
+
}
|
| 539 |
+
// ensure dir is tracked (harmless if redundant)
|
| 540 |
+
parentDir.add(sysPath.basename(dir));
|
| 541 |
+
this.fsw._getWatchedDir(dir);
|
| 542 |
+
let throttler;
|
| 543 |
+
let closer;
|
| 544 |
+
const oDepth = this.fsw.options.depth;
|
| 545 |
+
if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) {
|
| 546 |
+
if (!target) {
|
| 547 |
+
await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler);
|
| 548 |
+
if (this.fsw.closed)
|
| 549 |
+
return;
|
| 550 |
+
}
|
| 551 |
+
closer = this._watchWithNodeFs(dir, (dirPath, stats) => {
|
| 552 |
+
// if current directory is removed, do nothing
|
| 553 |
+
if (stats && stats.mtimeMs === 0)
|
| 554 |
+
return;
|
| 555 |
+
this._handleRead(dirPath, false, wh, target, dir, depth, throttler);
|
| 556 |
+
});
|
| 557 |
+
}
|
| 558 |
+
return closer;
|
| 559 |
+
}
|
| 560 |
+
/**
|
| 561 |
+
* Handle added file, directory, or glob pattern.
|
| 562 |
+
* Delegates call to _handleFile / _handleDir after checks.
|
| 563 |
+
* @param path to file or ir
|
| 564 |
+
* @param initialAdd was the file added at watch instantiation?
|
| 565 |
+
* @param priorWh depth relative to user-supplied path
|
| 566 |
+
* @param depth Child path actually targeted for watch
|
| 567 |
+
* @param target Child path actually targeted for watch
|
| 568 |
+
*/
|
| 569 |
+
async _addToNodeFs(path, initialAdd, priorWh, depth, target) {
|
| 570 |
+
const ready = this.fsw._emitReady;
|
| 571 |
+
if (this.fsw._isIgnored(path) || this.fsw.closed) {
|
| 572 |
+
ready();
|
| 573 |
+
return false;
|
| 574 |
+
}
|
| 575 |
+
const wh = this.fsw._getWatchHelpers(path);
|
| 576 |
+
if (priorWh) {
|
| 577 |
+
wh.filterPath = (entry) => priorWh.filterPath(entry);
|
| 578 |
+
wh.filterDir = (entry) => priorWh.filterDir(entry);
|
| 579 |
+
}
|
| 580 |
+
// evaluate what is at the path we're being asked to watch
|
| 581 |
+
try {
|
| 582 |
+
const stats = await statMethods[wh.statMethod](wh.watchPath);
|
| 583 |
+
if (this.fsw.closed)
|
| 584 |
+
return;
|
| 585 |
+
if (this.fsw._isIgnored(wh.watchPath, stats)) {
|
| 586 |
+
ready();
|
| 587 |
+
return false;
|
| 588 |
+
}
|
| 589 |
+
const follow = this.fsw.options.followSymlinks;
|
| 590 |
+
let closer;
|
| 591 |
+
if (stats.isDirectory()) {
|
| 592 |
+
const absPath = sysPath.resolve(path);
|
| 593 |
+
const targetPath = follow ? await (0, promises_1.realpath)(path) : path;
|
| 594 |
+
if (this.fsw.closed)
|
| 595 |
+
return;
|
| 596 |
+
closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
|
| 597 |
+
if (this.fsw.closed)
|
| 598 |
+
return;
|
| 599 |
+
// preserve this symlink's target path
|
| 600 |
+
if (absPath !== targetPath && targetPath !== undefined) {
|
| 601 |
+
this.fsw._symlinkPaths.set(absPath, targetPath);
|
| 602 |
+
}
|
| 603 |
+
}
|
| 604 |
+
else if (stats.isSymbolicLink()) {
|
| 605 |
+
const targetPath = follow ? await (0, promises_1.realpath)(path) : path;
|
| 606 |
+
if (this.fsw.closed)
|
| 607 |
+
return;
|
| 608 |
+
const parent = sysPath.dirname(wh.watchPath);
|
| 609 |
+
this.fsw._getWatchedDir(parent).add(wh.watchPath);
|
| 610 |
+
this.fsw._emit(EV.ADD, wh.watchPath, stats);
|
| 611 |
+
closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath);
|
| 612 |
+
if (this.fsw.closed)
|
| 613 |
+
return;
|
| 614 |
+
// preserve this symlink's target path
|
| 615 |
+
if (targetPath !== undefined) {
|
| 616 |
+
this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath);
|
| 617 |
+
}
|
| 618 |
+
}
|
| 619 |
+
else {
|
| 620 |
+
closer = this._handleFile(wh.watchPath, stats, initialAdd);
|
| 621 |
+
}
|
| 622 |
+
ready();
|
| 623 |
+
if (closer)
|
| 624 |
+
this.fsw._addPathCloser(path, closer);
|
| 625 |
+
return false;
|
| 626 |
+
}
|
| 627 |
+
catch (error) {
|
| 628 |
+
if (this.fsw._handleError(error)) {
|
| 629 |
+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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
|
| 2 |
+
import { Stats } from 'fs';
|
| 3 |
+
import { EventEmitter } from 'events';
|
| 4 |
+
import { ReaddirpStream, ReaddirpOptions, EntryInfo } from 'readdirp';
|
| 5 |
+
import { NodeFsHandler, EventName, Path, EVENTS as EV, WatchHandlers } from './handler.js';
|
| 6 |
+
type AWF = {
|
| 7 |
+
stabilityThreshold: number;
|
| 8 |
+
pollInterval: number;
|
| 9 |
+
};
|
| 10 |
+
type BasicOpts = {
|
| 11 |
+
persistent: boolean;
|
| 12 |
+
ignoreInitial: boolean;
|
| 13 |
+
followSymlinks: boolean;
|
| 14 |
+
cwd?: string;
|
| 15 |
+
usePolling: boolean;
|
| 16 |
+
interval: number;
|
| 17 |
+
binaryInterval: number;
|
| 18 |
+
alwaysStat?: boolean;
|
| 19 |
+
depth?: number;
|
| 20 |
+
ignorePermissionErrors: boolean;
|
| 21 |
+
atomic: boolean | number;
|
| 22 |
+
};
|
| 23 |
+
export type Throttler = {
|
| 24 |
+
timeoutObject: NodeJS.Timeout;
|
| 25 |
+
clear: () => void;
|
| 26 |
+
count: number;
|
| 27 |
+
};
|
| 28 |
+
export type ChokidarOptions = Partial<BasicOpts & {
|
| 29 |
+
ignored: Matcher | Matcher[];
|
| 30 |
+
awaitWriteFinish: boolean | Partial<AWF>;
|
| 31 |
+
}>;
|
| 32 |
+
export type FSWInstanceOptions = BasicOpts & {
|
| 33 |
+
ignored: Matcher[];
|
| 34 |
+
awaitWriteFinish: false | AWF;
|
| 35 |
+
};
|
| 36 |
+
export type ThrottleType = 'readdir' | 'watch' | 'add' | 'remove' | 'change';
|
| 37 |
+
export type EmitArgs = [path: Path, stats?: Stats];
|
| 38 |
+
export type EmitErrorArgs = [error: Error, stats?: Stats];
|
| 39 |
+
export type EmitArgsWithName = [event: EventName, ...EmitArgs];
|
| 40 |
+
export type MatchFunction = (val: string, stats?: Stats) => boolean;
|
| 41 |
+
export interface MatcherObject {
|
| 42 |
+
path: string;
|
| 43 |
+
recursive?: boolean;
|
| 44 |
+
}
|
| 45 |
+
export type Matcher = string | RegExp | MatchFunction | MatcherObject;
|
| 46 |
+
/**
|
| 47 |
+
* Directory entry.
|
| 48 |
+
*/
|
| 49 |
+
declare class DirEntry {
|
| 50 |
+
path: Path;
|
| 51 |
+
_removeWatcher: (dir: string, base: string) => void;
|
| 52 |
+
items: Set<Path>;
|
| 53 |
+
constructor(dir: Path, removeWatcher: (dir: string, base: string) => void);
|
| 54 |
+
add(item: string): void;
|
| 55 |
+
remove(item: string): Promise<void>;
|
| 56 |
+
has(item: string): boolean | undefined;
|
| 57 |
+
getChildren(): string[];
|
| 58 |
+
dispose(): void;
|
| 59 |
+
}
|
| 60 |
+
export declare class WatchHelper {
|
| 61 |
+
fsw: FSWatcher;
|
| 62 |
+
path: string;
|
| 63 |
+
watchPath: string;
|
| 64 |
+
fullWatchPath: string;
|
| 65 |
+
dirParts: string[][];
|
| 66 |
+
followSymlinks: boolean;
|
| 67 |
+
statMethod: 'stat' | 'lstat';
|
| 68 |
+
constructor(path: string, follow: boolean, fsw: FSWatcher);
|
| 69 |
+
entryPath(entry: EntryInfo): Path;
|
| 70 |
+
filterPath(entry: EntryInfo): boolean;
|
| 71 |
+
filterDir(entry: EntryInfo): boolean;
|
| 72 |
+
}
|
| 73 |
+
export interface FSWatcherKnownEventMap {
|
| 74 |
+
[EV.READY]: [];
|
| 75 |
+
[EV.RAW]: Parameters<WatchHandlers['rawEmitter']>;
|
| 76 |
+
[EV.ERROR]: Parameters<WatchHandlers['errHandler']>;
|
| 77 |
+
[EV.ALL]: [event: EventName, ...EmitArgs];
|
| 78 |
+
}
|
| 79 |
+
export type FSWatcherEventMap = FSWatcherKnownEventMap & {
|
| 80 |
+
[k in Exclude<EventName, keyof FSWatcherKnownEventMap>]: EmitArgs;
|
| 81 |
+
};
|
| 82 |
+
/**
|
| 83 |
+
* Watches files & directories for changes. Emitted events:
|
| 84 |
+
* `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
|
| 85 |
+
*
|
| 86 |
+
* new FSWatcher()
|
| 87 |
+
* .add(directories)
|
| 88 |
+
* .on('add', path => log('File', path, 'was added'))
|
| 89 |
+
*/
|
| 90 |
+
export declare class FSWatcher extends EventEmitter<FSWatcherEventMap> {
|
| 91 |
+
closed: boolean;
|
| 92 |
+
options: FSWInstanceOptions;
|
| 93 |
+
_closers: Map<string, Array<any>>;
|
| 94 |
+
_ignoredPaths: Set<Matcher>;
|
| 95 |
+
_throttled: Map<ThrottleType, Map<any, any>>;
|
| 96 |
+
_streams: Set<ReaddirpStream>;
|
| 97 |
+
_symlinkPaths: Map<Path, string | boolean>;
|
| 98 |
+
_watched: Map<string, DirEntry>;
|
| 99 |
+
_pendingWrites: Map<string, any>;
|
| 100 |
+
_pendingUnlinks: Map<string, EmitArgsWithName>;
|
| 101 |
+
_readyCount: number;
|
| 102 |
+
_emitReady: () => void;
|
| 103 |
+
_closePromise?: Promise<void>;
|
| 104 |
+
_userIgnored?: MatchFunction;
|
| 105 |
+
_readyEmitted: boolean;
|
| 106 |
+
_emitRaw: WatchHandlers['rawEmitter'];
|
| 107 |
+
_boundRemove: (dir: string, item: string) => void;
|
| 108 |
+
_nodeFsHandler: NodeFsHandler;
|
| 109 |
+
constructor(_opts?: ChokidarOptions);
|
| 110 |
+
_addIgnoredPath(matcher: Matcher): void;
|
| 111 |
+
_removeIgnoredPath(matcher: Matcher): void;
|
| 112 |
+
/**
|
| 113 |
+
* Adds paths to be watched on an existing FSWatcher instance.
|
| 114 |
+
* @param paths_ file or file list. Other arguments are unused
|
| 115 |
+
*/
|
| 116 |
+
add(paths_: Path | Path[], _origAdd?: string, _internal?: boolean): FSWatcher;
|
| 117 |
+
/**
|
| 118 |
+
* Close watchers or start ignoring events from specified paths.
|
| 119 |
+
*/
|
| 120 |
+
unwatch(paths_: Path | Path[]): FSWatcher;
|
| 121 |
+
/**
|
| 122 |
+
* Close watchers and remove all listeners from watched paths.
|
| 123 |
+
*/
|
| 124 |
+
close(): Promise<void>;
|
| 125 |
+
/**
|
| 126 |
+
* Expose list of watched paths
|
| 127 |
+
* @returns for chaining
|
| 128 |
+
*/
|
| 129 |
+
getWatched(): Record<string, string[]>;
|
| 130 |
+
emitWithAll(event: EventName, args: EmitArgs): void;
|
| 131 |
+
/**
|
| 132 |
+
* Normalize and emit events.
|
| 133 |
+
* Calling _emit DOES NOT MEAN emit() would be called!
|
| 134 |
+
* @param event Type of event
|
| 135 |
+
* @param path File or directory path
|
| 136 |
+
* @param stats arguments to be passed with event
|
| 137 |
+
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
| 138 |
+
*/
|
| 139 |
+
_emit(event: EventName, path: Path, stats?: Stats): Promise<this | undefined>;
|
| 140 |
+
/**
|
| 141 |
+
* Common handler for errors
|
| 142 |
+
* @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
| 143 |
+
*/
|
| 144 |
+
_handleError(error: Error): Error | boolean;
|
| 145 |
+
/**
|
| 146 |
+
* Helper utility for throttling
|
| 147 |
+
* @param actionType type being throttled
|
| 148 |
+
* @param path being acted upon
|
| 149 |
+
* @param timeout duration of time to suppress duplicate actions
|
| 150 |
+
* @returns tracking object or false if action should be suppressed
|
| 151 |
+
*/
|
| 152 |
+
_throttle(actionType: ThrottleType, path: Path, timeout: number): Throttler | false;
|
| 153 |
+
_incrReadyCount(): number;
|
| 154 |
+
/**
|
| 155 |
+
* Awaits write operation to finish.
|
| 156 |
+
* Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
|
| 157 |
+
* @param path being acted upon
|
| 158 |
+
* @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
|
| 159 |
+
* @param event
|
| 160 |
+
* @param awfEmit Callback to be called when ready for event to be emitted.
|
| 161 |
+
*/
|
| 162 |
+
_awaitWriteFinish(path: Path, threshold: number, event: EventName, awfEmit: (err?: Error, stat?: Stats) => void): void;
|
| 163 |
+
/**
|
| 164 |
+
* Determines whether user has asked to ignore this path.
|
| 165 |
+
*/
|
| 166 |
+
_isIgnored(path: Path, stats?: Stats): boolean;
|
| 167 |
+
_isntIgnored(path: Path, stat?: Stats): boolean;
|
| 168 |
+
/**
|
| 169 |
+
* Provides a set of common helpers and properties relating to symlink handling.
|
| 170 |
+
* @param path file or directory pattern being watched
|
| 171 |
+
*/
|
| 172 |
+
_getWatchHelpers(path: Path): WatchHelper;
|
| 173 |
+
/**
|
| 174 |
+
* Provides directory tracking objects
|
| 175 |
+
* @param directory path of the directory
|
| 176 |
+
*/
|
| 177 |
+
_getWatchedDir(directory: string): DirEntry;
|
| 178 |
+
/**
|
| 179 |
+
* Check for read permissions: https://stackoverflow.com/a/11781404/1358405
|
| 180 |
+
*/
|
| 181 |
+
_hasReadPermissions(stats: Stats): boolean;
|
| 182 |
+
/**
|
| 183 |
+
* Handles emitting unlink events for
|
| 184 |
+
* files and directories, and via recursion, for
|
| 185 |
+
* files and directories within directories that are unlinked
|
| 186 |
+
* @param directory within which the following item is located
|
| 187 |
+
* @param item base path of item/directory
|
| 188 |
+
*/
|
| 189 |
+
_remove(directory: string, item: string, isDirectory?: boolean): void;
|
| 190 |
+
/**
|
| 191 |
+
* Closes all watchers for a path
|
| 192 |
+
*/
|
| 193 |
+
_closePath(path: Path): void;
|
| 194 |
+
/**
|
| 195 |
+
* Closes only file-specific watchers
|
| 196 |
+
*/
|
| 197 |
+
_closeFile(path: Path): void;
|
| 198 |
+
_addPathCloser(path: Path, closer: () => void): void;
|
| 199 |
+
_readdirp(root: Path, opts?: Partial<ReaddirpOptions>): ReaddirpStream | undefined;
|
| 200 |
+
}
|
| 201 |
+
/**
|
| 202 |
+
* Instantiates watcher with paths to be tracked.
|
| 203 |
+
* @param paths file / directory paths
|
| 204 |
+
* @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
|
| 205 |
+
* @returns an instance of FSWatcher for chaining.
|
| 206 |
+
* @example
|
| 207 |
+
* const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
|
| 208 |
+
* watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
|
| 209 |
+
*/
|
| 210 |
+
export declare function watch(paths: string | string[], options?: ChokidarOptions): FSWatcher;
|
| 211 |
+
declare const _default: {
|
| 212 |
+
watch: typeof watch;
|
| 213 |
+
FSWatcher: typeof FSWatcher;
|
| 214 |
+
};
|
| 215 |
+
export default _default;
|
backend/node_modules/chokidar/index.js
ADDED
|
@@ -0,0 +1,804 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.FSWatcher = exports.WatchHelper = void 0;
|
| 4 |
+
exports.watch = watch;
|
| 5 |
+
/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */
|
| 6 |
+
const fs_1 = require("fs");
|
| 7 |
+
const promises_1 = require("fs/promises");
|
| 8 |
+
const events_1 = require("events");
|
| 9 |
+
const sysPath = require("path");
|
| 10 |
+
const readdirp_1 = require("readdirp");
|
| 11 |
+
const handler_js_1 = require("./handler.js");
|
| 12 |
+
const SLASH = '/';
|
| 13 |
+
const SLASH_SLASH = '//';
|
| 14 |
+
const ONE_DOT = '.';
|
| 15 |
+
const TWO_DOTS = '..';
|
| 16 |
+
const STRING_TYPE = 'string';
|
| 17 |
+
const BACK_SLASH_RE = /\\/g;
|
| 18 |
+
const DOUBLE_SLASH_RE = /\/\//;
|
| 19 |
+
const DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
|
| 20 |
+
const REPLACER_RE = /^\.[/\\]/;
|
| 21 |
+
function arrify(item) {
|
| 22 |
+
return Array.isArray(item) ? item : [item];
|
| 23 |
+
}
|
| 24 |
+
const isMatcherObject = (matcher) => typeof matcher === 'object' && matcher !== null && !(matcher instanceof RegExp);
|
| 25 |
+
function createPattern(matcher) {
|
| 26 |
+
if (typeof matcher === 'function')
|
| 27 |
+
return matcher;
|
| 28 |
+
if (typeof matcher === 'string')
|
| 29 |
+
return (string) => matcher === string;
|
| 30 |
+
if (matcher instanceof RegExp)
|
| 31 |
+
return (string) => matcher.test(string);
|
| 32 |
+
if (typeof matcher === 'object' && matcher !== null) {
|
| 33 |
+
return (string) => {
|
| 34 |
+
if (matcher.path === string)
|
| 35 |
+
return true;
|
| 36 |
+
if (matcher.recursive) {
|
| 37 |
+
const relative = sysPath.relative(matcher.path, string);
|
| 38 |
+
if (!relative) {
|
| 39 |
+
return false;
|
| 40 |
+
}
|
| 41 |
+
return !relative.startsWith('..') && !sysPath.isAbsolute(relative);
|
| 42 |
+
}
|
| 43 |
+
return false;
|
| 44 |
+
};
|
| 45 |
+
}
|
| 46 |
+
return () => false;
|
| 47 |
+
}
|
| 48 |
+
function normalizePath(path) {
|
| 49 |
+
if (typeof path !== 'string')
|
| 50 |
+
throw new Error('string expected');
|
| 51 |
+
path = sysPath.normalize(path);
|
| 52 |
+
path = path.replace(/\\/g, '/');
|
| 53 |
+
let prepend = false;
|
| 54 |
+
if (path.startsWith('//'))
|
| 55 |
+
prepend = true;
|
| 56 |
+
const DOUBLE_SLASH_RE = /\/\//;
|
| 57 |
+
while (path.match(DOUBLE_SLASH_RE))
|
| 58 |
+
path = path.replace(DOUBLE_SLASH_RE, '/');
|
| 59 |
+
if (prepend)
|
| 60 |
+
path = '/' + path;
|
| 61 |
+
return path;
|
| 62 |
+
}
|
| 63 |
+
function matchPatterns(patterns, testString, stats) {
|
| 64 |
+
const path = normalizePath(testString);
|
| 65 |
+
for (let index = 0; index < patterns.length; index++) {
|
| 66 |
+
const pattern = patterns[index];
|
| 67 |
+
if (pattern(path, stats)) {
|
| 68 |
+
return true;
|
| 69 |
+
}
|
| 70 |
+
}
|
| 71 |
+
return false;
|
| 72 |
+
}
|
| 73 |
+
function anymatch(matchers, testString) {
|
| 74 |
+
if (matchers == null) {
|
| 75 |
+
throw new TypeError('anymatch: specify first argument');
|
| 76 |
+
}
|
| 77 |
+
// Early cache for matchers.
|
| 78 |
+
const matchersArray = arrify(matchers);
|
| 79 |
+
const patterns = matchersArray.map((matcher) => createPattern(matcher));
|
| 80 |
+
if (testString == null) {
|
| 81 |
+
return (testString, stats) => {
|
| 82 |
+
return matchPatterns(patterns, testString, stats);
|
| 83 |
+
};
|
| 84 |
+
}
|
| 85 |
+
return matchPatterns(patterns, testString);
|
| 86 |
+
}
|
| 87 |
+
const unifyPaths = (paths_) => {
|
| 88 |
+
const paths = arrify(paths_).flat();
|
| 89 |
+
if (!paths.every((p) => typeof p === STRING_TYPE)) {
|
| 90 |
+
throw new TypeError(`Non-string provided as watch path: ${paths}`);
|
| 91 |
+
}
|
| 92 |
+
return paths.map(normalizePathToUnix);
|
| 93 |
+
};
|
| 94 |
+
// If SLASH_SLASH occurs at the beginning of path, it is not replaced
|
| 95 |
+
// because "//StoragePC/DrivePool/Movies" is a valid network path
|
| 96 |
+
const toUnix = (string) => {
|
| 97 |
+
let str = string.replace(BACK_SLASH_RE, SLASH);
|
| 98 |
+
let prepend = false;
|
| 99 |
+
if (str.startsWith(SLASH_SLASH)) {
|
| 100 |
+
prepend = true;
|
| 101 |
+
}
|
| 102 |
+
while (str.match(DOUBLE_SLASH_RE)) {
|
| 103 |
+
str = str.replace(DOUBLE_SLASH_RE, SLASH);
|
| 104 |
+
}
|
| 105 |
+
if (prepend) {
|
| 106 |
+
str = SLASH + str;
|
| 107 |
+
}
|
| 108 |
+
return str;
|
| 109 |
+
};
|
| 110 |
+
// Our version of upath.normalize
|
| 111 |
+
// TODO: this is not equal to path-normalize module - investigate why
|
| 112 |
+
const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path)));
|
| 113 |
+
// TODO: refactor
|
| 114 |
+
const normalizeIgnored = (cwd = '') => (path) => {
|
| 115 |
+
if (typeof path === 'string') {
|
| 116 |
+
return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path));
|
| 117 |
+
}
|
| 118 |
+
else {
|
| 119 |
+
return path;
|
| 120 |
+
}
|
| 121 |
+
};
|
| 122 |
+
const getAbsolutePath = (path, cwd) => {
|
| 123 |
+
if (sysPath.isAbsolute(path)) {
|
| 124 |
+
return path;
|
| 125 |
+
}
|
| 126 |
+
return sysPath.join(cwd, path);
|
| 127 |
+
};
|
| 128 |
+
const EMPTY_SET = Object.freeze(new Set());
|
| 129 |
+
/**
|
| 130 |
+
* Directory entry.
|
| 131 |
+
*/
|
| 132 |
+
class DirEntry {
|
| 133 |
+
constructor(dir, removeWatcher) {
|
| 134 |
+
this.path = dir;
|
| 135 |
+
this._removeWatcher = removeWatcher;
|
| 136 |
+
this.items = new Set();
|
| 137 |
+
}
|
| 138 |
+
add(item) {
|
| 139 |
+
const { items } = this;
|
| 140 |
+
if (!items)
|
| 141 |
+
return;
|
| 142 |
+
if (item !== ONE_DOT && item !== TWO_DOTS)
|
| 143 |
+
items.add(item);
|
| 144 |
+
}
|
| 145 |
+
async remove(item) {
|
| 146 |
+
const { items } = this;
|
| 147 |
+
if (!items)
|
| 148 |
+
return;
|
| 149 |
+
items.delete(item);
|
| 150 |
+
if (items.size > 0)
|
| 151 |
+
return;
|
| 152 |
+
const dir = this.path;
|
| 153 |
+
try {
|
| 154 |
+
await (0, promises_1.readdir)(dir);
|
| 155 |
+
}
|
| 156 |
+
catch (err) {
|
| 157 |
+
if (this._removeWatcher) {
|
| 158 |
+
this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir));
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
has(item) {
|
| 163 |
+
const { items } = this;
|
| 164 |
+
if (!items)
|
| 165 |
+
return;
|
| 166 |
+
return items.has(item);
|
| 167 |
+
}
|
| 168 |
+
getChildren() {
|
| 169 |
+
const { items } = this;
|
| 170 |
+
if (!items)
|
| 171 |
+
return [];
|
| 172 |
+
return [...items.values()];
|
| 173 |
+
}
|
| 174 |
+
dispose() {
|
| 175 |
+
this.items.clear();
|
| 176 |
+
this.path = '';
|
| 177 |
+
this._removeWatcher = handler_js_1.EMPTY_FN;
|
| 178 |
+
this.items = EMPTY_SET;
|
| 179 |
+
Object.freeze(this);
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
const STAT_METHOD_F = 'stat';
|
| 183 |
+
const STAT_METHOD_L = 'lstat';
|
| 184 |
+
class WatchHelper {
|
| 185 |
+
constructor(path, follow, fsw) {
|
| 186 |
+
this.fsw = fsw;
|
| 187 |
+
const watchPath = path;
|
| 188 |
+
this.path = path = path.replace(REPLACER_RE, '');
|
| 189 |
+
this.watchPath = watchPath;
|
| 190 |
+
this.fullWatchPath = sysPath.resolve(watchPath);
|
| 191 |
+
this.dirParts = [];
|
| 192 |
+
this.dirParts.forEach((parts) => {
|
| 193 |
+
if (parts.length > 1)
|
| 194 |
+
parts.pop();
|
| 195 |
+
});
|
| 196 |
+
this.followSymlinks = follow;
|
| 197 |
+
this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
|
| 198 |
+
}
|
| 199 |
+
entryPath(entry) {
|
| 200 |
+
return sysPath.join(this.watchPath, sysPath.relative(this.watchPath, entry.fullPath));
|
| 201 |
+
}
|
| 202 |
+
filterPath(entry) {
|
| 203 |
+
const { stats } = entry;
|
| 204 |
+
if (stats && stats.isSymbolicLink())
|
| 205 |
+
return this.filterDir(entry);
|
| 206 |
+
const resolvedPath = this.entryPath(entry);
|
| 207 |
+
// TODO: what if stats is undefined? remove !
|
| 208 |
+
return this.fsw._isntIgnored(resolvedPath, stats) && this.fsw._hasReadPermissions(stats);
|
| 209 |
+
}
|
| 210 |
+
filterDir(entry) {
|
| 211 |
+
return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
|
| 212 |
+
}
|
| 213 |
+
}
|
| 214 |
+
exports.WatchHelper = WatchHelper;
|
| 215 |
+
/**
|
| 216 |
+
* Watches files & directories for changes. Emitted events:
|
| 217 |
+
* `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error`
|
| 218 |
+
*
|
| 219 |
+
* new FSWatcher()
|
| 220 |
+
* .add(directories)
|
| 221 |
+
* .on('add', path => log('File', path, 'was added'))
|
| 222 |
+
*/
|
| 223 |
+
class FSWatcher extends events_1.EventEmitter {
|
| 224 |
+
// Not indenting methods for history sake; for now.
|
| 225 |
+
constructor(_opts = {}) {
|
| 226 |
+
super();
|
| 227 |
+
this.closed = false;
|
| 228 |
+
this._closers = new Map();
|
| 229 |
+
this._ignoredPaths = new Set();
|
| 230 |
+
this._throttled = new Map();
|
| 231 |
+
this._streams = new Set();
|
| 232 |
+
this._symlinkPaths = new Map();
|
| 233 |
+
this._watched = new Map();
|
| 234 |
+
this._pendingWrites = new Map();
|
| 235 |
+
this._pendingUnlinks = new Map();
|
| 236 |
+
this._readyCount = 0;
|
| 237 |
+
this._readyEmitted = false;
|
| 238 |
+
const awf = _opts.awaitWriteFinish;
|
| 239 |
+
const DEF_AWF = { stabilityThreshold: 2000, pollInterval: 100 };
|
| 240 |
+
const opts = {
|
| 241 |
+
// Defaults
|
| 242 |
+
persistent: true,
|
| 243 |
+
ignoreInitial: false,
|
| 244 |
+
ignorePermissionErrors: false,
|
| 245 |
+
interval: 100,
|
| 246 |
+
binaryInterval: 300,
|
| 247 |
+
followSymlinks: true,
|
| 248 |
+
usePolling: false,
|
| 249 |
+
// useAsync: false,
|
| 250 |
+
atomic: true, // NOTE: overwritten later (depends on usePolling)
|
| 251 |
+
..._opts,
|
| 252 |
+
// Change format
|
| 253 |
+
ignored: _opts.ignored ? arrify(_opts.ignored) : arrify([]),
|
| 254 |
+
awaitWriteFinish: awf === true ? DEF_AWF : typeof awf === 'object' ? { ...DEF_AWF, ...awf } : false,
|
| 255 |
+
};
|
| 256 |
+
// Always default to polling on IBM i because fs.watch() is not available on IBM i.
|
| 257 |
+
if (handler_js_1.isIBMi)
|
| 258 |
+
opts.usePolling = true;
|
| 259 |
+
// Editor atomic write normalization enabled by default with fs.watch
|
| 260 |
+
if (opts.atomic === undefined)
|
| 261 |
+
opts.atomic = !opts.usePolling;
|
| 262 |
+
// opts.atomic = typeof _opts.atomic === 'number' ? _opts.atomic : 100;
|
| 263 |
+
// Global override. Useful for developers, who need to force polling for all
|
| 264 |
+
// instances of chokidar, regardless of usage / dependency depth
|
| 265 |
+
const envPoll = process.env.CHOKIDAR_USEPOLLING;
|
| 266 |
+
if (envPoll !== undefined) {
|
| 267 |
+
const envLower = envPoll.toLowerCase();
|
| 268 |
+
if (envLower === 'false' || envLower === '0')
|
| 269 |
+
opts.usePolling = false;
|
| 270 |
+
else if (envLower === 'true' || envLower === '1')
|
| 271 |
+
opts.usePolling = true;
|
| 272 |
+
else
|
| 273 |
+
opts.usePolling = !!envLower;
|
| 274 |
+
}
|
| 275 |
+
const envInterval = process.env.CHOKIDAR_INTERVAL;
|
| 276 |
+
if (envInterval)
|
| 277 |
+
opts.interval = Number.parseInt(envInterval, 10);
|
| 278 |
+
// This is done to emit ready only once, but each 'add' will increase that?
|
| 279 |
+
let readyCalls = 0;
|
| 280 |
+
this._emitReady = () => {
|
| 281 |
+
readyCalls++;
|
| 282 |
+
if (readyCalls >= this._readyCount) {
|
| 283 |
+
this._emitReady = handler_js_1.EMPTY_FN;
|
| 284 |
+
this._readyEmitted = true;
|
| 285 |
+
// use process.nextTick to allow time for listener to be bound
|
| 286 |
+
process.nextTick(() => this.emit(handler_js_1.EVENTS.READY));
|
| 287 |
+
}
|
| 288 |
+
};
|
| 289 |
+
this._emitRaw = (...args) => this.emit(handler_js_1.EVENTS.RAW, ...args);
|
| 290 |
+
this._boundRemove = this._remove.bind(this);
|
| 291 |
+
this.options = opts;
|
| 292 |
+
this._nodeFsHandler = new handler_js_1.NodeFsHandler(this);
|
| 293 |
+
// Youβre frozen when your heartβs not open.
|
| 294 |
+
Object.freeze(opts);
|
| 295 |
+
}
|
| 296 |
+
_addIgnoredPath(matcher) {
|
| 297 |
+
if (isMatcherObject(matcher)) {
|
| 298 |
+
// return early if we already have a deeply equal matcher object
|
| 299 |
+
for (const ignored of this._ignoredPaths) {
|
| 300 |
+
if (isMatcherObject(ignored) &&
|
| 301 |
+
ignored.path === matcher.path &&
|
| 302 |
+
ignored.recursive === matcher.recursive) {
|
| 303 |
+
return;
|
| 304 |
+
}
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
this._ignoredPaths.add(matcher);
|
| 308 |
+
}
|
| 309 |
+
_removeIgnoredPath(matcher) {
|
| 310 |
+
this._ignoredPaths.delete(matcher);
|
| 311 |
+
// now find any matcher objects with the matcher as path
|
| 312 |
+
if (typeof matcher === 'string') {
|
| 313 |
+
for (const ignored of this._ignoredPaths) {
|
| 314 |
+
// TODO (43081j): make this more efficient.
|
| 315 |
+
// probably just make a `this._ignoredDirectories` or some
|
| 316 |
+
// such thing.
|
| 317 |
+
if (isMatcherObject(ignored) && ignored.path === matcher) {
|
| 318 |
+
this._ignoredPaths.delete(ignored);
|
| 319 |
+
}
|
| 320 |
+
}
|
| 321 |
+
}
|
| 322 |
+
}
|
| 323 |
+
// Public methods
|
| 324 |
+
/**
|
| 325 |
+
* Adds paths to be watched on an existing FSWatcher instance.
|
| 326 |
+
* @param paths_ file or file list. Other arguments are unused
|
| 327 |
+
*/
|
| 328 |
+
add(paths_, _origAdd, _internal) {
|
| 329 |
+
const { cwd } = this.options;
|
| 330 |
+
this.closed = false;
|
| 331 |
+
this._closePromise = undefined;
|
| 332 |
+
let paths = unifyPaths(paths_);
|
| 333 |
+
if (cwd) {
|
| 334 |
+
paths = paths.map((path) => {
|
| 335 |
+
const absPath = getAbsolutePath(path, cwd);
|
| 336 |
+
// Check `path` instead of `absPath` because the cwd portion can't be a glob
|
| 337 |
+
return absPath;
|
| 338 |
+
});
|
| 339 |
+
}
|
| 340 |
+
paths.forEach((path) => {
|
| 341 |
+
this._removeIgnoredPath(path);
|
| 342 |
+
});
|
| 343 |
+
this._userIgnored = undefined;
|
| 344 |
+
if (!this._readyCount)
|
| 345 |
+
this._readyCount = 0;
|
| 346 |
+
this._readyCount += paths.length;
|
| 347 |
+
Promise.all(paths.map(async (path) => {
|
| 348 |
+
const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, undefined, 0, _origAdd);
|
| 349 |
+
if (res)
|
| 350 |
+
this._emitReady();
|
| 351 |
+
return res;
|
| 352 |
+
})).then((results) => {
|
| 353 |
+
if (this.closed)
|
| 354 |
+
return;
|
| 355 |
+
results.forEach((item) => {
|
| 356 |
+
if (item)
|
| 357 |
+
this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item));
|
| 358 |
+
});
|
| 359 |
+
});
|
| 360 |
+
return this;
|
| 361 |
+
}
|
| 362 |
+
/**
|
| 363 |
+
* Close watchers or start ignoring events from specified paths.
|
| 364 |
+
*/
|
| 365 |
+
unwatch(paths_) {
|
| 366 |
+
if (this.closed)
|
| 367 |
+
return this;
|
| 368 |
+
const paths = unifyPaths(paths_);
|
| 369 |
+
const { cwd } = this.options;
|
| 370 |
+
paths.forEach((path) => {
|
| 371 |
+
// convert to absolute path unless relative path already matches
|
| 372 |
+
if (!sysPath.isAbsolute(path) && !this._closers.has(path)) {
|
| 373 |
+
if (cwd)
|
| 374 |
+
path = sysPath.join(cwd, path);
|
| 375 |
+
path = sysPath.resolve(path);
|
| 376 |
+
}
|
| 377 |
+
this._closePath(path);
|
| 378 |
+
this._addIgnoredPath(path);
|
| 379 |
+
if (this._watched.has(path)) {
|
| 380 |
+
this._addIgnoredPath({
|
| 381 |
+
path,
|
| 382 |
+
recursive: true,
|
| 383 |
+
});
|
| 384 |
+
}
|
| 385 |
+
// reset the cached userIgnored anymatch fn
|
| 386 |
+
// to make ignoredPaths changes effective
|
| 387 |
+
this._userIgnored = undefined;
|
| 388 |
+
});
|
| 389 |
+
return this;
|
| 390 |
+
}
|
| 391 |
+
/**
|
| 392 |
+
* Close watchers and remove all listeners from watched paths.
|
| 393 |
+
*/
|
| 394 |
+
close() {
|
| 395 |
+
if (this._closePromise) {
|
| 396 |
+
return this._closePromise;
|
| 397 |
+
}
|
| 398 |
+
this.closed = true;
|
| 399 |
+
// Memory management.
|
| 400 |
+
this.removeAllListeners();
|
| 401 |
+
const closers = [];
|
| 402 |
+
this._closers.forEach((closerList) => closerList.forEach((closer) => {
|
| 403 |
+
const promise = closer();
|
| 404 |
+
if (promise instanceof Promise)
|
| 405 |
+
closers.push(promise);
|
| 406 |
+
}));
|
| 407 |
+
this._streams.forEach((stream) => stream.destroy());
|
| 408 |
+
this._userIgnored = undefined;
|
| 409 |
+
this._readyCount = 0;
|
| 410 |
+
this._readyEmitted = false;
|
| 411 |
+
this._watched.forEach((dirent) => dirent.dispose());
|
| 412 |
+
this._closers.clear();
|
| 413 |
+
this._watched.clear();
|
| 414 |
+
this._streams.clear();
|
| 415 |
+
this._symlinkPaths.clear();
|
| 416 |
+
this._throttled.clear();
|
| 417 |
+
this._closePromise = closers.length
|
| 418 |
+
? Promise.all(closers).then(() => undefined)
|
| 419 |
+
: Promise.resolve();
|
| 420 |
+
return this._closePromise;
|
| 421 |
+
}
|
| 422 |
+
/**
|
| 423 |
+
* Expose list of watched paths
|
| 424 |
+
* @returns for chaining
|
| 425 |
+
*/
|
| 426 |
+
getWatched() {
|
| 427 |
+
const watchList = {};
|
| 428 |
+
this._watched.forEach((entry, dir) => {
|
| 429 |
+
const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir;
|
| 430 |
+
const index = key || ONE_DOT;
|
| 431 |
+
watchList[index] = entry.getChildren().sort();
|
| 432 |
+
});
|
| 433 |
+
return watchList;
|
| 434 |
+
}
|
| 435 |
+
emitWithAll(event, args) {
|
| 436 |
+
this.emit(event, ...args);
|
| 437 |
+
if (event !== handler_js_1.EVENTS.ERROR)
|
| 438 |
+
this.emit(handler_js_1.EVENTS.ALL, event, ...args);
|
| 439 |
+
}
|
| 440 |
+
// Common helpers
|
| 441 |
+
// --------------
|
| 442 |
+
/**
|
| 443 |
+
* Normalize and emit events.
|
| 444 |
+
* Calling _emit DOES NOT MEAN emit() would be called!
|
| 445 |
+
* @param event Type of event
|
| 446 |
+
* @param path File or directory path
|
| 447 |
+
* @param stats arguments to be passed with event
|
| 448 |
+
* @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
| 449 |
+
*/
|
| 450 |
+
async _emit(event, path, stats) {
|
| 451 |
+
if (this.closed)
|
| 452 |
+
return;
|
| 453 |
+
const opts = this.options;
|
| 454 |
+
if (handler_js_1.isWindows)
|
| 455 |
+
path = sysPath.normalize(path);
|
| 456 |
+
if (opts.cwd)
|
| 457 |
+
path = sysPath.relative(opts.cwd, path);
|
| 458 |
+
const args = [path];
|
| 459 |
+
if (stats != null)
|
| 460 |
+
args.push(stats);
|
| 461 |
+
const awf = opts.awaitWriteFinish;
|
| 462 |
+
let pw;
|
| 463 |
+
if (awf && (pw = this._pendingWrites.get(path))) {
|
| 464 |
+
pw.lastChange = new Date();
|
| 465 |
+
return this;
|
| 466 |
+
}
|
| 467 |
+
if (opts.atomic) {
|
| 468 |
+
if (event === handler_js_1.EVENTS.UNLINK) {
|
| 469 |
+
this._pendingUnlinks.set(path, [event, ...args]);
|
| 470 |
+
setTimeout(() => {
|
| 471 |
+
this._pendingUnlinks.forEach((entry, path) => {
|
| 472 |
+
this.emit(...entry);
|
| 473 |
+
this.emit(handler_js_1.EVENTS.ALL, ...entry);
|
| 474 |
+
this._pendingUnlinks.delete(path);
|
| 475 |
+
});
|
| 476 |
+
}, typeof opts.atomic === 'number' ? opts.atomic : 100);
|
| 477 |
+
return this;
|
| 478 |
+
}
|
| 479 |
+
if (event === handler_js_1.EVENTS.ADD && this._pendingUnlinks.has(path)) {
|
| 480 |
+
event = handler_js_1.EVENTS.CHANGE;
|
| 481 |
+
this._pendingUnlinks.delete(path);
|
| 482 |
+
}
|
| 483 |
+
}
|
| 484 |
+
if (awf && (event === handler_js_1.EVENTS.ADD || event === handler_js_1.EVENTS.CHANGE) && this._readyEmitted) {
|
| 485 |
+
const awfEmit = (err, stats) => {
|
| 486 |
+
if (err) {
|
| 487 |
+
event = handler_js_1.EVENTS.ERROR;
|
| 488 |
+
args[0] = err;
|
| 489 |
+
this.emitWithAll(event, args);
|
| 490 |
+
}
|
| 491 |
+
else if (stats) {
|
| 492 |
+
// if stats doesn't exist the file must have been deleted
|
| 493 |
+
if (args.length > 1) {
|
| 494 |
+
args[1] = stats;
|
| 495 |
+
}
|
| 496 |
+
else {
|
| 497 |
+
args.push(stats);
|
| 498 |
+
}
|
| 499 |
+
this.emitWithAll(event, args);
|
| 500 |
+
}
|
| 501 |
+
};
|
| 502 |
+
this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit);
|
| 503 |
+
return this;
|
| 504 |
+
}
|
| 505 |
+
if (event === handler_js_1.EVENTS.CHANGE) {
|
| 506 |
+
const isThrottled = !this._throttle(handler_js_1.EVENTS.CHANGE, path, 50);
|
| 507 |
+
if (isThrottled)
|
| 508 |
+
return this;
|
| 509 |
+
}
|
| 510 |
+
if (opts.alwaysStat &&
|
| 511 |
+
stats === undefined &&
|
| 512 |
+
(event === handler_js_1.EVENTS.ADD || event === handler_js_1.EVENTS.ADD_DIR || event === handler_js_1.EVENTS.CHANGE)) {
|
| 513 |
+
const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path;
|
| 514 |
+
let stats;
|
| 515 |
+
try {
|
| 516 |
+
stats = await (0, promises_1.stat)(fullPath);
|
| 517 |
+
}
|
| 518 |
+
catch (err) {
|
| 519 |
+
// do nothing
|
| 520 |
+
}
|
| 521 |
+
// Suppress event when fs_stat fails, to avoid sending undefined 'stat'
|
| 522 |
+
if (!stats || this.closed)
|
| 523 |
+
return;
|
| 524 |
+
args.push(stats);
|
| 525 |
+
}
|
| 526 |
+
this.emitWithAll(event, args);
|
| 527 |
+
return this;
|
| 528 |
+
}
|
| 529 |
+
/**
|
| 530 |
+
* Common handler for errors
|
| 531 |
+
* @returns The error if defined, otherwise the value of the FSWatcher instance's `closed` flag
|
| 532 |
+
*/
|
| 533 |
+
_handleError(error) {
|
| 534 |
+
const code = error && error.code;
|
| 535 |
+
if (error &&
|
| 536 |
+
code !== 'ENOENT' &&
|
| 537 |
+
code !== 'ENOTDIR' &&
|
| 538 |
+
(!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES'))) {
|
| 539 |
+
this.emit(handler_js_1.EVENTS.ERROR, error);
|
| 540 |
+
}
|
| 541 |
+
return error || this.closed;
|
| 542 |
+
}
|
| 543 |
+
/**
|
| 544 |
+
* Helper utility for throttling
|
| 545 |
+
* @param actionType type being throttled
|
| 546 |
+
* @param path being acted upon
|
| 547 |
+
* @param timeout duration of time to suppress duplicate actions
|
| 548 |
+
* @returns tracking object or false if action should be suppressed
|
| 549 |
+
*/
|
| 550 |
+
_throttle(actionType, path, timeout) {
|
| 551 |
+
if (!this._throttled.has(actionType)) {
|
| 552 |
+
this._throttled.set(actionType, new Map());
|
| 553 |
+
}
|
| 554 |
+
const action = this._throttled.get(actionType);
|
| 555 |
+
if (!action)
|
| 556 |
+
throw new Error('invalid throttle');
|
| 557 |
+
const actionPath = action.get(path);
|
| 558 |
+
if (actionPath) {
|
| 559 |
+
actionPath.count++;
|
| 560 |
+
return false;
|
| 561 |
+
}
|
| 562 |
+
// eslint-disable-next-line prefer-const
|
| 563 |
+
let timeoutObject;
|
| 564 |
+
const clear = () => {
|
| 565 |
+
const item = action.get(path);
|
| 566 |
+
const count = item ? item.count : 0;
|
| 567 |
+
action.delete(path);
|
| 568 |
+
clearTimeout(timeoutObject);
|
| 569 |
+
if (item)
|
| 570 |
+
clearTimeout(item.timeoutObject);
|
| 571 |
+
return count;
|
| 572 |
+
};
|
| 573 |
+
timeoutObject = setTimeout(clear, timeout);
|
| 574 |
+
const thr = { timeoutObject, clear, count: 0 };
|
| 575 |
+
action.set(path, thr);
|
| 576 |
+
return thr;
|
| 577 |
+
}
|
| 578 |
+
_incrReadyCount() {
|
| 579 |
+
return this._readyCount++;
|
| 580 |
+
}
|
| 581 |
+
/**
|
| 582 |
+
* Awaits write operation to finish.
|
| 583 |
+
* Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback.
|
| 584 |
+
* @param path being acted upon
|
| 585 |
+
* @param threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished
|
| 586 |
+
* @param event
|
| 587 |
+
* @param awfEmit Callback to be called when ready for event to be emitted.
|
| 588 |
+
*/
|
| 589 |
+
_awaitWriteFinish(path, threshold, event, awfEmit) {
|
| 590 |
+
const awf = this.options.awaitWriteFinish;
|
| 591 |
+
if (typeof awf !== 'object')
|
| 592 |
+
return;
|
| 593 |
+
const pollInterval = awf.pollInterval;
|
| 594 |
+
let timeoutHandler;
|
| 595 |
+
let fullPath = path;
|
| 596 |
+
if (this.options.cwd && !sysPath.isAbsolute(path)) {
|
| 597 |
+
fullPath = sysPath.join(this.options.cwd, path);
|
| 598 |
+
}
|
| 599 |
+
const now = new Date();
|
| 600 |
+
const writes = this._pendingWrites;
|
| 601 |
+
function awaitWriteFinishFn(prevStat) {
|
| 602 |
+
(0, fs_1.stat)(fullPath, (err, curStat) => {
|
| 603 |
+
if (err || !writes.has(path)) {
|
| 604 |
+
if (err && err.code !== 'ENOENT')
|
| 605 |
+
awfEmit(err);
|
| 606 |
+
return;
|
| 607 |
+
}
|
| 608 |
+
const now = Number(new Date());
|
| 609 |
+
if (prevStat && curStat.size !== prevStat.size) {
|
| 610 |
+
writes.get(path).lastChange = now;
|
| 611 |
+
}
|
| 612 |
+
const pw = writes.get(path);
|
| 613 |
+
const df = now - pw.lastChange;
|
| 614 |
+
if (df >= threshold) {
|
| 615 |
+
writes.delete(path);
|
| 616 |
+
awfEmit(undefined, curStat);
|
| 617 |
+
}
|
| 618 |
+
else {
|
| 619 |
+
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
|
| 620 |
+
}
|
| 621 |
+
});
|
| 622 |
+
}
|
| 623 |
+
if (!writes.has(path)) {
|
| 624 |
+
writes.set(path, {
|
| 625 |
+
lastChange: now,
|
| 626 |
+
cancelWait: () => {
|
| 627 |
+
writes.delete(path);
|
| 628 |
+
clearTimeout(timeoutHandler);
|
| 629 |
+
return event;
|
| 630 |
+
},
|
| 631 |
+
});
|
| 632 |
+
timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval);
|
| 633 |
+
}
|
| 634 |
+
}
|
| 635 |
+
/**
|
| 636 |
+
* Determines whether user has asked to ignore this path.
|
| 637 |
+
*/
|
| 638 |
+
_isIgnored(path, stats) {
|
| 639 |
+
if (this.options.atomic && DOT_RE.test(path))
|
| 640 |
+
return true;
|
| 641 |
+
if (!this._userIgnored) {
|
| 642 |
+
const { cwd } = this.options;
|
| 643 |
+
const ign = this.options.ignored;
|
| 644 |
+
const ignored = (ign || []).map(normalizeIgnored(cwd));
|
| 645 |
+
const ignoredPaths = [...this._ignoredPaths];
|
| 646 |
+
const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
|
| 647 |
+
this._userIgnored = anymatch(list, undefined);
|
| 648 |
+
}
|
| 649 |
+
return this._userIgnored(path, stats);
|
| 650 |
+
}
|
| 651 |
+
_isntIgnored(path, stat) {
|
| 652 |
+
return !this._isIgnored(path, stat);
|
| 653 |
+
}
|
| 654 |
+
/**
|
| 655 |
+
* Provides a set of common helpers and properties relating to symlink handling.
|
| 656 |
+
* @param path file or directory pattern being watched
|
| 657 |
+
*/
|
| 658 |
+
_getWatchHelpers(path) {
|
| 659 |
+
return new WatchHelper(path, this.options.followSymlinks, this);
|
| 660 |
+
}
|
| 661 |
+
// Directory helpers
|
| 662 |
+
// -----------------
|
| 663 |
+
/**
|
| 664 |
+
* Provides directory tracking objects
|
| 665 |
+
* @param directory path of the directory
|
| 666 |
+
*/
|
| 667 |
+
_getWatchedDir(directory) {
|
| 668 |
+
const dir = sysPath.resolve(directory);
|
| 669 |
+
if (!this._watched.has(dir))
|
| 670 |
+
this._watched.set(dir, new DirEntry(dir, this._boundRemove));
|
| 671 |
+
return this._watched.get(dir);
|
| 672 |
+
}
|
| 673 |
+
// File helpers
|
| 674 |
+
// ------------
|
| 675 |
+
/**
|
| 676 |
+
* Check for read permissions: https://stackoverflow.com/a/11781404/1358405
|
| 677 |
+
*/
|
| 678 |
+
_hasReadPermissions(stats) {
|
| 679 |
+
if (this.options.ignorePermissionErrors)
|
| 680 |
+
return true;
|
| 681 |
+
return Boolean(Number(stats.mode) & 0o400);
|
| 682 |
+
}
|
| 683 |
+
/**
|
| 684 |
+
* Handles emitting unlink events for
|
| 685 |
+
* files and directories, and via recursion, for
|
| 686 |
+
* files and directories within directories that are unlinked
|
| 687 |
+
* @param directory within which the following item is located
|
| 688 |
+
* @param item base path of item/directory
|
| 689 |
+
*/
|
| 690 |
+
_remove(directory, item, isDirectory) {
|
| 691 |
+
// if what is being deleted is a directory, get that directory's paths
|
| 692 |
+
// for recursive deleting and cleaning of watched object
|
| 693 |
+
// if it is not a directory, nestedDirectoryChildren will be empty array
|
| 694 |
+
const path = sysPath.join(directory, item);
|
| 695 |
+
const fullPath = sysPath.resolve(path);
|
| 696 |
+
isDirectory =
|
| 697 |
+
isDirectory != null ? isDirectory : this._watched.has(path) || this._watched.has(fullPath);
|
| 698 |
+
// prevent duplicate handling in case of arriving here nearly simultaneously
|
| 699 |
+
// via multiple paths (such as _handleFile and _handleDir)
|
| 700 |
+
if (!this._throttle('remove', path, 100))
|
| 701 |
+
return;
|
| 702 |
+
// if the only watched file is removed, watch for its return
|
| 703 |
+
if (!isDirectory && this._watched.size === 1) {
|
| 704 |
+
this.add(directory, item, true);
|
| 705 |
+
}
|
| 706 |
+
// This will create a new entry in the watched object in either case
|
| 707 |
+
// so we got to do the directory check beforehand
|
| 708 |
+
const wp = this._getWatchedDir(path);
|
| 709 |
+
const nestedDirectoryChildren = wp.getChildren();
|
| 710 |
+
// Recursively remove children directories / files.
|
| 711 |
+
nestedDirectoryChildren.forEach((nested) => this._remove(path, nested));
|
| 712 |
+
// Check if item was on the watched list and remove it
|
| 713 |
+
const parent = this._getWatchedDir(directory);
|
| 714 |
+
const wasTracked = parent.has(item);
|
| 715 |
+
parent.remove(item);
|
| 716 |
+
// Fixes issue #1042 -> Relative paths were detected and added as symlinks
|
| 717 |
+
// (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612),
|
| 718 |
+
// but never removed from the map in case the path was deleted.
|
| 719 |
+
// This leads to an incorrect state if the path was recreated:
|
| 720 |
+
// https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553
|
| 721 |
+
if (this._symlinkPaths.has(fullPath)) {
|
| 722 |
+
this._symlinkPaths.delete(fullPath);
|
| 723 |
+
}
|
| 724 |
+
// If we wait for this file to be fully written, cancel the wait.
|
| 725 |
+
let relPath = path;
|
| 726 |
+
if (this.options.cwd)
|
| 727 |
+
relPath = sysPath.relative(this.options.cwd, path);
|
| 728 |
+
if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
|
| 729 |
+
const event = this._pendingWrites.get(relPath).cancelWait();
|
| 730 |
+
if (event === handler_js_1.EVENTS.ADD)
|
| 731 |
+
return;
|
| 732 |
+
}
|
| 733 |
+
// The Entry will either be a directory that just got removed
|
| 734 |
+
// or a bogus entry to a file, in either case we have to remove it
|
| 735 |
+
this._watched.delete(path);
|
| 736 |
+
this._watched.delete(fullPath);
|
| 737 |
+
const eventName = isDirectory ? handler_js_1.EVENTS.UNLINK_DIR : handler_js_1.EVENTS.UNLINK;
|
| 738 |
+
if (wasTracked && !this._isIgnored(path))
|
| 739 |
+
this._emit(eventName, path);
|
| 740 |
+
// Avoid conflicts if we later create another file with the same name
|
| 741 |
+
this._closePath(path);
|
| 742 |
+
}
|
| 743 |
+
/**
|
| 744 |
+
* Closes all watchers for a path
|
| 745 |
+
*/
|
| 746 |
+
_closePath(path) {
|
| 747 |
+
this._closeFile(path);
|
| 748 |
+
const dir = sysPath.dirname(path);
|
| 749 |
+
this._getWatchedDir(dir).remove(sysPath.basename(path));
|
| 750 |
+
}
|
| 751 |
+
/**
|
| 752 |
+
* Closes only file-specific watchers
|
| 753 |
+
*/
|
| 754 |
+
_closeFile(path) {
|
| 755 |
+
const closers = this._closers.get(path);
|
| 756 |
+
if (!closers)
|
| 757 |
+
return;
|
| 758 |
+
closers.forEach((closer) => closer());
|
| 759 |
+
this._closers.delete(path);
|
| 760 |
+
}
|
| 761 |
+
_addPathCloser(path, closer) {
|
| 762 |
+
if (!closer)
|
| 763 |
+
return;
|
| 764 |
+
let list = this._closers.get(path);
|
| 765 |
+
if (!list) {
|
| 766 |
+
list = [];
|
| 767 |
+
this._closers.set(path, list);
|
| 768 |
+
}
|
| 769 |
+
list.push(closer);
|
| 770 |
+
}
|
| 771 |
+
_readdirp(root, opts) {
|
| 772 |
+
if (this.closed)
|
| 773 |
+
return;
|
| 774 |
+
const options = { type: handler_js_1.EVENTS.ALL, alwaysStat: true, lstat: true, ...opts, depth: 0 };
|
| 775 |
+
let stream = (0, readdirp_1.readdirp)(root, options);
|
| 776 |
+
this._streams.add(stream);
|
| 777 |
+
stream.once(handler_js_1.STR_CLOSE, () => {
|
| 778 |
+
stream = undefined;
|
| 779 |
+
});
|
| 780 |
+
stream.once(handler_js_1.STR_END, () => {
|
| 781 |
+
if (stream) {
|
| 782 |
+
this._streams.delete(stream);
|
| 783 |
+
stream = undefined;
|
| 784 |
+
}
|
| 785 |
+
});
|
| 786 |
+
return stream;
|
| 787 |
+
}
|
| 788 |
+
}
|
| 789 |
+
exports.FSWatcher = FSWatcher;
|
| 790 |
+
/**
|
| 791 |
+
* Instantiates watcher with paths to be tracked.
|
| 792 |
+
* @param paths file / directory paths
|
| 793 |
+
* @param options opts, such as `atomic`, `awaitWriteFinish`, `ignored`, and others
|
| 794 |
+
* @returns an instance of FSWatcher for chaining.
|
| 795 |
+
* @example
|
| 796 |
+
* const watcher = watch('.').on('all', (event, path) => { console.log(event, path); });
|
| 797 |
+
* watch('.', { atomic: true, awaitWriteFinish: true, ignored: (f, stats) => stats?.isFile() && !f.endsWith('.js') })
|
| 798 |
+
*/
|
| 799 |
+
function watch(paths, options = {}) {
|
| 800 |
+
const watcher = new FSWatcher(options);
|
| 801 |
+
watcher.add(paths);
|
| 802 |
+
return watcher;
|
| 803 |
+
}
|
| 804 |
+
exports.default = { watch, FSWatcher };
|
backend/node_modules/chokidar/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "chokidar",
|
| 3 |
+
"description": "Minimal and efficient cross-platform file watching library",
|
| 4 |
+
"version": "4.0.3",
|
| 5 |
+
"homepage": "https://github.com/paulmillr/chokidar",
|
| 6 |
+
"author": "Paul Miller (https://paulmillr.com)",
|
| 7 |
+
"files": [
|
| 8 |
+
"index.js",
|
| 9 |
+
"index.d.ts",
|
| 10 |
+
"handler.js",
|
| 11 |
+
"handler.d.ts",
|
| 12 |
+
"esm"
|
| 13 |
+
],
|
| 14 |
+
"main": "./index.js",
|
| 15 |
+
"module": "./esm/index.js",
|
| 16 |
+
"types": "./index.d.ts",
|
| 17 |
+
"exports": {
|
| 18 |
+
".": {
|
| 19 |
+
"import": "./esm/index.js",
|
| 20 |
+
"require": "./index.js"
|
| 21 |
+
},
|
| 22 |
+
"./handler.js": {
|
| 23 |
+
"import": "./esm/handler.js",
|
| 24 |
+
"require": "./handler.js"
|
| 25 |
+
}
|
| 26 |
+
},
|
| 27 |
+
"dependencies": {
|
| 28 |
+
"readdirp": "^4.0.1"
|
| 29 |
+
},
|
| 30 |
+
"devDependencies": {
|
| 31 |
+
"@paulmillr/jsbt": "0.2.1",
|
| 32 |
+
"@types/node": "20.14.8",
|
| 33 |
+
"chai": "4.3.4",
|
| 34 |
+
"prettier": "3.1.1",
|
| 35 |
+
"rimraf": "5.0.5",
|
| 36 |
+
"sinon": "12.0.1",
|
| 37 |
+
"sinon-chai": "3.7.0",
|
| 38 |
+
"typescript": "5.5.2",
|
| 39 |
+
"upath": "2.0.1"
|
| 40 |
+
},
|
| 41 |
+
"sideEffects": false,
|
| 42 |
+
"engines": {
|
| 43 |
+
"node": ">= 14.16.0"
|
| 44 |
+
},
|
| 45 |
+
"repository": {
|
| 46 |
+
"type": "git",
|
| 47 |
+
"url": "git+https://github.com/paulmillr/chokidar.git"
|
| 48 |
+
},
|
| 49 |
+
"bugs": {
|
| 50 |
+
"url": "https://github.com/paulmillr/chokidar/issues"
|
| 51 |
+
},
|
| 52 |
+
"license": "MIT",
|
| 53 |
+
"scripts": {
|
| 54 |
+
"build": "tsc && tsc -p tsconfig.esm.json",
|
| 55 |
+
"lint": "prettier --check src",
|
| 56 |
+
"format": "prettier --write src",
|
| 57 |
+
"test": "node --test"
|
| 58 |
+
},
|
| 59 |
+
"keywords": [
|
| 60 |
+
"fs",
|
| 61 |
+
"watch",
|
| 62 |
+
"watchFile",
|
| 63 |
+
"watcher",
|
| 64 |
+
"watching",
|
| 65 |
+
"file",
|
| 66 |
+
"fsevents"
|
| 67 |
+
],
|
| 68 |
+
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Changelog
|
| 2 |
+
|
| 3 |
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
| 4 |
+
|
| 5 |
+
## [Unreleased](https://github.com/motdotla/dotenv/compare/v16.6.1...master)
|
| 6 |
+
|
| 7 |
+
## [16.6.1](https://github.com/motdotla/dotenv/compare/v16.6.0...v16.6.1) (2025-06-27)
|
| 8 |
+
|
| 9 |
+
### Changed
|
| 10 |
+
|
| 11 |
+
- Default `quiet` to true β hiding the runtime log message ([#874](https://github.com/motdotla/dotenv/pull/874))
|
| 12 |
+
- NOTICE: 17.0.0 will be released with quiet defaulting to false. Use `config({ quiet: true })` to suppress.
|
| 13 |
+
- And check out the new [dotenvx](https://github.com/dotenvx/dotenvx). As coding workflows evolve and agents increasingly handle secrets, encrypted .env files offer a much safer way to deploy both agents and code together with secure secrets. Simply switch `require('dotenv').config()` for `require('@dotenvx/dotenvx').config()`.
|
| 14 |
+
|
| 15 |
+
## [16.6.0](https://github.com/motdotla/dotenv/compare/v16.5.0...v16.6.0) (2025-06-26)
|
| 16 |
+
|
| 17 |
+
### Added
|
| 18 |
+
|
| 19 |
+
- Default log helpful message `[dotenv@16.6.0] injecting env (1) from .env` ([#870](https://github.com/motdotla/dotenv/pull/870))
|
| 20 |
+
- Use `{ quiet: true }` to suppress
|
| 21 |
+
- Aligns dotenv more closely with [dotenvx](https://github.com/dotenvx/dotenvx).
|
| 22 |
+
|
| 23 |
+
## [16.5.0](https://github.com/motdotla/dotenv/compare/v16.4.7...v16.5.0) (2025-04-07)
|
| 24 |
+
|
| 25 |
+
### Added
|
| 26 |
+
|
| 27 |
+
- π Added new sponsor [Graphite](https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=dotenv) - *the AI developer productivity platform helping teams on GitHub ship higher quality software, faster*.
|
| 28 |
+
|
| 29 |
+
> [!TIP]
|
| 30 |
+
> **[Become a sponsor](https://github.com/sponsors/motdotla)**
|
| 31 |
+
>
|
| 32 |
+
> The dotenvx README is viewed thousands of times DAILY on GitHub and NPM.
|
| 33 |
+
> Sponsoring dotenv is a great way to get in front of developers and give back to the developer community at the same time.
|
| 34 |
+
|
| 35 |
+
### Changed
|
| 36 |
+
|
| 37 |
+
- Remove `_log` method. Use `_debug` [#862](https://github.com/motdotla/dotenv/pull/862)
|
| 38 |
+
|
| 39 |
+
## [16.4.7](https://github.com/motdotla/dotenv/compare/v16.4.6...v16.4.7) (2024-12-03)
|
| 40 |
+
|
| 41 |
+
### Changed
|
| 42 |
+
|
| 43 |
+
- Ignore `.tap` folder when publishing. (oops, sorry about that everyone. - @motdotla) [#848](https://github.com/motdotla/dotenv/pull/848)
|
| 44 |
+
|
| 45 |
+
## [16.4.6](https://github.com/motdotla/dotenv/compare/v16.4.5...v16.4.6) (2024-12-02)
|
| 46 |
+
|
| 47 |
+
### Changed
|
| 48 |
+
|
| 49 |
+
- Clean up stale dev dependencies [#847](https://github.com/motdotla/dotenv/pull/847)
|
| 50 |
+
- Various README updates clarifying usage and alternative solutions using [dotenvx](https://github.com/dotenvx/dotenvx)
|
| 51 |
+
|
| 52 |
+
## [16.4.5](https://github.com/motdotla/dotenv/compare/v16.4.4...v16.4.5) (2024-02-19)
|
| 53 |
+
|
| 54 |
+
### Changed
|
| 55 |
+
|
| 56 |
+
- π Fix recent regression when using `path` option. return to historical behavior: do not attempt to auto find `.env` if `path` set. (regression was introduced in `16.4.3`) [#814](https://github.com/motdotla/dotenv/pull/814)
|
| 57 |
+
|
| 58 |
+
## [16.4.4](https://github.com/motdotla/dotenv/compare/v16.4.3...v16.4.4) (2024-02-13)
|
| 59 |
+
|
| 60 |
+
### Changed
|
| 61 |
+
|
| 62 |
+
- π Replaced chaining operator `?.` with old school `&&` (fixing node 12 failures) [#812](https://github.com/motdotla/dotenv/pull/812)
|
| 63 |
+
|
| 64 |
+
## [16.4.3](https://github.com/motdotla/dotenv/compare/v16.4.2...v16.4.3) (2024-02-12)
|
| 65 |
+
|
| 66 |
+
### Changed
|
| 67 |
+
|
| 68 |
+
- Fixed processing of multiple files in `options.path` [#805](https://github.com/motdotla/dotenv/pull/805)
|
| 69 |
+
|
| 70 |
+
## [16.4.2](https://github.com/motdotla/dotenv/compare/v16.4.1...v16.4.2) (2024-02-10)
|
| 71 |
+
|
| 72 |
+
### Changed
|
| 73 |
+
|
| 74 |
+
- Changed funding link in package.json to [`dotenvx.com`](https://dotenvx.com)
|
| 75 |
+
|
| 76 |
+
## [16.4.1](https://github.com/motdotla/dotenv/compare/v16.4.0...v16.4.1) (2024-01-24)
|
| 77 |
+
|
| 78 |
+
- Patch support for array as `path` option [#797](https://github.com/motdotla/dotenv/pull/797)
|
| 79 |
+
|
| 80 |
+
## [16.4.0](https://github.com/motdotla/dotenv/compare/v16.3.2...v16.4.0) (2024-01-23)
|
| 81 |
+
|
| 82 |
+
- Add `error.code` to error messages around `.env.vault` decryption handling [#795](https://github.com/motdotla/dotenv/pull/795)
|
| 83 |
+
- Add ability to find `.env.vault` file when filename(s) passed as an array [#784](https://github.com/motdotla/dotenv/pull/784)
|
| 84 |
+
|
| 85 |
+
## [16.3.2](https://github.com/motdotla/dotenv/compare/v16.3.1...v16.3.2) (2024-01-18)
|
| 86 |
+
|
| 87 |
+
### Added
|
| 88 |
+
|
| 89 |
+
- Add debug message when no encoding set [#735](https://github.com/motdotla/dotenv/pull/735)
|
| 90 |
+
|
| 91 |
+
### Changed
|
| 92 |
+
|
| 93 |
+
- Fix output typing for `populate` [#792](https://github.com/motdotla/dotenv/pull/792)
|
| 94 |
+
- Use subarray instead of slice [#793](https://github.com/motdotla/dotenv/pull/793)
|
| 95 |
+
|
| 96 |
+
## [16.3.1](https://github.com/motdotla/dotenv/compare/v16.3.0...v16.3.1) (2023-06-17)
|
| 97 |
+
|
| 98 |
+
### Added
|
| 99 |
+
|
| 100 |
+
- Add missing type definitions for `processEnv` and `DOTENV_KEY` options. [#756](https://github.com/motdotla/dotenv/pull/756)
|
| 101 |
+
|
| 102 |
+
## [16.3.0](https://github.com/motdotla/dotenv/compare/v16.2.0...v16.3.0) (2023-06-16)
|
| 103 |
+
|
| 104 |
+
### Added
|
| 105 |
+
|
| 106 |
+
- Optionally pass `DOTENV_KEY` to options rather than relying on `process.env.DOTENV_KEY`. Defaults to `process.env.DOTENV_KEY` [#754](https://github.com/motdotla/dotenv/pull/754)
|
| 107 |
+
|
| 108 |
+
## [16.2.0](https://github.com/motdotla/dotenv/compare/v16.1.4...v16.2.0) (2023-06-15)
|
| 109 |
+
|
| 110 |
+
### Added
|
| 111 |
+
|
| 112 |
+
- Optionally write to your own target object rather than `process.env`. Defaults to `process.env`. [#753](https://github.com/motdotla/dotenv/pull/753)
|
| 113 |
+
- Add import type URL to types file [#751](https://github.com/motdotla/dotenv/pull/751)
|
| 114 |
+
|
| 115 |
+
## [16.1.4](https://github.com/motdotla/dotenv/compare/v16.1.3...v16.1.4) (2023-06-04)
|
| 116 |
+
|
| 117 |
+
### Added
|
| 118 |
+
|
| 119 |
+
- Added `.github/` to `.npmignore` [#747](https://github.com/motdotla/dotenv/pull/747)
|
| 120 |
+
|
| 121 |
+
## [16.1.3](https://github.com/motdotla/dotenv/compare/v16.1.2...v16.1.3) (2023-05-31)
|
| 122 |
+
|
| 123 |
+
### Removed
|
| 124 |
+
|
| 125 |
+
- Removed `browser` keys for `path`, `os`, and `crypto` in package.json. These were set to false incorrectly as of 16.1. Instead, if using dotenv on the front-end make sure to include polyfills for `path`, `os`, and `crypto`. [node-polyfill-webpack-plugin](https://github.com/Richienb/node-polyfill-webpack-plugin) provides these.
|
| 126 |
+
|
| 127 |
+
## [16.1.2](https://github.com/motdotla/dotenv/compare/v16.1.1...v16.1.2) (2023-05-31)
|
| 128 |
+
|
| 129 |
+
### Changed
|
| 130 |
+
|
| 131 |
+
- Exposed private function `_configDotenv` as `configDotenv`. [#744](https://github.com/motdotla/dotenv/pull/744)
|
| 132 |
+
|
| 133 |
+
## [16.1.1](https://github.com/motdotla/dotenv/compare/v16.1.0...v16.1.1) (2023-05-30)
|
| 134 |
+
|
| 135 |
+
### Added
|
| 136 |
+
|
| 137 |
+
- Added type definition for `decrypt` function
|
| 138 |
+
|
| 139 |
+
### Changed
|
| 140 |
+
|
| 141 |
+
- Fixed `{crypto: false}` in `packageJson.browser`
|
| 142 |
+
|
| 143 |
+
## [16.1.0](https://github.com/motdotla/dotenv/compare/v16.0.3...v16.1.0) (2023-05-30)
|
| 144 |
+
|
| 145 |
+
### Added
|
| 146 |
+
|
| 147 |
+
- Add `populate` convenience method [#733](https://github.com/motdotla/dotenv/pull/733)
|
| 148 |
+
- Accept URL as path option [#720](https://github.com/motdotla/dotenv/pull/720)
|
| 149 |
+
- Add dotenv to `npm fund` command
|
| 150 |
+
- Spanish language README [#698](https://github.com/motdotla/dotenv/pull/698)
|
| 151 |
+
- Add `.env.vault` support. π ([#730](https://github.com/motdotla/dotenv/pull/730))
|
| 152 |
+
|
| 153 |
+
βΉοΈ `.env.vault` extends the `.env` file format standard with a localized encrypted vault file. Package it securely with your production code deploys. It's cloud agnostic so that you can deploy your secrets anywhere βΒ without [risky third-party integrations](https://techcrunch.com/2023/01/05/circleci-breach/). [read more](https://github.com/motdotla/dotenv#-deploying)
|
| 154 |
+
|
| 155 |
+
### Changed
|
| 156 |
+
|
| 157 |
+
- Fixed "cannot resolve 'fs'" error on tools like Replit [#693](https://github.com/motdotla/dotenv/pull/693)
|
| 158 |
+
|
| 159 |
+
## [16.0.3](https://github.com/motdotla/dotenv/compare/v16.0.2...v16.0.3) (2022-09-29)
|
| 160 |
+
|
| 161 |
+
### Changed
|
| 162 |
+
|
| 163 |
+
- Added library version to debug logs ([#682](https://github.com/motdotla/dotenv/pull/682))
|
| 164 |
+
|
| 165 |
+
## [16.0.2](https://github.com/motdotla/dotenv/compare/v16.0.1...v16.0.2) (2022-08-30)
|
| 166 |
+
|
| 167 |
+
### Added
|
| 168 |
+
|
| 169 |
+
- Export `env-options.js` and `cli-options.js` in package.json for use with downstream [dotenv-expand](https://github.com/motdotla/dotenv-expand) module
|
| 170 |
+
|
| 171 |
+
## [16.0.1](https://github.com/motdotla/dotenv/compare/v16.0.0...v16.0.1) (2022-05-10)
|
| 172 |
+
|
| 173 |
+
### Changed
|
| 174 |
+
|
| 175 |
+
- Minor README clarifications
|
| 176 |
+
- Development ONLY: updated devDependencies as recommended for development only security risks ([#658](https://github.com/motdotla/dotenv/pull/658))
|
| 177 |
+
|
| 178 |
+
## [16.0.0](https://github.com/motdotla/dotenv/compare/v15.0.1...v16.0.0) (2022-02-02)
|
| 179 |
+
|
| 180 |
+
### Added
|
| 181 |
+
|
| 182 |
+
- _Breaking:_ Backtick support π ([#615](https://github.com/motdotla/dotenv/pull/615))
|
| 183 |
+
|
| 184 |
+
If you had values containing the backtick character, please quote those values with either single or double quotes.
|
| 185 |
+
|
| 186 |
+
## [15.0.1](https://github.com/motdotla/dotenv/compare/v15.0.0...v15.0.1) (2022-02-02)
|
| 187 |
+
|
| 188 |
+
### Changed
|
| 189 |
+
|
| 190 |
+
- Properly parse empty single or double quoted values π ([#614](https://github.com/motdotla/dotenv/pull/614))
|
| 191 |
+
|
| 192 |
+
## [15.0.0](https://github.com/motdotla/dotenv/compare/v14.3.2...v15.0.0) (2022-01-31)
|
| 193 |
+
|
| 194 |
+
`v15.0.0` is a major new release with some important breaking changes.
|
| 195 |
+
|
| 196 |
+
### Added
|
| 197 |
+
|
| 198 |
+
- _Breaking:_ Multiline parsing support (just works. no need for the flag.)
|
| 199 |
+
|
| 200 |
+
### Changed
|
| 201 |
+
|
| 202 |
+
- _Breaking:_ `#` marks the beginning of a comment (UNLESS the value is wrapped in quotes. Please update your `.env` files to wrap in quotes any values containing `#`. For example: `SECRET_HASH="something-with-a-#-hash"`).
|
| 203 |
+
|
| 204 |
+
..Understandably, (as some teams have noted) this is tedious to do across the entire team. To make it less tedious, we recommend using [dotenv cli](https://github.com/dotenv-org/cli) going forward. It's an optional plugin that will keep your `.env` files in sync between machines, environments, or team members.
|
| 205 |
+
|
| 206 |
+
### Removed
|
| 207 |
+
|
| 208 |
+
- _Breaking:_ Remove multiline option (just works out of the box now. no need for the flag.)
|
| 209 |
+
|
| 210 |
+
## [14.3.2](https://github.com/motdotla/dotenv/compare/v14.3.1...v14.3.2) (2022-01-25)
|
| 211 |
+
|
| 212 |
+
### Changed
|
| 213 |
+
|
| 214 |
+
- Preserve backwards compatibility on values containing `#` π ([#603](https://github.com/motdotla/dotenv/pull/603))
|
| 215 |
+
|
| 216 |
+
## [14.3.1](https://github.com/motdotla/dotenv/compare/v14.3.0...v14.3.1) (2022-01-25)
|
| 217 |
+
|
| 218 |
+
### Changed
|
| 219 |
+
|
| 220 |
+
- Preserve backwards compatibility on exports by re-introducing the prior in-place exports π ([#606](https://github.com/motdotla/dotenv/pull/606))
|
| 221 |
+
|
| 222 |
+
## [14.3.0](https://github.com/motdotla/dotenv/compare/v14.2.0...v14.3.0) (2022-01-24)
|
| 223 |
+
|
| 224 |
+
### Added
|
| 225 |
+
|
| 226 |
+
- Add `multiline` option π ([#486](https://github.com/motdotla/dotenv/pull/486))
|
| 227 |
+
|
| 228 |
+
## [14.2.0](https://github.com/motdotla/dotenv/compare/v14.1.1...v14.2.0) (2022-01-17)
|
| 229 |
+
|
| 230 |
+
### Added
|
| 231 |
+
|
| 232 |
+
- Add `dotenv_config_override` cli option
|
| 233 |
+
- Add `DOTENV_CONFIG_OVERRIDE` command line env option
|
| 234 |
+
|
| 235 |
+
## [14.1.1](https://github.com/motdotla/dotenv/compare/v14.1.0...v14.1.1) (2022-01-17)
|
| 236 |
+
|
| 237 |
+
### Added
|
| 238 |
+
|
| 239 |
+
- Add React gotcha to FAQ on README
|
| 240 |
+
|
| 241 |
+
## [14.1.0](https://github.com/motdotla/dotenv/compare/v14.0.1...v14.1.0) (2022-01-17)
|
| 242 |
+
|
| 243 |
+
### Added
|
| 244 |
+
|
| 245 |
+
- Add `override` option π ([#595](https://github.com/motdotla/dotenv/pull/595))
|
| 246 |
+
|
| 247 |
+
## [14.0.1](https://github.com/motdotla/dotenv/compare/v14.0.0...v14.0.1) (2022-01-16)
|
| 248 |
+
|
| 249 |
+
### Added
|
| 250 |
+
|
| 251 |
+
- Log error on failure to load `.env` file ([#594](https://github.com/motdotla/dotenv/pull/594))
|
| 252 |
+
|
| 253 |
+
## [14.0.0](https://github.com/motdotla/dotenv/compare/v13.0.1...v14.0.0) (2022-01-16)
|
| 254 |
+
|
| 255 |
+
### Added
|
| 256 |
+
|
| 257 |
+
- _Breaking:_ Support inline comments for the parser π ([#568](https://github.com/motdotla/dotenv/pull/568))
|
| 258 |
+
|
| 259 |
+
## [13.0.1](https://github.com/motdotla/dotenv/compare/v13.0.0...v13.0.1) (2022-01-16)
|
| 260 |
+
|
| 261 |
+
### Changed
|
| 262 |
+
|
| 263 |
+
* Hide comments and newlines from debug output ([#404](https://github.com/motdotla/dotenv/pull/404))
|
| 264 |
+
|
| 265 |
+
## [13.0.0](https://github.com/motdotla/dotenv/compare/v12.0.4...v13.0.0) (2022-01-16)
|
| 266 |
+
|
| 267 |
+
### Added
|
| 268 |
+
|
| 269 |
+
* _Breaking:_ Add type file for `config.js` ([#539](https://github.com/motdotla/dotenv/pull/539))
|
| 270 |
+
|
| 271 |
+
## [12.0.4](https://github.com/motdotla/dotenv/compare/v12.0.3...v12.0.4) (2022-01-16)
|
| 272 |
+
|
| 273 |
+
### Changed
|
| 274 |
+
|
| 275 |
+
* README updates
|
| 276 |
+
* Minor order adjustment to package json format
|
| 277 |
+
|
| 278 |
+
## [12.0.3](https://github.com/motdotla/dotenv/compare/v12.0.2...v12.0.3) (2022-01-15)
|
| 279 |
+
|
| 280 |
+
### Changed
|
| 281 |
+
|
| 282 |
+
* Simplified jsdoc for consistency across editors
|
| 283 |
+
|
| 284 |
+
## [12.0.2](https://github.com/motdotla/dotenv/compare/v12.0.1...v12.0.2) (2022-01-15)
|
| 285 |
+
|
| 286 |
+
### Changed
|
| 287 |
+
|
| 288 |
+
* Improve embedded jsdoc type documentation
|
| 289 |
+
|
| 290 |
+
## [12.0.1](https://github.com/motdotla/dotenv/compare/v12.0.0...v12.0.1) (2022-01-15)
|
| 291 |
+
|
| 292 |
+
### Changed
|
| 293 |
+
|
| 294 |
+
* README updates and clarifications
|
| 295 |
+
|
| 296 |
+
## [12.0.0](https://github.com/motdotla/dotenv/compare/v11.0.0...v12.0.0) (2022-01-15)
|
| 297 |
+
|
| 298 |
+
### Removed
|
| 299 |
+
|
| 300 |
+
- _Breaking:_ drop support for Flow static type checker ([#584](https://github.com/motdotla/dotenv/pull/584))
|
| 301 |
+
|
| 302 |
+
### Changed
|
| 303 |
+
|
| 304 |
+
- Move types/index.d.ts to lib/main.d.ts ([#585](https://github.com/motdotla/dotenv/pull/585))
|
| 305 |
+
- Typescript cleanup ([#587](https://github.com/motdotla/dotenv/pull/587))
|
| 306 |
+
- Explicit typescript inclusion in package.json ([#566](https://github.com/motdotla/dotenv/pull/566))
|
| 307 |
+
|
| 308 |
+
## [11.0.0](https://github.com/motdotla/dotenv/compare/v10.0.0...v11.0.0) (2022-01-11)
|
| 309 |
+
|
| 310 |
+
### Changed
|
| 311 |
+
|
| 312 |
+
- _Breaking:_ drop support for Node v10 ([#558](https://github.com/motdotla/dotenv/pull/558))
|
| 313 |
+
- Patch debug option ([#550](https://github.com/motdotla/dotenv/pull/550))
|
| 314 |
+
|
| 315 |
+
## [10.0.0](https://github.com/motdotla/dotenv/compare/v9.0.2...v10.0.0) (2021-05-20)
|
| 316 |
+
|
| 317 |
+
### Added
|
| 318 |
+
|
| 319 |
+
- Add generic support to parse function
|
| 320 |
+
- Allow for import "dotenv/config.js"
|
| 321 |
+
- Add support to resolve home directory in path via ~
|
| 322 |
+
|
| 323 |
+
## [9.0.2](https://github.com/motdotla/dotenv/compare/v9.0.1...v9.0.2) (2021-05-10)
|
| 324 |
+
|
| 325 |
+
### Changed
|
| 326 |
+
|
| 327 |
+
- Support windows newlines with debug mode
|
| 328 |
+
|
| 329 |
+
## [9.0.1](https://github.com/motdotla/dotenv/compare/v9.0.0...v9.0.1) (2021-05-08)
|
| 330 |
+
|
| 331 |
+
### Changed
|
| 332 |
+
|
| 333 |
+
- Updates to README
|
| 334 |
+
|
| 335 |
+
## [9.0.0](https://github.com/motdotla/dotenv/compare/v8.6.0...v9.0.0) (2021-05-05)
|
| 336 |
+
|
| 337 |
+
### Changed
|
| 338 |
+
|
| 339 |
+
- _Breaking:_ drop support for Node v8
|
| 340 |
+
|
| 341 |
+
## [8.6.0](https://github.com/motdotla/dotenv/compare/v8.5.1...v8.6.0) (2021-05-05)
|
| 342 |
+
|
| 343 |
+
### Added
|
| 344 |
+
|
| 345 |
+
- define package.json in exports
|
| 346 |
+
|
| 347 |
+
## [8.5.1](https://github.com/motdotla/dotenv/compare/v8.5.0...v8.5.1) (2021-05-05)
|
| 348 |
+
|
| 349 |
+
### Changed
|
| 350 |
+
|
| 351 |
+
- updated dev dependencies via npm audit
|
| 352 |
+
|
| 353 |
+
## [8.5.0](https://github.com/motdotla/dotenv/compare/v8.4.0...v8.5.0) (2021-05-05)
|
| 354 |
+
|
| 355 |
+
### Added
|
| 356 |
+
|
| 357 |
+
- allow for `import "dotenv/config"`
|
| 358 |
+
|
| 359 |
+
## [8.4.0](https://github.com/motdotla/dotenv/compare/v8.3.0...v8.4.0) (2021-05-05)
|
| 360 |
+
|
| 361 |
+
### Changed
|
| 362 |
+
|
| 363 |
+
- point to exact types file to work with VS Code
|
| 364 |
+
|
| 365 |
+
## [8.3.0](https://github.com/motdotla/dotenv/compare/v8.2.0...v8.3.0) (2021-05-05)
|
| 366 |
+
|
| 367 |
+
### Changed
|
| 368 |
+
|
| 369 |
+
- _Breaking:_ drop support for Node v8 (mistake to be released as minor bump. later bumped to 9.0.0. see above.)
|
| 370 |
+
|
| 371 |
+
## [8.2.0](https://github.com/motdotla/dotenv/compare/v8.1.0...v8.2.0) (2019-10-16)
|
| 372 |
+
|
| 373 |
+
### Added
|
| 374 |
+
|
| 375 |
+
- TypeScript types
|
| 376 |
+
|
| 377 |
+
## [8.1.0](https://github.com/motdotla/dotenv/compare/v8.0.0...v8.1.0) (2019-08-18)
|
| 378 |
+
|
| 379 |
+
### Changed
|
| 380 |
+
|
| 381 |
+
- _Breaking:_ drop support for Node v6 ([#392](https://github.com/motdotla/dotenv/issues/392))
|
| 382 |
+
|
| 383 |
+
# [8.0.0](https://github.com/motdotla/dotenv/compare/v7.0.0...v8.0.0) (2019-05-02)
|
| 384 |
+
|
| 385 |
+
### Changed
|
| 386 |
+
|
| 387 |
+
- _Breaking:_ drop support for Node v6 ([#302](https://github.com/motdotla/dotenv/issues/392))
|
| 388 |
+
|
| 389 |
+
## [7.0.0] - 2019-03-12
|
| 390 |
+
|
| 391 |
+
### Fixed
|
| 392 |
+
|
| 393 |
+
- Fix removing unbalanced quotes ([#376](https://github.com/motdotla/dotenv/pull/376))
|
| 394 |
+
|
| 395 |
+
### Removed
|
| 396 |
+
|
| 397 |
+
- Removed `load` alias for `config` for consistency throughout code and documentation.
|
| 398 |
+
|
| 399 |
+
## [6.2.0] - 2018-12-03
|
| 400 |
+
|
| 401 |
+
### Added
|
| 402 |
+
|
| 403 |
+
- Support preload configuration via environment variables ([#351](https://github.com/motdotla/dotenv/issues/351))
|
| 404 |
+
|
| 405 |
+
## [6.1.0] - 2018-10-08
|
| 406 |
+
|
| 407 |
+
### Added
|
| 408 |
+
|
| 409 |
+
- `debug` option for `config` and `parse` methods will turn on logging
|
| 410 |
+
|
| 411 |
+
## [6.0.0] - 2018-06-02
|
| 412 |
+
|
| 413 |
+
### Changed
|
| 414 |
+
|
| 415 |
+
- _Breaking:_ drop support for Node v4 ([#304](https://github.com/motdotla/dotenv/pull/304))
|
| 416 |
+
|
| 417 |
+
## [5.0.0] - 2018-01-29
|
| 418 |
+
|
| 419 |
+
### Added
|
| 420 |
+
|
| 421 |
+
- Testing against Node v8 and v9
|
| 422 |
+
- Documentation on trim behavior of values
|
| 423 |
+
- Documentation on how to use with `import`
|
| 424 |
+
|
| 425 |
+
### Changed
|
| 426 |
+
|
| 427 |
+
- _Breaking_: default `path` is now `path.resolve(process.cwd(), '.env')`
|
| 428 |
+
- _Breaking_: does not write over keys already in `process.env` if the key has a falsy value
|
| 429 |
+
- using `const` and `let` instead of `var`
|
| 430 |
+
|
| 431 |
+
### Removed
|
| 432 |
+
|
| 433 |
+
- Testing against Node v7
|
| 434 |
+
|
| 435 |
+
## [4.0.0] - 2016-12-23
|
| 436 |
+
|
| 437 |
+
### Changed
|
| 438 |
+
|
| 439 |
+
- Return Object with parsed content or error instead of false ([#165](https://github.com/motdotla/dotenv/pull/165)).
|
| 440 |
+
|
| 441 |
+
### Removed
|
| 442 |
+
|
| 443 |
+
- `verbose` option removed in favor of returning result.
|
| 444 |
+
|
| 445 |
+
## [3.0.0] - 2016-12-20
|
| 446 |
+
|
| 447 |
+
### Added
|
| 448 |
+
|
| 449 |
+
- `verbose` option will log any error messages. Off by default.
|
| 450 |
+
- parses email addresses correctly
|
| 451 |
+
- allow importing config method directly in ES6
|
| 452 |
+
|
| 453 |
+
### Changed
|
| 454 |
+
|
| 455 |
+
- Suppress error messages by default ([#154](https://github.com/motdotla/dotenv/pull/154))
|
| 456 |
+
- Ignoring more files for NPM to make package download smaller
|
| 457 |
+
|
| 458 |
+
### Fixed
|
| 459 |
+
|
| 460 |
+
- False positive test due to case-sensitive variable ([#124](https://github.com/motdotla/dotenv/pull/124))
|
| 461 |
+
|
| 462 |
+
### Removed
|
| 463 |
+
|
| 464 |
+
- `silent` option removed in favor of `verbose`
|
| 465 |
+
|
| 466 |
+
## [2.0.0] - 2016-01-20
|
| 467 |
+
|
| 468 |
+
### Added
|
| 469 |
+
|
| 470 |
+
- CHANGELOG to ["make it easier for users and contributors to see precisely what notable changes have been made between each release"](http://keepachangelog.com/). Linked to from README
|
| 471 |
+
- LICENSE to be more explicit about what was defined in `package.json`. Linked to from README
|
| 472 |
+
- Testing nodejs v4 on travis-ci
|
| 473 |
+
- added examples of how to use dotenv in different ways
|
| 474 |
+
- return parsed object on success rather than boolean true
|
| 475 |
+
|
| 476 |
+
### Changed
|
| 477 |
+
|
| 478 |
+
- README has shorter description not referencing ruby gem since we don't have or want feature parity
|
| 479 |
+
|
| 480 |
+
### Removed
|
| 481 |
+
|
| 482 |
+
- Variable expansion and escaping so environment variables are encouraged to be fully orthogonal
|
| 483 |
+
|
| 484 |
+
## [1.2.0] - 2015-06-20
|
| 485 |
+
|
| 486 |
+
### Added
|
| 487 |
+
|
| 488 |
+
- Preload hook to require dotenv without including it in your code
|
| 489 |
+
|
| 490 |
+
### Changed
|
| 491 |
+
|
| 492 |
+
- clarified license to be "BSD-2-Clause" in `package.json`
|
| 493 |
+
|
| 494 |
+
### Fixed
|
| 495 |
+
|
| 496 |
+
- retain spaces in string vars
|
| 497 |
+
|
| 498 |
+
## [1.1.0] - 2015-03-31
|
| 499 |
+
|
| 500 |
+
### Added
|
| 501 |
+
|
| 502 |
+
- Silent option to silence `console.log` when `.env` missing
|
| 503 |
+
|
| 504 |
+
## [1.0.0] - 2015-03-13
|
| 505 |
+
|
| 506 |
+
### Removed
|
| 507 |
+
|
| 508 |
+
- support for multiple `.env` files. should always use one `.env` file for the current environment
|
| 509 |
+
|
| 510 |
+
[7.0.0]: https://github.com/motdotla/dotenv/compare/v6.2.0...v7.0.0
|
| 511 |
+
[6.2.0]: https://github.com/motdotla/dotenv/compare/v6.1.0...v6.2.0
|
| 512 |
+
[6.1.0]: https://github.com/motdotla/dotenv/compare/v6.0.0...v6.1.0
|
| 513 |
+
[6.0.0]: https://github.com/motdotla/dotenv/compare/v5.0.0...v6.0.0
|
| 514 |
+
[5.0.0]: https://github.com/motdotla/dotenv/compare/v4.0.0...v5.0.0
|
| 515 |
+
[4.0.0]: https://github.com/motdotla/dotenv/compare/v3.0.0...v4.0.0
|
| 516 |
+
[3.0.0]: https://github.com/motdotla/dotenv/compare/v2.0.0...v3.0.0
|
| 517 |
+
[2.0.0]: https://github.com/motdotla/dotenv/compare/v1.2.0...v2.0.0
|
| 518 |
+
[1.2.0]: https://github.com/motdotla/dotenv/compare/v1.1.0...v1.2.0
|
| 519 |
+
[1.1.0]: https://github.com/motdotla/dotenv/compare/v1.0.0...v1.1.0
|
| 520 |
+
[1.0.0]: https://github.com/motdotla/dotenv/compare/v0.4.0...v1.0.0
|
backend/node_modules/dotenv/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2015, Scott Motte
|
| 2 |
+
All rights reserved.
|
| 3 |
+
|
| 4 |
+
Redistribution and use in source and binary forms, with or without
|
| 5 |
+
modification, are permitted provided that the following conditions are met:
|
| 6 |
+
|
| 7 |
+
* Redistributions of source code must retain the above copyright notice, this
|
| 8 |
+
list of conditions and the following disclaimer.
|
| 9 |
+
|
| 10 |
+
* Redistributions in binary form must reproduce the above copyright notice,
|
| 11 |
+
this list of conditions and the following disclaimer in the documentation
|
| 12 |
+
and/or other materials provided with the distribution.
|
| 13 |
+
|
| 14 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
| 15 |
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| 16 |
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 17 |
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
| 18 |
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
| 19 |
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
| 20 |
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
| 21 |
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 22 |
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 23 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
backend/node_modules/dotenv/README-es.md
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
| 11 |
+
<a href="https://github.com/sponsors/motdotla">Dotenv es apoyado por la comunidad.</a>
|
| 12 |
+
</sup>
|
| 13 |
+
</p>
|
| 14 |
+
<sup>Gracias espaciales a:</sup>
|
| 15 |
+
<br>
|
| 16 |
+
<br>
|
| 17 |
+
|
| 18 |
+
<a href="https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=dotenv"><img src="https://res.cloudinary.com/dotenv-org/image/upload/v1744035073/graphite_lgsrl8.gif" width="240" alt="Graphite" /></a>
|
| 19 |
+
|
| 20 |
+
<a href="https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=dotenv">
|
| 21 |
+
<b>Graphite is the AI developer productivity platform helping teams on GitHub ship higher quality software, faster.</b>
|
| 22 |
+
</a>
|
| 23 |
+
<hr>
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
# dotenv [](https://www.npmjs.com/package/dotenv)
|
| 27 |
+
|
| 28 |
+
<img src="https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.svg" alt="dotenv" align="right" width="200" />
|
| 29 |
+
|
| 30 |
+
Dotenv es un mΓ³dulo de dependencia cero que carga las variables de entorno desde un archivo `.env` en [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). El almacenamiento de la configuraciΓ³n del entorno separado del cΓ³digo estΓ‘ basado en la metodologΓa [The Twelve-Factor App](http://12factor.net/config).
|
| 31 |
+
|
| 32 |
+
[](https://github.com/feross/standard)
|
| 33 |
+
[](LICENSE)
|
| 34 |
+
|
| 35 |
+
## InstalaciΓ³n
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
# instalaciΓ³n local (recomendado)
|
| 39 |
+
npm install dotenv --save
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
O installaciΓ³n con yarn? `yarn add dotenv`
|
| 43 |
+
|
| 44 |
+
## Uso
|
| 45 |
+
|
| 46 |
+
Cree un archivo `.env` en la raΓz de su proyecto:
|
| 47 |
+
|
| 48 |
+
```dosini
|
| 49 |
+
S3_BUCKET="YOURS3BUCKET"
|
| 50 |
+
SECRET_KEY="YOURSECRETKEYGOESHERE"
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
Tan prΓ³nto como sea posible en su aplicaciΓ³n, importe y configure dotenv:
|
| 54 |
+
|
| 55 |
+
```javascript
|
| 56 |
+
require('dotenv').config()
|
| 57 |
+
console.log(process.env) // elimine esto despuΓ©s que haya confirmado que esta funcionando
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
.. o usa ES6?
|
| 61 |
+
|
| 62 |
+
```javascript
|
| 63 |
+
import * as dotenv from 'dotenv' // vea en https://github.com/motdotla/dotenv#como-uso-dotenv-con-import
|
| 64 |
+
// REVISAR LINK DE REFERENCIA DE IMPORTACIΓN
|
| 65 |
+
dotenv.config()
|
| 66 |
+
import express from 'express'
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
Eso es todo. `process.env` ahora tiene las claves y los valores que definiste en tu archivo `.env`:
|
| 70 |
+
|
| 71 |
+
```javascript
|
| 72 |
+
require('dotenv').config()
|
| 73 |
+
|
| 74 |
+
...
|
| 75 |
+
|
| 76 |
+
s3.getBucketCors({Bucket: process.env.S3_BUCKET}, function(err, data) {})
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
### Valores multilΓnea
|
| 80 |
+
|
| 81 |
+
Si necesita variables de varias lΓneas, por ejemplo, claves privadas, ahora se admiten en la versiΓ³n (`>= v15.0.0`) con saltos de lΓnea:
|
| 82 |
+
|
| 83 |
+
```dosini
|
| 84 |
+
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
|
| 85 |
+
...
|
| 86 |
+
Kh9NV...
|
| 87 |
+
...
|
| 88 |
+
-----END RSA PRIVATE KEY-----"
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
Alternativamente, puede usar comillas dobles y usar el carΓ‘cter `\n`:
|
| 92 |
+
|
| 93 |
+
```dosini
|
| 94 |
+
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nKh9NV...\n-----END RSA PRIVATE KEY-----\n"
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
### Comentarios
|
| 98 |
+
|
| 99 |
+
Los comentarios pueden ser agregados en tu archivo o en la misma lΓnea:
|
| 100 |
+
|
| 101 |
+
```dosini
|
| 102 |
+
# This is a comment
|
| 103 |
+
SECRET_KEY=YOURSECRETKEYGOESHERE # comment
|
| 104 |
+
SECRET_HASH="something-with-a-#-hash"
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
Los comentarios comienzan donde existe un `#`, entonces, si su valor contiene un `#`, enciΓ©rrelo entre comillas. Este es un cambio importante desde la versiΓ³n `>= v15.0.0` en adelante.
|
| 108 |
+
|
| 109 |
+
### AnΓ‘lisis
|
| 110 |
+
|
| 111 |
+
El motor que analiza el contenido de su archivo que contiene variables de entorno estΓ‘ disponible para su uso. Este Acepta una Cadena o un BΓΊfer y devolverΓ‘ un Objeto con las claves y los valores analizados.
|
| 112 |
+
|
| 113 |
+
```javascript
|
| 114 |
+
const dotenv = require('dotenv')
|
| 115 |
+
const buf = Buffer.from('BASICO=basico')
|
| 116 |
+
const config = dotenv.parse(buf) // devolverΓ‘ un objeto
|
| 117 |
+
console.log(typeof config, config) // objeto { BASICO : 'basico' }
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
### Precarga
|
| 121 |
+
|
| 122 |
+
Puede usar el `--require` (`-r`) [opciΓ³n de lΓnea de comando](https://nodejs.org/api/cli.html#-r---require-module) para precargar dotenv. Al hacer esto, no necesita requerir ni cargar dotnev en el cΓ³digo de su aplicaciΓ³n.
|
| 123 |
+
|
| 124 |
+
```bash
|
| 125 |
+
$ node -r dotenv/config tu_script.js
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
Las opciones de configuraciΓ³n a continuaciΓ³n se admiten como argumentos de lΓnea de comandos en el formato `dotenv_config_<option>=value`
|
| 129 |
+
|
| 130 |
+
```bash
|
| 131 |
+
$ node -r dotenv/config tu_script.js dotenv_config_path=/custom/path/to/.env dotenv_config_debug=true
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
AdemΓ‘s, puede usar variables de entorno para establecer opciones de configuraciΓ³n. Los argumentos de lΓnea de comandos precederΓ‘n a estos.
|
| 135 |
+
|
| 136 |
+
```bash
|
| 137 |
+
$ DOTENV_CONFIG_<OPTION>=value node -r dotenv/config tu_script.js
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
```bash
|
| 141 |
+
$ DOTENV_CONFIG_ENCODING=latin1 DOTENV_CONFIG_DEBUG=true node -r dotenv/config tu_script.js dotenv_config_path=/custom/path/to/.env
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
### ExpansiΓ³n Variable
|
| 145 |
+
|
| 146 |
+
Necesitaras agregar el valor de otro variable en una de sus variables? Usa [dotenv-expand](https://github.com/motdotla/dotenv-expand).
|
| 147 |
+
|
| 148 |
+
## Ejemplos
|
| 149 |
+
|
| 150 |
+
Vea [ejemplos](https://github.com/dotenv-org/examples) sobre el uso de dotenv con varios frameworks, lenguajes y configuraciones.
|
| 151 |
+
|
| 152 |
+
* [nodejs](https://github.com/dotenv-org/examples/tree/master/dotenv-nodejs)
|
| 153 |
+
* [nodejs (depurar en)](https://github.com/dotenv-org/examples/tree/master/dotenv-nodejs-debug)
|
| 154 |
+
* [nodejs (anular en)](https://github.com/dotenv-org/examples/tree/master/dotenv-nodejs-override)
|
| 155 |
+
* [esm](https://github.com/dotenv-org/examples/tree/master/dotenv-esm)
|
| 156 |
+
* [esm (precarga)](https://github.com/dotenv-org/examples/tree/master/dotenv-esm-preload)
|
| 157 |
+
* [typescript](https://github.com/dotenv-org/examples/tree/master/dotenv-typescript)
|
| 158 |
+
* [typescript parse](https://github.com/dotenv-org/examples/tree/master/dotenv-typescript-parse)
|
| 159 |
+
* [typescript config](https://github.com/dotenv-org/examples/tree/master/dotenv-typescript-config)
|
| 160 |
+
* [webpack](https://github.com/dotenv-org/examples/tree/master/dotenv-webpack)
|
| 161 |
+
* [webpack (plugin)](https://github.com/dotenv-org/examples/tree/master/dotenv-webpack2)
|
| 162 |
+
* [react](https://github.com/dotenv-org/examples/tree/master/dotenv-react)
|
| 163 |
+
* [react (typescript)](https://github.com/dotenv-org/examples/tree/master/dotenv-react-typescript)
|
| 164 |
+
* [express](https://github.com/dotenv-org/examples/tree/master/dotenv-express)
|
| 165 |
+
* [nestjs](https://github.com/dotenv-org/examples/tree/master/dotenv-nestjs)
|
| 166 |
+
|
| 167 |
+
## DocumentaciΓ³n
|
| 168 |
+
|
| 169 |
+
Dotenv expone dos funciones:
|
| 170 |
+
|
| 171 |
+
* `configuraciΓ³n`
|
| 172 |
+
* `analizar`
|
| 173 |
+
|
| 174 |
+
### ConfiguraciΓ³n
|
| 175 |
+
|
| 176 |
+
`ConfiguraciΓ³n` leerΓ‘ su archivo `.env`, analizarΓ‘ el contenido, lo asignarΓ‘ a [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env),
|
| 177 |
+
y devolverΓ‘ un Objeto con una clave `parsed` que contiene el contenido cargado o una clave `error` si falla.
|
| 178 |
+
|
| 179 |
+
```js
|
| 180 |
+
const result = dotenv.config()
|
| 181 |
+
|
| 182 |
+
if (result.error) {
|
| 183 |
+
throw result.error
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
console.log(result.parsed)
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
Adicionalmente, puede pasar opciones a `configuracion`.
|
| 190 |
+
|
| 191 |
+
#### Opciones
|
| 192 |
+
|
| 193 |
+
##### Ruta
|
| 194 |
+
|
| 195 |
+
Por defecto: `path.resolve(process.cwd(), '.env')`
|
| 196 |
+
|
| 197 |
+
Especifique una ruta personalizada si el archivo que contiene las variables de entorno se encuentra localizado en otro lugar.
|
| 198 |
+
|
| 199 |
+
```js
|
| 200 |
+
require('dotenv').config({ path: '/personalizado/ruta/a/.env' })
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
##### CodificaciΓ³n
|
| 204 |
+
|
| 205 |
+
Por defecto: `utf8`
|
| 206 |
+
|
| 207 |
+
Especifique la codificaciΓ³n del archivo que contiene las variables de entorno.
|
| 208 |
+
|
| 209 |
+
```js
|
| 210 |
+
require('dotenv').config({ encoding: 'latin1' })
|
| 211 |
+
```
|
| 212 |
+
|
| 213 |
+
##### Depurar
|
| 214 |
+
|
| 215 |
+
Por defecto: `false`
|
| 216 |
+
|
| 217 |
+
Active el registro de ayuda para depurar por quΓ© ciertas claves o valores no se inician como lo esperabas.
|
| 218 |
+
|
| 219 |
+
```js
|
| 220 |
+
require('dotenv').config({ debug: process.env.DEBUG })
|
| 221 |
+
```
|
| 222 |
+
|
| 223 |
+
##### Anular
|
| 224 |
+
|
| 225 |
+
Por defecto: `false`
|
| 226 |
+
|
| 227 |
+
Anule cualquier variable de entorno que ya se haya configurada en su maquina con los valores de su archivo .env.
|
| 228 |
+
|
| 229 |
+
```js
|
| 230 |
+
require('dotenv').config({ override: true })
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
### Analizar
|
| 234 |
+
|
| 235 |
+
El motor que analiza el contenido del archivo que contiene las variables de entorno estΓ‘ disponible para su uso. Acepta una Cadena o un BΓΊfer y retornarΓ‘ un objecto con los valores analizados.
|
| 236 |
+
|
| 237 |
+
```js
|
| 238 |
+
const dotenv = require('dotenv')
|
| 239 |
+
const buf = Buffer.from('BASICO=basico')
|
| 240 |
+
const config = dotenv.parse(buf) // devolverΓ‘ un objeto
|
| 241 |
+
console.log(typeof config, config) // objeto { BASICO : 'basico' }
|
| 242 |
+
```
|
| 243 |
+
|
| 244 |
+
#### Opciones
|
| 245 |
+
|
| 246 |
+
##### Depurar
|
| 247 |
+
|
| 248 |
+
Por defecto: `false`
|
| 249 |
+
|
| 250 |
+
Active el registro de ayuda para depurar por quΓ© ciertas claves o valores no se inician como lo esperabas.
|
| 251 |
+
|
| 252 |
+
```js
|
| 253 |
+
const dotenv = require('dotenv')
|
| 254 |
+
const buf = Buffer.from('hola mundo')
|
| 255 |
+
const opt = { debug: true }
|
| 256 |
+
const config = dotenv.parse(buf, opt)
|
| 257 |
+
// espere por un mensaje de depuraciΓ³n porque el bΓΊfer no esta listo KEY=VAL
|
| 258 |
+
```
|
| 259 |
+
|
| 260 |
+
## FAQ
|
| 261 |
+
|
| 262 |
+
### ΒΏPor quΓ© el archivo `.env` no carga mis variables de entorno correctamente?
|
| 263 |
+
|
| 264 |
+
Lo mΓ‘s probable es que su archivo `.env` no estΓ© en el lugar correcto. [Vea este stack overflow](https://stackoverflow.com/questions/42335016/dotenv-file-is-not-loading-environment-variables).
|
| 265 |
+
|
| 266 |
+
Active el modo de depuraciΓ³n y vuelva a intentarlo...
|
| 267 |
+
|
| 268 |
+
```js
|
| 269 |
+
require('dotenv').config({ debug: true })
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
RecibirΓ‘ un error apropiado en su consola.
|
| 273 |
+
|
| 274 |
+
### ΒΏDebo confirmar mi archivo `.env`?
|
| 275 |
+
|
| 276 |
+
No. Recomendamos **enfΓ‘ticamente** no enviar su archivo `.env` a la versiΓ³n de control. Solo debe incluir los valores especificos del entorno, como la base de datos, contraseΓ±as o claves API.
|
| 277 |
+
|
| 278 |
+
### ΒΏDeberΓa tener multiples archivos `.env`?
|
| 279 |
+
|
| 280 |
+
No. Recomendamos **enfΓ‘ticamente** no tener un archivo `.env` "principal" y un archivo `.env` de "entorno" como `.env.test`. Su configuraciΓ³n debe variar entre implementaciones y no debe compartir valores entre entornos.
|
| 281 |
+
|
| 282 |
+
> En una AplicaciΓ³n de Doce Factores, las variables de entorno son controles diferenciados, cada uno totalmente independiente a otras variables de entorno. Nunca se agrupan como "entornos", sino que se gestionan de manera independiente para cada despliegue. Este es un modelo que se escala sin problemas a medida que la aplicaciΓ³n se expande de forma natural en mΓ‘s despliegues a lo largo de su vida.
|
| 283 |
+
>
|
| 284 |
+
> β [La ApliaciΓ³n de los Doce Factores](https://12factor.net/es/)
|
| 285 |
+
|
| 286 |
+
### ΒΏQuΓ© reglas sigue el motor de anΓ‘lisis?
|
| 287 |
+
|
| 288 |
+
El motor de anΓ‘lisis actualmente admite las siguientes reglas:
|
| 289 |
+
|
| 290 |
+
- `BASICO=basico` se convierte en `{BASICO: 'basico'}`
|
| 291 |
+
- las lΓneas vacΓas se saltan
|
| 292 |
+
- las lΓneas que comienzan con `#` se tratan como comentarios
|
| 293 |
+
- `#` marca el comienzo de un comentario (a menos que el valor estΓ© entre comillas)
|
| 294 |
+
- valores vacΓos se convierten en cadenas vacΓas (`VACIO=` se convierte en `{VACIO: ''}`)
|
| 295 |
+
- las comillas internas se mantienen (piensa en JSON) (`JSON={"foo": "bar"}` se convierte en `{JSON:"{\"foo\": \"bar\"}"`)
|
| 296 |
+
- los espacios en blanco se eliminan de ambos extremos de los valores no citanos (aprende mΓ‘s en [`trim`](https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)) (`FOO= algo ` se convierte en `{FOO: 'algo'}`)
|
| 297 |
+
- los valores entre comillas simples y dobles se escapan (`CITA_SIMPLE='citado'` se convierte en `{CITA_SIMPLE: "citado"}`)
|
| 298 |
+
- los valores entre comillas simples y dobles mantienen los espacios en blanco en ambos extremos (`FOO=" algo "` se convierte en `{FOO: ' algo '}`)
|
| 299 |
+
- los valores entre comillas dobles expanden nuevas lΓneas (`MULTILINEA="nueva\nlΓnea"` se convierte en
|
| 300 |
+
|
| 301 |
+
```
|
| 302 |
+
{MULTILINEA: 'nueva
|
| 303 |
+
lΓnea'}
|
| 304 |
+
```
|
| 305 |
+
|
| 306 |
+
- se admite la comilla simple invertida (`` SIGNO_ACENTO=`Esto tiene comillas 'simples' y "dobles" en su interior.` ``)
|
| 307 |
+
|
| 308 |
+
### ΒΏQuΓ© sucede con las variables de entorno que ya estaban configuradas?
|
| 309 |
+
|
| 310 |
+
Por defecto, nunca modificaremos ninguna variable de entorno que ya haya sido establecida. En particular, si hay una variable en su archivo `.env` que colisiona con una que ya existe en su entorno, entonces esa variable se omitirΓ‘.
|
| 311 |
+
|
| 312 |
+
Si por el contrario, quieres anular `process.env` utiliza la opciΓ³n `override`.
|
| 313 |
+
|
| 314 |
+
```javascript
|
| 315 |
+
require('dotenv').config({ override: true })
|
| 316 |
+
```
|
| 317 |
+
|
| 318 |
+
### ΒΏPor quΓ© mis variables de entorno no aparecen para React?
|
| 319 |
+
|
| 320 |
+
Su cΓ³digo React se ejecuta en Webpack, donde el mΓ³dulo `fs` o incluso el propio `process` global no son accesibles fuera-de-la-caja. El mΓ³dulo `process.env` sΓ³lo puede ser inyectado a travΓ©s de la configuraciΓ³n de Webpack.
|
| 321 |
+
|
| 322 |
+
Si estΓ‘s usando [`react-scripts`](https://www.npmjs.com/package/react-scripts), el cual se distribuye a travΓ©s de [`create-react-app`](https://create-react-app.dev/), tiene dotenv incorporado pero con una singularidad. Escriba sus variables de entorno con `REACT_APP_`. Vea [este stack overflow](https://stackoverflow.com/questions/42182577/is-it-possible-to-use-dotenv-in-a-react-project) para mΓ‘s detalles.
|
| 323 |
+
|
| 324 |
+
Si estΓ‘s utilizando otros frameworks (por ejemplo, Next.js, Gatsby...), debes consultar su documentaciΓ³n para saber cΓ³mo injectar variables de entorno en el cliente.
|
| 325 |
+
|
| 326 |
+
### ΒΏPuedo personalizar/escribir plugins para dotenv?
|
| 327 |
+
|
| 328 |
+
SΓ! `dotenv.config()` devuelve un objeto que representa el archivo `.env` analizado. Esto te da todo lo que necesitas para poder establecer valores en `process.env`. Por ejemplo:
|
| 329 |
+
|
| 330 |
+
```js
|
| 331 |
+
const dotenv = require('dotenv')
|
| 332 |
+
const variableExpansion = require('dotenv-expand')
|
| 333 |
+
const miEnv = dotenv.config()
|
| 334 |
+
variableExpansion(miEnv)
|
| 335 |
+
```
|
| 336 |
+
|
| 337 |
+
### CΓ³mo uso dotnev con `import`?
|
| 338 |
+
|
| 339 |
+
Simplemente..
|
| 340 |
+
|
| 341 |
+
```javascript
|
| 342 |
+
// index.mjs (ESM)
|
| 343 |
+
import * as dotenv from 'dotenv' // vea https://github.com/motdotla/dotenv#como-uso-dotenv-con-import
|
| 344 |
+
dotenv.config()
|
| 345 |
+
import express from 'express'
|
| 346 |
+
```
|
| 347 |
+
|
| 348 |
+
Un poco de historia...
|
| 349 |
+
|
| 350 |
+
> Cuando se ejecuta un mΓ³dulo que contiene una sentencia `import`, los mΓ³dulos que importa serΓ‘n cargados primero, y luego se ejecuta cada bloque del mΓ³dulo en un recorrido en profundidad del grΓ‘fico de dependencias, evitando los ciclos al saltarse todo lo que ya se ha ejecutado.
|
| 351 |
+
>
|
| 352 |
+
> β [ES6 en Profundidad: MΓ³dulos](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/)
|
| 353 |
+
|
| 354 |
+
ΒΏQuΓ© significa esto en lenguaje sencillo? Significa que se podrΓas pensar que lo siguiente funcionarΓa pero no lo harΓ‘.
|
| 355 |
+
|
| 356 |
+
```js
|
| 357 |
+
// notificarError.mjs
|
| 358 |
+
import { Cliente } from 'mejor-servicio-para-notificar-error'
|
| 359 |
+
|
| 360 |
+
export default new Client(process.env.CLAVE_API)
|
| 361 |
+
|
| 362 |
+
// index.mjs
|
| 363 |
+
import dotenv from 'dotenv'
|
| 364 |
+
dotenv.config()
|
| 365 |
+
|
| 366 |
+
import notificarError from './notificarError.mjs'
|
| 367 |
+
notificarError.report(new Error('ejemplo documentado'))
|
| 368 |
+
```
|
| 369 |
+
|
| 370 |
+
`process.env.CLAVE_API` serΓ‘ vacio.
|
| 371 |
+
|
| 372 |
+
En su lugar, el cΓ³digo anterior debe ser escrito como...
|
| 373 |
+
|
| 374 |
+
```js
|
| 375 |
+
// notificarError.mjs
|
| 376 |
+
import { Cliente } from 'mejor-servicio-para-notificar-errores'
|
| 377 |
+
|
| 378 |
+
export default new Client(process.env.CLAVE_API)
|
| 379 |
+
|
| 380 |
+
// index.mjs
|
| 381 |
+
import * as dotenv from 'dotenv'
|
| 382 |
+
dotenv.config()
|
| 383 |
+
|
| 384 |
+
import notificarError from './notificarError.mjs'
|
| 385 |
+
notificarError.report(new Error('ejemplo documentado'))
|
| 386 |
+
```
|
| 387 |
+
|
| 388 |
+
ΒΏEsto tiene algo de sentido? Esto es poco poco intuitivo, pero es como funciona la importaciΓ³n de mΓ³dulos en ES6. AquΓ hay un ejemplo [ejemplo prΓ‘ctico de esta trampa](https://github.com/dotenv-org/examples/tree/master/dotenv-es6-import-pitfall).
|
| 389 |
+
|
| 390 |
+
Existen dos arternativas a este planteamiento:
|
| 391 |
+
|
| 392 |
+
1. Precarga dotenv: `node --require dotenv/config index.js` (_Nota: no es necesario usar `import` dotenv con este mΓ©todo_)
|
| 393 |
+
2. Cree un archivo separado que ejecutarΓ‘ `config` primero como se describe en [este comentario #133](https://github.com/motdotla/dotenv/issues/133#issuecomment-255298822)
|
| 394 |
+
|
| 395 |
+
### ΒΏQuΓ© pasa con la expansiΓ³n de variable?
|
| 396 |
+
|
| 397 |
+
Prueba [dotenv-expand](https://github.com/motdotla/dotenv-expand)
|
| 398 |
+
|
| 399 |
+
## GuΓa de contribuciΓ³n
|
| 400 |
+
|
| 401 |
+
Vea [CONTRIBUTING.md](CONTRIBUTING.md)
|
| 402 |
+
|
| 403 |
+
## REGISTRO DE CAMBIOS
|
| 404 |
+
|
| 405 |
+
Vea [CHANGELOG.md](CHANGELOG.md)
|
| 406 |
+
|
| 407 |
+
## ΒΏQuiΓ©nes utilizan dotenv?
|
| 408 |
+
|
| 409 |
+
[Estos mΓ³dulos npm dependen de Γ©l.](https://www.npmjs.com/browse/depended/dotenv)
|
| 410 |
+
|
| 411 |
+
Los proyectos que lo amplΓan suelen utilizar la [palabra clave "dotenv" en npm](https://www.npmjs.com/search?q=keywords:dotenv).
|
backend/node_modules/dotenv/README.md
ADDED
|
@@ -0,0 +1,645 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
π announcing <a href="https://github.com/dotenvx/dotenvx">dotenvx</a>. <em>run anywhere, multi-environment, encrypted envs</em>.
|
| 3 |
+
</div>
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
<div align="center">
|
| 8 |
+
|
| 9 |
+
**Special thanks to [our sponsors](https://github.com/sponsors/motdotla)**
|
| 10 |
+
|
| 11 |
+
<br>
|
| 12 |
+
<a href="https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=dotenv"><img src="https://res.cloudinary.com/dotenv-org/image/upload/v1744035073/graphite_lgsrl8.gif" width="240" alt="Graphite" /></a>
|
| 13 |
+
<br>
|
| 14 |
+
<a href="https://graphite.dev/?utm_source=github&utm_medium=repo&utm_campaign=dotenv">
|
| 15 |
+
<b>Graphite is the AI developer productivity platform helping teams on GitHub ship higher quality software, faster.</b>
|
| 16 |
+
</a>
|
| 17 |
+
<hr>
|
| 18 |
+
</div>
|
| 19 |
+
|
| 20 |
+
# dotenv [](https://www.npmjs.com/package/dotenv)
|
| 21 |
+
|
| 22 |
+
<img src="https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.svg" alt="dotenv" align="right" width="200" />
|
| 23 |
+
|
| 24 |
+
Dotenv is a zero-dependency module that loads environment variables from a `.env` file into [`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env). Storing configuration in the environment separate from code is based on [The Twelve-Factor App](https://12factor.net/config) methodology.
|
| 25 |
+
|
| 26 |
+
[](https://github.com/feross/standard)
|
| 27 |
+
[](LICENSE)
|
| 28 |
+
[](https://codecov.io/gh/motdotla/dotenv-expand)
|
| 29 |
+
|
| 30 |
+
* [π± Install](#-install)
|
| 31 |
+
* [ποΈ Usage (.env)](#%EF%B8%8F-usage)
|
| 32 |
+
* [π΄ Multiple Environments π](#-manage-multiple-environments)
|
| 33 |
+
* [π Deploying (encryption) π](#-deploying)
|
| 34 |
+
* [π Examples](#-examples)
|
| 35 |
+
* [π Docs](#-documentation)
|
| 36 |
+
* [β FAQ](#-faq)
|
| 37 |
+
* [β±οΈ Changelog](./CHANGELOG.md)
|
| 38 |
+
|
| 39 |
+
## π± Install
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
npm install dotenv --save
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
You can also use an npm-compatible package manager like yarn, bun or pnpm:
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
yarn add dotenv
|
| 49 |
+
```
|
| 50 |
+
```bash
|
| 51 |
+
bun add dotenv
|
| 52 |
+
```
|
| 53 |
+
```bash
|
| 54 |
+
pnpm add dotenv
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## ποΈ Usage
|
| 58 |
+
|
| 59 |
+
<a href="https://www.youtube.com/watch?v=YtkZR0NFd1g">
|
| 60 |
+
<div align="right">
|
| 61 |
+
<img src="https://img.youtube.com/vi/YtkZR0NFd1g/hqdefault.jpg" alt="how to use dotenv video tutorial" align="right" width="330" />
|
| 62 |
+
<img src="https://simpleicons.vercel.app/youtube/ff0000" alt="youtube/@dotenvorg" align="right" width="24" />
|
| 63 |
+
</div>
|
| 64 |
+
</a>
|
| 65 |
+
|
| 66 |
+
Create a `.env` file in the root of your project (if using a monorepo structure like `apps/backend/app.js`, put it in the root of the folder where your `app.js` process runs):
|
| 67 |
+
|
| 68 |
+
```dosini
|
| 69 |
+
S3_BUCKET="YOURS3BUCKET"
|
| 70 |
+
SECRET_KEY="YOURSECRETKEYGOESHERE"
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
As early as possible in your application, import and configure dotenv:
|
| 74 |
+
|
| 75 |
+
```javascript
|
| 76 |
+
require('dotenv').config()
|
| 77 |
+
console.log(process.env) // remove this after you've confirmed it is working
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
.. [or using ES6?](#how-do-i-use-dotenv-with-import)
|
| 81 |
+
|
| 82 |
+
```javascript
|
| 83 |
+
import 'dotenv/config'
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
That's it. `process.env` now has the keys and values you defined in your `.env` file:
|
| 87 |
+
|
| 88 |
+
```javascript
|
| 89 |
+
require('dotenv').config()
|
| 90 |
+
// or import 'dotenv/config' if you're using ES6
|
| 91 |
+
|
| 92 |
+
...
|
| 93 |
+
|
| 94 |
+
s3.getBucketCors({Bucket: process.env.S3_BUCKET}, function(err, data) {})
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
### Multiline values
|
| 98 |
+
|
| 99 |
+
If you need multiline variables, for example private keys, those are now supported (`>= v15.0.0`) with line breaks:
|
| 100 |
+
|
| 101 |
+
```dosini
|
| 102 |
+
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
|
| 103 |
+
...
|
| 104 |
+
Kh9NV...
|
| 105 |
+
...
|
| 106 |
+
-----END RSA PRIVATE KEY-----"
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
Alternatively, you can double quote strings and use the `\n` character:
|
| 110 |
+
|
| 111 |
+
```dosini
|
| 112 |
+
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nKh9NV...\n-----END RSA PRIVATE KEY-----\n"
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
### Comments
|
| 116 |
+
|
| 117 |
+
Comments may be added to your file on their own line or inline:
|
| 118 |
+
|
| 119 |
+
```dosini
|
| 120 |
+
# This is a comment
|
| 121 |
+
SECRET_KEY=YOURSECRETKEYGOESHERE # comment
|
| 122 |
+
SECRET_HASH="something-with-a-#-hash"
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
Comments begin where a `#` exists, so if your value contains a `#` please wrap it in quotes. This is a breaking change from `>= v15.0.0` and on.
|
| 126 |
+
|
| 127 |
+
### Parsing
|
| 128 |
+
|
| 129 |
+
The engine which parses the contents of your file containing environment variables is available to use. It accepts a String or Buffer and will return an Object with the parsed keys and values.
|
| 130 |
+
|
| 131 |
+
```javascript
|
| 132 |
+
const dotenv = require('dotenv')
|
| 133 |
+
const buf = Buffer.from('BASIC=basic')
|
| 134 |
+
const config = dotenv.parse(buf) // will return an object
|
| 135 |
+
console.log(typeof config, config) // object { BASIC : 'basic' }
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
### Preload
|
| 139 |
+
|
| 140 |
+
> Note: Consider using [`dotenvx`](https://github.com/dotenvx/dotenvx) instead of preloading. I am now doing (and recommending) so.
|
| 141 |
+
>
|
| 142 |
+
> It serves the same purpose (you do not need to require and load dotenv), adds better debugging, and works with ANY language, framework, or platform. β [motdotla](https://github.com/motdotla)
|
| 143 |
+
|
| 144 |
+
You can use the `--require` (`-r`) [command line option](https://nodejs.org/api/cli.html#-r---require-module) to preload dotenv. By doing this, you do not need to require and load dotenv in your application code.
|
| 145 |
+
|
| 146 |
+
```bash
|
| 147 |
+
$ node -r dotenv/config your_script.js
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
The configuration options below are supported as command line arguments in the format `dotenv_config_<option>=value`
|
| 151 |
+
|
| 152 |
+
```bash
|
| 153 |
+
$ node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/.env dotenv_config_debug=true
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
Additionally, you can use environment variables to set configuration options. Command line arguments will precede these.
|
| 157 |
+
|
| 158 |
+
```bash
|
| 159 |
+
$ DOTENV_CONFIG_<OPTION>=value node -r dotenv/config your_script.js
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
```bash
|
| 163 |
+
$ DOTENV_CONFIG_ENCODING=latin1 DOTENV_CONFIG_DEBUG=true node -r dotenv/config your_script.js dotenv_config_path=/custom/path/to/.env
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
### Variable Expansion
|
| 167 |
+
|
| 168 |
+
You need to add the value of another variable in one of your variables? Use [dotenv-expand](https://github.com/motdotla/dotenv-expand).
|
| 169 |
+
|
| 170 |
+
### Command Substitution
|
| 171 |
+
|
| 172 |
+
Use [dotenvx](https://github.com/dotenvx/dotenvx) to use command substitution.
|
| 173 |
+
|
| 174 |
+
Add the output of a command to one of your variables in your .env file.
|
| 175 |
+
|
| 176 |
+
```ini
|
| 177 |
+
# .env
|
| 178 |
+
DATABASE_URL="postgres://$(whoami)@localhost/my_database"
|
| 179 |
+
```
|
| 180 |
+
```js
|
| 181 |
+
// index.js
|
| 182 |
+
console.log('DATABASE_URL', process.env.DATABASE_URL)
|
| 183 |
+
```
|
| 184 |
+
```sh
|
| 185 |
+
$ dotenvx run --debug -- node index.js
|
| 186 |
+
[dotenvx@0.14.1] injecting env (1) from .env
|
| 187 |
+
DATABASE_URL postgres://yourusername@localhost/my_database
|
| 188 |
+
```
|
| 189 |
+
|
| 190 |
+
### Syncing
|
| 191 |
+
|
| 192 |
+
You need to keep `.env` files in sync between machines, environments, or team members? Use [dotenvx](https://github.com/dotenvx/dotenvx) to encrypt your `.env` files and safely include them in source control. This still subscribes to the twelve-factor app rules by generating a decryption key separate from code.
|
| 193 |
+
|
| 194 |
+
### Multiple Environments
|
| 195 |
+
|
| 196 |
+
Use [dotenvx](https://github.com/dotenvx/dotenvx) to generate `.env.ci`, `.env.production` files, and more.
|
| 197 |
+
|
| 198 |
+
### Deploying
|
| 199 |
+
|
| 200 |
+
You need to deploy your secrets in a cloud-agnostic manner? Use [dotenvx](https://github.com/dotenvx/dotenvx) to generate a private decryption key that is set on your production server.
|
| 201 |
+
|
| 202 |
+
## π΄ Manage Multiple Environments
|
| 203 |
+
|
| 204 |
+
Use [dotenvx](https://github.com/dotenvx/dotenvx)
|
| 205 |
+
|
| 206 |
+
Run any environment locally. Create a `.env.ENVIRONMENT` file and use `--env-file` to load it. It's straightforward, yet flexible.
|
| 207 |
+
|
| 208 |
+
```bash
|
| 209 |
+
$ echo "HELLO=production" > .env.production
|
| 210 |
+
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
| 211 |
+
|
| 212 |
+
$ dotenvx run --env-file=.env.production -- node index.js
|
| 213 |
+
Hello production
|
| 214 |
+
> ^^
|
| 215 |
+
```
|
| 216 |
+
|
| 217 |
+
or with multiple .env files
|
| 218 |
+
|
| 219 |
+
```bash
|
| 220 |
+
$ echo "HELLO=local" > .env.local
|
| 221 |
+
$ echo "HELLO=World" > .env
|
| 222 |
+
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
| 223 |
+
|
| 224 |
+
$ dotenvx run --env-file=.env.local --env-file=.env -- node index.js
|
| 225 |
+
Hello local
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
[more environment examples](https://dotenvx.com/docs/quickstart/environments)
|
| 229 |
+
|
| 230 |
+
## π Deploying
|
| 231 |
+
|
| 232 |
+
Use [dotenvx](https://github.com/dotenvx/dotenvx).
|
| 233 |
+
|
| 234 |
+
Add encryption to your `.env` files with a single command. Pass the `--encrypt` flag.
|
| 235 |
+
|
| 236 |
+
```
|
| 237 |
+
$ dotenvx set HELLO Production --encrypt -f .env.production
|
| 238 |
+
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
| 239 |
+
|
| 240 |
+
$ DOTENV_PRIVATE_KEY_PRODUCTION="<.env.production private key>" dotenvx run -- node index.js
|
| 241 |
+
[dotenvx] injecting env (2) from .env.production
|
| 242 |
+
Hello Production
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
+
[learn more](https://github.com/dotenvx/dotenvx?tab=readme-ov-file#encryption)
|
| 246 |
+
|
| 247 |
+
## π Examples
|
| 248 |
+
|
| 249 |
+
See [examples](https://github.com/dotenv-org/examples) of using dotenv with various frameworks, languages, and configurations.
|
| 250 |
+
|
| 251 |
+
* [nodejs](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-nodejs)
|
| 252 |
+
* [nodejs (debug on)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-nodejs-debug)
|
| 253 |
+
* [nodejs (override on)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-nodejs-override)
|
| 254 |
+
* [nodejs (processEnv override)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-custom-target)
|
| 255 |
+
* [esm](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-esm)
|
| 256 |
+
* [esm (preload)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-esm-preload)
|
| 257 |
+
* [typescript](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-typescript)
|
| 258 |
+
* [typescript parse](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-typescript-parse)
|
| 259 |
+
* [typescript config](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-typescript-config)
|
| 260 |
+
* [webpack](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-webpack)
|
| 261 |
+
* [webpack (plugin)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-webpack2)
|
| 262 |
+
* [react](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-react)
|
| 263 |
+
* [react (typescript)](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-react-typescript)
|
| 264 |
+
* [express](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-express)
|
| 265 |
+
* [nestjs](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-nestjs)
|
| 266 |
+
* [fastify](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-fastify)
|
| 267 |
+
|
| 268 |
+
## π Documentation
|
| 269 |
+
|
| 270 |
+
Dotenv exposes four functions:
|
| 271 |
+
|
| 272 |
+
* `config`
|
| 273 |
+
* `parse`
|
| 274 |
+
* `populate`
|
| 275 |
+
* `decrypt`
|
| 276 |
+
|
| 277 |
+
### Config
|
| 278 |
+
|
| 279 |
+
`config` will read your `.env` file, parse the contents, assign it to
|
| 280 |
+
[`process.env`](https://nodejs.org/docs/latest/api/process.html#process_process_env),
|
| 281 |
+
and return an Object with a `parsed` key containing the loaded content or an `error` key if it failed.
|
| 282 |
+
|
| 283 |
+
```js
|
| 284 |
+
const result = dotenv.config()
|
| 285 |
+
|
| 286 |
+
if (result.error) {
|
| 287 |
+
throw result.error
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
console.log(result.parsed)
|
| 291 |
+
```
|
| 292 |
+
|
| 293 |
+
You can additionally, pass options to `config`.
|
| 294 |
+
|
| 295 |
+
#### Options
|
| 296 |
+
|
| 297 |
+
##### path
|
| 298 |
+
|
| 299 |
+
Default: `path.resolve(process.cwd(), '.env')`
|
| 300 |
+
|
| 301 |
+
Specify a custom path if your file containing environment variables is located elsewhere.
|
| 302 |
+
|
| 303 |
+
```js
|
| 304 |
+
require('dotenv').config({ path: '/custom/path/to/.env' })
|
| 305 |
+
```
|
| 306 |
+
|
| 307 |
+
By default, `config` will look for a file called .env in the current working directory.
|
| 308 |
+
|
| 309 |
+
Pass in multiple files as an array, and they will be parsed in order and combined with `process.env` (or `option.processEnv`, if set). The first value set for a variable will win, unless the `options.override` flag is set, in which case the last value set will win. If a value already exists in `process.env` and the `options.override` flag is NOT set, no changes will be made to that value.
|
| 310 |
+
|
| 311 |
+
```js
|
| 312 |
+
require('dotenv').config({ path: ['.env.local', '.env'] })
|
| 313 |
+
```
|
| 314 |
+
|
| 315 |
+
##### encoding
|
| 316 |
+
|
| 317 |
+
Default: `utf8`
|
| 318 |
+
|
| 319 |
+
Specify the encoding of your file containing environment variables.
|
| 320 |
+
|
| 321 |
+
```js
|
| 322 |
+
require('dotenv').config({ encoding: 'latin1' })
|
| 323 |
+
```
|
| 324 |
+
|
| 325 |
+
##### debug
|
| 326 |
+
|
| 327 |
+
Default: `false`
|
| 328 |
+
|
| 329 |
+
Turn on logging to help debug why certain keys or values are not being set as you expect.
|
| 330 |
+
|
| 331 |
+
```js
|
| 332 |
+
require('dotenv').config({ debug: process.env.DEBUG })
|
| 333 |
+
```
|
| 334 |
+
|
| 335 |
+
##### override
|
| 336 |
+
|
| 337 |
+
Default: `false`
|
| 338 |
+
|
| 339 |
+
Override any environment variables that have already been set on your machine with values from your .env file(s). If multiple files have been provided in `option.path` the override will also be used as each file is combined with the next. Without `override` being set, the first value wins. With `override` set the last value wins.
|
| 340 |
+
|
| 341 |
+
```js
|
| 342 |
+
require('dotenv').config({ override: true })
|
| 343 |
+
```
|
| 344 |
+
|
| 345 |
+
##### processEnv
|
| 346 |
+
|
| 347 |
+
Default: `process.env`
|
| 348 |
+
|
| 349 |
+
Specify an object to write your environment variables to. Defaults to `process.env` environment variables.
|
| 350 |
+
|
| 351 |
+
```js
|
| 352 |
+
const myObject = {}
|
| 353 |
+
require('dotenv').config({ processEnv: myObject })
|
| 354 |
+
|
| 355 |
+
console.log(myObject) // values from .env
|
| 356 |
+
console.log(process.env) // this was not changed or written to
|
| 357 |
+
```
|
| 358 |
+
|
| 359 |
+
### Parse
|
| 360 |
+
|
| 361 |
+
The engine which parses the contents of your file containing environment
|
| 362 |
+
variables is available to use. It accepts a String or Buffer and will return
|
| 363 |
+
an Object with the parsed keys and values.
|
| 364 |
+
|
| 365 |
+
```js
|
| 366 |
+
const dotenv = require('dotenv')
|
| 367 |
+
const buf = Buffer.from('BASIC=basic')
|
| 368 |
+
const config = dotenv.parse(buf) // will return an object
|
| 369 |
+
console.log(typeof config, config) // object { BASIC : 'basic' }
|
| 370 |
+
```
|
| 371 |
+
|
| 372 |
+
#### Options
|
| 373 |
+
|
| 374 |
+
##### debug
|
| 375 |
+
|
| 376 |
+
Default: `false`
|
| 377 |
+
|
| 378 |
+
Turn on logging to help debug why certain keys or values are not being set as you expect.
|
| 379 |
+
|
| 380 |
+
```js
|
| 381 |
+
const dotenv = require('dotenv')
|
| 382 |
+
const buf = Buffer.from('hello world')
|
| 383 |
+
const opt = { debug: true }
|
| 384 |
+
const config = dotenv.parse(buf, opt)
|
| 385 |
+
// expect a debug message because the buffer is not in KEY=VAL form
|
| 386 |
+
```
|
| 387 |
+
|
| 388 |
+
### Populate
|
| 389 |
+
|
| 390 |
+
The engine which populates the contents of your .env file to `process.env` is available for use. It accepts a target, a source, and options. This is useful for power users who want to supply their own objects.
|
| 391 |
+
|
| 392 |
+
For example, customizing the source:
|
| 393 |
+
|
| 394 |
+
```js
|
| 395 |
+
const dotenv = require('dotenv')
|
| 396 |
+
const parsed = { HELLO: 'world' }
|
| 397 |
+
|
| 398 |
+
dotenv.populate(process.env, parsed)
|
| 399 |
+
|
| 400 |
+
console.log(process.env.HELLO) // world
|
| 401 |
+
```
|
| 402 |
+
|
| 403 |
+
For example, customizing the source AND target:
|
| 404 |
+
|
| 405 |
+
```js
|
| 406 |
+
const dotenv = require('dotenv')
|
| 407 |
+
const parsed = { HELLO: 'universe' }
|
| 408 |
+
const target = { HELLO: 'world' } // empty object
|
| 409 |
+
|
| 410 |
+
dotenv.populate(target, parsed, { override: true, debug: true })
|
| 411 |
+
|
| 412 |
+
console.log(target) // { HELLO: 'universe' }
|
| 413 |
+
```
|
| 414 |
+
|
| 415 |
+
#### options
|
| 416 |
+
|
| 417 |
+
##### Debug
|
| 418 |
+
|
| 419 |
+
Default: `false`
|
| 420 |
+
|
| 421 |
+
Turn on logging to help debug why certain keys or values are not being populated as you expect.
|
| 422 |
+
|
| 423 |
+
##### override
|
| 424 |
+
|
| 425 |
+
Default: `false`
|
| 426 |
+
|
| 427 |
+
Override any environment variables that have already been set.
|
| 428 |
+
|
| 429 |
+
## β FAQ
|
| 430 |
+
|
| 431 |
+
### Why is the `.env` file not loading my environment variables successfully?
|
| 432 |
+
|
| 433 |
+
Most likely your `.env` file is not in the correct place. [See this stack overflow](https://stackoverflow.com/questions/42335016/dotenv-file-is-not-loading-environment-variables).
|
| 434 |
+
|
| 435 |
+
Turn on debug mode and try again..
|
| 436 |
+
|
| 437 |
+
```js
|
| 438 |
+
require('dotenv').config({ debug: true })
|
| 439 |
+
```
|
| 440 |
+
|
| 441 |
+
You will receive a helpful error outputted to your console.
|
| 442 |
+
|
| 443 |
+
### Should I commit my `.env` file?
|
| 444 |
+
|
| 445 |
+
No. We **strongly** recommend against committing your `.env` file to version
|
| 446 |
+
control. It should only include environment-specific values such as database
|
| 447 |
+
passwords or API keys. Your production database should have a different
|
| 448 |
+
password than your development database.
|
| 449 |
+
|
| 450 |
+
### Should I have multiple `.env` files?
|
| 451 |
+
|
| 452 |
+
We recommend creating one `.env` file per environment. Use `.env` for local/development, `.env.production` for production and so on. This still follows the twelve factor principles as each is attributed individually to its own environment. Avoid custom set ups that work in inheritance somehow (`.env.production` inherits values form `.env` for example). It is better to duplicate values if necessary across each `.env.environment` file.
|
| 453 |
+
|
| 454 |
+
> In a twelve-factor app, env vars are granular controls, each fully orthogonal to other env vars. They are never grouped together as βenvironmentsβ, but instead are independently managed for each deploy. This is a model that scales up smoothly as the app naturally expands into more deploys over its lifetime.
|
| 455 |
+
>
|
| 456 |
+
> β [The Twelve-Factor App](http://12factor.net/config)
|
| 457 |
+
|
| 458 |
+
### What rules does the parsing engine follow?
|
| 459 |
+
|
| 460 |
+
The parsing engine currently supports the following rules:
|
| 461 |
+
|
| 462 |
+
- `BASIC=basic` becomes `{BASIC: 'basic'}`
|
| 463 |
+
- empty lines are skipped
|
| 464 |
+
- lines beginning with `#` are treated as comments
|
| 465 |
+
- `#` marks the beginning of a comment (unless when the value is wrapped in quotes)
|
| 466 |
+
- empty values become empty strings (`EMPTY=` becomes `{EMPTY: ''}`)
|
| 467 |
+
- inner quotes are maintained (think JSON) (`JSON={"foo": "bar"}` becomes `{JSON:"{\"foo\": \"bar\"}"`)
|
| 468 |
+
- whitespace is removed from both ends of unquoted values (see more on [`trim`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim)) (`FOO= some value ` becomes `{FOO: 'some value'}`)
|
| 469 |
+
- single and double quoted values are escaped (`SINGLE_QUOTE='quoted'` becomes `{SINGLE_QUOTE: "quoted"}`)
|
| 470 |
+
- single and double quoted values maintain whitespace from both ends (`FOO=" some value "` becomes `{FOO: ' some value '}`)
|
| 471 |
+
- double quoted values expand new lines (`MULTILINE="new\nline"` becomes
|
| 472 |
+
|
| 473 |
+
```
|
| 474 |
+
{MULTILINE: 'new
|
| 475 |
+
line'}
|
| 476 |
+
```
|
| 477 |
+
|
| 478 |
+
- backticks are supported (`` BACKTICK_KEY=`This has 'single' and "double" quotes inside of it.` ``)
|
| 479 |
+
|
| 480 |
+
### What happens to environment variables that were already set?
|
| 481 |
+
|
| 482 |
+
By default, we will never modify any environment variables that have already been set. In particular, if there is a variable in your `.env` file which collides with one that already exists in your environment, then that variable will be skipped.
|
| 483 |
+
|
| 484 |
+
If instead, you want to override `process.env` use the `override` option.
|
| 485 |
+
|
| 486 |
+
```javascript
|
| 487 |
+
require('dotenv').config({ override: true })
|
| 488 |
+
```
|
| 489 |
+
|
| 490 |
+
### How come my environment variables are not showing up for React?
|
| 491 |
+
|
| 492 |
+
Your React code is run in Webpack, where the `fs` module or even the `process` global itself are not accessible out-of-the-box. `process.env` can only be injected through Webpack configuration.
|
| 493 |
+
|
| 494 |
+
If you are using [`react-scripts`](https://www.npmjs.com/package/react-scripts), which is distributed through [`create-react-app`](https://create-react-app.dev/), it has dotenv built in but with a quirk. Preface your environment variables with `REACT_APP_`. See [this stack overflow](https://stackoverflow.com/questions/42182577/is-it-possible-to-use-dotenv-in-a-react-project) for more details.
|
| 495 |
+
|
| 496 |
+
If you are using other frameworks (e.g. Next.js, Gatsby...), you need to consult their documentation for how to inject environment variables into the client.
|
| 497 |
+
|
| 498 |
+
### Can I customize/write plugins for dotenv?
|
| 499 |
+
|
| 500 |
+
Yes! `dotenv.config()` returns an object representing the parsed `.env` file. This gives you everything you need to continue setting values on `process.env`. For example:
|
| 501 |
+
|
| 502 |
+
```js
|
| 503 |
+
const dotenv = require('dotenv')
|
| 504 |
+
const variableExpansion = require('dotenv-expand')
|
| 505 |
+
const myEnv = dotenv.config()
|
| 506 |
+
variableExpansion(myEnv)
|
| 507 |
+
```
|
| 508 |
+
|
| 509 |
+
### How do I use dotenv with `import`?
|
| 510 |
+
|
| 511 |
+
Simply..
|
| 512 |
+
|
| 513 |
+
```javascript
|
| 514 |
+
// index.mjs (ESM)
|
| 515 |
+
import 'dotenv/config' // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
|
| 516 |
+
import express from 'express'
|
| 517 |
+
```
|
| 518 |
+
|
| 519 |
+
A little background..
|
| 520 |
+
|
| 521 |
+
> When you run a module containing an `import` declaration, the modules it imports are loaded first, then each module body is executed in a depth-first traversal of the dependency graph, avoiding cycles by skipping anything already executed.
|
| 522 |
+
>
|
| 523 |
+
> β [ES6 In Depth: Modules](https://hacks.mozilla.org/2015/08/es6-in-depth-modules/)
|
| 524 |
+
|
| 525 |
+
What does this mean in plain language? It means you would think the following would work but it won't.
|
| 526 |
+
|
| 527 |
+
`errorReporter.mjs`:
|
| 528 |
+
```js
|
| 529 |
+
class Client {
|
| 530 |
+
constructor (apiKey) {
|
| 531 |
+
console.log('apiKey', apiKey)
|
| 532 |
+
|
| 533 |
+
this.apiKey = apiKey
|
| 534 |
+
}
|
| 535 |
+
}
|
| 536 |
+
|
| 537 |
+
export default new Client(process.env.API_KEY)
|
| 538 |
+
```
|
| 539 |
+
`index.mjs`:
|
| 540 |
+
```js
|
| 541 |
+
// Note: this is INCORRECT and will not work
|
| 542 |
+
import * as dotenv from 'dotenv'
|
| 543 |
+
dotenv.config()
|
| 544 |
+
|
| 545 |
+
import errorReporter from './errorReporter.mjs' // process.env.API_KEY will be blank!
|
| 546 |
+
```
|
| 547 |
+
|
| 548 |
+
`process.env.API_KEY` will be blank.
|
| 549 |
+
|
| 550 |
+
Instead, `index.mjs` should be written as..
|
| 551 |
+
|
| 552 |
+
```js
|
| 553 |
+
import 'dotenv/config'
|
| 554 |
+
|
| 555 |
+
import errorReporter from './errorReporter.mjs'
|
| 556 |
+
```
|
| 557 |
+
|
| 558 |
+
Does that make sense? It's a bit unintuitive, but it is how importing of ES6 modules work. Here is a [working example of this pitfall](https://github.com/dotenv-org/examples/tree/master/usage/dotenv-es6-import-pitfall).
|
| 559 |
+
|
| 560 |
+
There are two alternatives to this approach:
|
| 561 |
+
|
| 562 |
+
1. Preload dotenv: `node --require dotenv/config index.js` (_Note: you do not need to `import` dotenv with this approach_)
|
| 563 |
+
2. Create a separate file that will execute `config` first as outlined in [this comment on #133](https://github.com/motdotla/dotenv/issues/133#issuecomment-255298822)
|
| 564 |
+
|
| 565 |
+
### Why am I getting the error `Module not found: Error: Can't resolve 'crypto|os|path'`?
|
| 566 |
+
|
| 567 |
+
You are using dotenv on the front-end and have not included a polyfill. Webpack < 5 used to include these for you. Do the following:
|
| 568 |
+
|
| 569 |
+
```bash
|
| 570 |
+
npm install node-polyfill-webpack-plugin
|
| 571 |
+
```
|
| 572 |
+
|
| 573 |
+
Configure your `webpack.config.js` to something like the following.
|
| 574 |
+
|
| 575 |
+
```js
|
| 576 |
+
require('dotenv').config()
|
| 577 |
+
|
| 578 |
+
const path = require('path');
|
| 579 |
+
const webpack = require('webpack')
|
| 580 |
+
|
| 581 |
+
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
|
| 582 |
+
|
| 583 |
+
module.exports = {
|
| 584 |
+
mode: 'development',
|
| 585 |
+
entry: './src/index.ts',
|
| 586 |
+
output: {
|
| 587 |
+
filename: 'bundle.js',
|
| 588 |
+
path: path.resolve(__dirname, 'dist'),
|
| 589 |
+
},
|
| 590 |
+
plugins: [
|
| 591 |
+
new NodePolyfillPlugin(),
|
| 592 |
+
new webpack.DefinePlugin({
|
| 593 |
+
'process.env': {
|
| 594 |
+
HELLO: JSON.stringify(process.env.HELLO)
|
| 595 |
+
}
|
| 596 |
+
}),
|
| 597 |
+
]
|
| 598 |
+
};
|
| 599 |
+
```
|
| 600 |
+
|
| 601 |
+
Alternatively, just use [dotenv-webpack](https://github.com/mrsteele/dotenv-webpack) which does this and more behind the scenes for you.
|
| 602 |
+
|
| 603 |
+
### What about variable expansion?
|
| 604 |
+
|
| 605 |
+
Try [dotenv-expand](https://github.com/motdotla/dotenv-expand)
|
| 606 |
+
|
| 607 |
+
### What about syncing and securing .env files?
|
| 608 |
+
|
| 609 |
+
Use [dotenvx](https://github.com/dotenvx/dotenvx)
|
| 610 |
+
|
| 611 |
+
### What if I accidentally commit my `.env` file to code?
|
| 612 |
+
|
| 613 |
+
Remove it, [remove git history](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository) and then install the [git pre-commit hook](https://github.com/dotenvx/dotenvx#pre-commit) to prevent this from ever happening again.
|
| 614 |
+
|
| 615 |
+
```
|
| 616 |
+
brew install dotenvx/brew/dotenvx
|
| 617 |
+
dotenvx precommit --install
|
| 618 |
+
```
|
| 619 |
+
|
| 620 |
+
### How can I prevent committing my `.env` file to a Docker build?
|
| 621 |
+
|
| 622 |
+
Use the [docker prebuild hook](https://dotenvx.com/docs/features/prebuild).
|
| 623 |
+
|
| 624 |
+
```bash
|
| 625 |
+
# Dockerfile
|
| 626 |
+
...
|
| 627 |
+
RUN curl -fsS https://dotenvx.sh/ | sh
|
| 628 |
+
...
|
| 629 |
+
RUN dotenvx prebuild
|
| 630 |
+
CMD ["dotenvx", "run", "--", "node", "index.js"]
|
| 631 |
+
```
|
| 632 |
+
|
| 633 |
+
## Contributing Guide
|
| 634 |
+
|
| 635 |
+
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
| 636 |
+
|
| 637 |
+
## CHANGELOG
|
| 638 |
+
|
| 639 |
+
See [CHANGELOG.md](CHANGELOG.md)
|
| 640 |
+
|
| 641 |
+
## Who's using dotenv?
|
| 642 |
+
|
| 643 |
+
[These npm modules depend on it.](https://www.npmjs.com/browse/depended/dotenv)
|
| 644 |
+
|
| 645 |
+
Projects that expand it often use the [keyword "dotenv" on npm](https://www.npmjs.com/search?q=keywords:dotenv).
|
backend/node_modules/dotenv/SECURITY.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Please report any security vulnerabilities to security@dotenvx.com.
|
backend/node_modules/dotenv/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export {};
|
backend/node_modules/dotenv/config.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(function () {
|
| 2 |
+
require('./lib/main').config(
|
| 3 |
+
Object.assign(
|
| 4 |
+
{},
|
| 5 |
+
require('./lib/env-options'),
|
| 6 |
+
require('./lib/cli-options')(process.argv)
|
| 7 |
+
)
|
| 8 |
+
)
|
| 9 |
+
})()
|
backend/node_modules/dotenv/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "dotenv",
|
| 3 |
+
"version": "16.6.1",
|
| 4 |
+
"description": "Loads environment variables from .env file",
|
| 5 |
+
"main": "lib/main.js",
|
| 6 |
+
"types": "lib/main.d.ts",
|
| 7 |
+
"exports": {
|
| 8 |
+
".": {
|
| 9 |
+
"types": "./lib/main.d.ts",
|
| 10 |
+
"require": "./lib/main.js",
|
| 11 |
+
"default": "./lib/main.js"
|
| 12 |
+
},
|
| 13 |
+
"./config": "./config.js",
|
| 14 |
+
"./config.js": "./config.js",
|
| 15 |
+
"./lib/env-options": "./lib/env-options.js",
|
| 16 |
+
"./lib/env-options.js": "./lib/env-options.js",
|
| 17 |
+
"./lib/cli-options": "./lib/cli-options.js",
|
| 18 |
+
"./lib/cli-options.js": "./lib/cli-options.js",
|
| 19 |
+
"./package.json": "./package.json"
|
| 20 |
+
},
|
| 21 |
+
"scripts": {
|
| 22 |
+
"dts-check": "tsc --project tests/types/tsconfig.json",
|
| 23 |
+
"lint": "standard",
|
| 24 |
+
"pretest": "npm run lint && npm run dts-check",
|
| 25 |
+
"test": "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
| 26 |
+
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
| 27 |
+
"prerelease": "npm test",
|
| 28 |
+
"release": "standard-version"
|
| 29 |
+
},
|
| 30 |
+
"repository": {
|
| 31 |
+
"type": "git",
|
| 32 |
+
"url": "git://github.com/motdotla/dotenv.git"
|
| 33 |
+
},
|
| 34 |
+
"homepage": "https://github.com/motdotla/dotenv#readme",
|
| 35 |
+
"funding": "https://dotenvx.com",
|
| 36 |
+
"keywords": [
|
| 37 |
+
"dotenv",
|
| 38 |
+
"env",
|
| 39 |
+
".env",
|
| 40 |
+
"environment",
|
| 41 |
+
"variables",
|
| 42 |
+
"config",
|
| 43 |
+
"settings"
|
| 44 |
+
],
|
| 45 |
+
"readmeFilename": "README.md",
|
| 46 |
+
"license": "BSD-2-Clause",
|
| 47 |
+
"devDependencies": {
|
| 48 |
+
"@types/node": "^18.11.3",
|
| 49 |
+
"decache": "^4.6.2",
|
| 50 |
+
"sinon": "^14.0.1",
|
| 51 |
+
"standard": "^17.0.0",
|
| 52 |
+
"standard-version": "^9.5.0",
|
| 53 |
+
"tap": "^19.2.0",
|
| 54 |
+
"typescript": "^4.8.4"
|
| 55 |
+
},
|
| 56 |
+
"engines": {
|
| 57 |
+
"node": ">=12"
|
| 58 |
+
},
|
| 59 |
+
"browser": {
|
| 60 |
+
"fs": false
|
| 61 |
+
}
|
| 62 |
+
}
|
backend/node_modules/effect/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2023 Effectful Technologies Inc
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
backend/node_modules/effect/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# `effect` Core Package
|
| 2 |
+
|
| 3 |
+
The `effect` package is the heart of the Effect framework, providing robust primitives for managing side effects, ensuring type safety, and supporting concurrency in your TypeScript applications.
|
| 4 |
+
|
| 5 |
+
## Requirements
|
| 6 |
+
|
| 7 |
+
- **TypeScript 5.4 or Newer:**
|
| 8 |
+
Ensure you are using a compatible TypeScript version.
|
| 9 |
+
|
| 10 |
+
- **Strict Type-Checking:**
|
| 11 |
+
The `strict` flag must be enabled in your `tsconfig.json`. For example:
|
| 12 |
+
|
| 13 |
+
```json
|
| 14 |
+
{
|
| 15 |
+
"compilerOptions": {
|
| 16 |
+
"strict": true
|
| 17 |
+
// ...other options
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
## Installation
|
| 23 |
+
|
| 24 |
+
Install the core package using your preferred package manager. For example, with npm:
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
npm install effect
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Documentation
|
| 31 |
+
|
| 32 |
+
- **Website:**
|
| 33 |
+
For detailed information and usage examples, visit the [Effect website](https://www.effect.website/).
|
| 34 |
+
|
| 35 |
+
- **API Reference:**
|
| 36 |
+
For a complete API reference of the core package `effect`, see the [Effect API documentation](https://effect-ts.github.io/effect/).
|
| 37 |
+
|
| 38 |
+
## Overview of Effect Modules
|
| 39 |
+
|
| 40 |
+
The `effect` package provides a collection of modules designed for functional programming in TypeScript. Below is a brief overview of the core modules:
|
| 41 |
+
|
| 42 |
+
| Module | Description |
|
| 43 |
+
| -------- | -------------------------------------------------------------------------------------------------------------------------- |
|
| 44 |
+
| Effect | The core abstraction for managing side effects, concurrency, and error handling in a structured way. |
|
| 45 |
+
| Context | A lightweight dependency injection mechanism that enables passing services through computations without direct references. |
|
| 46 |
+
| Layer | A system for managing dependencies, allowing for modular and composable resource allocation. |
|
| 47 |
+
| Fiber | Lightweight virtual threads with resource-safe cancellation capabilities, enabling many features in Effect. |
|
| 48 |
+
| Stream | A powerful abstraction for handling asynchronous, event-driven data processing. |
|
| 49 |
+
| Schedule | A module for defining retry and repeat policies with composable schedules. |
|
| 50 |
+
| Scope | Manages the lifecycle of resources, ensuring proper acquisition and release. |
|
| 51 |
+
| Schema | A powerful library for defining, validating, and transforming structured data with type-safe encoding and decoding. |
|
| 52 |
+
|
| 53 |
+
For a comparison between `effect/Schema` and `zod`, see [Schema vs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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "effect",
|
| 3 |
+
"version": "3.21.0",
|
| 4 |
+
"description": "The missing standard library for TypeScript, for writing production-grade software.",
|
| 5 |
+
"license": "MIT",
|
| 6 |
+
"repository": {
|
| 7 |
+
"type": "git",
|
| 8 |
+
"url": "https://github.com/Effect-TS/effect.git",
|
| 9 |
+
"directory": "packages/effect"
|
| 10 |
+
},
|
| 11 |
+
"sideEffects": [],
|
| 12 |
+
"homepage": "https://effect.website",
|
| 13 |
+
"dependencies": {
|
| 14 |
+
"@standard-schema/spec": "^1.0.0",
|
| 15 |
+
"fast-check": "^3.23.1"
|
| 16 |
+
},
|
| 17 |
+
"publishConfig": {
|
| 18 |
+
"provenance": true
|
| 19 |
+
},
|
| 20 |
+
"main": "./dist/cjs/index.js",
|
| 21 |
+
"module": "./dist/esm/index.js",
|
| 22 |
+
"types": "./dist/dts/index.d.ts",
|
| 23 |
+
"exports": {
|
| 24 |
+
"./package.json": "./package.json",
|
| 25 |
+
".": {
|
| 26 |
+
"types": "./dist/dts/index.d.ts",
|
| 27 |
+
"import": "./dist/esm/index.js",
|
| 28 |
+
"default": "./dist/cjs/index.js"
|
| 29 |
+
},
|
| 30 |
+
"./.index": {
|
| 31 |
+
"types": "./dist/dts/.index.d.ts",
|
| 32 |
+
"import": "./dist/esm/.index.js",
|
| 33 |
+
"default": "./dist/cjs/.index.js"
|
| 34 |
+
},
|
| 35 |
+
"./Arbitrary": {
|
| 36 |
+
"types": "./dist/dts/Arbitrary.d.ts",
|
| 37 |
+
"import": "./dist/esm/Arbitrary.js",
|
| 38 |
+
"default": "./dist/cjs/Arbitrary.js"
|
| 39 |
+
},
|
| 40 |
+
"./Array": {
|
| 41 |
+
"types": "./dist/dts/Array.d.ts",
|
| 42 |
+
"import": "./dist/esm/Array.js",
|
| 43 |
+
"default": "./dist/cjs/Array.js"
|
| 44 |
+
},
|
| 45 |
+
"./BigDecimal": {
|
| 46 |
+
"types": "./dist/dts/BigDecimal.d.ts",
|
| 47 |
+
"import": "./dist/esm/BigDecimal.js",
|
| 48 |
+
"default": "./dist/cjs/BigDecimal.js"
|
| 49 |
+
},
|
| 50 |
+
"./BigInt": {
|
| 51 |
+
"types": "./dist/dts/BigInt.d.ts",
|
| 52 |
+
"import": "./dist/esm/BigInt.js",
|
| 53 |
+
"default": "./dist/cjs/BigInt.js"
|
| 54 |
+
},
|
| 55 |
+
"./Boolean": {
|
| 56 |
+
"types": "./dist/dts/Boolean.d.ts",
|
| 57 |
+
"import": "./dist/esm/Boolean.js",
|
| 58 |
+
"default": "./dist/cjs/Boolean.js"
|
| 59 |
+
},
|
| 60 |
+
"./Brand": {
|
| 61 |
+
"types": "./dist/dts/Brand.d.ts",
|
| 62 |
+
"import": "./dist/esm/Brand.js",
|
| 63 |
+
"default": "./dist/cjs/Brand.js"
|
| 64 |
+
},
|
| 65 |
+
"./Cache": {
|
| 66 |
+
"types": "./dist/dts/Cache.d.ts",
|
| 67 |
+
"import": "./dist/esm/Cache.js",
|
| 68 |
+
"default": "./dist/cjs/Cache.js"
|
| 69 |
+
},
|
| 70 |
+
"./Cause": {
|
| 71 |
+
"types": "./dist/dts/Cause.d.ts",
|
| 72 |
+
"import": "./dist/esm/Cause.js",
|
| 73 |
+
"default": "./dist/cjs/Cause.js"
|
| 74 |
+
},
|
| 75 |
+
"./Channel": {
|
| 76 |
+
"types": "./dist/dts/Channel.d.ts",
|
| 77 |
+
"import": "./dist/esm/Channel.js",
|
| 78 |
+
"default": "./dist/cjs/Channel.js"
|
| 79 |
+
},
|
| 80 |
+
"./ChildExecutorDecision": {
|
| 81 |
+
"types": "./dist/dts/ChildExecutorDecision.d.ts",
|
| 82 |
+
"import": "./dist/esm/ChildExecutorDecision.js",
|
| 83 |
+
"default": "./dist/cjs/ChildExecutorDecision.js"
|
| 84 |
+
},
|
| 85 |
+
"./Chunk": {
|
| 86 |
+
"types": "./dist/dts/Chunk.d.ts",
|
| 87 |
+
"import": "./dist/esm/Chunk.js",
|
| 88 |
+
"default": "./dist/cjs/Chunk.js"
|
| 89 |
+
},
|
| 90 |
+
"./Clock": {
|
| 91 |
+
"types": "./dist/dts/Clock.d.ts",
|
| 92 |
+
"import": "./dist/esm/Clock.js",
|
| 93 |
+
"default": "./dist/cjs/Clock.js"
|
| 94 |
+
},
|
| 95 |
+
"./Config": {
|
| 96 |
+
"types": "./dist/dts/Config.d.ts",
|
| 97 |
+
"import": "./dist/esm/Config.js",
|
| 98 |
+
"default": "./dist/cjs/Config.js"
|
| 99 |
+
},
|
| 100 |
+
"./ConfigError": {
|
| 101 |
+
"types": "./dist/dts/ConfigError.d.ts",
|
| 102 |
+
"import": "./dist/esm/ConfigError.js",
|
| 103 |
+
"default": "./dist/cjs/ConfigError.js"
|
| 104 |
+
},
|
| 105 |
+
"./ConfigProvider": {
|
| 106 |
+
"types": "./dist/dts/ConfigProvider.d.ts",
|
| 107 |
+
"import": "./dist/esm/ConfigProvider.js",
|
| 108 |
+
"default": "./dist/cjs/ConfigProvider.js"
|
| 109 |
+
},
|
| 110 |
+
"./ConfigProviderPathPatch": {
|
| 111 |
+
"types": "./dist/dts/ConfigProviderPathPatch.d.ts",
|
| 112 |
+
"import": "./dist/esm/ConfigProviderPathPatch.js",
|
| 113 |
+
"default": "./dist/cjs/ConfigProviderPathPatch.js"
|
| 114 |
+
},
|
| 115 |
+
"./Console": {
|
| 116 |
+
"types": "./dist/dts/Console.d.ts",
|
| 117 |
+
"import": "./dist/esm/Console.js",
|
| 118 |
+
"default": "./dist/cjs/Console.js"
|
| 119 |
+
},
|
| 120 |
+
"./Context": {
|
| 121 |
+
"types": "./dist/dts/Context.d.ts",
|
| 122 |
+
"import": "./dist/esm/Context.js",
|
| 123 |
+
"default": "./dist/cjs/Context.js"
|
| 124 |
+
},
|
| 125 |
+
"./Cron": {
|
| 126 |
+
"types": "./dist/dts/Cron.d.ts",
|
| 127 |
+
"import": "./dist/esm/Cron.js",
|
| 128 |
+
"default": "./dist/cjs/Cron.js"
|
| 129 |
+
},
|
| 130 |
+
"./Data": {
|
| 131 |
+
"types": "./dist/dts/Data.d.ts",
|
| 132 |
+
"import": "./dist/esm/Data.js",
|
| 133 |
+
"default": "./dist/cjs/Data.js"
|
| 134 |
+
},
|
| 135 |
+
"./DateTime": {
|
| 136 |
+
"types": "./dist/dts/DateTime.d.ts",
|
| 137 |
+
"import": "./dist/esm/DateTime.js",
|
| 138 |
+
"default": "./dist/cjs/DateTime.js"
|
| 139 |
+
},
|
| 140 |
+
"./DefaultServices": {
|
| 141 |
+
"types": "./dist/dts/DefaultServices.d.ts",
|
| 142 |
+
"import": "./dist/esm/DefaultServices.js",
|
| 143 |
+
"default": "./dist/cjs/DefaultServices.js"
|
| 144 |
+
},
|
| 145 |
+
"./Deferred": {
|
| 146 |
+
"types": "./dist/dts/Deferred.d.ts",
|
| 147 |
+
"import": "./dist/esm/Deferred.js",
|
| 148 |
+
"default": "./dist/cjs/Deferred.js"
|
| 149 |
+
},
|
| 150 |
+
"./Differ": {
|
| 151 |
+
"types": "./dist/dts/Differ.d.ts",
|
| 152 |
+
"import": "./dist/esm/Differ.js",
|
| 153 |
+
"default": "./dist/cjs/Differ.js"
|
| 154 |
+
},
|
| 155 |
+
"./Duration": {
|
| 156 |
+
"types": "./dist/dts/Duration.d.ts",
|
| 157 |
+
"import": "./dist/esm/Duration.js",
|
| 158 |
+
"default": "./dist/cjs/Duration.js"
|
| 159 |
+
},
|
| 160 |
+
"./Effect": {
|
| 161 |
+
"types": "./dist/dts/Effect.d.ts",
|
| 162 |
+
"import": "./dist/esm/Effect.js",
|
| 163 |
+
"default": "./dist/cjs/Effect.js"
|
| 164 |
+
},
|
| 165 |
+
"./Effectable": {
|
| 166 |
+
"types": "./dist/dts/Effectable.d.ts",
|
| 167 |
+
"import": "./dist/esm/Effectable.js",
|
| 168 |
+
"default": "./dist/cjs/Effectable.js"
|
| 169 |
+
},
|
| 170 |
+
"./Either": {
|
| 171 |
+
"types": "./dist/dts/Either.d.ts",
|
| 172 |
+
"import": "./dist/esm/Either.js",
|
| 173 |
+
"default": "./dist/cjs/Either.js"
|
| 174 |
+
},
|
| 175 |
+
"./Encoding": {
|
| 176 |
+
"types": "./dist/dts/Encoding.d.ts",
|
| 177 |
+
"import": "./dist/esm/Encoding.js",
|
| 178 |
+
"default": "./dist/cjs/Encoding.js"
|
| 179 |
+
},
|
| 180 |
+
"./Equal": {
|
| 181 |
+
"types": "./dist/dts/Equal.d.ts",
|
| 182 |
+
"import": "./dist/esm/Equal.js",
|
| 183 |
+
"default": "./dist/cjs/Equal.js"
|
| 184 |
+
},
|
| 185 |
+
"./Equivalence": {
|
| 186 |
+
"types": "./dist/dts/Equivalence.d.ts",
|
| 187 |
+
"import": "./dist/esm/Equivalence.js",
|
| 188 |
+
"default": "./dist/cjs/Equivalence.js"
|
| 189 |
+
},
|
| 190 |
+
"./ExecutionPlan": {
|
| 191 |
+
"types": "./dist/dts/ExecutionPlan.d.ts",
|
| 192 |
+
"import": "./dist/esm/ExecutionPlan.js",
|
| 193 |
+
"default": "./dist/cjs/ExecutionPlan.js"
|
| 194 |
+
},
|
| 195 |
+
"./ExecutionStrategy": {
|
| 196 |
+
"types": "./dist/dts/ExecutionStrategy.d.ts",
|
| 197 |
+
"import": "./dist/esm/ExecutionStrategy.js",
|
| 198 |
+
"default": "./dist/cjs/ExecutionStrategy.js"
|
| 199 |
+
},
|
| 200 |
+
"./Exit": {
|
| 201 |
+
"types": "./dist/dts/Exit.d.ts",
|
| 202 |
+
"import": "./dist/esm/Exit.js",
|
| 203 |
+
"default": "./dist/cjs/Exit.js"
|
| 204 |
+
},
|
| 205 |
+
"./FastCheck": {
|
| 206 |
+
"types": "./dist/dts/FastCheck.d.ts",
|
| 207 |
+
"import": "./dist/esm/FastCheck.js",
|
| 208 |
+
"default": "./dist/cjs/FastCheck.js"
|
| 209 |
+
},
|
| 210 |
+
"./Fiber": {
|
| 211 |
+
"types": "./dist/dts/Fiber.d.ts",
|
| 212 |
+
"import": "./dist/esm/Fiber.js",
|
| 213 |
+
"default": "./dist/cjs/Fiber.js"
|
| 214 |
+
},
|
| 215 |
+
"./FiberHandle": {
|
| 216 |
+
"types": "./dist/dts/FiberHandle.d.ts",
|
| 217 |
+
"import": "./dist/esm/FiberHandle.js",
|
| 218 |
+
"default": "./dist/cjs/FiberHandle.js"
|
| 219 |
+
},
|
| 220 |
+
"./FiberId": {
|
| 221 |
+
"types": "./dist/dts/FiberId.d.ts",
|
| 222 |
+
"import": "./dist/esm/FiberId.js",
|
| 223 |
+
"default": "./dist/cjs/FiberId.js"
|
| 224 |
+
},
|
| 225 |
+
"./FiberMap": {
|
| 226 |
+
"types": "./dist/dts/FiberMap.d.ts",
|
| 227 |
+
"import": "./dist/esm/FiberMap.js",
|
| 228 |
+
"default": "./dist/cjs/FiberMap.js"
|
| 229 |
+
},
|
| 230 |
+
"./FiberRef": {
|
| 231 |
+
"types": "./dist/dts/FiberRef.d.ts",
|
| 232 |
+
"import": "./dist/esm/FiberRef.js",
|
| 233 |
+
"default": "./dist/cjs/FiberRef.js"
|
| 234 |
+
},
|
| 235 |
+
"./FiberRefs": {
|
| 236 |
+
"types": "./dist/dts/FiberRefs.d.ts",
|
| 237 |
+
"import": "./dist/esm/FiberRefs.js",
|
| 238 |
+
"default": "./dist/cjs/FiberRefs.js"
|
| 239 |
+
},
|
| 240 |
+
"./FiberRefsPatch": {
|
| 241 |
+
"types": "./dist/dts/FiberRefsPatch.d.ts",
|
| 242 |
+
"import": "./dist/esm/FiberRefsPatch.js",
|
| 243 |
+
"default": "./dist/cjs/FiberRefsPatch.js"
|
| 244 |
+
},
|
| 245 |
+
"./FiberSet": {
|
| 246 |
+
"types": "./dist/dts/FiberSet.d.ts",
|
| 247 |
+
"import": "./dist/esm/FiberSet.js",
|
| 248 |
+
"default": "./dist/cjs/FiberSet.js"
|
| 249 |
+
},
|
| 250 |
+
"./FiberStatus": {
|
| 251 |
+
"types": "./dist/dts/FiberStatus.d.ts",
|
| 252 |
+
"import": "./dist/esm/FiberStatus.js",
|
| 253 |
+
"default": "./dist/cjs/FiberStatus.js"
|
| 254 |
+
},
|
| 255 |
+
"./Function": {
|
| 256 |
+
"types": "./dist/dts/Function.d.ts",
|
| 257 |
+
"import": "./dist/esm/Function.js",
|
| 258 |
+
"default": "./dist/cjs/Function.js"
|
| 259 |
+
},
|
| 260 |
+
"./GlobalValue": {
|
| 261 |
+
"types": "./dist/dts/GlobalValue.d.ts",
|
| 262 |
+
"import": "./dist/esm/GlobalValue.js",
|
| 263 |
+
"default": "./dist/cjs/GlobalValue.js"
|
| 264 |
+
},
|
| 265 |
+
"./Graph": {
|
| 266 |
+
"types": "./dist/dts/Graph.d.ts",
|
| 267 |
+
"import": "./dist/esm/Graph.js",
|
| 268 |
+
"default": "./dist/cjs/Graph.js"
|
| 269 |
+
},
|
| 270 |
+
"./GroupBy": {
|
| 271 |
+
"types": "./dist/dts/GroupBy.d.ts",
|
| 272 |
+
"import": "./dist/esm/GroupBy.js",
|
| 273 |
+
"default": "./dist/cjs/GroupBy.js"
|
| 274 |
+
},
|
| 275 |
+
"./HKT": {
|
| 276 |
+
"types": "./dist/dts/HKT.d.ts",
|
| 277 |
+
"import": "./dist/esm/HKT.js",
|
| 278 |
+
"default": "./dist/cjs/HKT.js"
|
| 279 |
+
},
|
| 280 |
+
"./Hash": {
|
| 281 |
+
"types": "./dist/dts/Hash.d.ts",
|
| 282 |
+
"import": "./dist/esm/Hash.js",
|
| 283 |
+
"default": "./dist/cjs/Hash.js"
|
| 284 |
+
},
|
| 285 |
+
"./HashMap": {
|
| 286 |
+
"types": "./dist/dts/HashMap.d.ts",
|
| 287 |
+
"import": "./dist/esm/HashMap.js",
|
| 288 |
+
"default": "./dist/cjs/HashMap.js"
|
| 289 |
+
},
|
| 290 |
+
"./HashRing": {
|
| 291 |
+
"types": "./dist/dts/HashRing.d.ts",
|
| 292 |
+
"import": "./dist/esm/HashRing.js",
|
| 293 |
+
"default": "./dist/cjs/HashRing.js"
|
| 294 |
+
},
|
| 295 |
+
"./HashSet": {
|
| 296 |
+
"types": "./dist/dts/HashSet.d.ts",
|
| 297 |
+
"import": "./dist/esm/HashSet.js",
|
| 298 |
+
"default": "./dist/cjs/HashSet.js"
|
| 299 |
+
},
|
| 300 |
+
"./Inspectable": {
|
| 301 |
+
"types": "./dist/dts/Inspectable.d.ts",
|
| 302 |
+
"import": "./dist/esm/Inspectable.js",
|
| 303 |
+
"default": "./dist/cjs/Inspectable.js"
|
| 304 |
+
},
|
| 305 |
+
"./Iterable": {
|
| 306 |
+
"types": "./dist/dts/Iterable.d.ts",
|
| 307 |
+
"import": "./dist/esm/Iterable.js",
|
| 308 |
+
"default": "./dist/cjs/Iterable.js"
|
| 309 |
+
},
|
| 310 |
+
"./JSONSchema": {
|
| 311 |
+
"types": "./dist/dts/JSONSchema.d.ts",
|
| 312 |
+
"import": "./dist/esm/JSONSchema.js",
|
| 313 |
+
"default": "./dist/cjs/JSONSchema.js"
|
| 314 |
+
},
|
| 315 |
+
"./KeyedPool": {
|
| 316 |
+
"types": "./dist/dts/KeyedPool.d.ts",
|
| 317 |
+
"import": "./dist/esm/KeyedPool.js",
|
| 318 |
+
"default": "./dist/cjs/KeyedPool.js"
|
| 319 |
+
},
|
| 320 |
+
"./Layer": {
|
| 321 |
+
"types": "./dist/dts/Layer.d.ts",
|
| 322 |
+
"import": "./dist/esm/Layer.js",
|
| 323 |
+
"default": "./dist/cjs/Layer.js"
|
| 324 |
+
},
|
| 325 |
+
"./LayerMap": {
|
| 326 |
+
"types": "./dist/dts/LayerMap.d.ts",
|
| 327 |
+
"import": "./dist/esm/LayerMap.js",
|
| 328 |
+
"default": "./dist/cjs/LayerMap.js"
|
| 329 |
+
},
|
| 330 |
+
"./List": {
|
| 331 |
+
"types": "./dist/dts/List.d.ts",
|
| 332 |
+
"import": "./dist/esm/List.js",
|
| 333 |
+
"default": "./dist/cjs/List.js"
|
| 334 |
+
},
|
| 335 |
+
"./LogLevel": {
|
| 336 |
+
"types": "./dist/dts/LogLevel.d.ts",
|
| 337 |
+
"import": "./dist/esm/LogLevel.js",
|
| 338 |
+
"default": "./dist/cjs/LogLevel.js"
|
| 339 |
+
},
|
| 340 |
+
"./LogSpan": {
|
| 341 |
+
"types": "./dist/dts/LogSpan.d.ts",
|
| 342 |
+
"import": "./dist/esm/LogSpan.js",
|
| 343 |
+
"default": "./dist/cjs/LogSpan.js"
|
| 344 |
+
},
|
| 345 |
+
"./Logger": {
|
| 346 |
+
"types": "./dist/dts/Logger.d.ts",
|
| 347 |
+
"import": "./dist/esm/Logger.js",
|
| 348 |
+
"default": "./dist/cjs/Logger.js"
|
| 349 |
+
},
|
| 350 |
+
"./Mailbox": {
|
| 351 |
+
"types": "./dist/dts/Mailbox.d.ts",
|
| 352 |
+
"import": "./dist/esm/Mailbox.js",
|
| 353 |
+
"default": "./dist/cjs/Mailbox.js"
|
| 354 |
+
},
|
| 355 |
+
"./ManagedRuntime": {
|
| 356 |
+
"types": "./dist/dts/ManagedRuntime.d.ts",
|
| 357 |
+
"import": "./dist/esm/ManagedRuntime.js",
|
| 358 |
+
"default": "./dist/cjs/ManagedRuntime.js"
|
| 359 |
+
},
|
| 360 |
+
"./Match": {
|
| 361 |
+
"types": "./dist/dts/Match.d.ts",
|
| 362 |
+
"import": "./dist/esm/Match.js",
|
| 363 |
+
"default": "./dist/cjs/Match.js"
|
| 364 |
+
},
|
| 365 |
+
"./MergeDecision": {
|
| 366 |
+
"types": "./dist/dts/MergeDecision.d.ts",
|
| 367 |
+
"import": "./dist/esm/MergeDecision.js",
|
| 368 |
+
"default": "./dist/cjs/MergeDecision.js"
|
| 369 |
+
},
|
| 370 |
+
"./MergeState": {
|
| 371 |
+
"types": "./dist/dts/MergeState.d.ts",
|
| 372 |
+
"import": "./dist/esm/MergeState.js",
|
| 373 |
+
"default": "./dist/cjs/MergeState.js"
|
| 374 |
+
},
|
| 375 |
+
"./MergeStrategy": {
|
| 376 |
+
"types": "./dist/dts/MergeStrategy.d.ts",
|
| 377 |
+
"import": "./dist/esm/MergeStrategy.js",
|
| 378 |
+
"default": "./dist/cjs/MergeStrategy.js"
|
| 379 |
+
},
|
| 380 |
+
"./Metric": {
|
| 381 |
+
"types": "./dist/dts/Metric.d.ts",
|
| 382 |
+
"import": "./dist/esm/Metric.js",
|
| 383 |
+
"default": "./dist/cjs/Metric.js"
|
| 384 |
+
},
|
| 385 |
+
"./MetricBoundaries": {
|
| 386 |
+
"types": "./dist/dts/MetricBoundaries.d.ts",
|
| 387 |
+
"import": "./dist/esm/MetricBoundaries.js",
|
| 388 |
+
"default": "./dist/cjs/MetricBoundaries.js"
|
| 389 |
+
},
|
| 390 |
+
"./MetricHook": {
|
| 391 |
+
"types": "./dist/dts/MetricHook.d.ts",
|
| 392 |
+
"import": "./dist/esm/MetricHook.js",
|
| 393 |
+
"default": "./dist/cjs/MetricHook.js"
|
| 394 |
+
},
|
| 395 |
+
"./MetricKey": {
|
| 396 |
+
"types": "./dist/dts/MetricKey.d.ts",
|
| 397 |
+
"import": "./dist/esm/MetricKey.js",
|
| 398 |
+
"default": "./dist/cjs/MetricKey.js"
|
| 399 |
+
},
|
| 400 |
+
"./MetricKeyType": {
|
| 401 |
+
"types": "./dist/dts/MetricKeyType.d.ts",
|
| 402 |
+
"import": "./dist/esm/MetricKeyType.js",
|
| 403 |
+
"default": "./dist/cjs/MetricKeyType.js"
|
| 404 |
+
},
|
| 405 |
+
"./MetricLabel": {
|
| 406 |
+
"types": "./dist/dts/MetricLabel.d.ts",
|
| 407 |
+
"import": "./dist/esm/MetricLabel.js",
|
| 408 |
+
"default": "./dist/cjs/MetricLabel.js"
|
| 409 |
+
},
|
| 410 |
+
"./MetricPair": {
|
| 411 |
+
"types": "./dist/dts/MetricPair.d.ts",
|
| 412 |
+
"import": "./dist/esm/MetricPair.js",
|
| 413 |
+
"default": "./dist/cjs/MetricPair.js"
|
| 414 |
+
},
|
| 415 |
+
"./MetricPolling": {
|
| 416 |
+
"types": "./dist/dts/MetricPolling.d.ts",
|
| 417 |
+
"import": "./dist/esm/MetricPolling.js",
|
| 418 |
+
"default": "./dist/cjs/MetricPolling.js"
|
| 419 |
+
},
|
| 420 |
+
"./MetricRegistry": {
|
| 421 |
+
"types": "./dist/dts/MetricRegistry.d.ts",
|
| 422 |
+
"import": "./dist/esm/MetricRegistry.js",
|
| 423 |
+
"default": "./dist/cjs/MetricRegistry.js"
|
| 424 |
+
},
|
| 425 |
+
"./MetricState": {
|
| 426 |
+
"types": "./dist/dts/MetricState.d.ts",
|
| 427 |
+
"import": "./dist/esm/MetricState.js",
|
| 428 |
+
"default": "./dist/cjs/MetricState.js"
|
| 429 |
+
},
|
| 430 |
+
"./Micro": {
|
| 431 |
+
"types": "./dist/dts/Micro.d.ts",
|
| 432 |
+
"import": "./dist/esm/Micro.js",
|
| 433 |
+
"default": "./dist/cjs/Micro.js"
|
| 434 |
+
},
|
| 435 |
+
"./ModuleVersion": {
|
| 436 |
+
"types": "./dist/dts/ModuleVersion.d.ts",
|
| 437 |
+
"import": "./dist/esm/ModuleVersion.js",
|
| 438 |
+
"default": "./dist/cjs/ModuleVersion.js"
|
| 439 |
+
},
|
| 440 |
+
"./MutableHashMap": {
|
| 441 |
+
"types": "./dist/dts/MutableHashMap.d.ts",
|
| 442 |
+
"import": "./dist/esm/MutableHashMap.js",
|
| 443 |
+
"default": "./dist/cjs/MutableHashMap.js"
|
| 444 |
+
},
|
| 445 |
+
"./MutableHashSet": {
|
| 446 |
+
"types": "./dist/dts/MutableHashSet.d.ts",
|
| 447 |
+
"import": "./dist/esm/MutableHashSet.js",
|
| 448 |
+
"default": "./dist/cjs/MutableHashSet.js"
|
| 449 |
+
},
|
| 450 |
+
"./MutableList": {
|
| 451 |
+
"types": "./dist/dts/MutableList.d.ts",
|
| 452 |
+
"import": "./dist/esm/MutableList.js",
|
| 453 |
+
"default": "./dist/cjs/MutableList.js"
|
| 454 |
+
},
|
| 455 |
+
"./MutableQueue": {
|
| 456 |
+
"types": "./dist/dts/MutableQueue.d.ts",
|
| 457 |
+
"import": "./dist/esm/MutableQueue.js",
|
| 458 |
+
"default": "./dist/cjs/MutableQueue.js"
|
| 459 |
+
},
|
| 460 |
+
"./MutableRef": {
|
| 461 |
+
"types": "./dist/dts/MutableRef.d.ts",
|
| 462 |
+
"import": "./dist/esm/MutableRef.js",
|
| 463 |
+
"default": "./dist/cjs/MutableRef.js"
|
| 464 |
+
},
|
| 465 |
+
"./NonEmptyIterable": {
|
| 466 |
+
"types": "./dist/dts/NonEmptyIterable.d.ts",
|
| 467 |
+
"import": "./dist/esm/NonEmptyIterable.js",
|
| 468 |
+
"default": "./dist/cjs/NonEmptyIterable.js"
|
| 469 |
+
},
|
| 470 |
+
"./Number": {
|
| 471 |
+
"types": "./dist/dts/Number.d.ts",
|
| 472 |
+
"import": "./dist/esm/Number.js",
|
| 473 |
+
"default": "./dist/cjs/Number.js"
|
| 474 |
+
},
|
| 475 |
+
"./Option": {
|
| 476 |
+
"types": "./dist/dts/Option.d.ts",
|
| 477 |
+
"import": "./dist/esm/Option.js",
|
| 478 |
+
"default": "./dist/cjs/Option.js"
|
| 479 |
+
},
|
| 480 |
+
"./Order": {
|
| 481 |
+
"types": "./dist/dts/Order.d.ts",
|
| 482 |
+
"import": "./dist/esm/Order.js",
|
| 483 |
+
"default": "./dist/cjs/Order.js"
|
| 484 |
+
},
|
| 485 |
+
"./Ordering": {
|
| 486 |
+
"types": "./dist/dts/Ordering.d.ts",
|
| 487 |
+
"import": "./dist/esm/Ordering.js",
|
| 488 |
+
"default": "./dist/cjs/Ordering.js"
|
| 489 |
+
},
|
| 490 |
+
"./ParseResult": {
|
| 491 |
+
"types": "./dist/dts/ParseResult.d.ts",
|
| 492 |
+
"import": "./dist/esm/ParseResult.js",
|
| 493 |
+
"default": "./dist/cjs/ParseResult.js"
|
| 494 |
+
},
|
| 495 |
+
"./PartitionedSemaphore": {
|
| 496 |
+
"types": "./dist/dts/PartitionedSemaphore.d.ts",
|
| 497 |
+
"import": "./dist/esm/PartitionedSemaphore.js",
|
| 498 |
+
"default": "./dist/cjs/PartitionedSemaphore.js"
|
| 499 |
+
},
|
| 500 |
+
"./Pipeable": {
|
| 501 |
+
"types": "./dist/dts/Pipeable.d.ts",
|
| 502 |
+
"import": "./dist/esm/Pipeable.js",
|
| 503 |
+
"default": "./dist/cjs/Pipeable.js"
|
| 504 |
+
},
|
| 505 |
+
"./Pool": {
|
| 506 |
+
"types": "./dist/dts/Pool.d.ts",
|
| 507 |
+
"import": "./dist/esm/Pool.js",
|
| 508 |
+
"default": "./dist/cjs/Pool.js"
|
| 509 |
+
},
|
| 510 |
+
"./Predicate": {
|
| 511 |
+
"types": "./dist/dts/Predicate.d.ts",
|
| 512 |
+
"import": "./dist/esm/Predicate.js",
|
| 513 |
+
"default": "./dist/cjs/Predicate.js"
|
| 514 |
+
},
|
| 515 |
+
"./Pretty": {
|
| 516 |
+
"types": "./dist/dts/Pretty.d.ts",
|
| 517 |
+
"import": "./dist/esm/Pretty.js",
|
| 518 |
+
"default": "./dist/cjs/Pretty.js"
|
| 519 |
+
},
|
| 520 |
+
"./PrimaryKey": {
|
| 521 |
+
"types": "./dist/dts/PrimaryKey.d.ts",
|
| 522 |
+
"import": "./dist/esm/PrimaryKey.js",
|
| 523 |
+
"default": "./dist/cjs/PrimaryKey.js"
|
| 524 |
+
},
|
| 525 |
+
"./PubSub": {
|
| 526 |
+
"types": "./dist/dts/PubSub.d.ts",
|
| 527 |
+
"import": "./dist/esm/PubSub.js",
|
| 528 |
+
"default": "./dist/cjs/PubSub.js"
|
| 529 |
+
},
|
| 530 |
+
"./Queue": {
|
| 531 |
+
"types": "./dist/dts/Queue.d.ts",
|
| 532 |
+
"import": "./dist/esm/Queue.js",
|
| 533 |
+
"default": "./dist/cjs/Queue.js"
|
| 534 |
+
},
|
| 535 |
+
"./Random": {
|
| 536 |
+
"types": "./dist/dts/Random.d.ts",
|
| 537 |
+
"import": "./dist/esm/Random.js",
|
| 538 |
+
"default": "./dist/cjs/Random.js"
|
| 539 |
+
},
|
| 540 |
+
"./RateLimiter": {
|
| 541 |
+
"types": "./dist/dts/RateLimiter.d.ts",
|
| 542 |
+
"import": "./dist/esm/RateLimiter.js",
|
| 543 |
+
"default": "./dist/cjs/RateLimiter.js"
|
| 544 |
+
},
|
| 545 |
+
"./RcMap": {
|
| 546 |
+
"types": "./dist/dts/RcMap.d.ts",
|
| 547 |
+
"import": "./dist/esm/RcMap.js",
|
| 548 |
+
"default": "./dist/cjs/RcMap.js"
|
| 549 |
+
},
|
| 550 |
+
"./RcRef": {
|
| 551 |
+
"types": "./dist/dts/RcRef.d.ts",
|
| 552 |
+
"import": "./dist/esm/RcRef.js",
|
| 553 |
+
"default": "./dist/cjs/RcRef.js"
|
| 554 |
+
},
|
| 555 |
+
"./Readable": {
|
| 556 |
+
"types": "./dist/dts/Readable.d.ts",
|
| 557 |
+
"import": "./dist/esm/Readable.js",
|
| 558 |
+
"default": "./dist/cjs/Readable.js"
|
| 559 |
+
},
|
| 560 |
+
"./Record": {
|
| 561 |
+
"types": "./dist/dts/Record.d.ts",
|
| 562 |
+
"import": "./dist/esm/Record.js",
|
| 563 |
+
"default": "./dist/cjs/Record.js"
|
| 564 |
+
},
|
| 565 |
+
"./RedBlackTree": {
|
| 566 |
+
"types": "./dist/dts/RedBlackTree.d.ts",
|
| 567 |
+
"import": "./dist/esm/RedBlackTree.js",
|
| 568 |
+
"default": "./dist/cjs/RedBlackTree.js"
|
| 569 |
+
},
|
| 570 |
+
"./Redacted": {
|
| 571 |
+
"types": "./dist/dts/Redacted.d.ts",
|
| 572 |
+
"import": "./dist/esm/Redacted.js",
|
| 573 |
+
"default": "./dist/cjs/Redacted.js"
|
| 574 |
+
},
|
| 575 |
+
"./Ref": {
|
| 576 |
+
"types": "./dist/dts/Ref.d.ts",
|
| 577 |
+
"import": "./dist/esm/Ref.js",
|
| 578 |
+
"default": "./dist/cjs/Ref.js"
|
| 579 |
+
},
|
| 580 |
+
"./RegExp": {
|
| 581 |
+
"types": "./dist/dts/RegExp.d.ts",
|
| 582 |
+
"import": "./dist/esm/RegExp.js",
|
| 583 |
+
"default": "./dist/cjs/RegExp.js"
|
| 584 |
+
},
|
| 585 |
+
"./Reloadable": {
|
| 586 |
+
"types": "./dist/dts/Reloadable.d.ts",
|
| 587 |
+
"import": "./dist/esm/Reloadable.js",
|
| 588 |
+
"default": "./dist/cjs/Reloadable.js"
|
| 589 |
+
},
|
| 590 |
+
"./Request": {
|
| 591 |
+
"types": "./dist/dts/Request.d.ts",
|
| 592 |
+
"import": "./dist/esm/Request.js",
|
| 593 |
+
"default": "./dist/cjs/Request.js"
|
| 594 |
+
},
|
| 595 |
+
"./RequestBlock": {
|
| 596 |
+
"types": "./dist/dts/RequestBlock.d.ts",
|
| 597 |
+
"import": "./dist/esm/RequestBlock.js",
|
| 598 |
+
"default": "./dist/cjs/RequestBlock.js"
|
| 599 |
+
},
|
| 600 |
+
"./RequestResolver": {
|
| 601 |
+
"types": "./dist/dts/RequestResolver.d.ts",
|
| 602 |
+
"import": "./dist/esm/RequestResolver.js",
|
| 603 |
+
"default": "./dist/cjs/RequestResolver.js"
|
| 604 |
+
},
|
| 605 |
+
"./Resource": {
|
| 606 |
+
"types": "./dist/dts/Resource.d.ts",
|
| 607 |
+
"import": "./dist/esm/Resource.js",
|
| 608 |
+
"default": "./dist/cjs/Resource.js"
|
| 609 |
+
},
|
| 610 |
+
"./Runtime": {
|
| 611 |
+
"types": "./dist/dts/Runtime.d.ts",
|
| 612 |
+
"import": "./dist/esm/Runtime.js",
|
| 613 |
+
"default": "./dist/cjs/Runtime.js"
|
| 614 |
+
},
|
| 615 |
+
"./RuntimeFlags": {
|
| 616 |
+
"types": "./dist/dts/RuntimeFlags.d.ts",
|
| 617 |
+
"import": "./dist/esm/RuntimeFlags.js",
|
| 618 |
+
"default": "./dist/cjs/RuntimeFlags.js"
|
| 619 |
+
},
|
| 620 |
+
"./RuntimeFlagsPatch": {
|
| 621 |
+
"types": "./dist/dts/RuntimeFlagsPatch.d.ts",
|
| 622 |
+
"import": "./dist/esm/RuntimeFlagsPatch.js",
|
| 623 |
+
"default": "./dist/cjs/RuntimeFlagsPatch.js"
|
| 624 |
+
},
|
| 625 |
+
"./STM": {
|
| 626 |
+
"types": "./dist/dts/STM.d.ts",
|
| 627 |
+
"import": "./dist/esm/STM.js",
|
| 628 |
+
"default": "./dist/cjs/STM.js"
|
| 629 |
+
},
|
| 630 |
+
"./Schedule": {
|
| 631 |
+
"types": "./dist/dts/Schedule.d.ts",
|
| 632 |
+
"import": "./dist/esm/Schedule.js",
|
| 633 |
+
"default": "./dist/cjs/Schedule.js"
|
| 634 |
+
},
|
| 635 |
+
"./ScheduleDecision": {
|
| 636 |
+
"types": "./dist/dts/ScheduleDecision.d.ts",
|
| 637 |
+
"import": "./dist/esm/ScheduleDecision.js",
|
| 638 |
+
"default": "./dist/cjs/ScheduleDecision.js"
|
| 639 |
+
},
|
| 640 |
+
"./ScheduleInterval": {
|
| 641 |
+
"types": "./dist/dts/ScheduleInterval.d.ts",
|
| 642 |
+
"import": "./dist/esm/ScheduleInterval.js",
|
| 643 |
+
"default": "./dist/cjs/ScheduleInterval.js"
|
| 644 |
+
},
|
| 645 |
+
"./ScheduleIntervals": {
|
| 646 |
+
"types": "./dist/dts/ScheduleIntervals.d.ts",
|
| 647 |
+
"import": "./dist/esm/ScheduleIntervals.js",
|
| 648 |
+
"default": "./dist/cjs/ScheduleIntervals.js"
|
| 649 |
+
},
|
| 650 |
+
"./Scheduler": {
|
| 651 |
+
"types": "./dist/dts/Scheduler.d.ts",
|
| 652 |
+
"import": "./dist/esm/Scheduler.js",
|
| 653 |
+
"default": "./dist/cjs/Scheduler.js"
|
| 654 |
+
},
|
| 655 |
+
"./Schema": {
|
| 656 |
+
"types": "./dist/dts/Schema.d.ts",
|
| 657 |
+
"import": "./dist/esm/Schema.js",
|
| 658 |
+
"default": "./dist/cjs/Schema.js"
|
| 659 |
+
},
|
| 660 |
+
"./SchemaAST": {
|
| 661 |
+
"types": "./dist/dts/SchemaAST.d.ts",
|
| 662 |
+
"import": "./dist/esm/SchemaAST.js",
|
| 663 |
+
"default": "./dist/cjs/SchemaAST.js"
|
| 664 |
+
},
|
| 665 |
+
"./Scope": {
|
| 666 |
+
"types": "./dist/dts/Scope.d.ts",
|
| 667 |
+
"import": "./dist/esm/Scope.js",
|
| 668 |
+
"default": "./dist/cjs/Scope.js"
|
| 669 |
+
},
|
| 670 |
+
"./ScopedCache": {
|
| 671 |
+
"types": "./dist/dts/ScopedCache.d.ts",
|
| 672 |
+
"import": "./dist/esm/ScopedCache.js",
|
| 673 |
+
"default": "./dist/cjs/ScopedCache.js"
|
| 674 |
+
},
|
| 675 |
+
"./ScopedRef": {
|
| 676 |
+
"types": "./dist/dts/ScopedRef.d.ts",
|
| 677 |
+
"import": "./dist/esm/ScopedRef.js",
|
| 678 |
+
"default": "./dist/cjs/ScopedRef.js"
|
| 679 |
+
},
|
| 680 |
+
"./Secret": {
|
| 681 |
+
"types": "./dist/dts/Secret.d.ts",
|
| 682 |
+
"import": "./dist/esm/Secret.js",
|
| 683 |
+
"default": "./dist/cjs/Secret.js"
|
| 684 |
+
},
|
| 685 |
+
"./SingleProducerAsyncInput": {
|
| 686 |
+
"types": "./dist/dts/SingleProducerAsyncInput.d.ts",
|
| 687 |
+
"import": "./dist/esm/SingleProducerAsyncInput.js",
|
| 688 |
+
"default": "./dist/cjs/SingleProducerAsyncInput.js"
|
| 689 |
+
},
|
| 690 |
+
"./Sink": {
|
| 691 |
+
"types": "./dist/dts/Sink.d.ts",
|
| 692 |
+
"import": "./dist/esm/Sink.js",
|
| 693 |
+
"default": "./dist/cjs/Sink.js"
|
| 694 |
+
},
|
| 695 |
+
"./SortedMap": {
|
| 696 |
+
"types": "./dist/dts/SortedMap.d.ts",
|
| 697 |
+
"import": "./dist/esm/SortedMap.js",
|
| 698 |
+
"default": "./dist/cjs/SortedMap.js"
|
| 699 |
+
},
|
| 700 |
+
"./SortedSet": {
|
| 701 |
+
"types": "./dist/dts/SortedSet.d.ts",
|
| 702 |
+
"import": "./dist/esm/SortedSet.js",
|
| 703 |
+
"default": "./dist/cjs/SortedSet.js"
|
| 704 |
+
},
|
| 705 |
+
"./Stream": {
|
| 706 |
+
"types": "./dist/dts/Stream.d.ts",
|
| 707 |
+
"import": "./dist/esm/Stream.js",
|
| 708 |
+
"default": "./dist/cjs/Stream.js"
|
| 709 |
+
},
|
| 710 |
+
"./StreamEmit": {
|
| 711 |
+
"types": "./dist/dts/StreamEmit.d.ts",
|
| 712 |
+
"import": "./dist/esm/StreamEmit.js",
|
| 713 |
+
"default": "./dist/cjs/StreamEmit.js"
|
| 714 |
+
},
|
| 715 |
+
"./StreamHaltStrategy": {
|
| 716 |
+
"types": "./dist/dts/StreamHaltStrategy.d.ts",
|
| 717 |
+
"import": "./dist/esm/StreamHaltStrategy.js",
|
| 718 |
+
"default": "./dist/cjs/StreamHaltStrategy.js"
|
| 719 |
+
},
|
| 720 |
+
"./Streamable": {
|
| 721 |
+
"types": "./dist/dts/Streamable.d.ts",
|
| 722 |
+
"import": "./dist/esm/Streamable.js",
|
| 723 |
+
"default": "./dist/cjs/Streamable.js"
|
| 724 |
+
},
|
| 725 |
+
"./String": {
|
| 726 |
+
"types": "./dist/dts/String.d.ts",
|
| 727 |
+
"import": "./dist/esm/String.js",
|
| 728 |
+
"default": "./dist/cjs/String.js"
|
| 729 |
+
},
|
| 730 |
+
"./Struct": {
|
| 731 |
+
"types": "./dist/dts/Struct.d.ts",
|
| 732 |
+
"import": "./dist/esm/Struct.js",
|
| 733 |
+
"default": "./dist/cjs/Struct.js"
|
| 734 |
+
},
|
| 735 |
+
"./Subscribable": {
|
| 736 |
+
"types": "./dist/dts/Subscribable.d.ts",
|
| 737 |
+
"import": "./dist/esm/Subscribable.js",
|
| 738 |
+
"default": "./dist/cjs/Subscribable.js"
|
| 739 |
+
},
|
| 740 |
+
"./SubscriptionRef": {
|
| 741 |
+
"types": "./dist/dts/SubscriptionRef.d.ts",
|
| 742 |
+
"import": "./dist/esm/SubscriptionRef.js",
|
| 743 |
+
"default": "./dist/cjs/SubscriptionRef.js"
|
| 744 |
+
},
|
| 745 |
+
"./Supervisor": {
|
| 746 |
+
"types": "./dist/dts/Supervisor.d.ts",
|
| 747 |
+
"import": "./dist/esm/Supervisor.js",
|
| 748 |
+
"default": "./dist/cjs/Supervisor.js"
|
| 749 |
+
},
|
| 750 |
+
"./Symbol": {
|
| 751 |
+
"types": "./dist/dts/Symbol.d.ts",
|
| 752 |
+
"import": "./dist/esm/Symbol.js",
|
| 753 |
+
"default": "./dist/cjs/Symbol.js"
|
| 754 |
+
},
|
| 755 |
+
"./SynchronizedRef": {
|
| 756 |
+
"types": "./dist/dts/SynchronizedRef.d.ts",
|
| 757 |
+
"import": "./dist/esm/SynchronizedRef.js",
|
| 758 |
+
"default": "./dist/cjs/SynchronizedRef.js"
|
| 759 |
+
},
|
| 760 |
+
"./TArray": {
|
| 761 |
+
"types": "./dist/dts/TArray.d.ts",
|
| 762 |
+
"import": "./dist/esm/TArray.js",
|
| 763 |
+
"default": "./dist/cjs/TArray.js"
|
| 764 |
+
},
|
| 765 |
+
"./TDeferred": {
|
| 766 |
+
"types": "./dist/dts/TDeferred.d.ts",
|
| 767 |
+
"import": "./dist/esm/TDeferred.js",
|
| 768 |
+
"default": "./dist/cjs/TDeferred.js"
|
| 769 |
+
},
|
| 770 |
+
"./TMap": {
|
| 771 |
+
"types": "./dist/dts/TMap.d.ts",
|
| 772 |
+
"import": "./dist/esm/TMap.js",
|
| 773 |
+
"default": "./dist/cjs/TMap.js"
|
| 774 |
+
},
|
| 775 |
+
"./TPriorityQueue": {
|
| 776 |
+
"types": "./dist/dts/TPriorityQueue.d.ts",
|
| 777 |
+
"import": "./dist/esm/TPriorityQueue.js",
|
| 778 |
+
"default": "./dist/cjs/TPriorityQueue.js"
|
| 779 |
+
},
|
| 780 |
+
"./TPubSub": {
|
| 781 |
+
"types": "./dist/dts/TPubSub.d.ts",
|
| 782 |
+
"import": "./dist/esm/TPubSub.js",
|
| 783 |
+
"default": "./dist/cjs/TPubSub.js"
|
| 784 |
+
},
|
| 785 |
+
"./TQueue": {
|
| 786 |
+
"types": "./dist/dts/TQueue.d.ts",
|
| 787 |
+
"import": "./dist/esm/TQueue.js",
|
| 788 |
+
"default": "./dist/cjs/TQueue.js"
|
| 789 |
+
},
|
| 790 |
+
"./TRandom": {
|
| 791 |
+
"types": "./dist/dts/TRandom.d.ts",
|
| 792 |
+
"import": "./dist/esm/TRandom.js",
|
| 793 |
+
"default": "./dist/cjs/TRandom.js"
|
| 794 |
+
},
|
| 795 |
+
"./TReentrantLock": {
|
| 796 |
+
"types": "./dist/dts/TReentrantLock.d.ts",
|
| 797 |
+
"import": "./dist/esm/TReentrantLock.js",
|
| 798 |
+
"default": "./dist/cjs/TReentrantLock.js"
|
| 799 |
+
},
|
| 800 |
+
"./TRef": {
|
| 801 |
+
"types": "./dist/dts/TRef.d.ts",
|
| 802 |
+
"import": "./dist/esm/TRef.js",
|
| 803 |
+
"default": "./dist/cjs/TRef.js"
|
| 804 |
+
},
|
| 805 |
+
"./TSemaphore": {
|
| 806 |
+
"types": "./dist/dts/TSemaphore.d.ts",
|
| 807 |
+
"import": "./dist/esm/TSemaphore.js",
|
| 808 |
+
"default": "./dist/cjs/TSemaphore.js"
|
| 809 |
+
},
|
| 810 |
+
"./TSet": {
|
| 811 |
+
"types": "./dist/dts/TSet.d.ts",
|
| 812 |
+
"import": "./dist/esm/TSet.js",
|
| 813 |
+
"default": "./dist/cjs/TSet.js"
|
| 814 |
+
},
|
| 815 |
+
"./TSubscriptionRef": {
|
| 816 |
+
"types": "./dist/dts/TSubscriptionRef.d.ts",
|
| 817 |
+
"import": "./dist/esm/TSubscriptionRef.js",
|
| 818 |
+
"default": "./dist/cjs/TSubscriptionRef.js"
|
| 819 |
+
},
|
| 820 |
+
"./Take": {
|
| 821 |
+
"types": "./dist/dts/Take.d.ts",
|
| 822 |
+
"import": "./dist/esm/Take.js",
|
| 823 |
+
"default": "./dist/cjs/Take.js"
|
| 824 |
+
},
|
| 825 |
+
"./TestAnnotation": {
|
| 826 |
+
"types": "./dist/dts/TestAnnotation.d.ts",
|
| 827 |
+
"import": "./dist/esm/TestAnnotation.js",
|
| 828 |
+
"default": "./dist/cjs/TestAnnotation.js"
|
| 829 |
+
},
|
| 830 |
+
"./TestAnnotationMap": {
|
| 831 |
+
"types": "./dist/dts/TestAnnotationMap.d.ts",
|
| 832 |
+
"import": "./dist/esm/TestAnnotationMap.js",
|
| 833 |
+
"default": "./dist/cjs/TestAnnotationMap.js"
|
| 834 |
+
},
|
| 835 |
+
"./TestAnnotations": {
|
| 836 |
+
"types": "./dist/dts/TestAnnotations.d.ts",
|
| 837 |
+
"import": "./dist/esm/TestAnnotations.js",
|
| 838 |
+
"default": "./dist/cjs/TestAnnotations.js"
|
| 839 |
+
},
|
| 840 |
+
"./TestClock": {
|
| 841 |
+
"types": "./dist/dts/TestClock.d.ts",
|
| 842 |
+
"import": "./dist/esm/TestClock.js",
|
| 843 |
+
"default": "./dist/cjs/TestClock.js"
|
| 844 |
+
},
|
| 845 |
+
"./TestConfig": {
|
| 846 |
+
"types": "./dist/dts/TestConfig.d.ts",
|
| 847 |
+
"import": "./dist/esm/TestConfig.js",
|
| 848 |
+
"default": "./dist/cjs/TestConfig.js"
|
| 849 |
+
},
|
| 850 |
+
"./TestContext": {
|
| 851 |
+
"types": "./dist/dts/TestContext.d.ts",
|
| 852 |
+
"import": "./dist/esm/TestContext.js",
|
| 853 |
+
"default": "./dist/cjs/TestContext.js"
|
| 854 |
+
},
|
| 855 |
+
"./TestLive": {
|
| 856 |
+
"types": "./dist/dts/TestLive.d.ts",
|
| 857 |
+
"import": "./dist/esm/TestLive.js",
|
| 858 |
+
"default": "./dist/cjs/TestLive.js"
|
| 859 |
+
},
|
| 860 |
+
"./TestServices": {
|
| 861 |
+
"types": "./dist/dts/TestServices.d.ts",
|
| 862 |
+
"import": "./dist/esm/TestServices.js",
|
| 863 |
+
"default": "./dist/cjs/TestServices.js"
|
| 864 |
+
},
|
| 865 |
+
"./TestSized": {
|
| 866 |
+
"types": "./dist/dts/TestSized.d.ts",
|
| 867 |
+
"import": "./dist/esm/TestSized.js",
|
| 868 |
+
"default": "./dist/cjs/TestSized.js"
|
| 869 |
+
},
|
| 870 |
+
"./Tracer": {
|
| 871 |
+
"types": "./dist/dts/Tracer.d.ts",
|
| 872 |
+
"import": "./dist/esm/Tracer.js",
|
| 873 |
+
"default": "./dist/cjs/Tracer.js"
|
| 874 |
+
},
|
| 875 |
+
"./Trie": {
|
| 876 |
+
"types": "./dist/dts/Trie.d.ts",
|
| 877 |
+
"import": "./dist/esm/Trie.js",
|
| 878 |
+
"default": "./dist/cjs/Trie.js"
|
| 879 |
+
},
|
| 880 |
+
"./Tuple": {
|
| 881 |
+
"types": "./dist/dts/Tuple.d.ts",
|
| 882 |
+
"import": "./dist/esm/Tuple.js",
|
| 883 |
+
"default": "./dist/cjs/Tuple.js"
|
| 884 |
+
},
|
| 885 |
+
"./Types": {
|
| 886 |
+
"types": "./dist/dts/Types.d.ts",
|
| 887 |
+
"import": "./dist/esm/Types.js",
|
| 888 |
+
"default": "./dist/cjs/Types.js"
|
| 889 |
+
},
|
| 890 |
+
"./Unify": {
|
| 891 |
+
"types": "./dist/dts/Unify.d.ts",
|
| 892 |
+
"import": "./dist/esm/Unify.js",
|
| 893 |
+
"default": "./dist/cjs/Unify.js"
|
| 894 |
+
},
|
| 895 |
+
"./UpstreamPullRequest": {
|
| 896 |
+
"types": "./dist/dts/UpstreamPullRequest.d.ts",
|
| 897 |
+
"import": "./dist/esm/UpstreamPullRequest.js",
|
| 898 |
+
"default": "./dist/cjs/UpstreamPullRequest.js"
|
| 899 |
+
},
|
| 900 |
+
"./UpstreamPullStrategy": {
|
| 901 |
+
"types": "./dist/dts/UpstreamPullStrategy.d.ts",
|
| 902 |
+
"import": "./dist/esm/UpstreamPullStrategy.js",
|
| 903 |
+
"default": "./dist/cjs/UpstreamPullStrategy.js"
|
| 904 |
+
},
|
| 905 |
+
"./Utils": {
|
| 906 |
+
"types": "./dist/dts/Utils.d.ts",
|
| 907 |
+
"import": "./dist/esm/Utils.js",
|
| 908 |
+
"default": "./dist/cjs/Utils.js"
|
| 909 |
+
},
|
| 910 |
+
"./index": {
|
| 911 |
+
"types": "./dist/dts/index.d.ts",
|
| 912 |
+
"import": "./dist/esm/index.js",
|
| 913 |
+
"default": "./dist/cjs/index.js"
|
| 914 |
+
}
|
| 915 |
+
},
|
| 916 |
+
"typesVersions": {
|
| 917 |
+
"*": {
|
| 918 |
+
".index": [
|
| 919 |
+
"./dist/dts/.index.d.ts"
|
| 920 |
+
],
|
| 921 |
+
"Arbitrary": [
|
| 922 |
+
"./dist/dts/Arbitrary.d.ts"
|
| 923 |
+
],
|
| 924 |
+
"Array": [
|
| 925 |
+
"./dist/dts/Array.d.ts"
|
| 926 |
+
],
|
| 927 |
+
"BigDecimal": [
|
| 928 |
+
"./dist/dts/BigDecimal.d.ts"
|
| 929 |
+
],
|
| 930 |
+
"BigInt": [
|
| 931 |
+
"./dist/dts/BigInt.d.ts"
|
| 932 |
+
],
|
| 933 |
+
"Boolean": [
|
| 934 |
+
"./dist/dts/Boolean.d.ts"
|
| 935 |
+
],
|
| 936 |
+
"Brand": [
|
| 937 |
+
"./dist/dts/Brand.d.ts"
|
| 938 |
+
],
|
| 939 |
+
"Cache": [
|
| 940 |
+
"./dist/dts/Cache.d.ts"
|
| 941 |
+
],
|
| 942 |
+
"Cause": [
|
| 943 |
+
"./dist/dts/Cause.d.ts"
|
| 944 |
+
],
|
| 945 |
+
"Channel": [
|
| 946 |
+
"./dist/dts/Channel.d.ts"
|
| 947 |
+
],
|
| 948 |
+
"ChildExecutorDecision": [
|
| 949 |
+
"./dist/dts/ChildExecutorDecision.d.ts"
|
| 950 |
+
],
|
| 951 |
+
"Chunk": [
|
| 952 |
+
"./dist/dts/Chunk.d.ts"
|
| 953 |
+
],
|
| 954 |
+
"Clock": [
|
| 955 |
+
"./dist/dts/Clock.d.ts"
|
| 956 |
+
],
|
| 957 |
+
"Config": [
|
| 958 |
+
"./dist/dts/Config.d.ts"
|
| 959 |
+
],
|
| 960 |
+
"ConfigError": [
|
| 961 |
+
"./dist/dts/ConfigError.d.ts"
|
| 962 |
+
],
|
| 963 |
+
"ConfigProvider": [
|
| 964 |
+
"./dist/dts/ConfigProvider.d.ts"
|
| 965 |
+
],
|
| 966 |
+
"ConfigProviderPathPatch": [
|
| 967 |
+
"./dist/dts/ConfigProviderPathPatch.d.ts"
|
| 968 |
+
],
|
| 969 |
+
"Console": [
|
| 970 |
+
"./dist/dts/Console.d.ts"
|
| 971 |
+
],
|
| 972 |
+
"Context": [
|
| 973 |
+
"./dist/dts/Context.d.ts"
|
| 974 |
+
],
|
| 975 |
+
"Cron": [
|
| 976 |
+
"./dist/dts/Cron.d.ts"
|
| 977 |
+
],
|
| 978 |
+
"Data": [
|
| 979 |
+
"./dist/dts/Data.d.ts"
|
| 980 |
+
],
|
| 981 |
+
"DateTime": [
|
| 982 |
+
"./dist/dts/DateTime.d.ts"
|
| 983 |
+
],
|
| 984 |
+
"DefaultServices": [
|
| 985 |
+
"./dist/dts/DefaultServices.d.ts"
|
| 986 |
+
],
|
| 987 |
+
"Deferred": [
|
| 988 |
+
"./dist/dts/Deferred.d.ts"
|
| 989 |
+
],
|
| 990 |
+
"Differ": [
|
| 991 |
+
"./dist/dts/Differ.d.ts"
|
| 992 |
+
],
|
| 993 |
+
"Duration": [
|
| 994 |
+
"./dist/dts/Duration.d.ts"
|
| 995 |
+
],
|
| 996 |
+
"Effect": [
|
| 997 |
+
"./dist/dts/Effect.d.ts"
|
| 998 |
+
],
|
| 999 |
+
"Effectable": [
|
| 1000 |
+
"./dist/dts/Effectable.d.ts"
|
| 1001 |
+
],
|
| 1002 |
+
"Either": [
|
| 1003 |
+
"./dist/dts/Either.d.ts"
|
| 1004 |
+
],
|
| 1005 |
+
"Encoding": [
|
| 1006 |
+
"./dist/dts/Encoding.d.ts"
|
| 1007 |
+
],
|
| 1008 |
+
"Equal": [
|
| 1009 |
+
"./dist/dts/Equal.d.ts"
|
| 1010 |
+
],
|
| 1011 |
+
"Equivalence": [
|
| 1012 |
+
"./dist/dts/Equivalence.d.ts"
|
| 1013 |
+
],
|
| 1014 |
+
"ExecutionPlan": [
|
| 1015 |
+
"./dist/dts/ExecutionPlan.d.ts"
|
| 1016 |
+
],
|
| 1017 |
+
"ExecutionStrategy": [
|
| 1018 |
+
"./dist/dts/ExecutionStrategy.d.ts"
|
| 1019 |
+
],
|
| 1020 |
+
"Exit": [
|
| 1021 |
+
"./dist/dts/Exit.d.ts"
|
| 1022 |
+
],
|
| 1023 |
+
"FastCheck": [
|
| 1024 |
+
"./dist/dts/FastCheck.d.ts"
|
| 1025 |
+
],
|
| 1026 |
+
"Fiber": [
|
| 1027 |
+
"./dist/dts/Fiber.d.ts"
|
| 1028 |
+
],
|
| 1029 |
+
"FiberHandle": [
|
| 1030 |
+
"./dist/dts/FiberHandle.d.ts"
|
| 1031 |
+
],
|
| 1032 |
+
"FiberId": [
|
| 1033 |
+
"./dist/dts/FiberId.d.ts"
|
| 1034 |
+
],
|
| 1035 |
+
"FiberMap": [
|
| 1036 |
+
"./dist/dts/FiberMap.d.ts"
|
| 1037 |
+
],
|
| 1038 |
+
"FiberRef": [
|
| 1039 |
+
"./dist/dts/FiberRef.d.ts"
|
| 1040 |
+
],
|
| 1041 |
+
"FiberRefs": [
|
| 1042 |
+
"./dist/dts/FiberRefs.d.ts"
|
| 1043 |
+
],
|
| 1044 |
+
"FiberRefsPatch": [
|
| 1045 |
+
"./dist/dts/FiberRefsPatch.d.ts"
|
| 1046 |
+
],
|
| 1047 |
+
"FiberSet": [
|
| 1048 |
+
"./dist/dts/FiberSet.d.ts"
|
| 1049 |
+
],
|
| 1050 |
+
"FiberStatus": [
|
| 1051 |
+
"./dist/dts/FiberStatus.d.ts"
|
| 1052 |
+
],
|
| 1053 |
+
"Function": [
|
| 1054 |
+
"./dist/dts/Function.d.ts"
|
| 1055 |
+
],
|
| 1056 |
+
"GlobalValue": [
|
| 1057 |
+
"./dist/dts/GlobalValue.d.ts"
|
| 1058 |
+
],
|
| 1059 |
+
"Graph": [
|
| 1060 |
+
"./dist/dts/Graph.d.ts"
|
| 1061 |
+
],
|
| 1062 |
+
"GroupBy": [
|
| 1063 |
+
"./dist/dts/GroupBy.d.ts"
|
| 1064 |
+
],
|
| 1065 |
+
"HKT": [
|
| 1066 |
+
"./dist/dts/HKT.d.ts"
|
| 1067 |
+
],
|
| 1068 |
+
"Hash": [
|
| 1069 |
+
"./dist/dts/Hash.d.ts"
|
| 1070 |
+
],
|
| 1071 |
+
"HashMap": [
|
| 1072 |
+
"./dist/dts/HashMap.d.ts"
|
| 1073 |
+
],
|
| 1074 |
+
"HashRing": [
|
| 1075 |
+
"./dist/dts/HashRing.d.ts"
|
| 1076 |
+
],
|
| 1077 |
+
"HashSet": [
|
| 1078 |
+
"./dist/dts/HashSet.d.ts"
|
| 1079 |
+
],
|
| 1080 |
+
"Inspectable": [
|
| 1081 |
+
"./dist/dts/Inspectable.d.ts"
|
| 1082 |
+
],
|
| 1083 |
+
"Iterable": [
|
| 1084 |
+
"./dist/dts/Iterable.d.ts"
|
| 1085 |
+
],
|
| 1086 |
+
"JSONSchema": [
|
| 1087 |
+
"./dist/dts/JSONSchema.d.ts"
|
| 1088 |
+
],
|
| 1089 |
+
"KeyedPool": [
|
| 1090 |
+
"./dist/dts/KeyedPool.d.ts"
|
| 1091 |
+
],
|
| 1092 |
+
"Layer": [
|
| 1093 |
+
"./dist/dts/Layer.d.ts"
|
| 1094 |
+
],
|
| 1095 |
+
"LayerMap": [
|
| 1096 |
+
"./dist/dts/LayerMap.d.ts"
|
| 1097 |
+
],
|
| 1098 |
+
"List": [
|
| 1099 |
+
"./dist/dts/List.d.ts"
|
| 1100 |
+
],
|
| 1101 |
+
"LogLevel": [
|
| 1102 |
+
"./dist/dts/LogLevel.d.ts"
|
| 1103 |
+
],
|
| 1104 |
+
"LogSpan": [
|
| 1105 |
+
"./dist/dts/LogSpan.d.ts"
|
| 1106 |
+
],
|
| 1107 |
+
"Logger": [
|
| 1108 |
+
"./dist/dts/Logger.d.ts"
|
| 1109 |
+
],
|
| 1110 |
+
"Mailbox": [
|
| 1111 |
+
"./dist/dts/Mailbox.d.ts"
|
| 1112 |
+
],
|
| 1113 |
+
"ManagedRuntime": [
|
| 1114 |
+
"./dist/dts/ManagedRuntime.d.ts"
|
| 1115 |
+
],
|
| 1116 |
+
"Match": [
|
| 1117 |
+
"./dist/dts/Match.d.ts"
|
| 1118 |
+
],
|
| 1119 |
+
"MergeDecision": [
|
| 1120 |
+
"./dist/dts/MergeDecision.d.ts"
|
| 1121 |
+
],
|
| 1122 |
+
"MergeState": [
|
| 1123 |
+
"./dist/dts/MergeState.d.ts"
|
| 1124 |
+
],
|
| 1125 |
+
"MergeStrategy": [
|
| 1126 |
+
"./dist/dts/MergeStrategy.d.ts"
|
| 1127 |
+
],
|
| 1128 |
+
"Metric": [
|
| 1129 |
+
"./dist/dts/Metric.d.ts"
|
| 1130 |
+
],
|
| 1131 |
+
"MetricBoundaries": [
|
| 1132 |
+
"./dist/dts/MetricBoundaries.d.ts"
|
| 1133 |
+
],
|
| 1134 |
+
"MetricHook": [
|
| 1135 |
+
"./dist/dts/MetricHook.d.ts"
|
| 1136 |
+
],
|
| 1137 |
+
"MetricKey": [
|
| 1138 |
+
"./dist/dts/MetricKey.d.ts"
|
| 1139 |
+
],
|
| 1140 |
+
"MetricKeyType": [
|
| 1141 |
+
"./dist/dts/MetricKeyType.d.ts"
|
| 1142 |
+
],
|
| 1143 |
+
"MetricLabel": [
|
| 1144 |
+
"./dist/dts/MetricLabel.d.ts"
|
| 1145 |
+
],
|
| 1146 |
+
"MetricPair": [
|
| 1147 |
+
"./dist/dts/MetricPair.d.ts"
|
| 1148 |
+
],
|
| 1149 |
+
"MetricPolling": [
|
| 1150 |
+
"./dist/dts/MetricPolling.d.ts"
|
| 1151 |
+
],
|
| 1152 |
+
"MetricRegistry": [
|
| 1153 |
+
"./dist/dts/MetricRegistry.d.ts"
|
| 1154 |
+
],
|
| 1155 |
+
"MetricState": [
|
| 1156 |
+
"./dist/dts/MetricState.d.ts"
|
| 1157 |
+
],
|
| 1158 |
+
"Micro": [
|
| 1159 |
+
"./dist/dts/Micro.d.ts"
|
| 1160 |
+
],
|
| 1161 |
+
"ModuleVersion": [
|
| 1162 |
+
"./dist/dts/ModuleVersion.d.ts"
|
| 1163 |
+
],
|
| 1164 |
+
"MutableHashMap": [
|
| 1165 |
+
"./dist/dts/MutableHashMap.d.ts"
|
| 1166 |
+
],
|
| 1167 |
+
"MutableHashSet": [
|
| 1168 |
+
"./dist/dts/MutableHashSet.d.ts"
|
| 1169 |
+
],
|
| 1170 |
+
"MutableList": [
|
| 1171 |
+
"./dist/dts/MutableList.d.ts"
|
| 1172 |
+
],
|
| 1173 |
+
"MutableQueue": [
|
| 1174 |
+
"./dist/dts/MutableQueue.d.ts"
|
| 1175 |
+
],
|
| 1176 |
+
"MutableRef": [
|
| 1177 |
+
"./dist/dts/MutableRef.d.ts"
|
| 1178 |
+
],
|
| 1179 |
+
"NonEmptyIterable": [
|
| 1180 |
+
"./dist/dts/NonEmptyIterable.d.ts"
|
| 1181 |
+
],
|
| 1182 |
+
"Number": [
|
| 1183 |
+
"./dist/dts/Number.d.ts"
|
| 1184 |
+
],
|
| 1185 |
+
"Option": [
|
| 1186 |
+
"./dist/dts/Option.d.ts"
|
| 1187 |
+
],
|
| 1188 |
+
"Order": [
|
| 1189 |
+
"./dist/dts/Order.d.ts"
|
| 1190 |
+
],
|
| 1191 |
+
"Ordering": [
|
| 1192 |
+
"./dist/dts/Ordering.d.ts"
|
| 1193 |
+
],
|
| 1194 |
+
"ParseResult": [
|
| 1195 |
+
"./dist/dts/ParseResult.d.ts"
|
| 1196 |
+
],
|
| 1197 |
+
"PartitionedSemaphore": [
|
| 1198 |
+
"./dist/dts/PartitionedSemaphore.d.ts"
|
| 1199 |
+
],
|
| 1200 |
+
"Pipeable": [
|
| 1201 |
+
"./dist/dts/Pipeable.d.ts"
|
| 1202 |
+
],
|
| 1203 |
+
"Pool": [
|
| 1204 |
+
"./dist/dts/Pool.d.ts"
|
| 1205 |
+
],
|
| 1206 |
+
"Predicate": [
|
| 1207 |
+
"./dist/dts/Predicate.d.ts"
|
| 1208 |
+
],
|
| 1209 |
+
"Pretty": [
|
| 1210 |
+
"./dist/dts/Pretty.d.ts"
|
| 1211 |
+
],
|
| 1212 |
+
"PrimaryKey": [
|
| 1213 |
+
"./dist/dts/PrimaryKey.d.ts"
|
| 1214 |
+
],
|
| 1215 |
+
"PubSub": [
|
| 1216 |
+
"./dist/dts/PubSub.d.ts"
|
| 1217 |
+
],
|
| 1218 |
+
"Queue": [
|
| 1219 |
+
"./dist/dts/Queue.d.ts"
|
| 1220 |
+
],
|
| 1221 |
+
"Random": [
|
| 1222 |
+
"./dist/dts/Random.d.ts"
|
| 1223 |
+
],
|
| 1224 |
+
"RateLimiter": [
|
| 1225 |
+
"./dist/dts/RateLimiter.d.ts"
|
| 1226 |
+
],
|
| 1227 |
+
"RcMap": [
|
| 1228 |
+
"./dist/dts/RcMap.d.ts"
|
| 1229 |
+
],
|
| 1230 |
+
"RcRef": [
|
| 1231 |
+
"./dist/dts/RcRef.d.ts"
|
| 1232 |
+
],
|
| 1233 |
+
"Readable": [
|
| 1234 |
+
"./dist/dts/Readable.d.ts"
|
| 1235 |
+
],
|
| 1236 |
+
"Record": [
|
| 1237 |
+
"./dist/dts/Record.d.ts"
|
| 1238 |
+
],
|
| 1239 |
+
"RedBlackTree": [
|
| 1240 |
+
"./dist/dts/RedBlackTree.d.ts"
|
| 1241 |
+
],
|
| 1242 |
+
"Redacted": [
|
| 1243 |
+
"./dist/dts/Redacted.d.ts"
|
| 1244 |
+
],
|
| 1245 |
+
"Ref": [
|
| 1246 |
+
"./dist/dts/Ref.d.ts"
|
| 1247 |
+
],
|
| 1248 |
+
"RegExp": [
|
| 1249 |
+
"./dist/dts/RegExp.d.ts"
|
| 1250 |
+
],
|
| 1251 |
+
"Reloadable": [
|
| 1252 |
+
"./dist/dts/Reloadable.d.ts"
|
| 1253 |
+
],
|
| 1254 |
+
"Request": [
|
| 1255 |
+
"./dist/dts/Request.d.ts"
|
| 1256 |
+
],
|
| 1257 |
+
"RequestBlock": [
|
| 1258 |
+
"./dist/dts/RequestBlock.d.ts"
|
| 1259 |
+
],
|
| 1260 |
+
"RequestResolver": [
|
| 1261 |
+
"./dist/dts/RequestResolver.d.ts"
|
| 1262 |
+
],
|
| 1263 |
+
"Resource": [
|
| 1264 |
+
"./dist/dts/Resource.d.ts"
|
| 1265 |
+
],
|
| 1266 |
+
"Runtime": [
|
| 1267 |
+
"./dist/dts/Runtime.d.ts"
|
| 1268 |
+
],
|
| 1269 |
+
"RuntimeFlags": [
|
| 1270 |
+
"./dist/dts/RuntimeFlags.d.ts"
|
| 1271 |
+
],
|
| 1272 |
+
"RuntimeFlagsPatch": [
|
| 1273 |
+
"./dist/dts/RuntimeFlagsPatch.d.ts"
|
| 1274 |
+
],
|
| 1275 |
+
"STM": [
|
| 1276 |
+
"./dist/dts/STM.d.ts"
|
| 1277 |
+
],
|
| 1278 |
+
"Schedule": [
|
| 1279 |
+
"./dist/dts/Schedule.d.ts"
|
| 1280 |
+
],
|
| 1281 |
+
"ScheduleDecision": [
|
| 1282 |
+
"./dist/dts/ScheduleDecision.d.ts"
|
| 1283 |
+
],
|
| 1284 |
+
"ScheduleInterval": [
|
| 1285 |
+
"./dist/dts/ScheduleInterval.d.ts"
|
| 1286 |
+
],
|
| 1287 |
+
"ScheduleIntervals": [
|
| 1288 |
+
"./dist/dts/ScheduleIntervals.d.ts"
|
| 1289 |
+
],
|
| 1290 |
+
"Scheduler": [
|
| 1291 |
+
"./dist/dts/Scheduler.d.ts"
|
| 1292 |
+
],
|
| 1293 |
+
"Schema": [
|
| 1294 |
+
"./dist/dts/Schema.d.ts"
|
| 1295 |
+
],
|
| 1296 |
+
"SchemaAST": [
|
| 1297 |
+
"./dist/dts/SchemaAST.d.ts"
|
| 1298 |
+
],
|
| 1299 |
+
"Scope": [
|
| 1300 |
+
"./dist/dts/Scope.d.ts"
|
| 1301 |
+
],
|
| 1302 |
+
"ScopedCache": [
|
| 1303 |
+
"./dist/dts/ScopedCache.d.ts"
|
| 1304 |
+
],
|
| 1305 |
+
"ScopedRef": [
|
| 1306 |
+
"./dist/dts/ScopedRef.d.ts"
|
| 1307 |
+
],
|
| 1308 |
+
"Secret": [
|
| 1309 |
+
"./dist/dts/Secret.d.ts"
|
| 1310 |
+
],
|
| 1311 |
+
"SingleProducerAsyncInput": [
|
| 1312 |
+
"./dist/dts/SingleProducerAsyncInput.d.ts"
|
| 1313 |
+
],
|
| 1314 |
+
"Sink": [
|
| 1315 |
+
"./dist/dts/Sink.d.ts"
|
| 1316 |
+
],
|
| 1317 |
+
"SortedMap": [
|
| 1318 |
+
"./dist/dts/SortedMap.d.ts"
|
| 1319 |
+
],
|
| 1320 |
+
"SortedSet": [
|
| 1321 |
+
"./dist/dts/SortedSet.d.ts"
|
| 1322 |
+
],
|
| 1323 |
+
"Stream": [
|
| 1324 |
+
"./dist/dts/Stream.d.ts"
|
| 1325 |
+
],
|
| 1326 |
+
"StreamEmit": [
|
| 1327 |
+
"./dist/dts/StreamEmit.d.ts"
|
| 1328 |
+
],
|
| 1329 |
+
"StreamHaltStrategy": [
|
| 1330 |
+
"./dist/dts/StreamHaltStrategy.d.ts"
|
| 1331 |
+
],
|
| 1332 |
+
"Streamable": [
|
| 1333 |
+
"./dist/dts/Streamable.d.ts"
|
| 1334 |
+
],
|
| 1335 |
+
"String": [
|
| 1336 |
+
"./dist/dts/String.d.ts"
|
| 1337 |
+
],
|
| 1338 |
+
"Struct": [
|
| 1339 |
+
"./dist/dts/Struct.d.ts"
|
| 1340 |
+
],
|
| 1341 |
+
"Subscribable": [
|
| 1342 |
+
"./dist/dts/Subscribable.d.ts"
|
| 1343 |
+
],
|
| 1344 |
+
"SubscriptionRef": [
|
| 1345 |
+
"./dist/dts/SubscriptionRef.d.ts"
|
| 1346 |
+
],
|
| 1347 |
+
"Supervisor": [
|
| 1348 |
+
"./dist/dts/Supervisor.d.ts"
|
| 1349 |
+
],
|
| 1350 |
+
"Symbol": [
|
| 1351 |
+
"./dist/dts/Symbol.d.ts"
|
| 1352 |
+
],
|
| 1353 |
+
"SynchronizedRef": [
|
| 1354 |
+
"./dist/dts/SynchronizedRef.d.ts"
|
| 1355 |
+
],
|
| 1356 |
+
"TArray": [
|
| 1357 |
+
"./dist/dts/TArray.d.ts"
|
| 1358 |
+
],
|
| 1359 |
+
"TDeferred": [
|
| 1360 |
+
"./dist/dts/TDeferred.d.ts"
|
| 1361 |
+
],
|
| 1362 |
+
"TMap": [
|
| 1363 |
+
"./dist/dts/TMap.d.ts"
|
| 1364 |
+
],
|
| 1365 |
+
"TPriorityQueue": [
|
| 1366 |
+
"./dist/dts/TPriorityQueue.d.ts"
|
| 1367 |
+
],
|
| 1368 |
+
"TPubSub": [
|
| 1369 |
+
"./dist/dts/TPubSub.d.ts"
|
| 1370 |
+
],
|
| 1371 |
+
"TQueue": [
|
| 1372 |
+
"./dist/dts/TQueue.d.ts"
|
| 1373 |
+
],
|
| 1374 |
+
"TRandom": [
|
| 1375 |
+
"./dist/dts/TRandom.d.ts"
|
| 1376 |
+
],
|
| 1377 |
+
"TReentrantLock": [
|
| 1378 |
+
"./dist/dts/TReentrantLock.d.ts"
|
| 1379 |
+
],
|
| 1380 |
+
"TRef": [
|
| 1381 |
+
"./dist/dts/TRef.d.ts"
|
| 1382 |
+
],
|
| 1383 |
+
"TSemaphore": [
|
| 1384 |
+
"./dist/dts/TSemaphore.d.ts"
|
| 1385 |
+
],
|
| 1386 |
+
"TSet": [
|
| 1387 |
+
"./dist/dts/TSet.d.ts"
|
| 1388 |
+
],
|
| 1389 |
+
"TSubscriptionRef": [
|
| 1390 |
+
"./dist/dts/TSubscriptionRef.d.ts"
|
| 1391 |
+
],
|
| 1392 |
+
"Take": [
|
| 1393 |
+
"./dist/dts/Take.d.ts"
|
| 1394 |
+
],
|
| 1395 |
+
"TestAnnotation": [
|
| 1396 |
+
"./dist/dts/TestAnnotation.d.ts"
|
| 1397 |
+
],
|
| 1398 |
+
"TestAnnotationMap": [
|
| 1399 |
+
"./dist/dts/TestAnnotationMap.d.ts"
|
| 1400 |
+
],
|
| 1401 |
+
"TestAnnotations": [
|
| 1402 |
+
"./dist/dts/TestAnnotations.d.ts"
|
| 1403 |
+
],
|
| 1404 |
+
"TestClock": [
|
| 1405 |
+
"./dist/dts/TestClock.d.ts"
|
| 1406 |
+
],
|
| 1407 |
+
"TestConfig": [
|
| 1408 |
+
"./dist/dts/TestConfig.d.ts"
|
| 1409 |
+
],
|
| 1410 |
+
"TestContext": [
|
| 1411 |
+
"./dist/dts/TestContext.d.ts"
|
| 1412 |
+
],
|
| 1413 |
+
"TestLive": [
|
| 1414 |
+
"./dist/dts/TestLive.d.ts"
|
| 1415 |
+
],
|
| 1416 |
+
"TestServices": [
|
| 1417 |
+
"./dist/dts/TestServices.d.ts"
|
| 1418 |
+
],
|
| 1419 |
+
"TestSized": [
|
| 1420 |
+
"./dist/dts/TestSized.d.ts"
|
| 1421 |
+
],
|
| 1422 |
+
"Tracer": [
|
| 1423 |
+
"./dist/dts/Tracer.d.ts"
|
| 1424 |
+
],
|
| 1425 |
+
"Trie": [
|
| 1426 |
+
"./dist/dts/Trie.d.ts"
|
| 1427 |
+
],
|
| 1428 |
+
"Tuple": [
|
| 1429 |
+
"./dist/dts/Tuple.d.ts"
|
| 1430 |
+
],
|
| 1431 |
+
"Types": [
|
| 1432 |
+
"./dist/dts/Types.d.ts"
|
| 1433 |
+
],
|
| 1434 |
+
"Unify": [
|
| 1435 |
+
"./dist/dts/Unify.d.ts"
|
| 1436 |
+
],
|
| 1437 |
+
"UpstreamPullRequest": [
|
| 1438 |
+
"./dist/dts/UpstreamPullRequest.d.ts"
|
| 1439 |
+
],
|
| 1440 |
+
"UpstreamPullStrategy": [
|
| 1441 |
+
"./dist/dts/UpstreamPullStrategy.d.ts"
|
| 1442 |
+
],
|
| 1443 |
+
"Utils": [
|
| 1444 |
+
"./dist/dts/Utils.d.ts"
|
| 1445 |
+
],
|
| 1446 |
+
"index": [
|
| 1447 |
+
"./dist/dts/index.d.ts"
|
| 1448 |
+
]
|
| 1449 |
+
}
|
| 1450 |
+
}
|
| 1451 |
+
}
|
backend/node_modules/giget/LICENSE
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
+
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
Third party bundled dependencies
|
| 26 |
+
|
| 27 |
+
- https://github.com/isaacs/node-tar
|
| 28 |
+
- https://github.com/isaacs/fs-minipass
|
| 29 |
+
|
| 30 |
+
"""
|
| 31 |
+
The ISC License
|
| 32 |
+
|
| 33 |
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
| 34 |
+
|
| 35 |
+
Permission to use, copy, modify, and/or distribute this software for any
|
| 36 |
+
purpose with or without fee is hereby granted, provided that the above
|
| 37 |
+
copyright notice and this permission notice appear in all copies.
|
| 38 |
+
|
| 39 |
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
| 40 |
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
| 41 |
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
| 42 |
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
| 43 |
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| 44 |
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
| 45 |
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
| 46 |
+
""""
|
| 47 |
+
|
| 48 |
+
- https://github.com/isaacs/minipass
|
| 49 |
+
|
| 50 |
+
"""
|
| 51 |
+
The ISC License
|
| 52 |
+
|
| 53 |
+
Copyright (c) 2017-2023 npm, Inc., Isaac Z. Schlueter, and Contributors
|
| 54 |
+
|
| 55 |
+
Permission to use, copy, modify, and/or distribute this software for any
|
| 56 |
+
purpose with or without fee is hereby granted, provided that the above
|
| 57 |
+
copyright notice and this permission notice appear in all copies.
|
| 58 |
+
|
| 59 |
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
| 60 |
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
| 61 |
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
| 62 |
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
| 63 |
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
| 64 |
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
| 65 |
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
| 66 |
+
"""
|
| 67 |
+
|
| 68 |
+
- https://github.com/isaacs/minizlib
|
| 69 |
+
|
| 70 |
+
"""
|
| 71 |
+
Minizlib was created by Isaac Z. Schlueter.
|
| 72 |
+
It is a derivative work of the Node.js project.
|
| 73 |
+
|
| 74 |
+
"""
|
| 75 |
+
Copyright (c) 2017-2023 Isaac Z. Schlueter and Contributors
|
| 76 |
+
Copyright (c) 2017-2023 Node.js contributors. All rights reserved.
|
| 77 |
+
Copyright (c) 2017-2023 Joyent, Inc. and other Node contributors. All rights reserved.
|
| 78 |
+
|
| 79 |
+
Permission is hereby granted, free of charge, to any person obtaining a
|
| 80 |
+
copy of this software and associated documentation files (the "Software"),
|
| 81 |
+
to deal in the Software without restriction, including without limitation
|
| 82 |
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 83 |
+
and/or sell copies of the Software, and to permit persons to whom the
|
| 84 |
+
Software is furnished to do so, subject to the following conditions:
|
| 85 |
+
|
| 86 |
+
The above copyright notice and this permission notice shall be included in
|
| 87 |
+
all copies or substantial portions of the Software.
|
| 88 |
+
|
| 89 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| 90 |
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 91 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 92 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 93 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 94 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 95 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 96 |
+
"""
|
| 97 |
+
|
| 98 |
+
- https://github.com/isaacs/node-mkdirp
|
| 99 |
+
|
| 100 |
+
"""
|
| 101 |
+
Copyright (c) 2011-2023 James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me)
|
| 102 |
+
|
| 103 |
+
This project is free software released under the MIT license:
|
| 104 |
+
|
| 105 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 106 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 107 |
+
in the Software without restriction, including without limitation the rights
|
| 108 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 109 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 110 |
+
furnished to do so, subject to the following conditions:
|
| 111 |
+
|
| 112 |
+
The above copyright notice and this permission notice shall be included in
|
| 113 |
+
all copies or substantial portions of the Software.
|
| 114 |
+
|
| 115 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 116 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 117 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 118 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 119 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 120 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 121 |
+
THE SOFTWARE.
|
| 122 |
+
"""
|
| 123 |
+
|
| 124 |
+
- https://github.com/isaacs/yallist/blob/main/LICENSE.md
|
| 125 |
+
- https://github.com/isaacs/chownr/blob/main/LICENSE.md
|
| 126 |
+
|
| 127 |
+
"""
|
| 128 |
+
|
| 129 |
+
# Blue Oak Model License
|
| 130 |
+
|
| 131 |
+
Version 1.0.0
|
| 132 |
+
|
| 133 |
+
## Purpose
|
| 134 |
+
|
| 135 |
+
This license gives everyone as much permission to work with
|
| 136 |
+
this software as possible, while protecting contributors
|
| 137 |
+
from liability.
|
| 138 |
+
|
| 139 |
+
## Acceptance
|
| 140 |
+
|
| 141 |
+
In order to receive this license, you must agree to its
|
| 142 |
+
rules. The rules of this license are both obligations
|
| 143 |
+
under that agreement and conditions to your license.
|
| 144 |
+
You must not do anything with this software that triggers
|
| 145 |
+
a rule that you cannot or will not follow.
|
| 146 |
+
|
| 147 |
+
## Copyright
|
| 148 |
+
|
| 149 |
+
Each contributor licenses you to do everything with this
|
| 150 |
+
software that would otherwise infringe that contributor's
|
| 151 |
+
copyright in it.
|
| 152 |
+
|
| 153 |
+
## Notices
|
| 154 |
+
|
| 155 |
+
You must ensure that everyone who gets a copy of
|
| 156 |
+
any part of this software from you, with or without
|
| 157 |
+
changes, also gets the text of this license or a link to
|
| 158 |
+
<https://blueoakcouncil.org/license/1.0.0>.
|
| 159 |
+
|
| 160 |
+
## Excuse
|
| 161 |
+
|
| 162 |
+
If anyone notifies you in writing that you have not
|
| 163 |
+
complied with [Notices](#notices), you can keep your
|
| 164 |
+
license by taking all practical steps to comply within 30
|
| 165 |
+
days after the notice. If you do not do so, your license
|
| 166 |
+
ends immediately.
|
| 167 |
+
|
| 168 |
+
## Patent
|
| 169 |
+
|
| 170 |
+
Each contributor licenses you to do everything with this
|
| 171 |
+
software that would otherwise infringe any patent claims
|
| 172 |
+
they can license or become able to license.
|
| 173 |
+
|
| 174 |
+
## Reliability
|
| 175 |
+
|
| 176 |
+
No contributor can revoke this license.
|
| 177 |
+
|
| 178 |
+
## No Liability
|
| 179 |
+
|
| 180 |
+
**_As far as the law allows, this software comes as is,
|
| 181 |
+
without any warranty or condition, and no contributor
|
| 182 |
+
will be liable to anyone for any damages related to this
|
| 183 |
+
software or this license, under any kind of legal claim._**
|
| 184 |
+
"""
|
backend/node_modules/giget/README.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# giget
|
| 2 |
+
|
| 3 |
+
[![npm version][npm-version-src]][npm-version-href]
|
| 4 |
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
| 5 |
+
[![Codecov][codecov-src]][codecov-href]
|
| 6 |
+
|
| 7 |
+
> Download templates and git repositories with pleasure!
|
| 8 |
+
|
| 9 |
+
## Features
|
| 10 |
+
|
| 11 |
+
β¨ Support popular git providers (GitHub, GitLab, Bitbucket, Sourcehut) out of the box.
|
| 12 |
+
|
| 13 |
+
β¨ Built-in and custom [template registry](#template-registry).
|
| 14 |
+
|
| 15 |
+
β¨ Fast cloning using tarball gzip without depending on local `git` and `tar`.
|
| 16 |
+
|
| 17 |
+
β¨ Works online and offline with disk cache support.
|
| 18 |
+
|
| 19 |
+
β¨ Custom template provider support with programmatic usage.
|
| 20 |
+
|
| 21 |
+
β¨ Support extracting with a sub dir.
|
| 22 |
+
|
| 23 |
+
β¨ Authorization support to download private templates
|
| 24 |
+
|
| 25 |
+
β¨ Optionally install dependencies after clone using [unjs/nypm](https://github.com/unjs/nypm)
|
| 26 |
+
|
| 27 |
+
β¨ HTTP proxy support and native fetch via [unjs/node-fetch-native](https://github.com/unjs/node-fetch-native)
|
| 28 |
+
|
| 29 |
+
## Usage (CLI)
|
| 30 |
+
|
| 31 |
+
```bash
|
| 32 |
+
npx giget@latest <template> [<dir>] [...options]
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
### Arguments
|
| 36 |
+
|
| 37 |
+
- **template**: Template name or a URI describing provider, repository, sub dir, and branch/ref. (See [Examples](#examples))
|
| 38 |
+
- **dir**: A relative or absolute path where to extract the template.
|
| 39 |
+
|
| 40 |
+
### Options
|
| 41 |
+
|
| 42 |
+
- `--force`: Clone to existing directory even if exists.
|
| 43 |
+
- `--offline`: Do not attempt to download and use the cached version.
|
| 44 |
+
- `--prefer-offline`: Use cache if exists otherwise try to download.
|
| 45 |
+
- `--force-clean`: β οΈ Remove any existing directory or file recursively before cloning.
|
| 46 |
+
- `--shell`: β οΈ Open a new shell with the current working directory in cloned dir. (Experimental).
|
| 47 |
+
- `--registry`: URL to a custom registry. (Can be overridden with `GIGET_REGISTRY` environment variable).
|
| 48 |
+
- `--no-registry`: Disable registry lookup and functionality.
|
| 49 |
+
- `--verbose`: Show verbose debugging info.
|
| 50 |
+
- `--cwd`: Set the current working directory to resolve dirs relative to it.
|
| 51 |
+
- `--auth`: Custom Authorization token to use for downloading template. (Can be overridden with `GIGET_AUTH` environment variable).
|
| 52 |
+
- `--install`: Install dependencies after cloning using [unjs/nypm](https://github.com/unjs/nypm).
|
| 53 |
+
|
| 54 |
+
### Examples
|
| 55 |
+
|
| 56 |
+
```sh
|
| 57 |
+
# Clone nuxt starter from giget template registry
|
| 58 |
+
npx giget@latest nuxt
|
| 59 |
+
|
| 60 |
+
# Clone the main branch of github.com/unjs/template to unjs-template directory
|
| 61 |
+
npx giget@latest gh:unjs/template
|
| 62 |
+
|
| 63 |
+
# Clone to myProject directory
|
| 64 |
+
npx giget@latest gh:unjs/template myProject
|
| 65 |
+
|
| 66 |
+
# Clone dev branch
|
| 67 |
+
npx giget@latest gh:unjs/template#dev
|
| 68 |
+
|
| 69 |
+
# Clone /test directory from main branch
|
| 70 |
+
npx giget@latest gh:unjs/template/test
|
| 71 |
+
|
| 72 |
+
# Clone from gitlab
|
| 73 |
+
npx giget@latest gitlab:unjs/template
|
| 74 |
+
|
| 75 |
+
# Clone from bitbucket
|
| 76 |
+
npx giget@latest bitbucket:unjs/template
|
| 77 |
+
|
| 78 |
+
# Clone from sourcehut
|
| 79 |
+
npx giget@latest sourcehut:pi0/unjs-template
|
| 80 |
+
|
| 81 |
+
# Clone from https URL (tarball)
|
| 82 |
+
npx giget@latest https://api.github.com/repos/unjs/template/tarball/main
|
| 83 |
+
|
| 84 |
+
# Clone from https URL (JSON)
|
| 85 |
+
npx giget@latest https://raw.githubusercontent.com/unjs/giget/main/templates/unjs.json
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## Template Registry
|
| 89 |
+
|
| 90 |
+
Giget has a built-in HTTP registry system for resolving templates. This way you can support template name shortcuts and meta-data. The default registry is served from [unjs/giget/templates](./templates/).
|
| 91 |
+
|
| 92 |
+
If you want to add your template to the built-in registry, just drop a PR to add it to the [./templates](./templates) directory. Slugs are added on a first-come first-served basis but this might change in the future.
|
| 93 |
+
|
| 94 |
+
### Custom Registry
|
| 95 |
+
|
| 96 |
+
A custom registry should provide an endpoint with the dynamic path `/:template.json` that returns a JSON response with keys the same as [custom providers](#custom-providers).
|
| 97 |
+
|
| 98 |
+
- `name`: (required) Name of the template.
|
| 99 |
+
- `tar` (required) Link to the tar download link.
|
| 100 |
+
- `defaultDir`: (optional) Default cloning directory.
|
| 101 |
+
- `url`: (optional) Webpage of the template.
|
| 102 |
+
- `subdir`: (optional) Directory inside the tar file.
|
| 103 |
+
- `headers`: (optional) Custom headers to send while downloading template.
|
| 104 |
+
|
| 105 |
+
Because of the simplicity, you can even use a GitHub repository as a template registry but also you can build something more powerful by bringing your own API.
|
| 106 |
+
|
| 107 |
+
## Usage (Programmatic)
|
| 108 |
+
|
| 109 |
+
Install package:
|
| 110 |
+
|
| 111 |
+
```sh
|
| 112 |
+
# npm
|
| 113 |
+
npm install giget
|
| 114 |
+
|
| 115 |
+
# yarn
|
| 116 |
+
yarn install giget
|
| 117 |
+
|
| 118 |
+
# pnpm
|
| 119 |
+
pnpm install giget
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
Import:
|
| 123 |
+
|
| 124 |
+
```js
|
| 125 |
+
// ESM
|
| 126 |
+
import { downloadTemplate } from "giget";
|
| 127 |
+
|
| 128 |
+
// CommonJS
|
| 129 |
+
const { downloadTemplate } = require("giget");
|
| 130 |
+
```
|
| 131 |
+
|
| 132 |
+
### `downloadTemplate(source, options?)`
|
| 133 |
+
|
| 134 |
+
**Example:**
|
| 135 |
+
|
| 136 |
+
```js
|
| 137 |
+
const { source, dir } = await downloadTemplate("github:unjs/template");
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
**Options:**
|
| 141 |
+
|
| 142 |
+
- `source`: (string) Input source in format of `[provider]:repo[/subpath][#ref]`.
|
| 143 |
+
- `options`: (object) Options are usually inferred from the input string. You can customize them.
|
| 144 |
+
- `dir`: (string) Destination directory to clone to. If not provided, `user-name` will be used relative to the current directory.
|
| 145 |
+
- `provider`: (string) Either `github`, `gitlab`, `bitbucket` or `sourcehut`. The default is `github`.
|
| 146 |
+
- `force`: (boolean) Extract to the existing dir even if already exists.
|
| 147 |
+
- `forceClean`: (boolean) β οΈ Clean up any existing directory or file before cloning.
|
| 148 |
+
- `offline`: (boolean) Do not attempt to download and use the cached version.
|
| 149 |
+
- `preferOffline`: (boolean) Use cache if exists otherwise try to download.
|
| 150 |
+
- `providers`: (object) A map from provider name to custom providers. Can be used to override built-ins too.
|
| 151 |
+
- `registry`: (string or false) Set to `false` to disable registry. Set to a URL string (without trailing slash) for custom registry. (Can be overridden with `GIGET_REGISTRY` environment variable).
|
| 152 |
+
- `cwd`: (string) Current working directory to resolve dirs relative to it.
|
| 153 |
+
- `auth`: (string) Custom Authorization token to use for downloading template. (Can be overridden with `GIGET_AUTH` environment variable).
|
| 154 |
+
|
| 155 |
+
**Return value:**
|
| 156 |
+
|
| 157 |
+
The return value is a promise that resolves to the resolved template.
|
| 158 |
+
|
| 159 |
+
- `dir`: (string) Path to extracted dir.
|
| 160 |
+
- `source`: (string) Normalized version of the input source without provider.
|
| 161 |
+
- [other provider template keys]
|
| 162 |
+
- `url`: (string) URL of the repository that can be opened in the browser. Useful for logging.
|
| 163 |
+
|
| 164 |
+
## Custom Providers
|
| 165 |
+
|
| 166 |
+
Using the programmatic method, you can make your custom template providers.
|
| 167 |
+
|
| 168 |
+
```ts
|
| 169 |
+
import type { TemplateProvider } from "giget";
|
| 170 |
+
|
| 171 |
+
const rainbow: TemplateProvider = async (input, { auth }) => {
|
| 172 |
+
return {
|
| 173 |
+
name: "rainbow",
|
| 174 |
+
version: input,
|
| 175 |
+
headers: { authorization: auth },
|
| 176 |
+
url: `https://rainbow.template/?variant=${input}`,
|
| 177 |
+
tar: `https://rainbow.template/dl/rainbow.${input}.tar.gz`,
|
| 178 |
+
};
|
| 179 |
+
};
|
| 180 |
+
|
| 181 |
+
const { source, dir } = await downloadTemplate("rainbow:one", {
|
| 182 |
+
providers: { rainbow },
|
| 183 |
+
});
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
### Custom Registry Providers
|
| 187 |
+
|
| 188 |
+
You can define additional [custom registry](#custom-registry) providers using `registryProvider` utility and register to `providers`.
|
| 189 |
+
|
| 190 |
+
```ts
|
| 191 |
+
import { registryProvider } from "giget";
|
| 192 |
+
|
| 193 |
+
const themes = registryProvider(
|
| 194 |
+
"https://raw.githubusercontent.com/unjs/giget/main/templates",
|
| 195 |
+
);
|
| 196 |
+
|
| 197 |
+
const { source, dir } = await downloadTemplate("themes:test", {
|
| 198 |
+
providers: { themes },
|
| 199 |
+
});
|
| 200 |
+
```
|
| 201 |
+
|
| 202 |
+
## Providing token for private repositories
|
| 203 |
+
|
| 204 |
+
For private repositories and sources, you might need a token. In order to provide it, using CLI, you can use `--auth`, using programmatic API using `auth` option and in both modes also it is possible to use `GIGET_AUTH` environment variable to set it. The value will be set in `Authorization: Bearer ...` header by default.
|
| 205 |
+
|
| 206 |
+
**Note:** For github private repository access with Fine-grained access tokens, you need to give **Contents** and **Metadata** repository permissions.
|
| 207 |
+
|
| 208 |
+
### GitHub Actions
|
| 209 |
+
|
| 210 |
+
If your project depends on a private GitHub repository, you need to add the access token as a secret. Please see GitHub Actions docs on [creating secrets for a repository](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository). In your workflow, refer to the token as shown in the example below:
|
| 211 |
+
|
| 212 |
+
```yml
|
| 213 |
+
- name: Install packages
|
| 214 |
+
run: npm ci
|
| 215 |
+
env:
|
| 216 |
+
GIGET_AUTH: ${{ secrets.GIGET_AUTH }}
|
| 217 |
+
```
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
## Related projects
|
| 221 |
+
|
| 222 |
+
Giget wouldn't be possible without inspiration from former projects. In comparison, giget does not depend on any local command which increases stability and performance and supports custom template providers, auth, and many more features out of the box.
|
| 223 |
+
|
| 224 |
+
- https://github.com/samsonjs/gitter
|
| 225 |
+
- https://github.com/tiged/tiged
|
| 226 |
+
- https://github.com/Rich-Harris/degit
|
| 227 |
+
|
| 228 |
+
## π» Development
|
| 229 |
+
|
| 230 |
+
- Clone this repository
|
| 231 |
+
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10)
|
| 232 |
+
- Install dependencies using `pnpm install`
|
| 233 |
+
- Run interactive tests using `pnpm dev`
|
| 234 |
+
|
| 235 |
+
## License
|
| 236 |
+
|
| 237 |
+
Made with π
|
| 238 |
+
|
| 239 |
+
Published under [MIT License](./LICENSE).
|
| 240 |
+
|
| 241 |
+
<!-- Badges -->
|
| 242 |
+
|
| 243 |
+
[npm-version-src]: https://img.shields.io/npm/v/giget?style=flat&colorA=18181B&colorB=F0DB4F
|
| 244 |
+
[npm-version-href]: https://npmjs.com/package/giget
|
| 245 |
+
[npm-downloads-src]: https://img.shields.io/npm/dm/giget?style=flat&colorA=18181B&colorB=F0DB4F
|
| 246 |
+
[npm-downloads-href]: https://npmjs.com/package/giget
|
| 247 |
+
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/giget/main?style=flat&colorA=18181B&colorB=F0DB4F
|
| 248 |
+
[codecov-href]: https://codecov.io/gh/unjs/giget
|
backend/node_modules/giget/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "giget",
|
| 3 |
+
"version": "2.0.0",
|
| 4 |
+
"description": "Download templates and git repositories with pleasure!",
|
| 5 |
+
"repository": "unjs/giget",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"sideEffects": false,
|
| 8 |
+
"type": "module",
|
| 9 |
+
"exports": {
|
| 10 |
+
".": {
|
| 11 |
+
"types": "./dist/index.d.mts",
|
| 12 |
+
"default": "./dist/index.mjs"
|
| 13 |
+
}
|
| 14 |
+
},
|
| 15 |
+
"types": "./dist/index.d.mts",
|
| 16 |
+
"bin": {
|
| 17 |
+
"giget": "./dist/cli.mjs"
|
| 18 |
+
},
|
| 19 |
+
"files": [
|
| 20 |
+
"dist"
|
| 21 |
+
],
|
| 22 |
+
"scripts": {
|
| 23 |
+
"build": "unbuild",
|
| 24 |
+
"dev": "vitest dev",
|
| 25 |
+
"giget": "jiti ./src/cli.ts",
|
| 26 |
+
"lint": "eslint . && prettier -c src test",
|
| 27 |
+
"lint:fix": "eslint . --fix && prettier -w src test",
|
| 28 |
+
"prepack": "unbuild",
|
| 29 |
+
"play": "pnpm giget --force-clean --verbose unjs .tmp/clone",
|
| 30 |
+
"release": "pnpm test && changelogen --release && npm publish && git push --follow-tags",
|
| 31 |
+
"test": "pnpm lint && vitest run --coverage"
|
| 32 |
+
},
|
| 33 |
+
"dependencies": {
|
| 34 |
+
"citty": "^0.1.6",
|
| 35 |
+
"consola": "^3.4.0",
|
| 36 |
+
"defu": "^6.1.4",
|
| 37 |
+
"node-fetch-native": "^1.6.6",
|
| 38 |
+
"nypm": "^0.6.0",
|
| 39 |
+
"pathe": "^2.0.3"
|
| 40 |
+
},
|
| 41 |
+
"devDependencies": {
|
| 42 |
+
"@types/node": "^22.13.5",
|
| 43 |
+
"@types/tar": "^6.1.13",
|
| 44 |
+
"@vitest/coverage-v8": "^3.0.7",
|
| 45 |
+
"changelogen": "^0.5.7",
|
| 46 |
+
"esbuild": "^0.25.0",
|
| 47 |
+
"eslint": "^9.21.0",
|
| 48 |
+
"eslint-config-unjs": "^0.4.2",
|
| 49 |
+
"jiti": "^2.4.2",
|
| 50 |
+
"prettier": "^3.5.2",
|
| 51 |
+
"tar": "^6.2.1",
|
| 52 |
+
"typescript": "^5.7.3",
|
| 53 |
+
"unbuild": "^3.3.1",
|
| 54 |
+
"vitest": "^3.0.7"
|
| 55 |
+
},
|
| 56 |
+
"packageManager": "pnpm@10.5.0",
|
| 57 |
+
"pnpm": {
|
| 58 |
+
"patchedDependencies": {
|
| 59 |
+
"tar": "patches/tar.patch"
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
}
|
backend/node_modules/perfect-debounce/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
backend/node_modules/perfect-debounce/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# perfect-debounce
|
| 2 |
+
|
| 3 |
+
[![npm version][npm-version-src]][npm-version-href]
|
| 4 |
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
| 5 |
+
[![Github Actions][github-actions-src]][github-actions-href]
|
| 6 |
+
[![Codecov][codecov-src]][codecov-href]
|
| 7 |
+
|
| 8 |
+
> An improved debounce function with Promise support.
|
| 9 |
+
|
| 10 |
+
- Well tested debounce implementation
|
| 11 |
+
- Native Promise support
|
| 12 |
+
- Avoid duplicate calls while promise is being resolved
|
| 13 |
+
- Configurable `trailing` and `leading` behavior
|
| 14 |
+
|
| 15 |
+
## Usage
|
| 16 |
+
|
| 17 |
+
Install package:
|
| 18 |
+
|
| 19 |
+
```sh
|
| 20 |
+
# npm
|
| 21 |
+
npm install perfect-debounce
|
| 22 |
+
|
| 23 |
+
# yarn
|
| 24 |
+
yarn add perfect-debounce
|
| 25 |
+
|
| 26 |
+
# pnpm
|
| 27 |
+
pnpm add perfect-debounce
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
Import:
|
| 31 |
+
|
| 32 |
+
```js
|
| 33 |
+
// ESM
|
| 34 |
+
import { debounce } from 'perfect-debounce'
|
| 35 |
+
|
| 36 |
+
// CommonJS
|
| 37 |
+
const { debounce } = require('perfect-debounce')
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
Debounce function:
|
| 41 |
+
|
| 42 |
+
```js
|
| 43 |
+
const debounced = debounce(async () => {
|
| 44 |
+
// Some heavy stuff
|
| 45 |
+
}, 25)
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
When calling `debounced`, it will wait at least for `25ms` as configured before actually calling our function. This helps to avoid multiple calls.
|
| 49 |
+
|
| 50 |
+
To avoid initial wait, we can set `leading: true` option. It will cause function to be immediately called if there is no other call:
|
| 51 |
+
|
| 52 |
+
```js
|
| 53 |
+
const debounced = debounce(async () => {
|
| 54 |
+
// Some heavy stuff
|
| 55 |
+
}, 25, { leading: true })
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
If executing async function takes longer than debounce value, duplicate calls will be still prevented a last call will happen. To disable this behavior, we can set `trailing: false` option:
|
| 59 |
+
|
| 60 |
+
```js
|
| 61 |
+
const debounced = debounce(async () => {
|
| 62 |
+
// Some heavy stuff
|
| 63 |
+
}, 25, { trailing: false })
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## π» Development
|
| 67 |
+
|
| 68 |
+
- Clone this repository
|
| 69 |
+
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable` (use `npm i -g corepack` for Node.js < 16.10)
|
| 70 |
+
- Install dependencies using `pnpm install`
|
| 71 |
+
- Run interactive tests using `pnpm dev`
|
| 72 |
+
|
| 73 |
+
## License
|
| 74 |
+
|
| 75 |
+
Made with π
|
| 76 |
+
|
| 77 |
+
Based on [sindresorhus/p-debounce](https://github.com/sindresorhus/p-debounce).
|
| 78 |
+
|
| 79 |
+
Published under [MIT License](./LICENSE).
|
| 80 |
+
|
| 81 |
+
<!-- Badges -->
|
| 82 |
+
[npm-version-src]: https://img.shields.io/npm/v/perfect-debounce?style=flat-square
|
| 83 |
+
[npm-version-href]: https://npmjs.com/package/perfect-debounce
|
| 84 |
+
|
| 85 |
+
[npm-downloads-src]: https://img.shields.io/npm/dm/perfect-debounce?style=flat-square
|
| 86 |
+
[npm-downloads-href]: https://npmjs.com/package/perfect-debounce
|
| 87 |
+
|
| 88 |
+
[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/perfect-debounce/ci/main?style=flat-square
|
| 89 |
+
[github-actions-href]: https://github.com/unjs/perfect-debounce/actions?query=workflow%3Aci
|
| 90 |
+
|
| 91 |
+
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/perfect-debounce/main?style=flat-square
|
| 92 |
+
[codecov-href]: https://codecov.io/gh/unjs/perfect-debounce
|
backend/node_modules/perfect-debounce/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "perfect-debounce",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"description": "",
|
| 5 |
+
"repository": "unjs/perfect-debounce",
|
| 6 |
+
"license": "MIT",
|
| 7 |
+
"sideEffects": false,
|
| 8 |
+
"type": "module",
|
| 9 |
+
"exports": {
|
| 10 |
+
".": {
|
| 11 |
+
"types": "./dist/index.d.ts",
|
| 12 |
+
"import": "./dist/index.mjs",
|
| 13 |
+
"require": "./dist/index.cjs"
|
| 14 |
+
}
|
| 15 |
+
},
|
| 16 |
+
"main": "./dist/index.cjs",
|
| 17 |
+
"module": "./dist/index.mjs",
|
| 18 |
+
"types": "./dist/index.d.ts",
|
| 19 |
+
"files": [
|
| 20 |
+
"dist"
|
| 21 |
+
],
|
| 22 |
+
"scripts": {
|
| 23 |
+
"build": "unbuild",
|
| 24 |
+
"dev": "vitest dev",
|
| 25 |
+
"lint": "eslint --ext .ts,.js,.mjs,.cjs . && prettier --check src test",
|
| 26 |
+
"lint:fix": "eslint --ext .ts,.js,.mjs,.cjs . --fix && prettier -w src test",
|
| 27 |
+
"release": "pnpm test && pnpm build && changelogen --release --push && npm publish",
|
| 28 |
+
"test": "vitest run --coverage"
|
| 29 |
+
},
|
| 30 |
+
"devDependencies": {
|
| 31 |
+
"@types/node": "^18.16.3",
|
| 32 |
+
"@vitest/coverage-c8": "^0.31.0",
|
| 33 |
+
"changelogen": "^0.5.3",
|
| 34 |
+
"eslint": "^8.39.0",
|
| 35 |
+
"eslint-config-unjs": "^0.1.0",
|
| 36 |
+
"in-range": "^3.0.0",
|
| 37 |
+
"prettier": "^2.8.8",
|
| 38 |
+
"time-span": "^5.1.0",
|
| 39 |
+
"typescript": "^5.0.4",
|
| 40 |
+
"unbuild": "^1.2.1",
|
| 41 |
+
"vitest": "^0.31.0"
|
| 42 |
+
},
|
| 43 |
+
"packageManager": "pnpm@8.4.0"
|
| 44 |
+
}
|
backend/node_modules/prisma/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright [yyyy] [name of copyright owner]
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
backend/node_modules/prisma/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<div align="center">
|
| 2 |
+
<h1>Prisma</h1>
|
| 3 |
+
<a href="https://www.npmjs.com/package/prisma"><img src="https://img.shields.io/npm/v/prisma.svg?style=flat" /></a>
|
| 4 |
+
<a href="https://github.com/prisma/prisma/blob/main/CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" /></a>
|
| 5 |
+
<a href="https://github.com/prisma/prisma/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202-blue" /></a>
|
| 6 |
+
<a href="https://pris.ly/discord"><img alt="Discord" src="https://img.shields.io/discord/937751382725886062?label=Discord"></a>
|
| 7 |
+
<br />
|
| 8 |
+
<br />
|
| 9 |
+
<a href="https://www.prisma.io/docs/getting-started/quickstart">Quickstart</a>
|
| 10 |
+
<span> β’ </span>
|
| 11 |
+
<a href="https://www.prisma.io/">Website</a>
|
| 12 |
+
<span> β’ </span>
|
| 13 |
+
<a href="https://www.prisma.io/docs/">Docs</a>
|
| 14 |
+
<span> β’ </span>
|
| 15 |
+
<a href="https://github.com/prisma/prisma-examples/">Examples</a>
|
| 16 |
+
<span> β’ </span>
|
| 17 |
+
<a href="https://www.prisma.io/blog">Blog</a>
|
| 18 |
+
<span> β’ </span>
|
| 19 |
+
<a href="https://pris.ly/discord">Discord</a>
|
| 20 |
+
<span> β’ </span>
|
| 21 |
+
<a href="https://twitter.com/prisma">Twitter</a>
|
| 22 |
+
<br />
|
| 23 |
+
<hr />
|
| 24 |
+
</div>
|
| 25 |
+
|
| 26 |
+
## What is Prisma?
|
| 27 |
+
|
| 28 |
+
Prisma is a **next-generation ORM** that consists of these tools:
|
| 29 |
+
|
| 30 |
+
- [**Prisma Client**](https://www.prisma.io/docs/concepts/components/prisma-client): Auto-generated and type-safe query builder for Node.js & TypeScript
|
| 31 |
+
- [**Prisma Migrate**](https://www.prisma.io/docs/concepts/components/prisma-migrate): Declarative data modeling & migration system
|
| 32 |
+
- [**Prisma Studio**](https://github.com/prisma/studio): GUI to view and edit data in your database
|
| 33 |
+
|
| 34 |
+
Prisma Client can be used in _any_ Node.js or TypeScript backend application (including serverless applications and microservices). This can be a [REST API](https://www.prisma.io/docs/concepts/overview/prisma-in-your-stack/rest), a [GraphQL API](https://www.prisma.io/docs/concepts/overview/prisma-in-your-stack/graphql) a gRPC API, or anything else that needs a database.
|
| 35 |
+
|
| 36 |
+
**If you need a database to use with Prisma ORM, check out [Prisma Postgres](https://www.prisma.io/docs/getting-started/quickstart-prismaPostgres?utm_source=npm&utm_medium=readme) or if you are looking for our MCP Server, head [here](https://github.com/prisma/mcp).**
|
| 37 |
+
|
| 38 |
+
## Getting started
|
| 39 |
+
|
| 40 |
+
The fastest way to get started with Prisma is by following the [**Quickstart (5 min)**](https://pris.ly/quickstart).
|
| 41 |
+
|
| 42 |
+
The Quickstart is based on a preconfigured SQLite database. You can also get started with your own database (PostgreSQL and MySQL) by following one of these guides:
|
| 43 |
+
|
| 44 |
+
- [Add Prisma to an existing project](https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project/relational-databases-typescript-postgresql)
|
| 45 |
+
- [Set up a new project with Prisma from scratch](https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-postgresql)
|
| 46 |
+
|
| 47 |
+
## Community
|
| 48 |
+
|
| 49 |
+
Prisma has a large and supportive [community](https://www.prisma.io/community) of enthusiastic application developers. You can join us on [Discord](https://pris.ly/discord) and here on [GitHub](https://github.com/prisma/prisma/discussions).
|
| 50 |
+
|
| 51 |
+
## Security
|
| 52 |
+
|
| 53 |
+
If you have a security issue to report, please contact us at [security@prisma.io](mailto:security@prisma.io?subject=[GitHub]%20Prisma%202%20Security%20Report%20).
|
| 54 |
+
|
| 55 |
+
## Support
|
| 56 |
+
|
| 57 |
+
### Ask a question about Prisma
|
| 58 |
+
|
| 59 |
+
You can ask questions and initiate [discussions](https://github.com/prisma/prisma/discussions/) about Prisma-related topics in the `prisma` repository on GitHub.
|
| 60 |
+
|
| 61 |
+
π [**Ask a question**](https://github.com/prisma/prisma/discussions/new)
|
| 62 |
+
|
| 63 |
+
### Create a bug report for Prisma
|
| 64 |
+
|
| 65 |
+
If you see an error message or run into an issue, please make sure to create a bug report! You can find [best practices for creating bug reports](https://www.prisma.io/docs/guides/other/troubleshooting-orm/creating-bug-reports) (like including additional debugging output) in the docs.
|
| 66 |
+
|
| 67 |
+
π [**Create bug report**](https://pris.ly/prisma-prisma-bug-report)
|
| 68 |
+
|
| 69 |
+
### Submit a feature request
|
| 70 |
+
|
| 71 |
+
If Prisma currently doesn't have a certain feature, be sure to check out the [roadmap](https://www.prisma.io/docs/more/roadmap) to see if this is already planned for the future.
|
| 72 |
+
|
| 73 |
+
If the feature on the roadmap is linked to a GitHub issue, please make sure to leave a +1 on the issue and ideally a comment with your thoughts about the feature!
|
| 74 |
+
|
| 75 |
+
π [**Submit feature request**](https://github.com/prisma/prisma/issues/new?assignees=&labels=&template=feature_request.md&title=)
|
| 76 |
+
|
| 77 |
+
## Contributing
|
| 78 |
+
|
| 79 |
+
Refer to our [contribution guidelines](https://github.com/prisma/prisma/blob/main/CONTRIBUTING.md) and [Code of Conduct for contributors](https://github.com/prisma/prisma/blob/main/CODE_OF_CONDUCT.md).
|
| 80 |
+
|
| 81 |
+
## Tests Status
|
| 82 |
+
|
| 83 |
+
- Prisma Tests Status:
|
| 84 |
+
[](https://github.com/prisma/prisma/actions/workflows/test.yml)
|
| 85 |
+
- Ecosystem Tests Status:
|
| 86 |
+
[](https://github.com/prisma/ecosystem-tests/actions)
|
backend/node_modules/prisma/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
export { defineConfig, env, type PrismaConfig, type PrismaConfigInternal } from '@prisma/config';
|
backend/node_modules/prisma/config.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
var __defProp = Object.defineProperty;
|
| 3 |
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
| 4 |
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
| 5 |
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
| 6 |
+
var __export = (target, all) => {
|
| 7 |
+
for (var name in all)
|
| 8 |
+
__defProp(target, name, { get: all[name], enumerable: true });
|
| 9 |
+
};
|
| 10 |
+
var __copyProps = (to, from, except, desc) => {
|
| 11 |
+
if (from && typeof from === "object" || typeof from === "function") {
|
| 12 |
+
for (let key of __getOwnPropNames(from))
|
| 13 |
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
| 14 |
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
| 15 |
+
}
|
| 16 |
+
return to;
|
| 17 |
+
};
|
| 18 |
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
| 19 |
+
var config_exports = {};
|
| 20 |
+
__export(config_exports, {
|
| 21 |
+
defineConfig: () => import_config.defineConfig,
|
| 22 |
+
env: () => import_config.env
|
| 23 |
+
});
|
| 24 |
+
module.exports = __toCommonJS(config_exports);
|
| 25 |
+
var import_config = require("@prisma/config");
|
| 26 |
+
// Annotate the CommonJS export names for ESM import in node:
|
| 27 |
+
0 && (module.exports = {
|
| 28 |
+
defineConfig,
|
| 29 |
+
env
|
| 30 |
+
});
|
backend/node_modules/prisma/package.json
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "6.19.3",
|
| 3 |
+
"name": "prisma",
|
| 4 |
+
"description": "Prisma is an open-source database toolkit. It includes a JavaScript/TypeScript ORM for Node.js, migrations and a modern GUI to view and edit the data in your database. You can use Prisma in new projects or add it to an existing one.",
|
| 5 |
+
"keywords": [
|
| 6 |
+
"CLI",
|
| 7 |
+
"ORM",
|
| 8 |
+
"Prisma",
|
| 9 |
+
"Prisma CLI",
|
| 10 |
+
"prisma2",
|
| 11 |
+
"database",
|
| 12 |
+
"db",
|
| 13 |
+
"JavaScript",
|
| 14 |
+
"JS",
|
| 15 |
+
"TypeScript",
|
| 16 |
+
"TS",
|
| 17 |
+
"SQL",
|
| 18 |
+
"SQLite",
|
| 19 |
+
"pg",
|
| 20 |
+
"Postgres",
|
| 21 |
+
"PostgreSQL",
|
| 22 |
+
"CockroachDB",
|
| 23 |
+
"MySQL",
|
| 24 |
+
"MariaDB",
|
| 25 |
+
"MSSQL",
|
| 26 |
+
"SQL Server",
|
| 27 |
+
"SQLServer",
|
| 28 |
+
"MongoDB",
|
| 29 |
+
"MCP"
|
| 30 |
+
],
|
| 31 |
+
"main": "build/index.js",
|
| 32 |
+
"repository": {
|
| 33 |
+
"type": "git",
|
| 34 |
+
"url": "https://github.com/prisma/prisma.git",
|
| 35 |
+
"directory": "packages/cli"
|
| 36 |
+
},
|
| 37 |
+
"homepage": "https://www.prisma.io",
|
| 38 |
+
"author": "Tim Suchanek <suchanek@prisma.io>",
|
| 39 |
+
"bugs": "https://github.com/prisma/prisma/issues",
|
| 40 |
+
"license": "Apache-2.0",
|
| 41 |
+
"engines": {
|
| 42 |
+
"node": ">=18.18"
|
| 43 |
+
},
|
| 44 |
+
"prisma": {
|
| 45 |
+
"prismaCommit": "727a61ae916846267a98358d103b3e8a2afebd45"
|
| 46 |
+
},
|
| 47 |
+
"files": [
|
| 48 |
+
"README.md",
|
| 49 |
+
"build",
|
| 50 |
+
"config.js",
|
| 51 |
+
"config.d.ts",
|
| 52 |
+
"dist/cli/src/types.d.ts",
|
| 53 |
+
"install",
|
| 54 |
+
"runtime/*.js",
|
| 55 |
+
"runtime/*.d.ts",
|
| 56 |
+
"runtime/utils",
|
| 57 |
+
"runtime/dist",
|
| 58 |
+
"runtime/llhttp",
|
| 59 |
+
"prisma-client",
|
| 60 |
+
"preinstall",
|
| 61 |
+
"scripts/preinstall-entry.js"
|
| 62 |
+
],
|
| 63 |
+
"pkg": {
|
| 64 |
+
"assets": [
|
| 65 |
+
"build/**/*",
|
| 66 |
+
"runtime/**/*",
|
| 67 |
+
"prisma-client/**/*",
|
| 68 |
+
"node_modules/@prisma/engines/**/*",
|
| 69 |
+
"node_modules/@prisma/engines/*"
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
"bin": {
|
| 73 |
+
"prisma": "build/index.js"
|
| 74 |
+
},
|
| 75 |
+
"types": "./dist/cli/src/types.d.ts",
|
| 76 |
+
"exports": {
|
| 77 |
+
"./package.json": "./package.json",
|
| 78 |
+
".": {
|
| 79 |
+
"require": {
|
| 80 |
+
"types": "./dist/cli/src/types.d.ts",
|
| 81 |
+
"default": "./build/types.js"
|
| 82 |
+
},
|
| 83 |
+
"import": {
|
| 84 |
+
"types": "./dist/cli/src/types.d.ts",
|
| 85 |
+
"default": "./build/types.js"
|
| 86 |
+
},
|
| 87 |
+
"default": "./build/types.js"
|
| 88 |
+
},
|
| 89 |
+
"./config": {
|
| 90 |
+
"require": {
|
| 91 |
+
"types": "./config.d.ts",
|
| 92 |
+
"default": "./config.js"
|
| 93 |
+
},
|
| 94 |
+
"import": {
|
| 95 |
+
"types": "./config.d.ts",
|
| 96 |
+
"default": "./config.js"
|
| 97 |
+
},
|
| 98 |
+
"default": "./config.js"
|
| 99 |
+
},
|
| 100 |
+
"./build/index.js": {
|
| 101 |
+
"require": {
|
| 102 |
+
"types": "./dist/cli/src/types.d.ts",
|
| 103 |
+
"default": "./build/index.js"
|
| 104 |
+
},
|
| 105 |
+
"default": "./build/index.js"
|
| 106 |
+
}
|
| 107 |
+
},
|
| 108 |
+
"devDependencies": {
|
| 109 |
+
"@inquirer/prompts": "7.3.3",
|
| 110 |
+
"@libsql/client": "0.8.1",
|
| 111 |
+
"@modelcontextprotocol/sdk": "1.13.2",
|
| 112 |
+
"@opentelemetry/api": "1.9.0",
|
| 113 |
+
"@opentelemetry/context-async-hooks": "2.1.0",
|
| 114 |
+
"@opentelemetry/sdk-trace-base": "2.1.0",
|
| 115 |
+
"@prisma/mini-proxy": "0.9.5",
|
| 116 |
+
"@prisma/studio": "0.511.0",
|
| 117 |
+
"@prisma/studio-server": "0.511.0",
|
| 118 |
+
"@swc/core": "1.11.5",
|
| 119 |
+
"@swc/jest": "0.2.37",
|
| 120 |
+
"@types/fs-extra": "11.0.4",
|
| 121 |
+
"@types/jest": "29.5.14",
|
| 122 |
+
"@types/node": "18.19.76",
|
| 123 |
+
"async-listen": "3.1.0",
|
| 124 |
+
"checkpoint-client": "1.1.33",
|
| 125 |
+
"chokidar": "4.0.3",
|
| 126 |
+
"env-paths": "2.2.1",
|
| 127 |
+
"execa": "5.1.1",
|
| 128 |
+
"fs-extra": "11.3.0",
|
| 129 |
+
"get-port": "7.1.0",
|
| 130 |
+
"jest": "29.7.0",
|
| 131 |
+
"jest-junit": "16.0.0",
|
| 132 |
+
"kleur": "4.1.5",
|
| 133 |
+
"line-replace": "2.0.1",
|
| 134 |
+
"log-update": "6.1.0",
|
| 135 |
+
"node-fetch": "3.3.2",
|
| 136 |
+
"npm-packlist": "5.1.3",
|
| 137 |
+
"open": "7.4.2",
|
| 138 |
+
"package-up": "5.0.0",
|
| 139 |
+
"resolve-pkg": "2.0.0",
|
| 140 |
+
"ts-pattern": "5.6.2",
|
| 141 |
+
"typescript": "5.4.5",
|
| 142 |
+
"xdg-app-paths": "8.3.0",
|
| 143 |
+
"zod": "3.24.2",
|
| 144 |
+
"@prisma/adapter-libsql": "6.19.3",
|
| 145 |
+
"@prisma/client-generator-registry": "6.19.3",
|
| 146 |
+
"@prisma/client": "6.19.3",
|
| 147 |
+
"@prisma/debug": "6.19.3",
|
| 148 |
+
"@prisma/dmmf": "6.19.3",
|
| 149 |
+
"@prisma/driver-adapter-utils": "6.19.3",
|
| 150 |
+
"@prisma/fetch-engine": "6.19.3",
|
| 151 |
+
"@prisma/internals": "6.19.3",
|
| 152 |
+
"@prisma/generator": "6.19.3",
|
| 153 |
+
"@prisma/get-platform": "6.19.3",
|
| 154 |
+
"@prisma/migrate": "6.19.3"
|
| 155 |
+
},
|
| 156 |
+
"dependencies": {
|
| 157 |
+
"@prisma/engines": "6.19.3",
|
| 158 |
+
"@prisma/config": "6.19.3"
|
| 159 |
+
},
|
| 160 |
+
"peerDependencies": {
|
| 161 |
+
"typescript": ">=5.1.0"
|
| 162 |
+
},
|
| 163 |
+
"peerDependenciesMeta": {
|
| 164 |
+
"typescript": {
|
| 165 |
+
"optional": true
|
| 166 |
+
}
|
| 167 |
+
},
|
| 168 |
+
"sideEffects": false,
|
| 169 |
+
"scripts": {
|
| 170 |
+
"prisma": "tsx src/bin.ts",
|
| 171 |
+
"platform": "tsx src/bin.ts platform --early-access",
|
| 172 |
+
"pm": "tsx src/bin.ts platform --early-access",
|
| 173 |
+
"dev": "DEV=true tsx helpers/build.ts",
|
| 174 |
+
"build": "tsx helpers/build.ts",
|
| 175 |
+
"test": "dotenv -e ../../.db.env -- tsx helpers/run-tests.ts",
|
| 176 |
+
"test:platform": "dotenv -e ../../.db.env -- tsx helpers/run-tests.ts src/platform",
|
| 177 |
+
"tsc": "tsc -d -p tsconfig.build.json",
|
| 178 |
+
"preinstall": "node scripts/preinstall-entry.js"
|
| 179 |
+
}
|
| 180 |
+
}
|
backend/node_modules/readdirp/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com)
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
backend/node_modules/readdirp/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# readdirp [](https://github.com/paulmillr/readdirp)
|
| 2 |
+
|
| 3 |
+
Recursive version of fs.readdir. Exposes a **stream API** (with small RAM & CPU footprint) and a **promise API**.
|
| 4 |
+
|
| 5 |
+
```sh
|
| 6 |
+
npm install readdirp
|
| 7 |
+
jsr add jsr:@paulmillr/readdirp
|
| 8 |
+
```
|
| 9 |
+
|
| 10 |
+
```javascript
|
| 11 |
+
// Use streams to achieve small RAM & CPU footprint.
|
| 12 |
+
// 1) Streams example with for-await.
|
| 13 |
+
import readdirp from 'readdirp';
|
| 14 |
+
for await (const entry of readdirp('.')) {
|
| 15 |
+
const {path} = entry;
|
| 16 |
+
console.log(`${JSON.stringify({path})}`);
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
// 2) Streams example, non for-await.
|
| 20 |
+
// Print out all JS files along with their size within the current folder & subfolders.
|
| 21 |
+
import readdirp from 'readdirp';
|
| 22 |
+
readdirp('.', {alwaysStat: true, fileFilter: (f) => f.basename.endsWith('.js')})
|
| 23 |
+
.on('data', (entry) => {
|
| 24 |
+
const {path, stats: {size}} = entry;
|
| 25 |
+
console.log(`${JSON.stringify({path, size})}`);
|
| 26 |
+
})
|
| 27 |
+
// Optionally call stream.destroy() in `warn()` in order to abort and cause 'close' to be emitted
|
| 28 |
+
.on('warn', error => console.error('non-fatal error', error))
|
| 29 |
+
.on('error', error => console.error('fatal error', error))
|
| 30 |
+
.on('end', () => console.log('done'));
|
| 31 |
+
|
| 32 |
+
// 3) Promise example. More RAM and CPU than streams / for-await.
|
| 33 |
+
import { readdirpPromise } from 'readdirp';
|
| 34 |
+
const files = await readdirpPromise('.');
|
| 35 |
+
console.log(files.map(file => file.path));
|
| 36 |
+
|
| 37 |
+
// Other options.
|
| 38 |
+
import readdirp from 'readdirp';
|
| 39 |
+
readdirp('test', {
|
| 40 |
+
fileFilter: (f) => f.basename.endsWith('.js'),
|
| 41 |
+
directoryFilter: (d) => d.basename !== '.git',
|
| 42 |
+
// directoryFilter: (di) => di.basename.length === 9
|
| 43 |
+
type: 'files_directories',
|
| 44 |
+
depth: 1
|
| 45 |
+
});
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## API
|
| 49 |
+
|
| 50 |
+
`const stream = readdirp(root[, options])` β **Stream API**
|
| 51 |
+
|
| 52 |
+
- Reads given root recursively and returns a `stream` of [entry infos](#entryinfo)
|
| 53 |
+
- Optionally can be used like `for await (const entry of stream)` with node.js 10+ (`asyncIterator`).
|
| 54 |
+
- `on('data', (entry) => {})` [entry info](#entryinfo) for every file / dir.
|
| 55 |
+
- `on('warn', (error) => {})` non-fatal `Error` that prevents a file / dir from being processed. Example: inaccessible to the user.
|
| 56 |
+
- `on('error', (error) => {})` fatal `Error` which also ends the stream. Example: illegal options where passed.
|
| 57 |
+
- `on('end')` β we are done. Called when all entries were found and no more will be emitted.
|
| 58 |
+
- `on('close')` β stream is destroyed via `stream.destroy()`.
|
| 59 |
+
Could be useful if you want to manually abort even on a non fatal error.
|
| 60 |
+
At that point the stream is no longer `readable` and no more entries, warning or errors are emitted
|
| 61 |
+
- To learn more about streams, consult the very detailed [nodejs streams documentation](https://nodejs.org/api/stream.html)
|
| 62 |
+
or the [stream-handbook](https://github.com/substack/stream-handbook)
|
| 63 |
+
|
| 64 |
+
`const entries = await readdirp.promise(root[, options])` β **Promise API**. Returns a list of [entry infos](#entryinfo).
|
| 65 |
+
|
| 66 |
+
First argument is awalys `root`, path in which to start reading and recursing into subdirectories.
|
| 67 |
+
|
| 68 |
+
### options
|
| 69 |
+
|
| 70 |
+
- `fileFilter`: filter to include or exclude files
|
| 71 |
+
- **Function**: a function that takes an entry info as a parameter and returns true to include or false to exclude the entry
|
| 72 |
+
- `directoryFilter`: filter to include/exclude directories found and to recurse into. Directories that do not pass a filter will not be recursed into.
|
| 73 |
+
- `depth: 5`: depth at which to stop recursing even if more subdirectories are found
|
| 74 |
+
- `type: 'files'`: determines if data events on the stream should be emitted for `'files'` (default), `'directories'`, `'files_directories'`, or `'all'`. Setting to `'all'` will also include entries for other types of file descriptors like character devices, unix sockets and named pipes.
|
| 75 |
+
- `alwaysStat: false`: always return `stats` property for every file. Default is `false`, readdirp will return `Dirent` entries. Setting it to `true` can double readdir execution time - use it only when you need file `size`, `mtime` etc. Cannot be enabled on node <10.10.0.
|
| 76 |
+
- `lstat: false`: include symlink entries in the stream along with files. When `true`, `fs.lstat` would be used instead of `fs.stat`
|
| 77 |
+
|
| 78 |
+
### `EntryInfo`
|
| 79 |
+
|
| 80 |
+
Has the following properties:
|
| 81 |
+
|
| 82 |
+
- `path: 'assets/javascripts/react.js'`: path to the file/directory (relative to given root)
|
| 83 |
+
- `fullPath: '/Users/dev/projects/app/assets/javascripts/react.js'`: full path to the file/directory found
|
| 84 |
+
- `basename: 'react.js'`: name of the file/directory
|
| 85 |
+
- `dirent: fs.Dirent`: built-in [dir entry object](https://nodejs.org/api/fs.html#fs_class_fs_dirent) - only with `alwaysStat: false`
|
| 86 |
+
- `stats: fs.Stats`: built in [stat object](https://nodejs.org/api/fs.html#fs_class_fs_stats) - only with `alwaysStat: true`
|
| 87 |
+
|
| 88 |
+
## Changelog
|
| 89 |
+
|
| 90 |
+
- 4.0 (Aug 25, 2024) rewritten in typescript, producing hybrid common.js / esm module.
|
| 91 |
+
- Remove glob support and all dependencies
|
| 92 |
+
- Make sure you're using `let {readdirp} = require('readdirp')` in common.js
|
| 93 |
+
- 3.5 (Oct 13, 2020) disallows recursive directory-based symlinks.
|
| 94 |
+
Before, it could have entered infinite loop.
|
| 95 |
+
- 3.4 (Mar 19, 2020) adds support for directory-based symlinks.
|
| 96 |
+
- 3.3 (Dec 6, 2019) stabilizes RAM consumption and enables perf management with `highWaterMark` option. Fixes race conditions related to `for-await` looping.
|
| 97 |
+
- 3.2 (Oct 14, 2019) improves performance by 250% and makes streams implementation more idiomatic.
|
| 98 |
+
- 3.1 (Jul 7, 2019) brings `bigint` support to `stat` output on Windows. This is backwards-incompatible for some cases. Be careful. It you use it incorrectly, you'll see "TypeError: Cannot mix BigInt and other types, use explicit conversions".
|
| 99 |
+
- 3.0 brings huge performance improvements and stream backpressure support.
|
| 100 |
+
- Upgrading 2.x to 3.x:
|
| 101 |
+
- Signature changed from `readdirp(options)` to `readdirp(root, options)`
|
| 102 |
+
- Replaced callback API with promise API.
|
| 103 |
+
- Renamed `entryType` option to `type`
|
| 104 |
+
- Renamed `entryType: 'both'` to `'files_directories'`
|
| 105 |
+
- `EntryInfo`
|
| 106 |
+
- Renamed `stat` to `stats`
|
| 107 |
+
- Emitted only when `alwaysStat: true`
|
| 108 |
+
- `dirent` is emitted instead of `stats` by default with `alwaysStat: false`
|
| 109 |
+
- Renamed `name` to `basename`
|
| 110 |
+
- Removed `parentDir` and `fullParentDir` properties
|
| 111 |
+
- Supported node.js versions:
|
| 112 |
+
- 4.x: node 14+
|
| 113 |
+
- 3.x: node 8+
|
| 114 |
+
- 2.x: node 0.6+
|
| 115 |
+
|
| 116 |
+
## License
|
| 117 |
+
|
| 118 |
+
Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (<https://paulmillr.com>)
|
| 119 |
+
|
| 120 |
+
MIT License, see [LICENSE](LICENSE) file.
|
backend/node_modules/readdirp/index.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"use strict";
|
| 2 |
+
Object.defineProperty(exports, "__esModule", { value: true });
|
| 3 |
+
exports.ReaddirpStream = exports.EntryTypes = void 0;
|
| 4 |
+
exports.readdirp = readdirp;
|
| 5 |
+
exports.readdirpPromise = readdirpPromise;
|
| 6 |
+
const promises_1 = require("node:fs/promises");
|
| 7 |
+
const node_stream_1 = require("node:stream");
|
| 8 |
+
const node_path_1 = require("node:path");
|
| 9 |
+
exports.EntryTypes = {
|
| 10 |
+
FILE_TYPE: 'files',
|
| 11 |
+
DIR_TYPE: 'directories',
|
| 12 |
+
FILE_DIR_TYPE: 'files_directories',
|
| 13 |
+
EVERYTHING_TYPE: 'all',
|
| 14 |
+
};
|
| 15 |
+
const defaultOptions = {
|
| 16 |
+
root: '.',
|
| 17 |
+
fileFilter: (_entryInfo) => true,
|
| 18 |
+
directoryFilter: (_entryInfo) => true,
|
| 19 |
+
type: exports.EntryTypes.FILE_TYPE,
|
| 20 |
+
lstat: false,
|
| 21 |
+
depth: 2147483648,
|
| 22 |
+
alwaysStat: false,
|
| 23 |
+
highWaterMark: 4096,
|
| 24 |
+
};
|
| 25 |
+
Object.freeze(defaultOptions);
|
| 26 |
+
const RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR';
|
| 27 |
+
const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]);
|
| 28 |
+
const ALL_TYPES = [
|
| 29 |
+
exports.EntryTypes.DIR_TYPE,
|
| 30 |
+
exports.EntryTypes.EVERYTHING_TYPE,
|
| 31 |
+
exports.EntryTypes.FILE_DIR_TYPE,
|
| 32 |
+
exports.EntryTypes.FILE_TYPE,
|
| 33 |
+
];
|
| 34 |
+
const DIR_TYPES = new Set([
|
| 35 |
+
exports.EntryTypes.DIR_TYPE,
|
| 36 |
+
exports.EntryTypes.EVERYTHING_TYPE,
|
| 37 |
+
exports.EntryTypes.FILE_DIR_TYPE,
|
| 38 |
+
]);
|
| 39 |
+
const FILE_TYPES = new Set([
|
| 40 |
+
exports.EntryTypes.EVERYTHING_TYPE,
|
| 41 |
+
exports.EntryTypes.FILE_DIR_TYPE,
|
| 42 |
+
exports.EntryTypes.FILE_TYPE,
|
| 43 |
+
]);
|
| 44 |
+
const isNormalFlowError = (error) => NORMAL_FLOW_ERRORS.has(error.code);
|
| 45 |
+
const wantBigintFsStats = process.platform === 'win32';
|
| 46 |
+
const emptyFn = (_entryInfo) => true;
|
| 47 |
+
const normalizeFilter = (filter) => {
|
| 48 |
+
if (filter === undefined)
|
| 49 |
+
return emptyFn;
|
| 50 |
+
if (typeof filter === 'function')
|
| 51 |
+
return filter;
|
| 52 |
+
if (typeof filter === 'string') {
|
| 53 |
+
const fl = filter.trim();
|
| 54 |
+
return (entry) => entry.basename === fl;
|
| 55 |
+
}
|
| 56 |
+
if (Array.isArray(filter)) {
|
| 57 |
+
const trItems = filter.map((item) => item.trim());
|
| 58 |
+
return (entry) => trItems.some((f) => entry.basename === f);
|
| 59 |
+
}
|
| 60 |
+
return emptyFn;
|
| 61 |
+
};
|
| 62 |
+
/** Readable readdir stream, emitting new files as they're being listed. */
|
| 63 |
+
class ReaddirpStream extends node_stream_1.Readable {
|
| 64 |
+
constructor(options = {}) {
|
| 65 |
+
super({
|
| 66 |
+
objectMode: true,
|
| 67 |
+
autoDestroy: true,
|
| 68 |
+
highWaterMark: options.highWaterMark,
|
| 69 |
+
});
|
| 70 |
+
const opts = { ...defaultOptions, ...options };
|
| 71 |
+
const { root, type } = opts;
|
| 72 |
+
this._fileFilter = normalizeFilter(opts.fileFilter);
|
| 73 |
+
this._directoryFilter = normalizeFilter(opts.directoryFilter);
|
| 74 |
+
const statMethod = opts.lstat ? promises_1.lstat : promises_1.stat;
|
| 75 |
+
// Use bigint stats if it's windows and stat() supports options (node 10+).
|
| 76 |
+
if (wantBigintFsStats) {
|
| 77 |
+
this._stat = (path) => statMethod(path, { bigint: true });
|
| 78 |
+
}
|
| 79 |
+
else {
|
| 80 |
+
this._stat = statMethod;
|
| 81 |
+
}
|
| 82 |
+
this._maxDepth = opts.depth ?? defaultOptions.depth;
|
| 83 |
+
this._wantsDir = type ? DIR_TYPES.has(type) : false;
|
| 84 |
+
this._wantsFile = type ? FILE_TYPES.has(type) : false;
|
| 85 |
+
this._wantsEverything = type === exports.EntryTypes.EVERYTHING_TYPE;
|
| 86 |
+
this._root = (0, node_path_1.resolve)(root);
|
| 87 |
+
this._isDirent = !opts.alwaysStat;
|
| 88 |
+
this._statsProp = this._isDirent ? 'dirent' : 'stats';
|
| 89 |
+
this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent };
|
| 90 |
+
// Launch stream with one parent, the root dir.
|
| 91 |
+
this.parents = [this._exploreDir(root, 1)];
|
| 92 |
+
this.reading = false;
|
| 93 |
+
this.parent = undefined;
|
| 94 |
+
}
|
| 95 |
+
async _read(batch) {
|
| 96 |
+
if (this.reading)
|
| 97 |
+
return;
|
| 98 |
+
this.reading = true;
|
| 99 |
+
try {
|
| 100 |
+
while (!this.destroyed && batch > 0) {
|
| 101 |
+
const par = this.parent;
|
| 102 |
+
const fil = par && par.files;
|
| 103 |
+
if (fil && fil.length > 0) {
|
| 104 |
+
const { path, depth } = par;
|
| 105 |
+
const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path));
|
| 106 |
+
const awaited = await Promise.all(slice);
|
| 107 |
+
for (const entry of awaited) {
|
| 108 |
+
if (!entry)
|
| 109 |
+
continue;
|
| 110 |
+
if (this.destroyed)
|
| 111 |
+
return;
|
| 112 |
+
const entryType = await this._getEntryType(entry);
|
| 113 |
+
if (entryType === 'directory' && this._directoryFilter(entry)) {
|
| 114 |
+
if (depth <= this._maxDepth) {
|
| 115 |
+
this.parents.push(this._exploreDir(entry.fullPath, depth + 1));
|
| 116 |
+
}
|
| 117 |
+
if (this._wantsDir) {
|
| 118 |
+
this.push(entry);
|
| 119 |
+
batch--;
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
else if ((entryType === 'file' || this._includeAsFile(entry)) &&
|
| 123 |
+
this._fileFilter(entry)) {
|
| 124 |
+
if (this._wantsFile) {
|
| 125 |
+
this.push(entry);
|
| 126 |
+
batch--;
|
| 127 |
+
}
|
| 128 |
+
}
|
| 129 |
+
}
|
| 130 |
+
}
|
| 131 |
+
else {
|
| 132 |
+
const parent = this.parents.pop();
|
| 133 |
+
if (!parent) {
|
| 134 |
+
this.push(null);
|
| 135 |
+
break;
|
| 136 |
+
}
|
| 137 |
+
this.parent = await parent;
|
| 138 |
+
if (this.destroyed)
|
| 139 |
+
return;
|
| 140 |
+
}
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
catch (error) {
|
| 144 |
+
this.destroy(error);
|
| 145 |
+
}
|
| 146 |
+
finally {
|
| 147 |
+
this.reading = false;
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
async _exploreDir(path, depth) {
|
| 151 |
+
let files;
|
| 152 |
+
try {
|
| 153 |
+
files = await (0, promises_1.readdir)(path, this._rdOptions);
|
| 154 |
+
}
|
| 155 |
+
catch (error) {
|
| 156 |
+
this._onError(error);
|
| 157 |
+
}
|
| 158 |
+
return { files, depth, path };
|
| 159 |
+
}
|
| 160 |
+
async _formatEntry(dirent, path) {
|
| 161 |
+
let entry;
|
| 162 |
+
const basename = this._isDirent ? dirent.name : dirent;
|
| 163 |
+
try {
|
| 164 |
+
const fullPath = (0, node_path_1.resolve)((0, node_path_1.join)(path, basename));
|
| 165 |
+
entry = { path: (0, node_path_1.relative)(this._root, fullPath), fullPath, basename };
|
| 166 |
+
entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
|
| 167 |
+
}
|
| 168 |
+
catch (err) {
|
| 169 |
+
this._onError(err);
|
| 170 |
+
return;
|
| 171 |
+
}
|
| 172 |
+
return entry;
|
| 173 |
+
}
|
| 174 |
+
_onError(err) {
|
| 175 |
+
if (isNormalFlowError(err) && !this.destroyed) {
|
| 176 |
+
this.emit('warn', err);
|
| 177 |
+
}
|
| 178 |
+
else {
|
| 179 |
+
this.destroy(err);
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
async _getEntryType(entry) {
|
| 183 |
+
// entry may be undefined, because a warning or an error were emitted
|
| 184 |
+
// and the statsProp is undefined
|
| 185 |
+
if (!entry && this._statsProp in entry) {
|
| 186 |
+
return '';
|
| 187 |
+
}
|
| 188 |
+
const stats = entry[this._statsProp];
|
| 189 |
+
if (stats.isFile())
|
| 190 |
+
return 'file';
|
| 191 |
+
if (stats.isDirectory())
|
| 192 |
+
return 'directory';
|
| 193 |
+
if (stats && stats.isSymbolicLink()) {
|
| 194 |
+
const full = entry.fullPath;
|
| 195 |
+
try {
|
| 196 |
+
const entryRealPath = await (0, promises_1.realpath)(full);
|
| 197 |
+
const entryRealPathStats = await (0, promises_1.lstat)(entryRealPath);
|
| 198 |
+
if (entryRealPathStats.isFile()) {
|
| 199 |
+
return 'file';
|
| 200 |
+
}
|
| 201 |
+
if (entryRealPathStats.isDirectory()) {
|
| 202 |
+
const len = entryRealPath.length;
|
| 203 |
+
if (full.startsWith(entryRealPath) && full.substr(len, 1) === node_path_1.sep) {
|
| 204 |
+
const recursiveError = new Error(`Circular symlink detected: "${full}" points to "${entryRealPath}"`);
|
| 205 |
+
// @ts-ignore
|
| 206 |
+
recursiveError.code = RECURSIVE_ERROR_CODE;
|
| 207 |
+
return this._onError(recursiveError);
|
| 208 |
+
}
|
| 209 |
+
return 'directory';
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
catch (error) {
|
| 213 |
+
this._onError(error);
|
| 214 |
+
return '';
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
_includeAsFile(entry) {
|
| 219 |
+
const stats = entry && entry[this._statsProp];
|
| 220 |
+
return stats && this._wantsEverything && !stats.isDirectory();
|
| 221 |
+
}
|
| 222 |
+
}
|
| 223 |
+
exports.ReaddirpStream = ReaddirpStream;
|
| 224 |
+
/**
|
| 225 |
+
* Streaming version: Reads all files and directories in given root recursively.
|
| 226 |
+
* Consumes ~constant small amount of RAM.
|
| 227 |
+
* @param root Root directory
|
| 228 |
+
* @param options Options to specify root (start directory), filters and recursion depth
|
| 229 |
+
*/
|
| 230 |
+
function readdirp(root, options = {}) {
|
| 231 |
+
// @ts-ignore
|
| 232 |
+
let type = options.entryType || options.type;
|
| 233 |
+
if (type === 'both')
|
| 234 |
+
type = exports.EntryTypes.FILE_DIR_TYPE; // backwards-compatibility
|
| 235 |
+
if (type)
|
| 236 |
+
options.type = type;
|
| 237 |
+
if (!root) {
|
| 238 |
+
throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)');
|
| 239 |
+
}
|
| 240 |
+
else if (typeof root !== 'string') {
|
| 241 |
+
throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)');
|
| 242 |
+
}
|
| 243 |
+
else if (type && !ALL_TYPES.includes(type)) {
|
| 244 |
+
throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`);
|
| 245 |
+
}
|
| 246 |
+
options.root = root;
|
| 247 |
+
return new ReaddirpStream(options);
|
| 248 |
+
}
|
| 249 |
+
/**
|
| 250 |
+
* Promise version: Reads all files and directories in given root recursively.
|
| 251 |
+
* Compared to streaming version, will consume a lot of RAM e.g. when 1 million files are listed.
|
| 252 |
+
* @returns array of paths and their entry infos
|
| 253 |
+
*/
|
| 254 |
+
function readdirpPromise(root, options = {}) {
|
| 255 |
+
return new Promise((resolve, reject) => {
|
| 256 |
+
const files = [];
|
| 257 |
+
readdirp(root, options)
|
| 258 |
+
.on('data', (entry) => files.push(entry))
|
| 259 |
+
.on('end', () => resolve(files))
|
| 260 |
+
.on('error', (error) => reject(error));
|
| 261 |
+
});
|
| 262 |
+
}
|
| 263 |
+
exports.default = readdirp;
|
backend/node_modules/readdirp/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "readdirp",
|
| 3 |
+
"description": "Recursive version of fs.readdir with small RAM & CPU footprint.",
|
| 4 |
+
"version": "4.1.2",
|
| 5 |
+
"homepage": "https://github.com/paulmillr/readdirp",
|
| 6 |
+
"repository": {
|
| 7 |
+
"type": "git",
|
| 8 |
+
"url": "git://github.com/paulmillr/readdirp.git"
|
| 9 |
+
},
|
| 10 |
+
"license": "MIT",
|
| 11 |
+
"bugs": {
|
| 12 |
+
"url": "https://github.com/paulmillr/readdirp/issues"
|
| 13 |
+
},
|
| 14 |
+
"author": "Thorsten Lorenz <thlorenz@gmx.de> (thlorenz.com)",
|
| 15 |
+
"contributors": [
|
| 16 |
+
"Thorsten Lorenz <thlorenz@gmx.de> (thlorenz.com)",
|
| 17 |
+
"Paul Miller (https://paulmillr.com)"
|
| 18 |
+
],
|
| 19 |
+
"engines": {
|
| 20 |
+
"node": ">= 14.18.0"
|
| 21 |
+
},
|
| 22 |
+
"files": [
|
| 23 |
+
"index.js",
|
| 24 |
+
"index.d.ts",
|
| 25 |
+
"index.d.ts.map",
|
| 26 |
+
"index.js.map",
|
| 27 |
+
"esm"
|
| 28 |
+
],
|
| 29 |
+
"main": "./index.js",
|
| 30 |
+
"module": "./esm/index.js",
|
| 31 |
+
"types": "./index.d.ts",
|
| 32 |
+
"exports": {
|
| 33 |
+
".": {
|
| 34 |
+
"import": "./esm/index.js",
|
| 35 |
+
"require": "./index.js"
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
"sideEffects": false,
|
| 39 |
+
"keywords": [
|
| 40 |
+
"recursive",
|
| 41 |
+
"fs",
|
| 42 |
+
"stream",
|
| 43 |
+
"streams",
|
| 44 |
+
"readdir",
|
| 45 |
+
"filesystem",
|
| 46 |
+
"find",
|
| 47 |
+
"filter"
|
| 48 |
+
],
|
| 49 |
+
"scripts": {
|
| 50 |
+
"build": "tsc && tsc -p tsconfig.cjs.json",
|
| 51 |
+
"lint": "prettier --check index.ts test/index.test.js",
|
| 52 |
+
"format": "prettier --write index.ts test/index.test.js",
|
| 53 |
+
"test": "node test/index.test.js",
|
| 54 |
+
"test:coverage": "c8 node test/index.test.js"
|
| 55 |
+
},
|
| 56 |
+
"devDependencies": {
|
| 57 |
+
"@paulmillr/jsbt": "0.3.1",
|
| 58 |
+
"@types/node": "20.14.8",
|
| 59 |
+
"c8": "10.1.3",
|
| 60 |
+
"chai": "4.3.4",
|
| 61 |
+
"chai-subset": "1.6.0",
|
| 62 |
+
"micro-should": "0.5.0",
|
| 63 |
+
"prettier": "3.1.1",
|
| 64 |
+
"typescript": "5.5.2"
|
| 65 |
+
},
|
| 66 |
+
"funding": {
|
| 67 |
+
"type": "individual",
|
| 68 |
+
"url": "https://paulmillr.com/funding/"
|
| 69 |
+
}
|
| 70 |
+
}
|
backend/prisma/migrations/20260516071158_init_auth/migration.sql
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- CreateTable
|
| 2 |
+
CREATE TABLE "User" (
|
| 3 |
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
| 4 |
+
"email" TEXT NOT NULL,
|
| 5 |
+
"passwordHash" TEXT NOT NULL,
|
| 6 |
+
"role" TEXT NOT NULL DEFAULT 'user',
|
| 7 |
+
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
| 8 |
+
"telegramChatId" TEXT,
|
| 9 |
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 10 |
+
"updatedAt" DATETIME NOT NULL
|
| 11 |
+
);
|
| 12 |
+
|
| 13 |
+
-- CreateTable
|
| 14 |
+
CREATE TABLE "Market" (
|
| 15 |
+
"id" TEXT NOT NULL PRIMARY KEY,
|
| 16 |
+
"question" TEXT NOT NULL,
|
| 17 |
+
"category" TEXT,
|
| 18 |
+
"countryCode" TEXT,
|
| 19 |
+
"yesPrice" REAL,
|
| 20 |
+
"noPrice" REAL,
|
| 21 |
+
"volumeEur" REAL,
|
| 22 |
+
"liquidityEur" REAL,
|
| 23 |
+
"status" TEXT NOT NULL DEFAULT 'active',
|
| 24 |
+
"closesAt" DATETIME,
|
| 25 |
+
"lastSynced" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
| 26 |
+
);
|
| 27 |
+
|
| 28 |
+
-- CreateTable
|
| 29 |
+
CREATE TABLE "AISignal" (
|
| 30 |
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
| 31 |
+
"marketId" TEXT NOT NULL,
|
| 32 |
+
"signal" TEXT NOT NULL,
|
| 33 |
+
"confidence" REAL NOT NULL,
|
| 34 |
+
"summary" TEXT,
|
| 35 |
+
"keyRisk" TEXT,
|
| 36 |
+
"newsCount" INTEGER NOT NULL DEFAULT 0,
|
| 37 |
+
"modelVersion" TEXT NOT NULL DEFAULT 'Qwen3-8B',
|
| 38 |
+
"generatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 39 |
+
CONSTRAINT "AISignal_marketId_fkey" FOREIGN KEY ("marketId") REFERENCES "Market" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
| 40 |
+
);
|
| 41 |
+
|
| 42 |
+
-- CreateTable
|
| 43 |
+
CREATE TABLE "Position" (
|
| 44 |
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
| 45 |
+
"userId" INTEGER NOT NULL,
|
| 46 |
+
"marketId" TEXT NOT NULL,
|
| 47 |
+
"outcome" TEXT NOT NULL,
|
| 48 |
+
"amountEur" REAL NOT NULL,
|
| 49 |
+
"entryPrice" REAL NOT NULL,
|
| 50 |
+
"currentPrice" REAL,
|
| 51 |
+
"pnl" REAL NOT NULL DEFAULT 0,
|
| 52 |
+
"kellyFraction" REAL,
|
| 53 |
+
"status" TEXT NOT NULL DEFAULT 'open',
|
| 54 |
+
"openedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 55 |
+
"closedAt" DATETIME,
|
| 56 |
+
CONSTRAINT "Position_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
| 57 |
+
CONSTRAINT "Position_marketId_fkey" FOREIGN KEY ("marketId") REFERENCES "Market" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
| 58 |
+
);
|
| 59 |
+
|
| 60 |
+
-- CreateTable
|
| 61 |
+
CREATE TABLE "Watchlist" (
|
| 62 |
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
| 63 |
+
"userId" INTEGER NOT NULL,
|
| 64 |
+
"marketId" TEXT NOT NULL,
|
| 65 |
+
"alertThreshold" REAL,
|
| 66 |
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 67 |
+
CONSTRAINT "Watchlist_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
| 68 |
+
CONSTRAINT "Watchlist_marketId_fkey" FOREIGN KEY ("marketId") REFERENCES "Market" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
| 69 |
+
);
|
| 70 |
+
|
| 71 |
+
-- CreateTable
|
| 72 |
+
CREATE TABLE "Alert" (
|
| 73 |
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
| 74 |
+
"userId" INTEGER NOT NULL,
|
| 75 |
+
"marketId" TEXT NOT NULL,
|
| 76 |
+
"type" TEXT NOT NULL,
|
| 77 |
+
"message" TEXT NOT NULL,
|
| 78 |
+
"sentAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 79 |
+
CONSTRAINT "Alert_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
|
| 80 |
+
CONSTRAINT "Alert_marketId_fkey" FOREIGN KEY ("marketId") REFERENCES "Market" ("id") ON DELETE CASCADE ON UPDATE CASCADE
|
| 81 |
+
);
|
| 82 |
+
|
| 83 |
+
-- CreateIndex
|
| 84 |
+
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
| 85 |
+
|
| 86 |
+
-- CreateIndex
|
| 87 |
+
CREATE INDEX "AISignal_marketId_generatedAt_idx" ON "AISignal"("marketId", "generatedAt");
|
| 88 |
+
|
| 89 |
+
-- CreateIndex
|
| 90 |
+
CREATE INDEX "Position_userId_status_idx" ON "Position"("userId", "status");
|
| 91 |
+
|
| 92 |
+
-- CreateIndex
|
| 93 |
+
CREATE INDEX "Position_marketId_idx" ON "Position"("marketId");
|
| 94 |
+
|
| 95 |
+
-- CreateIndex
|
| 96 |
+
CREATE INDEX "Watchlist_userId_idx" ON "Watchlist"("userId");
|
| 97 |
+
|
| 98 |
+
-- CreateIndex
|
| 99 |
+
CREATE UNIQUE INDEX "Watchlist_userId_marketId_key" ON "Watchlist"("userId", "marketId");
|
| 100 |
+
|
| 101 |
+
-- CreateIndex
|
| 102 |
+
CREATE INDEX "Alert_userId_sentAt_idx" ON "Alert"("userId", "sentAt");
|
| 103 |
+
|
| 104 |
+
-- CreateIndex
|
| 105 |
+
CREATE INDEX "Alert_marketId_idx" ON "Alert"("marketId");
|
backend/prisma/migrations/20260516072006_remove_user_role/migration.sql
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
Warnings:
|
| 3 |
+
|
| 4 |
+
- You are about to drop the column `role` on the `User` table. All the data in the column will be lost.
|
| 5 |
+
|
| 6 |
+
*/
|
| 7 |
+
-- RedefineTables
|
| 8 |
+
PRAGMA defer_foreign_keys=ON;
|
| 9 |
+
PRAGMA foreign_keys=OFF;
|
| 10 |
+
CREATE TABLE "new_User" (
|
| 11 |
+
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
| 12 |
+
"email" TEXT NOT NULL,
|
| 13 |
+
"passwordHash" TEXT NOT NULL,
|
| 14 |
+
"isActive" BOOLEAN NOT NULL DEFAULT true,
|
| 15 |
+
"telegramChatId" TEXT,
|
| 16 |
+
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
| 17 |
+
"updatedAt" DATETIME NOT NULL
|
| 18 |
+
);
|
| 19 |
+
INSERT INTO "new_User" ("createdAt", "email", "id", "isActive", "passwordHash", "telegramChatId", "updatedAt") SELECT "createdAt", "email", "id", "isActive", "passwordHash", "telegramChatId", "updatedAt" FROM "User";
|
| 20 |
+
DROP TABLE "User";
|
| 21 |
+
ALTER TABLE "new_User" RENAME TO "User";
|
| 22 |
+
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
|
| 23 |
+
PRAGMA foreign_keys=ON;
|
| 24 |
+
PRAGMA defer_foreign_keys=OFF;
|
backend/prisma/migrations/migration_lock.toml
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Please do not edit this file manually
|
| 2 |
+
# It should be added in your version-control system (e.g., Git)
|
| 3 |
+
provider = "sqlite"
|
backend/src/positions/positions.controller.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Controladores del modulo de posiciones (simulador virtual).
|
| 3 |
+
*
|
| 4 |
+
* Responsabilidades:
|
| 5 |
+
* - open(req, res) β abre una posicion virtual en un mercado.
|
| 6 |
+
* - list(req, res) β lista las posiciones del usuario autenticado.
|
| 7 |
+
* - close(req, res) β cierra una posicion y calcula P&L final.
|
| 8 |
+
*
|
| 9 |
+
* Endpoints (bajo /api/v1/positions, protegidos por requireAuth):
|
| 10 |
+
* POST / β abrir posicion.
|
| 11 |
+
* GET / β listar posiciones (opcional ?status=open|closed).
|
| 12 |
+
* DELETE /:id β cerrar posicion.
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
import { ok, created, noContent } from '../utils/apiResponse.js';
|
| 16 |
+
import { positionsService } from './positions.service.js';
|
| 17 |
+
|
| 18 |
+
export const positionsController = {
|
| 19 |
+
async open(req, res) {
|
| 20 |
+
const position = await positionsService.open(req.user.id, req.body);
|
| 21 |
+
created(res, position);
|
| 22 |
+
},
|
| 23 |
+
|
| 24 |
+
async list(req, res) {
|
| 25 |
+
const positions = await positionsService.list(req.user.id, req.query.status);
|
| 26 |
+
ok(res, positions);
|
| 27 |
+
},
|
| 28 |
+
|
| 29 |
+
async close(req, res) {
|
| 30 |
+
const position = await positionsService.close(req.params.id, req.user.id);
|
| 31 |
+
ok(res, position);
|
| 32 |
+
},
|
| 33 |
+
|
| 34 |
+
async suggest(req, res) {
|
| 35 |
+
const bankroll = req.query.bankroll ? parseFloat(req.query.bankroll) : 1000;
|
| 36 |
+
const suggestion = await positionsService.suggest(req.params.marketId, bankroll);
|
| 37 |
+
ok(res, suggestion);
|
| 38 |
+
},
|
| 39 |
+
};
|
backend/src/positions/positions.validators.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Esquemas Zod para validar inputs del modulo de posiciones.
|
| 3 |
+
*
|
| 4 |
+
* Responsabilidades:
|
| 5 |
+
* - openBody β marketId (string), outcome ('YES'|'NO'), amountEur (positivo, max 100k).
|
| 6 |
+
* - idParam β coerce a numero entero positivo.
|
| 7 |
+
* - listQuery β status opcional ('open'|'closed').
|
| 8 |
+
*
|
| 9 |
+
* Consumido por:
|
| 10 |
+
* - positions.routes.js β validate() en POST, GET y DELETE.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
import { z } from 'zod';
|
| 14 |
+
|
| 15 |
+
export const openBody = z.object({
|
| 16 |
+
marketId: z.string().min(1),
|
| 17 |
+
outcome: z.enum(['YES', 'NO']),
|
| 18 |
+
amountEur: z.number().positive().max(100_000),
|
| 19 |
+
});
|
| 20 |
+
|
| 21 |
+
export const idParam = z.object({
|
| 22 |
+
id: z.coerce.number().int().positive(),
|
| 23 |
+
});
|
| 24 |
+
|
| 25 |
+
export const listQuery = z.object({
|
| 26 |
+
status: z.enum(['open', 'closed']).optional(),
|
| 27 |
+
});
|
backend/src/socket/broadcaster.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Broadcaster de eventos en tiempo real via Socket.io.
|
| 3 |
+
*
|
| 4 |
+
* Actua como un wrapper singleton sobre la instancia de Socket.io.
|
| 5 |
+
* Responsabilidades:
|
| 6 |
+
* - Recibir la instancia de io en el arranque (attachBroadcaster).
|
| 7 |
+
* - Emitir eventos tipados a todos los clientes conectados:
|
| 8 |
+
* * market_update β cambio de precio/volumen de un mercado.
|
| 9 |
+
* * ai_signal β nueva senal generada por el pipeline de IA.
|
| 10 |
+
* * price_alert β alerta de umbral de precio o cambio de senal.
|
| 11 |
+
*
|
| 12 |
+
* Los controladores y servicios importan estas funciones para notificar
|
| 13 |
+
* sin acoplarse directamente a Socket.io.
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
let _io = null;
|
| 17 |
+
|
| 18 |
+
export function attachBroadcaster(io) {
|
| 19 |
+
_io = io;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
export function emitMarketUpdate(payload) {
|
| 23 |
+
_io?.emit('market_update', payload);
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
export function emitAiSignal(payload) {
|
| 27 |
+
_io?.emit('ai_signal', payload);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
export function emitPriceAlert(payload) {
|
| 31 |
+
_io?.emit('price_alert', payload);
|
| 32 |
+
}
|
backend/src/stats/stats.routes.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Rutas REST de estadisticas globales (publicas).
|
| 3 |
+
*
|
| 4 |
+
* Endpoint (montado en /api/v1/stats):
|
| 5 |
+
* GET / β estadisticas agregadas del sistema.
|
| 6 |
+
*
|
| 7 |
+
* Datos expuestos:
|
| 8 |
+
* - marketsCount : total de mercados activos.
|
| 9 |
+
* - volume24h : suma de volumen de mercados activos.
|
| 10 |
+
* - signalsCount : total de senales IA generadas.
|
| 11 |
+
* - alertsToday : alertas enviadas en las ultimas 24h.
|
| 12 |
+
*/
|
| 13 |
+
|
| 14 |
+
import { Router } from 'express';
|
| 15 |
+
import { prisma } from '../utils/prisma.js';
|
| 16 |
+
import { ok } from '../utils/apiResponse.js';
|
| 17 |
+
|
| 18 |
+
const router = Router();
|
| 19 |
+
|
| 20 |
+
router.get('/', async (_req, res) => {
|
| 21 |
+
const [marketsCount, signalsCount, alertsToday] = await Promise.all([
|
| 22 |
+
prisma.market.count({ where: { status: 'active' } }),
|
| 23 |
+
prisma.aISignal.count(),
|
| 24 |
+
prisma.alert.count({
|
| 25 |
+
where: { sentAt: { gte: new Date(Date.now() - 24 * 60 * 60 * 1000) } },
|
| 26 |
+
}),
|
| 27 |
+
]);
|
| 28 |
+
|
| 29 |
+
const volumeAgg = await prisma.market.aggregate({
|
| 30 |
+
where: { status: 'active' },
|
| 31 |
+
_sum: { volumeEur: true },
|
| 32 |
+
});
|
| 33 |
+
|
| 34 |
+
ok(res, {
|
| 35 |
+
marketsCount,
|
| 36 |
+
volume24h: volumeAgg._sum.volumeEur || 0,
|
| 37 |
+
signalsCount,
|
| 38 |
+
alertsToday,
|
| 39 |
+
});
|
| 40 |
+
});
|
| 41 |
+
|
| 42 |
+
export default router;
|
backend/src/watchlist/watchlist.controller.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Controladores del modulo de lista de seguimiento (watchlist).
|
| 3 |
+
*
|
| 4 |
+
* Responsabilidades:
|
| 5 |
+
* - add(req, res) β anade un mercado a la watchlist con umbral de alerta opcional.
|
| 6 |
+
* - remove(req, res) β elimina un mercado de la watchlist.
|
| 7 |
+
* - list(req, res) β devuelve la watchlist del usuario autenticado.
|
| 8 |
+
*
|
| 9 |
+
* Endpoints (bajo /api/v1/watchlist, protegidos por requireAuth):
|
| 10 |
+
* POST / β anadir mercado.
|
| 11 |
+
* GET / β listar watchlist.
|
| 12 |
+
* DELETE /:marketId β eliminar mercado.
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
import { ok, created, noContent } from '../utils/apiResponse.js';
|
| 16 |
+
import { watchlistService } from './watchlist.service.js';
|
| 17 |
+
|
| 18 |
+
export const watchlistController = {
|
| 19 |
+
async add(req, res) {
|
| 20 |
+
const entry = await watchlistService.add(req.user.id, req.body);
|
| 21 |
+
created(res, entry);
|
| 22 |
+
},
|
| 23 |
+
|
| 24 |
+
async remove(req, res) {
|
| 25 |
+
await watchlistService.remove(req.user.id, req.params.marketId);
|
| 26 |
+
noContent(res);
|
| 27 |
+
},
|
| 28 |
+
|
| 29 |
+
async list(req, res) {
|
| 30 |
+
const entries = await watchlistService.list(req.user.id);
|
| 31 |
+
ok(res, entries);
|
| 32 |
+
},
|
| 33 |
+
};
|
backend/src/watchlist/watchlist.repository.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Repositorio de acceso a datos para el modelo Watchlist.
|
| 3 |
+
*
|
| 4 |
+
* Responsabilidades:
|
| 5 |
+
* - create(data) β inserta entrada en watchlist.
|
| 6 |
+
* - findByUser(userId) β lista con datos del mercado asociado.
|
| 7 |
+
* - deleteByUserAndMarket(...) β elimina entrada especifica.
|
| 8 |
+
* - findAllWithThreshold() β entradas con alertThreshold definido (para alertas).
|
| 9 |
+
*
|
| 10 |
+
* Constraint:
|
| 11 |
+
* - @@unique([userId, marketId]) β un usuario no puede duplicar un mercado.
|
| 12 |
+
*
|
| 13 |
+
* Todas las operaciones usan Prisma ORM.
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
import { prisma } from '../utils/prisma.js';
|
| 17 |
+
|
| 18 |
+
export const watchlistRepository = {
|
| 19 |
+
create({ userId, marketId, alertThreshold }) {
|
| 20 |
+
return prisma.watchlist.create({ data: { userId, marketId, alertThreshold } });
|
| 21 |
+
},
|
| 22 |
+
|
| 23 |
+
findByUser(userId) {
|
| 24 |
+
return prisma.watchlist.findMany({
|
| 25 |
+
where: { userId },
|
| 26 |
+
include: {
|
| 27 |
+
market: { select: { id: true, question: true, yesPrice: true, noPrice: true, status: true } },
|
| 28 |
+
},
|
| 29 |
+
orderBy: { createdAt: 'desc' },
|
| 30 |
+
});
|
| 31 |
+
},
|
| 32 |
+
|
| 33 |
+
deleteByUserAndMarket(userId, marketId) {
|
| 34 |
+
return prisma.watchlist.deleteMany({ where: { userId, marketId } });
|
| 35 |
+
},
|
| 36 |
+
|
| 37 |
+
findAllWithThreshold() {
|
| 38 |
+
return prisma.watchlist.findMany({
|
| 39 |
+
where: { alertThreshold: { not: null } },
|
| 40 |
+
include: {
|
| 41 |
+
user: { select: { id: true, telegramChatId: true } },
|
| 42 |
+
market: { select: { id: true, question: true, yesPrice: true } },
|
| 43 |
+
},
|
| 44 |
+
});
|
| 45 |
+
},
|
| 46 |
+
};
|
backend/src/watchlist/watchlist.routes.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Rutas REST del modulo de lista de seguimiento (watchlist).
|
| 3 |
+
*
|
| 4 |
+
* Endpoints (montados en /api/v1/watchlist):
|
| 5 |
+
* POST / β anadir mercado (validate addBody).
|
| 6 |
+
* GET / β listar watchlist.
|
| 7 |
+
* DELETE /:marketId β eliminar mercado (validate marketIdParam en params).
|
| 8 |
+
*
|
| 9 |
+
* Todas las rutas requieren autenticacion JWT (router.use(requireAuth)).
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
import { Router } from 'express';
|
| 13 |
+
import { validate } from '../middlewares/validate.js';
|
| 14 |
+
import { requireAuth } from '../middlewares/requireAuth.js';
|
| 15 |
+
import { watchlistController } from './watchlist.controller.js';
|
| 16 |
+
import { addBody, marketIdParam } from './watchlist.validators.js';
|
| 17 |
+
|
| 18 |
+
const router = Router();
|
| 19 |
+
|
| 20 |
+
router.use(requireAuth);
|
| 21 |
+
|
| 22 |
+
router.post('/', validate(addBody), watchlistController.add);
|
| 23 |
+
router.get('/', watchlistController.list);
|
| 24 |
+
router.delete('/:marketId', validate(marketIdParam, 'params'), watchlistController.remove);
|
| 25 |
+
|
| 26 |
+
export default router;
|
backend/src/watchlist/watchlist.service.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Logica de negocio del modulo de lista de seguimiento (watchlist).
|
| 3 |
+
*
|
| 4 |
+
* Responsabilidades:
|
| 5 |
+
* - add(userId, { marketId, alertThreshold })
|
| 6 |
+
* β valida que el mercado exista, crea entrada en watchlist.
|
| 7 |
+
* β si ya existe (P2002), devuelve 409 ALREADY_IN_WATCHLIST.
|
| 8 |
+
* - remove(userId, marketId) β elimina entrada; si no existe devuelve 404.
|
| 9 |
+
* - list(userId) β devuelve todas las entradas del usuario.
|
| 10 |
+
*
|
| 11 |
+
* Consumido por:
|
| 12 |
+
* - watchlist.controller.js (API REST).
|
| 13 |
+
* - alerts.service.js β processAll() revisa watchlist con alertThreshold.
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
import { HttpError } from '../utils/apiResponse.js';
|
| 17 |
+
import { watchlistRepository } from './watchlist.repository.js';
|
| 18 |
+
import { marketsRepository } from '../markets/markets.repository.js';
|
| 19 |
+
|
| 20 |
+
export const watchlistService = {
|
| 21 |
+
async add(userId, { marketId, alertThreshold }) {
|
| 22 |
+
const market = await marketsRepository.findById(marketId);
|
| 23 |
+
if (!market) throw new HttpError(404, 'NOT_FOUND', 'Market not found');
|
| 24 |
+
|
| 25 |
+
try {
|
| 26 |
+
return await watchlistRepository.create({ userId, marketId, alertThreshold });
|
| 27 |
+
} catch (err) {
|
| 28 |
+
if (err.code === 'P2002') throw new HttpError(409, 'ALREADY_IN_WATCHLIST', 'Market already in watchlist');
|
| 29 |
+
throw err;
|
| 30 |
+
}
|
| 31 |
+
},
|
| 32 |
+
|
| 33 |
+
async remove(userId, marketId) {
|
| 34 |
+
const { count } = await watchlistRepository.deleteByUserAndMarket(userId, marketId);
|
| 35 |
+
if (count === 0) throw new HttpError(404, 'NOT_FOUND', 'Entry not found in watchlist');
|
| 36 |
+
},
|
| 37 |
+
|
| 38 |
+
list(userId) {
|
| 39 |
+
return watchlistRepository.findByUser(userId);
|
| 40 |
+
},
|
| 41 |
+
};
|
backend/src/watchlist/watchlist.validators.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Esquemas Zod para validar inputs del modulo de watchlist.
|
| 3 |
+
*
|
| 4 |
+
* Responsabilidades:
|
| 5 |
+
* - addBody β marketId (string), alertThreshold opcional (0.0 a 1.0).
|
| 6 |
+
* - marketIdParam β string no vacio para el parametro :marketId.
|
| 7 |
+
*
|
| 8 |
+
* Consumido por:
|
| 9 |
+
* - watchlist.routes.js β validate() en POST y DELETE.
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
import { z } from 'zod';
|
| 13 |
+
|
| 14 |
+
export const addBody = z.object({
|
| 15 |
+
marketId: z.string().min(1),
|
| 16 |
+
alertThreshold: z.number().min(0).max(1).optional(),
|
| 17 |
+
});
|
| 18 |
+
|
| 19 |
+
export const marketIdParam = z.object({
|
| 20 |
+
marketId: z.string().min(1),
|
| 21 |
+
});
|