@zuplo/cli 6.69.6 → 6.69.9

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.
Files changed (141) hide show
  1. package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts +2 -0
  2. package/dist/__tests__/integration/confirm-production-deploy.integration.test.d.ts.map +1 -0
  3. package/dist/__tests__/integration/confirm-production-deploy.integration.test.js +184 -0
  4. package/dist/__tests__/integration/confirm-production-deploy.integration.test.js.map +1 -0
  5. package/dist/__tests__/integration/deploy.integration.test.js +1 -0
  6. package/dist/__tests__/integration/deploy.integration.test.js.map +1 -1
  7. package/dist/__tests__/integration/jest-mocks-setup.js +3 -0
  8. package/dist/__tests__/integration/jest-mocks-setup.js.map +1 -1
  9. package/dist/__tests__/integration/whoami.integration.test.js +27 -0
  10. package/dist/__tests__/integration/whoami.integration.test.js.map +1 -1
  11. package/dist/bucket/list/handler.d.ts +8 -0
  12. package/dist/bucket/list/handler.d.ts.map +1 -0
  13. package/dist/bucket/list/handler.js +54 -0
  14. package/dist/bucket/list/handler.js.map +1 -0
  15. package/dist/bucket/models.d.ts +23 -0
  16. package/dist/bucket/models.d.ts.map +1 -0
  17. package/dist/bucket/models.js +2 -0
  18. package/dist/bucket/models.js.map +1 -0
  19. package/dist/cli.js +4 -0
  20. package/dist/cli.js.map +1 -1
  21. package/dist/cmds/bucket/index.d.ts +4 -0
  22. package/dist/cmds/bucket/index.d.ts.map +1 -0
  23. package/dist/cmds/bucket/index.js +9 -0
  24. package/dist/cmds/bucket/index.js.map +1 -0
  25. package/dist/cmds/bucket/list.d.ts +9 -0
  26. package/dist/cmds/bucket/list.d.ts.map +1 -0
  27. package/dist/cmds/bucket/list.js +60 -0
  28. package/dist/cmds/bucket/list.js.map +1 -0
  29. package/dist/cmds/deploy.d.ts.map +1 -1
  30. package/dist/cmds/deploy.js +4 -1
  31. package/dist/cmds/deploy.js.map +1 -1
  32. package/dist/cmds/logout.d.ts +9 -0
  33. package/dist/cmds/logout.d.ts.map +1 -0
  34. package/dist/cmds/logout.js +23 -0
  35. package/dist/cmds/logout.js.map +1 -0
  36. package/dist/cmds/whoami.d.ts.map +1 -1
  37. package/dist/cmds/whoami.js +1 -2
  38. package/dist/cmds/whoami.js.map +1 -1
  39. package/dist/common/middleware/confirm-production-deploy.d.ts +4 -0
  40. package/dist/common/middleware/confirm-production-deploy.d.ts.map +1 -0
  41. package/dist/common/middleware/confirm-production-deploy.js +49 -0
  42. package/dist/common/middleware/confirm-production-deploy.js.map +1 -0
  43. package/dist/common/middleware/get-environment-param.d.ts +6 -0
  44. package/dist/common/middleware/get-environment-param.d.ts.map +1 -1
  45. package/dist/common/middleware/get-environment-param.js +15 -0
  46. package/dist/common/middleware/get-environment-param.js.map +1 -1
  47. package/dist/common/middleware/get-environment-param.test.d.ts +2 -0
  48. package/dist/common/middleware/get-environment-param.test.d.ts.map +1 -0
  49. package/dist/common/middleware/get-environment-param.test.js +33 -0
  50. package/dist/common/middleware/get-environment-param.test.js.map +1 -0
  51. package/dist/common/output.d.ts +3 -0
  52. package/dist/common/output.d.ts.map +1 -1
  53. package/dist/common/output.js +11 -0
  54. package/dist/common/output.js.map +1 -1
  55. package/dist/common/read-linked-config.d.ts +6 -1
  56. package/dist/common/read-linked-config.d.ts.map +1 -1
  57. package/dist/common/read-linked-config.js +14 -4
  58. package/dist/common/read-linked-config.js.map +1 -1
  59. package/dist/common/read-linked-config.test.js +97 -0
  60. package/dist/common/read-linked-config.test.js.map +1 -1
  61. package/dist/deploy/environments.d.ts +1 -0
  62. package/dist/deploy/environments.d.ts.map +1 -1
  63. package/dist/deploy/environments.js +11 -7
  64. package/dist/deploy/environments.js.map +1 -1
  65. package/dist/login/logout.d.ts +5 -0
  66. package/dist/login/logout.d.ts.map +1 -0
  67. package/dist/login/logout.js +6 -0
  68. package/dist/login/logout.js.map +1 -0
  69. package/dist/login/tokens.d.ts +1 -0
  70. package/dist/login/tokens.d.ts.map +1 -1
  71. package/dist/login/tokens.js +16 -1
  72. package/dist/login/tokens.js.map +1 -1
  73. package/dist/tsconfig.tsbuildinfo +1 -1
  74. package/dist/whoami/handler.d.ts +1 -1
  75. package/dist/whoami/handler.d.ts.map +1 -1
  76. package/dist/whoami/handler.js +8 -1
  77. package/dist/whoami/handler.js.map +1 -1
  78. package/node_modules/@zuplo/core/customer.cli.minified.js +225 -211
  79. package/node_modules/@zuplo/core/index.minified.js +237 -223
  80. package/node_modules/@zuplo/core/package.json +1 -1
  81. package/node_modules/@zuplo/editor/node_modules/find-my-way/.github/workflows/node.js.yml +1 -1
  82. package/node_modules/@zuplo/editor/node_modules/find-my-way/README.md +10 -0
  83. package/node_modules/@zuplo/editor/node_modules/find-my-way/index.d.ts +6 -0
  84. package/node_modules/@zuplo/editor/node_modules/find-my-way/index.js +37 -4
  85. package/node_modules/@zuplo/editor/node_modules/find-my-way/lib/handler-storage.js +2 -2
  86. package/node_modules/@zuplo/editor/node_modules/find-my-way/package.json +3 -3
  87. package/node_modules/@zuplo/editor/node_modules/find-my-way/test/repro-issue-414.test.js +57 -0
  88. package/node_modules/@zuplo/editor/node_modules/find-my-way/test/types/router.test-d.ts +1 -0
  89. package/node_modules/@zuplo/graphql/package.json +1 -1
  90. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  91. package/node_modules/@zuplo/otel/package.json +1 -1
  92. package/node_modules/@zuplo/runtime/out/esm/index.js +48 -48
  93. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  94. package/node_modules/@zuplo/runtime/out/types/index.d.ts +23 -2
  95. package/node_modules/@zuplo/runtime/package.json +1 -1
  96. package/node_modules/graphql/index.d.ts +1 -0
  97. package/node_modules/graphql/language/ast.d.ts +10 -1
  98. package/node_modules/graphql/language/ast.js +8 -1
  99. package/node_modules/graphql/language/ast.mjs +8 -1
  100. package/node_modules/graphql/language/directiveLocation.d.ts +1 -0
  101. package/node_modules/graphql/language/directiveLocation.js +1 -0
  102. package/node_modules/graphql/language/directiveLocation.mjs +1 -0
  103. package/node_modules/graphql/language/index.d.ts +1 -0
  104. package/node_modules/graphql/language/kinds.d.ts +1 -0
  105. package/node_modules/graphql/language/kinds.js +1 -0
  106. package/node_modules/graphql/language/kinds.mjs +1 -0
  107. package/node_modules/graphql/language/parser.d.ts +14 -0
  108. package/node_modules/graphql/language/parser.js +33 -0
  109. package/node_modules/graphql/language/parser.mjs +33 -0
  110. package/node_modules/graphql/language/predicates.js +3 -1
  111. package/node_modules/graphql/language/predicates.mjs +5 -1
  112. package/node_modules/graphql/language/printer.js +13 -1
  113. package/node_modules/graphql/language/printer.mjs +13 -1
  114. package/node_modules/graphql/package.json +1 -1
  115. package/node_modules/graphql/type/directives.d.ts +9 -1
  116. package/node_modules/graphql/type/directives.js +10 -1
  117. package/node_modules/graphql/type/directives.mjs +10 -1
  118. package/node_modules/graphql/type/introspection.js +24 -1
  119. package/node_modules/graphql/type/introspection.mjs +24 -1
  120. package/node_modules/graphql/utilities/buildASTSchema.js +4 -0
  121. package/node_modules/graphql/utilities/buildASTSchema.mjs +4 -0
  122. package/node_modules/graphql/utilities/buildClientSchema.js +1 -0
  123. package/node_modules/graphql/utilities/buildClientSchema.mjs +1 -0
  124. package/node_modules/graphql/utilities/extendSchema.js +58 -3
  125. package/node_modules/graphql/utilities/extendSchema.mjs +58 -3
  126. package/node_modules/graphql/utilities/getIntrospectionQuery.d.ts +16 -0
  127. package/node_modules/graphql/utilities/getIntrospectionQuery.js +31 -38
  128. package/node_modules/graphql/utilities/getIntrospectionQuery.mjs +31 -38
  129. package/node_modules/graphql/utilities/introspectionFromSchema.js +1 -0
  130. package/node_modules/graphql/utilities/introspectionFromSchema.mjs +1 -0
  131. package/node_modules/graphql/utilities/printSchema.js +1 -0
  132. package/node_modules/graphql/utilities/printSchema.mjs +1 -0
  133. package/node_modules/graphql/utilities/valueFromAST.js +12 -2
  134. package/node_modules/graphql/utilities/valueFromAST.mjs +12 -2
  135. package/node_modules/graphql/validation/rules/KnownDirectivesRule.js +4 -0
  136. package/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +4 -0
  137. package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +12 -0
  138. package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +12 -0
  139. package/node_modules/graphql/version.js +3 -3
  140. package/node_modules/graphql/version.mjs +3 -3
  141. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "6.69.6",
