@entifix/rest 0.1.4 → 0.2.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.
@@ -35,7 +35,7 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../../entity-rest
35
35
  url
36
36
  }));
37
37
  return yield* readTransactionRecordEnvelope(response.body);
38
- }).pipe(Effect.catchAll((error)=>{
38
+ }).pipe(Effect.catch((error)=>{
39
39
  var _error_details;
40
40
  return ((_error_details = error.details) == null ? void 0 : _error_details['status']) === 404 ? Effect.succeed(undefined) : Effect.fail(error);
41
41
  }))
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.ts"],"sourcesContent":["import { ConfigurationRepositoryTag } from '@entifix/business';\nimport type { EntifixError } from '@entifix/core';\nimport {\n readTransactionRecordEnvelope,\n type TransactionRecord,\n type TransactionStatusReader,\n} from '@entifix/transactions';\nimport { Effect } from 'effect';\n\nimport { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';\nimport { buildEntityRestAdapterMixins as adapterMixins } from '../../entity-rest/build-entity-rest-adapter-mixins/index.js';\nimport type { BuildEntityRestOptions } from '../../entity-rest/types.js';\n\n/**\n * The tracker's own path segment. It is not an entity — nothing decorates a\n * `TransactionRecord` — but the URL is composed the same way every entity URL\n * is, so `buildEntityBaseUrl` (already generic over an arbitrary name) needs no\n * transaction-shaped sibling.\n */\nconst TRANSACTION_PATH = 'transaction';\n\n/**\n * Reads one transaction's record over HTTP, for a browser reconciling a write it\n * started.\n *\n * ⚠️ **A `404` answers `undefined`, and that is not a failure.** `accepted`\n * reaches the tracker over the bus, so with the broker down the entity write\n * commits — the outbox is in the same Mongo transaction — while no event is ever\n * published and the tracker holds no record at all. A caller that treated this\n * as terminal would un-render a healthy write during a broker outage, which is\n * the moment nobody can tell a UI bug from an outage (ADR 0043). The route also\n * answers `404` for another tenant's record, deliberately, so it cannot be\n * walked to probe ids that are also primary keys — indistinguishable here, and\n * correctly so: neither is a record this caller may reconcile against.\n *\n * Every other status stays an error, so an unreachable service is not quietly\n * read as \"no such transaction\".\n */\nexport const buildTransactionStatusReader = (\n options: BuildEntityRestOptions,\n): Effect.Effect<TransactionStatusReader, never, ConfigurationRepositoryTag> =>\n Effect.gen(function* () {\n const configurationStore = yield* ConfigurationRepositoryTag;\n\n return {\n read: (\n transactionId: string,\n ): Effect.Effect<TransactionRecord | undefined, EntifixError> =>\n Effect.gen(function* () {\n const url = yield* adapterMixins.buildEntityBaseUrl(\n configurationStore,\n options,\n TRANSACTION_PATH,\n transactionId,\n );\n\n const response = yield* performHttpRequestThroughFetch(\n adapterMixins.buildEntityRequest({ method: 'GET', url }),\n );\n\n return yield* readTransactionRecordEnvelope(response.body);\n }).pipe(\n Effect.catchAll(error =>\n error.details?.['status'] === 404\n ? Effect.succeed(undefined)\n : Effect.fail(error),\n ),\n ),\n };\n });\n"],"names":["ConfigurationRepositoryTag","readTransactionRecordEnvelope","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","TRANSACTION_PATH","buildTransactionStatusReader","options","gen","configurationStore","read","transactionId","url","buildEntityBaseUrl","response","buildEntityRequest","method","body","pipe","catchAll","error","details","succeed","undefined","fail"],"mappings":"AAAA,SAASA,0BAA0B,QAAQ,oBAAoB;AAE/D,SACEC,6BAA6B,QAGxB,wBAAwB;AAC/B,SAASC,MAAM,QAAQ,SAAS;AAEhC,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,gCAAgCC,aAAa,QAAQ,8DAA8D;AAG5H;;;;;CAKC,GACD,MAAMC,mBAAmB;AAEzB;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,+BAA+B,CAC1CC,UAEAN,OAAOO,GAAG,CAAC;QACT,MAAMC,qBAAqB,OAAOV;QAElC,OAAO;YACLW,MAAM,CACJC,gBAEAV,OAAOO,GAAG,CAAC;oBACT,MAAMI,MAAM,OAAOR,cAAcS,kBAAkB,CACjDJ,oBACAF,SACAF,kBACAM;oBAGF,MAAMG,WAAW,OAAOZ,+BACtBE,cAAcW,kBAAkB,CAAC;wBAAEC,QAAQ;wBAAOJ;oBAAI;oBAGxD,OAAO,OAAOZ,8BAA8Bc,SAASG,IAAI;gBAC3D,GAAGC,IAAI,CACLjB,OAAOkB,QAAQ,CAACC,CAAAA;wBACdA;2BAAAA,EAAAA,iBAAAA,MAAMC,OAAO,qBAAbD,cAAe,CAAC,SAAS,MAAK,MAC1BnB,OAAOqB,OAAO,CAACC,aACftB,OAAOuB,IAAI,CAACJ;;QAGxB;IACF,GAAG"}
1
+ {"version":3,"sources":["../../../../src/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.ts"],"sourcesContent":["import { ConfigurationRepositoryTag } from '@entifix/business';\nimport type { EntifixError } from '@entifix/core';\nimport {\n readTransactionRecordEnvelope,\n type TransactionRecord,\n type TransactionStatusReader,\n} from '@entifix/transactions';\nimport { Effect } from 'effect';\n\nimport { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';\nimport { buildEntityRestAdapterMixins as adapterMixins } from '../../entity-rest/build-entity-rest-adapter-mixins/index.js';\nimport type { BuildEntityRestOptions } from '../../entity-rest/types.js';\n\n/**\n * The tracker's own path segment. It is not an entity — nothing decorates a\n * `TransactionRecord` — but the URL is composed the same way every entity URL\n * is, so `buildEntityBaseUrl` (already generic over an arbitrary name) needs no\n * transaction-shaped sibling.\n */\nconst TRANSACTION_PATH = 'transaction';\n\n/**\n * Reads one transaction's record over HTTP, for a browser reconciling a write it\n * started.\n *\n * ⚠️ **A `404` answers `undefined`, and that is not a failure.** `accepted`\n * reaches the tracker over the bus, so with the broker down the entity write\n * commits — the outbox is in the same Mongo transaction — while no event is ever\n * published and the tracker holds no record at all. A caller that treated this\n * as terminal would un-render a healthy write during a broker outage, which is\n * the moment nobody can tell a UI bug from an outage (ADR 0043). The route also\n * answers `404` for another tenant's record, deliberately, so it cannot be\n * walked to probe ids that are also primary keys — indistinguishable here, and\n * correctly so: neither is a record this caller may reconcile against.\n *\n * Every other status stays an error, so an unreachable service is not quietly\n * read as \"no such transaction\".\n */\nexport const buildTransactionStatusReader = (\n options: BuildEntityRestOptions,\n): Effect.Effect<TransactionStatusReader, never, ConfigurationRepositoryTag> =>\n Effect.gen(function* () {\n const configurationStore = yield* ConfigurationRepositoryTag;\n\n return {\n read: (\n transactionId: string,\n ): Effect.Effect<TransactionRecord | undefined, EntifixError> =>\n Effect.gen(function* () {\n const url = yield* adapterMixins.buildEntityBaseUrl(\n configurationStore,\n options,\n TRANSACTION_PATH,\n transactionId,\n );\n\n const response = yield* performHttpRequestThroughFetch(\n adapterMixins.buildEntityRequest({ method: 'GET', url }),\n );\n\n return yield* readTransactionRecordEnvelope(response.body);\n }).pipe(\n Effect.catch(error =>\n error.details?.['status'] === 404\n ? Effect.succeed(undefined)\n : Effect.fail(error),\n ),\n ),\n };\n });\n"],"names":["ConfigurationRepositoryTag","readTransactionRecordEnvelope","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","TRANSACTION_PATH","buildTransactionStatusReader","options","gen","configurationStore","read","transactionId","url","buildEntityBaseUrl","response","buildEntityRequest","method","body","pipe","catch","error","details","succeed","undefined","fail"],"mappings":"AAAA,SAASA,0BAA0B,QAAQ,oBAAoB;AAE/D,SACEC,6BAA6B,QAGxB,wBAAwB;AAC/B,SAASC,MAAM,QAAQ,SAAS;AAEhC,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,gCAAgCC,aAAa,QAAQ,8DAA8D;AAG5H;;;;;CAKC,GACD,MAAMC,mBAAmB;AAEzB;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,+BAA+B,CAC1CC,UAEAN,OAAOO,GAAG,CAAC;QACT,MAAMC,qBAAqB,OAAOV;QAElC,OAAO;YACLW,MAAM,CACJC,gBAEAV,OAAOO,GAAG,CAAC;oBACT,MAAMI,MAAM,OAAOR,cAAcS,kBAAkB,CACjDJ,oBACAF,SACAF,kBACAM;oBAGF,MAAMG,WAAW,OAAOZ,+BACtBE,cAAcW,kBAAkB,CAAC;wBAAEC,QAAQ;wBAAOJ;oBAAI;oBAGxD,OAAO,OAAOZ,8BAA8Bc,SAASG,IAAI;gBAC3D,GAAGC,IAAI,CACLjB,OAAOkB,KAAK,CAACC,CAAAA;wBACXA;2BAAAA,EAAAA,iBAAAA,MAAMC,OAAO,qBAAbD,cAAe,CAAC,SAAS,MAAK,MAC1BnB,OAAOqB,OAAO,CAACC,aACftB,OAAOuB,IAAI,CAACJ;;QAGxB;IACF,GAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entifix/rest",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "HTTP entity adapter for the browser: get, load, save and delete against an entifix service, plus served metadata and transaction status.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -52,15 +52,15 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@swc/helpers": "0.5.23",
55
- "@entifix/transactions": "0.1.4",
56
- "@entifix/core": "0.1.4",
57
- "@entifix/business": "0.1.4"
55
+ "@entifix/business": "0.2.0",
56
+ "@entifix/transactions": "0.2.0",
57
+ "@entifix/core": "0.2.0"
58
58
  },
59
59
  "devDependencies": {
60
- "effect": "3.22.2",
61
- "@entifix/testing-unit": "0.1.4"
60
+ "effect": "4.0.5",
61
+ "@entifix/testing-unit": "0.2.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "effect": ">=3.22.2 <4"
64
+ "effect": "^4.0.5"
65
65
  }
66
66
  }