@fitzzero/quickdraw-core 5.0.0 → 5.1.0

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 (68) hide show
  1. package/README.md +343 -49
  2. package/dist/{admin-BiU4LRZS.d.ts → admin-DKwkIh5i.d.ts} +25 -10
  3. package/dist/{adminSchemas-k5a1Ov7b.d.ts → adminSchemas-2DUA_hZ8.d.ts} +15 -9
  4. package/dist/{auth-CMyRkfjZ.d.ts → auth-BhWqdyb-.d.ts} +2 -2
  5. package/dist/{caller-DHzK3oiI.d.ts → caller-CXTFswBO.d.ts} +28 -6
  6. package/dist/{chunk-2XJFNVHW.js → chunk-2PWMUVC7.js} +1 -1
  7. package/dist/{chunk-2XJFNVHW.js.map → chunk-2PWMUVC7.js.map} +1 -1
  8. package/dist/{chunk-5IC5VZ7T.js → chunk-2UELNHDD.js} +3 -3
  9. package/dist/{chunk-XFDOGTMC.js → chunk-3674EIRT.js} +4 -4
  10. package/dist/{chunk-DNCAI3KY.js → chunk-4DIQHASK.js} +1 -1
  11. package/dist/chunk-4DIQHASK.js.map +1 -0
  12. package/dist/{chunk-LLLYILEP.js → chunk-A6DJBGOG.js} +411 -43
  13. package/dist/chunk-A6DJBGOG.js.map +1 -0
  14. package/dist/{chunk-B2UQ27GH.js → chunk-CDKG4TFA.js} +25 -5
  15. package/dist/{chunk-B2UQ27GH.js.map → chunk-CDKG4TFA.js.map} +1 -1
  16. package/dist/{chunk-IRGAGRVG.js → chunk-JZBCLNDU.js} +4 -4
  17. package/dist/{chunk-XUSN5WKU.js → chunk-KNDDCVQJ.js} +4 -4
  18. package/dist/{chunk-5YRQ26LF.js → chunk-RT6OILOI.js} +1 -1
  19. package/dist/chunk-RT6OILOI.js.map +1 -0
  20. package/dist/{chunk-7QIY2DDX.js → chunk-VJTFXHOK.js} +2 -2
  21. package/dist/{chunk-7QIY2DDX.js.map → chunk-VJTFXHOK.js.map} +1 -1
  22. package/dist/chunk-XNLWBZIG.js +9 -0
  23. package/dist/chunk-XNLWBZIG.js.map +1 -0
  24. package/dist/cli/quickdraw-docs.js +241 -27
  25. package/dist/cli/quickdraw-docs.js.map +1 -1
  26. package/dist/client/index.d.ts +7 -7
  27. package/dist/client/index.js +5 -5
  28. package/dist/{clientTypes-B3o_99Xq.d.ts → clientTypes-Bc-G8n-U.d.ts} +3 -3
  29. package/dist/{connection-DuN8GvcD.d.ts → connection-Cr1BU07W.d.ts} +2 -2
  30. package/dist/{createServer-DUacdfKl.d.ts → createServer-CP9eDHZZ.d.ts} +30 -9
  31. package/dist/{createTestApp-DFLXoTKm.d.ts → createTestApp-UKVGEmOf.d.ts} +6 -6
  32. package/dist/{envelope-nf5eGB-a.d.ts → envelope-Cp3YcVxC.d.ts} +1 -1
  33. package/dist/{http--uoooIH5.d.ts → http-Djj2Inuu.d.ts} +6 -6
  34. package/dist/index.d.ts +6 -6
  35. package/dist/index.js +27 -7
  36. package/dist/index.js.map +1 -1
  37. package/dist/{infer-Dw21kmLw.d.ts → infer-Teo1xpsd.d.ts} +17 -0
  38. package/dist/{metrics-C0WvB7-I.d.ts → metrics-BdBu5o8G.d.ts} +2 -2
  39. package/dist/prisma/index.d.ts +4 -4
  40. package/dist/prisma/index.js +1 -1
  41. package/dist/server/auth/index.d.ts +14 -5
  42. package/dist/server/auth/index.js +0 -5
  43. package/dist/server/auth/index.js.map +1 -1
  44. package/dist/server/index.d.ts +120 -33
  45. package/dist/server/index.js +146 -193
  46. package/dist/server/index.js.map +1 -1
  47. package/dist/server/mcp/index.d.ts +51 -11
  48. package/dist/server/mcp/index.js +129 -8
  49. package/dist/server/mcp/index.js.map +1 -1
  50. package/dist/server/otel.d.ts +3 -3
  51. package/dist/{sharing-n4ss-ONM.d.ts → sharing-DVa8W-yR.d.ts} +3 -3
  52. package/dist/testing/client.d.ts +13 -13
  53. package/dist/testing/client.js +6 -6
  54. package/dist/testing/index.d.ts +156 -12
  55. package/dist/testing/index.js +1037 -22
  56. package/dist/testing/index.js.map +1 -1
  57. package/dist/testing/mock.d.ts +5 -5
  58. package/dist/testing/mock.js +5 -5
  59. package/dist/{types-Bwg3kIEc.d.ts → types-Cu0vmx7c.d.ts} +8 -2
  60. package/dist/utils/index.d.ts +1 -1
  61. package/package.json +1 -1
  62. package/dist/chunk-5YRQ26LF.js.map +0 -1
  63. package/dist/chunk-DNCAI3KY.js.map +0 -1
  64. package/dist/chunk-LLLYILEP.js.map +0 -1
  65. /package/dist/{chunk-5IC5VZ7T.js.map → chunk-2UELNHDD.js.map} +0 -0
  66. /package/dist/{chunk-XFDOGTMC.js.map → chunk-3674EIRT.js.map} +0 -0
  67. /package/dist/{chunk-IRGAGRVG.js.map → chunk-JZBCLNDU.js.map} +0 -0
  68. /package/dist/{chunk-XUSN5WKU.js.map → chunk-KNDDCVQJ.js.map} +0 -0
