zudello-integration-sdk 1.0.69 → 1.0.71
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/package.json +1 -1
- package/src/sdk/ZudelloStore.js +33 -21
package/package.json
CHANGED
package/src/sdk/ZudelloStore.js
CHANGED
|
@@ -23,37 +23,49 @@ class ZudelloStoreSDK extends BaseSDK {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
async fetch({ uuid, resource_type = null }) {
|
|
26
|
-
const validateIsEmpty = this.validator.isEmpty({ uuid })
|
|
26
|
+
const validateIsEmpty = this.validator.isEmpty({ uuid })
|
|
27
27
|
|
|
28
28
|
if (!validateIsEmpty.valid) {
|
|
29
|
-
return this.responseHandler.error(validateIsEmpty.errors)
|
|
29
|
+
return this.responseHandler.error(validateIsEmpty.errors)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return await this.makeRequest(
|
|
33
33
|
"GET",
|
|
34
34
|
`${this.apiURL}/general-store/api/${this.apiVersion}/resources/${uuid}${resource_type ? `?resource_type=${resource_type}` : ""}`,
|
|
35
35
|
{}
|
|
36
|
-
)
|
|
36
|
+
)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
39
|
+
async fetchFields({ documentType }) {
|
|
40
|
+
const validateIsEmpty = this.validator.isEmpty({ documentType })
|
|
41
|
+
|
|
42
|
+
if (!validateIsEmpty.valid) {
|
|
43
|
+
return this.responseHandler.error(validateIsEmpty.errors)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const resource = await this.makeRequest(
|
|
47
|
+
"GET",
|
|
48
|
+
`${this.apiURL}/general-store/api/${this.apiVersion}/resources/?resource_type=document_type&document_type=${documentType}`,
|
|
49
|
+
{}
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return _.map(_.get(resource, "response.data[0].payload.settings.fields", []), "path");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async fetchMetadata({ model }) {
|
|
56
|
+
const validateIsEmpty = this.validator.isEmpty({ model })
|
|
57
|
+
|
|
58
|
+
if (!validateIsEmpty.valid) {
|
|
59
|
+
return this.responseHandler.error(validateIsEmpty.errors)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const fieldMetadata = await this.makeRequest(
|
|
63
|
+
"GET",
|
|
64
|
+
`${this.apiURL}/general-store/api/${this.apiVersion}/metadata/field-metadata?section=forms&model_name=${model}`,
|
|
65
|
+
{}
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
return _.map(fieldMetadata.fields, 'path')
|
|
57
69
|
}
|
|
58
70
|
}
|
|
59
71
|
|