@zuplo/cli 7.9.18 → 7.9.19

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 (41) hide show
  1. package/node_modules/@posthog/core/dist/error-tracking/chunk-ids.d.ts.map +1 -1
  2. package/node_modules/@posthog/core/dist/error-tracking/chunk-ids.js +36 -22
  3. package/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs +36 -22
  4. package/node_modules/@posthog/core/dist/error-tracking/release.d.ts +3 -5
  5. package/node_modules/@posthog/core/dist/error-tracking/release.d.ts.map +1 -1
  6. package/node_modules/@posthog/core/dist/error-tracking/release.js +4 -0
  7. package/node_modules/@posthog/core/dist/error-tracking/release.mjs +4 -0
  8. package/node_modules/@posthog/core/package.json +1 -1
  9. package/node_modules/@posthog/core/src/error-tracking/chunk-ids.spec.ts +77 -0
  10. package/node_modules/@posthog/core/src/error-tracking/chunk-ids.ts +50 -25
  11. package/node_modules/@posthog/core/src/error-tracking/release.spec.ts +34 -0
  12. package/node_modules/@posthog/core/src/error-tracking/release.ts +10 -5
  13. package/node_modules/@zuplo/core/package.json +1 -1
  14. package/node_modules/@zuplo/graphql/package.json +1 -1
  15. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  16. package/node_modules/@zuplo/otel/package.json +1 -1
  17. package/node_modules/@zuplo/runtime/out/esm/{chunk-GYEX3OZM.js → chunk-6YPRGG62.js} +31 -31
  18. package/node_modules/@zuplo/runtime/out/esm/{chunk-GYEX3OZM.js.map → chunk-6YPRGG62.js.map} +1 -1
  19. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  20. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  21. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  22. package/node_modules/@zuplo/runtime/package.json +1 -1
  23. package/node_modules/content-disposition/README.md +105 -35
  24. package/node_modules/content-disposition/dist/index.d.ts +72 -0
  25. package/node_modules/content-disposition/dist/index.js +388 -0
  26. package/node_modules/content-disposition/dist/index.js.map +1 -0
  27. package/node_modules/content-disposition/package.json +31 -19
  28. package/node_modules/express/Readme.md +15 -9
  29. package/node_modules/express/lib/application.js +2 -2
  30. package/node_modules/express/lib/request.js +32 -19
  31. package/node_modules/express/lib/response.js +27 -30
  32. package/node_modules/express/node_modules/content-type/LICENSE +22 -0
  33. package/node_modules/express/node_modules/content-type/README.md +71 -0
  34. package/node_modules/express/node_modules/content-type/dist/index.d.ts +46 -0
  35. package/node_modules/express/node_modules/content-type/dist/index.js +176 -0
  36. package/node_modules/express/node_modules/content-type/dist/index.js.map +1 -0
  37. package/node_modules/express/node_modules/content-type/package.json +52 -0
  38. package/node_modules/express/package.json +10 -10
  39. package/package.json +11 -11
  40. package/node_modules/content-disposition/index.js +0 -536
  41. /package/node_modules/@zuplo/runtime/out/esm/{chunk-GYEX3OZM.js.LEGAL.txt → chunk-6YPRGG62.js.LEGAL.txt} +0 -0
@@ -22,5 +22,5 @@
22
22
  * DEALINGS IN THE SOFTWARE.
23
23
  *--------------------------------------------------------------------------------------------*/
24
24
 
