pipework 0.164.0 → 0.165.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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.165.0
4
+
5
+ - **Fixed: pipework errors are recognized across physical copies of the same version** (#703). When a workspace and a library it links each resolve their own copy of pipework, `instanceof` on any pipework error class (`QuotaExhaustedError`, `JobLaterError`, `JobPermanentError`, the HTTP error classes) now holds for the same error constructed by the other copy, keyed on the shared `Symbol.for('pipework.error')` brand and the class name in its prototype chain. A job that throws a `QuotaExhaustedError` from the library's copy is handed back to pending until `resetAt` with no attempt counted, instead of failing an attempt. Unbranded look-alikes are not matched.
6
+
3
7
  ## 0.164.0
4
8
 
5
9
  - **Added: outbound quota from a process outside the manifold** (#701). `quota.create({ reserve, connection: tap(url) })` takes, records and reads the shared budget over a standalone `tap()` connection, with no manifold and no request, job or `flow.run` context, so a plain Node worker spends the same `outbound_quota` budget as the pipework app (which must have migrated the table with blueprint `quota: {}`). A refusal throws `QuotaExhaustedError` (with `resetAt`) to the caller. The caller owns the connection's lifecycle. Passing both `connection` and `database` throws.
@@ -3,6 +3,7 @@ export declare abstract class PipeworkError extends Error {
3
3
  abstract readonly httpStatus: number;
4
4
  readonly details: Record<string, unknown>;
5
5
  constructor(message: string, details?: Record<string, unknown>);
6
+ static [Symbol.hasInstance](value: unknown): boolean;
6
7
  }
7
8
  /**
8
9
  * True for any PipeworkError, including one thrown across a module-realm boundary
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/core/errors/base.ts"],"names":[],"mappings":"AASA,8BAAsB,aAAc,SAAQ,KAAK;IAC/C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBAE7B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;CAMnE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAQtE"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/core/errors/base.ts"],"names":[],"mappings":"AASA,8BAAsB,aAAc,SAAQ,KAAK;IAC/C,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;gBAE7B,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;WASlD,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;CAS9D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAQtE"}
@@ -14,6 +14,21 @@ export class PipeworkError extends Error {
14
14
  this.details = details;
15
15
  Object.defineProperty(this, PIPEWORK_ERROR, { value: true, enumerable: false });
16
16
  }
17
+ // The brand is the identity across physical copies of pipework: a branded error is an
18
+ // instance of the class its prototype chain names, whichever copy constructed it.
19
+ static [Symbol.hasInstance](value) {
20
+ if (Function.prototype[Symbol.hasInstance].call(this, value))
21
+ return true;
22
+ if (!isPipeworkError(value))
23
+ return false;
24
+ if (this === PipeworkError)
25
+ return true;
26
+ for (let proto = Object.getPrototypeOf(value); proto !== null; proto = Object.getPrototypeOf(proto)) {
27
+ if (proto.constructor?.name === this.name)
28
+ return true;
29
+ }
30
+ return false;
31
+ }
17
32
  }
18
33
  /**
19
34
  * True for any PipeworkError, including one thrown across a module-realm boundary
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/core/errors/base.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,sFAAsF;AACtF,mFAAmF;AACnF,qFAAqF;AACrF,+DAA+D;AAC/D,sGAAsG;AACtG,+FAA+F;AAC/F,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,OAAgB,aAAc,SAAQ,KAAK;IAGtC,OAAO,CAAyB;IAEzC,YAAY,OAAe,EAAE,UAAmC,EAAE;QAChE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAA;IACjF,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAiC,CAAC,cAAc,CAAC,KAAK,IAAI;QAC3D,OAAQ,KAAkC,CAAC,UAAU,KAAK,QAAQ;QAClE,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,CACvD,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/core/errors/base.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,sFAAsF;AACtF,mFAAmF;AACnF,qFAAqF;AACrF,+DAA+D;AAC/D,sGAAsG;AACtG,+FAA+F;AAC/F,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;AAEnD,MAAM,OAAgB,aAAc,SAAQ,KAAK;IAGtC,OAAO,CAAyB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package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipework",
3
- "version": "0.164.0",
3
+ "version": "0.165.0",
4
4
  "description": "TypeScript framework for multi-tenant SaaS applications. PostgreSQL-only.",
5
5
  "type": "module",
6
6
  "license": "MIT",