@isaijs/core 0.1.5 → 0.1.8

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 (30) hide show
  1. package/dist/adapters/storage/r2/index.d.ts +3 -0
  2. package/dist/adapters/storage/r2/index.js +13 -2
  3. package/dist/auth/index.d.ts +2 -2
  4. package/dist/auth/index.js +2 -2
  5. package/dist/cli/index.js +79 -11
  6. package/dist/client/index.d.ts +4 -0
  7. package/dist/client/index.js +18 -13
  8. package/dist/{create-auth-BHdX68Ng.js → create-auth-BCvMwlVD.js} +18 -10
  9. package/dist/{data-layer-C5oJZ8V1.js → data-layer-CVCFjPyv.js} +15 -10
  10. package/dist/{data-layer-43pme0Gy.d.ts → data-layer-nvm_ivGQ.d.ts} +6 -2
  11. package/dist/db/index.d.ts +2 -2
  12. package/dist/db/index.js +5 -5
  13. package/dist/{index-D0FEnMhn.d.ts → index-Bb9Px6SR.d.ts} +116 -22
  14. package/dist/{index-CYcklQ1l.d.ts → index-CaR3hb0i.d.ts} +5 -1
  15. package/dist/index.d.ts +2 -2
  16. package/dist/index.js +169 -79
  17. package/dist/{make-ByA-84h8.js → make-jMJABOWI.js} +21 -3
  18. package/dist/{makers-P9kg68C8.js → makers-A0Pj6Tda.js} +3 -3
  19. package/dist/{migrator-B25prc9n.js → migrator-DxTpns_-.js} +174 -30
  20. package/dist/{model-Dc3HunKb.js → model-6pJBqqGd.js} +31 -1
  21. package/dist/{policies-KsqmlX67.js → policies-C_oiSgmY.js} +1 -1
  22. package/dist/{resource-BQK7bkPQ.js → resource-BIMAiOre.js} +8 -6
  23. package/dist/{tables-DgSwge7s.js → tables-DjW96Ubl.js} +1 -1
  24. package/dist/testing/index.d.ts +1 -1
  25. package/dist/testing/index.js +4 -4
  26. package/dist/{types-BgOkJy5d.d.ts → types-D5SIVeej.d.ts} +59 -2
  27. package/dist/validation/index.d.ts +2 -2
  28. package/dist/validation/index.js +1 -1
  29. package/dist/{validation-Cppmd0RV.js → validation-C3MCRBQO.js} +26 -3
  30. package/package.json +1 -1
@@ -1105,6 +1105,10 @@ const IMAGE_TYPES = [
1105
1105
  const MB = 1048576;
1106
1106
  /** At most this many files in one field. */
1107
1107
  const FILES_MAX = 10;
1108
+ /** At most this many documents in one field: an order's files, all its lines'. */
1109
+ const DOCUMENTS_MAX = 100;
1110
+ /** A document's size: the Workers body limit, the most one request can carry. */
1111
+ const DOCUMENT_BYTES = 100 * MB;
1108
1112
  /** A file's id: `fil_` and a ULID. */
1109
1113
  const FILE_ID = /^fil_[0-9A-HJKMNP-TV-Z]{26}$/;
1110
1114
  /** A storage's name: a key of `storage` in `app.ts`. */
@@ -1244,10 +1248,27 @@ function image(options = {}) {
1244
1248
  many: false
1245
1249
  }));
1246
1250
  }
1251
+ const DOCUMENT_TYPES = [
1252
+ "pdf",
1253
+ "png",
1254
+ "jpeg",
1255
+ "webp"
1256
+ ];
1257
+ /** A PDF or an image to print or read whole (never resized), up to 100 MB. */
1258
+ function document(options = {}) {
1259
+ return fileKind("document", specOf({
1260
+ ...options,
1261
+ types: DOCUMENT_TYPES
1262
+ }, ALL_TYPES, {
1263
+ image: false,
1264
+ maxBytes: DOCUMENT_BYTES,
1265
+ many: false
1266
+ }));
1267
+ }
1247
1268
  /** A list kind of files, carrying its item's spec as a list. */
1248
- function many(name, item) {
1269
+ function many(name, item, max = FILES_MAX) {
1249
1270
  return new Kind({
1250
- ...named(name, list(item).max(FILES_MAX)).spec,
1271
+ ...named(name, list(item).max(max)).spec,
1251
1272
  file: {
1252
1273
  ...item.spec.file,
1253
1274
  many: true
@@ -1258,6 +1279,8 @@ function many(name, item) {
1258
1279
  const files = (options = {}) => many("files", file(options));
1259
1280
  /** Up to 10 images. */
1260
1281
  const images = (options = {}) => many("images", image(options));
1282
+ /** Up to 100 documents (PDFs and images, each up to 100 MB). */
1283
+ const documents = (options = {}) => many("documents", document(options), DOCUMENTS_MAX);
1261
1284
  //#endregion
1262
1285
  //#region src/internal/phone.ts
1263
1286
  /**
@@ -1313,4 +1336,4 @@ function phone(options = {}) {
1313
1336
  return phoneKind(() => region);
1314
1337
  }
1315
1338
  //#endregion
1316
- export { fakeUlid as A, serialize as B, text as C, choice as D, url as E, quantity as F, ValidationError as G, validate as H, sequence as I, Fake as K, LIST_MAX as L, id as M, int as N, date as O, money as P, list as R, subdomain as S, token as T, Kind as U, toKind as V, kind as W, newToken as _, file as a, slug as b, image as c, json as d, urls as f, markdown as g, line as h, SIZES_MAX as i, flag as j, datetime as k, images as l, host as m, phoneKind as n, fileTypeNames as o, email as p, fakeValue as q, isPhoneRegion as r, files as s, phone as t, define as u, personName as v, textKind as w, slugify as x, secret as y, object as z };
1339
+ export { date as A, list as B, slugify as C, token as D, textKind as E, int as F, Kind as G, serialize as H, money as I, Fake as J, kind as K, quantity as L, fakeUlid as M, flag as N, url as O, id as P, sequence as R, slug as S, text as T, toKind as U, object as V, validate as W, fakeValue as Y, line as _, document as a, personName as b, fileTypeNames as c, images as d, define as f, host as g, email as h, SIZES_MAX as i, datetime as j, choice as k, files as l, urls as m, phoneKind as n, documents as o, json as p, ValidationError as q, isPhoneRegion as r, file as s, phone as t, image as u, markdown as v, subdomain as w, secret as x, newToken as y, LIST_MAX as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isaijs/core",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "description": "A batteries-included, type-safe TypeScript backend framework. Cloudflare first, no lock-in.",
5
5
  "type": "module",
6
6
  "license": "MIT",