apps 0.0.1-beta.0 → 0.0.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +145 -30
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/{chunk-36DNRFZQ.js → chunk-27F7W2LG.js} +1 -1
  5. package/js/{chunk-VFUZI3NY.js → chunk-57RKNWL2.js} +4 -4
  6. package/js/{chunk-BPEFS4YF.js → chunk-5T57N25Q.js} +122 -18
  7. package/js/chunk-72JNVHPK.js +41 -0
  8. package/js/{chunk-2OTCEKL2.js → chunk-CDL5PM2Q.js} +2643 -1646
  9. package/js/{chunk-KWTCHVLT.js → chunk-CRDWFA74.js} +69 -54
  10. package/js/chunk-CZ7CSFO4.js +39 -0
  11. package/js/{chunk-WIDTG42X.js → chunk-EPT3ZP52.js} +79 -26
  12. package/js/chunk-FL2QR3XW.js +507 -0
  13. package/js/{chunk-3ANFZFCV.js → chunk-IJX4CYZO.js} +15 -18
  14. package/js/chunk-IPI4MFSN.js +78 -0
  15. package/js/chunk-JU7VHODU.js +104 -0
  16. package/js/chunk-KUMBKVJD.js +39 -0
  17. package/js/{chunk-YDR4CPJA.js → chunk-M3B3DE4K.js} +8 -8
  18. package/js/chunk-MKWZPDR6.js +63 -0
  19. package/js/{chunk-7JXHF5IF.js → chunk-N7YDVXYJ.js} +49 -1
  20. package/js/chunk-NKLWZJLE.js +172 -0
  21. package/js/{chunk-OWD2YICM.js → chunk-ODEIDRGW.js} +116 -88
  22. package/js/{chunk-D6BKYP2L.js → chunk-PJJ24GU7.js} +4 -4
  23. package/js/{chunk-EP6AEUZO.js → chunk-PZB6T6KU.js} +1 -1
  24. package/js/chunk-R3EV5FTO.js +97 -0
  25. package/js/chunk-RFVIONFX.js +189 -0
  26. package/js/{chunk-W7Q5EOTS.js → chunk-UK573G7W.js} +32 -32
  27. package/js/chunk-UVL56Z6E.js +6641 -0
  28. package/js/{chunk-Q2FD5IBM.js → chunk-V5KNQVCT.js} +505 -124
  29. package/js/{chunk-SBKHUC5L.js → chunk-VFZKSM3T.js} +5 -25
  30. package/js/{chunk-HP7E42X6.js → chunk-WLE7WX2U.js} +1158 -232
  31. package/js/{chunk-X3YBZCJW.js → chunk-YXQHV65J.js} +58 -62
  32. package/js/chunk-Z5M2LQOZ.js +209 -0
  33. package/js/{chunk-R6JMJSVT.js → chunk-ZQINWV4W.js} +60 -20
  34. package/js/client.js +11 -27
  35. package/js/contracts.js +138 -27
  36. package/js/effect.js +20 -15
  37. package/js/es-APDZKREY.js +40968 -0
  38. package/js/graphql.js +220 -123
  39. package/js/host.js +75 -19
  40. package/js/index.js +261 -117
  41. package/js/mcp/effect.js +24 -17
  42. package/js/mcp/stdio.js +26 -21
  43. package/js/mcp.js +127 -26
  44. package/js/openapi.js +3048 -150
  45. package/js/operations/approval.js +1 -1
  46. package/js/react.js +4 -4
  47. package/js/skills/effect.js +11 -0
  48. package/js/skills.js +893 -0
  49. package/js/storage/facet.js +7 -7
  50. package/js/ui/auth/contracts.js +9 -10
  51. package/js/ui/auth.js +17 -15
  52. package/js/ui/contracts.js +5 -5
  53. package/js/ui/serving.js +14 -13
  54. package/package.json +9 -1
  55. package/runtime.json +1 -1
  56. package/types/app-cache/src/contracts/cache.d.ts +119 -0
  57. package/types/app-cache/src/index.d.ts +93 -0
  58. package/types/app-data/src/contracts/database.d.ts +33 -6
  59. package/types/app-data/src/implementation/schema.d.ts +2 -17
  60. package/types/apps/src/contracts/api-response-error.d.ts +43 -0
  61. package/types/apps/src/contracts/app.d.ts +16 -4
  62. package/types/apps/src/contracts/cache.d.ts +44 -0
  63. package/types/apps/src/contracts/dynamic-skills.d.ts +10 -0
  64. package/types/apps/src/contracts/failure.d.ts +25 -0
  65. package/types/apps/src/contracts/graphql.d.ts +18 -1
  66. package/types/apps/src/contracts/host.d.ts +76 -528
  67. package/types/apps/src/contracts/mcp.d.ts +19 -1
  68. package/types/apps/src/contracts/openapi-compile.d.ts +11 -0
  69. package/types/apps/src/contracts/openapi-document.d.ts +53 -0
  70. package/types/apps/src/contracts/openapi.d.ts +160 -30
  71. package/types/apps/src/contracts/operations.d.ts +0 -5
  72. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  73. package/types/apps/src/contracts/protocols/1.d.ts +1589 -0
  74. package/types/apps/src/contracts/protocols/2.d.ts +668 -0
  75. package/types/apps/src/contracts/protocols/3.d.ts +676 -0
  76. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  77. package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
  78. package/types/apps/src/contracts/provider-error.d.ts +15 -0
  79. package/types/apps/src/contracts/provider.d.ts +69 -6
  80. package/types/apps/src/contracts/router.d.ts +59 -0
  81. package/types/apps/src/contracts/skills.d.ts +122 -0
  82. package/types/apps/src/contracts/storage.d.ts +3 -3
  83. package/types/apps/src/contracts/swagger-client.d.ts +29 -0
  84. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  85. package/types/apps/src/contracts/workflows.d.ts +34 -3
  86. package/types/apps/src/graphql.d.ts +5 -7
  87. package/types/apps/src/host.d.ts +1 -0
  88. package/types/apps/src/implementation/account-router.d.ts +12 -0
  89. package/types/apps/src/implementation/app.d.ts +5 -4
  90. package/types/apps/src/implementation/cache-session.d.ts +7 -0
  91. package/types/apps/src/implementation/cache.d.ts +8 -0
  92. package/types/apps/src/implementation/catalog-cache.d.ts +36 -0
  93. package/types/apps/src/implementation/dynamic-skills.d.ts +7 -0
  94. package/types/apps/src/implementation/elicitation.d.ts +13 -13
  95. package/types/apps/src/implementation/failure-detail.d.ts +25 -0
  96. package/types/apps/src/implementation/git.d.ts +25 -0
  97. package/types/apps/src/implementation/graphql-catalog.d.ts +7 -0
  98. package/types/apps/src/implementation/graphql.d.ts +81 -3
  99. package/types/apps/src/implementation/inflate.d.ts +16 -0
  100. package/types/apps/src/implementation/input-problems.d.ts +3 -0
  101. package/types/apps/src/implementation/mcp-call.d.ts +3 -2
  102. package/types/apps/src/implementation/mcp-catalog.d.ts +9 -0
  103. package/types/apps/src/implementation/mcp-client.d.ts +39 -22
  104. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  105. package/types/apps/src/implementation/mcp-tools.d.ts +6 -3
  106. package/types/apps/src/implementation/mcp.d.ts +55 -2
  107. package/types/apps/src/implementation/openapi-compile.d.ts +120 -0
  108. package/types/apps/src/implementation/openapi-document.d.ts +51 -0
  109. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  110. package/types/apps/src/implementation/openapi-request.d.ts +10 -4
  111. package/types/apps/src/implementation/openapi-source.d.ts +36 -0
  112. package/types/apps/src/implementation/openapi.d.ts +39 -3
  113. package/types/apps/src/implementation/operations.d.ts +26 -3
  114. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  115. package/types/apps/src/implementation/provider-error.d.ts +10 -0
  116. package/types/apps/src/implementation/provider.d.ts +9 -4
  117. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  118. package/types/apps/src/implementation/router.d.ts +59 -0
  119. package/types/apps/src/implementation/schema.d.ts +11 -6
  120. package/types/apps/src/implementation/skill-files.d.ts +10 -0
  121. package/types/apps/src/implementation/skills.d.ts +43 -0
  122. package/types/apps/src/implementation/storage.d.ts +5 -3
  123. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  124. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  125. package/types/apps/src/implementation/ui-serving.d.ts +4 -2
  126. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  127. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  128. package/types/apps/src/index.d.ts +11 -3
  129. package/types/apps/src/mcp-stdio.d.ts +2 -5
  130. package/types/apps/src/mcp.d.ts +8 -7
  131. package/types/apps/src/openapi.d.ts +8 -6
  132. package/types/apps/src/skills.d.ts +75 -0
  133. package/types/apps/src/ui-auth.d.ts +2 -2
  134. package/types/telemetry/src/browser-operations.d.ts +5 -2
  135. package/types/telemetry/src/config.d.ts +2 -0
  136. package/js/chunk-22WRQZT7.js +0 -389
  137. package/js/chunk-BKVL7XAJ.js +0 -47
  138. package/js/chunk-C24KEZXR.js +0 -59
  139. package/js/chunk-LOKGDT6B.js +0 -28
  140. package/js/chunk-MLKGABMK.js +0 -9
  141. package/types/apps/src/implementation/account-operations.d.ts +0 -32
