@invisibleloop/pulse 0.21.0 → 0.21.2

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": "@invisibleloop/pulse",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "type": "module",
5
5
  "description": "AI-first frontend framework. The spec is the source of truth.",
6
6
  "license": "MIT",
@@ -1 +1 @@
1
- 0.21.0
1
+ 0.21.2
@@ -124,17 +124,18 @@
124
124
 
125
125
  /**
126
126
  * Validate a spec object against the schema.
127
- * Returns { valid: true } or { valid: false, errors: string[] }
127
+ * Returns { valid, errors, warnings } — `warnings` is always an array, including on the early
128
+ * returns (non-object spec, raw-response spec), because callers spread it.
128
129
  *
129
130
  * @param {unknown} spec
130
- * @returns {{ valid: boolean, errors: string[] }}
131
+ * @returns {{ valid: boolean, errors: string[], warnings: string[] }}
131
132
  */
132
133
  export function validateSpec(spec) {
133
134
  const errors = []
134
135
  const warnings = []
135
136
 
136
137
  if (!spec || typeof spec !== 'object') {
137
- return { valid: false, errors: ['Spec must be a plain object'] }
138
+ return { valid: false, errors: ['Spec must be a plain object'], warnings }
138
139
  }
139
140
 
140
141
  // route — '*' is the custom not-found page, rendered with status 404 when no route matches
@@ -191,7 +192,7 @@ export function validateSpec(spec) {
191
192
  errors.push('spec.render is required when spec.contentType is set — (ctx, server) => string')
192
193
  }
193
194
  // Raw specs don't need state or view — skip those checks
194
- return { valid: errors.length === 0, errors }
195
+ return { valid: errors.length === 0, errors, warnings }
195
196
  }
196
197
 
197
198
  // state