@entifix/rest 0.9.0 → 0.10.1

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.
Files changed (24) hide show
  1. package/dist/adapters/entity-metadata/make-entity-metadata-source/make-entity-metadata-source.d.ts.map +1 -1
  2. package/dist/adapters/entity-metadata/make-entity-metadata-source/make-entity-metadata-source.js +6 -9
  3. package/dist/adapters/entity-metadata/make-entity-metadata-source/make-entity-metadata-source.js.map +1 -1
  4. package/dist/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.d.ts +1 -1
  5. package/dist/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.d.ts.map +1 -1
  6. package/dist/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.js +2 -4
  7. package/dist/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.js.map +1 -1
  8. package/dist/adapters/entity-rest/build-entity-rest-adapter-facets/build-entity-rest-adapter-facets.d.ts +1 -1
  9. package/dist/adapters/entity-rest/build-entity-rest-adapter-facets/build-entity-rest-adapter-facets.d.ts.map +1 -1
  10. package/dist/adapters/entity-rest/build-entity-rest-adapter-get/build-entity-rest-adapter-get.d.ts +1 -1
  11. package/dist/adapters/entity-rest/build-entity-rest-adapter-get/build-entity-rest-adapter-get.d.ts.map +1 -1
  12. package/dist/adapters/entity-rest/build-entity-rest-adapter-load/build-entity-rest-adapter-load.d.ts +1 -1
  13. package/dist/adapters/entity-rest/build-entity-rest-adapter-load/build-entity-rest-adapter-load.d.ts.map +1 -1
  14. package/dist/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.d.ts +1 -1
  15. package/dist/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.d.ts.map +1 -1
  16. package/dist/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.d.ts +0 -17
  17. package/dist/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.d.ts.map +1 -1
  18. package/dist/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.js +8 -5
  19. package/dist/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.js.map +1 -1
  20. package/dist/clients/fetch/fetch-client.d.ts +2 -2
  21. package/dist/clients/fetch/fetch-client.d.ts.map +1 -1
  22. package/dist/clients/fetch/fetch-client.js +59 -29
  23. package/dist/clients/fetch/fetch-client.js.map +1 -1
  24. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"make-entity-metadata-source.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-metadata/make-entity-metadata-source/make-entity-metadata-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EAG1B,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;OAQG;IACH,GAAG,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAEtC,2BAA2B,KAAG,oBAgD/B,CAAC"}
