Commit Graph

140 Commits

Author SHA1 Message Date
2b31cc2ae9 perf: Merge develop into main (#36)
* Update dockerfile for standalone deployment (#23)

* Add files via upload

* Update Docker image for pluralflux service

* removing unnecessary network and container name definitions

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* Converting ES6 back to CJS (#25)

converting back to cjs

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* Fix: Further converting ES6 to CJS - Making exports named instead of default (#26)

* adding to git ignore

* making imports named not default to not break all my tests

* adjusted setup for memberhelper test

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* feat: add db migrations with typeORM (#28)

* adding typescript packages for typeORM

* add typeORM initial files

* updating package scripts

* updating compose.yaml to have an exposed port for the postgres

* modifying setup for typeORM

* update database stuff and and package.json to help generate migrations

* made models and migrations in typeORM

* delete unneeded database.js

* made database pattern ignored by jest

* remove sequelize

* separate member repo from member helper

* not sure why i made everything numbers in the model but it's fixed now

* edited package.json script

* remove unused index.ts

* adjusted files to reference repository correctly and appdatasource

* made appdatasource export as named

* removed start-db script

* added init to appdatasource in bot.js

* migrations finally!

* new migration matching model names I want

* updating tests

* removing testpathignore patterns since it seems to be unecessary?

* adjusting migrations to match current schema

* removed reference to secrets file

* delete old migration

* Revert "delete old migration"

This reverts commit db1efa39a7.

* Revert "adjusting migrations to match current schema"

This reverts commit ef89a83f6a.

* just deleted system creation since it's got nothing in it anyway

* renamed memberRepository to memberRepo for consistency

* added await back to parseMemberCommand call to memberArgumentHandler

* changed call to memberHelper.getMembersByAuthor to memberRepo

* renamed repo updateMemberValue to updateMemberField

* removed throw references in repo docstrings

* remove unneeded subscriber directory ref

* changed createdAt and updatedAt columns to be auto-generated

made member table have timezone

* changed casing of isInitialized in mock for bot.js

* removed % from ILike query so that it doesn't match substrings/wildcard

* renamed some stray updateMemberValue in mocks -> updateMemberField

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* feat: Add migration to migrate existing data to new member table (#29)

added migration to fill new Member table with data from Members

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* fix: update message helper reference hotfix (#30)

* forgot to update a reference in messageHelper to memberRepo instead of memberHelper

* turned off data-source logging

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* fix: update dockerfile to run npm start (#31)

fix: update dockerfile to run npm start (which runs ts-node) instead of node

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* added .env with examples, updated data-source to be access a docker container instead of relying on loopback

* i forgot to git add data-source.ts 🤦

* fix: changed property reference for createMember in repo (#32)

fix for createMember object references (was referencing non-existent properties)

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* fix: memberRepo methods syntax (#35)

* rearranged update member field and remove member to match expected structure in typeORM

* update docstring

* change insert to save in memberRepo

* added command in package.json

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* Delete duplicate members migration (#33)

* add migration to delete duplicates that currently exist in the db

* added a name attribute for consistency

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* Add unique index migration (#34)

* add migration to delete duplicates that currently exist in the db

* change model and migration to add a unique index constraint to id and name

* renamed unique index name to be readable

* redid model and migration to use @Unique instead of @Index

* remove //Here comment

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>

* why wont these workflows stay up gahdamn

---------

Co-authored-by: Laika Bozhko <63646916+LaikaBzko@users.noreply.github.com>
Co-authored-by: Aster Fialla <asterfialla@gmail.com>
Co-authored-by: laika <laika@sanya.gay>
2026-03-09 09:00:15 -04:00
df80eca0ec refactor: Removing then/catch from async/await calls (#22)
* refactored async/await for import helper to not also use then/catch

* added enum

* refactor webhookHelper and tests to not use then/catch

* changed docstring

* refactoring bot and tests to not use then/catch

* refactoring commands.js and tests to not use then/catch

* refactoring memberHelper.js and tests to not use then/catch

* removing then/catch from messageHelper.test.js

* fixed set up for commands tests

* edited bot to have top level main function

* one more test in commands.js, and removed console.error

* fixed typo in webhookHelper

* forgot to switch over some tests in bot.test and commands.test

* removed console.log from import helper

* put console.error in commands

* converted utils.js to not use then/catch

* tested utils checkImageFormatValidity

* removed jest-fetch-mock since it turns out I was just manually mocking it anyway

* refactored database to not use then/catch

* added dash to commands.js and test to pass

* added the remaining webhook tests

* changed utils to check for 10MB size not 1MB

* removed unnecessary try/catch from utils

* Simplify getWebhook to use .find() instead of foreach logic

* make memberCommand exit when error occurs with parseMemberCommand

* changed commands.js to not have user interaction within the catch

* updated console.error message in database.js

* made importHelper mock throw error instead of "resolve" error

* replaced "pk;" with "pf;" in test

* Got rid of unnecessary check for empty message from user (Fluxer doesn't allow this to happen)

Removed export of token

* getAllMembersInfo checks for fields.length

* added default case to memberCommandHandler to throw error if command is not recognized

* reversed check for valid proxy (was returning valid if the proxy existed and invalid if it didn't)

* pushes e.message instead of full error object to errors array in importHelper

* adjusted tests to properly use mockRejectedValue for async rejections

* changed getAllMembersInfo map to say `index` not `name` as it actually gets the index of a member and then the member object

* adjusted importHelper to properly test throwing of aggregate error

* revamped setting of expiration warning (moved to utils and changed logic, wrote tests)

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>
2026-02-25 19:30:39 -05:00
7fead5e3d7 feat: Add unit tests (#21)
Tests are mostly complete (though some are failing -- to be fixed in the
async/await refactor.

Also refactored, fixed bugs found while testing, and added ability to
type `pf;m` instead of `pf;member`.

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>
2026-02-24 12:42:23 -05:00
428310dfad Delete .github/workflows/node.js.yml (#20)
Since we're moving to local DevOps, this is no longer required. Also it
was broken.
2026-02-24 09:30:27 -05:00
dc0de4b092 Update README.md
added LLM note
2026-02-24 09:23:07 -05:00
6898e3142c Create CONTRIBUTING.md 2026-02-24 09:16:55 -05:00
adcb05a38b Create LICENSE
Add the peer production license as license
2026-02-22 11:57:12 -05:00
Aster Fialla
db3c588745 updated tests 2026-02-20 11:36:41 -05:00
Aster Fialla
56d7f7d1fa call getMemberCommandInfo in parseMemberCommand 2026-02-20 11:33:16 -05:00
Aster Fialla
8f6ae668b0 update getMemberCommandInfo
# Conflicts:
#	src/helpers/memberHelper.js
2026-02-20 11:31:54 -05:00
Aster Fialla
211a705f31 update enums 2026-02-20 11:29:28 -05:00
Aster Fialla
69c242350f updated readme 2026-02-20 10:01:56 -05:00
8fc590c062 feat: add tests and other such features (#3)
* converted import syntax to ES modules

removed unused methods

* got test sort of working (jest set up is not crashing but also not mocking correctly)

* adjusted beforeeach/beforeall so more pass

* more correct test setup

* converted import syntax to commonJS

removed unused methods

* got test sort of working (jest set up is not crashing but also not mocking correctly)

* adjusted beforeeach/beforeall so more pass

* more correct test setup

* more correct dockerfile and compose.yaml

* Revert "converted import syntax to commonJS"

This reverts commit 5ab0d62b

* updated jest to sort of work with es6

* separating out enum return from method return

* mostly working except for the weirdest error

* nevermind it wasn't actually working, gonna move on for now

* added babel to convert es modules to cjs

* finally figured out issue with tests (referencing the method directly in the test.each calls the real method not the mock in beforeEach())

* setup fixed more

* added error handling parseMemberCommand test

* renamed db to database
more tests and fixing logic for memberhelper

* upgraded fluxer.js

* moved import to helpers folder

* moved import to helpers folder

* more tests for member helper

* think i fixed weird error with webhook sending error when a user has no members

* simplified sendMessageAsAttachment

* added return to addFullMember so that addNewMember can reference it properly in strings

* test setup for messagehelper and webhookhelper

* readded line i shouldn't have removed in sendMessageAsMember

* fixed test and logic

* added test for memberHelper

* updated sendMessageAsAttachment to returnBufferFromText and updated commands/webhookHelper accordingly

* added tests for parseProxyTags and updated logic

* added "return" so tests dont terminate on failure and deleted env.jest

* finished tests for messageHelper!

* more cases for messageHelper just in case

* updating docstring for messageHelper parseProxyTags

* more tests for webhookhelper

* deleted extra file added during merge

* removed confusing brackets from enum docs

* finally mocking correctly

* adding more cases to messageHelper tests

* updating enums

* removed error response when proxy is sent without content

* , updated tests for webhookHelper and removed error response when proxy is sent without content

* added debounce to count guilds properly

* added todo note

* added tests for updateDisplayName

* edited help message trigger for updatePropic

* update message helper test to include space case

* update bot to suppress errors from API

* fixed bug for import not sending help text, added help text if you type a unrecognized command

* updated to be enum

* updated member helper and tests

* edit enums, tweak import content command

* removed unnecessary await and console.log

* made it easier to make a member

* added nicer error listing to importHelper

* updated documentation

* Merge branch 'main' of https://github.com/pieartsy/PluralFlux into add-tests

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>
2026-02-19 21:45:10 -05:00
Aster Fialla
d24bcc8438 Added package-lock.json 2026-02-19 21:43:38 -05:00
pieartsy
4f2e893491 Create node.js.yml
Workflow for node.js (hopefully works)
2026-02-17 11:41:30 -05:00
pieartsy
74cab4f91f Update README.md 2026-02-17 11:15:34 -05:00
pieartsy
1661dfd637 Create FUNDING.yml
Added github sponsorship.
2026-02-17 11:14:54 -05:00
Aster Fialla
055ecdf20d removed unneeded code 2026-02-16 13:43:34 -05:00
Aster Fialla
51ada567ce made bot search and query lowercase instead of only applying to uppercase 2026-02-16 13:30:57 -05:00
Aster Fialla
be5505b03c added --help functionality to import command 2026-02-16 13:15:28 -05:00
Aster Fialla
07d4e735eb changed parseProxyTags to filter proxy differently. changed conditional in sendMessageAsMember because obj will never not exist 2026-02-16 12:48:26 -05:00
Aster Fialla
8b709b75ce updated readme and enums 2026-02-16 12:31:44 -05:00
Aster Fialla
6cd34e9c68 adjusted webhook helper to not query twice for member.
adjusted proxy message to just reply to message w/ attachments with "Attachment sent by" instead of sending error message
2026-02-16 12:30:46 -05:00
Aster Fialla
b2fc9f9111 fixed regex to escape proxy tags that match a normal regex 2026-02-16 12:16:06 -05:00
Aster Fialla
b3813d771d tentative adding of system model (not used yet) 2026-02-16 11:09:03 -05:00
Aster Fialla
f19a5ba58c gitignore of env added 2026-02-16 11:08:53 -05:00
Aster Fialla
5a9a2977c6 adding build of whole image to compose 2026-02-16 11:08:41 -05:00
Aster Fialla
b15262e1c5 added .env to bot.js and db.js 2026-02-16 11:08:19 -05:00
Aster Fialla
4ea0a777af actually fixed proxy query 2026-02-16 10:56:40 -05:00
Aster Fialla
a3c3eb1545 added dotenv 2026-02-16 10:36:38 -05:00
Aster Fialla
559da55176 edited addFullMember to throw error if member was not added successfully 2026-02-16 10:36:31 -05:00
Aster Fialla
f169f4d755 adjusted reference to wrong file with import and enums 2026-02-16 10:32:14 -05:00
Aster Fialla
32adf7b6ef move list --help check to parseMemberCommand 2026-02-16 09:34:07 -05:00
Aster Fialla
1db4ab37dc removed nonexistent e 2026-02-16 00:42:15 -05:00
Aster Fialla
fa0de17724 edited member helper to notify only 25 members are supported currently in list 2026-02-16 00:40:40 -05:00
Aster Fialla
99bfdf685b updated readme 2026-02-16 00:25:36 -05:00
Aster Fialla
0a7057ef63 list enum documentation 2026-02-16 00:23:56 -05:00
Aster Fialla
58912f382c edited remove to not "remove" nonexistent members 2026-02-16 00:22:55 -05:00
Aster Fialla
375601cca7 added --help to list 2026-02-16 00:21:46 -05:00
Aster Fialla
e67a10fa79 allows invalid propic to still be imported 2026-02-16 00:16:38 -05:00
Aster Fialla
b83325785f removed ability to send attachments since i think fluxer deletes them from the server when a message is deleted :( 2026-02-16 00:11:57 -05:00
Aster Fialla
49cab523f0 removed ability to send attachments since i think fluxer deletes them from the server when a message is deleted :( 2026-02-16 00:11:11 -05:00
Aster Fialla
e1dbba9043 hopefully ACTUALLY writes and sends file now... 2026-02-15 23:18:29 -05:00
Aster Fialla
fa86606fb4 added helper to rerun app when it crashes 2026-02-15 23:09:27 -05:00
Aster Fialla
cf37508ee4 docstrings and changed expected parameters for messageHelper parseProxyTags 2026-02-15 21:25:07 -05:00
Aster Fialla
38105d910e deleted old dockerfile 2026-02-15 21:24:27 -05:00
Aster Fialla
fe05b93ac7 adding webhook sending of attachment as an embed since sending image directly apparently doesn't work in fluxer yet 2026-02-15 21:24:19 -05:00
Aster Fialla
964b5ec32a actually writing to created file if import fails 2026-02-15 21:18:40 -05:00
Aster Fialla
cebf14a2f5 updated readme and docs 2026-02-15 16:52:08 -05:00
Aster Fialla
dafbafeec6 if parsing member command returns null, don't send anything. 2026-02-15 16:48:51 -05:00