apps 0.0.1-beta.37 → 0.0.1-beta.38

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 (80) hide show
  1. package/framework-reference.json +1 -1
  2. package/js/{chunk-KOOJUMLR.js → chunk-3MMG2H6M.js} +2 -2
  3. package/js/{chunk-LQBR7AI7.js → chunk-3V575NIW.js} +217 -19
  4. package/js/{chunk-24EIFQYZ.js → chunk-5P2WQRRM.js} +10 -8
  5. package/js/{chunk-BWUHMKHQ.js → chunk-5TJA7364.js} +2 -2
  6. package/js/{chunk-7KEKFBV7.js → chunk-7CSHVXVR.js} +3 -3
  7. package/js/{chunk-3LRFKLUX.js → chunk-BO4US6DZ.js} +9 -49
  8. package/js/{chunk-A4O72Z3A.js → chunk-DKUEYTYD.js} +167 -30
  9. package/js/{chunk-GHDZEEPO.js → chunk-DWMEIU2L.js} +395 -82
  10. package/js/{chunk-ENJCQWVF.js → chunk-E4BWL7KQ.js} +3 -3
  11. package/js/{chunk-CAOHGMNW.js → chunk-F3TBO2U3.js} +7 -94
  12. package/js/{chunk-POOIHRPF.js → chunk-GHXRRFZA.js} +11 -34
  13. package/js/{chunk-RSNZDT4L.js → chunk-JTMDWPCH.js} +2 -2
  14. package/js/{chunk-YW333DH3.js → chunk-KANDIVIH.js} +4 -4
  15. package/js/{chunk-2FWXCU5I.js → chunk-KAQD3DTI.js} +1 -1
  16. package/js/{chunk-KEZ4YZSP.js → chunk-MLHNVYHT.js} +2 -2
  17. package/js/{chunk-IJQ5LE74.js → chunk-MXDKXAY4.js} +363 -401
  18. package/js/{chunk-U74JVKTQ.js → chunk-NROBHRTG.js} +7 -7
  19. package/js/{chunk-BI6R577B.js → chunk-P7MGDPFD.js} +2 -2
  20. package/js/{chunk-D45FU4TZ.js → chunk-Q4QZDB2F.js} +3 -3
  21. package/js/{chunk-JU7F4PRK.js → chunk-RIXVGVA6.js} +2 -2
  22. package/js/{chunk-QQKHJ72Y.js → chunk-RJCWJNCH.js} +9 -9
  23. package/js/{chunk-UCOMVHGW.js → chunk-U5PFZDVB.js} +2 -2
  24. package/js/{chunk-PHO7HXTC.js → chunk-VIU2XXA7.js} +294 -47
  25. package/js/{chunk-TADLIUEU.js → chunk-VJQXXOQ3.js} +2 -2
  26. package/js/{chunk-NHCFIWN5.js → chunk-W2NV54JD.js} +1 -1
  27. package/js/{chunk-BI45HZWM.js → chunk-YQ35E7KS.js} +1 -1
  28. package/js/{chunk-WDBUOIWV.js → chunk-ZUKBIHMK.js} +3 -3
  29. package/js/client.js +13 -17
  30. package/js/contracts.js +16 -21
  31. package/js/effect.js +19 -24
  32. package/js/graphql.js +21 -26
  33. package/js/host.js +19 -24
  34. package/js/index.js +13 -26
  35. package/js/mcp/effect.js +21 -26
  36. package/js/mcp/stdio.js +21 -26
  37. package/js/mcp.js +23 -28
  38. package/js/openapi.js +17 -21
  39. package/js/react.js +2 -3
  40. package/js/skills/effect.js +6 -7
  41. package/js/skills.js +15 -17
  42. package/js/storage/facet.js +1 -214
  43. package/js/ui/auth/contracts.js +2 -2
  44. package/js/ui/auth.js +5 -5
  45. package/js/ui/contracts.js +5 -6
  46. package/js/ui/serving.js +10 -11
  47. package/package.json +1 -2
  48. package/runtime.json +1 -1
  49. package/types/apps/src/contracts/app.d.ts +0 -2
  50. package/types/apps/src/contracts/context.d.ts +12 -11
  51. package/types/apps/src/contracts/host.d.ts +10 -8
  52. package/types/apps/src/contracts/live.d.ts +2 -0
  53. package/types/apps/src/contracts/operations.d.ts +3 -3
  54. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  55. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  56. package/types/apps/src/contracts/protocols/4.d.ts +3 -3
  57. package/types/apps/src/contracts/protocols/5.d.ts +1 -1
  58. package/types/apps/src/contracts/protocols/6.d.ts +1 -1
  59. package/types/apps/src/contracts/protocols/7.d.ts +1 -1
  60. package/types/apps/src/contracts/sql.d.ts +58 -0
  61. package/types/apps/src/facet.d.ts +4 -5
  62. package/types/apps/src/implementation/openapi-compile.d.ts +2 -2
  63. package/types/apps/src/implementation/schema.d.ts +1 -10
  64. package/types/apps/src/implementation/sql.d.ts +66 -0
  65. package/types/apps/src/index.d.ts +1 -2
  66. package/js/chunk-73AV3JVU.js +0 -186
  67. package/js/chunk-HDAQBRT5.js +0 -1254
  68. package/js/chunk-IU7CCCUC.js +0 -630
  69. package/js/chunk-NHUHTWAF.js +0 -0
  70. package/js/chunk-V5DWGYRK.js +0 -268
  71. package/js/chunk-Y3XN4X4Q.js +0 -19
  72. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  73. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  74. package/types/app-data/src/implementation/promise.d.ts +0 -68
  75. package/types/app-data/src/implementation/range.d.ts +0 -8
  76. package/types/app-data/src/implementation/schema.d.ts +0 -18
  77. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  78. package/types/app-data/src/index.d.ts +0 -4
  79. package/types/apps/src/contracts/storage.d.ts +0 -68
  80. package/types/apps/src/implementation/storage.d.ts +0 -15