@@ -1138,7 +1138,7 @@ var DESCRIBE = Object.freeze({
1138
1138
  adminSubscribers: "Counts the sockets subscribed to one row, per access level.",
1139
1139
  adminReemit: "Sends one row as it is now to every socket subscribed to it."
1140
1140
  });
1141
- var OPTIONS2 = ["entity", "filter", "sort", "expose", "describe"];
1141
+ var OPTIONS2 = ["entity", "filter", "sort", "editable", "expose", "describe"];
1142
1142
  function isRecord3(value) {
1143
1143
  return typeof value === "object" && value !== null && !Array.isArray(value);
1144
1144
  }
@@ -1150,7 +1150,7 @@ function quoted3(names) {
1150
1150
  }
1151
1151
  function checkOptions(options) {
1152
1152
  if (!isRecord3(options)) {
1153
- fail2("options must be { entity, filter?, sort?, expose?, describe? }");
1153
+ fail2("options must be { entity, filter?, sort?, editable?, expose?, describe? }");
1154
1154
  }
1155
1155
  const unknownKey = Object.keys(options).find((key) => !OPTIONS2.includes(key));
1156
1156
  if (unknownKey !== void 0) {
@@ -1177,6 +1177,24 @@ function checkFields2(owner, names, fields) {
1177
1177
  }
1178
1178
  return Object.freeze([...names]);
1179
1179
  }
1180
+ function checkEditable(names, fields) {
1181
+ if (names === void 0) {
1182
+ return void 0;
1183
+ }
1184
+ const valid = Array.isArray(names) && names.every((name) => typeof name === "string") && new Set(names).size === names.length;
1185
+ if (!valid) {
1186
+ fail2("editable must be a list of distinct field names");
1187
+ }
1188
+ for (const name of names) {
1189
+ if (ADMIN_NEVER_WRITABLE.includes(name)) {
1190
+ fail2(`editable: "${name}" is never editable; the database sets it`);
1191
+ }
1192
+ if (!fields.some((field) => field.name === name)) {
1193
+ fail2(`editable: "${name}" is not a field of the entity`);
1194
+ }
1195
+ }
1196
+ return Object.freeze([...names]);
1197
+ }
1180
1198
  function exposedOf(expose) {
1181
1199
  if (expose === void 0) {
1182
1200
  return ADMIN_METHODS;
@@ -1241,15 +1259,17 @@ function contract2(options) {
1241
1259
  const checked = checkOptions(options);
1242
1260
  const { entity } = checked;
1243
1261
  const fields = entityFieldsOf(entity, fail2);
1262
+ const editable = checkEditable(checked.editable, fields);
1244
1263
  const base = Object.freeze({
1245
1264
  entity,
1246
1265
  filter: checkFields2("filter", checked.filter, fields),
1247
1266
  sort: checkFields2("sort", checked.sort, fields),
1248
- fields
1267
+ fields,
1268
+ editable
1249
1269
  });
1250
1270
  const names = exposedOf(checked.expose);
1251
1271
  const described = describedOf(names, checked.describe);
1252
- const writable = fields.map((field) => field.name).filter((field) => !ADMIN_NEVER_WRITABLE.includes(field));
1272
+ const writable = editable ?? fields.map((field) => field.name).filter((field) => !ADMIN_NEVER_WRITABLE.includes(field));
1253
1273
  const methods = {};
1254
1274
  for (const name of names) {
1255
1275
  const own = described[name];
@@ -1301,4 +1321,4 @@ export {
1301
1321
  adminSpecOf,
1302
1322
  admin
1303
1323
  };
1304
- //# sourceMappingURL=chunk-B2UQ27GH.js.map
1324
+ //# sourceMappingURL=chunk-CDKG4TFA.js.map