@shiprev/server-sdk-node 0.0.0-stage → 0.1.0-beta.1
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 +202 -0
- package/README.md +276 -2
- package/dist/auth/token-verifier.d.ts +56 -0
- package/dist/auth/token-verifier.js +257 -0
- package/dist/client/connection-supervisor.d.ts +148 -0
- package/dist/client/connection-supervisor.js +650 -0
- package/dist/client/shiprev-client.d.ts +139 -0
- package/dist/client/shiprev-client.js +400 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +47 -0
- package/dist/metering/backlog/host-adapter-backlog.d.ts +10 -0
- package/dist/metering/backlog/host-adapter-backlog.js +27 -0
- package/dist/metering/backlog/journal-backlog.d.ts +14 -0
- package/dist/metering/backlog/journal-backlog.js +135 -0
- package/dist/metering/backlog/memory-backlog.d.ts +9 -0
- package/dist/metering/backlog/memory-backlog.js +34 -0
- package/dist/metering/usage-buffer.d.ts +59 -0
- package/dist/metering/usage-buffer.js +175 -0
- package/dist/mirror/degradation.d.ts +22 -0
- package/dist/mirror/degradation.js +67 -0
- package/dist/mirror/entitlement-mirror.d.ts +61 -0
- package/dist/mirror/entitlement-mirror.js +143 -0
- package/dist/nest/decorators.d.ts +15 -0
- package/dist/nest/decorators.js +21 -0
- package/dist/nest/index.d.ts +4 -0
- package/dist/nest/index.js +21 -0
- package/dist/nest/shiprev-auth.guard.d.ts +7 -0
- package/dist/nest/shiprev-auth.guard.js +52 -0
- package/dist/nest/shiprev-capability.guard.d.ts +9 -0
- package/dist/nest/shiprev-capability.guard.js +65 -0
- package/dist/nest/shiprev.module.d.ts +17 -0
- package/dist/nest/shiprev.module.js +57 -0
- package/dist/ruling/adjudicator.d.ts +15 -0
- package/dist/ruling/adjudicator.js +123 -0
- package/dist/transport/event-stream.d.ts +27 -0
- package/dist/transport/event-stream.js +92 -0
- package/dist/transport/http.transport.d.ts +69 -0
- package/dist/transport/http.transport.js +238 -0
- package/dist/transport/wire.d.ts +79 -0
- package/dist/transport/wire.js +8 -0
- package/dist/types.d.ts +252 -0
- package/dist/types.js +37 -0
- package/dist/util/decimal.d.ts +14 -0
- package/dist/util/decimal.js +57 -0
- package/package.json +96 -3
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
export type RulingSource = 'realtime' | 'authoritative' | 'degraded' | 'client_default';
|
|
2
|
+
export interface Ruling {
|
|
3
|
+
allowed: boolean;
|
|
4
|
+
remaining?: number;
|
|
5
|
+
limit?: number;
|
|
6
|
+
source: RulingSource;
|
|
7
|
+
reason?: 'disconnected_write' | 'invalid_request' | string;
|
|
8
|
+
adjudicated_at: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AdjudicateOptions {
|
|
11
|
+
organization_id: string;
|
|
12
|
+
capability_key: string;
|
|
13
|
+
quantity?: number;
|
|
14
|
+
operation: 'read' | 'write';
|
|
15
|
+
}
|
|
16
|
+
export interface TokenClaims {
|
|
17
|
+
account_id: string;
|
|
18
|
+
organization_id: string;
|
|
19
|
+
project_id: string;
|
|
20
|
+
tenant_id: string;
|
|
21
|
+
key_version: number;
|
|
22
|
+
scope: string;
|
|
23
|
+
exp: number;
|
|
24
|
+
iat?: number;
|
|
25
|
+
iss?: string;
|
|
26
|
+
sub?: string;
|
|
27
|
+
aud?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Overage policy of a capability, as the service reports it. Unknown future values are kept as
|
|
31
|
+
* strings and treated like BLOCK by local rulings.
|
|
32
|
+
*/
|
|
33
|
+
export type OveragePolicy = 'BLOCK' | 'ALLOW_AND_BILL' | 'PROMPT_UPGRADE' | (string & {});
|
|
34
|
+
/**
|
|
35
|
+
* One capability of an organization's snapshot, as served by `GET /sdk/v1/entitlements/snapshot`.
|
|
36
|
+
* Quantities are fixed-point decimal strings (e.g. "10.000000"), never floating point.
|
|
37
|
+
*/
|
|
38
|
+
export interface SnapshotItem {
|
|
39
|
+
capability_key: string;
|
|
40
|
+
allowance: string;
|
|
41
|
+
used: string;
|
|
42
|
+
remaining: string;
|
|
43
|
+
overage_policy: OveragePolicy;
|
|
44
|
+
starts_at?: string;
|
|
45
|
+
ends_at?: string;
|
|
46
|
+
reset_interval?: string;
|
|
47
|
+
billing_interval?: string;
|
|
48
|
+
}
|
|
49
|
+
/** One buyer organization inside the application snapshot. */
|
|
50
|
+
export interface OrganizationSnapshot {
|
|
51
|
+
revision: number;
|
|
52
|
+
wallet_balance: string;
|
|
53
|
+
/**
|
|
54
|
+
* Credits the wallet may go below zero by for ALLOW_AND_BILL capabilities. Informational: the mirror never widens
|
|
55
|
+
* a local ruling with it; beyond the allowance the service decides. Absent on instances that predate it.
|
|
56
|
+
*/
|
|
57
|
+
overdraft_limit?: string;
|
|
58
|
+
items: Record<string, SnapshotItem>;
|
|
59
|
+
/**
|
|
60
|
+
* Degradation level the instance computed for the organization. Instances that predate it leave it out; a
|
|
61
|
+
* value outside `DegradationLevel` is read as `RESTRICT_USAGE`.
|
|
62
|
+
*/
|
|
63
|
+
degradation_level?: string;
|
|
64
|
+
/** ISO 8601 time until which this entry may be used without a newer answer. */
|
|
65
|
+
valid_until?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Degradation level of a buyer organization, strictly increasing: `RESTRICT_NEW` blocks new commercial objects,
|
|
69
|
+
* `RESTRICT_USAGE` every write, `RESTRICT_READ` end-user reads too, and `SUSPENDED` is an explicit "no
|
|
70
|
+
* entitlement". Computed by the instance; a client only enforces it.
|
|
71
|
+
*/
|
|
72
|
+
export type DegradationLevel = 'NONE' | 'RESTRICT_NEW' | 'RESTRICT_USAGE' | 'RESTRICT_READ' | 'SUSPENDED';
|
|
73
|
+
/**
|
|
74
|
+
* The level to act on for one organization, combined from the mirror entry and what the client observes:
|
|
75
|
+
* `source: 'answer'` while the instance answers (online, or a pull of the organization just succeeded);
|
|
76
|
+
* `'degraded'` when acting on the mirror without an answer, with `expired` once the entry's `valid_until` has
|
|
77
|
+
* passed (the level is then at least `RESTRICT_USAGE`).
|
|
78
|
+
*/
|
|
79
|
+
export interface EffectiveLevel {
|
|
80
|
+
level: DegradationLevel;
|
|
81
|
+
source: 'answer' | 'degraded';
|
|
82
|
+
expired: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** One usage event for `sendUsage()`. The quantity may be a decimal string, sent as it is. */
|
|
85
|
+
export interface UsageSendEvent {
|
|
86
|
+
usage_event_id: string;
|
|
87
|
+
organization_id: string;
|
|
88
|
+
capability_key: string;
|
|
89
|
+
quantity: number | string;
|
|
90
|
+
occurred_at: string;
|
|
91
|
+
properties?: Record<string, unknown>;
|
|
92
|
+
}
|
|
93
|
+
/** What the instance did with a batch sent by `sendUsage()`. */
|
|
94
|
+
export interface UsageSendResult {
|
|
95
|
+
accepted_count: number;
|
|
96
|
+
duplicates_dropped: number;
|
|
97
|
+
rejected: Array<{
|
|
98
|
+
usage_event_id: string;
|
|
99
|
+
reason: string;
|
|
100
|
+
}>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Application-level entitlement snapshot envelope served by `GET /sdk/v1/entitlements/snapshot`:
|
|
104
|
+
* every buyer organization of the application, keyed by organization ID.
|
|
105
|
+
*/
|
|
106
|
+
export interface Snapshot {
|
|
107
|
+
project_id: string;
|
|
108
|
+
schema_version: number;
|
|
109
|
+
generated_at: string;
|
|
110
|
+
organizations: Record<string, OrganizationSnapshot>;
|
|
111
|
+
}
|
|
112
|
+
export interface ClientPresets {
|
|
113
|
+
cold_start?: 'allow' | 'deny';
|
|
114
|
+
connect_timeout_ms?: number;
|
|
115
|
+
reservation_ttl_s?: number;
|
|
116
|
+
}
|
|
117
|
+
export interface BacklogItem {
|
|
118
|
+
id: string;
|
|
119
|
+
event: UsageEventItem;
|
|
120
|
+
enqueued_at: number;
|
|
121
|
+
attempts: number;
|
|
122
|
+
}
|
|
123
|
+
export interface BacklogAdapter {
|
|
124
|
+
enqueue(event: UsageEventItem): Promise<void>;
|
|
125
|
+
peek(limit: number): Promise<BacklogItem[]>;
|
|
126
|
+
ack(ids: string[]): Promise<void>;
|
|
127
|
+
nack(ids: string[]): Promise<void>;
|
|
128
|
+
size(): Promise<number>;
|
|
129
|
+
}
|
|
130
|
+
export interface BacklogConfig {
|
|
131
|
+
mode?: 'memory' | 'host_adapter' | 'journal';
|
|
132
|
+
journal_path?: string;
|
|
133
|
+
adapter?: BacklogAdapter;
|
|
134
|
+
max_attempts?: number;
|
|
135
|
+
}
|
|
136
|
+
export interface UsageBufferConfig {
|
|
137
|
+
batch_size?: number;
|
|
138
|
+
flush_interval_ms?: number;
|
|
139
|
+
}
|
|
140
|
+
export interface UsageEventItem {
|
|
141
|
+
usage_event_id: string;
|
|
142
|
+
organization_id: string;
|
|
143
|
+
capability_key: string;
|
|
144
|
+
quantity: number;
|
|
145
|
+
occurred_at: string;
|
|
146
|
+
idempotency_key?: string;
|
|
147
|
+
properties?: Record<string, unknown>;
|
|
148
|
+
}
|
|
149
|
+
export interface RejectedEvent {
|
|
150
|
+
usage_event_id: string;
|
|
151
|
+
reason: string;
|
|
152
|
+
}
|
|
153
|
+
export interface UsageEventsResponse {
|
|
154
|
+
accepted: number;
|
|
155
|
+
duplicates_dropped: number;
|
|
156
|
+
rejected: RejectedEvent[];
|
|
157
|
+
}
|
|
158
|
+
export interface ReserveOptions {
|
|
159
|
+
organization_id: string;
|
|
160
|
+
capability_key: string;
|
|
161
|
+
amount: number;
|
|
162
|
+
idempotency_key?: string;
|
|
163
|
+
ttl_seconds?: number;
|
|
164
|
+
}
|
|
165
|
+
export interface ReservationResult {
|
|
166
|
+
reservation_id: string;
|
|
167
|
+
status: 'RESERVED' | 'CONFIRMED' | 'RELEASED';
|
|
168
|
+
expires_at: string;
|
|
169
|
+
}
|
|
170
|
+
export interface ConfirmReservationResult {
|
|
171
|
+
reservation_id: string;
|
|
172
|
+
status: 'CONFIRMED';
|
|
173
|
+
confirmed_amount: number;
|
|
174
|
+
}
|
|
175
|
+
export interface ReleaseReservationResult {
|
|
176
|
+
reservation_id: string;
|
|
177
|
+
status: 'RELEASED';
|
|
178
|
+
}
|
|
179
|
+
export interface AdjudicationLookupRequest {
|
|
180
|
+
organization_id: string;
|
|
181
|
+
capability_key: string;
|
|
182
|
+
quantity?: number;
|
|
183
|
+
operation: 'read' | 'write';
|
|
184
|
+
}
|
|
185
|
+
export interface AdjudicationLookupResponse {
|
|
186
|
+
allowed: boolean;
|
|
187
|
+
remaining?: number;
|
|
188
|
+
limit?: number;
|
|
189
|
+
source: 'authoritative';
|
|
190
|
+
reason?: string;
|
|
191
|
+
}
|
|
192
|
+
export interface ShipRevClientOptions {
|
|
193
|
+
api_key: string;
|
|
194
|
+
base_url: string;
|
|
195
|
+
presets?: ClientPresets;
|
|
196
|
+
buffer?: UsageBufferConfig;
|
|
197
|
+
backlog?: BacklogConfig;
|
|
198
|
+
on_flush_failure?: (events: UsageEventItem[], error: Error) => void;
|
|
199
|
+
on_rejected?: (rejected: RejectedEvent[]) => void;
|
|
200
|
+
/**
|
|
201
|
+
* Called when the effective level of an organization changes: a new entry, the connection going up or down,
|
|
202
|
+
* or an entry's `valid_until` passing while disconnected. Never called for an organization the mirror does
|
|
203
|
+
* not hold.
|
|
204
|
+
*/
|
|
205
|
+
on_level_change?: (organization_id: string, level: EffectiveLevel) => void;
|
|
206
|
+
}
|
|
207
|
+
export declare class DisconnectedWriteError extends Error {
|
|
208
|
+
readonly reason = "disconnected_write";
|
|
209
|
+
constructor(message?: string);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Thrown by `sendUsage()` when the batch did not reach the instance or the instance failed to process it (a
|
|
213
|
+
* network error, a timeout or a 5xx answer). Nothing in the batch can be assumed delivered; sending it again is
|
|
214
|
+
* safe, as every event carries its idempotency key.
|
|
215
|
+
*/
|
|
216
|
+
export declare class UsageDeliveryError extends Error {
|
|
217
|
+
constructor(message?: string);
|
|
218
|
+
}
|
|
219
|
+
/** Why `verifyToken()` refused a correctly signed, unexpired token. */
|
|
220
|
+
export type TokenRejectionReason =
|
|
221
|
+
/** The client has not obtained a machine token yet, so the expected issuer and application are unknown. */
|
|
222
|
+
'not_ready'
|
|
223
|
+
/** `aud` or `scope` is not `'public'`: not a buyer session token. */
|
|
224
|
+
| 'audience_mismatch'
|
|
225
|
+
/** `iss` differs from the issuer of this client's machine token. */
|
|
226
|
+
| 'issuer_mismatch'
|
|
227
|
+
/** `pid` differs from the application of this client's machine token. */
|
|
228
|
+
| 'project_mismatch'
|
|
229
|
+
/** The token carries a `purpose` claim: a one-time token such as an email verification link. */
|
|
230
|
+
| 'not_a_session_token'
|
|
231
|
+
/** The token has no numeric `exp`. */
|
|
232
|
+
| 'missing_expiry';
|
|
233
|
+
/**
|
|
234
|
+
* Thrown by `verifyToken()` when a token is correctly signed but is not a session token this client
|
|
235
|
+
* accepts. The message names the reason and never contains the token.
|
|
236
|
+
*/
|
|
237
|
+
export declare class TokenRejectedError extends Error {
|
|
238
|
+
readonly reason: TokenRejectionReason;
|
|
239
|
+
constructor(reason: TokenRejectionReason, message?: string);
|
|
240
|
+
}
|
|
241
|
+
export type ClientState = 'COLD' | 'CLAIMED' | 'LIVE' | 'COLD_OFFLINE' | 'DISCONNECTED';
|
|
242
|
+
export interface JwksKey {
|
|
243
|
+
kid: string;
|
|
244
|
+
kty: string;
|
|
245
|
+
alg?: string;
|
|
246
|
+
use?: string;
|
|
247
|
+
n: string;
|
|
248
|
+
e: string;
|
|
249
|
+
}
|
|
250
|
+
export interface JwksResponse {
|
|
251
|
+
keys: JwksKey[];
|
|
252
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenRejectedError = exports.UsageDeliveryError = exports.DisconnectedWriteError = void 0;
|
|
4
|
+
class DisconnectedWriteError extends Error {
|
|
5
|
+
reason = 'disconnected_write';
|
|
6
|
+
constructor(message = 'Write operation denied while client is disconnected') {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'DisconnectedWriteError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.DisconnectedWriteError = DisconnectedWriteError;
|
|
12
|
+
/**
|
|
13
|
+
* Thrown by `sendUsage()` when the batch did not reach the instance or the instance failed to process it (a
|
|
14
|
+
* network error, a timeout or a 5xx answer). Nothing in the batch can be assumed delivered; sending it again is
|
|
15
|
+
* safe, as every event carries its idempotency key.
|
|
16
|
+
*/
|
|
17
|
+
class UsageDeliveryError extends Error {
|
|
18
|
+
constructor(message = 'Usage events could not be delivered') {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'UsageDeliveryError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.UsageDeliveryError = UsageDeliveryError;
|
|
24
|
+
/**
|
|
25
|
+
* Thrown by `verifyToken()` when a token is correctly signed but is not a session token this client
|
|
26
|
+
* accepts. The message names the reason and never contains the token.
|
|
27
|
+
*/
|
|
28
|
+
class TokenRejectedError extends Error {
|
|
29
|
+
reason;
|
|
30
|
+
constructor(reason, message = `Token rejected: ${reason}`) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.name = 'TokenRejectedError';
|
|
33
|
+
this.reason = reason;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.TokenRejectedError = TokenRejectedError;
|
|
37
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact helpers for the fixed-point decimal strings the service uses for quantities and amounts.
|
|
3
|
+
* Public SDK types carry numbers; these helpers convert at the wire boundary and compare
|
|
4
|
+
* decimal strings without going through floating point.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Converts a finite number to a plain decimal string (no exponent), e.g. 3 -> "3", 1e-7 -> "0.0000001".
|
|
8
|
+
* Throws RangeError for NaN or infinite values.
|
|
9
|
+
*/
|
|
10
|
+
export declare function toDecimalString(value: number): string;
|
|
11
|
+
/** Compares two decimal strings exactly: negative when a < b, zero when equal, positive when a > b. */
|
|
12
|
+
export declare function compareDecimal(a: string, b: string): number;
|
|
13
|
+
/** Reads a decimal string from the wire into the number used by public SDK types. */
|
|
14
|
+
export declare function decimalToNumber(value: string | null | undefined): number | undefined;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Exact helpers for the fixed-point decimal strings the service uses for quantities and amounts.
|
|
4
|
+
* Public SDK types carry numbers; these helpers convert at the wire boundary and compare
|
|
5
|
+
* decimal strings without going through floating point.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.toDecimalString = toDecimalString;
|
|
9
|
+
exports.compareDecimal = compareDecimal;
|
|
10
|
+
exports.decimalToNumber = decimalToNumber;
|
|
11
|
+
const DECIMAL_PATTERN = /^(-)?(\d+)(?:\.(\d+))?$/;
|
|
12
|
+
/**
|
|
13
|
+
* Converts a finite number to a plain decimal string (no exponent), e.g. 3 -> "3", 1e-7 -> "0.0000001".
|
|
14
|
+
* Throws RangeError for NaN or infinite values.
|
|
15
|
+
*/
|
|
16
|
+
function toDecimalString(value) {
|
|
17
|
+
if (!Number.isFinite(value)) {
|
|
18
|
+
throw new RangeError(`Quantity must be a finite number, got ${value}`);
|
|
19
|
+
}
|
|
20
|
+
const text = String(value);
|
|
21
|
+
if (!/e/i.test(text)) {
|
|
22
|
+
return text;
|
|
23
|
+
}
|
|
24
|
+
// Exponent notation: expand through toFixed and drop trailing zeros.
|
|
25
|
+
const fixed = Math.abs(value) >= 1 ? BigInt(Math.trunc(value)).toString() : value.toFixed(20);
|
|
26
|
+
return fixed.includes('.') ? fixed.replace(/0+$/, '').replace(/\.$/, '') : fixed;
|
|
27
|
+
}
|
|
28
|
+
function parse(value) {
|
|
29
|
+
const match = DECIMAL_PATTERN.exec(value.trim());
|
|
30
|
+
if (!match) {
|
|
31
|
+
throw new RangeError(`Not a decimal string: ${value}`);
|
|
32
|
+
}
|
|
33
|
+
const fraction = match[3] ?? '';
|
|
34
|
+
return {
|
|
35
|
+
negative: match[1] === '-',
|
|
36
|
+
digits: BigInt(`${match[2]}${fraction}`),
|
|
37
|
+
scale: fraction.length,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Compares two decimal strings exactly: negative when a < b, zero when equal, positive when a > b. */
|
|
41
|
+
function compareDecimal(a, b) {
|
|
42
|
+
const pa = parse(a);
|
|
43
|
+
const pb = parse(b);
|
|
44
|
+
const scale = Math.max(pa.scale, pb.scale);
|
|
45
|
+
const va = (pa.negative ? -1n : 1n) * pa.digits * 10n ** BigInt(scale - pa.scale);
|
|
46
|
+
const vb = (pb.negative ? -1n : 1n) * pb.digits * 10n ** BigInt(scale - pb.scale);
|
|
47
|
+
return va < vb ? -1 : va > vb ? 1 : 0;
|
|
48
|
+
}
|
|
49
|
+
/** Reads a decimal string from the wire into the number used by public SDK types. */
|
|
50
|
+
function decimalToNumber(value) {
|
|
51
|
+
if (value === null || value === undefined) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const parsed = Number(value);
|
|
55
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=decimal.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,99 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shiprev/server-sdk-node",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
4
|
+
"description": "Server SDK for Node.js and NestJS services: token verification, local entitlement rulings, usage reporting, and two-phase reservations against a ShipRev instance.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"shiprev",
|
|
7
|
+
"entitlements",
|
|
8
|
+
"metering",
|
|
9
|
+
"usage-based-billing",
|
|
10
|
+
"nestjs",
|
|
11
|
+
"sdk"
|
|
12
|
+
],
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=20.0.0"
|
|
16
|
+
},
|
|
17
|
+
"main": "dist/index.js",
|
|
18
|
+
"types": "dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./nest": {
|
|
25
|
+
"types": "./dist/nest/index.d.ts",
|
|
26
|
+
"default": "./dist/nest/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"typesVersions": {
|
|
31
|
+
"*": {
|
|
32
|
+
"nest": [
|
|
33
|
+
"./dist/nest/index.d.ts"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"!dist/**/*.map"
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"tag": "beta"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@nestjs/common": "^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
47
|
+
"@nestjs/core": "^9.0.0 || ^10.0.0 || ^11.0.0",
|
|
48
|
+
"reflect-metadata": "^0.1.13 || ^0.2.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependenciesMeta": {
|
|
51
|
+
"@nestjs/common": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"@nestjs/core": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"reflect-metadata": {
|
|
58
|
+
"optional": true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@nestjs/common": "^11.0.1",
|
|
63
|
+
"@nestjs/core": "^11.1.12",
|
|
64
|
+
"@types/jest": "^29.5.14",
|
|
65
|
+
"@types/node": "^22.10.7",
|
|
66
|
+
"eslint": "^9.18.0",
|
|
67
|
+
"eslint-plugin-prettier": "^5.2.2",
|
|
68
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
69
|
+
"globals": "^16.0.0",
|
|
70
|
+
"jest": "^29.7.0",
|
|
71
|
+
"prettier": "^3.0.0",
|
|
72
|
+
"reflect-metadata": "^0.2.2",
|
|
73
|
+
"rxjs": "^7.8.1",
|
|
74
|
+
"ts-jest": "^29.2.5",
|
|
75
|
+
"typescript": "^5.7.3",
|
|
76
|
+
"typescript-eslint": "^8.20.0"
|
|
77
|
+
},
|
|
78
|
+
"jest": {
|
|
79
|
+
"moduleFileExtensions": [
|
|
80
|
+
"js",
|
|
81
|
+
"json",
|
|
82
|
+
"ts"
|
|
83
|
+
],
|
|
84
|
+
"rootDir": "src",
|
|
85
|
+
"testRegex": ".*\\.spec\\.ts$",
|
|
86
|
+
"transform": {
|
|
87
|
+
"^.+\\.ts$": "ts-jest"
|
|
88
|
+
},
|
|
89
|
+
"testEnvironment": "node"
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
93
|
+
"build": "tsc -p tsconfig.build.json",
|
|
94
|
+
"test": "jest",
|
|
95
|
+
"test:nest9": "node scripts/test-nest9.mjs",
|
|
96
|
+
"lint": "eslint \"src/**/*.ts\"",
|
|
97
|
+
"format": "prettier --write \"src/**/*.ts\""
|
|
98
|
+
}
|
|
6
99
|
}
|