Skip to content

Commit

Permalink
Add deno workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Robin committed Jul 7, 2024
1 parent ed3bf3c commit 96eaad1
Show file tree
Hide file tree
Showing 7 changed files with 1,204 additions and 1,127 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deno.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow will install Deno then run `deno lint` and `deno test`.
# For more information see: https://github.com/denoland/setup-deno

name: Deno

on:
push:
branches: ["master", "develop"]
pull_request:
branches: ["master", "develop"]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v4

- name: Setup Deno
# uses: denoland/setup-deno@v1
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2
with:
deno-version: v1.x

# Uncomment this step to verify the use of 'deno fmt' on each commit.
# - name: Verify formatting
# run: deno fmt --check

- name: Run linter
run: deno lint

- name: Run tests
run: deno task test
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changelog

**0.1.0**
**0.1.0**
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
# Early access

Denojection is a port of [Objection.js](https://github.com/Vincit/objection.js) to a TypeScript-native format, with additional improvements and fixes. Although Objection.js is [no longer actively maintained](https://github.com/Vincit/objection.js/discussions/2463), we have decided to fork the project and continue its development using Deno. Denojection will be compatible with both Node and Deno.
Denojection is a port of [Objection.js](https://github.com/Vincit/objection.js)
to a TypeScript-native format, with additional improvements and fixes. Although
Objection.js is
[no longer actively maintained](https://github.com/Vincit/objection.js/discussions/2463),
we have decided to fork the project and continue its development using Deno.
Denojection will be compatible with both Node and Deno.

> ⚠️ Denobjection is still in an early stage of development and clearly not production ready.
> ⚠️ Denobjection is still in an early stage of development and clearly not
> production ready.
# [Denobjection](#)

Denobjection is an [ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) for [Deno](https://deno.com/) and [Node.js](https://nodejs.org/) that aims to stay out of your way and make it as easy as possible to use the full power of SQL and the underlying database engine while still making the common stuff easy and enjoyable.
Denobjection is an
[ORM](https://en.wikipedia.org/wiki/Object-relational_mapping) for
[Deno](https://deno.com/) and [Node.js](https://nodejs.org/) that aims to stay
out of your way and make it as easy as possible to use the full power of SQL and
the underlying database engine while still making the common stuff easy and
enjoyable.

Even though ORM is the best commonly known acronym to describe objection, a more accurate description is to call it **a relational query builder**. You get all the benefits of an SQL query builder but also a powerful set of tools for working with relations.
Even though ORM is the best commonly known acronym to describe objection, a more
accurate description is to call it **a relational query builder**. You get all
the benefits of an SQL query builder but also a powerful set of tools for
working with relations.

Deobjection is built on an SQL query builder called [knex](http://knexjs.org). All databases supported by knex are supported by Denobjection.
Deobjection is built on an SQL query builder called [knex](http://knexjs.org).
All databases supported by knex are supported by Denobjection.
12 changes: 11 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,15 @@
"dev": "deno run --watch main.ts",
"test": "deno test tests/*"
},
"importMap": "import-map.json"
"importMap": "import-map.json",
"exclude": [
"**/*.js"
],
"lint": {
"rules": {
"tags": ["recommended"],
"include": [],
"exclude": ["no-deprecated-deno-api"]
}
}
}
6 changes: 3 additions & 3 deletions import-map.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"imports": {
"knex": "npm:knex@^3.1.0"
}
"imports": {
"knex": "npm:knex@^3.1.0"
}
}
62 changes: 36 additions & 26 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict';
"use strict";

const {
DBError,
Expand All @@ -8,36 +8,46 @@ const {
ConstraintViolationError,
CheckViolationError,
DataError,
} = require('db-errors');
const { Model: NativeModel } = require('./model/Model');
const { QueryBuilder: NativeQueryBuilder } = require('./queryBuilder/QueryBuilder');
const { QueryBuilderBase } = require('./queryBuilder/QueryBuilderBase');
const { QueryBuilderOperation } = require('./queryBuilder/operations/QueryBuilderOperation');
const { RelationExpression } = require('./queryBuilder/RelationExpression');
const { ValidationError } = require('./model/ValidationError');
const { NotFoundError } = require('./model/NotFoundError');
const { AjvValidator: NativeAjvValidator } = require('./model/AjvValidator');
const { Validator: NativeValidator } = require('./model/Validator');
const { Relation } = require('./relations/Relation');
const { HasOneRelation } = require('./relations/hasOne/HasOneRelation');
const { HasManyRelation } = require('./relations/hasMany/HasManyRelation');
const { BelongsToOneRelation } = require('./relations/belongsToOne/BelongsToOneRelation');
const { HasOneThroughRelation } = require('./relations/hasOneThrough/HasOneThroughRelation');
const { ManyToManyRelation } = require('./relations/manyToMany/ManyToManyRelation');
const { transaction } = require('./transaction');
const { initialize } = require('./initialize');
} = require("db-errors");
const { Model: NativeModel } = require("./model/Model");
const { QueryBuilder: NativeQueryBuilder } = require(
"./queryBuilder/QueryBuilder",
);
const { QueryBuilderBase } = require("./queryBuilder/QueryBuilderBase");
const { QueryBuilderOperation } = require(
"./queryBuilder/operations/QueryBuilderOperation",
);
const { RelationExpression } = require("./queryBuilder/RelationExpression");
const { ValidationError } = require("./model/ValidationError");
const { NotFoundError } = require("./model/NotFoundError");
const { AjvValidator: NativeAjvValidator } = require("./model/AjvValidator");
const { Validator: NativeValidator } = require("./model/Validator");
const { Relation } = require("./relations/Relation");
const { HasOneRelation } = require("./relations/hasOne/HasOneRelation");
const { HasManyRelation } = require("./relations/hasMany/HasManyRelation");
const { BelongsToOneRelation } = require(
"./relations/belongsToOne/BelongsToOneRelation",
);
const { HasOneThroughRelation } = require(
"./relations/hasOneThrough/HasOneThroughRelation",
);
const { ManyToManyRelation } = require(
"./relations/manyToMany/ManyToManyRelation",
);
const { transaction } = require("./transaction");
const { initialize } = require("./initialize");

const {
snakeCaseMappers,
knexSnakeCaseMappers,
knexIdentifierMapping,
} = require('./utils/identifierMapping');
const { compose, mixin } = require('./utils/mixin');
const { ref } = require('./queryBuilder/ReferenceBuilder');
const { val } = require('./queryBuilder/ValueBuilder');
const { raw } = require('./queryBuilder/RawBuilder');
const { fn } = require('./queryBuilder/FunctionBuilder');
const { inherit } = require('../lib/utils/classUtils');
} = require("./utils/identifierMapping");
const { compose, mixin } = require("./utils/mixin");
const { ref } = require("./queryBuilder/ReferenceBuilder");
const { val } = require("./queryBuilder/ValueBuilder");
const { raw } = require("./queryBuilder/RawBuilder");
const { fn } = require("./queryBuilder/FunctionBuilder");
const { inherit } = require("../lib/utils/classUtils");

// We need to wrap the classes, that people can inherit, with ES5 classes
// so that babel is able to use ES5 inheritance. sigh... Maybe people
Expand Down
Loading

0 comments on commit 96eaad1

Please sign in to comment.