@ontrails/trails 1.0.0-beta.14 → 1.0.0-beta.15
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/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +13 -0
- package/__tests__/examples.test.ts +29 -4
- package/dist/src/app.js +2 -2
- package/dist/src/app.js.map +1 -1
- package/dist/src/clack.d.ts +1 -1
- package/dist/src/clack.js +1 -1
- package/dist/src/cli.js +4 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/src/trails/add-surface.d.ts +3 -3
- package/dist/src/trails/add-surface.d.ts.map +1 -1
- package/dist/src/trails/add-surface.js +46 -24
- package/dist/src/trails/add-surface.js.map +1 -1
- package/dist/src/trails/add-trail.d.ts +3 -1
- package/dist/src/trails/add-trail.d.ts.map +1 -1
- package/dist/src/trails/add-trail.js +38 -11
- package/dist/src/trails/add-trail.js.map +1 -1
- package/dist/src/trails/add-trailhead.d.ts +1 -1
- package/dist/src/trails/add-trailhead.d.ts.map +1 -1
- package/dist/src/trails/add-trailhead.js +4 -4
- package/dist/src/trails/add-verify.d.ts +1 -1
- package/dist/src/trails/add-verify.d.ts.map +1 -1
- package/dist/src/trails/add-verify.js +7 -6
- package/dist/src/trails/add-verify.js.map +1 -1
- package/dist/src/trails/create-scaffold.d.ts +1 -1
- package/dist/src/trails/create-scaffold.d.ts.map +1 -1
- package/dist/src/trails/create-scaffold.js +10 -3
- package/dist/src/trails/create-scaffold.js.map +1 -1
- package/dist/src/trails/create.d.ts +10 -14
- package/dist/src/trails/create.d.ts.map +1 -1
- package/dist/src/trails/create.js +42 -37
- package/dist/src/trails/create.js.map +1 -1
- package/dist/src/trails/dev-clean.d.ts +4 -4
- package/dist/src/trails/dev-clean.d.ts.map +1 -1
- package/dist/src/trails/dev-clean.js +22 -21
- package/dist/src/trails/dev-clean.js.map +1 -1
- package/dist/src/trails/dev-reset.d.ts +1 -1
- package/dist/src/trails/dev-reset.d.ts.map +1 -1
- package/dist/src/trails/dev-reset.js +3 -2
- package/dist/src/trails/dev-reset.js.map +1 -1
- package/dist/src/trails/dev-stats.d.ts +4 -4
- package/dist/src/trails/dev-stats.d.ts.map +1 -1
- package/dist/src/trails/dev-stats.js +19 -19
- package/dist/src/trails/dev-stats.js.map +1 -1
- package/dist/src/trails/dev-support.d.ts +17 -17
- package/dist/src/trails/dev-support.d.ts.map +1 -1
- package/dist/src/trails/dev-support.js +60 -57
- package/dist/src/trails/dev-support.js.map +1 -1
- package/dist/src/trails/draft-promote.d.ts +1 -1
- package/dist/src/trails/draft-promote.d.ts.map +1 -1
- package/dist/src/trails/draft-promote.js +30 -16
- package/dist/src/trails/draft-promote.js.map +1 -1
- package/dist/src/trails/guide.d.ts +2 -2
- package/dist/src/trails/guide.d.ts.map +1 -1
- package/dist/src/trails/guide.js +1 -4
- package/dist/src/trails/guide.js.map +1 -1
- package/dist/src/trails/load-app.d.ts +7 -1
- package/dist/src/trails/load-app.d.ts.map +1 -1
- package/dist/src/trails/load-app.js +374 -26
- package/dist/src/trails/load-app.js.map +1 -1
- package/dist/src/trails/survey.d.ts +5 -5
- package/dist/src/trails/survey.d.ts.map +1 -1
- package/dist/src/trails/survey.js +51 -29
- package/dist/src/trails/survey.js.map +1 -1
- package/dist/src/trails/topo-export.d.ts +5 -4
- package/dist/src/trails/topo-export.d.ts.map +1 -1
- package/dist/src/trails/topo-export.js +4 -7
- package/dist/src/trails/topo-export.js.map +1 -1
- package/dist/src/trails/topo-history.d.ts +6 -10
- package/dist/src/trails/topo-history.d.ts.map +1 -1
- package/dist/src/trails/topo-history.js +7 -8
- package/dist/src/trails/topo-history.js.map +1 -1
- package/dist/src/trails/topo-pin.d.ts +5 -9
- package/dist/src/trails/topo-pin.d.ts.map +1 -1
- package/dist/src/trails/topo-pin.js +5 -9
- package/dist/src/trails/topo-pin.js.map +1 -1
- package/dist/src/trails/topo-read-support.d.ts +12 -8
- package/dist/src/trails/topo-read-support.d.ts.map +1 -1
- package/dist/src/trails/topo-read-support.js +71 -82
- package/dist/src/trails/topo-read-support.js.map +1 -1
- package/dist/src/trails/topo-reports.d.ts +15 -11
- package/dist/src/trails/topo-reports.d.ts.map +1 -1
- package/dist/src/trails/topo-reports.js +40 -34
- package/dist/src/trails/topo-reports.js.map +1 -1
- package/dist/src/trails/topo-show.d.ts +4 -4
- package/dist/src/trails/topo-show.d.ts.map +1 -1
- package/dist/src/trails/topo-show.js +8 -12
- package/dist/src/trails/topo-show.js.map +1 -1
- package/dist/src/trails/topo-store-support.d.ts +2 -2
- package/dist/src/trails/topo-store-support.d.ts.map +1 -1
- package/dist/src/trails/topo-store-support.js +22 -22
- package/dist/src/trails/topo-store-support.js.map +1 -1
- package/dist/src/trails/topo-support.d.ts +19 -30
- package/dist/src/trails/topo-support.d.ts.map +1 -1
- package/dist/src/trails/topo-support.js +63 -96
- package/dist/src/trails/topo-support.js.map +1 -1
- package/dist/src/trails/topo-unpin.d.ts +9 -4
- package/dist/src/trails/topo-unpin.d.ts.map +1 -1
- package/dist/src/trails/topo-unpin.js +9 -4
- package/dist/src/trails/topo-unpin.js.map +1 -1
- package/dist/src/trails/topo-verify.d.ts +2 -2
- package/dist/src/trails/topo-verify.d.ts.map +1 -1
- package/dist/src/trails/topo-verify.js +1 -5
- package/dist/src/trails/topo-verify.js.map +1 -1
- package/dist/src/trails/topo.d.ts +2 -2
- package/dist/src/trails/topo.d.ts.map +1 -1
- package/dist/src/trails/topo.js +6 -10
- package/dist/src/trails/topo.js.map +1 -1
- package/dist/src/trails/warden.d.ts +3 -2
- package/dist/src/trails/warden.d.ts.map +1 -1
- package/dist/src/trails/warden.js +11 -2
- package/dist/src/trails/warden.js.map +1 -1
- package/dist/src/versions.d.ts +12 -0
- package/dist/src/versions.d.ts.map +1 -0
- package/dist/src/versions.js +23 -0
- package/dist/src/versions.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/__tests__/add-trail.test.ts +97 -0
- package/src/__tests__/create.test.ts +91 -27
- package/src/__tests__/guide.test.ts +10 -5
- package/src/__tests__/load-app.test.ts +365 -4
- package/src/__tests__/survey.test.ts +143 -67
- package/src/__tests__/topo-dev.test.ts +48 -46
- package/src/app.ts +2 -2
- package/src/clack.ts +1 -1
- package/src/cli.ts +4 -3
- package/src/trails/add-surface.ts +150 -0
- package/src/trails/add-trail.ts +46 -10
- package/src/trails/add-verify.ts +11 -6
- package/src/trails/create-scaffold.ts +16 -3
- package/src/trails/create.ts +76 -71
- package/src/trails/dev-clean.ts +25 -21
- package/src/trails/dev-reset.ts +3 -2
- package/src/trails/dev-stats.ts +22 -19
- package/src/trails/dev-support.ts +88 -86
- package/src/trails/draft-promote.ts +70 -35
- package/src/trails/guide.ts +1 -4
- package/src/trails/load-app.ts +511 -32
- package/src/trails/survey.ts +60 -35
- package/src/trails/topo-export.ts +5 -9
- package/src/trails/topo-history.ts +8 -10
- package/src/trails/topo-pin.ts +9 -13
- package/src/trails/topo-read-support.ts +103 -106
- package/src/trails/topo-reports.ts +54 -47
- package/src/trails/topo-show.ts +8 -12
- package/src/trails/topo-store-support.ts +36 -28
- package/src/trails/topo-support.ts +90 -134
- package/src/trails/topo-unpin.ts +11 -6
- package/src/trails/topo-verify.ts +1 -5
- package/src/trails/topo.ts +6 -10
- package/src/trails/warden.ts +12 -3
- package/src/versions.ts +43 -0
- package/tsconfig.tests.json +10 -0
- package/src/trails/add-trailhead.ts +0 -121
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stored-export pipeline for topo persistence.
|
|
3
3
|
*
|
|
4
|
-
* Extracted from topo-support.ts
|
|
5
|
-
* keeping
|
|
4
|
+
* Extracted from topo-support.ts to isolate store persistence concerns,
|
|
5
|
+
* keeping module boundaries clean.
|
|
6
6
|
*/
|
|
7
7
|
import type { Topo } from '@ontrails/core';
|
|
8
8
|
import { Result } from '@ontrails/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-store-support.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-store-support.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"topo-store-support.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-store-support.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAgB,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAiB,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAavD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AA4D1D,eAAO,MAAM,iBAAiB,GAC5B,KAAK,IAAI,EACT,UAAU;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KACtC,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAmBzC,CAAC"}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stored-export pipeline for topo persistence.
|
|
3
3
|
*
|
|
4
|
-
* Extracted from topo-support.ts
|
|
5
|
-
* keeping
|
|
4
|
+
* Extracted from topo-support.ts to isolate store persistence concerns,
|
|
5
|
+
* keeping module boundaries clean.
|
|
6
6
|
*/
|
|
7
7
|
import { InternalError, Result } from '@ontrails/core';
|
|
8
|
-
import {
|
|
9
|
-
import { openWriteTrailsDb,
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { createTopoSnapshot, getStoredTopoExport, } from '@ontrails/core/internal/topo-store';
|
|
9
|
+
import { openWriteTrailsDb, deriveTrailsDir, } from '@ontrails/core/internal/trails-db';
|
|
10
|
+
import { writeSurfaceLock, writeSurfaceMap } from '@ontrails/schema';
|
|
11
|
+
import { deriveRootDir, deriveTopoCounts, readGitState, } from './topo-support.js';
|
|
12
12
|
const persistAndReadStoredExport = (app, db, rootDir) => {
|
|
13
|
-
const
|
|
14
|
-
...
|
|
15
|
-
...
|
|
13
|
+
const snapshotResult = createTopoSnapshot(db, app, {
|
|
14
|
+
...readGitState(rootDir),
|
|
15
|
+
...deriveTopoCounts(app),
|
|
16
16
|
});
|
|
17
|
-
if (
|
|
18
|
-
return
|
|
17
|
+
if (snapshotResult.isErr()) {
|
|
18
|
+
return snapshotResult;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
const storedExport = getStoredTopoExport(db,
|
|
20
|
+
const snapshot = snapshotResult.value;
|
|
21
|
+
const storedExport = getStoredTopoExport(db, snapshot.id);
|
|
22
22
|
if (storedExport === undefined) {
|
|
23
|
-
return Result.err(new InternalError(`Missing stored topo export for
|
|
23
|
+
return Result.err(new InternalError(`Missing stored topo export for snapshot "${snapshot.id}"`));
|
|
24
24
|
}
|
|
25
25
|
return Result.ok({
|
|
26
|
-
|
|
26
|
+
snapshot,
|
|
27
27
|
storedExport,
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
const writeStoredExportArtifacts = async (storedExport, trailsDir) => {
|
|
31
|
-
const mapPath = await
|
|
32
|
-
const lockPath = await
|
|
31
|
+
const mapPath = await writeSurfaceMap(JSON.parse(storedExport.surfaceMapJson), { dir: trailsDir });
|
|
32
|
+
const lockPath = await writeSurfaceLock(JSON.parse(storedExport.lockContent), { dir: trailsDir });
|
|
33
33
|
return {
|
|
34
|
-
hash: storedExport.
|
|
34
|
+
hash: storedExport.surfaceHash,
|
|
35
35
|
lockPath,
|
|
36
36
|
mapPath,
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
export const exportCurrentTopo = async (app, options) => {
|
|
40
|
-
const rootDir =
|
|
40
|
+
const rootDir = deriveRootDir(options?.rootDir);
|
|
41
41
|
const db = openWriteTrailsDb({ rootDir });
|
|
42
42
|
try {
|
|
43
43
|
const persisted = persistAndReadStoredExport(app, db, rootDir);
|
|
44
44
|
if (persisted.isErr()) {
|
|
45
45
|
return persisted;
|
|
46
46
|
}
|
|
47
|
-
const {
|
|
48
|
-
const artifacts = await writeStoredExportArtifacts(storedExport,
|
|
49
|
-
return Result.ok({ ...artifacts,
|
|
47
|
+
const { snapshot, storedExport } = persisted.value;
|
|
48
|
+
const artifacts = await writeStoredExportArtifacts(storedExport, deriveTrailsDir({ rootDir }));
|
|
49
|
+
return Result.ok({ ...artifacts, snapshot });
|
|
50
50
|
}
|
|
51
51
|
finally {
|
|
52
52
|
db.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-store-support.js","sourceRoot":"","sources":["../../../src/trails/topo-store-support.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"topo-store-support.js","sourceRoot":"","sources":["../../../src/trails/topo-store-support.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,eAAe,GAChB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGrE,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,MAAM,0BAA0B,GAAG,CACjC,GAAS,EACT,EAAwC,EACxC,OAAe,EAIf,EAAE;IACF,MAAM,cAAc,GAAG,kBAAkB,CAAC,EAAE,EAAE,GAAG,EAAE;QACjD,GAAG,YAAY,CAAC,OAAO,CAAC;QACxB,GAAG,gBAAgB,CAAC,GAAG,CAAC;KACzB,CAAC,CAAC;IACH,IAAI,cAAc,CAAC,KAAK,EAAE,EAAE,CAAC;QAC3B,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC;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G,SAAS,CAAC,KAAK,CAAC;QACnD,MAAM,SAAS,GAAG,MAAM,0BAA0B,CAChD,YAAY,EACZ,eAAe,CAAC,EAAE,OAAO,EAAE,CAAC,CAC7B,CAAC;QACF,OAAO,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/C,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
import type { Topo } from '@ontrails/core';
|
|
2
|
-
import type { TopoPinRecord, TopoSaveRecord } from '@ontrails/core/internal/topo-saves';
|
|
1
|
+
import type { Topo, TopoSnapshot } from '@ontrails/core';
|
|
3
2
|
import { z } from 'zod';
|
|
4
3
|
import type { BriefReport, SurveyListReport } from './topo-reports.js';
|
|
5
|
-
/** Output schema for a topo
|
|
6
|
-
export declare const
|
|
4
|
+
/** Output schema for a topo snapshot record. Shared across topo trails. */
|
|
5
|
+
export declare const topoSnapshotOutput: z.ZodObject<{
|
|
7
6
|
createdAt: z.ZodString;
|
|
8
7
|
gitDirty: z.ZodBoolean;
|
|
9
8
|
gitSha: z.ZodOptional<z.ZodString>;
|
|
10
9
|
id: z.ZodString;
|
|
11
|
-
|
|
10
|
+
pinnedAs: z.ZodOptional<z.ZodString>;
|
|
11
|
+
resourceCount: z.ZodNumber;
|
|
12
12
|
signalCount: z.ZodNumber;
|
|
13
13
|
trailCount: z.ZodNumber;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
|
-
/** Output schema for a topo pin record. Shared across topo trails. */
|
|
16
|
-
export declare const topoPinOutput: z.ZodObject<{
|
|
17
|
-
createdAt: z.ZodString;
|
|
18
|
-
name: z.ZodString;
|
|
19
|
-
saveId: z.ZodString;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
15
|
export declare const DEFAULT_APP_MODULE = "./src/app.ts";
|
|
22
16
|
export declare const DEFAULT_TOPO_HISTORY_LIMIT = 10;
|
|
23
17
|
export declare const LOCK_PATH = ".trails/trails.lock";
|
|
24
|
-
export declare const LEGACY_LOCK_PATH = ".trails/trailhead.lock";
|
|
25
|
-
/** Resolve the lockfile path, preferring the current name with legacy fallback. */
|
|
26
|
-
export declare const resolveLockPath: (trailsDir: string) => string;
|
|
27
18
|
export interface TopoSummaryReport {
|
|
28
19
|
readonly app: BriefReport;
|
|
29
20
|
readonly dbPath: string;
|
|
@@ -34,16 +25,15 @@ export interface TopoSummaryReport {
|
|
|
34
25
|
export interface TopoHistoryReport {
|
|
35
26
|
readonly dbPath: string;
|
|
36
27
|
readonly limit: number;
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly saves: TopoSaveRecord[];
|
|
28
|
+
readonly pinnedCount: number;
|
|
29
|
+
readonly snapshotCount: number;
|
|
30
|
+
readonly snapshots: TopoSnapshot[];
|
|
41
31
|
}
|
|
42
32
|
export interface TopoExportReport {
|
|
43
33
|
readonly hash: string;
|
|
44
34
|
readonly lockPath: string;
|
|
45
35
|
readonly mapPath: string;
|
|
46
|
-
readonly
|
|
36
|
+
readonly snapshot: TopoSnapshot;
|
|
47
37
|
}
|
|
48
38
|
export interface TopoVerifyReport {
|
|
49
39
|
readonly committedHash: string;
|
|
@@ -51,37 +41,36 @@ export interface TopoVerifyReport {
|
|
|
51
41
|
readonly lockPath: string;
|
|
52
42
|
readonly stale: false;
|
|
53
43
|
}
|
|
54
|
-
export declare const
|
|
55
|
-
export declare const
|
|
44
|
+
export declare const deriveRootDir: (cwd?: string) => string;
|
|
45
|
+
export declare const readGitState: (rootDir: string) => {
|
|
56
46
|
readonly gitDirty: boolean;
|
|
57
47
|
readonly gitSha?: string;
|
|
58
48
|
};
|
|
59
|
-
export declare const
|
|
60
|
-
export declare const
|
|
49
|
+
export declare const deriveTopoCounts: (app: Topo) => Pick<TopoSnapshot, "resourceCount" | "signalCount" | "trailCount">;
|
|
50
|
+
export declare const createIsolatedExampleInput: (name: string) => {
|
|
61
51
|
readonly module: string;
|
|
62
52
|
readonly rootDir: string;
|
|
63
53
|
};
|
|
64
|
-
export declare const
|
|
54
|
+
export declare const createCurrentTopoSnapshot: (app: Topo, options?: {
|
|
65
55
|
readonly rootDir?: string;
|
|
66
|
-
}) =>
|
|
56
|
+
}) => TopoSnapshot;
|
|
67
57
|
export declare const listTopoHistory: (options?: {
|
|
68
58
|
readonly limit?: number;
|
|
69
59
|
readonly rootDir?: string;
|
|
70
60
|
}) => TopoHistoryReport;
|
|
71
|
-
export declare const
|
|
61
|
+
export declare const pinCurrentTopoSnapshot: (app: Topo, input: {
|
|
72
62
|
readonly name: string;
|
|
73
63
|
readonly rootDir?: string;
|
|
74
64
|
}) => {
|
|
75
|
-
readonly
|
|
76
|
-
readonly save: TopoSaveRecord;
|
|
65
|
+
readonly snapshot: TopoSnapshot;
|
|
77
66
|
};
|
|
78
|
-
export declare const
|
|
67
|
+
export declare const removePinnedTopoSnapshot: (input: {
|
|
79
68
|
readonly dryRun: boolean;
|
|
80
69
|
readonly name: string;
|
|
81
70
|
readonly rootDir?: string;
|
|
82
71
|
}) => {
|
|
83
72
|
readonly dryRun: boolean;
|
|
84
|
-
readonly pin?: TopoPinRecord;
|
|
85
73
|
readonly removed: boolean;
|
|
74
|
+
readonly snapshot?: TopoSnapshot;
|
|
86
75
|
};
|
|
87
76
|
//# sourceMappingURL=topo-support.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-support.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-support.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"topo-support.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-support.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,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AC,EAAE,YAAY,CAAC;CAsBlC,CAAC"}
|
|
@@ -2,41 +2,25 @@ import { existsSync, mkdirSync, rmSync } from 'node:fs';
|
|
|
2
2
|
import { tmpdir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { openReadTrailsDb, openWriteTrailsDb, resolveTrailsDbPath, } from '@ontrails/core/internal/trails-db';
|
|
5
|
+
import { createTopoSnapshot as persistTopoSnapshot, listTopoSnapshots as readTopoSnapshots, pinTopoSnapshot, unpinTopoSnapshot, } from '@ontrails/core';
|
|
6
|
+
import { deriveTrailsDbPath } from '@ontrails/core/internal/trails-db';
|
|
8
7
|
import { z } from 'zod';
|
|
9
|
-
/** Output schema for a topo
|
|
10
|
-
export const
|
|
8
|
+
/** Output schema for a topo snapshot record. Shared across topo trails. */
|
|
9
|
+
export const topoSnapshotOutput = z.object({
|
|
11
10
|
createdAt: z.string(),
|
|
12
11
|
gitDirty: z.boolean(),
|
|
13
12
|
gitSha: z.string().optional(),
|
|
14
13
|
id: z.string(),
|
|
15
|
-
|
|
14
|
+
pinnedAs: z.string().optional(),
|
|
15
|
+
resourceCount: z.number(),
|
|
16
16
|
signalCount: z.number(),
|
|
17
17
|
trailCount: z.number(),
|
|
18
18
|
});
|
|
19
|
-
/** Output schema for a topo pin record. Shared across topo trails. */
|
|
20
|
-
export const topoPinOutput = z.object({
|
|
21
|
-
createdAt: z.string(),
|
|
22
|
-
name: z.string(),
|
|
23
|
-
saveId: z.string(),
|
|
24
|
-
});
|
|
25
19
|
export const DEFAULT_APP_MODULE = './src/app.ts';
|
|
26
20
|
export const DEFAULT_TOPO_HISTORY_LIMIT = 10;
|
|
27
21
|
export const LOCK_PATH = '.trails/trails.lock';
|
|
28
|
-
export const LEGACY_LOCK_PATH = '.trails/trailhead.lock';
|
|
29
|
-
/** Resolve the lockfile path, preferring the current name with legacy fallback. */
|
|
30
|
-
export const resolveLockPath = (trailsDir) => {
|
|
31
|
-
const primary = join(trailsDir, 'trails.lock');
|
|
32
|
-
if (existsSync(primary)) {
|
|
33
|
-
return primary;
|
|
34
|
-
}
|
|
35
|
-
const legacy = join(trailsDir, 'trailhead.lock');
|
|
36
|
-
return existsSync(legacy) ? legacy : primary;
|
|
37
|
-
};
|
|
38
22
|
const EXAMPLE_APP_MODULE = fileURLToPath(new URL('../app.ts', import.meta.url));
|
|
39
|
-
export const
|
|
23
|
+
export const deriveRootDir = (cwd) => cwd ?? process.cwd();
|
|
40
24
|
const safeGit = (cwd, args) => {
|
|
41
25
|
const proc = Bun.spawnSync({
|
|
42
26
|
cmd: ['git', '-C', cwd, ...args],
|
|
@@ -49,7 +33,7 @@ const safeGit = (cwd, args) => {
|
|
|
49
33
|
const text = Buffer.from(proc.stdout).toString('utf8').trim();
|
|
50
34
|
return text.length === 0 ? undefined : text;
|
|
51
35
|
};
|
|
52
|
-
export const
|
|
36
|
+
export const readGitState = (rootDir) => {
|
|
53
37
|
const gitSha = safeGit(rootDir, ['rev-parse', 'HEAD']);
|
|
54
38
|
const status = safeGit(rootDir, ['status', '--porcelain']);
|
|
55
39
|
return {
|
|
@@ -57,31 +41,31 @@ export const currentGitState = (rootDir) => {
|
|
|
57
41
|
...(gitSha === undefined ? {} : { gitSha }),
|
|
58
42
|
};
|
|
59
43
|
};
|
|
60
|
-
export const
|
|
61
|
-
|
|
44
|
+
export const deriveTopoCounts = (app) => ({
|
|
45
|
+
resourceCount: app.resources.size,
|
|
62
46
|
signalCount: app.signals.size,
|
|
63
47
|
trailCount: app.trails.size,
|
|
64
48
|
});
|
|
65
49
|
const emptyTopoHistory = (dbPath, limit) => ({
|
|
66
50
|
dbPath,
|
|
67
51
|
limit,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
saves: [],
|
|
52
|
+
pinnedCount: 0,
|
|
53
|
+
snapshotCount: 0,
|
|
54
|
+
snapshots: [],
|
|
72
55
|
});
|
|
73
|
-
const
|
|
56
|
+
const collectTopoHistory = (dbPath, limit, snapshots) => ({
|
|
74
57
|
dbPath,
|
|
75
58
|
limit,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
59
|
+
pinnedCount: snapshots.filter((snapshot) => snapshot.pinnedAs !== undefined)
|
|
60
|
+
.length,
|
|
61
|
+
snapshotCount: snapshots.length,
|
|
62
|
+
snapshots: snapshots.slice(0, limit),
|
|
63
|
+
});
|
|
64
|
+
const buildSnapshotInput = (app, rootDir) => ({
|
|
65
|
+
...readGitState(rootDir),
|
|
66
|
+
...deriveTopoCounts(app),
|
|
80
67
|
});
|
|
81
|
-
const
|
|
82
|
-
? { dryRun: true, pin, removed: false }
|
|
83
|
-
: { dryRun: false, pin, removed: unpinTopoSave(db, input.name) };
|
|
84
|
-
export const isolatedExampleInput = (name) => {
|
|
68
|
+
export const createIsolatedExampleInput = (name) => {
|
|
85
69
|
const rootDir = join(tmpdir(), 'ontrails-trails-examples', name);
|
|
86
70
|
rmSync(rootDir, { force: true, recursive: true });
|
|
87
71
|
mkdirSync(rootDir, { recursive: true });
|
|
@@ -90,76 +74,59 @@ export const isolatedExampleInput = (name) => {
|
|
|
90
74
|
rootDir,
|
|
91
75
|
};
|
|
92
76
|
};
|
|
93
|
-
export const
|
|
94
|
-
const rootDir =
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (result.isErr()) {
|
|
102
|
-
throw result.error;
|
|
103
|
-
}
|
|
104
|
-
return result.value;
|
|
105
|
-
}
|
|
106
|
-
finally {
|
|
107
|
-
db.close();
|
|
77
|
+
export const createCurrentTopoSnapshot = (app, options) => {
|
|
78
|
+
const rootDir = deriveRootDir(options?.rootDir);
|
|
79
|
+
const result = persistTopoSnapshot(app, {
|
|
80
|
+
rootDir,
|
|
81
|
+
...buildSnapshotInput(app, rootDir),
|
|
82
|
+
});
|
|
83
|
+
if (result.isErr()) {
|
|
84
|
+
throw result.error;
|
|
108
85
|
}
|
|
86
|
+
return result.value;
|
|
109
87
|
};
|
|
110
88
|
export const listTopoHistory = (options) => {
|
|
111
|
-
const rootDir =
|
|
89
|
+
const rootDir = deriveRootDir(options?.rootDir);
|
|
112
90
|
const limit = options?.limit ?? DEFAULT_TOPO_HISTORY_LIMIT;
|
|
113
|
-
const dbPath =
|
|
91
|
+
const dbPath = deriveTrailsDbPath({ rootDir });
|
|
114
92
|
if (!existsSync(dbPath)) {
|
|
115
93
|
return emptyTopoHistory(dbPath, limit);
|
|
116
94
|
}
|
|
117
|
-
|
|
118
|
-
try {
|
|
119
|
-
return collectedTopoHistory(dbPath, limit, listTopoPins(db), listTopoSaves(db));
|
|
120
|
-
}
|
|
121
|
-
finally {
|
|
122
|
-
db.close();
|
|
123
|
-
}
|
|
95
|
+
return collectTopoHistory(dbPath, limit, readTopoSnapshots({ rootDir }));
|
|
124
96
|
};
|
|
125
|
-
export const
|
|
126
|
-
const rootDir =
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (result.isErr()) {
|
|
134
|
-
throw result.error;
|
|
135
|
-
}
|
|
136
|
-
const pin = pinTopoSave(db, {
|
|
137
|
-
name: input.name,
|
|
138
|
-
saveId: result.value.id,
|
|
139
|
-
});
|
|
140
|
-
return { pin, save: result.value };
|
|
97
|
+
export const pinCurrentTopoSnapshot = (app, input) => {
|
|
98
|
+
const rootDir = deriveRootDir(input.rootDir);
|
|
99
|
+
const created = persistTopoSnapshot(app, {
|
|
100
|
+
rootDir,
|
|
101
|
+
...buildSnapshotInput(app, rootDir),
|
|
102
|
+
});
|
|
103
|
+
if (created.isErr()) {
|
|
104
|
+
throw created.error;
|
|
141
105
|
}
|
|
142
|
-
|
|
143
|
-
|
|
106
|
+
const snapshot = pinTopoSnapshot(created.value.id, input.name, {
|
|
107
|
+
rootDir,
|
|
108
|
+
});
|
|
109
|
+
if (snapshot === undefined) {
|
|
110
|
+
throw new Error(`Missing topo snapshot "${created.value.id}" to pin`);
|
|
144
111
|
}
|
|
112
|
+
return { snapshot };
|
|
145
113
|
};
|
|
146
|
-
export const
|
|
147
|
-
const rootDir =
|
|
148
|
-
if (!existsSync(
|
|
114
|
+
export const removePinnedTopoSnapshot = (input) => {
|
|
115
|
+
const rootDir = deriveRootDir(input.rootDir);
|
|
116
|
+
if (!existsSync(deriveTrailsDbPath({ rootDir }))) {
|
|
149
117
|
return { dryRun: input.dryRun, removed: false };
|
|
150
118
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
if (pin === undefined) {
|
|
157
|
-
return { dryRun: input.dryRun, removed: false };
|
|
158
|
-
}
|
|
159
|
-
return removeTopoPinWithDb(input, pin, db);
|
|
160
|
-
}
|
|
161
|
-
finally {
|
|
162
|
-
db.close();
|
|
119
|
+
if (input.dryRun) {
|
|
120
|
+
const snapshot = readTopoSnapshots({ pinned: true, rootDir }).find((candidate) => candidate.pinnedAs === input.name);
|
|
121
|
+
return snapshot === undefined
|
|
122
|
+
? { dryRun: true, removed: false }
|
|
123
|
+
: { dryRun: true, removed: false, snapshot };
|
|
163
124
|
}
|
|
125
|
+
const snapshot = unpinTopoSnapshot(input.name, { rootDir });
|
|
126
|
+
return {
|
|
127
|
+
dryRun: false,
|
|
128
|
+
removed: snapshot !== undefined,
|
|
129
|
+
...(snapshot === undefined ? {} : { snapshot }),
|
|
130
|
+
};
|
|
164
131
|
};
|
|
165
132
|
//# sourceMappingURL=topo-support.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-support.js","sourceRoot":"","sources":["../../../src/trails/topo-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC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AAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACjD,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC5D,OAAO;QACL,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,QAAQ,KAAK,SAAS;QAC/B,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -6,10 +6,15 @@ export declare const topoUnpinTrail: import("@ontrails/core").Trail<{
|
|
|
6
6
|
}, {
|
|
7
7
|
dryRun: boolean;
|
|
8
8
|
removed: boolean;
|
|
9
|
-
|
|
9
|
+
snapshot?: {
|
|
10
10
|
createdAt: string;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
gitDirty: boolean;
|
|
12
|
+
id: string;
|
|
13
|
+
resourceCount: number;
|
|
14
|
+
signalCount: number;
|
|
15
|
+
trailCount: number;
|
|
16
|
+
gitSha?: string | undefined;
|
|
17
|
+
pinnedAs?: string | undefined;
|
|
13
18
|
} | undefined;
|
|
14
|
-
}>;
|
|
19
|
+
}, never>;
|
|
15
20
|
//# sourceMappingURL=topo-unpin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-unpin.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-unpin.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"topo-unpin.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-unpin.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;SA8CzB,CAAC"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { Result, ValidationError, trail } from '@ontrails/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { createIsolatedExampleInput, removePinnedTopoSnapshot, topoSnapshotOutput, } from './topo-support.js';
|
|
4
4
|
export const topoUnpinTrail = trail('topo.unpin', {
|
|
5
5
|
blaze: (input, ctx) => {
|
|
6
6
|
if (input.dryRun !== true && input.yes !== true) {
|
|
7
7
|
return Result.err(new ValidationError('Refusing to remove a pin without `--yes` or `--dry-run`.'));
|
|
8
8
|
}
|
|
9
9
|
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
10
|
-
return Result.ok(
|
|
10
|
+
return Result.ok(removePinnedTopoSnapshot({
|
|
11
|
+
dryRun: input.dryRun,
|
|
12
|
+
name: input.name,
|
|
13
|
+
rootDir,
|
|
14
|
+
}));
|
|
11
15
|
},
|
|
12
16
|
description: 'Remove a named topo pin',
|
|
13
17
|
examples: [
|
|
14
18
|
{
|
|
15
19
|
input: {
|
|
16
|
-
...
|
|
20
|
+
...createIsolatedExampleInput('topo-unpin'),
|
|
17
21
|
dryRun: true,
|
|
18
22
|
name: 'before-auth-refactor',
|
|
19
23
|
},
|
|
@@ -32,8 +36,9 @@ export const topoUnpinTrail = trail('topo.unpin', {
|
|
|
32
36
|
intent: 'destroy',
|
|
33
37
|
output: z.object({
|
|
34
38
|
dryRun: z.boolean(),
|
|
35
|
-
pin: topoPinOutput.optional(),
|
|
36
39
|
removed: z.boolean(),
|
|
40
|
+
snapshot: topoSnapshotOutput.optional(),
|
|
37
41
|
}),
|
|
42
|
+
permit: { scopes: ['topo:delete'] },
|
|
38
43
|
});
|
|
39
44
|
//# sourceMappingURL=topo-unpin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-unpin.js","sourceRoot":"","sources":["../../../src/trails/topo-unpin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,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,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;QACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QACnE,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;KACxE,CAAC;IACF,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;QACnB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE;KACxC,CAAC;IACF,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,EAAE;CACpC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const topoVerifyTrail: import("@ontrails/core").Trail<{
|
|
2
|
-
module
|
|
2
|
+
module?: string | undefined;
|
|
3
3
|
rootDir?: string | undefined;
|
|
4
|
-
}, import("./topo-support.js").TopoVerifyReport>;
|
|
4
|
+
}, import("./topo-support.js").TopoVerifyReport, never>;
|
|
5
5
|
//# sourceMappingURL=topo-verify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-verify.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-verify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"topo-verify.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-verify.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;uDAkB1B,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { trail } from '@ontrails/core';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { loadApp } from './load-app.js';
|
|
4
4
|
import { verifyCurrentTopo } from './topo-read-support.js';
|
|
5
|
-
import { DEFAULT_APP_MODULE } from './topo-support.js';
|
|
6
5
|
export const topoVerifyTrail = trail('topo.verify', {
|
|
7
6
|
blaze: async (input, ctx) => {
|
|
8
7
|
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
@@ -11,10 +10,7 @@ export const topoVerifyTrail = trail('topo.verify', {
|
|
|
11
10
|
},
|
|
12
11
|
description: 'Verify that the committed lockfile matches the current topo',
|
|
13
12
|
input: z.object({
|
|
14
|
-
module: z
|
|
15
|
-
.string()
|
|
16
|
-
.default(DEFAULT_APP_MODULE)
|
|
17
|
-
.describe('Path to the app module'),
|
|
13
|
+
module: z.string().optional().describe('Path to the app module'),
|
|
18
14
|
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
19
15
|
}),
|
|
20
16
|
intent: 'read',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo-verify.js","sourceRoot":"","sources":["../../../src/trails/topo-verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"topo-verify.js","sourceRoot":"","sources":["../../../src/trails/topo-verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,EAAE;IAClD,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,iBAAiB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,WAAW,EAAE,6DAA6D;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAChE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;KACpE,CAAC;IACF,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;KACxB,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const topoTrail: import("@ontrails/core").Trail<{
|
|
2
|
-
module
|
|
2
|
+
module?: string | undefined;
|
|
3
3
|
rootDir?: string | undefined;
|
|
4
|
-
}, import("./topo-support.js").TopoSummaryReport>;
|
|
4
|
+
}, import("./topo-support.js").TopoSummaryReport, never>;
|
|
5
5
|
//# sourceMappingURL=topo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topo.d.ts","sourceRoot":"","sources":["../../../src/trails/topo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"topo.d.ts","sourceRoot":"","sources":["../../../src/trails/topo.ts"],"names":[],"mappings":"AAiDA,eAAO,MAAM,SAAS;;;wDAmBpB,CAAC"}
|