@@ -1,34 +1,24 @@
1
- import {
2
- promiseTable
3
- } from "./chunk-IU7CCCUC.js";
4
1
  import {
5
2
  declaredOperations,
6
3
  fromPromise,
7
4
  nativeOperation,
8
5
  nativeRouter
9
- } from "./chunk-7KEKFBV7.js";
6
+ } from "./chunk-7CSHVXVR.js";
10
7
  import {
11
8
  ScheduleTiming
12
- } from "./chunk-LQBR7AI7.js";
13
- import {
14
- DatabaseSchema
15
- } from "./chunk-73AV3JVU.js";
9
+ } from "./chunk-3V575NIW.js";
16
10
  import {
17
11
  decoderOf,
18
12
  isSchema,
19
- schemaArgument,
20
- storageFieldOf
21
- } from "./chunk-POOIHRPF.js";
22
- import {
23
- AppStorageUnavailable
24
- } from "./chunk-Y3XN4X4Q.js";
13
+ schemaArgument
14
+ } from "./chunk-GHXRRFZA.js";
25
15
  import {
26
16
  JsonValue
27
- } from "./chunk-BI45HZWM.js";
17
+ } from "./chunk-YQ35E7KS.js";
28
18
  import {
29
19
  Effect_exports,
30
20
  Schema_exports
31
- } from "./chunk-IJQ5LE74.js";
21
+ } from "./chunk-MXDKXAY4.js";
32
22
 
33
23
  // src/contracts/http.ts
