mythik 0.1.3 → 0.1.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 (34) hide show
  1. package/README.md +75 -51
  2. package/dist/actions/dispatcher.d.ts.map +1 -1
  3. package/dist/actions/dispatcher.js +11 -2
  4. package/dist/actions/dispatcher.js.map +1 -1
  5. package/dist/renderer/prop-schemas.js +1 -1
  6. package/dist/renderer/prop-schemas.js.map +1 -1
  7. package/dist/sql/drivers/mysql.d.ts.map +1 -1
  8. package/dist/sql/drivers/mysql.js +7 -5
  9. package/dist/sql/drivers/mysql.js.map +1 -1
  10. package/dist/sql/drivers/postgres.d.ts.map +1 -1
  11. package/dist/sql/drivers/postgres.js +7 -5
  12. package/dist/sql/drivers/postgres.js.map +1 -1
  13. package/dist/sql/drivers/sqlite.d.ts.map +1 -1
  14. package/dist/sql/drivers/sqlite.js +7 -5
  15. package/dist/sql/drivers/sqlite.js.map +1 -1
  16. package/dist/sql/drivers/sqlserver.d.ts.map +1 -1
  17. package/dist/sql/drivers/sqlserver.js +7 -5
  18. package/dist/sql/drivers/sqlserver.js.map +1 -1
  19. package/dist/sql/errors.d.ts +10 -0
  20. package/dist/sql/errors.d.ts.map +1 -1
  21. package/dist/sql/errors.js +14 -0
  22. package/dist/sql/errors.js.map +1 -1
  23. package/docs/consumer/ai-context-primitives.md +3 -0
  24. package/docs/consumer/ai-context-runtime-semantics.md +10 -8
  25. package/docs/consumer/ai-context.md +39 -29
  26. package/docs/consumer/reference-doc.md +40 -35
  27. package/docs/wiki/compiled/action-fetch.md +7 -2
  28. package/docs/wiki/compiled/concept-package-layout.md +11 -11
  29. package/docs/wiki/compiled/concept-public-package-names.md +24 -15
  30. package/docs/wiki/compiled/path-ui-loading-error.md +5 -0
  31. package/docs/wiki/compiled/pattern-fetch-vs-datasources.md +5 -0
  32. package/docs/wiki/compiled/pattern-loading-content-empty.md +3 -2
  33. package/docs/wiki/compiled/primitive-select.md +16 -2
  34. package/package.json +20 -2
@@ -7,29 +7,38 @@ sources: [docs/consumer/ai-context.md, docs/consumer/WHERE-TO-LOOK.md]
7
7
 
8
8
  # Public package names
9
9
 
10
- Mythik publishes unscoped npm packages. Do not generate scoped package imports for public npm consumers.
10
+ Mythik publishes unscoped npm packages. Do not generate scoped package imports for public npm consumers.
11
11
 
12
12
  | Public package | Use |
13
13
  |---|---|
14
14
  | `mythik` | Browser-safe core runtime, state, expressions, validation, browser-safe stores |
15
- | `mythik/server` | Node-only stores, SQL drivers, and SQL DDL helpers exported from the core package subpath |
16
- | `mythik-react` | React host, renderer, and web primitives |
17
- | `mythik-cli` | CLI package; installs the `mythik` binary |
18
- | `mythik-cli/api` | Programmatic CLI API: `runPush`, `runPatch`, `runLint`, and related types |
19
- | `mythik-server` | Express server runtime for ApiSpecs |
20
-
21
- The `mythik` package also ships the AI documentation under `node_modules/mythik/docs`.
22
- Use [[@cli-docs]] to locate or copy it after install.
23
-
24
- Typical React install:
15
+ | `mythik/server` | Node-only stores, SQL drivers, and SQL DDL helpers exported from the core package subpath |
16
+ | `mythik-react` | React host, renderer, and web primitives |
17
+ | `mythik-cli` | CLI package; installs the `mythik` binary |
18
+ | `mythik-cli/api` | Programmatic CLI API: `runPush`, `runPatch`, `runLint`, and related types |
19
+ | `mythik-server` | Express server runtime for ApiSpecs |
20
+
21
+ The `mythik` package also ships the AI documentation under `node_modules/mythik/docs`.
22
+ Use [[@cli-docs]] to locate or copy it after install.
23
+
24
+ Typical React install:
25
25
 
26
26
  ```bash
27
27
  npm install mythik mythik-react
28
28
  npm install -D mythik-cli
29
29
  ```
30
30
 
31
- Add `mythik-server` only when building a Mythik-backed Node server. React Native work is a repository preview track, not part of the supported npm publish surface yet.
32
-
33
- SQL adapters (`mssql`, `pg`, `mysql2`, `better-sqlite3`) are optional dependencies of `mythik`. They install by default with npm/pnpm unless optional dependencies are omitted.
31
+ Add `mythik-server` only when building a Mythik-backed Node server. React Native work is a repository preview track, not part of the supported npm publish surface yet.
32
+
33
+ SQL adapters (`mssql`, `pg`, `mysql2`, `better-sqlite3`) are optional peer dependencies. Install only the selected database adapter:
34
+
35
+ ```bash
36
+ npm install pg # PostgreSQL
37
+ npm install mysql2 # MySQL
38
+ npm install mssql # SQL Server
39
+ npm install better-sqlite3 # SQLite
40
+ ```
41
+
42
+ SQLite uses native `better-sqlite3`; warnings from its transitive native-build helpers are adapter-level install warnings, not Mythik runtime failures. Missing SQL adapter errors include the package name and exact install command for the selected dialect.
34
43
 