25
- import{E as p,J as c,M as u}from"../chunk-GYEX3OZM.js";import"../chunk-VTO3F6DK.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-YJ2BHVUH.js";import{aa as i}from"../chunk-PBDT4FDO.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
25
+ import{E as p,J as c,M as u}from"../chunk-6YPRGG62.js";import"../chunk-VTO3F6DK.js";import{a as d}from"../chunk-QGAJTUPE.js";import"../chunk-A3QGJZO7.js";import"../chunk-YJ2BHVUH.js";import{aa as i}from"../chunk-PBDT4FDO.js";import{a as o}from"../chunk-TYV53J3B.js";function w(l={request:new Request("https://api.example.com")}){let e=[];function t(s){e.push(Promise.resolve(s))}return o(t,"waitUntil"),{context:new a({event:{waitUntil:t},route:l.route,originalRequest:l.request}),invokeResponse:o(async()=>{await Promise.all(e)},"invokeResponse")}}o(w,"createMockContext");var g={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:o(()=>({}),"raw")},a=class extends EventTarget{static{o(this,"MockZuploContext")}#e;#t;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:t=g,parentContext:n,originalRequest:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:i.console.info,log:i.console.log,debug:i.console.debug,warn:i.console.warn,error:i.console.error,setLogProperties:o(()=>{},"setLogProperties")},this.custom={},this.route=t,this.incomingRequestProperties={ip:"203.0.113.7",asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0,clientCertFingerprintSha256:void 0,clientCertNotBefore:void 0,clientCertNotAfter:void 0,clientCertIssuerDn:void 0,clientCertSubjectDn:void 0},this.parentContext=n,this.#e=e,this.#t=r,this.analyticsContext=new c(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,t){throw new Error("Not implemented")}invokeOutboundPolicy(e,t,n){throw new Error("Not implemented")}invokeRoute(e,t){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addPreRequestHandler(e,t){let n;try{n=u.getContextExtensions(this)}catch{n=u.initialize(this,new d(this.#t??new Request("https://api.example.com")))}n.preRequestPhase??="active",p(this,n,e,t)}get preRequestHandlers(){let e;try{e=u.getContextExtensions(this)}catch{return[]}return(e.preRequestState?.entries??[]).map(t=>({policyName:t.policyName,name:t.name}))}addEventListener(e,t,n){let r=o(s=>{try{typeof t=="function"?t(s):t.handleEvent(s)}catch(m){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),m}},"wrapped");super.addEventListener(e,r,n)}};export{a as MockZuploContext,w as createMockContext};
26
26
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/runtime",
3
3
  "type": "module",
4
- "version": "7.9.18",
4
+ "version": "7.9.19",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -17,17 +17,17 @@ $ npm install content-disposition
17
17
  ## API
18
18
 
19
19
  ```js
20
- const contentDisposition = require('content-disposition')
20
+ import { create, parse, format } from 'content-disposition';
21
21
  ```
22
22
 
23
- ### contentDisposition(filename, options)
23
+ ### create(filename, options)
24
24
 
25
25
  Create an attachment `Content-Disposition` header value using the given file name,
26
26
  if supplied. The `filename` is optional and if no file name is desired, but you
27
27
  want to specify `options`, set `filename` to `undefined`.
28
28
 
29
29
  ```js
30
- res.setHeader('Content-Disposition', contentDisposition('∫ maths.pdf'))
30
+ res.setHeader('Content-Disposition', create('∫ maths.pdf'));
31
31
  ```
32
32
 
33
33
  **note** HTTP headers are of the ISO-8859-1 character set. If you are writing this
@@ -40,73 +40,139 @@ the `'binary'` encoding in Node.js.
40
40
 
41
41
  ##### fallback
42
42
 
43
- If the `filename` option is outside ISO-8859-1, then the file name is actually
43
+ If the `filename` option is outside US-ASCII, then the file name is actually
44
44
  stored in a supplemental field for clients that support Unicode file names and
45
- a ISO-8859-1 version of the file name is automatically generated.
45
+ a US-ASCII version of the file name is automatically generated.
46
46
 
47
- This specifies the ISO-8859-1 file name to override the automatic generation or
47
+ This specifies the US-ASCII file name to override the automatic generation or
48
48
  disables the generation all together, defaults to `true`.
49
49
 
50
- - A string will specify the ISO-8859-1 file name to use in place of automatic
51
- generation.
52
- - `false` will disable including a ISO-8859-1 file name and only include the
53
- Unicode version (unless the file name is already ISO-8859-1).
54
- - `true` will enable automatic generation if the file name is outside ISO-8859-1.
50
+ - A string will specify the US-ASCII file name to use in place of automatic
51
+ generation.
52
+ - `false` will disable including a US-ASCII file name and only include the
53
+ Unicode version (unless the file name is already US-ASCII).
54
+ - `true` will enable automatic generation if the file name is outside US-ASCII.
55
55
 
56
- If the `filename` option is ISO-8859-1 and this option is specified and has a
56
+ If the `filename` option is US-ASCII and this option is specified and has a
57
57
  different value, then the `filename` option is encoded in the extended field
58
- and this set as the fallback field, even though they are both ISO-8859-1.
58
+ and this set as the fallback field, even though they are both US-ASCII.
59
59
 
60
60
  ##### type
61
61
 
62
62
  Specifies the disposition type, defaults to `"attachment"`. This can also be
63
63
  `"inline"`, or any other value (all values except inline are treated like
64
64
  `attachment`, but can convey additional information if both parties agree to
65
- it). The type is normalized to lower-case.
65
+ it).
66
66
 
