@fabrika/check 0.5.2 → 0.5.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/check",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,11 +46,11 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@babel/parser": "8.0.7",
49
- "@fabrika/app": "0.5.2",
50
- "@fabrika/auth-core": "0.5.2",
51
- "@fabrika/db": "0.5.2",
52
- "@fabrika/operations-contract": "0.5.2",
53
- "@fabrika/platform-node": "0.5.2",
49
+ "@fabrika/app": "0.5.3",
50
+ "@fabrika/auth-core": "0.5.3",
51
+ "@fabrika/db": "0.5.3",
52
+ "@fabrika/operations-contract": "0.5.3",
53
+ "@fabrika/platform-node": "0.5.3",
54
54
  "zod": "^3.25.76"
55
55
  }
56
56
  }
@@ -385,6 +385,7 @@ class SurfaceReader {
385
385
  honeypot: optionalText(options.get('honeypot'), 'honeypot'),
386
386
  challenge: formChallenge(options.get('challenge')),
387
387
  then: optionalText(options.get('then'), 'then'),
388
+ ...crossOriginOption(options.get('crossOrigin')),
388
389
  unknownOptions: optionKeys(options, 'form'),
389
390
  }
390
391
  }
@@ -544,6 +545,7 @@ class SurfaceReader {
544
545
  input: input === undefined || input.kind === 'null' ? null : this.#schema(input, builder, 'input'),
545
546
  output: this.#output(options.get('output'), builder),
546
547
  access: access(options.get('access'), builder),
548
+ ...crossOriginOption(options.get('crossOrigin')),
547
549
  ...(kit === 'endpoints'
548
550
  ? { declared: declared(options), unknownOptions: kitOptionKeys(options, 'procedure') }
549
551
  : { unknownOptions: optionKeys(options, 'procedure') }),
@@ -854,6 +856,13 @@ function directoryOf(value: LiteralValue, owner: Owner): 'labels' {
854
856
  return directory
855
857
  }
856
858
 
859
+ /** `crossOrigin` as written, `true` or a string; the build decides which a builder admits. Absent stays absent. */
860
+ function crossOriginOption(value: LiteralValue | undefined): { readonly crossOrigin?: boolean | string } {
861
+ if (value === undefined) return {}
862
+ if (value.kind === 'boolean' || value.kind === 'string') return { crossOrigin: value.value }
863
+ throw new Refused(value.at, `crossOrigin is a ${describeKind(value)}`, "crossOrigin: true, or crossOrigin: '*' on a form")
864
+ }
865
+
857
866
  function optionalText(value: LiteralValue | undefined, field: string): string | undefined {
858
867
  return value === undefined ? undefined : text(value, value, field)
859
868
  }