apps 0.0.1-beta.138 → 0.0.1-beta.139

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,6 +1,6 @@
1
1
  import {
2
2
  prepareElicitation
3
- } from "./chunk-ZL56WYWO.js";
3
+ } from "./chunk-KOL4PQIA.js";
4
4
  import {
5
5
  failOnNetworkRefusal
6
6
  } from "./chunk-YF7TYPDS.js";
@@ -12,7 +12,7 @@ import {
12
12
  parseSkillLoadFailed,
13
13
  readCatalog,
14
14
  routerSkills
15
- } from "./chunk-E2R4JVK3.js";
15
+ } from "./chunk-R62755EK.js";
16
16
  import {
17
17
  appInvocationFetch
18
18
  } from "./chunk-YF7TYPDS.js";
@@ -171,7 +171,13 @@ var defaultOpenapiResponseLimits = {
171
171
  readTimeoutMs: 3e4
172
172
  };
173
173
  var isOpenapiJsonSequence = (type) => /^application\/(?:x-)?(?:ndjson|jsonl|jsonlines|json-seq)\s*(?:;|$)/i.test(type);
174
- var isOpenapiTextMedia = (type) => isOpenapiJsonSequence(type) || /^(?:text\/|application\/(?:[\w.-]+\+)?(?:json|xml)|application\/(?:javascript|x-www-form-urlencoded))/i.test(
174
+ var mediaName = "[a-z0-9][a-z0-9!#$&^_.+-]*";
175
+ var jsonMedia = new RegExp(
176
+ `^(?:(?:application|text)/(?:x-)?json|application/x-amz-json-1\\.[01]|${mediaName}/${mediaName}\\+json)\\s*(?:;|$)`,
177
+ "i"
178
+ );
179
+ var isOpenapiJsonMedia = (type) => jsonMedia.test(type);
180
+ var isOpenapiTextMedia = (type) => isOpenapiJsonSequence(type) || /^(?:text\/|application\/(?:[\w.-]+\+)?(?:json|xml)|application\/(?:hujson|javascript|x-www-form-urlencoded))/i.test(
175
181
  type
176
182
  );
177
183
  var isOpenapiFileSchema = (shape) => shape.contentMediaType !== void 0 && shape.contentEncoding === void 0 || shape.type === "string" && shape.format === "binary";
@@ -184,7 +190,7 @@ var openapiBinaryResultSchema = {
184
190
  required: ["base64", "contentType"],
185
191
  additionalProperties: false
186
192
  };
187
- var openapiMediaKind = (type) => type.includes("json") && !isOpenapiJsonSequence(type) ? "json" : type === "application/x-www-form-urlencoded" ? "form" : type === "multipart/form-data" ? "multipart" : isOpenapiTextMedia(type) ? "text" : "binary";
193
+ var openapiMediaKind = (type) => isOpenapiJsonMedia(type) ? "json" : type === "application/x-www-form-urlencoded" ? "form" : type === "multipart/form-data" ? "multipart" : isOpenapiTextMedia(type) ? "text" : "binary";
188
194
 
189
195
  // src/contracts/openapi-compile.ts
190
196
  var OpenapiCompileErrorCode = Schema_exports.Literals([
@@ -983,7 +989,7 @@ export {
983
989
  OpenapiMediaType,
984
990
  OpenapiError,
985
991
  defaultOpenapiResponseLimits,
986
- isOpenapiJsonSequence,
992
+ isOpenapiJsonMedia,
987
993
  isOpenapiTextMedia,
988
994
  isOpenapiFileSchema,
989
995
  openapiBinaryResultSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fixedRouter
3
- } from "./chunk-E2R4JVK3.js";
3
+ } from "./chunk-R62755EK.js";
4
4
  import {
5
5
  nativeOperation,
6
6
  operationDeclaration,
package/js/effect.js CHANGED
@@ -3,9 +3,9 @@ import {
3
3
  ApprovalDecision,
4
4
  createAppHandler,
5
5
  prepareElicitation
6
- } from "./chunk-ZL56WYWO.js";
6
+ } from "./chunk-KOL4PQIA.js";
7
7
  import "./chunk-W4WVDYQU.js";
8
- import "./chunk-E2R4JVK3.js";
8
+ import "./chunk-R62755EK.js";
9
9
  import "./chunk-YF7TYPDS.js";
10
10
  import "./chunk-34RH47V5.js";
11
11
  import "./chunk-GGDUOJT5.js";
package/js/graphql.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  } from "./chunk-T2PEBOBK.js";
5
5
  import {
6
6
  protocolOperations
7
- } from "./chunk-IW5S6WEE.js";
7
+ } from "./chunk-WTRNAN4H.js";
8
8
  import "./chunk-BCSNKUAC.js";
9
- import "./chunk-ZL56WYWO.js";
9
+ import "./chunk-KOL4PQIA.js";
10
10
  import {
11
11
  cacheKey
12
12
  } from "./chunk-W4WVDYQU.js";
@@ -20,7 +20,7 @@ import {
20
20
  maxGraphqlStatedErrors,
21
21
  maxGraphqlStatedExtensions,
22
22
  maxGraphqlStatedFieldLength
23
- } from "./chunk-E2R4JVK3.js";
23
+ } from "./chunk-R62755EK.js";
24
24
  import {
25
25
  failOnNetworkRefusal
26
26
  } from "./chunk-YF7TYPDS.js";
