@repost/client 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LSC EUROPA Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @repost/client
2
+
3
+ The npm face of the Repost-generated webhooks SDK, split exactly like Prisma's
4
+ `@prisma/client`:
5
+
6
+ - **The entry stub** (`index.js` / `index.mjs` / `index.d.ts` at the package
7
+ root) re-exports the *generated* client from the sibling `.repost/client`
8
+ package that `repost schema generate` writes into `node_modules`. Consumers
9
+ write:
10
+
11
+ ```ts
12
+ import { createRepostClient, type User } from "@repost/client";
13
+ ```
14
+
15
+ Before the first generate, the postinstall-written placeholder throws
16
+ `@repost/client did not initialize yet. Please run "repost schema generate"`.
17
+
18
+ - **The runtime** (`@repost/client/runtime`, built into `dist/`) carries the
19
+ logic the generated code depends on: schema-driven serialization (`@map`
20
+ renames, `@default` injection), Standard Webhooks envelope construction, and
21
+ the transport (a no-network stub until workstream A). Generated code imports
22
+ it by subpath:
23
+
24
+ ```ts
25
+ import { buildWebhooks, type ModelDescriptor } from "@repost/client/runtime";
26
+ ```
27
+
28
+ Monorepos that set a custom `output` in their generator block import the
29
+ generated package by path instead; the stub goes unused, the runtime subpath
30
+ still serves them.
31
+
32
+ ## Layout
33
+
34
+ | Path | Role |
35
+ |------|------|
36
+ | `index.js` / `index.mjs` / `index.d.ts` | Static stubs re-exporting `.repost/client/default` (the `@prisma/client` pattern — a single static spread, so `cjs-module-lexer` carries named exports into ESM). |
37
+ | `scripts/postinstall.js` | Writes the friendly-error placeholder `.repost/client` when nothing is generated yet. Never clobbers a real client; silent no-op outside `node_modules`. |
38
+ | `src/` → `dist/` (rollup) | The runtime, exported as `@repost/client/runtime`. |
39
+ | `tests/generated/` | The canonical generated package fixture, byte-identical to the Rust emitter (enforced by `canonical_generated_sdk_js_fixture_is_in_sync`; refresh with `UPDATE_EXPECT=1 cargo test -p repost-schema`). |
40
+ | `tests/stub-resolution.test.ts` | Real-`node` proof of the stub chain under npm and pnpm layouts, plus the before-generate error. |
41
+ | `tests/prisma-parity.test.ts` | Runs real `prisma generate` side by side and asserts the shared structural invariants (packaging spec R10). |
42
+ | `tests/e2e-session.test.ts` | The full consumer flow — `init` → multi-file schema → install → `migrate dev` → typed imports — against the real engine binary. |
43
+
44
+ ## Local development
45
+
46
+ `@repost/client` is not published to npm yet (see below). Until it is, consumers
47
+ outside this monorepo can wire it up locally. The options are listed in order of
48
+ fidelity — the first is truest to a real install, the last is fastest to iterate.
49
+
50
+ ### 1. Pack and install the tarball (recommended)
51
+
52
+ This exercises the exact `files` and `exports` a published package would ship,
53
+ so it catches a missing `dist/` file or a broken export before your users do.
54
+
55
+ ```bash
56
+ # in this package
57
+ pnpm pack # writes repost-client-0.1.0.tgz (prepack builds dist/ first)
58
+
59
+ # in your consumer app
60
+ npm install ../path/to/repost-client-0.1.0.tgz
61
+ repost schema generate # writes node_modules/.repost/client
62
+ ```
63
+
64
+ `pnpm pack` runs the `prepack` script, so the tarball always contains a fresh
65
+ `dist/`. Re-run `pnpm pack` and reinstall after each change you want to test.
66
+ Remember to re-run `repost schema generate` after any reinstall that prunes
67
+ `node_modules`.
68
+
69
+ ### 2. Link a built checkout (fastest iteration)
70
+
71
+ Linking is quicker but only resolves what is on disk under `dist/`, so you must
72
+ build first — an unbuilt checkout resolves to nothing.
73
+
74
+ ```bash
75
+ # in this package
76
+ pnpm build # or: pnpm dev (rollup -c -w, rebuilds dist/ on every save)
77
+ pnpm link --global # or: npm link
78
+
79
+ # in your consumer app
80
+ pnpm link --global @repost/client # or: npm link @repost/client
81
+ ```
82
+
83
+ Run `pnpm dev` in a separate terminal to keep `dist/` rebuilding while you edit,
84
+ and the linked consumer picks up each rebuild.
85
+
86
+ ### 3. After npm publish
87
+
88
+ Publishing is pending license confirmation. Once `@repost/client` is on npm this
89
+ whole section collapses to:
90
+
91
+ ```bash
92
+ npm install @repost/client
93
+ ```