@jxsuite/schema 0.28.2 → 0.28.4

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.
@@ -1,35 +1,35 @@
1
1
  export const expressionPointerSchema = {
2
+ additionalProperties: false,
2
3
  description: "A JSON Pointer $ref operand within an expression node.",
3
- type: "object",
4
4
  properties: {
5
5
  $ref: {
6
- type: "string",
7
6
  pattern: "^(\\$map/|\\$reduce/|event#/|#/|parent#/|window#/|document#/)",
7
+ type: "string",
8
8
  },
9
9
  },
10
10
  required: ["$ref"],
11
- additionalProperties: false,
11
+ type: "object",
12
12
  } as const;
13
13
 
14
14
  export const expressionLiteralSchema = {
15
- description: "A non-reactive operand: scalar or array of operands.",
16
15
  anyOf: [
17
- { type: "string", not: { pattern: "\\$\\{" } },
16
+ { not: { pattern: "\\$\\{" }, type: "string" },
18
17
  { type: "number" },
19
18
  { type: "boolean" },
20
19
  { type: "null" },
21
- { type: "array", items: { $ref: "#/$defs/ExpressionOperand" } },
20
+ { items: { $ref: "#/$defs/ExpressionOperand" }, type: "array" },
22
21
  ],
22
+ description: "A non-reactive operand: scalar or array of operands.",
23
23
  } as const;
24
24
 
25
25
  export const expressionOperandSchema = {
26
- description:
27
- "Anything that may appear in target or value: a pointer, a literal, or a nested expression node.",
28
26
  anyOf: [
29
27
  { $ref: "#/$defs/ExpressionPointer" },
30
28
  { $ref: "#/$defs/ExpressionNode" },
31
29
  { $ref: "#/$defs/ExpressionLiteral" },
32
30
  ],
31
+ description:
32
+ "Anything that may appear in target or value: a pointer, a literal, or a nested expression node.",
33
33
  } as const;
34
34
 
35
35
  export const unaryOperatorSchema = { enum: ["!", "-"] } as const;
@@ -44,97 +44,97 @@ export const reduceMethodSchema = { const: "reduce" } as const;
44
44
  export const mapFilterMethodSchema = { enum: ["map", "filter"] } as const;
45
45
 
46
46
  export const expressionNodeSchema = {
47
- description: "The core expression node. operator + target, with value gated by arity.",
48
- type: "object",
49
- required: ["operator", "target"],
50
47
  additionalProperties: false,
51
- properties: {
52
- operator: { type: "string" },
53
- target: { $ref: "#/$defs/ExpressionOperand" },
54
- value: { $ref: "#/$defs/ExpressionOperand" },
55
- initial: { $ref: "#/$defs/ExpressionOperand" },
56
- },
48
+ description: "The core expression node. operator + target, with value gated by arity.",
57
49
  oneOf: [
58
50
  {
59
- title: "Unary — target only, no value",
51
+ not: { anyOf: [{ required: ["value"] }, { required: ["initial"] }] },
60
52
  properties: { operator: { $ref: "#/$defs/UnaryOperator" } },
61
53
  required: ["operator"],
62
- not: { anyOf: [{ required: ["value"] }, { required: ["initial"] }] },
54
+ title: "Unary — target only, no value",
63
55
  },
64
56
  {
65
- title: "Binary — left in target, right in value",
57
+ not: { required: ["initial"] },
66
58
  properties: { operator: { $ref: "#/$defs/BinaryOperator" } },
67
59
  required: ["operator", "value"],
68
- not: { required: ["initial"] },
60
+ title: "Binary — left in target, right in value",
69
61
  },
70
62
  {
71
- title: "Assignment — writable target, value required",
63
+ not: { required: ["initial"] },
72
64
  properties: {
73
65
  operator: { $ref: "#/$defs/AssignmentOperator" },
74
66
  target: { $ref: "#/$defs/ExpressionPointer" },
75
67
  },
76
68
  required: ["operator", "value"],
77
- not: { required: ["initial"] },
69
+ title: "Assignment — writable target, value required",
78
70
  },
79
71
  {
80
- title: "pop / shift — array receiver, no value",
72
+ not: { anyOf: [{ required: ["value"] }, { required: ["initial"] }] },
81
73
  properties: {
82
74
  operator: { $ref: "#/$defs/NoArgMethod" },
83
75
  target: { $ref: "#/$defs/ExpressionPointer" },
84
76
  },
85
77
  required: ["operator"],
86
- not: { anyOf: [{ required: ["value"] }, { required: ["initial"] }] },
78
+ title: "pop / shift — array receiver, no value",
87
79
  },
88
80
  {
89
- title: "push / unshift — array receiver, single value argument",
81
+ not: { required: ["initial"] },
90
82
  properties: {
91
83
  operator: { $ref: "#/$defs/OneArgMethod" },
92
84
  target: { $ref: "#/$defs/ExpressionPointer" },
93
85
  },
94
86
  required: ["operator", "value"],
95
- not: { required: ["initial"] },
87
+ title: "push / unshift — array receiver, single value argument",
96
88
  },
97
89
  {
98
- title: "splice — array receiver, [start, deleteCount, ...items]",
90
+ not: { required: ["initial"] },
99
91
  properties: {
100
92
  operator: { $ref: "#/$defs/SpliceMethod" },
101
93
  target: { $ref: "#/$defs/ExpressionPointer" },
102
- value: { type: "array", items: { $ref: "#/$defs/ExpressionOperand" }, minItems: 1 },
94
+ value: { items: { $ref: "#/$defs/ExpressionOperand" }, minItems: 1, type: "array" },
103
95
  },
104
96
  required: ["operator", "value"],
105
- not: { required: ["initial"] },
97
+ title: "splice — array receiver, [start, deleteCount, ...items]",
106
98
  },
107
99
  {
108
- title: "reduce — pure fold; per-item expression in value, seed in initial",
109
100
  properties: {
110
101
  operator: { $ref: "#/$defs/ReduceMethod" },
111
102
  target: { $ref: "#/$defs/ExpressionPointer" },
112
103
  value: { $ref: "#/$defs/ExpressionNode" },
113
104
  },
114
105
  required: ["operator", "value", "initial"],
106
+ title: "reduce — pure fold; per-item expression in value, seed in initial",
115
107
  },
116
108
  {
117
- title: "map / filter — pure; per-item expression in value, no initial",
109
+ not: { required: ["initial"] },
118
110
  properties: {
119
111
  operator: { $ref: "#/$defs/MapFilterMethod" },
120
112
  target: { $ref: "#/$defs/ExpressionPointer" },
121
113
  value: { $ref: "#/$defs/ExpressionNode" },
122
114
  },
123
115
  required: ["operator", "value"],
124
- not: { required: ["initial"] },
116
+ title: "map / filter — pure; per-item expression in value, no initial",
125
117
  },
126
118
  ],
119
+ properties: {
120
+ initial: { $ref: "#/$defs/ExpressionOperand" },
121
+ operator: { type: "string" },
122
+ target: { $ref: "#/$defs/ExpressionOperand" },
123
+ value: { $ref: "#/$defs/ExpressionOperand" },
124
+ },
125
+ required: ["operator", "target"],
126
+ type: "object",
127
127
  } as const;
