@pb33f/cowboy-components 0.3.4 → 0.4.0
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/dist/assets/css.worker-CTSQecos.js +84 -0
- package/dist/assets/editor.worker-CYC0jP-p.js +12 -0
- package/dist/assets/equalizer.worker-CdIiiqfH.js +1 -0
- package/dist/assets/html.worker-C1BIaUKh.js +461 -0
- package/dist/assets/json.worker-BCyBlh8h.js +49 -0
- package/dist/assets/rule-documentation.worker-B7xOWY5M.js +1 -0
- package/dist/components/credit-ticker/credit-ticker.css.d.ts +2 -0
- package/dist/components/credit-ticker/credit-ticker.css.js +36 -0
- package/dist/components/credit-ticker/credit-ticker.d.ts +14 -0
- package/dist/components/credit-ticker/credit-ticker.js +88 -0
- package/dist/components/editor/editor-breadcrumb.css.d.ts +2 -0
- package/dist/components/editor/editor-breadcrumb.css.js +49 -0
- package/dist/components/editor/editor-breadcrumb.d.ts +9 -0
- package/dist/components/editor/editor-breadcrumb.js +60 -0
- package/dist/components/editor/editor.css.d.ts +2 -0
- package/dist/components/editor/editor.css.js +62 -0
- package/dist/components/editor/editor.d.ts +25 -4
- package/dist/components/editor/editor.js +412 -76
- package/dist/components/manage-ruleset/manage-ruleset.css.js +5 -0
- package/dist/components/manage-ruleset/manage-ruleset.js +8 -6
- package/dist/components/model-icon/model-icon.d.ts +7 -0
- package/dist/components/model-icon/model-icon.js +56 -7
- package/dist/components/model-renderer/clickable-ref.d.ts +2 -2
- package/dist/components/model-renderer/clickable-ref.js +5 -4
- package/dist/components/model-renderer/header.js +10 -10
- package/dist/components/model-renderer/operation.js +2 -2
- package/dist/components/model-renderer/rendered-node.css.js +1 -1
- package/dist/components/model-renderer/schema.js +1 -1
- package/dist/components/model-tree/tree.css.js +1 -0
- package/dist/components/model-tree/tree.d.ts +8 -0
- package/dist/components/model-tree/tree.js +232 -24
- package/dist/components/paginator/paginator.css.js +6 -2
- package/dist/components/paginator/paginator.d.ts +1 -0
- package/dist/components/paginator/paginator.js +8 -4
- package/dist/components/problem-list/details-drawer.css.js +1 -1
- package/dist/components/problem-list/problem-item.js +6 -3
- package/dist/components/problem-list/problem-label-view-filter.d.ts +2 -1
- package/dist/components/problem-list/problem-label-view-filter.js +1 -0
- package/dist/components/problem-list/problem-list.d.ts +1 -0
- package/dist/components/problem-list/problem-list.js +19 -1
- package/dist/components/problem-list/problem-mainview.css.js +1 -1
- package/dist/components/problem-list/problem-mainview.js +6 -0
- package/dist/components/problem-list/problem-sort-filter.d.ts +2 -1
- package/dist/components/problem-list/problem-sort-filter.js +1 -0
- package/dist/components/problems-overview/diagnostic-evaluation.css.js +14 -4
- package/dist/components/problems-overview/diagnostic-evaluation.js +42 -1
- package/dist/components/problems-overview/problems-overview.css.js +1 -0
- package/dist/components/the-doctor/nuke-workspace.d.ts +13 -0
- package/dist/components/the-doctor/nuke-workspace.js +70 -0
- package/dist/components/the-doctor/sparks.d.ts +1 -0
- package/dist/components/the-doctor/sparks.js +11 -2
- package/dist/components/the-doctor/status-bar.css.js +6 -5
- package/dist/components/the-doctor/the-doctor.css.js +117 -16
- package/dist/components/the-doctor/the-doctor.d.ts +70 -21
- package/dist/components/the-doctor/the-doctor.js +1026 -169
- package/dist/components/the-doctor/upload-archive.css.d.ts +2 -0
- package/dist/components/the-doctor/upload-archive.css.js +98 -0
- package/dist/components/the-doctor/upload-archive.d.ts +33 -0
- package/dist/components/the-doctor/upload-archive.js +281 -0
- package/dist/components/visualizer/equalizer.d.ts +3 -1
- package/dist/components/visualizer/equalizer.js +55 -31
- package/dist/components/visualizer/explorer.js +6 -5
- package/dist/cowboy-components.umd.cjs +1846 -1273
- package/dist/css/hr.css.d.ts +2 -0
- package/dist/css/hr.css.js +12 -0
- package/dist/css/pb33f-theme.css +1 -0
- package/dist/events/doctor.d.ts +19 -1
- package/dist/events/doctor.js +5 -0
- package/dist/model/channels.d.ts +1 -0
- package/dist/model/channels.js +1 -0
- package/dist/model/graph.d.ts +17 -0
- package/dist/model/graph.js +17 -1
- package/dist/model/link.d.ts +8 -0
- package/dist/model/node_type.d.ts +22 -1
- package/dist/model/node_type.js +22 -0
- package/dist/model/panel-state.d.ts +5 -0
- package/dist/model/panel-state.js +1 -0
- package/dist/model/problem.d.ts +3 -1
- package/dist/model/problem.js +4 -2
- package/dist/model/rolodex.d.ts +34 -0
- package/dist/model/rolodex.js +1 -0
- package/dist/services/linting-service.d.ts +1 -1
- package/dist/services/linting-service.js +23 -11
- package/dist/services/model-service.d.ts +8 -1
- package/dist/services/model-service.js +127 -0
- package/dist/style.css +1 -1
- package/dist/workers/equalizer.worker.js +4 -3
- package/dist/workers/rule-documentation.worker.d.ts +2 -2
- package/dist/workers/rule-documentation.worker.js +26 -15
- package/package.json +3 -3
- package/dist/assets/css.worker-B_qZXUzt.js +0 -84
- package/dist/assets/editor.worker-HEmB0D7P.js +0 -11
- package/dist/assets/equalizer.worker-icLzyXQ7.js +0 -1
- package/dist/assets/html.worker-D3WUrk8Q.js +0 -458
- package/dist/assets/json.worker-CAhUaBo4.js +0 -42
- package/dist/assets/rule-documentation.worker-D39NS8Lx.js +0 -1
package/dist/css/pb33f-theme.css
CHANGED
|
@@ -72,6 +72,7 @@ html {
|
|
|
72
72
|
--font-color-sub1: #a7a7a7;
|
|
73
73
|
--font-color-sub2: #787878;
|
|
74
74
|
--font-color-sub3: #585858;
|
|
75
|
+
--font-color-sub4: #2f2f2f;
|
|
75
76
|
--secondary-color: #f83aff;
|
|
76
77
|
--secondary-color-dimmer: rgba(248, 58, 255, 0.45);
|
|
77
78
|
--secondary-color-text-shadow: rgba(250, 113, 251, 0.5);
|
package/dist/events/doctor.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export declare const AddToast: string;
|
|
|
30
30
|
export declare const ToastExpired: string;
|
|
31
31
|
export declare const MessageEvent: string;
|
|
32
32
|
export declare const ModelTreeNodeClicked: string;
|
|
33
|
+
export declare const RolodexTreeNodeClicked: string;
|
|
34
|
+
export declare const RolodexRootFileSelected: string;
|
|
33
35
|
export declare const ExplorerNodeClicked: string;
|
|
34
36
|
export declare const NodeReferenceClicked: string;
|
|
35
37
|
export declare const GenerateMockFromSchema: string;
|
|
@@ -44,6 +46,12 @@ export declare const ExplorerKeyClose: string;
|
|
|
44
46
|
export declare const ExplorerEqualizerChanged: string;
|
|
45
47
|
export declare const ExplorerEqualizerFiltered: string;
|
|
46
48
|
export declare const ExplorerDependentNodeClicked: string;
|
|
49
|
+
export declare const ArchiveURLRequested: string;
|
|
50
|
+
export declare const DocumentReferenceClicked: string;
|
|
51
|
+
export declare const NukeWorkspaceEvent: string;
|
|
52
|
+
export interface ArchiveURLRequestedEvent {
|
|
53
|
+
url: string;
|
|
54
|
+
}
|
|
47
55
|
export interface ExplorerDependentNodeClickedEvent {
|
|
48
56
|
node: Node;
|
|
49
57
|
collapse: boolean;
|
|
@@ -54,13 +62,21 @@ export interface ExplorerEqualizerChangedEvent {
|
|
|
54
62
|
references?: References;
|
|
55
63
|
options?: Options;
|
|
56
64
|
}
|
|
65
|
+
export interface DocumentReference {
|
|
66
|
+
jsonPath: string;
|
|
67
|
+
noState?: boolean;
|
|
68
|
+
}
|
|
57
69
|
export interface NodeReferenceEvent {
|
|
58
70
|
nodePath: string;
|
|
59
71
|
}
|
|
60
72
|
export interface NodeClickedEvent {
|
|
61
|
-
nodeHashId
|
|
73
|
+
nodeHashId?: string;
|
|
62
74
|
first?: boolean;
|
|
75
|
+
content?: string;
|
|
76
|
+
path?: string;
|
|
63
77
|
noState?: boolean;
|
|
78
|
+
line?: number;
|
|
79
|
+
column?: number;
|
|
64
80
|
}
|
|
65
81
|
export interface ProblemLabelViewFilterChangedEvent {
|
|
66
82
|
label: string;
|
|
@@ -81,6 +97,7 @@ export interface MainViewSlideChangedEvent {
|
|
|
81
97
|
export interface EditorUpdatedEvent {
|
|
82
98
|
content: string;
|
|
83
99
|
id: string;
|
|
100
|
+
path?: string;
|
|
84
101
|
}
|
|
85
102
|
export interface CustomRulesetEnabledEvent {
|
|
86
103
|
rules: RuleComponent[];
|
|
@@ -144,4 +161,5 @@ export interface HistoryState {
|
|
|
144
161
|
page: number;
|
|
145
162
|
view: ActiveView;
|
|
146
163
|
activeNode: string;
|
|
164
|
+
ref: string;
|
|
147
165
|
}
|
package/dist/events/doctor.js
CHANGED
|
@@ -24,6 +24,8 @@ export const AddToast = "addToast";
|
|
|
24
24
|
export const ToastExpired = "toastExpired";
|
|
25
25
|
export const MessageEvent = "message";
|
|
26
26
|
export const ModelTreeNodeClicked = "modelTreeNodeClicked";
|
|
27
|
+
export const RolodexTreeNodeClicked = "rolodexNodeClicked";
|
|
28
|
+
export const RolodexRootFileSelected = "rolodexRootFileSelected";
|
|
27
29
|
export const ExplorerNodeClicked = "explorerNodeClicked";
|
|
28
30
|
export const NodeReferenceClicked = "nodeReferenceClicked";
|
|
29
31
|
export const GenerateMockFromSchema = "generateMockFromSchema";
|
|
@@ -38,6 +40,9 @@ export const ExplorerKeyClose = "explorerKeyClose";
|
|
|
38
40
|
export const ExplorerEqualizerChanged = "explorerEqualizerChanged";
|
|
39
41
|
export const ExplorerEqualizerFiltered = "explorerEqualizerFiltered";
|
|
40
42
|
export const ExplorerDependentNodeClicked = "explorerDependentNodeClicked";
|
|
43
|
+
export const ArchiveURLRequested = "archiveURLRequested";
|
|
44
|
+
export const DocumentReferenceClicked = "documentReferenceClicked";
|
|
45
|
+
export const NukeWorkspaceEvent = "nukeWorkspace";
|
|
41
46
|
export var ActiveView;
|
|
42
47
|
(function (ActiveView) {
|
|
43
48
|
ActiveView["Problems"] = "problems";
|
package/dist/model/channels.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const DoctorServiceChannel = "doctor-service";
|
|
2
2
|
export declare const SpecStreamChannel = "spec-stream";
|
|
3
|
+
export declare const CreditStreamChannel = "credit-stream";
|
|
3
4
|
export declare const TopicPrefix = "/t/";
|
|
4
5
|
export declare const QueuePrefix = "/q/";
|
|
5
6
|
export declare function isBrokerResponse(obj: any): obj is BrokerResponse;
|
package/dist/model/channels.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const DoctorServiceChannel = "doctor-service";
|
|
2
2
|
export const SpecStreamChannel = "spec-stream";
|
|
3
|
+
export const CreditStreamChannel = "credit-stream";
|
|
3
4
|
export const TopicPrefix = "/t/";
|
|
4
5
|
export const QueuePrefix = "/q/";
|
|
5
6
|
export function isBrokerResponse(obj) {
|
package/dist/model/graph.d.ts
CHANGED
|
@@ -33,6 +33,9 @@ export interface Node {
|
|
|
33
33
|
isPoly?: boolean;
|
|
34
34
|
searchMatch?: string;
|
|
35
35
|
searchKey?: string;
|
|
36
|
+
openapi?: boolean;
|
|
37
|
+
origin?: string;
|
|
38
|
+
path?: string;
|
|
36
39
|
}
|
|
37
40
|
export interface Edge {
|
|
38
41
|
id: string;
|
|
@@ -71,6 +74,7 @@ export interface GraphResponse {
|
|
|
71
74
|
};
|
|
72
75
|
stripped?: boolean;
|
|
73
76
|
strippedCount?: number;
|
|
77
|
+
rebuild?: boolean;
|
|
74
78
|
}
|
|
75
79
|
export interface VacuumResult {
|
|
76
80
|
message: string;
|
|
@@ -78,3 +82,16 @@ export interface VacuumResult {
|
|
|
78
82
|
ruleId: string;
|
|
79
83
|
ruleSeverity: string;
|
|
80
84
|
}
|
|
85
|
+
export interface Reference {
|
|
86
|
+
definition: string;
|
|
87
|
+
fullDefinition: string;
|
|
88
|
+
targetLine: number;
|
|
89
|
+
targetColumn: number;
|
|
90
|
+
jsonPath: string;
|
|
91
|
+
line: number;
|
|
92
|
+
startColumn: number;
|
|
93
|
+
endColumn: number;
|
|
94
|
+
isPolymorphic: boolean;
|
|
95
|
+
rolodexIdHash?: string;
|
|
96
|
+
}
|
|
97
|
+
export declare function SearchNodeTreeForPath(node: Node, path: string): Node | null;
|
package/dist/model/graph.js
CHANGED
|
@@ -1 +1,17 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export function SearchNodeTreeForPath(node, path) {
|
|
2
|
+
if (!node) {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
if (node.path === path) {
|
|
6
|
+
return node;
|
|
7
|
+
}
|
|
8
|
+
if (node.nodes && node.nodes.length > 0) {
|
|
9
|
+
for (let n of node.nodes) {
|
|
10
|
+
let found = SearchNodeTreeForPath(n, path);
|
|
11
|
+
if (found) {
|
|
12
|
+
return found;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
package/dist/model/link.d.ts
CHANGED
|
@@ -45,5 +45,26 @@ export declare enum NodeType {
|
|
|
45
45
|
POLYMORPHIC = "polymorphic",
|
|
46
46
|
ERROR = "error",
|
|
47
47
|
WARNING = "warning",
|
|
48
|
-
|
|
48
|
+
ROLODEX_FILE = "rolodex-file",
|
|
49
|
+
ROLODEX_FOLDER = "rolodex-dir",
|
|
50
|
+
OPENAPI = "openapi",
|
|
51
|
+
UPLOAD = "upload",
|
|
52
|
+
ADD = "add",
|
|
53
|
+
UNKNOWN = "unknown",
|
|
54
|
+
JS = "js",
|
|
55
|
+
GO = "go",
|
|
56
|
+
TS = "ts",
|
|
57
|
+
CS = "cs",
|
|
58
|
+
C = "c",
|
|
59
|
+
CPP = "cpp",
|
|
60
|
+
PHP = "php",
|
|
61
|
+
PY = "py",
|
|
62
|
+
HTML = "html",
|
|
63
|
+
MD = "md",
|
|
64
|
+
JAVA = "java",
|
|
65
|
+
RS = "rs",
|
|
66
|
+
ZIG = "zig",
|
|
67
|
+
RB = "rb",
|
|
68
|
+
YAML = "yaml",
|
|
69
|
+
JSON = "json"
|
|
49
70
|
}
|
package/dist/model/node_type.js
CHANGED
|
@@ -46,5 +46,27 @@ export var NodeType;
|
|
|
46
46
|
NodeType["POLYMORPHIC"] = "polymorphic";
|
|
47
47
|
NodeType["ERROR"] = "error";
|
|
48
48
|
NodeType["WARNING"] = "warning";
|
|
49
|
+
NodeType["ROLODEX_FILE"] = "rolodex-file";
|
|
50
|
+
NodeType["ROLODEX_FOLDER"] = "rolodex-dir";
|
|
51
|
+
NodeType["OPENAPI"] = "openapi";
|
|
52
|
+
NodeType["UPLOAD"] = "upload";
|
|
53
|
+
NodeType["ADD"] = "add";
|
|
49
54
|
NodeType["UNKNOWN"] = "unknown";
|
|
55
|
+
NodeType["JS"] = "js";
|
|
56
|
+
NodeType["GO"] = "go";
|
|
57
|
+
NodeType["TS"] = "ts";
|
|
58
|
+
NodeType["CS"] = "cs";
|
|
59
|
+
NodeType["C"] = "c";
|
|
60
|
+
NodeType["CPP"] = "cpp";
|
|
61
|
+
NodeType["PHP"] = "php";
|
|
62
|
+
NodeType["PY"] = "py";
|
|
63
|
+
NodeType["HTML"] = "html";
|
|
64
|
+
NodeType["MD"] = "md";
|
|
65
|
+
NodeType["JAVA"] = "java";
|
|
66
|
+
NodeType["RS"] = "rs";
|
|
67
|
+
NodeType["ZIG"] = "zig";
|
|
68
|
+
NodeType["RB"] = "rb";
|
|
69
|
+
NodeType["YAML"] = "yaml";
|
|
70
|
+
NodeType["JSON"] = "json";
|
|
71
|
+
//case YAML, JSON, JS, GO, TS, CS, C, CPP, PHP, PY, HTML, MD, JAVA, RS, ZIG, RB:
|
|
50
72
|
})(NodeType || (NodeType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/model/problem.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { MarkerSeverity } from "monaco-editor";
|
|
|
3
3
|
export declare class Problem implements monaco.editor.IMarkerData {
|
|
4
4
|
category: string;
|
|
5
5
|
jsonPath: string;
|
|
6
|
+
jsonPaths: string[];
|
|
6
7
|
endColumn: number;
|
|
7
8
|
endLineNumber: number;
|
|
8
9
|
message: string;
|
|
@@ -11,8 +12,9 @@ export declare class Problem implements monaco.editor.IMarkerData {
|
|
|
11
12
|
startLineNumber: number;
|
|
12
13
|
source: string;
|
|
13
14
|
id: string;
|
|
15
|
+
sourceLocation: string;
|
|
14
16
|
static reconstruct(problem: Problem): Problem;
|
|
15
|
-
constructor(category: string, jsonPath: string, endColumn: number, endLineNumber: number, message: string, severity: MarkerSeverity, startColumn: number, startLineNumber: number, source: string, id: string);
|
|
17
|
+
constructor(category: string, jsonPath: string, endColumn: number, endLineNumber: number, message: string, severity: MarkerSeverity, startColumn: number, startLineNumber: number, source: string, id: string, sourceLocation?: string, jsonPaths?: string[]);
|
|
16
18
|
hash(): string;
|
|
17
19
|
}
|
|
18
20
|
export declare function getProblemClass(problem: Problem): string;
|
package/dist/model/problem.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as monaco from "monaco-editor";
|
|
2
2
|
export class Problem {
|
|
3
3
|
static reconstruct(problem) {
|
|
4
|
-
return new Problem(problem.category, problem.jsonPath, problem.endColumn, problem.endLineNumber, problem.message, problem.severity, problem.startColumn, problem.startLineNumber, problem.source, problem.id);
|
|
4
|
+
return new Problem(problem.category, problem.jsonPath, problem.endColumn, problem.endLineNumber, problem.message, problem.severity, problem.startColumn, problem.startLineNumber, problem.source, problem.id, problem.sourceLocation, problem.jsonPaths);
|
|
5
5
|
}
|
|
6
|
-
constructor(category, jsonPath, endColumn, endLineNumber, message, severity, startColumn, startLineNumber, source, id) {
|
|
6
|
+
constructor(category, jsonPath, endColumn, endLineNumber, message, severity, startColumn, startLineNumber, source, id, sourceLocation = '', jsonPaths = []) {
|
|
7
7
|
this.category = category;
|
|
8
8
|
this.jsonPath = jsonPath;
|
|
9
9
|
this.endColumn = endColumn;
|
|
@@ -14,6 +14,8 @@ export class Problem {
|
|
|
14
14
|
this.startLineNumber = startLineNumber;
|
|
15
15
|
this.source = source;
|
|
16
16
|
this.id = id;
|
|
17
|
+
this.sourceLocation = sourceLocation;
|
|
18
|
+
this.jsonPaths = jsonPaths;
|
|
17
19
|
if (this.startLineNumber === 0) {
|
|
18
20
|
this.startLineNumber = 1;
|
|
19
21
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DocumentStatistics } from "./document-statistics";
|
|
2
|
+
import { Node, Reference } from "./graph";
|
|
3
|
+
export interface RolodexResponse {
|
|
4
|
+
rolodexRoot: Node;
|
|
5
|
+
statistics: DocumentStatistics;
|
|
6
|
+
}
|
|
7
|
+
export interface ArchiveFileResponse {
|
|
8
|
+
files: FileMeta[];
|
|
9
|
+
}
|
|
10
|
+
export interface FileMeta {
|
|
11
|
+
name: string;
|
|
12
|
+
isOpenAPI?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface RolodexFile {
|
|
15
|
+
content: string;
|
|
16
|
+
}
|
|
17
|
+
export interface RolodexFiles {
|
|
18
|
+
files: {
|
|
19
|
+
[path: string]: Node;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface ReferenceMap {
|
|
23
|
+
references: {
|
|
24
|
+
[path: string]: Reference[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface RolodexState {
|
|
28
|
+
activePath?: string;
|
|
29
|
+
activeHash?: string;
|
|
30
|
+
activeLanguage?: string;
|
|
31
|
+
activeNode?: Node;
|
|
32
|
+
rootHash?: string;
|
|
33
|
+
rootPath?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { Session } from "../model/session.js";
|
|
|
5
5
|
export declare class LintingService {
|
|
6
6
|
static doctorEndpoint: string;
|
|
7
7
|
static compareProblems(a: Problem, b: Problem): number;
|
|
8
|
-
static lintFile(file: string, brokerId?: string, url?: string): Promise<Problem[]>;
|
|
8
|
+
static lintFile(file: string, brokerId?: string, url?: string, currentPath?: string): Promise<Problem[]>;
|
|
9
9
|
static fetchAllHowToFix(): Promise<HowToFix[]>;
|
|
10
10
|
static fetchStatistics(): Promise<DrDiagnostics>;
|
|
11
11
|
static startSession(): Promise<Session>;
|
|
@@ -19,18 +19,28 @@ export class LintingService {
|
|
|
19
19
|
}
|
|
20
20
|
return 0;
|
|
21
21
|
}
|
|
22
|
-
static async lintFile(file, brokerId, url) {
|
|
22
|
+
static async lintFile(file, brokerId, url, currentPath) {
|
|
23
23
|
return new Promise(async (resolve, reject) => {
|
|
24
24
|
try {
|
|
25
25
|
const headers = HeaderService.buildDefaultHeaders(brokerId);
|
|
26
26
|
let lintResults;
|
|
27
27
|
if (!url) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
if (currentPath) {
|
|
29
|
+
lintResults = await fetch(LintingService.doctorEndpoint + '/lint-lsp?currentPath=' + encodeURIComponent(currentPath), {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
credentials: 'include',
|
|
32
|
+
headers: headers,
|
|
33
|
+
body: file
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
lintResults = await fetch(LintingService.doctorEndpoint + '/lint-lsp', {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
credentials: 'include',
|
|
40
|
+
headers: headers,
|
|
41
|
+
body: file
|
|
42
|
+
});
|
|
43
|
+
}
|
|
34
44
|
}
|
|
35
45
|
else {
|
|
36
46
|
lintResults = await fetch(LintingService.doctorEndpoint + '/lint-lsp?url=' + encodeURIComponent(url), {
|
|
@@ -53,12 +63,12 @@ export class LintingService {
|
|
|
53
63
|
if (lintData && Array.isArray(lintData)) {
|
|
54
64
|
for (let i = 0; i < lintData.length; i++) {
|
|
55
65
|
const problem = lintData[i];
|
|
56
|
-
constructedProblems.push(new Problem(problem.category, problem.jsonPath, problem.endColumn, problem.endLineNumber, problem.message, problem.severity, problem.startColumn, problem.startLineNumber, problem.source, problem.id));
|
|
66
|
+
constructedProblems.push(new Problem(problem.category, problem.jsonPath, problem.endColumn, problem.endLineNumber, problem.message, problem.severity, problem.startColumn, problem.startLineNumber, problem.source, problem.id, problem.sourceLocation));
|
|
57
67
|
}
|
|
58
68
|
}
|
|
59
69
|
if (lintData && !Array.isArray(lintData)) {
|
|
60
70
|
const problem = lintData;
|
|
61
|
-
constructedProblems.push(new Problem(problem.category, problem.jsonPath, problem.endColumn, problem.endLineNumber, problem.message, problem.severity, problem.startColumn, problem.startLineNumber, problem.source, problem.id));
|
|
71
|
+
constructedProblems.push(new Problem(problem.category, problem.jsonPath, problem.endColumn, problem.endLineNumber, problem.message, problem.severity, problem.startColumn, problem.startLineNumber, problem.source, problem.id, problem.sourceLocation));
|
|
62
72
|
}
|
|
63
73
|
constructedProblems.sort(LintingService.compareProblems);
|
|
64
74
|
resolve(constructedProblems);
|
|
@@ -82,8 +92,10 @@ export class LintingService {
|
|
|
82
92
|
resolve(howToFix);
|
|
83
93
|
}
|
|
84
94
|
catch (e) {
|
|
85
|
-
reject({
|
|
86
|
-
|
|
95
|
+
reject({
|
|
96
|
+
tile: "platform error", detail: "the pb33f platform is unresponsive, " +
|
|
97
|
+
"please try again later."
|
|
98
|
+
});
|
|
87
99
|
}
|
|
88
100
|
});
|
|
89
101
|
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { GraphResponse } from "../model/graph";
|
|
1
|
+
import { GraphResponse, Reference } from "../model/graph";
|
|
2
2
|
import { ExampleContainer } from "../model/example";
|
|
3
|
+
import { Node } from "../model/graph";
|
|
4
|
+
import { ArchiveFileResponse, RolodexResponse } from "../model/rolodex";
|
|
3
5
|
export declare class ModelService {
|
|
4
6
|
static doctorEndpoint: string;
|
|
5
7
|
static createGraph(spec?: string): Promise<GraphResponse>;
|
|
8
|
+
static fetchReferenceMap(): Promise<Reference[]>;
|
|
9
|
+
static uploadArchive(formData: FormData): Promise<ArchiveFileResponse>;
|
|
10
|
+
static selectRootPath(path: string): Promise<Node>;
|
|
11
|
+
static queryRolodex(id?: string, path?: string): Promise<RolodexResponse>;
|
|
6
12
|
static generateMock(spec?: string): Promise<any>;
|
|
7
13
|
static generateExample(example: ExampleContainer): Promise<ExampleContainer>;
|
|
8
14
|
static convertJSONToYAML(json?: string): Promise<any>;
|
|
15
|
+
static resetWorkspace(): Promise<boolean>;
|
|
9
16
|
}
|
|
@@ -26,6 +26,121 @@ export class ModelService {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
+
static async fetchReferenceMap() {
|
|
30
|
+
return new Promise(async (resolve, reject) => {
|
|
31
|
+
try {
|
|
32
|
+
const graph = await fetch(ModelService.doctorEndpoint + '/model/reference-map', {
|
|
33
|
+
method: 'GET',
|
|
34
|
+
credentials: 'include',
|
|
35
|
+
headers: {
|
|
36
|
+
'Content-Type': 'application/json'
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const referenceMap = await graph.json();
|
|
40
|
+
if (!referenceMap) {
|
|
41
|
+
reject({ detail: 'unable to fetch reference map' });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (referenceMap?.type && referenceMap?.title && referenceMap?.status) {
|
|
45
|
+
reject(referenceMap);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
resolve(referenceMap);
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
reject({ detail: 'unable fetch model graph: ' + e });
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
static async uploadArchive(formData) {
|
|
56
|
+
return new Promise(async (resolve, reject) => {
|
|
57
|
+
try {
|
|
58
|
+
const graph = await fetch(ModelService.doctorEndpoint + '/model/upload-archive', {
|
|
59
|
+
method: 'POST',
|
|
60
|
+
credentials: 'include',
|
|
61
|
+
body: formData,
|
|
62
|
+
});
|
|
63
|
+
const archiveData = await graph.json();
|
|
64
|
+
if (!archiveData) {
|
|
65
|
+
reject({ detail: 'unable to fetch archive data' });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (archiveData?.type && archiveData?.title && archiveData?.status) {
|
|
69
|
+
reject(archiveData);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
resolve(archiveData);
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
reject({ detail: 'unable fetch archive data: ' + e });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
static async selectRootPath(path) {
|
|
80
|
+
return new Promise(async (resolve, reject) => {
|
|
81
|
+
try {
|
|
82
|
+
const graph = await fetch(ModelService.doctorEndpoint + '/model/select-root', {
|
|
83
|
+
method: 'POST',
|
|
84
|
+
credentials: 'include',
|
|
85
|
+
headers: {
|
|
86
|
+
'Content-Type': 'application/json'
|
|
87
|
+
},
|
|
88
|
+
body: JSON.stringify({ rolodexRoot: path }),
|
|
89
|
+
});
|
|
90
|
+
const archiveData = await graph.json();
|
|
91
|
+
if (!archiveData) {
|
|
92
|
+
reject({ detail: 'unable to fetch archive data' });
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (archiveData?.type && archiveData?.title && archiveData?.status) {
|
|
96
|
+
reject(archiveData);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
resolve(await archiveData);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
reject({ detail: 'unable fetch archive data: ' + e });
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
static async queryRolodex(id, path = '') {
|
|
107
|
+
return new Promise(async (resolve, reject) => {
|
|
108
|
+
try {
|
|
109
|
+
let query = '';
|
|
110
|
+
if (id)
|
|
111
|
+
query = '?id=' + id;
|
|
112
|
+
if (path != '') {
|
|
113
|
+
if (query == '') {
|
|
114
|
+
query += '?';
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
query += '&';
|
|
118
|
+
}
|
|
119
|
+
query += 'path=' + encodeURIComponent(path);
|
|
120
|
+
}
|
|
121
|
+
const graph = await fetch(ModelService.doctorEndpoint + '/model/rolodex' + query, {
|
|
122
|
+
method: 'GET',
|
|
123
|
+
credentials: 'include',
|
|
124
|
+
headers: {
|
|
125
|
+
'Content-Type': 'application/json'
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
const rolodexData = await graph.json();
|
|
129
|
+
if (!rolodexData) {
|
|
130
|
+
reject({ detail: 'unable to fetch model rolodex' });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (rolodexData?.type && rolodexData?.title && rolodexData?.status) {
|
|
134
|
+
reject(rolodexData);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
resolve(rolodexData);
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
reject({ detail: 'unable fetch model rolodex: ' + e });
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
29
144
|
static async generateMock(spec = '') {
|
|
30
145
|
return new Promise(async (resolve, reject) => {
|
|
31
146
|
try {
|
|
@@ -110,5 +225,17 @@ export class ModelService {
|
|
|
110
225
|
}
|
|
111
226
|
});
|
|
112
227
|
}
|
|
228
|
+
static async resetWorkspace() {
|
|
229
|
+
return new Promise(async (resolve) => {
|
|
230
|
+
const reset = await fetch(ModelService.doctorEndpoint + '/model/reset-workspace', {
|
|
231
|
+
method: 'GET',
|
|
232
|
+
credentials: 'include',
|
|
233
|
+
headers: {
|
|
234
|
+
'Content-Type': 'application/json'
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
resolve(true);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
113
240
|
}
|
|
114
241
|
ModelService.doctorEndpoint = 'https://doctor.pb33f.io';
|