velocious 1.0.450 → 1.0.451
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/README.md +1 -1
- package/build/configuration-types.js +3 -1
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +785 -47
- package/build/frontend-models/base.js +1 -1
- package/build/src/configuration-types.d.ts +12 -2
- package/build/src/configuration-types.d.ts.map +1 -1
- package/build/src/configuration-types.js +4 -2
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +271 -13
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +666 -49
- package/build/src/frontend-models/base.d.ts +1 -1
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +2 -2
- package/package.json +1 -1
- package/src/configuration-types.js +3 -1
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +785 -47
- package/src/frontend-models/base.js +1 -1
package/README.md
CHANGED
|
@@ -392,7 +392,7 @@ Generate classes:
|
|
|
392
392
|
npx velocious g:frontend-models
|
|
393
393
|
```
|
|
394
394
|
|
|
395
|
-
|
|
395
|
+
Frontend-model attributes can usually be declared by name. The generator infers JSDoc typedefs and nullability from backend model columns and translated attribute columns. When an attribute entry needs resource-specific options such as `selectedByDefault: false`, keep only that option in the resource config, for example `{name: "archivedAt", selectedByDefault: false}`; the column type and nullability are still inferred. For computed resource attributes, add a typed `${attributeName}Attribute(model)` method with an `@returns` tag in the backend project's `src` tree. Resource attribute return types take precedence over column types because the resource method controls the serialized value. If Velocious cannot infer a read attribute from a column, generated model accessor, resource method JSDoc, or explicit metadata, generation fails with a clear error instead of emitting a broad fallback type.
|
|
396
396
|
|
|
397
397
|
This creates `src/frontend-models/user.js` (and one file per configured resource). Generated classes support:
|
|
398
398
|
|
|
@@ -263,6 +263,8 @@
|
|
|
263
263
|
* @property {string} [columnType] - Alias for column type name.
|
|
264
264
|
* @property {string} [sqlType] - Alias for column type name.
|
|
265
265
|
* @property {string} [dataType] - Alias for column type name.
|
|
266
|
+
* @property {string} [jsDocType] - Exact generated JSDoc type for non-column attributes.
|
|
267
|
+
* @property {string} [name] - Attribute name when configured as an array entry.
|
|
266
268
|
* @property {boolean} [null] - Whether value can be null.
|
|
267
269
|
* @property {boolean} [selectedByDefault] - Whether included in default serialization. Defaults to true.
|
|
268
270
|
*/
|
|
@@ -274,7 +276,7 @@
|
|
|
274
276
|
|
|
275
277
|
/**
|
|
276
278
|
* @typedef {object} FrontendModelResourceConfiguration
|
|
277
|
-
* @property {string
|
|
279
|
+
* @property {Array<string | FrontendModelAttributeConfiguration> | Record<string, FrontendModelAttributeConfiguration | import("./database/drivers/base-column.js").default | boolean>} attributes - Attributes to expose on the frontend model.
|
|
278
280
|
* @property {string[]} [abilities] - Ability action list (camelCase action names). Defaults to `["read"]` for `find` and `index` when omitted.
|
|
279
281
|
* @property {Record<string, FrontendModelAttachmentConfiguration>} [attachments] - Attachment helpers keyed by attachment name.
|
|
280
282
|
* @property {string[]} [commands] - Legacy built-in command names (`index`, `find`, `create`, `update`, `destroy`, `attach`, `download`, `url`).
|