Repository navigation
Releases: loixlab/gstore-node
Release list
v10.1.1
v10.1.0
v10.0.0
v9.0.0
v8.0.0
⚠ BREAKING CHANGES
- datastore.ts: Entity keys return ids as Number
⚠ KNOWN ISSUES
-
Caching - when not using in memory caching (e.g. Redis cache) Date objects data is not being correctly deserialized to Date objects
- Workaround - cast known Date data to a Date object using the
new Date()JavaScript constructor
- Workaround - cast known Date data to a Date object using the
Bug Fixes
v7.2.8
v7.2.7
Bug Fixes
- fix(src/serializers/datastore.ts): load cached entities with correct Datastore Key type (#265) b06641b
- test(integration tests): add integration tests for fineOne and check entityKey construction (#246) b87a275
Dependency upgrades
- chore(deps): bump validator from 13.0.0 to 13.7.0 (#257) d35f66a
- chore(deps): bump tmpl from 1.0.4 to 1.0.5 (#256) fef76a2
- chore(deps): bump path-parse from 1.0.6 to 1.0.7 (#255) 707943e
- chore(deps): bump glob-parent from 5.0.0 to 5.1.2 (#253) 8782798
- chore(deps): bump hosted-git-info from 2.7.1 to 2.8.9 (#251) 4012b03
- chore(deps): bump handlebars from 4.7.6 to 4.7.7 (#250) b75752e
- chore(deps): bump redis from 3.0.2 to 3.1.2 (#249) 3cb6c45
- chore(deps): bump y18n from 4.0.0 to 4.0.1 (#248) 766310d
- chore(deps): bump elliptic from 6.5.3 to 6.5.4 (#247) 5d083f7
Documentation
v7.2.6
v7.2.0
Features
- Typescript: Improve typings support (43d9dc2)
The code base has been converted to Typescript, as a result the typings have been improved.
const gstore = new Gstore();
const { Schema } = gstore;
interface User {
name: string;
age: number;
}
// Schema
const userSchema = new Schema<User>({
email: { type: String },
age: { type: Number }
});
// Model
const User = gstore.model('User', userSchema); // No need to provide the types here
// Entity
const user = new User({ name: 'John' }); // TS error as "age" is not provided
// Queries
const query = User.query();
query.filter('age', '<', 'wrong string'); // TS error as "age" should be a number
query.filter('wrongProperty', 'some value'); // TS error as "wrongProperty" does not exist in User
// We can also specify the format of the response ("JSON" is the default and thus optional)
const query = User.query<'ENTITY'>(); // Provide the response ("ENTITY")
query.run({ format: 'ENTITY' }).then(result => {
const { entities } = result;
const [user] = entities;
// "user" is an Entity instance with its methods
user.save();
});
// Shortcut queries (`list()` and `findAround()`) response are automatically typed from the `format` option
User.list({ format: 'ENTITY' }).populate().then((result) => {
const { entities } = result;
const [user] = entities;
const age = user.age; // number
user.save(); // method from the entity instance
});v7.0.0
⚠ BREAKING CHANGES
-
entitykey: The "keyType" Schema option has been removed as it is no longer needed. Also, as gstore does not parse the id anymore, running your project against the Datastore emulator locally might break as the emulator treats differently User.get(123) than User.get("123"). Auto-allocated ids are integers and need to be provided as integers for the Emulator.
-
Dependencies: Node version 8.x not supported anymore. Upgrade to v10.x or superior.
-
Dependencies: The @google-cloud/datastore package is not defined anymore as a dependency of gstore-node. You will need to manually install it in your project.
-
Dependencies: Set google-cloud datastore as peerDependency (#177) (ac52ffb)
Bug Fixes
- call execPostHooks on internalTransaction (#161) (7b132cf)
- entity: add "id" property to entity after it has been saved (#180) (15a713a), closes #172
- entitykey: remove convertion of string number to integer for entity key id (#179) (75dc869), closes #168
- excludefromindexes: update logic to add all properties of Array embedded entities (#182) (c9da35b), closes #132
- model: throw NOT_FOUND error when trying to update a Model that does not exist (#181) (cc11e02), closes #164
- Types: Schema methods() signature (#171) (4a144ce)