@@ -0,0 +1,65 @@
1
+ import {
2
+ Alias,
3
+ Composer,
4
+ Document,
5
+ Lexer,
6
+ LineCounter,
7
+ Pair,
8
+ Parser,
9
+ Scalar,
10
+ Schema,
11
+ YAMLError,
12
+ YAMLMap,
13
+ YAMLParseError,
14
+ YAMLSeq,
15
+ YAMLWarning,
16
+ browser_default,
17
+ cst_exports,
18
+ isAlias,
19
+ isCollection,
20
+ isDocument,
21
+ isMap,
22
+ isNode,
23
+ isPair,
24
+ isScalar,
25
+ isSeq,
26
+ parse,
27
+ parseAllDocuments,
28
+ parseDocument,
29
+ stringify,
30
+ visit,
31
+ visitAsync
32
+ } from "./chunk-UVL56Z6E.js";
33
+ import "./chunk-CZ7CSFO4.js";
34
+ export {
35
+ Alias,
36
+ cst_exports as CST,
37
+ Composer,
38
+ Document,
39
+ Lexer,
40
+ LineCounter,
41
+ Pair,
42
+ Parser,
43
+ Scalar,
44
+ Schema,
45
+ YAMLError,
46
+ YAMLMap,
47
+ YAMLParseError,
48
+ YAMLSeq,
49
+ YAMLWarning,
50
+ browser_default as default,
51
+ isAlias,
52
+ isCollection,
53
+ isDocument,
54
+ isMap,
55
+ isNode,
56
+ isPair,
57
+ isScalar,
58
+ isSeq,
59
+ parse,
60
+ parseAllDocuments,
61
+ parseDocument,
62
+ stringify,
63
+ visit,
64
+ visitAsync
65
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Schema_exports
3
- } from "./chunk-2OTCEKL2.js";
3
+ } from "./chunk-CDL5PM2Q.js";
4
4
 
