@scalar/pre-post-request-scripts 0.3.12 → 0.3.13

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 (68) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
  3. package/dist/components/ViewLayout/ValueEmitter.vue.js +7 -0
  4. package/dist/components/ViewLayout/ValueEmitter.vue.js.map +1 -0
  5. package/dist/components/ViewLayout/ValueEmitter.vue.script.js +18 -0
  6. package/dist/components/ViewLayout/ValueEmitter.vue.script.js.map +1 -0
  7. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +7 -0
  8. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js.map +1 -0
  9. package/dist/{ViewLayoutCollapse-BMrPz_sj.js → components/ViewLayout/ViewLayoutCollapse.vue.script.js} +5 -22
  10. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.script.js.map +1 -0
  11. package/dist/components/ViewLayout/index.d.ts +1 -1
  12. package/dist/consts/example-scripts.js +82 -0
  13. package/dist/consts/example-scripts.js.map +1 -0
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.js +2 -3
  16. package/dist/libs/execute-scripts/context/console.js +14 -0
  17. package/dist/libs/execute-scripts/context/console.js.map +1 -0
  18. package/dist/libs/execute-scripts/execute-post-response-script.js +16 -0
  19. package/dist/libs/execute-scripts/execute-post-response-script.js.map +1 -0
  20. package/dist/libs/execute-scripts/index.d.ts +1 -1
  21. package/dist/libs/execute-scripts/index.js +1 -1
  22. package/dist/libs/execute-scripts/postman-sandbox-adapter.d.ts +2 -2
  23. package/dist/{execute-scripts-BV13zq7B.js → libs/execute-scripts/postman-sandbox-adapter.js} +2 -24
  24. package/dist/libs/execute-scripts/postman-sandbox-adapter.js.map +1 -0
  25. package/dist/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue.js +7 -0
  26. package/dist/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue.js.map +1 -0
  27. package/dist/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue.script.js +35 -0
  28. package/dist/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue.script.js.map +1 -0
  29. package/dist/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue.js +7 -0
  30. package/dist/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue.js.map +1 -0
  31. package/dist/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue.script.js +49 -0
  32. package/dist/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue.script.js.map +1 -0
  33. package/dist/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue.js +9 -0
  34. package/dist/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue.js.map +1 -0
  35. package/dist/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue.script.js +36 -0
  36. package/dist/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue.script.js.map +1 -0
  37. package/dist/plugins/post-response-scripts/components/PostResponseScripts/index.d.ts +1 -1
  38. package/dist/plugins/post-response-scripts/components/PostResponseScripts/index.js +1 -1
  39. package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.js +7 -0
  40. package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.js.map +1 -0
  41. package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.script.js +70 -0
  42. package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.script.js.map +1 -0
  43. package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.js +7 -0
  44. package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.js.map +1 -0
  45. package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.script.js +45 -0
  46. package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.script.js.map +1 -0
  47. package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.js +7 -0
  48. package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.js.map +1 -0
  49. package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.script.js +73 -0
  50. package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.script.js.map +1 -0
  51. package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.js +7 -0
  52. package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.js.map +1 -0
  53. package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.script.js +45 -0
  54. package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.script.js.map +1 -0
  55. package/dist/plugins/post-response-scripts/components/TestResults/index.d.ts +1 -1
  56. package/dist/plugins/post-response-scripts/components/TestResults/index.js +1 -1
  57. package/dist/plugins/post-response-scripts/index.d.ts +1 -1
  58. package/dist/plugins/post-response-scripts/index.js +1 -2
  59. package/dist/{post-response-scripts-ikk1wrl9.js → plugins/post-response-scripts/post-response-scripts-plugin.js} +5 -5
  60. package/dist/plugins/post-response-scripts/post-response-scripts-plugin.js.map +1 -0
  61. package/package.json +5 -5
  62. package/dist/PostResponseScripts-CrM65oAM.js +0 -202
  63. package/dist/PostResponseScripts-CrM65oAM.js.map +0 -1
  64. package/dist/TestResults-DIM8u91u.js +0 -224
  65. package/dist/TestResults-DIM8u91u.js.map +0 -1
  66. package/dist/ViewLayoutCollapse-BMrPz_sj.js.map +0 -1
  67. package/dist/execute-scripts-BV13zq7B.js.map +0 -1
  68. package/dist/post-response-scripts-ikk1wrl9.js.map +0 -1
