@eventcatalog/sdk 2.17.2 → 2.17.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/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1983,6 +1983,7 @@ var dumpCatalog = (directory) => async (options) => {
|
|
|
1983
1983
|
// src/snapshots.ts
|
|
1984
1984
|
var import_node_fs8 = __toESM(require("fs"));
|
|
1985
1985
|
var import_node_path16 = __toESM(require("path"));
|
|
1986
|
+
var import_node_crypto = require("crypto");
|
|
1986
1987
|
var import_node_child_process = require("child_process");
|
|
1987
1988
|
var import_semver6 = require("semver");
|
|
1988
1989
|
|
|
@@ -2173,6 +2174,8 @@ var pickCoreFields = (resource) => {
|
|
|
2173
2174
|
if (resource.receives) picked.receives = resource.receives;
|
|
2174
2175
|
if (resource.deprecated) picked.deprecated = resource.deprecated;
|
|
2175
2176
|
if (resource.owners) picked.owners = resource.owners;
|
|
2177
|
+
if (resource.schemaPath) picked.schemaPath = resource.schemaPath;
|
|
2178
|
+
if (resource.schemaHash) picked.schemaHash = resource.schemaHash;
|
|
2176
2179
|
return picked;
|
|
2177
2180
|
};
|
|
2178
2181
|
var deduplicateByLatestVersion = (resources) => {
|
|
@@ -2200,6 +2203,16 @@ var detectGitInfo = (catalogDir) => {
|
|
|
2200
2203
|
return void 0;
|
|
2201
2204
|
}
|
|
2202
2205
|
};
|
|
2206
|
+
var enrichWithSchemaHashes = async (getSchemaForMessage2, resources) => {
|
|
2207
|
+
await Promise.all(
|
|
2208
|
+
resources.map(async (resource) => {
|
|
2209
|
+
if (!resource.schemaPath) return;
|
|
2210
|
+
const schema = await getSchemaForMessage2(resource.id, resource.version);
|
|
2211
|
+
if (!schema) return;
|
|
2212
|
+
resource.schemaHash = (0, import_node_crypto.createHash)("sha256").update(schema.schema).digest("hex");
|
|
2213
|
+
})
|
|
2214
|
+
);
|
|
2215
|
+
};
|
|
2203
2216
|
var createSnapshot = (directory) => {
|
|
2204
2217
|
return async (options) => {
|
|
2205
2218
|
const { label, outputDir, git } = options || {};
|
|
@@ -2212,6 +2225,11 @@ var createSnapshot = (directory) => {
|
|
|
2212
2225
|
sdk.getQueries(),
|
|
2213
2226
|
sdk.getChannels()
|
|
2214
2227
|
]);
|
|
2228
|
+
await Promise.all([
|
|
2229
|
+
enrichWithSchemaHashes(sdk.getSchemaForMessage, events || []),
|
|
2230
|
+
enrichWithSchemaHashes(sdk.getSchemaForMessage, commands || []),
|
|
2231
|
+
enrichWithSchemaHashes(sdk.getSchemaForMessage, queries || [])
|
|
2232
|
+
]);
|
|
2215
2233
|
const snapshotDomains = stripToCore(domains);
|
|
2216
2234
|
const snapshotServices = stripToCore(services);
|
|
2217
2235
|
const snapshotEvents = stripToCore(events);
|