Skip to content

Commit

Permalink
feat(major): rewrite core into TypeScript (#44)
Browse files Browse the repository at this point in the history
* refactor: entire project workspace initialized

* feat: Josh, JoshProvider and MapProvider implemented + tests

Added classes: Josh, JoshProvider, JoshError, and MapProvider. Plus
Methods enum, an Awaited type, payload types. Integrated basic testing
for MapProvider.

* fix: remove Josh.test.ts for now

* feat: change tsconfig target to ES2020

* feat: add defaultProvider functionality

* feat: remove symbols

* refactor: change how classes and types are exported

* feat: middleware coming

* feat: middleware coming pt. 2

* feat: realized the license was not here

* feat: middleware implemented

* fix: remove sapphire's prettier config in favor of our own

* feat: readme and contributing md files

* feat: add @sapphire/utilities for Constructor type

* feat: switch Awaited type for @sapphire/utilities'

* feat: add generic in classExtends check

* feat: add returnBulkType to JoshOptions

* feat: add object to returnBulkType

* feat: move types below classes

* feat: implment rollup bundler

* feat: implement getAll() plus qol changes

* ci: fix labelsync

* fix: add payload exports

* feat: implement convertBulkData method for bulk methods

* feat: remove lodash in favor of lodash.get/set

* feat: overhaul of changes

* fix: forgot to export ApplyOptions

* feat: make a fix for middleware methods and add stopwatch

* feat: add has() method

* feat: added autoEnsure middleware functionality

* refactor: rename `Middlewares` to `BuiltInMiddlewares`

* refactor: remove `getKeyAndPath()` method from `JoshProvider`

* feat: added `ensure()` method

* refactor: rename `BuiltInMiddlewares` to `BuiltInMiddleware`

* refactor: change how middleware and context works

* refactor: move `name` declaration after check

* feat: add `EnsurePayload` as an exported member

* refactor: move `version` export to a constants file

* feat: add `get()` and `set()` utils

* feat: add `CODEOWNERS`

* feat: remove `@types/lodash.get` and `@types/lodash.set`

* refactor: change to `instance` in favor of consistency

* feat: add @joshdb/utilities

* chore: small changes

* refactor: add `@shadoware/utilities` pkg

* feat: added better key/path functionality

* refactor: move `version` export to `main` file

* refactor: reposition tests

* feat: implement `keys` method

* feat: implement `values` method

* refactor: use Reflect to prevent type casting

* feat: implement `size` method

* refactor: change `filterByCondition` params

* ci: slim some code up

* feat: implement `getMany` method

* refactor: rename `keys` / `key(And/Or)Path` to `keyPath(s)`

* refactor: remove more type casting

* refactor: make condition properties required

* feat: implement `setMany` method

* feat: update `CoreAutoEnsure` for new `(set/get)Many` methods

* fix: `ReturnBulk` allow for `T | null` type

* chore: move imports/exports

* feat: implement `autoKey` method

* feat: implement `update` method

* fix: writing data on `updateBy*`

* feat: implement `randomKey()` method

* feat: implement `random()` method

* refactor: generics and `keyPath`

* feat: add `Payload.OptionalData`

* refactor: `Payload` types

* feat: fix `update()` method

* feat: implement `multi()` method

* feat: implement `update` in `autoEnsure`

* feat: implement tests for `Josh` statics

* feat: implement `find()` method

* chore: refactor `update()` method

* feat: implement payload validators

* chore: fix `autoEnsure`

* chore: refactor types

* chore: bump version down to `2.0.0`

* feat: refactor tests

* chore: update packages

* feat: update packages pt. 2

* feat: implement `delete()` method

* feat: implement `filter()` method

* fix: add promise compatibility for `find()` method

* feat: use `@realware/utilities`

* feat: implement `some()` method

* chore: update validators and fix payload types

* feat: implement validators for `Filter` and `Some`

* feat: implement `toJSON()` method for `Middleware`

* feat: update `README.md`

* feat: implement `inc()` and `dec()` methods

* refactor: use `isFunction()` utility to avoid casting

* feat: update `README.md`

* chore: refactor errors and fix bug

* feat: better errors and refactor file structure

* feat: bump `@realware/utilties` to `v1.0.1`

* ci: fix eslint bug

* fix: `name` property on `MapProviderError`

* feat: implement `push()` method

* chore: add error for missing data in `inc()` and `dec()`

* feat: add tests for `type` property on payloads

* refactor: change how providers are used with `Josh`

* chore: update tests

* feat: implement `build` branch

* chore: regenerate lock file

* feat: update `Node.js` to `v16`

* feat: add `workflow_dispatch`

* ci: fix delviery

* ci: remove `workflow_dispatch`

* chore: some comments

* feat: start adding comments

* chore: remove jsdoc comments

* docs: implemented for `structures/Josh.ts`

* feat: fix typings `ReturnBulk` typings

* feat: make `protected` methods `private`

* docs: implemented for `decorators/ApplyOptions.ts`

* docs: implemented for `errors/JoshError.ts`

* docs: implemented for `errors/JoshProviderError`

* docs: implemented for `payloads/Payload.ts`

* docs: implemtned for `payloads/*`

* feat: add strict methods to each payload

* docs: implemented for `structures/JoshProvider.ts`

* docs: simple spacing change for `structures/Josh.ts`

* docs: implemented for `structures/Middleware.ts`

* docs: implemented for `structures/MiddlewareStore.ts`

* docs: implemented for `structures/defaultProvider/*`

* docs: implemented for `validators/*`

* docs: update implementation for `payloads/*`

* chore: use `Payload.OptionalData`

* docs: small change

* docs: implemented for `payloads/*`

* docs: update implementation for `payloads/*`

* feat: add `run` method to `Middleware`

* feat: implement `map()` method

* chore: remove `Stopwatch`

* feat: implement `remove()` method

* feat: implement `every()` method

* refactor: entire codebase

* chore(deps): bump actions/cache from 2.1.5 to 2.1.6

Bumps [actions/cache](https://github.com/actions/cache) from 2.1.5 to 2.1.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](actions/cache@v2.1.5...v2.1.6)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore: update lock file

* feat: implement `math()` method

* style: move `main` and `types` properties

* feat(deps): update to latest

* fix: idek

* feat: implement guides

* feat(cli): add husky for commit linting

* chore(linting): add padding-line-between-statements and lines-around-comment rules

* chore(eslint): remove lines-around-comment rule

* chore(lint): minor linting changes and fixes

* ci(husky): move husky to it's own dir

* ci(github): make some github related changes

* ci(husky): fix prepare script

* fix(Middleware): minor bug with toJSON() method

* feat(provider): make options required in constructor

* fix(josh): insert empty object to default-provider

* chore(deps): bump deps to @latest

* fix(tests): insert empty object to default-provider

* chore(build): add esm support

* refactor(naming): file/folder naming convention changed to kebab-case from camelCase

* refactor(mapprovider): use map methods over internal this methods

* ci(labels): remove unused label

* ci(labels): add provider label

* fix(structure): forgot to change imports over

* feat(json): add gen-esm-wrapper to prepublishOnly script

* refactor(middleware): removed @sapphire/pieces in favor of own system

* feat(middleware): add functionality for options/hook or instance

* feat(provider): add common identifiers

* feat(default-provider): use the new identifiers exported from JoshProvider

* chore(deps): bump actions/cache from 2.1.6 to 2.1.7

Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](actions/cache@v2.1.6...v2.1.7)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

* feat(provider): add constructor type

* feat(provider): rename Identifiers to CommonIdentifiers

* feat(default-provider): update to CommonIdentifiers

* feat(tests): update to CommonIdentifiers

* fix: actions

* feat(build): add umd bundle

* fix(scripts): slight script tweak for linting

* docs(Josh): remove old middleware docs

* feat(codeowners): make up-to-date

* refactor(key-path): change how keys and paths are parsed and used (#11)

* refactor(core): change how keys and paths are used in Josh

* refactor(key-path): change how keys and paths are parsed

* refactor(version): move version to Josh as a static property

* feat: add export and import methods (#10)

* feat(method): add export and import methods

* refactor(export-import): remove functionality with providers

* chore(request-changes): fix for requested changes

* feat(import): use new setMany() method

* fix: forgot to change a re-export

* fix(isNodeEnvironment): invalid boolean

* feat(tests): add tests

* fix(requested-change): was checking for paths for some reason?

* fix(version): use static version property

* chore(eslint): force eslint to ~8.6.0

* chore(yarn): regen lockfile

* chore(deps): bump all dependencies

* docs: update readme

* chore: prepare for merge

* chore: add contributors property

* chore: final change before merge

* chore: change more stuff

* chore: revisions

* chore(indent-type): change from tab to spaces

* chore: change contributor

* feat(middleware): fix coreAutoEnsure

* feat: first implementation for documentation json

* fix(middleware): was not exported, is now

* chore(vscode): add/change settings

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: WilsontheWolf <[email protected]>
  • Loading branch information
3 people authored Jan 28, 2022
1 parent 762866d commit 5197b46
Show file tree
Hide file tree
Showing 116 changed files with 10,593 additions and 5,176 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,ts}]
indent_size = 2
indent_style = space
block_comment_start = /*
block_comment = *
block_comment_end = */

[*.{yml,yaml}]
indent_size = 2
indent_style = space

[*.{md,rmd,mkd,mkdn,mdwn,mdown,markdown,litcoffee}]
tab_width = 4
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
33 changes: 33 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": "@sapphire",
"rules": {
"no-tabs": "error",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/class-literal-property-style": "off",
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": "return" },

{ "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" },
{ "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"] },

{ "blankLine": "always", "prev": "directive", "next": "*" },
{ "blankLine": "any", "prev": "directive", "next": "directive" },

{ "blankLine": "always", "prev": ["case", "default"], "next": "*" },

{ "blankLine": "always", "prev": "block", "next": "*" },

{ "blankLine": "always", "prev": "block-like", "next": "*" },

{ "blankLine": "always", "prev": "for", "next": "*" },
{ "blankLine": "any", "prev": "for", "next": "for" },

{ "blankLine": "always", "prev": "if", "next": "*" },
{ "blankLine": "any", "prev": "if", "next": "if" },

{ "blankLine": "always", "prev": "expression", "next": "*" },
{ "blankLine": "any", "prev": "expression", "next": "expression" }
]
}
}
107 changes: 0 additions & 107 deletions .eslintrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/.github/ @RealShadowNova
/.husky/ @RealShadowNova
/.vscode/ @RealShadowNova
/docs/ @RealShadowNova
/src/ @RealShadowNova
/tests/ @RealShadowNova
25 changes: 25 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Contributing

