@pipeline-builder/pipeline-data 4.4.5 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/api/crud-service.d.ts +43 -1
- package/lib/api/crud-service.js +111 -40
- package/lib/api/ecosystem-privacy.d.ts +2 -4
- package/lib/api/ecosystem-privacy.js +8 -10
- package/lib/api/org-data-ownership.d.ts +41 -0
- package/lib/api/org-data-ownership.js +127 -0
- package/lib/api/org-data-purge.d.ts +34 -0
- package/lib/api/org-data-purge.js +74 -0
- package/lib/api/plugin-advisories.js +4 -4
- package/lib/api/plugin-resolution.js +6 -6
- package/lib/api/public-directory.js +3 -3
- package/lib/api/reporting/daily-rollup.js +33 -15
- package/lib/api/reporting/deploy-rollup.js +7 -1
- package/lib/api/reporting/dora.js +5 -2
- package/lib/api/reporting/sql-helpers.d.ts +48 -0
- package/lib/api/reporting/sql-helpers.js +60 -1
- package/lib/api/reporting/types.d.ts +4 -0
- package/lib/api/reporting/types.js +1 -1
- package/lib/api/reporting-service.d.ts +8 -5
- package/lib/api/reporting-service.js +48 -17
- package/lib/api/semver-range.d.ts +1 -58
- package/lib/api/semver-range.js +10 -171
- package/lib/api/soft-delete-sweep.d.ts +1 -1
- package/lib/api/soft-delete-sweep.js +1 -1
- package/lib/core/query-filters.d.ts +2 -134
- package/lib/core/query-filters.js +1 -1
- package/lib/database/drizzle-schema.d.ts +185 -0
- package/lib/database/drizzle-schema.js +3 -2
- package/lib/database/index.d.ts +2 -1
- package/lib/database/index.js +2 -2
- package/lib/database/postgres-connection.js +13 -1
- package/lib/database/read-lag.js +8 -31
- package/lib/database/schema/alert.d.ts +203 -0
- package/lib/database/schema/alert.js +39 -4
- package/lib/database/schema/dashboard.d.ts +1 -1
- package/lib/database/schema/dashboard.js +4 -4
- package/lib/database/schema/pipeline.js +5 -5
- package/lib/database/schema/plugin.d.ts +2 -43
- package/lib/database/schema/plugin.js +3 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +4 -2
- package/package.json +13 -4
- package/lib/testing/exports.json +0 -311
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog — @pipeline-builder/pipeline-data
|
|
2
|
+
|
|
3
|
+
Release versions are stamped by `nx release` (conventional commits). This file records
|
|
4
|
+
breaking changes in the public surface only.
|
|
5
|
+
|
|
6
|
+
## 5.0.0 (unreleased)
|
|
7
|
+
|
|
8
|
+
### BREAKING CHANGES — `./lib/*` removed; `./testing` is workspace-only.
|
|
9
|
+
|
|
10
|
+
The package's public surface is now exactly its `exports` map. Anything not listed below cannot be imported (`ERR_PACKAGE_PATH_NOT_EXPORTED`).
|
|
11
|
+
|
|
12
|
+
- **Entries:** `.`, `./package.json`.
|
|
13
|
+
- The `./lib/*` wildcard is gone, so `@pipeline-builder/pipeline-data/lib/...` deep imports no longer resolve.
|
|
14
|
+
- `./testing` is no longer in the published map. The tarball never contained `lib/testing/` (it needs the PGlite devDependency and the repo's `deploy/` init script), so the old entry pointed at nothing. It stays a workspace-only entry for this repo's test suites.
|
|
@@ -17,6 +17,34 @@ export declare function drizzleCount(rows: unknown): [{
|
|
|
17
17
|
* `onBeforePurge` so a subclass's dependent teardown runs in the SAME purge
|
|
18
18
|
* transaction (atomic with the parent DELETE), not a fresh connection. */
|
|
19
19
|
export type CrudTx = Parameters<Parameters<typeof withTenantTx>[0]>[0];
|
|
20
|
+
/**
|
|
21
|
+
* What an in-transaction mutation hook ({@link CrudService.onCreateInTx} and
|
|
22
|
+
* friends) is told about the write: who made it, and (for update/delete) the
|
|
23
|
+
* org the write was pinned to.
|
|
24
|
+
*/
|
|
25
|
+
export interface CrudMutationContext {
|
|
26
|
+
/** The acting user (the system actor id for background work). */
|
|
27
|
+
userId: string;
|
|
28
|
+
/** The org the write was scoped to (update/delete); absent on create. */
|
|
29
|
+
orgId?: string;
|
|
30
|
+
/** Which write fired the hook. */
|
|
31
|
+
operation: 'create' | 'update' | 'updateMany' | 'delete' | 'bulkDelete';
|
|
32
|
+
}
|
|
33
|
+
/** Options for {@link CrudService.update}. */
|
|
34
|
+
export interface UpdateOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Optimistic concurrency: write only if the row's `updated_at` still equals
|
|
37
|
+
* this (compared at millisecond precision — what a JSON round-trip of the
|
|
38
|
+
* read keeps). When the row exists but has moved on, the update throws
|
|
39
|
+
* `ConcurrencyConflictError` (412 PRECONDITION_FAILED) instead of returning
|
|
40
|
+
* null. An unparseable value is a 400 ValidationError.
|
|
41
|
+
*
|
|
42
|
+
* The token is `updated_at` (stamped from the app clock on every write), so
|
|
43
|
+
* two writes within the same millisecond are indistinguishable — adequate
|
|
44
|
+
* for human-paced edits, not a substitute for a lock on hot rows.
|
|
45
|
+
*/
|
|
46
|
+
expectedUpdatedAt?: Date | string;
|
|
47
|
+
}
|
|
20
48
|
/**
|
|
21
49
|
* Base interface for entities with common fields
|
|
22
50
|
*/
|
|
@@ -178,6 +206,12 @@ export declare abstract class CrudService<TEntity extends BaseEntity, TFilter, T
|
|
|
178
206
|
* `onAfterPurge` handles external side-effects best-effort. Returns the ids.
|
|
179
207
|
*/
|
|
180
208
|
private purgeWhere;
|
|
209
|
+
/** Called inside the create transaction, after the INSERT. */
|
|
210
|
+
protected onCreateInTx(_entity: TEntity, _tx: CrudTx, _ctx: CrudMutationContext): Promise<void>;
|
|
211
|
+
/** Called inside the update transaction for each updated row (update / updateMany). */
|
|
212
|
+
protected onUpdateInTx(_entity: TEntity, _tx: CrudTx, _ctx: CrudMutationContext): Promise<void>;
|
|
213
|
+
/** Called inside the soft-delete transaction for each deleted row (delete / bulkDelete). */
|
|
214
|
+
protected onDeleteInTx(_entity: TEntity, _tx: CrudTx, _ctx: CrudMutationContext): Promise<void>;
|
|
181
215
|
/** Called after a new entity is created */
|
|
182
216
|
protected onAfterCreate(_entity: TEntity, _userId: string): Promise<void>;
|
|
183
217
|
/** Called after an entity is updated */
|
|
@@ -318,7 +352,15 @@ export declare abstract class CrudService<TEntity extends BaseEntity, TFilter, T
|
|
|
318
352
|
/**
|
|
319
353
|
* Update an existing entity
|
|
320
354
|
*/
|
|
321
|
-
update(id: string, data: Partial<TUpdate>, orgId: string, userId: string): Promise<TEntity | null>;
|
|
355
|
+
update(id: string, data: Partial<TUpdate>, orgId: string, userId: string, options?: UpdateOptions): Promise<TEntity | null>;
|
|
356
|
+
/** Parse an `expectedUpdatedAt` option; an invalid value is the caller's 400. */
|
|
357
|
+
private expectedTimestamp;
|
|
358
|
+
/**
|
|
359
|
+
* `updated_at` equals `expected` at MILLISECOND precision. Postgres keeps
|
|
360
|
+
* microseconds (a `defaultNow()` insert), a client's copy of the timestamp
|
|
361
|
+
* (JSON, a JS Date) keeps milliseconds — an exact compare would always fail.
|
|
362
|
+
*/
|
|
363
|
+
private updatedAtMatches;
|
|
322
364
|
/**
|
|
323
365
|
* Delete an entity (soft delete by setting isActive = false)
|
|
324
366
|
*/
|