@g3nomaly/core 0.3.1 → 0.3.3
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 +122 -0
- package/dist/cli/commands/add.d.ts +24 -4
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/add.js +37 -14
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/conflict.d.ts +52 -0
- package/dist/cli/commands/conflict.d.ts.map +1 -0
- package/dist/cli/commands/conflict.js +88 -0
- package/dist/cli/commands/conflict.js.map +1 -0
- package/dist/cli/commands/installFromSources.d.ts +42 -13
- package/dist/cli/commands/installFromSources.d.ts.map +1 -1
- package/dist/cli/commands/installFromSources.js +68 -19
- package/dist/cli/commands/installFromSources.js.map +1 -1
- package/dist/cli/commands/ls.d.ts +13 -3
- package/dist/cli/commands/ls.d.ts.map +1 -1
- package/dist/cli/commands/ls.js +26 -6
- package/dist/cli/commands/ls.js.map +1 -1
- package/dist/cli/commands/remove.d.ts +7 -1
- package/dist/cli/commands/remove.d.ts.map +1 -1
- package/dist/cli/commands/remove.js +15 -1
- package/dist/cli/commands/remove.js.map +1 -1
- package/dist/cli/commands/sources.d.ts +34 -10
- package/dist/cli/commands/sources.d.ts.map +1 -1
- package/dist/cli/commands/sources.js +17 -3
- package/dist/cli/commands/sources.js.map +1 -1
- package/dist/cli/commands/update.d.ts +11 -4
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +32 -14
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/dialogue.d.ts +65 -13
- package/dist/cli/dialogue.d.ts.map +1 -1
- package/dist/cli/dialogue.js +46 -7
- package/dist/cli/dialogue.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installDialogues.d.ts +11 -3
- package/dist/cli/installDialogues.d.ts.map +1 -1
- package/dist/cli/installDialogues.js +22 -5
- package/dist/cli/installDialogues.js.map +1 -1
- package/dist/cli/pick.d.ts +11 -2
- package/dist/cli/pick.d.ts.map +1 -1
- package/dist/cli/pick.js +11 -2
- package/dist/cli/pick.js.map +1 -1
- package/dist/cli/report.d.ts +32 -8
- package/dist/cli/report.d.ts.map +1 -1
- package/dist/cli/report.js +26 -5
- package/dist/cli/report.js.map +1 -1
- package/dist/cli/theme.d.ts +4 -0
- package/dist/cli/theme.d.ts.map +1 -1
- package/dist/cli/theme.js +4 -0
- package/dist/cli/theme.js.map +1 -1
- package/dist/cli/types.d.ts +56 -5
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/config/config.d.ts +32 -7
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +37 -7
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +58 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +0 -10
- package/dist/config/types.js.map +1 -1
- package/dist/hash/hash.d.ts +6 -8
- package/dist/hash/hash.d.ts.map +1 -1
- package/dist/hash/hash.js +7 -8
- package/dist/hash/hash.js.map +1 -1
- package/dist/hash/index.d.ts.map +1 -1
- package/dist/hash/index.js +1 -0
- package/dist/hash/index.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/installer/classify.d.ts +27 -1
- package/dist/installer/classify.d.ts.map +1 -1
- package/dist/installer/classify.js +36 -1
- package/dist/installer/classify.js.map +1 -1
- package/dist/installer/files.d.ts +10 -6
- package/dist/installer/files.d.ts.map +1 -1
- package/dist/installer/files.js +4 -3
- package/dist/installer/files.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +1 -1
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/install.d.ts +18 -6
- package/dist/installer/install.d.ts.map +1 -1
- package/dist/installer/install.js +20 -7
- package/dist/installer/install.js.map +1 -1
- package/dist/installer/io.d.ts +6 -1
- package/dist/installer/io.d.ts.map +1 -1
- package/dist/installer/io.js +6 -1
- package/dist/installer/io.js.map +1 -1
- package/dist/installer/manifest.d.ts +29 -19
- package/dist/installer/manifest.d.ts.map +1 -1
- package/dist/installer/manifest.js +20 -10
- package/dist/installer/manifest.js.map +1 -1
- package/dist/installer/manifestSources.d.ts +18 -7
- package/dist/installer/manifestSources.d.ts.map +1 -1
- package/dist/installer/manifestSources.js +18 -7
- package/dist/installer/manifestSources.js.map +1 -1
- package/dist/installer/marketplace.d.ts +24 -12
- package/dist/installer/marketplace.d.ts.map +1 -1
- package/dist/installer/marketplace.js +18 -10
- package/dist/installer/marketplace.js.map +1 -1
- package/dist/installer/origin.d.ts +23 -7
- package/dist/installer/origin.d.ts.map +1 -1
- package/dist/installer/origin.js +14 -7
- package/dist/installer/origin.js.map +1 -1
- package/dist/installer/remove.d.ts +17 -5
- package/dist/installer/remove.d.ts.map +1 -1
- package/dist/installer/remove.js +17 -5
- package/dist/installer/remove.js.map +1 -1
- package/dist/installer/resolve.d.ts +80 -31
- package/dist/installer/resolve.d.ts.map +1 -1
- package/dist/installer/resolve.js +96 -29
- package/dist/installer/resolve.js.map +1 -1
- package/dist/installer/sourceRegistry.d.ts +59 -22
- package/dist/installer/sourceRegistry.d.ts.map +1 -1
- package/dist/installer/sourceRegistry.js +25 -10
- package/dist/installer/sourceRegistry.js.map +1 -1
- package/dist/installer/types.d.ts +72 -19
- package/dist/installer/types.d.ts.map +1 -1
- package/dist/installer/types.js +18 -8
- package/dist/installer/types.js.map +1 -1
- package/dist/registry/index.d.ts +0 -4
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -4
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/registry.handlers.d.ts +7 -0
- package/dist/registry/registry.handlers.d.ts.map +1 -1
- package/dist/registry/registry.handlers.js.map +1 -1
- package/dist/registry/registry.io.d.ts +23 -7
- package/dist/registry/registry.io.d.ts.map +1 -1
- package/dist/registry/registry.io.js +37 -14
- package/dist/registry/registry.io.js.map +1 -1
- package/dist/registry/registry.mutations.d.ts +10 -3
- package/dist/registry/registry.mutations.d.ts.map +1 -1
- package/dist/registry/registry.mutations.js +10 -3
- package/dist/registry/registry.mutations.js.map +1 -1
- package/dist/registry/registry.selectors.d.ts +41 -11
- package/dist/registry/registry.selectors.d.ts.map +1 -1
- package/dist/registry/registry.selectors.js +41 -11
- package/dist/registry/registry.selectors.js.map +1 -1
- package/dist/registry/registry.store.d.ts +22 -9
- package/dist/registry/registry.store.d.ts.map +1 -1
- package/dist/registry/registry.store.js +12 -3
- package/dist/registry/registry.store.js.map +1 -1
- package/dist/registry/registry.template.d.ts +12 -6
- package/dist/registry/registry.template.d.ts.map +1 -1
- package/dist/registry/registry.template.js +13 -6
- package/dist/registry/registry.template.js.map +1 -1
- package/dist/registry/types.d.ts +17 -3
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.js +16 -6
- package/dist/registry/types.js.map +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -0
- package/dist/security/index.js.map +1 -1
- package/dist/security/securityParser.d.ts +9 -8
- package/dist/security/securityParser.d.ts.map +1 -1
- package/dist/security/securityParser.js +12 -22
- package/dist/security/securityParser.js.map +1 -1
- package/dist/security/securityWorker.d.ts +11 -0
- package/dist/security/securityWorker.d.ts.map +1 -1
- package/dist/security/securityWorker.js +17 -38
- package/dist/security/securityWorker.js.map +1 -1
- package/dist/sources/checkout.d.ts +10 -4
- package/dist/sources/checkout.d.ts.map +1 -1
- package/dist/sources/checkout.js +10 -4
- package/dist/sources/checkout.js.map +1 -1
- package/dist/sources/git.d.ts +5 -3
- package/dist/sources/git.d.ts.map +1 -1
- package/dist/sources/git.js +5 -3
- package/dist/sources/git.js.map +1 -1
- package/dist/sources/local.d.ts +6 -4
- package/dist/sources/local.d.ts.map +1 -1
- package/dist/sources/local.js +6 -4
- package/dist/sources/local.js.map +1 -1
- package/dist/sources/npm.d.ts +10 -7
- package/dist/sources/npm.d.ts.map +1 -1
- package/dist/sources/npm.js +49 -15
- package/dist/sources/npm.js.map +1 -1
- package/dist/sources/parse.d.ts +24 -16
- package/dist/sources/parse.d.ts.map +1 -1
- package/dist/sources/parse.js +40 -18
- package/dist/sources/parse.js.map +1 -1
- package/dist/sources/process.d.ts +10 -7
- package/dist/sources/process.d.ts.map +1 -1
- package/dist/sources/process.js +10 -7
- package/dist/sources/process.js.map +1 -1
- package/dist/sources/register.d.ts +20 -5
- package/dist/sources/register.d.ts.map +1 -1
- package/dist/sources/register.js +20 -5
- package/dist/sources/register.js.map +1 -1
- package/dist/sources/types.d.ts +43 -8
- package/dist/sources/types.d.ts.map +1 -1
- package/dist/sources/types.js +21 -4
- package/dist/sources/types.js.map +1 -1
- package/dist/utils/errors.d.ts +6 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +6 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/merge.d.ts +8 -2
- package/dist/utils/merge.d.ts.map +1 -1
- package/dist/utils/merge.js +9 -2
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/packageMeta.d.ts +16 -2
- package/dist/utils/packageMeta.d.ts.map +1 -1
- package/dist/utils/packageMeta.js +6 -2
- package/dist/utils/packageMeta.js.map +1 -1
- package/dist/utils/paths.d.ts +16 -5
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +16 -5
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/prompt.d.ts +6 -1
- package/dist/utils/prompt.d.ts.map +1 -1
- package/dist/utils/prompt.js +6 -1
- package/dist/utils/prompt.js.map +1 -1
- package/dist/utils/version.d.ts +7 -2
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js +40 -3
- package/dist/utils/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,40 +1,61 @@
|
|
|
1
1
|
import type { BaseFileEntry } from "../registry/types";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* @brief Relation of one installed file to its package version, ordered by severity.
|
|
4
|
+
*
|
|
5
|
+
* Const object standing in for an enum. Every state from `UserOnly` up carries local changes.
|
|
6
|
+
*
|
|
7
|
+
* @property UpToDate - On disk and identical to the package file.
|
|
8
|
+
* @property SafeUpdate - Missing, or unmodified while the package file changed. Writable without data loss.
|
|
9
|
+
* @property UserOnly - Modified locally while the package file is unchanged.
|
|
10
|
+
* @property Conflict - Modified locally and the package file changed too.
|
|
6
11
|
*/
|
|
7
12
|
export declare const FileState: {
|
|
8
|
-
/** On disk and identical to the package file */
|
|
9
13
|
readonly UpToDate: 0;
|
|
10
|
-
/** Missing, or unmodified while the package file changed; writable without data loss */
|
|
11
14
|
readonly SafeUpdate: 1;
|
|
12
|
-
/** Modified locally while the package file is unchanged */
|
|
13
15
|
readonly UserOnly: 2;
|
|
14
|
-
/** Modified locally and the package file changed too */
|
|
15
16
|
readonly Conflict: 3;
|
|
16
17
|
};
|
|
18
|
+
/** One of the `FileState` values. */
|
|
17
19
|
export type FileState = (typeof FileState)[keyof typeof FileState];
|
|
18
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* @brief Choice for an entry whose files have local changes (`UserOnly` and `Conflict`).
|
|
22
|
+
*
|
|
23
|
+
* Const object standing in for an enum. `remove` offers only `Keep` and `Overwrite`.
|
|
24
|
+
*
|
|
25
|
+
* @property Keep - Skip: leave the changed files alone and keep their install-time hash, so the next run asks again.
|
|
26
|
+
* @property Overwrite - Restore: write the source version over the changes.
|
|
27
|
+
* @property Fork - Keep the files as they are under a new key that no update touches.
|
|
28
|
+
*/
|
|
19
29
|
export declare const ConflictDecision: {
|
|
20
30
|
readonly Keep: 0;
|
|
21
31
|
readonly Overwrite: 1;
|
|
32
|
+
readonly Fork: 2;
|
|
22
33
|
};
|
|
34
|
+
/** One of the `ConflictDecision` values. */
|
|
23
35
|
export type ConflictDecision = (typeof ConflictDecision)[keyof typeof ConflictDecision];
|
|
24
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* @brief Classification of one file, produced by `classifyFiles` and consumed by `applyClassifications`.
|
|
38
|
+
*
|
|
39
|
+
* @property file - Registry entry of the file, with the hash the package ships.
|
|
40
|
+
* @property destPath - Absolute path the file is installed at: `installDir` joined with `file.path`.
|
|
41
|
+
* @property state - What the install or update does with the file.
|
|
42
|
+
* @property exists - Whether a file is on disk at `destPath`.
|
|
43
|
+
* @property currentHash - Hash of the file on disk, e.g. `"a1b2"`. `null` when it does not exist.
|
|
44
|
+
* @property recordedHash - Hash recorded in the user manifest at install time. `undefined` when never installed.
|
|
45
|
+
* @property latestHash - Hash of the package's current version of the file.
|
|
46
|
+
*/
|
|
25
47
|
export interface FileClassification<F extends BaseFileEntry = BaseFileEntry> {
|
|
26
48
|
file: F;
|
|
27
49
|
destPath: string;
|
|
28
50
|
state: FileState;
|
|
29
51
|
exists: boolean;
|
|
30
|
-
/** Hash of the file currently on disk, null when it does not exist */
|
|
31
52
|
currentHash: string | null;
|
|
32
|
-
/** Hash recorded in the user manifest at install time, undefined when never installed */
|
|
33
53
|
recordedHash: string | undefined;
|
|
34
|
-
/** Hash of the package's current version of the file */
|
|
35
54
|
latestHash: string;
|
|
36
55
|
}
|
|
37
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Where a file's content comes from when it is written. `null` skips the file.
|
|
58
|
+
*/
|
|
38
59
|
export type FileContent = {
|
|
39
60
|
kind: "copy";
|
|
40
61
|
sourcePath: string;
|
|
@@ -42,10 +63,24 @@ export type FileContent = {
|
|
|
42
63
|
kind: "write";
|
|
43
64
|
content: string;
|
|
44
65
|
} | null;
|
|
66
|
+
/**
|
|
67
|
+
* @brief Produces the content of one file for `applyClassifications`.
|
|
68
|
+
*
|
|
69
|
+
* @param file - Registry entry of the file to produce content for.
|
|
70
|
+
* @returns Where the content comes from, or `null` to skip the file.
|
|
71
|
+
*/
|
|
45
72
|
export type FileSource<F extends BaseFileEntry = BaseFileEntry> = (file: F) => FileContent | Promise<FileContent>;
|
|
46
73
|
/**
|
|
47
|
-
* Filesystem boundary for the installer. `createInstallerIO` supplies the
|
|
48
|
-
*
|
|
74
|
+
* @brief Filesystem boundary for the installer. `createInstallerIO` supplies the real implementation; tests inject stubs per field.
|
|
75
|
+
*
|
|
76
|
+
* @property exists - Whether a path exists on disk.
|
|
77
|
+
* @property ensureDir - Creates a directory and its parents when missing.
|
|
78
|
+
* @property copyFile - Copies the file at `src` to `dest`.
|
|
79
|
+
* @property writeFile - Writes `content` to `dest` as UTF-8.
|
|
80
|
+
* @property removeFile - Deletes the file at `path`.
|
|
81
|
+
* @property listDir - Names of the entries directly inside `dir`.
|
|
82
|
+
* @property removeDir - Deletes `dir` and everything below it.
|
|
83
|
+
* @property hashFile - Content hash of the file at `path`.
|
|
49
84
|
*/
|
|
50
85
|
export interface InstallerIO {
|
|
51
86
|
exists: (path: string) => boolean;
|
|
@@ -57,21 +92,39 @@ export interface InstallerIO {
|
|
|
57
92
|
removeDir: (dir: string) => void;
|
|
58
93
|
hashFile: (path: string) => Promise<string>;
|
|
59
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* @brief Options that decide which changed files `applyClassifications` writes.
|
|
97
|
+
*
|
|
98
|
+
* @property decision - What to do with entries that have local changes.
|
|
99
|
+
* @property force - Writes changed files even when `decision` is not `Overwrite`.
|
|
100
|
+
* @property dryRun - Reports the result without touching the disk.
|
|
101
|
+
*/
|
|
60
102
|
export interface ApplyOptions {
|
|
61
103
|
decision: ConflictDecision;
|
|
62
104
|
force?: boolean;
|
|
63
105
|
dryRun?: boolean;
|
|
64
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* @brief Outcome of `applyClassifications`, per file.
|
|
109
|
+
*
|
|
110
|
+
* @property written - Relative paths written, or that would be written under `dryRun`.
|
|
111
|
+
* @property kept - Relative paths with local changes that were left alone.
|
|
112
|
+
* @property missingSource - Relative paths whose source produced no content.
|
|
113
|
+
* @property files - Manifest entries reflecting the on-disk state after the apply.
|
|
114
|
+
*/
|
|
65
115
|
export interface ApplyResult<F extends BaseFileEntry = BaseFileEntry> {
|
|
66
|
-
/** Relative paths written (or that would be written under dryRun) */
|
|
67
116
|
written: string[];
|
|
68
|
-
/** Relative paths with local changes that were left alone */
|
|
69
117
|
kept: string[];
|
|
70
|
-
/** Relative paths whose source produced no content */
|
|
71
118
|
missingSource: string[];
|
|
72
|
-
/** Manifest entries reflecting the on-disk state after the apply */
|
|
73
119
|
files: F[];
|
|
74
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* @brief Outcome of removing installed files.
|
|
123
|
+
*
|
|
124
|
+
* @property removed - Relative paths deleted.
|
|
125
|
+
* @property kept - Relative paths with local changes that were left alone.
|
|
126
|
+
* @property missing - Relative paths that were not on disk.
|
|
127
|
+
*/
|
|
75
128
|
export interface RemoveResult {
|
|
76
129
|
removed: string[];
|
|
77
130
|
kept: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/installer/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/installer/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS;aACpB,QAAQ,EAAI,CAAC;aACb,UAAU,EAAE,CAAC;aACb,QAAQ,EAAI,CAAC;aACb,QAAQ,EAAI,CAAC;CACL,CAAA;AACV,qCAAqC;AACrC,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA;AAElE;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;aAC3B,IAAI,EAAO,CAAC;aACZ,SAAS,EAAE,CAAC;aACZ,IAAI,EAAO,CAAC;CACJ,CAAA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AM,KAAK,MAAM,EAAE,CAAA;IACrC,SAAS,EAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,QAAQ,EAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC9C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,KAAK,CAAC,EAAI,OAAO,CAAA;IACjB,MAAM,CAAC,EAAG,OAAO,CAAA;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IAClE,OAAO,EAAQ,MAAM,EAAE,CAAA;IACvB,IAAI,EAAW,MAAM,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,KAAK,EAAU,CAAC,EAAE,CAAA;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,IAAI,EAAK,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB"}
|
package/dist/installer/types.js
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* @brief Relation of one installed file to its package version, ordered by severity.
|
|
3
|
+
*
|
|
4
|
+
* Const object standing in for an enum. Every state from `UserOnly` up carries local changes.
|
|
5
|
+
*
|
|
6
|
+
* @property UpToDate - On disk and identical to the package file.
|
|
7
|
+
* @property SafeUpdate - Missing, or unmodified while the package file changed. Writable without data loss.
|
|
8
|
+
* @property UserOnly - Modified locally while the package file is unchanged.
|
|
9
|
+
* @property Conflict - Modified locally and the package file changed too.
|
|
5
10
|
*/
|
|
6
11
|
export const FileState = {
|
|
7
|
-
/** On disk and identical to the package file */
|
|
8
12
|
UpToDate: 0,
|
|
9
|
-
/** Missing, or unmodified while the package file changed; writable without data loss */
|
|
10
13
|
SafeUpdate: 1,
|
|
11
|
-
/** Modified locally while the package file is unchanged */
|
|
12
14
|
UserOnly: 2,
|
|
13
|
-
/** Modified locally and the package file changed too */
|
|
14
15
|
Conflict: 3,
|
|
15
16
|
};
|
|
16
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* @brief Choice for an entry whose files have local changes (`UserOnly` and `Conflict`).
|
|
19
|
+
*
|
|
20
|
+
* Const object standing in for an enum. `remove` offers only `Keep` and `Overwrite`.
|
|
21
|
+
*
|
|
22
|
+
* @property Keep - Skip: leave the changed files alone and keep their install-time hash, so the next run asks again.
|
|
23
|
+
* @property Overwrite - Restore: write the source version over the changes.
|
|
24
|
+
* @property Fork - Keep the files as they are under a new key that no update touches.
|
|
25
|
+
*/
|
|
17
26
|
export const ConflictDecision = {
|
|
18
27
|
Keep: 0,
|
|
19
28
|
Overwrite: 1,
|
|
29
|
+
Fork: 2,
|
|
20
30
|
};
|
|
21
31
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/installer/types.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/installer/types.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,QAAQ,EAAI,CAAC;IACb,UAAU,EAAE,CAAC;IACb,QAAQ,EAAI,CAAC;IACb,QAAQ,EAAI,CAAC;CACL,CAAA;AAIV;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAO,CAAC;IACZ,SAAS,EAAE,CAAC;IACZ,IAAI,EAAO,CAAC;CACJ,CAAA"}
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -5,8 +5,4 @@ export * from "./registry.mutations";
|
|
|
5
5
|
export * from "./registry.selectors";
|
|
6
6
|
export * from "./registry.template";
|
|
7
7
|
export * from "./registry.io";
|
|
8
|
-
/**
|
|
9
|
-
* Purposfully a custom registry store. To reduce dependencies. Still follows the same pattern as the tanstack store design skill. Though it could still be improved since it is still missing a lot of default operators.
|
|
10
|
-
* Nevertheless, this stores doesn't need reactive updates. Hence, once more the, part of why it is a custom store.
|
|
11
|
-
*/
|
|
12
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
|
package/dist/registry/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/core/src/registry/index.ts
|
|
1
2
|
export * from "./types";
|
|
2
3
|
export * from "./registry.handlers";
|
|
3
4
|
export * from "./registry.store";
|
|
@@ -5,8 +6,4 @@ export * from "./registry.mutations";
|
|
|
5
6
|
export * from "./registry.selectors";
|
|
6
7
|
export * from "./registry.template";
|
|
7
8
|
export * from "./registry.io";
|
|
8
|
-
/**
|
|
9
|
-
* Purposfully a custom registry store. To reduce dependencies. Still follows the same pattern as the tanstack store design skill. Though it could still be improved since it is still missing a lot of default operators.
|
|
10
|
-
* Nevertheless, this stores doesn't need reactive updates. Hence, once more the, part of why it is a custom store.
|
|
11
|
-
*/
|
|
12
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { BaseRegistry, BaseRegistryEntry } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* @brief Converts a registry map to and from the text of a manifest file.
|
|
4
|
+
*
|
|
5
|
+
* @property extensions - File extensions this handler reads and writes, without the dot, e.g. `json`.
|
|
6
|
+
* @property serialize - Turns the registry map into file text.
|
|
7
|
+
* @property deserialize - Parses file text back into a registry map.
|
|
8
|
+
*/
|
|
2
9
|
export interface RegistryHandler<T extends BaseRegistryEntry = BaseRegistryEntry> {
|
|
3
10
|
extensions: string[];
|
|
4
11
|
serialize: (data: BaseRegistry<T>) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.handlers.d.ts","sourceRoot":"","sources":["../../src/registry/registry.handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.handlers.d.ts","sourceRoot":"","sources":["../../src/registry/registry.handlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE9D;;;;;;GAMG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IAC9E,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,MAAM,CAAA;IAC5C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,CAAA;CAC9C;AAED,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,GAAG,CAO1C,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,GAAG,CAI5C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.handlers.js","sourceRoot":"","sources":["../../src/registry/registry.handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.handlers.js","sourceRoot":"","sources":["../../src/registry/registry.handlers.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,SAAS,GAAyB;IAC7C,UAAU,EAAE,CAAC,IAAI,CAAC;IAClB,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,2BAA2B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa;IACvE,WAAW,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;IAC5E,CAAC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;CACtC,CAAA"}
|
|
@@ -2,21 +2,37 @@ import type { BaseRegistryEntry } from "./types";
|
|
|
2
2
|
import type { RegistryStore } from "./registry.store";
|
|
3
3
|
import type { RegistryHandler } from "./registry.handlers";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @brief Alias of `load()` that takes an explicit file path. Behaves the same.
|
|
6
|
+
*
|
|
7
|
+
* @param registry - Store to hydrate.
|
|
8
|
+
* @param filePath - Absolute path to read from.
|
|
6
9
|
*/
|
|
7
10
|
export declare function loadFrom<T extends BaseRegistryEntry>(registry: RegistryStore<T>, filePath: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* @brief Hydrates the store from a file.
|
|
13
|
+
*
|
|
14
|
+
* A `.ts` file is read by dynamic import, which skips the handler, since such a file exports a `registry`
|
|
15
|
+
* object directly at runtime. Any other file is read with `readFileSync` and `handler.deserialize`.
|
|
16
|
+
* Does nothing when there is no file path or the file does not exist yet.
|
|
17
|
+
*
|
|
18
|
+
* @param registry - Store to hydrate.
|
|
19
|
+
* @param filePath - File to read. Defaults to the store's bound `filePath`.
|
|
20
|
+
*/
|
|
8
21
|
export declare function load<T extends BaseRegistryEntry>(registry: RegistryStore<T>, filePath?: string): Promise<void>;
|
|
9
22
|
/**
|
|
10
|
-
*
|
|
11
|
-
* Sorts entries alphabetically for deterministic output.
|
|
23
|
+
* @brief Writes the store to its bound `filePath`, entries sorted by key.
|
|
12
24
|
*
|
|
13
|
-
* @
|
|
25
|
+
* @param registry - Store to write.
|
|
26
|
+
* @param handler - Serialization handler. Defaults to the store's handler, then `tsHandler`.
|
|
27
|
+
* @throws {Error} When the store has no bound `filePath`.
|
|
14
28
|
*/
|
|
15
29
|
export declare function flush<T extends BaseRegistryEntry>(registry: RegistryStore<T>, handler?: RegistryHandler<T>): void;
|
|
16
30
|
/**
|
|
17
|
-
* Writes the store to an explicit path.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
31
|
+
* @brief Writes the store to an explicit path, entries sorted by key. The store's bound `filePath` is not changed.
|
|
32
|
+
*
|
|
33
|
+
* @param registry - Store to write.
|
|
34
|
+
* @param filePath - Absolute path to write to.
|
|
35
|
+
* @param handler - Serialization handler. Defaults to the store's handler, then `tsHandler`.
|
|
20
36
|
*/
|
|
21
37
|
export declare function writeTo<T extends BaseRegistryEntry>(registry: RegistryStore<T>, filePath: string, handler?: RegistryHandler<T>): void;
|
|
22
38
|
//# sourceMappingURL=registry.io.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.io.d.ts","sourceRoot":"","sources":["../../src/registry/registry.io.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.io.d.ts","sourceRoot":"","sources":["../../src/registry/registry.io.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAqC1D;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,iBAAiB,EACxD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAEf;AAMD;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EACpD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAMD;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,iBAAiB,EAC/C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAC3B,IAAI,CASN;AAMD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,iBAAiB,EACjD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAC3B,IAAI,CAGN"}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
// packages/core/src/registry/registry.io.ts
|
|
1
2
|
import { writeFileSync, readFileSync } from "node:fs";
|
|
2
3
|
import { tsHandler } from "./registry.handlers";
|
|
3
4
|
// ---------------------------------------------------------------------------
|
|
4
5
|
// Helpers
|
|
5
6
|
// ---------------------------------------------------------------------------
|
|
7
|
+
/**
|
|
8
|
+
* @brief Picks the handler for a read or write: the override, then the store's handler, then `tsHandler`.
|
|
9
|
+
*
|
|
10
|
+
* @param registry - Store whose handler is the fallback.
|
|
11
|
+
* @param override - Handler passed by the caller, if any.
|
|
12
|
+
* @returns The handler to use.
|
|
13
|
+
*/
|
|
6
14
|
function resolveHandler(registry, override) {
|
|
7
15
|
return override ?? registry.handler ?? tsHandler;
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @brief Returns the store's entries sorted by key, for deterministic output.
|
|
19
|
+
*
|
|
20
|
+
* @param registry - Store to read from.
|
|
21
|
+
* @returns Entries by key, in alphabetical key order.
|
|
22
|
+
*/
|
|
9
23
|
function sortedEntries(registry) {
|
|
10
24
|
return Object.fromEntries(Object.entries(registry.store.state).sort(([a], [b]) => a.localeCompare(b)));
|
|
11
25
|
}
|
|
@@ -13,21 +27,27 @@ function sortedEntries(registry) {
|
|
|
13
27
|
// loadFrom (file → store)
|
|
14
28
|
// ---------------------------------------------------------------------------
|
|
15
29
|
/**
|
|
16
|
-
*
|
|
30
|
+
* @brief Alias of `load()` that takes an explicit file path. Behaves the same.
|
|
31
|
+
*
|
|
32
|
+
* @param registry - Store to hydrate.
|
|
33
|
+
* @param filePath - Absolute path to read from.
|
|
17
34
|
*/
|
|
18
35
|
export async function loadFrom(registry, filePath) {
|
|
19
36
|
return load(registry, filePath);
|
|
20
37
|
}
|
|
21
38
|
// ---------------------------------------------------------------------------
|
|
22
39
|
// load (file → store)
|
|
23
|
-
//
|
|
24
|
-
// Hydrates the store from its bound filePath.
|
|
25
|
-
// - .ts files: uses dynamic import (handler is not called — TS files export
|
|
26
|
-
// a `registry` object directly at runtime via Bun/tsx)
|
|
27
|
-
// - other files: uses readFileSync + handler.deserialize
|
|
28
|
-
//
|
|
29
|
-
// No-op if the store has no filePath or the file does not exist yet.
|
|
30
40
|
// ---------------------------------------------------------------------------
|
|
41
|
+
/**
|
|
42
|
+
* @brief Hydrates the store from a file.
|
|
43
|
+
*
|
|
44
|
+
* A `.ts` file is read by dynamic import, which skips the handler, since such a file exports a `registry`
|
|
45
|
+
* object directly at runtime. Any other file is read with `readFileSync` and `handler.deserialize`.
|
|
46
|
+
* Does nothing when there is no file path or the file does not exist yet.
|
|
47
|
+
*
|
|
48
|
+
* @param registry - Store to hydrate.
|
|
49
|
+
* @param filePath - File to read. Defaults to the store's bound `filePath`.
|
|
50
|
+
*/
|
|
31
51
|
export async function load(registry, filePath) {
|
|
32
52
|
const target = filePath ?? registry.filePath;
|
|
33
53
|
if (!target)
|
|
@@ -51,10 +71,11 @@ export async function load(registry, filePath) {
|
|
|
51
71
|
// flush (store → bound filePath)
|
|
52
72
|
// ---------------------------------------------------------------------------
|
|
53
73
|
/**
|
|
54
|
-
*
|
|
55
|
-
* Sorts entries alphabetically for deterministic output.
|
|
74
|
+
* @brief Writes the store to its bound `filePath`, entries sorted by key.
|
|
56
75
|
*
|
|
57
|
-
* @
|
|
76
|
+
* @param registry - Store to write.
|
|
77
|
+
* @param handler - Serialization handler. Defaults to the store's handler, then `tsHandler`.
|
|
78
|
+
* @throws {Error} When the store has no bound `filePath`.
|
|
58
79
|
*/
|
|
59
80
|
export function flush(registry, handler) {
|
|
60
81
|
if (!registry.filePath) {
|
|
@@ -67,9 +88,11 @@ export function flush(registry, handler) {
|
|
|
67
88
|
// writeTo (store → explicit path)
|
|
68
89
|
// ---------------------------------------------------------------------------
|
|
69
90
|
/**
|
|
70
|
-
* Writes the store to an explicit path.
|
|
71
|
-
*
|
|
72
|
-
*
|
|
91
|
+
* @brief Writes the store to an explicit path, entries sorted by key. The store's bound `filePath` is not changed.
|
|
92
|
+
*
|
|
93
|
+
* @param registry - Store to write.
|
|
94
|
+
* @param filePath - Absolute path to write to.
|
|
95
|
+
* @param handler - Serialization handler. Defaults to the store's handler, then `tsHandler`.
|
|
73
96
|
*/
|
|
74
97
|
export function writeTo(registry, filePath, handler) {
|
|
75
98
|
const h = resolveHandler(registry, handler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.io.js","sourceRoot":"","sources":["../../src/registry/registry.io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,cAAc,CACrB,QAA0B,EAC1B,QAA6B;IAE7B,OAAO,QAAQ,IAAI,QAAQ,CAAC,OAAO,IAAI,SAAS,CAAA;AAClD,CAAC;AAED,SAAS,aAAa,CAA8B,QAA0B;IAC5E,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAC5E,CAAA;AACH,CAAC;AAED,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E
|
|
1
|
+
{"version":3,"file":"registry.io.js","sourceRoot":"","sources":["../../src/registry/registry.io.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;GAMG;AACH,SAAS,cAAc,CACrB,QAA0B,EAC1B,QAA6B;IAE7B,OAAO,QAAQ,IAAI,QAAQ,CAAC,OAAO,IAAI,S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AAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,6CAA6C;IAC/C,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CACnB,QAA0B,EAC1B,OAA4B;IAE5B,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,uFAAuF,CACxF,CAAA;IACH,CAAC;IAED,MAAM,CAAC,GAAG,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC3C,aAAa,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AACjF,CAAC;AAED,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CACrB,QAA0B,EAC1B,QAAgB,EAChB,OAA4B;IAE5B,MAAM,CAAC,GAAG,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC3C,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AACxE,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { BaseRegistryEntry } from "./types";
|
|
2
2
|
import type { RegistryStore } from "./registry.store";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* @brief Registers an entry in the store, overwriting any entry under the same key.
|
|
5
|
+
*
|
|
6
|
+
* @param registry - Store to write to.
|
|
7
|
+
* @param key - Key the entry is stored under.
|
|
8
|
+
* @param entry - Entry to store.
|
|
5
9
|
*/
|
|
6
10
|
export declare function register<T extends BaseRegistryEntry>(registry: RegistryStore<T>, key: string, entry: T): void;
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
12
|
+
* @brief Removes an entry from the store.
|
|
13
|
+
*
|
|
14
|
+
* @param registry - Store to remove from.
|
|
15
|
+
* @param key - Key of the entry to remove.
|
|
16
|
+
* @returns `true` if the entry existed, `false` if it was already absent.
|
|
10
17
|
*/
|
|
11
18
|
export declare function unregister<T extends BaseRegistryEntry>(registry: RegistryStore<T>, key: string): boolean;
|
|
12
19
|
//# sourceMappingURL=registry.mutations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.mutations.d.ts","sourceRoot":"","sources":["../../src/registry/registry.mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.mutations.d.ts","sourceRoot":"","sources":["../../src/registry/registry.mutations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,iBAAiB,EAClD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,GACP,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,iBAAiB,EACpD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,GACV,OAAO,CAYT"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @brief Registers an entry in the store, overwriting any entry under the same key.
|
|
3
|
+
*
|
|
4
|
+
* @param registry - Store to write to.
|
|
5
|
+
* @param key - Key the entry is stored under.
|
|
6
|
+
* @param entry - Entry to store.
|
|
3
7
|
*/
|
|
4
8
|
export function register(registry, key, entry) {
|
|
5
9
|
registry.store.setState((s) => ({ ...s, [key]: entry }));
|
|
6
10
|
}
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
12
|
+
* @brief Removes an entry from the store.
|
|
13
|
+
*
|
|
14
|
+
* @param registry - Store to remove from.
|
|
15
|
+
* @param key - Key of the entry to remove.
|
|
16
|
+
* @returns `true` if the entry existed, `false` if it was already absent.
|
|
10
17
|
*/
|
|
11
18
|
export function unregister(registry, key) {
|
|
12
19
|
const existed = key in registry.store.state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.mutations.js","sourceRoot":"","sources":["../../src/registry/registry.mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.mutations.js","sourceRoot":"","sources":["../../src/registry/registry.mutations.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,QAA0B,EAC1B,GAAW,EACX,KAAQ;IAER,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,QAA0B,EAC1B,GAAW;IAEX,MAAM,OAAO,GAAG,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAA;IAE3C,IAAI,OAAO,EAAE,CAAC;QACZ,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;YACrB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;YAChB,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -1,38 +1,68 @@
|
|
|
1
1
|
import type { BaseRegistry, BaseRegistryEntry } from "./types";
|
|
2
2
|
import type { RegistryStore } from "./registry.store";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* @brief Gets a single entry by key.
|
|
5
|
+
*
|
|
6
|
+
* @param registry - Store to read from.
|
|
7
|
+
* @param key - Key of the entry.
|
|
8
|
+
* @returns The entry, or `undefined` when not found.
|
|
5
9
|
*/
|
|
6
10
|
export declare function get<T extends BaseRegistryEntry>(registry: RegistryStore<T>, key: string): T | undefined;
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
12
|
+
* @brief Checks whether a key exists in the store.
|
|
13
|
+
*
|
|
14
|
+
* @param registry - Store to read from.
|
|
15
|
+
* @param key - Key to look for.
|
|
16
|
+
* @returns `true` when the key is present.
|
|
9
17
|
*/
|
|
10
18
|
export declare function has<T extends BaseRegistryEntry>(registry: RegistryStore<T>, key: string): boolean;
|
|
11
19
|
/**
|
|
12
|
-
*
|
|
20
|
+
* @brief Returns all entries as a plain record.
|
|
21
|
+
*
|
|
22
|
+
* @param registry - Store to read from.
|
|
23
|
+
* @returns Entries by key. This is the store's own state, not a copy.
|
|
13
24
|
*/
|
|
14
25
|
export declare function entries<T extends BaseRegistryEntry>(registry: RegistryStore<T>): BaseRegistry<T>;
|
|
15
26
|
/**
|
|
16
|
-
*
|
|
27
|
+
* @brief Returns all registered keys.
|
|
28
|
+
*
|
|
29
|
+
* @param registry - Store to read from.
|
|
30
|
+
* @returns Keys of the store's state.
|
|
17
31
|
*/
|
|
18
32
|
export declare function keys<T extends BaseRegistryEntry>(registry: RegistryStore<T>): string[];
|
|
19
33
|
/**
|
|
20
|
-
*
|
|
34
|
+
* @brief Returns all entries whose `version` equals the given string.
|
|
35
|
+
*
|
|
36
|
+
* @param registry - Store to read from.
|
|
37
|
+
* @param version - Version to match exactly.
|
|
38
|
+
* @returns Matching entries by key.
|
|
21
39
|
*/
|
|
22
40
|
export declare function getByVersion<T extends BaseRegistryEntry>(registry: RegistryStore<T>, version: string): BaseRegistry<T>;
|
|
23
41
|
/**
|
|
24
|
-
*
|
|
42
|
+
* @brief Returns the count of registered entries.
|
|
43
|
+
*
|
|
44
|
+
* @param registry - Store to read from.
|
|
45
|
+
* @returns Number of entries.
|
|
25
46
|
*/
|
|
26
47
|
export declare function size<T extends BaseRegistryEntry>(registry: RegistryStore<T>): number;
|
|
27
48
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `unknown` and not walked further.
|
|
49
|
+
* @brief Walks `registryDependencies` depth-first, starting at `key`.
|
|
50
|
+
*
|
|
51
|
+
* Every entry reached is added to `seen`. Keys without a registry entry are pushed to `unknown` and not walked further.
|
|
52
|
+
*
|
|
53
|
+
* @param key - Key to start from.
|
|
54
|
+
* @param entries - Registry to walk, by key.
|
|
55
|
+
* @param seen - Keys already reached. Filled in place.
|
|
56
|
+
* @param unknown - Keys with no registry entry. Filled in place.
|
|
31
57
|
*/
|
|
32
58
|
export declare function collectDependencies(key: string, entries: BaseRegistry, seen: Set<string>, unknown: string[]): void;
|
|
33
59
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
60
|
+
* @brief Finds the candidates that depend on `key`, the entries that would break if it were removed.
|
|
61
|
+
*
|
|
62
|
+
* @param key - Key that may be needed.
|
|
63
|
+
* @param entries - Registry to read `registryDependencies` from, by key.
|
|
64
|
+
* @param candidates - Keys to check.
|
|
65
|
+
* @returns The candidates whose `registryDependencies` include `key`.
|
|
36
66
|
*/
|
|
37
67
|
export declare function entryDependencies(key: string, entries: BaseRegistry, candidates: string[]): string[];
|
|
38
68
|
//# sourceMappingURL=registry.selectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.selectors.d.ts","sourceRoot":"","sources":["../../src/registry/registry.selectors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,KAAK,EAAE,a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