@eventcatalog/sdk 2.17.1 → 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 +21 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1326,7 +1326,7 @@ var addMessageToService = (directory) => async (id, direction, event, version) =
|
|
|
1326
1326
|
}
|
|
1327
1327
|
const path8 = existingResource.split(/[\\/]+services/)[0];
|
|
1328
1328
|
const pathToResource = (0, import_node_path7.join)(path8, "services");
|
|
1329
|
-
await rmServiceById(directory)(id, version);
|
|
1329
|
+
await rmServiceById(directory)(id, version, true);
|
|
1330
1330
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
1331
1331
|
};
|
|
1332
1332
|
var serviceHasVersion = (directory) => async (id, version) => {
|
|
@@ -1359,7 +1359,7 @@ var addEntityToService = (directory) => async (id, entity, version) => {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
const path8 = existingResource.split(/[\\/]+services/)[0];
|
|
1361
1361
|
const pathToResource = (0, import_node_path7.join)(path8, "services");
|
|
1362
|
-
await rmServiceById(directory)(id, version);
|
|
1362
|
+
await rmServiceById(directory)(id, version, true);
|
|
1363
1363
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
1364
1364
|
};
|
|
1365
1365
|
var addDataStoreToService = (directory) => async (id, operation, dataStore, version) => {
|
|
@@ -1395,7 +1395,7 @@ var addDataStoreToService = (directory) => async (id, operation, dataStore, vers
|
|
|
1395
1395
|
}
|
|
1396
1396
|
const path8 = existingResource.split(/[\\/]+services/)[0];
|
|
1397
1397
|
const pathToResource = (0, import_node_path7.join)(path8, "services");
|
|
1398
|
-
await rmServiceById(directory)(id, version);
|
|
1398
|
+
await rmServiceById(directory)(id, version, true);
|
|
1399
1399
|
await writeService(pathToResource)(service, { format: extension === ".md" ? "md" : "mdx" });
|
|
1400
1400
|
};
|
|
1401
1401
|
|
|
@@ -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);
|