package/js/host.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createAppHandler
3
- } from "./chunk-ZL56WYWO.js";
3
+ } from "./chunk-KOL4PQIA.js";
4
4
  import "./chunk-W4WVDYQU.js";
5
- import "./chunk-E2R4JVK3.js";
5
+ import "./chunk-R62755EK.js";
6
6
  import "./chunk-YF7TYPDS.js";
7
7
  import "./chunk-34RH47V5.js";
8
8
  import "./chunk-GGDUOJT5.js";
package/js/mcp/effect.js CHANGED
@@ -2,11 +2,11 @@ import {
2
2
  mcpClientEffect,
3
3
  mcpHealthEffect,
4
4
  mcpToolsEffect
5
- } from "../chunk-IZUYCUH5.js";
5
+ } from "../chunk-2CMT4JYG.js";
6
6
  import "../chunk-BCSNKUAC.js";
7
- import "../chunk-ZL56WYWO.js";
7
+ import "../chunk-KOL4PQIA.js";
8
8
  import "../chunk-W4WVDYQU.js";
9
- import "../chunk-E2R4JVK3.js";
9
+ import "../chunk-R62755EK.js";
10
10
  import "../chunk-YF7TYPDS.js";
11
11
  import "../chunk-34RH47V5.js";
12
12
  import "../chunk-GGDUOJT5.js";
package/js/mcp.js CHANGED
@@ -4,20 +4,20 @@ import {
4
4
  } from "./chunk-T2PEBOBK.js";
5
5
  import {
6
6
  protocolOperations
7
- } from "./chunk-IW5S6WEE.js";
7
+ } from "./chunk-WTRNAN4H.js";
8
8
  import {
9
9
  adaptMcpTool,
10
10
  mcpClientEffect,
11
11
  mcpHealthEffect
12
- } from "./chunk-IZUYCUH5.js";
12
+ } from "./chunk-2CMT4JYG.js";
13
13
  import "./chunk-BCSNKUAC.js";
14
- import "./chunk-ZL56WYWO.js";
14
+ import "./chunk-KOL4PQIA.js";
15
15
  import {
16
16
  cacheKey
17
17
  } from "./chunk-W4WVDYQU.js";
18
18
  import {
19
19
  operationDescription
20
- } from "./chunk-E2R4JVK3.js";
20
+ } from "./chunk-R62755EK.js";
21
21
  import "./chunk-YF7TYPDS.js";
22
22
  import "./chunk-34RH47V5.js";
23
23
  import "./chunk-GGDUOJT5.js";
package/js/openapi.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  protocolOperations,
10
10
  protocolRouter
11
- } from "./chunk-IW5S6WEE.js";
11
+ } from "./chunk-WTRNAN4H.js";
12
12
  import {
13
13
  OpenapiCompileError,
14
14
  OpenapiCompileErrorCode,
@@ -24,12 +24,12 @@ import {
24
24
  OpenapiToolsOptions,
25
25
  defaultOpenapiResponseLimits,
26
26
  isOpenapiFileSchema,
27
- isOpenapiJsonSequence,
27
+ isOpenapiJsonMedia,
28
28
  isOpenapiReadMethod,
29
29
  isOpenapiTextMedia,
30
30
  openapiBinaryResultSchema,
31
31
  openapiMediaKind
32
- } from "./chunk-E2R4JVK3.js";
32
+ } from "./chunk-R62755EK.js";
33
33
  import {
34
34
  failOnNetworkRefusal
35
35
  } from "./chunk-YF7TYPDS.js";
@@ -425,11 +425,12 @@ function createRequest(config) {
425
425
  data.set(chunk, offset);
426
426
  offset += chunk.length;
427
427
  }
428
+ if (isOpenapiJsonMedia(contentType))
429
+ return yield* Schema_exports.decodeUnknownEffect(Schema_exports.fromJsonString(Schema_exports.Json))(
430
+ new TextDecoder().decode(data)
431
+ ).pipe(Effect_exports.mapError(() => unreadable));
428
432
  if (!isOpenapiTextMedia(contentType)) return { base64: Base64_exports.encode(data), contentType };
429
- const text = new TextDecoder().decode(data);
430
- return contentType.includes("json") && !isOpenapiJsonSequence(contentType) ? yield* Schema_exports.decodeUnknownEffect(Schema_exports.fromJsonString(Schema_exports.Json))(text).pipe(
431
- Effect_exports.mapError(() => unreadable)
432
- ) : text;
433
+ return new TextDecoder().decode(data);
433
434
  })
434
435
  ).pipe(
435
436
  owned("upstream", "provider.openapi.call", {
@@ -2114,7 +2115,7 @@ function responseSchema(document, operation, at, method2) {
2114
2115
  const media = Object.entries(record2(content));
2115
2116
  if (media.length === 0) return void 0;
2116
2117
  for (const [type, body] of media) {
2117
- if (!type.includes("json") || isOpenapiJsonSequence(type)) {
2118
+ if (!isOpenapiJsonMedia(type)) {
2118
2119
  shapes.push(
2119
2120
  () => isOpenapiTextMedia(type) ? { type: "string" } : openapiBinaryResultSchema
2120
2121
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps",
3
- "version": "0.0.1-beta.138",
3
+ "version": "0.0.1-beta.139",
4
4
  "description": "TypeScript apps with typed tools, accounts, storage, and UI.",
5
5
  "type": "module",
6
6
  "sideEffects": false,