Skip to content

Releases: imqueue/pg-sequelize

v4.2.7

Choose a tag to compare

@github-actions github-actions released this 11 Sep 03:47

What's Changed

  • fix(cla): store signatures off master, where a bot can write them by @Mikhus in #27

New Contributors

Full Changelog: v4.2.6...v4.2.7

About

@imqueue/pg-sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.2.6

Choose a tag to compare

@github-actions github-actions released this 08 Sep 18:52

What's changed

  • chore(deps): rpc -> ^3.9.1

Full Changelog: v4.2.5...v4.2.6

About

@imqueue/pg-sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.2.5

Choose a tag to compare

@github-actions github-actions released this 31 Aug 23:32

What's changed

  • chore(deps): rpc -> ^3.9.0

Full Changelog: v4.2.4...v4.2.5

About

@imqueue/pg-sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.2.4

Choose a tag to compare

@github-actions github-actions released this 30 Aug 07:50

What's changed

  • chore(deps): rpc -> ^3.8.0
  • ci: reject AI attribution and vendor-locked agent config

Full Changelog: v4.2.3...v4.2.4

About

@imqueue/pg-sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.2.3

Choose a tag to compare

@github-actions github-actions released this 22 Aug 08:08

What's changed

  • chore(deps): rpc -> ^3.7.2

Full Changelog: v4.2.2...v4.2.3

About

@imqueue/pg-sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.2.2

Choose a tag to compare

@github-actions github-actions released this 22 Aug 06:09

What's changed

No source changes in this release — documentation, package metadata and dependency ranges only.

  • Added an npm-version badge; the build badge now links to the workflow rather than the repo root.
  • Added a https://imqueue.org/status.json pointer.
  • @imqueue/rpc range raised to ^3.7.1.

Full Changelog: v4.2.1...v4.2.2

About

@imqueue/pg-sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.2.1

Choose a tag to compare

@github-actions github-actions released this 18 Aug 10:30

Fixed

  • query.createEntity leaked a pooled connection on every failed insert.
    When no transaction was passed it opened one, and finished it only on the happy
    path — there was no rollback anywhere in the helper. A rejected save() (a
    unique or foreign-key violation, a NOT NULL, an invalid enum) unwound past the
    commit and left the transaction open.

    In sequelize 6 a pooled connection is bound to the Transaction and only
    commit() or rollback() hands it back, so nothing released it: pool.max
    failed inserts — 5 by default — exhausted the pool, after which every query in
    the process failed with SequelizeConnectionAcquireTimeoutError until it was
    restarted. On the database side the backend sat in
    idle in transaction (aborted) indefinitely.

    Ownership is now all-or-nothing, decided by a single flag used for both the
    commit and the rollback so the two cannot select different sets of calls. Only
    the call that opened the transaction finishes it; a caller-supplied transaction
    and the nested relation creates that inherit it are untouched, exactly as
    before. A rollback that fails is swallowed so it cannot replace the error that
    caused it.

    Anyone who cannot upgrade can own the lifecycle from outside, which closes the
    leak with no dependency change:

    const entity = await Model.sequelize!.transaction(transaction =>
        createEntity<T, I>(Model, data, fields, transaction),
    );

About

@imqueue/pg-sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.2.0

Choose a tag to compare

@github-actions github-actions released this 01 Aug 16:24

The package is renamed from @imqueue/sequelize to @imqueue/pg-sequelize. No
export changed name or signature; the migration is the dependency and the import
specifiers.

@imqueue/sequelize is deprecated on npm and will receive no further releases.
There is no compatibility shim: 4.1.3, the last version published under the old
name, stays installable indefinitely and stays frozen.

Changed

  • Renamed on npm. npm i @imqueue/pg-sequelize, and update every import
    specifier.

    The pg- prefix states what was already true. This package is Postgres-
    specific rather than dialect-neutral: pg is a direct dependency, the index
    decorators emit Postgres CREATE INDEX syntax including CONCURRENTLY, and
    the filter operators (ILIKE, ~, @>, <@, &&, -|-, …) are Postgres
    operators. It also lines the name up with its sibling
    @imqueue/pg-prisma, which covers the
    same ground for that stack.

  • repository.url was malformed and is now correct. It read
    git@github.com:/imqueue/sequelize — scp form with a stray slash after the
    colon and no .git suffix — and was published that way. It is now
    git+https://github.com/imqueue/pg-sequelize.git.

  • bugs.url and the three README badges (build status, Snyk, license) point
    at the renamed repository, and the API-reference link points at
    https://imqueue.org/api/pg-sequelize/latest/.

  • The published description was silently truncated. npm stores 255
    characters and the description was 286, so it had been cut mid-word at
    "…Sequelize cannot e" since 4.1.3. It is now 239 characters.

Added

  • keywords. There were none, so discoverability rested entirely on the
    package name matching a search for "sequelize" — which the rename gives up.
    The list keeps sequelize alongside postgres, pg, orm and the rest.

  • publishConfig.access, so a first publish under a new scoped name cannot
    land as a restricted package.

About

