apps 0.0.1-beta.65 → 0.0.1-beta.67

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/js/openapi.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  protocolOperations,
10
10
  protocolRouter
11
- } from "./chunk-J2LGI2UN.js";
11
+ } from "./chunk-6RH2UYRB.js";
12
12
  import {
13
13
  OpenapiCompileError,
14
14
  OpenapiCompileErrorCode,
@@ -29,22 +29,24 @@ import {
29
29
  isOpenapiTextMedia,
30
30
  openapiBinaryResultSchema,
31
31
  openapiMediaKind
32
- } from "./chunk-Z33B35HR.js";
32
+ } from "./chunk-5EOB55ID.js";
33
33
  import {
34
34
  failOnNetworkRefusal
35
- } from "./chunk-PP2XV753.js";
35
+ } from "./chunk-T3FPHPJJ.js";
36
36
  import "./chunk-XBG7HHXC.js";
37
37
  import {
38
38
  nativeOperation,
39
39
  routerDeclaration
40
- } from "./chunk-SKDK6FE4.js";
40
+ } from "./chunk-X36WUWBJ.js";
41
41
  import {
42
42
  accountProviderError,
43
+ bodyUpstreamError,
43
44
  fromPromise,
44
45
  httpProviderError,
45
46
  method,
47
+ providerErrorDetail,
46
48
  toPromise
47
- } from "./chunk-3U3S7L4N.js";
49
+ } from "./chunk-K2VZ3O27.js";
48
50
  import {
49
51
  ApiErrorRecovery,
50
52
  ApiErrorResponse,
@@ -66,7 +68,7 @@ import {
66
68
  } from "./chunk-KGCTYL2S.js";
67
69
  import {
68
70
  owned
69
- } from "./chunk-E6XNNHQ5.js";
71
+ } from "./chunk-3CVQ3VPP.js";
70
72
  import {
71
73
  FetchHttpClient_exports
72
74
  } from "./chunk-PD6I2SDG.js";
@@ -112,16 +114,15 @@ var responseShape = (response) => {
112
114
  };
113
115
  };
114
116
  var bodyRecovery = Schema_exports.decodeUnknownOption(Schema_exports.Struct({ recovery: ApiErrorRecovery }));
115
- function responseError(response, errors) {
117
+ function errorBody(response) {
116
118
  return Effect_exports.gen(function* () {
117
- const candidates = errors.filter((error) => error.status === response.status);
118
- if (candidates.length === 0 || !/^application\/(?:[\w.-]+\+)?json$/i.test(
119
+ if (!/^application\/(?:[\w.-]+\+)?json$/i.test(
119
120
  response.headers["content-type"]?.split(";")[0]?.trim() ?? ""
120
121
  ))
121
122
  return;
122
123
  const length = response.headers["content-length"];
123
124
  if (length !== void 0 && Number(length) > defaultOpenapiErrorLimits.maxBodyBytes) return;
124
- const json = yield* response.stream.pipe(
125
+ return yield* response.stream.pipe(
125
126
  Stream_exports.mapError(() => new OpenapiError({ reason: "request", status: response.status })),
126
127
  Stream_exports.limitBytes(
127
128
  defaultOpenapiErrorLimits.maxBodyBytes,
@@ -132,6 +133,11 @@ function responseError(response, errors) {
132
133
  Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(Schema_exports.fromJsonString(Schema_exports.Json))),
133
134
  Effect_exports.timeout(defaultOpenapiErrorLimits.readTimeoutMs)
134
135
  );
136
+ }).pipe(Effect_exports.catch(() => Effect_exports.succeed(void 0)));
137
+ }
138
+ function responseError(status, json, errors) {
139
+ return Effect_exports.gen(function* () {
140
+ const candidates = errors.filter((error) => error.status === status);
135
141
  for (const candidate of candidates) {
136
142
  const parsed = yield* Schema_exports.decodeUnknownEffect(candidate.decoder)(json).pipe(Effect_exports.option);
137
143
  if (Option_exports.isSome(parsed)) {
@@ -142,7 +148,7 @@ function responseError(response, errors) {
142
148
  const recovery = bodyRecovery(parsed.value);
143
149
  return new OpenapiResponseError({
144
150
  code: candidate.code,
145
- status: response.status,
151
+ status,
146
152
  message: message.value.message,
147
153
  ...Option_exports.isSome(recovery) ? { recovery: recovery.value.recovery } : {}
148
154
  });
@@ -368,8 +374,10 @@ function createRequest(config) {
368
374
  if (response.status < 200 || response.status >= 300) {
369
375
  const provider = httpProviderError(response.status, response.headers);
370
376
  if (provider !== void 0 && provider.reason !== "rejected") return yield* provider;
371
- const declared = yield* responseError(response, errors);
372
- return yield* declared ?? provider ?? new OpenapiError({ reason: "request", operation, ...responseShape(response) });
377
+ const json = provider !== void 0 || errors.some((error) => error.status === response.status) ? yield* errorBody(response) : void 0;
378
+ const declared = json === void 0 ? void 0 : yield* responseError(response.status, json, errors);
379
+ const upstream = json === void 0 ? void 0 : bodyUpstreamError(json);
380
+ return yield* declared ?? (provider === void 0 || upstream === void 0 ? provider : providerErrorDetail(provider, { upstream })) ?? new OpenapiError({ reason: "request", operation, ...responseShape(response) });
373
381
  }
374
382
  if (response.status === 204 || prepared.method === "HEAD") return null;
375
383
  const unreadable = new OpenapiError({
package/js/skills.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  catalogCache,
3
3
  catalogScope
4
- } from "./chunk-IVGA4YM2.js";
4
+ } from "./chunk-AZIV4XRH.js";
5
5
  import "./chunk-AQU56EPI.js";
6
6
  import {
7
7
  failOnNetworkRefusal
8
- } from "./chunk-PP2XV753.js";
8
+ } from "./chunk-T3FPHPJJ.js";
9
9
  import {
10
10
  folderSkillsEffect,
11
11
  skillFromFiles
@@ -16,7 +16,7 @@ import {
16
16
  httpProviderError,
17
17
  method,
18
18
  toPromise
19
- } from "./chunk-3U3S7L4N.js";
19
+ } from "./chunk-K2VZ3O27.js";
20
20
  import {
21
21
  NetworkRefused,
22
22
  ProviderError,
@@ -35,7 +35,7 @@ import {
35
35
  import {
36
36
  wrap
37
37
  } from "./chunk-KGCTYL2S.js";
38
- import "./chunk-E6XNNHQ5.js";
38
+ import "./chunk-3CVQ3VPP.js";
39
39
  import {
40
40
  FetchHttpClient_exports
41
41
  } from "./chunk-PD6I2SDG.js";
package/js/ui/serving.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "../chunk-CDXQDN7W.js";
8
8
  import {
9
9
  CurrentTelemetryConfig
10
- } from "../chunk-E6XNNHQ5.js";
10
+ } from "../chunk-3CVQ3VPP.js";
11
11
  import "../chunk-PD6I2SDG.js";
12
12
  import "../chunk-5FHWNLCI.js";
13
13
  import "../chunk-H2CJWXA3.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.65",
3
+ "version": "0.0.1-beta.67",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,