@@ -0,0 +1,70 @@
1
+ import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, guardReactiveProps, mergeProps, normalizeClass, normalizeProps, openBlock, toDisplayString, unref } from "vue";
2
+ import { ScalarIcon, cva, useBindCx } from "@scalar/components";
3
+ //#region src/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue?vue&type=script&setup=true&lang.ts
4
+ var _hoisted_1 = {
5
+ key: 1,
6
+ class: "ml-1.25 capitalize"
7
+ };
8
+ var TestResultIndicator_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
9
+ __name: "TestResultIndicator",
10
+ props: {
11
+ state: {},
12
+ failedTestsCount: {},
13
+ pendingTestsCount: {},
14
+ totalTestsCount: {},
15
+ inline: { type: Boolean }
16
+ },
17
+ setup(__props) {
18
+ const { cx } = useBindCx();
19
+ const icon = computed(() => {
20
+ if (__props.state === "passed") return {
21
+ name: "Checkmark",
22
+ color: "text-green p-0.25"
23
+ };
24
+ if (__props.state === "failed") return {
25
+ name: "Close",
26
+ color: "text-red"
27
+ };
28
+ return {
29
+ name: "Ellipses",
30
+ color: "text-c-1"
31
+ };
32
+ });
33
+ const statusVariants = cva({
34
+ base: "flex items-center gap-1.5 rounded-full border pr-2 pl-1.25",
35
+ variants: { status: {
36
+ passed: "text-green",
37
+ failed: "text-red",
38
+ pending: "text-orange"
39
+ } }
40
+ });
41
+ const textVariants = cva({
42
+ base: "text-c-2",
43
+ variants: { inline: {
44
+ true: "text-xs",
45
+ false: "text-sm"
46
+ } }
47
+ });
48
+ const getTestCountDisplay = computed(() => {
49
+ if (__props.totalTestsCount === void 0) return "";
50
+ if (__props.failedTestsCount) return `${__props.failedTestsCount}/${__props.totalTestsCount}`;
51
+ return `${__props.totalTestsCount - (__props.pendingTestsCount || 0) - (__props.failedTestsCount || 0)}/${__props.totalTestsCount}`;
52
+ });
53
+ return (_ctx, _cache) => {
54
+ return openBlock(), createElementBlock("div", normalizeProps(guardReactiveProps(unref(cx)(unref(statusVariants)({ status: __props.state })))), [
55
+ __props.state ? (openBlock(), createBlock(unref(ScalarIcon), {
56
+ key: 0,
57
+ class: normalizeClass(icon.value.color),
58
+ icon: icon.value.name,
59
+ size: "sm"
60
+ }, null, 8, ["class", "icon"])) : createCommentVNode("", true),
61
+ !__props.inline ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(__props.state), 1)) : createCommentVNode("", true),
62
+ __props.totalTestsCount !== void 0 ? (openBlock(), createElementBlock("span", normalizeProps(mergeProps({ key: 2 }, unref(cx)(unref(textVariants)({ inline: __props.inline })))), toDisplayString(getTestCountDisplay.value), 17)) : createCommentVNode("", true)
63
+ ], 16);
64
+ };
65
+ }
66
+ });
67
+ //#endregion
68
+ export { TestResultIndicator_vue_vue_type_script_setup_true_lang_default as default };
69
+
70
+ //# sourceMappingURL=TestResultIndicator.vue.script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestResultIndicator.vue.script.js","names":[],"sources":["../../../../../src/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva, ScalarIcon, useBindCx, type Icon } from '@scalar/components'\nimport { computed } from 'vue'\n\nimport type { TestResult } from '@/libs/execute-scripts'\n\nconst { state, totalTestsCount, pendingTestsCount, failedTestsCount } =\n defineProps<{\n state?: TestResult['status']\n failedTestsCount: number | undefined\n pendingTestsCount: number | undefined\n totalTestsCount: number | undefined\n inline?: boolean\n }>()\n\nconst { cx } = useBindCx()\n\nconst icon = computed(() => {\n if (state === 'passed') {\n return { name: 'Checkmark', color: 'text-green p-0.25' }\n }\n\n if (state === 'failed') {\n return { name: 'Close', color: 'text-red' }\n }\n\n return { name: 'Ellipses', color: 'text-c-1' }\n})\n\nconst statusVariants = cva({\n base: 'flex items-center gap-1.5 rounded-full border pr-2 pl-1.25',\n variants: {\n status: {\n passed: 'text-green',\n failed: 'text-red',\n pending: 'text-orange',\n },\n },\n})\n\nconst textVariants = cva({\n base: 'text-c-2',\n variants: {\n inline: {\n true: 'text-xs',\n false: 'text-sm',\n },\n },\n})\n\n// Display the number of tests that passed e.g 1/3\nconst getTestCountDisplay = computed(() => {\n // When there are no tests, show nothing\n if (totalTestsCount === undefined) {\n return ''\n }\n\n // When they failed, show failed/total\n if (failedTestsCount) {\n return `${failedTestsCount}/${totalTestsCount}`\n }\n\n // When they passed, show passed/total\n const completedTests =\n totalTestsCount - (pendingTestsCount || 0) - (failedTestsCount || 0)\n return `${completedTests}/${totalTestsCount}`\n})\n</script>\n\n<template>\n <div v-bind=\"cx(statusVariants({ status: state }))\">\n <ScalarIcon\n v-if=\"state\"\n :class=\"icon.color\"\n :icon=\"icon.name as Icon\"\n size=\"sm\" />\n <span\n v-if=\"!inline\"\n class=\"ml-1.25 capitalize\">\n {{ state }}\n </span>\n <span\n v-if=\"totalTestsCount !== undefined\"\n v-bind=\"cx(textVariants({ inline }))\">\n {{ getTestCountDisplay }}\n </span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;EAeA,MAAM,EAAE,OAAO,WAAU;EAEzB,MAAM,OAAO,eAAe;AAC1B,OAAI,QAAA,UAAU,SACZ,QAAO;IAAE,MAAM;IAAa,OAAO;IAAoB;AAGzD,OAAI,QAAA,UAAU,SACZ,QAAO;IAAE,MAAM;IAAS,OAAO;IAAW;AAG5C,UAAO;IAAE,MAAM;IAAY,OAAO;IAAW;IAC9C;EAED,MAAM,iBAAiB,IAAI;GACzB,MAAM;GACN,UAAU,EACR,QAAQ;IACN,QAAQ;IACR,QAAQ;IACR,SAAS;IACV,EACF;GACF,CAAA;EAED,MAAM,eAAe,IAAI;GACvB,MAAM;GACN,UAAU,EACR,QAAQ;IACN,MAAM;IACN,OAAO;IACR,EACF;GACF,CAAA;EAGD,MAAM,sBAAsB,eAAe;AAEzC,OAAI,QAAA,oBAAoB,KAAA,EACtB,QAAO;AAIT,OAAI,QAAA,iBACF,QAAO,GAAG,QAAA,iBAAiB,GAAG,QAAA;AAMhC,UAAO,GADL,QAAA,mBAAmB,QAAA,qBAAqB,MAAM,QAAA,oBAAoB,GAC3C,GAAG,QAAA;IAC7B;;uBAIC,mBAgBM,OAAA,eAAA,mBAhBO,MAAA,GAAE,CAAC,MAAA,eAAc,CAAA,EAAA,QAAW,QAAA,OAAK,CAAA,CAAA,CAAA,CAAA,EAAA;IAEpC,QAAA,SAAA,WAAA,EADR,YAIc,MAAA,WAAA,EAAA;;KAFX,OAAK,eAAE,KAAA,MAAK,MAAK;KACjB,MAAM,KAAA,MAAK;KACZ,MAAK;;KAEE,QAAA,UAAA,WAAA,EADT,mBAIO,QAJP,YAIO,gBADF,QAAA,MAAK,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;IAGF,QAAA,oBAAoB,KAAA,KAAA,WAAA,EAD5B,mBAIO,QAAA,eAAA,WAAA,EAAA,KAAA,GAAA,EAFG,MAAA,GAAE,CAAC,MAAA,aAAY,CAAA,EAAA,QAAG,QAAA,QAAM,CAAA,CAAA,CAAA,CAAA,EAAA,gBAC7B,oBAAA,MAAmB,EAAA,GAAA,IAAA,mBAAA,IAAA,KAAA"}
@@ -0,0 +1,7 @@
1
+ import TestResultItem_vue_vue_type_script_setup_true_lang_default from "./TestResultItem.vue.script.js";
2
+ //#region src/plugins/post-response-scripts/components/TestResults/TestResultItem.vue
3
+ var TestResultItem_default = TestResultItem_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { TestResultItem_default as default };
6
+
7
+ //# sourceMappingURL=TestResultItem.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestResultItem.vue.js","names":[],"sources":["../../../../../src/plugins/post-response-scripts/components/TestResults/TestResultItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon, type Icon } from '@scalar/components'\nimport { computed } from 'vue'\n\nimport type { TestResult } from '@/libs/execute-scripts'\n\nconst { currentState, result } = defineProps<{\n result: TestResult\n currentState: TestResult['status']\n}>()\n\nconst resultStatus = computed(() => {\n if (result.passed) {\n return { icon: 'Checkmark', color: 'text-green p-0.25' }\n }\n\n if (!result.passed && currentState !== 'pending') {\n return { icon: 'Close', color: 'text-red' }\n }\n\n return { icon: 'Ellipses', color: 'text-c-1' }\n})\n</script>\n\n<template>\n <div class=\"flex flex-col\">\n <div\n class=\"flex h-8 items-center gap-2 pr-3 pl-2.25\"\n :class=\"result.error && 'bg-b-danger'\">\n <!-- Title -->\n <div class=\"flex items-center gap-3 p-2\">\n <ScalarIcon\n :class=\"resultStatus.color\"\n :icon=\"resultStatus.icon as Icon\"\n size=\"sm\" />\n\n <span class=\"text-c-2 overflow-hidden text-ellipsis whitespace-nowrap\">\n {{ result.title }}\n </span>\n </div>\n <!-- Duration -->\n <span class=\"text-c-3 ml-auto whitespace-nowrap\">\n {{ result.duration }} ms\n </span>\n </div>\n <!-- Error -->\n <div\n v-if=\"result.error\"\n class=\"bg-b-danger text-c-1 flex items-center pr-3 pb-1.5 pl-9\">\n {{ result.error }}\n </div>\n </div>\n</template>\n"],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref } from "vue";
2
+ import { ScalarIcon } from "@scalar/components";
3
+ //#region src/plugins/post-response-scripts/components/TestResults/TestResultItem.vue?vue&type=script&setup=true&lang.ts
4
+ var _hoisted_1 = { class: "flex flex-col" };
5
+ var _hoisted_2 = { class: "flex items-center gap-3 p-2" };
6
+ var _hoisted_3 = { class: "text-c-2 overflow-hidden text-ellipsis whitespace-nowrap" };
7
+ var _hoisted_4 = { class: "text-c-3 ml-auto whitespace-nowrap" };
8
+ var _hoisted_5 = {
9
+ key: 0,
10
+ class: "bg-b-danger text-c-1 flex items-center pr-3 pb-1.5 pl-9"
11
+ };
12
+ var TestResultItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
13
+ __name: "TestResultItem",
14
+ props: {
15
+ result: {},
16
+ currentState: {}
17
+ },
18
+ setup(__props) {
19
+ const resultStatus = computed(() => {
20
+ if (__props.result.passed) return {
21
+ icon: "Checkmark",
22
+ color: "text-green p-0.25"
23
+ };
24
+ if (!__props.result.passed && __props.currentState !== "pending") return {
25
+ icon: "Close",
26
+ color: "text-red"
27
+ };
28
+ return {
29
+ icon: "Ellipses",
30
+ color: "text-c-1"
31
+ };
32
+ });
33
+ return (_ctx, _cache) => {
34
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", { class: normalizeClass(["flex h-8 items-center gap-2 pr-3 pl-2.25", __props.result.error && "bg-b-danger"]) }, [createElementVNode("div", _hoisted_2, [createVNode(unref(ScalarIcon), {
35
+ class: normalizeClass(resultStatus.value.color),
36
+ icon: resultStatus.value.icon,
37
+ size: "sm"
38
+ }, null, 8, ["class", "icon"]), createElementVNode("span", _hoisted_3, toDisplayString(__props.result.title), 1)]), createElementVNode("span", _hoisted_4, toDisplayString(__props.result.duration) + " ms ", 1)], 2), __props.result.error ? (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(__props.result.error), 1)) : createCommentVNode("", true)]);
39
+ };
40
+ }
41
+ });
42
+ //#endregion
43
+ export { TestResultItem_vue_vue_type_script_setup_true_lang_default as default };
44
+
45
+ //# sourceMappingURL=TestResultItem.vue.script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestResultItem.vue.script.js","names":[],"sources":["../../../../../src/plugins/post-response-scripts/components/TestResults/TestResultItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon, type Icon } from '@scalar/components'\nimport { computed } from 'vue'\n\nimport type { TestResult } from '@/libs/execute-scripts'\n\nconst { currentState, result } = defineProps<{\n result: TestResult\n currentState: TestResult['status']\n}>()\n\nconst resultStatus = computed(() => {\n if (result.passed) {\n return { icon: 'Checkmark', color: 'text-green p-0.25' }\n }\n\n if (!result.passed && currentState !== 'pending') {\n return { icon: 'Close', color: 'text-red' }\n }\n\n return { icon: 'Ellipses', color: 'text-c-1' }\n})\n</script>\n\n<template>\n <div class=\"flex flex-col\">\n <div\n class=\"flex h-8 items-center gap-2 pr-3 pl-2.25\"\n :class=\"result.error && 'bg-b-danger'\">\n <!-- Title -->\n <div class=\"flex items-center gap-3 p-2\">\n <ScalarIcon\n :class=\"resultStatus.color\"\n :icon=\"resultStatus.icon as Icon\"\n size=\"sm\" />\n\n <span class=\"text-c-2 overflow-hidden text-ellipsis whitespace-nowrap\">\n {{ result.title }}\n </span>\n </div>\n <!-- Duration -->\n <span class=\"text-c-3 ml-auto whitespace-nowrap\">\n {{ result.duration }} ms\n </span>\n </div>\n <!-- Error -->\n <div\n v-if=\"result.error\"\n class=\"bg-b-danger text-c-1 flex items-center pr-3 pb-1.5 pl-9\">\n {{ result.error }}\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EAWA,MAAM,eAAe,eAAe;AAClC,OAAI,QAAA,OAAO,OACT,QAAO;IAAE,MAAM;IAAa,OAAO;IAAoB;AAGzD,OAAI,CAAC,QAAA,OAAO,UAAU,QAAA,iBAAiB,UACrC,QAAO;IAAE,MAAM;IAAS,OAAO;IAAW;AAG5C,UAAO;IAAE,MAAM;IAAY,OAAO;IAAW;IAC9C;;uBAIC,mBA0BM,OA1BN,YA0BM,CAzBJ,mBAkBM,OAAA,EAjBJ,OAAK,eAAA,CAAC,4CACE,QAAA,OAAO,SAAK,cAAA,CAAA,EAAA,EAAA,CAEpB,mBASM,OATN,YASM,CARJ,YAGc,MAAA,WAAA,EAAA;IAFX,OAAK,eAAE,aAAA,MAAa,MAAK;IACzB,MAAM,aAAA,MAAa;IACpB,MAAK;mCAEP,mBAEO,QAFP,YAEO,gBADF,QAAA,OAAO,MAAK,EAAA,EAAA,CAAA,CAAA,EAInB,mBAEO,QAFP,YAEO,gBADF,QAAA,OAAO,SAAQ,GAAG,QACvB,EAAA,CAAA,EAAA,EAAA,EAIM,QAAA,OAAO,SAAA,WAAA,EADf,mBAIM,OAJN,YAIM,gBADD,QAAA,OAAO,MAAK,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA"}
@@ -0,0 +1,7 @@
1
+ import TestResults_vue_vue_type_script_setup_true_lang_default from "./TestResults.vue.script.js";
2
+ //#region src/plugins/post-response-scripts/components/TestResults/TestResults.vue
3
+ var TestResults_default = TestResults_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { TestResults_default as default };
6
+
7
+ //# sourceMappingURL=TestResults.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestResults.vue.js","names":[],"sources":["../../../../../src/plugins/post-response-scripts/components/TestResults/TestResults.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, type Ref } from 'vue'\n\nimport type { TestResult } from '@/libs/execute-scripts'\n\nimport { ViewLayoutCollapse } from '../../../../components/ViewLayout'\nimport TestResultIndicator from './TestResultIndicator.vue'\nimport TestResultItem from './TestResultItem.vue'\nimport TestSummary from './TestSummary.vue'\n\nconst { results } = defineProps<{\n results?: Ref<TestResult[]> | undefined\n}>()\n\nconst passedTests = computed(() =>\n results?.value?.filter((result: TestResult) => result.status === 'passed'),\n)\n\nconst pendingTests = computed(() =>\n results?.value?.filter((result: TestResult) => result.status === 'pending'),\n)\n\nconst failedTests = computed(() =>\n results?.value?.filter((result: TestResult) => result.status === 'failed'),\n)\n\nconst allTestsPassed = computed(\n () => passedTests.value?.length === results?.value?.length,\n)\n\nconst currentState = computed(() => {\n if (allTestsPassed.value) {\n return 'passed'\n }\n\n if (pendingTests.value?.length) {\n return 'pending'\n }\n\n return 'failed'\n})\n\nconst totalDuration = computed(\n () =>\n results?.value?.reduce(\n (acc: number, curr: TestResult) => acc + curr.duration,\n 0,\n ) ?? 0,\n)\n</script>\n\n<template>\n <ViewLayoutCollapse\n v-if=\"results?.value?.length\"\n class=\"overflow-auto text-sm\"\n :defaultOpen=\"true\">\n <template #title> Tests </template>\n <template #suffix>\n <TestResultIndicator\n :failedTestsCount=\"failedTests?.length\"\n inline\n :passedTestsCount=\"passedTests?.length\"\n :pendingTestsCount=\"pendingTests?.length\"\n :state=\"currentState\"\n :totalTestsCount=\"results?.value?.length\" />\n </template>\n\n <div class=\"max-h-[calc(100%-32px)] divide-y overflow-y-auto border-t\">\n <!-- Results -->\n <TestResultItem\n v-for=\"result in results?.value\"\n :key=\"result.title\"\n :currentState=\"result.status\"\n :result=\"result\" />\n\n <TestSummary\n v-if=\"results\"\n :allTestsPassed=\"allTestsPassed\"\n :failedTests=\"failedTests ?? []\"\n :passedTests=\"passedTests ?? []\"\n :pendingTests=\"pendingTests ?? []\"\n :results=\"results?.value\"\n :totalDuration=\"totalDuration\" />\n </div>\n </ViewLayoutCollapse>\n</template>\n"],"mappings":""}
@@ -0,0 +1,73 @@
1
+ import ViewLayoutCollapse_default from "../../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
2
+ import TestResultIndicator_default from "./TestResultIndicator.vue.js";
3
+ import TestResultItem_default from "./TestResultItem.vue.js";
4
+ import TestSummary_default from "./TestSummary.vue.js";
5
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, renderList, unref, withCtx } from "vue";
6
+ //#region src/plugins/post-response-scripts/components/TestResults/TestResults.vue?vue&type=script&setup=true&lang.ts
7
+ var _hoisted_1 = { class: "max-h-[calc(100%-32px)] divide-y overflow-y-auto border-t" };
8
+ var TestResults_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
9
+ __name: "TestResults",
10
+ props: { results: {} },
11
+ setup(__props) {
12
+ const passedTests = computed(() => __props.results?.value?.filter((result) => result.status === "passed"));
13
+ const pendingTests = computed(() => __props.results?.value?.filter((result) => result.status === "pending"));
14
+ const failedTests = computed(() => __props.results?.value?.filter((result) => result.status === "failed"));
15
+ const allTestsPassed = computed(() => passedTests.value?.length === __props.results?.value?.length);
16
+ const currentState = computed(() => {
17
+ if (allTestsPassed.value) return "passed";
18
+ if (pendingTests.value?.length) return "pending";
19
+ return "failed";
20
+ });
21
+ const totalDuration = computed(() => __props.results?.value?.reduce((acc, curr) => acc + curr.duration, 0) ?? 0);
22
+ return (_ctx, _cache) => {
23
+ return __props.results?.value?.length ? (openBlock(), createBlock(unref(ViewLayoutCollapse_default), {
24
+ key: 0,
25
+ class: "overflow-auto text-sm",
26
+ defaultOpen: true
27
+ }, {
28
+ title: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode(" Tests ", -1)])]),
29
+ suffix: withCtx(() => [createVNode(TestResultIndicator_default, {
30
+ failedTestsCount: failedTests.value?.length,
31
+ inline: "",
32
+ passedTestsCount: passedTests.value?.length,
33
+ pendingTestsCount: pendingTests.value?.length,
34
+ state: currentState.value,
35
+ totalTestsCount: __props.results?.value?.length
36
+ }, null, 8, [
37
+ "failedTestsCount",
38
+ "passedTestsCount",
39
+ "pendingTestsCount",
40
+ "state",
41
+ "totalTestsCount"
42
+ ])]),
43
+ default: withCtx(() => [createElementVNode("div", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.results?.value, (result) => {
44
+ return openBlock(), createBlock(TestResultItem_default, {
45
+ key: result.title,
46
+ currentState: result.status,
47
+ result
48
+ }, null, 8, ["currentState", "result"]);
49
+ }), 128)), __props.results ? (openBlock(), createBlock(TestSummary_default, {
50
+ key: 0,
51
+ allTestsPassed: allTestsPassed.value,
52
+ failedTests: failedTests.value ?? [],
53
+ passedTests: passedTests.value ?? [],
54
+ pendingTests: pendingTests.value ?? [],
55
+ results: __props.results?.value,
56
+ totalDuration: totalDuration.value
57
+ }, null, 8, [
58
+ "allTestsPassed",
59
+ "failedTests",
60
+ "passedTests",
61
+ "pendingTests",
62
+ "results",
63
+ "totalDuration"
64
+ ])) : createCommentVNode("", true)])]),
65
+ _: 1
66
+ })) : createCommentVNode("", true);
67
+ };
68
+ }
69
+ });
70
+ //#endregion
71
+ export { TestResults_vue_vue_type_script_setup_true_lang_default as default };
72
+
73
+ //# sourceMappingURL=TestResults.vue.script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestResults.vue.script.js","names":[],"sources":["../../../../../src/plugins/post-response-scripts/components/TestResults/TestResults.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, type Ref } from 'vue'\n\nimport type { TestResult } from '@/libs/execute-scripts'\n\nimport { ViewLayoutCollapse } from '../../../../components/ViewLayout'\nimport TestResultIndicator from './TestResultIndicator.vue'\nimport TestResultItem from './TestResultItem.vue'\nimport TestSummary from './TestSummary.vue'\n\nconst { results } = defineProps<{\n results?: Ref<TestResult[]> | undefined\n}>()\n\nconst passedTests = computed(() =>\n results?.value?.filter((result: TestResult) => result.status === 'passed'),\n)\n\nconst pendingTests = computed(() =>\n results?.value?.filter((result: TestResult) => result.status === 'pending'),\n)\n\nconst failedTests = computed(() =>\n results?.value?.filter((result: TestResult) => result.status === 'failed'),\n)\n\nconst allTestsPassed = computed(\n () => passedTests.value?.length === results?.value?.length,\n)\n\nconst currentState = computed(() => {\n if (allTestsPassed.value) {\n return 'passed'\n }\n\n if (pendingTests.value?.length) {\n return 'pending'\n }\n\n return 'failed'\n})\n\nconst totalDuration = computed(\n () =>\n results?.value?.reduce(\n (acc: number, curr: TestResult) => acc + curr.duration,\n 0,\n ) ?? 0,\n)\n</script>\n\n<template>\n <ViewLayoutCollapse\n v-if=\"results?.value?.length\"\n class=\"overflow-auto text-sm\"\n :defaultOpen=\"true\">\n <template #title> Tests </template>\n <template #suffix>\n <TestResultIndicator\n :failedTestsCount=\"failedTests?.length\"\n inline\n :passedTestsCount=\"passedTests?.length\"\n :pendingTestsCount=\"pendingTests?.length\"\n :state=\"currentState\"\n :totalTestsCount=\"results?.value?.length\" />\n </template>\n\n <div class=\"max-h-[calc(100%-32px)] divide-y overflow-y-auto border-t\">\n <!-- Results -->\n <TestResultItem\n v-for=\"result in results?.value\"\n :key=\"result.title\"\n :currentState=\"result.status\"\n :result=\"result\" />\n\n <TestSummary\n v-if=\"results\"\n :allTestsPassed=\"allTestsPassed\"\n :failedTests=\"failedTests ?? []\"\n :passedTests=\"passedTests ?? []\"\n :pendingTests=\"pendingTests ?? []\"\n :results=\"results?.value\"\n :totalDuration=\"totalDuration\" />\n </div>\n </ViewLayoutCollapse>\n</template>\n"],"mappings":";;;;;;;;;;;EAcA,MAAM,cAAc,eAClB,QAAA,SAAS,OAAO,QAAQ,WAAuB,OAAO,WAAW,SAAS,CAC5E;EAEA,MAAM,eAAe,eACnB,QAAA,SAAS,OAAO,QAAQ,WAAuB,OAAO,WAAW,UAAU,CAC7E;EAEA,MAAM,cAAc,eAClB,QAAA,SAAS,OAAO,QAAQ,WAAuB,OAAO,WAAW,SAAS,CAC5E;EAEA,MAAM,iBAAiB,eACf,YAAY,OAAO,WAAW,QAAA,SAAS,OAAO,OACtD;EAEA,MAAM,eAAe,eAAe;AAClC,OAAI,eAAe,MACjB,QAAO;AAGT,OAAI,aAAa,OAAO,OACtB,QAAO;AAGT,UAAO;IACR;EAED,MAAM,gBAAgB,eAElB,QAAA,SAAS,OAAO,QACb,KAAa,SAAqB,MAAM,KAAK,UAC9C,EACD,IAAI,EACT;;UAKU,QAAA,SAAS,OAAO,UAAA,WAAA,EADxB,YAgCqB,MAAA,2BAAA,EAAA;;IA9BnB,OAAM;IACL,aAAa;;IACH,OAAK,cAAQ,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;IACb,QAAM,cAO+B,CAN9C,YAM8C,6BAAA;KAL3C,kBAAkB,YAAA,OAAa;KAChC,QAAA;KACC,kBAAkB,YAAA,OAAa;KAC/B,mBAAmB,aAAA,OAAc;KACjC,OAAO,aAAA;KACP,iBAAiB,QAAA,SAAS,OAAO;;;;;;;;2BAmBhC,CAhBN,mBAgBM,OAhBN,YAgBM,EAAA,UAAA,KAAA,EAdJ,mBAIqB,UAAA,MAAA,WAHF,QAAA,SAAS,QAAnB,WAAM;yBADf,YAIqB,wBAAA;MAFlB,KAAK,OAAO;MACZ,cAAc,OAAO;MACb;;eAGH,QAAA,WAAA,WAAA,EADR,YAOmC,qBAAA;;KALhC,gBAAgB,eAAA;KAChB,aAAa,YAAA,SAAW,EAAA;KACxB,aAAa,YAAA,SAAW,EAAA;KACxB,cAAc,aAAA,SAAY,EAAA;KAC1B,SAAS,QAAA,SAAS;KAClB,eAAe,cAAA"}
@@ -0,0 +1,7 @@
1
+ import TestSummary_vue_vue_type_script_setup_true_lang_default from "./TestSummary.vue.script.js";
2
+ //#region src/plugins/post-response-scripts/components/TestResults/TestSummary.vue
3
+ var TestSummary_default = TestSummary_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { TestSummary_default as default };
6
+
7
+ //# sourceMappingURL=TestSummary.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestSummary.vue.js","names":[],"sources":["../../../../../src/plugins/post-response-scripts/components/TestResults/TestSummary.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TestResult } from '@/libs/execute-scripts'\n\nimport TestResultIndicator from './TestResultIndicator.vue'\n\ndefineProps<{\n results: TestResult[]\n passedTests: TestResult[]\n failedTests: TestResult[]\n pendingTests: TestResult[]\n allTestsPassed: boolean\n totalDuration: number\n}>()\n</script>\n\n<template>\n <div class=\"flex h-8 items-center gap-1.5 pr-3 pl-1\">\n <TestResultIndicator\n :failedTestsCount=\"failedTests?.length\"\n :passedTestsCount=\"passedTests?.length\"\n :pendingTestsCount=\"pendingTests?.length\"\n :state=\"allTestsPassed ? 'passed' : 'failed'\"\n :totalTestsCount=\"results?.length\" />\n <span\n v-if=\"pendingTests?.length\"\n class=\"text-orange\">\n {{ pendingTests?.length }}\n Pending\n </span>\n <span class=\"text-c-3 ml-auto\"> {{ totalDuration.toFixed(1) }} ms </span>\n </div>\n</template>\n"],"mappings":""}
@@ -0,0 +1,45 @@
1
+ import TestResultIndicator_default from "./TestResultIndicator.vue.js";
2
+ import { createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, toDisplayString } from "vue";
3
+ //#region src/plugins/post-response-scripts/components/TestResults/TestSummary.vue?vue&type=script&setup=true&lang.ts
4
+ var _hoisted_1 = { class: "flex h-8 items-center gap-1.5 pr-3 pl-1" };
5
+ var _hoisted_2 = {
6
+ key: 0,
7
+ class: "text-orange"
8
+ };
9
+ var _hoisted_3 = { class: "text-c-3 ml-auto" };
10
+ var TestSummary_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
11
+ __name: "TestSummary",
12
+ props: {
13
+ results: {},
14
+ passedTests: {},
15
+ failedTests: {},
16
+ pendingTests: {},
17
+ allTestsPassed: { type: Boolean },
18
+ totalDuration: {}
19
+ },
20
+ setup(__props) {
21
+ return (_ctx, _cache) => {
22
+ return openBlock(), createElementBlock("div", _hoisted_1, [
23
+ createVNode(TestResultIndicator_default, {
24
+ failedTestsCount: __props.failedTests?.length,
25
+ passedTestsCount: __props.passedTests?.length,
26
+ pendingTestsCount: __props.pendingTests?.length,
27
+ state: __props.allTestsPassed ? "passed" : "failed",
28
+ totalTestsCount: __props.results?.length
29
+ }, null, 8, [
30
+ "failedTestsCount",
31
+ "passedTestsCount",
32
+ "pendingTestsCount",
33
+ "state",
34
+ "totalTestsCount"
35
+ ]),
36
+ __props.pendingTests?.length ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.pendingTests?.length) + " Pending ", 1)) : createCommentVNode("", true),
37
+ createElementVNode("span", _hoisted_3, toDisplayString(__props.totalDuration.toFixed(1)) + " ms ", 1)
38
+ ]);
39
+ };
40
+ }
41
+ });
42
+ //#endregion
43
+ export { TestSummary_vue_vue_type_script_setup_true_lang_default as default };
44
+
45
+ //# sourceMappingURL=TestSummary.vue.script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestSummary.vue.script.js","names":[],"sources":["../../../../../src/plugins/post-response-scripts/components/TestResults/TestSummary.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { TestResult } from '@/libs/execute-scripts'\n\nimport TestResultIndicator from './TestResultIndicator.vue'\n\ndefineProps<{\n results: TestResult[]\n passedTests: TestResult[]\n failedTests: TestResult[]\n pendingTests: TestResult[]\n allTestsPassed: boolean\n totalDuration: number\n}>()\n</script>\n\n<template>\n <div class=\"flex h-8 items-center gap-1.5 pr-3 pl-1\">\n <TestResultIndicator\n :failedTestsCount=\"failedTests?.length\"\n :passedTestsCount=\"passedTests?.length\"\n :pendingTestsCount=\"pendingTests?.length\"\n :state=\"allTestsPassed ? 'passed' : 'failed'\"\n :totalTestsCount=\"results?.length\" />\n <span\n v-if=\"pendingTests?.length\"\n class=\"text-orange\">\n {{ pendingTests?.length }}\n Pending\n </span>\n <span class=\"text-c-3 ml-auto\"> {{ totalDuration.toFixed(1) }} ms </span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;uBAgBE,mBAcM,OAdN,YAcM;IAbJ,YAKuC,6BAAA;KAJpC,kBAAkB,QAAA,aAAa;KAC/B,kBAAkB,QAAA,aAAa;KAC/B,mBAAmB,QAAA,cAAc;KACjC,OAAO,QAAA,iBAAc,WAAA;KACrB,iBAAiB,QAAA,SAAS;;;;;;;;IAErB,QAAA,cAAc,UAAA,WAAA,EADtB,mBAKO,QALP,YAKO,gBAFF,QAAA,cAAc,OAAM,GAAG,aAE5B,EAAA,IAAA,mBAAA,IAAA,KAAA;IACA,mBAAyE,QAAzE,YAAyE,gBAAtC,QAAA,cAAc,QAAO,EAAA,CAAA,GAAM,QAAI,EAAA"}
@@ -1,2 +1,2 @@
1
- export { default as TestResults } from './TestResults.vue';
1
+ export { default as TestResults } from './TestResults.vue.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
- import { t as TestResults_default } from "../../../../TestResults-DIM8u91u.js";
1
+ import TestResults_default from "./TestResults.vue.js";
2
2
  export { TestResults_default as TestResults };
