@zuplo/cli 7.1.9 → 7.2.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.
Files changed (107) hide show
  1. package/node_modules/@hono/node-server/dist/index.cjs +151 -9
  2. package/node_modules/@hono/node-server/dist/index.mjs +151 -9
  3. package/node_modules/@hono/node-server/package.json +1 -1
  4. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -3
  5. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +4 -3
  6. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +4 -3
  7. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/jwt/encrypt.d.ts +4 -3
  8. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/types/types.d.ts +4 -2
  9. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwe/general/encrypt.js +7 -3
  10. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  11. package/node_modules/@modelcontextprotocol/client/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +6 -2
  12. package/node_modules/@modelcontextprotocol/client/node_modules/jose/package.json +1 -1
  13. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +4 -3
  14. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +4 -3
  15. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +4 -3
  16. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/jwt/encrypt.d.ts +4 -3
  17. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/types/types.d.ts +4 -2
  18. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwe/general/encrypt.js +7 -3
  19. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  20. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +6 -2
  21. package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
  22. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +24 -3
  23. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
  24. package/node_modules/@posthog/core/dist/posthog-core-stateless.js +30 -9
  25. package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +28 -10
  26. package/node_modules/@posthog/core/dist/posthog-core.d.ts +3 -3
  27. package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
  28. package/node_modules/@posthog/core/dist/posthog-core.js +1 -0
  29. package/node_modules/@posthog/core/dist/posthog-core.mjs +1 -0
  30. package/node_modules/@posthog/core/dist/types.d.ts +2 -1
  31. package/node_modules/@posthog/core/dist/types.d.ts.map +1 -1
  32. package/node_modules/@posthog/core/dist/types.js +1 -0
  33. package/node_modules/@posthog/core/dist/types.mjs +1 -0
  34. package/node_modules/@posthog/core/package.json +2 -2
  35. package/node_modules/@posthog/core/src/posthog-core-stateless.ts +42 -10
  36. package/node_modules/@posthog/core/src/posthog-core.ts +4 -3
  37. package/node_modules/@posthog/core/src/types.ts +2 -1
  38. package/node_modules/@posthog/types/dist/capture.d.ts +1 -1
  39. package/node_modules/@posthog/types/dist/index.d.ts +1 -1
  40. package/node_modules/@posthog/types/dist/index.d.ts.map +1 -1
  41. package/node_modules/@posthog/types/dist/posthog-config.d.ts +54 -5
  42. package/node_modules/@posthog/types/dist/posthog-config.d.ts.map +1 -1
  43. package/node_modules/@posthog/types/dist/posthog.d.ts +3 -3
  44. package/node_modules/@posthog/types/dist/posthog.d.ts.map +1 -1
  45. package/node_modules/@posthog/types/dist/segment.d.ts +11 -2
  46. package/node_modules/@posthog/types/dist/segment.d.ts.map +1 -1
  47. package/node_modules/@posthog/types/package.json +1 -1
  48. package/node_modules/@posthog/types/src/capture.ts +1 -1
  49. package/node_modules/@posthog/types/src/index.ts +1 -0
  50. package/node_modules/@posthog/types/src/posthog-config.ts +64 -6
  51. package/node_modules/@posthog/types/src/posthog.ts +3 -3
  52. package/node_modules/@posthog/types/src/segment.ts +11 -2
  53. package/node_modules/@zuplo/core/customer.cli.minified.js +1 -1
  54. package/node_modules/@zuplo/core/index.minified.js +1 -1
  55. package/node_modules/@zuplo/core/package.json +1 -1
  56. package/node_modules/@zuplo/graphql/package.json +1 -1
  57. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  58. package/node_modules/@zuplo/otel/package.json +1 -1
  59. package/node_modules/@zuplo/runtime/out/esm/chunk-4VE55TG3.js +26 -0
  60. package/node_modules/@zuplo/runtime/out/esm/chunk-4VE55TG3.js.map +1 -0
  61. package/node_modules/@zuplo/runtime/out/esm/chunk-FP5XLKCX.js +409 -0
  62. package/node_modules/@zuplo/runtime/out/esm/chunk-FP5XLKCX.js.map +1 -0
  63. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  64. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  65. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  66. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  67. package/node_modules/@zuplo/runtime/out/types/index.d.ts +299 -20
  68. package/node_modules/@zuplo/runtime/out/types/internal/index.d.ts +1 -0
  69. package/node_modules/@zuplo/runtime/out/types/mcp/messages/index.d.ts +1 -0
  70. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +1 -0
  71. package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +1 -0
  72. package/node_modules/@zuplo/runtime/out/types/sdks/aws/index.d.ts +1 -0
  73. package/node_modules/@zuplo/runtime/package.json +1 -1
  74. package/node_modules/ansi-regex/index.js +3 -2
  75. package/node_modules/ansi-regex/package.json +1 -1
  76. package/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  77. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  78. package/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  79. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  80. package/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  81. package/node_modules/default-browser/package.json +1 -1
  82. package/node_modules/default-browser/windows.js +3 -1
  83. package/node_modules/hono/dist/cjs/client/client.js +3 -3
  84. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +1 -1
  85. package/node_modules/hono/dist/cjs/middleware/cors/index.js +15 -12
  86. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +47 -1
  87. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +6 -3
  88. package/node_modules/hono/dist/cjs/utils/url.js +2 -2
  89. package/node_modules/hono/dist/client/client.js +3 -3
  90. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +1 -1
  91. package/node_modules/hono/dist/middleware/cors/index.js +15 -12
  92. package/node_modules/hono/dist/middleware/etag/digest.js +47 -1
  93. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +6 -3
  94. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +3 -3
  95. package/node_modules/hono/dist/utils/url.js +2 -2
  96. package/node_modules/hono/package.json +1 -1
  97. package/node_modules/type-is/node_modules/content-type/README.md +2 -0
  98. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  99. package/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  100. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  101. package/node_modules/type-is/node_modules/content-type/package.json +1 -1
  102. package/package.json +6 -6
  103. package/node_modules/@zuplo/runtime/out/esm/chunk-MXYNCB5D.js +0 -382
  104. package/node_modules/@zuplo/runtime/out/esm/chunk-MXYNCB5D.js.map +0 -1
  105. package/node_modules/@zuplo/runtime/out/esm/chunk-RAZK5G27.js +0 -26
  106. package/node_modules/@zuplo/runtime/out/esm/chunk-RAZK5G27.js.map +0 -1
  107. /package/node_modules/@zuplo/runtime/out/esm/{chunk-MXYNCB5D.js.LEGAL.txt → chunk-FP5XLKCX.js.LEGAL.txt} +0 -0