35
- Related: [[@cli-docs]], [[@cli-programmatic-api]], [[@concept-spec-stores-catalog]], [[@concept-where-to-look]].
44
+ Related: [[@cli-docs]], [[@cli-programmatic-api]], [[@concept-spec-stores-catalog]], [[@concept-where-to-look]].
@@ -16,6 +16,11 @@ Auto-managed by `fetch` action.
16
16
  | `/ui/loading` | boolean | Set `true` at request start, `false` at resolve. **Shared across all fetch actions.** |
17
17
  | `/ui/lastError` | object | Error message on failure; cleared on next successful fetch. |
18
18
 
19
+ `/ui/lastError` is global compatibility state. For critical screen loads,
20
+ set `fetch.params.errorTarget` to a screen-owned `/ui/...` path and render
21
+ that path visibly; `fetch` writes the same structured error there and clears
22
+ it on success.
23
+
19
24
  ## Use in visibility
20
25
 
21
26
  ```json
@@ -19,6 +19,11 @@ Both load data into state. Pick **one pattern per data target**.
19
19
  | **Re-fetch** | Manual (call fetch again) | Automatic on param change, or `refreshDataSource` |
20
20
  | **Use for** | Static initial data, POST/PUT/DELETE | Lists with filters, search, pagination |
21
21
 
22
+ For critical `initialActions + fetch` screen loads, set `errorTarget` to a
23
+ screen-owned path (for example `/ui/loadErrors/orderForm`) and render that
24
+ path visibly. `/ui/lastError` is shared global state and can be overwritten
25
+ by unrelated fetches.
26
+
22
27
  ## Rule
23
28
 
24
29
  **Don't mix both for the same data target.** They write to different
@@ -12,7 +12,8 @@ state paths differ between `initialActions + fetch` vs `dataSources`.
12
12
 
13
13
  ## With `initialActions + fetch`
14
14
 
15
- Uses `/ui/loading` and `/ui/lastError`:
15
+ Uses `/ui/loading`; critical loads should set `errorTarget` and render the
16
+ screen-owned error path:
16
17
 
17
18
  ```json
18
19
  "loading": { "visible": { "$and": [
@@ -24,7 +25,7 @@ Uses `/ui/loading` and `/ui/lastError`:
24
25
  { "$not": { "$state": "/ui/loading" } },
25
26
  { "$not": { "$array": "count", "source": { "$state": "/items" } } }
26
27
  ]}},
27
- "error": { "visible": { "$state": "/ui/lastError" } }
28
+ "error": { "visible": { "$state": "/ui/loadErrors/items" } }
28
29
  ```
29
30
 
30
31
  ## With `dataSources`
@@ -7,8 +7,8 @@ sources: [docs/consumer/ai-context-primitives.md#select, docs/consumer/reference
7
7
 
8
8
  # `select`
9
9
 
10
- Dropdown picker. Options accept either string array or `[{ label, value }]`
11
- objects.
10
+ Dropdown picker. Options accept strings, `[{ label, value }]` objects, or
11
+ catalog-shaped objects when `labelKey` and `valueKey` are provided.
12
12
 
13
13
  ## Props
14
14
 
@@ -55,6 +55,16 @@ State-driven options:
55
55
  }}
56
56
  ```
57
57
 
58
+ Catalog-shaped options:
59
+ ```json
60
+ { "type": "select", "props": {
61
+ "options": { "$state": "/cat/services/data" },
62
+ "labelKey": "name",
63
+ "valueKey": "id",
64
+ "value": { "$bindState": "/form/serviceId" }
65
+ }}
66
+ ```
67
+
58
68
  ## Notes
59
69
 
60
70
  - **Listbox portals to `document.body`** (rule 225) — the dropdown panel
@@ -64,6 +74,10 @@ State-driven options:
64
74
  opaque background for readability across all surface modes (in
65
75
  `outlined`, card has transparent bg).
66
76
 
77
+ Malformed option data renders as disabled diagnostics instead of blank
78
+ clickable rows or crashes. `labelKey` and `valueKey` are simple field names on each
79
+ option object, not nested paths.
80
+
67
81
  ## Related concepts
68
82
 
69
83
  - [[@expression-bindstate]]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mythik",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Spec-driven core runtime for validated JSON applications, APIs, editor sessions, state, actions, validation, and versioning.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -48,15 +48,33 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^25.5.2",
51
+ "better-sqlite3": "^12.9.0",
51
52
  "es-module-lexer": "^2.0.0",
53
+ "mssql": "^12.2.1",
54
+ "mysql2": "^3.22.3",
55
+ "pg": "^8.20.0",
52
56
  "typescript": "^5.7.0"
53
57
  },
54
- "optionalDependencies": {
58
+ "peerDependencies": {
55
59
  "better-sqlite3": "^12.9.0",
56
60
  "mssql": "^12.2.1",
57
61
  "mysql2": "^3.22.3",
58
62
  "pg": "^8.20.0"
59
63
  },
64
+ "peerDependenciesMeta": {
65
+ "better-sqlite3": {
66
+ "optional": true
67
+ },
68
+ "mssql": {
69
+ "optional": true
70
+ },
71
+ "mysql2": {
72
+ "optional": true
73
+ },
74
+ "pg": {
75
+ "optional": true
76
+ }
77
+ },
60
78
  "scripts": {
61
79
  "build": "node ../../node_modules/typescript/bin/tsc",
62
80
  "typecheck": "node ../../node_modules/typescript/bin/tsc --noEmit"