@harperfast/template-react-studio 1.6.2 → 1.6.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.
Files changed (25) hide show
  1. package/.agents/skills/harper-best-practices/AGENTS.md +1428 -303
  2. package/.agents/skills/harper-best-practices/SKILL.md +24 -20
  3. package/.agents/skills/harper-best-practices/rules/adding-tables-with-schemas.md +4 -2
  4. package/.agents/skills/harper-best-practices/rules/automatic-apis.md +144 -16
  5. package/.agents/skills/harper-best-practices/rules/caching.md +134 -21
  6. package/.agents/skills/harper-best-practices/rules/checking-authentication.md +139 -148
  7. package/.agents/skills/harper-best-practices/rules/creating-a-fabric-account-and-cluster.md +2 -0
  8. package/.agents/skills/harper-best-practices/rules/creating-harper-apps.md +2 -0
  9. package/.agents/skills/harper-best-practices/rules/custom-resources.md +5 -3
  10. package/.agents/skills/harper-best-practices/rules/defining-relationships.md +2 -0
  11. package/.agents/skills/harper-best-practices/rules/deploying-to-harper-fabric.md +97 -77
  12. package/.agents/skills/harper-best-practices/rules/extending-tables.md +3 -1
  13. package/.agents/skills/harper-best-practices/rules/handling-binary-data.md +2 -0
  14. package/.agents/skills/harper-best-practices/rules/logging.md +154 -77
  15. package/.agents/skills/harper-best-practices/rules/programmatic-table-requests.md +91 -0
  16. package/.agents/skills/harper-best-practices/rules/querying-rest-apis.md +190 -15
  17. package/.agents/skills/harper-best-practices/rules/real-time-apps.md +80 -21
  18. package/.agents/skills/harper-best-practices/rules/schema-design-tooling.md +4 -2
  19. package/.agents/skills/harper-best-practices/rules/serving-web-content.md +3 -2
  20. package/.agents/skills/harper-best-practices/rules/typescript-type-stripping.md +3 -1
  21. package/.agents/skills/harper-best-practices/rules/using-blob-datatype.md +3 -1
  22. package/.agents/skills/harper-best-practices/rules/vector-indexing.md +85 -120
  23. package/.agents/skills/harper-best-practices/rules.manifest.yaml +258 -0
  24. package/package.json +1 -1
  25. package/skills-lock.json +1 -1
@@ -1,92 +1,169 @@
1
1
  ---
2
2
  name: logging
3
- description: Best practices for logging in Harper, including console capture, the granular logger interface, and programmatic log retrieval.
3
+ description: >-
4
+ Best practices for logging in Harper, including console capture, the granular
5
+ logger interface, and programmatic log retrieval.
6
+ metadata:
7
+ mode: generate
8
+ sources:
9
+ - reference/v5/logging/overview.md
10
+ - reference/v5/logging/api.md
11
+ sourceCommit: b7fbddadd42eb4487190b650a9abc4bcfeef5819
12
+ inputHash: 46cd384598304e3b
4
13
  ---
5
14
 
6
- # Logging Best Practices
15
+ # Harper Logging
7
16
 
8
- Harper provides a robust logging system that captures standard output and offers a granular, tagged logging interface for both local and deployed environments.
17
+ Instructions for the agent to follow when implementing logging in Harper applications, including direct logger usage, tagged loggers, and console capture behavior.
9
18
 
10
- ## Standard Console Logging
19
+ ## When to Use
11
20
 
