@draftt-io/draftt-mcp 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +117 -0
- package/dist/api/client.d.ts +20 -0
- package/dist/api/client.js +93 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/drafttClient.d.ts +20 -0
- package/dist/api/drafttClient.js +90 -0
- package/dist/api/drafttClient.js.map +1 -0
- package/dist/api/responseFormatter.d.ts +13 -0
- package/dist/api/responseFormatter.js +21 -0
- package/dist/api/responseFormatter.js.map +1 -0
- package/dist/drafttClient.d.ts +17 -0
- package/dist/drafttClient.js +187 -0
- package/dist/drafttClient.js.map +1 -0
- package/dist/handlers/componentHandler.d.ts +18 -0
- package/dist/handlers/componentHandler.js +46 -0
- package/dist/handlers/componentHandler.js.map +1 -0
- package/dist/handlers/drafttHandler.d.ts +12 -0
- package/dist/handlers/drafttHandler.js +31 -0
- package/dist/handlers/drafttHandler.js.map +1 -0
- package/dist/handlers/policyHandler.d.ts +31 -0
- package/dist/handlers/policyHandler.js +85 -0
- package/dist/handlers/policyHandler.js.map +1 -0
- package/dist/helpers/constants.d.ts +31 -0
- package/dist/helpers/constants.js +37 -0
- package/dist/helpers/constants.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/component.d.ts +60 -0
- package/dist/interfaces/component.js +3 -0
- package/dist/interfaces/component.js.map +1 -0
- package/dist/interfaces/draftt.d.ts +3 -0
- package/dist/interfaces/draftt.js +3 -0
- package/dist/interfaces/draftt.js.map +1 -0
- package/dist/interfaces/policy.d.ts +21 -0
- package/dist/interfaces/policy.js +3 -0
- package/dist/interfaces/policy.js.map +1 -0
- package/dist/models/component.d.ts +60 -0
- package/dist/models/component.js +3 -0
- package/dist/models/component.js.map +1 -0
- package/dist/models/draftt.d.ts +3 -0
- package/dist/models/draftt.js +3 -0
- package/dist/models/draftt.js.map +1 -0
- package/dist/models/policy.d.ts +21 -0
- package/dist/models/policy.js +3 -0
- package/dist/models/policy.js.map +1 -0
- package/dist/schemas/componentSchema.d.ts +278 -0
- package/dist/schemas/componentSchema.js +87 -0
- package/dist/schemas/componentSchema.js.map +1 -0
- package/dist/schemas/drafttSchema.d.ts +4 -0
- package/dist/schemas/drafttSchema.js +8 -0
- package/dist/schemas/drafttSchema.js.map +1 -0
- package/dist/schemas/policySchema.d.ts +100 -0
- package/dist/schemas/policySchema.js +33 -0
- package/dist/schemas/policySchema.js.map +1 -0
- package/dist/tools.d.ts +6 -0
- package/dist/tools.js +277 -0
- package/dist/tools.js.map +1 -0
- package/dist/utils/constants.d.ts +31 -0
- package/dist/utils/constants.js +37 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.js +52 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DrafttClient = void 0;
|
|
4
|
+
class DrafttClient {
|
|
5
|
+
constructor(logger, accessKey) {
|
|
6
|
+
this.accessKey = accessKey;
|
|
7
|
+
this.baseUrl = "https://api.dev.internal.draftt.io/api/v1";
|
|
8
|
+
this.logger = logger;
|
|
9
|
+
// Use environment variables if not provided as constructor arguments
|
|
10
|
+
this.accessKey = accessKey || process.env.DRAFTT_ACCESS_KEY;
|
|
11
|
+
if (!this.accessKey) {
|
|
12
|
+
throw new Error("Access key is required for authentication");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
getHeaders() {
|
|
16
|
+
return {
|
|
17
|
+
Authorization: `Bearer ${this.accessKey}`,
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async componentSearch(args) {
|
|
22
|
+
try {
|
|
23
|
+
const response = await fetch(`${this.baseUrl}/component/search`, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: this.getHeaders(),
|
|
26
|
+
body: JSON.stringify({
|
|
27
|
+
size: args.pageSize || 50,
|
|
28
|
+
// Only include parameters in the request if they are provided
|
|
29
|
+
...(args.integrationId ? { integrationId: args.integrationId } : {}),
|
|
30
|
+
...(args.uniqueIdentifier ? { uniqueIdentifier: args.uniqueIdentifier } : {}),
|
|
31
|
+
...(args.region ? { region: args.region } : {}),
|
|
32
|
+
...(args.technology ? { technology: args.technology } : {}),
|
|
33
|
+
...(args.type ? { type: args.type } : {}),
|
|
34
|
+
...(args.version ? { version: args.version } : {}),
|
|
35
|
+
...(args.tags ? { tags: args.tags } : {}),
|
|
36
|
+
...(args.createdAt ? { createdAt: args.createdAt } : {}),
|
|
37
|
+
...(args.updatedAt ? { updatedAt: args.updatedAt } : {}),
|
|
38
|
+
...(args.sort ? { sort: args.sort } : {}),
|
|
39
|
+
...(args.nextToken ? { nextToken: args.nextToken } : {}),
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
if (response.status === 401) {
|
|
44
|
+
this.logger.info("Unauthorized. Please check your access key and try again...");
|
|
45
|
+
}
|
|
46
|
+
const errorText = await response.text();
|
|
47
|
+
throw new Error(`Inventory query failed: ${response.status} ${errorText}`);
|
|
48
|
+
}
|
|
49
|
+
this.logger.info("Inventory query successful");
|
|
50
|
+
return await response.json();
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
this.logger.error("Inventory error:", error);
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async componentGet(args) {
|
|
58
|
+
try {
|
|
59
|
+
const response = await fetch(`${this.baseUrl}/component/${args.componentId}`, {
|
|
60
|
+
method: "GET",
|
|
61
|
+
headers: this.getHeaders(),
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
if (response.status === 401) {
|
|
65
|
+
this.logger.info("Unauthorized. Please check your access key and try again...");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
this.logger.error("Component get error:", error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async policySearch(args) {
|
|
75
|
+
try {
|
|
76
|
+
const response = await fetch(`${this.baseUrl}/policy/search`, {
|
|
77
|
+
method: "POST",
|
|
78
|
+
headers: this.getHeaders(),
|
|
79
|
+
body: JSON.stringify({
|
|
80
|
+
...(args.filter ? { filter: args.filter } : {}),
|
|
81
|
+
...(args.sort ? { sort: args.sort } : {}),
|
|
82
|
+
...(args.nextToken ? { nextToken: args.nextToken } : {}),
|
|
83
|
+
...(args.pageSize ? { pageSize: args.pageSize } : {}),
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
if (response.status === 401) {
|
|
88
|
+
this.logger.info("Unauthorized. Please check your access key and try again...");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
this.logger.error("Policy search error:", error);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async policyGet(args) {
|
|
98
|
+
try {
|
|
99
|
+
const response = await fetch(`${this.baseUrl}/policy/${args.policyId}`, {
|
|
100
|
+
method: "GET",
|
|
101
|
+
headers: this.getHeaders(),
|
|
102
|
+
});
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
if (response.status === 401) {
|
|
105
|
+
this.logger.info("Unauthorized. Please check your access key and try again...");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
this.logger.error("Policy get error:", error);
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async policyComponentSearch(args) {
|
|
115
|
+
try {
|
|
116
|
+
const response = await fetch(`${this.baseUrl}/policy/${args.policyId}/component/search`, {
|
|
117
|
+
method: "POST",
|
|
118
|
+
headers: this.getHeaders(),
|
|
119
|
+
body: JSON.stringify({
|
|
120
|
+
...(args.componentId ? { componentId: args.componentId } : {}),
|
|
121
|
+
...(args.integrationId ? { integrationId: args.integrationId } : {}),
|
|
122
|
+
...(args.name ? { name: args.name } : {}),
|
|
123
|
+
...(args.technology ? { technology: args.technology } : {}),
|
|
124
|
+
...(args.type ? { type: args.type } : {}),
|
|
125
|
+
...(args.urgency ? { urgency: args.urgency } : {}),
|
|
126
|
+
...(args.priority ? { priority: args.priority } : {}),
|
|
127
|
+
...(args.isCompliant ? { isCompliant: args.isCompliant } : {}),
|
|
128
|
+
...(args.requiredVersion ? { requiredVersion: args.requiredVersion } : {}),
|
|
129
|
+
...(args.desiredVersion ? { desiredVersion: args.desiredVersion } : {}),
|
|
130
|
+
...(args.recommendedVersion ? { recommendedVersion: args.recommendedVersion } : {}),
|
|
131
|
+
...(args.dueDate ? { dueDate: args.dueDate } : {}),
|
|
132
|
+
...(args.tags ? { tags: args.tags } : {}),
|
|
133
|
+
...(args.createdAt ? { createdAt: args.createdAt } : {}),
|
|
134
|
+
...(args.updatedAt ? { updatedAt: args.updatedAt } : {}),
|
|
135
|
+
...(args.sort ? { sort: args.sort } : {}),
|
|
136
|
+
...(args.nextToken ? { nextToken: args.nextToken } : {}),
|
|
137
|
+
...(args.pageSize ? { pageSize: args.pageSize } : {}),
|
|
138
|
+
}),
|
|
139
|
+
});
|
|
140
|
+
if (!response.ok) {
|
|
141
|
+
if (response.status === 401) {
|
|
142
|
+
this.logger.info("Unauthorized. Please check your access key and try again...");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
this.logger.error("Policy component search error:", error);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async policyComponentGet(args) {
|
|
152
|
+
try {
|
|
153
|
+
const response = await fetch(`${this.baseUrl}/policy/${args.policyId}/component/${args.componentId}`, {
|
|
154
|
+
method: "GET",
|
|
155
|
+
headers: this.getHeaders(),
|
|
156
|
+
});
|
|
157
|
+
if (!response.ok) {
|
|
158
|
+
if (response.status === 401) {
|
|
159
|
+
this.logger.info("Unauthorized. Please check your access key and try again...");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
this.logger.error("Policy component get error:", error);
|
|
165
|
+
throw error;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async drafttGet(args) {
|
|
169
|
+
try {
|
|
170
|
+
const response = await fetch(`${this.baseUrl}/component/${args.componentId}/draftt/query`, {
|
|
171
|
+
method: "GET",
|
|
172
|
+
headers: this.getHeaders(),
|
|
173
|
+
});
|
|
174
|
+
if (!response.ok) {
|
|
175
|
+
if (response.status === 401) {
|
|
176
|
+
this.logger.info("Unauthorized. Please check your access key and try again...");
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
this.logger.error("Draftt get error:", error);
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.DrafttClient = DrafttClient;
|
|
187
|
+
//# sourceMappingURL=drafttClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drafttClient.js","sourceRoot":"","sources":["../src/drafttClient.ts"],"names":[],"mappings":";;;AAIA,MAAa,YAAY;IAIrB,YAAY,MAAW,EAAU,SAAkB;QAAlB,cAAS,GAAT,SAAS,CAAS;QAH3C,YAAO,GAAW,2CAA2C,CAAC;QAIlE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,qEAAqE;QACrE,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAE5D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK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cAAc,IAAI,CAAC,WAAW,eAAe,EAAE;gBACvF,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;aAC7B,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACf,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;oBAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;gBACpF,CAAC;YACL,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;YAC9C,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CACJ;AAjMD,oCAiMC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DrafttClient } from "../api/drafttClient";
|
|
2
|
+
import { ComponentGetArgs, ComponentSearchArgs } from "../models/component";
|
|
3
|
+
export declare class ComponentHandler {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: DrafttClient);
|
|
6
|
+
search(args: ComponentSearchArgs): Promise<{
|
|
7
|
+
content: {
|
|
8
|
+
type: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
}>;
|
|
12
|
+
get(args: ComponentGetArgs): Promise<{
|
|
13
|
+
content: {
|
|
14
|
+
type: string;
|
|
15
|
+
text: string;
|
|
16
|
+
}[];
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentHandler = void 0;
|
|
4
|
+
const client_1 = require("../api/client");
|
|
5
|
+
const responseFormatter_1 = require("../api/responseFormatter");
|
|
6
|
+
const logger_1 = require("../utils/logger");
|
|
7
|
+
class ComponentHandler {
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
async search(args) {
|
|
12
|
+
const logger = (0, logger_1.getLogger)();
|
|
13
|
+
try {
|
|
14
|
+
logger.debug("Processing component search with args:", args);
|
|
15
|
+
const result = await this.client.componentSearch(args);
|
|
16
|
+
return (0, responseFormatter_1.formatSuccessResponse)(result);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
logger.error("Error in component search:", error);
|
|
20
|
+
if (error instanceof client_1.ApiError) {
|
|
21
|
+
return (0, responseFormatter_1.formatErrorResponse)(error.code, error.message, error.details);
|
|
22
|
+
}
|
|
23
|
+
return (0, responseFormatter_1.formatErrorResponse)("INTERNAL_ERROR", `Unexpected error during component search: ${error instanceof Error ? error.message : String(error)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async get(args) {
|
|
27
|
+
const logger = (0, logger_1.getLogger)();
|
|
28
|
+
try {
|
|
29
|
+
logger.debug("Processing component get with args:", args);
|
|
30
|
+
if (!args.componentId) {
|
|
31
|
+
return (0, responseFormatter_1.formatErrorResponse)("MISSING_PARAM", "Missing required parameter: componentId");
|
|
32
|
+
}
|
|
33
|
+
const result = await this.client.componentGet(args);
|
|
34
|
+
return (0, responseFormatter_1.formatSuccessResponse)(result);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
logger.error("Error in component get:", error);
|
|
38
|
+
if (error instanceof client_1.ApiError) {
|
|
39
|
+
return (0, responseFormatter_1.formatErrorResponse)(error.code, error.message, error.details);
|
|
40
|
+
}
|
|
41
|
+
return (0, responseFormatter_1.formatErrorResponse)("INTERNAL_ERROR", `Unexpected error during component get: ${error instanceof Error ? error.message : String(error)}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ComponentHandler = ComponentHandler;
|
|
46
|
+
//# sourceMappingURL=componentHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentHandler.js","sourceRoot":"","s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YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACpD,OAAO,IAAA,yCAAqB,EAAC,MAAM,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YAC/C,IAAI,KAAK,YAAY,iBAAQ,EAAE,CAAC;gBAC5B,OAAO,IAAA,uCAAmB,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACzE,CAAC;YACD,OAAO,IAAA,uCAAmB,EACtB,gBAAgB,EAChB,0CAA0C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACrG,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AA7CD,4CA6CC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DrafttClient } from "../api/drafttClient";
|
|
2
|
+
import { DrafttGetArgs } from "../models/draftt";
|
|
3
|
+
export declare class DrafttHandler {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: DrafttClient);
|
|
6
|
+
get(args: DrafttGetArgs): Promise<{
|
|
7
|
+
content: {
|
|
8
|
+
type: string;
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DrafttHandler = void 0;
|
|
4
|
+
const client_1 = require("../api/client");
|
|
5
|
+
const responseFormatter_1 = require("../api/responseFormatter");
|
|
6
|
+
const logger_1 = require("../utils/logger");
|
|
7
|
+
class DrafttHandler {
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
async get(args) {
|
|
12
|
+
const logger = (0, logger_1.getLogger)();
|
|
13
|
+
try {
|
|
14
|
+
logger.debug("Processing draftt get with args:", args);
|
|
15
|
+
if (!args.componentId) {
|
|
16
|
+
return (0, responseFormatter_1.formatErrorResponse)("MISSING_PARAM", "Missing required parameter: componentId");
|
|
17
|
+
}
|
|
18
|
+
const result = await this.client.drafttGet(args);
|
|
19
|
+
return (0, responseFormatter_1.formatSuccessResponse)(result);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
logger.error("Error in draftt get:", error);
|
|
23
|
+
if (error instanceof client_1.ApiError) {
|
|
24
|
+
return (0, responseFormatter_1.formatErrorResponse)(error.code, error.message, error.details);
|
|
25
|
+
}
|
|
26
|
+
return (0, responseFormatter_1.formatErrorResponse)("INTERNAL_ERROR", `Unexpected error during draftt get: ${error instanceof Error ? error.message : String(error)}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.DrafttHandler = DrafttHandler;
|
|
31
|
+
//# sourceMappingURL=drafttHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drafttHandler.js","sourceRoot":"","sources":["../../src/handlers/drafttHandler.ts"],"names":[],"mappings":";;;AACA,0CAAyC;AACzC,gEAAsF;AAEtF,4CAA4C;AAE5C,MAAa,aAAa;IACtB,YAAoB,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAE5C,KAAK,CAAC,GAAG,CAAC,IAAmB;QACzB,MAAM,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;QAE3B,IAAI,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,kCAAkC,EAAE,IAAI,CAAC,CAAC;YAEvD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACpB,OAAO,IAAA,uCAAmB,EAAC,eAAe,EAAE,yCAAyC,CAAC,CAAC;YAC3F,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACjD,OAAO,IAAA,yCAAqB,EAAC,MAAM,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;YAC5C,IAAI,KAAK,YAAY,iBAAQ,EAAE,CAAC;gBAC5B,OAAO,IAAA,uCAAmB,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACzE,CAAC;YACD,OAAO,IAAA,uCAAmB,EACtB,gBAAgB,EAChB,uCAAuC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAClG,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AA1BD,sCA0BC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DrafttClient } from "../api/drafttClient";
|
|
2
|
+
import { PolicyComponentGetArgs, PolicyComponentSearchArgs } from "../models/component";
|
|
3
|
+
import { PolicyGetArgs, PolicySearchArgs } from "../models/policy";
|
|
4
|
+
export declare class PolicyHandler {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: DrafttClient);
|
|
7
|
+
search(args: PolicySearchArgs): Promise<{
|
|
8
|
+
content: {
|
|
9
|
+
type: string;
|
|
10
|
+
text: string;
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
get(args: PolicyGetArgs): Promise<{
|
|
14
|
+
content: {
|
|
15
|
+
type: string;
|
|
16
|
+
text: string;
|
|
17
|
+
}[];
|
|
18
|
+
}>;
|
|
19
|
+
componentSearch(args: PolicyComponentSearchArgs): Promise<{
|
|
20
|
+
content: {
|
|
21
|
+
type: string;
|
|
22
|
+
text: string;
|
|
23
|
+
}[];
|
|
24
|
+
}>;
|
|
25
|
+
componentGet(args: PolicyComponentGetArgs): Promise<{
|
|
26
|
+
content: {
|
|
27
|
+
type: string;
|
|
28
|
+
text: string;
|
|
29
|
+
}[];
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PolicyHandler = void 0;
|
|
4
|
+
const client_1 = require("../api/client");
|
|
5
|
+
const responseFormatter_1 = require("../api/responseFormatter");
|
|
6
|
+
const logger_1 = require("../utils/logger");
|
|
7
|
+
class PolicyHandler {
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
async search(args) {
|
|
12
|
+
const logger = (0, logger_1.getLogger)();
|
|
13
|
+
try {
|
|
14
|
+
logger.debug("Processing policy search with args:", args);
|
|
15
|
+
const result = await this.client.policySearch(args);
|
|
16
|
+
return (0, responseFormatter_1.formatSuccessResponse)(result);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
logger.error("Error in policy search:", error);
|
|
20
|
+
if (error instanceof client_1.ApiError) {
|
|
21
|
+
return (0, responseFormatter_1.formatErrorResponse)(error.code, error.message, error.details);
|
|
22
|
+
}
|
|
23
|
+
return (0, responseFormatter_1.formatErrorResponse)("INTERNAL_ERROR", `Unexpected error during policy search: ${error instanceof Error ? error.message : String(error)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async get(args) {
|
|
27
|
+
const logger = (0, logger_1.getLogger)();
|
|
28
|
+
try {
|
|
29
|
+
logger.debug("Processing policy get with args:", args);
|
|
30
|
+
if (!args.policyId) {
|
|
31
|
+
return (0, responseFormatter_1.formatErrorResponse)("MISSING_PARAM", "Missing required parameter: policyId");
|
|
32
|
+
}
|
|
33
|
+
const result = await this.client.policyGet(args);
|
|
34
|
+
return (0, responseFormatter_1.formatSuccessResponse)(result);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
logger.error("Error in policy get:", error);
|
|
38
|
+
if (error instanceof client_1.ApiError) {
|
|
39
|
+
return (0, responseFormatter_1.formatErrorResponse)(error.code, error.message, error.details);
|
|
40
|
+
}
|
|
41
|
+
return (0, responseFormatter_1.formatErrorResponse)("INTERNAL_ERROR", `Unexpected error during policy get: ${error instanceof Error ? error.message : String(error)}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async componentSearch(args) {
|
|
45
|
+
const logger = (0, logger_1.getLogger)();
|
|
46
|
+
try {
|
|
47
|
+
logger.debug("Processing policy component search with args:", args);
|
|
48
|
+
if (!args.policyId) {
|
|
49
|
+
return (0, responseFormatter_1.formatErrorResponse)("MISSING_PARAM", "Missing required parameter: policyId");
|
|
50
|
+
}
|
|
51
|
+
const result = await this.client.policyComponentSearch(args);
|
|
52
|
+
return (0, responseFormatter_1.formatSuccessResponse)(result);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
logger.error("Error in policy component search:", error);
|
|
56
|
+
if (error instanceof client_1.ApiError) {
|
|
57
|
+
return (0, responseFormatter_1.formatErrorResponse)(error.code, error.message, error.details);
|
|
58
|
+
}
|
|
59
|
+
return (0, responseFormatter_1.formatErrorResponse)("INTERNAL_ERROR", `Unexpected error during policy component search: ${error instanceof Error ? error.message : String(error)}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async componentGet(args) {
|
|
63
|
+
const logger = (0, logger_1.getLogger)();
|
|
64
|
+
try {
|
|
65
|
+
logger.debug("Processing policy component get with args:", args);
|
|
66
|
+
if (!args.policyId) {
|
|
67
|
+
return (0, responseFormatter_1.formatErrorResponse)("MISSING_PARAM", "Missing required parameter: policyId");
|
|
68
|
+
}
|
|
69
|
+
if (!args.componentId) {
|
|
70
|
+
return (0, responseFormatter_1.formatErrorResponse)("MISSING_PARAM", "Missing required parameter: componentId");
|
|
71
|
+
}
|
|
72
|
+
const result = await this.client.policyComponentGet(args);
|
|
73
|
+
return (0, responseFormatter_1.formatSuccessResponse)(result);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
logger.error("Error in policy component get:", error);
|
|
77
|
+
if (error instanceof client_1.ApiError) {
|
|
78
|
+
return (0, responseFormatter_1.formatErrorResponse)(error.code, error.message, error.details);
|
|
79
|
+
}
|
|
80
|
+
return (0, responseFormatter_1.formatErrorResponse)("INTERNAL_ERROR", `Unexpected error during policy component get: ${error instanceof Error ? error.message : String(error)}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.PolicyHandler = PolicyHandler;
|
|
85
|
+
//# sourceMappingURL=policyHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policyHandler.js","sourceRoot":"","sources":["../../src/handlers/policyHandler.ts"],"names":[],"mappings":";;;AACA,0CAAyC;AACzC,gEAAsF;AAGtF,4CAA4C;AAE5C,MAAa,aAAa;IACtB,YAAoB,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAE5C,KAAK,CAAC,MAAM,CAAC,IAAsB;QAC/B,MAAM,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;QAE3B,IAAI,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,qCAAqC,EAAE,IAAI,CAAC,CAAC;YAC1D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACpD,OAAO,IAAA,yCAAqB,EAAC,MAAM,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YAC/C,IAAI,KAAK,YAAY,iBAAQ,EAAE,CAAC;gBAC5B,OAAO,IAAA,uCAAmB,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;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C,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC1D,OAAO,IAAA,yCAAqB,EAAC,MAAM,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACtD,IAAI,KAAK,YAAY,iBAAQ,EAAE,CAAC;gBAC5B,OAAO,IAAA,uCAAmB,EAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACzE,CAAC;YACD,OAAO,IAAA,uCAAmB,EACtB,gBAAgB,EAChB,iDAAiD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC5G,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AAjGD,sCAiGC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const AwsRegions: readonly ["us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-east-1", "ap-south-1", "ap-south-2", "ap-southeast-1", "ap-southeast-2", "ap-southeast-3", "ap-southeast-4", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "eu-central-1", "eu-central-2", "eu-west-1", "eu-west-2", "eu-west-3", "eu-south-1", "eu-south-2", "eu-north-1", "il-central-1", "me-south-1", "me-central-1", "sa-east-1"];
|
|
2
|
+
export declare const GcpRegions: readonly ["asia-east1", "asia-east2", "asia-northeast1", "asia-northeast2", "asia-northeast3", "asia-south1", "asia-south2", "asia-southeast1", "asia-southeast2", "australia-southeast1", "australia-southeast2", "europe-central2", "europe-north1", "europe-west1", "europe-west2", "europe-west3", "europe-west4", "europe-west6", "europe-west8", "europe-west9", "europe-west12", "me-central1", "me-west1", "northamerica-northeast1", "northamerica-northeast2", "southamerica-east1", "southamerica-west1", "us-central1", "us-east1", "us-east4", "us-east5", "us-south1", "us-west1", "us-west2", "us-west3", "us-west4"];
|
|
3
|
+
export declare const AllRegions: readonly ["us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-east-1", "ap-south-1", "ap-south-2", "ap-southeast-1", "ap-southeast-2", "ap-southeast-3", "ap-southeast-4", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "eu-central-1", "eu-central-2", "eu-west-1", "eu-west-2", "eu-west-3", "eu-south-1", "eu-south-2", "eu-north-1", "il-central-1", "me-south-1", "me-central-1", "sa-east-1", "asia-east1", "asia-east2", "asia-northeast1", "asia-northeast2", "asia-northeast3", "asia-south1", "asia-south2", "asia-southeast1", "asia-southeast2", "australia-southeast1", "australia-southeast2", "europe-central2", "europe-north1", "europe-west1", "europe-west2", "europe-west3", "europe-west4", "europe-west6", "europe-west8", "europe-west9", "europe-west12", "me-central1", "me-west1", "northamerica-northeast1", "northamerica-northeast2", "southamerica-east1", "southamerica-west1", "us-central1", "us-east1", "us-east4", "us-east5", "us-south1", "us-west1", "us-west2", "us-west3", "us-west4"];
|
|
4
|
+
export type Region = typeof AllRegions[number];
|
|
5
|
+
export declare const Technologies: readonly ["bigquery", "cloudsql", "ecr", "elasticache", "k8s", "lambda", "opensearch", "rds", "kafka"];
|
|
6
|
+
export type Technology = typeof Technologies[number];
|
|
7
|
+
export declare const ComponentTypes: readonly ["aws-lambda-dotnet", "aws-lambda-go", "aws-lambda-java", "aws-lambda-nodejs", "aws-lambda-providedal", "aws-lambda-python", "aws-lambda-ruby", "aws-msk", "bigquery", "cloudsql-mysql", "cloudsql-postgres", "eks", "elasticache-memcached", "elasticache-redis", "elasticsearch", "gke", "java", "mongodb-atlas", "nodejs", "opensearch", "python", "rds-aurora-mysql", "rds-aurora-postgresql", "rds-docdb", "rds-mariadb", "rds-mysql", "rds-neptune", "rds-oracle", "rds-postgres", "rds-sqlserver-ex"];
|
|
8
|
+
export type ComponentType = typeof ComponentTypes[number];
|
|
9
|
+
export interface TagFilter {
|
|
10
|
+
key: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export interface DateRangeFilter {
|
|
14
|
+
eq?: string;
|
|
15
|
+
gt?: string;
|
|
16
|
+
gte?: string;
|
|
17
|
+
lt?: string;
|
|
18
|
+
lte?: string;
|
|
19
|
+
}
|
|
20
|
+
export type SortDirection = "asc" | "desc";
|
|
21
|
+
export interface SortParams {
|
|
22
|
+
integrationId?: SortDirection;
|
|
23
|
+
uniqueIdentifier?: SortDirection;
|
|
24
|
+
region?: SortDirection;
|
|
25
|
+
technology?: SortDirection;
|
|
26
|
+
type?: SortDirection;
|
|
27
|
+
version?: SortDirection;
|
|
28
|
+
tags?: SortDirection;
|
|
29
|
+
createdAt?: SortDirection;
|
|
30
|
+
updatedAt?: SortDirection;
|
|
31
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentTypes = exports.Technologies = exports.AllRegions = exports.GcpRegions = exports.AwsRegions = void 0;
|
|
4
|
+
exports.AwsRegions = [
|
|
5
|
+
"us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1",
|
|
6
|
+
"ap-east-1", "ap-south-1", "ap-south-2", "ap-southeast-1", "ap-southeast-2",
|
|
7
|
+
"ap-southeast-3", "ap-southeast-4", "ap-northeast-1", "ap-northeast-2",
|
|
8
|
+
"ap-northeast-3", "ca-central-1", "eu-central-1", "eu-central-2", "eu-west-1",
|
|
9
|
+
"eu-west-2", "eu-west-3", "eu-south-1", "eu-south-2", "eu-north-1",
|
|
10
|
+
"il-central-1", "me-south-1", "me-central-1", "sa-east-1"
|
|
11
|
+
];
|
|
12
|
+
exports.GcpRegions = [
|
|
13
|
+
"asia-east1", "asia-east2", "asia-northeast1", "asia-northeast2",
|
|
14
|
+
"asia-northeast3", "asia-south1", "asia-south2", "asia-southeast1",
|
|
15
|
+
"asia-southeast2", "australia-southeast1", "australia-southeast2",
|
|
16
|
+
"europe-central2", "europe-north1", "europe-west1", "europe-west2",
|
|
17
|
+
"europe-west3", "europe-west4", "europe-west6", "europe-west8",
|
|
18
|
+
"europe-west9", "europe-west12", "me-central1", "me-west1",
|
|
19
|
+
"northamerica-northeast1", "northamerica-northeast2", "southamerica-east1",
|
|
20
|
+
"southamerica-west1", "us-central1", "us-east1", "us-east4", "us-east5",
|
|
21
|
+
"us-south1", "us-west1", "us-west2", "us-west3", "us-west4"
|
|
22
|
+
];
|
|
23
|
+
exports.AllRegions = [...exports.AwsRegions, ...exports.GcpRegions];
|
|
24
|
+
exports.Technologies = [
|
|
25
|
+
"bigquery", "cloudsql", "ecr", "elasticache", "k8s", "lambda",
|
|
26
|
+
"opensearch", "rds", "kafka"
|
|
27
|
+
];
|
|
28
|
+
exports.ComponentTypes = [
|
|
29
|
+
"aws-lambda-dotnet", "aws-lambda-go", "aws-lambda-java", "aws-lambda-nodejs",
|
|
30
|
+
"aws-lambda-providedal", "aws-lambda-python", "aws-lambda-ruby", "aws-msk",
|
|
31
|
+
"bigquery", "cloudsql-mysql", "cloudsql-postgres", "eks",
|
|
32
|
+
"elasticache-memcached", "elasticache-redis", "elasticsearch", "gke",
|
|
33
|
+
"java", "mongodb-atlas", "nodejs", "opensearch", "python", "rds-aurora-mysql",
|
|
34
|
+
"rds-aurora-postgresql", "rds-docdb", "rds-mariadb", "rds-mysql",
|
|
35
|
+
"rds-neptune", "rds-oracle", "rds-postgres", "rds-sqlserver-ex"
|
|
36
|
+
];
|
|
37
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/helpers/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACxB,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY;IAChE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB;I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