@scalar/openapi-types 0.2.3 → 0.3.1
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 +12 -0
- package/dist/schemas/extensions/index.d.ts +1 -0
- package/dist/schemas/extensions/index.d.ts.map +1 -1
- package/dist/schemas/extensions/index.js +3 -0
- package/dist/schemas/extensions/index.js.map +2 -2
- package/dist/schemas/extensions/x-post-response.d.ts +26 -0
- package/dist/schemas/extensions/x-post-response.d.ts.map +1 -0
- package/dist/schemas/extensions/x-post-response.js +10 -0
- package/dist/schemas/extensions/x-post-response.js.map +7 -0
- package/dist/schemas/extensions/x-post-response.test.js +24 -0
- package/dist/schemas/extensions/x-post-response.test.js.map +7 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -10,4 +10,5 @@ export { XScalarSecurityQuery } from './x-scalar-security-query.js';
|
|
|
10
10
|
export { XScalarStabilitySchema, XScalarStabilityValues } from './x-scalar-stability.js';
|
|
11
11
|
export { XTagGroupsSchema, XTagGroupSchema } from './x-tag-groups.js';
|
|
12
12
|
export { XusePkceSchema, XUsePkceValues } from './x-use-pkce.js';
|
|
13
|
+
export { XPostResponseSchema, PostResponseSchema } from './x-post-response.js';
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAA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,15 @@ import { XScalarSecurityQuery } from "./x-scalar-security-query.js";
|
|
|
10
10
|
import { XScalarStabilitySchema, XScalarStabilityValues } from "./x-scalar-stability.js";
|
|
11
11
|
import { XTagGroupsSchema, XTagGroupSchema } from "./x-tag-groups.js";
|
|
12
12
|
import { XusePkceSchema, XUsePkceValues } from "./x-use-pkce.js";
|
|
13
|
+
import { XPostResponseSchema, PostResponseSchema } from "./x-post-response.js";
|
|
13
14
|
export {
|
|
15
|
+
PostResponseSchema,
|
|
14
16
|
XAdditionalPropertiesNameSchema,
|
|
15
17
|
XCodeSampleSchema,
|
|
16
18
|
XCodeSamplesSchema,
|
|
17
19
|
XEnumDescriptionsSchema,
|
|
18
20
|
XInternalSchema,
|
|
21
|
+
XPostResponseSchema,
|
|
19
22
|
XScalarIconSchema,
|
|
20
23
|
XScalarIgnoreSchema,
|
|
21
24
|
XScalarRedirectUriSchema,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/schemas/extensions/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { XAdditionalPropertiesNameSchema } from './x-additional-properties-name'\nexport { XCodeSamplesSchema, XCodeSampleSchema } from './x-code-samples'\nexport { XEnumDescriptionsSchema } from './x-enum-descriptions'\nexport { XInternalSchema } from './x-internal'\nexport { XScalarIconSchema } from './x-scalar-icon'\nexport { XScalarIgnoreSchema } from './x-scalar-ignore'\nexport { XScalarRedirectUriSchema } from './x-scalar-redirect-uri'\nexport { XScalarSdkInstallationSchema } from './x-scalar-sdk-installation'\nexport { XScalarSecurityQuery } from './x-scalar-security-query'\nexport { XScalarStabilitySchema, XScalarStabilityValues } from './x-scalar-stability'\nexport { XTagGroupsSchema, XTagGroupSchema } from './x-tag-groups'\nexport { XusePkceSchema, XUsePkceValues } from './x-use-pkce'\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,uCAAuC;AAChD,SAAS,oBAAoB,yBAAyB;AACtD,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,gCAAgC;AACzC,SAAS,oCAAoC;AAC7C,SAAS,4BAA4B;AACrC,SAAS,wBAAwB,8BAA8B;AAC/D,SAAS,kBAAkB,uBAAuB;AAClD,SAAS,gBAAgB,sBAAsB;",
|
|
4
|
+
"sourcesContent": ["export { XAdditionalPropertiesNameSchema } from './x-additional-properties-name'\nexport { XCodeSamplesSchema, XCodeSampleSchema } from './x-code-samples'\nexport { XEnumDescriptionsSchema } from './x-enum-descriptions'\nexport { XInternalSchema } from './x-internal'\nexport { XScalarIconSchema } from './x-scalar-icon'\nexport { XScalarIgnoreSchema } from './x-scalar-ignore'\nexport { XScalarRedirectUriSchema } from './x-scalar-redirect-uri'\nexport { XScalarSdkInstallationSchema } from './x-scalar-sdk-installation'\nexport { XScalarSecurityQuery } from './x-scalar-security-query'\nexport { XScalarStabilitySchema, XScalarStabilityValues } from './x-scalar-stability'\nexport { XTagGroupsSchema, XTagGroupSchema } from './x-tag-groups'\nexport { XusePkceSchema, XUsePkceValues } from './x-use-pkce'\nexport { XPostResponseSchema, PostResponseSchema } from './x-post-response'\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,uCAAuC;AAChD,SAAS,oBAAoB,yBAAyB;AACtD,SAAS,+BAA+B;AACxC,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AACpC,SAAS,gCAAgC;AACzC,SAAS,oCAAoC;AAC7C,SAAS,4BAA4B;AACrC,SAAS,wBAAwB,8BAA8B;AAC/D,SAAS,kBAAkB,uBAAuB;AAClD,SAAS,gBAAgB,sBAAsB;AAC/C,SAAS,qBAAqB,0BAA0B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** The code to execute */
|
|
3
|
+
export declare const PostResponseSchema: z.ZodString;
|
|
4
|
+
/**
|
|
5
|
+
* Post response scripts allow to execute arbitrary code after a response is received
|
|
6
|
+
*
|
|
7
|
+
* This is useful for:
|
|
8
|
+
* - Extracting data from the response, or
|
|
9
|
+
* - Testing the response
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```yaml
|
|
13
|
+
* x-post-response: |
|
|
14
|
+
* pm.test("Status code is 200", () => {
|
|
15
|
+
* pm.response.to.have.status(200)
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const XPostResponseSchema: z.ZodObject<{
|
|
20
|
+
'x-post-response': z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
'x-post-response'?: string | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
'x-post-response'?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=x-post-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x-post-response.d.ts","sourceRoot":"","sources":["../../../src/schemas/extensions/x-post-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,0BAA0B;AAC1B,eAAO,MAAM,kBAAkB,aAAa,CAAA;AAE5C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB;;;;;;EAE9B,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const PostResponseSchema = z.string();
|
|
3
|
+
const XPostResponseSchema = z.object({
|
|
4
|
+
"x-post-response": PostResponseSchema.optional()
|
|
5
|
+
});
|
|
6
|
+
export {
|
|
7
|
+
PostResponseSchema,
|
|
8
|
+
XPostResponseSchema
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=x-post-response.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/schemas/extensions/x-post-response.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\n\n/** The code to execute */\nexport const PostResponseSchema = z.string()\n\n/**\n * Post response scripts allow to execute arbitrary code after a response is received\n *\n * This is useful for:\n * - Extracting data from the response, or\n * - Testing the response\n *\n * @example\n * ```yaml\n * x-post-response: |\n * pm.test(\"Status code is 200\", () => {\n * pm.response.to.have.status(200)\n * })\n * ```\n */\nexport const XPostResponseSchema = z.object({\n 'x-post-response': PostResponseSchema.optional(),\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAAS;AAGX,MAAM,qBAAqB,EAAE,OAAO;AAiBpC,MAAM,sBAAsB,EAAE,OAAO;AAAA,EAC1C,mBAAmB,mBAAmB,SAAS;AACjD,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { XPostResponseSchema } from "./x-post-response.js";
|
|
3
|
+
describe("x-post-response", () => {
|
|
4
|
+
it("validates a valid post response script", () => {
|
|
5
|
+
const result = XPostResponseSchema.parse({
|
|
6
|
+
"x-post-response": 'pm.test("Status code is 200", () => { pm.response.to.have.status(200) })'
|
|
7
|
+
});
|
|
8
|
+
expect(result).toEqual({
|
|
9
|
+
"x-post-response": 'pm.test("Status code is 200", () => { pm.response.to.have.status(200) })'
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
it("allows empty object", () => {
|
|
13
|
+
const result = XPostResponseSchema.parse({});
|
|
14
|
+
expect(result).toEqual({ "x-post-response": void 0 });
|
|
15
|
+
});
|
|
16
|
+
it("rejects non-string values", () => {
|
|
17
|
+
expect(
|
|
18
|
+
() => XPostResponseSchema.parse({
|
|
19
|
+
"x-post-response": 123
|
|
20
|
+
})
|
|
21
|
+
).toThrow();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=x-post-response.test.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/schemas/extensions/x-post-response.test.ts"],
|
|
4
|
+
"sourcesContent": ["import { describe, expect, it } from 'vitest'\nimport { XPostResponseSchema } from './x-post-response'\n\ndescribe('x-post-response', () => {\n it('validates a valid post response script', () => {\n const result = XPostResponseSchema.parse({\n 'x-post-response': 'pm.test(\"Status code is 200\", () => { pm.response.to.have.status(200) })',\n })\n\n expect(result).toEqual({\n 'x-post-response': 'pm.test(\"Status code is 200\", () => { pm.response.to.have.status(200) })',\n })\n })\n\n it('allows empty object', () => {\n const result = XPostResponseSchema.parse({})\n expect(result).toEqual({ 'x-post-response': undefined })\n })\n\n it('rejects non-string values', () => {\n expect(() =>\n XPostResponseSchema.parse({\n 'x-post-response': 123,\n }),\n ).toThrow()\n })\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,UAAU,QAAQ,UAAU;AACrC,SAAS,2BAA2B;AAEpC,SAAS,mBAAmB,MAAM;AAChC,KAAG,0CAA0C,MAAM;AACjD,UAAM,SAAS,oBAAoB,MAAM;AAAA,MACvC,mBAAmB;AAAA,IACrB,CAAC;AAED,WAAO,MAAM,EAAE,QAAQ;AAAA,MACrB,mBAAmB;AAAA,IACrB,CAAC;AAAA,EACH,CAAC;AAED,KAAG,uBAAuB,MAAM;AAC9B,UAAM,SAAS,oBAAoB,MAAM,CAAC,CAAC;AAC3C,WAAO,MAAM,EAAE,QAAQ,EAAE,mBAAmB,OAAU,CAAC;AAAA,EACzD,CAAC;AAED,KAAG,6BAA6B,MAAM;AACpC;AAAA,MAAO,MACL,oBAAoB,MAAM;AAAA,QACxB,mBAAmB;AAAA,MACrB,CAAC;AAAA,IACH,EAAE,QAAQ;AAAA,EACZ,CAAC;AACH,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"swagger",
|
|
17
17
|
"typescript"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.
|
|
19
|
+
"version": "0.3.1",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=20"
|
|
22
22
|
},
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"zod": "3.24.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@scalar/build-tooling": "0.
|
|
56
|
+
"@scalar/build-tooling": "0.2.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "scalar-build-esbuild",
|