@gen3/toolsff 0.12.14 → 0.12.16

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.
@@ -115,11 +115,12 @@ function writeGeneratedMiddlewareEntryTs(matcher, opts = {}) {
115
115
  * in the middleware path matcher. If true, all application routes
116
116
  * are scanned and included; otherwise, specific routes from the
117
117
  * authentication configuration are considered.
118
- */ const createMiddlewareRoutes = (useScanAllPaths = false)=>{
118
+ * @param forceMatchAll - set to true to force all routes to be matched by the middleware.
119
+ */ const createMiddlewareRoutes = (useScanAllPaths = false, forceMatchAll = false)=>{
119
120
  const authConfig = loadAuthConfig();
120
121
  const allPagesRequireLogin = authConfig?.routes?.['*']?.loginRequired;
121
122
  let routes;
122
- if (allPagesRequireLogin) {
123
+ if (allPagesRequireLogin || forceMatchAll) {
123
124
  console.log('All pages require login. Adding all routes to middleware path matcher.');
124
125
  routes = useScanAllPaths ? getPagesRoutes() : []; // setting to [] will cause the matcher to be set below
125
126
  } else {
@@ -138,15 +139,19 @@ function writeGeneratedMiddlewareEntryTs(matcher, opts = {}) {
138
139
  };
139
140
  function main() {
140
141
  try {
141
- const { values: { scanAllPages } } = parseArgs({
142
+ const { values: { scanAllPages, forceMatchAll } } = parseArgs({
142
143
  options: {
143
144
  scanAllPages: {
144
145
  type: 'boolean',
145
146
  default: false
147
+ },
148
+ forceMatchAll: {
149
+ type: 'boolean',
150
+ default: false
146
151
  }
147
152
  }
148
153
  });
149
- createMiddlewareRoutes(scanAllPages);
154
+ createMiddlewareRoutes(scanAllPages, forceMatchAll);
150
155
  } catch (e) {
151
156
  if (e instanceof Error) {
152
157
  if (e.name === 'ERR_PARSE_ARGS_UNKNOWN_OPTION') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gen3/toolsff",
3
- "version": "0.12.14",
3
+ "version": "0.12.16",
4
4
  "description": "tools for processing Gen3 commons content: color theme, icons, sharedFilters",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -48,5 +48,5 @@
48
48
  "axios": "^1.8.2"
49
49
  }
50
50
  },
51
- "gitHead": "88fd33343236dd640ef1f0fe18c2b5186803c10e"
51
+ "gitHead": "2096bcb60b141c98a9be22a825be65ce58cb6904"
52
52
  }