## Workflow

1. Fork and clone this repository.
2. Create a new branch in your fork based off the **main** branch.
3. Make your changes, and push them.
4. Submit a Pull Request [here](https://github.com/josh-development/core/pulls)!

## Contributing to the code

**The issue tracker is only for issue reporting or proposals/suggestions. If you have a question, you can find us in our [Discord Server](https://discord.gg/N7ZKH3P)**.

To contribute to this repository, feel free to create a new fork of the repository and submit a pull request. We highly suggest [ESLint](https://eslint.org) to be installed in your text editor or IDE of your choice to ensure builds from GitHub Actions do not fail.

**_Before committing and pushing your changes, please ensure that you do not have any linting errors by running `yarn lint`!_**

### Josh Concept Guidelines

There are a number of guidelines considered when reviewing Pull Requests to be merged. _This is by no means an exhaustive list, but here are some things to consider before/while submitting your ideas._

- Everything in Josh should be generally useful for the majority of users. Don't let that stop you if you've got a good concept though, as your idea still might be a great addition.
- Everything should follow [OOP paradigms](https://en.wikipedia.org/wiki/Object-oriented_programming) and generally rely on behavior over state where possible. This abstraction, and leads to efficiency and therefore scalability.
- Everything should follow our ESLint rules as closely as possible, and should pass lint tests even if you must disable a rule for a single line.
- Scripts that are to be ran outside of the scope source files should be added to [scripts](/scripts) directory and should be in the `mjs` file format.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
day: 'sunday'
time: '12:00'
labels:
- 'Meta: Dependencies'
177 changes: 177 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
- name: 'Bug: Already Fixed'
description: Issues that report already fixed bugs.
color: B3E88C
- name: 'Bug: Cannot Reproduce'
description: Issues that report bugs that cannot be reproduced.
color: f9d0c4
- name: 'Bug: Confirmed'
description: Issues that report confirmed bugs.
color: f9d0c4
- name: 'Bug: Fixed'
description: Issues that report bugs and have been fixed.
color: 00fa9a
- name: 'Bug: Fixed in main'
description: Issues that report bugs from stable, but that are fixed in main.
color: b3e88c
- name: 'Bug: Pending Response'
description: Issues that report bugs and are pending of a response from the author.
color: f9d0c4
- name: 'Bug: Unverified'
description: Issues that report unverified bugs. Pending for inspection.
color: f9d0c4
- name: 'hacktoberfest-accepted'
description: Issues and PRs related to Hacktoberfest.
color: EE4700
- name: 'Meta: Bike-Shedding'
description: Issues and PRs that nit pick
color: f9253a
- name: 'Meta: BugFix'
description: PRs that fix bugs or issues.
color: 4cce4a
- name: 'Meta: Cleanup'
description: Issues and PRs related to code cleanup.
color: ffff00
- name: 'Meta: Dependencies'
description: Issues and PRs related to dependencies.
color: ffff00
- name: 'Meta: Documentation'
description: Issues and PRs related to documentation.
color: ffff00
- name: 'Meta: Error Handling'
description: Issues and PRs related to error handling.
color: ffff00
- name: 'Meta: Examples'
description: Issues and PRs related to examples.
color: ffff00
- name: 'Meta: Feature'
description: Issues and PRs related to new features.
color: ffff00
- name: 'Meta: GitHub'
description: Issues and PRs related to GitHub.
color: ffff00
- name: 'Meta: Refactor'
description: Issues and PRs related to refactors.
color: ffff00
- name: 'Meta: Typings'
description: Issues and PRs related to typings.
color: ffff00
- name: 'Meta: V8'
description: Issues and PRs related to the V8 engine.
color: ffff00
- name: 'Priority: Critical'
description: Issues that must be fixed or PRs that must be finished and merged with
maximum priority.
color: b60205
- name: 'Priority: High'
description: Issues that must be fixed or PRs that must be finished and merged with
high priority.
color: d93f0b
- name: 'Priority: Medium'
description: Issues that must be fixed or PRs that must be finished and merged with
medium priority.
color: fbca04
- name: 'Priority: Low'
description: Issues that must be fixed or PRs that must be finished and merged with
low priority.
color: 0e8a16
- name: 'Priority: Kirito Level'
description: Issues/PR's that have a priority so low that even a quantum computer
couldn't calculate it.
color: '818181'
- name: 'SEM: Major'
description: PRs that contain breaking changes and should be released in the next
major version.
color: 9a35be
- name: 'SEM: Minor'
description: PRs that contain new features and should be released in the next minor
version.
color: d38dfa
- name: 'SEM: Patch'
description: PRs that contain bugfixes and should be released in the next patch
version.
color: 66d8eb
- name: 'SEM: N/A'
description: PRs that only contain documentation changes and do not change the api's
interface.
color: a7f9f3
- name: 'Status: Blocked'
description: PRs that are blocked by other issues/PRs.
color: d81a0d
- name: 'Status: Denied'
description: Issues or PRs that have been denied by the team.
color: bc1202
- name: 'Status: Duplicate'
description: Issues/PRs that are duplicated.
color: d93f0b
- name: 'Status: Help Wanted'
description: Issues that need assistance from volunteers or PRs that need help to
proceed.
color: 128A0C
- name: 'Status: Invalid'
description: Issues that will not be fixed or PRs that will not merge, e.g. due
to backwards compatibility.
color: 671df0
- name: 'Status: Needs Docs'
description: PRs that need documentation
color: d4c5f9
- name: 'Status: Needs Testing'
description: PRs that need testing from the author or volunteers.
color: d93f0b
- name: 'Status: Needs Typings'
description: PRs that need typings
color: d4c5f9
- name: 'Status: Ready To Merge'
description: PRs that are ready to merge.
color: 05F541
- name: 'Status: Review Ready'
description: PRs that are ready for author review.
color: 05F541
- name: 'Status: Stalled'
description: Issues and PRs that are being set aside for now for rethinking
color: fbca04
- name: 'Status: WIP'
description: Issues and PRs that are still a work in progress.
color: b60205
- name: 'Type: Caching'
description: Issues and PRs related to caching.
color: 1d76db
- name: 'Type: Consistency'
description: Issues and PRs related to code consistency.
color: 1d76db
- name: 'Type: Dependencies'
description: Pull requests that update a dependency file
color: 0025ff
- name: 'Type: Discussion'
description: Issues that discuss a new feature, implementation, or a api's interface.
color: ffffff
- name: 'Type: Enhancement'
description: Issues and PRs related to feature enhancement.
color: 1d76db
- name: 'Type: Maintenance'
description: Issues and PRs related to the maintenance of a module.
color: 1d76db
- name: 'Type: Performance'
description: Issues and PRs related to the performance of the api's interface.
color: 1d76db
- name: 'Type: Provider'
description: Issues and PRs related to providers.
color: 1d76db
- name: 'Type: Proposal'
description: Issues that request a new feature or a change in the api's interface.
color: ffffff
- name: 'Type: Question'
description: Issues that do not belong to the Issue Tracker and should be asked
in the official Discord Server.
color: cc317c
- name: 'Type: Security'
description: Pull requests that address a security vulnerability
color: ee0701
- name: 'Type: Sharding'
description: Issues and PRs related to sharding.
color: 1d76db
- name: 'Type: Typo'
description: Issues and PRs related to typos in the documentation or code.
color: c5def5
- name: 'Type: Needs Rebase & Merge'
description: PRs that should be merged through the "Rebase and merge" strategy
color: 24853c
Loading

0 comments on commit 5197b46

Please sign in to comment.