@harperfast/template-vue-studio 1.5.22 → 1.5.23

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.
@@ -245,11 +245,12 @@ How to use filters, operators, sorting, and pagination in REST requests.
245
245
 
246
246
  #### Query Parameters
247
247
 
248
- - `limit`: Number of records to return.
249
- - `offset`: Number of records to skip.
250
- - `sort`: Field to sort by.
251
- - `order`: `asc` or `desc`.
252
- - `filter`: JSON object for filtering.
248
+ - `limit(count)` or `limit(offset, count)`: Number of records to return and optional skip. Example: `?limit(10)`, `?limit(10, 20)`.
249
+ - `sort(+field1, -field2)`: Fields to sort by. Use `+` for ascending and `-` for descending. Example: `?sort(+name)`, `?sort(-price, +name)`.
250
+ - `select(field1, field2)`: Specific fields to return. Example: `?select(id, name)`.
251
+ - `filter`: Advanced filtering using comparison operators and logic.
252
+ - Operators: `gt`, `ge`, `lt`, `le`, `ne`. Example: `?price=gt=100`.
253
+ - Logic: `&` (AND), `|` (OR), `()` (grouping). Example: `?(category=electronics|category=books)&price=lt=500`.
253
254
 
254
255
  ### 2.3 Real-time Applications
255
256
 
@@ -292,8 +293,13 @@ How to define custom REST endpoints using JavaScript or TypeScript.
292
293
  #### How It Works
293
294
 
294
295
  1. **Create Resource File**: Define your logic in a JS or TS file.
295
- 2. **Export Handlers**: Export functions like `GET`, `POST`, etc.
296
- 3. **Registration**: Ensure the resource is correctly registered in your application configuration.
296
+ 2. **Define Resource Class**: Export a class extending `Resource` from `harperdb`.
297
+ 3. **Implement HTTP Methods**: Add methods like `get`, `post`, `put`, `patch`, or `delete` to handle corresponding requests.
298
+ 4. **Route Nesting and Naming**: You can control the URL structure by how you export your resources:
299
+ - **Direct Class Export**: `export class Foo extends Resource` creates endpoints at `/Foo/`. Class names are case-sensitive in the URL.
300
+ - **Nested Objects**: `export const Bar = { Foo };` creates endpoints at `/Bar/Foo/`.
301
+ - **Lowercase and Hyphens**: Use object keys to define custom paths: `export const bar = { 'foo-baz': Foo };` exposes endpoints at `/bar/foo-baz/`.
302
+ 5. **Registration**: Ensure the resource is correctly registered in your application configuration.
297
303
 
298
304
  ### 3.2 Extending Table Resources
299
305
 
@@ -27,11 +27,15 @@ Use this skill when the automatic CRUD operations provided by `@table @export` a
27
27
  }
28
28
  ```
29
29
 
30
- 4. **Implement HTTP Methods**: Add methods like `get`, `post`, `put`, `patch`, or `delete` to handle corresponding requests. Note that paths are **case-sensitive** and match the class name.
31
- 5. **Access Tables (Optional)**: Import and use the `tables` object to interact with your data:
30
+ 4. **Implement HTTP Methods**: Add methods like `get`, `post`, `put`, `patch`, or `delete` to handle corresponding requests.
31
+ 5. **Route Nesting and Naming**: You can control the URL structure by how you export your resources:
32
+ - **Direct Class Export**: `export class Foo extends Resource` creates endpoints at `/Foo/`. Class names are case-sensitive in the URL.
33
+ - **Nested Objects**: `export const Bar = { Foo };` creates endpoints at `/Bar/Foo/`.
34
+ - **Lowercase and Hyphens**: Use object keys to define custom paths: `export const bar = { 'foo-baz': Foo };` exposes endpoints at `/bar/foo-baz/`.
35
+ 6. **Access Tables (Optional)**: Import and use the `tables` object to interact with your data:
32
36
  ```typescript
33
37
  import { tables } from 'harperdb';
34
38
  // ... inside a method
35
39
  const results = await tables.MyTable.list();
36
40
  ```
37
- 6. **Configure Loading**: Ensure `config.yaml` points to your resource files (e.g., `jsResource: { files: 'resources/*.ts' }`).
41
+ 7. **Configure Loading**: Ensure `config.yaml` points to your resource files (e.g., `jsResource: { files: 'resources/*.ts' }`).
@@ -17,6 +17,11 @@ Use this skill when you need to perform advanced data retrieval (filtering, sort
17
17
  2. **Use Comparison Operators**: Append operators like `gt`, `ge`, `lt`, `le`, `ne` using FIQL-style syntax: `GET /Table/?price=gt=100`.
18
18
  3. **Apply Logic and Grouping**: Use `&` for AND, `|` for OR, and `()` for grouping: `GET /Table/?(rating=5|featured=true)&price=lt=50`.
19
19
  4. **Select Specific Fields**: Use `select()` to limit returned attributes: `GET /Table/?select(name,price)`.
20
- 5. **Paginate Results**: Use `limit(count)` or `limit(offset, count)`: `GET /Table/?limit(20, 10)`.
21
- 6. **Sort Results**: Use `sort()` with `+` (asc) or `-` (desc): `GET /Table/?sort(-price,+name)`.
20
+ 5. **Paginate Results**: Use `limit(count)` or `limit(offset, count)` to set the number of records to return and skip.
21
+ - Example (first 10): `GET /Table/?limit(10)`
22
+ - Example (skip 20, return 10): `GET /Table/?limit(20, 10)`
23
+ 6. **Sort Results**: Use `sort()` with `+` (asc) or `-` (desc) before the field name. Avoid `sort=field` format.
24
+ - Example (asc): `GET /Table/?sort(+name)`
25
+ - Example (desc): `GET /Table/?sort(-price)`
26
+ - Example (combined): `GET /Table/?sort(-price,+name)`
22
27
  7. **Query Relationships**: Use dot syntax for tables linked with `@relationship`: `GET /Book/?author.name=Harper`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harperfast/template-vue-studio",
3
- "version": "1.5.22",
3
+ "version": "1.5.23",
4
4
  "type": "module",
5
5
  "repository": "github:HarperFast/create-harper",
6
6
  "scripts": {},
package/skills-lock.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "harper-best-practices": {
5
5
  "source": "harperfast/skills",
6
6
  "sourceType": "github",
7
- "computedHash": "20b7623e2a79067e2362cd6ffee756f7d039259ff33dd52f2b69ff8f8e3c06bb"
7
+ "computedHash": "dc6edafe30ac9800fb009d9ac48b73206e9ba9efc6b9a49268aeb1bb7e8c1b8c"
8
8
  }
9
9
  }
10
10
  }