Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove remaining bluebird references #12167

Merged
merged 2 commits into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ We're glad to get pull request if any functionality is missing or something is b
* Make sure that all existing tests pass
* Make sure you followed [coding guidelines](https://github.com/sequelize/sequelize/blob/master/CONTRIBUTING.md#coding-guidelines)
* Add some tests for your new functionality or a test exhibiting the bug you are solving. Ideally all new tests should not pass _without_ your changes.
- Use [promise style](http://bluebirdjs.com/docs/why-promises.html) in all new tests. Specifically this means:
- Use [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) in all new tests. Specifically this means:
- don't use `EventEmitter`, `QueryChainer` or the `success`, `done` and `error` events
- don't use a done callback in your test, just return the promise chain.
- Small bugfixes and direct backports to the 4.x branch are accepted without tests.
Expand Down
6 changes: 3 additions & 3 deletions docs/manual/core-concepts/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ const sequelize = new Sequelize('sqlite::memory:', {
});
```

## Bluebird Promises and async/await
## Promises and async/await

Most of the methods provided by Sequelize are asynchronous and therefore return Promises. They are all [Bluebird](http://bluebirdjs.com) Promises, so you can use the rich Bluebird API (for example, using `finally`, `tap`, `tapCatch`, `map`, `mapSeries`, etc) out of the box. You can access the Bluebird constructor used internally by Sequelize with `Sequelize.Promise`, if you want to set any Bluebird specific options.
Most of the methods provided by Sequelize are asynchronous and therefore return Promises. They are all [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) , so you can use the Promise API (for example, using `then`, `catch`, `finally`) out of the box.

Of course, using `async` and `await` works normally as well.
Of course, using `async` and `await` works normally as well.
4 changes: 1 addition & 3 deletions docs/manual/other-topics/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ As Sequelize heavily relies on runtime property assignments, TypeScript won't be

In order to avoid installation bloat for non TS users, you must install the following typing packages manually:

- `@types/node` (this is universally required)
- `@types/node` (this is universally required in node projects)
- `@types/validator`
- `@types/bluebird`

## Usage

Expand Down Expand Up @@ -129,7 +128,6 @@ Address.belongsTo(User, {targetKey: 'id'});
User.hasOne(Address,{sourceKey: 'id'});

async function stuff() {
// Please note that when using async/await you lose the `bluebird` promise context
// and you fall back to native
SimonSchick marked this conversation as resolved.
Show resolved Hide resolved
const newUser = await User.create({
name: 'Johnny',
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-angular": "^8.3.4",
"@types/bluebird": "^3.5.26",
"@types/node": "^12.12.37",
"@types/validator": "^10.11.0",
"acorn": "^7.1.1",
Expand Down
1 change: 0 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ export * from './lib/associations/index';
export * from './lib/errors';
export { BaseError as Error } from './lib/errors';
export { useInflection } from './lib/utils';
export { Promise } from './lib/promise';
export { Utils, QueryTypes, Op, TableHints, IndexHints, DataTypes, Deferrable };
export { Validator as validator } from './lib/utils/validator-extras';
4 changes: 1 addition & 3 deletions types/lib/associations/belongs-to-many.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
Transactionable,
WhereOptions,
} from '../model';
import { Promise } from '../promise';
import { Transaction } from '../transaction';
import { Association, AssociationScope, ForeignKeyOptions, ManyToManyOptions, MultiAssociationAccessors } from './base';

/**
Expand All @@ -21,7 +19,7 @@ import { Association, AssociationScope, ForeignKeyOptions, ManyToManyOptions, Mu
export interface ThroughOptions {
/**
* The model used to join both sides of the N:M association.
* Can be a string if you want the model to be generated by sequelize.
* Can be a string if you want the model to be generated by sequelize.
*/
model: typeof Model | string;

Expand Down
1 change: 0 additions & 1 deletion types/lib/associations/belongs-to.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DataType } from '../data-types';
import { CreateOptions, FindOptions, Model, ModelCtor, SaveOptions } from '../model';
import { Promise } from '../promise';
import { Association, AssociationOptions, SingleAssociationAccessors } from './base';

// type ModelCtor<M extends Model> = InstanceType<typeof M>;
Expand Down
1 change: 0 additions & 1 deletion types/lib/associations/has-many.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
ModelCtor,
Transactionable,
} from '../model';
import { Promise } from '../promise';
import { Association, ManyToManyOptions, MultiAssociationAccessors } from './base';

/**
Expand Down
1 change: 0 additions & 1 deletion types/lib/associations/has-one.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DataType } from '../data-types';
import { CreateOptions, FindOptions, Model, ModelCtor, SaveOptions } from '../model';
import { Promise } from '../promise';
import { Association, AssociationOptions, SingleAssociationAccessors } from './base';

/**
Expand Down
2 changes: 0 additions & 2 deletions types/lib/connection-manager.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Promise } from './promise';

export interface GetConnectionOptions {
/**
* Set which replica to use. Available options are `read` and `write`
Expand Down
3 changes: 1 addition & 2 deletions types/lib/model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { DataType } from './data-types';
import { Deferrable } from './deferrable';
import { HookReturn, Hooks, ModelHooks } from './hooks';
import { ValidationOptions } from './instance-validator';
import { Promise } from './promise';
import { QueryOptions, IndexesOptions } from './query-interface';
import { Config, Options, Sequelize, SyncOptions } from './sequelize';
import { Sequelize, SyncOptions } from './sequelize';
import { Transaction, LOCK } from './transaction';
import { Col, Fn, Literal, Where } from './utils';
import Op = require('./operators');
Expand Down
6 changes: 0 additions & 6 deletions types/lib/promise.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion types/lib/query-interface.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DataType } from './data-types';
import { Logging, Model, ModelAttributeColumnOptions, ModelAttributes, Transactionable, WhereOptions, Filterable, Poolable } from './model';
import { Promise } from './promise';
import QueryTypes = require('./query-types');
import { Sequelize, RetryOptions } from './sequelize';
import { Transaction } from './transaction';
Expand Down
8 changes: 1 addition & 7 deletions types/lib/sequelize.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as DataTypes from './data-types';
import * as Deferrable from './deferrable';
import { HookReturn, Hooks, SequelizeHooks } from './hooks';
import { ValidationOptions } from './instance-validator';
import {
Expand All @@ -23,15 +22,10 @@ import {
Hookable,
} from './model';
import { ModelManager } from './model-manager';
import * as Op from './operators';
import { Promise } from './promise';
import { QueryInterface, QueryOptions, QueryOptionsWithModel, QueryOptionsWithType } from './query-interface';
import QueryTypes = require('./query-types');
import { Transaction, TransactionOptions } from './transaction';
import { Cast, Col, Fn, Json, Literal, Where } from './utils';
// tslint:disable-next-line:no-duplicate-imports
import * as Utils from './utils';
import { validator } from './utils/validator-extras';
import { ConnectionManager } from './connection-manager';

/**
Expand Down Expand Up @@ -777,7 +771,7 @@ export class Sequelize extends Hooks {
/**
* Use CLS with Sequelize.
* CLS namespace provided is stored as `Sequelize._cls`
* and bluebird Promise is patched to use the namespace, using `cls-bluebird` module.
* and Promise is patched to use the namespace, using `cls-hooked` module.
*
* @param namespace
*/
Expand Down
1 change: 0 additions & 1 deletion types/lib/transaction.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Deferrable } from './deferrable';
import { Logging } from './model';
import { Promise } from './promise';
import { Sequelize } from './sequelize';

/**
Expand Down
2 changes: 0 additions & 2 deletions types/lib/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,5 +115,3 @@ export class Where extends SequelizeMethod {
constructor(attr: object, comparator: string, logic: string | object);
constructor(attr: object, logic: string | object);
}

export { Promise } from './promise';
2 changes: 1 addition & 1 deletion types/test/count.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Model, Promise, Op } from 'sequelize';
import { Model, Op } from 'sequelize';

class MyModel extends Model {}

Expand Down
1 change: 0 additions & 1 deletion types/test/e2e/docs-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ Address.belongsTo(User, {targetKey: 'id'});
User.hasOne(Address,{sourceKey: 'id'});

async function stuff() {
// Please note that when using async/await you lose the `bluebird` promise context
// and you fall back to native
SimonSchick marked this conversation as resolved.
Show resolved Hide resolved
const newUser = await User.create({
name: 'Johnny',
Expand Down
6 changes: 0 additions & 6 deletions types/test/promise.ts

This file was deleted.