@@ -13,6 +13,157 @@ var RequestError = class extends Error {
13
13
  }
14
14
  };
15
15
 
16
+ //#endregion
17
+ //#region src/headers.ts
18
+ const nonJoinedHeaders = new Set([
19
+ "age",
20
+ "authorization",
21
+ "content-length",
22
+ "content-type",
23
+ "etag",
24
+ "expires",
25
+ "from",
26
+ "host",
27
+ "if-modified-since",
28
+ "if-unmodified-since",
29
+ "last-modified",
30
+ "location",
31
+ "max-forwards",
32
+ "proxy-authorization",
33
+ "referer",
34
+ "retry-after",
35
+ "server",
36
+ "user-agent"
37
+ ]);
38
+ const validHeaderName = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
39
+ const isHttpWhitespace = (code) => code === 9 || code === 10 || code === 13 || code === 32;
40
+ const normalizeHeaderValue = (value) => {
41
+ if (!isHttpWhitespace(value.charCodeAt(0)) && !isHttpWhitespace(value.charCodeAt(value.length - 1))) return value;
42
+ let start = 0;
43
+ let end = value.length;
44
+ while (start < end && isHttpWhitespace(value.charCodeAt(start))) start++;
45
+ while (end > start && isHttpWhitespace(value.charCodeAt(end - 1))) end--;
46
+ return value.slice(start, end);
47
+ };
48
+ const forbiddenHeaderValue = /[\0\r\n]/;
49
+ const GlobalHeaders = globalThis.Headers;
50
+ const materializeHeaders = (rawHeaders, HeadersCtor = GlobalHeaders) => {
51
+ const headers = new HeadersCtor();
52
+ for (let i = 0; i < rawHeaders.length; i += 2) {
53
+ const name = rawHeaders[i];
54
+ if (!name.startsWith(":")) headers.append(name, rawHeaders[i + 1]);
55
+ }
56
+ return headers;
57
+ };
58
+ var RequestHeaders = class {
59
+ #incoming;
60
+ #rawHeaders;
61
+ #headers;
62
+ #invalidValue;
63
+ constructor(incoming) {
64
+ this.#incoming = incoming;
65
+ if (incoming instanceof node_http2.Http2ServerRequest) this.#rawHeaders = incoming.rawHeaders.slice();
66
+ }
67
+ get #lazyRawHeaders() {
68
+ return this.#rawHeaders ??= this.#incoming.rawHeaders.slice();
69
+ }
70
+ get #native() {
71
+ if (!this.#headers) {
72
+ this.#headers = materializeHeaders(this.#lazyRawHeaders);
73
+ this.#rawHeaders = void 0;
74
+ }
75
+ return this.#headers;
76
+ }
77
+ #normalizedName(name) {
78
+ if (typeof name !== "string") return;
79
+ if (!validHeaderName.test(name)) throw new TypeError(`Invalid header name: ${name}`);
80
+ return name.toLowerCase();
81
+ }
82
+ #lookupHttp1(lowerName) {
83
+ const headers = this.#incoming instanceof node_http2.Http2ServerRequest ? void 0 : this.#incoming.headers;
84
+ if (!headers || nonJoinedHeaders.has(lowerName) || lowerName === "set-cookie" || lowerName === "__proto__") return;
85
+ if (!Object.hasOwn(headers, lowerName)) return null;
86
+ const rawValue = headers[lowerName];
87
+ if (typeof rawValue === "string") {
88
+ const value = normalizeHeaderValue(rawValue);
89
+ return forbiddenHeaderValue.test(value) ? void 0 : value;
90
+ }
91
+ }
92
+ #lookup(rawHeaders, lowerName) {
93
+ const separator = lowerName === "cookie" ? "; " : ", ";
94
+ let value = null;
95
+ for (let i = 0; i < rawHeaders.length; i += 2) {
96
+ const rawName = rawHeaders[i];
97
+ if (rawName.length === lowerName.length && rawName.toLowerCase() === lowerName) {
98
+ const rawValue = normalizeHeaderValue(rawHeaders[i + 1]);
99
+ if (forbiddenHeaderValue.test(rawValue)) {
100
+ this.#invalidValue = true;
101
+ return;
102
+ }
103
+ value = value === null ? rawValue : value + separator + rawValue;
104
+ }
105
+ }
106
+ return value;
107
+ }
108
+ append(name, value) {
109
+ this.#native.append(name, value);
110
+ }
111
+ delete(name) {
112
+ this.#native.delete(name);
113
+ }
114
+ get(name) {
115
+ const lowerName = this.#normalizedName(name);
116
+ if (lowerName && !this.#headers && !this.#invalidValue) {
117
+ const http1Value = this.#lookupHttp1(lowerName);
118
+ if (http1Value !== void 0) return http1Value;
119
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
120
+ if (value !== void 0) return value;
121
+ }
122
+ return this.#native.get(name);
123
+ }
124
+ has(name) {
125
+ const lowerName = this.#normalizedName(name);
126
+ if (lowerName && !this.#headers && !this.#invalidValue) {
127
+ const http1Value = this.#lookupHttp1(lowerName);
128
+ if (http1Value !== void 0) return http1Value !== null;
129
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
130
+ if (value !== void 0) return value !== null;
131
+ }
132
+ return this.#native.has(name);
133
+ }
134
+ set(name, value) {
135
+ this.#native.set(name, value);
136
+ }
137
+ getSetCookie() {
138
+ return this.#native.getSetCookie();
139
+ }
140
+ keys() {
141
+ return this.#native.keys();
142
+ }
143
+ values() {
144
+ return this.#native.values();
145
+ }
146
+ entries() {
147
+ return this.#native.entries();
148
+ }
149
+ forEach(callback, thisArg) {
150
+ this.#native.forEach((value, key) => {
151
+ callback.call(thisArg, value, key, this);
152
+ });
153
+ }
154
+ [Symbol.iterator]() {
155
+ return this.entries();
156
+ }
157
+ };
158
+ Object.defineProperty(RequestHeaders.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
159
+ return `Headers (lightweight) ${inspectFn(Object.fromEntries(this), {
160
+ ...options,
161
+ depth: depth == null ? null : depth - 1
162
+ })}`;
163
+ } });
164
+ Object.setPrototypeOf(RequestHeaders.prototype, GlobalHeaders.prototype);
165
+ const newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeaders ? new RequestHeaders(incoming) : materializeHeaders(incoming.rawHeaders, globalThis.Headers);
166
+
16
167
  //#endregion
