@emeryld/rrroutes-export 1.0.24 → 1.0.26

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.cjs CHANGED
@@ -1827,6 +1827,19 @@ function flattenSourceSections(snapshot) {
1827
1827
  }
1828
1828
  return map;
1829
1829
  }
1830
+ function emptySourceSnapshotLike(snapshot) {
1831
+ return {
1832
+ id: snapshot.id,
1833
+ displayName: snapshot.displayName,
1834
+ routeKeys: [],
1835
+ sections: {
1836
+ params: {},
1837
+ query: {},
1838
+ body: {},
1839
+ output: {}
1840
+ }
1841
+ };
1842
+ }
1830
1843
  function diffSourceSchemas(before, after) {
1831
1844
  const prev = flattenSourceSections(before);
1832
1845
  const next = flattenSourceSections(after);
@@ -2225,12 +2238,14 @@ function diffSnapshots(previous, current) {
2225
2238
  const prevRoute = previous.routesByKey[routeKey];
2226
2239
  const nextRoute = current.routesByKey[routeKey];
2227
2240
  if (!prevRoute && nextRoute) {
2241
+ const schemaDiff2 = diffRouteSchemas({}, nextRoute.flatSchema);
2228
2242
  routeEvents.push({
2229
2243
  type: "route_added",
2230
2244
  commitSha: current.commit.sha,
2231
2245
  routeKey,
2232
2246
  method: nextRoute.method,
2233
- path: nextRoute.path
2247
+ path: nextRoute.path,
2248
+ schemaDiff: schemaDiff2.length > 0 ? schemaDiff2 : void 0
2234
2249
  });
2235
2250
  continue;
2236
2251
  }
@@ -2276,12 +2291,17 @@ function diffSnapshots(previous, current) {
2276
2291
  const prevSource = previous.sourceObjectsById[sourceObjectId];
2277
2292
  const nextSource = current.sourceObjectsById[sourceObjectId];
2278
2293
  if (!prevSource && nextSource) {
2294
+ const schemaDiff2 = diffSourceSchemas(
2295
+ emptySourceSnapshotLike(nextSource),
2296
+ nextSource
2297
+ );
2279
2298
  sourceEvents.push({
2280
2299
  type: "source_object_added",
2281
2300
  commitSha: current.commit.sha,
2282
2301
  sourceObjectId,
2283
2302
  displayName: nextSource.displayName,
2284
- impactedRoutes: nextSource.routeKeys
2303
+ impactedRoutes: nextSource.routeKeys,
2304
+ schemaDiff: schemaDiff2.length > 0 ? schemaDiff2 : void 0
2285
2305
  });
2286
2306
  continue;
2287
2307
  }