34
24
  var ResponseStatusError = class extends Schema_exports.TaggedError()(
@@ -147,7 +137,6 @@ var defineApp = (requirements, definition) => {
147
137
  const factory = fromPromise(evaluate);
148
138
  const native = {
149
139
  accounts: requirements.accounts,
150
- ...requirements.database === void 0 ? {} : { database: requirements.database },
151
140
  evaluate: (context) => factory(context).pipe(Effect_exports.map((value) => adaptDefinition(value)))
152
141
  };
153
142
  return {
@@ -157,87 +146,11 @@ var defineApp = (requirements, definition) => {
157
146
  };
158
147
  };
159
148
 
160
- // src/implementation/storage.ts
161
- var table = (fields) => tableWithIndexes(fields, []);
162
- var tableWithIndexes = (fields, indexes) => ({
163
- fields,
164
- indexes,
165
- index: (name, fieldsInIndex) => tableWithIndexes(fields, [...indexes, { name, fields: fieldsInIndex }])
166
- });
167
- var serialize = (tables) => {
168
- const definitions = Object.fromEntries(
169
- Object.entries(tables).map(([name, table2]) => [
170
- name,
171
- {
172
- fields: Object.fromEntries(
173
- Object.entries(table2.fields).map(([fieldName, schema]) => {
174
- const field = storageFieldOf(schema);
175
- if (field === void 0) throw new Error("Database columns must use a scalar schema");
176
- return [fieldName, field];
177
- })
178
- ),
179
- indexes: table2.indexes
180
- }
181
- ])
182
- );
183
- return Schema_exports.decodeUnknownSync(DatabaseSchema)(definitions);
184
- };
185
- var authorDatabase = (tables, session, signal, writable) => {
186
- return Object.fromEntries(
187
- Object.entries(tables).map(([name, table2]) => {
188
- const api = promiseTable(session, name, signal);
189
- const parseFields = (input, partial) => {
190
- const values = Schema_exports.decodeUnknownSync(
191
- Schema_exports.Record(Schema_exports.String, Schema_exports.Unknown)
192
- )(input);
193
- const fields = {};
194
- for (const [key, value] of Object.entries(values)) {
195
- if (value === void 0) continue;
196
- const field = Object.hasOwn(table2.fields, key) ? table2.fields[key] : void 0;
197
- if (field === void 0) throw new Error("Unknown database column");
198
- const definition = storageFieldOf(field);
199
- fields[key] = value === null && definition?.optional ? null : field.parse(value);
200
- }
201
- if (!partial) {
202
- for (const [key, field] of Object.entries(table2.fields))
203
- if (!Object.hasOwn(fields, key)) {
204
- const value = field.parse(void 0);
205
- if (value !== void 0) fields[key] = value;
206
- }
207
- }
208
- return fields;
209
- };
210
- const read = { get: api.get, withIndex: api.withIndex };
211
- return [
212
- name,
213
- writable ? {
214
- ...read,
215
- insert: (value) => api.insert(parseFields(value, false)),
216
- update: (id, value) => api.update(id, parseFields(value, true)),
217
- delete: api.delete
218
- } : read
219
- ];
220
- })
221
- );
222
- };
223
- var defineDatabase = (tables) => ({
224
- schema: serialize(tables),
225
- tables
226
- });
227
- var unavailableStorage = {
228
- read: () => Effect_exports.fail(new AppStorageUnavailable()),
229
- mutate: () => Effect_exports.fail(new AppStorageUnavailable())
230
- };
231
-
232
149
  export {
233
150
  ResponseStatusError,
234
151
  ResponseDecodeError,
235
152
  workflow,
236
153
  isApp,
237
154
  toEffectApp,
238
- defineApp,
239
- table,
240
- authorDatabase,
241
- defineDatabase,
242
- unavailableStorage
155
+ defineApp
243
156
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  JsonObject,
3
3
  ValidationError
4
- } from "./chunk-BI45HZWM.js";
4
+ } from "./chunk-YQ35E7KS.js";
5
5
  import {
6
6
  Cause_exports,
7
7
  Effect_exports,
@@ -10,7 +10,7 @@ import {
10
10
  SchemaIssue_exports,
11
11
  SchemaParser_exports,
12
12
  Schema_exports
13
- } from "./chunk-IJQ5LE74.js";
13
+ } from "./chunk-MXDKXAY4.js";
14
14
 
15
15
  // ../../node_modules/.bun/@cfworker+json-schema@4.1.1/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js
16
16
  function deepCompareStrict(a, b) {
@@ -107,9 +107,9 @@ var ignoredKeyword = {
107
107
  var initialBaseURI = typeof self !== "undefined" && self.location && self.location.origin !== "null" ? new URL(self.location.origin + self.location.pathname + location.search) : new URL("https://github.com/cfworker");
108
108
  function dereference(schema, lookup = /* @__PURE__ */ Object.create(null), baseURI = initialBaseURI, basePointer = "") {
109
109
  if (schema && typeof schema === "object" && !Array.isArray(schema)) {
110
- const id2 = schema.$id || schema.id;
111
- if (id2) {
112
- const url = new URL(id2, baseURI.href);
110
+ const id = schema.$id || schema.id;
111
+ if (id) {
112
+ const url = new URL(id, baseURI.href);
113
113
  if (url.hash.length > 1) {
114
114
  lookup[url.href] = schema;
115
115
  } else {
@@ -1069,7 +1069,6 @@ function schemaPattern(pattern) {
1069
1069
  }
1070
1070
 
1071
1071
  // src/implementation/schema.ts
1072
- var StorageField = /* @__PURE__ */ Symbol("apps.StorageField");
1073
1072
  var Decoder = /* @__PURE__ */ Symbol("apps.Schema");
1074
1073
  var decoderOf = (schema) => schema[Decoder];
1075
1074
  var isSchema = (value) => typeof value === "object" && value !== null && Decoder in value;
@@ -1083,33 +1082,18 @@ var schemaArgument = (value, role) => {
1083
1082
  var parse = (decoder, input) => Effect_exports.suspend(() => Schema_exports.decodeUnknownEffect(decoder)(input)).pipe(
1084
1083
  Effect_exports.mapError(() => new ValidationError())
1085
1084
  );
1086
- function wrap(decoder, optionalValue, field) {
1085
+ function wrap(decoder, optionalValue) {
1087
1086
  return {
1088
1087
  [Decoder]: decoder,
1089
- ...field === void 0 ? {} : { [StorageField]: field },
1090
1088
  optionalValue,
1091
1089
  parse: (input) => Effect_exports.runSync(parse(decoder, input)),
1092
- optional: () => wrap(
1093
- Schema_exports.optional(decoder),
1094
- true,
1095
- field === void 0 ? void 0 : { ...field, optional: true }
1096
- ),
1090
+ optional: () => wrap(Schema_exports.optional(decoder), true),
1097
1091
  default: (value) => {
1098
1092
  const parsed = Effect_exports.runSync(parse(decoder, value));
1099
1093
  return {
1100
1094
  ...wrap(
1101
1095
  decoder.annotate({ default: parsed }).pipe(Schema_exports.withDecodingDefault(Effect_exports.succeed(parsed))),
1102
- false,
1103
- field === void 0 || parsed === void 0 ? void 0 : {
1104
- ...field,
1105
- default: Schema_exports.decodeUnknownSync(
1106
- Schema_exports.Union([
1107
- Schema_exports.String,
1108
- Schema_exports.Finite,
1109
- Schema_exports.Boolean
1110
- ])
1111
- )(parsed)
1112
- }
1096
+ false
1113
1097
  ),
1114
1098
  hasDefault: true,
1115
1099
  inputOptional: optionalValue
@@ -1120,12 +1104,11 @@ function wrap(decoder, optionalValue, field) {
1120
1104
  function string(options = {}) {
1121
1105
  return wrap(
1122
1106
  options.minLength === void 0 ? Schema_exports.String : Schema_exports.String.check(Schema_exports.isMinLength(options.minLength)),
1123
- false,
1124
- { kind: "string" }
1107
+ false
1125
1108
  );
1126
1109
  }
1127
- var number = () => wrap(Schema_exports.Finite, false, { kind: "number" });
1128
- var boolean = () => wrap(Schema_exports.Boolean, false, { kind: "boolean" });
1110
+ var number = () => wrap(Schema_exports.Finite, false);
1111
+ var boolean = () => wrap(Schema_exports.Boolean, false);
1129
1112
  var json = () => wrap(Schema_exports.Json, false);
1130
1113
  var record = (value) => wrap(
1131
1114
  Schema_exports.Record(
@@ -1752,9 +1735,6 @@ var jsonSchema = (input) => {
1752
1735
  false
1753
1736
  );
1754
1737
  };
1755
- var storageFieldOf = (schema) => schema[StorageField];
1756
- var id = (table) => wrap(Schema_exports.NonEmptyString, false, { kind: "id", references: table });
1757
- var userId = () => wrap(Schema_exports.NonEmptyString, false, { kind: "userId" });
1758
1738
  var jsonSchemaDocument = (decoder) => {
1759
1739
  const imported = importedJsonSchema(decoder);
1760
1740
  if (imported !== void 0) return Schema_exports.decodeUnknownEffect(JsonObject)(imported);
@@ -1797,8 +1777,5 @@ export {
1797
1777
  preparedJsonSchemaDecoder,
1798
1778
  jsonSchemaDecoder,
1799
1779
  jsonSchema,
1800
- storageFieldOf,
1801
- id,
1802
- userId,
1803
1780
  jsonSchemaDocument
1804
1781
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  appSignInCallbackPath
3
- } from "./chunk-NHCFIWN5.js";
3
+ } from "./chunk-W2NV54JD.js";
4
4
  import {
5
5
  HttpServerResponse_exports
6
- } from "./chunk-KOOJUMLR.js";
6
+ } from "./chunk-3MMG2H6M.js";
7
7
 
8
8
  // src/implementation/ui-auth.ts
9
9
  var appPrivateHeaders = {
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  CacheError
3
- } from "./chunk-BI6R577B.js";
3
+ } from "./chunk-P7MGDPFD.js";
4
4
  import {
5
5
  wrap
6
- } from "./chunk-POOIHRPF.js";
6
+ } from "./chunk-GHXRRFZA.js";
7
7
  import {
8
8
  JsonObject
9
- } from "./chunk-BI45HZWM.js";
9
+ } from "./chunk-YQ35E7KS.js";
10
10
  import {
11
11
  Duration_exports,
12
12
  Effect_exports,
13
13
  Schema_exports
14
- } from "./chunk-IJQ5LE74.js";
14
+ } from "./chunk-MXDKXAY4.js";
15
15
 
16
16
  // src/implementation/catalog-cache.ts
17
17
  var catalogScope = (options, credential, invalid) => {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Predicate_exports
3
- } from "./chunk-IJQ5LE74.js";
3
+ } from "./chunk-MXDKXAY4.js";
4
4
 
5
5
  // ../utils/src/recorded-message.ts
6
6
  var RecordedMessage = /* @__PURE__ */ Symbol.for("@executor-js/utils/RecordedMessage");
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  RecordedMessage
3
- } from "./chunk-2FWXCU5I.js";
3
+ } from "./chunk-KAQD3DTI.js";
4
4
  import {
5
5
  SchemaGetter_exports,
6
6
  Schema_exports
7
- } from "./chunk-IJQ5LE74.js";
7
+ } from "./chunk-MXDKXAY4.js";
8
8
 
9
9
  // ../utils/src/api-error.ts
10
10
  var MessageField = Schema_exports.String.pipe(