Skip to content

Commit

Permalink
"Update dependencies, add schema support, and improve type definitio…
Browse files Browse the repository at this point in the history
…ns in versedb"

This commit includes the following changes:

* Updates dependencies to the latest versions.
* Adds schema support to the versedb library, allowing for more robust data validation and manipulation.
* Improves type definitions for better type safety and autocompletion in various code editors.
* Adds a new `info` method to the `connect` class, which returns information about the database files in the data path.
* Adds a new `countDocuments` method to the `connect` class, which returns the number of documents in a database file based on an optional query.
* Adds a new `model` method to the `connect` class, which allows for creating models with data validation and manipulation based on a schema.
* Updates the `countDoc` and `updateMany` methods in the `SQLAdapter` and `YAMLAdapter` interfaces to include an optional query parameter.
* Makes various improvements to the test suite, including adding tests for the new methods and fixing some existing tests.
* Updates the documentation to reflect the changes in this commit.
  • Loading branch information
Marco5dev committed Mar 30, 2024
1 parent 8ea575d commit af44c82
Show file tree
Hide file tree
Showing 15 changed files with 936 additions and 247 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: Marco5dev # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: [Marco5dev] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20

- name: Install Dependencies
run: npm i
Expand Down
33 changes: 29 additions & 4 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,32 @@ on:
types:
- published
jobs:
build:
Setup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install Dependencies
run: npm i

Test:
needs: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run Tests
run: npm run test

Build:
needs: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -15,14 +40,14 @@ jobs:
- run: npm i
- run: npm run test

publish-npm:
needs: build
Publish:
needs: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm i
- run: npm publish
Expand Down
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ package-lock.json
tests
tests/
src
tsconfig.json
tsconfig.json
tsup.config.ts
yarn.lock
jest.config.js
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "verse.db",
"version": "1.0.0",
"description": "VERSE.db is the multiverse of the database, with json, sql, ymal and more... you can save data with the way you like faster than before, the new gen of the database",
"description": "verse.db isn't just a database, it's your universal data bridge. Designed for unmatched flexibility, security, and performance, verse.db empowers you to manage your data with ease.",
"license": "MIT",
"author": "marco5dev (Mark Maher)",
"main": "./dist/index.js",
Expand Down
5 changes: 3 additions & 2 deletions src/adapters/json.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class jsonAdapter extends EventEmitter implements versedbAdapter {
}
}

async dataAll(
async loadAll(
dataname: string,
displayOptions: any
): Promise<AdapterResults> {
Expand Down Expand Up @@ -519,7 +519,7 @@ export class jsonAdapter extends EventEmitter implements versedbAdapter {
}

async updateMany(
dataname: string,
dataname: any,
queries: any[any],
newData: operationKeys,
upsert: boolean = false
Expand Down Expand Up @@ -624,6 +624,7 @@ export class jsonAdapter extends EventEmitter implements versedbAdapter {
};
}


fs.writeFileSync(dataname, JSON.stringify(currentData), "utf8");

logSuccess({
Expand Down
Loading

0 comments on commit af44c82

Please sign in to comment.