@@ -1,2 +1,2 @@
1
- export { postResponseScriptsPlugin } from './post-response-scripts-plugin';
1
+ export { postResponseScriptsPlugin } from './post-response-scripts-plugin.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,2 @@
1
- import "../../PostResponseScripts-CrM65oAM.js";
2
- import { t as postResponseScriptsPlugin } from "../../post-response-scripts-ikk1wrl9.js";
1
+ import { postResponseScriptsPlugin } from "./post-response-scripts-plugin.js";
3
2
  export { postResponseScriptsPlugin };
@@ -1,6 +1,6 @@
1
- import { t as executePostResponseScript } from "./execute-scripts-BV13zq7B.js";
2
- import { t as PostResponseScripts_default } from "./PostResponseScripts-CrM65oAM.js";
3
- import { t as TestResults_default } from "./TestResults-DIM8u91u.js";
1
+ import { executePostResponseScript } from "../../libs/execute-scripts/execute-post-response-script.js";
2
+ import PostResponseScripts_default from "./components/PostResponseScripts/PostResponseScripts.vue.js";
3
+ import TestResults_default from "./components/TestResults/TestResults.vue.js";
4
4
  import { ref } from "vue";
5
5
  //#region src/plugins/post-response-scripts/post-response-scripts-plugin.ts
