paperhive / octonom Goto Github PK
View Code? Open in Web Editor NEWGeneral-purpose models and collections with multi-database support, written in TypeScript
License: MIT License
General-purpose models and collections with multi-database support, written in TypeScript
License: MIT License
We still need an elegant way to resolve collections. Directly importing them will lead to cyclic dependencies and this i the road to hell. ;)
Branch | Build failing π¨ |
---|---|
Dependency | mocha |
Current Version | 5.0.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 15 commits.
09ce746
Release v5.0.1
70027b6
update changelog for v5.0.1 [ci skip]
44aae9f
add working wallaby config
412cf27
[Update] license year
b7377b3
rename help-wanted to "help wanted" in stale.yml
d975a6a
fix memory leak when run in v8; closes #3119
3509029
update .gitignore to only ignore root mocha.js [ci skip]
b57f623
fix: When using --delay, .only() no longer works. Issue #1838
cd74322
Slight copy update on docs for test directory
f687d2b
update docs for the glob
14fc030
Add all supported wallaby editors
2e7e4c0
rename "common-mistake" label to "faq"
bca57f4
clarify docs on html, xunit and 3p reporters; closes #1906
2fe2d01
Revert "fix travis "before script" script"
c0ac1b9
fix travis "before script" script
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Hooks and sanitization are not run on nested objects of a model instance:
class Person extends Model {
@Property({type: 'object', definition: {foo: {type: string}}})
public obj: {foo: string};
}
const person = new Person({});
person.obj = {foo: 'bar'}; // OK, triggers hooks
person.obj.foo = 'baz'; // NOT OK, doesn't trigger hooks
A model should have hooks for events like beforeSet
, afterSet
, beforeSave
, afterSave
, ...
Branch | Build failing π¨ |
---|---|
Dependency |
@types/sinon
|
Current Version | 5.0.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
@types/sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Mixins could do the job of defining and updating fields like createdAt
or updatedAt
. Example:
class PersonBase extends Model<PersonBase> {
@Model.Property({type: 'string'})
public name: string;
}
export const Person = Timestamp(PersonBase);
const person = new Person({name: 'Rosa Luxemburg'});
// the following should print the current timestamp
console.log(person.createdAt);
console.log(person.updatedAt);
A mixin of the following form works but the constructor's data
argument has a wrong type then:
export type Constructor<T = {}> = new (...args: any[]) => T;
export function Timestamp<TBase extends Constructor>(base: TBase) {
const newClass = class extends base {
public createdAt: Date;
constructor(...args: any[]) {
super(...args);
const date = new Date();
if (!this.createdAt) {
this.createdAt = date;
}
}
};
// ideally we'd use the decorator on the property as usual but
// typescript doesn't like this yet, see
// https://github.com/Microsoft/TypeScript/issues/7342
Model.Property({type: 'date'})(newClass.prototype, 'createdAt');
return newClass;
}
Instead of deriving from Timestamp
we could have a CreatedAt
and UpdatedAt
schemas that can be used like this:
@CreatedAt()
public createdAt: Date;
This allows users to use their own property names which is not possible with the current Timstamp
class approach.
Branch | Build failing π¨ |
---|---|
Dependency |
@types/mocha
|
Current Version | 5.2.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
@types/mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
We need tests that verify that 2 derived classes (from a base model class) get separate static properties (schema, hooks).
Instead of using interfaces for schemas we can make Octonom much more extensible by creating a base class SchemaValue
or PropertyValue
and derive classes like String
, Array
, Model
, ... from it. The class should implement all we need (sanitize
, validate
). Users can then easily create their own classes.
Branch | Build failing π¨ |
---|---|
Dependency | @types/chai |
Current Version | 4.0.6 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
@types/chai is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Setting them to undefined works as expected.
Branch | Build failing π¨ |
---|---|
Dependency | @types/mocha |
Current Version | 2.2.47 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
@types/mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Currently one has to explicitly specify the generic parameter for ArrayCollection
and ModelArray
(and possibly others), e.g. new ArrayCollection<Person>(Person)
instead of new ArrayCollection(Person)
. Otherwise the type is a generic ArrayCollection<Model>
.
Branch | Build failing π¨ |
---|---|
Dependency | sinon |
Current Version | 4.2.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 7 commits.
b5968ab
Update docs/changelog.md and set new release id in docs/_config.yml
9cbf3f2
Add release documentation for v4.2.3
45cf330
4.2.3
8f54d73
Update History.md and AUTHORS for new release
a401b34
Update package-lock.json
a21e4f7
Replace formatio with @sinonjs/formatio
f4e44ac
Use comments in pull request template to get better descriptions with less template text
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | chai-as-promised |
Current Version | 7.0.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As chai-as-promised is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
Fixes Chai's proxy protection for property assertions (when using Chai v4 or higher). (@meeber, #205)
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Example:
import { Model, Property } from 'octonom';
import { Timestamp } from 'octonom-timestamp';
class Child extends Model {}
class Parent extends Timestamp(Model) {
@Property.Model({required: true, model: Child})
public child: Child;
}
const parent = new Parent(); // stack overflow
The conditions in setObject()
for resetting values should be checked. Also the default value logic should be checked.
We lose the type safety on the data
parameter in model constructors if the derived class does not implement a constructor Γ la
class Person extends Model {
constructor(data?: Partial<Person>) {
super(data);
}
}
Try to make the data parameter typed! Waiting for microsoft/TypeScript#5863.
Branch | Build failing π¨ |
---|---|
Dependency | sinon |
Current Version | 4.1.5 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 10 commits.
68c37ed
Update docs/changelog.md and set new release id in docs/_config.yml
cd8ae51
Add release documentation for v4.1.6
29e80be
4.1.6
a5c59a5
Update History.md and AUTHORS for new release
0ae60b6
Merge pull request #1653 from mroderick/upgrade-dependencies
dcd4191
Upgrade browserify to latest
a316f02
Upgrade markdownlint-cli to latest
78ebdb3
Upgrade lint-staged to latest
fcf967b
Upgrade dependency supports-color
7c3cb4f
Enable StaleBot with default configuration (#1649)
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
For some data it would be nice if you can provide a sanitize function. Example:
@Property.String({sanitize: value => value.toLowerCase().trim()})
public email: string;
npm install
prepare
instead of prepublish
Branch | Build failing π¨ |
---|---|
Dependency |
sinon
|
Current Version | 5.0.10 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 39 commits.
e68ba0d
Update docs/changelog.md and set new release id in docs/_config.yml
bb0ff41
Add release documentation for v5.1.0
8f867f9
5.1.0
39466a4
Update History.md and AUTHORS for new release
8a4808b
finished fixing ie tests
53169e3
Merge pull request #1811 from mhmoudgmal/feature/in-matcher
09f849c
Remove notice
01e69a9
cleaning up the fix for #1821
fabe894
fixed coveralls integration
5a886bd
Fix #1821: fake tests fails on IE 11
bed477a
Revert PR #1807 to fix #1814
878e2e8
clean up travis config
5e49793
removed node v4; added node v10
81a87d5
Improve tests readability
9d30dcf
Merge pull request #1809 from fatso83/esm-module
There are 39 commits in total.
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
A REST API could be used as a collection! Yey @andywer!
Revert #66 when mongodb driver supports MongoDB 3.6.
Branch | Build failing π¨ |
---|---|
Dependency | @types/sinon |
Current Version | 2.3.6 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
@types/sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | @types/chai |
Current Version | 4.0.8 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
@types/chai is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Branch | Build failing π¨ |
---|---|
Dependency | sinon |
Current Version | 4.1.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
sinon is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 12 commits.
39b0849
Update docs/changelog.md and set new release id in docs/_config.yml
6f9af25
4.1.3
c6bd1de
Update History.md and AUTHORS for new release
911c498
Spy passes through calling with new
(#1626)
271d84a
Update external_howtos.yml
e96ff8c
CircleCI Integration (#1479)
88e9132
Upgrade type-detect dependency to 4.0.5
45c4d57
Move yieldsAsync* documentation to the first yieldsAsync*
8c54024
Remove sinon.restore(object|method) from v3.x+ docs
9ae6f73
Remove sinon.log from 2.x+ docs
0111ed0
Update markdownlinter-cli to official v0.4.0
109e7b7
Add markdownlint to dependencies
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
A subtle issue you can find in most ORMs today is that you mutate model instances as you go and sync them with the remote database from time to time. It seems like an easy and convenient approach, but falls short if a model instance is used concurrently (esp. dangerous in JS with async code everywhere!).
Consider this:
const user = await User.findByName('Karl')
await Promise.all([
renameUser(user, 'John'),
changeBirthday(user, '1990-08-01')
])
async function renameUser (user, newName) {
await something()
user.name = newName
}
async function changeBirthday (user, birthday) {
await somethingElse()
user.birthday = birthday
console.log(`User ${user.name}'s birthday is the ${birthday}.`)
// Race Condition! Maybe `user.name` is still 'Karl', maybe it is already 'John'!
}
You can easily spend an hour of debugging to recognize the issue. And fixing it may be even harder.
So I'd like to propose a different approach:
const user = await User.findByName('Karl')
await renameUser(user, 'John')
async function renameUser (user, newName) {
await something()
// Returns an updated user instance, the old instance remains untouched
user = user.setName(newName)
}
The setter methods could probably be easily derived from the field name. You could also track the change operations (setName
, setBirthday
, ...) since the last database sync and have a change history. Might be nice for debugging and to only update fields in the database that have actually changed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.