Skip to content

Commit fe67840

Browse files
committed
chore: relax ash dep to >= 3.17.1 and consolidate 0.16.0 breaking changes
1 parent a771f31 commit fe67840

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,41 @@ Generate type-safe TypeScript clients directly from your Elixir Ash resources, e
2121

2222
## Breaking Changes
2323

24-
### 0.17.0 - Project-Root-Relative Import Paths
24+
### 0.16.0
2525

26-
`import_into_generated` and `typed_controller_import_into_generated` file paths are now **project-root-relative** instead of JS-relative import paths. The codegen resolves the correct relative import path for each output file automatically.
27-
28-
**Migration:**
29-
```elixir
30-
# Before (JS-relative)
31-
config :ash_typescript,
32-
import_into_generated: [%{import_name: "RpcHooks", file: "./rpcHooks"}]
33-
34-
# After (project-root-relative)
35-
config :ash_typescript,
36-
import_into_generated: [%{import_name: "RpcHooks", file: "assets/js/rpcHooks.ts"}]
37-
```
38-
39-
### 0.16.0 - Multi-File Output
26+
#### Multi-File Output & Project-Root-Relative Import Paths
4027

4128
AshTypescript now generates multiple output files instead of a single monolithic file. Shared types and Zod schemas are extracted into dedicated files (`ash_types.ts` and `ash_zod.ts`) that both RPC and controller code import from.
4229

30+
Additionally, `import_into_generated` and `typed_controller_import_into_generated` file paths are now **project-root-relative** instead of JS-relative import paths. The codegen resolves the correct relative import path for each output file automatically.
31+
4332
**What changed:**
4433
- Types and Zod schemas are no longer inlined in `ash_rpc.ts` — they live in separate files
4534
- Two new config options auto-derive from `output_file`: `types_output_file` (→ `ash_types.ts`) and `zod_output_file` (→ `ash_zod.ts`)
4635
- If you import types directly from the generated RPC file, update imports to use the new shared types file
36+
- `import_into_generated` and `typed_controller_import_into_generated` use project-root-relative paths
4737

4838
**Migration:**
4939
1. Run `mix ash_typescript.codegen` — new files will be created alongside the existing output
5040
2. Update any TypeScript imports that referenced types from `ash_rpc.ts` to import from `ash_types.ts` instead
5141
3. If you use Zod schemas, update imports to use `ash_zod.ts`
42+
4. Update import paths from JS-relative to project-root-relative:
43+
```elixir
44+
# Before (JS-relative)
45+
config :ash_typescript,
46+
import_into_generated: [%{import_name: "RpcHooks", file: "./rpcHooks"}]
47+
48+
# After (project-root-relative)
49+
config :ash_typescript,
50+
import_into_generated: [%{import_name: "RpcHooks", file: "assets/js/rpcHooks.ts"}]
51+
```
5252

5353
No changes are needed if you only import the RPC functions themselves (e.g., `import { listTodos } from './ash_rpc'`).
5454

55+
#### Compile-Time Verification of `public?` Actions
56+
57+
Actions and relationship read actions referenced in `typescript_rpc` blocks are now verified to be `public? true` at compile time. Previously, non-public actions would silently generate types but fail at runtime. If you see new compile errors like `"action :foo is not public?"`, set `public? true` on the action or remove it from the `typescript_rpc` block.
58+
5559
## Features
5660

5761
- **Zero-config TypeScript generation** - Automatically generates types from Ash resources

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ defmodule AshTypescript.MixProject do
176176
# Run "mix help deps" to learn about dependencies.
177177
defp deps do
178178
[
179-
{:ash, git: "https://github.com/ash-project/ash", branch: "main", override: true},
179+
{:ash, ">= 3.17.1"},
180180
{:ash_phoenix, "~> 2.0"},
181181
{:ash_postgres, "~> 2.0", only: [:dev, :test]},
182182
{:git_ops, "~> 2.0", only: [:dev], runtime: false},

mix.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
%{
2-
"ash": {:git, "https://github.com/ash-project/ash", "c3f8044241a9ff551cf9b40bc56b1f1099696757", [branch: "main"]},
2+
"ash": {:hex, :ash, "3.21.1", "1334e59a59b3ae549fb38ac3f88152b9aa3c09ad78d16e4f7b9c40f1abc2daeb", [:mix], [{:crux, ">= 0.1.2 and < 1.0.0-0", [hex: :crux, repo: "hexpm", optional: false]}, {:decimal, "~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8", [hex: :ets, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.2", [hex: :picosat_elixir, repo: "hexpm", optional: true]}, {:plug, ">= 0.0.0", [hex: :plug, repo: "hexpm", optional: true]}, {:reactor, "~> 1.0", [hex: :reactor, repo: "hexpm", optional: false]}, {:simple_sat, ">= 0.1.1 and < 1.0.0-0", [hex: :simple_sat, repo: "hexpm", optional: true]}, {:spark, ">= 2.6.0", [hex: :spark, repo: "hexpm", optional: false]}, {:splode, "~> 0.3", [hex: :splode, repo: "hexpm", optional: false]}, {:stream_data, "~> 1.0", [hex: :stream_data, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.1", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "084585df15173b979ad534e33aa64f9d9bffa1e6ed135cef9c5ffd7aa0d27cef"},
33
"ash_phoenix": {:hex, :ash_phoenix, "2.3.20", "022682396892046f48dc35a137bbea9c1e4c6a6d58e71d795defd2f071c3b138", [:mix], [{:ash, ">= 3.5.13 and < 4.0.0-0", [hex: :ash, repo: "hexpm", optional: false]}, {:igniter, "~> 0.6", [hex: :igniter, repo: "hexpm", optional: true]}, {:inertia, "~> 2.3", [hex: :inertia, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.5.6 or ~> 1.6", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.20.3 or ~> 1.0-rc.1", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:spark, ">= 2.2.29 and < 3.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}], "hexpm", "0655a90b042a5e8873b32ba2f0b52c7c9b8da0fd415518bef41ac03a7b07e02e"},
44
"ash_postgres": {:hex, :ash_postgres, "2.8.0", "bf1a30c57b15ae3622f1cea34959b3a11c33f0f4319830dd28235a3c0c79f647", [:mix], [{:ash, "~> 3.19", [hex: :ash, repo: "hexpm", optional: false]}, {:ash_sql, ">= 0.4.3 and < 1.0.0-0", [hex: :ash_sql, repo: "hexpm", optional: false]}, {:ecto, "~> 3.13", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.13", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:igniter, ">= 0.6.29 and < 1.0.0-0", [hex: :igniter, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: false]}, {:spark, ">= 2.3.4 and < 3.0.0-0", [hex: :spark, repo: "hexpm", optional: false]}], "hexpm", "06cd4278ccc838104fdbc92e0f9508cf75c4f3376a922ec7e6d85bc7192d616d"},
55
"ash_sql": {:hex, :ash_sql, "0.5.1", "f4fcaa29308bdf417fe85373e57fb6d868b7db1e7ccc2fae5cc7f8f92016d622", [:mix], [{:ash, "~> 3.7", [hex: :ash, repo: "hexpm", optional: false]}, {:ecto, ">= 3.13.4 and < 4.0.0-0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "~> 3.9", [hex: :ecto_sql, repo: "hexpm", optional: false]}], "hexpm", "33febc8a84443683c3685a2d65f674391d8f21c073555d7c22d6c484f72faa65"},

0 commit comments

Comments
 (0)