@emeryld/rrroutes-export 1.0.24 → 1.0.25

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.mjs CHANGED
@@ -1771,6 +1771,19 @@ function flattenSourceSections(snapshot) {
1771
1771
  }
1772
1772
  return map;
1773
1773
  }
1774
+ function emptySourceSnapshotLike(snapshot) {
1775
+ return {
1776
+ id: snapshot.id,
1777
+ displayName: snapshot.displayName,
1778
+ routeKeys: [],
1779
+ sections: {
1780
+ params: {},
1781
+ query: {},
1782
+ body: {},
1783
+ output: {}
1784
+ }
1785
+ };
1786
+ }
1774
1787
  function diffSourceSchemas(before, after) {
1775
1788
  const prev = flattenSourceSections(before);
1776
1789
  const next = flattenSourceSections(after);
@@ -2169,12 +2182,14 @@ function diffSnapshots(previous, current) {
2169
2182
  const prevRoute = previous.routesByKey[routeKey];
2170
2183
  const nextRoute = current.routesByKey[routeKey];
2171
2184
  if (!prevRoute && nextRoute) {
2185
+ const schemaDiff2 = diffRouteSchemas({}, nextRoute.flatSchema);
2172
2186
  routeEvents.push({
2173
2187
  type: "route_added",
2174
2188
  commitSha: current.commit.sha,
2175
2189
  routeKey,
2176
2190
  method: nextRoute.method,
2177
- path: nextRoute.path
2191
+ path: nextRoute.path,
2192
+ schemaDiff: schemaDiff2.length > 0 ? schemaDiff2 : void 0
2178
2193
  });
2179
2194
  continue;
2180
2195
  }
@@ -2220,12 +2235,17 @@ function diffSnapshots(previous, current) {
2220
2235
  const prevSource = previous.sourceObjectsById[sourceObjectId];
2221
2236
  const nextSource = current.sourceObjectsById[sourceObjectId];
2222
2237
  if (!prevSource && nextSource) {
2238
+ const schemaDiff2 = diffSourceSchemas(
2239
+ emptySourceSnapshotLike(nextSource),
2240
+ nextSource
2241
+ );
2223
2242
  sourceEvents.push({
2224
2243
  type: "source_object_added",
2225
2244
  commitSha: current.commit.sha,
2226
2245
  sourceObjectId,
2227
2246
  displayName: nextSource.displayName,
2228
- impactedRoutes: nextSource.routeKeys
2247
+ impactedRoutes: nextSource.routeKeys,
2248
+ schemaDiff: schemaDiff2.length > 0 ? schemaDiff2 : void 0
2229
2249
  });
2230
2250
  continue;
2231
2251
  }