17
168
  //#region src/url.ts
18
169
  const reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
@@ -50,15 +201,6 @@ var Request$1 = class extends GlobalRequest {
50
201
  super(input, options);
51
202
  }
52
203
  };
53
- const newHeadersFromIncoming = (incoming) => {
54
- const headerRecord = [];
55
- const rawHeaders = incoming.rawHeaders;
56
- for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
57
- const key = rawHeaders[i];
58
- if (key.charCodeAt(0) !== 58) headerRecord.push([key, rawHeaders[i + 1]]);
59
- }
60
- return new Headers(headerRecord);
61
- };
62
204
  const wrapBodyStream = Symbol("wrapBodyStream");
63
205
  const byteExactEncodings = new Set([
64
206
  "latin1",
@@ -12,6 +12,157 @@ var RequestError = class extends Error {
12
12
  }
13
13
  };
14
14
 
15
+ //#endregion
16
+ //#region src/headers.ts
17
+ const nonJoinedHeaders = new Set([
18
+ "age",
19
+ "authorization",
20
+ "content-length",
21
+ "content-type",
22
+ "etag",
23
+ "expires",
24
+ "from",
25
+ "host",
26
+ "if-modified-since",
27
+ "if-unmodified-since",
28
+ "last-modified",
29
+ "location",
30
+ "max-forwards",
31
+ "proxy-authorization",
32
+ "referer",
33
+ "retry-after",
34
+ "server",
35
+ "user-agent"
36
+ ]);
37
+ const validHeaderName = /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/;
38
+ const isHttpWhitespace = (code) => code === 9 || code === 10 || code === 13 || code === 32;
39
+ const normalizeHeaderValue = (value) => {
40
+ if (!isHttpWhitespace(value.charCodeAt(0)) && !isHttpWhitespace(value.charCodeAt(value.length - 1))) return value;
41
+ let start = 0;
42
+ let end = value.length;
43
+ while (start < end && isHttpWhitespace(value.charCodeAt(start))) start++;
44
+ while (end > start && isHttpWhitespace(value.charCodeAt(end - 1))) end--;
45
+ return value.slice(start, end);
46
+ };
47
+ const forbiddenHeaderValue = /[\0\r\n]/;
48
+ const GlobalHeaders = globalThis.Headers;
49
+ const materializeHeaders = (rawHeaders, HeadersCtor = GlobalHeaders) => {
50
+ const headers = new HeadersCtor();
51
+ for (let i = 0; i < rawHeaders.length; i += 2) {
52
+ const name = rawHeaders[i];
53
+ if (!name.startsWith(":")) headers.append(name, rawHeaders[i + 1]);
54
+ }
55
+ return headers;
56
+ };
57
+ var RequestHeaders = class {
58
+ #incoming;
59
+ #rawHeaders;
60
+ #headers;
61
+ #invalidValue;
62
+ constructor(incoming) {
63
+ this.#incoming = incoming;
64
+ if (incoming instanceof Http2ServerRequest) this.#rawHeaders = incoming.rawHeaders.slice();
65
+ }
66
+ get #lazyRawHeaders() {
67
+ return this.#rawHeaders ??= this.#incoming.rawHeaders.slice();
68
+ }
69
+ get #native() {
70
+ if (!this.#headers) {
71
+ this.#headers = materializeHeaders(this.#lazyRawHeaders);
72
+ this.#rawHeaders = void 0;
73
+ }
74
+ return this.#headers;
75
+ }
76
+ #normalizedName(name) {
77
+ if (typeof name !== "string") return;
78
+ if (!validHeaderName.test(name)) throw new TypeError(`Invalid header name: ${name}`);
79
+ return name.toLowerCase();
80
+ }
81
+ #lookupHttp1(lowerName) {
82
+ const headers = this.#incoming instanceof Http2ServerRequest ? void 0 : this.#incoming.headers;
83
+ if (!headers || nonJoinedHeaders.has(lowerName) || lowerName === "set-cookie" || lowerName === "__proto__") return;
84
+ if (!Object.hasOwn(headers, lowerName)) return null;
85
+ const rawValue = headers[lowerName];
86
+ if (typeof rawValue === "string") {
87
+ const value = normalizeHeaderValue(rawValue);
88
+ return forbiddenHeaderValue.test(value) ? void 0 : value;
89
+ }
90
+ }
91
+ #lookup(rawHeaders, lowerName) {
92
+ const separator = lowerName === "cookie" ? "; " : ", ";
93
+ let value = null;
94
+ for (let i = 0; i < rawHeaders.length; i += 2) {
95
+ const rawName = rawHeaders[i];
96
+ if (rawName.length === lowerName.length && rawName.toLowerCase() === lowerName) {
97
+ const rawValue = normalizeHeaderValue(rawHeaders[i + 1]);
98
+ if (forbiddenHeaderValue.test(rawValue)) {
99
+ this.#invalidValue = true;
100
+ return;
101
+ }
102
+ value = value === null ? rawValue : value + separator + rawValue;
103
+ }
104
+ }
105
+ return value;
106
+ }
107
+ append(name, value) {
108
+ this.#native.append(name, value);
109
+ }
110
+ delete(name) {
111
+ this.#native.delete(name);
112
+ }
113
+ get(name) {
114
+ const lowerName = this.#normalizedName(name);
115
+ if (lowerName && !this.#headers && !this.#invalidValue) {
116
+ const http1Value = this.#lookupHttp1(lowerName);
117
+ if (http1Value !== void 0) return http1Value;
118
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
119
+ if (value !== void 0) return value;
120
+ }
121
+ return this.#native.get(name);
122
+ }
123
+ has(name) {
124
+ const lowerName = this.#normalizedName(name);
125
+ if (lowerName && !this.#headers && !this.#invalidValue) {
126
+ const http1Value = this.#lookupHttp1(lowerName);
127
+ if (http1Value !== void 0) return http1Value !== null;
128
+ const value = this.#lookup(this.#lazyRawHeaders, lowerName);
129
+ if (value !== void 0) return value !== null;
130
+ }
131
+ return this.#native.has(name);
132
+ }
133
+ set(name, value) {
134
+ this.#native.set(name, value);
135
+ }
136
+ getSetCookie() {
137
+ return this.#native.getSetCookie();
138
+ }
139
+ keys() {
140
+ return this.#native.keys();
141
+ }
142
+ values() {
143
+ return this.#native.values();
144
+ }
145
+ entries() {
146
+ return this.#native.entries();
147
+ }
148
+ forEach(callback, thisArg) {
149
+ this.#native.forEach((value, key) => {
150
+ callback.call(thisArg, value, key, this);
151
+ });
152
+ }
153
+ [Symbol.iterator]() {
154
+ return this.entries();
155
+ }
156
+ };
157
+ Object.defineProperty(RequestHeaders.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
158
+ return `Headers (lightweight) ${inspectFn(Object.fromEntries(this), {
159
+ ...options,
160
+ depth: depth == null ? null : depth - 1
161
+ })}`;
162
+ } });
163
+ Object.setPrototypeOf(RequestHeaders.prototype, GlobalHeaders.prototype);
164
+ const newHeadersFromIncoming = (incoming) => globalThis.Headers === GlobalHeaders ? new RequestHeaders(incoming) : materializeHeaders(incoming.rawHeaders, globalThis.Headers);
165
+
15
166
  //#endregion