128
128
 
129
129
  export const expressionEntrySchema = {
130
+ additionalProperties: false,
130
131
  description:
131
132
  "A declarative expression entry (Shape 5). Used as a state entry or inline event handler.",
132
- type: "object",
133
- required: ["$expression"],
134
133
  properties: {
134
+ $description: { type: "string" },
135
135
  $expression: { $ref: "#/$defs/ExpressionNode" },
136
136
  $title: { type: "string" },
137
- $description: { type: "string" },
138
137
  },
139
- additionalProperties: false,
138
+ required: ["$expression"],
139
+ type: "object",
140
140
  } as const;
@@ -19,13 +19,13 @@ export const externalClassDefSchema = {
19
19
  'An external class / data source. $prototype is a constructor name (not "Function"). ' +
20
20
  "When $prototype is not in the built-in registry, $src is required. " +
21
21
  "All state entries are reactive by default.",
22
- type: "object",
23
- required: ["$prototype"],
24
22
  properties: {
23
+ $export: {
24
+ description: "Named export in $src module. Defaults to the $prototype value.",
25
+ type: "string",
26
+ },
25
27
  $prototype: {
26
28
  description: "Constructor name — built-in Web API class or external class name.",
27
- type: "string",
28
- not: { const: "Function" },
29
29
  examples: [
30
30
  "Request",
31
31
  "URLSearchParams",
@@ -42,66 +42,66 @@ export const externalClassDefSchema = {
42
42
  "MarkdownCollection",
43
43
  "MyParser",
44
44
  ],
45
+ not: { const: "Function" },
46
+ type: "string",
45
47
  },
46
48
  $src: {
47
49
  description: "External module specifier. Required when $prototype is not a built-in.",
48
- type: "string",
49
50
  examples: ["@jxsuite/md", "./lib/my-parser.js", "npm:@myorg/data"],
50
- },
51
- $export: {
52
- description: "Named export in $src module. Defaults to the $prototype value.",
53
51
  type: "string",
54
52
  },
55
- timing: { type: "string", enum: ["compiler", "server", "client"] },
56
- manual: { type: "boolean" },
57
- debounce: { type: "integer", minimum: 0 },
58
- url: { $ref: "#/$defs/StringOrRef" },
59
- method: {
60
- type: "string",
61
- enum: ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"],
62
- },
63
- headers: { type: "object", additionalProperties: { type: "string" } },
53
+ autoIncrement: { type: "boolean" },
64
54
  body: {},
65
- responseType: {
66
- type: "string",
67
- enum: ["json", "text", "blob", "arraybuffer", "document", ""],
68
- },
69
- key: { type: "string" },
70
- name: { type: "string" },
71
- maxAge: { type: "integer" },
72
- expires: { type: "string" },
73
- path: { type: "string" },
74
- domain: { type: "string" },
75
- secure: { type: "boolean" },
76
- sameSite: { type: "string", enum: ["strict", "lax", "none"] },
77
55
  database: { type: "string" },
78
- store: { type: "string" },
79
- version: { type: "integer", minimum: 1 },
80
- keyPath: { type: "string" },
81
- autoIncrement: { type: "boolean" },
56
+ debounce: { minimum: 0, type: "integer" },
57
+ default: {},
58
+ description: { type: "string" },
59
+ domain: { type: "string" },
60
+ expires: { type: "string" },
61
+ filter: { $ref: "#/$defs/RefObject" },
62
+ headers: { additionalProperties: { type: "string" }, type: "object" },
82
63
  indexes: {
83
- type: "array",
84
64
  items: {
85
- type: "object",
86
- required: ["name", "keyPath"],
87
65
  properties: {
88
- name: { type: "string" },
89
66
  keyPath: {
90
- oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
67
+ oneOf: [{ type: "string" }, { items: { type: "string" }, type: "array" }],
91
68
  },
69
+ name: { type: "string" },
92
70
  unique: { type: "boolean" },
93
71
  },
72
+ required: ["name", "keyPath"],
73
+ type: "object",
94
74
  },
75
+ type: "array",
95
76
  },
96
- default: {},
97
- description: { type: "string" },
98
77
  items: {},
78
+ key: { type: "string" },
79
+ keyPath: { type: "string" },
80
+ manual: { type: "boolean" },
99
81
  map: { $ref: "#/$defs/ElementDef" },
100
- filter: { $ref: "#/$defs/RefObject" },
82
+ maxAge: { type: "integer" },
83
+ method: {
84
+ enum: ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"],
85
+ type: "string",
86
+ },
87
+ name: { type: "string" },
88
+ path: { type: "string" },
89
+ responseType: {
90
+ enum: ["json", "text", "blob", "arraybuffer", "document", ""],
91
+ type: "string",
92
+ },
93
+ sameSite: { enum: ["strict", "lax", "none"], type: "string" },
94
+ secure: { type: "boolean" },
101
95
  sort: { $ref: "#/$defs/RefObject" },
102
96
  src: {
103
97
  description: "Configuration property passed to external class constructor.",
104
98
  type: "string",
105
99
  },
100
+ store: { type: "string" },
101
+ timing: { enum: ["compiler", "server", "client"], type: "string" },
102
+ url: { $ref: "#/$defs/StringOrRef" },
103
+ version: { minimum: 1, type: "integer" },
106
104
  },
105
+ required: ["$prototype"],
106
+ type: "object",
107
107
  } as const;
@@ -1,59 +1,59 @@
1
1
  export const functionDefSchema = {
2
+ additionalProperties: false,
2
3
  description:
3
4
  'A function declaration. $prototype must be "Function". ' +
4
5
  "body (inline) and $src (external) are mutually exclusive. " +
5
6
  "First parameter is always state (the reactive scope).",
6
- type: "object",
7
- required: ["$prototype"],
8
7
  properties: {
9
- $prototype: { type: "string", const: "Function" },
8
+ $export: {
9
+ description: "Named export in $src module. Defaults to the state key name.",
10
+ type: "string",
11
+ },
12
+ $prototype: { const: "Function", type: "string" },
13
+ $src: {
14
+ description: "External module specifier. Mutually exclusive with body.",
15
+ examples: ["./counter.js", "npm:@myorg/validators"],
16
+ type: "string",
17
+ },
10
18
  body: {
11
19
  description: "Inline function body string. First implicit parameter is state.",
12
- type: "string",
13
20
  examples: [
14
21
  "state.count++",
15
22
  'state.items.push({ id: Date.now(), text: "", done: false })',
16
23
  'return state.score >= 90 ? "gold" : "silver"',
17
24
  ],
25
+ type: "string",
26
+ },
27
+ description: { type: "string" },
28
+ emits: {
29
+ description:
30
+ "Array of CEM-compatible Event objects this function dispatches. " +
31
+ "Used for CEM extraction and studio event discovery.",
32
+ items: { $ref: "#/$defs/CemEvent" },
33
+ type: "array",
34
+ },
35
+ name: {
36
+ description: "Explicit function name. Defaults to the state key name.",
37
+ type: "string",
18
38
  },
19
39
  parameters: {
20
40
  description:
21
41
  "Function parameters (after the implicit state parameter). " +
22
42
  "Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",
23
- type: "array",
24
- items: {
25
- oneOf: [{ type: "string" }, { $ref: "#/$defs/CemParameter" }],
26
- },
27
43
  examples: [
28
44
  ["event"],
29
45
  [{ name: "event", type: { text: "Event" } }],
30
- [{ name: "id", type: { text: "number" }, description: "Item identifier" }],
46
+ [{ description: "Item identifier", name: "id", type: { text: "number" } }],
31
47
  ],
32
- },
33
- name: {
34
- description: "Explicit function name. Defaults to the state key name.",
35
- type: "string",
36
- },
37
- $src: {
38
- description: "External module specifier. Mutually exclusive with body.",
39
- type: "string",
40
- examples: ["./counter.js", "npm:@myorg/validators"],
41
- },
42
- $export: {
43
- description: "Named export in $src module. Defaults to the state key name.",
44
- type: "string",
48
+ items: {
49
+ oneOf: [{ type: "string" }, { $ref: "#/$defs/CemParameter" }],
50
+ },
51
+ type: "array",
45
52
  },
46
53
  type: {
47
54
  description: "Return type for tooling (JSON Schema or CEM { text } format).",
48
55
  },
49
- emits: {
50
- description:
51
- "Array of CEM-compatible Event objects this function dispatches. " +
52
- "Used for CEM extraction and studio event discovery.",
53
- type: "array",
54
- items: { $ref: "#/$defs/CemEvent" },
55
- },
56
- description: { type: "string" },
57
56
  },
58
- additionalProperties: false,
57
+ required: ["$prototype"],
58
+ type: "object",
59
59
  } as const;
@@ -1,17 +1,17 @@
1
1
  export const headEntrySchema = {
2
+ additionalProperties: true,
2
3
  description: "A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",
3
- type: "object",
4
- required: ["tagName"],
5
4
  properties: {
6
- tagName: { type: "string" },
7
5
  attributes: {
8
- type: "object",
9
6
  additionalProperties: {
10
7
  oneOf: [{ type: "string" }, { type: "boolean" }],
11
8
  },
9
+ type: "object",
12
10
  },
11
+ children: { items: { $ref: "#/$defs/HeadEntry" }, type: "array" },
12
+ tagName: { type: "string" },
13
13
  textContent: { type: "string" },
14
- children: { type: "array", items: { $ref: "#/$defs/HeadEntry" } },
15
14
  },
16
- additionalProperties: true,
15
+ required: ["tagName"],
16
+ type: "object",
17
17
  } as const;
@@ -1,36 +1,36 @@
1
1
  export const imageConfigSchema = {
2
2
  description: "Image optimization configuration for the project.",
3
- type: "object",
4
3
  properties: {
4
+ formats: { items: { type: "string" }, type: "array" },
5
+ lazyLoad: { type: "boolean" },
5
6
  optimize: { type: "boolean" },
6
- widths: { type: "array", items: { type: "number" } },
7
- formats: { type: "array", items: { type: "string" } },
8
7
  quality: {
9
- type: "object",
10
8
  properties: {
11
- webp: { type: "number" },
12
9
  avif: { type: "number" },
13
10
  jpeg: { type: "number" },
14
11
  png: { type: "number" },
12
+ webp: { type: "number" },
15
13
  },
16
- },
17
- sizes: { type: "string" },
18
- lazyLoad: { type: "boolean" },
19
- service: {
20
- description:
21
- 'How images are optimized: "build" runs Sharp at build time; "cloudflare" emits ' +
22
- "/cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires " +
23
- "the feature to be enabled on the serving zone).",
24
- type: "string",
25
- enum: ["build", "cloudflare"],
14
+ type: "object",
26
15
  },
27
16
  remoteDomains: {
28
17
  description:
29
18
  "Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform " +
30
19
  'URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources ' +
31
20
  "from other hosts are left untouched.",
32
- type: "array",
33
21
  items: { type: "string" },
22
+ type: "array",
23
+ },
24
+ service: {
25
+ description:
26
+ 'How images are optimized: "build" runs Sharp at build time; "cloudflare" emits ' +
27
+ "/cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires " +
28
+ "the feature to be enabled on the serving zone).",
29
+ enum: ["build", "cloudflare"],
30
+ type: "string",
34
31
  },
32
+ sizes: { type: "string" },
33
+ widths: { items: { type: "number" }, type: "array" },
35
34
  },
35
+ type: "object",
36
36
  } as const;
@@ -1,4 +1,4 @@
1
1
  export const jsonSchemaTypeSchema = {
2
- type: "string",
3
2
  enum: ["string", "number", "integer", "boolean", "array", "object", "null"],
3
+ type: "string",
4
4
  } as const;