@panneau/protocol 5.0.0-alpha.4 → 5.0.0-alpha.5

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 (66) hide show
  1. package/dist/conformance/index.d.ts.map +1 -1
  2. package/dist/conformance/index.js +121 -1
  3. package/dist/conformance/index.js.map +1 -1
  4. package/dist/constants.d.ts +2 -2
  5. package/dist/constants.d.ts.map +1 -1
  6. package/dist/constants.js +3 -1
  7. package/dist/constants.js.map +1 -1
  8. package/dist/index.js +5 -2
  9. package/dist/libraries.d.ts +16 -0
  10. package/dist/libraries.d.ts.map +1 -0
  11. package/dist/libraries.js +15 -0
  12. package/dist/libraries.js.map +1 -0
  13. package/dist/lint.d.ts +2 -2
  14. package/dist/lint.d.ts.map +1 -1
  15. package/dist/lint.js +15 -9
  16. package/dist/lint.js.map +1 -1
  17. package/dist/mock/example.d.ts.map +1 -1
  18. package/dist/mock/example.js +8 -0
  19. package/dist/mock/example.js.map +1 -1
  20. package/dist/mock/index.d.ts +9 -1
  21. package/dist/mock/index.d.ts.map +1 -1
  22. package/dist/mock/index.js +119 -13
  23. package/dist/mock/index.js.map +1 -1
  24. package/dist/openapi.d.ts.map +1 -1
  25. package/dist/openapi.js +37 -7
  26. package/dist/openapi.js.map +1 -1
  27. package/dist/rules.d.ts.map +1 -1
  28. package/dist/rules.js +17 -0
  29. package/dist/rules.js.map +1 -1
  30. package/dist/runtime/index.d.ts +3 -0
  31. package/dist/runtime/index.d.ts.map +1 -1
  32. package/dist/runtime/index.js +4 -1
  33. package/dist/schemas/action.d.ts +17 -1
  34. package/dist/schemas/action.d.ts.map +1 -1
  35. package/dist/schemas/api.d.ts +87 -0
  36. package/dist/schemas/api.d.ts.map +1 -1
  37. package/dist/schemas/api.js +28 -9
  38. package/dist/schemas/api.js.map +1 -1
  39. package/dist/schemas/definition.d.ts +38 -2
  40. package/dist/schemas/definition.d.ts.map +1 -1
  41. package/dist/schemas/definition.js +2 -1
  42. package/dist/schemas/definition.js.map +1 -1
  43. package/dist/schemas/field.d.ts +24 -1
  44. package/dist/schemas/field.d.ts.map +1 -1
  45. package/dist/schemas/field.js +22 -4
  46. package/dist/schemas/field.js.map +1 -1
  47. package/dist/schemas/index.d.ts +201 -6
  48. package/dist/schemas/index.d.ts.map +1 -1
  49. package/dist/schemas/index.js +4 -2
  50. package/dist/schemas/index.js.map +1 -1
  51. package/dist/schemas/resource.d.ts +36 -2
  52. package/dist/schemas/resource.d.ts.map +1 -1
  53. package/dist/schemas/resource.js +3 -1
  54. package/dist/schemas/resource.js.map +1 -1
  55. package/dist/search.d.ts +51 -0
  56. package/dist/search.d.ts.map +1 -0
  57. package/dist/search.js +53 -0
  58. package/dist/search.js.map +1 -0
  59. package/dist/transforms.d.ts +17 -0
  60. package/dist/transforms.d.ts.map +1 -0
  61. package/dist/transforms.js +34 -0
  62. package/dist/transforms.js.map +1 -0
  63. package/package.json +1 -1
  64. package/schema/boot.schema.json +80 -1
  65. package/schema/definition.schema.json +80 -1
  66. package/schema/openapi.json +342 -13
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","names":[],"sources":["../../src/schemas/api.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Abilities, Id, RouteReference } from './common';\nimport { User } from './definition';\n\nexport const Item = z\n .looseObject({\n id: Id,\n version: z.string().nullable().meta({\n description: 'Changes on every update. `null` when the backend has no versions.',\n }),\n abilities: Abilities,\n })\n .meta({\n description: 'An item of a resource. Its other properties are the values of its fields.',\n });\n\nexport const Pagination = z.looseObject({\n page: z.number().int().positive(),\n perPage: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n lastPage: z.number().int().positive(),\n});\n\nexport const ItemResponse = z.looseObject({ data: Item });\n\nexport const ListResponse = z.looseObject({ data: z.array(Item), meta: Pagination });\n\nexport const Problem = z\n .looseObject({\n type: z.string().meta({ description: 'A URI reference that identifies the problem type.' }),\n title: z.string(),\n status: z.number().int().min(400).max(599),\n detail: z.string().optional(),\n instance: z.string().optional(),\n errors: z\n .record(z.string(), z.array(z.string()))\n .optional()\n .meta({ description: '`422`: messages keyed by the dot path of the invalid value.' }),\n current: Item.optional().meta({ description: '`412`: the current version of the item.' }),\n })\n .meta({ description: 'An error, as RFC 9457 problem details (`application/problem+json`).' });\n\nexport const Selection = z.union([\n z.looseObject({ ids: z.array(Id).min(1) }),\n z.looseObject({\n query: z.looseObject({\n filter: z.record(z.string(), z.unknown()).optional().meta({\n description:\n 'The `filter` of the list query, by filter id: a value, a list of values, or the bounds of a range (`{ \"from\": \"2026-01-01\", \"to\": \"2026-01-31\" }`).',\n }),\n q: z.string().optional(),\n }),\n except: z.array(Id).optional(),\n }),\n]);\n\nexport const ActionRequest = z.looseObject({\n selection: Selection.optional().meta({\n description: 'Omitted for actions on the whole resource.',\n }),\n values: z.record(z.string(), z.unknown()).optional(),\n dryRun: z.boolean().optional().meta({\n description:\n 'Answer what the action would do without running it: a `200` action result whose `summary` counts the items that would succeed and those that would be skipped. Only for actions with `dryRun: true`.',\n }),\n});\n\nexport const ActionItemResult = z.looseObject({\n id: Id,\n status: z.enum(['failed', 'skipped']),\n message: z.string().optional(),\n reason: z\n .string()\n .optional()\n .meta({ description: '`skipped`: `forbidden`, `not_found` or `unchanged`.' }),\n});\n\nexport const ActionResult = z.looseObject({\n message: z.string().optional(),\n summary: z\n .looseObject({\n succeeded: z.number().int().nonnegative(),\n failed: z.number().int().nonnegative(),\n skipped: z.number().int().nonnegative(),\n })\n .optional(),\n results: z\n .array(ActionItemResult)\n .optional()\n .meta({ description: 'The items that did not succeed.' }),\n refresh: z.enum(['none', 'items', 'list']).optional(),\n redirect: z.union([z.string(), RouteReference]).nullable().optional(),\n download: z\n .looseObject({\n url: z.string(),\n filename: z.string().optional(),\n expiresAt: z.string().optional(),\n })\n .nullable()\n .optional(),\n});\n\nexport const ActionRun = z.looseObject({\n id: Id,\n action: z.string(),\n resource: z.string(),\n status: z.enum(['queued', 'running', 'succeeded', 'partial', 'failed', 'cancelled']),\n progress: z.number().int().nonnegative(),\n total: z.number().int().nonnegative().nullable(),\n result: ActionResult.optional().meta({ description: 'Set once the run has finished.' }),\n createdAt: z.string().optional(),\n finishedAt: z.string().nullable().optional(),\n});\n\nexport const ActionRunResponse = z.looseObject({ run: ActionRun });\n\nexport const MediaTransform = z\n .looseObject({\n crop: z\n .looseObject({\n x: z.number().int().nonnegative(),\n y: z.number().int().nonnegative(),\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n })\n .optional()\n .meta({\n description:\n 'In whole pixels of the upright original image (after its EXIF orientation), from its top left corner.',\n }),\n rotate: z\n .union([z.literal(0), z.literal(90), z.literal(180), z.literal(270)])\n .optional()\n .meta({ description: 'Clockwise, in degrees.' }),\n flipX: z.boolean().optional().meta({ description: 'Mirrors left to right (horizontal).' }),\n flipY: z.boolean().optional().meta({ description: 'Mirrors top to bottom (vertical).' }),\n focalPoint: z\n .looseObject({ x: z.number().min(0).max(1), y: z.number().min(0).max(1) })\n .optional()\n .meta({\n description:\n 'From 0 to 1, relative to the width and height of the upright original image, not of the crop: changing the crop does not move it. Renderers map it into the transformed image and clamp it to the crop.',\n }),\n })\n .meta({\n description:\n 'Non-destructive edits of an image, applied in this order: crop, then rotate, then flip.',\n });\n\nexport const UploadReference = z.looseObject({ upload: z.string().min(1) }).meta({\n description:\n 'A file uploaded directly to storage, by the id of its upload: in a file value, such as the `file` of a media, or an action parameter.',\n});\n\nexport const StoredFile = z\n .looseObject({\n name: z.string().meta({ description: 'The name of the file, as the user knows it.' }),\n url: z.string().nullable().optional().meta({\n description: 'Where to download it. A private file gets a temporary URL.',\n }),\n mime: z.string().nullable().optional(),\n size: z.number().int().nonnegative().nullable().optional(),\n })\n .meta({\n description:\n 'A file stored by the backend: the value of a `file` field in items. Requests send it back to keep the file, `{ \"upload\" }` to replace it, or `null` to remove it.',\n });\n\nexport const Upload = z\n .looseObject({\n id: z.string().min(1).meta({ description: 'The id of the upload: `upl_…`.' }),\n key: z.string().optional().meta({ description: 'The key of the object in storage.' }),\n name: z.string().optional(),\n mime: z.string().optional(),\n size: z.number().int().nonnegative().optional(),\n })\n .meta({\n description:\n 'A file the browser uploaded to storage, before it becomes a media, an import or another value.',\n });\n\nexport const UploadResponse = z.looseObject({ data: Upload });\n\nexport const UploadSignRequest = z\n .looseObject({\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']),\n key: z.string().min(1),\n uploadId: z.string().optional().meta({ description: 'The S3 multipart upload.' }),\n partNumber: z.number().int().positive().optional(),\n contentType: z.string().optional(),\n expiresIn: z.number().int().positive().optional(),\n })\n .meta({\n description: \"A request of the browser's S3 client to sign (Uppy 6's `signRequest`).\",\n });\n\nexport const UploadSignResponse = z\n .looseObject({\n url: z.string(),\n key: z\n .string()\n .optional()\n .meta({ description: 'The key the backend chose, for the first request of a file.' }),\n headers: z.record(z.string(), z.string()).optional().meta({\n description: 'Headers the URL was signed with, which the browser sends.',\n }),\n upload: z\n .string()\n .optional()\n .meta({ description: 'The upload the first request of a file created: `upl_…`.' }),\n })\n .meta({ description: 'A presigned request.' });\n\nexport const MediaInfo = z\n .looseObject({\n type: z.string().meta({\n description:\n '`image`, `video`, `audio`, `document`, `font`, or another type the backend knows.',\n }),\n mime: z.string().nullable().optional(),\n size: z.number().int().nonnegative().nullable().optional(),\n url: z.string().nullable().optional().meta({\n description:\n 'The main file to show or play: a rendition, or the original until it exists.',\n }),\n thumbnailUrl: z.string().nullable().optional(),\n variants: z\n .record(\n z.string(),\n z.looseObject({\n url: z.string(),\n width: z.number().optional(),\n height: z.number().optional(),\n }),\n )\n .optional()\n .meta({ description: 'Named renditions: sizes of an image, qualities of a video.' }),\n width: z.number().nullable().optional(),\n height: z.number().nullable().optional(),\n duration: z.number().nullable().optional().meta({ description: 'In seconds.' }),\n status: z.enum(['pending', 'processing', 'ready', 'failed']).optional().meta({\n description:\n 'Where the processing of the file is: `pending` and `processing` until its renditions are made, then `ready` or `failed`. Without it, the media is ready.',\n }),\n metadata: z.record(z.string(), z.unknown()).optional(),\n })\n .meta({\n description:\n 'What the backend computed about the file of a media item: the `media` of the items of a `media` resource, and of the values of `media` fields. Read-only: the editable properties of a media are the fields of its resource.',\n });\n\nexport const MediaItem = Item.extend({\n media: MediaInfo,\n}).meta({\n description:\n 'An item of a resource of kind `media`: the values of its fields (`file`, the original, and those of the project), and the `media` the backend computed.',\n});\n\nexport const MediaReference = z\n .looseObject({\n id: Id,\n label: z.string().optional().meta({ description: 'The `itemTitle` of the media.' }),\n media: MediaInfo.optional(),\n transform: MediaTransform.nullable().optional().meta({\n description: 'The edits of the image for this use only, over those of the media.',\n }),\n })\n .meta({\n description:\n 'The value of a `media` field in items: the media, with what lists and fields show, and its edits for this use. Requests send the id, or `{ id, transform }`.',\n });\n\nexport const Session = z.looseObject({ user: User });\n\nexport const SearchResponse = z.looseObject({\n data: z.array(\n z.looseObject({\n resource: z.string(),\n items: z.array(Item),\n total: z.number().int().nonnegative().optional(),\n }),\n ),\n});\n\nexport const PreviewResponse = z.looseObject({ url: z.string(), expiresAt: z.string().optional() });\n\nexport type Item = z.infer<typeof Item>;\nexport type Pagination = z.infer<typeof Pagination>;\nexport type ItemResponse = z.infer<typeof ItemResponse>;\nexport type ListResponse = z.infer<typeof ListResponse>;\nexport type Problem = z.infer<typeof Problem>;\nexport type Selection = z.infer<typeof Selection>;\nexport type ActionRequest = z.infer<typeof ActionRequest>;\nexport type ActionItemResult = z.infer<typeof ActionItemResult>;\nexport type ActionResult = z.infer<typeof ActionResult>;\nexport type ActionRun = z.infer<typeof ActionRun>;\nexport type ActionRunResponse = z.infer<typeof ActionRunResponse>;\nexport type MediaTransform = z.infer<typeof MediaTransform>;\nexport type UploadReference = z.infer<typeof UploadReference>;\nexport type StoredFile = z.infer<typeof StoredFile>;\nexport type Upload = z.infer<typeof Upload>;\nexport type UploadResponse = z.infer<typeof UploadResponse>;\nexport type UploadSignRequest = z.infer<typeof UploadSignRequest>;\nexport type UploadSignResponse = z.infer<typeof UploadSignResponse>;\nexport type MediaInfo = z.infer<typeof MediaInfo>;\nexport type MediaItem = z.infer<typeof MediaItem>;\nexport type MediaReference = z.infer<typeof MediaReference>;\nexport type Session = z.infer<typeof Session>;\nexport type SearchResponse = z.infer<typeof SearchResponse>;\nexport type PreviewResponse = z.infer<typeof PreviewResponse>;\n"],"mappings":";;;;AAKA,IAAa,OAAO,EACf,YAAY;CACT,IAAI;CACJ,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAChC,aAAa,oEACjB,CAAC;CACD,WAAW;AACf,CAAC,CAAC,CACD,KAAK,EACF,aAAa,4EACjB,CAAC;AAEL,IAAa,aAAa,EAAE,YAAY;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAChC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CACnC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY;CACpC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;AACxC,CAAC;AAED,IAAa,eAAe,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAExD,IAAa,eAAe,EAAE,YAAY;CAAE,MAAM,EAAE,MAAM,IAAI;CAAG,MAAM;AAAW,CAAC;AAEnF,IAAa,UAAU,EAClB,YAAY;CACT,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,aAAa,oDAAoD,CAAC;CAC1F,OAAO,EAAE,OAAO;CAChB,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,GAAG;CACzC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,QAAQ,EACH,OAAO,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CACvC,SAAS,CAAC,CACV,KAAK,EAAE,aAA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9E,QAAQ,EAAE,KAAK;EAAC;EAAW;EAAc;EAAS;CAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACzE,aACI,2JACR,CAAC;CACD,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS;AACzD,CAAC,CAAC,CACD,KAAK,EACF,aACI,+NACR,CAAC;AAEL,IAAa,YAAY,KAAK,OAAO,EACjC,OAAO,UACX,CAAC,CAAC,CAAC,KAAK,EACJ,aACI,0JACR,CAAC;AAED,IAAa,iBAAiB,EACzB,YAAY;CACT,IAAI;CACJ,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,gCAAgC,CAAC;CAClF,OAAO,UAAU,SAAS;CAC1B,WAAW,eAAe,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACjD,aAAa,qEACjB,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,+JACR,CAAC;AAEL,IAAa,UAAU,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAEnD,IAAa,iBAAiB,EAAE,YAAY,EACxC,MAAM,EAAE,MACJ,EAAE,YAAY;CACV,UAAU,EAAE,OAAO;CACnB,OAAO,EAAE,MAAM,IAAI;CACnB,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS;AACnD,CAAC,CACL,EACJ,CAAC;AAED,IAAa,kBAAkB,EAAE,YAAY;CAAE,KAAK,EAAE,OAAO;CAAG,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;AAAE,CAAC"}
1
+ {"version":3,"file":"api.js","names":[],"sources":["../../src/schemas/api.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Abilities, Id, RouteReference } from './common';\nimport { User } from './definition';\n\nexport const Item = z\n .looseObject({\n id: Id,\n version: z.string().nullable().meta({\n description: 'Changes on every update. `null` when the backend has no versions.',\n }),\n abilities: Abilities,\n })\n .meta({\n description: 'An item of a resource. Its other properties are the values of its fields.',\n });\n\nexport const Pagination = z.looseObject({\n page: z.number().int().positive(),\n perPage: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n lastPage: z.number().int().positive(),\n});\n\nexport const ItemResponse = z.looseObject({ data: Item });\n\nexport const ListResponse = z.looseObject({ data: z.array(Item), meta: Pagination });\n\nexport const Problem = z\n .looseObject({\n type: z.string().meta({ description: 'A URI reference that identifies the problem type.' }),\n title: z.string(),\n status: z.number().int().min(400).max(599),\n detail: z.string().optional(),\n instance: z.string().optional(),\n errors: z\n .record(z.string(), z.array(z.string()))\n .optional()\n .meta({ description: '`422`: messages keyed by the dot path of the invalid value.' }),\n current: Item.optional().meta({ description: '`412`: the current version of the item.' }),\n })\n .meta({ description: 'An error, as RFC 9457 problem details (`application/problem+json`).' });\n\nexport const Selection = z.union([\n z.looseObject({ ids: z.array(Id).min(1) }),\n z.looseObject({\n query: z.looseObject({\n filter: z.record(z.string(), z.unknown()).optional().meta({\n description:\n 'The `filter` of the list query, by filter id: a value, a list of values, or the bounds of a range (`{ \"from\": \"2026-01-01\", \"to\": \"2026-01-31\" }`).',\n }),\n q: z.string().optional(),\n }),\n except: z.array(Id).optional(),\n }),\n]);\n\nexport const ActionRequest = z.looseObject({\n selection: Selection.optional().meta({\n description: 'Omitted for actions on the whole resource.',\n }),\n values: z.record(z.string(), z.unknown()).optional(),\n dryRun: z.boolean().optional().meta({\n description:\n 'Answer what the action would do without running it: a `200` action result whose `summary` counts the items that would succeed and those that would be skipped. Only for actions with `dryRun: true`.',\n }),\n});\n\nexport const ActionItemResult = z.looseObject({\n id: Id,\n status: z.enum(['failed', 'skipped']),\n message: z.string().optional(),\n reason: z\n .string()\n .optional()\n .meta({ description: '`skipped`: `forbidden`, `not_found` or `unchanged`.' }),\n});\n\nexport const ActionResult = z.looseObject({\n message: z.string().optional(),\n summary: z\n .looseObject({\n succeeded: z.number().int().nonnegative(),\n failed: z.number().int().nonnegative(),\n skipped: z.number().int().nonnegative(),\n })\n .optional(),\n results: z\n .array(ActionItemResult)\n .optional()\n .meta({ description: 'The items that did not succeed.' }),\n refresh: z.enum(['none', 'items', 'list']).optional(),\n redirect: z.union([z.string(), RouteReference]).nullable().optional(),\n download: z\n .looseObject({\n url: z.string(),\n filename: z.string().optional(),\n expiresAt: z.string().optional(),\n })\n .nullable()\n .optional(),\n});\n\nexport const ActionRun = z.looseObject({\n id: Id,\n action: z.string(),\n resource: z.string(),\n status: z.enum(['queued', 'running', 'succeeded', 'partial', 'failed', 'cancelled']),\n progress: z.number().int().nonnegative(),\n total: z.number().int().nonnegative().nullable(),\n result: ActionResult.optional().meta({ description: 'Set once the run has finished.' }),\n createdAt: z.string().optional(),\n finishedAt: z.string().nullable().optional(),\n});\n\nexport const ActionRunResponse = z.looseObject({ run: ActionRun });\n\nexport const MediaTransform = z\n .looseObject({\n crop: z\n .looseObject({\n x: z.number().int().nonnegative(),\n y: z.number().int().nonnegative(),\n width: z.number().int().positive(),\n height: z.number().int().positive(),\n })\n .optional()\n .meta({\n description:\n 'In whole pixels of the upright original image (after its EXIF orientation), from its top left corner.',\n }),\n rotate: z\n .union([z.literal(0), z.literal(90), z.literal(180), z.literal(270)])\n .optional()\n .meta({ description: 'Clockwise, in degrees.' }),\n flipX: z.boolean().optional().meta({ description: 'Mirrors left to right (horizontal).' }),\n flipY: z.boolean().optional().meta({ description: 'Mirrors top to bottom (vertical).' }),\n focalPoint: z\n .looseObject({ x: z.number().min(0).max(1), y: z.number().min(0).max(1) })\n .optional()\n .meta({\n description:\n 'From 0 to 1, relative to the width and height of the upright original image, not of the crop: changing the crop does not move it. Renderers map it into the transformed image and clamp it to the crop.',\n }),\n base: z.enum(['media', 'original']).optional().meta({\n description:\n \"What a transform for one use starts from: the original file by default, or the media's own transform (`media`). With `media`, the crop and the focal point are relative to the media's version instead of the original (decision 0031).\",\n }),\n // Return types are written out so that declaration files keep the recursion.\n get baseTransform(): z.ZodOptional<typeof MediaTransform> {\n return MediaTransform.optional().meta({\n description:\n 'With `base: \"media\"`: the media\\'s own transform this one was made on. When the media\\'s transform is no longer the same, clients ask to check the crop, and renderers clamp it.',\n });\n },\n })\n .meta({\n description:\n \"Non-destructive edits of an image, applied in this order: crop, then rotate, then flip. Renderers ignore the keys they don't know, which editor tools can add.\",\n });\n\nexport const UploadReference = z.looseObject({ upload: z.string().min(1) }).meta({\n description:\n 'A file uploaded directly to storage, by the id of its upload: in a file value, such as the `file` of a media, or an action parameter.',\n});\n\nexport const StoredFile = z\n .looseObject({\n name: z.string().meta({ description: 'The name of the file, as the user knows it.' }),\n url: z.string().nullable().optional().meta({\n description: 'Where to download it. A private file gets a temporary URL.',\n }),\n mime: z.string().nullable().optional(),\n size: z.number().int().nonnegative().nullable().optional(),\n })\n .meta({\n description:\n 'A file stored by the backend: the value of a `file` field in items. Requests send it back to keep the file, `{ \"upload\" }` to replace it, or `null` to remove it.',\n });\n\nexport const Upload = z\n .looseObject({\n id: z.string().min(1).meta({ description: 'The id of the upload: `upl_…`.' }),\n key: z.string().optional().meta({ description: 'The key of the object in storage.' }),\n name: z.string().optional(),\n mime: z.string().optional(),\n size: z.number().int().nonnegative().optional(),\n })\n .meta({\n description:\n 'A file the browser uploaded to storage, before it becomes a media, an import or another value.',\n });\n\nexport const UploadResponse = z.looseObject({ data: Upload });\n\nexport const UploadSignRequest = z\n .looseObject({\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']),\n key: z.string().min(1),\n uploadId: z.string().optional().meta({ description: 'The S3 multipart upload.' }),\n partNumber: z.number().int().positive().optional(),\n contentType: z.string().optional(),\n expiresIn: z.number().int().positive().optional(),\n })\n .meta({\n description: \"A request of the browser's S3 client to sign (Uppy 6's `signRequest`).\",\n });\n\nexport const UploadSignResponse = z\n .looseObject({\n url: z.string(),\n key: z\n .string()\n .optional()\n .meta({ description: 'The key the backend chose, for the first request of a file.' }),\n headers: z.record(z.string(), z.string()).optional().meta({\n description: 'Headers the URL was signed with, which the browser sends.',\n }),\n upload: z\n .string()\n .optional()\n .meta({ description: 'The upload the first request of a file created: `upl_…`.' }),\n })\n .meta({ description: 'A presigned request.' });\n\nexport const MediaInfo = z\n .looseObject({\n type: z.string().meta({\n description:\n '`image`, `video`, `audio`, `document`, `font`, or another type the backend knows.',\n }),\n mime: z.string().nullable().optional(),\n size: z.number().int().nonnegative().nullable().optional(),\n url: z.string().nullable().optional().meta({\n description:\n 'The main file to show or play: a rendition, or the original until it exists.',\n }),\n thumbnailUrl: z.string().nullable().optional(),\n variants: z\n .record(\n z.string(),\n z.looseObject({\n url: z.string(),\n width: z.number().optional(),\n height: z.number().optional(),\n }),\n )\n .optional()\n .meta({ description: 'Named renditions: sizes of an image, qualities of a video.' }),\n width: z.number().nullable().optional(),\n height: z.number().nullable().optional(),\n duration: z.number().nullable().optional().meta({ description: 'In seconds.' }),\n status: z.enum(['pending', 'processing', 'ready', 'failed']).optional().meta({\n description:\n 'Where the processing of the file is: `pending` and `processing` until its renditions are made, then `ready` or `failed`. Without it, the media is ready.',\n }),\n metadata: z.record(z.string(), z.unknown()).optional(),\n transform: MediaTransform.nullable().optional().meta({\n description:\n \"The media's own transform, from its library, which clients need to draw a transform for one use made over it (decision 0031).\",\n }),\n })\n .meta({\n description:\n 'What the backend computed about the file of a media item: the `media` of the items of a `media` resource, and of the values of `media` fields. Read-only: the editable properties of a media are the fields of its resource.',\n });\n\nexport const MediaItem = Item.extend({\n media: MediaInfo,\n}).meta({\n description:\n 'An item of a resource of kind `media`: the values of its fields (`file`, the original, and those of the project), and the `media` the backend computed.',\n});\n\nexport const MediaReference = z\n .looseObject({\n id: Id,\n resource: z.string().optional().meta({\n description:\n 'The library of the media. Required for a field that allows several libraries, since ids are unique only within their resource (decision 0027).',\n }),\n label: z.string().optional().meta({ description: 'The `itemTitle` of the media.' }),\n media: MediaInfo.optional(),\n transform: MediaTransform.nullable().optional().meta({\n description:\n 'The edits of the image for this use only: from the original file, or over the media\\'s own transform with `base: \"media\"`.',\n }),\n })\n .meta({\n description:\n 'The value of a `media` or `image` field in items: the media, with what lists and fields show, and its edits for this use. Requests send the id, or `{ id, resource, transform }`: `resource` is required when the field allows several libraries.',\n });\n\nexport const FieldCheckRequest = z\n .looseObject({\n value: z.string().meta({ description: 'The value to check, as it is typed.' }),\n locale: z\n .string()\n .optional()\n .meta({ description: 'The locale of the value, for a localized field.' }),\n id: Id.nullable()\n .optional()\n .meta({ description: 'The item being edited, or null when creating one.' }),\n values: z.record(z.string(), z.unknown()).optional().meta({\n description:\n \"The form's current values, as they would be sent to save, for what the check depends on (a page's parent).\",\n }),\n })\n .meta({ description: 'A value of a field with `check`, to check with the backend.' });\n\nexport const FieldCheckResponse = z\n .looseObject({\n available: z.boolean().meta({\n description:\n 'Whether no other item of the resource, in its scope and the same locale, has the value.',\n }),\n suggestion: z.string().nullable().optional().meta({\n description: 'An available value close to the one checked, when it is taken.',\n }),\n prefix: z.string().nullable().optional().meta({\n description: 'What the field shows in front of the value: the start of its URL.',\n }),\n url: z\n .string()\n .nullable()\n .optional()\n .meta({ description: 'The URL the value gives the item, which the field links to.' }),\n disabled: z.boolean().optional().meta({\n description:\n \"The field doesn't apply to this item (the home page has no slug): the field is read-only.\",\n }),\n })\n .meta({\n description:\n 'What the backend says about a value: not authoritative, since saving still validates it.',\n });\n\nexport const Session = z.looseObject({ user: User });\n\nexport const SearchResponse = z\n .looseObject({\n data: z.array(\n z.looseObject({\n resource: z.string().meta({ description: 'The id of the resource.' }),\n items: z.array(Item),\n total: z.number().int().nonnegative().optional().meta({\n description:\n 'How many items of the resource match, when the backend counts them: the list of the resource, searched, shows them all.',\n }),\n }),\n ),\n })\n .meta({\n description:\n 'The results of the global search: the resources with results, in the order of the definition.',\n });\n\nexport const PreviewResponse = z.looseObject({ url: z.string(), expiresAt: z.string().optional() });\n\nexport type Item = z.infer<typeof Item>;\nexport type Pagination = z.infer<typeof Pagination>;\nexport type ItemResponse = z.infer<typeof ItemResponse>;\nexport type ListResponse = z.infer<typeof ListResponse>;\nexport type Problem = z.infer<typeof Problem>;\nexport type Selection = z.infer<typeof Selection>;\nexport type ActionRequest = z.infer<typeof ActionRequest>;\nexport type ActionItemResult = z.infer<typeof ActionItemResult>;\nexport type ActionResult = z.infer<typeof ActionResult>;\nexport type ActionRun = z.infer<typeof ActionRun>;\nexport type ActionRunResponse = z.infer<typeof ActionRunResponse>;\nexport type MediaTransform = z.infer<typeof MediaTransform>;\nexport type UploadReference = z.infer<typeof UploadReference>;\nexport type StoredFile = z.infer<typeof StoredFile>;\nexport type Upload = z.infer<typeof Upload>;\nexport type UploadResponse = z.infer<typeof UploadResponse>;\nexport type UploadSignRequest = z.infer<typeof UploadSignRequest>;\nexport type UploadSignResponse = z.infer<typeof UploadSignResponse>;\nexport type FieldCheckRequest = z.infer<typeof FieldCheckRequest>;\nexport type FieldCheckResponse = z.infer<typeof FieldCheckResponse>;\nexport type MediaInfo = z.infer<typeof MediaInfo>;\nexport type MediaItem = z.infer<typeof MediaItem>;\nexport type MediaReference = z.infer<typeof MediaReference>;\nexport type Session = z.infer<typeof Session>;\nexport type SearchResponse = z.infer<typeof SearchResponse>;\nexport type PreviewResponse = z.infer<typeof PreviewResponse>;\n"],"mappings":";;;;AAKA,IAAa,OAAO,EACf,YAAY;CACT,IAAI;CACJ,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAChC,aAAa,oEACjB,CAAC;CACD,WAAW;AACf,CAAC,CAAC,CACD,KAAK,EACF,aAAa,4EACjB,CAAC;AAEL,IAAa,aAAa,EAAE,YAAY;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAChC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CACnC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY;CACpC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;AACxC,CAAC;A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K,EAClC,aACI,4FACR,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EACF,aACI,2FACR,CAAC;AAEL,IAAa,UAAU,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AAEnD,IAAa,iBAAiB,EACzB,YAAY,EACT,MAAM,EAAE,MACJ,EAAE,YAAY;CACV,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,EAAE,aAAa,0BAA0B,CAAC;CACpE,OAAO,EAAE,MAAM,IAAI;CACnB,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAClD,aACI,0HACR,CAAC;AACL,CAAC,CACL,EACJ,CAAC,CAAC,CACD,KAAK,EACF,aACI,gGACR,CAAC;AAEL,IAAa,kBAAkB,EAAE,YAAY;CAAE,KAAK,EAAE,OAAO;CAAG,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;AAAE,CAAC"}
@@ -5,6 +5,7 @@ export declare const User: z.ZodObject<{
5
5
  email: z.ZodOptional<z.ZodString>;
6
6
  avatarUrl: z.ZodOptional<z.ZodString>;
7
7
  abilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
8
+ resource: z.ZodOptional<z.ZodString>;
8
9
  }, z.core.$loose>;
9
10
  export declare const AuthProvider: z.ZodObject<{
10
11
  id: z.ZodString;
@@ -80,6 +81,8 @@ export declare const Definition: z.ZodObject<{
80
81
  description: z.ZodOptional<z.ZodString>;
81
82
  icon: z.ZodOptional<z.ZodString>;
82
83
  itemTitle: z.ZodOptional<z.ZodString>;
84
+ itemSubtitle: z.ZodOptional<z.ZodString>;
85
+ itemImage: z.ZodOptional<z.ZodString>;
83
86
  fields: z.ZodArray<z.ZodObject<{
84
87
  name: z.ZodString;
85
88
  type: z.ZodString;
@@ -133,6 +136,13 @@ export declare const Definition: z.ZodObject<{
133
136
  field: z.ZodString;
134
137
  }, z.core.$loose>]>;
135
138
  message: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$loose>, z.ZodObject<{
140
+ rule: z.ZodLiteral<"crop">;
141
+ value: z.ZodObject<{
142
+ ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
143
+ required: z.ZodOptional<z.ZodBoolean>;
144
+ }, z.core.$loose>;
145
+ message: z.ZodOptional<z.ZodString>;
136
146
  }, z.core.$loose>, z.ZodObject<{
137
147
  rule: z.ZodString;
138
148
  message: z.ZodOptional<z.ZodString>;
@@ -153,9 +163,18 @@ export declare const Definition: z.ZodObject<{
153
163
  disabled: z.ZodOptional<z.ZodBoolean>;
154
164
  }, z.core.$loose>>>;
155
165
  multiple: z.ZodOptional<z.ZodBoolean>;
156
- resource: z.ZodOptional<z.ZodString>;
166
+ resource: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
157
167
  accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
168
+ ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
169
+ rotate: z.ZodOptional<z.ZodBoolean>;
170
+ focalPoint: z.ZodOptional<z.ZodBoolean>;
171
+ transformBase: z.ZodOptional<z.ZodEnum<{
172
+ media: "media";
173
+ original: "original";
174
+ choose: "choose";
175
+ }>>;
158
176
  from: z.ZodOptional<z.ZodString>;
177
+ check: z.ZodOptional<z.ZodBoolean>;
159
178
  display: z.ZodOptional<z.ZodString>;
160
179
  fields: z.ZodOptional<z.ZodArray<typeof import("./field").Field>>;
161
180
  types: z.ZodOptional<z.ZodArray<typeof import("./field").BlockType>>;
@@ -302,6 +321,13 @@ export declare const Definition: z.ZodObject<{
302
321
  field: z.ZodString;
303
322
  }, z.core.$loose>]>;
304
323
  message: z.ZodOptional<z.ZodString>;
324
+ }, z.core.$loose>, z.ZodObject<{
325
+ rule: z.ZodLiteral<"crop">;
326
+ value: z.ZodObject<{
327
+ ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
328
+ required: z.ZodOptional<z.ZodBoolean>;
329
+ }, z.core.$loose>;
330
+ message: z.ZodOptional<z.ZodString>;
305
331
  }, z.core.$loose>, z.ZodObject<{
306
332
  rule: z.ZodString;
307
333
  message: z.ZodOptional<z.ZodString>;
@@ -322,9 +348,18 @@ export declare const Definition: z.ZodObject<{
322
348
  disabled: z.ZodOptional<z.ZodBoolean>;
323
349
  }, z.core.$loose>>>;
324
350
  multiple: z.ZodOptional<z.ZodBoolean>;
325
- resource: z.ZodOptional<z.ZodString>;
351
+ resource: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
326
352
  accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
353
+ ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
354
+ rotate: z.ZodOptional<z.ZodBoolean>;
355
+ focalPoint: z.ZodOptional<z.ZodBoolean>;
356
+ transformBase: z.ZodOptional<z.ZodEnum<{
357
+ media: "media";
358
+ original: "original";
359
+ choose: "choose";
360
+ }>>;
327
361
  from: z.ZodOptional<z.ZodString>;
362
+ check: z.ZodOptional<z.ZodBoolean>;
328
363
  display: z.ZodOptional<z.ZodString>;
329
364
  fields: z.ZodOptional<z.ZodArray<typeof import("./field").Field>>;
330
365
  types: z.ZodOptional<z.ZodArray<typeof import("./field").BlockType>>;
@@ -502,6 +537,7 @@ export declare const Definition: z.ZodObject<{
502
537
  email: z.ZodOptional<z.ZodString>;
503
538
  avatarUrl: z.ZodOptional<z.ZodString>;
504
539
  abilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
540
+ resource: z.ZodOptional<z.ZodString>;
505
541
  }, z.core.$loose>>>;
506
542
  }, z.core.$loose>;
507
543
  export type User = z.infer<typeof User>;
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/schemas/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,IAAI;;;;;;iBAMf,CAAC;AAEH,eAAO,MAAM,YAA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
9
9
  name: z.string(),
10
10
  email: z.string().optional(),
11
11
  avatarUrl: z.string().optional(),
12
- abilities: Abilities.optional()
12
+ abilities: Abilities.optional(),
13
+ resource: z.string().optional().meta({ description: "The resource of users: its item with this `id` is the profile of the user. Without it, clients look for a resource `users`." })
13
14
  });
14
15
  var AuthProvider = z.looseObject({
15
16
  id: z.string().min(1),
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","names":[],"sources":["../../src/schemas/definition.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PROTOCOL_VERSION } from '../version';\nimport { Abilities, Id } from './common';\nimport { Resource } from './resource';\nimport { DefinitionTheme } from './theme';\n\nexport const User = z.looseObject({\n id: Id,\n name: z.string(),\n email: z.string().optional(),\n avatarUrl: z.string().optional(),\n abilities: Abilities.optional(),\n});\n\nexport const AuthProvider = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n url: z.string().optional().meta({ description: 'Where the login with this provider starts.' }),\n icon: z.string().optional(),\n});\n\nexport const Auth = z.looseObject({\n mode: z.enum(['panneau', 'external']).meta({\n description: \"`panneau`: Panneau's own login pages. `external`: the site handles login.\",\n }),\n loginUrl: z\n .string()\n .nullable()\n .optional()\n .meta({ description: '`external`: where unauthenticated users are sent.' }),\n password: z.boolean().optional(),\n providers: z.array(AuthProvider).optional(),\n passwordReset: z.boolean().optional(),\n twoFactor: z.boolean().optional(),\n passkeys: z.boolean().optional(),\n emailVerification: z.boolean().optional(),\n});\n\nexport const MenuItem = z\n .looseObject({\n type: z.string().min(1).meta({\n description: 'Built-in: `resources`, `resource`, `page`, `link`, `separator`, `group`.',\n }),\n label: z.string().optional(),\n icon: z.string().optional(),\n resource: z.string().optional(),\n page: z.string().optional(),\n url: z.string().optional(),\n external: z.boolean().optional(),\n // The return type is written out so that declaration files keep the recursion.\n get children(): z.ZodOptional<z.ZodArray<typeof MenuItem>> {\n return z.array(MenuItem).optional();\n },\n })\n .meta({ description: 'An entry of a menu.' });\n\nexport const Page = z.looseObject({\n component: z\n .string()\n .min(1)\n .meta({ description: 'A page provided by a plugin, or a built-in page.' }),\n path: z.string().optional().meta({ description: 'Path of a custom page.' }),\n label: z.string().optional(),\n props: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const Widget = z.looseObject({\n id: z.string().min(1),\n type: z.string().min(1).meta({\n description: 'Built-in: `stat`, `chart`, `recent-items`, `shortcuts`, `welcome`.',\n }),\n label: z.string().optional(),\n width: z.number().int().min(1).max(12).optional(),\n settings: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const Uploads = z.looseObject({\n mode: z.enum(['multipart', 'tus', 'presigned']).meta({\n description:\n '`multipart`: files go through `POST /media` and the requests that take them. `presigned`: the browser also sends files to storage itself, with URLs that `POST /uploads/sign` signs, then `POST /uploads/{upload}/complete` gives an upload that values reference.',\n }),\n endpoint: z.string().optional().meta({\n description:\n '`presigned`: the base URL of the upload routes, when they are not `{api.baseUrl}/uploads`.',\n }),\n maxSize: z.number().int().positive().optional(),\n});\n\nexport const Definition = z\n .looseObject({\n protocol: z.literal(PROTOCOL_VERSION),\n name: z.string(),\n locale: z\n .string()\n .min(2)\n .meta({ description: 'BCP 47 locale of the labels and messages.' }),\n locales: z\n .array(z.string().min(2))\n .min(1)\n .meta({ description: 'Locales of localized content fields.' }),\n api: z.looseObject({ baseUrl: z.string() }),\n resources: z.array(Resource),\n pages: z.record(z.string(), Page).optional(),\n menus: z.record(z.string(), z.array(MenuItem)).optional(),\n routes: z.record(z.string(), z.string()).optional().meta({\n description: 'Named paths of the frontend, for `link` actions and redirects.',\n }),\n auth: Auth.optional(),\n dashboard: z.looseObject({ widgets: z.array(Widget) }).optional(),\n search: z.looseObject({ enabled: z.boolean() }).optional(),\n uploads: Uploads.optional(),\n theme: DefinitionTheme.optional(),\n user: User.nullable().optional(),\n })\n .superRefine((definition, context) => {\n const ids = new Set<string>();\n definition.resources.forEach((resource, index) => {\n if (ids.has(resource.id)) {\n context.addIssue({\n code: 'custom',\n message: `Duplicate resource id \\`${resource.id}\\`.`,\n path: ['resources', index, 'id'],\n });\n }\n ids.add(resource.id);\n });\n })\n .meta({ description: 'Everything a frontend needs to render the admin for the current user.' });\n\nexport type User = z.infer<typeof User>;\nexport type AuthProvider = z.infer<typeof AuthProvider>;\nexport type Auth = z.infer<typeof Auth>;\nexport type MenuItem = z.infer<typeof MenuItem>;\nexport type Page = z.infer<typeof Page>;\nexport type Widget = z.infer<typeof Widget>;\nexport type Uploads = z.infer<typeof Uploads>;\nexport type Definition = z.infer<typeof Definition>;\n/** A definition as a backend writes it, before defaults are applied. */\nexport type DefinitionInput = z.input<typeof Definition>;\n"],"mappings":";;;;;;AAOA,IAAa,OAAO,EAAE,YAAY;CAC9B,IAAI;CACJ,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,WAAW,UAAU,SAAS;AAClC,CAAC;AAED,IAAa,eAAe,EAAE,YAAY;CACtC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,OAAO,EAAE,OAAO;CAChB,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,6CAA6C,CAAC;CAC7F,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC9B,CAAC;AAED,IAAa,OAAO,EAAE,YAAY;CAC9B,MAAM,EAAE,KAAK,CAAC,WAAW,UAAU,CAAC,CAAC,CAAC,KAAK,EACvC,aAAa,4EACjB,CAAC;CACD,UAAU,EACL,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,oDAAoD,CAAC;CAC9E,UAAU,EAAE,QAAQ,CAAC,CAAC,SAAS;CAC/B,WAAW,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS;CAC1C,eAAe,EAAE,QAAQ,CAAC,CAAC,SAAS;CACpC,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS;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AAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;CACzD,SAAS,QAAQ,SAAS;CAC1B,OAAO,gBAAgB,SAAS;CAChC,MAAM,KAAK,SAAS,CAAC,CAAC,SAAS;AACnC,CAAC,CAAC,CACD,aAAa,YAAY,YAAY;CAClC,MAAM,sBAAM,IAAI,IAAY;CAC5B,WAAW,UAAU,SAAS,UAAU,UAAU;EAC9C,IAAI,IAAI,IAAI,SAAS,EAAE,GACnB,QAAQ,SAAS;GACb,MAAM;GACN,SAAS,2BAA2B,SAAS,GAAG;GAChD,MAAM;IAAC;IAAa;IAAO;GAAI;EACnC,CAAC;EAEL,IAAI,IAAI,SAAS,EAAE;CACvB,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,wEAAwE,CAAC"}
1
+ {"version":3,"file":"definition.js","names":[],"sources":["../../src/schemas/definition.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PROTOCOL_VERSION } from '../version';\nimport { Abilities, Id } from './common';\nimport { Resource } from './resource';\nimport { DefinitionTheme } from './theme';\n\nexport const User = z.looseObject({\n id: Id,\n name: z.string(),\n email: z.string().optional(),\n avatarUrl: z.string().optional(),\n abilities: Abilities.optional(),\n resource: z.string().optional().meta({\n description:\n 'The resource of users: its item with this `id` is the profile of the user. Without it, clients look for a resource `users`.',\n }),\n});\n\nexport const AuthProvider = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n url: z.string().optional().meta({ description: 'Where the login with this provider starts.' }),\n icon: z.string().optional(),\n});\n\nexport const Auth = z.looseObject({\n mode: z.enum(['panneau', 'external']).meta({\n description: \"`panneau`: Panneau's own login pages. `external`: the site handles login.\",\n }),\n loginUrl: z\n .string()\n .nullable()\n .optional()\n .meta({ description: '`external`: where unauthenticated users are sent.' }),\n password: z.boolean().optional(),\n providers: z.array(AuthProvider).optional(),\n passwordReset: z.boolean().optional(),\n twoFactor: z.boolean().optional(),\n passkeys: z.boolean().optional(),\n emailVerification: z.boolean().optional(),\n});\n\nexport const MenuItem = z\n .looseObject({\n type: z.string().min(1).meta({\n description: 'Built-in: `resources`, `resource`, `page`, `link`, `separator`, `group`.',\n }),\n label: z.string().optional(),\n icon: z.string().optional(),\n resource: z.string().optional(),\n page: z.string().optional(),\n url: z.string().optional(),\n external: z.boolean().optional(),\n // The return type is written out so that declaration files keep the recursion.\n get children(): z.ZodOptional<z.ZodArray<typeof MenuItem>> {\n return z.array(MenuItem).optional();\n },\n })\n .meta({ description: 'An entry of a menu.' });\n\nexport const Page = z.looseObject({\n component: z\n .string()\n .min(1)\n .meta({ description: 'A page provided by a plugin, or a built-in page.' }),\n path: z.string().optional().meta({ description: 'Path of a custom page.' }),\n label: z.string().optional(),\n props: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const Widget = z.looseObject({\n id: z.string().min(1),\n type: z.string().min(1).meta({\n description: 'Built-in: `stat`, `chart`, `recent-items`, `shortcuts`, `welcome`.',\n }),\n label: z.string().optional(),\n width: z.number().int().min(1).max(12).optional(),\n settings: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const Uploads = z.looseObject({\n mode: z.enum(['multipart', 'tus', 'presigned']).meta({\n description:\n '`multipart`: files go through `POST /media` and the requests that take them. `presigned`: the browser also sends files to storage itself, with URLs that `POST /uploads/sign` signs, then `POST /uploads/{upload}/complete` gives an upload that values reference.',\n }),\n endpoint: z.string().optional().meta({\n description:\n '`presigned`: the base URL of the upload routes, when they are not `{api.baseUrl}/uploads`.',\n }),\n maxSize: z.number().int().positive().optional(),\n});\n\nexport const Definition = z\n .looseObject({\n protocol: z.literal(PROTOCOL_VERSION),\n name: z.string(),\n locale: z\n .string()\n .min(2)\n .meta({ description: 'BCP 47 locale of the labels and messages.' }),\n locales: z\n .array(z.string().min(2))\n .min(1)\n .meta({ description: 'Locales of localized content fields.' }),\n api: z.looseObject({ baseUrl: z.string() }),\n resources: z.array(Resource),\n pages: z.record(z.string(), Page).optional(),\n menus: z.record(z.string(), z.array(MenuItem)).optional(),\n routes: z.record(z.string(), z.string()).optional().meta({\n description: 'Named paths of the frontend, for `link` actions and redirects.',\n }),\n auth: Auth.optional(),\n dashboard: z.looseObject({ widgets: z.array(Widget) }).optional(),\n search: z.looseObject({ enabled: z.boolean() }).optional(),\n uploads: Uploads.optional(),\n theme: DefinitionTheme.optional(),\n user: User.nullable().optional(),\n })\n .superRefine((definition, context) => {\n const ids = new Set<string>();\n definition.resources.forEach((resource, index) => {\n if (ids.has(resource.id)) {\n context.addIssue({\n code: 'custom',\n message: `Duplicate resource id \\`${resource.id}\\`.`,\n path: ['resources', index, 'id'],\n });\n }\n ids.add(resource.id);\n });\n })\n .meta({ description: 'Everything a frontend needs to render the admin for the current user.' });\n\nexport type User = z.infer<typeof User>;\nexport type AuthProvider = z.infer<typeof AuthProvider>;\nexport type Auth = z.infer<typeof Auth>;\nexport type MenuItem = z.infer<typeof MenuItem>;\nexport type Page = z.infer<typeof Page>;\nexport type Widget = z.infer<typeof Widget>;\nexport type Uploads = z.infer<typeof Uploads>;\nexport type Definition = z.infer<typeof Definition>;\n/** A definition as a backend writes it, before defaults are applied. */\nexport type DefinitionInput = z.input<typeof Definition>;\n"],"mappings":";;;;;;AAOA,IAAa,OAAO,EAAE,YAAY;CAC9B,IAAI;CACJ,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,WAAW,UAAU,SAAS;CAC9B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACjC,aACI,8HACR,CAAC;AACL,CAAC;AAED,IAAa,eAAe,EAAE,YAAY;CACtC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,OAAO,EAAE,OAAO;CAChB,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,6CAA6C,CAAC;CAC7F,MAAM,EAAE,OAAO,CA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,WAAW,EAAE,MAAM,QAAQ;CAC3B,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC,CAAC,SAAS;CAC3C,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,MAAM,QAAQ,CAAC,CAAC,CAAC,SAAS;CACxD,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACrD,aAAa,iEACjB,CAAC;CACD,MAAM,KAAK,SAAS;CACpB,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS;CAChE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;CACzD,SAAS,QAAQ,SAAS;CAC1B,OAAO,gBAAgB,SAAS;CAChC,MAAM,KAAK,SAAS,CAAC,CAAC,SAAS;AACnC,CAAC,CAAC,CACD,aAAa,YAAY,YAAY;CAClC,MAAM,sBAAM,IAAI,IAAY;CAC5B,WAAW,UAAU,SAAS,UAAU,UAAU;EAC9C,IAAI,IAAI,IAAI,SAAS,EAAE,GACnB,QAAQ,SAAS;GACb,MAAM;GACN,SAAS,2BAA2B,SAAS,GAAG;GAChD,MAAM;IAAC;IAAa;IAAO;GAAI;EACnC,CAAC;EAEL,IAAI,IAAI,SAAS,EAAE;CACvB,CAAC;AACL,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,wEAAwE,CAAC"}
@@ -42,6 +42,13 @@ export declare const Rule: z.ZodUnion<readonly [z.ZodObject<{
42
42
  field: z.ZodString;
43
43
  }, z.core.$loose>]>;
44
44
  message: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$loose>, z.ZodObject<{
46
+ rule: z.ZodLiteral<"crop">;
47
+ value: z.ZodObject<{
48
+ ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
49
+ required: z.ZodOptional<z.ZodBoolean>;
50
+ }, z.core.$loose>;
51
+ message: z.ZodOptional<z.ZodString>;
45
52
  }, z.core.$loose>, z.ZodObject<{
46
53
  rule: z.ZodString;
47
54
  message: z.ZodOptional<z.ZodString>;
@@ -105,6 +112,13 @@ export declare const Field: z.ZodObject<{
105
112
  field: z.ZodString;
106
113
  }, z.core.$loose>]>;
107
114
  message: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$loose>, z.ZodObject<{
116
+ rule: z.ZodLiteral<"crop">;
117
+ value: z.ZodObject<{
118
+ ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
+ required: z.ZodOptional<z.ZodBoolean>;
120
+ }, z.core.$loose>;
121
+ message: z.ZodOptional<z.ZodString>;
108
122
  }, z.core.$loose>, z.ZodObject<{
109
123
  rule: z.ZodString;
110
124
  message: z.ZodOptional<z.ZodString>;
@@ -125,9 +139,18 @@ export declare const Field: z.ZodObject<{
125
139
  disabled: z.ZodOptional<z.ZodBoolean>;
126
140
  }, z.core.$loose>>>;
127
141
  multiple: z.ZodOptional<z.ZodBoolean>;
128
- resource: z.ZodOptional<z.ZodString>;
142
+ resource: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
129
143
  accept: z.ZodOptional<z.ZodArray<z.ZodString>>;
144
+ ratios: z.ZodOptional<z.ZodArray<z.ZodString>>;
145
+ rotate: z.ZodOptional<z.ZodBoolean>;
146
+ focalPoint: z.ZodOptional<z.ZodBoolean>;
147
+ transformBase: z.ZodOptional<z.ZodEnum<{
148
+ media: "media";
149
+ original: "original";
150
+ choose: "choose";
151
+ }>>;
130
152
  from: z.ZodOptional<z.ZodString>;
153
+ check: z.ZodOptional<z.ZodBoolean>;
131
154
  display: z.ZodOptional<z.ZodString>;
132
155
  fields: z.ZodOptional<z.ZodArray<typeof Field>>;
133
156
  types: z.ZodOptional<z.ZodArray<typeof BlockType>>;
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/schemas/field.ts"],"names":[],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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA4DI,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;WAMxC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;;iBAQhB,CAAC;AAEjD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACxC,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC"}
@@ -3,6 +3,7 @@ import { Condition, Option } from "./common.js";
3
3
  import { z } from "zod";
4
4
  //#region src/schemas/field.ts
5
5
  var message = z.string().optional().meta({ description: "Message shown when the rule fails, instead of the default one." });
6
+ var Ratio = z.string().regex(/^[1-9][0-9]*:[1-9][0-9]*$/).meta({ description: "An aspect ratio, as `width:height`: `16:9`." });
6
7
  var DateBound = z.union([z.string().meta({ description: "An ISO 8601 date or date-time." }), z.looseObject({ field: z.string().min(1) }).meta({ description: "Another field of the form." })]);
7
8
  var Rule = z.union([
8
9
  z.looseObject({
@@ -48,11 +49,19 @@ var Rule = z.union([
48
49
  value: DateBound,
49
50
  message
50
51
  }),
52
+ z.looseObject({
53
+ rule: z.literal("crop"),
54
+ value: z.looseObject({
55
+ ratios: z.array(Ratio).optional().meta({ description: "A crop must have one of them: its height is within one pixel of its width divided by the ratio, after its rotation." }),
56
+ required: z.boolean().optional().meta({ description: "Each image needs a crop for this use." })
57
+ }),
58
+ message
59
+ }),
51
60
  z.looseObject({
52
61
  rule: z.string().refine((rule) => !PORTABLE_RULES.includes(rule)),
53
62
  message
54
63
  }).meta({ description: "A rule added in a later version of the protocol. Clients that don't know it ignore it; the server still enforces it." })
55
- ]).meta({ description: "A portable validation rule. `min` and `max` apply to numbers, and to the length of text and arrays. `accept` lists MIME types (`image/*`). `maxSize` is in bytes." });
64
+ ]).meta({ description: "A portable validation rule. `min` and `max` apply to numbers, and to the length of text and arrays. `accept` lists MIME types (`image/*`). `maxSize` is in bytes. `crop` checks the transform of each image of an `image` or `media` value (decision 0031)." });
56
65
  var BlockType = z.looseObject({
57
66
  id: z.string().min(1),
58
67
  label: z.string(),
@@ -75,10 +84,19 @@ var Field = z.looseObject({
75
84
  rules: z.array(Rule).optional(),
76
85
  visibleWhen: Condition.optional(),
77
86
  options: z.array(Option).optional().meta({ description: "`select`: the choices." }),
78
- multiple: z.boolean().optional().meta({ description: "`select`, `relation`, `media`, `file`: the value is an array." }),
79
- resource: z.string().optional().meta({ description: "`relation`: id of the related resource. `media`: id of a resource of kind `media`, optional when the definition has only one." }),
80
- accept: z.array(z.string()).optional().meta({ description: "`media`, `file`: accepted MIME types." }),
87
+ multiple: z.boolean().optional().meta({ description: "`select`, `relation`, `media`, `image`, `file`: the value is an array." }),
88
+ resource: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).optional().meta({ description: "`relation`: id of the related resource. `media`, `image`: id of a resource of kind `media`, or a list of them; without it, every library of the definition (decision 0027)." }),
89
+ accept: z.array(z.string()).optional().meta({ description: "`media`, `image`, `file`: accepted MIME types. `image` defaults to `image/*`." }),
90
+ ratios: z.array(Ratio).optional().meta({ description: "`image`: ratios the editor suggests. The `crop` rule enforces ratios (decision 0031)." }),
91
+ rotate: z.boolean().optional().meta({ description: "`image`: whether the editor offers rotation and flips. Defaults to true." }),
92
+ focalPoint: z.boolean().optional().meta({ description: "`image`: whether the editor offers the focal point. Defaults to true." }),
93
+ transformBase: z.enum([
94
+ "media",
95
+ "original",
96
+ "choose"
97
+ ]).optional().meta({ description: "`image`: what a transform for one use starts from: the media's own transform (`media`, the default), the original file, or the user's choice in the editor (decision 0031)." }),
81
98
  from: z.string().optional().meta({ description: "`slug`: the field the slug is generated from." }),
99
+ check: z.boolean().optional().meta({ description: "The client checks the value with the backend as it is typed, with `POST /resources/{resource}/fields/{field}/check`: whether a `slug` is available, and its URL. A field at the top of the resource only." }),
82
100
  display: z.string().optional().meta({ description: "Display used in lists, when it differs from the default one of the type." }),
83
101
  get fields() {
84
102
  return z.array(Field).optional().meta({ description: "`group` and `repeater`: the nested fields." });
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","names":[],"sources":["../../src/schemas/field.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PORTABLE_RULES } from '../constants';\nimport { Condition, Option } from './common';\n\nconst message = z\n .string()\n .optional()\n .meta({ description: 'Message shown when the rule fails, instead of the default one.' });\n\nconst DateBound = z.union([\n z.string().meta({ description: 'An ISO 8601 date or date-time.' }),\n z.looseObject({ field: z.string().min(1) }).meta({ description: 'Another field of the form.' }),\n]);\n\nexport const Rule = z\n .union([\n z.looseObject({ rule: z.literal('required'), message }),\n z.looseObject({ rule: z.enum(['min', 'max']), value: z.number(), message }),\n z.looseObject({\n rule: z.literal('pattern'),\n value: z.string(),\n flags: z.string().optional(),\n message,\n }),\n z.looseObject({ rule: z.enum(['email', 'url']), message }),\n z.looseObject({\n rule: z.literal('in'),\n value: z.array(z.union([z.string(), z.number(), z.boolean()])),\n message,\n }),\n z.looseObject({ rule: z.literal('accept'), value: z.array(z.string().min(1)), message }),\n z.looseObject({ rule: z.literal('maxSize'), value: z.number().int().positive(), message }),\n z.looseObject({ rule: z.enum(['before', 'after']), value: DateBound, message }),\n z\n .looseObject({\n rule: z\n .string()\n .refine((rule) => !(PORTABLE_RULES as readonly string[]).includes(rule)),\n message,\n })\n .meta({\n description:\n \"A rule added in a later version of the protocol. Clients that don't know it ignore it; the server still enforces it.\",\n }),\n ])\n .meta({\n description:\n 'A portable validation rule. `min` and `max` apply to numbers, and to the length of text and arrays. `accept` lists MIME types (`image/*`). `maxSize` is in bytes.',\n });\n\nexport const BlockType = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n icon: z.string().optional(),\n // Return types are written out so that declaration files keep the recursion.\n get fields(): z.ZodArray<typeof Field> {\n return z.array(Field);\n },\n});\n\nexport const Field = z\n .looseObject({\n name: z.string().min(1),\n type: z\n .string()\n .min(1)\n .meta({ description: 'A built-in field type, or a type provided by a plugin.' }),\n label: z.string().optional(),\n help: z.string().optional(),\n placeholder: z.string().optional(),\n default: z.unknown().optional(),\n localized: z\n .boolean()\n .optional()\n .meta({ description: 'The value is an object keyed by locale.' }),\n readOnly: z.boolean().optional(),\n createOnly: z.boolean().optional(),\n updateOnly: z.boolean().optional(),\n rules: z.array(Rule).optional(),\n visibleWhen: Condition.optional(),\n options: z.array(Option).optional().meta({ description: '`select`: the choices.' }),\n multiple: z\n .boolean()\n .optional()\n .meta({ description: '`select`, `relation`, `media`, `file`: the value is an array.' }),\n resource: z.string().optional().meta({\n description:\n '`relation`: id of the related resource. `media`: id of a resource of kind `media`, optional when the definition has only one.',\n }),\n accept: z\n .array(z.string())\n .optional()\n .meta({ description: '`media`, `file`: accepted MIME types.' }),\n from: z\n .string()\n .optional()\n .meta({ description: '`slug`: the field the slug is generated from.' }),\n display: z.string().optional().meta({\n description: 'Display used in lists, when it differs from the default one of the type.',\n }),\n get fields(): z.ZodOptional<z.ZodArray<typeof Field>> {\n return z\n .array(Field)\n .optional()\n .meta({ description: '`group` and `repeater`: the nested fields.' });\n },\n get types(): z.ZodOptional<z.ZodArray<typeof BlockType>> {\n return z\n .array(BlockType)\n .optional()\n .meta({ description: '`repeater`: typed blocks, each with its own fields.' });\n },\n settings: z.record(z.string(), z.unknown()).optional(),\n })\n .meta({ description: 'A field of a form.' });\n\nexport type Rule = z.infer<typeof Rule>;\nexport type BlockType = z.infer<typeof BlockType>;\nexport type Field = z.infer<typeof Field>;\n"],"mappings":";;;;AAKA,IAAM,UAAU,EACX,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iEAAiE,CAAC;AAE3F,IAAM,YAA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,gIACR,CAAC;CACD,QAAQ,EACH,MAAM,EAAE,OAAO,CAAC,CAAC,CACjB,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,wCAAwC,CAAC;CAClE,MAAM,EACD,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,gDAAgD,CAAC;CAC1E,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAChC,aAAa,2EACjB,CAAC;CACD,IAAI,SAAkD;EAClD,OAAO,EACF,MAAM,KAAK,CAAC,CACZ,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,6CAA6C,CAAC;CAC3E;CACA,IAAI,QAAqD;EACrD,OAAO,EACF,MAAM,SAAS,CAAC,CAChB,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,sDAAsD,CAAC;CACpF;CACA,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS;AACzD,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,qBAAqB,CAAC"}
1
+ {"version":3,"file":"field.js","names":[],"sources":["../../src/schemas/field.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PORTABLE_RULES } from '../constants';\nimport { Condition, Option } from './common';\n\nconst message = z\n .string()\n .optional()\n .meta({ description: 'Message shown when the rule fails, instead of the default one.' });\n\nconst Ratio = z\n .string()\n .regex(/^[1-9][0-9]*:[1-9][0-9]*$/)\n .meta({ description: 'An aspect ratio, as `width:height`: `16:9`.' });\n\nconst DateBound = z.union([\n z.string().meta({ description: 'An ISO 8601 date or date-time.' }),\n z.looseObject({ field: z.string().min(1) }).meta({ description: 'Another field of the form.' }),\n]);\n\nexport const Rule = z\n .union([\n z.looseObject({ rule: z.literal('required'), message }),\n z.looseObject({ rule: z.enum(['min', 'max']), value: z.number(), message }),\n z.looseObject({\n rule: z.literal('pattern'),\n value: z.string(),\n flags: z.string().optional(),\n message,\n }),\n z.looseObject({ rule: z.enum(['email', 'url']), message }),\n z.looseObject({\n rule: z.literal('in'),\n value: z.array(z.union([z.string(), z.number(), z.boolean()])),\n message,\n }),\n z.looseObject({ rule: z.literal('accept'), value: z.array(z.string().min(1)), message }),\n z.looseObject({ rule: z.literal('maxSize'), value: z.number().int().positive(), message }),\n z.looseObject({ rule: z.enum(['before', 'after']), value: DateBound, message }),\n z.looseObject({\n rule: z.literal('crop'),\n value: z.looseObject({\n ratios: z.array(Ratio).optional().meta({\n description:\n 'A crop must have one of them: its height is within one pixel of its width divided by the ratio, after its rotation.',\n }),\n required: z\n .boolean()\n .optional()\n .meta({ description: 'Each image needs a crop for this use.' }),\n }),\n message,\n }),\n z\n .looseObject({\n rule: z\n .string()\n .refine((rule) => !(PORTABLE_RULES as readonly string[]).includes(rule)),\n message,\n })\n .meta({\n description:\n \"A rule added in a later version of the protocol. Clients that don't know it ignore it; the server still enforces it.\",\n }),\n ])\n .meta({\n description:\n 'A portable validation rule. `min` and `max` apply to numbers, and to the length of text and arrays. `accept` lists MIME types (`image/*`). `maxSize` is in bytes. `crop` checks the transform of each image of an `image` or `media` value (decision 0031).',\n });\n\nexport const BlockType = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n icon: z.string().optional(),\n // Return types are written out so that declaration files keep the recursion.\n get fields(): z.ZodArray<typeof Field> {\n return z.array(Field);\n },\n});\n\nexport const Field = z\n .looseObject({\n name: z.string().min(1),\n type: z\n .string()\n .min(1)\n .meta({ description: 'A built-in field type, or a type provided by a plugin.' }),\n label: z.string().optional(),\n help: z.string().optional(),\n placeholder: z.string().optional(),\n default: z.unknown().optional(),\n localized: z\n .boolean()\n .optional()\n .meta({ description: 'The value is an object keyed by locale.' }),\n readOnly: z.boolean().optional(),\n createOnly: z.boolean().optional(),\n updateOnly: z.boolean().optional(),\n rules: z.array(Rule).optional(),\n visibleWhen: Condition.optional(),\n options: z.array(Option).optional().meta({ description: '`select`: the choices.' }),\n multiple: z.boolean().optional().meta({\n description: '`select`, `relation`, `media`, `image`, `file`: the value is an array.',\n }),\n resource: z\n .union([z.string().min(1), z.array(z.string().min(1)).min(1)])\n .optional()\n .meta({\n description:\n '`relation`: id of the related resource. `media`, `image`: id of a resource of kind `media`, or a list of them; without it, every library of the definition (decision 0027).',\n }),\n accept: z.array(z.string()).optional().meta({\n description:\n '`media`, `image`, `file`: accepted MIME types. `image` defaults to `image/*`.',\n }),\n ratios: z.array(Ratio).optional().meta({\n description:\n '`image`: ratios the editor suggests. The `crop` rule enforces ratios (decision 0031).',\n }),\n rotate: z.boolean().optional().meta({\n description: '`image`: whether the editor offers rotation and flips. Defaults to true.',\n }),\n focalPoint: z.boolean().optional().meta({\n description: '`image`: whether the editor offers the focal point. Defaults to true.',\n }),\n transformBase: z.enum(['media', 'original', 'choose']).optional().meta({\n description:\n \"`image`: what a transform for one use starts from: the media's own transform (`media`, the default), the original file, or the user's choice in the editor (decision 0031).\",\n }),\n from: z\n .string()\n .optional()\n .meta({ description: '`slug`: the field the slug is generated from.' }),\n check: z.boolean().optional().meta({\n description:\n 'The client checks the value with the backend as it is typed, with `POST /resources/{resource}/fields/{field}/check`: whether a `slug` is available, and its URL. A field at the top of the resource only.',\n }),\n display: z.string().optional().meta({\n description: 'Display used in lists, when it differs from the default one of the type.',\n }),\n get fields(): z.ZodOptional<z.ZodArray<typeof Field>> {\n return z\n .array(Field)\n .optional()\n .meta({ description: '`group` and `repeater`: the nested fields.' });\n },\n get types(): z.ZodOptional<z.ZodArray<typeof BlockType>> {\n return z\n .array(BlockType)\n .optional()\n .meta({ description: '`repeater`: typed blocks, each with its own fields.' });\n },\n settings: z.record(z.string(), z.unknown()).optional(),\n })\n .meta({ description: 'A field of a form.' });\n\nexport type Rule = z.infer<typeof Rule>;\nexport type BlockType = z.infer<typeof BlockType>;\nexport type Field = z.infer<typeof Field>;\n"],"mappings":";;;;AAKA,IAAM,UAAU,EACX,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,iEAAiE,CAAC;AAE3F,IAAM,QAAQ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