@repost/client 0.2.0 → 0.4.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.
Files changed (75) hide show
  1. package/README.md +15 -85
  2. package/dist/cjs/index-e0zw7VDH.cjs +2987 -0
  3. package/dist/cjs/index-e0zw7VDH.cjs.map +1 -0
  4. package/dist/cjs/index.cjs +23 -1046
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/node-Dd92VNS7.cjs +841 -0
  7. package/dist/cjs/node-Dd92VNS7.cjs.map +1 -0
  8. package/dist/cjs/observer-dykSFHYi.cjs +69 -0
  9. package/dist/cjs/observer-dykSFHYi.cjs.map +1 -0
  10. package/dist/cjs/otel/index.cjs +99 -0
  11. package/dist/cjs/otel/index.cjs.map +1 -0
  12. package/dist/cjs/testing/index.cjs +257 -0
  13. package/dist/cjs/testing/index.cjs.map +1 -0
  14. package/dist/cjs/types/config.d.ts +28 -0
  15. package/dist/cjs/types/errors.d.ts +83 -0
  16. package/dist/cjs/types/index.d.ts +8 -3
  17. package/dist/cjs/types/observer.d.ts +44 -0
  18. package/dist/cjs/types/operation-events.d.ts +8 -0
  19. package/dist/cjs/types/operation-input.d.ts +5 -0
  20. package/dist/cjs/types/operation-policy.d.ts +23 -0
  21. package/dist/cjs/types/operation.d.ts +14 -0
  22. package/dist/cjs/types/otel/index.d.ts +2 -0
  23. package/dist/cjs/types/otel/metrics.d.ts +5 -0
  24. package/dist/cjs/types/otel/telemetry.d.ts +5 -0
  25. package/dist/cjs/types/runtime-state.d.ts +45 -0
  26. package/dist/cjs/types/serialize.d.ts +9 -3
  27. package/dist/cjs/types/telemetry.d.ts +43 -0
  28. package/dist/cjs/types/testing/deterministic.d.ts +19 -0
  29. package/dist/cjs/types/testing/index.d.ts +16 -0
  30. package/dist/cjs/types/testing/manual-clock.d.ts +12 -0
  31. package/dist/cjs/types/testing/recording-observer.d.ts +11 -0
  32. package/dist/cjs/types/testing/stub-transport.d.ts +35 -0
  33. package/dist/cjs/types/transport/connect-proxy.d.ts +30 -0
  34. package/dist/cjs/types/transport/failure.d.ts +7 -0
  35. package/dist/cjs/types/transport/framing.d.ts +8 -0
  36. package/dist/cjs/types/transport/h2.d.ts +3 -0
  37. package/dist/cjs/types/transport/node.d.ts +3 -0
  38. package/dist/cjs/types/transport/response-reader.d.ts +6 -0
  39. package/dist/cjs/types/transport/strict-json.d.ts +5 -0
  40. package/dist/cjs/types/transport/tls.d.ts +14 -0
  41. package/dist/cjs/types/transport/undici-compat.d.ts +47 -0
  42. package/dist/cjs/types/transport.d.ts +42 -19
  43. package/dist/cjs/types/types.d.ts +146 -23
  44. package/dist/cjs/types/version.d.ts +2 -0
  45. package/dist/cjs/types/webhooks.d.ts +15 -0
  46. package/dist/cjs/version-CGqSWJir.cjs +7 -0
  47. package/dist/cjs/version-CGqSWJir.cjs.map +1 -0
  48. package/dist/esm/index-DRD5FBax.mjs +2967 -0
  49. package/dist/esm/index-DRD5FBax.mjs.map +1 -0
  50. package/dist/esm/index.mjs +3 -1041
  51. package/dist/esm/index.mjs.map +1 -1
  52. package/dist/esm/node-BAJt_qhB.mjs +839 -0
  53. package/dist/esm/node-BAJt_qhB.mjs.map +1 -0
  54. package/dist/esm/observer-Dns2X4wE.mjs +66 -0
  55. package/dist/esm/observer-Dns2X4wE.mjs.map +1 -0
  56. package/dist/esm/otel/index.mjs +96 -0
  57. package/dist/esm/otel/index.mjs.map +1 -0
  58. package/dist/esm/testing/index.mjs +248 -0
  59. package/dist/esm/testing/index.mjs.map +1 -0
  60. package/dist/esm/version-Dp5vd2nu.mjs +5 -0
  61. package/dist/esm/version-Dp5vd2nu.mjs.map +1 -0
  62. package/index.d.ts +1 -1
  63. package/index.js +3 -4
  64. package/index.mjs +1 -1
  65. package/otel/index.d.ts +1 -0
  66. package/otel/index.js +3 -0
  67. package/otel/index.mjs +1 -0
  68. package/package.json +38 -9
  69. package/runtime/index.d.ts +1 -1
  70. package/runtime/index.js +2 -2
  71. package/runtime/index.mjs +1 -1
  72. package/scripts/postinstall.js +2 -2
  73. package/testing/index.d.ts +1 -0
  74. package/testing/index.js +3 -0
  75. package/testing/index.mjs +1 -0
package/README.md CHANGED
@@ -1,93 +1,23 @@
1
1
  # @repost/client
2
2
 
3
- The npm face of the Repost-generated webhooks SDK, split exactly like Prisma's
4
- `@prisma/client`:
3
+ [![npm version](https://img.shields.io/npm/v/@repost/client.svg)](https://www.npmjs.com/package/@repost/client)
5
4
 
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:
5
+ Type-safe webhook publishing generated from your Repost schema. `@repost/client`
6
+ exposes the models, enums, and webhook methods generated by the Repost CLI, then
7
+ handles deterministic serialization, Standard Webhooks envelopes, idempotency,
8
+ retries, and publishing — so a send is a single typed method call.
10
9
 
11
- ```ts
12
- import { createRepostClient, type User } from "@repost/client";
13
- ```
10
+ It is part of the [Repost](https://repost.sh) platform for defining webhook
11
+ contracts once and delivering them reliably. See the full documentation at
12
+ [repost.sh/docs](https://repost.sh/docs).
14
13
 
15
- Before the first generate, the postinstall-written placeholder throws
16
- `@repost/client did not initialize yet. Please run "repost schema generate"`.
14
+ ## Getting started
17
15
 
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:
16
+ - [Quickstart](https://repost.sh/docs/send/typescript/quickstart) (5 min)
17
+ - [Schema & migrations](https://repost.sh/docs/send/typescript/generation) (15 min)
18
+ - [Add Repost to an existing project](https://repost.sh/docs/send/typescript/existing-project) (15 min)
23
19
 
24
- ```ts
25
- import { buildWebhooks, type ModelDescriptor } from "@repost/client/runtime";
26
- ```
20
+ ## Support
27
21
 
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
- ```
22
+ - [GitHub repository](https://github.com/repost-sh/monorepo)
23
+ - [Documentation](https://repost.sh/docs)