12
- The simplest way to log in Harper is using standard JavaScript console methods. `console.log()`, `console.warn()`, `console.error()`, and `console.trace()` are automatically captured by Harper and can be viewed in the logs.
13
-
14
- - `console.log(...)`: Captured as `stdout` level in Harper logs.
15
- - `console.warn(...)`: Captured as `stderr` level in Harper logs.
16
- - `console.error(...)`: Captured as `stderr` level in Harper logs.
17
- - `console.trace(...)`: Captured as `stdout` level in Harper logs (includes stack trace).
18
-
19
- ## Harper Logger
20
-
21
- For more granularity and better organization, use Harper's built-in `logger`. You can use the global `logger` object or import it from the `harper` package.
22
-
23
- ### Log Levels
24
-
25
- The Harper `logger` supports the following levels (ordered by increasing severity):
26
-
27
- - `trace`
28
- - `debug`
29
- - `info`
30
- - `warn`
31
- - `error`
32
- - `fatal`
33
- - `notify`
34
-
35
- ### Usage
36
-
37
- ```typescript
38
- import { logger, loggerWithTag } from 'harper';
39
-
40
- // Basic logging
41
- logger.info('Application started');
42
- logger.error('An error occurred', error);
43
-
44
- // Tagged logging for better filtering (Namespacing)
45
- const authLogger = loggerWithTag('auth');
46
- authLogger.debug('User login attempt', { userId: '123' });
21
+ Apply this rule when writing any JavaScript component, plugin, or resource that needs to emit structured log entries, filter logs by component, or capture existing `console.log` output into Harper's log system. Use it whenever you need to understand log levels, log entry format, or the `logger` global API.
22
+
23
+ ## How It Works
24
+
25
+ 1. **Use the `logger` global directly** `logger` is available in all JavaScript components without any imports. Call the method matching the desired severity level:
26
+
27
+ ```javascript
28
+ logger.trace('detailed trace message');
29
+ logger.debug('debug info', { someContext: 'value' });
30
+ logger.info('informational message');
31
+ logger.warn('potential issue');
32
+ logger.error('error occurred', error);
33
+ logger.fatal('fatal error');
34
+ logger.notify('server is ready');
35
+ ```
36
+
37
+ Only entries at or above the configured `logging.level` (or `logging.external.level`) are written to `hdb.log`.
38
+
39
+ 2. **Create a tagged logger with `withTag(`** — Call `logger.withTag(tag)` once per module or class to get a `TaggedLogger` scoped to that tag. This prefixes every log entry with the tag, making log output filterable by component.
40
+
41
+ ```javascript
42
+ const log = logger.withTag('my-resource');
43
+ ```
44
+
45
+ Because `TaggedLogger` methods for disabled levels are `null`, always use optional chaining (`?.`) when calling them:
46
+
47
+ ```javascript
48
+ log.debug?.('Fetching record', { id });
49
+ log.warn?.('Record not found', { id });
50
+ log.error?.('Failed to update record', err);
51
+ ```
52
+
53
+ `TaggedLogger` does not have a `withTag()` method.
54
+
55
+ 3. **Understand the interface contracts** `MainLogger` always has all methods defined:
56
+
57
+ ```typescript
58
+ interface MainLogger {
59
+ trace(...messages: any[]): void;
60
+ debug(...messages: any[]): void;
61
+ info(...messages: any[]): void;
62
+ warn(...messages: any[]): void;
63
+ error(...messages: any[]): void;
64
+ fatal(...messages: any[]): void;
65
+ notify(...messages: any[]): void;
66
+ withTag(tag: string): TaggedLogger;
67
+ }
68
+ ```
69
+
70
+ `TaggedLogger` methods may be `null`:
71
+
72
+ ```typescript
73
+ interface TaggedLogger {
74
+ trace: ((...messages: any[]) => void) | null;
75
+ debug: ((...messages: any[]) => void) | null;
76
+ info: ((...messages: any[]) => void) | null;
77
+ warn: ((...messages: any[]) => void) | null;
78
+ error: ((...messages: any[]) => void) | null;
79
+ fatal: ((...messages: any[]) => void) | null;
80
+ notify: ((...messages: any[]) => void) | null;
81
+ }
82
+ ```
83
+
84
+ 4. **Know the log levels** — From least to most severe:
85
+
86
+ | Level | Description |
87
+ | -------- | -------------------------------------------------------------------- |
88
+ | `trace` | Highly detailed internal execution tracing. |
89
+ | `debug` | Diagnostic information useful during development. |
90
+ | `info` | General operational events. |
91
+ | `warn` | Potential issues that don't prevent normal operation. |
92
+ | `error` | Errors that affect specific operations. |
93
+ | `fatal` | Critical errors causing process termination. |
94
+ | `notify` | Important operational milestones. Always logged regardless of level. |
95
+
96
+ The default log level is `warn`. Setting a level includes that level and all more-severe levels.
97
+
98
+ 5. **Enable console capture when porting existing code** — When `logging.console: true` is set, writes via `console.log`, `console.warn`, `console.error`, etc. are appended verbatim to `hdb.log`. Captured lines do **not** pass through `logger`'s level filter. Prefer `logger` directly in production code so that level filtering and tagging apply. Console capture is intended as a convenience for porting existing code and for debugging.
99
+
100
+ 6. **Know where logs are written** — All standard log output goes to `<ROOTPATH>/log/hdb.log` (default: `~/hdb/log/hdb.log`). To also log to `stdout`/`stderr`, set `logging.stdStreams: true`.
101
+
102
+ ## Examples
103
+
104
+ ### Basic logging in a resource
105
+
106
+ ```javascript
107
+ export class MyResource extends Resource {
108
+ async get(id) {
109
+ logger.debug('Fetching record', { id });
110
+ const record = await super.get(id);
111
+ if (!record) {
112
+ logger.warn('Record not found', { id });
113
+ }
114
+ return record;
115
+ }
116
+
117
+ async put(record) {
118
+ logger.info('Updating record', { id: record.id });
119
+ try {
120
+ return await super.put(record);
121
+ } catch (err) {
122
+ logger.error('Failed to update record', err);
123
+ throw err;
124
+ }
125
+ }
126
+ }
47
127
  ```
48
128
 
49
- Using `loggerWithTag` is highly recommended for grouping related logs, making them much easier to filter and analyze in the Harper Studio or via the API.
50
-
51
- ## Programmatic Log Retrieval
52
-
53
- You can programmatically read logs from a deployed Harper instance using the `read_log` operation. This is useful for building custom monitoring tools or debugging dashboards.
54
-
55
- ### `read_log` Operation
56
-
57
- The `read_log` operation is a POST request to the Harper instance.
58
-
59
- **Example Request:**
60
-
61
- ```json
62
- {
63
- "operation": "read_log",
64
- "limit": 100,
65
- "start": 0,
66
- "level": "error",
67
- "order": "desc",
68
- "from": "2024-01-01T00:00:00.000Z",
69
- "until": "2024-01-02T00:00:00.000Z"
129
+ ### Tagged logging with `withTag()`
130
+
131
+ ```javascript
132
+ const log = logger.withTag('my-resource');
133
+
134
+ export class MyResource extends Resource {
135
+ async get(id) {
136
+ log.debug?.('Fetching record', { id });
137
+ const record = await super.get(id);
138
+ if (!record) {
139
+ log.warn?.('Record not found', { id });
140
+ }
141
+ return record;
142
+ }
143
+
144
+ async put(record) {
145
+ log.info?.('Updating record', { id: record.id });
146
+ try {
147
+ return await super.put(record);
148
+ } catch (err) {
149
+ log.error?.('Failed to update record', err);
150
+ throw err;
151
+ }
152
+ }
70
153
  }
71
154
  ```
72
155
 
73
- ### Parameters
74
-
75
- - `limit`: Number of log entries to return.
76
- - `start`: Offset for pagination.
77
- - `level`: Filter by log level (`info`, `error`, `warn`, `debug`, `trace`, `notify`, `fatal`, `stdout`, `stderr`).
78
- - `from`: ISO 8601 timestamp to start reading from.
79
- - `until`: ISO 8601 timestamp to stop reading at.
80
- - `order`: Sort order, either `asc` or `desc`.
81
- - `replicated`: (Boolean) Include logs from replicated nodes in a cluster.
156
+ Tagged entries appear in `hdb.log` with the tag in the header:
82
157
 
83
- ### Log Entry Structure
158
+ ```
159
+ 2023-03-09T14:25:05.269Z [info] [my-resource]: Updating record
160
+ ```
84
161
 
85
- Each log entry returned by `read_log` typically includes:
162
+ ## Notes
86
163
 
87
- - `level`: The severity level of the log.
88
- - `timestamp`: When the log was recorded.
89
- - `thread`: The execution thread.
90
- - `tags`: An array of tags (e.g., from `loggerWithTag`).
91
- - `node`: The node name in a Harper cluster.
92
- - `message`: The logged content.
164
+ - All log output is written to `<ROOTPATH>/log/hdb.log`. The `logger` global writes to this file at the configured `logging.external` level.
165
+ - Log entry format for `logger`: `<timestamp> [<level>] [<thread>/<id>]: <message>`
166
+ - Log entry format for `TaggedLogger`: `<timestamp> [<level>] [<tag>]: <message>`
167
+ - `console.log` output is only forwarded to `hdb.log` when `logging.console: true` is explicitly set; it is not forwarded by default.
168
+ - When logging to standard streams, run Harper in the foreground (`harper`, not `harper start`).
169
+ - `TaggedLogger` is bound to the configured log level at creation time — always use `?.` on its methods.
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: programmatic-table-requests
3
3
  description: How to interact with Harper tables programmatically using the `tables` object.
4
+ metadata:
5
+ mode: synthesized
4
6
  ---
5
7
 
6
8
  # Programmatic Table Requests
@@ -30,6 +32,7 @@ Use this skill when you need to perform database operations (CRUD, search, subsc
30
32
  // process record
31
33
  }
32
34
  ```
35
+ See the [Query Conditions](#query-conditions) section below for the full query object reference.
33
36
  5. **Real-time Subscriptions**: Use `subscribe(query)` to listen for changes:
34
37
  ```typescript
35
38
  for await (const event of tables.MyTable.subscribe(query)) {
@@ -38,6 +41,94 @@ Use this skill when you need to perform database operations (CRUD, search, subsc
38
41
  ```
39
42
  6. **Publish Events**: Use `publish(id, message)` to trigger subscriptions without necessarily persisting data.
40
43
 
44
+ ## Query Conditions
45
+
46
+ When passing a query to `search()`, `get()`, or `subscribe()`, use a query object with a `conditions` array.
47
+
48
+ ### Condition Object Shape
49
+
50
+ | Property | Description |
51
+ | ------------ | ------------------------------------------------------------------------------------------ |
52
+ | `attribute` | Field name, or array of field names to traverse a relationship (e.g., `['brand', 'name']`) |
53
+ | `value` | The value to compare against |
54
+ | `comparator` | One of the comparator strings below (default: `equals`) |
55
+ | `operator` | `and` (default) or `or` — applies to a nested `conditions` block |
56
+ | `conditions` | Nested array of condition objects for complex AND/OR logic |
57
+
58
+ ### Comparator Values
59
+
60
+ Use these exact strings — incorrect comparator names will silently fail or error:
61
+
62
+ | Comparator | Meaning |
63
+ | -------------------- | ---------------------------------------------------------- |
64
+ | `equals` | Exact match (default) |
65
+ | `not_equal` | Not equal |
66
+ | `greater_than` | `>` |
67
+ | `greater_than_equal` | `>=` |
68
+ | `less_than` | `<` |
69
+ | `less_than_equal` | `<=` |
70
+ | `starts_with` | String starts with value |
71
+ | `contains` | String contains value |
72
+ | `ends_with` | String ends with value |
73
+ | `between` | Value is between two bounds (pass `value` as `[min, max]`) |
74
+
75
+ ### Query Object Parameters
76
+
77
+ | Property | Description |
78
+ | ------------ | ------------------------------------------------------------------------------------ |
79
+ | `conditions` | Array of condition objects |
80
+ | `limit` | Maximum number of records to return |
81
+ | `offset` | Number of records to skip (for pagination) |
82
+ | `select` | Array of attribute names to return; supports `$id` and `$updatedtime` |
83
+ | `sort` | Object with `attribute`, `descending` (bool), and optional `next` for secondary sort |
84
+
85
+ ### Examples
86
+
87
+ **Simple filter:**
88
+
89
+ ```javascript
90
+ for await (const record of tables.Product.search({
91
+ conditions: [{ attribute: 'price', comparator: 'less_than', value: 100 }],
92
+ limit: 20,
93
+ })) { ... }
94
+ ```
95
+
96
+ **AND + nested OR:**
97
+
98
+ ```javascript
99
+ for await (const record of tables.Product.search({
100
+ conditions: [
101
+ { attribute: 'price', comparator: 'less_than', value: 100 },
102
+ {
103
+ operator: 'or',
104
+ conditions: [
105
+ { attribute: 'rating', comparator: 'greater_than', value: 4 },
106
+ { attribute: 'featured', value: true },
107
+ ],
108
+ },
109
+ ],
110
+ })) { ... }
111
+ ```
112
+
113
+ **Relationship traversal:**
114
+
115
+ ```javascript
116
+ for await (const record of tables.Book.search({
117
+ conditions: [{ attribute: ['brand', 'name'], comparator: 'equals', value: 'Harper' }],
118
+ })) { ... }
119
+ ```
120
+
121
+ **Sort and paginate:**
122
+
123
+ ```javascript
124
+ for await (const record of tables.Product.search({
125
+ conditions: [{ attribute: 'inStock', value: true }],
126
+ sort: { attribute: 'price', descending: false },
127
+ limit: 10,
128
+ offset: 20,
129
+ })) { ... }
130
+ ```
131
+
41
132
  ## Cautions
42
133
 
43
134
  Be very careful when performing updates and deletions! You may be dealing with live production data. The wrong request to delete, without approval from a human, could be devastating to a business. Always use the proper approval process.
@@ -1,27 +1,202 @@
1
1
  ---
2
2
  name: querying-rest-apis
3
- description: How to use query parameters to filter, sort, and paginate Harper REST APIs.
3
+ description: 'How to use query parameters to filter, sort, and paginate Harper REST APIs.'
4
+ metadata:
5
+ mode: generate
6
+ sources:
7
+ - reference/v5/rest/querying.md
8
+ sourceCommit: b7fbddadd42eb4487190b650a9abc4bcfeef5819
9
+ inputHash: 9f8c981a629ef606
4
10
  ---
5
11
 
6
12
  # Querying REST APIs
7
13
 
8
- Instructions for the agent to follow when querying Harper's REST APIs.
14
+ Instructions for the agent to filter, sort, select, and paginate Harper REST API collections using URL query parameters.
9
15
 
10
16
  ## When to Use
11
17
 
12
- Use this skill when you need to perform advanced data retrieval (filtering, sorting, pagination, joins) using Harper's automatic REST endpoints.
18
+ Apply this rule when building or modifying code that queries Harper REST endpoints with filtering, sorting, field selection, or pagination. Use it whenever constructing URLs against collection paths exposed by Harper's automatic REST interface (see [automatic-apis.md](automatic-apis.md)).
13
19
 
14
20
  ## How It Works
15
21
 
16
- 1. **Basic Filtering**: Use attribute names as query parameters: `GET /Table/?key=value`.
17
- 2. **Use Comparison Operators**: Append operators like `gt`, `ge`, `lt`, `le`, `ne` using FIQL-style syntax: `GET /Table/?price=gt=100`.
18
- 3. **Apply Logic and Grouping**: Use `&` for AND, `|` for OR, and `()` for grouping: `GET /Table/?(rating=5|featured=true)&price=lt=50`.
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)` 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)`
27
- 7. **Query Relationships**: Use dot syntax for tables linked with `@relationship`: `GET /Book/?author.name=Harper`.
22
+ 1. **Filter by attribute**: Add query parameters matching attribute names and values. The queried attribute must be indexed.
23
+
24
+ ```
25
+ GET /Product/?category=software
26
+ GET /Product/?category=software&inStock=true
27
+ ```
28
+
29
+ 2. **Apply comparison operators (FIQL syntax)**: Use FIQL operators directly in query parameter values.
30
+
31
+ | Operator | Meaning |
32
+ | ------------ | -------------------------------------- |
33
+ | `==` | Equal |
34
+ | `=lt=` | Less than |
35
+ | `=le=` | Less than or equal |
36
+ | `=gt=` | Greater than |
37
+ | `=ge=` | Greater than or equal |
38
+ | `=ne=`, `!=` | Not equal |
39
+ | `=ct=` | Contains (strings) |
40
+ | `=sw=` | Starts with (strings) |
41
+ | `=ew=` | Ends with (strings) |
42
+ | `=`, `===` | Strict equality (no type conversion) |
43
+ | `!==` | Strict inequality (no type conversion) |
44
+
45
+ ```
46
+ GET /Product/?price=gt=100
47
+ GET /Product/?price=le=20
48
+ GET /Product/?name==Keyboard*
49
+ GET /Product/?category=software&price=gt=100&price=lt=200
50
+ ```
51
+
52
+ For date fields, URL-encode colons as `%3A`:
53
+
54
+ ```
55
+ GET /Product/?listDate=gt=2017-03-08T09%3A30%3A00.000Z
56
+ ```
57
+
58
+ 3. **Chain conditions for range queries**: Omit the attribute name on the second condition to apply it to the same attribute. Only `gt`/`ge` combined with `lt`/`le` is supported.
59
+
60
+ ```
61
+ GET /Product/?price=gt=100&lt=200
62
+ ```
63
+
64
+ 4. **Combine conditions with OR logic**: Use `|` instead of `&`.
65
+
66
+ ```
67
+ GET /Product/?rating=5|featured=true
68
+ ```
69
+
70
+ 5. **Group conditions**: Use parentheses or square brackets to control order of operations. Prefer square brackets when constructing queries from user input, since standard URI encoding safely encodes `[` and `]`.
71
+
72
+ ```
73
+ GET /Product/?rating=5|(price=gt=100&price=lt=200)
74
+ GET /Product/?rating=5&[tag=fast|tag=scalable|tag=efficient]
75
+ ```
76
+
77
+ Construct grouped queries from JavaScript:
78
+
79
+ ```javascript
80
+ let url = `/Product/?rating=5&[${tags.map(encodeURIComponent).join('|')}]`;
81
+ ```
82
+
83
+ 6. **Select specific properties with `select(`**: Use `select()` to control which fields are returned.
84
+
85
+ | Syntax | Returns |
86
+ | -------------------------------------- | ------------------------------------------- |
87
+ | `?select(property)` | Values of a single property directly |
88
+ | `?select(property1,property2)` | Objects with only the specified properties |
89
+ | `?select([property1,property2])` | Arrays of property values |
90
+ | `?select(property1,)` | Objects with a single specified property |
91
+ | `?select(property{subProp1,subProp2})` | Nested objects with specific sub-properties |
92
+
93
+ ```
94
+ GET /Product/?category=software&select(name)
95
+ GET /Product/?brand.name=Microsoft&select(name,brand{name})
96
+ ```
97
+
98
+ 7. **Limit results with `limit(`**: Use `limit(end)` or `limit(start,end)` to paginate.
99
+
100
+ ```
101
+ GET /Product/?rating=gt=3&inStock=true&select(rating,name)&limit(20)
102
+ GET /Product/?rating=gt=3&limit(10,30)
103
+ ```
104
+
105
+ 8. **Sort results with `sort(`**: Use `sort(property)` or `sort(+property,-property,...)`. Prefix `+` or no prefix = ascending; `-` = descending.
106
+
107
+ ```
108
+ GET /Product/?rating=gt=3&sort(+name)
109
+ GET /Product/?sort(+rating,-price)
110
+ ```
111
+
112
+ 9. **Query across relationships**: Use dot-syntax to filter by related table attributes. Relationships must be defined in the schema using `@relation`.
113
+
114
+ ```
115
+ GET /Product/?brand.name=Microsoft
116
+ GET /Brand/?products.name=Keyboard
117
+ ```
118
+
119
+ Use `select()` to include relationship attributes in the response (they are not included by default):
120
+
121
+ ```
122
+ GET /Product/?brand.name=Microsoft&select(name,brand{name})
123
+ ```
124
+
125
+ 10. **Access a specific property by URL**: Append the property name with dot syntax to the record ID. Only works for properties declared in the schema.
126
+ ```
127
+ GET /MyTable/123.propertyName
128
+ ```
129
+
130
+ ## Examples
131
+
132
+ **Range filter with select and limit:**
133
+
134
+ ```
135
+ GET /Product/?category=software&price=gt=100&price=lt=200&select(name,price)&limit(20)
136
+ ```
137
+
138
+ **Sort descending with multiple fields:**
139
+
140
+ ```
141
+ GET /Product/?sort(+rating,-price)
142
+ ```
143
+
144
+ **OR logic with grouping:**
145
+
146
+ ```
147
+ GET /Product/?price=lt=100|[rating=5&[tag=fast|tag=scalable|tag=efficient]&inStock=true]
148
+ ```
149
+
150
+ **Relationship join with nested select:**
151
+
152
+ ```
153
+ GET /Product/?brand.name=Microsoft&select(name,brand{name,id})
154
+ ```
155
+
156
+ **Schema defining a relationship for join queries:**
157
+
158
+ ```graphql
159
+ type Product @table @export {
160
+ id: Long @primaryKey
161
+ name: String
162
+ brandId: Long @indexed
163
+ brand: Brand @relation(from: "brandId")
164
+ }
165
+ type Brand @table @export {
166
+ id: Long @primaryKey
167
+ name: String
168
+ products: [Product] @relation(to: "brandId")
169
+ }
170
+ ```
171
+
172
+ **Many-to-many relationship query:**
173
+
174
+ ```graphql
175
+ type Product @table @export {
176
+ id: Long @primaryKey
177
+ name: String
178
+ resellerIds: [Long] @indexed
179
+ resellers: [Reseller] @relation(from: "resellerId")
180
+ }
181
+ ```
182
+
183
+ ```
184
+ GET /Product/?resellers.name=Cool Shop&select(id,name,resellers{name,id})
185
+ ```
186
+
187
+ **Type conversion with explicit prefix:**
188
+
189
+ ```
190
+ GET /Product/?price==number:123
191
+ GET /Product/?active==boolean:true
192
+ GET /Product/?listDate==date:2024-01-05T20%3A07%3A27.955Z
193
+ ```
194
+
195
+ ## Notes
196
+
197
+ - Only indexed attributes can be used as the primary filter; additional unindexed attributes can be combined with `&` once at least one indexed attribute is present.
198
+ - For null value queries, use `?attribute=null`. Indexes must have been created with null indexing support; existing indexes must be removed and re-added to support null queries.
199
+ - FIQL comparators (`==`, `!=`, `=gt=`, etc.) apply automatic type conversion based on value syntax or schema-declared type. Strict operators (`=`, `===`, `!==`) skip automatic type conversion.
200
+ - Filtering by a related attribute produces INNER JOIN behavior (only records with a matching related record are returned). Using `select()` on a relationship without a filter produces LEFT JOIN behavior.
201
+ - The array order of foreign key values in many-to-many relationships is preserved when resolving the relationship.
202
+ - See [automatic-apis.md](automatic-apis.md) for how Harper tables are automatically exposed as REST endpoints.