@entifix/rest 0.23.4 → 0.23.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-client.d.ts","sourceRoot":"","sources":["../../src/endpoint/endpoint-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"endpoint-client.d.ts","sourceRoot":"","sources":["../../src/endpoint/endpoint-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAKhB,KAAK,eAAe,EAEpB,KAAK,eAAe,EAEpB,KAAK,eAAe,EACpB,KAAK,cAAc,EAOnB,KAAK,gBAAgB,EAGtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EACL,UAAU,EAGX,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,CACvC,MAAM,EACN,MAAM,EACN,iBAAiB,GAAG,WAAW,GAAG,SAAS,CAC5C,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAC/B,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEvD,sFAAsF;AACtF,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GACrD,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GAC3C,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACjC,OAAO,GACP;IAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GACrC,OAAO,CAAC,CAAC;AAEf,0CAA0C;AAC1C,MAAM,MAAM,cAAc,CAAC,SAAS,SAAS,aAAa,CAAC,WAAW,CAAC,IAAI;IACzE,QAAQ,EAAE,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAC9C,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAC5B,MAAM,CAAC,MAAM,CAChB,eAAe,CAAC,CAAC,CAAC,EAClB,mBAAmB,CAAC,CAAC,CAAC,EACtB,UAAU,CAAC,UAAU,CACtB;CACF,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,CACzB,MAAM,EAAE,UAAU,CAAC,UAAU,KAC1B,UAAU,CAAC,UAAU,CAAC;CAC5B;AAmOD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,KAAK,CAAC,SAAS,SAAS,aAAa,CAAC,WAAW,CAAC,EAElD,WAAW,SAAS,EACpB,SAAS,qBAAqB,KAC7B,cAAc,CAAC,SAAS,CAMgB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
2
|
+
import { bodyEncodingOf, currentRemainingMs, DEADLINE_HEADER, decodeProblem, formatIdempotencyKey, IDEMPOTENCY_KEY_HEADER, isBinaryResponse, Overloaded, PROBLEM_CONTENT_TYPE, ProtocolFailure, Timeout, Unavailable } from '@entifix/core';
|
|
2
3
|
import { Effect, Schema } from 'effect';
|
|
3
4
|
import { HttpClient, HttpClientRequest } from 'effect/http';
|
|
4
5
|
const toSchema = (schema)=>Schema.isSchema(schema) ? schema : Schema.Struct(schema);
|
|
@@ -44,6 +45,25 @@ const ALWAYS = new Set([
|
|
|
44
45
|
retryAfterSeconds: retryAfter
|
|
45
46
|
}) : failure;
|
|
46
47
|
});
|
|
48
|
+
/**
|
|
49
|
+
* The request carrying `payload` the way its descriptor declared it: JSON
|
|
50
|
+
* unless it said text, a form or raw bytes.
|
|
51
|
+
*/ const withBody = (outgoing, descriptor, payload)=>{
|
|
52
|
+
const encoding = bodyEncodingOf(toSchema(descriptor.payload));
|
|
53
|
+
switch(encoding == null ? void 0 : encoding.kind){
|
|
54
|
+
case 'text':
|
|
55
|
+
return HttpClientRequest.bodyText(outgoing, payload, encoding.contentType);
|
|
56
|
+
case 'form':
|
|
57
|
+
return HttpClientRequest.bodyUrlParams(outgoing, payload);
|
|
58
|
+
case 'binary':
|
|
59
|
+
{
|
|
60
|
+
const { bytes, contentType } = payload;
|
|
61
|
+
return HttpClientRequest.bodyUint8Array(outgoing, bytes, contentType);
|
|
62
|
+
}
|
|
63
|
+
default:
|
|
64
|
+
return HttpClientRequest.bodyText(outgoing, JSON.stringify(payload), 'application/json');
|
|
65
|
+
}
|
|
66
|
+
};
|
|
47
67
|
const parse = (text)=>{
|
|
48
68
|
try {
|
|
49
69
|
return JSON.parse(text);
|
|
@@ -62,8 +82,8 @@ const call = (descriptor, options, request)=>Effect.gen(function*() {
|
|
|
62
82
|
const params = yield* encode(descriptor.params, request['params']);
|
|
63
83
|
const query = yield* encode(descriptor.query, request['query']);
|
|
64
84
|
const payload = yield* encode(descriptor.payload, request['payload']);
|
|
65
|
-
let outgoing = HttpClientRequest.make(descriptor.method)(`${options.baseUrl}${pathOf(descriptor.path, params)}`).pipe(HttpClientRequest.setUrlParams(queryOf(query)), HttpClientRequest.setHeader('accept', 'application/json'));
|
|
66
|
-
if (descriptor.payload !== undefined) outgoing =
|
|
85
|
+
let outgoing = HttpClientRequest.make(descriptor.method)(`${options.baseUrl}${pathOf(descriptor.path, params)}`).pipe(HttpClientRequest.setUrlParams(queryOf(query)), HttpClientRequest.setHeader('accept', isBinaryResponse(descriptor.success) ? '*/*' : 'application/json'));
|
|
86
|
+
if (descriptor.payload !== undefined) outgoing = withBody(outgoing, descriptor, payload);
|
|
67
87
|
if (descriptor.idempotent !== undefined) outgoing = HttpClientRequest.setHeader(outgoing, IDEMPOTENCY_KEY_HEADER, formatIdempotencyKey(request['idempotencyKey']));
|
|
68
88
|
if (remaining !== undefined) outgoing = HttpClientRequest.setHeader(outgoing, DEADLINE_HEADER, String(remaining));
|
|
69
89
|
const base = yield* HttpClient.HttpClient;
|
|
@@ -72,6 +92,19 @@ const call = (descriptor, options, request)=>Effect.gen(function*() {
|
|
|
72
92
|
dependency: `${descriptor.method} ${descriptor.path}`
|
|
73
93
|
})));
|
|
74
94
|
if (response.status >= 400) return yield* Effect.fail((yield* failureOf(descriptor, response)));
|
|
95
|
+
if (isBinaryResponse(descriptor.success)) {
|
|
96
|
+
const buffer = yield* response.arrayBuffer.pipe(Effect.mapError(()=>new Unavailable({
|
|
97
|
+
dependency: `${descriptor.method} ${descriptor.path}`
|
|
98
|
+
})));
|
|
99
|
+
const _response_headers = response.headers, { 'content-type': contentType } = _response_headers, headers = _object_without_properties_loose(_response_headers, [
|
|
100
|
+
'content-type'
|
|
101
|
+
]);
|
|
102
|
+
return {
|
|
103
|
+
bytes: new Uint8Array(buffer),
|
|
104
|
+
contentType: contentType != null ? contentType : 'application/octet-stream',
|
|
105
|
+
headers
|
|
106
|
+
};
|
|
107
|
+
}
|
|
75
108
|
const text = yield* response.text.pipe(Effect.mapError(()=>new Unavailable({
|
|
76
109
|
dependency: `${descriptor.method} ${descriptor.path}`
|
|
77
110
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/endpoint/endpoint-client.ts"],"sourcesContent":["import {\n type AnyEndpoint,\n currentRemainingMs,\n DEADLINE_HEADER,\n type DeclaredFailure,\n decodeProblem,\n type EndpointRequest,\n type EndpointSchema,\n type EndpointSuccess,\n type EntifixFailure,\n formatIdempotencyKey,\n IDEMPOTENCY_KEY_HEADER,\n Overloaded,\n PROBLEM_CONTENT_TYPE,\n ProtocolFailure,\n type TechnicalFailure,\n Timeout,\n Unavailable,\n} from '@entifix/core';\nimport { Effect, Schema } from 'effect';\nimport {\n HttpClient,\n HttpClientRequest,\n type HttpClientResponse,\n} from 'effect/http';\n\n/**\n * A refusal any guarded endpoint may answer without declaring it: the caller\n * is not signed in, may not, or sent something the endpoint cannot read.\n */\nexport type GuardFailure = EntifixFailure<\n string,\n string,\n 'unauthenticated' | 'forbidden' | 'invalid'\n>;\n\n/** Everything a call may fail with: what it declares, and what any call may. */\nexport type EndpointCallFailure<D> =\n DeclaredFailure<D> | GuardFailure | TechnicalFailure;\n\n/** What a caller sends: the endpoint's decoded parts, and its key when idempotent. */\nexport type EndpointCallRequest<D> = EndpointRequest<D> &\n (D extends { readonly idempotent?: infer Mode }\n ? [NonNullable<Mode>] extends [never]\n ? unknown\n : { readonly idempotencyKey: string }\n : unknown);\n\n/** One call per endpoint, by its name. */\nexport type EndpointClient<Endpoints extends ReadonlyArray<AnyEndpoint>> = {\n readonly [D in Endpoints[number] as D['name']]: (\n request: EndpointCallRequest<D>,\n ) => Effect.Effect<\n EndpointSuccess<D>,\n EndpointCallFailure<D>,\n HttpClient.HttpClient\n >;\n};\n\nexport interface EndpointClientOptions {\n /** The origin and any prefix the endpoints' paths are joined to. */\n readonly baseUrl: string;\n /**\n * Shapes the client before each call — forwarding a cookie from a Next\n * server component, or adding a crossing token for a participant call.\n */\n readonly transformClient?: (\n client: HttpClient.HttpClient,\n ) => HttpClient.HttpClient;\n}\n\nconst toSchema = (schema: EndpointSchema): Schema.Top =>\n Schema.isSchema(schema) ? schema : Schema.Struct(schema);\n\nconst encode = (schema: EndpointSchema | undefined, value: unknown) =>\n schema === undefined\n ? Effect.succeed(undefined)\n : Schema.encodeUnknownEffect(\n toSchema(schema) as Schema.Codec<unknown, unknown>,\n )(value).pipe(\n Effect.mapError(\n error =>\n new ProtocolFailure({\n reason: `the request does not encode: ${error.message}`,\n }),\n ),\n );\n\n/**\n * The path with every `:param` replaced by its encoded value. A path that\n * names a parameter is one whose descriptor declares it, so the encoded\n * params carry every name the path does.\n */\nconst pathOf = (path: string, params: unknown): string =>\n path.replace(/:([A-Za-z0-9_]+)/g, (_match, name: string) =>\n encodeURIComponent(String((params as Record<string, unknown>)[name])),\n );\n\nconst queryOf = (query: unknown): Record<string, string | string[]> =>\n Object.fromEntries(\n Object.entries((query ?? {}) as Record<string, unknown>)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [\n key,\n Array.isArray(value) ? value.map(String) : String(value),\n ]),\n );\n\nconst ALWAYS: ReadonlySet<string> = new Set([\n 'unauthenticated',\n 'forbidden',\n 'invalid',\n]);\n\n/**\n * The failure a response names, decoded by its `code` against what the\n * endpoint may answer — never by its status, which is the shell's to choose.\n * A business failure the endpoint does not declare, a code nobody registered\n * and a body that is not a problem are all `protocol`: the peer said something\n * this contract does not admit.\n */\nconst failureOf = (\n descriptor: AnyEndpoint,\n response: HttpClientResponse.HttpClientResponse,\n) =>\n Effect.gen(function* () {\n const text = yield* response.text.pipe(Effect.orElseSucceed(() => ''));\n const isProblem =\n response.headers['content-type']?.startsWith(PROBLEM_CONTENT_TYPE) ===\n true;\n if (!isProblem)\n return new ProtocolFailure({\n reason: `${descriptor.method} ${descriptor.path} answered ${String(response.status)} without a problem body`,\n upstreamStatus: response.status,\n }) as EntifixFailure;\n\n const failure = decodeProblem(parse(text), response.status);\n const declared = descriptor.errors.some(\n failureClass => failureClass.identifier === failure._tag,\n );\n if (\n failure.family === 'business' &&\n !declared &&\n !ALWAYS.has(failure.category)\n )\n return new ProtocolFailure({\n reason: `${descriptor.method} ${descriptor.path} answered '${failure.code}', which it does not declare`,\n upstreamStatus: response.status,\n });\n\n const retryAfter = Number(response.headers['retry-after']);\n return failure._tag === 'Overloaded' &&\n !('retryAfterSeconds' in failure) &&\n Number.isFinite(retryAfter) &&\n retryAfter > 0\n ? new Overloaded({ retryAfterSeconds: retryAfter })\n : failure;\n });\n\nconst parse = (text: string): unknown => {\n try {\n return JSON.parse(text) as unknown;\n } catch {\n return undefined;\n }\n};\n\nconst call = (\n descriptor: AnyEndpoint,\n options: EndpointClientOptions,\n request: Record<string, unknown>,\n) =>\n Effect.gen(function* () {\n // The caller's remaining budget travels on, and a budget already spent is\n // not worth a round trip.\n const remaining = yield* currentRemainingMs;\n if (remaining === 0)\n return yield* Effect.fail(\n new Timeout({ dependency: `${descriptor.method} ${descriptor.path}` }),\n );\n\n const params = yield* encode(descriptor.params, request['params']);\n const query = yield* encode(descriptor.query, request['query']);\n const payload = yield* encode(descriptor.payload, request['payload']);\n\n let outgoing = HttpClientRequest.make(descriptor.method)(\n `${options.baseUrl}${pathOf(descriptor.path, params)}`,\n ).pipe(\n HttpClientRequest.setUrlParams(queryOf(query)),\n HttpClientRequest.setHeader('accept', 'application/json'),\n );\n if (descriptor.payload !== undefined)\n outgoing = HttpClientRequest.bodyText(\n outgoing,\n JSON.stringify(payload),\n 'application/json',\n );\n if (descriptor.idempotent !== undefined)\n outgoing = HttpClientRequest.setHeader(\n outgoing,\n IDEMPOTENCY_KEY_HEADER,\n formatIdempotencyKey(request['idempotencyKey'] as string),\n );\n if (remaining !== undefined)\n outgoing = HttpClientRequest.setHeader(\n outgoing,\n DEADLINE_HEADER,\n String(remaining),\n );\n\n const base = yield* HttpClient.HttpClient;\n const client = options.transformClient?.(base) ?? base;\n const response = yield* client.execute(outgoing).pipe(\n Effect.mapError(\n () =>\n new Unavailable({\n dependency: `${descriptor.method} ${descriptor.path}`,\n }),\n ),\n );\n\n if (response.status >= 400)\n return yield* Effect.fail(yield* failureOf(descriptor, response));\n\n const text = yield* response.text.pipe(\n Effect.mapError(\n () =>\n new Unavailable({\n dependency: `${descriptor.method} ${descriptor.path}`,\n }),\n ),\n );\n return yield* Schema.decodeUnknownEffect(\n descriptor.success as Schema.Codec<unknown, unknown>,\n )(text === '' ? undefined : parse(text)).pipe(\n Effect.mapError(\n error =>\n new ProtocolFailure({\n reason: `${descriptor.method} ${descriptor.path} answered a body that does not decode: ${error.message}`,\n upstreamStatus: response.status,\n }),\n ),\n );\n });\n\n/**\n * A typed client over a set of endpoint descriptors\n * ([ADR 0020](../../../../../docs/adr/0020-endpoints-are-descriptors-and-the-shell-builds-an-httpapi.md)):\n * one call per endpoint, by name, typed from its descriptor. It runs wherever\n * an `HttpClient` does — `FetchHttpClient` in a browser, a Next server with a\n * forwarded cookie, an Effect service calling a participant — and needs\n * nothing of the shell that serves the endpoints, its status table included.\n */\nexport const makeEndpointClient = <\n const Endpoints extends ReadonlyArray<AnyEndpoint>,\n>(\n endpoints: Endpoints,\n options: EndpointClientOptions,\n): EndpointClient<Endpoints> =>\n Object.fromEntries(\n endpoints.map(descriptor => [\n descriptor.name,\n (request: Record<string, unknown>) => call(descriptor, options, request),\n ]),\n ) as unknown as EndpointClient<Endpoints>;\n"],"names":["currentRemainingMs","DEADLINE_HEADER","decodeProblem","formatIdempotencyKey","IDEMPOTENCY_KEY_HEADER","Overloaded","PROBLEM_CONTENT_TYPE","ProtocolFailure","Timeout","Unavailable","Effect","Schema","HttpClient","HttpClientRequest","toSchema","schema","isSchema","Struct","encode","value","undefined","succeed","encodeUnknownEffect","pipe","mapError","error","reason","message","pathOf","path","params","replace","_match","name","encodeURIComponent","String","queryOf","query","Object","fromEntries","entries","filter","map","key","Array","isArray","ALWAYS","Set","failureOf","descriptor","response","gen","text","orElseSucceed","isProblem","headers","startsWith","method","status","upstreamStatus","failure","parse","declared","errors","some","failureClass","identifier","_tag","family","has","category","code","retryAfter","Number","isFinite","retryAfterSeconds","JSON","call","options","request","remaining","fail","dependency","payload","outgoing","make","baseUrl","setUrlParams","setHeader","bodyText","stringify","idempotent","base","client","transformClient","execute","decodeUnknownEffect","success","makeEndpointClient","endpoints"],"mappings":"AAAA,SAEEA,kBAAkB,EAClBC,eAAe,EAEfC,aAAa,EAKbC,oBAAoB,EACpBC,sBAAsB,EACtBC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EAEfC,OAAO,EACPC,WAAW,QACN,gBAAgB;AACvB,SAASC,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,SACEC,UAAU,EACVC,i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AAY;gBACdyE,YAAY,GAAGjC,WAAWQ,MAAM,CAAC,CAAC,EAAER,WAAWpB,IAAI,EAAE;YACvD;QAGN,OAAO,OAAOlB,OAAOqF,mBAAmB,CACtC/C,WAAWgD,OAAO,EAClB7C,SAAS,KAAKhC,YAAYyC,MAAMT,OAAO7B,IAAI,CAC3Cb,OAAOc,QAAQ,CACbC,CAAAA,QACE,IAAIlB,gBAAgB;gBAClBmB,QAAQ,GAAGuB,WAAWQ,MAAM,CAAC,CAAC,EAAER,WAAWpB,IAAI,CAAC,uCAAuC,EAAEJ,MAAME,OAAO,EAAE;gBACxGgC,gBAAgBT,SAASQ,MAAM;YACjC;IAGR;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMwC,qBAAqB,CAGhCC,WACArB,UAEAxC,OAAOC,WAAW,CAChB4D,UAAUzD,GAAG,CAACO,CAAAA,aAAc;YAC1BA,WAAWhB,IAAI;YACf,CAAC8C,UAAqCF,KAAK5B,YAAY6B,SAASC;SACjE,GACuC"}
|
|
1
|
+
{"version":3,"sources":["../../src/endpoint/endpoint-client.ts"],"sourcesContent":["import {\n type AnyEndpoint,\n type BinaryBody,\n bodyEncodingOf,\n currentRemainingMs,\n DEADLINE_HEADER,\n type DeclaredFailure,\n decodeProblem,\n type EndpointRequest,\n type EndpointSchema,\n type EndpointSuccess,\n type EntifixFailure,\n formatIdempotencyKey,\n IDEMPOTENCY_KEY_HEADER,\n isBinaryResponse,\n Overloaded,\n PROBLEM_CONTENT_TYPE,\n ProtocolFailure,\n type TechnicalFailure,\n Timeout,\n Unavailable,\n} from '@entifix/core';\nimport { Effect, Schema } from 'effect';\nimport {\n HttpClient,\n HttpClientRequest,\n type HttpClientResponse,\n} from 'effect/http';\n\n/**\n * A refusal any guarded endpoint may answer without declaring it: the caller\n * is not signed in, may not, or sent something the endpoint cannot read.\n */\nexport type GuardFailure = EntifixFailure<\n string,\n string,\n 'unauthenticated' | 'forbidden' | 'invalid'\n>;\n\n/** Everything a call may fail with: what it declares, and what any call may. */\nexport type EndpointCallFailure<D> =\n DeclaredFailure<D> | GuardFailure | TechnicalFailure;\n\n/** What a caller sends: the endpoint's decoded parts, and its key when idempotent. */\nexport type EndpointCallRequest<D> = EndpointRequest<D> &\n (D extends { readonly idempotent?: infer Mode }\n ? [NonNullable<Mode>] extends [never]\n ? unknown\n : { readonly idempotencyKey: string }\n : unknown);\n\n/** One call per endpoint, by its name. */\nexport type EndpointClient<Endpoints extends ReadonlyArray<AnyEndpoint>> = {\n readonly [D in Endpoints[number] as D['name']]: (\n request: EndpointCallRequest<D>,\n ) => Effect.Effect<\n EndpointSuccess<D>,\n EndpointCallFailure<D>,\n HttpClient.HttpClient\n >;\n};\n\nexport interface EndpointClientOptions {\n /** The origin and any prefix the endpoints' paths are joined to. */\n readonly baseUrl: string;\n /**\n * Shapes the client before each call — forwarding a cookie from a Next\n * server component, or adding a crossing token for a participant call.\n */\n readonly transformClient?: (\n client: HttpClient.HttpClient,\n ) => HttpClient.HttpClient;\n}\n\nconst toSchema = (schema: EndpointSchema): Schema.Top =>\n Schema.isSchema(schema) ? schema : Schema.Struct(schema);\n\nconst encode = (schema: EndpointSchema | undefined, value: unknown) =>\n schema === undefined\n ? Effect.succeed(undefined)\n : Schema.encodeUnknownEffect(\n toSchema(schema) as Schema.Codec<unknown, unknown>,\n )(value).pipe(\n Effect.mapError(\n error =>\n new ProtocolFailure({\n reason: `the request does not encode: ${error.message}`,\n }),\n ),\n );\n\n/**\n * The path with every `:param` replaced by its encoded value. A path that\n * names a parameter is one whose descriptor declares it, so the encoded\n * params carry every name the path does.\n */\nconst pathOf = (path: string, params: unknown): string =>\n path.replace(/:([A-Za-z0-9_]+)/g, (_match, name: string) =>\n encodeURIComponent(String((params as Record<string, unknown>)[name])),\n );\n\nconst queryOf = (query: unknown): Record<string, string | string[]> =>\n Object.fromEntries(\n Object.entries((query ?? {}) as Record<string, unknown>)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [\n key,\n Array.isArray(value) ? value.map(String) : String(value),\n ]),\n );\n\nconst ALWAYS: ReadonlySet<string> = new Set([\n 'unauthenticated',\n 'forbidden',\n 'invalid',\n]);\n\n/**\n * The failure a response names, decoded by its `code` against what the\n * endpoint may answer — never by its status, which is the shell's to choose.\n * A business failure the endpoint does not declare, a code nobody registered\n * and a body that is not a problem are all `protocol`: the peer said something\n * this contract does not admit.\n */\nconst failureOf = (\n descriptor: AnyEndpoint,\n response: HttpClientResponse.HttpClientResponse,\n) =>\n Effect.gen(function* () {\n const text = yield* response.text.pipe(Effect.orElseSucceed(() => ''));\n const isProblem =\n response.headers['content-type']?.startsWith(PROBLEM_CONTENT_TYPE) ===\n true;\n if (!isProblem)\n return new ProtocolFailure({\n reason: `${descriptor.method} ${descriptor.path} answered ${String(response.status)} without a problem body`,\n upstreamStatus: response.status,\n }) as EntifixFailure;\n\n const failure = decodeProblem(parse(text), response.status);\n const declared = descriptor.errors.some(\n failureClass => failureClass.identifier === failure._tag,\n );\n if (\n failure.family === 'business' &&\n !declared &&\n !ALWAYS.has(failure.category)\n )\n return new ProtocolFailure({\n reason: `${descriptor.method} ${descriptor.path} answered '${failure.code}', which it does not declare`,\n upstreamStatus: response.status,\n });\n\n const retryAfter = Number(response.headers['retry-after']);\n return failure._tag === 'Overloaded' &&\n !('retryAfterSeconds' in failure) &&\n Number.isFinite(retryAfter) &&\n retryAfter > 0\n ? new Overloaded({ retryAfterSeconds: retryAfter })\n : failure;\n });\n\n/**\n * The request carrying `payload` the way its descriptor declared it: JSON\n * unless it said text, a form or raw bytes.\n */\nconst withBody = (\n outgoing: HttpClientRequest.HttpClientRequest,\n descriptor: AnyEndpoint,\n payload: unknown,\n): HttpClientRequest.HttpClientRequest => {\n const encoding = bodyEncodingOf(toSchema(descriptor.payload!));\n switch (encoding?.kind) {\n case 'text':\n return HttpClientRequest.bodyText(\n outgoing,\n payload as string,\n encoding.contentType,\n );\n case 'form':\n return HttpClientRequest.bodyUrlParams(\n outgoing,\n payload as Record<string, string>,\n );\n case 'binary': {\n const { bytes, contentType } = payload as BinaryBody;\n return HttpClientRequest.bodyUint8Array(outgoing, bytes, contentType);\n }\n default:\n return HttpClientRequest.bodyText(\n outgoing,\n JSON.stringify(payload),\n 'application/json',\n );\n }\n};\n\nconst parse = (text: string): unknown => {\n try {\n return JSON.parse(text) as unknown;\n } catch {\n return undefined;\n }\n};\n\nconst call = (\n descriptor: AnyEndpoint,\n options: EndpointClientOptions,\n request: Record<string, unknown>,\n) =>\n Effect.gen(function* () {\n // The caller's remaining budget travels on, and a budget already spent is\n // not worth a round trip.\n const remaining = yield* currentRemainingMs;\n if (remaining === 0)\n return yield* Effect.fail(\n new Timeout({ dependency: `${descriptor.method} ${descriptor.path}` }),\n );\n\n const params = yield* encode(descriptor.params, request['params']);\n const query = yield* encode(descriptor.query, request['query']);\n const payload = yield* encode(descriptor.payload, request['payload']);\n\n let outgoing = HttpClientRequest.make(descriptor.method)(\n `${options.baseUrl}${pathOf(descriptor.path, params)}`,\n ).pipe(\n HttpClientRequest.setUrlParams(queryOf(query)),\n HttpClientRequest.setHeader(\n 'accept',\n isBinaryResponse(descriptor.success) ? '*/*' : 'application/json',\n ),\n );\n if (descriptor.payload !== undefined)\n outgoing = withBody(outgoing, descriptor, payload);\n if (descriptor.idempotent !== undefined)\n outgoing = HttpClientRequest.setHeader(\n outgoing,\n IDEMPOTENCY_KEY_HEADER,\n formatIdempotencyKey(request['idempotencyKey'] as string),\n );\n if (remaining !== undefined)\n outgoing = HttpClientRequest.setHeader(\n outgoing,\n DEADLINE_HEADER,\n String(remaining),\n );\n\n const base = yield* HttpClient.HttpClient;\n const client = options.transformClient?.(base) ?? base;\n const response = yield* client.execute(outgoing).pipe(\n Effect.mapError(\n () =>\n new Unavailable({\n dependency: `${descriptor.method} ${descriptor.path}`,\n }),\n ),\n );\n\n if (response.status >= 400)\n return yield* Effect.fail(yield* failureOf(descriptor, response));\n\n if (isBinaryResponse(descriptor.success)) {\n const buffer = yield* response.arrayBuffer.pipe(\n Effect.mapError(\n () =>\n new Unavailable({\n dependency: `${descriptor.method} ${descriptor.path}`,\n }),\n ),\n );\n const { 'content-type': contentType, ...headers } = response.headers;\n return {\n bytes: new Uint8Array(buffer),\n contentType: contentType ?? 'application/octet-stream',\n headers,\n };\n }\n\n const text = yield* response.text.pipe(\n Effect.mapError(\n () =>\n new Unavailable({\n dependency: `${descriptor.method} ${descriptor.path}`,\n }),\n ),\n );\n return yield* Schema.decodeUnknownEffect(\n descriptor.success as Schema.Codec<unknown, unknown>,\n )(text === '' ? undefined : parse(text)).pipe(\n Effect.mapError(\n error =>\n new ProtocolFailure({\n reason: `${descriptor.method} ${descriptor.path} answered a body that does not decode: ${error.message}`,\n upstreamStatus: response.status,\n }),\n ),\n );\n });\n\n/**\n * A typed client over a set of endpoint descriptors\n * ([ADR 0020](../../../../../docs/adr/0020-endpoints-are-descriptors-and-the-shell-builds-an-httpapi.md)):\n * one call per endpoint, by name, typed from its descriptor. It runs wherever\n * an `HttpClient` does — `FetchHttpClient` in a browser, a Next server with a\n * forwarded cookie, an Effect service calling a participant — and needs\n * nothing of the shell that serves the endpoints, its status table included.\n */\nexport const makeEndpointClient = <\n const Endpoints extends ReadonlyArray<AnyEndpoint>,\n>(\n endpoints: Endpoints,\n options: EndpointClientOptions,\n): EndpointClient<Endpoints> =>\n Object.fromEntries(\n endpoints.map(descriptor => [\n descriptor.name,\n (request: Record<string, unknown>) => call(descriptor, options, request),\n ]),\n ) as unknown as EndpointClient<Endpoints>;\n"],"names":["bodyEncodingOf","currentRemainingMs","DEADLINE_HEADER","decodeProblem","formatIdempotencyKey","IDEMPOTENCY_KEY_HEADER","isBinaryResponse","Overloaded","PROBLEM_CONTENT_TYPE","ProtocolFailure","Timeout","Unavailable","Effect","Schema","HttpClient","HttpClientRequest","toSchema","schema","isSchema","Struct","encode","value","undefined","succeed","encodeUnknownEffect","pipe","mapError","error","reason","message","pathOf","path","params","replace","_match","name","encodeURIComponent","String","queryOf","query","Object","fromEntries","entries","filter","map","key","Array","isArray","ALWAYS","Set","failureOf","descriptor","response","gen","text","orElseSucceed","isProblem","headers","startsWith","method","status","upstreamStatus","failure","parse","declared","errors","some","failureClass","identifier","_tag","family","has","category","code","retryAfter","Number","isFinite","retryAfterSeconds","withBody","outgoing","payload","encoding","kind","bodyText","contentType","bodyUrlParams","bytes","bodyUint8Array","JSON","stringify","call","options","request","remaining","fail","dependency","make","baseUrl","setUrlParams","setHeader","success","idempotent","base","client","transformClient","execute","buffer","arrayBuffer","Uint8Array","decodeUnknownEffect","makeEndpointClient","endpoints"],"mappings":";AAAA,SAGEA,cAAc,EACdC,kBAAkB,EAClBC,eAAe,EAEfC,aAAa,EAKbC,oBAAoB,EACpBC,sBAAsB,EACtBC,gBAAgB,EAChBC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EAEfC,OAAO,EACPC,WAAW,QACN,gBAAgB;AACvB,SAASC,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,SACEC,UAAU,EACVC,iBAAiB,QAEZ,cAAc;AA+CrB,MAAMC,WAAW,CAACC,SAChBJ,OAAOK,QAAQ,CAACD,UAAUA,SAASJ,OAAOM,MAAM,CAACF;AAEnD,MAAMG,SAAS,CAACH,QAAoCI,QAClDJ,WAAWK,YACPV,OAAOW,OAAO,CAACD,aACfT,OAAOW,mBAAmB,CACxBR,SAASC,SACTI,OAAOI,IAAI,CACXb,OAAOc,QAAQ,CACbC,CAAAA,QACE,IAAIlB,gBAAgB;YAClBmB,QAAQ,CAAC,6BAA6B,EAAED,MAAME,OAAO,EAAE;QACzD;AAIZ;;;;CAIC,GACD,MAAMC,SAAS,CAACC,MAAcC,SAC5BD,KAAKE,OAAO,CAAC,qBAAqB,CAACC,QAAQC,OACzCC,mBAAmBC,OAAO,AAACL,MAAkC,CAACG,KAAK;AAGvE,MAAMG,UAAU,CAACC,QACfC,OAAOC,WAAW,CAChBD,OAAOE,OAAO,CAAEH,gBAAAA,QAAS,CAAC,GACvBI,MAAM,CAAC,C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pB,IAAI,EAAE;gBACvD;YAGN,MAAoDqB,oBAAAA,SAASK,OAAO,EAA9D,EAAE,gBAAgB2B,WAAW,EAAc,GAAGhC,mBAAZK,2CAAYL;gBAA5C;;YACR,OAAO;gBACLkC,OAAO,IAAIsB,WAAWF;gBACtBtB,WAAW,EAAEA,sBAAAA,cAAe;gBAC5B3B;YACF;QACF;QAEA,MAAMH,OAAO,OAAOF,SAASE,IAAI,CAAC7B,IAAI,CACpCb,OAAOc,QAAQ,CACb,IACE,IAAIf,YAAY;gBACdoF,YAAY,GAAG5C,WAAWQ,MAAM,CAAC,CAAC,EAAER,WAAWpB,IAAI,EAAE;YACvD;QAGN,OAAO,OAAOlB,OAAOgG,mBAAmB,CACtC1D,WAAWiD,OAAO,EAClB9C,SAAS,KAAKhC,YAAYyC,MAAMT,OAAO7B,IAAI,CAC3Cb,OAAOc,QAAQ,CACbC,CAAAA,QACE,IAAIlB,gBAAgB;gBAClBmB,QAAQ,GAAGuB,WAAWQ,MAAM,CAAC,CAAC,EAAER,WAAWpB,IAAI,CAAC,uCAAuC,EAAEJ,MAAME,OAAO,EAAE;gBACxGgC,gBAAgBT,SAASQ,MAAM;YACjC;IAGR;AAEF;;;;;;;CAOC,GACD,OAAO,MAAMkD,qBAAqB,CAGhCC,WACApB,UAEAnD,OAAOC,WAAW,CAChBsE,UAAUnE,GAAG,CAACO,CAAAA,aAAc;YAC1BA,WAAWhB,IAAI;YACf,CAACyD,UAAqCF,KAAKvC,YAAYwC,SAASC;SACjE,GACuC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entifix/rest",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.6",
|
|
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,12 +56,12 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@swc/helpers": "0.5.23",
|
|
59
|
-
"@entifix/core": "0.23.
|
|
60
|
-
"@entifix/transactions": "0.23.
|
|
59
|
+
"@entifix/core": "0.23.6",
|
|
60
|
+
"@entifix/transactions": "0.23.6"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"effect": "4.0.7",
|
|
64
|
-
"@entifix/testing-unit": "0.23.
|
|
64
|
+
"@entifix/testing-unit": "0.23.6"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"effect": "^4.0.7"
|