3
+ "version": "6.69.9",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -63,6 +63,6 @@ jobs:
63
63
  pull-requests: write
64
64
  contents: write
65
65
  steps:
66
- - uses: fastify/github-action-merge-dependabot@1b2ed42db8f9d81a46bac83adedfc03eb5149dff # v3.11.2
66
+ - uses: fastify/github-action-merge-dependabot@30c3f8f14a4f7b315ba38dbc1b793d27128fef82 # v3.12.0
67
67
  with:
68
68
  github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -126,6 +126,16 @@ const router = require('find-my-way')({
126
126
  })
127
127
  ```
128
128
 
129
+ If you want to handle the case where the `maxParamLength` is exceeded, you can provide a custom `onMaxParamLength` handler. This handler will be invoked if no other route (e.g. a wildcard) matches the path.
130
+ ```js
131
+ const router = require('find-my-way')({
132
+ onMaxParamLength: function (path, req, res) {
133
+ res.statusCode = 414
134
+ res.end('URI Too Long')
135
+ }
136
+ })
137
+ ```
138
+
129
139
  If you are using a regex based route, `find-my-way` will throw an error if detects potentially catastrophic exponential-time regular expressions *(internally uses [`safe-regex2`](https://github.com/fastify/safe-regex2))*.<br/>
130
140
  If you want to disable this behavior, pass the option `allowUnsafeRegex`.
131
141
  ```js
