@tinyrack/devsync 1.3.0 → 1.4.0
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 +116 -78
- package/dist/cli/base-command.d.ts +3 -0
- package/dist/cli/base-command.d.ts.map +1 -1
- package/dist/cli/base-command.js +7 -1
- package/dist/cli/base-command.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts.map +1 -1
- package/dist/cli/commands/doctor.js +3 -4
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/index.d.ts +4 -4
- package/dist/cli/commands/index.js +4 -4
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +1 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/{machine → profile}/list.d.ts +1 -1
- package/dist/cli/commands/profile/list.d.ts.map +1 -0
- package/dist/cli/commands/profile/list.js +14 -0
- package/dist/cli/commands/profile/list.js.map +1 -0
- package/dist/cli/commands/{machine → profile}/use.d.ts +2 -2
- package/dist/cli/commands/{machine → profile}/use.d.ts.map +1 -1
- package/dist/cli/commands/profile/use.js +26 -0
- package/dist/cli/commands/profile/use.js.map +1 -0
- package/dist/cli/commands/pull.d.ts +1 -1
- package/dist/cli/commands/pull.d.ts.map +1 -1
- package/dist/cli/commands/pull.js +7 -8
- package/dist/cli/commands/pull.js.map +1 -1
- package/dist/cli/commands/push.d.ts +1 -1
- package/dist/cli/commands/push.d.ts.map +1 -1
- package/dist/cli/commands/push.js +6 -7
- package/dist/cli/commands/push.js.map +1 -1
- package/dist/cli/commands/status.d.ts +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +8 -9
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/track.d.ts +1 -1
- package/dist/cli/commands/track.d.ts.map +1 -1
- package/dist/cli/commands/track.js +18 -18
- package/dist/cli/commands/track.js.map +1 -1
- package/dist/cli/commands/untrack.d.ts.map +1 -1
- package/dist/cli/commands/untrack.js +2 -3
- package/dist/cli/commands/untrack.js.map +1 -1
- package/dist/config/global-config.d.ts +7 -7
- package/dist/config/global-config.js +11 -11
- package/dist/config/platform.d.ts +3 -3
- package/dist/config/platform.d.ts.map +1 -1
- package/dist/config/platform.js +1 -1
- package/dist/config/platform.js.map +1 -1
- package/dist/config/sync.d.ts +17 -18
- package/dist/config/sync.d.ts.map +1 -1
- package/dist/config/sync.js +48 -49
- package/dist/config/sync.js.map +1 -1
- package/dist/config/xdg.js +1 -1
- package/dist/config/xdg.js.map +1 -1
- package/dist/lib/output.d.ts +24 -16
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +179 -146
- package/dist/lib/output.js.map +1 -1
- package/dist/services/add.d.ts +3 -4
- package/dist/services/add.d.ts.map +1 -1
- package/dist/services/add.js +38 -40
- package/dist/services/add.js.map +1 -1
- package/dist/services/config-file.d.ts +3 -3
- package/dist/services/config-file.js +3 -3
- package/dist/services/config-file.js.map +1 -1
- package/dist/services/doctor.d.ts +2 -3
- package/dist/services/doctor.d.ts.map +1 -1
- package/dist/services/doctor.js +23 -20
- package/dist/services/doctor.js.map +1 -1
- package/dist/services/filesystem.d.ts +2 -3
- package/dist/services/filesystem.d.ts.map +1 -1
- package/dist/services/filesystem.js +0 -1
- package/dist/services/filesystem.js.map +1 -1
- package/dist/services/forget.d.ts +1 -2
- package/dist/services/forget.d.ts.map +1 -1
- package/dist/services/forget.js +20 -18
- package/dist/services/forget.js.map +1 -1
- package/dist/services/init.d.ts +1 -2
- package/dist/services/init.d.ts.map +1 -1
- package/dist/services/init.js +19 -20
- package/dist/services/init.js.map +1 -1
- package/dist/services/local-materialization.d.ts +1 -1
- package/dist/services/local-materialization.js +4 -4
- package/dist/services/local-snapshot.d.ts +1 -1
- package/dist/services/local-snapshot.js +4 -4
- package/dist/services/local-snapshot.js.map +1 -1
- package/dist/services/paths.d.ts +3 -7
- package/dist/services/paths.d.ts.map +1 -1
- package/dist/services/paths.js +2 -3
- package/dist/services/paths.js.map +1 -1
- package/dist/services/profile.d.ts +39 -0
- package/dist/services/profile.d.ts.map +1 -0
- package/dist/services/profile.js +117 -0
- package/dist/services/profile.js.map +1 -0
- package/dist/services/pull.d.ts +5 -5
- package/dist/services/pull.d.ts.map +1 -1
- package/dist/services/pull.js +15 -12
- package/dist/services/pull.js.map +1 -1
- package/dist/services/push.d.ts +5 -5
- package/dist/services/push.d.ts.map +1 -1
- package/dist/services/push.js +16 -14
- package/dist/services/push.js.map +1 -1
- package/dist/services/repo-artifacts.d.ts +9 -9
- package/dist/services/repo-artifacts.js +22 -22
- package/dist/services/repo-snapshot.js +12 -12
- package/dist/services/runtime.d.ts +11 -20
- package/dist/services/runtime.d.ts.map +1 -1
- package/dist/services/runtime.js +20 -27
- package/dist/services/runtime.js.map +1 -1
- package/dist/services/set.d.ts +7 -9
- package/dist/services/set.d.ts.map +1 -1
- package/dist/services/set.js +24 -24
- package/dist/services/set.js.map +1 -1
- package/dist/services/status.d.ts +5 -7
- package/dist/services/status.d.ts.map +1 -1
- package/dist/services/status.js +16 -14
- package/dist/services/status.js.map +1 -1
- package/package.json +7 -7
- package/dist/cli/commands/machine/list.d.ts.map +0 -1
- package/dist/cli/commands/machine/list.js +0 -12
- package/dist/cli/commands/machine/list.js.map +0 -1
- package/dist/cli/commands/machine/use.js +0 -28
- package/dist/cli/commands/machine/use.js.map +0 -1
- package/dist/services/machine.d.ts +0 -40
- package/dist/services/machine.d.ts.map +0 -1
- package/dist/services/machine.js +0 -113
- package/dist/services/machine.js.map +0 -1
package/dist/services/push.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { resolveSyncArtifactsDirectoryPath } from "#app/config/sync.js";
|
|
2
|
+
import { resolveSyncArtifactsDirectoryPath, resolveSyncConfigFilePath, } from "#app/config/sync.js";
|
|
3
3
|
import { removePathAtomically } from "./filesystem.js";
|
|
4
4
|
import { buildLocalSnapshot } from "./local-snapshot.js";
|
|
5
5
|
import { buildArtifactKey, buildRepoArtifacts, collectExistingArtifactKeys, writeArtifactsToDirectory, } from "./repo-artifacts.js";
|
|
6
|
-
import { ensureSyncRepository, loadSyncConfig, } from "./runtime.js";
|
|
6
|
+
import { ensureSyncRepository, loadSyncConfig, resolveSyncPaths, } from "./runtime.js";
|
|
7
7
|
const buildPushCounts = (snapshot) => {
|
|
8
8
|
let directoryCount = 0;
|
|
9
9
|
let encryptedFileCount = 0;
|
|
@@ -32,13 +32,13 @@ const buildPushCounts = (snapshot) => {
|
|
|
32
32
|
symlinkCount,
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
-
export const buildPushPlan = async (config,
|
|
35
|
+
export const buildPushPlan = async (config, syncDirectory) => {
|
|
36
36
|
const snapshot = await buildLocalSnapshot(config);
|
|
37
37
|
const artifacts = await buildRepoArtifacts(snapshot, config);
|
|
38
38
|
const desiredArtifactKeys = new Set(artifacts.map((artifact) => {
|
|
39
39
|
return buildArtifactKey(artifact);
|
|
40
40
|
}));
|
|
41
|
-
const existingArtifactKeys = await collectExistingArtifactKeys(
|
|
41
|
+
const existingArtifactKeys = await collectExistingArtifactKeys(syncDirectory, config);
|
|
42
42
|
const deletedArtifactCount = [...existingArtifactKeys].filter((key) => {
|
|
43
43
|
return !desiredArtifactKeys.has(key);
|
|
44
44
|
}).length;
|
|
@@ -63,23 +63,25 @@ export const buildPushPlanPreview = (plan) => {
|
|
|
63
63
|
});
|
|
64
64
|
return [...createdOrUpdated.slice(0, 4), ...deleted.slice(0, 4)].slice(0, 6);
|
|
65
65
|
};
|
|
66
|
-
export const buildPushResultFromPlan = (plan,
|
|
66
|
+
export const buildPushResultFromPlan = (plan, syncDirectory, dryRun) => {
|
|
67
|
+
const configPath = resolveSyncConfigFilePath(syncDirectory);
|
|
67
68
|
return {
|
|
68
|
-
configPath
|
|
69
|
+
configPath,
|
|
69
70
|
deletedArtifactCount: plan.deletedArtifactCount,
|
|
70
71
|
dryRun,
|
|
71
|
-
syncDirectory
|
|
72
|
+
syncDirectory,
|
|
72
73
|
...plan.counts,
|
|
73
74
|
};
|
|
74
75
|
};
|
|
75
|
-
export const pushSync = async (request,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
export const pushSync = async (request, environment) => {
|
|
77
|
+
const { syncDirectory } = resolveSyncPaths(environment);
|
|
78
|
+
await ensureSyncRepository(syncDirectory);
|
|
79
|
+
const { effectiveConfig: config } = await loadSyncConfig(syncDirectory, environment, {
|
|
80
|
+
...(request.profile === undefined ? {} : { profile: request.profile }),
|
|
79
81
|
});
|
|
80
|
-
const plan = await buildPushPlan(config,
|
|
82
|
+
const plan = await buildPushPlan(config, syncDirectory);
|
|
81
83
|
if (!request.dryRun) {
|
|
82
|
-
const artifactsDirectory = resolveSyncArtifactsDirectoryPath(
|
|
84
|
+
const artifactsDirectory = resolveSyncArtifactsDirectoryPath(syncDirectory);
|
|
83
85
|
const artifacts = await buildRepoArtifacts(plan.snapshot, config);
|
|
84
86
|
for (const staleKey of [...plan.existingArtifactKeys].filter((key) => {
|
|
85
87
|
return !plan.desiredArtifactKeys.has(key);
|
|
@@ -91,6 +93,6 @@ export const pushSync = async (request, context) => {
|
|
|
91
93
|
}
|
|
92
94
|
await writeArtifactsToDirectory(artifactsDirectory, artifacts, config.age);
|
|
93
95
|
}
|
|
94
|
-
return buildPushResultFromPlan(plan,
|
|
96
|
+
return buildPushResultFromPlan(plan, syncDirectory, request.dryRun);
|
|
95
97
|
};
|
|
96
98
|
//# sourceMappingURL=push.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/services/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../src/services/push.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CA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,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YACnE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5C,CAAC,CAAC,EAAE,CAAC;YACH,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;gBACzC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACvB,CAAC,CAAC,QAAQ,CAAC;YAEb,MAAM,oBAAoB,CACxB,IAAI,CAAC,kBAAkB,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CACrD,CAAC;QACJ,CAAC;QAED,MAAM,yBAAyB,CAAC,kBAAkB,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,uBAAuB,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC,CAAC"}
|
|
@@ -2,29 +2,29 @@ import { type ResolvedSyncConfigEntry } from "#app/config/sync.js";
|
|
|
2
2
|
import type { SnapshotNode } from "./local-snapshot.js";
|
|
3
3
|
import type { EffectiveSyncConfig } from "./runtime.js";
|
|
4
4
|
type ArtifactConfig = EffectiveSyncConfig;
|
|
5
|
-
export declare const collectArtifactNamespaces: (entries: readonly Pick<ResolvedSyncConfigEntry, "
|
|
5
|
+
export declare const collectArtifactNamespaces: (entries: readonly Pick<ResolvedSyncConfigEntry, "profiles">[]) => Set<string>;
|
|
6
6
|
export type RepoArtifact = Readonly<{
|
|
7
7
|
category: "plain";
|
|
8
8
|
kind: "directory";
|
|
9
|
-
|
|
9
|
+
profile: string;
|
|
10
10
|
repoPath: string;
|
|
11
11
|
}> | Readonly<{
|
|
12
12
|
category: "plain";
|
|
13
13
|
kind: "file";
|
|
14
14
|
repoPath: string;
|
|
15
|
-
|
|
15
|
+
profile: string;
|
|
16
16
|
contents: Uint8Array;
|
|
17
17
|
executable: boolean;
|
|
18
18
|
}> | Readonly<{
|
|
19
19
|
category: "plain";
|
|
20
20
|
kind: "symlink";
|
|
21
|
-
|
|
21
|
+
profile: string;
|
|
22
22
|
repoPath: string;
|
|
23
23
|
linkTarget: string;
|
|
24
24
|
}> | Readonly<{
|
|
25
25
|
category: "secret";
|
|
26
26
|
kind: "file";
|
|
27
|
-
|
|
27
|
+
profile: string;
|
|
28
28
|
repoPath: string;
|
|
29
29
|
contents: Uint8Array;
|
|
30
30
|
executable: boolean;
|
|
@@ -33,14 +33,14 @@ export declare const buildArtifactKey: (artifact: RepoArtifact) => string;
|
|
|
33
33
|
export declare const isSecretArtifactPath: (relativePath: string) => boolean;
|
|
34
34
|
export declare const stripSecretArtifactSuffix: (relativePath: string) => string | undefined;
|
|
35
35
|
export declare const assertStorageSafeRepoPath: (repoPath: string) => void;
|
|
36
|
-
export declare const resolveArtifactRelativePath: (artifact: Pick<RepoArtifact, "category" | "
|
|
36
|
+
export declare const resolveArtifactRelativePath: (artifact: Pick<RepoArtifact, "category" | "profile" | "repoPath">) => string;
|
|
37
37
|
export declare const parseArtifactRelativePath: (relativePath: string) => {
|
|
38
|
-
|
|
38
|
+
profile: string;
|
|
39
39
|
repoPath: string;
|
|
40
40
|
secret: boolean;
|
|
41
41
|
};
|
|
42
|
-
export declare const resolveEntryArtifactRelativePath: (entry: Pick<ResolvedSyncConfigEntry, "repoPath">,
|
|
43
|
-
export declare const resolveEntryArtifactPath: (artifactsDirectory: string, entry: Pick<ResolvedSyncConfigEntry, "repoPath">,
|
|
42
|
+
export declare const resolveEntryArtifactRelativePath: (entry: Pick<ResolvedSyncConfigEntry, "repoPath">, profile: string) => string;
|
|
43
|
+
export declare const resolveEntryArtifactPath: (artifactsDirectory: string, entry: Pick<ResolvedSyncConfigEntry, "repoPath">, profile: string) => string;
|
|
44
44
|
export declare const buildRepoArtifacts: (snapshot: ReadonlyMap<string, SnapshotNode>, config: ArtifactConfig) => Promise<RepoArtifact[]>;
|
|
45
45
|
export declare const collectExistingArtifactKeys: (syncDirectory: string, config: ArtifactConfig) => Promise<Set<string>>;
|
|
46
46
|
type AgeWriteConfig = Readonly<{
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { lstat, mkdir, readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { findOwningSyncEntry, hasReservedSyncArtifactSuffixSegment, resolveSyncArtifactsDirectoryPath, resolveSyncRule,
|
|
3
|
+
import { findOwningSyncEntry, hasReservedSyncArtifactSuffixSegment, resolveSyncArtifactsDirectoryPath, resolveSyncRule, syncDefaultProfile, syncSecretArtifactSuffix, } from "#app/config/sync.js";
|
|
4
4
|
import { buildDirectoryKey } from "#app/lib/path.js";
|
|
5
5
|
import { decryptSecretFile, encryptSecretFile } from "./crypto.js";
|
|
6
6
|
import { DevsyncError } from "./error.js";
|
|
7
7
|
import { getPathStats, listDirectoryEntries, writeFileNode, writeSymlinkNode, } from "./filesystem.js";
|
|
8
8
|
export const collectArtifactNamespaces = (entries) => {
|
|
9
9
|
const namespaces = new Set();
|
|
10
|
-
namespaces.add(
|
|
10
|
+
namespaces.add(syncDefaultProfile);
|
|
11
11
|
for (const entry of entries) {
|
|
12
|
-
for (const
|
|
13
|
-
namespaces.add(
|
|
12
|
+
for (const profile of entry.profiles) {
|
|
13
|
+
namespaces.add(profile);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return namespaces;
|
|
@@ -41,10 +41,10 @@ export const assertStorageSafeRepoPath = (repoPath) => {
|
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
43
|
export const resolveArtifactRelativePath = (artifact) => {
|
|
44
|
-
const
|
|
44
|
+
const profileRelativePath = `${artifact.profile}/${artifact.repoPath}`;
|
|
45
45
|
return artifact.category === "secret"
|
|
46
|
-
? `${
|
|
47
|
-
:
|
|
46
|
+
? `${profileRelativePath}${syncSecretArtifactSuffix}`
|
|
47
|
+
: profileRelativePath;
|
|
48
48
|
};
|
|
49
49
|
export const parseArtifactRelativePath = (relativePath) => {
|
|
50
50
|
const secret = relativePath.endsWith(syncSecretArtifactSuffix);
|
|
@@ -58,22 +58,22 @@ export const parseArtifactRelativePath = (relativePath) => {
|
|
|
58
58
|
details: [`Repository path: ${relativePath}`],
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
const [
|
|
61
|
+
const [profile, ...repoPathSegments] = segments;
|
|
62
62
|
return {
|
|
63
|
-
|
|
63
|
+
profile,
|
|
64
64
|
repoPath: repoPathSegments.join("/"),
|
|
65
65
|
secret,
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
export const resolveEntryArtifactRelativePath = (entry,
|
|
68
|
+
export const resolveEntryArtifactRelativePath = (entry, profile) => {
|
|
69
69
|
return resolveArtifactRelativePath({
|
|
70
70
|
category: "plain",
|
|
71
|
-
|
|
71
|
+
profile,
|
|
72
72
|
repoPath: entry.repoPath,
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
|
-
export const resolveEntryArtifactPath = (artifactsDirectory, entry,
|
|
76
|
-
return join(artifactsDirectory, ...resolveEntryArtifactRelativePath(entry,
|
|
75
|
+
export const resolveEntryArtifactPath = (artifactsDirectory, entry, profile) => {
|
|
76
|
+
return join(artifactsDirectory, ...resolveEntryArtifactRelativePath(entry, profile).split("/"));
|
|
77
77
|
};
|
|
78
78
|
export const buildRepoArtifacts = async (snapshot, config) => {
|
|
79
79
|
const artifacts = [];
|
|
@@ -95,7 +95,7 @@ export const buildRepoArtifacts = async (snapshot, config) => {
|
|
|
95
95
|
assertStorageSafeRepoPath(repoPath);
|
|
96
96
|
const node = snapshot.get(repoPath);
|
|
97
97
|
const owningEntry = findOwningSyncEntry(config, repoPath);
|
|
98
|
-
const resolvedRule = resolveSyncRule(config, repoPath, config.
|
|
98
|
+
const resolvedRule = resolveSyncRule(config, repoPath, config.activeProfile);
|
|
99
99
|
if (node === undefined ||
|
|
100
100
|
owningEntry === undefined ||
|
|
101
101
|
resolvedRule === undefined) {
|
|
@@ -105,7 +105,7 @@ export const buildRepoArtifacts = async (snapshot, config) => {
|
|
|
105
105
|
addArtifact({
|
|
106
106
|
category: "plain",
|
|
107
107
|
kind: "directory",
|
|
108
|
-
|
|
108
|
+
profile: resolvedRule.profile,
|
|
109
109
|
repoPath,
|
|
110
110
|
});
|
|
111
111
|
continue;
|
|
@@ -115,7 +115,7 @@ export const buildRepoArtifacts = async (snapshot, config) => {
|
|
|
115
115
|
category: "plain",
|
|
116
116
|
kind: "symlink",
|
|
117
117
|
linkTarget: node.linkTarget,
|
|
118
|
-
|
|
118
|
+
profile: resolvedRule.profile,
|
|
119
119
|
repoPath,
|
|
120
120
|
});
|
|
121
121
|
continue;
|
|
@@ -126,7 +126,7 @@ export const buildRepoArtifacts = async (snapshot, config) => {
|
|
|
126
126
|
contents: node.contents,
|
|
127
127
|
executable: node.executable,
|
|
128
128
|
kind: "file",
|
|
129
|
-
|
|
129
|
+
profile: resolvedRule.profile,
|
|
130
130
|
repoPath,
|
|
131
131
|
});
|
|
132
132
|
continue;
|
|
@@ -136,7 +136,7 @@ export const buildRepoArtifacts = async (snapshot, config) => {
|
|
|
136
136
|
contents: node.contents,
|
|
137
137
|
executable: node.executable,
|
|
138
138
|
kind: "file",
|
|
139
|
-
|
|
139
|
+
profile: resolvedRule.profile,
|
|
140
140
|
repoPath,
|
|
141
141
|
});
|
|
142
142
|
}
|
|
@@ -177,8 +177,8 @@ export const collectExistingArtifactKeys = async (syncDirectory, config) => {
|
|
|
177
177
|
continue;
|
|
178
178
|
}
|
|
179
179
|
const artifact = parseArtifactRelativePath(key);
|
|
180
|
-
const rule = resolveSyncRule(config, artifact.repoPath, config.
|
|
181
|
-
if (rule === undefined || rule.
|
|
180
|
+
const rule = resolveSyncRule(config, artifact.repoPath, config.activeProfile);
|
|
181
|
+
if (rule === undefined || rule.profile !== artifact.profile) {
|
|
182
182
|
keys.delete(key);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -186,13 +186,13 @@ export const collectExistingArtifactKeys = async (syncDirectory, config) => {
|
|
|
186
186
|
if (entry.kind !== "directory") {
|
|
187
187
|
continue;
|
|
188
188
|
}
|
|
189
|
-
const rule = resolveSyncRule(config, entry.repoPath, config.
|
|
189
|
+
const rule = resolveSyncRule(config, entry.repoPath, config.activeProfile);
|
|
190
190
|
if (rule === undefined) {
|
|
191
191
|
continue;
|
|
192
192
|
}
|
|
193
193
|
const relativePath = resolveArtifactRelativePath({
|
|
194
194
|
category: "plain",
|
|
195
|
-
|
|
195
|
+
profile: rule.profile,
|
|
196
196
|
repoPath: entry.repoPath,
|
|
197
197
|
});
|
|
198
198
|
const path = join(artifactsDirectory, ...relativePath.split("/"));
|
|
@@ -7,20 +7,20 @@ import { DevsyncError, wrapUnknownError } from "./error.js";
|
|
|
7
7
|
import { getPathStats, listDirectoryEntries } from "./filesystem.js";
|
|
8
8
|
import { addSnapshotNode } from "./local-snapshot.js";
|
|
9
9
|
import { assertStorageSafeRepoPath, collectArtifactNamespaces, parseArtifactRelativePath, } from "./repo-artifacts.js";
|
|
10
|
-
const
|
|
11
|
-
const rule = resolveSyncRule(config, repoPath, config.
|
|
10
|
+
const isActiveStorageProfile = (storageProfile, config, repoPath) => {
|
|
11
|
+
const rule = resolveSyncRule(config, repoPath, config.activeProfile);
|
|
12
12
|
if (rule === undefined) {
|
|
13
13
|
return false;
|
|
14
14
|
}
|
|
15
|
-
return rule.
|
|
15
|
+
return rule.profile === storageProfile;
|
|
16
16
|
};
|
|
17
17
|
const readArtifactLeaf = async (absolutePath, storagePath, config, snapshot) => {
|
|
18
18
|
const artifact = parseArtifactRelativePath(storagePath);
|
|
19
|
-
if (!
|
|
19
|
+
if (!isActiveStorageProfile(artifact.profile, config, artifact.repoPath)) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
assertStorageSafeRepoPath(artifact.repoPath);
|
|
23
|
-
const rule = resolveSyncRule(config, artifact.repoPath, config.
|
|
23
|
+
const rule = resolveSyncRule(config, artifact.repoPath, config.activeProfile);
|
|
24
24
|
if (rule === undefined) {
|
|
25
25
|
throw new DevsyncError("Repository path is not managed by the current sync configuration.", {
|
|
26
26
|
code: "UNMANAGED_SYNC_PATH",
|
|
@@ -31,13 +31,13 @@ const readArtifactLeaf = async (absolutePath, storagePath, config, snapshot) =>
|
|
|
31
31
|
hint: "Add the parent path to devsync, or remove stray artifacts from the sync repository.",
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
if (rule.
|
|
35
|
-
throw new DevsyncError("Repository artifact is stored under the wrong
|
|
34
|
+
if (rule.profile !== artifact.profile) {
|
|
35
|
+
throw new DevsyncError("Repository artifact is stored under the wrong profile namespace.", {
|
|
36
36
|
code: "REPO_PROFILE_MISMATCH",
|
|
37
37
|
details: [
|
|
38
38
|
`Repository path: ${artifact.repoPath}`,
|
|
39
|
-
`Stored
|
|
40
|
-
`Expected
|
|
39
|
+
`Stored profile: ${artifact.profile}`,
|
|
40
|
+
`Expected profile: ${rule.profile}`,
|
|
41
41
|
],
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -76,7 +76,7 @@ const readArtifactLeaf = async (absolutePath, storagePath, config, snapshot) =>
|
|
|
76
76
|
});
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
const mode = resolveManagedSyncMode(config, artifact.repoPath, config.
|
|
79
|
+
const mode = resolveManagedSyncMode(config, artifact.repoPath, config.activeProfile, storagePath);
|
|
80
80
|
const stats = await lstat(absolutePath);
|
|
81
81
|
if (stats.isSymbolicLink()) {
|
|
82
82
|
if (mode === "secret") {
|
|
@@ -138,14 +138,14 @@ export const buildRepositorySnapshot = async (syncDirectory, config) => {
|
|
|
138
138
|
if (entry.kind !== "directory") {
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
|
-
const rule = resolveSyncRule(config, entry.repoPath, config.
|
|
141
|
+
const rule = resolveSyncRule(config, entry.repoPath, config.activeProfile);
|
|
142
142
|
if (rule === undefined) {
|
|
143
143
|
continue;
|
|
144
144
|
}
|
|
145
145
|
const hasTrackedChildren = [...snapshot.keys()].some((repoPath) => {
|
|
146
146
|
return repoPath.startsWith(`${entry.repoPath}/`);
|
|
147
147
|
});
|
|
148
|
-
const expectedPath = join(artifactsDirectory, rule.
|
|
148
|
+
const expectedPath = join(artifactsDirectory, rule.profile, ...entry.repoPath.split("/"));
|
|
149
149
|
const expectedStats = await getPathStats(expectedPath);
|
|
150
150
|
if (expectedStats !== undefined && !expectedStats.isDirectory()) {
|
|
151
151
|
throw new DevsyncError("Directory sync entry is not stored as a directory in the repository.", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type ResolvedSyncConfig, type
|
|
3
|
-
export type
|
|
1
|
+
import { type ActiveProfileSelection, type GlobalDevsyncConfig } from "#app/config/global-config.js";
|
|
2
|
+
import { type ResolvedSyncConfig, type SyncAgeConfig } from "#app/config/sync.js";
|
|
3
|
+
export type RuntimeAgeConfig = Readonly<{
|
|
4
4
|
configuredIdentityFile: string;
|
|
5
5
|
identityFile: string;
|
|
6
6
|
recipients: readonly string[];
|
|
@@ -12,29 +12,20 @@ export type SyncPaths = Readonly<{
|
|
|
12
12
|
homeDirectory: string;
|
|
13
13
|
syncDirectory: string;
|
|
14
14
|
}>;
|
|
15
|
-
export type SyncContext = Readonly<{
|
|
16
|
-
cwd: string;
|
|
17
|
-
environment: NodeJS.ProcessEnv;
|
|
18
|
-
paths: SyncPaths;
|
|
19
|
-
}>;
|
|
20
15
|
export type EffectiveSyncConfig = ResolvedSyncConfig & Readonly<{
|
|
21
|
-
|
|
22
|
-
age:
|
|
16
|
+
activeProfile?: string;
|
|
17
|
+
age: RuntimeAgeConfig;
|
|
23
18
|
}>;
|
|
24
19
|
export type LoadedSyncConfig = Readonly<{
|
|
25
20
|
effectiveConfig: EffectiveSyncConfig;
|
|
26
21
|
fullConfig: ResolvedSyncConfig;
|
|
27
22
|
globalConfig?: GlobalDevsyncConfig;
|
|
28
23
|
}>;
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export declare const resolveAgeFromSyncConfig: (age: ResolvedSyncConfigAge, environment: NodeJS.ProcessEnv) => ResolvedAgeConfig;
|
|
36
|
-
export declare const buildEffectiveSyncConfig: (fullConfig: ResolvedSyncConfig, selection: ActiveMachineSelection, age: ResolvedAgeConfig) => EffectiveSyncConfig;
|
|
37
|
-
export declare const loadSyncConfig: (context: SyncContext, options?: Readonly<{
|
|
38
|
-
machine?: string;
|
|
24
|
+
export declare const resolveSyncPaths: (environment?: NodeJS.ProcessEnv) => SyncPaths;
|
|
25
|
+
export declare const ensureSyncRepository: (syncDirectory: string) => Promise<void>;
|
|
26
|
+
export declare const resolveAgeFromSyncConfig: (age: SyncAgeConfig, environment: NodeJS.ProcessEnv) => RuntimeAgeConfig;
|
|
27
|
+
export declare const buildEffectiveSyncConfig: (fullConfig: ResolvedSyncConfig, selection: ActiveProfileSelection, age: RuntimeAgeConfig) => EffectiveSyncConfig;
|
|
28
|
+
export declare const loadSyncConfig: (syncDirectory: string, environment: NodeJS.ProcessEnv, options?: Readonly<{
|
|
29
|
+
profile?: string;
|
|
39
30
|
}>) => Promise<LoadedSyncConfig>;
|
|
40
31
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/services/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EAIzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/services/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B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C,UAAU,EAC9B,UAAS,QAAQ,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAM,KACN,OAAO,CAAC,gBAAgB,CA6B1B,CAAC"}
|
package/dist/services/runtime.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { readGlobalDevsyncConfig,
|
|
2
|
-
import { readSyncConfig, resolveSyncArtifactsDirectoryPath, resolveSyncConfigFilePath,
|
|
1
|
+
import { readGlobalDevsyncConfig, resolveActiveProfileSelection, resolveConfiguredIdentityFile, } from "#app/config/global-config.js";
|
|
2
|
+
import { readSyncConfig, resolveSyncArtifactsDirectoryPath, resolveSyncConfigFilePath, syncDefaultProfile, } from "#app/config/sync.js";
|
|
3
3
|
import { resolveDevsyncGlobalConfigFilePath, resolveDevsyncSyncDirectory, resolveHomeDirectory, } from "#app/config/xdg.js";
|
|
4
4
|
import { DevsyncError } from "./error.js";
|
|
5
5
|
import { ensureGitRepository } from "./git.js";
|
|
6
|
-
export const
|
|
6
|
+
export const resolveSyncPaths = (environment = process.env) => {
|
|
7
7
|
const syncDirectory = resolveDevsyncSyncDirectory(environment);
|
|
8
8
|
return {
|
|
9
9
|
artifactsDirectory: resolveSyncArtifactsDirectoryPath(syncDirectory),
|
|
@@ -13,16 +13,8 @@ export const createSyncPaths = (environment = process.env) => {
|
|
|
13
13
|
syncDirectory,
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
-
export const
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
cwd: options.cwd ?? process.cwd(),
|
|
20
|
-
environment,
|
|
21
|
-
paths: createSyncPaths(environment),
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export const ensureSyncRepository = async (context) => {
|
|
25
|
-
await ensureGitRepository(context.paths.syncDirectory);
|
|
16
|
+
export const ensureSyncRepository = async (syncDirectory) => {
|
|
17
|
+
await ensureGitRepository(syncDirectory);
|
|
26
18
|
};
|
|
27
19
|
export const resolveAgeFromSyncConfig = (age, environment) => {
|
|
28
20
|
return {
|
|
@@ -32,36 +24,37 @@ export const resolveAgeFromSyncConfig = (age, environment) => {
|
|
|
32
24
|
};
|
|
33
25
|
};
|
|
34
26
|
export const buildEffectiveSyncConfig = (fullConfig, selection, age) => {
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
?
|
|
38
|
-
:
|
|
39
|
-
const entries = fullConfig.entries.filter((entry) => entry.
|
|
27
|
+
const activeProfile = selection.mode === "single" ? selection.profile : undefined;
|
|
28
|
+
const effectiveProfile = activeProfile !== undefined && activeProfile !== syncDefaultProfile
|
|
29
|
+
? activeProfile
|
|
30
|
+
: syncDefaultProfile;
|
|
31
|
+
const entries = fullConfig.entries.filter((entry) => entry.profiles.length === 0 || entry.profiles.includes(effectiveProfile));
|
|
40
32
|
return {
|
|
41
33
|
...fullConfig,
|
|
42
34
|
entries,
|
|
43
35
|
age,
|
|
44
|
-
...(
|
|
36
|
+
...(activeProfile !== undefined ? { activeProfile } : {}),
|
|
45
37
|
};
|
|
46
38
|
};
|
|
47
|
-
export const loadSyncConfig = async (
|
|
48
|
-
const fullConfig = await readSyncConfig(
|
|
49
|
-
const globalConfig = await readGlobalDevsyncConfig(
|
|
50
|
-
const selection = options.
|
|
51
|
-
?
|
|
39
|
+
export const loadSyncConfig = async (syncDirectory, environment, options = {}) => {
|
|
40
|
+
const fullConfig = await readSyncConfig(syncDirectory, environment);
|
|
41
|
+
const globalConfig = await readGlobalDevsyncConfig(environment);
|
|
42
|
+
const selection = options.profile === undefined
|
|
43
|
+
? resolveActiveProfileSelection(globalConfig)
|
|
52
44
|
: {
|
|
53
|
-
|
|
45
|
+
profile: options.profile,
|
|
54
46
|
mode: "single",
|
|
55
47
|
};
|
|
56
48
|
const rawAge = fullConfig.age;
|
|
57
49
|
if (rawAge === undefined) {
|
|
50
|
+
const configPath = resolveSyncConfigFilePath(syncDirectory);
|
|
58
51
|
throw new DevsyncError("Age configuration is missing from manifest.json.", {
|
|
59
52
|
code: "AGE_CONFIG_MISSING",
|
|
60
|
-
details: [`Config file: ${
|
|
53
|
+
details: [`Config file: ${configPath}`],
|
|
61
54
|
hint: "Run 'devsync init' to set up encryption.",
|
|
62
55
|
});
|
|
63
56
|
}
|
|
64
|
-
const age = resolveAgeFromSyncConfig(rawAge,
|
|
57
|
+
const age = resolveAgeFromSyncConfig(rawAge, environment);
|
|
65
58
|
return {
|
|
66
59
|
effectiveConfig: buildEffectiveSyncConfig(fullConfig, selection, age),
|
|
67
60
|
fullConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/services/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EACvB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/services/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,uBAAuB,EACvB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,cAAc,EACd,iCAAiC,EACjC,yBAAyB,EAEzB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA4B/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,cAAiC,OAAO,CAAC,GAAG,EACjC,EAAE;IACb,MAAM,aAAa,GAAG,2BAA2B,CAAC,WAAW,CAAC,CAAC;IAE/D,OAAO;QACL,kBAAkB,EAAE,iCAAiC,CAAC,aAAa,CAAC;QACpE,UAAU,EAAE,yBAAyB,CAAC,aAAa,CAAC;QACpD,gBAAgB,EAAE,kCAAkC,CAAC,WA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CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,aAAqB,EACrB,WAA8B,EAC9B,UAEK,EAAE,EACoB,EAAE;IAC7B,MAAM,UAAU,GAAG,MAAM,cAAc,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,MAAM,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAChE,MAAM,SAAS,GACb,OAAO,CAAC,OAAO,KAAK,SAAS;QAC3B,CAAC,CAAC,6BAA6B,CAAC,YAAY,CAAC;QAC7C,CAAC,CAAC;YACE,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,IAAI,EAAE,QAAiB;SACxB,CAAC;IAER,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC;IAE9B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,yBAAyB,CAAC,aAAa,CAAC,CAAC;QAC5D,MAAM,IAAI,YAAY,CAAC,kDAAkD,EAAE;YACzE,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,CAAC,gBAAgB,UAAU,EAAE,CAAC;YACvC,IAAI,EAAE,0CAA0C;SACjD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,GAAG,GAAG,wBAAwB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAE1D,OAAO;QACL,eAAe,EAAE,wBAAwB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,CAAC;QACrE,UAAU;QACV,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC;KACxD,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/services/set.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { readSyncConfig, type SyncMode } from "#app/config/sync.js";
|
|
2
|
-
import { type SyncContext } from "./runtime.js";
|
|
3
2
|
export type SyncSetRequest = Readonly<{
|
|
4
|
-
|
|
3
|
+
mode: SyncMode;
|
|
5
4
|
target: string;
|
|
6
5
|
}>;
|
|
7
6
|
type SyncSetAction = "added" | "removed" | "unchanged" | "updated";
|
|
@@ -16,23 +15,22 @@ export type SyncSetResult = Readonly<{
|
|
|
16
15
|
reason?: SyncSetReason;
|
|
17
16
|
syncDirectory: string;
|
|
18
17
|
}>;
|
|
19
|
-
export declare const resolveSetTarget: (target: string, config: Awaited<ReturnType<typeof readSyncConfig>>,
|
|
18
|
+
export declare const resolveSetTarget: (target: string, config: Awaited<ReturnType<typeof readSyncConfig>>, environment: NodeJS.ProcessEnv, cwd: string, homeDirectory: string) => Promise<{
|
|
20
19
|
entry: Readonly<{
|
|
21
|
-
configuredLocalPath: import("../config/platform.js").
|
|
20
|
+
configuredLocalPath: import("../config/platform.js").PlatformLocalPath;
|
|
22
21
|
kind: import("#app/config/sync.js").SyncConfigEntryKind;
|
|
23
22
|
localPath: string;
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
profiles: readonly string[];
|
|
24
|
+
profilesExplicit: boolean;
|
|
26
25
|
mode: SyncMode;
|
|
27
26
|
modeExplicit: boolean;
|
|
28
|
-
name: string;
|
|
29
27
|
repoPath: string;
|
|
30
28
|
}>;
|
|
31
29
|
localPath: string;
|
|
32
30
|
relativePath: string;
|
|
33
31
|
repoPath: string;
|
|
34
|
-
stats: import("
|
|
32
|
+
stats: import("fs").Stats | undefined;
|
|
35
33
|
}>;
|
|
36
|
-
export declare const setSyncTargetMode: (request: SyncSetRequest,
|
|
34
|
+
export declare const setSyncTargetMode: (request: SyncSetRequest, environment: NodeJS.ProcessEnv, cwd: string) => Promise<SyncSetResult>;
|
|
37
35
|
export {};
|
|
38
36
|
//# sourceMappingURL=set.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/services/set.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,cAAc,EAEd,KAAK,QAAQ,EACd,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/services/set.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,cAAc,EAEd,KAAK,QAAQ,EACd,MAAM,qBAAqB,CAAC;AAiB7B,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH,KAAK,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AACnE,KAAK,aAAa,GAAG,aAAa,CAAC;AAEnC,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAUH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,MAAM,EACd,QAAQ,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,EAClD,aAAa,MAAM,CAAC,UAAU,EAC9B,KAAK,MAAM,EACX,eAAe,MAAM;;;;;;;;;;;;;;;EAsItB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,cAAc,EACvB,aAAa,MAAM,CAAC,UAAU,EAC9B,KAAK,MAAM,KACV,OAAO,CAAC,aAAa,CAwGvB,CAAC"}
|