@pega/custom-dx-components 0.25.19 → 0.25.21

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.
Files changed (163) hide show
  1. package/package.json +2 -2
  2. package/src/tasks/build-jest-assets/index.js +5 -5
  3. package/src/tasks/create/templates/Constellation/Field/Boolean/create-nonce.ts.mustache +1 -0
  4. package/src/tasks/create/templates/Constellation/Field/Date/create-nonce.ts.mustache +1 -0
  5. package/src/tasks/create/templates/Constellation/Field/Date/date.ts.mustache +0 -24
  6. package/src/tasks/create/templates/Constellation/Field/DateTime/create-nonce.ts.mustache +1 -0
  7. package/src/tasks/create/templates/Constellation/Field/Decimal/create-nonce.ts.mustache +1 -0
  8. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/create-nonce.ts.mustache +1 -0
  9. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/create-nonce.ts.mustache +1 -0
  10. package/src/tasks/create/templates/Constellation/Field/Icon-Button-URL/create-nonce.ts.mustache +1 -0
  11. package/src/tasks/create/templates/Constellation/Field/Integer/create-nonce.ts.mustache +1 -0
  12. package/src/tasks/create/templates/Constellation/Field/Picklist/create-nonce.ts.mustache +1 -0
  13. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/create-nonce.ts.mustache +1 -0
  14. package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/repeat-utils.ts.mustache +0 -4
  15. package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/create-nonce.ts.mustache +1 -0
  16. package/src/tasks/create/templates/Constellation/Field/Text/create-nonce.ts.mustache +1 -0
  17. package/src/tasks/create/templates/Constellation/Field/Text-Email/create-nonce.ts.mustache +1 -0
  18. package/src/tasks/create/templates/Constellation/Field/Text-Input/create-nonce.ts.mustache +1 -0
  19. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/create-nonce.ts.mustache +1 -0
  20. package/src/tasks/create/templates/Constellation/Field/Text-Phone/create-nonce.ts.mustache +1 -0
  21. package/src/tasks/create/templates/Constellation/Field/Text-URL/create-nonce.ts.mustache +1 -0
  22. package/src/tasks/create/templates/Constellation/Field/TimeofDay/create-nonce.ts.mustache +1 -0
  23. package/src/tasks/create/templates/Constellation/Template/DETAILS/create-nonce.ts.mustache +1 -0
  24. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/create-nonce.ts.mustache +1 -0
  25. package/src/tasks/create/templates/Constellation/Template/FORM/create-nonce.ts.mustache +1 -0
  26. package/src/tasks/create/templates/Constellation/Template/FORM-region/create-nonce.ts.mustache +1 -0
  27. package/src/tasks/create/templates/Constellation/Template/PAGE/create-nonce.ts.mustache +1 -0
  28. package/src/tasks/create/templates/Constellation/Widget/CASE/create-nonce.ts.mustache +1 -0
  29. package/src/tasks/create/templates/Constellation/Widget/PAGE/create-nonce.ts.mustache +1 -0
  30. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/create-nonce.ts.mustache +1 -0
  31. package/src/tasks/create/templates/Launchpad/Field/Icon-Button-URL/create-nonce.ts.mustache +1 -0
  32. package/src/tasks/create/templates/Launchpad/Widget/CASE/create-nonce.ts.mustache +1 -0
  33. package/src/tasks/create/templates/Launchpad/Widget/PAGE/create-nonce.ts.mustache +1 -0
  34. package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/create-nonce.ts.mustache +1 -0
  35. package/src/tasks/create-lib/helper.js +6 -2
  36. package/src/tasks/create-lib/index.js +3 -1
  37. package/src/tasks/delete-pub/index.js +3 -1
  38. package/src/tasks/export-archive/index.js +10 -5
  39. package/src/tasks/import-archive/index.js +12 -18
  40. package/src/tasks/init/template/.eslintrc.json +1 -1
  41. package/src/tasks/init/template/package.json.mustache +4 -4
  42. package/src/tasks/list-pub/index.js +15 -7
  43. package/src/tasks/publish-lib/index.js +131 -135
  44. package/src/tasks/restore/index.js +7 -1
  45. package/src/tasks/show-status/index.js +10 -6
  46. package/src/util.js +83 -4
  47. package/tests/assets/library/components/create/Pega_DXIL_MyTestText/config.json +1 -1
  48. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyBoolean/config.json +1 -1
  49. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/config.json +1 -1
  50. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/localizations.json +8 -0
  51. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyCurrency/config.json +1 -1
  52. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDate/config.json +1 -1
  53. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDateTime/config.json +1 -1
  54. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDecimal/config.json +1 -1
  55. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyDetails/config.json +1 -1
  56. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyEmail/config.json +1 -1
  57. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyForm/config.json +1 -1
  58. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/config.json +1 -1
  59. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/localizations.json +10 -0
  60. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyInteger/config.json +1 -1
  61. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPage/config.json +1 -1
  62. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/config.json +1 -1
  63. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/config.json +1 -1
  64. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPageWidget/localizations.json +10 -0
  65. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyParagraph/config.json +1 -1
  66. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPercentage/config.json +1 -1
  67. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPhone/config.json +1 -1
  68. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyPicklist/config.json +1 -1
  69. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/config.json +1 -1
  70. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/config.json +1 -1
  71. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MySearchbox/localizations.json +5 -0
  72. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyText/config.json +1 -1
  73. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTextInput/config.json +1 -1
  74. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/config.json +1 -1
  75. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/config.json +1 -1
  76. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/config.json +1 -1
  77. package/tests/assets/library/components/createAll/Constellation/Pega_DXIL_MyURL/config.json +1 -1
  78. package/tests/assets/original/components/create/Pega_DXIL_MyTestText/create-nonce.ts +1 -0
  79. package/tests/assets/original/components/create/shared/PConnProps.d.ts +46 -0
  80. package/tests/assets/original/components/create/shared/create-nonce.ts +7 -0
  81. package/tests/assets/original/components/create/shared/suggestions-handler.ts +9 -0
  82. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyBoolean/create-nonce.ts +1 -0
  83. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/create-nonce.ts +1 -0
  84. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/localizations.json +8 -0
  85. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyCurrency/create-nonce.ts +1 -0
  86. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/create-nonce.ts +1 -0
  87. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDate/date.ts +0 -24
  88. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDateTime/create-nonce.ts +1 -0
  89. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDecimal/create-nonce.ts +1 -0
  90. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyDetails/create-nonce.ts +1 -0
  91. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyEmail/create-nonce.ts +1 -0
  92. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyForm/create-nonce.ts +1 -0
  93. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/create-nonce.ts +1 -0
  94. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyIconButtonURL/localizations.json +10 -0
  95. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyInteger/create-nonce.ts +1 -0
  96. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPage/create-nonce.ts +1 -0
  97. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/create-nonce.ts +1 -0
  98. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/create-nonce.ts +1 -0
  99. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPageWidget/localizations.json +10 -0
  100. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyParagraph/create-nonce.ts +1 -0
  101. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPercentage/create-nonce.ts +1 -0
  102. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPhone/create-nonce.ts +1 -0
  103. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyPicklist/create-nonce.ts +1 -0
  104. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyRadiobuttons/create-nonce.ts +1 -0
  105. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/create-nonce.ts +1 -0
  106. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/localizations.json +5 -0
  107. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MySearchbox/repeat-utils.ts +0 -4
  108. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyText/create-nonce.ts +1 -0
  109. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTextInput/create-nonce.ts +1 -0
  110. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/create-nonce.ts +1 -0
  111. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/create-nonce.ts +1 -0
  112. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/create-nonce.ts +1 -0
  113. package/tests/assets/original/components/createAll/Constellation/Pega_DXIL_MyURL/create-nonce.ts +1 -0
  114. package/tests/assets/original/components/createAll/Constellation/shared/PConnProps.d.ts +46 -0
  115. package/tests/assets/original/components/createAll/Constellation/shared/create-nonce.ts +7 -0
  116. package/tests/assets/original/components/createAll/Constellation/shared/suggestions-handler.ts +9 -0
  117. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyBoolean/create-nonce.ts +1 -0
  118. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCaseWidget/create-nonce.ts +1 -0
  119. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyCurrency/create-nonce.ts +1 -0
  120. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/create-nonce.ts +1 -0
  121. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDate/date.ts +0 -24
  122. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDateTime/create-nonce.ts +1 -0
  123. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDecimal/create-nonce.ts +1 -0
  124. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyDetails/create-nonce.ts +1 -0
  125. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyEmail/create-nonce.ts +1 -0
  126. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyForm/create-nonce.ts +1 -0
  127. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyIconButtonURL/create-nonce.ts +1 -0
  128. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyInteger/create-nonce.ts +1 -0
  129. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPage/create-nonce.ts +1 -0
  130. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/create-nonce.ts +1 -0
  131. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/create-nonce.ts +1 -0
  132. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyParagraph/create-nonce.ts +1 -0
  133. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPercentage/create-nonce.ts +1 -0
  134. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPhone/create-nonce.ts +1 -0
  135. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyPicklist/create-nonce.ts +1 -0
  136. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyRadiobuttons/create-nonce.ts +1 -0
  137. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/create-nonce.ts +1 -0
  138. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/localizations.json +5 -0
  139. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MySearchbox/repeat-utils.ts +0 -4
  140. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyText/create-nonce.ts +1 -0
  141. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTextInput/create-nonce.ts +1 -0
  142. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/create-nonce.ts +1 -0
  143. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/create-nonce.ts +1 -0
  144. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/create-nonce.ts +1 -0
  145. package/tests/assets/original/components/createAll/Launchpad/Pega_DXIL_MyURL/create-nonce.ts +1 -0
  146. package/tests/assets/original/components/createAll/Launchpad/shared/PConnProps.d.ts +46 -0
  147. package/tests/assets/original/components/createAll/Launchpad/shared/create-nonce.ts +7 -0
  148. package/tests/assets/original/components/createAll/Launchpad/shared/suggestions-handler.ts +9 -0
  149. package/tests/functional/localCreateAllListDeleteAll.test.js +8 -8
  150. package/tests/functional/localLibCreateLibAlreadyDeleteLib.test.js +14 -14
  151. package/tests/functional/localLibCreateLibBuildLibDeleteLib.test.js +17 -17
  152. package/tests/functional/localLibCreateLibBuildLibListPubDeleteLib.test.js +20 -20
  153. package/tests/functional/localLibCreateLibDeleteLib.test.js +17 -17
  154. package/tests/functional/localLibCreateLibExportImportLib.test.js +27 -27
  155. package/tests/functional/localLibCreateLibExportLib.test.js +19 -19
  156. package/tests/functional/localLibCreateLibImportCompDeleteLib.test.js +14 -14
  157. package/tests/functional/localLibCreateLibListDeleteLib.test.js +22 -22
  158. package/tests/functional/localLibCreateLibListMoveDeleteLib.test.js +31 -31
  159. package/tests/functional/localLibCreateLibListSwitchDeleteLib.test.js +20 -20
  160. package/tests/functional/localLibCreateLibStatusDeleteLib.test.js +13 -29
  161. package/tests/functional/localLibCreateLibValidateDeleteLib.test.js +15 -15
  162. package/tests/functional/localLibCreateLibVersionDeleteLib.test.js +27 -27
  163. package/tests/functional/localLibCreateLibPermDeleteLib.test.js +0 -144
