@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
package/README.md
CHANGED
|
@@ -1,6 +1,120 @@
|
|
|
1
1
|
# @emeryld/rrroutes-export
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Headless runtime inspection, canonical snapshots, semantic changes, checkpoints,
|
|
4
|
+
storage, and JSON HTTP adapters for RRRoutes. Browser rendering lives in
|
|
5
|
+
`@emeryld/rrroutes-export-ui`.
|
|
6
|
+
|
|
7
|
+
## Runtime setup
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createRRRoutesExportRuntime } from '@emeryld/rrroutes-export'
|
|
11
|
+
import { createFileSystemInspectionStorage } from '@emeryld/rrroutes-export/storage/filesystem'
|
|
12
|
+
|
|
13
|
+
export const rrroutesExport = createRRRoutesExportRuntime({
|
|
14
|
+
endpointClient,
|
|
15
|
+
allRoutes,
|
|
16
|
+
allClients: { users: usersClient, projects: projectsClient },
|
|
17
|
+
sockets: { application: socketClient },
|
|
18
|
+
server, // optional for client-only and contract-only processes
|
|
19
|
+
storage: createFileSystemInspectionStorage({ directory: '.rrroutes' }),
|
|
20
|
+
checkpoints: {
|
|
21
|
+
scope: process.env.NODE_ENV ?? 'development',
|
|
22
|
+
retention: {
|
|
23
|
+
type: 'combined',
|
|
24
|
+
maximum: 20,
|
|
25
|
+
maximumAgeMs: 30 * 24 * 60 * 60 * 1000,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
meta: {
|
|
29
|
+
application: 'example-api',
|
|
30
|
+
environment: process.env.NODE_ENV,
|
|
31
|
+
version: process.env.APP_VERSION,
|
|
32
|
+
commit: process.env.GIT_SHA,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`METHOD + path` is always the canonical route identity. Optional leaf,
|
|
38
|
+
binding, augment, controller, middleware, and socket IDs improve display and
|
|
39
|
+
diff matching but never replace the route key and are never required.
|
|
40
|
+
|
|
41
|
+
Snapshots are structural by default. Use `inspect({ includeLive: true })` for
|
|
42
|
+
hosted socket status; live connection IDs, rooms, and listener counts do not
|
|
43
|
+
affect the normal snapshot hash or checkpoint changelog.
|
|
44
|
+
|
|
45
|
+
## Checkpoints
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
await rrroutesExport.checkpoints.advance({
|
|
49
|
+
scope: 'production',
|
|
50
|
+
trigger: {
|
|
51
|
+
type: 'webhook',
|
|
52
|
+
externalId: deploymentId,
|
|
53
|
+
label: `Deployment ${deploymentId}`,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Advancement is scope-locked and writes the durable change set before replacing
|
|
59
|
+
the active checkpoint. Transition hashes make webhook retries idempotent.
|
|
60
|
+
Checkpoint retention and change-set retention are independent; change sets are
|
|
61
|
+
kept forever by default.
|
|
62
|
+
|
|
63
|
+
Built-in storage adapters are available at:
|
|
64
|
+
|
|
65
|
+
- `@emeryld/rrroutes-export/storage/memory`
|
|
66
|
+
- `@emeryld/rrroutes-export/storage/filesystem`
|
|
67
|
+
- `@emeryld/rrroutes-export/storage/sqlite`
|
|
68
|
+
|
|
69
|
+
The SQLite adapter accepts a database compatible with `node:sqlite`
|
|
70
|
+
`DatabaseSync` or `better-sqlite3`, avoiding a mandatory native dependency.
|
|
71
|
+
|
|
72
|
+
## Hosted inspector API
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
app.use(
|
|
76
|
+
'/_rrroutes',
|
|
77
|
+
rrroutesExport.createExpressRouter({
|
|
78
|
+
mutations: {
|
|
79
|
+
enabled: process.env.NODE_ENV !== 'production',
|
|
80
|
+
authorize: async ({ request, action }) =>
|
|
81
|
+
authorizeInspector(request, action),
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Mutation routes are disabled by default. The handler sets no-store headers,
|
|
88
|
+
limits mutation bodies, supports authorization hooks and idempotency keys, and
|
|
89
|
+
does not expose request data, tokens, query cache contents, environment
|
|
90
|
+
variables, or function source. Mounting is always application-owned; the
|
|
91
|
+
package never exposes the inspector automatically.
|
|
92
|
+
|
|
93
|
+
Use `createHttpHandler()` for the framework-neutral Web `Request`/`Response`
|
|
94
|
+
adapter. Install `express` only when using the Express adapter.
|
|
95
|
+
|
|
96
|
+
## CLI
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
rrroutes-export-snapshot --module ./src/inspection-runtime.ts \
|
|
100
|
+
--export rrroutesExport --out ./rrroutes.snapshot.json
|
|
101
|
+
|
|
102
|
+
rrroutes-export-changes --module ./src/inspection-runtime.ts \
|
|
103
|
+
--export rrroutesExport --before ./previous.snapshot.json \
|
|
104
|
+
--out ./rrroutes.changes.json
|
|
105
|
+
|
|
106
|
+
rrroutes-checkpoint advance --module ./src/inspection-runtime.ts \
|
|
107
|
+
--export rrroutesExport --scope production
|
|
108
|
+
|
|
109
|
+
rrroutes-inspector-serve --module ./src/inspection-runtime.ts \
|
|
110
|
+
--export rrroutesExport --port 4310
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Legacy finalized-leaf exports
|
|
114
|
+
|
|
115
|
+
The original finalized-leaf and Git-history entry points remain temporarily as
|
|
116
|
+
thin migration surfaces. They reuse the same schema serializer, source
|
|
117
|
+
extractor, and baked-payload injector used by the canonical implementation.
|
|
4
118
|
|
|
5
119
|
## What this package provides
|
|
6
120
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runCheckpointCli } from '../dist/index.mjs'
|
|
3
|
+
|
|
4
|
+
runCheckpointCli(process.argv.slice(2))
|
|
5
|
+
.then((result) => process.stdout.write(`${JSON.stringify(result, null, 2)}\n`))
|
|
6
|
+
.catch((error) => {
|
|
7
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`)
|
|
8
|
+
process.exitCode = 1
|
|
9
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runChangesCli } from '../dist/index.mjs'
|
|
3
|
+
|
|
4
|
+
runChangesCli(process.argv.slice(2))
|
|
5
|
+
.then(({ outFile }) => process.stdout.write(`${outFile}\n`))
|
|
6
|
+
.catch((error) => {
|
|
7
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`)
|
|
8
|
+
process.exitCode = 1
|
|
9
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runSnapshotCli } from '../dist/index.mjs'
|
|
3
|
+
|
|
4
|
+
runSnapshotCli(process.argv.slice(2))
|
|
5
|
+
.then(({ outFile }) => process.stdout.write(`${outFile}\n`))
|
|
6
|
+
.catch((error) => {
|
|
7
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`)
|
|
8
|
+
process.exitCode = 1
|
|
9
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runInspectorServeCli } from '../dist/index.mjs'
|
|
3
|
+
|
|
4
|
+
runInspectorServeCli(process.argv.slice(2))
|
|
5
|
+
.then(({ port }) => process.stdout.write(`RRRoutes inspector listening on http://localhost:${port}\n`))
|
|
6
|
+
.catch((error) => {
|
|
7
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`)
|
|
8
|
+
process.exitCode = 1
|
|
9
|
+
})
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Router } from 'express';
|
|
2
|
+
import type { InspectorHttpOptions, InspectorRuntimeLike } from '../http/types';
|
|
3
|
+
export type InspectorExpressOptions = InspectorHttpOptions & {
|
|
4
|
+
runtime: InspectorRuntimeLike;
|
|
5
|
+
};
|
|
6
|
+
export declare function createExpressRouter(options: InspectorExpressOptions): Router;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChangeSetRetention, CheckpointRetention } from './types';
|
|
2
|
+
import type { InspectionStorage } from '../storage/types';
|
|
3
|
+
export declare function applyCheckpointRetention(args: {
|
|
4
|
+
storage: InspectionStorage;
|
|
5
|
+
scope: string;
|
|
6
|
+
activeId: string;
|
|
7
|
+
retention?: CheckpointRetention;
|
|
8
|
+
now?: number;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function applyChangeSetRetention(args: {
|
|
11
|
+
storage: InspectionStorage;
|
|
12
|
+
scope: string;
|
|
13
|
+
retention: ChangeSetRetention;
|
|
14
|
+
now?: number;
|
|
15
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RRRoutesSnapshot } from '../snapshot/types';
|
|
2
|
+
import type { InspectionStorage } from '../storage/types';
|
|
3
|
+
import type { ChangeSetRetention, CheckpointRetention, CheckpointService } from './types';
|
|
4
|
+
export type CreateCheckpointServiceOptions = {
|
|
5
|
+
inspect: () => Promise<RRRoutesSnapshot>;
|
|
6
|
+
storage?: InspectionStorage;
|
|
7
|
+
scope?: string;
|
|
8
|
+
retention?: CheckpointRetention;
|
|
9
|
+
changeSetRetention?: ChangeSetRetention;
|
|
10
|
+
};
|
|
11
|
+
export declare function createCheckpointService(options: CreateCheckpointServiceOptions): CheckpointService;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { CheckpointTrigger, RRRoutesChangeSet } from '../diff/types';
|
|
2
|
+
import type { RRRoutesSnapshot } from '../snapshot/types';
|
|
3
|
+
export interface RRRoutesCheckpoint {
|
|
4
|
+
id: string;
|
|
5
|
+
scope: string;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
updatedAt: string;
|
|
8
|
+
snapshotHash: string;
|
|
9
|
+
snapshot: RRRoutesSnapshot;
|
|
10
|
+
trigger: CheckpointTrigger;
|
|
11
|
+
expiresAt?: string;
|
|
12
|
+
}
|
|
13
|
+
export type RRRoutesCheckpointSummary = Omit<RRRoutesCheckpoint, 'snapshot'> & {
|
|
14
|
+
active: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type RRRoutesChangeSetSummary = Omit<RRRoutesChangeSet, 'changes'>;
|
|
17
|
+
export type CheckpointRetention = {
|
|
18
|
+
type: 'duration';
|
|
19
|
+
maximumAgeMs: number;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'count';
|
|
22
|
+
maximum: number;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'combined';
|
|
25
|
+
maximumAgeMs: number;
|
|
26
|
+
maximum: number;
|
|
27
|
+
};
|
|
28
|
+
export type ChangeSetRetention = {
|
|
29
|
+
type: 'forever';
|
|
30
|
+
} | {
|
|
31
|
+
type: 'duration';
|
|
32
|
+
maximumAgeMs: number;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'count';
|
|
35
|
+
maximum: number;
|
|
36
|
+
};
|
|
37
|
+
export type CheckpointAdvanceInput = {
|
|
38
|
+
scope?: string;
|
|
39
|
+
trigger?: CheckpointTrigger;
|
|
40
|
+
};
|
|
41
|
+
export type CheckpointAdvanceResult = {
|
|
42
|
+
status: 'baseline_created';
|
|
43
|
+
checkpoint: RRRoutesCheckpoint;
|
|
44
|
+
} | {
|
|
45
|
+
status: 'no_changes';
|
|
46
|
+
checkpoint: RRRoutesCheckpoint;
|
|
47
|
+
} | {
|
|
48
|
+
status: 'idempotent_replay';
|
|
49
|
+
checkpoint: RRRoutesCheckpoint;
|
|
50
|
+
changeSet?: RRRoutesChangeSet;
|
|
51
|
+
} | {
|
|
52
|
+
status: 'advanced';
|
|
53
|
+
checkpoint: RRRoutesCheckpoint;
|
|
54
|
+
changeSet: RRRoutesChangeSet;
|
|
55
|
+
};
|
|
56
|
+
export interface CheckpointService {
|
|
57
|
+
advance(input?: CheckpointAdvanceInput): Promise<CheckpointAdvanceResult>;
|
|
58
|
+
create(input?: CheckpointAdvanceInput): Promise<RRRoutesCheckpoint>;
|
|
59
|
+
get(id: string): Promise<RRRoutesCheckpoint | undefined>;
|
|
60
|
+
getActive(scope?: string): Promise<RRRoutesCheckpoint | undefined>;
|
|
61
|
+
list(scope?: string): Promise<readonly RRRoutesCheckpointSummary[]>;
|
|
62
|
+
delete(id: string): Promise<void>;
|
|
63
|
+
listChangeSets(scope?: string): Promise<readonly RRRoutesChangeSetSummary[]>;
|
|
64
|
+
getChangeSet(id: string): Promise<RRRoutesChangeSet | undefined>;
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCheckpointCli(argv: readonly string[]): Promise<import("..").RRRoutesCheckpoint | import("..").CheckpointAdvanceResult>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RRRoutesExportRuntime } from '../runtime';
|
|
2
|
+
export declare function parseCliFlags(argv: readonly string[]): Map<string, string>;
|
|
3
|
+
export declare function loadExportRuntime(args: {
|
|
4
|
+
modulePath: string;
|
|
5
|
+
exportName?: string;
|
|
6
|
+
}): Promise<RRRoutesExportRuntime>;
|
|
7
|
+
export declare function requiredFlag(flags: Map<string, string>, name: string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RRRoutesSnapshot } from '../snapshot/types';
|
|
2
|
+
import type { DiffOptions, RRRoutesChangeSet } from './types';
|
|
3
|
+
export declare function diffRRRoutesSnapshots(before: RRRoutesSnapshot, after: RRRoutesSnapshot, options?: DiffOptions): RRRoutesChangeSet;
|
|
4
|
+
export declare const createSnapshotChangeSet: typeof diffRRRoutesSnapshots;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { RouteKey } from '@emeryld/rrroutes-contract';
|
|
2
|
+
import type { JsonValue } from '../snapshot/types';
|
|
3
|
+
export type RRRoutesChangeLayer = 'contract' | 'client' | 'server' | 'socket';
|
|
4
|
+
export type RRRoutesChangeSeverity = 'breaking' | 'behavioral' | 'non-breaking' | 'informational';
|
|
5
|
+
export type RRRoutesChangeType = 'route_added' | 'route_removed' | 'route_id_changed' | 'schema_changed' | 'cfg_changed' | 'description_changed' | 'files_changed' | 'source_changed' | 'client_resource_added' | 'client_resource_removed' | 'client_binding_added' | 'client_binding_removed' | 'client_binding_target_changed' | 'client_binding_enabled' | 'client_binding_disabled' | 'client_build_options_changed' | 'client_augment_added' | 'client_augment_removed' | 'client_augment_changed' | 'client_augment_reordered' | 'client_socket_connection_added' | 'client_socket_connection_removed' | 'client_socket_connection_changed' | 'server_controller_registered' | 'server_controller_unregistered' | 'server_endpoint_enabled' | 'server_endpoint_disabled' | 'server_controller_changed' | 'server_middleware_added' | 'server_middleware_removed' | 'server_middleware_changed' | 'server_middleware_reordered' | 'server_output_validation_changed' | 'socket_runtime_added' | 'socket_runtime_removed' | 'socket_contract_event_added' | 'socket_contract_event_removed' | 'socket_payload_schema_changed' | 'socket_handler_added' | 'socket_handler_removed' | 'socket_binding_changed' | 'socket_room_strategy_changed' | 'socket_cache_reducer_changed' | 'socket_heartbeat_configuration_changed';
|
|
6
|
+
export interface FieldChange {
|
|
7
|
+
field: string;
|
|
8
|
+
before?: JsonValue;
|
|
9
|
+
after?: JsonValue;
|
|
10
|
+
}
|
|
11
|
+
export interface RRRoutesChange {
|
|
12
|
+
id: string;
|
|
13
|
+
layer: RRRoutesChangeLayer;
|
|
14
|
+
type: RRRoutesChangeType;
|
|
15
|
+
routeKey?: RouteKey;
|
|
16
|
+
entityId: string;
|
|
17
|
+
severity: RRRoutesChangeSeverity;
|
|
18
|
+
before?: JsonValue;
|
|
19
|
+
after?: JsonValue;
|
|
20
|
+
changedFields?: readonly FieldChange[];
|
|
21
|
+
}
|
|
22
|
+
export interface CheckpointTrigger {
|
|
23
|
+
type: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
externalId?: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
actor?: string;
|
|
28
|
+
metadata?: JsonValue;
|
|
29
|
+
}
|
|
30
|
+
export interface SnapshotReference {
|
|
31
|
+
snapshotHash: string;
|
|
32
|
+
capturedAt: string;
|
|
33
|
+
checkpointId?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface RRRoutesChangeSummary {
|
|
36
|
+
total: number;
|
|
37
|
+
byLayer: Record<RRRoutesChangeLayer, number>;
|
|
38
|
+
bySeverity: Record<RRRoutesChangeSeverity, number>;
|
|
39
|
+
byType: Partial<Record<RRRoutesChangeType, number>>;
|
|
40
|
+
}
|
|
41
|
+
export interface RRRoutesChangeSet {
|
|
42
|
+
id: string;
|
|
43
|
+
scope: string;
|
|
44
|
+
createdAt: string;
|
|
45
|
+
from: SnapshotReference;
|
|
46
|
+
to: SnapshotReference;
|
|
47
|
+
trigger: CheckpointTrigger;
|
|
48
|
+
summary: RRRoutesChangeSummary;
|
|
49
|
+
changes: readonly RRRoutesChange[];
|
|
50
|
+
}
|
|
51
|
+
export interface DiffOptions {
|
|
52
|
+
includeLive?: boolean;
|
|
53
|
+
scope?: string;
|
|
54
|
+
trigger?: CheckpointTrigger;
|
|
55
|
+
createdAt?: string;
|
|
56
|
+
fromCheckpointId?: string;
|
|
57
|
+
toCheckpointId?: string;
|
|
58
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ExportFinalizedLeavesOptions, type FinalizedLeavesExport, type WriteFinalizedLeavesExportOptions } from './exportFinalizedLeaves';
|
|
2
2
|
import type { FlatSchemaEntry, FlatSchemaMap } from './flattenSchema';
|
|
3
|
+
import type { RRRoutesChangeSet } from './diff/types';
|
|
3
4
|
declare const CHANGESET_CFG_FIELDS: readonly ["summary", "description", "tags", "deprecated", "stability", "docsGroup", "docsHidden", "feed"];
|
|
4
5
|
declare const SCHEMA_SECTIONS: readonly ["params", "query", "body", "output"];
|
|
5
6
|
type ChangelogSchemaSection = (typeof SCHEMA_SECTIONS)[number];
|
|
@@ -112,6 +113,8 @@ export type FinalizedLeavesChangelogExport = {
|
|
|
112
113
|
byRoute: Record<string, RouteChangeEvent[]>;
|
|
113
114
|
bySourceObject: Record<string, SourceObjectChangeEvent[]>;
|
|
114
115
|
rollups: ChangelogRollups;
|
|
116
|
+
/** Canonical durable transitions used by checkpoints and direct comparisons. */
|
|
117
|
+
changeSets?: RRRoutesChangeSet[];
|
|
115
118
|
};
|
|
116
119
|
export type ExportFinalizedLeavesChangelogOptions = {
|
|
117
120
|
modulePath: string;
|
|
@@ -160,6 +163,7 @@ declare function loadSnapshotExport(options: {
|
|
|
160
163
|
declare function diffSnapshots(previous: CommitSnapshot, current: CommitSnapshot): {
|
|
161
164
|
routeEvents: RouteChangeEvent[];
|
|
162
165
|
sourceEvents: SourceObjectChangeEvent[];
|
|
166
|
+
changeSet: RRRoutesChangeSet;
|
|
163
167
|
};
|
|
164
168
|
export declare function writeFinalizedLeavesChangelogExport(payload: FinalizedLeavesChangelogExport, outFileOrOptions: string | WriteFinalizedLeavesExportOptions): Promise<{
|
|
165
169
|
outFile?: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RRRoutesChangeSet } from '../diff/types';
|
|
2
|
+
import type { RRRoutesCheckpointSummary } from '../checkpoint/types';
|
|
3
|
+
import type { RRRoutesSnapshot } from '../snapshot/types';
|
|
4
|
+
export declare const RRROUTES_BAKED_PAYLOAD_MARKER = "<!--__RRROUTES_INSPECTOR_BAKED_PAYLOAD__-->";
|
|
5
|
+
export type RRRoutesBakedInspectorPayload = {
|
|
6
|
+
kind: 'rrroutes-inspector-baked';
|
|
7
|
+
snapshot: RRRoutesSnapshot;
|
|
8
|
+
checkpoints: readonly RRRoutesCheckpointSummary[];
|
|
9
|
+
changeSets: readonly RRRoutesChangeSet[];
|
|
10
|
+
};
|
|
11
|
+
export declare function createBakedInspectorPayload(args: {
|
|
12
|
+
snapshot: RRRoutesSnapshot;
|
|
13
|
+
checkpoints?: readonly RRRoutesCheckpointSummary[];
|
|
14
|
+
changeSets?: readonly RRRoutesChangeSet[];
|
|
15
|
+
}): RRRoutesBakedInspectorPayload;
|
|
16
|
+
export declare function escapeBakedPayload(payload: unknown): string;
|
|
17
|
+
export declare function injectBakedInspectorPayload(html: string, payload: unknown, options?: {
|
|
18
|
+
marker?: string;
|
|
19
|
+
globalName?: string;
|
|
20
|
+
scriptId?: string;
|
|
21
|
+
}): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RRRoutesChangeSet } from '../diff/types';
|
|
2
|
+
import type { RRRoutesSnapshot } from '../snapshot/types';
|
|
3
|
+
export type WriteSnapshotOptions = {
|
|
4
|
+
outFile: string;
|
|
5
|
+
};
|
|
6
|
+
export type WriteChangeSetOptions = {
|
|
7
|
+
outFile: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function writeRRRoutesSnapshot(snapshot: RRRoutesSnapshot, options: WriteSnapshotOptions): Promise<void>;
|
|
10
|
+
export declare function writeRRRoutesChangeSet(changeSet: RRRoutesChangeSet, options: WriteChangeSetOptions): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CheckpointService } from '../checkpoint/types';
|
|
2
|
+
import type { InspectOptions, RRRoutesSnapshot } from '../snapshot/types';
|
|
3
|
+
export type InspectorMutationAction = 'checkpoint.create' | 'checkpoint.advance' | 'checkpoint.delete';
|
|
4
|
+
export type InspectorMutationOptions = false | {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
authorize?: (args: {
|
|
7
|
+
request: Request;
|
|
8
|
+
action: InspectorMutationAction;
|
|
9
|
+
}) => boolean | Promise<boolean>;
|
|
10
|
+
};
|
|
11
|
+
export type InspectorHttpOptions = {
|
|
12
|
+
mutations?: InspectorMutationOptions;
|
|
13
|
+
includeLive?: boolean;
|
|
14
|
+
maxMutationBodyBytes?: number;
|
|
15
|
+
authorize?: (args: {
|
|
16
|
+
request: Request;
|
|
17
|
+
action: 'read';
|
|
18
|
+
}) => boolean | Promise<boolean>;
|
|
19
|
+
};
|
|
20
|
+
export type InspectorRuntimeLike = {
|
|
21
|
+
inspect(options?: InspectOptions): Promise<RRRoutesSnapshot>;
|
|
22
|
+
checkpoints: CheckpointService;
|
|
23
|
+
};
|
|
24
|
+
export type HttpHandler = (request: Request) => Promise<Response>;
|