16
167
  //#region src/url.ts
17
168
  const reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
@@ -49,15 +200,6 @@ var Request$1 = class extends GlobalRequest {
49
200
  super(input, options);
50
201
  }
51
202
  };
52
- const newHeadersFromIncoming = (incoming) => {
53
- const headerRecord = [];
54
- const rawHeaders = incoming.rawHeaders;
55
- for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
56
- const key = rawHeaders[i];
57
- if (key.charCodeAt(0) !== 58) headerRecord.push([key, rawHeaders[i + 1]]);
58
- }
59
- return new Headers(headerRecord);
60
- };
61
203
  const wrapBodyStream = Symbol("wrapBodyStream");
62
204
  const byteExactEncodings = new Set([
63
205
  "latin1",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hono/node-server",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Node.js Adapter for Hono",
5
5
  "main": "dist/index.mjs",
6
6
  "type": "module",
@@ -35,9 +35,10 @@ export declare class CompactEncrypt {
35
35
  */
36
36
  setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
37
37
  /**
38
- * Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
39
- * use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
40
- * parameters.
38
+ * Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of
39
+ * the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo)
40
+ * and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the
41
+ * appropriate JOSE Header.
41
42
  *
42
43
  * @param parameters JWE Key Management parameters.
43
44
  */
@@ -9,9 +9,10 @@ export declare class FlattenedEncrypt {
9
9
  */
10
10
  constructor(plaintext: Uint8Array);
11
11
  /**
12
- * Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
13
- * use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
14
- * parameters.
12
+ * Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of
13
+ * the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo)
14
+ * and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the
15
+ * appropriate JOSE Header.
15
16
  *
16
17
  * @param parameters JWE Key Management parameters.
17
18
  */
@@ -8,9 +8,10 @@ export interface Recipient {
8
8
  */
9
9
  setUnprotectedHeader(unprotectedHeader: types.JWEHeaderParameters): Recipient;
10
10
  /**
11
- * Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
12
- * use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
13
- * parameters.
11
+ * Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of
12
+ * the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo)
13
+ * and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the
14
+ * appropriate JOSE Header.
14
15
  *
15
16
  * @param parameters JWE Key Management parameters.
16
17
  */
@@ -23,9 +23,10 @@ export declare class EncryptJWT implements types.ProduceJWT {
23
23
  */
24
24
  setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
25
25
  /**
26
- * Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
27
- * use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
28
- * parameters.
26
+ * Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of
27
+ * the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo)
28
+ * and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the
29
+ * appropriate JOSE Header.
29
30
  *
30
31
  * @param parameters JWE Key Management parameters.
31
32
  */
@@ -417,11 +417,13 @@ export interface JWEKeyManagementHeaderParameters {
417
417
  * used in ECDH's ConcatKDF.
418
418
  */
419
419
  apv?: Uint8Array
420
+
420
421
  /**
421
- * @deprecated You should not use this parameter. It is only intended for testing and vector
422
- * validation purposes.
422
+ * PBES2 "p2c" (PBES2 Count). This will be used as a JOSE Header Parameter and as the PBKDF2
423
+ * iteration count.
423
424
  */
424
425
  p2c?: number
426
+
425
427
  /**
426
428
  * @deprecated You should not use this parameter. It is only intended for testing and vector
427
429
  * validation purposes.
@@ -5,7 +5,7 @@ import { generateCek } from '../../lib/content_encryption.js';
5
5
  import { encryptKeyManagement } from '../../lib/key_management.js';
6
6
  import { encode as b64u } from '../../util/base64url.js';
7
7
  import { validateCritDuplicates } from '../../lib/options.js';
8
- import { checkEncryptHeaders, encryptJWE } from '../../lib/jwe_encrypt.js';
8
+ import { checkDisjoint, checkEncryptHeaders, encryptJWE } from '../../lib/jwe_encrypt.js';
9
9
  import { prepareKey } from '../../lib/key.js';
10
10
  import { jweAlgorithm } from '../../lib/jwe_algorithms.js';
11
11
  class IndividualRecipient {
@@ -158,8 +158,12 @@ export class GeneralEncrypt {
158
158
  const k = await prepareKey(jweAlgorithm(alg), key, 'encrypt');
159
159
  const [, encryptedKey, parameters] = await encryptKeyManagement(alg, encEntry, k, cek, keyManagementParameters);
160
160
  target.encrypted_key = b64u(encryptedKey);
161
- if (unprotectedHeader || parameters)
162
- target.header = { ...unprotectedHeader, ...parameters };
161
+ if (unprotectedHeader || parameters) {
162
+ const header = { ...unprotectedHeader, ...parameters };
163
+ if (parameters)
164
+ checkDisjoint(this.#protectedHeader, header, this.#unprotectedHeader);
165
+ target.header = header;
166
+ }
163
167
  }
164
168
  return jwe;
165
169
  }
@@ -9,7 +9,7 @@ function isCloudflareWorkers() {
9
9
  let USER_AGENT;
10
10
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
11
11
  const NAME = 'jose';
12
- const VERSION = 'v6.2.8';
12
+ const VERSION = 'v6.2.9';
13
13
  USER_AGENT = `${NAME}/${VERSION}`;
14
14
  }
15
15
  export const customFetch = Symbol();
@@ -8,11 +8,14 @@ import { validateCrit, JWE_RECOGNIZED } from './options.js';
8
8
  import { prepareKey } from './key.js';
9
9
  import { jweAlgorithm, jweEncryption } from './jwe_algorithms.js';
10
10
  import { compress } from './deflate.js';
11
- export function checkEncryptHeaders(input) {
12
- const [, protectedHeader, unprotectedHeader, sharedUnprotectedHeader, , , , , crit] = input;
11
+ export function checkDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader) {
13
12
  if (!isDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader)) {
14
13
  throw new JWEInvalid('JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint');
15
14
  }
15
+ }
16
+ export function checkEncryptHeaders(input) {
17
+ const [, protectedHeader, unprotectedHeader, sharedUnprotectedHeader, , , , , crit] = input;
18
+ checkDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader);
16
19
  const joseHeader = {
17
20
  ...protectedHeader,
18
21
  ...unprotectedHeader,
@@ -52,6 +55,7 @@ export async function encryptJWE(input, checked, key) {
52
55
  else {
53
56
  protectedHeader = protectedHeader ? { ...protectedHeader, ...parameters } : parameters;
54
57
  }
58
+ checkDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader);
55
59
  }
56
60
  let protectedHeaderS;
57
61
  let protectedHeaderB;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "6.2.8",
3
+ "version": "6.2.9",
4
4
  "description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
5
5
  "keywords": [
6
6
  "akp",
@@ -35,9 +35,10 @@ export declare class CompactEncrypt {
35
35
  */
36
36
  setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
37
37
  /**
38
- * Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
39
- * use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
40
- * parameters.
38
+ * Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of
39
+ * the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo)
40
+ * and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the
41
+ * appropriate JOSE Header.
41
42
  *
42
43
  * @param parameters JWE Key Management parameters.
43
44
  */
@@ -9,9 +9,10 @@ export declare class FlattenedEncrypt {
9
9
  */
10
10
  constructor(plaintext: Uint8Array);
11
11
  /**
12
- * Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
13
- * use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
14
- * parameters.
12
+ * Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of
13
+ * the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo)
14
+ * and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the
15
+ * appropriate JOSE Header.
15
16
  *
16
17
  * @param parameters JWE Key Management parameters.
17
18
  */
@@ -8,9 +8,10 @@ export interface Recipient {
8
8
  */
9
9
  setUnprotectedHeader(unprotectedHeader: types.JWEHeaderParameters): Recipient;
10
10
  /**
11
- * Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
12
- * use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
13
- * parameters.
11
+ * Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of
12
+ * the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo)
13
+ * and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the
14
+ * appropriate JOSE Header.
14
15
  *
15
16
  * @param parameters JWE Key Management parameters.
16
17
  */
@@ -23,9 +23,10 @@ export declare class EncryptJWT implements types.ProduceJWT {
23
23
  */
24
24
  setProtectedHeader(protectedHeader: types.CompactJWEHeaderParameters): this;
25
25
  /**
26
- * Sets the JWE Key Management parameters to be used when encrypting. For ECDH based algorithms,
27
- * use this method to set the "apu" (Agreement PartyUInfo) or "apv" (Agreement PartyVInfo)
28
- * parameters.
26
+ * Sets the JWE Key Management parameters to be used when encrypting. Use this method instead of
27
+ * the header setters to configure algorithm inputs such as ECDH-ES "apu" (Agreement PartyUInfo)
28
+ * and "apv" (Agreement PartyVInfo), or PBES2 "p2c" (PBES2 Count). The parameters are added to the
29
+ * appropriate JOSE Header.
29
30
  *
30
31
  * @param parameters JWE Key Management parameters.
31
32
  */
@@ -417,11 +417,13 @@ export interface JWEKeyManagementHeaderParameters {
417
417
  * used in ECDH's ConcatKDF.
418
418
  */
419
419
  apv?: Uint8Array
420
+
420
421
  /**
421
- * @deprecated You should not use this parameter. It is only intended for testing and vector
422
- * validation purposes.
422
+ * PBES2 "p2c" (PBES2 Count). This will be used as a JOSE Header Parameter and as the PBKDF2
423
+ * iteration count.
423
424
  */
424
425
  p2c?: number
426
+
425
427
  /**
426
428
  * @deprecated You should not use this parameter. It is only intended for testing and vector
427
429
  * validation purposes.
@@ -5,7 +5,7 @@ import { generateCek } from '../../lib/content_encryption.js';
5
5
  import { encryptKeyManagement } from '../../lib/key_management.js';
6
6
  import { encode as b64u } from '../../util/base64url.js';
7
7
  import { validateCritDuplicates } from '../../lib/options.js';
8
- import { checkEncryptHeaders, encryptJWE } from '../../lib/jwe_encrypt.js';
8
+ import { checkDisjoint, checkEncryptHeaders, encryptJWE } from '../../lib/jwe_encrypt.js';
9
9
  import { prepareKey } from '../../lib/key.js';
10
10
  import { jweAlgorithm } from '../../lib/jwe_algorithms.js';
11
11
  class IndividualRecipient {
@@ -158,8 +158,12 @@ export class GeneralEncrypt {
158
158
  const k = await prepareKey(jweAlgorithm(alg), key, 'encrypt');
159
159
  const [, encryptedKey, parameters] = await encryptKeyManagement(alg, encEntry, k, cek, keyManagementParameters);
160
160
  target.encrypted_key = b64u(encryptedKey);
161
- if (unprotectedHeader || parameters)
162
- target.header = { ...unprotectedHeader, ...parameters };
161
+ if (unprotectedHeader || parameters) {
162
+ const header = { ...unprotectedHeader, ...parameters };
163
+ if (parameters)
164
+ checkDisjoint(this.#protectedHeader, header, this.#unprotectedHeader);
165
+ target.header = header;
166
+ }
163
167
  }
164
168
  return jwe;
165
169
  }
@@ -9,7 +9,7 @@ function isCloudflareWorkers() {
9
9
  let USER_AGENT;
10
10
  if (typeof navigator === 'undefined' || !navigator.userAgent?.startsWith?.('Mozilla/5.0 ')) {
11
11
  const NAME = 'jose';
12
- const VERSION = 'v6.2.8';
12
+ const VERSION = 'v6.2.9';
13
13
  USER_AGENT = `${NAME}/${VERSION}`;
14
14
  }
15
15
  export const customFetch = Symbol();
@@ -8,11 +8,14 @@ import { validateCrit, JWE_RECOGNIZED } from './options.js';
8
8
  import { prepareKey } from './key.js';
9
9
  import { jweAlgorithm, jweEncryption } from './jwe_algorithms.js';
10
10
  import { compress } from './deflate.js';
11
- export function checkEncryptHeaders(input) {
12
- const [, protectedHeader, unprotectedHeader, sharedUnprotectedHeader, , , , , crit] = input;
11
+ export function checkDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader) {
13
12
  if (!isDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader)) {
14
13
  throw new JWEInvalid('JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint');
15
14
  }
15
+ }
16
+ export function checkEncryptHeaders(input) {
17
+ const [, protectedHeader, unprotectedHeader, sharedUnprotectedHeader, , , , , crit] = input;
18
+ checkDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader);
16
19
  const joseHeader = {
17
20
  ...protectedHeader,
18
21
  ...unprotectedHeader,
@@ -52,6 +55,7 @@ export async function encryptJWE(input, checked, key) {
52
55
  else {
53
56
  protectedHeader = protectedHeader ? { ...protectedHeader, ...parameters } : parameters;
54
57
  }
58
+ checkDisjoint(protectedHeader, unprotectedHeader, sharedUnprotectedHeader);
55
59
  }
56
60
  let protectedHeaderS;
57
61
  let protectedHeaderB;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jose",
3
- "version": "6.2.8",
3
+ "version": "6.2.9",
4
4
  "description": "JWA, JWS, JWE, JWT, JWK, JWKS for Node.js, Browser, Cloudflare Workers, Deno, Bun, and other Web-interoperable runtimes",
5
5
  "keywords": [
6
6
  "akp",