5
5
  // src/contracts/schema.ts
6
6
  var JsonValue = Schema_exports.Json;
@@ -4,7 +4,7 @@ import {
4
4
  fromWeb,
5
5
  layerMergedContext,
6
6
  make2 as make
7
- } from "./chunk-W7Q5EOTS.js";
7
+ } from "./chunk-UK573G7W.js";
8
8
  import {
9
9
  Reference,
10
10
  Service,
@@ -17,12 +17,12 @@ import {
17
17
  succeed4 as succeed,
18
18
  toReadableStreamEffect,
19
19
  tryPromise
20
- } from "./chunk-2OTCEKL2.js";
20
+ } from "./chunk-CDL5PM2Q.js";
21
21
  import {
22
22
  __export
23
- } from "./chunk-MLKGABMK.js";
23
+ } from "./chunk-CZ7CSFO4.js";
24
24
 
25
- // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b0796b742bddeb797269d/node_modules/effect/dist/unstable/http/FetchHttpClient.js
25
+ // ../../node_modules/.bun/effect@https+++pkg.pr.new+Effect-TS+effect+effect@c7d1ffff31a3e2ae0b0b+a654a55b752bdb24/node_modules/effect/dist/unstable/http/FetchHttpClient.js
26
26
  var FetchHttpClient_exports = {};
