@ductape/sdk 0.0.3-beta13 → 0.0.3-beta15
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/api/services/webhooksApi.service.d.ts +4 -1
- package/dist/api/services/webhooksApi.service.js +6 -3
- package/dist/api/services/webhooksApi.service.js.map +1 -1
- package/dist/clients/webhooks.client.d.ts +2 -1
- package/dist/clients/webhooks.client.js +2 -2
- package/dist/clients/webhooks.client.js.map +1 -1
- package/dist/imports/imports.service.d.ts +2 -3
- package/dist/imports/imports.service.js +4 -45
- package/dist/imports/imports.service.js.map +1 -1
- package/dist/imports/imports.types.d.ts +238 -0
- package/dist/imports/repos/openApi.repo.d.ts +5 -11
- package/dist/imports/repos/openApi.repo.js +77 -27
- package/dist/imports/repos/openApi.repo.js.map +1 -1
- package/dist/processor/utils/processor.utils.d.ts +2 -1
- package/dist/products/services/products.service.d.ts +1 -0
- package/dist/products/services/products.service.js +4 -0
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/test/test.import.openapi.d.ts +1 -0
- package/dist/test/test.import.openapi.js +76 -0
- package/dist/test/test.import.openapi.js.map +1 -0
- package/dist/types/processor.types.d.ts +1 -0
- package/package.json +5 -2
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RedisClientType } from "redis";
|
|
2
|
+
import { EnvType, IRequestExtension, IWebhooks } from "../../types";
|
|
2
3
|
export interface IWebhooksApiService {
|
|
3
4
|
registerWebhooks(payload: Array<IWebhooks>, auth: IRequestExtension): Promise<void>;
|
|
4
5
|
generateLink(payload: Partial<IWebhooks>, auth: IRequestExtension): Promise<string>;
|
|
5
6
|
fetchWebhooks(payload: Partial<IWebhooks>, auth: IRequestExtension): Promise<any>;
|
|
6
7
|
}
|
|
7
8
|
export declare class WebhooksApiService implements IWebhooksApiService {
|
|
9
|
+
private environment;
|
|
10
|
+
constructor(environment: EnvType, redis_client?: RedisClientType);
|
|
8
11
|
fetchWebhooks(payload: Partial<IWebhooks>, auth: IRequestExtension): Promise<any>;
|
|
9
12
|
registerWebhooks(payload: Array<IWebhooks>, auth: IRequestExtension): Promise<void>;
|
|
10
13
|
generateLink(payload: IWebhooks, auth: IRequestExtension): Promise<string>;
|
|
@@ -16,10 +16,13 @@ const webhooks_client_1 = require("../../clients/webhooks.client");
|
|
|
16
16
|
const types_1 = require("../../types");
|
|
17
17
|
const urls_1 = require("../urls");
|
|
18
18
|
class WebhooksApiService {
|
|
19
|
+
constructor(environment, redis_client = null) {
|
|
20
|
+
this.environment = environment;
|
|
21
|
+
}
|
|
19
22
|
async fetchWebhooks(payload, auth) {
|
|
20
23
|
try {
|
|
21
24
|
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
22
|
-
const res = await (0, webhooks_client_1.webhookClient)(token, types_1.DataFormats.JSON).get(urls_1.FETCH_WEBHOOKS_URL, Object.assign(Object.assign({}, userAuthData), { data: payload }));
|
|
25
|
+
const res = await (0, webhooks_client_1.webhookClient)(token, types_1.DataFormats.JSON, this.environment).get(urls_1.FETCH_WEBHOOKS_URL, Object.assign(Object.assign({}, userAuthData), { data: payload }));
|
|
23
26
|
return res.data.data;
|
|
24
27
|
}
|
|
25
28
|
catch (e) {
|
|
@@ -29,7 +32,7 @@ class WebhooksApiService {
|
|
|
29
32
|
async registerWebhooks(payload, auth) {
|
|
30
33
|
try {
|
|
31
34
|
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
32
|
-
const res = await (0, webhooks_client_1.webhookClient)(token, types_1.DataFormats.JSON).post(urls_1.WEBHOOK_REGISTER_URL, Object.assign(Object.assign({}, userAuthData), { data: payload }));
|
|
35
|
+
const res = await (0, webhooks_client_1.webhookClient)(token, types_1.DataFormats.JSON, this.environment).post(urls_1.WEBHOOK_REGISTER_URL, Object.assign(Object.assign({}, userAuthData), { data: payload }));
|
|
33
36
|
return res.data.data;
|
|
34
37
|
}
|
|
35
38
|
catch (e) {
|
|
@@ -39,7 +42,7 @@ class WebhooksApiService {
|
|
|
39
42
|
async generateLink(payload, auth) {
|
|
40
43
|
try {
|
|
41
44
|
const { token } = auth, userAuthData = __rest(auth, ["token"]);
|
|
42
|
-
const res = await (0, webhooks_client_1.webhookClient)(token, types_1.DataFormats.JSON).post(urls_1.GENERATE_WEBHOOK_LINK_URL, Object.assign(Object.assign({}, userAuthData), { data: payload }));
|
|
45
|
+
const res = await (0, webhooks_client_1.webhookClient)(token, types_1.DataFormats.JSON, this.environment).post(urls_1.GENERATE_WEBHOOK_LINK_URL, Object.assign(Object.assign({}, userAuthData), { data: payload }));
|
|
43
46
|
return res.data.data.link;
|
|
44
47
|
}
|
|
45
48
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooksApi.service.js","sourceRoot":"","sources":["../../../src/api/services/webhooksApi.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"webhooksApi.service.js","sourceRoot":"","sources":["../../../src/api/services/webhooksApi.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,mEAA8D;AAC9D,uCAAiF;AACjF,kCAA8F;AAQ9F,MAAa,kBAAkB;IAC3B,YAAoB,WAAoB,EAAE,eAAgC,IAAI;QAA1D,gBAAW,GAAX,WAAW,CAAS;IAAyC,CAAC;IAElF,KAAK,CAAC,aAAa,CAAC,OAA2B,EAAE,IAAuB;QACpE,IAAI,CAAC;YACD,MAAM,EAAE,KAAK,KAAsB,IAAI,EAArB,YAAY,UAAK,IAAI,EAAjC,SAA0B,CAAO,CAAC;YACxC,MAAM,GAAG,GAAG,MAAM,IAAA,+BAAa,EAAC,KAAK,EAAE,mBAAW,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,yBAAkB,kCAAM,YAAY,KAAE,IAAI,EAAE,OAAO,IAAE,CAAA;YAEpI,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;IACD,KAAK,CAAC,gBAAgB,CAAC,OAAyB,EAAE,IAAuB;QACrE,IAAI,CAAC;YAED,MAAM,EAAE,KAAK,KAAsB,IAAI,EAArB,YAAY,UAAK,IAAI,EAAjC,SAA0B,CAAO,CAAC;YACxC,MAAM,GAAG,GAAG,MAAM,IAAA,+BAAa,EAAC,KAAK,EAAE,mBAAW,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,2BAAoB,kCAAM,YAAY,KAAE,IAAI,EAAE,OAAO,IAAE,CAAA;YAEvI,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,OAAkB,EAAE,IAAuB;QAC1D,IAAI,CAAC;YAED,MAAM,EAAE,KAAK,KAAsB,IAAI,EAArB,YAAY,UAAK,IAAI,EAAjC,SAA0B,CAAO,CAAC;YACxC,MAAM,GAAG,GAAG,MAAM,IAAA,+BAAa,EAAC,KAAK,EAAE,mBAAW,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,gCAAyB,kCAAM,YAAY,KAAE,IAAI,EAAE,OAAO,IAAE,CAAA;YAE5I,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,MAAM,CAAC,CAAC;QACZ,CAAC;IACL,CAAC;CACJ;AApCD,gDAoCC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
|
|
2
|
+
import { EnvType } from "../types";
|
|
3
|
+
export declare const webhookClient: (auth: string, contentType: string, environment: EnvType) => AxiosInstance;
|
|
@@ -13,11 +13,11 @@ const requestInterceptor = async (config) => {
|
|
|
13
13
|
return config;
|
|
14
14
|
};
|
|
15
15
|
let instance;
|
|
16
|
-
const webhookClient = (auth, contentType) => {
|
|
16
|
+
const webhookClient = (auth, contentType, environment) => {
|
|
17
17
|
if (instance)
|
|
18
18
|
return instance;
|
|
19
19
|
instance = axios_1.default.create({
|
|
20
|
-
baseURL: urls_1.
|
|
20
|
+
baseURL: (0, urls_1.getUrlForEnvironment)(environment, 'webhooks'),
|
|
21
21
|
timeout: 15000,
|
|
22
22
|
headers: {
|
|
23
23
|
'Content-Type': contentType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.client.js","sourceRoot":"","sources":["../../src/clients/webhooks.client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"webhooks.client.js","sourceRoot":"","sources":["../../src/clients/webhooks.client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0D;AAC1D,sCAAqE;AAGrE,MAAM,WAAW,GAAG,eAAK,CAAC,WAAW,CAAC;AACtC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC;AACpC,MAAM,kBAAkB,GAAG,KAAK,EAAE,MAAqC,EAAE,EAAE;IACzE,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AACF,IAAI,QAAuB,CAAC;AAErB,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAE,WAAoB,EAAE,EAAE;IACrF,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAC;QACtB,OAAO,EAAE,IAAA,2BAAoB,EAAC,WAAW,EAAE,UAAU,CAAC;QACtD,OAAO,EAAE,KAAK;QACd,OAAO,EAAE;YACP,cAAc,EAAE,WAAW;YAC3B,aAAa,EAAE,IAAI;SACpB;QACD,eAAe,EAAE,KAAK;KACvB,CAAC,CAAC;IAEH,aAAa;IACb,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACtD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAfS,QAAA,aAAa,iBAetB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IBuilderInit } from '../types/index.types';
|
|
2
2
|
import { ImportDocsTypes } from './imports.types';
|
|
3
|
-
import { OpenApi30 } from './openAPI3.0.types';
|
|
4
3
|
export interface IImportService {
|
|
5
4
|
importPostmanV21(file: Buffer, type: ImportDocsTypes, version: string, updateIfExists?: boolean, app_id?: string): Promise<void>;
|
|
6
5
|
importApp(file: Buffer, type: ImportDocsTypes, version: string, updateIfExists: boolean, app_id: string): Promise<void>;
|
|
@@ -14,11 +13,11 @@ export default class ImportService implements IImportService {
|
|
|
14
13
|
private appApi;
|
|
15
14
|
private workspaceApi;
|
|
16
15
|
private postmanV21Repo;
|
|
17
|
-
private
|
|
16
|
+
private openAPIV3Repo;
|
|
18
17
|
constructor({ workspace_id, public_key, user_id, token, env_type }: IBuilderInit);
|
|
19
18
|
importApp(file: Buffer, type: ImportDocsTypes, version?: string, updateIfExists?: boolean, app_id?: string): Promise<void>;
|
|
20
19
|
importPostmanV21(file: Buffer, type: ImportDocsTypes, version: string, updateIfExists?: boolean, app_id?: string): Promise<void>;
|
|
21
|
-
|
|
20
|
+
importOpenAPIV3(file: Buffer, type: ImportDocsTypes, version: string, updateIfExists?: boolean, app_id?: string): Promise<void>;
|
|
22
21
|
private splitAndWriteBulkInChunks;
|
|
23
22
|
private getUserAccess;
|
|
24
23
|
}
|
|
@@ -6,13 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const app_service_1 = __importDefault(require("../apps/services/app.service"));
|
|
7
7
|
const imports_types_1 = require("./imports.types");
|
|
8
8
|
const enums_1 = require("../types/enums");
|
|
9
|
-
const string_utils_1 = require("../apps/utils/string.utils");
|
|
10
|
-
const imports_utils_1 = require("./utils/imports.utils");
|
|
11
9
|
const appApi_service_1 = require("../api/services/appApi.service");
|
|
12
10
|
const workspaceApi_service_1 = require("../api/services/workspaceApi.service");
|
|
13
11
|
const postmanV21_repo_1 = require("./repos/postmanV21.repo");
|
|
14
12
|
const openApi_repo_1 = require("./repos/openApi.repo");
|
|
15
|
-
const bson_objectid_1 = __importDefault(require("bson-objectid"));
|
|
16
13
|
class ImportService {
|
|
17
14
|
constructor({ workspace_id, public_key, user_id, token, env_type }) {
|
|
18
15
|
this.workspace_id = workspace_id;
|
|
@@ -20,7 +17,7 @@ class ImportService {
|
|
|
20
17
|
this.user_id = user_id;
|
|
21
18
|
this.token = token;
|
|
22
19
|
this.postmanV21Repo = postmanV21_repo_1.PostmanV21Repo;
|
|
23
|
-
this.
|
|
20
|
+
this.openAPIV3Repo = openApi_repo_1.OpenAPIV3Repo;
|
|
24
21
|
this.appService = new app_service_1.default({ workspace_id, public_key, user_id, token, env_type });
|
|
25
22
|
this.workspaceApi = new workspaceApi_service_1.WorkspaceApiService(env_type);
|
|
26
23
|
this.appApi = new appApi_service_1.AppApiService(env_type);
|
|
@@ -30,7 +27,7 @@ class ImportService {
|
|
|
30
27
|
await this.importPostmanV21(file, type, version, updateIfExists, app_id);
|
|
31
28
|
}
|
|
32
29
|
else if (type === imports_types_1.ImportDocsTypes.openApiV30) {
|
|
33
|
-
await this.
|
|
30
|
+
await this.importOpenAPIV3(file, type, version, updateIfExists, app_id);
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
async importPostmanV21(file, type, version, updateIfExists = false, app_id = null) {
|
|
@@ -41,47 +38,9 @@ class ImportService {
|
|
|
41
38
|
throw e;
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
|
-
async
|
|
41
|
+
async importOpenAPIV3(file, type, version, updateIfExists = false, app_id = null) {
|
|
45
42
|
try {
|
|
46
|
-
|
|
47
|
-
if (openapi !== '3.0.0') {
|
|
48
|
-
throw new Error(`Invalid openapi version ${openapi}`);
|
|
49
|
-
}
|
|
50
|
-
let exists;
|
|
51
|
-
if (!app_id) {
|
|
52
|
-
exists = await this.appService.checkIfAppExists(info.title);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
await this.appService.initializeApp(app_id);
|
|
56
|
-
exists = this.appService.fetchApp();
|
|
57
|
-
}
|
|
58
|
-
let collection = {};
|
|
59
|
-
collection._id = new bson_objectid_1.default().toHexString();
|
|
60
|
-
if (exists && !updateIfExists) {
|
|
61
|
-
throw new Error(`App ${exists.app_name} exists, if you want to update if, set updateIfExists to true`);
|
|
62
|
-
}
|
|
63
|
-
const workspace = await this.workspaceApi.fetchWorkspaceById(this.getUserAccess(), true);
|
|
64
|
-
if (!workspace) {
|
|
65
|
-
throw new Error(`Workspace: ${this.workspace_id} not found`);
|
|
66
|
-
}
|
|
67
|
-
if (exists) {
|
|
68
|
-
collection._id = exists._id;
|
|
69
|
-
}
|
|
70
|
-
const { folders, actions } = await this.openAPIV30Repo.fetchhParsedItems(paths, this.appService);
|
|
71
|
-
collection.folders = folders;
|
|
72
|
-
// collection.actions = actions;
|
|
73
|
-
if (!exists) {
|
|
74
|
-
collection.tag = `${(0, string_utils_1.tagify)(workspace.name)}:${(0, string_utils_1.tagify)(info.title)}`;
|
|
75
|
-
collection.app_name = info.title;
|
|
76
|
-
collection.description = info.description;
|
|
77
|
-
await this.appApi.createApp(collection, {
|
|
78
|
-
workspace_id: this.workspace_id,
|
|
79
|
-
user_id: this.user_id,
|
|
80
|
-
public_key: this.public_key,
|
|
81
|
-
token: this.token,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
await this.splitAndWriteBulkInChunks(collection._id, (0, imports_utils_1.generateActionTags)(actions), enums_1.AppComponents.ACTION);
|
|
43
|
+
await this.appApi.importApp(app_id, type, file, version, updateIfExists, this.getUserAccess());
|
|
85
44
|
}
|
|
86
45
|
catch (e) {
|
|
87
46
|
throw e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.service.js","sourceRoot":"","sources":["../../src/imports/imports.service.ts"],"names":[],"mappings":";;;;;AAAA,+EAAqF;AAGrF,
|
|
1
|
+
{"version":3,"file":"imports.service.js","sourceRoot":"","sources":["../../src/imports/imports.service.ts"],"names":[],"mappings":"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"}
|
|
@@ -102,3 +102,241 @@ export declare enum Formats {
|
|
|
102
102
|
export declare enum Modes {
|
|
103
103
|
RAW = "raw"
|
|
104
104
|
}
|
|
105
|
+
export interface OpenAPIV3Document {
|
|
106
|
+
openapi: string;
|
|
107
|
+
info: OpenAPIV3Info;
|
|
108
|
+
servers?: OpenAPIV3Server[];
|
|
109
|
+
paths: OpenAPIV3Paths;
|
|
110
|
+
components?: OpenAPIV3Components;
|
|
111
|
+
security?: OpenAPIV3SecurityRequirement[];
|
|
112
|
+
tags?: OpenAPIV3Tag[];
|
|
113
|
+
externalDocs?: OpenAPIV3ExternalDocumentation;
|
|
114
|
+
}
|
|
115
|
+
export interface OpenAPIV3Info {
|
|
116
|
+
title: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
termsOfService?: string;
|
|
119
|
+
contact?: OpenAPIV3Contact;
|
|
120
|
+
license?: OpenAPIV3License;
|
|
121
|
+
version: string;
|
|
122
|
+
}
|
|
123
|
+
export interface OpenAPIV3Contact {
|
|
124
|
+
name?: string;
|
|
125
|
+
url?: string;
|
|
126
|
+
email?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface OpenAPIV3License {
|
|
129
|
+
name: string;
|
|
130
|
+
url?: string;
|
|
131
|
+
}
|
|
132
|
+
export interface OpenAPIV3Server {
|
|
133
|
+
url: string;
|
|
134
|
+
description?: string;
|
|
135
|
+
variables?: Record<string, OpenAPIV3ServerVariable>;
|
|
136
|
+
}
|
|
137
|
+
export interface OpenAPIV3ServerVariable {
|
|
138
|
+
enum?: string[];
|
|
139
|
+
default: string;
|
|
140
|
+
description?: string;
|
|
141
|
+
}
|
|
142
|
+
export interface OpenAPIV3Paths {
|
|
143
|
+
[path: string]: OpenAPIV3PathItem;
|
|
144
|
+
}
|
|
145
|
+
export interface OpenAPIV3PathItem {
|
|
146
|
+
$ref?: string;
|
|
147
|
+
summary?: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
get?: OpenAPIV3Operation;
|
|
150
|
+
put?: OpenAPIV3Operation;
|
|
151
|
+
post?: OpenAPIV3Operation;
|
|
152
|
+
delete?: OpenAPIV3Operation;
|
|
153
|
+
options?: OpenAPIV3Operation;
|
|
154
|
+
head?: OpenAPIV3Operation;
|
|
155
|
+
patch?: OpenAPIV3Operation;
|
|
156
|
+
trace?: OpenAPIV3Operation;
|
|
157
|
+
servers?: OpenAPIV3Server[];
|
|
158
|
+
parameters?: (OpenAPIV3Parameter | OpenAPIV3Reference)[];
|
|
159
|
+
}
|
|
160
|
+
export interface OpenAPIV3Operation {
|
|
161
|
+
tags?: string[];
|
|
162
|
+
summary?: string;
|
|
163
|
+
description?: string;
|
|
164
|
+
externalDocs?: OpenAPIV3ExternalDocumentation;
|
|
165
|
+
operationId?: string;
|
|
166
|
+
parameters?: (OpenAPIV3Parameter | OpenAPIV3Reference)[];
|
|
167
|
+
requestBody?: OpenAPIV3RequestBody | OpenAPIV3Reference;
|
|
168
|
+
responses: OpenAPIV3Responses;
|
|
169
|
+
callbacks?: Record<string, OpenAPIV3Callback | OpenAPIV3Reference>;
|
|
170
|
+
deprecated?: boolean;
|
|
171
|
+
security?: OpenAPIV3SecurityRequirement[];
|
|
172
|
+
servers?: OpenAPIV3Server[];
|
|
173
|
+
}
|
|
174
|
+
export interface OpenAPIV3Parameter {
|
|
175
|
+
name: string;
|
|
176
|
+
in: 'query' | 'header' | 'path' | 'cookie';
|
|
177
|
+
description?: string;
|
|
178
|
+
required?: boolean;
|
|
179
|
+
deprecated?: boolean;
|
|
180
|
+
allowEmptyValue?: boolean;
|
|
181
|
+
style?: string;
|
|
182
|
+
explode?: boolean;
|
|
183
|
+
allowReserved?: boolean;
|
|
184
|
+
schema?: OpenAPIV3Schema | OpenAPIV3Reference;
|
|
185
|
+
example?: any;
|
|
186
|
+
examples?: Record<string, OpenAPIV3Example | OpenAPIV3Reference>;
|
|
187
|
+
content?: Record<string, OpenAPIV3MediaType>;
|
|
188
|
+
}
|
|
189
|
+
export interface OpenAPIV3RequestBody {
|
|
190
|
+
description?: string;
|
|
191
|
+
content: Record<string, OpenAPIV3MediaType>;
|
|
192
|
+
required?: boolean;
|
|
193
|
+
}
|
|
194
|
+
export interface OpenAPIV3MediaType {
|
|
195
|
+
schema?: OpenAPIV3Schema | OpenAPIV3Reference;
|
|
196
|
+
example?: any;
|
|
197
|
+
examples?: Record<string, OpenAPIV3Example | OpenAPIV3Reference>;
|
|
198
|
+
encoding?: Record<string, OpenAPIV3Encoding>;
|
|
199
|
+
}
|
|
200
|
+
export interface OpenAPIV3Encoding {
|
|
201
|
+
contentType?: string;
|
|
202
|
+
headers?: Record<string, OpenAPIV3Header | OpenAPIV3Reference>;
|
|
203
|
+
style?: string;
|
|
204
|
+
explode?: boolean;
|
|
205
|
+
allowReserved?: boolean;
|
|
206
|
+
}
|
|
207
|
+
export interface OpenAPIV3Responses {
|
|
208
|
+
default?: OpenAPIV3Response | OpenAPIV3Reference;
|
|
209
|
+
[statusCode: string]: OpenAPIV3Response | OpenAPIV3Reference | undefined;
|
|
210
|
+
}
|
|
211
|
+
export interface OpenAPIV3Response {
|
|
212
|
+
description: string;
|
|
213
|
+
headers?: Record<string, OpenAPIV3Header | OpenAPIV3Reference>;
|
|
214
|
+
content?: Record<string, OpenAPIV3MediaType>;
|
|
215
|
+
links?: Record<string, OpenAPIV3Link | OpenAPIV3Reference>;
|
|
216
|
+
}
|
|
217
|
+
export interface OpenAPIV3Header {
|
|
218
|
+
description?: string;
|
|
219
|
+
required?: boolean;
|
|
220
|
+
deprecated?: boolean;
|
|
221
|
+
allowEmptyValue?: boolean;
|
|
222
|
+
style?: string;
|
|
223
|
+
explode?: boolean;
|
|
224
|
+
allowReserved?: boolean;
|
|
225
|
+
schema?: OpenAPIV3Schema | OpenAPIV3Reference;
|
|
226
|
+
example?: any;
|
|
227
|
+
examples?: Record<string, OpenAPIV3Example | OpenAPIV3Reference>;
|
|
228
|
+
content?: Record<string, OpenAPIV3MediaType>;
|
|
229
|
+
}
|
|
230
|
+
export interface OpenAPIV3Callback {
|
|
231
|
+
[expression: string]: OpenAPIV3PathItem;
|
|
232
|
+
}
|
|
233
|
+
export interface OpenAPIV3Example {
|
|
234
|
+
summary?: string;
|
|
235
|
+
description?: string;
|
|
236
|
+
value?: any;
|
|
237
|
+
externalValue?: string;
|
|
238
|
+
}
|
|
239
|
+
export interface OpenAPIV3Link {
|
|
240
|
+
operationRef?: string;
|
|
241
|
+
operationId?: string;
|
|
242
|
+
parameters?: Record<string, any>;
|
|
243
|
+
requestBody?: any;
|
|
244
|
+
description?: string;
|
|
245
|
+
server?: OpenAPIV3Server;
|
|
246
|
+
}
|
|
247
|
+
export interface OpenAPIV3Schema {
|
|
248
|
+
title?: string;
|
|
249
|
+
multipleOf?: number;
|
|
250
|
+
maximum?: number;
|
|
251
|
+
exclusiveMaximum?: boolean;
|
|
252
|
+
minimum?: number;
|
|
253
|
+
exclusiveMinimum?: boolean;
|
|
254
|
+
maxLength?: number;
|
|
255
|
+
minLength?: number;
|
|
256
|
+
pattern?: string;
|
|
257
|
+
maxItems?: number;
|
|
258
|
+
minItems?: number;
|
|
259
|
+
uniqueItems?: boolean;
|
|
260
|
+
maxProperties?: number;
|
|
261
|
+
minProperties?: number;
|
|
262
|
+
required?: string[];
|
|
263
|
+
enum?: any[];
|
|
264
|
+
type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | ('string' | 'number' | 'integer' | 'boolean' | 'array' | 'object')[];
|
|
265
|
+
not?: OpenAPIV3Schema | OpenAPIV3Reference;
|
|
266
|
+
allOf?: (OpenAPIV3Schema | OpenAPIV3Reference)[];
|
|
267
|
+
oneOf?: (OpenAPIV3Schema | OpenAPIV3Reference)[];
|
|
268
|
+
anyOf?: (OpenAPIV3Schema | OpenAPIV3Reference)[];
|
|
269
|
+
items?: OpenAPIV3Schema | OpenAPIV3Reference;
|
|
270
|
+
properties?: Record<string, OpenAPIV3Schema | OpenAPIV3Reference>;
|
|
271
|
+
additionalProperties?: boolean | OpenAPIV3Schema | OpenAPIV3Reference;
|
|
272
|
+
description?: string;
|
|
273
|
+
format?: string;
|
|
274
|
+
default?: any;
|
|
275
|
+
nullable?: boolean;
|
|
276
|
+
discriminator?: OpenAPIV3Discriminator;
|
|
277
|
+
readOnly?: boolean;
|
|
278
|
+
writeOnly?: boolean;
|
|
279
|
+
xml?: OpenAPIV3XML;
|
|
280
|
+
externalDocs?: OpenAPIV3ExternalDocumentation;
|
|
281
|
+
example?: any;
|
|
282
|
+
deprecated?: boolean;
|
|
283
|
+
}
|
|
284
|
+
export interface OpenAPIV3Discriminator {
|
|
285
|
+
propertyName: string;
|
|
286
|
+
mapping?: Record<string, string>;
|
|
287
|
+
}
|
|
288
|
+
export interface OpenAPIV3XML {
|
|
289
|
+
name?: string;
|
|
290
|
+
namespace?: string;
|
|
291
|
+
prefix?: string;
|
|
292
|
+
attribute?: boolean;
|
|
293
|
+
wrapped?: boolean;
|
|
294
|
+
}
|
|
295
|
+
export interface OpenAPIV3SecurityRequirement {
|
|
296
|
+
[name: string]: string[];
|
|
297
|
+
}
|
|
298
|
+
export interface OpenAPIV3Components {
|
|
299
|
+
schemas?: Record<string, OpenAPIV3Schema | OpenAPIV3Reference>;
|
|
300
|
+
responses?: Record<string, OpenAPIV3Response | OpenAPIV3Reference>;
|
|
301
|
+
parameters?: Record<string, OpenAPIV3Parameter | OpenAPIV3Reference>;
|
|
302
|
+
examples?: Record<string, OpenAPIV3Example | OpenAPIV3Reference>;
|
|
303
|
+
requestBodies?: Record<string, OpenAPIV3RequestBody | OpenAPIV3Reference>;
|
|
304
|
+
headers?: Record<string, OpenAPIV3Header | OpenAPIV3Reference>;
|
|
305
|
+
securitySchemes?: Record<string, OpenAPIV3SecurityScheme | OpenAPIV3Reference>;
|
|
306
|
+
links?: Record<string, OpenAPIV3Link | OpenAPIV3Reference>;
|
|
307
|
+
callbacks?: Record<string, OpenAPIV3Callback | OpenAPIV3Reference>;
|
|
308
|
+
}
|
|
309
|
+
export interface OpenAPIV3SecurityScheme {
|
|
310
|
+
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
311
|
+
description?: string;
|
|
312
|
+
name?: string;
|
|
313
|
+
in?: 'query' | 'header' | 'cookie';
|
|
314
|
+
scheme?: string;
|
|
315
|
+
bearerFormat?: string;
|
|
316
|
+
flows?: OpenAPIV3OAuthFlows;
|
|
317
|
+
openIdConnectUrl?: string;
|
|
318
|
+
}
|
|
319
|
+
export interface OpenAPIV3OAuthFlows {
|
|
320
|
+
implicit?: OpenAPIV3OAuthFlow;
|
|
321
|
+
password?: OpenAPIV3OAuthFlow;
|
|
322
|
+
clientCredentials?: OpenAPIV3OAuthFlow;
|
|
323
|
+
authorizationCode?: OpenAPIV3OAuthFlow;
|
|
324
|
+
}
|
|
325
|
+
export interface OpenAPIV3OAuthFlow {
|
|
326
|
+
authorizationUrl?: string;
|
|
327
|
+
tokenUrl?: string;
|
|
328
|
+
refreshUrl?: string;
|
|
329
|
+
scopes: Record<string, string>;
|
|
330
|
+
}
|
|
331
|
+
export interface OpenAPIV3Tag {
|
|
332
|
+
name: string;
|
|
333
|
+
description?: string;
|
|
334
|
+
externalDocs?: OpenAPIV3ExternalDocumentation;
|
|
335
|
+
}
|
|
336
|
+
export interface OpenAPIV3ExternalDocumentation {
|
|
337
|
+
description?: string;
|
|
338
|
+
url: string;
|
|
339
|
+
}
|
|
340
|
+
export interface OpenAPIV3Reference {
|
|
341
|
+
$ref: string;
|
|
342
|
+
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
+
import { IFoldersAndActions, OpenAPIV3Document, PostmanCollectionV21 } from '../../types';
|
|
1
2
|
import { IAppBuilderService } from '../../apps/services/app.service';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export interface IOPenAPI30Repo {
|
|
6
|
-
fetchhParsedItems(paths: Paths, appService: IAppBuilderService): Promise<IFoldersAndActions>;
|
|
7
|
-
fetchParsedBody(): Promise<ISample>;
|
|
8
|
-
fetchParsedHeaders(): Promise<ISample>;
|
|
9
|
-
fetchParsedQuery(): Promise<ISample>;
|
|
10
|
-
fetchParsedParams(): Promise<ISample>;
|
|
11
|
-
fetchParsedResponses(): Promise<IAppActionResponseInfo[]>;
|
|
3
|
+
export interface IOPenAPIV3Repo {
|
|
4
|
+
fetchParsedItems(document: OpenAPIV3Document, appService: IAppBuilderService): Promise<IFoldersAndActions>;
|
|
5
|
+
convertToPostmanCollection(document: OpenAPIV3Document): Promise<PostmanCollectionV21>;
|
|
12
6
|
}
|
|
13
|
-
export declare const
|
|
7
|
+
export declare const OpenAPIV3Repo: IOPenAPIV3Repo;
|
|
@@ -1,33 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
9
24
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.OpenAPIV3Repo = void 0;
|
|
37
|
+
const postmanV21_repo_1 = require("./postmanV21.repo");
|
|
38
|
+
const OpenAPIToPostman = __importStar(require("openapi-to-postmanv2"));
|
|
39
|
+
exports.OpenAPIV3Repo = {
|
|
40
|
+
async fetchParsedItems(document, appService) {
|
|
41
|
+
const postmanCollection = await this.convertToPostmanCollection(document);
|
|
42
|
+
return postmanV21_repo_1.PostmanV21Repo.fetchParsedItems(postmanCollection.item, appService);
|
|
28
43
|
},
|
|
29
|
-
async
|
|
30
|
-
|
|
44
|
+
async convertToPostmanCollection(document) {
|
|
45
|
+
const options = {
|
|
46
|
+
requestNameSource: 'operationId',
|
|
47
|
+
collapseFolders: false,
|
|
48
|
+
folderStrategy: 'Tags',
|
|
49
|
+
schemaFaker: true,
|
|
50
|
+
indentCharacter: 'Tab',
|
|
51
|
+
requestParametersResolution: 'Example',
|
|
52
|
+
optimizeConversion: true,
|
|
53
|
+
stackLimit: 50,
|
|
54
|
+
includeAuthInfoInExample: true
|
|
55
|
+
};
|
|
56
|
+
const input = {
|
|
57
|
+
type: 'json',
|
|
58
|
+
data: JSON.stringify(document)
|
|
59
|
+
};
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
OpenAPIToPostman.convert(input, options, (err, conversionResult) => {
|
|
62
|
+
if (err) {
|
|
63
|
+
console.error('❌ Error in conversion:', err);
|
|
64
|
+
return reject(err);
|
|
65
|
+
}
|
|
66
|
+
if (!conversionResult.result) {
|
|
67
|
+
console.error('❌ Conversion failed:', conversionResult.reason);
|
|
68
|
+
if (conversionResult.warnings) {
|
|
69
|
+
console.warn('⚠️ Conversion warnings:', conversionResult.warnings);
|
|
70
|
+
}
|
|
71
|
+
return reject(new Error(conversionResult.reason));
|
|
72
|
+
}
|
|
73
|
+
const postmanCollection = conversionResult.output[0].data;
|
|
74
|
+
postmanCollection.info.schema = 'https://schema.getpostman.com/json/collection/v2.1.0/collection.json';
|
|
75
|
+
if (!postmanCollection.variable) {
|
|
76
|
+
postmanCollection.variable = [];
|
|
77
|
+
}
|
|
78
|
+
resolve(postmanCollection);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
31
81
|
},
|
|
32
82
|
};
|
|
33
83
|
//# sourceMappingURL=openApi.repo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openApi.repo.js","sourceRoot":"","sources":["../../../src/imports/repos/openApi.repo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openApi.repo.js","sourceRoot":"","sources":["../../../src/imports/repos/openApi.repo.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,uDAAmD;AACnD,uEAAyD;AAO5C,QAAA,aAAa,GAAmB;IAC3C,KAAK,CAAC,gBAAgB,CAAC,QAA2B,EAAE,UAA8B;QAChF,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC;QAC1E,OAAO,gCAAc,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAC7E,CAAC;IAED,KAAK,CAAC,0BAA0B,CAAC,QAA2B;QAC1D,MAAM,OAAO,GAA6B;YACxC,iBAAiB,EAAE,aAAoB;YACvC,eAAe,EAAE,KAAK;YACtB,cAAc,EAAE,MAAM;YACtB,WAAW,EAAE,IAAI;YACjB,eAAe,EAAE,KAAK;YACtB,2BAA2B,EAAE,SAAS;YACtC,kBAAkB,EAAE,IAAI;YACxB,UAAU,EAAE,EAAE;YACd,wBAAwB,EAAE,IAAI;SAC/B,CAAC;QAEF,MAAM,KAAK,GAA2B;YACpC,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;SAC/B,CAAC;QAEF,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3D,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,gBAAqB,EAAE,EAAE;gBACtE,IAAI,GAAG,EAAE,CAAC;oBACR,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;oBAC7C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC;gBAED,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;oBAC7B,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;oBAC/D,IAAI,gBAAgB,CAAC,QAAQ,EAAE,CAAC;wBAC9B,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;oBACrE,CAAC;oBACD,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;gBACpD,CAAC;gBAED,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC1D,iBAAiB,CAAC,IAAI,CAAC,MAAM,GAAG,sEAAsE,CAAC;gBAEvG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;oBAChC,iBAAiB,CAAC,QAAQ,GAAG,EAAE,CAAC;gBAClC,CAAC;gBAED,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -35,7 +35,8 @@ export declare function generateSqlQuery(template: string, data: Record<string,
|
|
|
35
35
|
export declare const compareValues: (initiator: string | number, operator: string, value: string | number) => boolean;
|
|
36
36
|
export declare const structuredClone: (data: any) => any;
|
|
37
37
|
export declare const cleanBlob: (data: any) => any;
|
|
38
|
-
export declare const generateIndexes: (operator: string,
|
|
38
|
+
export declare const generateIndexes: (operator: string, //">" | "<" | ">=" | "<=" | "==" | "!==",
|
|
39
|
+
iter: number, init: number, value: number) => number[];
|
|
39
40
|
export declare const validateStringsInObject: (obj: Record<string, unknown>) => boolean;
|
|
40
41
|
export declare const extractAxiosErrorDetails: (error: any) => {
|
|
41
42
|
code: any;
|
|
@@ -40,6 +40,7 @@ const update_productNotificationMessage_validator_1 = __importDefault(require(".
|
|
|
40
40
|
const create_productNotification_validator_1 = require("../validators/joi-validators/create.productNotification.validator");
|
|
41
41
|
const functions_utils_1 = require("../utils/functions.utils");
|
|
42
42
|
const objects_utils_2 = require("../../apps/utils/objects.utils");
|
|
43
|
+
const webhooksApi_service_1 = require("../../api/services/webhooksApi.service");
|
|
43
44
|
class ProductsBuilderService {
|
|
44
45
|
constructor({ workspace_id, public_key, user_id, token, env_type, redis_client }) {
|
|
45
46
|
this.workspace_id = workspace_id;
|
|
@@ -49,6 +50,7 @@ class ProductsBuilderService {
|
|
|
49
50
|
this.userApi = new userApi_service_1.UserApiService(env_type, redis_client);
|
|
50
51
|
this.productApi = new productsApi_service_1.ProductsApiService(env_type, redis_client);
|
|
51
52
|
this.workspaceApi = new workspaceApi_service_1.WorkspaceApiService(env_type, redis_client);
|
|
53
|
+
this.webhooksApi = new webhooksApi_service_1.WebhooksApiService(env_type);
|
|
52
54
|
this.appApi = new appApi_service_1.AppApiService(env_type, redis_client);
|
|
53
55
|
this.inputsService = new inputs_service_1.default();
|
|
54
56
|
this.thirdPartyApps = [];
|
|
@@ -1158,6 +1160,8 @@ class ProductsBuilderService {
|
|
|
1158
1160
|
throw new Error(`App with access tag ${access_tag} not found`);
|
|
1159
1161
|
}
|
|
1160
1162
|
const version = app.versions.find((version) => version.tag === app.version);
|
|
1163
|
+
const status = await this.webhooksApi.fetchWebhooks({ access_tag, app_tag: app.tag, version: app.version }, this.getUserAccess());
|
|
1164
|
+
console.log(status);
|
|
1161
1165
|
if (!version) {
|
|
1162
1166
|
throw new Error(`Required app version not found`);
|
|
1163
1167
|
}
|