@zohodesk/library-platform 1.0.0 → 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/es/bc/index.js +1 -0
- package/es/bc/zlist/index.js +2 -0
- package/es/cc/fields/index.js +17 -0
- package/es/cc/index.js +2 -1
- package/es/index.js +10 -0
- package/es/library/dot/legacy-to-new-arch/index.js +2 -1
- package/package.json +5 -4
- package/es/library/behaviours/sort-by/adapters/controllers/Initialize.js +0 -14
- package/es/library/custom-component/adapters/gateways/validator/jsonValidator.js +0 -5
- package/es/library/custom-component/entities/getRef.js +0 -10
- package/es/platform/data-broker/utils/transformer/createCf.js +0 -12
- package/es/platform/data-broker/utils/transformer/transformer.js +0 -25
- package/es/platform/zfield/adapters/gateways/TemplateHelpers.js +0 -30
- package/es/platform/zfield/entities/api-template/APITemplate.js +0 -71
- package/es/platform/zfield/entities/api-template/APITemplates.js +0 -24
- package/es/platform/zfield/entities/interfaces/api-template/APIModels.js +0 -8
- package/es/platform/zfield/entities/interfaces/api-template/IAPITemplate.js +0 -1
- package/es/platform/zfield/entities/interfaces/api-template/IAPITemplates.js +0 -1
- package/es/platform/zfield/entities/interfaces/api-template/ITemplateHelpers.js +0 -1
- package/es/platform/zfield/usecases/entity-factory/FieldBuilder.js +0 -109
- package/es/platform/zfield/usecases/entity-factory/FieldFactory.js +0 -10
- package/es/platform/zfield/usecases/entity-factory/FieldsManagerBuilder.js +0 -49
- package/es/platform/zrecord/adapters/gateways/TemplateHelpers.js +0 -30
- package/es/platform/zrecord/entities/APITemplate.js +0 -75
- package/es/platform/zrecord/entities/APITemplates.js +0 -24
- package/es/platform/zrecord/entities/Property.js +0 -40
- package/es/platform/zrecord/entities/interfaces/APIDetailsModel.js +0 -1
- package/es/platform/zrecord/entities/interfaces/APITemplateModel.js +0 -1
- package/es/platform/zrecord/entities/interfaces/APITemplatesModel.js +0 -1
- package/es/platform/zrecord/entities/interfaces/ActionModel.js +0 -1
- package/es/platform/zrecord/entities/interfaces/IAPITemplate.js +0 -1
- package/es/platform/zrecord/entities/interfaces/IAPITemplates.js +0 -1
- package/es/platform/zrecord/entities/interfaces/IProperties.js +0 -1
- package/es/platform/zrecord/entities/interfaces/ITemplateHelpers.js +0 -1
- package/es/platform/zrecord/entities/interfaces/MetaData.js +0 -1
- package/es/platform/zrecord/usecases/entities-factory/APITemplatesFactory.js +0 -14
- package/es/platform/zrecord/usecases/interfaces/gateways/ITemplateHelpers.js +0 -1
package/es/bc/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./zlist";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { default as BooleanFieldProperties } from "./boolean/Properties";
|
|
2
|
+
export { default as CurrencyFieldProperties } from "./currency/Properties";
|
|
3
|
+
export { default as DateFieldProperties } from "./date/Properties";
|
|
4
|
+
export { default as DecimalFieldProperties } from "./decimal/Properties";
|
|
5
|
+
export { default as DateTimeFieldProperties } from "./datetime/Properties";
|
|
6
|
+
export { default as EmailFieldProperties } from "./email/Properties";
|
|
7
|
+
export { default as FieldFieldProperties } from "./field/Properties";
|
|
8
|
+
export { default as LookupFieldProperties } from "./lookup/Properties";
|
|
9
|
+
export { default as MultiLineFieldProperties } from "./multi-line/Properties";
|
|
10
|
+
export { default as MultiSelectFieldProperties } from "./multi-select/Properties";
|
|
11
|
+
export { default as NumberFieldProperties } from "./number/Properties";
|
|
12
|
+
export { default as PercentFieldProperties } from "./percent/Properties";
|
|
13
|
+
export { default as PhoneFieldProperties } from "./phone/Properties";
|
|
14
|
+
export { default as PickListFieldProperties } from "./pick-list/Properties";
|
|
15
|
+
export { default as TextFieldProperties } from "./text/Properties";
|
|
16
|
+
export { default as UrlFieldProperties } from "./url/Properties";
|
|
17
|
+
export { default as FieldTypes } from "./field/Types";
|
package/es/cc/index.js
CHANGED
package/es/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _CC from "./cc";
|
|
2
|
+
export { _CC as CC };
|
|
3
|
+
import * as _BC from "./bc";
|
|
4
|
+
export { _BC as BC };
|
|
5
|
+
export { TableConnectedFactory } from "./desk-frameworks";
|
|
6
|
+
export { ComponentRegistry, createCustomComponent } from "./library";
|
|
7
|
+
import * as _TableFieldComponents from "./library/dot/legacy-to-new-arch/table-field-components";
|
|
8
|
+
export { _TableFieldComponents as TableFieldComponents };
|
|
9
|
+
import * as _Components from "./library/dot/legacy-to-new-arch";
|
|
10
|
+
export { _Components as Components };
|
|
@@ -5,4 +5,5 @@ export { default as HighlightedValue } from "./highlighted-value/frameworks/ui/H
|
|
|
5
5
|
export { default as Link } from "./link/frameworks/ui/Link";
|
|
6
6
|
export { default as Switch } from "./switch/frameworks/ui/Switch";
|
|
7
7
|
export { default as Tags } from "./tags/frameworks/ui/Tags";
|
|
8
|
-
export { default as Text } from "./text/frameworks/ui/Text";
|
|
8
|
+
export { default as Text } from "./text/frameworks/ui/Text";
|
|
9
|
+
export { default as ActionIcon } from "./action-icon/ActionIcon";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/library-platform",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"files": [
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
"download": "react-cli clean ./node_modules ./package-lock.json && npm install && npm run lint:setup",
|
|
13
13
|
"rtl": "react-cli rtl ./src ./es",
|
|
14
14
|
"cssVariableConvert": "react-cli variableConverter ./es ./es",
|
|
15
|
-
"
|
|
16
|
-
"build
|
|
15
|
+
"clean": "react-cli clean ./es",
|
|
16
|
+
"build": "npm run clean && react-cli build:library:es",
|
|
17
|
+
"build:watch": "npm run clean && npm run build -- -w",
|
|
17
18
|
"test": "react-cli test",
|
|
18
|
-
"prepare": "npm run build && npm run rtl && npm run cssVariableConvert",
|
|
19
|
+
"prepare": "npm run clean && npm run build && npm run rtl && npm run cssVariableConvert",
|
|
19
20
|
"publish:alpha": "npm publish --tag alpha",
|
|
20
21
|
"publish:beta": "npm publish --tag beta",
|
|
21
22
|
"publish:exp": "npm publish --tag experimental",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import createCf from "./createCf";
|
|
2
|
-
|
|
3
|
-
function transformer(_ref, key) {
|
|
4
|
-
let {
|
|
5
|
-
data
|
|
6
|
-
} = _ref;
|
|
7
|
-
let records = data.map(item => {
|
|
8
|
-
let {
|
|
9
|
-
id,
|
|
10
|
-
createdTime
|
|
11
|
-
} = item;
|
|
12
|
-
return {
|
|
13
|
-
id,
|
|
14
|
-
recordName: {
|
|
15
|
-
key: key,
|
|
16
|
-
value: item[key]
|
|
17
|
-
},
|
|
18
|
-
createdTime,
|
|
19
|
-
cf: item.cf ? item.cf : createCf(item, key)
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
return records;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default transformer;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default class TemplateHelpers {
|
|
2
|
-
getPathValue(path, obj) {
|
|
3
|
-
return path.split('.').reduce(function (prev, curr) {
|
|
4
|
-
return prev ? prev[curr] : undefined;
|
|
5
|
-
}, obj);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
replaceTemplateVariables(inputString, replacementObj) {
|
|
9
|
-
return inputString.replace(/{{(.*?)}}/g, (match, key) => {
|
|
10
|
-
let value = this.getPathValue(key.trim(), replacementObj);
|
|
11
|
-
|
|
12
|
-
if (Array.isArray(value) || value instanceof Object) {
|
|
13
|
-
return JSON.stringify(value);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return value !== undefined ? value : match;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
objectToQueryString(obj) {
|
|
21
|
-
return Object.keys(obj).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(obj[key])).join('&');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
constructQueryString(inputString, replacementObj) {
|
|
25
|
-
const replacedString = this.replaceTemplateVariables(inputString, replacementObj);
|
|
26
|
-
const parsedObj = JSON.parse(replacedString);
|
|
27
|
-
return this.objectToQueryString(parsedObj);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
import { API_METHODS } from "../interfaces/api-template/APIModels";
|
|
4
|
-
|
|
5
|
-
class APITemplate {
|
|
6
|
-
constructor(input, templateHelpers) {
|
|
7
|
-
_defineProperty(this, "input", void 0);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "api", void 0);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "payload", void 0);
|
|
12
|
-
|
|
13
|
-
_defineProperty(this, "parameters", void 0);
|
|
14
|
-
|
|
15
|
-
_defineProperty(this, "type", void 0);
|
|
16
|
-
|
|
17
|
-
_defineProperty(this, "helper", void 0);
|
|
18
|
-
|
|
19
|
-
this.input = input;
|
|
20
|
-
this.api = input.api;
|
|
21
|
-
this.payload = input.requestBody;
|
|
22
|
-
this.parameters = input.parameters;
|
|
23
|
-
this.type = API_METHODS[input.type];
|
|
24
|
-
this.helper = templateHelpers;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getApi(obj) {
|
|
28
|
-
return this.helper.replaceTemplateVariables(this.api, obj);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getPayload(obj) {
|
|
32
|
-
if (this.payload) {
|
|
33
|
-
return JSON.parse(this.helper.replaceTemplateVariables(this.payload, obj));
|
|
34
|
-
} else {
|
|
35
|
-
return `{}`;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getParameter(obj) {
|
|
40
|
-
if (this.parameters) {
|
|
41
|
-
return this.helper.replaceTemplateVariables(this.parameters, obj);
|
|
42
|
-
} else {
|
|
43
|
-
return `""`;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
constructURL(obj) {
|
|
48
|
-
const queryObj = JSON.parse(this.getParameter(obj));
|
|
49
|
-
const query = this.helper.objectToQueryString(queryObj);
|
|
50
|
-
return `${this.getApi(obj)}?${query}`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
getApiDetails(obj) {
|
|
54
|
-
return {
|
|
55
|
-
url: this.constructURL(obj),
|
|
56
|
-
type: this.type,
|
|
57
|
-
payload: this.getPayload(obj)
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
getTransformer() {
|
|
62
|
-
return this.input.transformer;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
toObject() {
|
|
66
|
-
return this.input;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export default APITemplate;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class APITemplates {
|
|
2
|
-
constructor(apiTemplates) {
|
|
3
|
-
this.apiTemplates = apiTemplates;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
getAPITemplateByName(name) {
|
|
7
|
-
return this.apiTemplates.get(name);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
getApiDetails(actionName, props) {
|
|
11
|
-
return this.getAPITemplateByName(actionName).getApiDetails(props);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
toObject() {
|
|
15
|
-
const output = {};
|
|
16
|
-
this.apiTemplates.forEach((record, apiName) => {
|
|
17
|
-
output[apiName] = record.toObject();
|
|
18
|
-
});
|
|
19
|
-
return output;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default APITemplates;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
import * as FieldEntities from "../../entities";
|
|
4
|
-
|
|
5
|
-
class FieldBuilder {
|
|
6
|
-
constructor() {
|
|
7
|
-
_defineProperty(this, "id", void 0);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "type", void 0);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "name", void 0);
|
|
12
|
-
|
|
13
|
-
_defineProperty(this, "displayLabel", void 0);
|
|
14
|
-
|
|
15
|
-
_defineProperty(this, "isCustomField", void 0);
|
|
16
|
-
|
|
17
|
-
_defineProperty(this, "i18NLabel", void 0);
|
|
18
|
-
|
|
19
|
-
_defineProperty(this, "isSortable", void 0);
|
|
20
|
-
|
|
21
|
-
_defineProperty(this, "isVisible", void 0);
|
|
22
|
-
|
|
23
|
-
_defineProperty(this, "isReadOnly", void 0);
|
|
24
|
-
|
|
25
|
-
_defineProperty(this, "isEncryptedField", void 0);
|
|
26
|
-
|
|
27
|
-
_defineProperty(this, "isPHI", void 0);
|
|
28
|
-
|
|
29
|
-
_defineProperty(this, "maxLength", void 0);
|
|
30
|
-
|
|
31
|
-
_defineProperty(this, "isMandatory", void 0);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
setId(id) {
|
|
35
|
-
this.id = id;
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
setType(type) {
|
|
40
|
-
if (!FieldEntities[type]) {
|
|
41
|
-
throw new Error(`Invalid field type: ${type}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.type = type;
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
setName(name) {
|
|
49
|
-
this.name = name;
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
setDisplayLabel(displayLabel) {
|
|
54
|
-
this.displayLabel = displayLabel;
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
setIsCustomField(isCustomField) {
|
|
59
|
-
this.isCustomField = isCustomField;
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
setI18NLabel(i18NLabel) {
|
|
64
|
-
this.i18NLabel = i18NLabel;
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
setIsSortable(isSortable) {
|
|
69
|
-
this.isSortable = isSortable;
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
setIsVisible(isVisible) {
|
|
74
|
-
this.isVisible = isVisible;
|
|
75
|
-
return this;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
setIsReadOnly(isReadOnly) {
|
|
79
|
-
this.isReadOnly = isReadOnly;
|
|
80
|
-
return this;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
setIsEncryptedField(isEncryptedField) {
|
|
84
|
-
this.isEncryptedField = isEncryptedField;
|
|
85
|
-
return this;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
setIsPHI(isPHI) {
|
|
89
|
-
this.isPHI = isPHI;
|
|
90
|
-
return this;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
setMaxLength(maxLength) {
|
|
94
|
-
this.maxLength = maxLength;
|
|
95
|
-
return this;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
setIsMandatory(isMandatory) {
|
|
99
|
-
this.isMandatory = isMandatory;
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
build() {
|
|
104
|
-
return new FieldEntities[this.type](this.id, this.type, this.name, this.displayLabel, this.isCustomField, this.i18NLabel, this.isSortable, this.isVisible, this.isReadOnly, this.isEncryptedField, this.isPHI, this.maxLength, this.isMandatory);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export default FieldBuilder;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import FieldBuilder from "./FieldBuilder";
|
|
2
|
-
|
|
3
|
-
class FieldFactory {
|
|
4
|
-
static create(input) {
|
|
5
|
-
return new FieldBuilder().setId(input.id).setType(input.type).setName(input.name).setDisplayLabel(input.displayLabel).setIsCustomField(input.isCustomField).setI18NLabel(input.i18NLabel).setIsSortable(input.isSortable).setIsVisible(input.isVisible).setIsReadOnly(input.isReadOnly).setIsEncryptedField(input.isEncryptedField).setIsPHI(input.isPHI).setMaxLength(input.maxLength).setIsMandatory(input.isMandatory).build();
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default FieldFactory;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
import FieldsManager from "../../entities/fields-manager/FieldsManager";
|
|
4
|
-
|
|
5
|
-
class FieldsManagerBuilder {
|
|
6
|
-
constructor() {
|
|
7
|
-
_defineProperty(this, "availableFields", void 0);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "selectedFields", void 0);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "isAvailableFieldsFetching", void 0);
|
|
12
|
-
|
|
13
|
-
_defineProperty(this, "isSelectedFieldsFetching", void 0);
|
|
14
|
-
|
|
15
|
-
_defineProperty(this, "apiTemplate", void 0);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
setAvailableFields(availableFields) {
|
|
19
|
-
this.availableFields = availableFields;
|
|
20
|
-
return this;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
setSelectedFields(selectedFields) {
|
|
24
|
-
this.selectedFields = selectedFields;
|
|
25
|
-
return this;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
setAvailableFieldsFetchingStatus(isAvailableFieldsFetching) {
|
|
29
|
-
this.isAvailableFieldsFetching = isAvailableFieldsFetching;
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
setSelectedFieldsFetchingStatus(isSelectedFieldsFetching) {
|
|
34
|
-
this.isSelectedFieldsFetching = isSelectedFieldsFetching;
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
setApiTemplate(apiTemplate) {
|
|
39
|
-
this.apiTemplate = apiTemplate;
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
build() {
|
|
44
|
-
return new FieldsManager(this.availableFields, this.selectedFields, this.isAvailableFieldsFetching, this.isSelectedFieldsFetching, this.apiTemplate);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default FieldsManagerBuilder;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default class TemplateHelpers {
|
|
2
|
-
getPathValue(path, obj) {
|
|
3
|
-
return path.split('.').reduce(function (prev, curr) {
|
|
4
|
-
return prev ? prev[curr] : undefined;
|
|
5
|
-
}, obj);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
replaceTemplateVariables(inputString, replacementObj) {
|
|
9
|
-
return inputString.replace(/{{(.*?)}}/g, (match, key) => {
|
|
10
|
-
let value = this.getPathValue(key.trim(), replacementObj);
|
|
11
|
-
|
|
12
|
-
if (Array.isArray(value) || value instanceof Object) {
|
|
13
|
-
return JSON.stringify(value);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return value !== undefined ? value : match;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
objectToQueryString(obj) {
|
|
21
|
-
return Object.keys(obj).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(obj[key])).join('&');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
constructQueryString(inputString, replacementObj) {
|
|
25
|
-
const replacedString = this.replaceTemplateVariables(inputString, replacementObj);
|
|
26
|
-
const parsedObj = JSON.parse(replacedString);
|
|
27
|
-
return this.objectToQueryString(parsedObj);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
class APITemplate {
|
|
4
|
-
constructor(input, templateHelpers) {
|
|
5
|
-
_defineProperty(this, "input", void 0);
|
|
6
|
-
|
|
7
|
-
_defineProperty(this, "api", void 0);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "payload", void 0);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "parameters", void 0);
|
|
12
|
-
|
|
13
|
-
_defineProperty(this, "type", void 0);
|
|
14
|
-
|
|
15
|
-
_defineProperty(this, "helper", void 0);
|
|
16
|
-
|
|
17
|
-
this.input = input;
|
|
18
|
-
this.api = input.api;
|
|
19
|
-
this.payload = input.requestBody;
|
|
20
|
-
this.parameters = input.parameters;
|
|
21
|
-
this.type = input.type;
|
|
22
|
-
this.helper = templateHelpers;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getApi(obj) {
|
|
26
|
-
return this.helper.replaceTemplateVariables(this.api, obj);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getPayload(obj) {
|
|
30
|
-
if (this.payload) {
|
|
31
|
-
return this.helper.replaceTemplateVariables(this.payload, obj);
|
|
32
|
-
} else {
|
|
33
|
-
return `{}`;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getParameter(obj) {
|
|
38
|
-
if (this.parameters) {
|
|
39
|
-
return this.helper.replaceTemplateVariables(this.parameters, obj);
|
|
40
|
-
} else {
|
|
41
|
-
return `""`;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
constructURL(obj) {
|
|
46
|
-
const queryObj = JSON.parse(this.getParameter(obj));
|
|
47
|
-
const query = this.helper.objectToQueryString(queryObj);
|
|
48
|
-
|
|
49
|
-
if (query === '') {
|
|
50
|
-
return this.getApi(obj);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return `${this.getApi(obj)}?${query}`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getApiDetails(obj) {
|
|
57
|
-
return {
|
|
58
|
-
url: this.constructURL(obj),
|
|
59
|
-
type: this.type,
|
|
60
|
-
method: this.type,
|
|
61
|
-
payload: this.getPayload(obj)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
getTransformer() {
|
|
66
|
-
return this.input.transformer;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
toObject() {
|
|
70
|
-
return this.input;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default APITemplate;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class APITemplates {
|
|
2
|
-
constructor(apiTemplates) {
|
|
3
|
-
this.apiTemplates = apiTemplates;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
getAPITemplateByName(name) {
|
|
7
|
-
return this.apiTemplates.get(name);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
getApiDetails(actionName, props) {
|
|
11
|
-
return this.getAPITemplateByName(actionName).getApiDetails(props);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
toObject() {
|
|
15
|
-
const output = {};
|
|
16
|
-
this.apiTemplates.forEach((record, apiName) => {
|
|
17
|
-
output[apiName] = record.toObject();
|
|
18
|
-
});
|
|
19
|
-
return output;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export default APITemplates;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
class Property {
|
|
4
|
-
constructor() {
|
|
5
|
-
_defineProperty(this, "name", void 0);
|
|
6
|
-
|
|
7
|
-
_defineProperty(this, "required", void 0);
|
|
8
|
-
|
|
9
|
-
_defineProperty(this, "defaultValue", void 0);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "label", void 0);
|
|
12
|
-
|
|
13
|
-
_defineProperty(this, "typeMetadata", void 0);
|
|
14
|
-
|
|
15
|
-
_defineProperty(this, "value", void 0);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getRequired() {
|
|
19
|
-
return this.required;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getName() {
|
|
23
|
-
return this.name;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
getDefaultValue() {
|
|
27
|
-
return this.defaultValue;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getTypeMetadata() {
|
|
31
|
-
return this.typeMetadata;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getValue() {
|
|
35
|
-
return this.value == undefined ? this.defaultValue : this.value;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default Property;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { RECORD_FAILURE, RECORD_SUCCESS } from "../../../../bc/zrecord/Symbols";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import APITemplate from "../../entities/APITemplate";
|
|
2
|
-
import APITemplates from "../../entities/APITemplates";
|
|
3
|
-
export default class APITemplatesFactory {
|
|
4
|
-
static create(httpTemplates, templateHelpers) {
|
|
5
|
-
const apiTemplatesMap = new Map();
|
|
6
|
-
Object.keys(httpTemplates).forEach(key => {
|
|
7
|
-
const apiTemplateTemplate = httpTemplates[key];
|
|
8
|
-
const apiTemplate = new APITemplate(apiTemplateTemplate, templateHelpers);
|
|
9
|
-
apiTemplatesMap.set(key, apiTemplate);
|
|
10
|
-
});
|
|
11
|
-
return new APITemplates(apiTemplatesMap);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ITemplateHelpers } from "../../../entities/interfaces/ITemplateHelpers";
|