27
27
  __export(FetchHttpClient_exports, {
28
28
  Fetch: () => Fetch,
@@ -1,12 +1,16 @@
1
1
  import {
2
+ JsonObject,
2
3
  ValidationError
3
- } from "./chunk-36DNRFZQ.js";
4
+ } from "./chunk-27F7W2LG.js";
4
5
  import {
6
+ Cause_exports,
5
7
  Effect_exports,
8
+ Exit_exports,
9
+ SchemaGetter_exports,
6
10
  SchemaIssue_exports,
7
11
  SchemaParser_exports,
8
12
  Schema_exports
9
- } from "./chunk-2OTCEKL2.js";
13
+ } from "./chunk-CDL5PM2Q.js";
10
14
 
11
15
  // ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
12
16
  function deepCompareStrict(a, b) {
@@ -1129,12 +1133,30 @@ function object(fields) {
1129
1133
  const entries = Object.entries(fields).map(
1130
1134
  ([key, field]) => [key, decoderOf(field)]
1131
1135
  );
1132
- const decoder = Schema_exports.Struct(Object.fromEntries(entries));
1136
+ const decoder = entries.length === 0 ? withJsonSchemaDocument(
1137
+ // Native Struct({}) accepts every non-null value and retains undeclared fields.
1138
+ Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown).pipe(
1139
+ Schema_exports.decodeTo(Schema_exports.Record(Schema_exports.String, Schema_exports.Never), {
1140
+ decode: SchemaGetter_exports.transform(() => ({})),
1141
+ encode: SchemaGetter_exports.transform((value) => value)
1142
+ })
1143
+ ),
1144
+ { type: "object", properties: {}, additionalProperties: false }
1145
+ ) : Schema_exports.Struct(Object.fromEntries(entries));
1133
1146
  return { ...wrap(decoder, false), fields: Object.freeze({ ...fields }) };
1134
1147
  }
1135
1148
  var ImportedJsonSchema = /* @__PURE__ */ Symbol("apps.JsonSchemaDocument");
1136
1149
  var importedJsonSchema = (decoder) => ImportedJsonSchema in decoder ? decoder[ImportedJsonSchema] : void 0;
1137
1150
  var withJsonSchemaDocument = (decoder, document) => Object.assign(decoder, { [ImportedJsonSchema]: document });
1151
+ var once = (compute) => {
1152
+ let state;
1153
+ return () => (state ??= { value: compute() }).value;
1154
+ };
1155
+ var withLazyJsonSchemaDocument = (decoder, document) => Object.defineProperty(decoder, ImportedJsonSchema, {
1156
+ configurable: true,
1157
+ enumerable: true,
1158
+ get: once(document)
1159
+ });
1138
1160
  var nestJsonSchema = (input, pointer) => {
1139
1161
  const document = structuredClone(input);
1140
1162
  const lookup = dereference(document);
@@ -1232,6 +1254,40 @@ function interpretedDocument(value) {
1232
1254
  }
1233
1255
  return Object.fromEntries(entries);
1234
1256
  }
