@pb33f/cowboy-components 0.0.1 → 0.0.3

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 (82) hide show
  1. package/README.md +9 -0
  2. package/dist/components/attention-box/attention-box.css.js +73 -0
  3. package/dist/components/attention-box/attention-box.d.ts +16 -0
  4. package/dist/components/attention-box/attention-box.js +65 -0
  5. package/dist/components/changelog/changelog.css.js +95 -0
  6. package/dist/components/changelog/changelog.d.ts +12 -0
  7. package/dist/components/changelog/changelog.js +125 -0
  8. package/dist/components/changelog/model.d.ts +68 -0
  9. package/dist/components/changelog/model.js +1 -0
  10. package/dist/components/changelog/release.css.d.ts +2 -0
  11. package/dist/components/changelog/release.css.js +66 -0
  12. package/dist/components/changelog/release.d.ts +16 -0
  13. package/dist/components/changelog/release.js +96 -0
  14. package/dist/components/header/header.css.js +102 -0
  15. package/dist/components/header/header.d.ts +1 -0
  16. package/dist/components/header/header.js +39 -0
  17. package/dist/components/http-method/http-method.css.d.ts +2 -0
  18. package/dist/components/http-method/http-method.css.js +22 -0
  19. package/dist/components/http-method/http-method.d.ts +8 -0
  20. package/dist/components/http-method/http-method.js +34 -0
  21. package/dist/components/http-property-view/http-property-view.css.d.ts +2 -0
  22. package/dist/components/http-property-view/http-property-view.css.js +108 -0
  23. package/dist/components/http-property-view/http-property-view.d.ts +19 -0
  24. package/dist/components/http-property-view/http-property-view.js +102 -0
  25. package/dist/components/kv-view/kv-view.css.js +81 -0
  26. package/dist/components/kv-view/kv-view.js +98 -0
  27. package/dist/components/mailing-list/mailing-list.css.d.ts +2 -0
  28. package/dist/components/mailing-list/mailing-list.css.js +100 -0
  29. package/dist/components/mailing-list/mailing-list.d.ts +24 -0
  30. package/dist/components/mailing-list/mailing-list.js +138 -0
  31. package/dist/components/terminal/terminal-example.css.js +43 -0
  32. package/dist/components/terminal/terminal-example.js +34 -0
  33. package/dist/components/theme-switcher/theme-switcher.css.js +9 -0
  34. package/dist/components/theme-switcher/theme-switcher.js +76 -0
  35. package/dist/components/timeline/timeline-item.css.d.ts +2 -0
  36. package/dist/components/timeline/timeline-item.css.js +63 -0
  37. package/dist/components/timeline/timeline-item.d.ts +6 -0
  38. package/dist/components/timeline/timeline-item.js +32 -0
  39. package/dist/components/timeline/timeline.css.d.ts +2 -0
  40. package/dist/components/timeline/timeline.css.js +53 -0
  41. package/dist/components/timeline/timeline.d.ts +6 -0
  42. package/dist/components/timeline/timeline.js +30 -0
  43. package/dist/cowboy-components.d.ts +14 -0
  44. package/dist/cowboy-components.js +18 -4240
  45. package/dist/cowboy-components.umd.cjs +1146 -1213
  46. package/dist/css/alerts.css.d.ts +2 -0
  47. package/dist/css/alerts.css.js +89 -0
  48. package/dist/css/prism.css.d.ts +2 -0
  49. package/dist/css/prism.css.js +114 -0
  50. package/dist/css/shared.css.d.ts +2 -0
  51. package/dist/css/shared.css.js +116 -0
  52. package/dist/model/constants.d.ts +23 -0
  53. package/dist/model/constants.js +23 -0
  54. package/dist/model/controls.d.ts +30 -0
  55. package/dist/model/controls.js +25 -0
  56. package/dist/model/errors.d.ts +7 -0
  57. package/dist/model/errors.js +1 -0
  58. package/dist/model/exchange_method.d.ts +1 -0
  59. package/dist/model/exchange_method.js +16 -0
  60. package/dist/model/extract_content_type.d.ts +34 -0
  61. package/dist/model/extract_content_type.js +78 -0
  62. package/dist/model/extract_query.d.ts +1 -0
  63. package/dist/model/extract_query.js +11 -0
  64. package/dist/model/http_transaction.d.ts +78 -0
  65. package/dist/model/http_transaction.js +109 -0
  66. package/dist/style.css +1 -1
  67. package/package.json +18 -7
  68. package/demo/index.ts +0 -1
  69. package/demo/kv-view.ts +0 -18
  70. package/dist/fonts/BerkeleyMono-Bold.woff +0 -0
  71. package/dist/fonts/BerkeleyMono-Bold.woff2 +0 -0
  72. package/dist/fonts/BerkeleyMono-BoldItalic.woff +0 -0
  73. package/dist/fonts/BerkeleyMono-BoldItalic.woff2 +0 -0
  74. package/dist/fonts/BerkeleyMono-Italic.woff +0 -0
  75. package/dist/fonts/BerkeleyMono-Italic.woff2 +0 -0
  76. package/dist/fonts/BerkeleyMono-Regular.woff +0 -0
  77. package/dist/fonts/BerkeleyMono-Regular.woff2 +0 -0
  78. package/dist/index.d.ts +0 -9
  79. package/dist/vite.svg +0 -1
  80. package/index.html +0 -66
  81. /package/dist/components/{prism.css.d.ts → attention-box/attention-box.css.d.ts} +0 -0
  82. /package/dist/components/{shared.css.d.ts → changelog/changelog.css.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,89 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+
4
+ strong {
5
+ display: block;
6
+ margin-bottom: var(--global-space);
7
+ }
8
+
9
+ sl-alert::part(base) {
10
+ font: var(--font-stack);
11
+ color: var(--font-color);
12
+ border: none;
13
+ border-radius: 0;
14
+ background-color: var(--error-color-verylowalpha);
15
+ }
16
+
17
+ sl-alert.error::part(base) {
18
+ border: 1px dashed var(--error-color);
19
+ background-color: var(--terminal-background);
20
+ }
21
+ sl-alert.error::part(icon) {
22
+ color: var(--error-color);
23
+ font-size: 1.5rem;
24
+ }
25
+ sl-alert.error > strong {
26
+ color: var(--error-color);
27
+ font: 1.2rem var(--font-stack-bold);
28
+ }
29
+
30
+ sl-alert.warning::part(icon) {
31
+ color: var(--warn-300);
32
+ font-size: 1.5rem;
33
+ }
34
+ sl-alert.warning::part(base) {
35
+ border: 1px dashed var(--warn-200);
36
+ background-color: var(--terminal-background);
37
+ }
38
+
39
+ sl-alert.warning > strong {
40
+ color: var(--warn-200);
41
+ font: 1.2rem var(--font-stack-bold);
42
+ }
43
+
44
+ sl-alert.info::part(base) {
45
+ border: 1px dashed var(--primary-color);
46
+ background-color: var(--terminal-background);
47
+ }
48
+ sl-alert.info::part(icon) {
49
+ color: var(--primary-color);
50
+ font-size: 1.5rem;
51
+ }
52
+ sl-alert.info > strong {
53
+ font: 1.2rem var(--font-stack-bold);
54
+ color: var(--primary-color);
55
+ }
56
+
57
+ sl-alert.success::part(base) {
58
+ border: 1px dashed var(--terminal-text);
59
+ background-color: var(--terminal-background);
60
+ }
61
+ sl-alert.success::part(icon) {
62
+ color: var(--terminal-text);
63
+ font-size: 1.5rem;
64
+ }
65
+ sl-alert.success > strong {
66
+ font: 1.2rem var(--font-stack-bold);
67
+ color: var(--terminal-text);
68
+ }
69
+
70
+ sl-alert.context::part(base) {
71
+ border: 1px dashed var(--code-border);
72
+ background-color: var(--terminal-background);
73
+ }
74
+ sl-alert.context::part(icon) {
75
+ color: var(--font-color-sub1);
76
+ font-size: 1.5rem;
77
+ }
78
+ sl-alert.context > strong {
79
+ font: 1.2rem var(--font-stack-bold);
80
+ color: var(--font-color);
81
+ }
82
+
83
+ sl-alert::part(message) {
84
+ font: var(--font-stack);
85
+ padding-top: var(--global-padding);
86
+ padding-bottom: var(--global-padding);
87
+ }
88
+
89
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,114 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+
4
+ code,
5
+ pre {
6
+ color: var(--font-color);
7
+ background: none;
8
+ font-family: var(--font-stack), sans-serif;
9
+ font-size: 1em;
10
+ text-align: left;
11
+ white-space: pre;
12
+ word-spacing: normal;
13
+ word-break: normal;
14
+ word-wrap: normal;
15
+ line-height: 1.5;
16
+ tab-size: 4;
17
+ hyphens: none;
18
+ }
19
+
20
+ /* Code blocks */
21
+
22
+ pre[class*="language-"] {
23
+ padding: 1em;
24
+ margin: .5em 0;
25
+ overflow: auto;
26
+ border-radius: 0.3em;
27
+ }
28
+
29
+
30
+ /* Inline code */
31
+
32
+ :not(pre) > code[class*="language-"] {
33
+ padding: .1em;
34
+ border-radius: .3em;
35
+ white-space: normal;
36
+ }
37
+
38
+ .token.comment,
39
+ .token.prolog,
40
+ .token.doctype,
41
+ .token.cdata {
42
+ color: #7f7f7f;
43
+ }
44
+
45
+ .token.punctuation {
46
+ color: #7f7f7f;
47
+ }
48
+
49
+ .token.namespace {
50
+ opacity: .7;
51
+ }
52
+
53
+ .token.property,
54
+ .token.tag,
55
+ .token.constant,
56
+ .token.symbol,
57
+ .token.deleted {
58
+ color: var(--primary-color);
59
+ }
60
+
61
+ .token.boolean,
62
+ .token.number {
63
+ color: var(--primary-color);
64
+ }
65
+
66
+ .token.selector,
67
+ .token.attr-name,
68
+ .token.string,
69
+ .token.char,
70
+ .token.builtin,
71
+ .token.inserted {
72
+ color: var(--secondary-color);
73
+ }
74
+
75
+ .token.operator,
76
+ .token.entity,
77
+ .token.url,
78
+ .language-css .token.string,
79
+ .style .token.string,
80
+ .token.variable {
81
+ color: var(--tertiary-color);
82
+ }
83
+
84
+ .token.atrule,
85
+ .token.attr-value,
86
+ .token.function,
87
+ .token.class-name {
88
+ color: var(--terminal-text);
89
+ }
90
+
91
+ .token.keyword {
92
+ color: var(--primary-color);
93
+ }
94
+
95
+ .token.regex,
96
+ .token.important {
97
+ color: #fd971f;
98
+ }
99
+
100
+ .token.important,
101
+ .token.bold {
102
+ font-weight: bold;
103
+ }
104
+
105
+ .token.italic {
106
+ font-style: italic;
107
+ }
108
+
109
+ .token.entity {
110
+ cursor: help;
111
+ }
112
+
113
+
114
+ `;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,116 @@
1
+ import { css } from "lit";
2
+ export default css `
3
+
4
+ a, a:visited, a:active {
5
+ text-decoration: none;
6
+ color: var(--primary-color);
7
+ font-family: var(--font-stack-bold), monospace;
8
+ font-weight: normal
9
+ }
10
+
11
+ a:hover {
12
+ color: var(--primary-color);
13
+ text-decoration: underline;
14
+ }
15
+
16
+ hr {
17
+ height: 1px;
18
+ border-bottom: none;
19
+ border-left: none;
20
+ border-right: none;
21
+ border-top: 1px dashed var(--secondary-color);
22
+ margin-bottom: 20px;
23
+ margin-top: 10px;
24
+ }
25
+
26
+ .empty-data {
27
+ text-align: center;
28
+ padding-top: 20px;
29
+ color: var(--font-color-sub2)
30
+ }
31
+
32
+ .empty-data .mute-icon {
33
+ font-size: 100px;
34
+ margin-bottom: 20px;
35
+ color: var(--font-color-sub2);
36
+ }
37
+
38
+ .empty-data .binary-icon {
39
+ font-size: 100px;
40
+ margin-bottom: 20px;
41
+ color: var(--secondary-color);
42
+ }
43
+
44
+ .empty-data .up-icon {
45
+ font-size: 100px;
46
+ margin-bottom: 20px;
47
+ color: var(--primary-color);
48
+ }
49
+
50
+ .empty-data .ok-icon {
51
+ font-size: 100px;
52
+ margin-bottom: 20px;
53
+ color: var(--primary-color);
54
+ }
55
+
56
+ .empty-data.ok {
57
+ color: var(--primary-color);
58
+ }
59
+
60
+ .empty-data.engage {
61
+ padding-top: 90px;
62
+ color: var(--primary-color);
63
+ }
64
+
65
+ .binary-data .binary-icon {
66
+ font-size: 100px;
67
+ margin-bottom: 20px;
68
+ color: var(--primary-color);
69
+ }
70
+
71
+ strong {
72
+ font-weight: normal;
73
+ font-family: var(--font-stack-bold), monospace;
74
+ }
75
+
76
+ .spin {
77
+ display: inline-block;
78
+ position: relative;
79
+ width: 35px;
80
+ height: 25px;
81
+ }
82
+
83
+ .spin:after {
84
+ content: " ";
85
+ display: block;
86
+ border-radius: 50%;
87
+ width: 0;
88
+ height: 0;
89
+ margin: 8px;
90
+ box-sizing: border-box;
91
+ border: 10px solid var(--primary-color);
92
+ border-color: var(--primary-color) transparent var(--primary-color) transparent;
93
+ animation: spinner 1.2s infinite;
94
+ }
95
+ .pb33f-loader {
96
+ display: inline-block;
97
+ position: relative;
98
+ width: 100%;
99
+ height: 60px;
100
+ }
101
+
102
+ @keyframes spinner {
103
+ 0% {
104
+ transform: rotate(0);
105
+ animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);
106
+ }
107
+ 50% {
108
+ transform: rotate(900deg);
109
+ animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
110
+ }
111
+ 100% {
112
+ transform: rotate(1800deg);
113
+ }
114
+ }
115
+
116
+ `;
@@ -0,0 +1,23 @@
1
+ export declare const WiretapChannel = "wiretap-broadcast";
2
+ export declare const SpecChannel = "specs";
3
+ export declare const WiretapControlsChannel = "controls";
4
+ export declare const WiretapReportChannel = "report";
5
+ export declare const WiretapConfigurationChannel = "configuration";
6
+ export declare const WiretapStaticChannel = "wiretap-static-change";
7
+ export declare const WiretapHttpTransactionStore = "http-transaction-store";
8
+ export declare const WiretapSelectedTransactionStore = "selected-transaction-store";
9
+ export declare const WiretapSpecStore = "wiretap-spec-store";
10
+ export declare const WiretapControlsStore = "wiretap-controls-store";
11
+ export declare const WiretapFiltersStore = "wiretap-filters-store";
12
+ export declare const WiretapLinkCacheStore = "http-link-cache-store";
13
+ export declare const WiretapLinkCacheKey = "http-link-cache";
14
+ export declare const WiretapFiltersKey = "wiretap-filters";
15
+ export declare const WiretapControlsKey = "wiretap-controls";
16
+ export declare const WiretapCurrentSpec = "current-spec";
17
+ export declare const GetCurrentSpecCommand = "get-current-spec";
18
+ export declare const ChangeDelayCommand = "change-delay-request";
19
+ export declare const RequestReportCommand = "generate-report-request";
20
+ export declare const WiretapLocalStorage = "wiretap-transactions";
21
+ export declare const NoSpec = "no-spec";
22
+ export declare const TopicPrefix = "/topic/";
23
+ export declare const QueuePrefix = "/queue/";
@@ -0,0 +1,23 @@
1
+ export const WiretapChannel = "wiretap-broadcast";
2
+ export const SpecChannel = "specs";
3
+ export const WiretapControlsChannel = "controls";
4
+ export const WiretapReportChannel = "report";
5
+ export const WiretapConfigurationChannel = "configuration";
6
+ export const WiretapStaticChannel = "wiretap-static-change";
7
+ export const WiretapHttpTransactionStore = "http-transaction-store";
8
+ export const WiretapSelectedTransactionStore = "selected-transaction-store";
9
+ export const WiretapSpecStore = "wiretap-spec-store";
10
+ export const WiretapControlsStore = "wiretap-controls-store";
11
+ export const WiretapFiltersStore = "wiretap-filters-store";
12
+ export const WiretapLinkCacheStore = "http-link-cache-store";
13
+ export const WiretapLinkCacheKey = "http-link-cache";
14
+ export const WiretapFiltersKey = "wiretap-filters";
15
+ export const WiretapControlsKey = "wiretap-controls";
16
+ export const WiretapCurrentSpec = "current-spec";
17
+ export const GetCurrentSpecCommand = "get-current-spec";
18
+ export const ChangeDelayCommand = "change-delay-request";
19
+ export const RequestReportCommand = "generate-report-request";
20
+ export const WiretapLocalStorage = "wiretap-transactions";
21
+ export const NoSpec = "no-spec";
22
+ export const TopicPrefix = "/topic/";
23
+ export const QueuePrefix = "/queue/";
@@ -0,0 +1,30 @@
1
+ import { HttpTransaction } from "./http_transaction";
2
+ export declare class WiretapControls {
3
+ globalDelay: number;
4
+ }
5
+ export declare class WiretapFilters {
6
+ constructor();
7
+ filterMethod: Filter;
8
+ filterKeywords: Filter[];
9
+ filterChain: Filter[];
10
+ }
11
+ export declare function AreFiltersActive(filters: WiretapFilters): boolean;
12
+ export interface Filter {
13
+ id?: string;
14
+ keyword: string;
15
+ }
16
+ export interface ControlsResponse {
17
+ config: WiretapConfig;
18
+ }
19
+ export interface ControlsResponse {
20
+ config: WiretapConfig;
21
+ }
22
+ export interface ReportResponse {
23
+ transactions: HttpTransaction[];
24
+ }
25
+ export interface WiretapConfig {
26
+ redirectHost: string;
27
+ port: string;
28
+ monitorPort: string;
29
+ globalAPIDelay: number;
30
+ }
@@ -0,0 +1,25 @@
1
+ import { RanchUtils } from "@pb33f/ranch";
2
+ export class WiretapControls {
3
+ constructor() {
4
+ this.globalDelay = 0;
5
+ }
6
+ }
7
+ export class WiretapFilters {
8
+ constructor() {
9
+ this.filterMethod = {
10
+ id: RanchUtils.genShortId(5),
11
+ keyword: "",
12
+ };
13
+ this.filterKeywords = [];
14
+ this.filterChain = [];
15
+ }
16
+ }
17
+ export function AreFiltersActive(filters) {
18
+ if (filters.filterMethod.keyword.length > 0) {
19
+ return true;
20
+ }
21
+ if (filters.filterKeywords.length > 0) {
22
+ return true;
23
+ }
24
+ return filters.filterChain.length > 0;
25
+ }
@@ -0,0 +1,7 @@
1
+ export interface PlatformError {
2
+ detail: string;
3
+ instance: string;
4
+ statusL: number;
5
+ title: string;
6
+ type: string;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function ExchangeMethod(method: string): string;
@@ -0,0 +1,16 @@
1
+ export function ExchangeMethod(method) {
2
+ switch (method.toLowerCase()) {
3
+ case 'get':
4
+ return 'success';
5
+ case 'post':
6
+ return 'primary';
7
+ case 'put':
8
+ return 'primary';
9
+ case 'delete':
10
+ return 'danger';
11
+ case 'patch':
12
+ return 'warning';
13
+ default:
14
+ return 'neutral';
15
+ }
16
+ }
@@ -0,0 +1,34 @@
1
+ import { HttpRequest, HttpResponse } from "./http_transaction";
2
+ export declare const ContentTypeJSON = "application/json";
3
+ export declare const ContentTypeFormEncoded = "application/x-www-form-urlencoded";
4
+ export declare const ContentTypeXML = "application/xml";
5
+ export declare const ContentTypeMultipartForm = "multipart/form-data";
6
+ export declare const ContentTypeOctetStream = "application/octet-stream";
7
+ export declare const ContentTypeText = "text/plain";
8
+ export declare const ContentTypeHtml = "text/html";
9
+ export interface FormDataEntry {
10
+ type: 'file' | 'field';
11
+ name: string;
12
+ filename?: string;
13
+ headers?: Map<string, string[]>;
14
+ value?: string;
15
+ }
16
+ export interface FormPart {
17
+ type: 'file' | 'field';
18
+ name: string;
19
+ value?: string[];
20
+ headers?: Map<string, string[]>;
21
+ files?: FormPart[];
22
+ }
23
+ export declare function ExtractContentType(value: string): string;
24
+ export declare function IsJsonContentType(value: string): boolean;
25
+ export declare function IsFormEncoded(value: string): boolean;
26
+ export declare function IsXmlContentType(value: string): boolean;
27
+ export declare function IsOctectStreamContentType(value: string): boolean;
28
+ export declare function IsTextContentType(value: string): boolean;
29
+ export declare function IsHtmlContentType(value: string): boolean;
30
+ export declare function ExtractContentTypeFromRequest(request: HttpRequest): string;
31
+ export declare function ExtractFullContentTypeFromRequest(request: HttpRequest): string;
32
+ export declare function ExtractBoundaryFromFormEncodedContentType(contentType: string): string;
33
+ export declare function ExtractContentTypeFromResponse(response: HttpResponse): string;
34
+ export declare function ExtractFullContentTypeFromResponse(response: HttpResponse): string;
@@ -0,0 +1,78 @@
1
+ export const ContentTypeJSON = "application/json";
2
+ export const ContentTypeFormEncoded = "application/x-www-form-urlencoded";
3
+ export const ContentTypeXML = "application/xml";
4
+ export const ContentTypeMultipartForm = "multipart/form-data";
5
+ export const ContentTypeOctetStream = "application/octet-stream";
6
+ export const ContentTypeText = "text/plain";
7
+ export const ContentTypeHtml = "text/html";
8
+ export function ExtractContentType(value) {
9
+ return value.split(";")[0];
10
+ }
11
+ export function IsJsonContentType(value) {
12
+ const contentType = ExtractContentType(value);
13
+ return contentType === ContentTypeJSON;
14
+ }
15
+ export function IsFormEncoded(value) {
16
+ const contentType = ExtractContentType(value);
17
+ return contentType === ContentTypeFormEncoded;
18
+ }
19
+ export function IsXmlContentType(value) {
20
+ const contentType = ExtractContentType(value);
21
+ return contentType === ContentTypeXML;
22
+ }
23
+ export function IsOctectStreamContentType(value) {
24
+ const contentType = ExtractContentType(value);
25
+ return contentType === ContentTypeOctetStream;
26
+ }
27
+ export function IsTextContentType(value) {
28
+ const contentType = ExtractContentType(value);
29
+ return contentType === ContentTypeText;
30
+ }
31
+ export function IsHtmlContentType(value) {
32
+ const contentType = ExtractContentType(value);
33
+ return contentType === ContentTypeHtml;
34
+ }
35
+ export function ExtractContentTypeFromRequest(request) {
36
+ let contentType = request.headers["content-type"];
37
+ if (contentType) {
38
+ return contentType;
39
+ }
40
+ contentType = request.headers["Content-Type"];
41
+ if (contentType?.indexOf(";") > 0) {
42
+ contentType = contentType.split(";")[0];
43
+ }
44
+ return contentType;
45
+ }
46
+ export function ExtractFullContentTypeFromRequest(request) {
47
+ let contentType = request.headers["content-type"];
48
+ if (contentType) {
49
+ return contentType;
50
+ }
51
+ contentType = request.headers["Content-Type"];
52
+ return contentType;
53
+ }
54
+ export function ExtractBoundaryFromFormEncodedContentType(contentType) {
55
+ return contentType.split("boundary=")[1];
56
+ }
57
+ export function ExtractContentTypeFromResponse(response) {
58
+ let contentType = response.headers["content-type"];
59
+ if (contentType) {
60
+ return contentType;
61
+ }
62
+ contentType = response.headers["Content-Type"];
63
+ if (contentType && contentType.indexOf(";") > 0) {
64
+ contentType = contentType.split(";")[0];
65
+ }
66
+ return contentType;
67
+ }
68
+ export function ExtractFullContentTypeFromResponse(response) {
69
+ let contentType = response.headers["content-type"];
70
+ if (contentType) {
71
+ return contentType;
72
+ }
73
+ contentType = response.headers["Content-Type"];
74
+ if (contentType && contentType.indexOf(";") > 0) {
75
+ contentType = contentType.split(";")[0];
76
+ }
77
+ return contentType;
78
+ }
@@ -0,0 +1 @@
1
+ export declare function ExtractQueryString(queryString: string | undefined): Map<string, string>;
@@ -0,0 +1,11 @@
1
+ export function ExtractQueryString(queryString) {
2
+ const query = new Map();
3
+ if (queryString) {
4
+ const queryItems = queryString.split("&");
5
+ for (const item of queryItems) {
6
+ const keyValuePair = item.split("=");
7
+ query.set(decodeURI(keyValuePair[0]), decodeURI(keyValuePair[1]));
8
+ }
9
+ }
10
+ return query;
11
+ }
@@ -0,0 +1,78 @@
1
+ import { Filter, WiretapFilters } from "./controls";
2
+ export interface HttpCookie {
3
+ value?: string;
4
+ path?: string;
5
+ domain?: string;
6
+ expires?: string;
7
+ maxAge?: number;
8
+ secure?: boolean;
9
+ httpOnly?: boolean;
10
+ }
11
+ export interface SchemaValidationFailure {
12
+ reason?: string;
13
+ location?: string;
14
+ referenceSchema?: string;
15
+ referenceObject?: string;
16
+ line?: number;
17
+ column?: number;
18
+ }
19
+ export interface ValidationError {
20
+ message: string;
21
+ reason: string;
22
+ validationType: string;
23
+ validationSubType: string;
24
+ specLine: number;
25
+ specColumn: number;
26
+ howToFix: string;
27
+ validationErrors?: SchemaValidationFailure[];
28
+ context?: any;
29
+ }
30
+ export declare class HttpRequest {
31
+ url?: string;
32
+ method?: string;
33
+ path?: string;
34
+ host?: string;
35
+ query?: string;
36
+ headers?: any;
37
+ cookies?: any;
38
+ requestBody?: string;
39
+ timestamp?: number;
40
+ originalPath?: string;
41
+ droppedHeaders?: string[];
42
+ injectedHeaders?: any;
43
+ constructor();
44
+ extractHeaders(): Map<string, string>;
45
+ extractQuery(): Map<string, string>;
46
+ extractCookies(): Map<string, HttpCookie>;
47
+ checkContentType(contentType: string): boolean;
48
+ }
49
+ export declare class HttpResponse {
50
+ headers?: any;
51
+ cookies?: any;
52
+ statusCode?: number;
53
+ responseBody?: string;
54
+ timestamp?: number;
55
+ constructor();
56
+ extractHeaders(): Map<string, string>;
57
+ extractCookies(): Map<string, string>;
58
+ }
59
+ export declare class HttpTransactionBase {
60
+ id?: string;
61
+ timestamp?: number;
62
+ }
63
+ export interface HttpTransactionLink extends HttpTransactionBase {
64
+ queryString?: string;
65
+ }
66
+ export declare class HttpTransaction extends HttpTransactionBase {
67
+ delay?: number;
68
+ requestValidation?: ValidationError[];
69
+ httpResponse?: HttpResponse;
70
+ responseValidation?: ValidationError[];
71
+ containsChainLink?: boolean;
72
+ httpRequest?: HttpRequest;
73
+ constructor(timestamp?: number, delay?: number, httpRequest?: HttpRequest, httpResponse?: HttpResponse, id?: string, requestValidation?: ValidationError[], responseValidation?: ValidationError[], containsChainLink?: boolean);
74
+ matchesMethodFilter(filter: WiretapFilters): Filter | boolean;
75
+ matchesKeywordFilter(filter: WiretapFilters): Filter | boolean;
76
+ containsActiveLink(filter: WiretapFilters): Filter | boolean;
77
+ }
78
+ export declare function BuildLiveTransactionFromState(httpTransaction: HttpTransaction): HttpTransaction;