@ai-primitives-hub/app 0.2.1 → 0.2.2-next.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 +5 -1
- package/dist/collection/affected-collections.d.ts +11 -0
- package/dist/collection/affected-collections.d.ts.map +1 -0
- package/dist/collection/affected-collections.js +90 -0
- package/dist/collection/affected-collections.js.map +1 -0
- package/dist/collection/create-plugin.d.ts +35 -0
- package/dist/collection/create-plugin.d.ts.map +1 -0
- package/dist/collection/create-plugin.js +118 -0
- package/dist/collection/create-plugin.js.map +1 -0
- package/dist/collection/index.d.ts +4 -2
- package/dist/collection/index.d.ts.map +1 -1
- package/dist/collection/index.js +8 -4
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/kind-route-warning.d.ts +13 -0
- package/dist/collection/kind-route-warning.d.ts.map +1 -0
- package/dist/collection/kind-route-warning.js +40 -0
- package/dist/collection/kind-route-warning.js.map +1 -0
- package/dist/collection/plugin-item-issues.d.ts +36 -0
- package/dist/collection/plugin-item-issues.d.ts.map +1 -0
- package/dist/collection/plugin-item-issues.js +31 -0
- package/dist/collection/plugin-item-issues.js.map +1 -0
- package/dist/collection/read-collection.d.ts +1 -1
- package/dist/collection/read-collection.d.ts.map +1 -1
- package/dist/collection/read-collection.js +14 -15
- package/dist/collection/read-collection.js.map +1 -1
- package/dist/collection-editor/collection-contribution-workflow.d.ts +96 -0
- package/dist/collection-editor/collection-contribution-workflow.d.ts.map +1 -0
- package/dist/collection-editor/collection-contribution-workflow.js +479 -0
- package/dist/collection-editor/collection-contribution-workflow.js.map +1 -0
- package/dist/collection-editor/collection-editor-service.d.ts +232 -0
- package/dist/collection-editor/collection-editor-service.d.ts.map +1 -0
- package/dist/collection-editor/collection-editor-service.js +868 -0
- package/dist/collection-editor/collection-editor-service.js.map +1 -0
- package/dist/collection-editor/index.d.ts +7 -0
- package/dist/collection-editor/index.d.ts.map +1 -0
- package/dist/collection-editor/index.js +12 -0
- package/dist/collection-editor/index.js.map +1 -0
- package/dist/diagnostics/find-ancestor-file.d.ts +13 -0
- package/dist/diagnostics/find-ancestor-file.d.ts.map +1 -0
- package/dist/diagnostics/find-ancestor-file.js +85 -0
- package/dist/diagnostics/find-ancestor-file.js.map +1 -0
- package/dist/diagnostics/index.d.ts +10 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics/index.js +26 -0
- package/dist/diagnostics/index.js.map +1 -0
- package/dist/diagnostics/run-primitive-diagnostics.d.ts +43 -0
- package/dist/diagnostics/run-primitive-diagnostics.d.ts.map +1 -0
- package/dist/diagnostics/run-primitive-diagnostics.js +413 -0
- package/dist/diagnostics/run-primitive-diagnostics.js.map +1 -0
- package/dist/diagnostics/sandbox-snapshot.d.ts +20 -0
- package/dist/diagnostics/sandbox-snapshot.d.ts.map +1 -0
- package/dist/diagnostics/sandbox-snapshot.js +117 -0
- package/dist/diagnostics/sandbox-snapshot.js.map +1 -0
- package/dist/governance/generate-catalogue.d.ts +16 -0
- package/dist/governance/generate-catalogue.d.ts.map +1 -0
- package/dist/governance/generate-catalogue.js +67 -0
- package/dist/governance/generate-catalogue.js.map +1 -0
- package/dist/governance/hub-scoped-governance.d.ts +37 -0
- package/dist/governance/hub-scoped-governance.d.ts.map +1 -0
- package/dist/governance/hub-scoped-governance.js +110 -0
- package/dist/governance/hub-scoped-governance.js.map +1 -0
- package/dist/governance/index.d.ts +10 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +26 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/load-config.d.ts +45 -0
- package/dist/governance/load-config.d.ts.map +1 -0
- package/dist/governance/load-config.js +137 -0
- package/dist/governance/load-config.js.map +1 -0
- package/dist/governance/pr-scope.d.ts +23 -0
- package/dist/governance/pr-scope.d.ts.map +1 -0
- package/dist/governance/pr-scope.js +22 -0
- package/dist/governance/pr-scope.js.map +1 -0
- package/dist/governance/report.d.ts +23 -0
- package/dist/governance/report.d.ts.map +1 -0
- package/dist/governance/report.js +177 -0
- package/dist/governance/report.js.map +1 -0
- package/dist/governance/run-governance.d.ts +22 -0
- package/dist/governance/run-governance.d.ts.map +1 -0
- package/dist/governance/run-governance.js +78 -0
- package/dist/governance/run-governance.js.map +1 -0
- package/dist/governance/source-checks.d.ts +29 -0
- package/dist/governance/source-checks.d.ts.map +1 -0
- package/dist/governance/source-checks.js +80 -0
- package/dist/governance/source-checks.js.map +1 -0
- package/dist/governance/validate-collection-governance.d.ts +46 -0
- package/dist/governance/validate-collection-governance.d.ts.map +1 -0
- package/dist/governance/validate-collection-governance.js +291 -0
- package/dist/governance/validate-collection-governance.js.map +1 -0
- package/dist/hub-editor/hub-config-editor-service.d.ts +94 -0
- package/dist/hub-editor/hub-config-editor-service.d.ts.map +1 -0
- package/dist/hub-editor/hub-config-editor-service.js +289 -0
- package/dist/hub-editor/hub-config-editor-service.js.map +1 -0
- package/dist/hub-editor/hub-contribution-workflow.d.ts +99 -0
- package/dist/hub-editor/hub-contribution-workflow.d.ts.map +1 -0
- package/dist/hub-editor/hub-contribution-workflow.js +385 -0
- package/dist/hub-editor/hub-contribution-workflow.js.map +1 -0
- package/dist/hub-editor/index.d.ts +7 -0
- package/dist/hub-editor/index.d.ts.map +1 -0
- package/dist/hub-editor/index.js +23 -0
- package/dist/hub-editor/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/install/index.d.ts +2 -0
- package/dist/install/index.d.ts.map +1 -1
- package/dist/install/index.js +3 -1
- package/dist/install/index.js.map +1 -1
- package/dist/install/partial-target-write.d.ts +63 -0
- package/dist/install/partial-target-write.d.ts.map +1 -0
- package/dist/install/partial-target-write.js +128 -0
- package/dist/install/partial-target-write.js.map +1 -0
- package/dist/install/pipeline.d.ts +2 -1
- package/dist/install/pipeline.d.ts.map +1 -1
- package/dist/install/pipeline.js +4 -3
- package/dist/install/pipeline.js.map +1 -1
- package/dist/install/target-write.d.ts +10 -0
- package/dist/install/target-write.d.ts.map +1 -1
- package/dist/install/target-write.js +3 -2
- package/dist/install/target-write.js.map +1 -1
- package/dist/install/uninstall-pipeline.d.ts +11 -10
- package/dist/install/uninstall-pipeline.d.ts.map +1 -1
- package/dist/install/uninstall-pipeline.js +10 -11
- package/dist/install/uninstall-pipeline.js.map +1 -1
- package/dist/records/atomic-write.d.ts +11 -0
- package/dist/records/atomic-write.d.ts.map +1 -0
- package/dist/records/atomic-write.js +66 -0
- package/dist/records/atomic-write.js.map +1 -0
- package/dist/records/confine-path.d.ts +35 -0
- package/dist/records/confine-path.d.ts.map +1 -0
- package/dist/records/confine-path.js +140 -0
- package/dist/records/confine-path.js.map +1 -0
- package/dist/records/git-root.d.ts +66 -0
- package/dist/records/git-root.d.ts.map +1 -0
- package/dist/records/git-root.js +208 -0
- package/dist/records/git-root.js.map +1 -0
- package/dist/records/index.d.ts +30 -0
- package/dist/records/index.d.ts.map +1 -0
- package/dist/records/index.js +46 -0
- package/dist/records/index.js.map +1 -0
- package/dist/records/install-record-service.d.ts +496 -0
- package/dist/records/install-record-service.d.ts.map +1 -0
- package/dist/records/install-record-service.js +1365 -0
- package/dist/records/install-record-service.js.map +1 -0
- package/dist/records/install-record-services.d.ts +29 -0
- package/dist/records/install-record-services.d.ts.map +1 -0
- package/dist/records/install-record-services.js +17 -0
- package/dist/records/install-record-services.js.map +1 -0
- package/dist/records/legacy-shapes.d.ts +18 -0
- package/dist/records/legacy-shapes.d.ts.map +1 -0
- package/dist/records/legacy-shapes.js +30 -0
- package/dist/records/legacy-shapes.js.map +1 -0
- package/dist/records/map-tool-to-target.d.ts +33 -0
- package/dist/records/map-tool-to-target.d.ts.map +1 -0
- package/dist/records/map-tool-to-target.js +98 -0
- package/dist/records/map-tool-to-target.js.map +1 -0
- package/dist/records/mcp-servers.d.ts +116 -0
- package/dist/records/mcp-servers.d.ts.map +1 -0
- package/dist/records/mcp-servers.js +268 -0
- package/dist/records/mcp-servers.js.map +1 -0
- package/dist/records/modified-files.d.ts +32 -0
- package/dist/records/modified-files.d.ts.map +1 -0
- package/dist/records/modified-files.js +146 -0
- package/dist/records/modified-files.js.map +1 -0
- package/dist/records/plan-record-entries.d.ts +76 -0
- package/dist/records/plan-record-entries.d.ts.map +1 -0
- package/dist/records/plan-record-entries.js +84 -0
- package/dist/records/plan-record-entries.js.map +1 -0
- package/dist/records/read-record-text.d.ts +15 -0
- package/dist/records/read-record-text.d.ts.map +1 -0
- package/dist/records/read-record-text.js +36 -0
- package/dist/records/read-record-text.js.map +1 -0
- package/dist/records/record-entry.d.ts +31 -0
- package/dist/records/record-entry.d.ts.map +1 -0
- package/dist/records/record-entry.js +81 -0
- package/dist/records/record-entry.js.map +1 -0
- package/dist/records/record-file-shape.d.ts +90 -0
- package/dist/records/record-file-shape.d.ts.map +1 -0
- package/dist/records/record-file-shape.js +288 -0
- package/dist/records/record-file-shape.js.map +1 -0
- package/dist/records/record-hub.d.ts +42 -0
- package/dist/records/record-hub.d.ts.map +1 -0
- package/dist/records/record-hub.js +85 -0
- package/dist/records/record-hub.js.map +1 -0
- package/dist/records/record-identity.d.ts +14 -0
- package/dist/records/record-identity.d.ts.map +1 -0
- package/dist/records/record-identity.js +41 -0
- package/dist/records/record-identity.js.map +1 -0
- package/dist/records/record-migration.d.ts +118 -0
- package/dist/records/record-migration.d.ts.map +1 -0
- package/dist/records/record-migration.js +454 -0
- package/dist/records/record-migration.js.map +1 -0
- package/dist/records/record-store.d.ts +123 -0
- package/dist/records/record-store.d.ts.map +1 -0
- package/dist/records/record-store.js +291 -0
- package/dist/records/record-store.js.map +1 -0
- package/dist/records/resolve-record-source.d.ts +64 -0
- package/dist/records/resolve-record-source.d.ts.map +1 -0
- package/dist/records/resolve-record-source.js +160 -0
- package/dist/records/resolve-record-source.js.map +1 -0
- package/dist/records/sanitize-source.d.ts +18 -0
- package/dist/records/sanitize-source.d.ts.map +1 -0
- package/dist/records/sanitize-source.js +90 -0
- package/dist/records/sanitize-source.js.map +1 -0
- package/dist/records/select-record.d.ts +54 -0
- package/dist/records/select-record.d.ts.map +1 -0
- package/dist/records/select-record.js +180 -0
- package/dist/records/select-record.js.map +1 -0
- package/dist/records/serialize-record.d.ts +20 -0
- package/dist/records/serialize-record.d.ts.map +1 -0
- package/dist/records/serialize-record.js +100 -0
- package/dist/records/serialize-record.js.map +1 -0
- package/dist/records/source-fields.d.ts +21 -0
- package/dist/records/source-fields.d.ts.map +1 -0
- package/dist/records/source-fields.js +28 -0
- package/dist/records/source-fields.js.map +1 -0
- package/dist/records/to-record-source.d.ts +23 -0
- package/dist/records/to-record-source.d.ts.map +1 -0
- package/dist/records/to-record-source.js +39 -0
- package/dist/records/to-record-source.js.map +1 -0
- package/dist/records/user-home.d.ts +16 -0
- package/dist/records/user-home.d.ts.map +1 -0
- package/dist/records/user-home.js +84 -0
- package/dist/records/user-home.js.map +1 -0
- package/dist/records/writer-group.d.ts +7 -0
- package/dist/records/writer-group.d.ts.map +1 -0
- package/dist/records/writer-group.js +31 -0
- package/dist/records/writer-group.js.map +1 -0
- package/dist/registry/activate-registry-profile.d.ts.map +1 -1
- package/dist/registry/activate-registry-profile.js +4 -1
- package/dist/registry/activate-registry-profile.js.map +1 -1
- package/dist/registry/batch-install-profile.d.ts +76 -0
- package/dist/registry/batch-install-profile.d.ts.map +1 -0
- package/dist/registry/batch-install-profile.js +67 -0
- package/dist/registry/batch-install-profile.js.map +1 -0
- package/dist/registry/create-source-adapter.d.ts +16 -1
- package/dist/registry/create-source-adapter.d.ts.map +1 -1
- package/dist/registry/create-source-adapter.js +76 -3
- package/dist/registry/create-source-adapter.js.map +1 -1
- package/dist/registry/hub-manager.d.ts +41 -0
- package/dist/registry/hub-manager.d.ts.map +1 -1
- package/dist/registry/hub-manager.js +82 -4
- package/dist/registry/hub-manager.js.map +1 -1
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -0
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/install-registry-bundle.js +4 -3
- package/dist/registry/install-registry-bundle.js.map +1 -1
- package/dist/registry/list-installed-bundles.d.ts +2 -3
- package/dist/registry/list-installed-bundles.d.ts.map +1 -1
- package/dist/registry/list-installed-bundles.js.map +1 -1
- package/dist/registry/load-hub-sources.d.ts +8 -0
- package/dist/registry/load-hub-sources.d.ts.map +1 -1
- package/dist/registry/load-hub-sources.js +70 -3
- package/dist/registry/load-hub-sources.js.map +1 -1
- package/dist/registry/profile-lifecycle.d.ts +7 -2
- package/dist/registry/profile-lifecycle.d.ts.map +1 -1
- package/dist/registry/profile-lifecycle.js +82 -11
- package/dist/registry/profile-lifecycle.js.map +1 -1
- package/dist/registry/uninstall-installed-bundle.d.ts +2 -3
- package/dist/registry/uninstall-installed-bundle.d.ts.map +1 -1
- package/dist/registry/uninstall-installed-bundle.js.map +1 -1
- package/dist/registry/update-registry-bundle.d.ts +2 -2
- package/dist/registry/update-registry-bundle.js +2 -2
- package/dist/registry/update-registry-bundle.js.map +1 -1
- package/dist/registry/validate-hub-config-file.d.ts +14 -1
- package/dist/registry/validate-hub-config-file.d.ts.map +1 -1
- package/dist/registry/validate-hub-config-file.js +81 -44
- package/dist/registry/validate-hub-config-file.js.map +1 -1
- package/dist/release/plan-bundle-release.d.ts +6 -12
- package/dist/release/plan-bundle-release.d.ts.map +1 -1
- package/dist/release/plan-bundle-release.js +178 -7
- package/dist/release/plan-bundle-release.js.map +1 -1
- package/dist/replicate/replicate.d.ts +5 -2
- package/dist/replicate/replicate.d.ts.map +1 -1
- package/dist/replicate/replicate.js +121 -17
- package/dist/replicate/replicate.js.map +1 -1
- package/dist/security/index.d.ts +4 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +22 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/rating/bundle-discovery.d.ts +19 -0
- package/dist/security/rating/bundle-discovery.d.ts.map +1 -0
- package/dist/security/rating/bundle-discovery.js +244 -0
- package/dist/security/rating/bundle-discovery.js.map +1 -0
- package/dist/security/rating/index.d.ts +5 -0
- package/dist/security/rating/index.d.ts.map +1 -0
- package/dist/security/rating/index.js +21 -0
- package/dist/security/rating/index.js.map +1 -0
- package/dist/security/rating/security-rating-markdown.d.ts +17 -0
- package/dist/security/rating/security-rating-markdown.d.ts.map +1 -0
- package/dist/security/rating/security-rating-markdown.js +131 -0
- package/dist/security/rating/security-rating-markdown.js.map +1 -0
- package/dist/security/rating/security-rating-scan.d.ts +23 -0
- package/dist/security/rating/security-rating-scan.d.ts.map +1 -0
- package/dist/security/rating/security-rating-scan.js +40 -0
- package/dist/security/rating/security-rating-scan.js.map +1 -0
- package/dist/security/rating/security-rating-templates.d.ts +40 -0
- package/dist/security/rating/security-rating-templates.d.ts.map +1 -0
- package/dist/security/rating/security-rating-templates.js +83 -0
- package/dist/security/rating/security-rating-templates.js.map +1 -0
- package/dist/security/rating/security-rating.d.ts +32 -0
- package/dist/security/rating/security-rating.d.ts.map +1 -0
- package/dist/security/rating/security-rating.js +94 -0
- package/dist/security/rating/security-rating.js.map +1 -0
- package/dist/security/security-scan-use-case.d.ts +101 -0
- package/dist/security/security-scan-use-case.d.ts.map +1 -0
- package/dist/security/security-scan-use-case.js +185 -0
- package/dist/security/security-scan-use-case.js.map +1 -0
- package/dist/stores/json-lockfile-store.d.ts.map +1 -1
- package/dist/stores/json-lockfile-store.js +6 -32
- package/dist/stores/json-lockfile-store.js.map +1 -1
- package/dist/transform/transformer-registry.d.ts.map +1 -1
- package/dist/transform/transformer-registry.js +3 -0
- package/dist/transform/transformer-registry.js.map +1 -1
- package/dist/transform/transformers/windsurf-transformer.d.ts +5 -0
- package/dist/transform/transformers/windsurf-transformer.d.ts.map +1 -1
- package/dist/transform/transformers/windsurf-transformer.js.map +1 -1
- package/dist/writers/file-tree-writer.d.ts +14 -1
- package/dist/writers/file-tree-writer.d.ts.map +1 -1
- package/dist/writers/file-tree-writer.js +23 -71
- package/dist/writers/file-tree-writer.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.migrateLevel = exports.migrateRecords = exports.readOldLockfile = exports.PROFILE_STORE_NAME = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* Record migration: move a level's old 2.0.0 stores into its 3.0.0 records
|
|
39
|
+
* before the first record change. Repository level merges the two old
|
|
40
|
+
* `prompt-registry` files at the root and deletes them; user level imports the
|
|
41
|
+
* CLI's old user lockfile once and the extension's profile entries. Old
|
|
42
|
+
* entries go under the `unknown` tool. Entries a record already holds are
|
|
43
|
+
* skipped, so an interrupted run is finished by the next one.
|
|
44
|
+
* @module records/record-migration
|
|
45
|
+
*/
|
|
46
|
+
const path = __importStar(require("node:path"));
|
|
47
|
+
const core_1 = require("@ai-primitives-hub/core");
|
|
48
|
+
const user_config_paths_1 = require("../registry/user-config-paths");
|
|
49
|
+
const json_lockfile_store_1 = require("../stores/json-lockfile-store");
|
|
50
|
+
const confine_path_1 = require("./confine-path");
|
|
51
|
+
const install_record_service_1 = require("./install-record-service");
|
|
52
|
+
const read_record_text_1 = require("./read-record-text");
|
|
53
|
+
const record_entry_1 = require("./record-entry");
|
|
54
|
+
const record_identity_1 = require("./record-identity");
|
|
55
|
+
const sanitize_source_1 = require("./sanitize-source");
|
|
56
|
+
/** Name of the profile store in `MigrationReport.mergedFrom`. */
|
|
57
|
+
exports.PROFILE_STORE_NAME = 'RegistryStorage (this profile)';
|
|
58
|
+
/** URL recorded for a migrated source the old file did not describe; the record schema requires one. */
|
|
59
|
+
const MISSING_SOURCE_URL = core_1.UNKNOWN_TOOL_NAME;
|
|
60
|
+
const ALREADY_RECORDED = 'already recorded';
|
|
61
|
+
const ISO_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;
|
|
62
|
+
// The record schema needs a real calendar date and time, not only the ISO shape.
|
|
63
|
+
const isDateTime = (value) => {
|
|
64
|
+
const match = value === undefined ? null : ISO_DATE_TIME.exec(value);
|
|
65
|
+
if (match === null) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
// With a `Z` zone the offset groups are absent, so they are NaN and pass the offset check.
|
|
69
|
+
const [year, month, day, hour, minute, second, offsetHour, offsetMinute] = match.slice(1).map(Number);
|
|
70
|
+
const date = new Date(0);
|
|
71
|
+
date.setUTCFullYear(year, month - 1, day);
|
|
72
|
+
date.setUTCHours(hour, minute, second);
|
|
73
|
+
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day
|
|
74
|
+
&& date.getUTCHours() === hour && date.getUTCMinutes() === minute && date.getUTCSeconds() === second
|
|
75
|
+
&& !(offsetHour > 23 || offsetMinute > 59);
|
|
76
|
+
};
|
|
77
|
+
const OLD_REPOSITORY_FILES = [
|
|
78
|
+
{ name: json_lockfile_store_1.LOCKFILE_NAME, commitMode: 'commit', origin: 'repository-committed' },
|
|
79
|
+
{ name: json_lockfile_store_1.LOCAL_LOCKFILE_NAME, commitMode: 'local-only', origin: 'repository-local' }
|
|
80
|
+
];
|
|
81
|
+
const nonEmpty = (value) => (typeof value === 'string' && value !== '' ? value : undefined);
|
|
82
|
+
const findShapeProblem = (value) => {
|
|
83
|
+
if (!(0, core_1.isJsonObject)(value)) {
|
|
84
|
+
return 'top level is not an object';
|
|
85
|
+
}
|
|
86
|
+
if (!(0, core_1.isJsonObject)(value.bundles)) {
|
|
87
|
+
return 'bundles is not an object';
|
|
88
|
+
}
|
|
89
|
+
const map = ['sources', 'hubs', 'profiles'].find((key) => value[key] !== undefined && !(0, core_1.isJsonObject)(value[key]));
|
|
90
|
+
if (map !== undefined) {
|
|
91
|
+
return `${map} is not an object`;
|
|
92
|
+
}
|
|
93
|
+
for (const [bundleId, entry] of Object.entries(value.bundles)) {
|
|
94
|
+
const name = `bundles.${JSON.stringify(bundleId)}`;
|
|
95
|
+
if (!(0, core_1.isJsonObject)(entry) || nonEmpty(entry.version) === undefined || nonEmpty(entry.sourceId) === undefined) {
|
|
96
|
+
return `${name} has no version or sourceId`;
|
|
97
|
+
}
|
|
98
|
+
if (typeof entry.sourceType !== 'string' || !core_1.RECORD_NAME_PATTERN.test(entry.sourceType)) {
|
|
99
|
+
return `${name}.sourceType is not a source type name`;
|
|
100
|
+
}
|
|
101
|
+
if (!Array.isArray(entry.files) || !entry.files.every((file) => (0, core_1.isJsonObject)(file) && typeof file.path === 'string')) {
|
|
102
|
+
return `${name}.files is not a list of files with a path`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Read an old 2.0.0 lockfile with the record store's guards: capped size,
|
|
109
|
+
* strict UTF-8, prototype-free parsing and the minimum 2.0.0 shape.
|
|
110
|
+
* @param fs - Filesystem port.
|
|
111
|
+
* @param file - Absolute path of the old file.
|
|
112
|
+
* @throws {RegistryError} `RECORD.MALFORMED` naming the file.
|
|
113
|
+
*/
|
|
114
|
+
const readOldLockfile = async (fs, file) => {
|
|
115
|
+
const parsed = (0, core_1.parseJsonWithoutPrototypes)(await (0, read_record_text_1.readRecordText)(fs, file, file), file);
|
|
116
|
+
const problem = findShapeProblem(parsed);
|
|
117
|
+
if (problem !== undefined) {
|
|
118
|
+
throw (0, core_1.recordError)('RECORD.MALFORMED', { file, detail: problem });
|
|
119
|
+
}
|
|
120
|
+
return parsed;
|
|
121
|
+
};
|
|
122
|
+
exports.readOldLockfile = readOldLockfile;
|
|
123
|
+
// A version that cannot be compared keeps the order given.
|
|
124
|
+
const higherFirst = (left, right) => {
|
|
125
|
+
try {
|
|
126
|
+
return (0, core_1.compareVersions)(right, left);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const identityOf = (entry) => (0, record_identity_1.recordIdentityOf)(entry.bundleId, entry.version);
|
|
133
|
+
// Entries of the same identity under any key and, when given, for one tool only.
|
|
134
|
+
const entriesOfIdentity = (loaded, identity, tool) => loaded.flatMap((file) => Object.entries(file.record.bundles).flatMap(([bundleId, bundle]) => Object.entries(bundle.tools)
|
|
135
|
+
.filter(([name, entry]) => (tool === undefined || name === tool) && (0, record_identity_1.recordIdentityOf)(bundleId, entry.version) === identity)
|
|
136
|
+
.map(([name, entry]) => ({ file, bundleId, tool: name, version: entry.version }))));
|
|
137
|
+
const holdsIdentity = (loaded, identity) => entriesOfIdentity(loaded, identity).length > 0;
|
|
138
|
+
/**
|
|
139
|
+
* The entries of one identity each, the higher version first in each list;
|
|
140
|
+
* a version that cannot be compared keeps the order given.
|
|
141
|
+
* @param entries - Entries in the order given.
|
|
142
|
+
*/
|
|
143
|
+
const groupByIdentity = (entries) => {
|
|
144
|
+
const groups = new Map();
|
|
145
|
+
for (const item of entries) {
|
|
146
|
+
const identity = identityOf(item.entry);
|
|
147
|
+
groups.set(identity, [...(groups.get(identity) ?? []), item]);
|
|
148
|
+
}
|
|
149
|
+
return [...groups.values()].map((group) => group.toSorted((left, right) => higherFirst(left.entry.version, right.entry.version)));
|
|
150
|
+
};
|
|
151
|
+
const dropEntry = (report, entry) => {
|
|
152
|
+
report.droppedEntries.push({ bundleId: entry.bundleId, version: entry.version, sourceId: entry.sourceId, reason: ALREADY_RECORDED });
|
|
153
|
+
};
|
|
154
|
+
const fromOldEntry = (old, bundleId) => {
|
|
155
|
+
const entry = old.lock.bundles[bundleId];
|
|
156
|
+
const sources = old.lock.sources ?? {};
|
|
157
|
+
return {
|
|
158
|
+
bundleId,
|
|
159
|
+
tool: core_1.UNKNOWN_TOOL_NAME,
|
|
160
|
+
version: entry.version,
|
|
161
|
+
sourceId: entry.sourceId,
|
|
162
|
+
sourceType: entry.sourceType,
|
|
163
|
+
installedAt: entry.installedAt,
|
|
164
|
+
files: entry.files,
|
|
165
|
+
source: Object.hasOwn(sources, entry.sourceId) ? { ...sources[entry.sourceId] } : undefined,
|
|
166
|
+
from: old.origin
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
// The recorded file for one old path, or why it is dropped.
|
|
170
|
+
const keepFile = async (fs, root, recordedPath) => {
|
|
171
|
+
let relative;
|
|
172
|
+
try {
|
|
173
|
+
relative = await (0, confine_path_1.confinePath)(fs, root, recordedPath);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
if ((0, core_1.isRecordError)(error)) {
|
|
177
|
+
return 'unsafe path';
|
|
178
|
+
}
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
const kind = (await fs.lstat(path.join(root, ...relative.split('/'))))?.kind;
|
|
182
|
+
if (kind === undefined) {
|
|
183
|
+
return 'not found';
|
|
184
|
+
}
|
|
185
|
+
if (kind !== 'file' && kind !== 'symlink') {
|
|
186
|
+
return 'not a regular file';
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
return await (0, record_entry_1.hashRecordedFile)(fs, root, relative);
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
return 'could not be read';
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
// The record schema needs a type and url the old store may lack.
|
|
196
|
+
const toSourceRecord = (entry) => {
|
|
197
|
+
const given = entry.source ?? {};
|
|
198
|
+
const source = (0, sanitize_source_1.sanitizeSource)({ ...given, type: nonEmpty(given.type) ?? entry.sourceType, url: nonEmpty(given.url) ?? MISSING_SOURCE_URL });
|
|
199
|
+
if (source.url === '') {
|
|
200
|
+
source.url = MISSING_SOURCE_URL;
|
|
201
|
+
}
|
|
202
|
+
return source;
|
|
203
|
+
};
|
|
204
|
+
// The CLI user lockfile records no target, so none of its files is kept.
|
|
205
|
+
const addEntry = async (run, target, entry) => {
|
|
206
|
+
const files = new Map();
|
|
207
|
+
for (const { path: recordedPath } of entry.files) {
|
|
208
|
+
const kept = entry.from === 'cli-user-lockfile' ? 'no target recorded' : await keepFile(run.input.fs, run.input.root, recordedPath);
|
|
209
|
+
if (typeof kept === 'string') {
|
|
210
|
+
run.report.droppedFiles.push({ bundleId: entry.bundleId, path: recordedPath, reason: kept });
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
files.set(kept.path, kept);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const unknown = entry.tool === core_1.UNKNOWN_TOOL_NAME;
|
|
217
|
+
const { record } = target;
|
|
218
|
+
(0, record_entry_1.putToolEntry)(record, entry.bundleId, entry.tool, {
|
|
219
|
+
version: entry.version,
|
|
220
|
+
sourceId: entry.sourceId,
|
|
221
|
+
sourceType: entry.sourceType,
|
|
222
|
+
installedAt: isDateTime(entry.installedAt) ? entry.installedAt : run.report.migratedAt,
|
|
223
|
+
files: [...files.values()],
|
|
224
|
+
...(unknown ? { needsReinstall: true } : {})
|
|
225
|
+
});
|
|
226
|
+
if (unknown) {
|
|
227
|
+
run.report.needsReinstall.push({ bundleId: entry.bundleId, version: entry.version });
|
|
228
|
+
}
|
|
229
|
+
if (!Object.hasOwn(record.sources, entry.sourceId)) {
|
|
230
|
+
record.sources[entry.sourceId] = toSourceRecord(entry);
|
|
231
|
+
}
|
|
232
|
+
run.changed.add(target);
|
|
233
|
+
};
|
|
234
|
+
// Carry `hubs` and `profiles` over, keeping any key the target already has.
|
|
235
|
+
const carryMaps = (run, old) => {
|
|
236
|
+
for (const key of ['hubs', 'profiles']) {
|
|
237
|
+
const from = old.lock[key];
|
|
238
|
+
if (from === undefined) {
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
const into = (old.target.record[key] ??= Object.create(null));
|
|
242
|
+
for (const [id, value] of Object.entries(from)) {
|
|
243
|
+
if (!Object.hasOwn(into, id)) {
|
|
244
|
+
into[id] = value;
|
|
245
|
+
run.changed.add(old.target);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
// One entry per identity: the record's wins, otherwise the higher version in the old files, the committed one on a tie.
|
|
251
|
+
const planRepository = async (run, oldFiles) => {
|
|
252
|
+
const candidates = [];
|
|
253
|
+
for (const old of oldFiles) {
|
|
254
|
+
carryMaps(run, old);
|
|
255
|
+
for (const bundleId of Object.keys(old.lock.bundles)) {
|
|
256
|
+
candidates.push({ entry: fromOldEntry(old, bundleId), target: old.target });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
for (const [kept, ...others] of groupByIdentity(candidates)) {
|
|
260
|
+
if (holdsIdentity(run.loaded, identityOf(kept.entry))) {
|
|
261
|
+
[kept, ...others].forEach(({ entry }) => dropEntry(run.report, entry));
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
for (const other of others) {
|
|
265
|
+
run.report.versionConflicts.push({ bundleId: other.entry.bundleId, kept: kept.entry.version, dropped: other.entry.version });
|
|
266
|
+
}
|
|
267
|
+
await addEntry(run, kept.target, kept.entry);
|
|
268
|
+
}
|
|
269
|
+
for (const old of oldFiles) {
|
|
270
|
+
if (!old.target.exists && run.changed.has(old.target)) {
|
|
271
|
+
run.report.renamed.push({ from: old.path, to: old.target.location.path });
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
run.report.mergedFrom.push(old.path);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
// Remove the `unknown` entries found; returns the source ids they used.
|
|
279
|
+
const removeUnknown = (target, found) => {
|
|
280
|
+
const { bundles } = target.record;
|
|
281
|
+
return found.map(({ bundleId }) => {
|
|
282
|
+
const { sourceId } = bundles[bundleId].tools[core_1.UNKNOWN_TOOL_NAME];
|
|
283
|
+
delete bundles[bundleId].tools[core_1.UNKNOWN_TOOL_NAME];
|
|
284
|
+
if (Object.keys(bundles[bundleId].tools).length === 0) {
|
|
285
|
+
delete bundles[bundleId];
|
|
286
|
+
}
|
|
287
|
+
return sourceId;
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
const dropUnusedSources = (target, sourceIds) => {
|
|
291
|
+
const { record } = target;
|
|
292
|
+
for (const sourceId of sourceIds) {
|
|
293
|
+
if (!Object.values(record.bundles).some((bundle) => Object.values(bundle.tools).some((entry) => entry.sourceId === sourceId))) {
|
|
294
|
+
delete record.sources[sourceId];
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
// One entry per identity and tool. Profile entries first, the higher version of
|
|
299
|
+
// each identity, replacing a lone `unknown` one; then old user lockfile bundles
|
|
300
|
+
// nothing holds yet, the higher version of each identity; then the marker.
|
|
301
|
+
const planUser = async (run, target, old) => {
|
|
302
|
+
const profileEntries = run.input.profileEntries ?? [];
|
|
303
|
+
const recordedProfile = new Map();
|
|
304
|
+
for (const [kept, ...others] of groupByIdentity(profileEntries.map((entry) => ({ entry })))) {
|
|
305
|
+
const { entry } = kept;
|
|
306
|
+
const identity = identityOf(entry);
|
|
307
|
+
if (entriesOfIdentity([target], identity, entry.tool).length > 0) {
|
|
308
|
+
[kept, ...others].forEach((item) => dropEntry(run.report, item.entry));
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
for (const other of others) {
|
|
312
|
+
run.report.versionConflicts.push({ bundleId: other.entry.bundleId, kept: entry.version, dropped: other.entry.version });
|
|
313
|
+
}
|
|
314
|
+
const held = entriesOfIdentity([target], identity);
|
|
315
|
+
const replacedSources = held.length > 0 && (0, install_record_service_1.isLoneUnknown)(held.map((found) => found.tool)) ? removeUnknown(target, held) : [];
|
|
316
|
+
for (const replaced of new Set(replacedSources.length === 0 ? [] : held.map((found) => found.version))) {
|
|
317
|
+
if (replaced !== entry.version) {
|
|
318
|
+
run.report.versionConflicts.push({ bundleId: entry.bundleId, kept: entry.version, dropped: replaced });
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
await addEntry(run, target, entry);
|
|
322
|
+
dropUnusedSources(target, replacedSources);
|
|
323
|
+
recordedProfile.set(identity, entry.version);
|
|
324
|
+
}
|
|
325
|
+
if (profileEntries.length > 0) {
|
|
326
|
+
run.report.mergedFrom.push(exports.PROFILE_STORE_NAME);
|
|
327
|
+
}
|
|
328
|
+
if (old !== undefined) {
|
|
329
|
+
const oldEntries = Object.keys(old.lock.bundles).map((bundleId) => ({ entry: fromOldEntry(old, bundleId) }));
|
|
330
|
+
for (const group of groupByIdentity(oldEntries)) {
|
|
331
|
+
const identity = identityOf(group[0].entry);
|
|
332
|
+
const kept = recordedProfile.get(identity);
|
|
333
|
+
const held = holdsIdentity(run.loaded, identity);
|
|
334
|
+
for (const [index, { entry }] of group.entries()) {
|
|
335
|
+
if (kept !== undefined && kept !== entry.version) {
|
|
336
|
+
run.report.versionConflicts.push({ bundleId: entry.bundleId, kept, dropped: entry.version });
|
|
337
|
+
}
|
|
338
|
+
else if (held) {
|
|
339
|
+
dropEntry(run.report, entry);
|
|
340
|
+
}
|
|
341
|
+
else if (index === 0) {
|
|
342
|
+
await addEntry(run, target, entry);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
run.report.versionConflicts.push({ bundleId: entry.bundleId, kept: group[0].entry.version, dropped: entry.version });
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
run.report.mergedFrom.push(old.path);
|
|
350
|
+
}
|
|
351
|
+
if (target.record[core_1.IMPORTED_USER_LOCKFILE_FIELD] === undefined) {
|
|
352
|
+
target.record[core_1.IMPORTED_USER_LOCKFILE_FIELD] = run.report.migratedAt;
|
|
353
|
+
run.changed.add(target);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
const readOldRepositoryFiles = async (input, loaded) => {
|
|
357
|
+
const oldFiles = [];
|
|
358
|
+
for (const { name, commitMode, origin } of OLD_REPOSITORY_FILES) {
|
|
359
|
+
const file = path.join(input.root, name);
|
|
360
|
+
const target = loaded.find((candidate) => candidate.location.commitMode === commitMode);
|
|
361
|
+
if (target !== undefined && (await input.fs.lstat(file)) !== undefined) {
|
|
362
|
+
oldFiles.push({ path: file, origin, lock: await (0, exports.readOldLockfile)(input.fs, file), target });
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return oldFiles;
|
|
366
|
+
};
|
|
367
|
+
const readOldUserFile = async (input, target) => {
|
|
368
|
+
const file = input.oldUserLockfile;
|
|
369
|
+
if (file === undefined || target.record[core_1.IMPORTED_USER_LOCKFILE_FIELD] !== undefined || (await input.fs.lstat(file)) === undefined) {
|
|
370
|
+
return undefined;
|
|
371
|
+
}
|
|
372
|
+
return { path: file, origin: 'cli-user-lockfile', lock: await (0, exports.readOldLockfile)(input.fs, file), target };
|
|
373
|
+
};
|
|
374
|
+
const deleteOldFiles = async (fs, oldFiles) => {
|
|
375
|
+
for (const old of oldFiles) {
|
|
376
|
+
try {
|
|
377
|
+
await fs.unlink(old.path);
|
|
378
|
+
}
|
|
379
|
+
catch (error) {
|
|
380
|
+
throw (0, core_1.recordError)('RECORD.WRITE_FAILED', {
|
|
381
|
+
file: old.path,
|
|
382
|
+
detail: 'the old record could not be deleted after migration',
|
|
383
|
+
message: 'The old install record could not be deleted; the new record is complete.',
|
|
384
|
+
hint: 'Check that the file can be deleted, then run the command again; it will only delete it.',
|
|
385
|
+
cause: error
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Migrate the old stores of a level into its 3.0.0 records: load everything,
|
|
392
|
+
* plan in memory, save the changed targets, then delete the old repository files.
|
|
393
|
+
* @param input - Migration input.
|
|
394
|
+
* @returns The report, or `undefined` when there was nothing to do.
|
|
395
|
+
* @throws {RegistryError} `RECORD.MALFORMED` for a bad old file (nothing is
|
|
396
|
+
* written), or `RECORD.WRITE_FAILED` from a save or delete.
|
|
397
|
+
*/
|
|
398
|
+
const migrateRecords = async (input) => {
|
|
399
|
+
const loaded = [];
|
|
400
|
+
for (const target of input.targets) {
|
|
401
|
+
loaded.push(await input.store.load(target));
|
|
402
|
+
}
|
|
403
|
+
if (loaded.length === 0) {
|
|
404
|
+
return undefined;
|
|
405
|
+
}
|
|
406
|
+
const userTarget = input.level === 'user' ? loaded[0] : undefined;
|
|
407
|
+
const oldFiles = userTarget === undefined ? await readOldRepositoryFiles(input, loaded) : [];
|
|
408
|
+
const oldUser = userTarget === undefined ? undefined : await readOldUserFile(input, userTarget);
|
|
409
|
+
const hasWork = userTarget === undefined
|
|
410
|
+
? oldFiles.length > 0
|
|
411
|
+
: oldUser !== undefined || (input.profileEntries ?? []).length > 0 || userTarget.record[core_1.IMPORTED_USER_LOCKFILE_FIELD] === undefined;
|
|
412
|
+
if (!hasWork) {
|
|
413
|
+
return undefined;
|
|
414
|
+
}
|
|
415
|
+
const run = {
|
|
416
|
+
input,
|
|
417
|
+
loaded,
|
|
418
|
+
changed: new Set(),
|
|
419
|
+
report: {
|
|
420
|
+
level: input.level, renamed: [], mergedFrom: [], needsReinstall: [], versionConflicts: [],
|
|
421
|
+
droppedFiles: [], droppedEntries: [], migratedAt: input.now().toISOString(), warnings: []
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
await (userTarget === undefined ? planRepository(run, oldFiles) : planUser(run, userTarget, oldUser));
|
|
425
|
+
for (const file of loaded) {
|
|
426
|
+
if (run.changed.has(file)) {
|
|
427
|
+
run.report.warnings.push(...(await input.store.save(file.location, file.record)).warnings);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
await deleteOldFiles(input.fs, oldFiles);
|
|
431
|
+
return run.report;
|
|
432
|
+
};
|
|
433
|
+
exports.migrateRecords = migrateRecords;
|
|
434
|
+
/**
|
|
435
|
+
* Migrate the level the targets belong to, rooted at their root; the CLI and the extension both use it.
|
|
436
|
+
* @param input - Store, filesystem, targets, environment, profile entries and clock.
|
|
437
|
+
* @throws {RegistryError} As {@link migrateRecords}.
|
|
438
|
+
*/
|
|
439
|
+
const migrateLevel = (input) => {
|
|
440
|
+
const level = input.targets[0].level;
|
|
441
|
+
return (0, exports.migrateRecords)({
|
|
442
|
+
store: input.store,
|
|
443
|
+
fs: input.fs,
|
|
444
|
+
level,
|
|
445
|
+
root: input.targets[0].root,
|
|
446
|
+
targets: input.targets,
|
|
447
|
+
...(level === 'user'
|
|
448
|
+
? { oldUserLockfile: (0, user_config_paths_1.resolveUserConfigPaths)(input.env).userLockfile, profileEntries: input.profileEntries ?? [] }
|
|
449
|
+
: {}),
|
|
450
|
+
now: input.now ?? (() => new Date())
|
|
451
|
+
});
|
|
452
|
+
};
|
|
453
|
+
exports.migrateLevel = migrateLevel;
|
|
454
|
+
//# sourceMappingURL=record-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-migration.js","sourceRoot":"","sources":["../../src/records/record-migration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;GAQG;AACH,gDAAkC;AAClC,kDAciC;AACjC,qEAEuC;AACvC,uEAIuC;AACvC,iDAEwB;AACxB,qEAEkC;AAClC,yDAE4B;AAC5B,iDAGwB;AACxB,uDAE2B;AAK3B,uDAE2B;AA8D3B,iEAAiE;AACpD,QAAA,kBAAkB,GAAG,gCAAgC,CAAC;AAEnE,wGAAwG;AACxG,MAAM,kBAAkB,GAAG,wBAAiB,CAAC;AAE7C,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C,MAAM,aAAa,GAAG,uFAAuF,CAAC;AAE9G,iFAAiF;AACjF,MAAM,UAAU,GAAG,CAAC,KAAyB,EAAmB,EAAE;IAChE,MAAM,KAAK,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrE,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,2FAA2F;IAC3F,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtG,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,CAAC,cAAc,CAAC,IAAI,E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pB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK;QACL,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,KAAK,KAAK,MAAM;YAClB,CAAC,CAAC,EAAE,eAAe,EAAE,IAAA,0CAAsB,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,EAAE,EAAE;YACjH,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;KACrC,CAAC,CAAC;AACL,CAAC,CAAC;AAbW,QAAA,YAAY,gBAavB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { type InstallRecord, type RecordFs, type RecordLevel, type RecordLocation, type UnvalidatedRecord } from '@ai-primitives-hub/core';
|
|
2
|
+
/** Schema gate the store runs after `parseRecord`; `RecordSchemaValidator` in infra implements it. */
|
|
3
|
+
export interface RecordValidator {
|
|
4
|
+
/** @throws {RegistryError} `RECORD.MALFORMED` when the record does not match the schema. */
|
|
5
|
+
validate(record: UnvalidatedRecord, file?: string): InstallRecord;
|
|
6
|
+
}
|
|
7
|
+
/** A loaded record. */
|
|
8
|
+
export interface LoadedRecord {
|
|
9
|
+
location: RecordLocation;
|
|
10
|
+
/** Parsed and validated record, with prototype-free objects; empty when the file is missing. */
|
|
11
|
+
record: InstallRecord;
|
|
12
|
+
/** `false` when the file is not there yet. */
|
|
13
|
+
exists: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** Outcome of {@link RecordStore.save}. */
|
|
16
|
+
export interface RecordSaveResult {
|
|
17
|
+
/** Non-fatal problems for the caller to log, e.g. an `info/exclude` that could not be updated. */
|
|
18
|
+
warnings: string[];
|
|
19
|
+
}
|
|
20
|
+
/** Dependencies of a {@link RecordStore}. */
|
|
21
|
+
export interface RecordStoreOptions {
|
|
22
|
+
/** Filesystem port; `NodeRecordFs` from infra in production. */
|
|
23
|
+
fs: RecordFs;
|
|
24
|
+
/** Schema gate; `RecordSchemaValidator` from infra in production. */
|
|
25
|
+
validator: RecordValidator;
|
|
26
|
+
/** Writer stamp for `generatedBy`, e.g. `ai-primitives-hub-cli@0.3.0`. */
|
|
27
|
+
generatedBy: string;
|
|
28
|
+
/** Clock for `generatedAt`; defaults to the current time. */
|
|
29
|
+
now?: () => Date;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Build an empty, prototype-free record for a level.
|
|
33
|
+
* @param level - Record level.
|
|
34
|
+
* @param generatedBy - Writer stamp.
|
|
35
|
+
* @param now - Time stamped as `generatedAt`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const createEmptyRecord: (level: RecordLevel, generatedBy: string, now: Date) => InstallRecord;
|
|
38
|
+
/** Locates, loads and saves install record files. */
|
|
39
|
+
export declare class RecordStore {
|
|
40
|
+
private readonly fs;
|
|
41
|
+
private readonly validator;
|
|
42
|
+
private readonly generatedBy;
|
|
43
|
+
private readonly now;
|
|
44
|
+
/** Paths whose last load succeeded; only these may be saved. */
|
|
45
|
+
private readonly loadedPaths;
|
|
46
|
+
constructor(options: RecordStoreOptions);
|
|
47
|
+
private labelOf;
|
|
48
|
+
/**
|
|
49
|
+
* The path to read: a regular file, or a symlink to one inside the root; `undefined` when missing.
|
|
50
|
+
* @param location - Record location.
|
|
51
|
+
* @param file - Record file to name in errors.
|
|
52
|
+
*/
|
|
53
|
+
private gateRecordFile;
|
|
54
|
+
/**
|
|
55
|
+
* Realpath of a record symlink, required to be inside the root.
|
|
56
|
+
* @param location - Record location.
|
|
57
|
+
* @param file - Record file to name in errors.
|
|
58
|
+
*/
|
|
59
|
+
private resolveAllowedLink;
|
|
60
|
+
private readAndCheck;
|
|
61
|
+
private checkPaths;
|
|
62
|
+
private checkSourceIds;
|
|
63
|
+
/**
|
|
64
|
+
* Prototype-free shallow copy with the writer fields set.
|
|
65
|
+
* @param location - Record location.
|
|
66
|
+
* @param record - Record to write.
|
|
67
|
+
*/
|
|
68
|
+
private stamp;
|
|
69
|
+
/**
|
|
70
|
+
* Write atomically; an allowed symlink keeps its link and has its target replaced.
|
|
71
|
+
* @param location - Record location.
|
|
72
|
+
* @param text - Serialized record.
|
|
73
|
+
* @param file - Record file to name in errors.
|
|
74
|
+
*/
|
|
75
|
+
private writeAtomically;
|
|
76
|
+
/**
|
|
77
|
+
* Both repository record locations at the git root above `start` (or `start` itself), committed first.
|
|
78
|
+
* @param input - Where the git-root walk starts.
|
|
79
|
+
* @param input.start - Target root, or the current folder.
|
|
80
|
+
*/
|
|
81
|
+
resolveRepository(input: {
|
|
82
|
+
start: string;
|
|
83
|
+
}): Promise<[RecordLocation, RecordLocation]>;
|
|
84
|
+
/**
|
|
85
|
+
* Both repository record files for a start folder, loaded and checked, with
|
|
86
|
+
* the one the commit mode records in.
|
|
87
|
+
* @param input - Where the git-root walk starts and the install's commit mode.
|
|
88
|
+
* @param input.start - The target's root path, or the current folder.
|
|
89
|
+
* @param input.commitMode - `local-only` picks the local-only file; anything else the committed one.
|
|
90
|
+
* @throws {RegistryError} Any `RECORD.*` error from loading either file.
|
|
91
|
+
*/
|
|
92
|
+
loadRepository(input: {
|
|
93
|
+
start: string;
|
|
94
|
+
commitMode?: RecordLocation['commitMode'];
|
|
95
|
+
}): Promise<{
|
|
96
|
+
locations: [RecordLocation, RecordLocation];
|
|
97
|
+
location: RecordLocation;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* The user-level record location, rooted at the home folder.
|
|
101
|
+
* @param input - Home folder and record file.
|
|
102
|
+
* @param input.home - Absolute home folder.
|
|
103
|
+
* @param input.path - Absolute path of the user record.
|
|
104
|
+
*/
|
|
105
|
+
resolveUser(input: {
|
|
106
|
+
home: string;
|
|
107
|
+
path: string;
|
|
108
|
+
}): RecordLocation;
|
|
109
|
+
/**
|
|
110
|
+
* Load and check a record file. A missing file gives an empty record.
|
|
111
|
+
* @param location - Record location.
|
|
112
|
+
* @throws {RegistryError} A `RECORD.*` error; the file is left untouched.
|
|
113
|
+
*/
|
|
114
|
+
load(location: RecordLocation): Promise<LoadedRecord>;
|
|
115
|
+
/**
|
|
116
|
+
* Stamp, validate and atomically write a record whose location was loaded first.
|
|
117
|
+
* @param location - Record location.
|
|
118
|
+
* @param record - Record to write; left unchanged.
|
|
119
|
+
* @throws {RegistryError} `RECORD.MALFORMED` or `RECORD.WRITE_FAILED`; the previous file is intact.
|
|
120
|
+
*/
|
|
121
|
+
save(location: RecordLocation, record: InstallRecord): Promise<RecordSaveResult>;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=record-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-store.d.ts","sourceRoot":"","sources":["../../src/records/record-store.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,aAAa,EASlB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,cAAc,EAGnB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAsBjC,sGAAsG;AACtG,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,QAAQ,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;CACnE;AAED,uBAAuB;AACvB,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,cAAc,CAAC;IACzB,gGAAgG;IAChG,MAAM,EAAE,aAAa,CAAC;IACtB,8CAA8C;IAC9C,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B,kGAAkG;IAClG,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,EA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