@emeryld/rrroutes-export 1.1.1 → 1.1.2
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 +115 -1
- package/bin/rrroutes-checkpoint.mjs +9 -0
- package/bin/rrroutes-export-changes.mjs +9 -0
- package/bin/rrroutes-export-snapshot.mjs +9 -0
- package/bin/rrroutes-inspector-serve.mjs +9 -0
- package/dist/adapters/express.d.ts +6 -0
- package/dist/checkpoint/lock.d.ts +4 -0
- package/dist/checkpoint/retention.d.ts +15 -0
- package/dist/checkpoint/service.d.ts +11 -0
- package/dist/checkpoint/types.d.ts +65 -0
- package/dist/cli/changes.d.ts +4 -0
- package/dist/cli/checkpoint.d.ts +1 -0
- package/dist/cli/runtime.d.ts +7 -0
- package/dist/cli/serve.d.ts +7 -0
- package/dist/cli/snapshot.d.ts +4 -0
- package/dist/diff/diff-snapshots.d.ts +4 -0
- package/dist/diff/types.d.ts +58 -0
- package/dist/exportFinalizedLeaves.changelog.d.ts +4 -0
- package/dist/files/baked-payload.d.ts +21 -0
- package/dist/files/write.d.ts +10 -0
- package/dist/http/handler.d.ts +2 -0
- package/dist/http/types.d.ts +24 -0
- package/dist/index.cjs +3094 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.mjs +3065 -116
- package/dist/index.mjs.map +1 -1
- package/dist/inspection/diagnostics.d.ts +8 -0
- package/dist/inspection/inspect-clients.d.ts +9 -0
- package/dist/inspection/inspect-contract.d.ts +8 -0
- package/dist/inspection/inspect-server.d.ts +8 -0
- package/dist/inspection/inspect-sockets.d.ts +4 -0
- package/dist/inspection/join-routes.d.ts +10 -0
- package/dist/inspection/native.d.ts +4 -0
- package/dist/inspection/normalize-clients.d.ts +8 -0
- package/dist/inspection/normalize-routes.d.ts +3 -0
- package/dist/inspection/normalize-sockets.d.ts +7 -0
- package/dist/inspection/serializable.d.ts +3 -0
- package/dist/runtime.d.ts +16 -0
- package/dist/serializeLeafContract.d.ts +1 -0
- package/dist/snapshot/build.d.ts +2 -0
- package/dist/snapshot/canonicalize.d.ts +6 -0
- package/dist/snapshot/hash.d.ts +5 -0
- package/dist/snapshot/types.d.ts +287 -0
- package/dist/storage/filesystem.d.ts +5 -0
- package/dist/storage/memory.d.ts +2 -0
- package/dist/storage/sqlite.d.ts +15 -0
- package/dist/storage/types.d.ts +27 -0
- package/package.json +66 -7
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RouteKey } from '@emeryld/rrroutes-contract';
|
|
2
|
+
import type { ClientResourceInspection, ClientRouteInspection } from '../snapshot/types';
|
|
3
|
+
import type { InspectionDiagnostics } from './diagnostics';
|
|
4
|
+
import { type NormalizedClientInput } from './normalize-clients';
|
|
5
|
+
export type ClientInspectionResult = {
|
|
6
|
+
clients: Readonly<Record<string, ClientResourceInspection>>;
|
|
7
|
+
byRoute: Readonly<Record<RouteKey, readonly ClientRouteInspection[]>>;
|
|
8
|
+
};
|
|
9
|
+
export declare function inspectClients(inputs: readonly NormalizedClientInput[], diagnostics: InspectionDiagnostics): ClientInspectionResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnyLeafLowProfile, RouteKey } from '@emeryld/rrroutes-contract';
|
|
2
|
+
import { exportFinalizedLeaves } from '../exportFinalizedLeaves';
|
|
3
|
+
import type { ContractRouteInspection, SourceInspectionOptions } from '../snapshot/types';
|
|
4
|
+
export type ContractInspectionResult = {
|
|
5
|
+
routes: Readonly<Record<RouteKey, ContractRouteInspection>>;
|
|
6
|
+
sourceExtraction?: Awaited<ReturnType<typeof exportFinalizedLeaves>>['_meta']['sourceExtraction'];
|
|
7
|
+
};
|
|
8
|
+
export declare function inspectContractRoutes(leaves: readonly AnyLeafLowProfile[], source: SourceInspectionOptions | undefined, includeSource: boolean): Promise<ContractInspectionResult>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RouteKey } from '@emeryld/rrroutes-contract';
|
|
2
|
+
import type { ServerRouteInspection, ServerRuntimeInspection, SupportedServerInput } from '../snapshot/types';
|
|
3
|
+
import type { InspectionDiagnostics } from './diagnostics';
|
|
4
|
+
export type ServerInspectionResult = {
|
|
5
|
+
servers: Readonly<Record<string, ServerRuntimeInspection>>;
|
|
6
|
+
byRoute: Readonly<Record<RouteKey, ServerRouteInspection>>;
|
|
7
|
+
};
|
|
8
|
+
export declare function inspectServer(input: SupportedServerInput | undefined, diagnostics: InspectionDiagnostics): ServerInspectionResult;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SocketRuntimeInspection } from '../snapshot/types';
|
|
2
|
+
import type { InspectionDiagnostics } from './diagnostics';
|
|
3
|
+
import type { NormalizedSocketInput } from './normalize-sockets';
|
|
4
|
+
export declare function inspectSockets(inputs: readonly NormalizedSocketInput[], includeLive: boolean, diagnostics: InspectionDiagnostics): Readonly<Record<string, SocketRuntimeInspection>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RouteKey } from '@emeryld/rrroutes-contract';
|
|
2
|
+
import type { ClientRouteInspection, ContractRouteInspection, InspectionDiagnostic, RouteInspection, ServerRouteInspection, ServerRuntimeInspection } from '../snapshot/types';
|
|
3
|
+
export declare function joinRouteInspections(args: {
|
|
4
|
+
contract: Readonly<Record<RouteKey, ContractRouteInspection>>;
|
|
5
|
+
clients: Readonly<Record<RouteKey, readonly ClientRouteInspection[]>>;
|
|
6
|
+
server: Readonly<Record<RouteKey, ServerRouteInspection>>;
|
|
7
|
+
servers: Readonly<Record<string, ServerRuntimeInspection>>;
|
|
8
|
+
serverSupplied: boolean;
|
|
9
|
+
diagnostics: InspectionDiagnostic[];
|
|
10
|
+
}): Readonly<Record<RouteKey, RouteInspection>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function asRecord(value: unknown): Record<PropertyKey, unknown> | undefined;
|
|
2
|
+
export declare function readNativeInspection(value: unknown): Record<PropertyKey, unknown> | undefined;
|
|
3
|
+
export declare function optionalString(value: unknown): string | undefined;
|
|
4
|
+
export declare function optionalBoolean(value: unknown): boolean | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SupportedClientsInput, SupportedEndpointClient } from '../snapshot/types';
|
|
2
|
+
export type NormalizedClientInput = {
|
|
3
|
+
value: object;
|
|
4
|
+
registeredName?: string;
|
|
5
|
+
index: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function normalizeClientsInput(endpointClient?: SupportedEndpointClient, allClients?: SupportedClientsInput): readonly NormalizedClientInput[];
|
|
8
|
+
export declare function looksLikeClientEndpoint(value: unknown): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SocketRuntime, SupportedSocketsInput } from '../snapshot/types';
|
|
2
|
+
export type NormalizedSocketInput = {
|
|
3
|
+
value: SocketRuntime;
|
|
4
|
+
registeredName?: string;
|
|
5
|
+
index: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function normalizeSocketsInput(input?: SupportedSocketsInput): readonly NormalizedSocketInput[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CheckpointService } from './checkpoint/types';
|
|
2
|
+
import type { DiffOptions, RRRoutesChangeSet } from './diff/types';
|
|
3
|
+
import { type WriteChangeSetOptions, type WriteSnapshotOptions } from './files/write';
|
|
4
|
+
import { createExpressRouter, type InspectorExpressOptions } from './adapters/express';
|
|
5
|
+
import type { HttpHandler, InspectorHttpOptions } from './http/types';
|
|
6
|
+
import type { CreateRRRoutesExportRuntimeOptions, InspectOptions, RRRoutesSnapshot } from './snapshot/types';
|
|
7
|
+
export interface RRRoutesExportRuntime {
|
|
8
|
+
inspect(options?: InspectOptions): Promise<RRRoutesSnapshot>;
|
|
9
|
+
diff(before: RRRoutesSnapshot, after?: RRRoutesSnapshot, options?: DiffOptions): Promise<RRRoutesChangeSet>;
|
|
10
|
+
checkpoints: CheckpointService;
|
|
11
|
+
createHttpHandler(options?: InspectorHttpOptions): HttpHandler;
|
|
12
|
+
createExpressRouter(options?: Omit<InspectorExpressOptions, 'runtime'>): ReturnType<typeof createExpressRouter>;
|
|
13
|
+
writeSnapshot(options: WriteSnapshotOptions): Promise<RRRoutesSnapshot>;
|
|
14
|
+
writeChangeSet(changeSet: RRRoutesChangeSet, options: WriteChangeSetOptions): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function createRRRoutesExportRuntime(options: CreateRRRoutesExportRuntimeOptions): RRRoutesExportRuntime;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { JsonValue, RRRoutesSnapshot } from './types';
|
|
2
|
+
export declare function canonicalizeJson(value: unknown): JsonValue;
|
|
3
|
+
export declare function canonicalSnapshotStructure(snapshot: RRRoutesSnapshot, options?: {
|
|
4
|
+
includeLive?: boolean;
|
|
5
|
+
}): JsonValue;
|
|
6
|
+
export declare function stableStringify(value: unknown): string;
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import type { AnyLeafLowProfile, FinalizedRegistry, RRRoutesInspectionJsonValue, RouteKey, RouteResource } from '@emeryld/rrroutes-contract';
|
|
2
|
+
import type { FlatSchemaMap } from '../flattenSchema';
|
|
3
|
+
import type { LeafSourceByKey } from '../extractLeafSourceByAst';
|
|
4
|
+
import type { SerializedLeafContract } from '../serializeLeafContract';
|
|
5
|
+
import type { SerializableSchema } from '../schemaIntrospection';
|
|
6
|
+
import type { ChangeSetRetention, CheckpointRetention } from '../checkpoint/types';
|
|
7
|
+
import type { InspectionStorage } from '../storage/types';
|
|
8
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
9
|
+
export type JsonValue = RRRoutesInspectionJsonValue;
|
|
10
|
+
export type IdentityStability = 'stable' | 'positional';
|
|
11
|
+
export type SupportedRoutesInput = FinalizedRegistry<readonly AnyLeafLowProfile[]> | readonly AnyLeafLowProfile[] | RouteResource;
|
|
12
|
+
export type InspectableClientResource = object;
|
|
13
|
+
export type SupportedEndpointClient = object;
|
|
14
|
+
export type SupportedClientsInput = Readonly<Record<string, InspectableClientResource>> | readonly InspectableClientResource[];
|
|
15
|
+
export type SocketRuntime = object;
|
|
16
|
+
export type SupportedSocketsInput = Readonly<Record<string, SocketRuntime>> | readonly SocketRuntime[] | SocketRuntime;
|
|
17
|
+
export type SupportedServerInput = object;
|
|
18
|
+
export type RuntimeSnapshotMetaInput = {
|
|
19
|
+
application?: string;
|
|
20
|
+
environment?: string;
|
|
21
|
+
version?: string;
|
|
22
|
+
commit?: string;
|
|
23
|
+
instanceId?: string;
|
|
24
|
+
};
|
|
25
|
+
export type SourceInspectionOptions = {
|
|
26
|
+
include?: boolean;
|
|
27
|
+
modulePath?: string;
|
|
28
|
+
exportName?: string;
|
|
29
|
+
tsconfigPath?: string;
|
|
30
|
+
};
|
|
31
|
+
export type DiagnosticOptions = {
|
|
32
|
+
includeInfo?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export interface CreateRRRoutesExportRuntimeOptions {
|
|
35
|
+
endpointClient?: SupportedEndpointClient;
|
|
36
|
+
allRoutes: SupportedRoutesInput;
|
|
37
|
+
allClients?: SupportedClientsInput;
|
|
38
|
+
sockets?: SupportedSocketsInput;
|
|
39
|
+
server?: SupportedServerInput;
|
|
40
|
+
meta?: RuntimeSnapshotMetaInput;
|
|
41
|
+
source?: SourceInspectionOptions;
|
|
42
|
+
diagnostics?: DiagnosticOptions;
|
|
43
|
+
storage?: InspectionStorage;
|
|
44
|
+
checkpoints?: {
|
|
45
|
+
scope?: string;
|
|
46
|
+
retention?: CheckpointRetention;
|
|
47
|
+
changeSetRetention?: ChangeSetRetention;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export type InspectOptions = {
|
|
51
|
+
includeLive?: boolean;
|
|
52
|
+
includeSource?: boolean;
|
|
53
|
+
};
|
|
54
|
+
export type InspectionDiagnosticSeverity = 'info' | 'warning' | 'error';
|
|
55
|
+
export interface InspectionDiagnostic {
|
|
56
|
+
code: string;
|
|
57
|
+
severity: InspectionDiagnosticSeverity;
|
|
58
|
+
entity?: {
|
|
59
|
+
routeKey?: RouteKey;
|
|
60
|
+
client?: string;
|
|
61
|
+
server?: string;
|
|
62
|
+
socket?: string;
|
|
63
|
+
[key: string]: string | undefined;
|
|
64
|
+
};
|
|
65
|
+
message: string;
|
|
66
|
+
}
|
|
67
|
+
export interface RRRoutesSnapshotMeta {
|
|
68
|
+
capturedAt: string;
|
|
69
|
+
snapshotHash: string;
|
|
70
|
+
application?: string;
|
|
71
|
+
environment?: string;
|
|
72
|
+
version?: string;
|
|
73
|
+
commit?: string;
|
|
74
|
+
instanceId?: string;
|
|
75
|
+
packageVersions: {
|
|
76
|
+
contract?: string;
|
|
77
|
+
client?: string;
|
|
78
|
+
server?: string;
|
|
79
|
+
export?: string;
|
|
80
|
+
};
|
|
81
|
+
sourceExtraction?: {
|
|
82
|
+
mode: 'ast';
|
|
83
|
+
enabled: boolean;
|
|
84
|
+
modulePath?: string;
|
|
85
|
+
exportName?: string;
|
|
86
|
+
tsconfigPath?: string;
|
|
87
|
+
resolvedLeafCount: number;
|
|
88
|
+
reason?: string;
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
export interface RRRoutesSnapshotCapabilities {
|
|
92
|
+
contract: true;
|
|
93
|
+
client: boolean;
|
|
94
|
+
server: boolean;
|
|
95
|
+
socket: boolean;
|
|
96
|
+
live: boolean;
|
|
97
|
+
source: boolean;
|
|
98
|
+
}
|
|
99
|
+
export interface ContractRouteInspection {
|
|
100
|
+
serializedLeaf: SerializedLeafContract;
|
|
101
|
+
schemaFlat: FlatSchemaMap;
|
|
102
|
+
source?: LeafSourceByKey[string];
|
|
103
|
+
fingerprint: string;
|
|
104
|
+
}
|
|
105
|
+
export interface SerializableClientBuildOptions {
|
|
106
|
+
readonly [key: string]: JsonValue;
|
|
107
|
+
}
|
|
108
|
+
export interface ClientAugmentInspection {
|
|
109
|
+
identity: string;
|
|
110
|
+
id?: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
kind?: string;
|
|
113
|
+
options?: JsonValue;
|
|
114
|
+
order: number;
|
|
115
|
+
identityStability: IdentityStability;
|
|
116
|
+
}
|
|
117
|
+
export interface ClientSocketConnectionInspection {
|
|
118
|
+
identity: string;
|
|
119
|
+
id?: string;
|
|
120
|
+
name?: string;
|
|
121
|
+
events: readonly string[];
|
|
122
|
+
roomStrategy?: JsonValue;
|
|
123
|
+
cacheReducers: readonly JsonValue[];
|
|
124
|
+
order: number;
|
|
125
|
+
identityStability: IdentityStability;
|
|
126
|
+
}
|
|
127
|
+
export interface ClientRouteInspection {
|
|
128
|
+
clientId: string;
|
|
129
|
+
clientName?: string;
|
|
130
|
+
bindingId?: string;
|
|
131
|
+
bindingIdentity: string;
|
|
132
|
+
publicName: string;
|
|
133
|
+
routeKey: RouteKey;
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
built: boolean;
|
|
136
|
+
build: {
|
|
137
|
+
feed: boolean;
|
|
138
|
+
singleton: boolean;
|
|
139
|
+
many: boolean;
|
|
140
|
+
pagination?: JsonValue;
|
|
141
|
+
options: SerializableClientBuildOptions;
|
|
142
|
+
};
|
|
143
|
+
augments: readonly ClientAugmentInspection[];
|
|
144
|
+
socketConnections: readonly ClientSocketConnectionInspection[];
|
|
145
|
+
identityStability: IdentityStability;
|
|
146
|
+
}
|
|
147
|
+
export interface ClientResourceInspection {
|
|
148
|
+
identity: string;
|
|
149
|
+
id?: string;
|
|
150
|
+
name?: string;
|
|
151
|
+
identityStability: IdentityStability;
|
|
152
|
+
bindings: readonly ClientRouteInspection[];
|
|
153
|
+
}
|
|
154
|
+
export interface MiddlewareInspection {
|
|
155
|
+
identity: string;
|
|
156
|
+
id?: string;
|
|
157
|
+
name?: string;
|
|
158
|
+
order: number;
|
|
159
|
+
identityStability: IdentityStability;
|
|
160
|
+
}
|
|
161
|
+
export interface ServerRouteInspection {
|
|
162
|
+
routeKey: RouteKey;
|
|
163
|
+
registered: boolean;
|
|
164
|
+
enabled: boolean;
|
|
165
|
+
controllerId?: string;
|
|
166
|
+
controllerName?: string;
|
|
167
|
+
before: readonly MiddlewareInspection[];
|
|
168
|
+
middleware: {
|
|
169
|
+
sanitizerCount: number;
|
|
170
|
+
preCtxCount: number;
|
|
171
|
+
postCtxCount: number;
|
|
172
|
+
beforeCount: number;
|
|
173
|
+
};
|
|
174
|
+
validateOutput: boolean;
|
|
175
|
+
multipart: boolean;
|
|
176
|
+
identityStability: IdentityStability;
|
|
177
|
+
}
|
|
178
|
+
export interface ServerRuntimeInspection {
|
|
179
|
+
identity: string;
|
|
180
|
+
id?: string;
|
|
181
|
+
name?: string;
|
|
182
|
+
identityStability: IdentityStability;
|
|
183
|
+
controllers: Readonly<Record<RouteKey, ServerRouteInspection>>;
|
|
184
|
+
middleware: {
|
|
185
|
+
sanitizerCount: number;
|
|
186
|
+
preCtxCount: number;
|
|
187
|
+
postCtxCount: number;
|
|
188
|
+
};
|
|
189
|
+
validateOutput: boolean;
|
|
190
|
+
}
|
|
191
|
+
export interface SocketContractEventInspection {
|
|
192
|
+
identity: string;
|
|
193
|
+
name: string;
|
|
194
|
+
schema?: SerializableSchema;
|
|
195
|
+
}
|
|
196
|
+
export interface SocketContractInspection {
|
|
197
|
+
events: Readonly<Record<string, SocketContractEventInspection>>;
|
|
198
|
+
}
|
|
199
|
+
export interface SocketConfigurationInspection {
|
|
200
|
+
heartbeat?: JsonValue;
|
|
201
|
+
reconnection?: JsonValue;
|
|
202
|
+
system?: JsonValue;
|
|
203
|
+
handlers: readonly SocketHandlerInspection[];
|
|
204
|
+
}
|
|
205
|
+
export interface SocketHandlerInspection {
|
|
206
|
+
identity: string;
|
|
207
|
+
event: string;
|
|
208
|
+
name?: string;
|
|
209
|
+
order: number;
|
|
210
|
+
identityStability: IdentityStability;
|
|
211
|
+
}
|
|
212
|
+
export interface SocketBindingInspection {
|
|
213
|
+
identity: string;
|
|
214
|
+
routeKey?: RouteKey;
|
|
215
|
+
eventNames: readonly string[];
|
|
216
|
+
identityStability: IdentityStability;
|
|
217
|
+
}
|
|
218
|
+
export interface SocketLiveInspection {
|
|
219
|
+
connected: boolean;
|
|
220
|
+
socketId?: string;
|
|
221
|
+
namespace?: string;
|
|
222
|
+
roomsCount?: number;
|
|
223
|
+
totalHandlers?: number;
|
|
224
|
+
rooms?: readonly {
|
|
225
|
+
room: string;
|
|
226
|
+
count: number;
|
|
227
|
+
}[];
|
|
228
|
+
handlers?: readonly {
|
|
229
|
+
event: string;
|
|
230
|
+
handlers: number;
|
|
231
|
+
}[];
|
|
232
|
+
routeSubscriptions?: readonly {
|
|
233
|
+
routeKey: RouteKey;
|
|
234
|
+
rooms: readonly {
|
|
235
|
+
room: string;
|
|
236
|
+
count: number;
|
|
237
|
+
}[];
|
|
238
|
+
handlers: readonly {
|
|
239
|
+
event: string;
|
|
240
|
+
handlers: number;
|
|
241
|
+
}[];
|
|
242
|
+
}[];
|
|
243
|
+
}
|
|
244
|
+
export interface SocketRuntimeInspection {
|
|
245
|
+
identity: string;
|
|
246
|
+
id?: string;
|
|
247
|
+
name?: string;
|
|
248
|
+
identityStability: IdentityStability;
|
|
249
|
+
contract: SocketContractInspection;
|
|
250
|
+
configuration: SocketConfigurationInspection;
|
|
251
|
+
bindings: readonly SocketBindingInspection[];
|
|
252
|
+
live?: SocketLiveInspection;
|
|
253
|
+
}
|
|
254
|
+
export interface RouteSocketInspection {
|
|
255
|
+
identity: string;
|
|
256
|
+
clientBindingIdentity: string;
|
|
257
|
+
events: readonly string[];
|
|
258
|
+
roomStrategy?: JsonValue;
|
|
259
|
+
cacheReducers: readonly JsonValue[];
|
|
260
|
+
identityStability: IdentityStability;
|
|
261
|
+
}
|
|
262
|
+
export interface RouteInspectionStatus {
|
|
263
|
+
client: 'unbound' | 'bound' | 'disabled';
|
|
264
|
+
server: 'unavailable' | 'missing' | 'enabled' | 'disabled';
|
|
265
|
+
socket: 'none' | 'configured';
|
|
266
|
+
}
|
|
267
|
+
export interface RouteInspection {
|
|
268
|
+
routeKey: RouteKey;
|
|
269
|
+
id?: string;
|
|
270
|
+
method: string;
|
|
271
|
+
path: string;
|
|
272
|
+
contract: ContractRouteInspection;
|
|
273
|
+
clients: readonly ClientRouteInspection[];
|
|
274
|
+
server?: ServerRouteInspection;
|
|
275
|
+
sockets: readonly RouteSocketInspection[];
|
|
276
|
+
status: RouteInspectionStatus;
|
|
277
|
+
}
|
|
278
|
+
export interface RRRoutesSnapshot {
|
|
279
|
+
schemaVersion: 1;
|
|
280
|
+
meta: RRRoutesSnapshotMeta;
|
|
281
|
+
capabilities: RRRoutesSnapshotCapabilities;
|
|
282
|
+
routes: Readonly<Record<RouteKey, RouteInspection>>;
|
|
283
|
+
clients: Readonly<Record<string, ClientResourceInspection>>;
|
|
284
|
+
servers: Readonly<Record<string, ServerRuntimeInspection>>;
|
|
285
|
+
sockets: Readonly<Record<string, SocketRuntimeInspection>>;
|
|
286
|
+
diagnostics: readonly InspectionDiagnostic[];
|
|
287
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InspectionStorage } from './types';
|
|
2
|
+
export interface SQLiteStatementLike {
|
|
3
|
+
run(...parameters: unknown[]): unknown;
|
|
4
|
+
get(...parameters: unknown[]): unknown;
|
|
5
|
+
all(...parameters: unknown[]): unknown;
|
|
6
|
+
}
|
|
7
|
+
/** Compatible with node:sqlite DatabaseSync and better-sqlite3 databases. */
|
|
8
|
+
export interface SQLiteDatabaseLike {
|
|
9
|
+
exec(sql: string): unknown;
|
|
10
|
+
prepare(sql: string): SQLiteStatementLike;
|
|
11
|
+
}
|
|
12
|
+
export type SQLiteInspectionStorageOptions = {
|
|
13
|
+
database: SQLiteDatabaseLike;
|
|
14
|
+
};
|
|
15
|
+
export declare function createSQLiteInspectionStorage(options: SQLiteInspectionStorageOptions): InspectionStorage;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RRRoutesChangeSet } from '../diff/types';
|
|
2
|
+
import type { RRRoutesChangeSetSummary, RRRoutesCheckpoint, RRRoutesCheckpointSummary } from '../checkpoint/types';
|
|
3
|
+
export interface CheckpointStore {
|
|
4
|
+
get(id: string): Promise<RRRoutesCheckpoint | undefined>;
|
|
5
|
+
getActive(scope: string): Promise<RRRoutesCheckpoint | undefined>;
|
|
6
|
+
list(scope?: string): Promise<readonly RRRoutesCheckpointSummary[]>;
|
|
7
|
+
save(checkpoint: RRRoutesCheckpoint): Promise<void>;
|
|
8
|
+
setActive(scope: string, checkpointId: string): Promise<void>;
|
|
9
|
+
delete(id: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface ChangeSetQuery {
|
|
12
|
+
scope?: string;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ChangeSetStore {
|
|
16
|
+
get(id: string): Promise<RRRoutesChangeSet | undefined>;
|
|
17
|
+
findByTransition(scope: string, fromHash: string, toHash: string): Promise<RRRoutesChangeSet | undefined>;
|
|
18
|
+
list(query?: ChangeSetQuery): Promise<readonly RRRoutesChangeSetSummary[]>;
|
|
19
|
+
save(changeSet: RRRoutesChangeSet): Promise<void>;
|
|
20
|
+
delete?(id: string): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export interface InspectionStorage {
|
|
23
|
+
checkpoints: CheckpointStore;
|
|
24
|
+
changes: ChangeSetStore;
|
|
25
|
+
/** Optional adapter-level transaction used to make multi-store advancement atomic. */
|
|
26
|
+
transaction?<T>(operation: () => Promise<T>): Promise<T>;
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emeryld/rrroutes-export",
|
|
3
3
|
"description": "Finalized leaves export helpers and CLI for RRRoutes",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.cjs",
|
|
@@ -12,25 +12,84 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"import": "./dist/index.mjs",
|
|
14
14
|
"require": "./dist/index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./inspection": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.mjs",
|
|
19
|
+
"require": "./dist/index.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./snapshot": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.mjs",
|
|
24
|
+
"require": "./dist/index.cjs"
|
|
25
|
+
},
|
|
26
|
+
"./diff": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"import": "./dist/index.mjs",
|
|
29
|
+
"require": "./dist/index.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./checkpoint": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.mjs",
|
|
34
|
+
"require": "./dist/index.cjs"
|
|
35
|
+
},
|
|
36
|
+
"./storage/memory": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.mjs",
|
|
39
|
+
"require": "./dist/index.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./storage/filesystem": {
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"import": "./dist/index.mjs",
|
|
44
|
+
"require": "./dist/index.cjs"
|
|
45
|
+
},
|
|
46
|
+
"./storage/sqlite": {
|
|
47
|
+
"types": "./dist/index.d.ts",
|
|
48
|
+
"import": "./dist/index.mjs",
|
|
49
|
+
"require": "./dist/index.cjs"
|
|
50
|
+
},
|
|
51
|
+
"./http": {
|
|
52
|
+
"types": "./dist/index.d.ts",
|
|
53
|
+
"import": "./dist/index.mjs",
|
|
54
|
+
"require": "./dist/index.cjs"
|
|
55
|
+
},
|
|
56
|
+
"./express": {
|
|
57
|
+
"types": "./dist/index.d.ts",
|
|
58
|
+
"import": "./dist/index.mjs",
|
|
59
|
+
"require": "./dist/index.cjs"
|
|
15
60
|
}
|
|
16
61
|
},
|
|
17
62
|
"bin": {
|
|
18
63
|
"rrroutes-export-finalized-leaves": "./bin/rrroutes-export-finalized-leaves.mjs",
|
|
19
|
-
"rrroutes-export-changelog": "./bin/rrroutes-export-changelog.mjs"
|
|
64
|
+
"rrroutes-export-changelog": "./bin/rrroutes-export-changelog.mjs",
|
|
65
|
+
"rrroutes-export-snapshot": "./bin/rrroutes-export-snapshot.mjs",
|
|
66
|
+
"rrroutes-export-changes": "./bin/rrroutes-export-changes.mjs",
|
|
67
|
+
"rrroutes-checkpoint": "./bin/rrroutes-checkpoint.mjs",
|
|
68
|
+
"rrroutes-inspector-serve": "./bin/rrroutes-inspector-serve.mjs"
|
|
20
69
|
},
|
|
21
70
|
"files": [
|
|
22
71
|
"dist",
|
|
23
72
|
"tools/finalized-leaves-viewer.html",
|
|
24
73
|
"bin/rrroutes-export-finalized-leaves.mjs",
|
|
25
|
-
"bin/rrroutes-export-changelog.mjs"
|
|
74
|
+
"bin/rrroutes-export-changelog.mjs",
|
|
75
|
+
"bin/rrroutes-export-snapshot.mjs",
|
|
76
|
+
"bin/rrroutes-export-changes.mjs",
|
|
77
|
+
"bin/rrroutes-checkpoint.mjs",
|
|
78
|
+
"bin/rrroutes-inspector-serve.mjs"
|
|
26
79
|
],
|
|
27
80
|
"dependencies": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
81
|
+
"typescript": "^5.9.3",
|
|
82
|
+
"@emeryld/rrroutes-contract": "^2.10.4"
|
|
30
83
|
},
|
|
31
84
|
"peerDependencies": {
|
|
85
|
+
"express": "^5.1.0",
|
|
32
86
|
"zod": "^4.0.0"
|
|
33
87
|
},
|
|
88
|
+
"peerDependenciesMeta": {
|
|
89
|
+
"express": {
|
|
90
|
+
"optional": true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
34
93
|
"devDependencies": {
|
|
35
94
|
"@jest/globals": "^30.4.1",
|
|
36
95
|
"zod": "4.3.6"
|
|
@@ -40,8 +99,8 @@
|
|
|
40
99
|
"url": "https://github.com/EmeryK-1/RRRoutes.git"
|
|
41
100
|
},
|
|
42
101
|
"scripts": {
|
|
43
|
-
"clean": "rimraf dist
|
|
44
|
-
"build": "pnpm run clean && pnpm
|
|
102
|
+
"clean": "rimraf dist",
|
|
103
|
+
"build": "pnpm run clean && pnpm run build:js && pnpm run build:types",
|
|
45
104
|
"build:js": "tsup --config tsup.config.ts",
|
|
46
105
|
"build:types": "tsc -p tsconfig.build.json",
|
|
47
106
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|