@imqueue/pg-sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.1.3

Choose a tag to compare

@github-actions github-actions released this 01 Aug 14:10

Full Changelog: v4.1.2...v4.1.3

About

@imqueue/sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.

v4.1.2

Choose a tag to compare

@github-actions github-actions released this 01 Aug 13:58

The substance of the 4.1 line: every exported symbol documented, the first published API
reference, and the defects that writing that documentation turned up — one of which made a
whole feature unreachable. v4.1.1 and v4.1.2 are documentation and packaging on top of
v4.1.0; these notes cover everything since v4.0.3.

Nothing here breaks code that was already producing correct SQL. Several calls that used
to succeed now throw, and in every case they are the ones that were silently producing wrong
output.

Upgrade notes (4.0.x → 4.1.x)

  • @ColumnIndex and @NullableIndex now work at all. They threw TypeError at import
    time on any ordinary model: TypeScript applies property decorators before class
    decorators, so they ran before @Table created the options bag they read from, and @Column
    does not create one either. No decorator order worked — the feature was unreachable. If you
    gave up on them, they are usable now.

  • CREATE INDEX output changed, and indices will appear that never existed. Five of the
    thirteen ColumnIndexOptions emitted invalid SQL — USING came before ON, and COLLATE,
    the operator class, the sort order and the nulls position landed after the closing
    parenthesis. method, collation, opClass, order and nullsFirst now work, and
    include is emitted for the first time. Those statements were failing silently, because
    syncIndex discarded its own rejections; expect the indices to be created on your next
    sync().

  • @NullableIndex's factory form declared the wrong indices. It built both halves by
    mutating one options object, which @ColumnIndex stores by reference, so you got two
    identical IS NOT NULL indices and neither carried the predicate that makes them partial.
    It now builds a fresh object per half, combines your own predicate with the null test, and
    suffixes your own name so the halves cannot collide.

  • query.sql now throws when given a template substitution. It ignored substitution
    values, and a tagged template hands the literal parts in as an array — which String()
    joins with commas. So sql`SELECT * FROM t WHERE id = ${id}` yielded
    SELECT * FROM t WHERE id = ,;: valid-looking, silently wrong. Use bind parameters. Calling
    sql() as a plain function is as lenient as it was.

  • query.L now interpolates its substitutions. The same defect fixed the other way round:
    a literal fragment has no bind channel, so escaping and interpolation are the only option.
    Its own documented example previously produced
    (SELECT COUNT(*) FROM "SomeTable" WHERE owner = ,) = 0.

  • query.E() now doubles embedded quotes. It wrapped a string in single quotes without
    escaping the ones inside it, so any value containing a quote produced a broken string
    constant — and a value chosen for the purpose produced SQL. This is also the helper that
    escapes a dynamic view's parameters on their way into the view definition, and viewParams
    can arrive with a find() call, so a service that let a caller choose them was exposed.

  • sync() rejects instead of leaking an unhandled rejection, and sync(options) now
    passes its options to the view pass — so withoutDrop: true takes effect, where before it
    did nothing whatever. The order is tables, then views, then indices, each awaited, so an
    index on a materialized view has something to attach to. syncIndices() on a model that
    declares no index resolves rather than throwing synchronously.

  • @View and @DynamicView reject a blank definition with a TypeError naming the
    problem, instead of accepting it or failing later with an unhelpful one.

  • @AssociatedWith resolves its thunk on first read rather than at decoration time — the
    one moment a thunk exists to avoid. Input classes and models import each other, so the
    decorator body could run while the other module was still initialising and capture
    undefined as the model.

Fixed

  • A caller-supplied logging function no longer crashes on the first query. Setting
    sequelize.logging to a plain callback — the shape sequelize's own option takes — got it
    cast to ILogger and put in the logger slot, so the first logged query threw
    TypeError: logger.log is not a function. Both shapes are now accepted, a supplied callback
    still receives formatted SQL, and false still disables logging. Logging is on unless
    explicitly turned off, so this was the default path, not an edge case.

Added

  • API reference — every exported symbol,
    searchable, always serving the current major.
  • SqlLoggingFunction — names the callback shape accepted by logging.

Documentation

Doc-block coverage went from 81% to 100% with no bare pages: all 25 BaseModel symbols, all
36 remaining decorator symbols, and the query namespace. Several things that were true of the
code but written down nowhere are now stated — toWhereOptions treating a % anywhere in a
string as an ILIKE pattern and a leading comparison operator as that operator, pureFields()
always appending primary keys, database() caching process-wide. Graph was documented as
undirected and is directed; its path() returns the reachable set, not the longest path.
@Emittable is now documented as what it is — an empty body behind a doc-block that promised
NOTIFY-based change events.

Every fix above is pinned by a test that fails against the code it replaces.

Full Changelog: v4.0.3...v4.1.2

About

@imqueue/sequelize turns a query described as data — filters, paging, ordering and the requested fields — into one efficient Sequelize statement, with database views as models and the Postgres index options Sequelize cannot express. Part of the @imqueue framework for Node.js & TypeScript microservices.