@@ -67,6 +67,8 @@ addDebugLog("doesLibraryExist", `libraryName: ${libraryName}, libraryVersion: ${
67
67
 
68
68
 
69
69
  export const zipLibraryComponent = async (libraryName, version) => {
70
+ addDebugLog("zipLibraryComponent", `libraryName: ${libraryName}, libraryVersion: ${version}`, "");
71
+
70
72
  const currentDirectory = process.cwd();
71
73
  const libraryDirName = `${libraryName}/${version}`;
72
74
  const libraryDirectory = path.join(currentDirectory, libraryDirName);
@@ -79,15 +81,20 @@ export const zipLibraryComponent = async (libraryName, version) => {
79
81
  const zipChunks = [];
80
82
  archive.on('data', chunk => zipChunks.push(chunk));
81
83
 
82
- // Add src directory
83
- archive.directory(libraryDirectory, 'src');
84
+ // No going to add full list of created by buildLib, instead
85
+ // below going just just *.js files and a few specific .json files
86
+ // // Add main directory as src directory in zip
87
+ // archive.directory(libraryDirectory, 'src');
88
+
89
+ // only zip *.js files, not *.js.br, *.js.map, license, text, json, etc.
90
+ archive.glob("*.js", { cwd: libraryDirectory });
84
91
 
85
- // Add config.json file
92
+ // Add componentsconfig.json.json file (array of config.json)
86
93
  if (fs.existsSync(componentsConfigJson)) {
87
94
  archive.file(componentsConfigJson, { name: path.basename(componentsConfigJson) });
88
95
  }
89
96
 
90
- // Add localizations file
97
+ // Add componentslocalization.jspon (array of component localizations) file
91
98
  if (fs.existsSync(localizationsJson)) {
92
99
  archive.file(localizationsJson, { name: path.basename(localizationsJson) });
93
100
  }
@@ -118,136 +125,138 @@ export const zipLibraryComponent = async (libraryName, version) => {
118
125
 
119
126
 
120
127
  export const publishComponentLibraryToServer = async (data, doFetch) => {
121
- addDebugLog("publishComponentToServer", `data: ${data}`, "");
122
- const { configContent, zipContent, localizationsContent, rulesetName, rulesetVersion, libraryName, version } = data;
123
-
124
- const defaultPegaServerConfig = await getPegaServerConfig();
125
- const { serverType, isolationId } = defaultPegaServerConfig;
126
- const isLaunchpad = serverType === 'launchpad';
127
- const launchpadRestEndpoint = LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT.replace(
128
- '{isolationId}',
129
- isolationId || 'undefined'
130
- );
131
- let apiBody;
132
-
133
- if (isLaunchpad) {
134
- // currently no launchpad records to rule resolve a library
135
-
136
- // apiBody = {
137
- // type: 'CustomComponent',
138
- // zipContent,
139
- // componentName: JSON.parse(configContent).componentKey,
140
- // pxUpdateDateTime: '',
141
- // environmentID: defaultPegaServerConfig.isolationId
142
- // };
143
- } else {
144
- apiBody = {
145
- configContent,
146
- zipContent,
147
- publishFor: 'constellation',
148
- rulesetName,
149
- rulesetVersion,
150
- libraryName,
151
- version,
152
- category: '',
153
- localizationsContent
154
- };
155
- }
128
+ addDebugLog("publishComponentToServer", `data: ${data}`, "");
129
+ const { configContent, zipContent, localizationsContent, rulesetName, rulesetVersion, libraryName, version } = data;
130
+
131
+ const defaultPegaServerConfig = await getPegaServerConfig();
132
+ const { serverType, isolationId } = defaultPegaServerConfig;
133
+ const isLaunchpad = serverType === 'launchpad';
134
+ const launchpadRestEndpoint = LP_PUBLISH_COMPONENT_SERVICE_REST_ENDPOINT.replace(
135
+ '{isolationId}',
136
+ isolationId || 'undefined'
137
+ );
138
+ let apiBody;
139
+
140
+ if (isLaunchpad) {
141
+ // currently no launchpad records to rule resolve a library
142
+
143
+ // apiBody = {
144
+ // type: 'CustomComponent',
145
+ // zipContent,
146
+ // componentName: JSON.parse(configContent).componentKey,
147
+ // pxUpdateDateTime: '',
148
+ // environmentID: defaultPegaServerConfig.isolationId
149
+ // };
150
+ } else {
151
+ apiBody = {
152
+ configContent,
153
+ zipContent,
154
+ publishFor: 'constellation',
155
+ rulesetName,
156
+ rulesetVersion,
157
+ libraryName,
158
+ version,
159
+ category: '',
160
+ localizationsContent
161
+ };
162
+ }
156
163
 
157
- const defaultPegaConfig = await getPegaServerConfig();
158
- const url = constructCompleteUrl(
159
- defaultPegaConfig.server,
160
- isLaunchpad ? launchpadRestEndpoint : PUBLISH_COMPONENT_LIBRARY_SERVICE_REST_ENDPOINT
161
- );
162
-
163
- if (doFetch) {
164
- try {
165
- const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
166
- if (OauthData) {
167
- const {
168
- access_token: accessToken,
169
- token_type: tokenType
170
- // refresh_token: refreshToken
171
- } = JSON.parse(OauthData);
172
- let status = 500;
173
- let headers = {};
174
-
175
- if (isLaunchpad) {
176
- headers.cookie = `Pega-AAT=${accessToken}`;
177
- headers['Content-Type'] = 'application/json';
178
- } else {
179
- headers.Authorization = `${tokenType} ${accessToken}`;
180
- }
164
+ const defaultPegaConfig = await getPegaServerConfig();
165
+ const url = constructCompleteUrl(
166
+ defaultPegaConfig.server,
167
+ isLaunchpad ? launchpadRestEndpoint : PUBLISH_COMPONENT_LIBRARY_SERVICE_REST_ENDPOINT
168
+ );
181
169
 
182
- let spinner;
183
-
184
- console.log();
185
- spinner = ora(chalk.green.bold('Publishing library...')).start();
186
-
187
- const response = await fetch(url, {
188
- method: 'POST',
189
- agent: getHttpsAgent(defaultPegaConfig),
190
- headers,
191
- body: JSON.stringify(apiBody)
192
- });
193
-
194
- spinner.stop();
195
-
196
- status = response.status;
197
- if (!response.ok) {
198
- if (status === 401) {
199
- throw new Error(
200
- 'Error occurred in authentication. Please regenerate using authenticate'
201
- );
202
- // console.log(accessTokenUri, refreshToken);
203
- /* TODO - Handle refresh_token */
204
- } else if (status === 404) {
205
- throw new Error('404: Server resource not found');
206
- } else if (status === 405) {
207
- throw new Error('405: Server method not allowed');
208
- } else if (status === 408) {
209
- throw new Error('408: Server timed out');
210
- } else if (response.status === 403) {
211
- throw new Error('Error forbidden: User does not have privileges to Publish.');
212
- }
170
+ if (doFetch) {
171
+ try {
172
+ const OauthData = fs.readFileSync(TOKEN_PATH, 'utf8');
173
+ if (OauthData) {
174
+ const {
175
+ access_token: accessToken,
176
+ token_type: tokenType
177
+ // refresh_token: refreshToken
178
+ } = JSON.parse(OauthData);
179
+ let status = 500;
180
+ let headers = {};
181
+
182
+ if (isLaunchpad) {
183
+ headers.cookie = `Pega-AAT=${accessToken}`;
184
+ headers['Content-Type'] = 'application/json';
185
+ } else {
186
+ headers.Authorization = `${tokenType} ${accessToken}`;
187
+ }
188
+
189
+ let spinner;
190
+
191
+ console.log();
192
+ spinner = ora(chalk.green.bold('Publishing library...')).start();
193
+
194
+ const response = await fetch(url, {
195
+ method: 'POST',
196
+ agent: getHttpsAgent(defaultPegaConfig),
197
+ headers,
198
+ body: JSON.stringify(apiBody)
199
+ });
200
+
201
+ spinner.stop();
202
+
203
+ status = response.status;
204
+ if (!response.ok) {
205
+ if (status === 401) {
206
+ throw new Error(
207
+ 'Error occurred in authentication. Please regenerate using authenticate'
208
+ );
209
+ // console.log(accessTokenUri, refreshToken);
210
+ /* TODO - Handle refresh_token */
211
+ } else if (status === 404) {
212
+ throw new Error('404: Server resource not found');
213
+ } else if (status === 405) {
214
+ throw new Error('405: Server method not allowed');
215
+ } else if (status === 408) {
216
+ throw new Error('408: Server timed out');
217
+ } else if (response.status === 403) {
218
+ throw new Error('Error forbidden: User does not have privileges to Publish.');
213
219
  }
220
+ }
214
221
 
215
- try {
216
- // const respData = isLaunchpad ? await response.text() : await response.json();
217
- const headerType = response.headers.get('content-type');
218
- const respData = headerType.includes("json") ? await response.json() : await response.text();
219
- let respMessage = headerType.includes("json") ? respData.message : respData;
222
+ try {
223
+ // const respData = isLaunchpad ? await response.text() : await response.json();
224
+ const headerType = response.headers.get('content-type');
225
+ const respData = headerType.includes("json") ? await response.json() : await response.text();
226
+ let respMessage = headerType.includes("json") ? respData.message : respData;
220
227
 
221
228
 
222
- if (status === 500) {
223
- status = 999;
224
- if (respMessage === '') {
225
- respMessage = `Server error, please check server logs for error.`;
226
- }
227
- throw new Error(respMessage);
229
+ if (status === 500) {
230
+ status = 999;
231
+ if (respMessage === '') {
232
+ respMessage = `Server error, please check server logs for error.`;
228
233
  }
234
+ throw new Error(respMessage);
235
+ }
229
236
 
230
- console.log(chalk.bold.green(`Success : ${respMessage }`));
237
+ console.log(chalk.bold.green(`Success : ${respMessage }`));
231
238
 
232
- } catch (err) {
233
- if (status === 500) {
234
- throw new Error(`Server error, please check server logs for error.`);
235
- } else if (status === 999) {
236
- throw new Error(err);
237
- }
239
+ } catch (err) {
240
+ if (status === 500) {
241
+ throw new Error(`Server error, please check server logs for error.`);
242
+ } else if (status === 999) {
243
+ throw new Error(err);
238
244
  }
239
- } else {
240
- throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
241
245
  }
242
- } catch (err) {
243
- // throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
244
- throw new Error(err);
246
+ } else {
247
+ throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
245
248
  }
249
+ } catch (err) {
250
+ // throw new Error(`Error occurred in authentication. Please regenerate using authenticate`);
251
+ throw new Error(err);
246
252
  }
247
- };
253
+ }
254
+ };
248
255
 
249
256
 
250
257
  export const publishUILibraryComponentToInfinity = async (content) => {
258
+ addDebugLog("publishUILibraryComponentToInfinity", `content: ${content}`, "");
259
+
251
260
  // const compDef = getConfigDefaults();
252
261
  // const organization = compDef.organization;
253
262
  // const library = compDef.library;
@@ -267,16 +276,15 @@ export const publishUILibraryComponentToInfinity = async (content) => {
267
276
  // console.log(chalk.green.bold(`Success: Published ${content.libraryName}/${content.version} to server as a CL.`));
268
277
  }
269
278
  catch (err) {
270
- console.log(chalk.bold.red(err.toString()));
279
+ let sErr = err.toString();
280
+ // strip all Error:
281
+ sErr = sErr.replaceAll("Error: ", "");
282
+ console.log(chalk.bold.red("Error: " + sErr));
271
283
  }
272
284
 
273
-
274
-
275
285
  }
276
286
 
277
287
 
278
-
279
-
280
288
  export const publishNewLibraryAsync = async (libraryName, version, checkDeleted = false) => {
281
289
  addDebugLog("publishNewLibraryAsync", `libraryName: ${libraryName}, version: ${version}, checkDeleted: ${checkDeleted} `, "");
282
290
 
@@ -372,13 +380,6 @@ addDebugLog("publishLibrary", "", "+");
372
380
 
373
381
  version = orgLib.buildVersion;
374
382
 
375
- // check to see if devBuild
376
- // const devBuild = await getConfigDevBuild();
377
- // const devBuild = orgLib.devBuild;
378
- // if (devBuild) {
379
- // version = version.concat("-dev");
380
- // }
381
-
382
383
  }
383
384
 
384
385
  const tokenAndStaticServer = await getC11NB2STokenAndStaticServer();
@@ -414,10 +415,8 @@ addDebugLog("publishLibrary", "", "+");
414
415
  ({version} = versionAnswers);
415
416
  }
416
417
 
417
-
418
418
  let okToPublish = true;
419
419
 
420
-
421
420
  // this check matches check below, but for JEST, we don't want to go any further, just verifying if will
422
421
  // be caught
423
422
  if (noRealPublish && !version.includes("-dev")) {
@@ -425,7 +424,6 @@ addDebugLog("publishLibrary", "", "+");
425
424
  return;
426
425
  }
427
426
 
428
-
429
427
  if (!version.includes("-dev") && !internalPublish && !isLibraryBasedCL) {
430
428
  okToPublish = false;
431
429
  const publishAnswers = await inquirer.prompt([
@@ -457,7 +455,6 @@ addDebugLog("publishLibrary", "", "+");
457
455
  let content = { libraryName, version, rulesetName, rulesetVersion };
458
456
  await publishUILibraryComponentToInfinity(content);
459
457
 
460
-
461
458
  }
462
459
  else {
463
460
  let libVersionExists = await doesLibraryExist(libraryName, version);
@@ -515,7 +512,6 @@ addDebugLog("publishLibrary", "", "+");
515
512
  }
516
513
 
517
514
 
518
-
519
515
  addDebugLog("publishLibrary", "END", "-");
520
516
 
521
517
  return true;
@@ -10,9 +10,12 @@ import {
10
10
  getConfigDefaults,
11
11
  getLibraryBased,
12
12
  restoreFromArchive,
13
- cleanUpTemp
13
+ cleanUpTemp,
14
+ forceDefaultsUpdate
14
15
  } from '../../util.js';
15
16
 
17
+ import { showCurrentStatus } from '../show-status/index.js';
18
+
16
19
  export default async options => {
17
20
  await showVersion();
18
21
  await checkLibraryAndArchives();
@@ -61,6 +64,9 @@ addDebugLog("restoreComponent", "", "+");
61
64
  process.exit(1);
62
65
  });
63
66
  console.log(chalk.greenBright('\nComponents restored'));
67
+
68
+ await forceDefaultsUpdate();
69
+ await showCurrentStatus();
64
70
  }
65
71
 
66
72
 
@@ -3,12 +3,13 @@ import path from 'path';
3
3
 
4
4
  import chalk from 'chalk';
5
5
 
6
- import { showVersion, getLibraryBased, addDebugLog, getConfigDefaults, getComponents, checkLibraryAndArchives } from '../../util.js';
6
+ import { showVersion, getLibraryBased, addDebugLog, getConfigDefaults, getComponents, checkLibraryAndArchives, getLibraryBasedCL } from '../../util.js';
7
7
 
8
8
  export const showCurrentStatus = async () => {
9
9
 
10
10
  const configDefaults = getConfigDefaults();
11
11
  const componentList = await getComponents();
12
+ const isLibraryBasedCL = getLibraryBasedCL();
12
13
 
13
14
  console.log("");
14
15
  console.log("\tCurrent status");
@@ -16,12 +17,15 @@ export const showCurrentStatus = async () => {
16
17
  console.log(`\tOrganization:\t ${chalk.bold.green(`${configDefaults.organization}`)}`);
17
18
  console.log(`\tLibrary:\t ${chalk.bold.green(`${configDefaults.library}`)}`);
18
19
  console.log(`\tVersion:\t ${chalk.bold.green(`${configDefaults.buildVersion}`)}`);
19
- if (!configDefaults.devBuild) {
20
- console.log(`\tPermanent:\t ${chalk.bold.magentaBright(`${!configDefaults.devBuild}`)}`);
21
- }
22
- else {
23
- console.log(`\tPermanent:\t ${chalk.bold.green(`${!configDefaults.devBuild}`)}`);
20
+ if (!isLibraryBasedCL) {
21
+ if (!configDefaults.devBuild) {
22
+ console.log(`\tPermanent:\t ${chalk.bold.magentaBright(`${!configDefaults.devBuild}`)}`);
23
+ }
24
+ else {
25
+ console.log(`\tPermanent:\t ${chalk.bold.green(`${!configDefaults.devBuild}`)}`);
26
+ }
24
27
  }
28
+
25
29
  console.log(`\tComponent count: ${chalk.bold.green(`${componentList.length}`)}`);
26
30
 
27
31
  console.log("");
package/src/util.js CHANGED
@@ -155,6 +155,11 @@ export const setUpDefaults = async () => {
155
155
 
156
156
  if (data[LIBRARY_BASED_CL]) {
157
157
  retrievedConfigData.isLibraryBasedCL = data[LIBRARY_BASED_CL];
158
+
159
+ // if this is true, then force librarybased to true, so it doesn't have to be set
160
+ if (retrievedConfigData.isLibraryBasedCL) {
161
+ retrievedConfigData.isLibraryBased = retrievedConfigData.isLibraryBasedCL;
162
+ }
158
163
  }
159
164
 
160
165
 
@@ -470,6 +475,55 @@ if (showDebug) addDebugLog("setLibraryBased", "", "");
470
475
 
471
476
  }
472
477
 
478
+ export const setLibraryBasedCL = async (isLibraryBasedCL) => {
479
+ if (showDebug) addDebugLog("setLibraryBased", "", "");
480
+ const currentDirectory = process.cwd();
481
+ const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
482
+
483
+ try {
484
+ // force to throw error and not console log
485
+ await checkPathAccess(pegaConfigJsonPath, {}, true);
486
+ }
487
+ catch (ex) {
488
+ // when can't find it, always be false, assume no library based.
489
+ // This is IMPORTANT for init (npx install)
490
+ return false;
491
+ }
492
+
493
+ let data = fs.readFileSync(pegaConfigJsonPath, { encoding: 'utf8' });
494
+ data = JSON.parse(data);
495
+
496
+ if (data[LIBRARY_BASED_CL] != undefined) {
497
+ data[LIBRARY_BASED_CL] = isLibraryBasedCL;
498
+
499
+ // if not undefined, force this as well
500
+ if (data[LIBRARY_BASED] != undefined) {
501
+ data[LIBRARY_BASED] = isLibraryBasedCL;
502
+ }
503
+
504
+ // update file
505
+ // stringify "4", makes the json string look like JSON in the file, formated instead of a single line
506
+ try {
507
+ fs.writeFileSync(pegaConfigJsonPath, JSON.stringify(data, null, 4), { encoding: 'utf8',flag:'w' });
508
+ }
509
+ catch (err) {
510
+ console.error(err);
511
+ }
512
+ //await forceDefaultsUpdate();
513
+ defaultConfigs.isLibraryBasedCL = isLibraryBasedCL;
514
+
515
+ // force libraryBased if isLibraryBasedCL is true
516
+ defaultConfigs.isLibraryBased = isLibraryBasedCL;
517
+
518
+
519
+ // reset
520
+ pegaData = null;
521
+ pegaConfig = null;
522
+
523
+ }
524
+
525
+ }
526
+
473
527
  export const getShowDebug = () => {
474
528
  // const currentDirectory = process.cwd();
475
529
  // const pegaConfigJsonPath = join(currentDirectory, TASKS_CONFIG_JSON_FILENAME);
@@ -856,6 +910,26 @@ export const getPegaServerConfig = async () => {
856
910
  if (showDebug) addDebugLog("getPegaServerConfig", "", "+");
857
911
  if (!pegaConfig) {
858
912
  pegaConfig = await getPegaConfig();
913
+
914
+ if (getServerType() === "launchpad") {
915
+
916
+ // need to append isolation id for now
917
+ let OAuthData;
918
+ try {
919
+ OAuthData = fs.readFileSync(TOKEN_PATH, 'utf8');
920
+ }
921
+ catch (ex) {
922
+ return ({});
923
+ }
924
+
925
+ if (OAuthData) {
926
+ const oOAuthData = JSON.parse(OAuthData);
927
+ const isolationId = oOAuthData["isolation-ids"].write;
928
+ pegaConfig['server-config'].isolationId = isolationId[0];
929
+ }
930
+
931
+ }
932
+
859
933
  sPegaServerConfig = JSON.stringify(pegaConfig['server-config']);
860
934
  }
861
935
 
@@ -1390,13 +1464,18 @@ if (showDebug) addDebugLog("deleteInfinityServerComponentLibrary", `componentKey
1390
1464
 
1391
1465
  try {
1392
1466
  const respData = await response.json();
1393
- console.log(
1394
- chalk.bold.green(`${respData.message}`)
1395
- );
1467
+ const message = respData.message;
1468
+ status = parseInt(respData.status);
1469
+
1470
+ if (status === 200) {
1471
+ console.log(
1472
+ chalk.bold.green(`${message}`)
1473
+ );
1474
+ }
1396
1475
 
1397
1476
  if (status === 500) {
1398
1477
  status = 999;
1399
- throw new Error(respData.message);
1478
+ throw new Error(message);
1400
1479
  }
1401
1480
  }
1402
1481
  catch (err) {
@@ -3,7 +3,7 @@
3
3
  "label": "My Test Text",
4
4
  "description": "My Test Text Description",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyTestText",
@@ -3,7 +3,7 @@
3
3
  "label": "My Boolean",
4
4
  "description": "My Boolean",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyBoolean",
@@ -3,7 +3,7 @@
3
3
  "label": "My Case Widget",
4
4
  "description": "My Case Widget",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyCaseWidget",
@@ -0,0 +1,8 @@
1
+ {
2
+ "fields": {
3
+ "Date": "Date",
4
+ "Description" : "Description",
5
+ "Performed by" : "Performed by",
6
+ "Loading case history" : "Loading case history"
7
+ }
8
+ }
@@ -3,7 +3,7 @@
3
3
  "label": "My Currency",
4
4
  "description": "My Currency",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyCurrency",
@@ -3,7 +3,7 @@
3
3
  "label": "My Date",
4
4
  "description": "My Date",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyDate",
@@ -3,7 +3,7 @@
3
3
  "label": "My DateTime",
4
4
  "description": "My DateTime",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyDateTime",
@@ -3,7 +3,7 @@
3
3
  "label": "My Decimal",
4
4
  "description": "My Decimal",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyDecimal",
@@ -3,7 +3,7 @@
3
3
  "label": "My Details",
4
4
  "description": "My Details",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyDetails",
@@ -3,7 +3,7 @@
3
3
  "label": "My Email",
4
4
  "description": "My Email",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyEmail",
@@ -3,7 +3,7 @@
3
3
  "label": "My Form",
4
4
  "description": "My Form",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyForm",
@@ -3,7 +3,7 @@
3
3
  "label": "My Icon Button URL",
4
4
  "description": "My Icon Button URL",
5
5
  "organization": "Pega",
6
- "version": "0.0.1-dev",
6
+ "version": "0.0.1",
7
7
  "library": "DXIL",
8
8
  "allowedApplications": [],
9
9
  "componentKey": "Pega_DXIL_MyIconButtonURL",
@@ -0,0 +1,10 @@
1
+ {
2
+ "fields": {
3
+ "State name" : "State name",
4
+ "State code" : "State code",
5
+ "State list for": "State list for",
6
+ "Click to show/hide state list": "Click to show/hide state list",
7
+ "State list": "State list",
8
+ "Loading state list": "Loading state list"
9
+ }
10
+ }