@nexussdk/contracts 0.0.1 → 0.0.4
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 +32 -0
- package/dist/auth.cjs +1 -4
- package/dist/auth.mjs +0 -3
- package/dist/flags.cjs +1 -4
- package/dist/flags.mjs +0 -3
- package/dist/index.cjs +2 -8
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2 -6
- package/dist/rfc7807.cjs +2 -8
- package/dist/rfc7807.mjs +2 -6
- package/dist/tracker.cjs +1 -4
- package/dist/tracker.d.mts +144 -1
- package/dist/tracker.d.ts +144 -1
- package/dist/tracker.mjs +0 -3
- package/package.json +29 -1
- package/.turbo/turbo-build.log +0 -52
- package/dist/auth.cjs.map +0 -1
- package/dist/auth.mjs.map +0 -1
- package/dist/flags.cjs.map +0 -1
- package/dist/flags.mjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/rfc7807.cjs.map +0 -1
- package/dist/rfc7807.mjs.map +0 -1
- package/dist/tracker.cjs.map +0 -1
- package/dist/tracker.mjs.map +0 -1
- package/src/auth.ts +0 -224
- package/src/flags.ts +0 -255
- package/src/index.ts +0 -12
- package/src/rfc7807.ts +0 -76
- package/src/tracker.ts +0 -205
- package/tsconfig.json +0 -8
- package/tsup.config.ts +0 -17
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @nexussdk/contracts
|
|
2
|
+
|
|
3
|
+
Single Source of Truth (SSOT) data contracts and TypeScript interfaces for the **Nexus Platform** ecosystem.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@nexussdk/contracts)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @nexussdk/contracts
|
|
14
|
+
# or
|
|
15
|
+
pnpm add @nexussdk/contracts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Exports
|
|
21
|
+
|
|
22
|
+
- `@nexussdk/contracts`: Root unified types
|
|
23
|
+
- `@nexussdk/contracts/flags`: Feature flag, evaluation rule, and rollout segment definitions
|
|
24
|
+
- `@nexussdk/contracts/tracker`: Telemetry event, breadcrumb, and exception payload interfaces
|
|
25
|
+
- `@nexussdk/contracts/auth`: Client key and environment metadata definitions
|
|
26
|
+
- `@nexussdk/contracts/rfc7807`: Problem Details standard error structures
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT © [Nexus Platform](https://github.com/Huynhdung295/NexusSDK)
|
package/dist/auth.cjs
CHANGED
package/dist/auth.mjs
CHANGED
package/dist/flags.cjs
CHANGED
package/dist/flags.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/rfc7807.ts
|
|
4
|
-
var NEXUS_ERROR_BASE = "https://nexus.dev/errors";
|
|
5
|
-
|
|
6
|
-
exports.NEXUS_ERROR_BASE = NEXUS_ERROR_BASE;
|
|
7
|
-
//# sourceMappingURL=index.cjs.map
|
|
8
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
'use strict';var t="https://nexus.dev/errors";
|
|
2
|
+
exports.NEXUS_ERROR_BASE=t;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Account, AccountStatus, ApiKey, ApiKeyType, Environment, GeneratedApiKeyResponse, LoginDto, PlanTier, Project, RegisterAccountDto, SessionPayload } from './auth.mjs';
|
|
2
2
|
export { BatchFlagEvaluation, CreateFlagDto, FeatureFlag, FlagEvaluationResult, FlagStreamEvent, FlagVariants, RuleOperator, TargetingRule, UpdateFlagDto, UserContext, VariantValue } from './flags.mjs';
|
|
3
|
-
export { Breadcrumb, BreadcrumbCategory, DeviceContext, ErrorEventEntity, ErrorEventPayload, ErrorGroupSummary, SeverityLevel, StackFrame } from './tracker.mjs';
|
|
3
|
+
export { Breadcrumb, BreadcrumbCategory, DevServerEventEnvelope, DeviceContext, ErrorEventEntity, ErrorEventPayload, ErrorGroupSummary, NexusErrorInfo, PerformanceVitalEntry, PerformanceVitalsOptions, SamplingConfig, SeverityLevel, StackFrame, TransportPlugin, VitalMetricName } from './tracker.mjs';
|
|
4
4
|
export { NEXUS_ERROR_BASE, ProblemDetails } from './rfc7807.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Account, AccountStatus, ApiKey, ApiKeyType, Environment, GeneratedApiKeyResponse, LoginDto, PlanTier, Project, RegisterAccountDto, SessionPayload } from './auth.js';
|
|
2
2
|
export { BatchFlagEvaluation, CreateFlagDto, FeatureFlag, FlagEvaluationResult, FlagStreamEvent, FlagVariants, RuleOperator, TargetingRule, UpdateFlagDto, UserContext, VariantValue } from './flags.js';
|
|
3
|
-
export { Breadcrumb, BreadcrumbCategory, DeviceContext, ErrorEventEntity, ErrorEventPayload, ErrorGroupSummary, SeverityLevel, StackFrame } from './tracker.js';
|
|
3
|
+
export { Breadcrumb, BreadcrumbCategory, DevServerEventEnvelope, DeviceContext, ErrorEventEntity, ErrorEventPayload, ErrorGroupSummary, NexusErrorInfo, PerformanceVitalEntry, PerformanceVitalsOptions, SamplingConfig, SeverityLevel, StackFrame, TransportPlugin, VitalMetricName } from './tracker.js';
|
|
4
4
|
export { NEXUS_ERROR_BASE, ProblemDetails } from './rfc7807.js';
|
package/dist/index.mjs
CHANGED
package/dist/rfc7807.cjs
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/rfc7807.ts
|
|
4
|
-
var NEXUS_ERROR_BASE = "https://nexus.dev/errors";
|
|
5
|
-
|
|
6
|
-
exports.NEXUS_ERROR_BASE = NEXUS_ERROR_BASE;
|
|
7
|
-
//# sourceMappingURL=rfc7807.cjs.map
|
|
8
|
-
//# sourceMappingURL=rfc7807.cjs.map
|
|
1
|
+
'use strict';var t="https://nexus.dev/errors";
|
|
2
|
+
exports.NEXUS_ERROR_BASE=t;
|
package/dist/rfc7807.mjs
CHANGED
package/dist/tracker.cjs
CHANGED
package/dist/tracker.d.mts
CHANGED
|
@@ -194,4 +194,147 @@ interface ErrorGroupSummary {
|
|
|
194
194
|
lastSeenAt: string;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Normalized error information passed to NexusGuard fallback render function.
|
|
199
|
+
* Framework-agnostic — used by React, Vue, and Vanilla integrations.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* // React render prop
|
|
203
|
+
* <NexusGuard fallback={({ error, errorId, reset }) => (
|
|
204
|
+
* <div>Error #{errorId}: {error.message} <button onClick={reset}>Retry</button></div>
|
|
205
|
+
* )}>
|
|
206
|
+
* <App />
|
|
207
|
+
* </NexusGuard>
|
|
208
|
+
*/
|
|
209
|
+
interface NexusErrorInfo {
|
|
210
|
+
/** The original Error object that triggered the boundary. */
|
|
211
|
+
error: Error;
|
|
212
|
+
/**
|
|
213
|
+
* Deterministic fingerprint ID for this error class.
|
|
214
|
+
* Can be shown to users as a support reference code.
|
|
215
|
+
*/
|
|
216
|
+
errorId: string;
|
|
217
|
+
/** Resets the error boundary back to normal rendering state. */
|
|
218
|
+
reset: () => void;
|
|
219
|
+
/** Component stack trace (React/Vue only — undefined in Vanilla). */
|
|
220
|
+
componentStack?: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Custom transport plugin for SDK error event delivery.
|
|
224
|
+
* Allows complete replacement of the default fetch-based ingestion transport.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* // Custom Sentry forwarding transport
|
|
228
|
+
* const sentryTransport: TransportPlugin = async (event) => {
|
|
229
|
+
* Sentry.captureException(new Error(event.errorMessage));
|
|
230
|
+
* };
|
|
231
|
+
*
|
|
232
|
+
* Nexus.init({ transport: sentryTransport });
|
|
233
|
+
*/
|
|
234
|
+
type TransportPlugin = 'fetch' | 'console' | 'localStorage' | ((event: ErrorEventPayload) => void | Promise<void>);
|
|
235
|
+
/**
|
|
236
|
+
* Client-side event sampling and rate limiting configuration.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* Nexus.init({
|
|
240
|
+
* sampling: {
|
|
241
|
+
* rate: 0.5, // Capture 50% of errors
|
|
242
|
+
* dedupeWindow: 5000, // 5s dedup window
|
|
243
|
+
* maxPerSession: 25, // Max 25 unique errors per session
|
|
244
|
+
* }
|
|
245
|
+
* });
|
|
246
|
+
*/
|
|
247
|
+
interface SamplingConfig {
|
|
248
|
+
/**
|
|
249
|
+
* Fraction of errors to capture and transmit. Range: 0.0 (none) to 1.0 (all).
|
|
250
|
+
* @default 1.0
|
|
251
|
+
*/
|
|
252
|
+
rate?: number;
|
|
253
|
+
/**
|
|
254
|
+
* Milliseconds sliding window for client-side deduplication.
|
|
255
|
+
* Duplicate errors within this window are counted but not retransmitted.
|
|
256
|
+
* @default 10000
|
|
257
|
+
*/
|
|
258
|
+
dedupeWindow?: number;
|
|
259
|
+
/**
|
|
260
|
+
* Maximum number of unique error fingerprints captured per browser session.
|
|
261
|
+
* Prevents event storms in crash-loop scenarios.
|
|
262
|
+
* @default 100
|
|
263
|
+
*/
|
|
264
|
+
maxPerSession?: number;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Web Vitals metric names measured by the Performance observer.
|
|
268
|
+
*/
|
|
269
|
+
type VitalMetricName = 'LCP' | 'CLS' | 'FID' | 'TTFB' | 'INP' | 'FCP';
|
|
270
|
+
/**
|
|
271
|
+
* Captured Web Vitals performance metric entry.
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* const entry: PerformanceVitalEntry = {
|
|
275
|
+
* name: 'LCP',
|
|
276
|
+
* value: 1200,
|
|
277
|
+
* rating: 'good',
|
|
278
|
+
* delta: 1200,
|
|
279
|
+
* navigationType: 'navigate',
|
|
280
|
+
* };
|
|
281
|
+
*/
|
|
282
|
+
interface PerformanceVitalEntry {
|
|
283
|
+
/** Metric name. */
|
|
284
|
+
name: VitalMetricName;
|
|
285
|
+
/** Metric value in milliseconds (or unitless score for CLS). */
|
|
286
|
+
value: number;
|
|
287
|
+
/** Quality rating based on Core Web Vitals thresholds. */
|
|
288
|
+
rating: 'good' | 'needs-improvement' | 'poor';
|
|
289
|
+
/** Delta from previous measurement in the same session. */
|
|
290
|
+
delta: number;
|
|
291
|
+
/** Navigation type that initiated the metric measurement. */
|
|
292
|
+
navigationType: 'navigate' | 'reload' | 'back-forward' | 'prerender' | string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Configuration for the Web Vitals performance observer.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* attachWebVitals(tracker, {
|
|
299
|
+
* captureAsEvents: true,
|
|
300
|
+
* poorRatingOnly: true,
|
|
301
|
+
* });
|
|
302
|
+
*/
|
|
303
|
+
interface PerformanceVitalsOptions {
|
|
304
|
+
/**
|
|
305
|
+
* When true, captures poor/needs-improvement vitals as full error events.
|
|
306
|
+
* When false, captures all vitals as breadcrumbs only.
|
|
307
|
+
* @default false
|
|
308
|
+
*/
|
|
309
|
+
captureAsEvents?: boolean;
|
|
310
|
+
/**
|
|
311
|
+
* When true, only captures metrics rated 'poor' or 'needs-improvement'.
|
|
312
|
+
* @default false
|
|
313
|
+
*/
|
|
314
|
+
poorRatingOnly?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Subset of vital names to observe. Defaults to all supported vitals.
|
|
317
|
+
* @default ['LCP', 'CLS', 'FID', 'TTFB', 'INP', 'FCP']
|
|
318
|
+
*/
|
|
319
|
+
vitals?: VitalMetricName[];
|
|
320
|
+
/**
|
|
321
|
+
* Long task duration threshold in milliseconds. Tasks exceeding this
|
|
322
|
+
* are recorded as breadcrumbs with category 'performance'.
|
|
323
|
+
* @default 50
|
|
324
|
+
*/
|
|
325
|
+
longTaskThresholdMs?: number;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Event envelope used by the nexus-dev local ingestion server.
|
|
329
|
+
* Wraps ErrorEventPayload with server-assigned metadata.
|
|
330
|
+
*/
|
|
331
|
+
interface DevServerEventEnvelope {
|
|
332
|
+
/** Monotonically increasing server-assigned event ID. */
|
|
333
|
+
id: number;
|
|
334
|
+
/** ISO timestamp when the dev server received the event. */
|
|
335
|
+
receivedAt: string;
|
|
336
|
+
/** The captured error event payload. */
|
|
337
|
+
payload: ErrorEventPayload;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export { type Breadcrumb, type BreadcrumbCategory, type DevServerEventEnvelope, type DeviceContext, type ErrorEventEntity, type ErrorEventPayload, type ErrorGroupSummary, type NexusErrorInfo, type PerformanceVitalEntry, type PerformanceVitalsOptions, type SamplingConfig, type SeverityLevel, type StackFrame, type TransportPlugin, UserContext, type VitalMetricName };
|
package/dist/tracker.d.ts
CHANGED
|
@@ -194,4 +194,147 @@ interface ErrorGroupSummary {
|
|
|
194
194
|
lastSeenAt: string;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Normalized error information passed to NexusGuard fallback render function.
|
|
199
|
+
* Framework-agnostic — used by React, Vue, and Vanilla integrations.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* // React render prop
|
|
203
|
+
* <NexusGuard fallback={({ error, errorId, reset }) => (
|
|
204
|
+
* <div>Error #{errorId}: {error.message} <button onClick={reset}>Retry</button></div>
|
|
205
|
+
* )}>
|
|
206
|
+
* <App />
|
|
207
|
+
* </NexusGuard>
|
|
208
|
+
*/
|
|
209
|
+
interface NexusErrorInfo {
|
|
210
|
+
/** The original Error object that triggered the boundary. */
|
|
211
|
+
error: Error;
|
|
212
|
+
/**
|
|
213
|
+
* Deterministic fingerprint ID for this error class.
|
|
214
|
+
* Can be shown to users as a support reference code.
|
|
215
|
+
*/
|
|
216
|
+
errorId: string;
|
|
217
|
+
/** Resets the error boundary back to normal rendering state. */
|
|
218
|
+
reset: () => void;
|
|
219
|
+
/** Component stack trace (React/Vue only — undefined in Vanilla). */
|
|
220
|
+
componentStack?: string;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Custom transport plugin for SDK error event delivery.
|
|
224
|
+
* Allows complete replacement of the default fetch-based ingestion transport.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* // Custom Sentry forwarding transport
|
|
228
|
+
* const sentryTransport: TransportPlugin = async (event) => {
|
|
229
|
+
* Sentry.captureException(new Error(event.errorMessage));
|
|
230
|
+
* };
|
|
231
|
+
*
|
|
232
|
+
* Nexus.init({ transport: sentryTransport });
|
|
233
|
+
*/
|
|
234
|
+
type TransportPlugin = 'fetch' | 'console' | 'localStorage' | ((event: ErrorEventPayload) => void | Promise<void>);
|
|
235
|
+
/**
|
|
236
|
+
* Client-side event sampling and rate limiting configuration.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* Nexus.init({
|
|
240
|
+
* sampling: {
|
|
241
|
+
* rate: 0.5, // Capture 50% of errors
|
|
242
|
+
* dedupeWindow: 5000, // 5s dedup window
|
|
243
|
+
* maxPerSession: 25, // Max 25 unique errors per session
|
|
244
|
+
* }
|
|
245
|
+
* });
|
|
246
|
+
*/
|
|
247
|
+
interface SamplingConfig {
|
|
248
|
+
/**
|
|
249
|
+
* Fraction of errors to capture and transmit. Range: 0.0 (none) to 1.0 (all).
|
|
250
|
+
* @default 1.0
|
|
251
|
+
*/
|
|
252
|
+
rate?: number;
|
|
253
|
+
/**
|
|
254
|
+
* Milliseconds sliding window for client-side deduplication.
|
|
255
|
+
* Duplicate errors within this window are counted but not retransmitted.
|
|
256
|
+
* @default 10000
|
|
257
|
+
*/
|
|
258
|
+
dedupeWindow?: number;
|
|
259
|
+
/**
|
|
260
|
+
* Maximum number of unique error fingerprints captured per browser session.
|
|
261
|
+
* Prevents event storms in crash-loop scenarios.
|
|
262
|
+
* @default 100
|
|
263
|
+
*/
|
|
264
|
+
maxPerSession?: number;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Web Vitals metric names measured by the Performance observer.
|
|
268
|
+
*/
|
|
269
|
+
type VitalMetricName = 'LCP' | 'CLS' | 'FID' | 'TTFB' | 'INP' | 'FCP';
|
|
270
|
+
/**
|
|
271
|
+
* Captured Web Vitals performance metric entry.
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* const entry: PerformanceVitalEntry = {
|
|
275
|
+
* name: 'LCP',
|
|
276
|
+
* value: 1200,
|
|
277
|
+
* rating: 'good',
|
|
278
|
+
* delta: 1200,
|
|
279
|
+
* navigationType: 'navigate',
|
|
280
|
+
* };
|
|
281
|
+
*/
|
|
282
|
+
interface PerformanceVitalEntry {
|
|
283
|
+
/** Metric name. */
|
|
284
|
+
name: VitalMetricName;
|
|
285
|
+
/** Metric value in milliseconds (or unitless score for CLS). */
|
|
286
|
+
value: number;
|
|
287
|
+
/** Quality rating based on Core Web Vitals thresholds. */
|
|
288
|
+
rating: 'good' | 'needs-improvement' | 'poor';
|
|
289
|
+
/** Delta from previous measurement in the same session. */
|
|
290
|
+
delta: number;
|
|
291
|
+
/** Navigation type that initiated the metric measurement. */
|
|
292
|
+
navigationType: 'navigate' | 'reload' | 'back-forward' | 'prerender' | string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Configuration for the Web Vitals performance observer.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* attachWebVitals(tracker, {
|
|
299
|
+
* captureAsEvents: true,
|
|
300
|
+
* poorRatingOnly: true,
|
|
301
|
+
* });
|
|
302
|
+
*/
|
|
303
|
+
interface PerformanceVitalsOptions {
|
|
304
|
+
/**
|
|
305
|
+
* When true, captures poor/needs-improvement vitals as full error events.
|
|
306
|
+
* When false, captures all vitals as breadcrumbs only.
|
|
307
|
+
* @default false
|
|
308
|
+
*/
|
|
309
|
+
captureAsEvents?: boolean;
|
|
310
|
+
/**
|
|
311
|
+
* When true, only captures metrics rated 'poor' or 'needs-improvement'.
|
|
312
|
+
* @default false
|
|
313
|
+
*/
|
|
314
|
+
poorRatingOnly?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Subset of vital names to observe. Defaults to all supported vitals.
|
|
317
|
+
* @default ['LCP', 'CLS', 'FID', 'TTFB', 'INP', 'FCP']
|
|
318
|
+
*/
|
|
319
|
+
vitals?: VitalMetricName[];
|
|
320
|
+
/**
|
|
321
|
+
* Long task duration threshold in milliseconds. Tasks exceeding this
|
|
322
|
+
* are recorded as breadcrumbs with category 'performance'.
|
|
323
|
+
* @default 50
|
|
324
|
+
*/
|
|
325
|
+
longTaskThresholdMs?: number;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Event envelope used by the nexus-dev local ingestion server.
|
|
329
|
+
* Wraps ErrorEventPayload with server-assigned metadata.
|
|
330
|
+
*/
|
|
331
|
+
interface DevServerEventEnvelope {
|
|
332
|
+
/** Monotonically increasing server-assigned event ID. */
|
|
333
|
+
id: number;
|
|
334
|
+
/** ISO timestamp when the dev server received the event. */
|
|
335
|
+
receivedAt: string;
|
|
336
|
+
/** The captured error event payload. */
|
|
337
|
+
payload: ErrorEventPayload;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export { type Breadcrumb, type BreadcrumbCategory, type DevServerEventEnvelope, type DeviceContext, type ErrorEventEntity, type ErrorEventPayload, type ErrorGroupSummary, type NexusErrorInfo, type PerformanceVitalEntry, type PerformanceVitalsOptions, type SamplingConfig, type SeverityLevel, type StackFrame, type TransportPlugin, UserContext, type VitalMetricName };
|
package/dist/tracker.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexussdk/contracts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"description": "Single Source of Truth (SSOT) data contracts for the Nexus Platform ecosystem",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Nexus",
|
|
11
|
+
"contributors": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Hồ Huỳnh Dũng",
|
|
14
|
+
"email": "hohuynhdung@gmail.com",
|
|
15
|
+
"url": "https://github.com/Huynhdung295"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/Huynhdung295/NexusSDK.git",
|
|
21
|
+
"directory": "packages/contracts"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/Huynhdung295/NexusSDK#readme",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"nexus",
|
|
26
|
+
"nexussdk",
|
|
27
|
+
"contracts",
|
|
28
|
+
"typescript",
|
|
29
|
+
"feature-flags",
|
|
30
|
+
"telemetry",
|
|
31
|
+
"rfc7807"
|
|
32
|
+
],
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
9
37
|
"main": "./dist/index.cjs",
|
|
10
38
|
"module": "./dist/index.mjs",
|
|
11
39
|
"types": "./dist/index.d.ts",
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @nexussdk/contracts@0.0.1 build /home/runner/work/NexusSDK/NexusSDK/packages/contracts
|
|
3
|
-
> tsup
|
|
4
|
-
|
|
5
|
-
[34mCLI[39m Building entry: src/auth.ts, src/flags.ts, src/index.ts, src/rfc7807.ts, src/tracker.ts
|
|
6
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.5.1
|
|
8
|
-
[34mCLI[39m Using tsup config: /home/runner/work/NexusSDK/NexusSDK/packages/contracts/tsup.config.ts
|
|
9
|
-
[34mCLI[39m Target: es2022
|
|
10
|
-
[34mCLI[39m Cleaning output folder
|
|
11
|
-
[34mESM[39m Build start
|
|
12
|
-
[34mCJS[39m Build start
|
|
13
|
-
Generated an empty chunk: "auth".
|
|
14
|
-
Generated an empty chunk: "flags".
|
|
15
|
-
Generated an empty chunk: "tracker".
|
|
16
|
-
Generated an empty chunk: "auth".
|
|
17
|
-
Generated an empty chunk: "flags".
|
|
18
|
-
Generated an empty chunk: "tracker".
|
|
19
|
-
[32mCJS[39m [1mdist/auth.cjs [22m[32m82.00 B[39m
|
|
20
|
-
[32mCJS[39m [1mdist/flags.cjs [22m[32m84.00 B[39m
|
|
21
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m199.00 B[39m
|
|
22
|
-
[32mCJS[39m [1mdist/rfc7807.cjs [22m[32m203.00 B[39m
|
|
23
|
-
[32mCJS[39m [1mdist/tracker.cjs [22m[32m88.00 B[39m
|
|
24
|
-
[32mCJS[39m [1mdist/auth.cjs.map [22m[32m69.00 B[39m
|
|
25
|
-
[32mCJS[39m [1mdist/flags.cjs.map [22m[32m70.00 B[39m
|
|
26
|
-
[32mCJS[39m [1mdist/index.cjs.map [22m[32m2.58 KB[39m
|
|
27
|
-
[32mCJS[39m [1mdist/rfc7807.cjs.map [22m[32m2.58 KB[39m
|
|
28
|
-
[32mCJS[39m [1mdist/tracker.cjs.map [22m[32m72.00 B[39m
|
|
29
|
-
[32mCJS[39m ⚡️ Build success in 111ms
|
|
30
|
-
[32mESM[39m [1mdist/auth.mjs [22m[32m68.00 B[39m
|
|
31
|
-
[32mESM[39m [1mdist/flags.mjs [22m[32m70.00 B[39m
|
|
32
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m168.00 B[39m
|
|
33
|
-
[32mESM[39m [1mdist/rfc7807.mjs [22m[32m172.00 B[39m
|
|
34
|
-
[32mESM[39m [1mdist/tracker.mjs [22m[32m74.00 B[39m
|
|
35
|
-
[32mESM[39m [1mdist/auth.mjs.map [22m[32m69.00 B[39m
|
|
36
|
-
[32mESM[39m [1mdist/flags.mjs.map [22m[32m70.00 B[39m
|
|
37
|
-
[32mESM[39m [1mdist/index.mjs.map [22m[32m2.57 KB[39m
|
|
38
|
-
[32mESM[39m [1mdist/rfc7807.mjs.map [22m[32m2.58 KB[39m
|
|
39
|
-
[32mESM[39m [1mdist/tracker.mjs.map [22m[32m72.00 B[39m
|
|
40
|
-
[32mESM[39m ⚡️ Build success in 113ms
|
|
41
|
-
[34mDTS[39m Build start
|
|
42
|
-
[32mDTS[39m ⚡️ Build success in 1002ms
|
|
43
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m607.00 B[39m
|
|
44
|
-
[32mDTS[39m [1mdist/rfc7807.d.mts [22m[32m2.49 KB[39m
|
|
45
|
-
[32mDTS[39m [1mdist/tracker.d.mts [22m[32m6.48 KB[39m
|
|
46
|
-
[32mDTS[39m [1mdist/flags.d.mts [22m[32m7.17 KB[39m
|
|
47
|
-
[32mDTS[39m [1mdist/auth.d.mts [22m[32m6.21 KB[39m
|
|
48
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m603.00 B[39m
|
|
49
|
-
[32mDTS[39m [1mdist/rfc7807.d.ts [22m[32m2.49 KB[39m
|
|
50
|
-
[32mDTS[39m [1mdist/tracker.d.ts [22m[32m6.48 KB[39m
|
|
51
|
-
[32mDTS[39m [1mdist/flags.d.ts [22m[32m7.17 KB[39m
|
|
52
|
-
[32mDTS[39m [1mdist/auth.d.ts [22m[32m6.21 KB[39m
|
package/dist/auth.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"auth.cjs"}
|
package/dist/auth.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"auth.mjs"}
|
package/dist/flags.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"flags.cjs"}
|
package/dist/flags.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"flags.mjs"}
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rfc7807.ts"],"names":[],"mappings":";;;AA2EO,IAAM,gBAAA,GAAmB","file":"index.cjs","sourcesContent":["/**\n * @fileoverview Problem Details for HTTP APIs Specification (RFC 7807).\n * Standardized error format across Go-Gin and NestJS error responses.\n * @see {@link https://www.rfc-editor.org/rfc/rfc7807}\n * @module @nexus/contracts/rfc7807\n */\n\n/**\n * RFC 7807 Compliant Error Schema.\n * Ensures consistent machine-readable error diagnostics across all Nexus services.\n *\n * @example\n * const problem: ProblemDetails = {\n * type: 'https://nexus.dev/errors/quota-exceeded',\n * title: 'Monthly Quota Exceeded',\n * status: 429,\n * detail: \"API Key 'pk_live_...' has exhausted its limit of 50,000 monthly events.\",\n * instance: '/api/v1/telemetry/errors',\n * timestamp: '2024-06-01T12:00:00Z',\n * };\n */\nexport interface ProblemDetails {\n /**\n * URI reference identifying the problem type.\n * Should be a stable, documented URI that clients can bookmark.\n * @example 'https://nexus.dev/errors/rate-limit-exceeded'\n */\n type: string;\n /**\n * Short, human-readable summary of problem type.\n * Must be invariant across occurrences of the same problem type.\n * @example 'Too Many Requests'\n */\n title: string;\n /**\n * HTTP status code generated by origin server.\n * @example 429\n */\n status: number;\n /**\n * Human-readable explanation specific to this occurrence of the problem.\n * May differ across occurrences of the same problem type.\n * @example \"API Key 'pk_live_a1b2...' has exhausted its monthly event limit.\"\n */\n detail: string;\n /**\n * URI reference identifying specific occurrence of problem.\n * Typically the request path that triggered the error.\n * @example '/api/v1/telemetry/errors'\n */\n instance?: string;\n /**\n * Additional diagnostic error parameters for validation failures.\n * @example [{ name: 'email', reason: 'Must be a valid email address.' }]\n */\n invalidParams?: Array<{\n /** Field name that caused the validation error. */\n name: string;\n /** Human-readable reason for the validation failure. */\n reason: string;\n }>;\n /**\n * ISO 8601 timestamp when error was produced.\n * @example '2024-06-01T12:00:00.000Z'\n */\n timestamp?: string;\n}\n\n/**\n * Standard Nexus error type URI prefix.\n * All RFC 7807 type values should use this base to ensure namespacing consistency.\n *\n * @example\n * const type = `${NEXUS_ERROR_BASE}/rate-limit-exceeded`;\n */\nexport const NEXUS_ERROR_BASE = 'https://nexus.dev/errors' as const;\n"]}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rfc7807.ts"],"names":[],"mappings":";AA2EO,IAAM,gBAAA,GAAmB","file":"index.mjs","sourcesContent":["/**\n * @fileoverview Problem Details for HTTP APIs Specification (RFC 7807).\n * Standardized error format across Go-Gin and NestJS error responses.\n * @see {@link https://www.rfc-editor.org/rfc/rfc7807}\n * @module @nexus/contracts/rfc7807\n */\n\n/**\n * RFC 7807 Compliant Error Schema.\n * Ensures consistent machine-readable error diagnostics across all Nexus services.\n *\n * @example\n * const problem: ProblemDetails = {\n * type: 'https://nexus.dev/errors/quota-exceeded',\n * title: 'Monthly Quota Exceeded',\n * status: 429,\n * detail: \"API Key 'pk_live_...' has exhausted its limit of 50,000 monthly events.\",\n * instance: '/api/v1/telemetry/errors',\n * timestamp: '2024-06-01T12:00:00Z',\n * };\n */\nexport interface ProblemDetails {\n /**\n * URI reference identifying the problem type.\n * Should be a stable, documented URI that clients can bookmark.\n * @example 'https://nexus.dev/errors/rate-limit-exceeded'\n */\n type: string;\n /**\n * Short, human-readable summary of problem type.\n * Must be invariant across occurrences of the same problem type.\n * @example 'Too Many Requests'\n */\n title: string;\n /**\n * HTTP status code generated by origin server.\n * @example 429\n */\n status: number;\n /**\n * Human-readable explanation specific to this occurrence of the problem.\n * May differ across occurrences of the same problem type.\n * @example \"API Key 'pk_live_a1b2...' has exhausted its monthly event limit.\"\n */\n detail: string;\n /**\n * URI reference identifying specific occurrence of problem.\n * Typically the request path that triggered the error.\n * @example '/api/v1/telemetry/errors'\n */\n instance?: string;\n /**\n * Additional diagnostic error parameters for validation failures.\n * @example [{ name: 'email', reason: 'Must be a valid email address.' }]\n */\n invalidParams?: Array<{\n /** Field name that caused the validation error. */\n name: string;\n /** Human-readable reason for the validation failure. */\n reason: string;\n }>;\n /**\n * ISO 8601 timestamp when error was produced.\n * @example '2024-06-01T12:00:00.000Z'\n */\n timestamp?: string;\n}\n\n/**\n * Standard Nexus error type URI prefix.\n * All RFC 7807 type values should use this base to ensure namespacing consistency.\n *\n * @example\n * const type = `${NEXUS_ERROR_BASE}/rate-limit-exceeded`;\n */\nexport const NEXUS_ERROR_BASE = 'https://nexus.dev/errors' as const;\n"]}
|
package/dist/rfc7807.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rfc7807.ts"],"names":[],"mappings":";;;AA2EO,IAAM,gBAAA,GAAmB","file":"rfc7807.cjs","sourcesContent":["/**\n * @fileoverview Problem Details for HTTP APIs Specification (RFC 7807).\n * Standardized error format across Go-Gin and NestJS error responses.\n * @see {@link https://www.rfc-editor.org/rfc/rfc7807}\n * @module @nexus/contracts/rfc7807\n */\n\n/**\n * RFC 7807 Compliant Error Schema.\n * Ensures consistent machine-readable error diagnostics across all Nexus services.\n *\n * @example\n * const problem: ProblemDetails = {\n * type: 'https://nexus.dev/errors/quota-exceeded',\n * title: 'Monthly Quota Exceeded',\n * status: 429,\n * detail: \"API Key 'pk_live_...' has exhausted its limit of 50,000 monthly events.\",\n * instance: '/api/v1/telemetry/errors',\n * timestamp: '2024-06-01T12:00:00Z',\n * };\n */\nexport interface ProblemDetails {\n /**\n * URI reference identifying the problem type.\n * Should be a stable, documented URI that clients can bookmark.\n * @example 'https://nexus.dev/errors/rate-limit-exceeded'\n */\n type: string;\n /**\n * Short, human-readable summary of problem type.\n * Must be invariant across occurrences of the same problem type.\n * @example 'Too Many Requests'\n */\n title: string;\n /**\n * HTTP status code generated by origin server.\n * @example 429\n */\n status: number;\n /**\n * Human-readable explanation specific to this occurrence of the problem.\n * May differ across occurrences of the same problem type.\n * @example \"API Key 'pk_live_a1b2...' has exhausted its monthly event limit.\"\n */\n detail: string;\n /**\n * URI reference identifying specific occurrence of problem.\n * Typically the request path that triggered the error.\n * @example '/api/v1/telemetry/errors'\n */\n instance?: string;\n /**\n * Additional diagnostic error parameters for validation failures.\n * @example [{ name: 'email', reason: 'Must be a valid email address.' }]\n */\n invalidParams?: Array<{\n /** Field name that caused the validation error. */\n name: string;\n /** Human-readable reason for the validation failure. */\n reason: string;\n }>;\n /**\n * ISO 8601 timestamp when error was produced.\n * @example '2024-06-01T12:00:00.000Z'\n */\n timestamp?: string;\n}\n\n/**\n * Standard Nexus error type URI prefix.\n * All RFC 7807 type values should use this base to ensure namespacing consistency.\n *\n * @example\n * const type = `${NEXUS_ERROR_BASE}/rate-limit-exceeded`;\n */\nexport const NEXUS_ERROR_BASE = 'https://nexus.dev/errors' as const;\n"]}
|
package/dist/rfc7807.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rfc7807.ts"],"names":[],"mappings":";AA2EO,IAAM,gBAAA,GAAmB","file":"rfc7807.mjs","sourcesContent":["/**\n * @fileoverview Problem Details for HTTP APIs Specification (RFC 7807).\n * Standardized error format across Go-Gin and NestJS error responses.\n * @see {@link https://www.rfc-editor.org/rfc/rfc7807}\n * @module @nexus/contracts/rfc7807\n */\n\n/**\n * RFC 7807 Compliant Error Schema.\n * Ensures consistent machine-readable error diagnostics across all Nexus services.\n *\n * @example\n * const problem: ProblemDetails = {\n * type: 'https://nexus.dev/errors/quota-exceeded',\n * title: 'Monthly Quota Exceeded',\n * status: 429,\n * detail: \"API Key 'pk_live_...' has exhausted its limit of 50,000 monthly events.\",\n * instance: '/api/v1/telemetry/errors',\n * timestamp: '2024-06-01T12:00:00Z',\n * };\n */\nexport interface ProblemDetails {\n /**\n * URI reference identifying the problem type.\n * Should be a stable, documented URI that clients can bookmark.\n * @example 'https://nexus.dev/errors/rate-limit-exceeded'\n */\n type: string;\n /**\n * Short, human-readable summary of problem type.\n * Must be invariant across occurrences of the same problem type.\n * @example 'Too Many Requests'\n */\n title: string;\n /**\n * HTTP status code generated by origin server.\n * @example 429\n */\n status: number;\n /**\n * Human-readable explanation specific to this occurrence of the problem.\n * May differ across occurrences of the same problem type.\n * @example \"API Key 'pk_live_a1b2...' has exhausted its monthly event limit.\"\n */\n detail: string;\n /**\n * URI reference identifying specific occurrence of problem.\n * Typically the request path that triggered the error.\n * @example '/api/v1/telemetry/errors'\n */\n instance?: string;\n /**\n * Additional diagnostic error parameters for validation failures.\n * @example [{ name: 'email', reason: 'Must be a valid email address.' }]\n */\n invalidParams?: Array<{\n /** Field name that caused the validation error. */\n name: string;\n /** Human-readable reason for the validation failure. */\n reason: string;\n }>;\n /**\n * ISO 8601 timestamp when error was produced.\n * @example '2024-06-01T12:00:00.000Z'\n */\n timestamp?: string;\n}\n\n/**\n * Standard Nexus error type URI prefix.\n * All RFC 7807 type values should use this base to ensure namespacing consistency.\n *\n * @example\n * const type = `${NEXUS_ERROR_BASE}/rate-limit-exceeded`;\n */\nexport const NEXUS_ERROR_BASE = 'https://nexus.dev/errors' as const;\n"]}
|
package/dist/tracker.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"tracker.cjs"}
|
package/dist/tracker.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"tracker.mjs"}
|