1
+ {"version":3,"file":"make-entity-metadata-source.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-metadata/make-entity-metadata-source/make-entity-metadata-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,oBAAoB,EAK1B,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;OAQG;IACH,GAAG,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAEtC,2BAA2B,KAAG,oBAwC/B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { EntifixConnError, envelopeEntityName, readEntityMetadataEnvelope } from '@entifix/core';
1
+ import { decodeProblem, envelopeEntityName, ProtocolFailure, readEntityMetadataEnvelope, Unavailable } from '@entifix/core';
2
2
  import { Effect } from 'effect';
3
3
  /**
4
4
  * Fetches an entity's {@link EntityMetadataDocument} over HTTP.
@@ -17,8 +17,8 @@ import { Effect } from 'effect';
17
17
  Accept: 'application/json'
18
18
  }
19
19
  }),
20
- catch: (error)=>new EntifixConnError(`Metadata request for "${name}" failed`, error, {
21
- entity: name
20
+ catch: ()=>new Unavailable({
21
+ dependency: name
22
22
  })
23
23
  });
24
24
  if (!response.ok) {
@@ -26,15 +26,12 @@ import { Effect } from 'effect';
26
26
  // readable, or not hosted" — the endpoint refuses to distinguish the
27
27
  // two so it cannot be walked to enumerate the model. Either way the
28
28
  // caller has no affordances, so it is an error, not an empty document.
29
- return yield* Effect.fail(new EntifixConnError(`Metadata request for "${name}" failed with status ${response.status}`, undefined, {
30
- entity: name,
31
- status: response.status
32
- }));
29
+ return yield* Effect.fail(decodeProblem((yield* Effect.promise(()=>response.json().catch(()=>undefined))), response.status));
33
30
  }
34
31
  const body = yield* Effect.tryPromise({
35
32
  try: ()=>response.json(),
36
- catch: (error)=>new EntifixConnError(`Metadata response for "${name}" was not JSON`, error, {
37
- entity: name
33
+ catch: ()=>new ProtocolFailure({
34
+ reason: `metadata for "${name}" was not JSON`
38
35
  })
39
36
  });
40
37
  return yield* readEntityMetadataEnvelope(entityConstructor, body);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/adapters/entity-metadata/make-entity-metadata-source/make-entity-metadata-source.ts"],"sourcesContent":["import {\n EntifixConnError,\n type Entity,\n type EntityConstructor,\n type EntityMetadataDocument,\n type EntityMetadataSource,\n envelopeEntityName,\n readEntityMetadataEnvelope,\n} from '@entifix/core';\nimport { Effect } from 'effect';\n\nexport interface EntityMetadataSourceOptions {\n /**\n * Where this entity's document lives, given its envelope name.\n *\n * A builder rather than the adapters' `BuildEntityRestOptions`, because the\n * two consumers resolve their base differently: the catalog goes through\n * `buildEntityBaseUrl`'s config-driven `compose` mode, while a Next shell with\n * hand-written same-origin routes has no adapters context at all. Both can\n * write one arrow function.\n */\n url: (entityName: string) => string;\n}\n\n/**\n * Fetches an entity's {@link EntityMetadataDocument} over HTTP.\n *\n * The response is permission-filtered by the service against the *verified*\n * principal, so nothing here re-checks anything: this reads what the caller was\n * told they may do. Cookies ride along by `fetch`'s same-origin default, which\n * is what carries the session on a Next shell's own `/api` route.\n */\nexport const makeEntityMetadataSource = ({\n url,\n}: EntityMetadataSourceOptions): EntityMetadataSource => ({\n fetchMetadata: <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n ): Promise<EntityMetadataDocument> => {\n const name = envelopeEntityName(entityConstructor);\n return Effect.runPromise(\n Effect.gen(function* () {\n const response = yield* Effect.tryPromise({\n try: () =>\n fetch(url(name), { headers: { Accept: 'application/json' } }),\n catch: error =>\n new EntifixConnError(\n `Metadata request for \"${name}\" failed`,\n error,\n {\n entity: name,\n },\n ),\n });\n\n if (!response.ok) {\n // A `404` here is deliberate on the service side and means \"not\n // readable, or not hosted\" — the endpoint refuses to distinguish the\n // two so it cannot be walked to enumerate the model. Either way the\n // caller has no affordances, so it is an error, not an empty document.\n return yield* Effect.fail(\n new EntifixConnError(\n `Metadata request for \"${name}\" failed with status ${response.status}`,\n undefined,\n { entity: name, status: response.status },\n ),\n );\n }\n\n const body = yield* Effect.tryPromise({\n try: () => response.json() as Promise<unknown>,\n catch: error =>\n new EntifixConnError(\n `Metadata response for \"${name}\" was not JSON`,\n error,\n { entity: name },\n ),\n });\n\n return yield* readEntityMetadataEnvelope(entityConstructor, body);\n }),\n );\n },\n});\n"],"names":["EntifixConnError","envelopeEntityName","readEntityMetadataEnvelope","Effect","makeEntityMetadataSource","url","fetchMetadata","entityConstructor","name","runPromise","gen","response","tryPromise","try","fetch","headers","Accept","catch","error","entity","ok","fail","status","undefined","body","json"],"mappings":"AAAA,SACEA,gBAAgB,EAKhBC,kBAAkB,EAClBC,0BAA0B,QACrB,gBAAgB;AACvB,SAASC,MAAM,QAAQ,SAAS;AAehC;;;;;;;CAOC,GACD,OAAO,MAAMC,2BAA2B,CAAC,EACvCC,GAAG,EACyB,GAA4B,CAAA;QACxDC,eAAe,CACbC;YAEA,MAAMC,OAAOP,mBAAmBM;YAChC,OAAOJ,OAAOM,UAAU,CACtBN,OAAOO,GAAG,CAAC;gBACT,MAAMC,WAAW,OAAOR,OAAOS,UAAU,CAAC;oBACxCC,KAAK,IACHC,MAAMT,IAAIG,OAAO;4BAAEO,SAAS;gCAAEC,QAAQ;4BAAmB;wBAAE;oBAC7DC,OAAOC,CAAAA,QACL,IAAIlB,iBACF,CAAC,sBAAsB,EAAEQ,KAAK,QAAQ,CAAC,EACvCU,OACA;4BACEC,QAAQX;wBACV;gBAEN;gBAEA,IAAI,CAACG,SAASS,EAAE,EAAE;oBAChB,gEAAgE;oBAChE,qEAAqE;oBACrE,oEAAoE;oBACpE,uEAAuE;oBACvE,OAAO,OAAOjB,OAAOkB,IAAI,CACvB,IAAIrB,iBACF,CAAC,sBAAsB,EAAEQ,KAAK,qBAAqB,EAAEG,SAASW,MAAM,EAAE,EACtEC,WACA;wBAAEJ,QAAQX;wBAAMc,QAAQX,SAASW,MAAM;oBAAC;gBAG9C;gBAEA,MAAME,OAAO,OAAOrB,OAAOS,UAAU,CAAC;oBACpCC,KAAK,IAAMF,SAASc,IAAI;oBACxBR,OAAOC,CAAAA,QACL,IAAIlB,iBACF,CAAC,uBAAuB,EAAEQ,KAAK,cAAc,CAAC,EAC9CU,OACA;4BAAEC,QAAQX;wBAAK;gBAErB;gBAEA,OAAO,OAAON,2BAA2BK,mBAAmBiB;YAC9D;QAEJ;IACF,CAAA,EAAG"}
1
+ {"version":3,"sources":["../../../../src/adapters/entity-metadata/make-entity-metadata-source/make-entity-metadata-source.ts"],"sourcesContent":["import {\n decodeProblem,\n type Entity,\n type EntityConstructor,\n type EntityMetadataDocument,\n type EntityMetadataSource,\n envelopeEntityName,\n ProtocolFailure,\n readEntityMetadataEnvelope,\n Unavailable,\n} from '@entifix/core';\nimport { Effect } from 'effect';\n\nexport interface EntityMetadataSourceOptions {\n /**\n * Where this entity's document lives, given its envelope name.\n *\n * A builder rather than the adapters' `BuildEntityRestOptions`, because the\n * two consumers resolve their base differently: the catalog goes through\n * `buildEntityBaseUrl`'s config-driven `compose` mode, while a Next shell with\n * hand-written same-origin routes has no adapters context at all. Both can\n * write one arrow function.\n */\n url: (entityName: string) => string;\n}\n\n/**\n * Fetches an entity's {@link EntityMetadataDocument} over HTTP.\n *\n * The response is permission-filtered by the service against the *verified*\n * principal, so nothing here re-checks anything: this reads what the caller was\n * told they may do. Cookies ride along by `fetch`'s same-origin default, which\n * is what carries the session on a Next shell's own `/api` route.\n */\nexport const makeEntityMetadataSource = ({\n url,\n}: EntityMetadataSourceOptions): EntityMetadataSource => ({\n fetchMetadata: <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n ): Promise<EntityMetadataDocument> => {\n const name = envelopeEntityName(entityConstructor);\n return Effect.runPromise(\n Effect.gen(function* () {\n const response = yield* Effect.tryPromise({\n try: () =>\n fetch(url(name), { headers: { Accept: 'application/json' } }),\n catch: () => new Unavailable({ dependency: name }),\n });\n\n if (!response.ok) {\n // A `404` here is deliberate on the service side and means \"not\n // readable, or not hosted\" — the endpoint refuses to distinguish the\n // two so it cannot be walked to enumerate the model. Either way the\n // caller has no affordances, so it is an error, not an empty document.\n return yield* Effect.fail(\n decodeProblem(\n yield* Effect.promise(() =>\n response.json().catch(() => undefined),\n ),\n response.status,\n ),\n );\n }\n\n const body = yield* Effect.tryPromise({\n try: () => response.json() as Promise<unknown>,\n catch: () =>\n new ProtocolFailure({\n reason: `metadata for \"${name}\" was not JSON`,\n }),\n });\n\n return yield* readEntityMetadataEnvelope(entityConstructor, body);\n }),\n );\n },\n});\n"],"names":["decodeProblem","envelopeEntityName","ProtocolFailure","readEntityMetadataEnvelope","Unavailable","Effect","makeEntityMetadataSource","url","fetchMetadata","entityConstructor","name","runPromise","gen","response","tryPromise","try","fetch","headers","Accept","catch","dependency","ok","fail","promise","json","undefined","status","body","reason"],"mappings":"AAAA,SACEA,aAAa,EAKbC,kBAAkB,EAClBC,eAAe,EACfC,0BAA0B,EAC1BC,WAAW,QACN,gBAAgB;AACvB,SAASC,MAAM,QAAQ,SAAS;AAehC;;;;;;;CAOC,GACD,OAAO,MAAMC,2BAA2B,CAAC,EACvCC,GAAG,EACyB,GAA4B,CAAA;QACxDC,eAAe,CACbC;YAEA,MAAMC,OAAOT,mBAAmBQ;YAChC,OAAOJ,OAAOM,UAAU,CACtBN,OAAOO,GAAG,CAAC;gBACT,MAAMC,WAAW,OAAOR,OAAOS,UAAU,CAAC;oBACxCC,KAAK,IACHC,MAAMT,IAAIG,OAAO;4BAAEO,SAAS;gCAAEC,QAAQ;4BAAmB;wBAAE;oBAC7DC,OAAO,IAAM,IAAIf,YAAY;4BAAEgB,YAAYV;wBAAK;gBAClD;gBAEA,IAAI,CAACG,SAASQ,EAAE,EAAE;oBAChB,gEAAgE;oBAChE,qEAAqE;oBACrE,oEAAoE;oBACpE,uEAAuE;oBACvE,OAAO,OAAOhB,OAAOiB,IAAI,CACvBtB,cACE,CAAA,OAAOK,OAAOkB,OAAO,CAAC,IACpBV,SAASW,IAAI,GAAGL,KAAK,CAAC,IAAMM,WAC9B,GACAZ,SAASa,MAAM;gBAGrB;gBAEA,MAAMC,OAAO,OAAOtB,OAAOS,UAAU,CAAC;oBACpCC,KAAK,IAAMF,SAASW,IAAI;oBACxBL,OAAO,IACL,IAAIjB,gBAAgB;4BAClB0B,QAAQ,CAAC,cAAc,EAAElB,KAAK,cAAc,CAAC;wBAC/C;gBACJ;gBAEA,OAAO,OAAOP,2BAA2BM,mBAAmBkB;YAC9D;QAEJ;IACF,CAAA,EAAG"}
@@ -8,5 +8,5 @@ import { BuildEntityRestOptions } from '../types.js';
8
8
  * envelope rather than a bare `204`: the shared fetch client always parses the
9
9
  * response as JSON, and an empty body would fail that parse.
10
10
  */
11
- export declare const buildEntityRestAdapterDelete: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => <TEntity_1 extends Entity>(entityOrId: EntityId | TEntity_1) => Effect.Effect<undefined, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixConnError, never>;
11
+ export declare const buildEntityRestAdapterDelete: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => <TEntity_1 extends Entity>(entityOrId: EntityId | TEntity_1) => Effect.Effect<undefined, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixFailure<string, string, import("@entifix/core").FailureCategory>, never>;
12
12
  //# sourceMappingURL=build-entity-rest-adapter-delete.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-entity-rest-adapter-delete.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EACN,iBAAiB,EACjB,QAAQ,EAET,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AASrD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACtC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,MAErD,SAAO,SAAS,MAAM,EAAE,YAAY,QAAQ,GAAG,SAAO,0HAyBnD,CAAC"}
1
+ {"version":3,"file":"build-entity-rest-adapter-delete.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,QAAQ,EAGT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AASrD;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GACtC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,MAErD,SAAO,SAAS,MAAM,EAAE,YAAY,QAAQ,GAAG,SAAO,iLAmBnD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { EntifixLogicError, extractMetaEntity } from '@entifix/core';
1
+ import { extractMetaEntity, Internal } from '@entifix/core';
2
2
  import { Effect } from 'effect';
3
3
  import { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';
4
4
  import { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-rest-adapter-mixins/index.js';
@@ -16,9 +16,7 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-r
16
16
  const metaEntity = extractMetaEntity(entityConstructor);
17
17
  const id = toEntityId(entityOrId);
18
18
  if (id == null) {
19
- return yield* Effect.fail(new EntifixLogicError(`Cannot delete a ${entityConstructor.name} without an id`, undefined, {
20
- entity: entityConstructor.name
21
- }));
19
+ return yield* Effect.fail(new Internal());
22
20
  }
23
21
  const url = yield* adapterMixins.buildEntityBaseUrl(configuration, {
24
22
  uriConfig
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.ts"],"sourcesContent":["import {\n EntifixLogicError,\n Entity,\n EntityConstructor,\n EntityId,\n extractMetaEntity,\n} from '@entifix/core';\nimport { Effect } from 'effect';\n\nimport { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';\nimport { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-rest-adapter-mixins/index.js';\nimport { BuildEntityRestOptions } from '../types.js';\n\n/** Accepts either an id or a whole entity, mirroring the repository contract. */\nfunction toEntityId(entityOrId: EntityId | Entity): EntityId {\n return entityOrId != null && typeof entityOrId === 'object'\n ? (entityOrId as Entity).id\n : (entityOrId as EntityId);\n}\n\n/**\n * Deletes an entity over HTTP.\n *\n * The response body is discarded, but the service still answers with an\n * envelope rather than a bare `204`: the shared fetch client always parses the\n * response as JSON, and an empty body would fail that parse.\n */\nexport const buildEntityRestAdapterDelete =\n <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n { uriConfig, configuration }: BuildEntityRestOptions,\n ) =>\n <TEntity extends Entity>(entityOrId: EntityId | TEntity) =>\n Effect.gen(function* () {\n const metaEntity = extractMetaEntity(entityConstructor);\n const id = toEntityId(entityOrId);\n\n if (id == null) {\n return yield* Effect.fail(\n new EntifixLogicError(\n `Cannot delete a ${entityConstructor.name} without an id`,\n undefined,\n { entity: entityConstructor.name },\n ),\n );\n }\n\n const url = yield* adapterMixins.buildEntityBaseUrl(\n configuration,\n { uriConfig },\n metaEntity.key ?? metaEntity.name,\n String(id),\n );\n\n yield* performHttpRequestThroughFetch(\n adapterMixins.buildEntityRequest({ method: 'DELETE', url }),\n );\n });\n"],"names":["EntifixLogicError","extractMetaEntity","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","toEntityId","entityOrId","id","buildEntityRestAdapterDelete","entityConstructor","uriConfig","configuration","gen","metaEntity","fail","name","undefined","entity","url","buildEntityBaseUrl","key","String","buildEntityRequest","method"],"mappings":"AAAA,SACEA,iBAAiB,EAIjBC,iBAAiB,QACZ,gBAAgB;AACvB,SAASC,MAAM,QAAQ,SAAS;AAEhC,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,gCAAgCC,aAAa,QAAQ,+CAA+C;AAG7G,+EAA+E,GAC/E,SAASC,WAAWC,UAA6B;IAC/C,OAAOA,cAAc,QAAQ,OAAOA,eAAe,WAC/C,AAACA,WAAsBC,EAAE,GACxBD;AACP;AAEA;;;;;;CAMC,GACD,OAAO,MAAME,+BACX,CACEC,mBACA,EAAEC,SAAS,EAAEC,aAAa,EAA0B,GAEtD,CAAyBL,aACvBL,OAAOW,GAAG,CAAC;gBAiBPC;YAhBF,MAAMA,aAAab,kBAAkBS;YACrC,MAAMF,KAAKF,WAAWC;YAEtB,IAAIC,MAAM,MAAM;gBACd,OAAO,OAAON,OAAOa,IAAI,CACvB,IAAIf,kBACF,CAAC,gBAAgB,EAAEU,kBAAkBM,IAAI,CAAC,cAAc,CAAC,EACzDC,WACA;oBAAEC,QAAQR,kBAAkBM,IAAI;gBAAC;YAGvC;YAEA,MAAMG,MAAM,OAAOd,cAAce,kBAAkB,CACjDR,eACA;gBAAED;YAAU,IACZG,kBAAAA,WAAWO,GAAG,YAAdP,kBAAkBA,WAAWE,IAAI,EACjCM,OAAOd;YAGT,OAAOL,+BACLE,cAAckB,kBAAkB,CAAC;gBAAEC,QAAQ;gBAAUL;YAAI;QAE7D,GAAG"}
1
+ {"version":3,"sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.ts"],"sourcesContent":["import {\n Entity,\n EntityConstructor,\n EntityId,\n extractMetaEntity,\n Internal,\n} from '@entifix/core';\nimport { Effect } from 'effect';\n\nimport { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';\nimport { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-rest-adapter-mixins/index.js';\nimport { BuildEntityRestOptions } from '../types.js';\n\n/** Accepts either an id or a whole entity, mirroring the repository contract. */\nfunction toEntityId(entityOrId: EntityId | Entity): EntityId {\n return entityOrId != null && typeof entityOrId === 'object'\n ? (entityOrId as Entity).id\n : (entityOrId as EntityId);\n}\n\n/**\n * Deletes an entity over HTTP.\n *\n * The response body is discarded, but the service still answers with an\n * envelope rather than a bare `204`: the shared fetch client always parses the\n * response as JSON, and an empty body would fail that parse.\n */\nexport const buildEntityRestAdapterDelete =\n <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n { uriConfig, configuration }: BuildEntityRestOptions,\n ) =>\n <TEntity extends Entity>(entityOrId: EntityId | TEntity) =>\n Effect.gen(function* () {\n const metaEntity = extractMetaEntity(entityConstructor);\n const id = toEntityId(entityOrId);\n\n if (id == null) {\n return yield* Effect.fail(new Internal());\n }\n\n const url = yield* adapterMixins.buildEntityBaseUrl(\n configuration,\n { uriConfig },\n metaEntity.key ?? metaEntity.name,\n String(id),\n );\n\n yield* performHttpRequestThroughFetch(\n adapterMixins.buildEntityRequest({ method: 'DELETE', url }),\n );\n });\n"],"names":["extractMetaEntity","Internal","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","toEntityId","entityOrId","id","buildEntityRestAdapterDelete","entityConstructor","uriConfig","configuration","gen","metaEntity","fail","url","buildEntityBaseUrl","key","name","String","buildEntityRequest","method"],"mappings":"AAAA,SAIEA,iBAAiB,EACjBC,QAAQ,QACH,gBAAgB;AACvB,SAASC,MAAM,QAAQ,SAAS;AAEhC,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,gCAAgCC,aAAa,QAAQ,+CAA+C;AAG7G,+EAA+E,GAC/E,SAASC,WAAWC,UAA6B;IAC/C,OAAOA,cAAc,QAAQ,OAAOA,eAAe,WAC/C,AAACA,WAAsBC,EAAE,GACxBD;AACP;AAEA;;;;;;CAMC,GACD,OAAO,MAAME,+BACX,CACEC,mBACA,EAAEC,SAAS,EAAEC,aAAa,EAA0B,GAEtD,CAAyBL,aACvBL,OAAOW,GAAG,CAAC;gBAWPC;YAVF,MAAMA,aAAad,kBAAkBU;YACrC,MAAMF,KAAKF,WAAWC;YAEtB,IAAIC,MAAM,MAAM;gBACd,OAAO,OAAON,OAAOa,IAAI,CAAC,IAAId;YAChC;YAEA,MAAMe,MAAM,OAAOX,cAAcY,kBAAkB,CACjDL,eACA;gBAAED;YAAU,IACZG,kBAAAA,WAAWI,GAAG,YAAdJ,kBAAkBA,WAAWK,IAAI,EACjCC,OAAOZ;YAGT,OAAOL,+BACLE,cAAcgB,kBAAkB,CAAC;gBAAEC,QAAQ;gBAAUN;YAAI;QAE7D,GAAG"}
@@ -7,5 +7,5 @@ import { BuildEntityRestOptions } from '../types.js';
7
7
  * the same query protocol, so what this composes is what the service parses
8
8
  * back. The caller binds it to the port, as it binds `load` to the repository.
9
9
  */
10
- export declare const buildEntityRestAdapterFacets: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => <T extends Entity>(queries: readonly EntityFacetQuery<T>[]) => Effect.Effect<Readonly<Record<string, readonly import("@entifix/core").EntityFacetValue[]>>, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixConnError, never>;
10
+ export declare const buildEntityRestAdapterFacets: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => <T extends Entity>(queries: readonly EntityFacetQuery<T>[]) => Effect.Effect<Readonly<Record<string, readonly import("@entifix/core").EntityFacetValue[]>>, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixFailure<string, string, import("@entifix/core").FailureCategory>, never>;
11
11
  //# sourceMappingURL=build-entity-rest-adapter-facets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-entity-rest-adapter-facets.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-facets/build-entity-rest-adapter-facets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EAItB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GACtC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,MAErD,CAAC,SAAS,MAAM,EAAE,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,8LAoBtD,CAAC"}
1
+ {"version":3,"file":"build-entity-rest-adapter-facets.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-facets/build-entity-rest-adapter-facets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EAItB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,GACtC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,MAErD,CAAC,SAAS,MAAM,EAAE,SAAS,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,qPAoBtD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Entity, EntityConstructor } from '@entifix/core';
2
2
  import { Effect } from 'effect';
3
3
  import { BuildEntityRestOptions } from '../types.js';
4
- export declare const buildEntityRestAdapterGet: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => <TEntity_1 extends Entity>(entityId: string) => Effect.Effect<TEntity_1, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixConnError, never>;
4
+ export declare const buildEntityRestAdapterGet: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => <TEntity_1 extends Entity>(entityId: string) => Effect.Effect<TEntity_1, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixFailure<string, string, import("@entifix/core").FailureCategory>, never>;
5
5
  //# sourceMappingURL=build-entity-rest-adapter-get.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-entity-rest-adapter-get.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-get/build-entity-rest-adapter-get.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EAGlB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,yBAAyB,GACnC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,MAErD,SAAO,SAAS,MAAM,EAAE,UAAU,MAAM,0HAoBrC,CAAC"}
1
+ {"version":3,"file":"build-entity-rest-adapter-get.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-get/build-entity-rest-adapter-get.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EAGlB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,yBAAyB,GACnC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,MAErD,SAAO,SAAS,MAAM,EAAE,UAAU,MAAM,iLAoBrC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Entity, EntityConstructor, EntityLoadRequest, EntityPage } from '@entifix/core';
2
2
  import { Effect } from 'effect';
3
3
  import { BuildEntityRestOptions } from '../types.js';
4
- export declare const buildEntityRestAdapterLoad: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => <TEntity_1 extends Entity>(request: EntityLoadRequest<TEntity_1>) => Effect.Effect<EntityPage<TEntity_1>, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixConnError, never>;
4
+ export declare const buildEntityRestAdapterLoad: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => <TEntity_1 extends Entity>(request: EntityLoadRequest<TEntity_1>) => Effect.Effect<EntityPage<TEntity_1>, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixFailure<string, string, import("@entifix/core").FailureCategory>, never>;
5
5
  //# sourceMappingURL=build-entity-rest-adapter-load.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-entity-rest-adapter-load.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-load/build-entity-rest-adapter-load.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAIX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,0BAA0B,GACpC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,MAErD,SAAO,SAAS,MAAM,EAAE,SAAS,iBAAiB,CAAC,SAAO,CAAC,sIA8BxD,CAAC"}
1
+ {"version":3,"file":"build-entity-rest-adapter-load.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-load/build-entity-rest-adapter-load.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EAIX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,0BAA0B,GACpC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,MAErD,SAAO,SAAS,MAAM,EAAE,SAAS,iBAAiB,CAAC,SAAO,CAAC,6LA8BxD,CAAC"}
@@ -20,5 +20,5 @@ import { BuildEntityRestOptions } from '../types.js';
20
20
  * adapter parsed the `202` as an entity envelope, failed, and reported an error
21
21
  * for a create that was in fact about to succeed.
22
22
  */
23
- export declare const buildEntityRestAdapterSave: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, create, configuration }: BuildEntityRestOptions) => <TInput extends Entity>(entity: TInput) => Effect.Effect<TInput, import("@entifix/core").EntifixError, never>;
23
+ export declare const buildEntityRestAdapterSave: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, create, configuration }: BuildEntityRestOptions) => <TInput extends Entity>(entity: TInput) => Effect.Effect<TInput, import("@entifix/core").EntifixBuildError | import("@entifix/core").EntifixFailure<string, string, import("@entifix/core").FailureCategory>, never>;
24
24
  //# sourceMappingURL=build-entity-rest-adapter-save.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-entity-rest-adapter-save.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EAKlB,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAIxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,GACpC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,sCAAiD,sBAAsB,MAKxE,MAAM,SAAS,MAAM,EAAE,QAAQ,MAAM,uEAiFlC,CAAC"}
1
+ {"version":3,"file":"build-entity-rest-adapter-save.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,iBAAiB,EAKlB,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAIxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,GACpC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,sCAAiD,sBAAsB,MAKxE,MAAM,SAAS,MAAM,EAAE,QAAQ,MAAM,8KAiFlC,CAAC"}
@@ -1,21 +1,4 @@
1
1
  import { type TransactionStatusReader } from '@entifix/transactions';
2
2
  import type { BuildEntityRestOptions } from '../../entity-rest/types.js';
3
- /**
4
- * Reads one transaction's record over HTTP, for a browser reconciling a write it
5
- * started.
6
- *
7
- * ⚠️ **A `404` answers `undefined`, and that is not a failure.** `accepted`
8
- * reaches the tracker over the bus, so with the broker down the entity write
9
- * commits — the outbox is in the same Mongo transaction — while no event is ever
10
- * published and the tracker holds no record at all. A caller that treated this
11
- * as terminal would un-render a healthy write during a broker outage, which is
12
- * the moment nobody can tell a UI bug from an outage. The route also
13
- * answers `404` for another tenant's record, deliberately, so it cannot be
14
- * walked to probe ids that are also primary keys — indistinguishable here, and
15
- * correctly so: neither is a record this caller may reconcile against.
16
- *
17
- * Every other status stays an error, so an unreachable service is not quietly
18
- * read as "no such transaction".
19
- */
20
3
  export declare const buildTransactionStatusReader: (options: Pick<BuildEntityRestOptions, "uriConfig" | "configuration">) => TransactionStatusReader;
21
4
  //# sourceMappingURL=build-transaction-status-reader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-transaction-status-reader.d.ts","sourceRoot":"","sources":["../../../../src/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAUzE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,4BAA4B,GACvC,SAAS,IAAI,CAAC,sBAAsB,EAAE,WAAW,GAAG,eAAe,CAAC,KACnE,uBA4BF,CAAC"}
1
+ {"version":3,"file":"build-transaction-status-reader.d.ts","sourceRoot":"","sources":["../../../../src/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAqCzE,eAAO,MAAM,4BAA4B,GACvC,SAAS,IAAI,CAAC,sBAAsB,EAAE,WAAW,GAAG,eAAe,CAAC,KACnE,uBA0BF,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { isTag } from '@entifix/core';
1
2
  import { readTransactionRecordEnvelope } from '@entifix/transactions';
2
3
  import { Effect } from 'effect';
3
4
  import { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';
@@ -24,7 +25,12 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../../entity-rest
24
25
  *
25
26
  * Every other status stays an error, so an unreachable service is not quietly
26
27
  * read as "no such transaction".
27
- */ export const buildTransactionStatusReader = (options)=>{
28
+ */ /**
29
+ * A `404`, however it arrived: a tracker that answers a problem body says
30
+ * `NotFound`; one that answers no body at all is a protocol failure that
31
+ * still carries the status.
32
+ */ const isNotFound = (error)=>isTag('NotFound')(error) || isTag('ProtocolFailure')(error) && error.upstreamStatus === 404;
33
+ export const buildTransactionStatusReader = (options)=>{
28
34
  const { configuration } = options;
29
35
  return {
30
36
  read: (transactionId)=>Effect.gen(function*() {
@@ -34,10 +40,7 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../../entity-rest
34
40
  url
35
41
  }));
36
42
  return yield* readTransactionRecordEnvelope(response.body);
37
- }).pipe(Effect.catch((error)=>{
38
- var _error_details;
39
- return ((_error_details = error.details) == null ? void 0 : _error_details['status']) === 404 ? Effect.succeed(undefined) : Effect.fail(error);
40
- }))
43
+ }).pipe(Effect.catch((error)=>isNotFound(error) ? Effect.succeed(undefined) : Effect.fail(error)))
41
44
  };
42
45
  };
43
46
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.ts"],"sourcesContent":["import 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. 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: Pick<BuildEntityRestOptions, 'uriConfig' | 'configuration'>,\n): TransactionStatusReader => {\n const { configuration } = options;\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 configuration,\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":["readTransactionRecordEnvelope","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","TRANSACTION_PATH","buildTransactionStatusReader","options","configuration","read","transactionId","gen","url","buildEntityBaseUrl","response","buildEntityRequest","method","body","pipe","catch","error","details","succeed","undefined","fail"],"mappings":"AACA,SACEA,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;IAEA,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,OAAO;QACLE,MAAM,CACJC,gBAEAT,OAAOU,GAAG,CAAC;gBACT,MAAMC,MAAM,OAAOR,cAAcS,kBAAkB,CACjDL,eACAD,SACAF,kBACAK;gBAGF,MAAMI,WAAW,OAAOZ,+BACtBE,cAAcW,kBAAkB,CAAC;oBAAEC,QAAQ;oBAAOJ;gBAAI;gBAGxD,OAAO,OAAOZ,8BAA8Bc,SAASG,IAAI;YAC3D,GAAGC,IAAI,CACLjB,OAAOkB,KAAK,CAACC,CAAAA;oBACXA;uBAAAA,EAAAA,iBAAAA,MAAMC,OAAO,qBAAbD,cAAe,CAAC,SAAS,MAAK,MAC1BnB,OAAOqB,OAAO,CAACC,aACftB,OAAOuB,IAAI,CAACJ;;IAGxB;AACF,EAAE"}
1
+ {"version":3,"sources":["../../../../src/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.ts"],"sourcesContent":["import { isTag, type TransitionalFailure } 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. 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 */\n/**\n * A `404`, however it arrived: a tracker that answers a problem body says\n * `NotFound`; one that answers no body at all is a protocol failure that\n * still carries the status.\n */\nconst isNotFound = (error: unknown): boolean =>\n isTag('NotFound')(error) ||\n (isTag('ProtocolFailure')(error) &&\n (error as { readonly upstreamStatus?: unknown }).upstreamStatus === 404);\n\nexport const buildTransactionStatusReader = (\n options: Pick<BuildEntityRestOptions, 'uriConfig' | 'configuration'>,\n): TransactionStatusReader => {\n const { configuration } = options;\n\n return {\n read: (\n transactionId: string,\n ): Effect.Effect<TransactionRecord | undefined, TransitionalFailure> =>\n Effect.gen(function* () {\n const url = yield* adapterMixins.buildEntityBaseUrl(\n configuration,\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 isNotFound(error) ? Effect.succeed(undefined) : Effect.fail(error),\n ),\n ),\n };\n};\n"],"names":["isTag","readTransactionRecordEnvelope","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","TRANSACTION_PATH","isNotFound","error","upstreamStatus","buildTransactionStatusReader","options","configuration","read","transactionId","gen","url","buildEntityBaseUrl","response","buildEntityRequest","method","body","pipe","catch","succeed","undefined","fail"],"mappings":"AAAA,SAASA,KAAK,QAAkC,gBAAgB;AAChE,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;;;;CAIC,GACD,MAAMC,aAAa,CAACC,QAClBR,MAAM,YAAYQ,UACjBR,MAAM,mBAAmBQ,UACxB,AAACA,MAAgDC,cAAc,KAAK;AAExE,OAAO,MAAMC,+BAA+B,CAC1CC;IAEA,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,OAAO;QACLE,MAAM,CACJC,gBAEAZ,OAAOa,GAAG,CAAC;gBACT,MAAMC,MAAM,OAAOX,cAAcY,kBAAkB,CACjDL,eACAD,SACAL,kBACAQ;gBAGF,MAAMI,WAAW,OAAOf,+BACtBE,cAAcc,kBAAkB,CAAC;oBAAEC,QAAQ;oBAAOJ;gBAAI;gBAGxD,OAAO,OAAOf,8BAA8BiB,SAASG,IAAI;YAC3D,GAAGC,IAAI,CACLpB,OAAOqB,KAAK,CAACf,CAAAA,QACXD,WAAWC,SAASN,OAAOsB,OAAO,CAACC,aAAavB,OAAOwB,IAAI,CAAClB;IAGpE;AACF,EAAE"}
@@ -1,5 +1,5 @@
1
- import { EntifixConnError } from '@entifix/core';
1
+ import { type EntifixFailure } from '@entifix/core';
2
2
  import { Effect } from 'effect';
3
3
  import { HttpRequest, HttpResponse } from '../types.js';
4
- export declare const performHttpRequestThroughFetch: <TResponseBody>(request: HttpRequest<unknown>) => Effect.Effect<HttpResponse<TResponseBody>, EntifixConnError, never>;
4
+ export declare const performHttpRequestThroughFetch: <TResponseBody>(request: HttpRequest<unknown>) => Effect.Effect<HttpResponse<TResponseBody>, EntifixFailure<string, string, import("@entifix/core").FailureCategory>, never>;
5
5
  //# sourceMappingURL=fetch-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch-client.d.ts","sourceRoot":"","sources":["../../../src/clients/fetch/fetch-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,eAAO,MAAM,8BAA8B,GAAI,aAAa,EAC1D,SAAS,WAAW,CAAC,OAAO,CAAC,wEAmE3B,CAAC"}
1
+ {"version":3,"file":"fetch-client.d.ts","sourceRoot":"","sources":["../../../src/clients/fetch/fetch-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EAMpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA6CxD,eAAO,MAAM,8BAA8B,GAAI,aAAa,EAC1D,SAAS,WAAW,CAAC,OAAO,CAAC,+HAuD3B,CAAC"}
@@ -1,44 +1,74 @@
1
1
  import { _ as _extends } from "@swc/helpers/_/_extends";
2
- import { EntifixConnError } from '@entifix/core';
2
+ import { currentRemainingMs, DEADLINE_HEADER, decodeProblem, Overloaded, PROBLEM_CONTENT_TYPE, ProtocolFailure, Timeout, Unavailable } from '@entifix/core';
3
3
  import { Effect } from 'effect';
4
+ /** The host a request went to, which is what a failure names as its dependency. */ const dependencyOf = (url)=>{
5
+ try {
6
+ return new URL(url).host;
7
+ } catch (unused) {
8
+ return url;
9
+ }
10
+ };
11
+ /**
12
+ * The failure a non-2xx answer carries. `Retry-After` in seconds is copied
13
+ * onto an `Overloaded` that did not say itself when to come back.
14
+ */ const failureOf = (response, request)=>Effect.gen(function*() {
15
+ var _response_headers_get;
16
+ const text = yield* Effect.promise(()=>response.text());
17
+ const isProblem = ((_response_headers_get = response.headers.get('content-type')) == null ? void 0 : _response_headers_get.startsWith(PROBLEM_CONTENT_TYPE)) === true;
18
+ if (!isProblem) return new ProtocolFailure({
19
+ reason: `${request.method} ${request.url} answered ${String(response.status)} without a problem body`,
20
+ upstreamStatus: response.status
21
+ });
22
+ const failure = decodeProblem(parseOr(text), response.status);
23
+ const retryAfter = Number(response.headers.get('retry-after'));
24
+ return failure._tag === 'Overloaded' && !('retryAfterSeconds' in failure) && Number.isFinite(retryAfter) && retryAfter > 0 ? new Overloaded({
25
+ retryAfterSeconds: retryAfter
26
+ }) : failure;
27
+ });
28
+ const parseOr = (text)=>{
29
+ try {
30
+ return JSON.parse(text);
31
+ } catch (unused) {
32
+ return undefined;
33
+ }
34
+ };
4
35
  export const performHttpRequestThroughFetch = (request)=>Effect.gen(function*() {
5
- // Perform the HTTP request using the Fetch API
36
+ // The caller's remaining budget travels on, minus what is already spent,
37
+ // and a budget already spent is not worth a round trip (ADR 0014).
38
+ const remaining = yield* currentRemainingMs;
39
+ if (remaining === 0) return yield* Effect.fail(new Timeout({
40
+ dependency: request.url
41
+ }));
42
+ // The signal is tied to this fiber: a caller that goes away interrupts it,
43
+ // and the request below is aborted rather than left to finish.
6
44
  const response = yield* Effect.tryPromise({
7
- try: ()=>fetch(request.url, {
45
+ try: (signal)=>fetch(request.url, {
8
46
  method: request.method,
9
- headers: request.headers,
10
- body: request.body ? JSON.stringify(request.body) : undefined
47
+ headers: _extends({}, request.headers, remaining === undefined ? {} : {
48
+ [DEADLINE_HEADER]: String(remaining)
49
+ }),
50
+ body: request.body ? JSON.stringify(request.body) : undefined,
51
+ signal
11
52
  }),
12
- catch: (error)=>new EntifixConnError(`HTTP request to ${request.url} failed`, error, {
13
- url: request.url,
14
- method: request.method
53
+ // Only reached without an answer: a network error or a refused
54
+ // connection. An interruption aborts through the signal instead.
55
+ catch: ()=>new Unavailable({
56
+ dependency: dependencyOf(request.url)
15
57
  })
16
58
  });
17
- // Check if the response is successful (status code 2xx)
59
+ // A failure answers as the failure that was sent: a problem body decodes
60
+ // into its registered class with its typed fields, so a business `409`
61
+ // reaches the browser as the refusal it is and never as a connection
62
+ // error. A body that is not a problem — a proxy's, a host route that still
63
+ // writes its own — decodes as `ProtocolFailure` carrying the status.
18
64
  if (!response.ok) {
19
- // Services answer a failure with `{ error, code, detail }`. Carrying the
20
- // `code` into `details` is what lets the browser render a translated
21
- // message instead of the service's English `error` string. A body that is
22
- // not JSON is not itself a failure — the status already is one.
23
- const failure = yield* Effect.promise(()=>response.json().then((parsed)=>parsed, ()=>({})));
24
- const code = failure['code'];
25
- yield* Effect.fail(new EntifixConnError(`HTTP request failed with status ${response.status}: ${response.statusText}`, undefined, _extends({
26
- status: response.status,
27
- statusText: response.statusText,
28
- url: request.url,
29
- method: request.method
30
- }, typeof code === 'string' ? {
31
- code
32
- } : {})));
65
+ return yield* Effect.fail((yield* failureOf(response, request)));
33
66
  }
34
- // Parse the response body as JSON. If parse fails, fail with an EntifixExternalError with details about the failure.
35
67
  const body = yield* Effect.tryPromise({
36
68
  try: ()=>response.json(),
37
- catch: (error)=>new EntifixConnError('Failed to parse response body as JSON', error, {
38
- url: request.url,
39
- method: request.method,
40
- status: response.status,
41
- statusText: response.statusText
69
+ catch: ()=>new ProtocolFailure({
70
+ reason: `${request.method} ${request.url} answered a body that is not JSON`,
71
+ upstreamStatus: response.status
42
72
  })
43
73
  });
44
74
  // Return the HttpResponse object
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/clients/fetch/fetch-client.ts"],"sourcesContent":["import { EntifixConnError } from '@entifix/core';\nimport { Effect } from 'effect';\n\nimport { HttpRequest, HttpResponse } from '../types.js';\n\nexport const performHttpRequestThroughFetch = <TResponseBody>(\n request: HttpRequest<unknown>,\n) =>\n Effect.gen(function* () {\n // Perform the HTTP request using the Fetch API\n const response = yield* Effect.tryPromise({\n try: () =>\n fetch(request.url, {\n method: request.method,\n headers: request.headers,\n body: request.body ? JSON.stringify(request.body) : undefined,\n }),\n catch: error =>\n new EntifixConnError(`HTTP request to ${request.url} failed`, error, {\n url: request.url,\n method: request.method,\n }),\n });\n\n // Check if the response is successful (status code 2xx)\n if (!response.ok) {\n // Services answer a failure with `{ error, code, detail }`. Carrying the\n // `code` into `details` is what lets the browser render a translated\n // message instead of the service's English `error` string. A body that is\n // not JSON is not itself a failure — the status already is one.\n const failure = yield* Effect.promise(() =>\n response.json().then(\n (parsed: unknown) => parsed as Record<string, unknown>,\n () => ({}) as Record<string, unknown>,\n ),\n );\n const code = failure['code'];\n\n yield* Effect.fail(\n new EntifixConnError(\n `HTTP request failed with status ${response.status}: ${response.statusText}`,\n undefined,\n {\n status: response.status,\n statusText: response.statusText,\n url: request.url,\n method: request.method,\n ...(typeof code === 'string' ? { code } : {}),\n },\n ),\n );\n }\n\n // Parse the response body as JSON. If parse fails, fail with an EntifixExternalError with details about the failure.\n const body = yield* Effect.tryPromise({\n try: () => response.json() as Promise<TResponseBody>,\n catch: error =>\n new EntifixConnError('Failed to parse response body as JSON', error, {\n url: request.url,\n method: request.method,\n status: response.status,\n statusText: response.statusText,\n }),\n });\n\n // Return the HttpResponse object\n const httpResponse: HttpResponse<TResponseBody> = {\n status: response.status,\n headers: Object.fromEntries(response.headers.entries()),\n body,\n };\n\n return httpResponse;\n });\n"],"names":["EntifixConnError","Effect","performHttpRequestThroughFetch","request","gen","response","tryPromise","try","fetch","url","method","headers","body","JSON","stringify","undefined","catch","error","ok","failure","promise","json","then","parsed","code","fail","status","statusText","httpResponse","Object","fromEntries","entries"],"mappings":";AAAA,SAASA,gBAAgB,QAAQ,gBAAgB;AACjD,SAASC,MAAM,QAAQ,SAAS;AAIhC,OAAO,MAAMC,iCAAiC,CAC5CC,UAEAF,OAAOG,GAAG,CAAC;QACT,+CAA+C;QAC/C,MAAMC,WAAW,OAAOJ,OAAOK,UAAU,CAAC;YACxCC,KAAK,IACHC,MAAML,QAAQM,GAAG,EAAE;oBACjBC,QAAQP,QAAQO,MAAM;oBACtBC,SAASR,QAAQQ,OAAO;oBACxBC,MAAMT,QAAQS,IAAI,GAAGC,KAAKC,SAAS,CAACX,QAAQS,IAAI,IAAIG;gBACtD;YACFC,OAAOC,CAAAA,QACL,IAAIjB,iBAAiB,CAAC,gBAAgB,EAAEG,QAAQM,GAAG,CAAC,OAAO,CAAC,EAAEQ,OAAO;oBACnER,KAAKN,QAAQM,GAAG;oBAChBC,QAAQP,QAAQO,MAAM;gBACxB;QACJ;QAEA,wDAAwD;QACxD,IAAI,CAACL,SAASa,EAAE,EAAE;YAChB,yEAAyE;YACzE,qEAAqE;YACrE,0EAA0E;YAC1E,gEAAgE;YAChE,MAAMC,UAAU,OAAOlB,OAAOmB,OAAO,CAAC,IACpCf,SAASgB,IAAI,GAAGC,IAAI,CAClB,CAACC,SAAoBA,QACrB,IAAO,CAAA,CAAC,CAAA;YAGZ,MAAMC,OAAOL,OAAO,CAAC,OAAO;YAE5B,OAAOlB,OAAOwB,IAAI,CAChB,IAAIzB,iBACF,CAAC,gCAAgC,EAAEK,SAASqB,MAAM,CAAC,EAAE,EAAErB,SAASsB,UAAU,EAAE,EAC5EZ,WACA;gBACEW,QAAQrB,SAASqB,MAAM;gBACvBC,YAAYtB,SAASsB,UAAU;gBAC/BlB,KAAKN,QAAQM,GAAG;gBAChBC,QAAQP,QAAQO,MAAM;eAClB,OAAOc,SAAS,WAAW;gBAAEA;YAAK,IAAI,CAAC;QAInD;QAEA,qHAAqH;QACrH,MAAMZ,OAAO,OAAOX,OAAOK,UAAU,CAAC;YACpCC,KAAK,IAAMF,SAASgB,IAAI;YACxBL,OAAOC,CAAAA,QACL,IAAIjB,iBAAiB,yCAAyCiB,OAAO;oBACnER,KAAKN,QAAQM,GAAG;oBAChBC,QAAQP,QAAQO,MAAM;oBACtBgB,QAAQrB,SAASqB,MAAM;oBACvBC,YAAYtB,SAASsB,UAAU;gBACjC;QACJ;QAEA,iCAAiC;QACjC,MAAMC,eAA4C;YAChDF,QAAQrB,SAASqB,MAAM;YACvBf,SAASkB,OAAOC,WAAW,CAACzB,SAASM,OAAO,CAACoB,OAAO;YACpDnB;QACF;QAEA,OAAOgB;IACT,GAAG"}
1
+ {"version":3,"sources":["../../../src/clients/fetch/fetch-client.ts"],"sourcesContent":["import {\n currentRemainingMs,\n DEADLINE_HEADER,\n decodeProblem,\n type EntifixFailure,\n Overloaded,\n PROBLEM_CONTENT_TYPE,\n ProtocolFailure,\n Timeout,\n Unavailable,\n} from '@entifix/core';\nimport { Effect } from 'effect';\n\nimport { HttpRequest, HttpResponse } from '../types.js';\n\n/** The host a request went to, which is what a failure names as its dependency. */\nconst dependencyOf = (url: string): string => {\n try {\n return new URL(url).host;\n } catch {\n return url;\n }\n};\n\n/**\n * The failure a non-2xx answer carries. `Retry-After` in seconds is copied\n * onto an `Overloaded` that did not say itself when to come back.\n */\nconst failureOf = (response: Response, request: HttpRequest<unknown>) =>\n Effect.gen(function* () {\n const text = yield* Effect.promise(() => response.text());\n const isProblem =\n response.headers.get('content-type')?.startsWith(PROBLEM_CONTENT_TYPE) ===\n true;\n if (!isProblem)\n return new ProtocolFailure({\n reason: `${request.method} ${request.url} answered ${String(response.status)} without a problem body`,\n upstreamStatus: response.status,\n }) as EntifixFailure;\n\n const failure = decodeProblem(parseOr(text), response.status);\n const retryAfter = Number(response.headers.get('retry-after'));\n return failure._tag === 'Overloaded' &&\n !('retryAfterSeconds' in failure) &&\n Number.isFinite(retryAfter) &&\n retryAfter > 0\n ? new Overloaded({ retryAfterSeconds: retryAfter })\n : failure;\n });\n\nconst parseOr = (text: string): unknown => {\n try {\n return JSON.parse(text) as unknown;\n } catch {\n return undefined;\n }\n};\n\nexport const performHttpRequestThroughFetch = <TResponseBody>(\n request: HttpRequest<unknown>,\n) =>\n Effect.gen(function* () {\n // The caller's remaining budget travels on, minus what is already spent,\n // and a budget already spent is not worth a round trip (ADR 0014).\n const remaining = yield* currentRemainingMs;\n if (remaining === 0)\n return yield* Effect.fail(new Timeout({ dependency: request.url }));\n\n // The signal is tied to this fiber: a caller that goes away interrupts it,\n // and the request below is aborted rather than left to finish.\n const response = yield* Effect.tryPromise({\n try: signal =>\n fetch(request.url, {\n method: request.method,\n headers: {\n ...request.headers,\n ...(remaining === undefined\n ? {}\n : { [DEADLINE_HEADER]: String(remaining) }),\n },\n body: request.body ? JSON.stringify(request.body) : undefined,\n signal,\n }),\n // Only reached without an answer: a network error or a refused\n // connection. An interruption aborts through the signal instead.\n catch: () => new Unavailable({ dependency: dependencyOf(request.url) }),\n });\n\n // A failure answers as the failure that was sent: a problem body decodes\n // into its registered class with its typed fields, so a business `409`\n // reaches the browser as the refusal it is and never as a connection\n // error. A body that is not a problem — a proxy's, a host route that still\n // writes its own — decodes as `ProtocolFailure` carrying the status.\n if (!response.ok) {\n return yield* Effect.fail(yield* failureOf(response, request));\n }\n\n const body = yield* Effect.tryPromise({\n try: () => response.json() as Promise<TResponseBody>,\n catch: () =>\n new ProtocolFailure({\n reason: `${request.method} ${request.url} answered a body that is not JSON`,\n upstreamStatus: response.status,\n }),\n });\n\n // Return the HttpResponse object\n const httpResponse: HttpResponse<TResponseBody> = {\n status: response.status,\n headers: Object.fromEntries(response.headers.entries()),\n body,\n };\n\n return httpResponse;\n });\n"],"names":["currentRemainingMs","DEADLINE_HEADER","decodeProblem","Overloaded","PROBLEM_CONTENT_TYPE","ProtocolFailure","Timeout","Unavailable","Effect","dependencyOf","url","URL","host","failureOf","response","request","gen","text","promise","isProblem","headers","get","startsWith","reason","method","String","status","upstreamStatus","failure","parseOr","retryAfter","Number","_tag","isFinite","retryAfterSeconds","JSON","parse","undefined","performHttpRequestThroughFetch","remaining","fail","dependency","tryPromise","try","signal","fetch","body","stringify","catch","ok","json","httpResponse","Object","fromEntries","entries"],"mappings":";AAAA,SACEA,kBAAkB,EAClBC,eAAe,EACfC,aAAa,EAEbC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfC,OAAO,EACPC,WAAW,QACN,gBAAgB;AACvB,SAASC,MAAM,QAAQ,SAAS;AAIhC,iFAAiF,GACjF,MAAMC,eAAe,CAACC;IACpB,IAAI;QACF,OAAO,IAAIC,IAAID,KAAKE,IAAI;IAC1B,EAAE,eAAM;QACN,OAAOF;IACT;AACF;AAEA;;;CAGC,GACD,MAAMG,YAAY,CAACC,UAAoBC,UACrCP,OAAOQ,GAAG,CAAC;YAGPF;QAFF,MAAMG,OAAO,OAAOT,OAAOU,OAAO,CAAC,IAAMJ,SAASG,IAAI;QACtD,MAAME,YACJL,EAAAA,wBAAAA,SAASM,OAAO,CAACC,GAAG,CAAC,oCAArBP,sBAAsCQ,UAAU,CAAClB,2BACjD;QACF,IAAI,CAACe,WACH,OAAO,IAAId,gBAAgB;YACzBkB,QAAQ,GAAGR,QAAQS,MAAM,CAAC,CAAC,EAAET,QAAQL,GAAG,CAAC,UAAU,EAAEe,OAAOX,SAASY,MAAM,EAAE,uBAAuB,CAAC;YACrGC,gBAAgBb,SAASY,MAAM;QACjC;QAEF,MAAME,UAAU1B,cAAc2B,QAAQZ,OAAOH,SAASY,MAAM;QAC5D,MAAMI,aAAaC,OAAOjB,SAASM,OAAO,CAACC,GAAG,CAAC;QAC/C,OAAOO,QAAQI,IAAI,KAAK,gBACtB,CAAE,CAAA,uBAAuBJ,OAAM,KAC/BG,OAAOE,QAAQ,CAACH,eAChBA,aAAa,IACX,IAAI3B,WAAW;YAAE+B,mBAAmBJ;QAAW,KAC/CF;IACN;AAEF,MAAMC,UAAU,CAACZ;IACf,IAAI;QACF,OAAOkB,KAAKC,KAAK,CAACnB;IACpB,EAAE,eAAM;QACN,OAAOoB;IACT;AACF;AAEA,OAAO,MAAMC,iCAAiC,CAC5CvB,UAEAP,OAAOQ,GAAG,CAAC;QACT,yEAAyE;QACzE,mEAAmE;QACnE,MAAMuB,YAAY,OAAOvC;QACzB,IAAIuC,cAAc,GAChB,OAAO,OAAO/B,OAAOgC,IAAI,CAAC,IAAIlC,QAAQ;YAAEmC,YAAY1B,QAAQL,GAAG;QAAC;QAElE,2EAA2E;QAC3E,+DAA+D;QAC/D,MAAMI,WAAW,OAAON,OAAOkC,UAAU,CAAC;YACxCC,KAAKC,CAAAA,SACHC,MAAM9B,QAAQL,GAAG,EAAE;oBACjBc,QAAQT,QAAQS,MAAM;oBACtBJ,SAAS,aACJL,QAAQK,OAAO,EACdmB,cAAcF,YACd,CAAC,IACD;wBAAE,CAACpC,gBAAgB,EAAEwB,OAAOc;oBAAW;oBAE7CO,MAAM/B,QAAQ+B,IAAI,GAAGX,KAAKY,SAAS,CAAChC,QAAQ+B,IAAI,IAAIT;oBACpDO;gBACF;YACF,+DAA+D;YAC/D,iEAAiE;YACjEI,OAAO,IAAM,IAAIzC,YAAY;oBAAEkC,YAAYhC,aAAaM,QAAQL,GAAG;gBAAE;QACvE;QAEA,yEAAyE;QACzE,uEAAuE;QACvE,qEAAqE;QACrE,2EAA2E;QAC3E,qEAAqE;QACrE,IAAI,CAACI,SAASmC,EAAE,EAAE;YAChB,OAAO,OAAOzC,OAAOgC,IAAI,CAAC,CAAA,OAAO3B,UAAUC,UAAUC,QAAO;QAC9D;QAEA,MAAM+B,OAAO,OAAOtC,OAAOkC,UAAU,CAAC;YACpCC,KAAK,IAAM7B,SAASoC,IAAI;YACxBF,OAAO,IACL,IAAI3C,gBAAgB;oBAClBkB,QAAQ,GAAGR,QAAQS,MAAM,CAAC,CAAC,EAAET,QAAQL,GAAG,CAAC,iCAAiC,CAAC;oBAC3EiB,gBAAgBb,SAASY,MAAM;gBACjC;QACJ;QAEA,iCAAiC;QACjC,MAAMyB,eAA4C;YAChDzB,QAAQZ,SAASY,MAAM;YACvBN,SAASgC,OAAOC,WAAW,CAACvC,SAASM,OAAO,CAACkC,OAAO;YACpDR;QACF;QAEA,OAAOK;IACT,GAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entifix/rest",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
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": {
@@ -51,14 +51,14 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@swc/helpers": "0.5.23",
54
- "@entifix/core": "0.9.0",
55
- "@entifix/transactions": "0.9.0"
54
+ "@entifix/core": "0.10.1",
55
+ "@entifix/transactions": "0.10.1"
56
56
  },
57
57
  "devDependencies": {
58
- "effect": "4.0.5",
59
- "@entifix/testing-unit": "0.9.0"
58
+ "effect": "4.0.6",
59
+ "@entifix/testing-unit": "0.10.1"
60
60
  },
61
61
  "peerDependencies": {
62
- "effect": "^4.0.5"
62
+ "effect": "^4.0.6"
63
63
  }
64
64
  }