@@ -103,6 +103,12 @@ declare namespace Router {
103
103
  res: Res<V>
104
104
  ): void;
105
105
 
106
+ onMaxParamLength?(
107
+ path: string,
108
+ req: Req<V>,
109
+ res: Res<V>
110
+ ): void;
111
+
106
112
  constraints? : {
107
113
  [key: string]: ConstraintStrategy<V>
108
114
  }
@@ -96,6 +96,7 @@ function Router (opts) {
96
96
  this.ignoreTrailingSlash = opts.ignoreTrailingSlash || false
97
97
  this.ignoreDuplicateSlashes = opts.ignoreDuplicateSlashes || false
98
98
  this.maxParamLength = opts.maxParamLength || 100
99
+ this.onMaxParamLength = opts.onMaxParamLength || null
99
100
  this.allowUnsafeRegex = opts.allowUnsafeRegex || false
100
101
  this.constrainer = new Constrainer(opts.constraints)
101
102
  this.useSemicolonDelimiter = opts.useSemicolonDelimiter || false
@@ -608,6 +609,7 @@ Router.prototype.find = function find (method, path, derivedConstraints) {
608
609
  const pathLen = path.length
609
610
 
610
611
  const brothersNodesStack = []
612
+ let maxParamLengthExceeded = false
611
613
 
612
614
  while (true) {
613
615
  if (pathIndex === pathLen && currentNode.isLeafNode) {
@@ -626,6 +628,9 @@ Router.prototype.find = function find (method, path, derivedConstraints) {
626
628
 
627
629
  if (node === null) {
628
630
  if (brothersNodesStack.length === 0) {
631
+ if (maxParamLengthExceeded && this.onMaxParamLength) {
632
+ return this._onMaxParamLength(originPath)
633
+ }
629
634
  return null
630
635
  }
631
636
 
@@ -667,18 +672,34 @@ Router.prototype.find = function find (method, path, derivedConstraints) {
667
672
 
668
673
  if (currentNode.isRegex) {
669
674
  const matchedParameters = currentNode.regex.exec(param)
670
- if (matchedParameters === null) continue
675
+ if (matchedParameters === null) {
676
+ node = null
677
+ continue
678
+ }
671
679
 
680
+ let regexMaxParamLengthExceeded = false
672
681
  for (let i = 1; i < matchedParameters.length; i++) {
673
682
  const matchedParam = matchedParameters[i]
674
683
  if (matchedParam.length > maxParamLength) {
675
- return null
684
+ regexMaxParamLengthExceeded = true
685
+ break
676
686
  }
677
- params.push(matchedParam)
687
+ }
688
+
689
+ if (regexMaxParamLengthExceeded) {
690
+ maxParamLengthExceeded = true
691
+ node = null
692
+ continue
693
+ }
694
+
695
+ for (let i = 1; i < matchedParameters.length; i++) {
696
+ params.push(matchedParameters[i])
678
697
  }
679
698
  } else {
680
699
  if (param.length > maxParamLength) {
681
- return null
700
+ maxParamLengthExceeded = true
701
+ node = null
702
+ continue
682
703
  }
683
704
  params.push(param)
684
705
  }
@@ -719,6 +740,18 @@ Router.prototype._onBadUrl = function (path) {
719
740
  }
720
741
  }
721
742
 
743
+ Router.prototype._onMaxParamLength = function (path) {
744
+ if (this.onMaxParamLength === null) {
745
+ return null
746
+ }
747
+ const onMaxParamLength = this.onMaxParamLength
748
+ return {
749
+ handler: (req, res, ctx) => onMaxParamLength(path, req, res),
750
+ params: {},
751
+ store: null
752
+ }
753
+ }
754
+
722
755
  Router.prototype.prettyPrint = function (options = {}) {
723
756
  const method = options.method
724
757
 
@@ -165,8 +165,8 @@ class HandlerStorage {
165
165
  }
166
166
  }
167
167
 
168
- // Return the first handler who's bit is set in the candidates https://stackoverflow.com/questions/18134985/how-to-find-index-of-first-set-bit
169
- lines.push('return this.handlers[Math.floor(Math.log2(candidates))]')
168
+ // Return the highest set bit index in the candidates bitmask.
169
+ lines.push('return this.handlers[31 - Math.clz32(candidates)]')
170
170
 
171
171
  this._getHandlerMatchingConstraints = new Function('derivedConstraints', lines.join('\n')) // eslint-disable-line
172
172
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "find-my-way",
3
- "version": "9.5.0",
3
+ "version": "9.6.0",
4
4
  "description": "Crazy fast http radix based router",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -36,10 +36,10 @@
36
36
  "devDependencies": {
37
37
  "@types/node": "^25.0.3",
38
38
  "benchmark": "^2.1.4",
39
- "borp": "^0.21.0",
39
+ "borp": "^1.0.0",
40
40
  "chalk": "^5.4.1",
41
41
  "inquirer": "^13.1.0",
42
- "pre-commit": "^1.2.2",
42
+ "pre-commit": "^2.0.0",
43
43
  "proxyquire": "^2.1.3",
44
44
  "rfdc": "^1.3.0",
45
45
  "simple-git": "^3.7.1",
@@ -0,0 +1,57 @@
1
+ 'use strict'
2
+
3
+ const { test } = require('node:test')
4
+ const FindMyWay = require('../')
5
+
6
+ test('should return null when maxParamLength is exceeded (current behavior)', t => {
7
+ t.plan(1)
8
+ const findMyWay = FindMyWay({ maxParamLength: 5 })
9
+ findMyWay.on('GET', '/test/:param', () => 'param')
10
+
11
+ const handle = findMyWay.find('GET', '/test/123456')
12
+ t.assert.equal(handle, null)
13
+ })
14
+
15
+ test('should still match other routes if one parametric route exceeds maxParamLength (static)', t => {
16
+ t.plan(2)
17
+ const findMyWay = FindMyWay({ maxParamLength: 5 })
18
+ findMyWay.on('GET', '/test/:param', () => 'param')
19
+ findMyWay.on('GET', '/test/special', () => 'special')
20
+
21
+ const handle = findMyWay.find('GET', '/test/special')
22
+ t.assert.ok(handle)
23
+ t.assert.equal(handle.handler(), 'special')
24
+ })
25
+
26
+ test('should fail to match any route if the only candidate exceeds maxParamLength', t => {
27
+ t.plan(1)
28
+ const findMyWay = FindMyWay({ maxParamLength: 5 })
29
+ findMyWay.on('GET', '/test/:param', () => 'param')
30
+
31
+ const handle = findMyWay.find('GET', '/test/123456789')
32
+ t.assert.equal(handle, null)
33
+ })
34
+
35
+ test('should match wildcard if parametric exceeds maxParamLength', t => {
36
+ t.plan(2)
37
+ const findMyWay = FindMyWay({ maxParamLength: 5 })
38
+ findMyWay.on('GET', '/test/:param', () => 'param')
39
+ findMyWay.on('GET', '/test/*', () => 'wildcard')
40
+
41
+ const handle = findMyWay.find('GET', '/test/123456789')
42
+ t.assert.ok(handle)
43
+ t.assert.equal(handle.handler(), 'wildcard')
44
+ })
45
+
46
+ test('should return custom onMaxParamLength handler if provided and no other route matches', t => {
47
+ t.plan(2)
48
+ const findMyWay = FindMyWay({
49
+ maxParamLength: 5,
50
+ onMaxParamLength: (path, req, res) => 'custom error'
51
+ })
52
+ findMyWay.on('GET', '/test/:param', () => 'param')
53
+
54
+ const handle = findMyWay.find('GET', '/test/123456')
55
+ t.assert.ok(handle)
56
+ t.assert.equal(handle.handler(), 'custom error')
57
+ })
@@ -27,6 +27,7 @@ expectType<string>(Router.trimLastSlash('/hello/'))
27
27
  querystringParser: (queryString) => {},
28
28
  defaultRoute (http1Req, http1Res) {},
29
29
  onBadUrl (path, http1Req, http1Res) {},
30
+ onMaxParamLength (path, http1Req, http1Res) {},
30
31
  constraints: {
31
32
  foo: {
32
33
  name: 'foo',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/graphql",
3
3
  "type": "module",
4
- "version": "6.69.6",
4
+ "version": "6.69.9",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -2,7 +2,7 @@
2
2
  "name": "@zuplo/openapi-tools",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "6.69.6",
5
+ "version": "6.69.9",
6
6
  "description": "Tooling for OpenAPI files",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/otel",
3
3
  "type": "module",
4
- "version": "6.69.6",
4
+ "version": "6.69.9",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {