@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.
- package/README.md +15 -85
- package/dist/cjs/index-e0zw7VDH.cjs +2987 -0
- package/dist/cjs/index-e0zw7VDH.cjs.map +1 -0
- package/dist/cjs/index.cjs +23 -1046
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/node-Dd92VNS7.cjs +841 -0
- package/dist/cjs/node-Dd92VNS7.cjs.map +1 -0
- package/dist/cjs/observer-dykSFHYi.cjs +69 -0
- package/dist/cjs/observer-dykSFHYi.cjs.map +1 -0
- package/dist/cjs/otel/index.cjs +99 -0
- package/dist/cjs/otel/index.cjs.map +1 -0
- package/dist/cjs/testing/index.cjs +257 -0
- package/dist/cjs/testing/index.cjs.map +1 -0
- package/dist/cjs/types/config.d.ts +28 -0
- package/dist/cjs/types/errors.d.ts +83 -0
- package/dist/cjs/types/index.d.ts +8 -3
- package/dist/cjs/types/observer.d.ts +44 -0
- package/dist/cjs/types/operation-events.d.ts +8 -0
- package/dist/cjs/types/operation-input.d.ts +5 -0
- package/dist/cjs/types/operation-policy.d.ts +23 -0
- package/dist/cjs/types/operation.d.ts +14 -0
- package/dist/cjs/types/otel/index.d.ts +2 -0
- package/dist/cjs/types/otel/metrics.d.ts +5 -0
- package/dist/cjs/types/otel/telemetry.d.ts +5 -0
- package/dist/cjs/types/runtime-state.d.ts +45 -0
- package/dist/cjs/types/serialize.d.ts +9 -3
- package/dist/cjs/types/telemetry.d.ts +43 -0
- package/dist/cjs/types/testing/deterministic.d.ts +19 -0
- package/dist/cjs/types/testing/index.d.ts +16 -0
- package/dist/cjs/types/testing/manual-clock.d.ts +12 -0
- package/dist/cjs/types/testing/recording-observer.d.ts +11 -0
- package/dist/cjs/types/testing/stub-transport.d.ts +35 -0
- package/dist/cjs/types/transport/connect-proxy.d.ts +30 -0
- package/dist/cjs/types/transport/failure.d.ts +7 -0
- package/dist/cjs/types/transport/framing.d.ts +8 -0
- package/dist/cjs/types/transport/h2.d.ts +3 -0
- package/dist/cjs/types/transport/node.d.ts +3 -0
- package/dist/cjs/types/transport/response-reader.d.ts +6 -0
- package/dist/cjs/types/transport/strict-json.d.ts +5 -0
- package/dist/cjs/types/transport/tls.d.ts +14 -0
- package/dist/cjs/types/transport/undici-compat.d.ts +47 -0
- package/dist/cjs/types/transport.d.ts +42 -19
- package/dist/cjs/types/types.d.ts +146 -23
- package/dist/cjs/types/version.d.ts +2 -0
- package/dist/cjs/types/webhooks.d.ts +15 -0
- package/dist/cjs/version-CGqSWJir.cjs +7 -0
- package/dist/cjs/version-CGqSWJir.cjs.map +1 -0
- package/dist/esm/index-DRD5FBax.mjs +2967 -0
- package/dist/esm/index-DRD5FBax.mjs.map +1 -0
- package/dist/esm/index.mjs +3 -1041
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/node-BAJt_qhB.mjs +839 -0
- package/dist/esm/node-BAJt_qhB.mjs.map +1 -0
- package/dist/esm/observer-Dns2X4wE.mjs +66 -0
- package/dist/esm/observer-Dns2X4wE.mjs.map +1 -0
- package/dist/esm/otel/index.mjs +96 -0
- package/dist/esm/otel/index.mjs.map +1 -0
- package/dist/esm/testing/index.mjs +248 -0
- package/dist/esm/testing/index.mjs.map +1 -0
- package/dist/esm/version-Dp5vd2nu.mjs +5 -0
- package/dist/esm/version-Dp5vd2nu.mjs.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +3 -4
- package/index.mjs +1 -1
- package/otel/index.d.ts +1 -0
- package/otel/index.js +3 -0
- package/otel/index.mjs +1 -0
- package/package.json +38 -9
- package/runtime/index.d.ts +1 -1
- package/runtime/index.js +2 -2
- package/runtime/index.mjs +1 -1
- package/scripts/postinstall.js +2 -2
- package/testing/index.d.ts +1 -0
- package/testing/index.js +3 -0
- package/testing/index.mjs +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/testing/manual-clock.ts","../../../../src/testing/deterministic.ts","../../../../src/testing/recording-observer.ts","../../../../src/testing/stub-transport.ts","../../../../src/testing/index.ts"],"sourcesContent":["import type { Scheduler } from \"../types\";\n\ninterface ManualTimer {\n readonly due: number;\n readonly sequence: number;\n resolve(): void;\n reject(reason?: unknown): void;\n cancelled: boolean;\n}\n\nexport class ManualClock {\n private current = 0;\n private sequence = 0;\n private readonly timers: ManualTimer[] = [];\n\n readonly monotonic = (): number => this.current;\n readonly wall = (): number => this.current;\n get nowMs(): number { return this.current; }\n\n async advance(ms: number): Promise<void> {\n if (!Number.isFinite(ms) || ms < 0) throw new RangeError(\"advance requires non-negative milliseconds\");\n const target = this.current + ms;\n while (true) {\n this.timers.sort((left, right) => left.due - right.due || left.sequence - right.sequence);\n const next = this.timers.find((timer) => !timer.cancelled && timer.due <= target);\n if (!next) break;\n this.timers.splice(this.timers.indexOf(next), 1);\n this.current = next.due;\n next.resolve();\n await Promise.resolve();\n await Promise.resolve();\n }\n this.current = target;\n await Promise.resolve();\n }\n\n schedule(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise((resolve, reject) => {\n const timer: ManualTimer = {\n due: this.current + ms,\n sequence: ++this.sequence,\n resolve,\n reject,\n cancelled: false,\n };\n if (signal?.aborted) {\n timer.cancelled = true;\n reject(signal.reason);\n return;\n }\n signal?.addEventListener(\"abort\", () => {\n if (timer.cancelled) return;\n timer.cancelled = true;\n reject(signal.reason);\n }, { once: true });\n this.timers.push(timer);\n });\n }\n}\n\nexport function manualScheduler(clock: ManualClock): Scheduler {\n return { sleep: (ms, signal) => clock.schedule(ms, signal) };\n}\n","import type { Generators, RetryEntropy } from \"../types\";\n\nexport const TestDefaultValueGenerators = {\n fixed(nowIso: string, uuid: string, cuid: string): Generators {\n return { now: () => nowIso, uuid: () => uuid, cuid: () => cuid };\n },\n sequence(entries: Array<Partial<{ now: string; uuid: string; cuid: string }>>): Generators {\n const indices = { now: 0, uuid: 0, cuid: 0 };\n const next = (kind: keyof typeof indices): string => {\n const value = entries[indices[kind]++]?.[kind];\n if (value === undefined) throw new Error(`${kind} sequence exhausted`);\n return value;\n };\n return { now: () => next(\"now\"), uuid: () => next(\"uuid\"), cuid: () => next(\"cuid\") };\n },\n failing(error = new Error(\"default generator failed\")): Generators {\n const fail = (): never => { throw error; };\n return { now: fail, uuid: fail, cuid: fail };\n },\n};\n\nexport const TestIdempotencyKeyGenerator = {\n fixed(key: string): () => string { return () => key; },\n sequence(...keys: string[]): () => string {\n let index = 0;\n return () => {\n const key = keys[index++];\n if (key === undefined) throw new Error(\"idempotency key sequence exhausted\");\n return key;\n };\n },\n failing(error = new Error(\"idempotency key generator failed\")): () => string {\n return () => { throw error; };\n },\n};\n\nexport const DeterministicRetryEntropy = {\n zero(): RetryEntropy { return { nextInt: () => 0 }; },\n sequence(...values: number[]): RetryEntropy {\n let index = 0;\n return {\n nextInt(exclusiveBound) {\n const value = values[index++];\n if (value === undefined) throw new Error(\"entropy sequence exhausted\");\n if (!Number.isInteger(value) || value < 0 || value >= exclusiveBound) throw new RangeError(\"entropy value out of range\");\n return value;\n },\n };\n },\n};\n","import { observerFlush, type FlushableObserver, type ObserverEvent } from \"../observer\";\n\nexport class RecordingObserver {\n private readonly recorded: ObserverEvent[] = [];\n private readonly waiters: Array<(event: ObserverEvent) => void> = [];\n\n readonly callback: FlushableObserver = Object.assign(\n (event: ObserverEvent) => {\n this.recorded.push(event);\n this.waiters.shift()?.(event);\n },\n { [observerFlush]: async () => {} },\n );\n\n get events(): readonly ObserverEvent[] { return Object.freeze([...this.recorded]); }\n\n awaitNext(options: { timeoutMs?: number } = {}): Promise<ObserverEvent> {\n const timeoutMs = options.timeoutMs ?? 1_000;\n return new Promise((resolve, reject) => {\n const waiter = (event: ObserverEvent): void => { clearTimeout(timer); resolve(event); };\n const timer = setTimeout(() => {\n const index = this.waiters.indexOf(waiter);\n if (index >= 0) this.waiters.splice(index, 1);\n reject(new Error(\"observer event timeout\"));\n }, timeoutMs);\n this.waiters.push(waiter);\n });\n }\n\n async awaitQuiescence(): Promise<void> {\n await this.callback[observerFlush]?.();\n }\n}\n","import type { AttemptOutcome, AttemptRequest, Transport } from \"../types\";\nimport type { RepostFailureReason } from \"../errors\";\n\ntype FailureCode = \"DNS\" | \"CONNECT\" | \"PROXY\" | \"TLS\" | \"IO\" | \"ATTEMPT_TIMEOUT\";\n\nexport interface RecordedRequest {\n readonly url: string;\n readonly headers: Readonly<Record<string, string>>;\n readonly bodyText: string;\n readonly bodyBytes: Uint8Array;\n readonly attemptNumber: number;\n readonly idempotencyKey: string;\n readonly attemptTimeoutMs: number;\n readonly captureSequence: number;\n}\n\nexport interface ControlledResponse {\n respond(status: number, body: string, headers?: Record<string, string>): void;\n fail(code: FailureCode, options?: { reason?: RepostFailureReason; committed?: boolean }): void;\n readonly isDone: boolean;\n}\n\nexport class ScriptedStubTransport implements Transport {\n private readonly script: Array<(request: AttemptRequest) => Promise<AttemptOutcome>> = [];\n private readonly captured: RecordedRequest[] = [];\n private sequence = 0;\n\n get requests(): readonly RecordedRequest[] { return Object.freeze([...this.captured]); }\n\n enqueueResponse(status: number, body: string, headers: Record<string, string> = {}): this {\n this.script.push(async (request) => responseOutcome(request, status, body, headers));\n return this;\n }\n\n enqueueFailure(\n code: FailureCode,\n options: { reason?: RepostFailureReason; committed?: boolean } = {},\n ): this {\n this.script.push(async (request) => {\n if (options.committed) request.commitTracker.markCommitted();\n return { kind: \"failure\", code, reason: options.reason ?? null, committed: options.committed ?? false };\n });\n return this;\n }\n\n enqueuePending(): ControlledResponse {\n let settle: ((outcome: AttemptOutcome) => void) | undefined;\n let pending: AttemptOutcome | undefined;\n let done = false;\n this.script.push((request) => {\n if (pending) {\n if (pending.kind === \"response\" || pending.committed) request.commitTracker.markCommitted();\n return Promise.resolve(pending);\n }\n return new Promise((resolve) => {\n settle = (outcome) => {\n if (outcome.kind === \"response\" || outcome.committed) request.commitTracker.markCommitted();\n resolve(outcome);\n };\n request.signal.addEventListener(\"abort\", () => {\n if (!done) complete({ kind: \"failure\", code: \"ATTEMPT_TIMEOUT\", reason: null, committed: request.commitTracker.committed });\n }, { once: true });\n });\n });\n const complete = (outcome: AttemptOutcome): void => {\n if (done) return;\n done = true;\n pending = outcome;\n settle?.(outcome);\n };\n return {\n respond(status, body, headers = {}) { complete(responseOutcome(undefined, status, body, headers)); },\n fail(code, options = {}) { complete({ kind: \"failure\", code, reason: options.reason ?? null, committed: options.committed ?? false }); },\n get isDone() { return done; },\n };\n }\n\n async send(request: AttemptRequest): Promise<AttemptOutcome> {\n const next = this.script.shift();\n if (!next) throw new Error(\"script exhausted\");\n this.sequence += 1;\n const headers = Object.fromEntries(request.headers.map(([name, value]) => [name, name.toLowerCase() === \"authorization\" ? \"<redacted>\" : value]));\n this.captured.push(Object.freeze({\n url: request.url,\n headers: Object.freeze(headers),\n bodyText: new TextDecoder().decode(request.bodyBytes),\n bodyBytes: request.bodyBytes.slice(),\n attemptNumber: request.attemptNumber,\n idempotencyKey: headers[\"idempotency-key\"] ?? \"\",\n attemptTimeoutMs: request.attemptTimeoutMs,\n captureSequence: this.sequence,\n }));\n return next(request);\n }\n}\n\nfunction responseOutcome(\n request: AttemptRequest | undefined,\n status: number,\n body: string,\n headers: Record<string, string>,\n): AttemptOutcome {\n request?.commitTracker.markCommitted();\n const bodyBytes = new TextEncoder().encode(body);\n return {\n kind: \"response\",\n status,\n headers: Object.fromEntries(Object.entries(headers).map(([name, value]) => [name.toLowerCase(), [value]])),\n bodyBytes,\n compressedBytes: bodyBytes.length,\n decompressedBytes: bodyBytes.length,\n truncated: false,\n };\n}\n","import type { RepostClientOptions } from \"../types\";\nimport { ManualClock, manualScheduler } from \"./manual-clock\";\nimport { DeterministicRetryEntropy, TestDefaultValueGenerators, TestIdempotencyKeyGenerator } from \"./deterministic\";\nimport { RecordingObserver } from \"./recording-observer\";\nimport { ScriptedStubTransport, type ControlledResponse, type RecordedRequest } from \"./stub-transport\";\n\nexport { ManualClock, manualScheduler };\nexport { DeterministicRetryEntropy, TestDefaultValueGenerators, TestIdempotencyKeyGenerator };\nexport { RecordingObserver };\nexport { ScriptedStubTransport };\nexport type { ControlledResponse, RecordedRequest };\n\nexport function deterministicClientOptions(overrides: Partial<RepostClientOptions> = {}): {\n options: RepostClientOptions;\n transport: ScriptedStubTransport;\n observer: RecordingObserver;\n clock: ManualClock;\n} {\n const transport = new ScriptedStubTransport();\n const observer = new RecordingObserver();\n const clock = new ManualClock();\n return {\n transport,\n observer,\n clock,\n options: {\n apiKey: \"test-key\",\n transport,\n observer: observer.callback,\n generators: TestDefaultValueGenerators.fixed(\n \"2026-01-01T00:00:00.000Z\",\n \"00000000-0000-4000-8000-000000000000\",\n \"ck0nf0rm4nc3f1x3dcu1d000\",\n ),\n idempotencyKeyGenerator: TestIdempotencyKeyGenerator.fixed(\"idem_test\"),\n retryEntropy: DeterministicRetryEntropy.zero(),\n monotonicClock: clock.monotonic,\n wallClock: clock.wall,\n scheduler: manualScheduler(clock),\n ...overrides,\n },\n };\n}\n"],"names":[],"mappings":";;MAUa,WAAW,CAAA;AAAxB,IAAA,WAAA,GAAA;QACU,IAAA,CAAA,OAAO,GAAG,CAAC;QACX,IAAA,CAAA,QAAQ,GAAG,CAAC;QACH,IAAA,CAAA,MAAM,GAAkB,EAAE;AAElC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAc,IAAI,CAAC,OAAO;AACtC,QAAA,IAAA,CAAA,IAAI,GAAG,MAAc,IAAI,CAAC,OAAO;IA0C5C;IAzCE,IAAI,KAAK,KAAa,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IAE3C,MAAM,OAAO,CAAC,EAAU,EAAA;QACtB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC;AAAE,YAAA,MAAM,IAAI,UAAU,CAAC,4CAA4C,CAAC;AACtG,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,GAAG,EAAE;QAChC,OAAO,IAAI,EAAE;AACX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CAC3B;AACD,YAAA,uBAAuB,EAAE,2BAA2B,CAAC,KAAK,CAAC,WAAW,CAAC;AACvE,YAAA,YAAY,EAAE,yBAAyB,CAAC,IAAI,EAAE;YAC9C,cAAc,EAAE,KAAK,CAAC,SAAS;YAC/B,SAAS,EAAE,KAAK,CAAC,IAAI;AACrB,YAAA,SAAS,EAAE,eAAe,CAAC,KAAK,CAAC;AACjC,YAAA,GAAG,SAAS;AACb,SAAA;KACF;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-Dp5vd2nu.mjs","sources":["../../../src/version.ts"],"sourcesContent":["/** Package version embedded in runtime identifiers and telemetry instruments. */\nexport const PACKAGE_VERSION = \"0.4.0\";\n"],"names":[],"mappings":"AAAA;AACO,MAAM,eAAe,GAAG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @repost/client — type stub
|
|
1
|
+
// @repost/client — type stub. The typed surface (model
|
|
2
2
|
// interfaces, enums, the Webhooks tree, createRepostClient) lives in the
|
|
3
3
|
// generated package's index.d.ts, written by `repost schema generate`.
|
|
4
4
|
export * from ".repost/client/default";
|
package/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
// @repost/client — entry stub
|
|
1
|
+
// @repost/client — entry stub. The real client is
|
|
2
2
|
// generated into the sibling `.repost/client` package by `repost schema
|
|
3
|
-
// generate`; this static spread re-export
|
|
4
|
-
//
|
|
3
|
+
// generate`; this static spread re-export lets cjs-module-lexer follow the
|
|
4
|
+
// chain, so ESM
|
|
5
5
|
// consumers get named exports end to end. Keep it a single static expression —
|
|
6
6
|
// wrapping the require in try/catch would break that detection; the friendly
|
|
7
7
|
// before-generate error comes from the postinstall placeholder instead.
|
|
8
8
|
"use strict";
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
// https://github.com/prisma/prisma/pull/12907
|
|
12
11
|
...require(".repost/client/default"),
|
|
13
12
|
};
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @repost/client — ESM entry stub
|
|
1
|
+
// @repost/client — ESM entry stub. ESM cannot resolve
|
|
2
2
|
// the bare `.repost/client` specifier (a leading dot means a relative path
|
|
3
3
|
// there), so this re-exports the CJS stub; named exports survive through
|
|
4
4
|
// Node's CJS interop, which follows the spread-require chain into the
|
package/otel/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../dist/cjs/types/otel/index";
|
package/otel/index.js
ADDED
package/otel/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../dist/esm/otel/index.mjs";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repost/client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Type-safe webhook publishing generated from your Repost schema, with serialization, idempotent retries, and Standard Webhooks envelopes.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
@@ -18,11 +18,25 @@
|
|
|
18
18
|
"import": "./runtime/index.mjs",
|
|
19
19
|
"default": "./runtime/index.mjs"
|
|
20
20
|
},
|
|
21
|
+
"./otel": {
|
|
22
|
+
"types": "./otel/index.d.ts",
|
|
23
|
+
"require": "./otel/index.js",
|
|
24
|
+
"import": "./otel/index.mjs",
|
|
25
|
+
"default": "./otel/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./testing": {
|
|
28
|
+
"types": "./testing/index.d.ts",
|
|
29
|
+
"require": "./testing/index.js",
|
|
30
|
+
"import": "./testing/index.mjs",
|
|
31
|
+
"default": "./testing/index.mjs"
|
|
32
|
+
},
|
|
21
33
|
"./package.json": "./package.json"
|
|
22
34
|
},
|
|
23
35
|
"files": [
|
|
24
36
|
"dist",
|
|
25
37
|
"runtime",
|
|
38
|
+
"otel",
|
|
39
|
+
"testing",
|
|
26
40
|
"index.js",
|
|
27
41
|
"index.mjs",
|
|
28
42
|
"index.d.ts",
|
|
@@ -32,24 +46,40 @@
|
|
|
32
46
|
"engines": {
|
|
33
47
|
"node": ">=20"
|
|
34
48
|
},
|
|
49
|
+
"homepage": "https://repost.sh",
|
|
35
50
|
"repository": {
|
|
36
51
|
"type": "git",
|
|
37
52
|
"url": "git+https://github.com/repost-sh/monorepo.git",
|
|
38
|
-
"directory": "
|
|
53
|
+
"directory": "sdk/typescript"
|
|
54
|
+
},
|
|
55
|
+
"bugs": {
|
|
56
|
+
"url": "https://github.com/repost-sh/monorepo/issues",
|
|
57
|
+
"email": "hello@repost.sh"
|
|
39
58
|
},
|
|
40
59
|
"publishConfig": {
|
|
41
60
|
"access": "public"
|
|
42
61
|
},
|
|
43
62
|
"dependencies": {
|
|
44
|
-
"@paralleldrive/cuid2": "^2.2.2"
|
|
63
|
+
"@paralleldrive/cuid2": "^2.2.2",
|
|
64
|
+
"undici": "~7.28.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"@opentelemetry/api": "^1.9.1"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@opentelemetry/api": {
|
|
71
|
+
"optional": true
|
|
72
|
+
}
|
|
45
73
|
},
|
|
46
74
|
"devDependencies": {
|
|
47
|
-
"@
|
|
75
|
+
"@opentelemetry/api": "^1.9.1",
|
|
76
|
+
"@opentelemetry/core": "^2.9.0",
|
|
77
|
+
"@opentelemetry/sdk-metrics": "^2.9.0",
|
|
78
|
+
"@opentelemetry/sdk-trace-base": "^2.9.0",
|
|
48
79
|
"@rollup/plugin-commonjs": "26.0.1",
|
|
49
80
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
50
81
|
"@rollup/plugin-typescript": "11.1.6",
|
|
51
82
|
"@types/node": "^22.18.8",
|
|
52
|
-
"prisma": "^7.1.0",
|
|
53
83
|
"rollup": "4.52.4",
|
|
54
84
|
"typescript": "5.9.3",
|
|
55
85
|
"vitest": "^3.0.0"
|
|
@@ -58,9 +88,8 @@
|
|
|
58
88
|
"build": "rollup -c",
|
|
59
89
|
"dev": "rollup -c -w",
|
|
60
90
|
"postinstall": "node scripts/postinstall.js",
|
|
61
|
-
"check-types": "tsc --noEmit",
|
|
62
91
|
"typecheck": "tsc --noEmit",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
92
|
+
"test": "vitest run",
|
|
93
|
+
"check:goldens": "tsc -p tsconfig.goldens.json"
|
|
65
94
|
}
|
|
66
95
|
}
|
package/runtime/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @repost/client/runtime — literal-path type entry
|
|
1
|
+
// @repost/client/runtime — literal-path type entry, so
|
|
2
2
|
// the generated client's `import ... from "@repost/client/runtime"` resolves
|
|
3
3
|
// under `node10` module resolution too (which ignores `exports` maps).
|
|
4
4
|
export * from "../dist/cjs/types/index";
|
package/runtime/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// @repost/client/runtime — literal-path entry
|
|
1
|
+
// @repost/client/runtime — literal-path entry. The
|
|
2
2
|
// `exports` map serves modern resolvers, but `node10` module resolution (plain
|
|
3
3
|
// `tsc` with no tsconfig, older tooling) ignores it and resolves this real
|
|
4
|
-
// file instead
|
|
4
|
+
// file instead.
|
|
5
5
|
"use strict";
|
|
6
6
|
|
|
7
7
|
module.exports = require("../dist/cjs/index.cjs");
|
package/runtime/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// @repost/client/runtime — literal-path ESM entry
|
|
1
|
+
// @repost/client/runtime — literal-path ESM entry.
|
|
2
2
|
export * from "../dist/esm/index.mjs";
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Before-generate DX
|
|
3
|
-
//
|
|
2
|
+
// Before-generate DX: on install, when nothing has been
|
|
3
|
+
// generated yet, write a placeholder
|
|
4
4
|
// `.repost/client` whose entry throws a friendly "run repost schema generate"
|
|
5
5
|
// error instead of a raw MODULE_NOT_FOUND. `repost schema generate` writes the
|
|
6
6
|
// real package over the placeholder. Outside a real `node_modules` install
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../dist/cjs/types/testing/index";
|
package/testing/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../dist/esm/testing/index.mjs";
|