@stacksjs/defaults 0.74.43 → 0.74.45

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.
@@ -66,7 +66,7 @@ globalThis.toggleDark = toggleDark
66
66
  - **Custom Functions**: From `resources/functions/` (counter, dark mode, GPX, geo utilities)
67
67
 
68
68
  ### Server Auto-Imports (100+)
69
- - **All ORM Models**: User, Post, Author, Product, Order, Payment, Customer, etc. (102 models)
69
+ - **All ORM Models**: User, Post, Author, Product, Order, Payment, Customer, etc. (103 models)
70
70
  - **Request Models**: UserRequest, PostRequest, OrderRequest, etc.
71
71
  - **Actions**: Action types and helpers
72
72
  - **Schema**: validation schema builder
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-models
3
- description: Use when working with data models in Stacks - the defineModel() API, model attributes with validation and factories, relationships (hasOne/hasMany/belongsTo/belongsToMany), traits (useAuth, useUuid, useTimestamps, useSearch, useApi, billable, taggable, categorizable, commentable, likeable, observe), computed properties (get/set), model generation, and the 102 built-in framework models. Covers model definitions and storage/framework/defaults/app/Models/.
3
+ description: Use when working with data models in Stacks - the defineModel() API, model attributes with validation and factories, relationships (hasOne/hasMany/belongsTo/belongsToMany), traits (useAuth, useUuid, useTimestamps, useSearch, useApi, billable, taggable, categorizable, commentable, likeable, observe), computed properties (get/set), model generation, and the 103 built-in framework models. Covers model definitions and storage/framework/defaults/app/Models/.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript, SQLite >= 3.47.2
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -265,7 +265,7 @@ pass `--allow-protected` to override.
265
265
  ## Built-in models by category
266
266
 
267
267
  The ones below are worth knowing by name. They are a selection, not the set:
268
- `storage/framework/defaults/app/Models/` holds 102, and that directory is the
268
+ `storage/framework/defaults/app/Models/` holds 103, and that directory is the
269
269
  authority. This section said "All 62 built-in models by category" while
270
270
  listing fewer than that against 102 on disk, so an agent reading to the end
271
271
  had no way to tell it was short.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacks-orm
3
- description: Use when working with the Stacks ORM - defining models with defineModel(), model relationships (hasOne, hasMany, belongsTo, belongsToMany, morphOne, hasManyThrough), attributes, traits, factories, computed properties, query building, transactions, or the 102 built-in models. Covers @stacksjs/orm, storage/framework/orm/, and storage/framework/defaults/app/Models/.
3
+ description: Use when working with the Stacks ORM - defining models with defineModel(), model relationships (hasOne, hasMany, belongsTo, belongsToMany, morphOne, hasManyThrough), attributes, traits, factories, computed properties, query building, transactions, or the 103 built-in models. Covers @stacksjs/orm, storage/framework/orm/, and storage/framework/defaults/app/Models/.
4
4
  license: MIT
5
5
  compatibility: Bun >= 1.3.0, TypeScript, SQLite >= 3.47.2
6
6
  allowed-tools: Read Edit Write Bash Grep Glob
@@ -11,7 +11,7 @@ allowed-tools: Read Edit Write Bash Grep Glob
11
11
  ## Key Paths
12
12
  - Core ORM package: `storage/framework/core/orm/src/`
13
13
  - ORM implementation: `storage/framework/orm/`
14
- - Model definitions: `storage/framework/defaults/app/Models/` (102 models)
14
+ - Model definitions: `storage/framework/defaults/app/Models/` (103 models)
15
15
  - Application models: `app/Models/`
16
16
  - Default model templates: `storage/framework/defaults/app/Models/`
17
17
  - ORM type globals: `storage/framework/types/orm-globals.d.ts`
@@ -0,0 +1,55 @@
1
+ import { defineModel } from '@stacksjs/orm'
2
+ import { schema } from '@stacksjs/validation'
3
+
4
+ // The CMS catalogue already exists in categorizables. Commerce's Category
5
+ // model owns a different table and its IDs cannot be used by this pivot.
6
+ export default defineModel({
7
+ name: 'Categorizable',
8
+ table: 'categorizables',
9
+ primaryKey: 'id',
10
+ autoIncrement: true,
11
+ ownership: false,
12
+ traits: { useTimestamps: true },
13
+ indexes: [
14
+ { name: 'categorizables_type_slug_unique', columns: ['categorizable_type', 'slug'], unique: true },
15
+ { name: 'categorizables_owner_slug_unique', columns: ['categorizable_type', 'categorizable_id', 'slug'], unique: true },
16
+ ],
17
+ attributes: {
18
+ name: {
19
+ required: true,
20
+ fillable: true,
21
+ validation: { rule: schema.string() },
22
+ },
23
+ slug: {
24
+ required: true,
25
+ fillable: true,
26
+ validation: { rule: schema.string() },
27
+ },
28
+ description: {
29
+ required: false,
30
+ nullable: true,
31
+ fillable: true,
32
+ validation: { rule: schema.string() },
33
+ },
34
+ isActive: {
35
+ required: true,
36
+ fillable: true,
37
+ default: true,
38
+ validation: { rule: schema.boolean() },
39
+ },
40
+ categorizableId: {
41
+ // Runtime trait-table setup adds this column to older catalogues.
42
+ // Zero denotes a catalogue entry with no individual owner.
43
+ type: 'integer',
44
+ required: true,
45
+ fillable: true,
46
+ default: 0,
47
+ validation: { rule: schema.number().integer().min(0) },
48
+ },
49
+ categorizableType: {
50
+ required: true,
51
+ fillable: true,
52
+ validation: { rule: schema.string() },
53
+ },
54
+ },
55
+ } as const)
@@ -44,7 +44,7 @@ export default defineModel({
44
44
  belongsTo: ['Author', 'Site'],
45
45
  belongsToMany: {
46
46
  categories: {
47
- model: 'Category',
47
+ model: 'Categorizable',
48
48
  table: 'categorizable_models',
49
49
  foreignKey: 'categorizable_id',
50
50
  relatedKey: 'category_id',
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.74.43",
5
+ "version": "0.74.45",
6
6
  "description": "A modern Stacks development environment.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.74.43",
5
+ "version": "0.74.45",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -55,7 +55,7 @@
55
55
  "dependencies": {
56
56
  "@iconify-json/f7": "^1.2.2",
57
57
  "@iconify-json/hugeicons": "^1.2.27",
58
- "@stacksjs/mobile": "^0.74.43",
58
+ "@stacksjs/mobile": "^0.74.45",
59
59
  "@stacksjs/sanitizer": "^0.2.113",
60
60
  "ts-qr-codes": "^0.1.8"
61
61
  }