1257
+ var containerKeywords = /* @__PURE__ */ new Set([
1258
+ "$ref",
1259
+ "$recursiveRef",
1260
+ "$dynamicRef",
1261
+ "properties",
1262
+ "patternProperties",
1263
+ "additionalProperties",
1264
+ "unevaluatedProperties",
1265
+ "propertyNames",
1266
+ "items",
1267
+ "prefixItems",
1268
+ "additionalItems",
1269
+ "unevaluatedItems",
1270
+ "contains",
1271
+ "allOf",
1272
+ "if",
1273
+ "then",
1274
+ "else",
1275
+ "dependentSchemas"
1276
+ ]);
1277
+ var jsonSchemaProblems = (errors) => {
1278
+ const problems = errors.flatMap(({ keyword, instanceLocation, error }) => {
1279
+ if (containerKeywords.has(keyword)) return [];
1280
+ const path = instanceLocation.replace(/^#\/?/, "").split("/").filter((segment) => segment !== "").map((segment) => decodeURIComponent(segment).replace(/~1/g, "/").replace(/~0/g, "~")).map((segment) => /^\d+$/.test(segment) ? Number(segment) : segment);
1281
+ const required = keyword === "required" ? /required property "([^"]*)"/.exec(error) : null;
1282
+ const expected = keyword === "type" ? /Expected "([^.]*)"\.?$/.exec(error) : null;
1283
+ const issue = required !== null ? { path: [...path, required[1] ?? ""], issue: "Missing key" } : {
1284
+ path,
1285
+ issue: expected !== null ? `Expected ${(expected[1] ?? "").replace(/"/g, "")}` : keyword === "const" || keyword === "enum" ? "Expected one of the allowed values" : `Failed the "${keyword}" constraint`
1286
+ };
1287
+ return [issue];
1288
+ });
1289
+ return problems.length === 0 ? false : problems;
1290
+ };
1235
1291
  var compileJsonSchemaDecoder = (document) => Effect_exports.gen(function* () {
1236
1292
  const validator = yield* Effect_exports.try({
1237
1293
  try: () => {
@@ -1266,7 +1322,8 @@ var compileJsonSchemaDecoder = (document) => Effect_exports.gen(function* () {
1266
1322
  Schema_exports.makeFilter(
1267
1323
  (value) => {
1268
1324
  try {
1269
- return validator.validate(value).valid;
1325
+ const result = validator.validate(value);
1326
+ return result.valid || jsonSchemaProblems(result.errors);
1270
1327
  } catch {
1271
1328
  return false;
1272
1329
  }
@@ -1276,27 +1333,71 @@ var compileJsonSchemaDecoder = (document) => Effect_exports.gen(function* () {
1276
1333
  );
1277
1334
  return Object.assign(decoder, { [ImportedJsonSchema]: document });
1278
1335
  });
1279
- var jsonSchemaDecoder = (input) => Effect_exports.gen(function* () {
1280
- const document = yield* parse(
1281
- Schema_exports.Record(Schema_exports.String, Schema_exports.Json),
1282
- input
1336
+ var lazyDecoder = (document) => {
1337
+ const read = once(document);
1338
+ let compiled;
1339
+ const compile = Effect_exports.suspend(
1340
+ () => compiled ?? compileJsonSchemaDecoder(read()).pipe(
1341
+ // An interrupted compilation is not a result; the next decode compiles again.
1342
+ Effect_exports.onExit(
1343
+ (exit) => Effect_exports.sync(() => {
1344
+ if (Exit_exports.isSuccess(exit) || !Cause_exports.hasInterrupts(exit.cause)) compiled = exit;
1345
+ })
1346
+ )
1347
+ )
1283
1348
  );
1284
- const compiled = yield* Effect_exports.cached(compileJsonSchemaDecoder(document));
1285
1349
  const decoder = Schema_exports.declareConstructor()(
1286
1350
  [],
1287
- () => (input2, _ast, options) => compiled.pipe(
1288
- Effect_exports.mapError(
1289
- () => new SchemaIssue_exports.InvalidValue({ message: "Unsupported JSON Schema" })
1290
- ),
1291
- Effect_exports.flatMap((schema) => SchemaParser_exports.decodeUnknownEffect(schema)(input2, options))
1351
+ () => (input, _ast, options) => compile.pipe(
1352
+ Effect_exports.mapError(() => new SchemaIssue_exports.InvalidValue({ message: "Unsupported JSON Schema" })),
1353
+ Effect_exports.flatMap((schema) => SchemaParser_exports.decodeUnknownEffect(schema)(input, options))
1292
1354
  )
1293
1355
  );
1294
- return Object.assign(decoder, { [ImportedJsonSchema]: document });
1356
+ return withLazyJsonSchemaDocument(decoder, read);
1357
+ };
1358
+ var lazyJsonSchemaDecoder = (document) => Effect_exports.sync(() => lazyDecoder(document));
1359
+ var isJsonValue = Schema_exports.is(Schema_exports.Json);
1360
+ var jsonDocument = (input) => {
1361
+ if (typeof input !== "object" || input === null || Array.isArray(input)) return void 0;
1362
+ const keys = Object.keys(input);
1363
+ const values = keys.map((key) => Reflect.get(input, key));
1364
+ if (!isJsonValue(values)) return void 0;
1365
+ const document = {};
1366
+ keys.forEach(
1367
+ (key, index) => Object.defineProperty(document, key, {
1368
+ value: values[index],
1369
+ enumerable: true,
1370
+ writable: true,
1371
+ configurable: true
1372
+ })
1373
+ );
1374
+ return document;
1375
+ };
1376
+ var jsonSchemaDecoder = (input) => Effect_exports.suspend(() => {
1377
+ const document = jsonDocument(input);
1378
+ return document === void 0 ? Effect_exports.fail(new ValidationError()) : lazyJsonSchemaDecoder(() => document);
1295
1379
  });
1296
- var jsonSchema = (input) => wrap(Effect_exports.runSync(jsonSchemaDecoder(input)), false);
1380
+ var jsonSchema = (input) => {
1381
+ const document = jsonDocument(input);
1382
+ if (document === void 0) throw new ValidationError();
1383
+ return wrap(
1384
+ lazyDecoder(() => document),
1385
+ false
1386
+ );
1387
+ };
1297
1388
  var storageFieldOf = (schema) => schema[StorageField];
1298
1389
  var id = (table) => wrap(Schema_exports.NonEmptyString, false, { kind: "id", references: table });
1299
1390
  var userId = () => wrap(Schema_exports.NonEmptyString, false, { kind: "userId" });
1391
+ var jsonSchemaDocument = (decoder) => {
1392
+ const imported = importedJsonSchema(decoder);
1393
+ if (imported !== void 0) return Schema_exports.decodeUnknownEffect(JsonObject)(imported);
1394
+ const document = Schema_exports.toJsonSchemaDocument(decoder);
1395
+ return Schema_exports.decodeUnknownEffect(JsonObject)({
1396
+ ...document.schema,
1397
+ $defs: document.definitions,
1398
+ $schema: "https://json-schema.org/draft/2020-12/schema"
1399
+ });
1400
+ };
1300
1401
 
1301
1402
  export {
1302
1403
  decoderOf,
@@ -1312,12 +1413,15 @@ export {
1312
1413
  array,
1313
1414
  object,
1314
1415
  importedJsonSchema,
1315
- withJsonSchemaDocument,
1416
+ once,
1417
+ withLazyJsonSchemaDocument,
1316
1418
  nestJsonSchema,
1317
1419
  compileJsonSchemaDecoder,
1420
+ lazyJsonSchemaDecoder,
1318
1421
  jsonSchemaDecoder,
1319
1422
  jsonSchema,
1320
1423
  storageFieldOf,
1321
1424
  id,
1322
- userId
1425
+ userId,
1426
+ jsonSchemaDocument
1323
1427
  };
@@ -0,0 +1,41 @@
1
+ import {
2
+ fixedRouter
3
+ } from "./chunk-FL2QR3XW.js";
4
+ import {
5
+ nativeOperation,
6
+ operationDeclaration,
7
+ routerDeclaration
8
+ } from "./chunk-Z5M2LQOZ.js";
9
+
10
+ // src/implementation/protocol-operations.ts
11
+ var protocolOperations = (operations, kinds = {}) => {
12
+ const declared = {};
13
+ for (const [name, operation] of Object.entries(operations)) {
14
+ const kind = Object.hasOwn(kinds, name) ? kinds[name] ?? "mutation" : operation.readOnly === true ? "query" : "mutation";
15
+ const native = {
16
+ description: operation.description,
17
+ ...operation.title === void 0 ? {} : { title: operation.title },
18
+ ...operation.annotations === void 0 ? {} : { annotations: operation.annotations },
19
+ ...operation._meta === void 0 ? {} : { _meta: operation._meta },
20
+ input: operation.input,
21
+ run: operation.run
22
+ };
23
+ const output = Object.getOwnPropertyDescriptor(operation, "outputSchema");
24
+ const withOutput = (target) => output === void 0 || output.get === void 0 && output.value === void 0 ? target : Object.defineProperty(target, "outputSchema", { ...output, enumerable: true });
25
+ declared[name] = operationDeclaration(withOutput({ ...native, kind }));
26
+ }
27
+ return declared;
28
+ };
29
+ var protocolRouter = (operations, kinds = {}) => {
30
+ const native = {};
31
+ for (const [name, declaration] of Object.entries(protocolOperations(operations, kinds))) {
32
+ const operation = nativeOperation(declaration);
33
+ if (operation !== void 0) native[name] = operation;
34
+ }
35
+ return routerDeclaration(fixedRouter(native));
36
+ };
37
+
38
+ export {
39
+ protocolOperations,
40
+ protocolRouter
41
+ };