drapcode-developer-sdk 1.0.8 → 1.0.9-dev

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/build/index.d.ts CHANGED
@@ -5,7 +5,9 @@ export declare class DrapcodeApis {
5
5
  private authorization;
6
6
  private environment;
7
7
  private API_PATH;
8
- constructor(project_seo_name: string, xApiKey?: string, authorization?: string, environment?: string);
8
+ private builderKey;
9
+ private protocol;
10
+ constructor(project_seo_name: string, xApiKey?: string, authorization?: string, environment?: string, builderKey?: string);
9
11
  getBaseUrl(): string;
10
12
  getHeaders(): Record<string, string>;
11
13
  getAllItems(collectionName: string, reqQuery?: SearchPaginate | any, query?: Query[] | []): Promise<{
@@ -14,6 +16,12 @@ export declare class DrapcodeApis {
14
16
  data: any;
15
17
  error: string;
16
18
  message: string;
19
+ } | {
20
+ code: any;
21
+ success: boolean;
22
+ data: string;
23
+ error: any;
24
+ message: string;
17
25
  } | {
18
26
  code: any;
19
27
  success: boolean;
@@ -22,6 +30,10 @@ export declare class DrapcodeApis {
22
30
  data: string;
23
31
  totalItems?: undefined;
24
32
  totalPages?: undefined;
33
+ } | {
34
+ code: number;
35
+ error: any;
36
+ message: any;
25
37
  }>;
26
38
  createItem(collectionName: string, body: any): Promise<{
27
39
  code: any;
@@ -30,18 +42,38 @@ export declare class DrapcodeApis {
30
42
  error: string;
31
43
  message: string;
32
44
  } | {
45
+ code: any;
33
46
  success: boolean;
34
47
  data: string;
35
- error: string;
48
+ error: any;
36
49
  message: string;
50
+ } | {
51
+ code: number;
52
+ error: any;
53
+ message: any;
37
54
  } | undefined>;
38
55
  getItemsWithFilter(collectionName: string, filterUuid: string): Promise<{
39
56
  code: any;
40
57
  success: boolean;
41
- data: any;
58
+ error: any;
59
+ message: any;
60
+ data: string;
61
+ totalItems?: undefined;
62
+ totalPages?: undefined;
63
+ } | {
64
+ code: number;
65
+ success: boolean;
42
66
  error: string;
43
67
  message: string;
68
+ data: any;
69
+ totalItems: any;
70
+ totalPages: any;
44
71
  } | {
72
+ code: number;
73
+ error: any;
74
+ message: any;
75
+ }>;
76
+ getItemsCountWithFilter(collectionName: string, filterUuid: string): Promise<{
45
77
  code: any;
46
78
  success: boolean;
47
79
  error: any;
@@ -49,13 +81,37 @@ export declare class DrapcodeApis {
49
81
  data: string;
50
82
  totalItems?: undefined;
51
83
  totalPages?: undefined;
84
+ } | {
85
+ code: number;
86
+ success: boolean;
87
+ error: string;
88
+ message: string;
89
+ data: any;
90
+ totalItems: any;
91
+ totalPages: any;
92
+ } | {
93
+ code: number;
94
+ error: any;
95
+ message: any;
52
96
  }>;
53
- getItemsCountWithFilter(collectionName: string, filterUuid: string): Promise<{
97
+ getItemWithUuid(collectionName: string, itemUuid: string): Promise<any>;
98
+ getItemOnly(collectionName: string, itemUuid: string): Promise<any>;
99
+ countItemByValue(collectionName: string, fieldName: string, fieldValue: any): Promise<any>;
100
+ saveCSVData(collectionName: string, items: any[]): Promise<any>;
101
+ validateItem(collectionName: string, item: any): Promise<any>;
102
+ lastItem(collectionName: string): Promise<any>;
103
+ updateItemWithUuid(collectionName: string, itemUuid: string, body: any): Promise<{
54
104
  code: any;
55
105
  success: boolean;
56
106
  data: any;
57
107
  error: string;
58
108
  message: string;
109
+ } | {
110
+ code: any;
111
+ success: boolean;
112
+ data: string;
113
+ error: any;
114
+ message: string;
59
115
  } | {
60
116
  code: any;
61
117
  success: boolean;
@@ -64,29 +120,38 @@ export declare class DrapcodeApis {
64
120
  data: string;
65
121
  totalItems?: undefined;
66
122
  totalPages?: undefined;
123
+ } | {
124
+ code: number;
125
+ error: any;
126
+ message: any;
67
127
  }>;
68
- getItemWithUuid(collectionName: string, itemUuid: string): Promise<{
128
+ clearItem(collectionName: string): Promise<{
69
129
  code: any;
70
130
  success: boolean;
71
131
  data: any;
72
132
  error: string;
73
133
  message: string;
74
134
  } | {
75
- code: any;
76
- success: boolean;
135
+ code: number;
77
136
  error: any;
78
137
  message: any;
79
- data: string;
80
- totalItems?: undefined;
81
- totalPages?: undefined;
138
+ success?: undefined;
139
+ data?: undefined;
82
140
  }>;
83
- updateItemWithUuid(collectionName: string, itemUuid: string, body: any): Promise<{
141
+ deleteFieldItem(collectionName: string, fieldName: string): Promise<{
84
142
  code: any;
85
143
  success: boolean;
86
144
  data: any;
87
145
  error: string;
88
146
  message: string;
89
147
  } | {
148
+ code: number;
149
+ error: any;
150
+ message: any;
151
+ success?: undefined;
152
+ data?: undefined;
153
+ }>;
154
+ deleteItemWithUuid(collectionName: string, itemUuid: string): Promise<{
90
155
  code: any;
91
156
  success: boolean;
92
157
  error: any;
@@ -94,49 +159,83 @@ export declare class DrapcodeApis {
94
159
  data: string;
95
160
  totalItems?: undefined;
96
161
  totalPages?: undefined;
97
- }>;
98
- deleteItemWithUuid(collectionName: string, itemUuid: string): Promise<{
99
- code: any;
162
+ } | {
163
+ code: number;
100
164
  success: boolean;
101
- data: any;
102
165
  error: string;
103
166
  message: string;
167
+ data: any;
168
+ totalItems: any;
169
+ totalPages: any;
170
+ } | {
171
+ code: number;
172
+ error: any;
173
+ message: any;
104
174
  }>;
105
175
  bulkDeleteItems(collectionName: string, body: any): Promise<{
106
- code: any;
107
176
  success: boolean;
108
177
  data: any;
109
178
  error: string;
110
179
  message: string;
180
+ code?: undefined;
111
181
  } | {
182
+ code: number;
183
+ error: any;
184
+ message: any;
185
+ success?: undefined;
186
+ data?: undefined;
187
+ }>;
188
+ removeReferenceItem(collectionName: string, body: any): Promise<{
112
189
  success: boolean;
113
190
  data: any;
114
191
  error: string;
115
192
  message: string;
193
+ code?: undefined;
194
+ } | {
195
+ code: number;
196
+ error: any;
197
+ message: any;
198
+ success?: undefined;
199
+ data?: undefined;
116
200
  }>;
117
- getItemsByids(collectionName: string, body: any): Promise<{
118
- code: any;
201
+ addReferenceItem(collectionName: string, body: any): Promise<{
119
202
  success: boolean;
120
203
  data: any;
121
204
  error: string;
122
205
  message: string;
206
+ code?: undefined;
123
207
  } | {
208
+ code: number;
209
+ error: any;
210
+ message: any;
211
+ success?: undefined;
212
+ data?: undefined;
213
+ }>;
214
+ getItemsByids(collectionName: string, body: any): Promise<{
124
215
  success: boolean;
125
216
  data: any;
126
217
  error: string;
127
218
  message: string;
219
+ code?: undefined;
220
+ } | {
221
+ code: number;
222
+ error: any;
223
+ message: any;
224
+ success?: undefined;
225
+ data?: undefined;
128
226
  }>;
129
227
  sendEmail(templateId: string, sendTo: string): Promise<{
130
- code: any;
131
228
  success: boolean;
132
229
  data: any;
133
230
  error: string;
134
231
  message: string;
232
+ code?: undefined;
135
233
  } | {
136
- success: boolean;
137
- data: any;
138
- error: string;
139
- message: string;
234
+ code: number;
235
+ error: any;
236
+ message: any;
237
+ success?: undefined;
238
+ data?: undefined;
140
239
  }>;
141
240
  }
142
241
  export * from "./utils/index";
package/build/index.js CHANGED
@@ -53,28 +53,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
53
53
  exports.DrapcodeApis = void 0;
54
54
  var methods_1 = require("./methods/methods");
55
55
  var DrapcodeApis = /** @class */ (function () {
56
- function DrapcodeApis(project_seo_name, xApiKey, authorization, environment) {
56
+ function DrapcodeApis(project_seo_name, xApiKey, authorization, environment, builderKey) {
57
57
  if (xApiKey === void 0) { xApiKey = ""; }
58
58
  if (authorization === void 0) { authorization = ""; }
59
59
  if (environment === void 0) { environment = "PRODUCTION"; }
60
- this.API_PATH = "drapcode.io/api/v1/developer";
60
+ if (builderKey === void 0) { builderKey = ""; }
61
+ // private API_PATH = "drapcode.io/api/v1/developer";
62
+ // private API_PATH = "webkonnect.site/api/v1/developer";
63
+ this.API_PATH = "prodeless.com:5002/api/v1/developer";
64
+ // private protocol = "https";
65
+ this.protocol = "http";
61
66
  this.project_seo_name = project_seo_name;
62
67
  this.xApiKey = xApiKey;
63
68
  this.authorization = authorization;
64
69
  this.environment = environment;
70
+ this.builderKey = builderKey;
65
71
  }
66
72
  DrapcodeApis.prototype.getBaseUrl = function () {
67
73
  switch (this.environment.toUpperCase()) {
68
74
  case "PRODUCTION":
69
- return "https://".concat(this.project_seo_name, ".api.").concat(this.API_PATH);
75
+ return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.").concat(this.API_PATH);
70
76
  case "PREVIEW":
71
- return "https://".concat(this.project_seo_name, ".api.preview.").concat(this.API_PATH);
77
+ return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.preview.").concat(this.API_PATH);
72
78
  case "BETA":
73
- return "https://".concat(this.project_seo_name, ".api.sandbox.").concat(this.API_PATH);
79
+ return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.sandbox.").concat(this.API_PATH);
74
80
  case "ALPHA":
75
- return "https://".concat(this.project_seo_name, ".api.uat.").concat(this.API_PATH);
81
+ return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.uat.").concat(this.API_PATH);
76
82
  default:
77
- return "https://".concat(this.project_seo_name, ".api.").concat(this.API_PATH);
83
+ return "".concat(this.protocol, "://").concat(this.project_seo_name, ".api.").concat(this.API_PATH);
78
84
  }
79
85
  };
80
86
  DrapcodeApis.prototype.getHeaders = function () {
@@ -88,7 +94,9 @@ var DrapcodeApis = /** @class */ (function () {
88
94
  if (this.authorization) {
89
95
  headers["Authorization"] = this.authorization;
90
96
  }
91
- console.log("here is header", headers);
97
+ if (this.builderKey) {
98
+ headers["BuilderKey"] = this.builderKey;
99
+ }
92
100
  return headers;
93
101
  };
94
102
  DrapcodeApis.prototype.getAllItems = function (collectionName, reqQuery, query) {
@@ -128,6 +136,41 @@ var DrapcodeApis = /** @class */ (function () {
128
136
  });
129
137
  });
130
138
  };
139
+ DrapcodeApis.prototype.getItemOnly = function (collectionName, itemUuid) {
140
+ return __awaiter(this, void 0, void 0, function () {
141
+ return __generator(this, function (_a) {
142
+ return [2 /*return*/, (0, methods_1.getItemOnly)(this.getBaseUrl(), this.getHeaders(), collectionName, itemUuid)];
143
+ });
144
+ });
145
+ };
146
+ DrapcodeApis.prototype.countItemByValue = function (collectionName, fieldName, fieldValue) {
147
+ return __awaiter(this, void 0, void 0, function () {
148
+ return __generator(this, function (_a) {
149
+ return [2 /*return*/, (0, methods_1.countItemByValue)(this.getBaseUrl(), this.getHeaders(), collectionName, fieldName, fieldValue)];
150
+ });
151
+ });
152
+ };
153
+ DrapcodeApis.prototype.saveCSVData = function (collectionName, items) {
154
+ return __awaiter(this, void 0, void 0, function () {
155
+ return __generator(this, function (_a) {
156
+ return [2 /*return*/, (0, methods_1.saveCSVData)(this.getBaseUrl(), this.getHeaders(), collectionName, items)];
157
+ });
158
+ });
159
+ };
160
+ DrapcodeApis.prototype.validateItem = function (collectionName, item) {
161
+ return __awaiter(this, void 0, void 0, function () {
162
+ return __generator(this, function (_a) {
163
+ return [2 /*return*/, (0, methods_1.validateItem)(this.getBaseUrl(), this.getHeaders(), collectionName, item)];
164
+ });
165
+ });
166
+ };
167
+ DrapcodeApis.prototype.lastItem = function (collectionName) {
168
+ return __awaiter(this, void 0, void 0, function () {
169
+ return __generator(this, function (_a) {
170
+ return [2 /*return*/, (0, methods_1.lastItem)(this.getBaseUrl(), this.getHeaders(), collectionName)];
171
+ });
172
+ });
173
+ };
131
174
  DrapcodeApis.prototype.updateItemWithUuid = function (collectionName, itemUuid, body) {
132
175
  return __awaiter(this, void 0, void 0, function () {
133
176
  return __generator(this, function (_a) {
@@ -135,6 +178,20 @@ var DrapcodeApis = /** @class */ (function () {
135
178
  });
136
179
  });
137
180
  };
181
+ DrapcodeApis.prototype.clearItem = function (collectionName) {
182
+ return __awaiter(this, void 0, void 0, function () {
183
+ return __generator(this, function (_a) {
184
+ return [2 /*return*/, (0, methods_1.clearItem)(this.getBaseUrl(), this.getHeaders(), collectionName)];
185
+ });
186
+ });
187
+ };
188
+ DrapcodeApis.prototype.deleteFieldItem = function (collectionName, fieldName) {
189
+ return __awaiter(this, void 0, void 0, function () {
190
+ return __generator(this, function (_a) {
191
+ return [2 /*return*/, (0, methods_1.deleteFieldItem)(this.getBaseUrl(), this.getHeaders(), collectionName, fieldName)];
192
+ });
193
+ });
194
+ };
138
195
  DrapcodeApis.prototype.deleteItemWithUuid = function (collectionName, itemUuid) {
139
196
  return __awaiter(this, void 0, void 0, function () {
140
197
  return __generator(this, function (_a) {
@@ -149,6 +206,20 @@ var DrapcodeApis = /** @class */ (function () {
149
206
  });
150
207
  });
151
208
  };
209
+ DrapcodeApis.prototype.removeReferenceItem = function (collectionName, body) {
210
+ return __awaiter(this, void 0, void 0, function () {
211
+ return __generator(this, function (_a) {
212
+ return [2 /*return*/, (0, methods_1.bulkDeleteItems)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
213
+ });
214
+ });
215
+ };
216
+ DrapcodeApis.prototype.addReferenceItem = function (collectionName, body) {
217
+ return __awaiter(this, void 0, void 0, function () {
218
+ return __generator(this, function (_a) {
219
+ return [2 /*return*/, (0, methods_1.bulkDeleteItems)(this.getBaseUrl(), this.getHeaders(), collectionName, body)];
220
+ });
221
+ });
222
+ };
152
223
  DrapcodeApis.prototype.getItemsByids = function (collectionName, body) {
153
224
  return __awaiter(this, void 0, void 0, function () {
154
225
  return __generator(this, function (_a) {
@@ -5,6 +5,12 @@ export declare const getAllItems: (baseurl: string, headers: Record<string, stri
5
5
  data: any;
6
6
  error: string;
7
7
  message: string;
8
+ } | {
9
+ code: any;
10
+ success: boolean;
11
+ data: string;
12
+ error: any;
13
+ message: string;
8
14
  } | {
9
15
  code: any;
10
16
  success: boolean;
@@ -13,6 +19,10 @@ export declare const getAllItems: (baseurl: string, headers: Record<string, stri
13
19
  data: string;
14
20
  totalItems?: undefined;
15
21
  totalPages?: undefined;
22
+ } | {
23
+ code: number;
24
+ error: any;
25
+ message: any;
16
26
  }>;
17
27
  export declare const createItem: (baseurl: string, headers: Record<string, string>, collectionName: string, body: any) => Promise<{
18
28
  code: any;
@@ -21,18 +31,17 @@ export declare const createItem: (baseurl: string, headers: Record<string, strin
21
31
  error: string;
22
32
  message: string;
23
33
  } | {
34
+ code: any;
24
35
  success: boolean;
25
36
  data: string;
26
- error: string;
37
+ error: any;
27
38
  message: string;
39
+ } | {
40
+ code: number;
41
+ error: any;
42
+ message: any;
28
43
  } | undefined>;
29
44
  export declare const getItemsWithFilter: (baseurl: string, headers: Record<string, string>, collectionName: string, filterUuid: string) => Promise<{
30
- code: any;
31
- success: boolean;
32
- data: any;
33
- error: string;
34
- message: string;
35
- } | {
36
45
  code: any;
37
46
  success: boolean;
38
47
  error: any;
@@ -40,14 +49,20 @@ export declare const getItemsWithFilter: (baseurl: string, headers: Record<strin
40
49
  data: string;
41
50
  totalItems?: undefined;
42
51
  totalPages?: undefined;
43
- }>;
44
- export declare const getItemsCountWithFilter: (baseurl: string, headers: Record<string, string>, collectionName: string, filterUuid: string) => Promise<{
45
- code: any;
52
+ } | {
53
+ code: number;
46
54
  success: boolean;
47
- data: any;
48
55
  error: string;
49
56
  message: string;
57
+ data: any;
58
+ totalItems: any;
59
+ totalPages: any;
50
60
  } | {
61
+ code: number;
62
+ error: any;
63
+ message: any;
64
+ }>;
65
+ export declare const getItemsCountWithFilter: (baseurl: string, headers: Record<string, string>, collectionName: string, filterUuid: string) => Promise<{
51
66
  code: any;
52
67
  success: boolean;
53
68
  error: any;
@@ -55,28 +70,37 @@ export declare const getItemsCountWithFilter: (baseurl: string, headers: Record<
55
70
  data: string;
56
71
  totalItems?: undefined;
57
72
  totalPages?: undefined;
58
- }>;
59
- export declare const getItemWithUuid: (baseurl: string, headers: Record<string, string>, collectionName: string, itemUuid: string) => Promise<{
60
- code: any;
73
+ } | {
74
+ code: number;
61
75
  success: boolean;
62
- data: any;
63
76
  error: string;
64
77
  message: string;
78
+ data: any;
79
+ totalItems: any;
80
+ totalPages: any;
65
81
  } | {
66
- code: any;
67
- success: boolean;
82
+ code: number;
68
83
  error: any;
69
84
  message: any;
70
- data: string;
71
- totalItems?: undefined;
72
- totalPages?: undefined;
73
85
  }>;
86
+ export declare const getItemWithUuid: (baseurl: string, headers: Record<string, string>, collectionName: string, itemUuid: string) => Promise<any>;
87
+ export declare const getItemOnly: (baseurl: string, headers: Record<string, string>, collectionName: string, itemUuid: string) => Promise<any>;
88
+ export declare const countItemByValue: (baseurl: string, headers: Record<string, string>, collectionName: string, fieldName: string, fieldValue: any) => Promise<any>;
89
+ export declare const saveCSVData: (baseurl: string, headers: Record<string, string>, collectionName: string, items: any[]) => Promise<any>;
90
+ export declare const validateItem: (baseurl: string, headers: Record<string, string>, collectionName: string, item: any) => Promise<any>;
91
+ export declare const lastItem: (baseurl: string, headers: Record<string, string>, collectionName: string) => Promise<any>;
74
92
  export declare const updateItemWithUuid: (baseurl: string, headers: Record<string, string>, collectionName: string, itemUuid: string, body: any) => Promise<{
75
93
  code: any;
76
94
  success: boolean;
77
95
  data: any;
78
96
  error: string;
79
97
  message: string;
98
+ } | {
99
+ code: any;
100
+ success: boolean;
101
+ data: string;
102
+ error: any;
103
+ message: string;
80
104
  } | {
81
105
  code: any;
82
106
  success: boolean;
@@ -85,56 +109,96 @@ export declare const updateItemWithUuid: (baseurl: string, headers: Record<strin
85
109
  data: string;
86
110
  totalItems?: undefined;
87
111
  totalPages?: undefined;
112
+ } | {
113
+ code: number;
114
+ error: any;
115
+ message: any;
88
116
  }>;
89
117
  export declare const deleteItemWithUuid: (baseurl: string, headers: Record<string, string>, collectionName: string, itemUuid: string) => Promise<{
90
118
  code: any;
91
119
  success: boolean;
92
- data: any;
120
+ error: any;
121
+ message: any;
122
+ data: string;
123
+ totalItems?: undefined;
124
+ totalPages?: undefined;
125
+ } | {
126
+ code: number;
127
+ success: boolean;
93
128
  error: string;
94
129
  message: string;
130
+ data: any;
131
+ totalItems: any;
132
+ totalPages: any;
133
+ } | {
134
+ code: number;
135
+ error: any;
136
+ message: any;
95
137
  }>;
96
138
  export declare const bulkDeleteItems: (baseurl: string, headers: Record<string, string>, collectionName: string, body: any) => Promise<{
97
- code: any;
98
139
  success: boolean;
99
140
  data: any;
100
141
  error: string;
101
142
  message: string;
143
+ code?: undefined;
102
144
  } | {
103
- success: boolean;
104
- data: any;
105
- error: string;
106
- message: string;
145
+ code: number;
146
+ error: any;
147
+ message: any;
148
+ success?: undefined;
149
+ data?: undefined;
107
150
  }>;
108
151
  export declare const getItemsByids: (baseurl: string, headers: Record<string, string>, collectionName: string, body: any) => Promise<{
109
- code: any;
110
152
  success: boolean;
111
153
  data: any;
112
154
  error: string;
113
155
  message: string;
156
+ code?: undefined;
114
157
  } | {
158
+ code: number;
159
+ error: any;
160
+ message: any;
161
+ success?: undefined;
162
+ data?: undefined;
163
+ }>;
164
+ export declare const clearItem: (baseurl: string, headers: Record<string, string>, collectionName: string) => Promise<{
165
+ code: any;
115
166
  success: boolean;
116
167
  data: any;
117
168
  error: string;
118
169
  message: string;
170
+ } | {
171
+ code: number;
172
+ error: any;
173
+ message: any;
174
+ success?: undefined;
175
+ data?: undefined;
119
176
  }>;
120
- export declare const sendEmail: (baseurl: string, headers: Record<string, string>, templateId: string, sendTo: any) => Promise<{
177
+ export declare const deleteFieldItem: (baseurl: string, headers: Record<string, string>, collectionName: string, fieldName: string) => Promise<{
121
178
  code: any;
122
179
  success: boolean;
123
180
  data: any;
124
181
  error: string;
125
182
  message: string;
126
183
  } | {
184
+ code: number;
185
+ error: any;
186
+ message: any;
187
+ success?: undefined;
188
+ data?: undefined;
189
+ }>;
190
+ export declare const addReferenceItem: (baseurl: string, headers: Record<string, string>, collectionName: string, data: any) => Promise<any>;
191
+ export declare const removeReferenceItem: (baseurl: string, headers: Record<string, string>, collectionName: string, data: any) => Promise<any>;
192
+ export declare const sendEmail: (baseurl: string, headers: Record<string, string>, templateId: string, sendTo: any) => Promise<{
127
193
  success: boolean;
128
194
  data: any;
129
195
  error: string;
130
196
  message: string;
197
+ code?: undefined;
198
+ } | {
199
+ code: number;
200
+ error: any;
201
+ message: any;
202
+ success?: undefined;
203
+ data?: undefined;
131
204
  }>;
132
- /**
133
- * {
134
- * code,
135
- * success
136
- * data,
137
- * error,
138
- * message,
139
- * }
140
- */