6
6
  var postResponseScriptsPlugin = () => {
@@ -56,6 +56,6 @@ var postResponseScriptsPluginV2 = () => {
56
56
  };
57
57
  };
58
58
  //#endregion
59
- export { postResponseScriptsPluginV2 as n, postResponseScriptsPlugin as t };
59
+ export { postResponseScriptsPlugin, postResponseScriptsPluginV2 };
60
60
 
61
- //# sourceMappingURL=post-response-scripts-ikk1wrl9.js.map
61
+ //# sourceMappingURL=post-response-scripts-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-response-scripts-plugin.js","names":[],"sources":["../../../src/plugins/post-response-scripts/post-response-scripts-plugin.ts"],"sourcesContent":["import type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { ApiClientPlugin } from '@scalar/types/api-reference'\nimport { ref } from 'vue'\n\nimport { type TestResult, executePostResponseScript } from '@/libs/execute-scripts'\n\nimport { PostResponseScripts } from './components/PostResponseScripts'\nimport { TestResults } from './components/TestResults'\n\nexport const postResponseScriptsPlugin = (): ApiClientPlugin => {\n const results = ref<TestResult[]>([])\n\n return () => ({\n name: 'post-response-scripts',\n views: {\n 'request.section': [\n {\n title: 'Scripts',\n component: PostResponseScripts,\n },\n ],\n 'response.section': [\n {\n title: 'Tests',\n component: TestResults,\n props: {\n results,\n },\n },\n ],\n },\n hooks: {\n // Reset test results when a new request is sent\n onBeforeRequest() {\n results.value = []\n },\n // Execute post-response scripts when a response is received\n async onResponseReceived({ response, operation }) {\n await executePostResponseScript(operation['x-post-response'], {\n response,\n onTestResultsUpdate: (newResults) => (results.value = [...newResults]),\n })\n },\n },\n })\n}\n\n/** Post Response Scripts Plugin for client V2 */\nexport const postResponseScriptsPluginV2 = (): ClientPlugin => {\n const results = ref<TestResult[]>([])\n\n return {\n components: {\n request: { component: PostResponseScripts },\n response: { component: TestResults, additionalProps: { results } },\n },\n\n hooks: {\n // Reset test results when a new request is sent\n beforeRequest: () => {\n results.value = []\n },\n // Execute post-response scripts when a response is received\n responseReceived: async ({ response, operation }) => {\n await executePostResponseScript(operation['x-post-response'], {\n response,\n onTestResultsUpdate: (newResults) => (results.value = [...newResults]),\n })\n },\n },\n }\n}\n"],"mappings":";;;;;AASA,IAAa,kCAAmD;CAC9D,MAAM,UAAU,IAAkB,EAAE,CAAC;AAErC,eAAc;EACZ,MAAM;EACN,OAAO;GACL,mBAAmB,CACjB;IACE,OAAO;IACP,WAAW;IACZ,CACF;GACD,oBAAoB,CAClB;IACE,OAAO;IACP,WAAW;IACX,OAAO,EACL,SACD;IACF,CACF;GACF;EACD,OAAO;GAEL,kBAAkB;AAChB,YAAQ,QAAQ,EAAE;;GAGpB,MAAM,mBAAmB,EAAE,UAAU,aAAa;AAChD,UAAM,0BAA0B,UAAU,oBAAoB;KAC5D;KACA,sBAAsB,eAAgB,QAAQ,QAAQ,CAAC,GAAG,WAAW;KACtE,CAAC;;GAEL;EACF;;;AAIH,IAAa,oCAAkD;CAC7D,MAAM,UAAU,IAAkB,EAAE,CAAC;AAErC,QAAO;EACL,YAAY;GACV,SAAS,EAAE,WAAW,6BAAqB;GAC3C,UAAU;IAAE,WAAW;IAAa,iBAAiB,EAAE,SAAS;IAAE;GACnE;EAED,OAAO;GAEL,qBAAqB;AACnB,YAAQ,QAAQ,EAAE;;GAGpB,kBAAkB,OAAO,EAAE,UAAU,gBAAgB;AACnD,UAAM,0BAA0B,UAAU,oBAAoB;KAC5D;KACA,sBAAsB,eAAgB,QAAQ,QAAQ,CAAC,GAAG,WAAW;KACtE,CAAC;;GAEL;EACF"}
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "post-response scripts",
20
20
  "api client"
