@ixon-cdk/core 1.1.0 → 1.2.0-next.0
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/api/deploy.service.js +6 -4
- package/package.json +1 -1
- package/server/index.js +1 -0
package/api/deploy.service.js
CHANGED
|
@@ -26,7 +26,7 @@ module.exports = class DeployService extends ApiBaseService {
|
|
|
26
26
|
fetchPublishable(companyId, templateId) {
|
|
27
27
|
return this._fetchDescTemplateVersions(companyId, templateId).then((versions) => {
|
|
28
28
|
const publishedIdx = versions.findIndex((v) => typeof v.publishedOn === 'string');
|
|
29
|
-
|
|
29
|
+
return publishedIdx !== -1 ? versions.slice(0, publishedIdx) : versions;
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -55,10 +55,12 @@ module.exports = class DeployService extends ApiBaseService {
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
publishLatestVersion(companyId, templateId) {
|
|
59
|
-
return this.fetchPublishable(companyId, templateId).then(
|
|
58
|
+
publishLatestVersion(companyId, templateId, failNoUnpublished) {
|
|
59
|
+
return this.fetchPublishable(companyId, templateId).then(data => {
|
|
60
60
|
if (!data.length) {
|
|
61
|
-
return
|
|
61
|
+
return failNoUnpublished
|
|
62
|
+
? Promise.reject('Template has no publishable versions')
|
|
63
|
+
: Promise.resolve('Template has no publishable versions');
|
|
62
64
|
}
|
|
63
65
|
const latest = data.sort((v1, v2) => Number(v2.number) - Number(v1.number))[0];
|
|
64
66
|
return this._publish(companyId, latest.publicId);
|
package/package.json
CHANGED