@websolutespa/bom-mixer-store 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @websolutespa/bom-mixer-store
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added: splat routes.
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.js CHANGED
@@ -1194,6 +1194,26 @@ function storeHandler(storePromise = async () => await getStore()) {
1194
1194
  }
1195
1195
  }
1196
1196
  });
1197
+ if (routes.length === 0) {
1198
+ const splatRoutes = await store.route.findMany({
1199
+ where: {
1200
+ useSplat: {
1201
+ equals: true
1202
+ }
1203
+ }
1204
+ });
1205
+ const route = splatRoutes.reduce((p, c) => {
1206
+ const match = pathname.indexOf(c.id) === 0;
1207
+ if (match && (!p || p.id.length < c.id.length)) {
1208
+ return { ...c, splat: pathname.substring(c.id.length, pathname.length) };
1209
+ } else {
1210
+ return p;
1211
+ }
1212
+ }, void 0);
1213
+ if (route) {
1214
+ return response.status(200).json(route);
1215
+ }
1216
+ }
1197
1217
  if (routes.length > 0) {
1198
1218
  return response.status(200).json(routes[0]);
1199
1219
  } else {
package/dist/index.mjs CHANGED
@@ -1146,6 +1146,26 @@ function storeHandler(storePromise = async () => await getStore()) {
1146
1146
  }
1147
1147
  }
1148
1148
  });
1149
+ if (routes.length === 0) {
1150
+ const splatRoutes = await store.route.findMany({
1151
+ where: {
1152
+ useSplat: {
1153
+ equals: true
1154
+ }
1155
+ }
1156
+ });
1157
+ const route = splatRoutes.reduce((p, c) => {
1158
+ const match = pathname.indexOf(c.id) === 0;
1159
+ if (match && (!p || p.id.length < c.id.length)) {
1160
+ return { ...c, splat: pathname.substring(c.id.length, pathname.length) };
1161
+ } else {
1162
+ return p;
1163
+ }
1164
+ }, void 0);
1165
+ if (route) {
1166
+ return response.status(200).json(route);
1167
+ }
1168
+ }
1149
1169
  if (routes.length > 0) {
1150
1170
  return response.status(200).json(routes[0]);
1151
1171
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-store",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Mixer Store module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -22,11 +22,10 @@
22
22
  "prepack": "bom prepack",
23
23
  "postpack": "bom postpack"
24
24
  },
25
- "dependencies": {
26
- "@websolutespa/bom-core": "*",
27
- "iron-session": "^6.2.1"
28
- },
25
+ "dependencies": {},
29
26
  "peerDependencies": {
27
+ "@websolutespa/bom-core": "*",
28
+ "iron-session": ">= 6.2.1",
30
29
  "next": ">= 12.3.2"
31
30
  },
32
31
  "devDependencies": {