@scalar/pre-post-request-scripts 0.3.11 → 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.
- package/CHANGELOG.md +12 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/ViewLayout/ValueEmitter.vue.js +7 -0
- package/dist/components/ViewLayout/ValueEmitter.vue.js.map +1 -0
- package/dist/components/ViewLayout/ValueEmitter.vue.script.js +18 -0
- package/dist/components/ViewLayout/ValueEmitter.vue.script.js.map +1 -0
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +7 -0
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js.map +1 -0
- package/dist/{ViewLayoutCollapse-BMrPz_sj.js → components/ViewLayout/ViewLayoutCollapse.vue.script.js} +5 -22
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.script.js.map +1 -0
- package/dist/components/ViewLayout/index.d.ts +1 -1
- package/dist/consts/example-scripts.js +82 -0
- package/dist/consts/example-scripts.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -3
- package/dist/libs/execute-scripts/context/console.js +14 -0
- package/dist/libs/execute-scripts/context/console.js.map +1 -0
- package/dist/libs/execute-scripts/execute-post-response-script.js +16 -0
- package/dist/libs/execute-scripts/execute-post-response-script.js.map +1 -0
- package/dist/libs/execute-scripts/index.d.ts +1 -1
- package/dist/libs/execute-scripts/index.js +1 -1
- package/dist/libs/execute-scripts/postman-sandbox-adapter.d.ts +2 -2
- package/dist/{execute-scripts-BV13zq7B.js → libs/execute-scripts/postman-sandbox-adapter.js} +2 -24
- package/dist/libs/execute-scripts/postman-sandbox-adapter.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue.js +7 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue.script.js +35 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/ExampleScripts.vue.script.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue.js +7 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue.script.js +49 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/PostResponseScripts.vue.script.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue.js +9 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue.script.js +36 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/ScriptEditor.vue.script.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/index.d.ts +1 -1
- package/dist/plugins/post-response-scripts/components/PostResponseScripts/index.js +1 -1
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.d.ts +1 -1
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.js +7 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.script.js +70 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.script.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.d.ts +1 -1
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.js +7 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.script.js +45 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.script.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.d.ts +1 -1
- package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.js +7 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.script.js +73 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.script.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.d.ts +1 -1
- package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.js +7 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.script.js +45 -0
- package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.script.js.map +1 -0
- package/dist/plugins/post-response-scripts/components/TestResults/index.d.ts +1 -1
- package/dist/plugins/post-response-scripts/components/TestResults/index.js +1 -1
- package/dist/plugins/post-response-scripts/index.d.ts +1 -1
- package/dist/plugins/post-response-scripts/index.js +1 -2
- package/dist/{post-response-scripts-ikk1wrl9.js → plugins/post-response-scripts/post-response-scripts-plugin.js} +5 -5
- package/dist/plugins/post-response-scripts/post-response-scripts-plugin.js.map +1 -0
- package/package.json +6 -6
- package/dist/PostResponseScripts-CrM65oAM.js +0 -202
- package/dist/PostResponseScripts-CrM65oAM.js.map +0 -1
- package/dist/TestResults-DIM8u91u.js +0 -224
- package/dist/TestResults-DIM8u91u.js.map +0 -1
- package/dist/ViewLayoutCollapse-BMrPz_sj.js.map +0 -1
- package/dist/execute-scripts-BV13zq7B.js.map +0 -1
- package/dist/post-response-scripts-ikk1wrl9.js.map +0 -1
package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestResultIndicator.vue.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":""}
|
package/dist/plugins/post-response-scripts/components/TestResults/TestResultIndicator.vue.script.js
ADDED
|
@@ -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":""}
|
package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.script.js
ADDED
|
@@ -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
|
package/dist/plugins/post-response-scripts/components/TestResults/TestResultItem.vue.script.js.map
ADDED
|
@@ -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
|
package/dist/plugins/post-response-scripts/components/TestResults/TestResults.vue.script.js.map
ADDED
|
@@ -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
|
package/dist/plugins/post-response-scripts/components/TestResults/TestSummary.vue.script.js.map
ADDED
|
@@ -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
|
|
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,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 {
|
|
59
|
+
export { postResponseScriptsPlugin, postResponseScriptsPluginV2 };
|
|
60
60
|
|
|
61
|
-
//# sourceMappingURL=post-response-scripts-
|
|
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.
|
|
22
|
+
"version": "0.3.13",
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=22"
|
|
25
25
|
},
|
|
@@ -67,18 +67,18 @@
|
|
|
67
67
|
"@headlessui/vue": "1.7.23",
|
|
68
68
|
"postman-sandbox": "^6.5.0",
|
|
69
69
|
"vue": "^3.5.26",
|
|
70
|
-
"@scalar/components": "0.
|
|
71
|
-
"@scalar/oas-utils": "0.10.
|
|
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/
|
|
78
|
-
"@scalar/
|
|
77
|
+
"@scalar/use-codemirror": "0.14.10",
|
|
78
|
+
"@scalar/types": "0.7.4"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
|
-
"build": "vite build && vue-tsc -p tsconfig.build.json",
|
|
81
|
+
"build": "vite build && vue-tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
82
82
|
"dev": "vite",
|
|
83
83
|
"preview": "vite preview",
|
|
84
84
|
"test": "vitest",
|