67
- ### contentDisposition.parse(string)
67
+ ### parse(string, options)
68
68
 
69
69
  ```js
70
- const disposition = contentDisposition.parse('attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt')
70
+ const disposition = parse(
71
+ 'attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt',
72
+ );
71
73
  ```
72
74
 
73
75
  Parse a `Content-Disposition` header string. This automatically handles extended
74
76
  ("Unicode") parameters by decoding them and providing them under the standard
75
- parameter name. This will return an object with the following properties (examples
76
- are shown for the string `'attachment; filename="EURO rates.txt"; filename*=UTF-8\'\'%e2%82%ac%20rates.txt'`):
77
+ parameter name. This will return an object with the following properties:
77
78
 
78
- - `type`: The disposition type (always lower case). Example: `'attachment'`
79
+ - `type`: The disposition type (always lower case). Example: `'attachment'`
79
80
 
80
- - `parameters`: An object of the parameters in the disposition (name of parameter
81
- always lower case and extended versions replace non-extended versions). Example:
82
- `{filename: "€ rates.txt"}`
81
+ - `parameters`: An object of the parameters in the disposition (name of parameter
82
+ always lower case and extended versions replace non-extended versions). Example:
83
+ `{filename: "€ rates.txt"}`
84
+
85
+ #### Options
86
+
87
+ ##### multipart
88
+
89
+ Parse parameters using browser `multipart/form-data` behavior.
90
+
91
+ ```js
92
+ parse('form-data; name="file"; filename="the %22plans%22.pdf"', {
93
+ multipart: true,
94
+ });
95
+ ```
96
+
97
+ ##### extended
98
+
99
+ Parse RFC 5987 extended header parameters automatically when decoding
100
+ parameters, defaults to `true`.
101
+
102
+ ### format(obj, options)
103
+
104
+ ```js
105
+ const disposition = format({
106
+ type: 'attachment',
107
+ parameters: {
108
+ filename: '€ rates.txt',
109
+ },
110
+ });
111
+ ```
112
+
113
+ Formats an object to a `Content-Disposition` header string. This automatically
114
+ handles extended ("Unicode") parameters and returns a string. Example:
115
+ `'attachment; filename*=UTF-8''%E2%82%AC%20rates.txt'`
116
+
117
+ #### Options
118
+
119
+ ##### multipart
120
+
121
+ Format parameters using browser `multipart/form-data` behavior. This quotes
122
+ parameter values, escapes `"` as `%22`, and writes Unicode values directly
123
+ instead of using extended parameters.
124
+
125
+ ```js
126
+ format(
127
+ {
128
+ type: 'form-data',
129
+ parameters: { name: 'file', filename: '€ rates.txt' },
130
+ },
131
+ { multipart: true },
132
+ );
133
+ ```
134
+
135
+ ##### extended
136
+
137
+ Encode Unicode parameter values using RFC 5987 extended header parameters,
138
+ e.g. `filename*=`, defaults to `true`.
83
139
 
84
140
  ## Examples
85
141
 
86
142
  ### Send a file for download
87
143
 
88
144
  ```js
89
- const contentDisposition = require('content-disposition')
90
- const fs = require('fs')
91
- const http = require('http')
92
- const onFinished = require('on-finished')
145
+ const contentDisposition = require('content-disposition');
146
+ const fs = require('fs');
147
+ const http = require('http');
148
+ const onFinished = require('on-finished');
93
149
 
94
- const filePath = '/path/to/public/plans.pdf'
150
+ const filePath = '/path/to/public/plans.pdf';
95
151
 
96
- http.createServer(function onRequest (req, res) {
152
+ http.createServer(function onRequest(req, res) {
97
153
  // set headers
98
- res.setHeader('Content-Type', 'application/pdf')
99
- res.setHeader('Content-Disposition', contentDisposition(filePath))
154
+ res.setHeader('Content-Type', 'application/pdf');
155
+ res.setHeader('Content-Disposition', contentDisposition(filePath));
100
156
 
101
157
  // send file
102
- const stream = fs.createReadStream(filePath)
103
- stream.pipe(res)
158
+ const stream = fs.createReadStream(filePath);
159
+ stream.pipe(res);
104
160
  onFinished(res, function () {
105
- stream.destroy()
106
- })
107
- })
161
+ stream.destroy();
162
+ });
163
+ });
108
164
  ```
