Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

breeze-sequelize

Package Overview
Dependencies
Maintainers
5
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

breeze-sequelize - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

6

dbUtils.js

@@ -8,3 +8,4 @@ "use strict";

exports.createDb = createDb;
/** @returns Promise<"success"> or throws an error */
/** Connect to existing database.
* @returns Promise<"success"> or throws an error */
function connect(dbConfig, sequelizeOptions) {

@@ -23,3 +24,4 @@ var sequelize = new sequelize_1.Sequelize(dbConfig.dbName, dbConfig.user, dbConfig.password, sequelizeOptions);

;
/** @returns Promise<void> or throws an error */
/** Create new database.
* @returns Promise<void> or throws an error */
function createDb(dbConfig, sequelizeOptions) {

@@ -26,0 +28,0 @@ var sequelize = new sequelize_1.Sequelize(null, dbConfig.user, dbConfig.password, sequelizeOptions);

@@ -5,2 +5,3 @@ "use strict";

exports.SequelizeQuery = SequelizeQuery_1.SequelizeQuery;
exports.entityQueryFromUrl = SequelizeQuery_1.entityQueryFromUrl;
var SequelizeManager_1 = require("./SequelizeManager");

@@ -7,0 +8,0 @@ exports.SequelizeManager = SequelizeManager_1.SequelizeManager;

{
"name": "breeze-sequelize",
"version": "0.4.0",
"version": "0.4.1",
"description": "Breeze Sequelize server implementation",

@@ -22,7 +22,9 @@ "keywords": [

"dependencies": {
"toposort": "^2.0.2"
},
"peerDependencies": {
"bluebird": "^3.7.2",
"breeze-client": ">=2.0.3",
"breeze-client": ">=2.0.4",
"lodash": "^4.17.15",
"sequelize": "^5.21.3",
"toposort": "^2.0.2"
"sequelize": "^5.21.3"
},

@@ -32,8 +34,8 @@ "devDependencies": {

"@types/lodash": "^4.14.137",
"@types/node": "^12.12.25",
"@types/node": "^12.12.26",
"@types/validator": "^12.0.1",
"chai": "^4.2.0",
"mocha": "^6.2.0",
"rimraf": "^3.0.0",
"typescript": "~3.4.5"
"rimraf": "^3.0.1",
"typescript": "^3.7.5"
},

@@ -40,0 +42,0 @@ "scripts": {

@@ -8,5 +8,7 @@ "use strict";

var SQVisitor_1 = require("./SQVisitor");
// patch Breeze EntityQuery for server-side use
// TODO make this a method on SequelizeQuery, so we don't have to patch Breeze?
breeze_client_1.EntityQuery['fromUrl'] = function (url, resourceName) {
/** Create an EntityQuery from a JSON-format breeze query string
* @param url - url containing query, e.g. `/orders?{freight:{">":100}}`
* @param resourceName - Name of the resource/entity. If omitted, resourceName is derived from the pathname of the url.
*/
function entityQueryFromUrl(url, resourceName) {
var parsedUrl = urlUtils.parse(url, true);

@@ -25,3 +27,7 @@ resourceName = resourceName || parsedUrl.pathname;

return entityQuery;
};
}
exports.entityQueryFromUrl = entityQueryFromUrl;
// patch Breeze EntityQuery for server-side use
// TODO make this a method on SequelizeQuery, so we don't have to patch Breeze?
breeze_client_1.EntityQuery['fromUrl'] = entityQueryFromUrl;
// TODO: still need to add support for fns like toUpper, length etc.

@@ -28,0 +34,0 @@ // TODO: still need to add support for any/all

@@ -21,3 +21,3 @@ "use strict";

}
/** Save the entities in the save request */
/** Save the entities in the save request, returning either the saved entities or an error collection */
SequelizeSaveHandler.prototype.save = function () {

@@ -24,0 +24,0 @@ var _this = this;

"use strict";
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
var _a;
var _ = require("lodash");

@@ -5,0 +5,0 @@ var sequelize_1 = require("sequelize");

import { Options } from "sequelize";
/** Config for connecting to a database */
export interface DbConfig {

@@ -7,5 +8,7 @@ dbName: string;

}
/** @returns Promise<"success"> or throws an error */
/** Connect to existing database.
* @returns Promise<"success"> or throws an error */
export declare function connect(dbConfig: DbConfig, sequelizeOptions: Options): Promise<string>;
/** @returns Promise<void> or throws an error */
/** Create new database.
* @returns Promise<void> or throws an error */
export declare function createDb(dbConfig: DbConfig, sequelizeOptions: Options): Promise<void>;

@@ -1,2 +0,2 @@

import { SequelizeQuery } from "./SequelizeQuery";
import { SequelizeQuery, entityQueryFromUrl } from "./SequelizeQuery";
import { SequelizeManager } from "./SequelizeManager";

@@ -8,2 +8,2 @@ import { SequelizeSaveHandler } from "./SequelizeSaveHandler";

declare const Sequelize: typeof import("sequelize/types").Sequelize;
export { SequelizeQuery, SequelizeManager, Sequelize, SequelizeSaveHandler, utils, dbUtils, breeze };
export { SequelizeQuery, entityQueryFromUrl, SequelizeManager, Sequelize, SequelizeSaveHandler, utils, dbUtils, breeze };
import { MetadataStore } from "breeze-client";
import { Model, Sequelize } from "sequelize";
/** Map name to Sequelize Model type */
export interface NameModelMap {

@@ -10,5 +11,7 @@ [modelName: string]: {

export declare class MetadataMapper {
sequelize: Sequelize;
metadataStore: MetadataStore;
readonly sequelize: Sequelize;
readonly metadataStore: MetadataStore;
/** Maps entity type name to Sequelize Model */
entityTypeSqModelMap: NameModelMap;
/** Maps resource name to Sequelize Model */
resourceNameSqModelMap: NameModelMap;

@@ -15,0 +18,0 @@ constructor(breezeMetadata: MetadataStore | string | Object, sequelize: Sequelize);

@@ -14,6 +14,10 @@ import { Sequelize, Options, SyncOptions } from "sequelize";

sequelize: Sequelize;
/** Same as resourceNameSqModelMap */
models: NameModelMap;
/** Maps resource name to Sequelize Model */
resourceNameSqModelMap: NameModelMap;
/** Maps entity type name to Sequelize Model */
entityTypeSqModelMap: NameModelMap;
metadataStore: MetadataStore;
/** Generates keys for entity types where autoGeneratedKeyType = "KeyGenerator" */
keyGenerator: KeyGenerator;

@@ -20,0 +24,0 @@ constructor(dbConfig: DbConfig, sequelizeOptions: Options);

import { EntityQuery, EntityType, MetadataStore, NavigationProperty, VisitContext } from "breeze-client";
import { FindOptions, IncludeOptions, Model, Transaction } from "sequelize";
import { SequelizeManager } from "./SequelizeManager";
/** Create an EntityQuery from a JSON-format breeze query string
* @param url - url containing query, e.g. `/orders?{freight:{">":100}}`
* @param resourceName - Name of the resource/entity. If omitted, resourceName is derived from the pathname of the url.
*/
export declare function entityQueryFromUrl(url: string, resourceName?: string): EntityQuery;
export interface SequelizeQueryOptions {

@@ -8,3 +13,4 @@ useTransaction: boolean;

}
interface CountModel {
/** Object returned from a query with inlineCountEnabled */
export interface CountModel {
rows: Model[];

@@ -50,2 +56,1 @@ count: number;

}
export {};

@@ -5,6 +5,7 @@ import { Entity, MetadataStore, SaveOptions } from "breeze-client";

import { KeyGenerator, SequelizeManager } from "./SequelizeManager";
/** Save bundle from breeze client */
export interface SaveRequest {
body: {
entities: Entity[];
saveOptions: SaveOptions;
saveOptions?: SaveOptions;
};

@@ -14,5 +15,5 @@ }

export declare class SequelizeSaveHandler {
sequelizeManager: SequelizeManager;
metadataStore: MetadataStore;
entitiesFromClient: Entity[];
readonly sequelizeManager: SequelizeManager;
readonly metadataStore: MetadataStore;
readonly entitiesFromClient: Entity[];
saveOptions: SaveOptions;

@@ -22,8 +23,11 @@ private _keyMappings;

private _savedEntities;
/** Generates keys for entity types where autoGeneratedKeyType = "KeyGenerator" */
keyGenerator: KeyGenerator;
beforeSaveEntity: (ei: EntityInfo) => EntityInfo;
/** Process an entity before save. If false is returned, entity is not saved. */
beforeSaveEntity: (ei: EntityInfo) => boolean;
/** Process all entities before save. The entities in the returned SaveMap are saved. */
beforeSaveEntities: (sm: SaveMap, trx?: Transaction) => SaveMap;
/** Create an instance for the given save request */
constructor(sequelizeManager: SequelizeManager, req: SaveRequest);
/** Save the entities in the save request */
/** Save the entities in the save request, returning either the saved entities or an error collection */
save(): Promise<{

@@ -30,0 +34,0 @@ errors: ServerEntityError[];

import { VisitContext } from "breeze-client";
import { IncludeOptions, WhereOptions } from "sequelize";
import { SqVisitContext } from "./SequelizeQuery";
/** Result of processing a query expression into Sequelize */
export interface ExprResult {

@@ -5,0 +6,0 @@ include: IncludeOptions[];

@@ -0,1 +1,2 @@

/** Wrapper around console.log. Use `log.enabled` to enable/disable */
export declare function log(s: any, ...args: any[]): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** Wrapper around console.log. Use `log.enabled` to enable/disable */
function log(s) {

@@ -4,0 +5,0 @@ var args = [];

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc