Commit Graph

174 Commits

Author SHA1 Message Date
Annika
bc6e0dcdb7 REPL: Fix heapdump path
The `path` identifier referred to the module `path`, not the path that the heapdump should be written to
2022-03-02 19:48:22 -08:00
Annika
6e91e22740 Improve typing and fix build 2022-02-28 19:49:08 -08:00
Mia
1c8381113f
SQL: Expose an sql-template-strings API
Necessary for consumers of the DatabaseTable API wishing to use the delete etc functions. And this solution is much nicer than `tableinstance.SQL\`\``.
2022-02-01 12:36:31 -06:00
Mia
29cef961c6
SQL: Add an abstraction for typed queries (#8565) 2022-02-01 10:02:53 -08:00
Mia
fa8f7a3e50
SQL: Propagate errors to the parent process (#8613) 2022-01-05 17:56:52 -08:00
Mia
971a02061a
Fix build
I don't know why this counts as a variable.
2021-11-27 22:43:36 -06:00
Mia
5649bc5f30 Crashlogger: Don't crash if there's no Config global 2021-11-27 14:34:20 -06:00
Guangcong Luo
57554dc283 Stop using fs.exists
`fs.exists` should in practice be replaced with try-catch (since the
latter isn't susceptible to race conditions).
2021-10-09 15:53:30 -04:00
Mia
a4e81e29d3 Crashlogger: Support passing nodemailer configuration
This is useful for the new loginserver.
2021-10-03 19:58:13 -05:00
Mia
e08e1a9cf0 Repl: Create file directory if it doesn't exist 2021-09-13 20:26:11 -05:00
Mia
7811795344
Handle new TypeScript version (#8449)
Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2021-08-30 20:11:44 -07:00
Mia
d9b342745c Process-Manager: Allow undefined responses in QueryProcessManager 2021-08-21 13:20:06 -05:00
Mia
b70bf3fa17
ProcessManager: Crashlog bad JSON responses (#8438) 2021-08-20 18:18:34 -07:00
Mia
8cf1035ee2
SQL: Automatically prepare statements unless told otherwise (#8439) 2021-08-18 12:51:39 -07:00
Mia
0a2ed42d13 SQL: Support turning SQL.Statements to JSON 2021-08-15 15:17:45 -05:00
Annika
a7ddaa1b63 SQL library: Support loading extensions at will 2021-08-14 20:35:08 -07:00
Annika
f13609e721
SQL library: Improve typing of #run() 2021-08-14 18:58:13 -07:00
Mia
ca1400ddc3 Fix build 2021-08-14 20:24:23 -05:00
Mia
d63e647a95 Fix typo 2021-08-14 19:58:24 -05:00
Mia
c8991c3d9d SQL: Overhaul database/statement not found errors 2021-08-14 19:58:02 -05:00
Mia
77861ceae6
SQL: Use a QueryProcessManager subclass (#8422) 2021-08-14 17:45:51 -07:00
Mia
a43d3f66a9 SQL: Properly support named parameters 2021-08-13 21:08:43 -05:00
Annika
33ad1a0a50 Move Modlog.formatArray to Utils 2021-08-12 16:38:14 -07:00
Annika
e9990080d3 FS: Fix build 2021-08-04 21:12:37 -07:00
Annika
bcbe100c41
Modlog: Use SQLite for searches (#8004) 2021-07-23 13:47:49 -07:00
Mia
4f50a1143f Fix build 2021-07-21 16:26:21 -05:00
Mia
9ed2c0036f
Add a command for evaluating SQLite (#8407) 2021-07-21 13:05:02 -07:00
Annika
9e11aab86d SQL library: Fix bugs and add features for modlog 2021-07-20 21:31:02 -07:00
Mia
330038ca0f SQL: Expose normal statement table to transactions 2021-07-20 20:47:40 -05:00
Mia
719f0818d0 SQL: Expose string-keyed statement table to transactions 2021-07-20 20:45:27 -05:00
Mia
044dc3e54f SQL library: Improve API 2021-07-20 20:25:34 -05:00
Mia
ace114ff36 Fix build 2021-07-20 00:03:12 -05:00
Mia
adbe7b9947 SQL library: Improve error handling 2021-07-19 23:56:58 -05:00
Mia
2c1b7d7828
Add a library for running SQLite databases in threads (#7350) 2021-07-19 21:02:03 -05:00
Mia
b175d8b000 Friends: Use /migrations/friends for versioning 2021-07-19 20:49:47 -05:00
Mia
20c795f8f4
Friends: Move caching to User#friends (#8404) 2021-07-16 20:33:07 -07:00
Mia
e5fbd64427
Support adding friends (#7333) 2021-07-16 12:56:34 -07:00
Annika
6ed55b6d1f
IPTools: Add sanity checks (#8331) 2021-07-09 19:59:45 -07:00
Annika
c134195915
Use ts-node instead of Sucrase (#8369) 2021-07-09 19:59:22 -07:00
Guangcong Luo
f47e38c5ad Support building TS declarations
`./build decl` now builds TS declarations for everything exported by
`sim/`. Unfortunately, the built TS declarations still refer to global
types, so some things still have `any` type, but it's much better than
nothing.
2021-06-09 17:51:49 -05:00
Mia
48ce5d720f FS: Don't crash if config doesn't exist
QOL. Also, if we _do_ want to export this as a module, we need this to not crash if Config doesn't exist.
2021-05-30 12:21:24 -05:00
Mia
c7b8925d82
Repl: Make it easier to heapdump processes (#8333) 2021-05-25 16:00:00 -07:00
Guangcong Luo
4e213368dc Redesign Rock Paper Scissors
This new update will have it looking a lot nicer, and also fixes some
architectural issues with the old design.
2021-05-13 09:39:51 -04:00
Guangcong Luo
574bb28bbe
Implement Utils.Multiset (#8260)
If you grep the codebase for `|| 0) + 1` you get a lot of results,
all of which would be better implemented with a multiset.
2021-05-04 21:53:23 -07:00
Guangcong Luo
04243bc731 Fix crash in Utils.sortBy 2021-04-26 14:57:35 -04:00
Guangcong Luo
486f292904
Refactor everything to use Utils.sortBy (#8220)
A few uses of `array.sort()` have been left alone:

- sorting in `data/` because they aren't supposed to import anything

- `set-importer` because I still have no clue what that's for and what
  dependencies it is/isn't allowed to have

- `sort()` with no arguments used as a lexical sort (at which point
  `sortBy` offers no benefits)

All other cases have been replaced with `Utils.sortBy`, which should
be a massive increase in readability.

Sort orders should be much more readable now, without needing to puzzle
through sign issues. The order is always low-to-high, A-to-Z,
true-to-false.
2021-04-23 22:41:00 -07:00
Guangcong Luo
13189fdb02
Update Dex API (#8181)
This is the change that renames:

- `Dex.getMove` -> `Dex.moves.get`
- `Dex.getAbility` -> `Dex.abilities.get`
- `Dex.getItem` -> `Dex.items.get`
- `Dex.getSpecies` -> `Dex.species.get`
- `Dex.getEffect` -> `Dex.conditions.get`
- `Dex.getNature` -> `Dex.natures.get`
- `Dex.getType` -> `Dex.types.get`
- `Dex.getFormat` -> `Dex.formats.get`

In addition, some other APIs have been updated:

- `getByID` methods have also been added to every other table.
- `Dex.moves.all()` now gets an array of all moves
  - Plus equivalent methods for `abilities`, `items`, `species`, `formats`, `natures`, `types`
  - Note: there's no `Dex.conditions.all()`
- new API: `Dex.stats` for naming/iterating stats
- `Dex.getEffectByID` -> `Dex.conditions.getByID`
- `Dex.getType` -> `Dex.types.get`
- `Dex.data.Formats` -> `Dex.data.Rulesets`
- `Dex.formats` -> now an array `Dex.formats.all()`
- `Dex.getRuleTable` -> `Dex.formats.getRuleTable`
- `Dex.validateFormat` -> `Dex.formats.validate`

Team functions have been split off into a new `sim/teams` package:

- `Dex.packTeam` -> `Teams.pack`
- `Dex.fastUnpackTeam` -> `Teams.unpack`
- `Dex.generateTeam` -> `Teams.generate`
- `Dex.stringifyTeam` -> `Teams.export`

`Teams.export` has also been rewritten to better match how it works in client.

This implements #8178
2021-04-08 03:00:37 -07:00
Mia
07b1c01f75
Support hotpatching User/Room/ProcessManager protos (#8095) 2021-03-08 05:23:17 -08:00
Mia
736e38e4af
ProcessManager: Handle Monitor#slow in subprocesses (#7990) 2021-03-03 12:39:53 -08:00
Guangcong Luo
61ea2dd916 Implement Utils.escapeHTMLForceWrap
Combining escapeHTML and forceWrap allows us to use <wbr /> instead
of U+200B, fixing a copy/paste bug.
2021-02-15 06:09:58 -05:00