drapcode-developer-sdk 1.0.6 → 1.0.7
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 +5 -6
- package/build/methods/methods.d.ts +5 -6
- package/build/methods/methods.js +23 -17
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -24,18 +24,17 @@ export declare class DrapcodeApis {
|
|
|
24
24
|
totalPages?: undefined;
|
|
25
25
|
}>;
|
|
26
26
|
createItem(collectionName: string, body: any): Promise<{
|
|
27
|
+
code: any;
|
|
27
28
|
success: boolean;
|
|
28
|
-
data:
|
|
29
|
+
data: any;
|
|
29
30
|
error: string;
|
|
30
31
|
message: string;
|
|
31
|
-
code?: undefined;
|
|
32
32
|
} | {
|
|
33
|
-
code: any;
|
|
34
33
|
success: boolean;
|
|
35
|
-
data:
|
|
34
|
+
data: string;
|
|
36
35
|
error: string;
|
|
37
|
-
message:
|
|
38
|
-
}>;
|
|
36
|
+
message: string;
|
|
37
|
+
} | undefined>;
|
|
39
38
|
getItemsWithFilter(collectionName: string, filterUuid: string): Promise<{
|
|
40
39
|
code: any;
|
|
41
40
|
success: boolean;
|
|
@@ -15,18 +15,17 @@ export declare const getAllItems: (baseurl: string, headers: Record<string, stri
|
|
|
15
15
|
totalPages?: undefined;
|
|
16
16
|
}>;
|
|
17
17
|
export declare const createItem: (baseurl: string, headers: Record<string, string>, collectionName: string, body: any) => Promise<{
|
|
18
|
+
code: any;
|
|
18
19
|
success: boolean;
|
|
19
|
-
data:
|
|
20
|
+
data: any;
|
|
20
21
|
error: string;
|
|
21
22
|
message: string;
|
|
22
|
-
code?: undefined;
|
|
23
23
|
} | {
|
|
24
|
-
code: any;
|
|
25
24
|
success: boolean;
|
|
26
|
-
data:
|
|
25
|
+
data: string;
|
|
27
26
|
error: string;
|
|
28
|
-
message:
|
|
29
|
-
}>;
|
|
27
|
+
message: string;
|
|
28
|
+
} | undefined>;
|
|
30
29
|
export declare const getItemsWithFilter: (baseurl: string, headers: Record<string, string>, collectionName: string, filterUuid: string) => Promise<{
|
|
31
30
|
code: any;
|
|
32
31
|
success: boolean;
|
package/build/methods/methods.js
CHANGED
|
@@ -151,7 +151,7 @@ var getAllItems = function (baseurl, headers, collectionName, reqQuery, query) {
|
|
|
151
151
|
var conditionString = constants_1.QueryOperation[query.condition];
|
|
152
152
|
var field = encodeURIComponent(query.field);
|
|
153
153
|
var value = encodeURIComponent(query.value);
|
|
154
|
-
queryParams_1.append("".concat(field, "
|
|
154
|
+
queryParams_1.append("".concat(field, ":").concat(conditionString), "".concat(value));
|
|
155
155
|
});
|
|
156
156
|
url = "".concat(baseurl, "/collection/").concat(collectionName, "/items?").concat(queryParams_1.toString());
|
|
157
157
|
console.log("Generated URL:", url);
|
|
@@ -176,8 +176,9 @@ var createItem = function (baseurl, headers, collectionName, body) { return __aw
|
|
|
176
176
|
return __generator(this, function (_a) {
|
|
177
177
|
switch (_a.label) {
|
|
178
178
|
case 0:
|
|
179
|
-
_a.trys.push([0,
|
|
179
|
+
_a.trys.push([0, 4, , 5]);
|
|
180
180
|
url = "".concat(baseurl, "/collection/").concat(collectionName, "/items");
|
|
181
|
+
console.log("url :>> ", url);
|
|
181
182
|
return [4 /*yield*/, fetch(url, {
|
|
182
183
|
method: "POST",
|
|
183
184
|
headers: headers,
|
|
@@ -185,28 +186,33 @@ var createItem = function (baseurl, headers, collectionName, body) { return __aw
|
|
|
185
186
|
})];
|
|
186
187
|
case 1:
|
|
187
188
|
response = _a.sent();
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
189
|
+
console.log("response.status :>> ", response.status);
|
|
190
|
+
if (response.status && response.status === 404) {
|
|
191
|
+
return [2 /*return*/, {
|
|
192
|
+
success: false,
|
|
193
|
+
data: "Collection Not Found",
|
|
194
|
+
error: "",
|
|
195
|
+
message: "",
|
|
196
|
+
}];
|
|
197
|
+
}
|
|
198
|
+
if (!(response.status &&
|
|
199
|
+
(response.status === 200 || response.status === 201))) return [3 /*break*/, 3];
|
|
200
|
+
return [4 /*yield*/, response.json()];
|
|
201
|
+
case 2:
|
|
197
202
|
result = _a.sent();
|
|
203
|
+
console.log("result :>> ", result);
|
|
198
204
|
return [2 /*return*/, {
|
|
199
|
-
code:
|
|
205
|
+
code: response.status,
|
|
200
206
|
success: true,
|
|
201
|
-
data: result
|
|
207
|
+
data: result,
|
|
202
208
|
error: "",
|
|
203
|
-
message:
|
|
209
|
+
message: "",
|
|
204
210
|
}];
|
|
205
|
-
case
|
|
206
|
-
case
|
|
211
|
+
case 3: return [3 /*break*/, 5];
|
|
212
|
+
case 4:
|
|
207
213
|
error_2 = _a.sent();
|
|
208
214
|
return [2 /*return*/, createErrorResponse(error_2)];
|
|
209
|
-
case
|
|
215
|
+
case 5: return [2 /*return*/];
|
|
210
216
|
}
|
|
211
217
|
});
|
|
212
218
|
}); };
|