109
165
 
166
+ ## Local demo
167
+
168
+ Run the upload inspector locally:
169
+
170
+ ```sh
171
+ npm run demo
172
+ ```
173
+
174
+ Then open `http://127.0.0.1:3000` in your browser. The demo lets you upload files, inspect the multipart upload part headers sent by the browser, and compare them with the download `Content-Disposition` header generated by this package.
175
+
110
176
  ## Testing
111
177
 
112
178
  ```sh
@@ -118,11 +184,15 @@ $ npm test
118
184
  - [RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1][rfc-2616]
119
185
  - [RFC 5987: Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters][rfc-5987]
120
186
  - [RFC 6266: Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)][rfc-6266]
187
+ - [RFC 8187: Indicating Character Encoding and Language for HTTP Header Field Parameters][rfc-8187]
188
+ - [HTML Living Standard: Multipart form data][html-form]
121
189
  - [Test Cases for HTTP Content-Disposition header field (RFC 6266) and the Encodings defined in RFCs 2047, 2231 and 5987][tc-2231]
122
190
 
123
191
  [rfc-2616]: https://datatracker.ietf.org/doc/html/rfc2616
124
192
  [rfc-5987]: https://datatracker.ietf.org/doc/html/rfc5987
125
193
  [rfc-6266]: https://datatracker.ietf.org/doc/html/rfc6266
194
+ [rfc-8187]: https://datatracker.ietf.org/doc/html/rfc8187
195
+ [html-form]: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#multipart-form-data
126
196
  [tc-2231]: http://greenbytes.de/tech/tc2231/
127
197
 
128
198
  ## License
@@ -0,0 +1,72 @@
1
+ /*!
2
+ * content-disposition
3
+ * Copyright(c) 2014-2017 Douglas Christopher Wilson
4
+ * MIT Licensed
5
+ */
6
+ export interface ContentDisposition {
7
+ /**
8
+ * Content-Disposition type, such as "attachment" or "inline"
9
+ */
10
+ type: string;
11
+ /**
12
+ * Content-Disposition parameters, such as "filename"
13
+ */
14
+ parameters: Record<string, string>;
15
+ }
16
+ export interface CreateOptions {
17
+ /**
18
+ * Content-Disposition type, defaults to "attachment"
19
+ * @default "attachment"
20
+ */
21
+ type?: string;
22
+ /**
23
+ * Fallback filename for non-US-ASCII strings. If true, a fallback will be generated by replacing non-US-ASCII characters with "?". If false, no fallback will be generated.
24
+ * @default true
25
+ */
26
+ fallback?: string | boolean;
27
+ }
28
+ /**
29
+ * Create an attachment Content-Disposition header.
30
+ */
31
+ export declare function create(filename?: string, options?: CreateOptions): string;
32
+ export interface ParseOptions {
33
+ /**
34
+ * Whether to decode RFC 8187 encoded parameters.
35
+ * @default true
36
+ */
37
+ extended?: boolean;
38
+ /**
39
+ * Parse parameters as sent by browsers in `multipart/form-data`.
40
+ * @default false
41
+ */
42
+ multipart?: boolean;
43
+ }
44
+ /**
45
+ * Parse Content-Disposition header string.
46
+ */
47
+ export declare function parse(header: string, options?: ParseOptions): ContentDisposition;
48
+ /**
49
+ * Decode a RFC 8187 field value (gracefully).
50
+ */
51
+ export declare function decodeExtended(str: string): string | undefined;
52
+ export interface FormatOptions {
53
+ /**
54
+ * Whether to use extended parameter encoding for non-ISO-8859-1 strings.
55
+ * If false, an error will be thrown when formatting such strings.
56
+ * @default true
57
+ */
58
+ extended?: boolean;
59
+ /**
60
+ * Format parameters as sent by browsers in `multipart/form-data`.
61
+ * @default false
62
+ */
63
+ multipart?: boolean;
64
+ }
65
+ /**
66
+ * Format object to Content-Disposition header.
67
+ */
68
+ export declare function format(obj: Partial<ContentDisposition>, options?: FormatOptions): string;
69
+ /**
70
+ * Encode a Unicode string for HTTP (RFC 8187).
71
+ */
72
+ export declare function encodeExtended(str: string): string;