@entifix/rest 0.13.0 → 0.14.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/dist/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.d.ts +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-delete/build-entity-rest-adapter-delete.d.ts.map +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-facets/build-entity-rest-adapter-facets.d.ts +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-facets/build-entity-rest-adapter-facets.d.ts.map +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-get/build-entity-rest-adapter-get.d.ts +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-get/build-entity-rest-adapter-get.d.ts.map +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-load/build-entity-rest-adapter-load.d.ts +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-load/build-entity-rest-adapter-load.d.ts.map +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-mixins/build-entity-base-url.d.ts +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-mixins/build-entity-base-url.d.ts.map +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-mixins/index.d.ts +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.d.ts +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.d.ts.map +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.js +20 -32
- package/dist/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.js.map +1 -1
- package/dist/adapters/entity-rest/build-entity-rest-adapter-write/build-entity-rest-adapter-write.d.ts +10 -0
- package/dist/adapters/entity-rest/build-entity-rest-adapter-write/build-entity-rest-adapter-write.d.ts.map +1 -0
- package/dist/adapters/entity-rest/build-entity-rest-adapter-write/build-entity-rest-adapter-write.js +49 -0
- package/dist/adapters/entity-rest/build-entity-rest-adapter-write/build-entity-rest-adapter-write.js.map +1 -0
- package/dist/adapters/entity-rest/build-entity-rest-adapter-write/index.d.ts +2 -0
- package/dist/adapters/entity-rest/build-entity-rest-adapter-write/index.d.ts.map +1 -0
- package/dist/adapters/entity-rest/build-entity-rest-adapter-write/index.js +3 -0
- package/dist/adapters/entity-rest/build-entity-rest-adapter-write/index.js.map +1 -0
- package/dist/adapters/entity-rest/pending-save-keys.d.ts +13 -0
- package/dist/adapters/entity-rest/pending-save-keys.d.ts.map +1 -0
- package/dist/adapters/entity-rest/pending-save-keys.js +13 -0
- package/dist/adapters/entity-rest/pending-save-keys.js.map +1 -0
- package/dist/adapters/entity-rest/read-write-response.d.ts +13 -0
- package/dist/adapters/entity-rest/read-write-response.d.ts.map +1 -0
- package/dist/adapters/entity-rest/read-write-response.js +17 -0
- package/dist/adapters/entity-rest/read-write-response.js.map +1 -0
- package/dist/adapters/entity-rest/types.d.ts +5 -0
- package/dist/adapters/entity-rest/types.d.ts.map +1 -1
- package/dist/adapters/entity-rest/types.js.map +1 -1
- package/dist/adapters/entity-use-case/make-entity-rest-use-case-runner.d.ts +3 -1
- package/dist/adapters/entity-use-case/make-entity-rest-use-case-runner.d.ts.map +1 -1
- package/dist/adapters/entity-use-case/make-entity-rest-use-case-runner.js +9 -2
- package/dist/adapters/entity-use-case/make-entity-rest-use-case-runner.js.map +1 -1
- package/dist/adapters/flow-status/build-flow-status-reader/build-flow-status-reader.d.ts +19 -0
- package/dist/adapters/flow-status/build-flow-status-reader/build-flow-status-reader.d.ts.map +1 -0
- package/dist/adapters/flow-status/build-flow-status-reader/build-flow-status-reader.js +27 -0
- package/dist/adapters/flow-status/build-flow-status-reader/build-flow-status-reader.js.map +1 -0
- package/dist/adapters/flow-status/build-flow-status-reader/index.d.ts +2 -0
- package/dist/adapters/flow-status/build-flow-status-reader/index.d.ts.map +1 -0
- package/dist/adapters/flow-status/build-flow-status-reader/index.js +3 -0
- package/dist/adapters/flow-status/build-flow-status-reader/index.js.map +1 -0
- package/dist/adapters/is-not-found.d.ts +7 -0
- package/dist/adapters/is-not-found.d.ts.map +1 -0
- package/dist/adapters/is-not-found.js +8 -0
- package/dist/adapters/is-not-found.js.map +1 -0
- package/dist/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.d.ts +17 -0
- package/dist/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.d.ts.map +1 -1
- package/dist/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.js +2 -7
- package/dist/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.js.map +1 -1
- package/dist/clients/types.d.ts +1 -1
- package/dist/clients/types.d.ts.map +1 -1
- package/dist/clients/types.js.map +1 -1
- package/dist/configuration-client/configuration-client-rest-client.d.ts.map +1 -1
- package/dist/configuration-client/configuration-client-rest-client.js +5 -3
- package/dist/configuration-client/configuration-client-rest-client.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -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").
|
|
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").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,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,
|
|
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,qIAmBnD,CAAC"}
|
|
@@ -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").
|
|
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").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,
|
|
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,yMAoBtD,CAAC"}
|
package/dist/adapters/entity-rest/build-entity-rest-adapter-get/build-entity-rest-adapter-get.d.ts
CHANGED
|
@@ -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").
|
|
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").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,
|
|
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,qIAoBrC,CAAC"}
|
package/dist/adapters/entity-rest/build-entity-rest-adapter-load/build-entity-rest-adapter-load.d.ts
CHANGED
|
@@ -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").
|
|
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").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,
|
|
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,iJA8BxD,CAAC"}
|
package/dist/adapters/entity-rest/build-entity-rest-adapter-mixins/build-entity-base-url.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigurationClient } from '@entifix/core';
|
|
2
2
|
import { Effect } from 'effect';
|
|
3
3
|
import { BuildEntityRestOptions } from '../types.js';
|
|
4
|
-
export declare const buildEntityBaseUrl: (configurationStore: ConfigurationClient, options: Pick<BuildEntityRestOptions, "uriConfig">, entityName: string, entityId?: string) => Effect.Effect<string, import("@entifix/core").
|
|
4
|
+
export declare const buildEntityBaseUrl: (configurationStore: ConfigurationClient, options: Pick<BuildEntityRestOptions, "uriConfig">, entityName: string, entityId?: string) => Effect.Effect<string, import("@entifix/core").Unavailable, never>;
|
|
5
5
|
//# sourceMappingURL=build-entity-base-url.d.ts.map
|
package/dist/adapters/entity-rest/build-entity-rest-adapter-mixins/build-entity-base-url.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-entity-base-url.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-mixins/build-entity-base-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIrD,eAAO,MAAM,kBAAkB,GAC7B,oBAAoB,mBAAmB,EACvC,SAAS,IAAI,CAAC,sBAAsB,EAAE,WAAW,CAAC,EAClD,YAAY,MAAM,EAClB,WAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"build-entity-base-url.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-mixins/build-entity-base-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIrD,eAAO,MAAM,kBAAkB,GAC7B,oBAAoB,mBAAmB,EACvC,SAAS,IAAI,CAAC,sBAAsB,EAAE,WAAW,CAAC,EAClD,YAAY,MAAM,EAClB,WAAW,MAAM,sEAYf,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const buildEntityRestAdapterMixins: {
|
|
2
|
-
buildEntityBaseUrl: (configurationStore: import("@entifix/core").ConfigurationClient, options: Pick<import("../types.js").BuildEntityRestOptions, "uriConfig">, entityName: string, entityId?: string) => import("effect/Effect").Effect<string, import("@entifix/core").
|
|
2
|
+
buildEntityBaseUrl: (configurationStore: import("@entifix/core").ConfigurationClient, options: Pick<import("../types.js").BuildEntityRestOptions, "uriConfig">, entityName: string, entityId?: string) => import("effect/Effect").Effect<string, import("@entifix/core").Unavailable, never>;
|
|
3
3
|
buildEntityRequest: ({ method, url, envelope, idempotencyKey, }: import("./build-entity-request.js").BuildEntityRequestOptions) => import("../../../index.js").HttpRequest<import("@entifix/core").EntifixEnvelope<unknown>>;
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.d.ts
CHANGED
|
@@ -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>,
|
|
23
|
+
export declare const buildEntityRestAdapterSave: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, options: BuildEntityRestOptions) => <TInput extends Entity>(entity: TInput) => Effect.Effect<TInput, 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,
|
|
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,EAIlB,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AAMxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAKrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,GACpC,OAAO,SAAS,MAAM,EACrB,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,SAAS,sBAAsB,MAKhC,MAAM,SAAS,MAAM,EAAE,QAAQ,MAAM,kIAwFlC,CAAC"}
|
package/dist/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import { extractMetaEntity,
|
|
1
|
+
import { extractMetaEntity, ProtocolFailure, serializeEntity } from '@entifix/core';
|
|
2
2
|
import { makeCommandEnvelope, readTransactionAcceptedEnvelope, TransactionSinkTag } from '@entifix/transactions';
|
|
3
3
|
import { Effect, Option } from 'effect';
|
|
4
4
|
import { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';
|
|
5
5
|
import { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-rest-adapter-mixins/index.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* that save succeeds.
|
|
9
|
-
*
|
|
10
|
-
* Keyed by the entity instance, so a save called again on the same object
|
|
11
|
-
* after a network error — the case the key exists for — sends the same key and
|
|
12
|
-
* the service replays its first answer instead of writing twice. A save that
|
|
13
|
-
* succeeded forgets its key, so the next edit of that object is a new request.
|
|
14
|
-
* The browser itself never retries (ADR 0014); this is what makes a person's
|
|
15
|
-
* retry safe.
|
|
16
|
-
*/ const pendingKeys = new WeakMap();
|
|
6
|
+
import { buildEntityRestAdapterWrite } from '../build-entity-rest-adapter-write/index.js';
|
|
7
|
+
import { pendingSaveKeys } from '../pending-save-keys.js';
|
|
17
8
|
/** A transactional create whose `202` never arrived: same command, same id. */ const pendingCreates = new WeakSet();
|
|
18
9
|
/**
|
|
19
10
|
* Persists an entity over HTTP.
|
|
@@ -33,26 +24,27 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-r
|
|
|
33
24
|
* That is the point of the client owning the id — before it, this
|
|
34
25
|
* adapter parsed the `202` as an entity envelope, failed, and reported an error
|
|
35
26
|
* for a create that was in fact about to succeed.
|
|
36
|
-
*/ export const buildEntityRestAdapterSave = (entityConstructor,
|
|
27
|
+
*/ export const buildEntityRestAdapterSave = (entityConstructor, options)=>// Deliberately not shadowing `TEntity` here (as the read builders do): the
|
|
37
28
|
// envelope has to be built against the *constructor's* entity type, which a
|
|
38
29
|
// shadowed parameter would make unreachable.
|
|
39
30
|
(entity)=>Effect.gen(function*() {
|
|
40
|
-
var _metaEntity_key
|
|
31
|
+
var _metaEntity_key;
|
|
32
|
+
const { uriConfig, create = 'entity', configuration } = options;
|
|
41
33
|
const metaEntity = extractMetaEntity(entityConstructor);
|
|
42
34
|
const key = (_metaEntity_key = metaEntity.key) != null ? _metaEntity_key : metaEntity.name;
|
|
43
35
|
const isCreate = entity.id == null || pendingCreates.has(entity);
|
|
44
|
-
const url = yield* adapterMixins.buildEntityBaseUrl(configuration, {
|
|
45
|
-
uriConfig
|
|
46
|
-
}, key, isCreate ? undefined : String(entity.id));
|
|
47
36
|
if (isCreate && create === 'command') {
|
|
48
|
-
var
|
|
37
|
+
var _pendingSaveKeys_get;
|
|
38
|
+
const url = yield* adapterMixins.buildEntityBaseUrl(configuration, {
|
|
39
|
+
uriConfig
|
|
40
|
+
}, key);
|
|
49
41
|
// `crypto.randomUUID` is available in every browser this ships to and in
|
|
50
42
|
// Node — and the id must be a UUID, because the service constrains the
|
|
51
43
|
// key space a caller may address.
|
|
52
44
|
// A retried create reuses the id it was first sent with: that id *is*
|
|
53
45
|
// the idempotency key, so a new one would write a second record.
|
|
54
|
-
const transactionId = (
|
|
55
|
-
|
|
46
|
+
const transactionId = (_pendingSaveKeys_get = pendingSaveKeys.get(entity)) != null ? _pendingSaveKeys_get : crypto.randomUUID();
|
|
47
|
+
pendingSaveKeys.set(entity, transactionId);
|
|
56
48
|
pendingCreates.add(entity);
|
|
57
49
|
entity.id = transactionId;
|
|
58
50
|
const command = {
|
|
@@ -71,7 +63,7 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-r
|
|
|
71
63
|
// accepted a transaction rather than answering something else with a
|
|
72
64
|
// 2xx, which is the failure the old code path could not distinguish.
|
|
73
65
|
yield* readTransactionAcceptedEnvelope(accepted.body);
|
|
74
|
-
|
|
66
|
+
pendingSaveKeys.delete(entity);
|
|
75
67
|
pendingCreates.delete(entity);
|
|
76
68
|
// Tell whoever is watching that a write is in flight. This is the only
|
|
77
69
|
// point in the system that knows it — the entity returned below is
|
|
@@ -97,18 +89,14 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-r
|
|
|
97
89
|
}
|
|
98
90
|
return entity;
|
|
99
91
|
}
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
idempotencyKey
|
|
92
|
+
const result = yield* buildEntityRestAdapterWrite(entityConstructor, options).save(entity);
|
|
93
|
+
// A repository save answers the stored entity, so it has nothing to
|
|
94
|
+
// return for a write the service handed to a flow; a screen writes such
|
|
95
|
+
// an entity through `buildEntityRestAdapterWrite` instead.
|
|
96
|
+
if (result._tag === 'pending') return yield* new ProtocolFailure({
|
|
97
|
+
reason: `'${key}' answered a save with 202 flowAccepted; write it through buildEntityRestAdapterWrite`
|
|
107
98
|
});
|
|
108
|
-
|
|
109
|
-
const saved = yield* readEntityEnvelope(entityConstructor, response.body);
|
|
110
|
-
pendingKeys.delete(entity);
|
|
111
|
-
return saved;
|
|
99
|
+
return result.value;
|
|
112
100
|
});
|
|
113
101
|
|
|
114
102
|
//# sourceMappingURL=build-entity-rest-adapter-save.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.ts"],"sourcesContent":["import {\n Entity,\n EntityConstructor,\n extractMetaEntity,\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-save/build-entity-rest-adapter-save.ts"],"sourcesContent":["import {\n Entity,\n EntityConstructor,\n extractMetaEntity,\n ProtocolFailure,\n serializeEntity,\n} from '@entifix/core';\nimport {\n makeCommandEnvelope,\n readTransactionAcceptedEnvelope,\n type TransactionCommand,\n TransactionSinkTag,\n} from '@entifix/transactions';\nimport { Effect, Option } from 'effect';\n\nimport { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';\nimport { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-rest-adapter-mixins/index.js';\nimport { buildEntityRestAdapterWrite } from '../build-entity-rest-adapter-write/index.js';\nimport { pendingSaveKeys } from '../pending-save-keys.js';\nimport { BuildEntityRestOptions } from '../types.js';\n\n/** A transactional create whose `202` never arrived: same command, same id. */\nconst pendingCreates = new WeakSet<object>();\n\n/**\n * Persists an entity over HTTP.\n *\n * An entity without an id has never been stored, so it is created with `POST`\n * against the collection; one with an id is replaced with `PUT` against its own\n * URL.\n *\n * For a plain create the response envelope — not the request — is what gets\n * deserialized and returned, because the service is the authority on the stored\n * entity (it assigns ids and may normalize fields).\n *\n * A **transactional** create inverts that, and deliberately. The service answers\n * `202` describing a transaction rather than an entity, so there is no stored\n * entity to read back yet: the client mints the transaction id, which *is* the\n * id the entity will be stored under, and returns the entity it already holds.\n * That is the point of the client owning the id — before it, this\n * adapter parsed the `202` as an entity envelope, failed, and reported an error\n * for a create that was in fact about to succeed.\n */\nexport const buildEntityRestAdapterSave =\n <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n options: BuildEntityRestOptions,\n ) =>\n // Deliberately not shadowing `TEntity` here (as the read builders do): the\n // envelope has to be built against the *constructor's* entity type, which a\n // shadowed parameter would make unreachable.\n <TInput extends Entity>(entity: TInput) =>\n Effect.gen(function* () {\n const { uriConfig, create = 'entity', configuration } = options;\n const metaEntity = extractMetaEntity(entityConstructor);\n const key = metaEntity.key ?? metaEntity.name;\n const isCreate = entity.id == null || pendingCreates.has(entity);\n\n if (isCreate && create === 'command') {\n const url = yield* adapterMixins.buildEntityBaseUrl(\n configuration,\n { uriConfig },\n key,\n );\n\n // `crypto.randomUUID` is available in every browser this ships to and in\n // Node — and the id must be a UUID, because the service constrains the\n // key space a caller may address.\n // A retried create reuses the id it was first sent with: that id *is*\n // the idempotency key, so a new one would write a second record.\n const transactionId =\n pendingSaveKeys.get(entity) ?? crypto.randomUUID();\n pendingSaveKeys.set(entity, transactionId);\n pendingCreates.add(entity);\n entity.id = transactionId;\n\n const command: TransactionCommand = {\n transactionId,\n type: 'create',\n entity: key,\n payload: serializeEntity(\n entityConstructor,\n entity as unknown as TEntity,\n ),\n };\n\n const accepted = yield* performHttpRequestThroughFetch(\n adapterMixins.buildEntityRequest({\n method: 'POST',\n url,\n envelope: makeCommandEnvelope(command),\n idempotencyKey: transactionId,\n }),\n );\n // Read for its shape, not its contents: this asserts the service really\n // accepted a transaction rather than answering something else with a\n // 2xx, which is the failure the old code path could not distinguish.\n yield* readTransactionAcceptedEnvelope(accepted.body);\n pendingSaveKeys.delete(entity);\n pendingCreates.delete(entity);\n\n // Tell whoever is watching that a write is in flight. This is the only\n // point in the system that knows it — the entity returned below is\n // indistinguishable from a plain REST create, so without this the\n // browser navigates away at the `202` and a later failure leaves no row,\n // no message and nothing to retry from.\n //\n // `serviceOption`, deliberately: reading the tag this way keeps it out\n // of this function's `R`, so the storefront, the plain REST adapters and\n // every existing spec compile and run with no layer to provide. The cost\n // is that nothing *forces* a composition root to provide it, which is\n // why `mergeContext` has a spec pinning that it does.\n const sink = yield* Effect.serviceOption(TransactionSinkTag);\n if (Option.isSome(sink)) {\n // After the assertion above, never before: a `2xx` that is not a\n // transaction envelope must not register a pending id, because nothing\n // would ever settle it and the entry becomes a permanent phantom.\n sink.value.began({\n transactionId,\n entity: key,\n at: new Date().toISOString(),\n });\n }\n\n return entity;\n }\n\n const result = yield* buildEntityRestAdapterWrite(\n entityConstructor,\n options,\n ).save(entity);\n // A repository save answers the stored entity, so it has nothing to\n // return for a write the service handed to a flow; a screen writes such\n // an entity through `buildEntityRestAdapterWrite` instead.\n if (result._tag === 'pending')\n return yield* new ProtocolFailure({\n reason: `'${key}' answered a save with 202 flowAccepted; write it through buildEntityRestAdapterWrite`,\n });\n return result.value;\n });\n"],"names":["extractMetaEntity","ProtocolFailure","serializeEntity","makeCommandEnvelope","readTransactionAcceptedEnvelope","TransactionSinkTag","Effect","Option","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","buildEntityRestAdapterWrite","pendingSaveKeys","pendingCreates","WeakSet","buildEntityRestAdapterSave","entityConstructor","options","entity","gen","metaEntity","uriConfig","create","configuration","key","name","isCreate","id","has","url","buildEntityBaseUrl","transactionId","get","crypto","randomUUID","set","add","command","type","payload","accepted","buildEntityRequest","method","envelope","idempotencyKey","body","delete","sink","serviceOption","isSome","value","began","at","Date","toISOString","result","save","_tag","reason"],"mappings":"AAAA,SAGEA,iBAAiB,EACjBC,eAAe,EACfC,eAAe,QACV,gBAAgB;AACvB,SACEC,mBAAmB,EACnBC,+BAA+B,EAE/BC,kBAAkB,QACb,wBAAwB;AAC/B,SAASC,MAAM,EAAEC,MAAM,QAAQ,SAAS;AAExC,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,gCAAgCC,aAAa,QAAQ,+CAA+C;AAC7G,SAASC,2BAA2B,QAAQ,8CAA8C;AAC1F,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,6EAA6E,GAC7E,MAAMC,iBAAiB,IAAIC;AAE3B;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,MAAMC,6BACX,CACEC,mBACAC,UAEF,2EAA2E;IAC3E,4EAA4E;IAC5E,6CAA6C;IAC7C,CAAwBC,SACtBZ,OAAOa,GAAG,CAAC;gBAGGC;YAFZ,MAAM,EAAEC,SAAS,EAAEC,SAAS,QAAQ,EAAEC,aAAa,EAAE,GAAGN;YACxD,MAAMG,aAAapB,kBAAkBgB;YACrC,MAAMQ,OAAMJ,kBAAAA,WAAWI,GAAG,YAAdJ,kBAAkBA,WAAWK,IAAI;YAC7C,MAAMC,WAAWR,OAAOS,EAAE,IAAI,QAAQd,eAAee,GAAG,CAACV;YAEzD,IAAIQ,YAAYJ,WAAW,WAAW;oBAalCV;gBAZF,MAAMiB,MAAM,OAAOnB,cAAcoB,kBAAkB,CACjDP,eACA;oBAAEF;gBAAU,GACZG;gBAGF,yEAAyE;gBACzE,uEAAuE;gBACvE,kCAAkC;gBAClC,sEAAsE;gBACtE,iEAAiE;gBACjE,MAAMO,iBACJnB,uBAAAA,gBAAgBoB,GAAG,CAACd,mBAApBN,uBAA+BqB,OAAOC,UAAU;gBAClDtB,gBAAgBuB,GAAG,CAACjB,QAAQa;gBAC5BlB,eAAeuB,GAAG,CAAClB;gBACnBA,OAAOS,EAAE,GAAGI;gBAEZ,MAAMM,UAA8B;oBAClCN;oBACAO,MAAM;oBACNpB,QAAQM;oBACRe,SAASrC,gBACPc,mBACAE;gBAEJ;gBAEA,MAAMsB,WAAW,OAAOhC,+BACtBE,cAAc+B,kBAAkB,CAAC;oBAC/BC,QAAQ;oBACRb;oBACAc,UAAUxC,oBAAoBkC;oBAC9BO,gBAAgBb;gBAClB;gBAEF,wEAAwE;gBACxE,qEAAqE;gBACrE,qEAAqE;gBACrE,OAAO3B,gCAAgCoC,SAASK,IAAI;gBACpDjC,gBAAgBkC,MAAM,CAAC5B;gBACvBL,eAAeiC,MAAM,CAAC5B;gBAEtB,uEAAuE;gBACvE,mEAAmE;gBACnE,kEAAkE;gBAClE,yEAAyE;gBACzE,wCAAwC;gBACxC,EAAE;gBACF,uEAAuE;gBACvE,yEAAyE;gBACzE,yEAAyE;gBACzE,sEAAsE;gBACtE,sDAAsD;gBACtD,MAAM6B,OAAO,OAAOzC,OAAO0C,aAAa,CAAC3C;gBACzC,IAAIE,OAAO0C,MAAM,CAACF,OAAO;oBACvB,iEAAiE;oBACjE,uEAAuE;oBACvE,kEAAkE;oBAClEA,KAAKG,KAAK,CAACC,KAAK,CAAC;wBACfpB;wBACAb,QAAQM;wBACR4B,IAAI,IAAIC,OAAOC,WAAW;oBAC5B;gBACF;gBAEA,OAAOpC;YACT;YAEA,MAAMqC,SAAS,OAAO5C,4BACpBK,mBACAC,SACAuC,IAAI,CAACtC;YACP,oEAAoE;YACpE,wEAAwE;YACxE,2DAA2D;YAC3D,IAAIqC,OAAOE,IAAI,KAAK,WAClB,OAAO,OAAO,IAAIxD,gBAAgB;gBAChCyD,QAAQ,CAAC,CAAC,EAAElC,IAAI,qFAAqF,CAAC;YACxG;YACF,OAAO+B,OAAOL,KAAK;QACrB,GAAG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Entity, type EntityConstructor, type EntityWriter } from '@entifix/core';
|
|
2
|
+
import type { BuildEntityRestOptions } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The write half of an entity's REST adapters, answering both settle modes.
|
|
5
|
+
*
|
|
6
|
+
* The `command` create protocol is the tracker's and is not served here; it
|
|
7
|
+
* stays on `buildEntityRestAdapterSave`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const buildEntityRestAdapterWrite: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, update, configuration }: BuildEntityRestOptions) => EntityWriter;
|
|
10
|
+
//# sourceMappingURL=build-entity-rest-adapter-write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-entity-rest-adapter-write.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-write/build-entity-rest-adapter-write.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,iBAAiB,EAEtB,KAAK,YAAY,EAKlB,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAO1D;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,SAAS,MAAM,EAChE,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,sCAA8C,sBAAsB,KACnE,YAqDF,CAAC"}
|
package/dist/adapters/entity-rest/build-entity-rest-adapter-write/build-entity-rest-adapter-write.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { extractMetaEntity, Internal, makeEntityEnvelope, readEntityEnvelope } from '@entifix/core';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';
|
|
4
|
+
import { buildEntityRestAdapterMixins as adapterMixins } from '../build-entity-rest-adapter-mixins/index.js';
|
|
5
|
+
import { pendingSaveKeys } from '../pending-save-keys.js';
|
|
6
|
+
import { readWriteResponse } from '../read-write-response.js';
|
|
7
|
+
const idOf = (entityOrId)=>entityOrId != null && typeof entityOrId === 'object' ? entityOrId.id : entityOrId;
|
|
8
|
+
/**
|
|
9
|
+
* The write half of an entity's REST adapters, answering both settle modes.
|
|
10
|
+
*
|
|
11
|
+
* The `command` create protocol is the tracker's and is not served here; it
|
|
12
|
+
* stays on `buildEntityRestAdapterSave`.
|
|
13
|
+
*/ export const buildEntityRestAdapterWrite = (entityConstructor, { uriConfig, update = 'PUT', configuration })=>{
|
|
14
|
+
var _metaEntity_key;
|
|
15
|
+
const metaEntity = extractMetaEntity(entityConstructor);
|
|
16
|
+
const key = (_metaEntity_key = metaEntity.key) != null ? _metaEntity_key : metaEntity.name;
|
|
17
|
+
const urlOf = (id)=>adapterMixins.buildEntityBaseUrl(configuration, {
|
|
18
|
+
uriConfig
|
|
19
|
+
}, key, id == null ? undefined : String(id));
|
|
20
|
+
return {
|
|
21
|
+
save: (entity)=>Effect.gen(function*() {
|
|
22
|
+
var _pendingSaveKeys_get;
|
|
23
|
+
const isCreate = entity.id == null;
|
|
24
|
+
const url = yield* urlOf(entity.id);
|
|
25
|
+
const idempotencyKey = (_pendingSaveKeys_get = pendingSaveKeys.get(entity)) != null ? _pendingSaveKeys_get : crypto.randomUUID();
|
|
26
|
+
pendingSaveKeys.set(entity, idempotencyKey);
|
|
27
|
+
const response = yield* performHttpRequestThroughFetch(adapterMixins.buildEntityRequest({
|
|
28
|
+
method: isCreate ? 'POST' : update,
|
|
29
|
+
url,
|
|
30
|
+
envelope: makeEntityEnvelope(entityConstructor, entity),
|
|
31
|
+
idempotencyKey
|
|
32
|
+
}));
|
|
33
|
+
const result = yield* readWriteResponse(response, (body)=>Effect.map(readEntityEnvelope(entityConstructor, body), (saved)=>saved));
|
|
34
|
+
pendingSaveKeys.delete(entity);
|
|
35
|
+
return result;
|
|
36
|
+
}),
|
|
37
|
+
delete: (entityOrId)=>Effect.gen(function*() {
|
|
38
|
+
const id = idOf(entityOrId);
|
|
39
|
+
if (id == null) return yield* Effect.fail(new Internal());
|
|
40
|
+
const response = yield* performHttpRequestThroughFetch(adapterMixins.buildEntityRequest({
|
|
41
|
+
method: 'DELETE',
|
|
42
|
+
url: yield* urlOf(id)
|
|
43
|
+
}));
|
|
44
|
+
return yield* readWriteResponse(response, ()=>Effect.void);
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=build-entity-rest-adapter-write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-write/build-entity-rest-adapter-write.ts"],"sourcesContent":["import {\n type Entity,\n type EntityConstructor,\n type EntityId,\n type EntityWriter,\n extractMetaEntity,\n Internal,\n makeEntityEnvelope,\n readEntityEnvelope,\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 { pendingSaveKeys } from '../pending-save-keys.js';\nimport { readWriteResponse } from '../read-write-response.js';\nimport type { BuildEntityRestOptions } from '../types.js';\n\nconst idOf = (entityOrId: EntityId | Entity): EntityId =>\n entityOrId != null && typeof entityOrId === 'object'\n ? entityOrId.id\n : entityOrId;\n\n/**\n * The write half of an entity's REST adapters, answering both settle modes.\n *\n * The `command` create protocol is the tracker's and is not served here; it\n * stays on `buildEntityRestAdapterSave`.\n */\nexport const buildEntityRestAdapterWrite = <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n { uriConfig, update = 'PUT', configuration }: BuildEntityRestOptions,\n): EntityWriter => {\n const metaEntity = extractMetaEntity(entityConstructor);\n const key = metaEntity.key ?? metaEntity.name;\n const urlOf = (id?: EntityId) =>\n adapterMixins.buildEntityBaseUrl(\n configuration,\n { uriConfig },\n key,\n id == null ? undefined : String(id),\n );\n\n return {\n save: <TInput extends Entity>(entity: TInput) =>\n Effect.gen(function* () {\n const isCreate = entity.id == null;\n const url = yield* urlOf(entity.id);\n const idempotencyKey =\n pendingSaveKeys.get(entity) ?? crypto.randomUUID();\n pendingSaveKeys.set(entity, idempotencyKey);\n\n const response = yield* performHttpRequestThroughFetch(\n adapterMixins.buildEntityRequest({\n method: isCreate ? 'POST' : update,\n url,\n envelope: makeEntityEnvelope(\n entityConstructor,\n entity as unknown as TEntity,\n ),\n idempotencyKey,\n }),\n );\n const result = yield* readWriteResponse(response, body =>\n Effect.map(\n readEntityEnvelope(entityConstructor, body),\n saved => saved as unknown as TInput,\n ),\n );\n pendingSaveKeys.delete(entity);\n return result;\n }),\n delete: entityOrId =>\n Effect.gen(function* () {\n const id = idOf(entityOrId);\n if (id == null) return yield* Effect.fail(new Internal());\n const response = yield* performHttpRequestThroughFetch(\n adapterMixins.buildEntityRequest({\n method: 'DELETE',\n url: yield* urlOf(id),\n }),\n );\n return yield* readWriteResponse(response, () => Effect.void);\n }),\n };\n};\n"],"names":["extractMetaEntity","Internal","makeEntityEnvelope","readEntityEnvelope","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","pendingSaveKeys","readWriteResponse","idOf","entityOrId","id","buildEntityRestAdapterWrite","entityConstructor","uriConfig","update","configuration","metaEntity","key","name","urlOf","buildEntityBaseUrl","undefined","String","save","entity","gen","isCreate","url","idempotencyKey","get","crypto","randomUUID","set","response","buildEntityRequest","method","envelope","result","body","map","saved","delete","fail","void"],"mappings":"AAAA,SAKEA,iBAAiB,EACjBC,QAAQ,EACRC,kBAAkB,EAClBC,kBAAkB,QACb,gBAAgB;AACvB,SAASC,MAAM,QAAQ,SAAS;AAEhC,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,gCAAgCC,aAAa,QAAQ,+CAA+C;AAC7G,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,SAASC,iBAAiB,QAAQ,4BAA4B;AAG9D,MAAMC,OAAO,CAACC,aACZA,cAAc,QAAQ,OAAOA,eAAe,WACxCA,WAAWC,EAAE,GACbD;AAEN;;;;;CAKC,GACD,OAAO,MAAME,8BAA8B,CACzCC,mBACA,EAAEC,SAAS,EAAEC,SAAS,KAAK,EAAEC,aAAa,EAA0B;QAGxDC;IADZ,MAAMA,aAAalB,kBAAkBc;IACrC,MAAMK,OAAMD,kBAAAA,WAAWC,GAAG,YAAdD,kBAAkBA,WAAWE,IAAI;IAC7C,MAAMC,QAAQ,CAACT,KACbL,cAAce,kBAAkB,CAC9BL,eACA;YAAEF;QAAU,GACZI,KACAP,MAAM,OAAOW,YAAYC,OAAOZ;IAGpC,OAAO;QACLa,MAAM,CAAwBC,SAC5BtB,OAAOuB,GAAG,CAAC;oBAIPnB;gBAHF,MAAMoB,WAAWF,OAAOd,EAAE,IAAI;gBAC9B,MAAMiB,MAAM,OAAOR,MAAMK,OAAOd,EAAE;gBAClC,MAAMkB,kBACJtB,uBAAAA,gBAAgBuB,GAAG,CAACL,mBAApBlB,uBAA+BwB,OAAOC,UAAU;gBAClDzB,gBAAgB0B,GAAG,CAACR,QAAQI;gBAE5B,MAAMK,WAAW,OAAO9B,+BACtBE,cAAc6B,kBAAkB,CAAC;oBAC/BC,QAAQT,WAAW,SAASZ;oBAC5Ba;oBACAS,UAAUpC,mBACRY,mBACAY;oBAEFI;gBACF;gBAEF,MAAMS,SAAS,OAAO9B,kBAAkB0B,UAAUK,CAAAA,OAChDpC,OAAOqC,GAAG,CACRtC,mBAAmBW,mBAAmB0B,OACtCE,CAAAA,QAASA;gBAGblC,gBAAgBmC,MAAM,CAACjB;gBACvB,OAAOa;YACT;QACFI,QAAQhC,CAAAA,aACNP,OAAOuB,GAAG,CAAC;gBACT,MAAMf,KAAKF,KAAKC;gBAChB,IAAIC,MAAM,MAAM,OAAO,OAAOR,OAAOwC,IAAI,CAAC,IAAI3C;gBAC9C,MAAMkC,WAAW,OAAO9B,+BACtBE,cAAc6B,kBAAkB,CAAC;oBAC/BC,QAAQ;oBACRR,KAAK,OAAOR,MAAMT;gBACpB;gBAEF,OAAO,OAAOH,kBAAkB0B,UAAU,IAAM/B,OAAOyC,IAAI;YAC7D;IACJ;AACF,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-write/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/entity-rest/build-entity-rest-adapter-write/index.ts"],"sourcesContent":["export * from './build-entity-rest-adapter-write.js';\n"],"names":[],"mappings":"AAAA,cAAc,uCAAuC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Idempotency-Key` each entity's pending save was sent under, kept until
|
|
3
|
+
* that save is answered.
|
|
4
|
+
*
|
|
5
|
+
* Keyed by the entity instance, so a save called again on the same object
|
|
6
|
+
* after a network error — the case the key exists for — sends the same key and
|
|
7
|
+
* the service replays its first answer instead of writing twice. An answered
|
|
8
|
+
* save forgets its key, so the next edit of that object is a new request. The
|
|
9
|
+
* browser itself never retries (ADR 0014); this is what makes a person's retry
|
|
10
|
+
* safe.
|
|
11
|
+
*/
|
|
12
|
+
export declare const pendingSaveKeys: WeakMap<object, string>;
|
|
13
|
+
//# sourceMappingURL=pending-save-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-save-keys.d.ts","sourceRoot":"","sources":["../../../src/adapters/entity-rest/pending-save-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,yBAAgC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Idempotency-Key` each entity's pending save was sent under, kept until
|
|
3
|
+
* that save is answered.
|
|
4
|
+
*
|
|
5
|
+
* Keyed by the entity instance, so a save called again on the same object
|
|
6
|
+
* after a network error — the case the key exists for — sends the same key and
|
|
7
|
+
* the service replays its first answer instead of writing twice. An answered
|
|
8
|
+
* save forgets its key, so the next edit of that object is a new request. The
|
|
9
|
+
* browser itself never retries (ADR 0014); this is what makes a person's retry
|
|
10
|
+
* safe.
|
|
11
|
+
*/ export const pendingSaveKeys = new WeakMap();
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=pending-save-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/entity-rest/pending-save-keys.ts"],"sourcesContent":["/**\n * The `Idempotency-Key` each entity's pending save was sent under, kept until\n * that save is answered.\n *\n * Keyed by the entity instance, so a save called again on the same object\n * after a network error — the case the key exists for — sends the same key and\n * the service replays its first answer instead of writing twice. An answered\n * save forgets its key, so the next edit of that object is a new request. The\n * browser itself never retries (ADR 0014); this is what makes a person's retry\n * safe.\n */\nexport const pendingSaveKeys = new WeakMap<object, string>();\n"],"names":["pendingSaveKeys","WeakMap"],"mappings":"AAAA;;;;;;;;;;CAUC,GACD,OAAO,MAAMA,kBAAkB,IAAIC,UAA0B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import '@entifix/transactions';
|
|
2
|
+
import { type ProtocolFailure, type WriteResult } from '@entifix/core';
|
|
3
|
+
import { Effect } from 'effect';
|
|
4
|
+
import type { HttpResponse } from '../../clients/types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Reads a write's answer as one of its two modes
|
|
7
|
+
* ([ADR 0022](../../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)):
|
|
8
|
+
* a `202` is a flow, and its body must decode as `flowAccepted`; any other
|
|
9
|
+
* success is the write itself, read by `readSettled`. A failure status never
|
|
10
|
+
* gets here — the fetch client already decoded it as the failure it is.
|
|
11
|
+
*/
|
|
12
|
+
export declare const readWriteResponse: <T, E>(response: HttpResponse<unknown>, readSettled: (body: unknown) => Effect.Effect<T, E>) => Effect.Effect<WriteResult<T>, E | ProtocolFailure>;
|
|
13
|
+
//# sourceMappingURL=read-write-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-write-response.d.ts","sourceRoot":"","sources":["../../../src/adapters/entity-rest/read-write-response.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAGL,KAAK,eAAe,EAEpB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,CAAC,EACpC,UAAU,YAAY,CAAC,OAAO,CAAC,EAC/B,aAAa,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAClD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,eAAe,CAOiB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Loaded for its registration of `flowAccepted`, which the decode below reads.
|
|
2
|
+
import '@entifix/transactions';
|
|
3
|
+
import { decodeEnvelope, pending, settled } from '@entifix/core';
|
|
4
|
+
import { Effect } from 'effect';
|
|
5
|
+
/**
|
|
6
|
+
* Reads a write's answer as one of its two modes
|
|
7
|
+
* ([ADR 0022](../../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)):
|
|
8
|
+
* a `202` is a flow, and its body must decode as `flowAccepted`; any other
|
|
9
|
+
* success is the write itself, read by `readSettled`. A failure status never
|
|
10
|
+
* gets here — the fetch client already decoded it as the failure it is.
|
|
11
|
+
*/ export const readWriteResponse = (response, readSettled)=>response.status === 202 ? Effect.map(decodeEnvelope(response.body, 'flowAccepted'), (envelope)=>{
|
|
12
|
+
// Decoded against the registered `flowAccepted` schema just above.
|
|
13
|
+
const accepted = envelope.data;
|
|
14
|
+
return pending(accepted.flowId, accepted.links);
|
|
15
|
+
}) : Effect.map(readSettled(response.body), (value)=>settled(value));
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=read-write-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/entity-rest/read-write-response.ts"],"sourcesContent":["// Loaded for its registration of `flowAccepted`, which the decode below reads.\nimport '@entifix/transactions';\n\nimport {\n decodeEnvelope,\n pending,\n type ProtocolFailure,\n settled,\n type WriteResult,\n} from '@entifix/core';\nimport type { FlowAccepted } from '@entifix/transactions';\nimport { Effect } from 'effect';\n\nimport type { HttpResponse } from '../../clients/types.js';\n\n/**\n * Reads a write's answer as one of its two modes\n * ([ADR 0022](../../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)):\n * a `202` is a flow, and its body must decode as `flowAccepted`; any other\n * success is the write itself, read by `readSettled`. A failure status never\n * gets here — the fetch client already decoded it as the failure it is.\n */\nexport const readWriteResponse = <T, E>(\n response: HttpResponse<unknown>,\n readSettled: (body: unknown) => Effect.Effect<T, E>,\n): Effect.Effect<WriteResult<T>, E | ProtocolFailure> =>\n response.status === 202\n ? Effect.map(decodeEnvelope(response.body, 'flowAccepted'), envelope => {\n // Decoded against the registered `flowAccepted` schema just above.\n const accepted = envelope.data as FlowAccepted;\n return pending(accepted.flowId, accepted.links);\n })\n : Effect.map(readSettled(response.body), value => settled(value));\n"],"names":["decodeEnvelope","pending","settled","Effect","readWriteResponse","response","readSettled","status","map","body","envelope","accepted","data","flowId","links","value"],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,wBAAwB;AAE/B,SACEA,cAAc,EACdC,OAAO,EAEPC,OAAO,QAEF,gBAAgB;AAEvB,SAASC,MAAM,QAAQ,SAAS;AAIhC;;;;;;CAMC,GACD,OAAO,MAAMC,oBAAoB,CAC/BC,UACAC,cAEAD,SAASE,MAAM,KAAK,MAChBJ,OAAOK,GAAG,CAACR,eAAeK,SAASI,IAAI,EAAE,iBAAiBC,CAAAA;QACxD,mEAAmE;QACnE,MAAMC,WAAWD,SAASE,IAAI;QAC9B,OAAOX,QAAQU,SAASE,MAAM,EAAEF,SAASG,KAAK;IAChD,KACAX,OAAOK,GAAG,CAACF,YAAYD,SAASI,IAAI,GAAGM,CAAAA,QAASb,QAAQa,QAAQ"}
|
|
@@ -20,6 +20,11 @@ export interface BuildEntityRestOptions {
|
|
|
20
20
|
};
|
|
21
21
|
/** Defaults to `'entity'` — the plain REST write. */
|
|
22
22
|
create?: EntityCreateProtocol;
|
|
23
|
+
/**
|
|
24
|
+
* The method an update is sent with: `PUT` replaces the stored entity,
|
|
25
|
+
* `PATCH` merges into it. Defaults to `'PUT'`.
|
|
26
|
+
*/
|
|
27
|
+
update?: 'PUT' | 'PATCH';
|
|
23
28
|
/**
|
|
24
29
|
* Where `uriConfig` is looked up, bound when the adapter is built.
|
|
25
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/entity-rest/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,wBAAwB,CAAC;KAC3C,CAAC;IACF,qDAAqD;IACrD,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B;;;;;;;OAOG;IACH,aAAa,EAAE,mBAAmB,CAAC;CACpC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/adapters/entity-rest/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,wBAAwB,CAAC;KAC3C,CAAC;IACF,qDAAqD;IACrD,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACzB;;;;;;;OAOG;IACH,aAAa,EAAE,mBAAmB,CAAC;CACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/entity-rest/types.ts"],"sourcesContent":["import type {\n ConfigurationClient,\n ConfigurationExtractMode,\n} from '@entifix/core';\n\n/**\n * How a create is sent to this entity's service.\n *\n * `entity` is the plain REST write: `POST` an entity envelope, get the stored\n * entity back. `command` is the CQRS write path — the client mints the\n * transaction id, `POST`s a `command` envelope and gets a `202` naming the\n * transaction, because the write completes asynchronously behind a saga.\n *\n * It is per entity rather than global because the two live side by side today:\n * `ProductSpecification` is transactional, while `ProductBrand` and\n * `ProductCategory` are plain writes on another service.\n */\nexport type EntityCreateProtocol = 'entity' | 'command';\n\nexport interface BuildEntityRestOptions {\n uriConfig: {\n key: string;\n group?: string;\n extractionMode?: ConfigurationExtractMode;\n };\n /** Defaults to `'entity'` — the plain REST write. */\n create?: EntityCreateProtocol;\n /**\n * Where `uriConfig` is looked up, bound when the adapter is built.\n *\n * A value rather than a requirement on each call: the URL lookup is this\n * adapter's mechanism, and putting it in the repository port's environment\n * made every use case — and every static or database-backed caller — provide\n * a configuration it never read.\n */\n configuration: ConfigurationClient;\n}\n"],"names":[],"mappings":"AAmBA,
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/entity-rest/types.ts"],"sourcesContent":["import type {\n ConfigurationClient,\n ConfigurationExtractMode,\n} from '@entifix/core';\n\n/**\n * How a create is sent to this entity's service.\n *\n * `entity` is the plain REST write: `POST` an entity envelope, get the stored\n * entity back. `command` is the CQRS write path — the client mints the\n * transaction id, `POST`s a `command` envelope and gets a `202` naming the\n * transaction, because the write completes asynchronously behind a saga.\n *\n * It is per entity rather than global because the two live side by side today:\n * `ProductSpecification` is transactional, while `ProductBrand` and\n * `ProductCategory` are plain writes on another service.\n */\nexport type EntityCreateProtocol = 'entity' | 'command';\n\nexport interface BuildEntityRestOptions {\n uriConfig: {\n key: string;\n group?: string;\n extractionMode?: ConfigurationExtractMode;\n };\n /** Defaults to `'entity'` — the plain REST write. */\n create?: EntityCreateProtocol;\n /**\n * The method an update is sent with: `PUT` replaces the stored entity,\n * `PATCH` merges into it. Defaults to `'PUT'`.\n */\n update?: 'PUT' | 'PATCH';\n /**\n * Where `uriConfig` is looked up, bound when the adapter is built.\n *\n * A value rather than a requirement on each call: the URL lookup is this\n * adapter's mechanism, and putting it in the repository port's environment\n * made every use case — and every static or database-backed caller — provide\n * a configuration it never read.\n */\n configuration: ConfigurationClient;\n}\n"],"names":[],"mappings":"AAmBA,WAsBC"}
|
|
@@ -7,7 +7,9 @@ import type { BuildEntityRestOptions } from '../entity-rest/types.js';
|
|
|
7
7
|
* ([ADR 0020](../../../../../../docs/adr/0020-endpoints-are-descriptors-and-the-shell-builds-an-httpapi.md)).
|
|
8
8
|
*
|
|
9
9
|
* A refusal arrives as the failure the service sent, decoded from its problem
|
|
10
|
-
* body, so a screen shows the coded message rather than a generic error.
|
|
10
|
+
* body, so a screen shows the coded message rather than a generic error. A
|
|
11
|
+
* verb that starts a flow answers `202 flowAccepted` and runs as pending; any
|
|
12
|
+
* other success is settled with the `data` of what the service answered.
|
|
11
13
|
*/
|
|
12
14
|
export declare const makeEntityRestUseCaseRunner: <TEntity extends Entity>(entityConstructor: EntityConstructor<TEntity>, { uriConfig, configuration }: BuildEntityRestOptions) => EntityUseCaseRunner;
|
|
13
15
|
//# sourceMappingURL=make-entity-rest-use-case-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make-entity-rest-use-case-runner.d.ts","sourceRoot":"","sources":["../../../src/adapters/entity-use-case/make-entity-rest-use-case-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAIzB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"make-entity-rest-use-case-runner.d.ts","sourceRoot":"","sources":["../../../src/adapters/entity-use-case/make-entity-rest-use-case-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAIzB,MAAM,eAAe,CAAC;AAMvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,SAAS,MAAM,EAChE,mBAAmB,iBAAiB,CAAC,OAAO,CAAC,EAC7C,8BAA8B,sBAAsB,KACnD,mBA+CF,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { extractMetaEntity, ProtocolFailure, toWireSelection } from '@entifix/co
|
|
|
2
2
|
import { Effect } from 'effect';
|
|
3
3
|
import { performHttpRequestThroughFetch } from '../../clients/fetch/index.js';
|
|
4
4
|
import { buildEntityRestAdapterMixins as adapterMixins } from '../entity-rest/build-entity-rest-adapter-mixins/index.js';
|
|
5
|
+
import { readWriteResponse } from '../entity-rest/read-write-response.js';
|
|
5
6
|
/**
|
|
6
7
|
* Runs an entity's verbs against the service that serves them, at the path the
|
|
7
8
|
* shell derives from each verb's key and binding — under the same base URL the
|
|
@@ -9,7 +10,9 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../entity-rest/bu
|
|
|
9
10
|
* ([ADR 0020](../../../../../../docs/adr/0020-endpoints-are-descriptors-and-the-shell-builds-an-httpapi.md)).
|
|
10
11
|
*
|
|
11
12
|
* A refusal arrives as the failure the service sent, decoded from its problem
|
|
12
|
-
* body, so a screen shows the coded message rather than a generic error.
|
|
13
|
+
* body, so a screen shows the coded message rather than a generic error. A
|
|
14
|
+
* verb that starts a flow answers `202 flowAccepted` and runs as pending; any
|
|
15
|
+
* other success is settled with the `data` of what the service answered.
|
|
13
16
|
*/ export const makeEntityRestUseCaseRunner = (entityConstructor, { uriConfig, configuration })=>{
|
|
14
17
|
var _metaEntity_key;
|
|
15
18
|
const metaEntity = extractMetaEntity(entityConstructor);
|
|
@@ -20,10 +23,14 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../entity-rest/bu
|
|
|
20
23
|
return {
|
|
21
24
|
run: (useCase, id)=>Effect.gen(function*() {
|
|
22
25
|
const url = yield* baseUrl(useCase.binding === 'entity' && id != null ? String(id) : undefined);
|
|
23
|
-
yield* performHttpRequestThroughFetch({
|
|
26
|
+
const response = yield* performHttpRequestThroughFetch({
|
|
24
27
|
method: 'POST',
|
|
25
28
|
url: `${url}/${useCase.key}`
|
|
26
29
|
});
|
|
30
|
+
return yield* readWriteResponse(response, ()=>{
|
|
31
|
+
var _response_body;
|
|
32
|
+
return Effect.succeed((_response_body = response.body) == null ? void 0 : _response_body.data);
|
|
33
|
+
});
|
|
27
34
|
}),
|
|
28
35
|
bulk: (useCase, selection)=>Effect.gen(function*() {
|
|
29
36
|
var _response_body;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/adapters/entity-use-case/make-entity-rest-use-case-runner.ts"],"sourcesContent":["import {\n type BulkOutcome,\n type Entity,\n type EntityConstructor,\n type EntityUseCaseRunner,\n extractMetaEntity,\n ProtocolFailure,\n toWireSelection,\n} from '@entifix/core';\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 * Runs an entity's verbs against the service that serves them, at the path the\n * shell derives from each verb's key and binding — under the same base URL the\n * entity's other adapters use, so a same-origin proxy is followed the same way\n * ([ADR 0020](../../../../../../docs/adr/0020-endpoints-are-descriptors-and-the-shell-builds-an-httpapi.md)).\n *\n * A refusal arrives as the failure the service sent, decoded from its problem\n * body, so a screen shows the coded message rather than a generic error.\n */\nexport const makeEntityRestUseCaseRunner = <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n { uriConfig, configuration }: BuildEntityRestOptions,\n): EntityUseCaseRunner => {\n const metaEntity = extractMetaEntity(entityConstructor);\n const name = metaEntity.key ?? metaEntity.name;\n const baseUrl = (id?: string) =>\n adapterMixins.buildEntityBaseUrl(configuration, { uriConfig }, name, id);\n\n return {\n run: (useCase, id) =>\n Effect.gen(function* () {\n const url = yield* baseUrl(\n useCase.binding === 'entity' && id != null ? String(id) : undefined,\n );\n yield* performHttpRequestThroughFetch({\n method: 'POST',\n url: `${url}/${useCase.key}`,\n });\n }),\n bulk: (useCase, selection) =>\n Effect.gen(function* () {\n const url = yield* baseUrl();\n // The wire form, never the selection itself: a `Set` serializes to\n // `{}`, so a selection sent raw would lose its ids.\n const response = yield* performHttpRequestThroughFetch<{\n readonly data?: unknown;\n }>({\n method: 'POST',\n url: `${url}/${useCase.key}`,\n headers: { 'Content-Type': 'application/json' },\n body: { selection: toWireSelection(selection) },\n });\n // A bulk answer is a `bulkOutcome` envelope, one outcome per record in\n // its `data`; anything else is a peer speaking something else.\n const outcomes = response.body?.data;\n if (!Array.isArray(outcomes)) {\n return yield* new ProtocolFailure({\n reason:\n 'a bulk answer carries its outcomes in a bulkOutcome envelope',\n });\n }\n return outcomes as readonly BulkOutcome[];\n }),\n };\n};\n"],"names":["extractMetaEntity","ProtocolFailure","toWireSelection","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","makeEntityRestUseCaseRunner","entityConstructor","uriConfig","configuration","metaEntity","name","key","baseUrl","id","buildEntityBaseUrl","run","useCase","gen","url","binding","String","undefined","method","
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/entity-use-case/make-entity-rest-use-case-runner.ts"],"sourcesContent":["import {\n type BulkOutcome,\n type Entity,\n type EntityConstructor,\n type EntityUseCaseRunner,\n extractMetaEntity,\n ProtocolFailure,\n toWireSelection,\n} from '@entifix/core';\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 { readWriteResponse } from '../entity-rest/read-write-response.js';\nimport type { BuildEntityRestOptions } from '../entity-rest/types.js';\n\n/**\n * Runs an entity's verbs against the service that serves them, at the path the\n * shell derives from each verb's key and binding — under the same base URL the\n * entity's other adapters use, so a same-origin proxy is followed the same way\n * ([ADR 0020](../../../../../../docs/adr/0020-endpoints-are-descriptors-and-the-shell-builds-an-httpapi.md)).\n *\n * A refusal arrives as the failure the service sent, decoded from its problem\n * body, so a screen shows the coded message rather than a generic error. A\n * verb that starts a flow answers `202 flowAccepted` and runs as pending; any\n * other success is settled with the `data` of what the service answered.\n */\nexport const makeEntityRestUseCaseRunner = <TEntity extends Entity>(\n entityConstructor: EntityConstructor<TEntity>,\n { uriConfig, configuration }: BuildEntityRestOptions,\n): EntityUseCaseRunner => {\n const metaEntity = extractMetaEntity(entityConstructor);\n const name = metaEntity.key ?? metaEntity.name;\n const baseUrl = (id?: string) =>\n adapterMixins.buildEntityBaseUrl(configuration, { uriConfig }, name, id);\n\n return {\n run: (useCase, id) =>\n Effect.gen(function* () {\n const url = yield* baseUrl(\n useCase.binding === 'entity' && id != null ? String(id) : undefined,\n );\n const response = yield* performHttpRequestThroughFetch<{\n readonly data?: unknown;\n }>({\n method: 'POST',\n url: `${url}/${useCase.key}`,\n });\n return yield* readWriteResponse(response, () =>\n Effect.succeed(response.body?.data),\n );\n }),\n bulk: (useCase, selection) =>\n Effect.gen(function* () {\n const url = yield* baseUrl();\n // The wire form, never the selection itself: a `Set` serializes to\n // `{}`, so a selection sent raw would lose its ids.\n const response = yield* performHttpRequestThroughFetch<{\n readonly data?: unknown;\n }>({\n method: 'POST',\n url: `${url}/${useCase.key}`,\n headers: { 'Content-Type': 'application/json' },\n body: { selection: toWireSelection(selection) },\n });\n // A bulk answer is a `bulkOutcome` envelope, one outcome per record in\n // its `data`; anything else is a peer speaking something else.\n const outcomes = response.body?.data;\n if (!Array.isArray(outcomes)) {\n return yield* new ProtocolFailure({\n reason:\n 'a bulk answer carries its outcomes in a bulkOutcome envelope',\n });\n }\n return outcomes as readonly BulkOutcome[];\n }),\n };\n};\n"],"names":["extractMetaEntity","ProtocolFailure","toWireSelection","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","readWriteResponse","makeEntityRestUseCaseRunner","entityConstructor","uriConfig","configuration","metaEntity","name","key","baseUrl","id","buildEntityBaseUrl","run","useCase","gen","url","binding","String","undefined","response","method","succeed","body","data","bulk","selection","headers","outcomes","Array","isArray","reason"],"mappings":"AAAA,SAKEA,iBAAiB,EACjBC,eAAe,EACfC,eAAe,QACV,gBAAgB;AACvB,SAASC,MAAM,QAAQ,SAAS;AAEhC,SAASC,8BAA8B,QAAQ,+BAA+B;AAC9E,SAASC,gCAAgCC,aAAa,QAAQ,2DAA2D;AACzH,SAASC,iBAAiB,QAAQ,wCAAwC;AAG1E;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,mBACA,EAAEC,SAAS,EAAEC,aAAa,EAA0B;QAGvCC;IADb,MAAMA,aAAaZ,kBAAkBS;IACrC,MAAMI,QAAOD,kBAAAA,WAAWE,GAAG,YAAdF,kBAAkBA,WAAWC,IAAI;IAC9C,MAAME,UAAU,CAACC,KACfV,cAAcW,kBAAkB,CAACN,eAAe;YAAED;QAAU,GAAGG,MAAMG;IAEvE,OAAO;QACLE,KAAK,CAACC,SAASH,KACbb,OAAOiB,GAAG,CAAC;gBACT,MAAMC,MAAM,OAAON,QACjBI,QAAQG,OAAO,KAAK,YAAYN,MAAM,OAAOO,OAAOP,MAAMQ;gBAE5D,MAAMC,WAAW,OAAOrB,+BAErB;oBACDsB,QAAQ;oBACRL,KAAK,GAAGA,IAAI,CAAC,EAAEF,QAAQL,GAAG,EAAE;gBAC9B;gBACA,OAAO,OAAOP,kBAAkBkB,UAAU;wBACzBA;2BAAftB,OAAOwB,OAAO,EAACF,iBAAAA,SAASG,IAAI,qBAAbH,eAAeI,IAAI;;YAEtC;QACFC,MAAM,CAACX,SAASY,YACd5B,OAAOiB,GAAG,CAAC;oBAcQK;gBAbjB,MAAMJ,MAAM,OAAON;gBACnB,mEAAmE;gBACnE,oDAAoD;gBACpD,MAAMU,WAAW,OAAOrB,+BAErB;oBACDsB,QAAQ;oBACRL,KAAK,GAAGA,IAAI,CAAC,EAAEF,QAAQL,GAAG,EAAE;oBAC5BkB,SAAS;wBAAE,gBAAgB;oBAAmB;oBAC9CJ,MAAM;wBAAEG,WAAW7B,gBAAgB6B;oBAAW;gBAChD;gBACA,uEAAuE;gBACvE,+DAA+D;gBAC/D,MAAME,YAAWR,iBAAAA,SAASG,IAAI,qBAAbH,eAAeI,IAAI;gBACpC,IAAI,CAACK,MAAMC,OAAO,CAACF,WAAW;oBAC5B,OAAO,OAAO,IAAIhC,gBAAgB;wBAChCmC,QACE;oBACJ;gBACF;gBACA,OAAOH;YACT;IACJ;AACF,EAAE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import '@entifix/transactions';
|
|
2
|
+
import { type EntifixFailure } from '@entifix/core';
|
|
3
|
+
import type { FlowStatusBody } from '@entifix/transactions';
|
|
4
|
+
import { Effect } from 'effect';
|
|
5
|
+
/** Reads where a flow stands from the `status` link its `202` named. */
|
|
6
|
+
export type FlowStatusReader = (href: string) => Effect.Effect<FlowStatusBody | undefined, EntifixFailure>;
|
|
7
|
+
/**
|
|
8
|
+
* Reads a flow's `status` link over HTTP, for a browser settling a write whose
|
|
9
|
+
* outcome it did not hear pushed.
|
|
10
|
+
*
|
|
11
|
+
* ⚠️ **A `404` answers `undefined`, and that is not a failure.** A status read
|
|
12
|
+
* is a projection of the flow's events, so a flow that has just started may
|
|
13
|
+
* not be in it yet; the caller keeps the write pending, up to its own bound
|
|
14
|
+
* ([ADR 0022](../../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).
|
|
15
|
+
* Every other failure stays a failure, so an unreachable service is not read
|
|
16
|
+
* as "no such flow".
|
|
17
|
+
*/
|
|
18
|
+
export declare const buildFlowStatusReader: () => FlowStatusReader;
|
|
19
|
+
//# sourceMappingURL=build-flow-status-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-flow-status-reader.d.ts","sourceRoot":"","sources":["../../../../src/adapters/flow-status/build-flow-status-reader/build-flow-status-reader.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,MAAM,KACT,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,SAAS,EAAE,cAAc,CAAC,CAAC;AAE/D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,QAAO,gBAatC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Loaded for its registration of `flowStatus`, which the decode below reads.
|
|
2
|
+
import '@entifix/transactions';
|
|
3
|
+
import { decodeEnvelope } from '@entifix/core';
|
|
4
|
+
import { Effect } from 'effect';
|
|
5
|
+
import { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';
|
|
6
|
+
import { isNotFound } from '../../is-not-found.js';
|
|
7
|
+
/**
|
|
8
|
+
* Reads a flow's `status` link over HTTP, for a browser settling a write whose
|
|
9
|
+
* outcome it did not hear pushed.
|
|
10
|
+
*
|
|
11
|
+
* ⚠️ **A `404` answers `undefined`, and that is not a failure.** A status read
|
|
12
|
+
* is a projection of the flow's events, so a flow that has just started may
|
|
13
|
+
* not be in it yet; the caller keeps the write pending, up to its own bound
|
|
14
|
+
* ([ADR 0022](../../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).
|
|
15
|
+
* Every other failure stays a failure, so an unreachable service is not read
|
|
16
|
+
* as "no such flow".
|
|
17
|
+
*/ export const buildFlowStatusReader = ()=>(href)=>Effect.gen(function*() {
|
|
18
|
+
const response = yield* performHttpRequestThroughFetch({
|
|
19
|
+
method: 'GET',
|
|
20
|
+
url: href
|
|
21
|
+
});
|
|
22
|
+
const envelope = yield* decodeEnvelope(response.body, 'flowStatus');
|
|
23
|
+
// Decoded against the registered `flowStatus` schema just above.
|
|
24
|
+
return envelope.data;
|
|
25
|
+
}).pipe(Effect.catch((error)=>isNotFound(error) ? Effect.succeed(undefined) : Effect.fail(error)));
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=build-flow-status-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/flow-status/build-flow-status-reader/build-flow-status-reader.ts"],"sourcesContent":["// Loaded for its registration of `flowStatus`, which the decode below reads.\nimport '@entifix/transactions';\n\nimport { decodeEnvelope, type EntifixFailure } from '@entifix/core';\nimport type { FlowStatusBody } from '@entifix/transactions';\nimport { Effect } from 'effect';\n\nimport { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';\nimport { isNotFound } from '../../is-not-found.js';\n\n/** Reads where a flow stands from the `status` link its `202` named. */\nexport type FlowStatusReader = (\n href: string,\n) => Effect.Effect<FlowStatusBody | undefined, EntifixFailure>;\n\n/**\n * Reads a flow's `status` link over HTTP, for a browser settling a write whose\n * outcome it did not hear pushed.\n *\n * ⚠️ **A `404` answers `undefined`, and that is not a failure.** A status read\n * is a projection of the flow's events, so a flow that has just started may\n * not be in it yet; the caller keeps the write pending, up to its own bound\n * ([ADR 0022](../../../../../../docs/adr/0022-two-settle-modes-and-the-pending-flow-store.md)).\n * Every other failure stays a failure, so an unreachable service is not read\n * as \"no such flow\".\n */\nexport const buildFlowStatusReader = (): FlowStatusReader => (href: string) =>\n Effect.gen(function* () {\n const response = yield* performHttpRequestThroughFetch({\n method: 'GET',\n url: href,\n });\n const envelope = yield* decodeEnvelope(response.body, 'flowStatus');\n // Decoded against the registered `flowStatus` schema just above.\n return envelope.data as FlowStatusBody;\n }).pipe(\n Effect.catch(error =>\n isNotFound(error) ? Effect.succeed(undefined) : Effect.fail(error),\n ),\n );\n"],"names":["decodeEnvelope","Effect","performHttpRequestThroughFetch","isNotFound","buildFlowStatusReader","href","gen","response","method","url","envelope","body","data","pipe","catch","error","succeed","undefined","fail"],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,wBAAwB;AAE/B,SAASA,cAAc,QAA6B,gBAAgB;AAEpE,SAASC,MAAM,QAAQ,SAAS;AAEhC,SAASC,8BAA8B,QAAQ,kCAAkC;AACjF,SAASC,UAAU,QAAQ,wBAAwB;AAOnD;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,wBAAwB,IAAwB,CAACC,OAC5DJ,OAAOK,GAAG,CAAC;YACT,MAAMC,WAAW,OAAOL,+BAA+B;gBACrDM,QAAQ;gBACRC,KAAKJ;YACP;YACA,MAAMK,WAAW,OAAOV,eAAeO,SAASI,IAAI,EAAE;YACtD,iEAAiE;YACjE,OAAOD,SAASE,IAAI;QACtB,GAAGC,IAAI,CACLZ,OAAOa,KAAK,CAACC,CAAAA,QACXZ,WAAWY,SAASd,OAAOe,OAAO,CAACC,aAAahB,OAAOiB,IAAI,CAACH,SAE9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/flow-status/build-flow-status-reader/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/flow-status/build-flow-status-reader/index.ts"],"sourcesContent":["export * from './build-flow-status-reader.js';\n"],"names":[],"mappings":"AAAA,cAAc,gCAAgC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A `404`, however it arrived: a service that answers a problem body says
|
|
3
|
+
* `NotFound`; one that answers no body at all is a protocol failure that
|
|
4
|
+
* still carries the status.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isNotFound: (error: unknown) => boolean;
|
|
7
|
+
//# sourceMappingURL=is-not-found.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-not-found.d.ts","sourceRoot":"","sources":["../../src/adapters/is-not-found.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,OAGgC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isTag } from '@entifix/core';
|
|
2
|
+
/**
|
|
3
|
+
* A `404`, however it arrived: a service that answers a problem body says
|
|
4
|
+
* `NotFound`; one that answers no body at all is a protocol failure that
|
|
5
|
+
* still carries the status.
|
|
6
|
+
*/ export const isNotFound = (error)=>isTag('NotFound')(error) || isTag('ProtocolFailure')(error) && error.upstreamStatus === 404;
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=is-not-found.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/is-not-found.ts"],"sourcesContent":["import { isTag } from '@entifix/core';\n\n/**\n * A `404`, however it arrived: a service 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 */\nexport const isNotFound = (error: unknown): boolean =>\n isTag('NotFound')(error) ||\n (isTag('ProtocolFailure')(error) &&\n (error as { readonly upstreamStatus?: unknown }).upstreamStatus === 404);\n"],"names":["isTag","isNotFound","error","upstreamStatus"],"mappings":"AAAA,SAASA,KAAK,QAAQ,gBAAgB;AAEtC;;;;CAIC,GACD,OAAO,MAAMC,aAAa,CAACC,QACzBF,MAAM,YAAYE,UACjBF,MAAM,mBAAmBE,UACxB,AAACA,MAAgDC,cAAc,KAAK,IAAK"}
|
|
@@ -1,4 +1,21 @@
|
|
|
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
|
+
*/
|
|
3
20
|
export declare const buildTransactionStatusReader: (options: Pick<BuildEntityRestOptions, "uriConfig" | "configuration">) => TransactionStatusReader;
|
|
4
21
|
//# 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;
|
|
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;AAWzE;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,4BAA4B,GACvC,SAAS,IAAI,CAAC,sBAAsB,EAAE,WAAW,GAAG,eAAe,CAAC,KACnE,uBA0BF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isTag } from '@entifix/core';
|
|
2
1
|
import { readTransactionRecordEnvelope } from '@entifix/transactions';
|
|
3
2
|
import { Effect } from 'effect';
|
|
4
3
|
import { performHttpRequestThroughFetch } from '../../../clients/fetch/index.js';
|
|
5
4
|
import { buildEntityRestAdapterMixins as adapterMixins } from '../../entity-rest/build-entity-rest-adapter-mixins/index.js';
|
|
5
|
+
import { isNotFound } from '../../is-not-found.js';
|
|
6
6
|
/**
|
|
7
7
|
* The tracker's own path segment. It is not an entity — nothing decorates a
|
|
8
8
|
* `TransactionRecord` — but the URL is composed the same way every entity URL
|
|
@@ -25,12 +25,7 @@ import { buildEntityRestAdapterMixins as adapterMixins } from '../../entity-rest
|
|
|
25
25
|
*
|
|
26
26
|
* Every other status stays an error, so an unreachable service is not quietly
|
|
27
27
|
* read as "no such transaction".
|
|
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
|
+
*/ export const buildTransactionStatusReader = (options)=>{
|
|
34
29
|
const { configuration } = options;
|
|
35
30
|
return {
|
|
36
31
|
read: (transactionId)=>Effect.gen(function*() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/adapters/transaction-status/build-transaction-status-reader/build-transaction-status-reader.ts"],"sourcesContent":["import type { EntifixFailure } 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';\nimport { isNotFound } from '../../is-not-found.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\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, EntifixFailure> =>\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":["readTransactionRecordEnvelope","Effect","performHttpRequestThroughFetch","buildEntityRestAdapterMixins","adapterMixins","isNotFound","TRANSACTION_PATH","buildTransactionStatusReader","options","configuration","read","transactionId","gen","url","buildEntityBaseUrl","response","buildEntityRequest","method","body","pipe","catch","error","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;AAE5H,SAASC,UAAU,QAAQ,wBAAwB;AAEnD;;;;;CAKC,GACD,MAAMC,mBAAmB;AAEzB;;;;;;;;;;;;;;;;CAgBC,GAED,OAAO,MAAMC,+BAA+B,CAC1CC;IAEA,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,OAAO;QACLE,MAAM,CACJC,gBAEAV,OAAOW,GAAG,CAAC;gBACT,MAAMC,MAAM,OAAOT,cAAcU,kBAAkB,CACjDL,eACAD,SACAF,kBACAK;gBAGF,MAAMI,WAAW,OAAOb,+BACtBE,cAAcY,kBAAkB,CAAC;oBAAEC,QAAQ;oBAAOJ;gBAAI;gBAGxD,OAAO,OAAOb,8BAA8Be,SAASG,IAAI;YAC3D,GAAGC,IAAI,CACLlB,OAAOmB,KAAK,CAACC,CAAAA,QACXhB,WAAWgB,SAASpB,OAAOqB,OAAO,CAACC,aAAatB,OAAOuB,IAAI,CAACH;IAGpE;AACF,EAAE"}
|
package/dist/clients/types.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/clients/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/clients/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD,MAAM,WAAW,WAAW,CAAC,KAAK,GAAG,KAAK;IACxC,MAAM,EAAE,UAAU,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,YAAY,CAAC,KAAK;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;CACb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/clients/types.ts"],"sourcesContent":["export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';\n\nexport type HttpHeaders = Record<string, string>;\n\nexport interface HttpRequest<TBody = never> {\n method: HttpMethod;\n url: string;\n headers?: HttpHeaders;\n body?: TBody;\n}\n\nexport interface HttpResponse<TBody> {\n status: number;\n headers: HttpHeaders;\n body: TBody;\n}\n"],"names":[],"mappings":"AAWA,WAIC"}
|
|
1
|
+
{"version":3,"sources":["../../src/clients/types.ts"],"sourcesContent":["export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';\n\nexport type HttpHeaders = Record<string, string>;\n\nexport interface HttpRequest<TBody = never> {\n method: HttpMethod;\n url: string;\n headers?: HttpHeaders;\n body?: TBody;\n}\n\nexport interface HttpResponse<TBody> {\n status: number;\n headers: HttpHeaders;\n body: TBody;\n}\n"],"names":[],"mappings":"AAWA,WAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration-client-rest-client.d.ts","sourceRoot":"","sources":["../../src/configuration-client/configuration-client-rest-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EAKzB,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,oCAAoC;IACnD,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;
|
|
1
|
+
{"version":3,"file":"configuration-client-rest-client.d.ts","sourceRoot":"","sources":["../../src/configuration-client/configuration-client-rest-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EAKzB,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,oCAAoC;IACnD,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AAoED;;;;;;;;;;;;GAYG;AACH,qBAAa,6BAA8B,YAAW,mBAAmB;;gBAG3D,OAAO,CAAC,EAAE,oCAAoC;IAgC1D,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,wBAAwB;CAG5C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as _class_private_field_loose_base } from "@swc/helpers/_/_class_private_field_loose_base";
|
|
2
2
|
import { _ as _class_private_field_loose_key } from "@swc/helpers/_/_class_private_field_loose_key";
|
|
3
|
-
import { ConfigurationClientInMemory,
|
|
3
|
+
import { ConfigurationClientInMemory, Unavailable } from '@entifix/core';
|
|
4
4
|
import { Effect } from 'effect';
|
|
5
5
|
const DEFAULT_CONFIG_URL = '/api/config';
|
|
6
6
|
var _pending = /*#__PURE__*/ _class_private_field_loose_key("_pending");
|
|
@@ -102,8 +102,10 @@ var _loadPlain = /*#__PURE__*/ _class_private_field_loose_key("_loadPlain");
|
|
|
102
102
|
};
|
|
103
103
|
_class_private_field_loose_base(this, _loadPlain)[_loadPlain] = Effect.tryPromise({
|
|
104
104
|
try: load,
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
// The configuration source could not be reached or did not answer: a
|
|
106
|
+
// dependency, so the next read asks again.
|
|
107
|
+
catch: ()=>new Unavailable({
|
|
108
|
+
dependency: url
|
|
107
109
|
})
|
|
108
110
|
});
|
|
109
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/configuration-client/configuration-client-rest-client.ts"],"sourcesContent":["import {\n ConfigurationClient,\n ConfigurationClientGroup,\n ConfigurationClientInMemory,\n ConfigurationExtractMode,\n ConfigurationPlain,\n
|
|
1
|
+
{"version":3,"sources":["../../src/configuration-client/configuration-client-rest-client.ts"],"sourcesContent":["import {\n ConfigurationClient,\n ConfigurationClientGroup,\n ConfigurationClientInMemory,\n ConfigurationExtractMode,\n ConfigurationPlain,\n Unavailable,\n} from '@entifix/core';\nimport { Effect } from 'effect';\n\nexport interface ConfigurationClientRestClientOptions {\n /** Endpoint returning this service's `ConfigurationPlain`. */\n url?: string;\n /**\n * Headers to send with the lookup.\n *\n * Empty for the browser, which reads its own app's same-origin `/api/config`\n * and needs nothing. A **server** component reads config-service directly —\n * there is no origin to proxy through and no browser to hide an address from\n * — and that endpoint is gated on the shared fleet token, so the caller has\n * to carry it. The header itself stays out of this package: the token is a\n * Next server concern and lives in `@entifix/next-shell`.\n */\n headers?: Readonly<Record<string, string>>;\n}\n\nconst DEFAULT_CONFIG_URL = '/api/config';\n\n/**\n * {@link ConfigurationClientGroup} view over an HTTP-sourced\n * {@link ConfigurationPlain}. Resolution is delegated to an in-memory store\n * once the plain configuration has been fetched.\n */\nclass ConfigurationClientGroupRestClient implements ConfigurationClientGroup {\n constructor(\n private readonly loadPlain: Effect.Effect<ConfigurationPlain, Unavailable>,\n private readonly group: string,\n ) {}\n\n #pending() {\n return Effect.die(\n new Error(\n 'ConfigurationClientGroupRestClient getter not implemented yet',\n ),\n );\n }\n\n getString(key: string, extractMode?: ConfigurationExtractMode) {\n return this.loadPlain.pipe(\n Effect.flatMap(plain =>\n new ConfigurationClientInMemory(plain)\n .in(this.group)\n .getString(key, extractMode),\n ),\n );\n }\n\n getNumber() {\n return this.#pending();\n }\n getDate() {\n return this.#pending();\n }\n getArrayNumber() {\n return this.#pending();\n }\n getArrayString() {\n return this.#pending();\n }\n getArrayDate() {\n return this.#pending();\n }\n getOptionalNumber() {\n return this.#pending();\n }\n getOptionalString() {\n return this.#pending();\n }\n getOptionalDate() {\n return this.#pending();\n }\n getOptionalArrayNumber() {\n return this.#pending();\n }\n getOptionalArrayString() {\n return this.#pending();\n }\n getOptionalArrayDate() {\n return this.#pending();\n }\n}\n\n/**\n * {@link ConfigurationClient} that sources its `ConfigurationPlain` over HTTP\n * (by default the same-origin `/api/config` route, which proxies\n * marketplace-config-api). The fetched configuration is memoized so it is\n * requested at most once per client instance — **once it has arrived**.\n *\n * ⚠️ A failed load is not memoized. Clients are usually built once per process\n * (a server component's module scope), and in a fleet that starts together the\n * first read routinely races config-service's boot. Caching that rejection made\n * the failure permanent: a storefront rendered an empty catalog until it was\n * restarted, while every service it reads from was healthy. Callers that arrive\n * while a request is in flight still share it.\n */\nexport class ConfigurationClientRestClient implements ConfigurationClient {\n #loadPlain: Effect.Effect<ConfigurationPlain, Unavailable>;\n\n constructor(options?: ConfigurationClientRestClientOptions) {\n const url = options?.url ?? DEFAULT_CONFIG_URL;\n const headers = options?.headers;\n let cache: Promise<ConfigurationPlain> | undefined;\n\n const load = (): Promise<ConfigurationPlain> => {\n if (cache !== undefined) return cache;\n const pending = fetch(url, { headers }).then(response => {\n if (!response.ok) {\n throw new Error(\n `Configuration request to ${url} failed with status ${response.status}`,\n );\n }\n return response.json() as Promise<ConfigurationPlain>;\n });\n cache = pending;\n // Forget a failure so the next read asks again. Nothing else clears the\n // cache, so the entry being cleared is always this request's own.\n pending.catch(() => {\n cache = undefined;\n });\n return pending;\n };\n\n this.#loadPlain = Effect.tryPromise({\n try: load,\n // The configuration source could not be reached or did not answer: a\n // dependency, so the next read asks again.\n catch: () => new Unavailable({ dependency: url }),\n });\n }\n\n in(group: string): ConfigurationClientGroup {\n return new ConfigurationClientGroupRestClient(this.#loadPlain, group);\n }\n}\n"],"names":["ConfigurationClientInMemory","Unavailable","Effect","DEFAULT_CONFIG_URL","ConfigurationClientGroupRestClient","getString","key","extractMode","loadPlain","pipe","flatMap","plain","in","group","getNumber","getDate","getArrayNumber","getArrayString","getArrayDate","getOptionalNumber","getOptionalString","getOptionalDate","getOptionalArrayNumber","getOptionalArrayString","getOptionalArrayDate","die","Error","ConfigurationClientRestClient","options","url","headers","cache","load","undefined","pending","fetch","then","response","ok","status","json","catch","tryPromise","try","dependency"],"mappings":";;AAAA,SAGEA,2BAA2B,EAG3BC,WAAW,QACN,gBAAgB;AACvB,SAASC,MAAM,QAAQ,SAAS;AAkBhC,MAAMC,qBAAqB;IAazB;AAXF;;;;CAIC,GACD,IAAA,AAAMC,qCAAN,MAAMA;IAcJC,UAAUC,GAAW,EAAEC,WAAsC,EAAE;QAC7D,OAAO,IAAI,CAACC,SAAS,CAACC,IAAI,CACxBP,OAAOQ,OAAO,CAACC,CAAAA,QACb,IAAIX,4BAA4BW,OAC7BC,EAAE,CAAC,IAAI,CAACC,KAAK,EACbR,SAAS,CAACC,KAAKC;IAGxB;IAEAO,YAAY;QACV,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,UAAU;QACR,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,iBAAiB;QACf,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,iBAAiB;QACf,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,eAAe;QACb,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,oBAAoB;QAClB,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,oBAAoB;QAClB,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,kBAAkB;QAChB,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,yBAAyB;QACvB,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,yBAAyB;QACvB,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IACAC,uBAAuB;QACrB,OAAO,gCAAA,IAAI,EAAC,UAAA;IACd;IAvDA,YACE,AAAiBhB,SAAyD,EAC1E,AAAiBK,KAAa,CAC9B;QAEF,4BAAA;mBAAA;;aAJmBL,YAAAA;aACAK,QAAAA;IAChB;AAqDL;AAnDE,SAAA;IACE,OAAOX,OAAOuB,GAAG,CACf,IAAIC,MACF;AAGN;IA6DA;AAdF;;;;;;;;;;;;CAYC,GACD,OAAO,MAAMC;IAmCXf,GAAGC,KAAa,EAA4B;QAC1C,OAAO,IAAIT,mCAAmC,gCAAA,IAAI,EAAC,YAAA,aAAYS;IACjE;IAlCA,YAAYe,OAA8C,CAAE;;QAF5D,4BAAA;;mBAAA,KAAA;;QAGE,MAAMC,cAAMD,2BAAAA,QAASC,GAAG,mBAAI1B;QAC5B,MAAM2B,UAAUF,2BAAAA,QAASE,OAAO;QAChC,IAAIC;QAEJ,MAAMC,OAAO;YACX,IAAID,UAAUE,WAAW,OAAOF;YAChC,MAAMG,UAAUC,MAAMN,KAAK;gBAAEC;YAAQ,GAAGM,IAAI,CAACC,CAAAA;gBAC3C,IAAI,CAACA,SAASC,EAAE,EAAE;oBAChB,MAAM,IAAIZ,MACR,CAAC,yBAAyB,EAAEG,IAAI,oBAAoB,EAAEQ,SAASE,MAAM,EAAE;gBAE3E;gBACA,OAAOF,SAASG,IAAI;YACtB;YACAT,QAAQG;YACR,wEAAwE;YACxE,kEAAkE;YAClEA,QAAQO,KAAK,CAAC;gBACZV,QAAQE;YACV;YACA,OAAOC;QACT;QAEA,gCAAA,IAAI,EAAC,YAAA,cAAahC,OAAOwC,UAAU,CAAC;YAClCC,KAAKX;YACL,qEAAqE;YACrE,2CAA2C;YAC3CS,OAAO,IAAM,IAAIxC,YAAY;oBAAE2C,YAAYf;gBAAI;QACjD;IACF;AAKF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ export * from './adapters/entity-rest/build-entity-rest-adapter-facets/index.js'
|
|
|
4
4
|
export * from './adapters/entity-rest/build-entity-rest-adapter-get/index.js';
|
|
5
5
|
export * from './adapters/entity-rest/build-entity-rest-adapter-load/index.js';
|
|
6
6
|
export * from './adapters/entity-rest/build-entity-rest-adapter-save/index.js';
|
|
7
|
+
export * from './adapters/entity-rest/build-entity-rest-adapter-write/index.js';
|
|
7
8
|
export * from './adapters/entity-rest/types.js';
|
|
8
9
|
export * from './adapters/entity-use-case/index.js';
|
|
10
|
+
export * from './adapters/flow-status/build-flow-status-reader/index.js';
|
|
9
11
|
export * from './adapters/transaction-status/build-transaction-status-reader/index.js';
|
|
10
12
|
export * from './clients/fetch/index.js';
|
|
11
13
|
export * from './clients/types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iEAAiE,CAAC;AAChF,cAAc,kEAAkE,CAAC;AACjF,cAAc,kEAAkE,CAAC;AACjF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wEAAwE,CAAC;AACvF,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iEAAiE,CAAC;AAChF,cAAc,kEAAkE,CAAC;AACjF,cAAc,kEAAkE,CAAC;AACjF,cAAc,+DAA+D,CAAC;AAC9E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,gEAAgE,CAAC;AAC/E,cAAc,iEAAiE,CAAC;AAChF,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0DAA0D,CAAC;AACzE,cAAc,wEAAwE,CAAC;AACvF,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,10 @@ export * from './adapters/entity-rest/build-entity-rest-adapter-facets/index.js'
|
|
|
4
4
|
export * from './adapters/entity-rest/build-entity-rest-adapter-get/index.js';
|
|
5
5
|
export * from './adapters/entity-rest/build-entity-rest-adapter-load/index.js';
|
|
6
6
|
export * from './adapters/entity-rest/build-entity-rest-adapter-save/index.js';
|
|
7
|
+
export * from './adapters/entity-rest/build-entity-rest-adapter-write/index.js';
|
|
7
8
|
export * from './adapters/entity-rest/types.js';
|
|
8
9
|
export * from './adapters/entity-use-case/index.js';
|
|
10
|
+
export * from './adapters/flow-status/build-flow-status-reader/index.js';
|
|
9
11
|
export * from './adapters/transaction-status/build-transaction-status-reader/index.js';
|
|
10
12
|
export * from './clients/fetch/index.js';
|
|
11
13
|
export * from './clients/types.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './adapters/entity-metadata/make-entity-metadata-source/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-delete/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-facets/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-get/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-load/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-save/index.js';\nexport * from './adapters/entity-rest/types.js';\nexport * from './adapters/entity-use-case/index.js';\nexport * from './adapters/transaction-status/build-transaction-status-reader/index.js';\nexport * from './clients/fetch/index.js';\nexport * from './clients/types.js';\nexport * from './configuration-client/index.js';\n"],"names":[],"mappings":"AAAA,cAAc,kEAAkE;AAChF,cAAc,mEAAmE;AACjF,cAAc,mEAAmE;AACjF,cAAc,gEAAgE;AAC9E,cAAc,iEAAiE;AAC/E,cAAc,iEAAiE;AAC/E,cAAc,kCAAkC;AAChD,cAAc,sCAAsC;AACpD,cAAc,yEAAyE;AACvF,cAAc,2BAA2B;AACzC,cAAc,qBAAqB;AACnC,cAAc,kCAAkC"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './adapters/entity-metadata/make-entity-metadata-source/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-delete/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-facets/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-get/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-load/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-save/index.js';\nexport * from './adapters/entity-rest/build-entity-rest-adapter-write/index.js';\nexport * from './adapters/entity-rest/types.js';\nexport * from './adapters/entity-use-case/index.js';\nexport * from './adapters/flow-status/build-flow-status-reader/index.js';\nexport * from './adapters/transaction-status/build-transaction-status-reader/index.js';\nexport * from './clients/fetch/index.js';\nexport * from './clients/types.js';\nexport * from './configuration-client/index.js';\n"],"names":[],"mappings":"AAAA,cAAc,kEAAkE;AAChF,cAAc,mEAAmE;AACjF,cAAc,mEAAmE;AACjF,cAAc,gEAAgE;AAC9E,cAAc,iEAAiE;AAC/E,cAAc,iEAAiE;AAC/E,cAAc,kEAAkE;AAChF,cAAc,kCAAkC;AAChD,cAAc,sCAAsC;AACpD,cAAc,2DAA2D;AACzE,cAAc,yEAAyE;AACvF,cAAc,2BAA2B;AACzC,cAAc,qBAAqB;AACnC,cAAc,kCAAkC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entifix/rest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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": {
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@swc/helpers": "0.5.23",
|
|
59
|
-
"@entifix/core": "0.
|
|
60
|
-
"@entifix/transactions": "0.
|
|
59
|
+
"@entifix/core": "0.14.0",
|
|
60
|
+
"@entifix/transactions": "0.14.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"effect": "4.0.
|
|
64
|
-
"@entifix/testing-unit": "0.
|
|
63
|
+
"effect": "4.0.7",
|
|
64
|
+
"@entifix/testing-unit": "0.14.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"effect": "^4.0.
|
|
67
|
+
"effect": "^4.0.7"
|
|
68
68
|
}
|
|
69
69
|
}
|