21
21
  ],
22
- "version": "0.3.12",
22
+ "version": "0.3.13",
23
23
  "engines": {
24
24
  "node": ">=22"
25
25
  },
@@ -67,15 +67,15 @@
67
67
  "@headlessui/vue": "1.7.23",
68
68
  "postman-sandbox": "^6.5.0",
69
69
  "vue": "^3.5.26",
70
- "@scalar/oas-utils": "0.10.10",
71
- "@scalar/components": "0.20.12"
70
+ "@scalar/components": "0.21.0",
71
+ "@scalar/oas-utils": "0.10.11"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@vitejs/plugin-vue": "^6.0.3",
75
75
  "@vue/test-utils": "2.4.6",
76
76
  "vite": "8.0.0",
77
- "@scalar/types": "0.7.4",
78
- "@scalar/use-codemirror": "0.14.10"
77
+ "@scalar/use-codemirror": "0.14.10",
78
+ "@scalar/types": "0.7.4"
79
79
  },
80
80
  "scripts": {
81
81
  "build": "vite build && vue-tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
@@ -1,202 +0,0 @@
1
- import { t as ViewLayoutCollapse_default } from "./ViewLayoutCollapse-BMrPz_sj.js";
2
- import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, renderList, toDisplayString, toRef, unref, withCtx } from "vue";
3
- import { javascript } from "@codemirror/lang-javascript";
4
- import { useCodeMirror } from "@scalar/use-codemirror";
5
- //#region src/consts/example-scripts.ts
6
- var EXAMPLE_SCRIPTS = [
7
- {
8
- title: "Check the status code",
9
- script: `pm.test("Status code is 200", () => {
10
- pm.response.to.have.status(200)
11
- })`,
12
- mockResponse: {
13
- status: 200,
14
- body: { success: true }
15
- }
16
- },
17
- {
18
- title: "Check JSON response",
19
- script: `pm.test("Response is valid JSON", () => {
20
- const responseData = pm.response.json()
21
- pm.expect(responseData).to.be.an('object')
22
- })`,
23
- mockResponse: {
24
- status: 200,
25
- body: { data: "test" },
26
- headers: { "Content-Type": "application/json" }
27
- }
28
- },
29
- {
30
- title: "Check response headers",
31
- script: `pm.test("Content-Type header is present", () => {
32
- pm.response.to.have.header('Content-Type')
33
- })`,
34
- mockResponse: {
35
- status: 200,
36
- body: { success: true },
37
- headers: { "Content-Type": "application/json" }
38
- }
39
- },
40
- {
41
- title: "Validate JSON schema",
42
- script: `pm.test("Response matches schema", () => {
43
- const schema = {
44
- type: 'object',
45
- required: ['id', 'name'],
46
- properties: {
47
- id: { type: 'number' },
48
- name: { type: 'string' }
49
- }
50
- }
51
- pm.response.to.have.jsonSchema(schema)
52
- })`,
53
- mockResponse: {
54
- status: 200,
55
- body: {
56
- id: 1,
57
- name: "Test Item"
58
- },
59
- headers: { "Content-Type": "application/json" }
60
- }
61
- },
62
- {
63
- title: "Check response body",
64
- script: `pm.test("Response body contains string", () => {
65
- pm.expect(pm.response.text()).to.include('success')
66
- })`,
67
- mockResponse: {
68
- status: 200,
69
- body: "This is a successful response"
70
- }
71
- },
72
- {
73
- title: "Successful POST request",
74
- script: `pm.test("Successful POST request", () => {
75
- pm.expect(pm.response.code).to.be.oneOf([201, 202])
76
- })`,
77
- mockResponse: {
78
- status: 201,
79
- body: { success: true }
80
- }
81
- }
82
- ];
83
- //#endregion
84
- //#region src/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue?vue&type=script&setup=true&lang.ts
85
- var _hoisted_1$2 = { class: "flex flex-wrap gap-1" };
86
- var _hoisted_2$1 = ["onClick"];
87
- //#endregion
88
- //#region src/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue
89
- var ExampleScripts_default = /* @__PURE__ */ defineComponent({
90
- __name: "ExampleScripts",
91
- props: { modelValue: {} },
92
- emits: ["update:modelValue"],
93
- setup(__props, { emit: __emit }) {
94
- const props = __props;
95
- const emit = __emit;
96
- const addExample = (example) => {
97
- let addition = example;
98
- if (props.modelValue.trim() !== "") addition = `\n\n${addition}`;
99
- emit("update:modelValue", props.modelValue.trim() + addition);
100
- };
101
- return (_ctx, _cache) => {
102
- return openBlock(), createElementBlock("ul", _hoisted_1$2, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(EXAMPLE_SCRIPTS), (example) => {
103
- return openBlock(), createElementBlock("li", {
104
- key: example.title,
105
- class: "bg-b-2 text-c-2 hover:bg-b-3 inline-flex flex-col rounded-full px-3 py-1 text-xs font-medium"
106
- }, [createElementVNode("button", {
107
- class: "w-full",
108
- type: "button",
109
- onClick: ($event) => addExample(example.script)
110
- }, toDisplayString(example.title), 9, _hoisted_2$1)]);
111
- }), 128))]);
112
- };
113
- }
114
- });
115
- //#endregion
116
- //#region src/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue?vue&type=script&setup=true&lang.ts
117
- var _hoisted_1$1 = { class: "script-editor text-sm" };
118
- var ScriptEditor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
119
- __name: "ScriptEditor",
120
- props: { modelValue: {} },
121
- emits: ["update:modelValue"],
122
- setup(__props, { emit: __emit }) {
123
- const props = __props;
124
- const emit = __emit;
125
- const codeMirrorRef = ref(null);
126
- useCodeMirror({
127
- codeMirrorRef,
128
- content: toRef(() => props.modelValue),
129
- language: void 0,
130
- extensions: [javascript()],
131
- lineNumbers: true,
132
- onChange: (value) => {
133
- emit("update:modelValue", value);
134
- }
135
- });
136
- return (_ctx, _cache) => {
137
- return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("div", {
138
- ref_key: "codeMirrorRef",
139
- ref: codeMirrorRef,
140
- class: "editor-container"
141
- }, null, 512)]);
142
- };
143
- }
144
- });
145
- //#endregion
146
- //#region \0plugin-vue:export-helper
147
- var _plugin_vue_export_helper_default = (sfc, props) => {
148
- const target = sfc.__vccOpts || sfc;
149
- for (const [key, val] of props) target[key] = val;
150
- return target;
151
- };
152
- //#endregion
153
- //#region src/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue
154
- var ScriptEditor_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ScriptEditor_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-a9df3276"]]);
155
- //#endregion
156
- //#region src/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue?vue&type=script&setup=true&lang.ts
157
- var _hoisted_1 = { class: "w-full" };
158
- var _hoisted_2 = { class: "mr-2" };
159
- var _hoisted_3 = {
160
- key: 0,
161
- class: "bg-green h-2 w-2 rounded-full"
162
- };
163
- var _hoisted_4 = { class: "border-y p-3" };
164
- //#endregion
165
- //#region src/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue
166
- var PostResponseScripts_default = /* @__PURE__ */ defineComponent({
167
- __name: "PostResponseScripts",
168
- props: { operation: {} },
169
- emits: ["operation:update:extension"],
170
- setup(__props, { emit: __emit }) {
171
- const emit = __emit;
172
- const script = computed(() => __props.operation["x-post-response"] || "");
173
- const updatePostResponseScript = (value) => {
174
- emit("operation:update:extension", { "x-post-response": value });
175
- };
176
- return (_ctx, _cache) => {
177
- return openBlock(), createElementBlock("div", _hoisted_1, [createVNode(unref(ViewLayoutCollapse_default), {
178
- class: "w-full",
179
- defaultOpen: true
180
- }, {
181
- title: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("Scripts", -1)])]),
182
- suffix: withCtx(() => [createElementVNode("div", _hoisted_2, [script.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3)) : createCommentVNode("", true)])]),
183
- default: withCtx(() => [
184
- _cache[1] || (_cache[1] = createElementVNode("div", { class: "text-c-3 flex h-8 items-center border-y px-3 text-sm" }, " Post-Response ", -1)),
185
- createVNode(ScriptEditor_default, {
186
- modelValue: script.value,
187
- "onUpdate:modelValue": updatePostResponseScript
188
- }, null, 8, ["modelValue"]),
189
- createElementVNode("div", _hoisted_4, [createVNode(ExampleScripts_default, {
190
- modelValue: script.value,
191
- "onUpdate:modelValue": updatePostResponseScript
192
- }, null, 8, ["modelValue"])])
193
- ]),
194
- _: 1
195
- })]);
196
- };
197
- }
198
- });
199
- //#endregion
200
- export { PostResponseScripts_default as t };
201
-
202
- //# sourceMappingURL=PostResponseScripts-CrM65oAM.js.map