sfdx-browserforce-plugin 5.1.1 → 5.2.0-next.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.
Files changed (264) hide show
  1. package/README.md +54 -16
  2. package/lib/browserforce-command.d.ts +15 -0
  3. package/lib/browserforce-command.js +61 -0
  4. package/lib/browserforce-command.js.map +1 -0
  5. package/lib/browserforce.d.ts +29 -0
  6. package/lib/browserforce.js +194 -0
  7. package/lib/browserforce.js.map +1 -0
  8. package/lib/commands/browserforce/apply.d.ts +10 -0
  9. package/lib/commands/browserforce/apply.js +54 -0
  10. package/lib/commands/browserforce/apply.js.map +1 -0
  11. package/lib/commands/browserforce/plan.d.ts +10 -0
  12. package/lib/commands/browserforce/plan.js +56 -0
  13. package/lib/commands/browserforce/plan.js.map +1 -0
  14. package/lib/config-parser.d.ts +16 -0
  15. package/lib/config-parser.js +24 -0
  16. package/lib/config-parser.js.map +1 -0
  17. package/lib/index.d.ts +1 -0
  18. package/lib/index.js +2 -0
  19. package/lib/index.js.map +1 -0
  20. package/lib/jsforce-utils.d.ts +5 -0
  21. package/lib/jsforce-utils.js +14 -0
  22. package/lib/jsforce-utils.js.map +1 -0
  23. package/lib/pages/login.d.ts +8 -0
  24. package/lib/pages/login.js +39 -0
  25. package/lib/pages/login.js.map +1 -0
  26. package/lib/plugin.d.ts +17 -0
  27. package/lib/plugin.js +30 -0
  28. package/lib/plugin.js.map +1 -0
  29. package/lib/plugins/activity-settings/index.d.ts +9 -0
  30. package/lib/plugins/activity-settings/index.e2e-spec.d.ts +1 -0
  31. package/lib/plugins/activity-settings/index.e2e-spec.js +36 -0
  32. package/lib/plugins/activity-settings/index.e2e-spec.js.map +1 -0
  33. package/lib/plugins/activity-settings/index.js +34 -0
  34. package/lib/plugins/activity-settings/index.js.map +1 -0
  35. package/lib/plugins/company-information/index.d.ts +8 -0
  36. package/lib/plugins/company-information/index.e2e-spec.d.ts +1 -0
  37. package/lib/plugins/company-information/index.e2e-spec.js +37 -0
  38. package/lib/plugins/company-information/index.e2e-spec.js.map +1 -0
  39. package/lib/plugins/company-information/index.js +60 -0
  40. package/lib/plugins/company-information/index.js.map +1 -0
  41. package/lib/plugins/customer-portal/available-custom-objects/index.d.ts +14 -0
  42. package/lib/plugins/customer-portal/available-custom-objects/index.js +114 -0
  43. package/lib/plugins/customer-portal/available-custom-objects/index.js.map +1 -0
  44. package/lib/plugins/customer-portal/available-custom-objects/index.test.d.ts +1 -0
  45. package/lib/plugins/customer-portal/available-custom-objects/index.test.js +39 -0
  46. package/lib/plugins/customer-portal/available-custom-objects/index.test.js.map +1 -0
  47. package/lib/plugins/customer-portal/enabled/index.d.ts +6 -0
  48. package/lib/plugins/customer-portal/enabled/index.js +26 -0
  49. package/lib/plugins/customer-portal/enabled/index.js.map +1 -0
  50. package/lib/plugins/customer-portal/enabled/index.test.d.ts +1 -0
  51. package/lib/plugins/customer-portal/enabled/index.test.js +34 -0
  52. package/lib/plugins/customer-portal/enabled/index.test.js.map +1 -0
  53. package/lib/plugins/customer-portal/index.d.ts +15 -0
  54. package/lib/plugins/customer-portal/index.e2e-spec.d.ts +1 -0
  55. package/lib/plugins/customer-portal/index.e2e-spec.js +202 -0
  56. package/lib/plugins/customer-portal/index.e2e-spec.js.map +1 -0
  57. package/lib/plugins/customer-portal/index.js +59 -0
  58. package/lib/plugins/customer-portal/index.js.map +1 -0
  59. package/lib/plugins/customer-portal/index.test.d.ts +1 -0
  60. package/lib/plugins/customer-portal/index.test.js +84 -0
  61. package/lib/plugins/customer-portal/index.test.js.map +1 -0
  62. package/lib/plugins/customer-portal/portals/index.d.ts +25 -0
  63. package/lib/plugins/customer-portal/portals/index.js +216 -0
  64. package/lib/plugins/customer-portal/portals/index.js.map +1 -0
  65. package/lib/plugins/customer-portal/portals/index.test.d.ts +1 -0
  66. package/lib/plugins/customer-portal/portals/index.test.js +140 -0
  67. package/lib/plugins/customer-portal/portals/index.test.js.map +1 -0
  68. package/lib/plugins/density-settings/index.d.ts +10 -0
  69. package/lib/plugins/density-settings/index.e2e-spec.d.ts +1 -0
  70. package/lib/plugins/density-settings/index.e2e-spec.js +39 -0
  71. package/lib/plugins/density-settings/index.e2e-spec.js.map +1 -0
  72. package/lib/plugins/density-settings/index.js +54 -0
  73. package/lib/plugins/density-settings/index.js.map +1 -0
  74. package/lib/plugins/deprecated.d.ts +4 -0
  75. package/lib/plugins/deprecated.js +28 -0
  76. package/lib/plugins/deprecated.js.map +1 -0
  77. package/lib/plugins/email-deliverability/index.d.ts +9 -0
  78. package/lib/plugins/email-deliverability/index.e2e-spec.d.ts +1 -0
  79. package/lib/plugins/email-deliverability/index.e2e-spec.js +55 -0
  80. package/lib/plugins/email-deliverability/index.e2e-spec.js.map +1 -0
  81. package/lib/plugins/email-deliverability/index.js +42 -0
  82. package/lib/plugins/email-deliverability/index.js.map +1 -0
  83. package/lib/plugins/high-velocity-sales-settings/index.d.ts +10 -0
  84. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.d.ts +1 -0
  85. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js +29 -0
  86. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js.map +1 -0
  87. package/lib/plugins/high-velocity-sales-settings/index.js +42 -0
  88. package/lib/plugins/high-velocity-sales-settings/index.js.map +1 -0
  89. package/lib/plugins/high-velocity-sales-settings/page.d.ts +7 -0
  90. package/lib/plugins/high-velocity-sales-settings/page.js +28 -0
  91. package/lib/plugins/high-velocity-sales-settings/page.js.map +1 -0
  92. package/lib/plugins/history-tracking/index.d.ts +17 -0
  93. package/lib/plugins/history-tracking/index.e2e-spec.d.ts +1 -0
  94. package/lib/plugins/history-tracking/index.e2e-spec.js +106 -0
  95. package/lib/plugins/history-tracking/index.e2e-spec.js.map +1 -0
  96. package/lib/plugins/history-tracking/index.js +176 -0
  97. package/lib/plugins/history-tracking/index.js.map +1 -0
  98. package/lib/plugins/home-page-layouts/index.d.ts +14 -0
  99. package/lib/plugins/home-page-layouts/index.e2e-spec.d.ts +1 -0
  100. package/lib/plugins/home-page-layouts/index.e2e-spec.js +47 -0
  101. package/lib/plugins/home-page-layouts/index.e2e-spec.js.map +1 -0
  102. package/lib/plugins/home-page-layouts/index.js +94 -0
  103. package/lib/plugins/home-page-layouts/index.js.map +1 -0
  104. package/lib/plugins/home-page-layouts/index.test.d.ts +1 -0
  105. package/lib/plugins/home-page-layouts/index.test.js +104 -0
  106. package/lib/plugins/home-page-layouts/index.test.js.map +1 -0
  107. package/lib/plugins/index.d.ts +24 -0
  108. package/lib/plugins/index.js +25 -0
  109. package/lib/plugins/index.js.map +1 -0
  110. package/lib/plugins/lightning-experience-settings/index.d.ts +18 -0
  111. package/lib/plugins/lightning-experience-settings/index.e2e-spec.d.ts +1 -0
  112. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js +40 -0
  113. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js.map +1 -0
  114. package/lib/plugins/lightning-experience-settings/index.js +101 -0
  115. package/lib/plugins/lightning-experience-settings/index.js.map +1 -0
  116. package/lib/plugins/linkedin-sales-navigator-settings/index.d.ts +8 -0
  117. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.d.ts +1 -0
  118. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js +29 -0
  119. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js.map +1 -0
  120. package/lib/plugins/linkedin-sales-navigator-settings/index.js +15 -0
  121. package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +1 -0
  122. package/lib/plugins/linkedin-sales-navigator-settings/page.d.ts +10 -0
  123. package/lib/plugins/linkedin-sales-navigator-settings/page.js +42 -0
  124. package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +1 -0
  125. package/lib/plugins/omni-channel-settings/index.d.ts +9 -0
  126. package/lib/plugins/omni-channel-settings/index.e2e-spec.d.ts +1 -0
  127. package/lib/plugins/omni-channel-settings/index.e2e-spec.js +30 -0
  128. package/lib/plugins/omni-channel-settings/index.e2e-spec.js.map +1 -0
  129. package/lib/plugins/omni-channel-settings/index.js +21 -0
  130. package/lib/plugins/omni-channel-settings/index.js.map +1 -0
  131. package/lib/plugins/opportunity-splits/index.d.ts +9 -0
  132. package/lib/plugins/opportunity-splits/index.e2e-spec.d.ts +1 -0
  133. package/lib/plugins/opportunity-splits/index.e2e-spec.js +46 -0
  134. package/lib/plugins/opportunity-splits/index.e2e-spec.js.map +1 -0
  135. package/lib/plugins/opportunity-splits/index.js +32 -0
  136. package/lib/plugins/opportunity-splits/index.js.map +1 -0
  137. package/lib/plugins/opportunity-splits/pages/layout-selection.d.ts +8 -0
  138. package/lib/plugins/opportunity-splits/pages/layout-selection.js +15 -0
  139. package/lib/plugins/opportunity-splits/pages/layout-selection.js.map +1 -0
  140. package/lib/plugins/opportunity-splits/pages/overview.d.ts +10 -0
  141. package/lib/plugins/opportunity-splits/pages/overview.js +33 -0
  142. package/lib/plugins/opportunity-splits/pages/overview.js.map +1 -0
  143. package/lib/plugins/opportunity-splits/pages/setup.d.ts +8 -0
  144. package/lib/plugins/opportunity-splits/pages/setup.js +17 -0
  145. package/lib/plugins/opportunity-splits/pages/setup.js.map +1 -0
  146. package/lib/plugins/permission-sets/index.d.ts +10 -0
  147. package/lib/plugins/permission-sets/index.e2e-spec.d.ts +1 -0
  148. package/lib/plugins/permission-sets/index.e2e-spec.js +47 -0
  149. package/lib/plugins/permission-sets/index.e2e-spec.js.map +1 -0
  150. package/lib/plugins/permission-sets/index.js +22 -0
  151. package/lib/plugins/permission-sets/index.js.map +1 -0
  152. package/lib/plugins/permission-sets/service-presence-status/index.d.ts +10 -0
  153. package/lib/plugins/permission-sets/service-presence-status/index.js +67 -0
  154. package/lib/plugins/permission-sets/service-presence-status/index.js.map +1 -0
  155. package/lib/plugins/picklists/field-dependencies/index.d.ts +11 -0
  156. package/lib/plugins/picklists/field-dependencies/index.js +56 -0
  157. package/lib/plugins/picklists/field-dependencies/index.js.map +1 -0
  158. package/lib/plugins/picklists/field-dependencies/index.test.d.ts +1 -0
  159. package/lib/plugins/picklists/field-dependencies/index.test.js +64 -0
  160. package/lib/plugins/picklists/field-dependencies/index.test.js.map +1 -0
  161. package/lib/plugins/picklists/field-dependencies/pages.d.ts +14 -0
  162. package/lib/plugins/picklists/field-dependencies/pages.js +49 -0
  163. package/lib/plugins/picklists/field-dependencies/pages.js.map +1 -0
  164. package/lib/plugins/picklists/index.d.ts +23 -0
  165. package/lib/plugins/picklists/index.e2e-spec.d.ts +1 -0
  166. package/lib/plugins/picklists/index.e2e-spec.js +100 -0
  167. package/lib/plugins/picklists/index.e2e-spec.js.map +1 -0
  168. package/lib/plugins/picklists/index.js +153 -0
  169. package/lib/plugins/picklists/index.js.map +1 -0
  170. package/lib/plugins/picklists/pages.d.ts +41 -0
  171. package/lib/plugins/picklists/pages.js +166 -0
  172. package/lib/plugins/picklists/pages.js.map +1 -0
  173. package/lib/plugins/picklists/standard-value-set.d.ts +1 -0
  174. package/lib/plugins/picklists/standard-value-set.js +80 -0
  175. package/lib/plugins/picklists/standard-value-set.js.map +1 -0
  176. package/lib/plugins/record-types/index.d.ts +13 -0
  177. package/lib/plugins/record-types/index.e2e-spec.d.ts +1 -0
  178. package/lib/plugins/record-types/index.e2e-spec.js +73 -0
  179. package/lib/plugins/record-types/index.e2e-spec.js.map +1 -0
  180. package/lib/plugins/record-types/index.js +70 -0
  181. package/lib/plugins/record-types/index.js.map +1 -0
  182. package/lib/plugins/record-types/pages.d.ts +15 -0
  183. package/lib/plugins/record-types/pages.js +56 -0
  184. package/lib/plugins/record-types/pages.js.map +1 -0
  185. package/lib/plugins/relate-contact-to-multiple-accounts/index.d.ts +11 -0
  186. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.d.ts +1 -0
  187. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js +29 -0
  188. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js.map +1 -0
  189. package/lib/plugins/relate-contact-to-multiple-accounts/index.js +62 -0
  190. package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +1 -0
  191. package/lib/plugins/reports-and-dashboards/folder-sharing/index.d.ts +8 -0
  192. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.d.ts +1 -0
  193. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js +3 -0
  194. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js.map +1 -0
  195. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +55 -0
  196. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +1 -0
  197. package/lib/plugins/reports-and-dashboards/index.d.ts +11 -0
  198. package/lib/plugins/reports-and-dashboards/index.e2e-spec.d.ts +1 -0
  199. package/lib/plugins/reports-and-dashboards/index.e2e-spec.js +3 -0
  200. package/lib/plugins/reports-and-dashboards/index.e2e-spec.js.map +1 -0
  201. package/lib/plugins/reports-and-dashboards/index.js +29 -0
  202. package/lib/plugins/reports-and-dashboards/index.js.map +1 -0
  203. package/lib/plugins/salesforce-cpq-config/formConfig.d.ts +17 -0
  204. package/lib/plugins/salesforce-cpq-config/formConfig.js +649 -0
  205. package/lib/plugins/salesforce-cpq-config/formConfig.js.map +1 -0
  206. package/lib/plugins/salesforce-cpq-config/index.d.ts +7 -0
  207. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.d.ts +1 -0
  208. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js +37 -0
  209. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js.map +1 -0
  210. package/lib/plugins/salesforce-cpq-config/index.js +214 -0
  211. package/lib/plugins/salesforce-cpq-config/index.js.map +1 -0
  212. package/lib/plugins/salesforce-to-salesforce/index.d.ts +9 -0
  213. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.d.ts +1 -0
  214. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js +35 -0
  215. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js.map +1 -0
  216. package/lib/plugins/salesforce-to-salesforce/index.js +36 -0
  217. package/lib/plugins/salesforce-to-salesforce/index.js.map +1 -0
  218. package/lib/plugins/security/authentication-configuration/index.d.ts +11 -0
  219. package/lib/plugins/security/authentication-configuration/index.e2e-spec.d.ts +1 -0
  220. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js +101 -0
  221. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js.map +1 -0
  222. package/lib/plugins/security/authentication-configuration/index.js +67 -0
  223. package/lib/plugins/security/authentication-configuration/index.js.map +1 -0
  224. package/lib/plugins/security/certificate-and-key-management/index.d.ts +23 -0
  225. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.d.ts +1 -0
  226. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js +63 -0
  227. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js.map +1 -0
  228. package/lib/plugins/security/certificate-and-key-management/index.js +154 -0
  229. package/lib/plugins/security/certificate-and-key-management/index.js.map +1 -0
  230. package/lib/plugins/security/certificate-and-key-management/index.test.d.ts +1 -0
  231. package/lib/plugins/security/certificate-and-key-management/index.test.js +61 -0
  232. package/lib/plugins/security/certificate-and-key-management/index.test.js.map +1 -0
  233. package/lib/plugins/security/index.d.ts +13 -0
  234. package/lib/plugins/security/index.js +42 -0
  235. package/lib/plugins/security/index.js.map +1 -0
  236. package/lib/plugins/service-channels/capacity/index.d.ts +18 -0
  237. package/lib/plugins/service-channels/capacity/index.js +162 -0
  238. package/lib/plugins/service-channels/capacity/index.js.map +1 -0
  239. package/lib/plugins/service-channels/index.d.ts +12 -0
  240. package/lib/plugins/service-channels/index.e2e-spec.d.ts +1 -0
  241. package/lib/plugins/service-channels/index.e2e-spec.js +61 -0
  242. package/lib/plugins/service-channels/index.e2e-spec.js.map +1 -0
  243. package/lib/plugins/service-channels/index.js +38 -0
  244. package/lib/plugins/service-channels/index.js.map +1 -0
  245. package/lib/plugins/slack/index.d.ts +9 -0
  246. package/lib/plugins/slack/index.e2e-spec.d.ts +1 -0
  247. package/lib/plugins/slack/index.e2e-spec.js +47 -0
  248. package/lib/plugins/slack/index.e2e-spec.js.map +1 -0
  249. package/lib/plugins/slack/index.js +46 -0
  250. package/lib/plugins/slack/index.js.map +1 -0
  251. package/lib/plugins/user-access-policies/index.d.ts +19 -0
  252. package/lib/plugins/user-access-policies/index.e2e-spec.d.ts +1 -0
  253. package/lib/plugins/user-access-policies/index.e2e-spec.js +63 -0
  254. package/lib/plugins/user-access-policies/index.e2e-spec.js.map +1 -0
  255. package/lib/plugins/user-access-policies/index.js +107 -0
  256. package/lib/plugins/user-access-policies/index.js.map +1 -0
  257. package/lib/plugins/user-access-policies/page.d.ts +29 -0
  258. package/lib/plugins/user-access-policies/page.js +115 -0
  259. package/lib/plugins/user-access-policies/page.js.map +1 -0
  260. package/lib/plugins/utils.d.ts +3 -0
  261. package/lib/plugins/utils.js +47 -0
  262. package/lib/plugins/utils.js.map +1 -0
  263. package/oclif.manifest.json +153 -0
  264. package/package.json +2 -2
@@ -0,0 +1,106 @@
1
+ import assert from 'assert';
2
+ import * as child from 'child_process';
3
+ import { fileURLToPath } from 'node:url';
4
+ import * as path from 'path';
5
+ import { HistoryTracking } from './index.js';
6
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
7
+ describe(HistoryTracking.name, function () {
8
+ let plugin;
9
+ before(() => {
10
+ plugin = new HistoryTracking(global.bf);
11
+ });
12
+ const enableHistoryTracking = [
13
+ {
14
+ objectApiName: 'Account',
15
+ enableHistoryTracking: true,
16
+ fieldHistoryTracking: [
17
+ {
18
+ fieldApiName: 'PersonBirthdate',
19
+ enableHistoryTracking: true,
20
+ },
21
+ {
22
+ fieldApiName: 'Test__pc',
23
+ enableHistoryTracking: true,
24
+ },
25
+ ],
26
+ },
27
+ {
28
+ objectApiName: 'Opportunity',
29
+ enableHistoryTracking: true,
30
+ fieldHistoryTracking: [
31
+ {
32
+ fieldApiName: 'Type',
33
+ enableHistoryTracking: true,
34
+ },
35
+ ],
36
+ },
37
+ {
38
+ objectApiName: 'Test__c',
39
+ fieldHistoryTracking: [
40
+ {
41
+ fieldApiName: 'Owner',
42
+ enableHistoryTracking: true,
43
+ },
44
+ {
45
+ fieldApiName: 'Test__c',
46
+ enableHistoryTracking: true,
47
+ },
48
+ ],
49
+ },
50
+ ];
51
+ const disableHistoryTracking = [
52
+ {
53
+ objectApiName: 'Account',
54
+ enableHistoryTracking: true,
55
+ fieldHistoryTracking: [
56
+ {
57
+ fieldApiName: 'PersonBirthdate',
58
+ enableHistoryTracking: false,
59
+ },
60
+ {
61
+ fieldApiName: 'Test__pc',
62
+ enableHistoryTracking: true,
63
+ },
64
+ ],
65
+ },
66
+ {
67
+ objectApiName: 'Opportunity',
68
+ enableHistoryTracking: false,
69
+ },
70
+ {
71
+ objectApiName: 'Test__c',
72
+ fieldHistoryTracking: [
73
+ {
74
+ fieldApiName: 'Owner',
75
+ enableHistoryTracking: true,
76
+ },
77
+ {
78
+ fieldApiName: 'Test__c',
79
+ enableHistoryTracking: false,
80
+ },
81
+ ],
82
+ },
83
+ ];
84
+ it('should create custom object and fields as a prerequisite', () => {
85
+ const sourceDeployCmd = child.spawnSync('sf', [
86
+ 'project',
87
+ 'deploy',
88
+ 'start',
89
+ '-d',
90
+ path.join(__dirname, 'sfdx-source'),
91
+ '--json',
92
+ ]);
93
+ assert.deepStrictEqual(sourceDeployCmd.status, 0, sourceDeployCmd.output.toString());
94
+ });
95
+ it('should enable history tracking for objects and fields', async () => {
96
+ await plugin.run(enableHistoryTracking);
97
+ const res = await plugin.retrieve(enableHistoryTracking);
98
+ assert.deepStrictEqual(res, enableHistoryTracking);
99
+ });
100
+ it('should disable history tracking for objects and fields', async () => {
101
+ await plugin.run(disableHistoryTracking);
102
+ const res = await plugin.retrieve(disableHistoryTracking);
103
+ assert.deepStrictEqual(res, disableHistoryTracking);
104
+ });
105
+ });
106
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.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AAC,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;QAC1D,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,176 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ const BASE_PATH = 'ui/setup/layout/FieldHistoryTracking?pEntity={APINAME}';
3
+ const ENABLE_HISTORY_SELECTOR = 'input[id="enable"][type="checkbox"][name="enable"]';
4
+ const ENABLE_FIELD_HISTORY_SELECTOR = 'input[id="{APINAME}_fht"]';
5
+ const SAVE_BUTTON_SELECTOR = 'input[class="btn"][type="submit"][name="save"][title="Save"]';
6
+ export class HistoryTracking extends BrowserforcePlugin {
7
+ async retrieve(definition) {
8
+ const historyTrackingConfigs = [];
9
+ // We first need to retrieve the corresponding CustomField.TableOrEnumId for all objects
10
+ // This is in case we have field tracking configured for custom fields
11
+ const tableEnumOrIdByObjectApiName = await this.getTableEnumOrIdByObjectApiName(definition);
12
+ // Now we can iterate over all history tracking configurations in the definition
13
+ for await (const historyTrackingConfig of definition) {
14
+ const historyTrackingResult = { ...historyTrackingConfig };
15
+ // Open the object history tracking setup page
16
+ const page = await this.browserforce.openPage(BASE_PATH.replace('{APINAME}', tableEnumOrIdByObjectApiName.get(historyTrackingConfig.objectApiName)));
17
+ // Retrieve the object history tracking
18
+ // If this is a custom object, this checkbox does not exist, so skip
19
+ if (!historyTrackingConfig.objectApiName.includes('__c')) {
20
+ await page.locator(ENABLE_HISTORY_SELECTOR).waitFor();
21
+ historyTrackingResult.enableHistoryTracking = await page
22
+ .locator(ENABLE_HISTORY_SELECTOR)
23
+ .evaluate((el) => el.getAttribute('checked') === 'checked' ? true : false);
24
+ }
25
+ // If we have no field history tracking, there is nothing more to do
26
+ if (!historyTrackingConfig.fieldHistoryTracking) {
27
+ historyTrackingConfigs.push(historyTrackingResult);
28
+ continue;
29
+ }
30
+ const fieldHistoryTrackingConfigs = [];
31
+ // If the object history tracking is false, then we already know all field history tracking is false
32
+ // Only so long as this is a standard object
33
+ if (!historyTrackingResult.enableHistoryTracking &&
34
+ !historyTrackingConfig.objectApiName.includes('__c')) {
35
+ for (const fieldHistoryTracking of historyTrackingConfig.fieldHistoryTracking) {
36
+ fieldHistoryTrackingConfigs.push({
37
+ ...fieldHistoryTracking,
38
+ enableHistoryTracking: false,
39
+ });
40
+ }
41
+ historyTrackingResult.fieldHistoryTracking =
42
+ fieldHistoryTrackingConfigs;
43
+ historyTrackingConfigs.push(historyTrackingResult);
44
+ continue;
45
+ }
46
+ // We need to determine the correct html selector for each field that is configured
47
+ // This is because custom fields are identified using their CustomField.Id value
48
+ const fieldSelectorByFieldApiName = await this.getFieldSelectorByFieldApiName(tableEnumOrIdByObjectApiName.get(historyTrackingConfig.objectApiName), historyTrackingConfig.fieldHistoryTracking);
49
+ // We can now retrieve the field history settings for the fields specified for the object
50
+ for await (const fieldHistoryTracking of historyTrackingConfig.fieldHistoryTracking) {
51
+ const fieldHistoryTrackingResult = { ...fieldHistoryTracking };
52
+ const fieldApiName = fieldSelectorByFieldApiName.get(fieldHistoryTracking.fieldApiName);
53
+ fieldHistoryTrackingResult.enableHistoryTracking = await page
54
+ .locator(ENABLE_FIELD_HISTORY_SELECTOR.replace('{APINAME}', fieldApiName))
55
+ .evaluate((el) => el.getAttribute('checked') === 'checked' ? true : false);
56
+ fieldHistoryTrackingConfigs.push(fieldHistoryTrackingResult);
57
+ }
58
+ historyTrackingResult.fieldHistoryTracking = fieldHistoryTrackingConfigs;
59
+ historyTrackingConfigs.push(historyTrackingResult);
60
+ }
61
+ return historyTrackingConfigs;
62
+ }
63
+ async apply(plan) {
64
+ // We first need to retrieve the corresponding CustomField.TableOrEnumId for all objects
65
+ // This is in case we are configuring field tracking for custom fields
66
+ const tableEnumOrIdByObjectApiName = await this.getTableEnumOrIdByObjectApiName(plan);
67
+ // Now we can iterate over all history tracking configurations in the plan
68
+ for await (const historyTrackingConfig of plan) {
69
+ // Open the object history tracking setup page
70
+ const page = await this.browserforce.openPage(BASE_PATH.replace('{APINAME}', tableEnumOrIdByObjectApiName.get(historyTrackingConfig.objectApiName)));
71
+ // Retrieve the object history tracking
72
+ // If this is a custom object, this checkbox does not exist, so skip
73
+ if (!historyTrackingConfig.objectApiName.includes('__c')) {
74
+ await page.locator(ENABLE_HISTORY_SELECTOR).waitFor();
75
+ const historyTrackingEnabled = await page
76
+ .locator(ENABLE_HISTORY_SELECTOR)
77
+ .evaluate((el) => el.getAttribute('checked') === 'checked' ? true : false);
78
+ if (historyTrackingConfig.enableHistoryTracking !== historyTrackingEnabled) {
79
+ // Click the checkbox
80
+ await page.locator(ENABLE_HISTORY_SELECTOR).click();
81
+ }
82
+ }
83
+ if (historyTrackingConfig.fieldHistoryTracking) {
84
+ // We need to determine the correct html selector for each field that is configured
85
+ // This is because custom fields are identified using their CustomField.Id value
86
+ const fieldSelectorByFieldApiName = await this.getFieldSelectorByFieldApiName(tableEnumOrIdByObjectApiName.get(historyTrackingConfig.objectApiName), historyTrackingConfig.fieldHistoryTracking);
87
+ // We can now retrieve the field history settings for the fields specified for the object
88
+ for await (const fieldHistoryTracking of historyTrackingConfig.fieldHistoryTracking) {
89
+ const fieldApiName = fieldSelectorByFieldApiName.get(fieldHistoryTracking.fieldApiName);
90
+ const fieldSelector = ENABLE_FIELD_HISTORY_SELECTOR.replace('{APINAME}', fieldApiName);
91
+ const fieldHistoryTrackingEnabled = await page
92
+ .locator(fieldSelector)
93
+ .evaluate((el) => el.getAttribute('checked') === 'checked' ? true : false);
94
+ if (fieldHistoryTracking.enableHistoryTracking !==
95
+ fieldHistoryTrackingEnabled) {
96
+ // Click the checkbox
97
+ await page.locator(fieldSelector).click();
98
+ }
99
+ }
100
+ }
101
+ // Save the settings
102
+ await page
103
+ .locator(SAVE_BUTTON_SELECTOR)
104
+ .filter({ visible: true })
105
+ .first()
106
+ .click();
107
+ // Close the page
108
+ await page.close();
109
+ }
110
+ }
111
+ async getFieldSelectorByFieldApiName(tableEnumOrId, fieldHistoryTrackingConfigs) {
112
+ const fieldSelectorByFieldApiName = new Map();
113
+ const customFieldApiNames = [];
114
+ const personAccountFieldApiNames = [];
115
+ for (const fieldHistoryTrackingConfig of fieldHistoryTrackingConfigs) {
116
+ // If this is a person account field, we must do special handling for this
117
+ if (tableEnumOrId === 'Account' &&
118
+ fieldHistoryTrackingConfig.fieldApiName.includes('__pc')) {
119
+ personAccountFieldApiNames.push(`'${fieldHistoryTrackingConfig.fieldApiName.replace('__pc', '')}'`);
120
+ continue;
121
+ }
122
+ // If this is a custom field, we must query for the Field Id
123
+ if (fieldHistoryTrackingConfig.fieldApiName.includes('__c')) {
124
+ customFieldApiNames.push(`'${fieldHistoryTrackingConfig.fieldApiName.replace('__c', '')}'`);
125
+ continue;
126
+ }
127
+ // Otherwise, if this is a standard field, the Selector is the Field API Name
128
+ fieldSelectorByFieldApiName.set(fieldHistoryTrackingConfig.fieldApiName, fieldHistoryTrackingConfig.fieldApiName);
129
+ }
130
+ if (customFieldApiNames.length === 0 &&
131
+ personAccountFieldApiNames.length === 0) {
132
+ return fieldSelectorByFieldApiName;
133
+ }
134
+ if (personAccountFieldApiNames.length > 0) {
135
+ const personAccountFieldsQuery = await this.org
136
+ .getConnection()
137
+ .tooling.query(`SELECT Id, DeveloperName FROM CustomField WHERE DeveloperName IN (${personAccountFieldApiNames.join(',')}) AND TableEnumOrId = 'Contact'`);
138
+ for (const personAccountField of personAccountFieldsQuery.records) {
139
+ fieldSelectorByFieldApiName.set(`${personAccountField.DeveloperName}__pc`, personAccountField.Id.substring(0, 15));
140
+ }
141
+ }
142
+ if (customFieldApiNames.length > 0) {
143
+ const customFieldsQuery = await this.org
144
+ .getConnection()
145
+ .tooling.query(`SELECT Id, DeveloperName FROM CustomField WHERE DeveloperName IN (${customFieldApiNames.join(',')}) AND TableEnumOrId = '${tableEnumOrId}'`);
146
+ for (const customField of customFieldsQuery.records) {
147
+ fieldSelectorByFieldApiName.set(`${customField.DeveloperName}__c`, customField.Id.substring(0, 15));
148
+ }
149
+ }
150
+ return fieldSelectorByFieldApiName;
151
+ }
152
+ async getTableEnumOrIdByObjectApiName(historyTrackingConfigs) {
153
+ const tableEnumOrIdByObjectApiName = new Map();
154
+ const customObjectApiNames = [];
155
+ for (const historyTrackingConfig of historyTrackingConfigs) {
156
+ // If it is a custom object, the CustomField.TableEnumOrId is the Object Id
157
+ if (historyTrackingConfig.objectApiName.includes('__c')) {
158
+ customObjectApiNames.push(`'${historyTrackingConfig.objectApiName.replace('__c', '')}'`);
159
+ continue;
160
+ }
161
+ // Otherwise, if this is a standard object, the CustomField.TableEnumOrId is the Object API Name
162
+ tableEnumOrIdByObjectApiName.set(historyTrackingConfig.objectApiName, historyTrackingConfig.objectApiName);
163
+ }
164
+ if (customObjectApiNames.length === 0) {
165
+ return tableEnumOrIdByObjectApiName;
166
+ }
167
+ const customObjectsQuery = await this.org
168
+ .getConnection()
169
+ .tooling.query(`SELECT Id, DeveloperName FROM CustomObject WHERE DeveloperName IN (${customObjectApiNames.join(',')})`);
170
+ for (const customObject of customObjectsQuery.records) {
171
+ tableEnumOrIdByObjectApiName.set(`${customObject.DeveloperName}__c`, customObject.Id);
172
+ }
173
+ return tableEnumOrIdByObjectApiName;
174
+ }
175
+ }
176
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/history-tracking/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,SAAS,GAAG,wDAAwD,CAAC;AAE3E,MAAM,uBAAuB,GAC3B,oDAAoD,CAAC;AACvD,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAClE,MAAM,oBAAoB,GACxB,8DAA8D,CAAC;AAajE,MAAM,OAAO,eAAgB,SAAQ,kBAAkB;I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,IAAI,CAC7F,GAAG,CACJ,GAAG,CACL,CAAC;QAEJ,KAAK,MAAM,YAAY,IAAI,kBAAkB,CAAC,OAAO,EAAE,CAAC;YACtD,4BAA4B,CAAC,GAAG,CAC9B,GAAG,YAAY,CAAC,aAAa,KAAK,EAClC,YAAY,CAAC,EAAE,CAChB,CAAC;QACJ,CAAC;QAED,OAAO,4BAA4B,CAAC;IACtC,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ type Config = {
3
+ homePageLayoutAssignments: HomePageLayoutAssignment[];
4
+ };
5
+ type HomePageLayoutAssignment = {
6
+ profile: string;
7
+ layout: string;
8
+ };
9
+ export declare class HomePageLayouts extends BrowserforcePlugin {
10
+ retrieve(): Promise<Config>;
11
+ diff(source: Config, target: Config): Config | undefined;
12
+ apply(config: Config): Promise<void>;
13
+ }
14
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
1
+ import assert from 'assert';
2
+ import { HomePageLayouts } from './index.js';
3
+ describe(HomePageLayouts.name, function () {
4
+ let plugin;
5
+ before(() => {
6
+ plugin = new HomePageLayouts(global.bf);
7
+ });
8
+ const configPageDefault = {
9
+ homePageLayoutAssignments: [
10
+ {
11
+ profile: 'Standard User',
12
+ layout: '',
13
+ },
14
+ {
15
+ profile: 'System Administrator',
16
+ layout: '',
17
+ },
18
+ ],
19
+ };
20
+ const configOrgDefault = {
21
+ homePageLayoutAssignments: [
22
+ {
23
+ profile: 'Standard User',
24
+ layout: 'DE Default',
25
+ },
26
+ {
27
+ profile: 'System Administrator',
28
+ layout: 'DE Default',
29
+ },
30
+ ],
31
+ };
32
+ it('should assign some layouts', async () => {
33
+ await plugin.run(configPageDefault);
34
+ });
35
+ it('should be assigned', async () => {
36
+ const res = await plugin.run(configPageDefault);
37
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
38
+ });
39
+ it('should unassign some layouts', async () => {
40
+ await plugin.apply(configOrgDefault);
41
+ });
42
+ it('should be unassigned', async () => {
43
+ const res = await plugin.run(configOrgDefault);
44
+ assert.deepStrictEqual(res, { message: 'no action necessary' });
45
+ });
46
+ });
47
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/home-page-layouts/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE;IAC7B,IAAI,MAAuB,CAAC;IAC5B,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG;QACxB,yBAAyB,EAAE;YACzB;gBACE,OAAO,EAAE,eAAe;gBACxB,MAAM,EAAE,EAAE;aACX;YACD;gBACE,OAAO,EAAE,sBAAsB;gBAC/B,MAAM,EAAE,EAAE;aACX;SACF;KACF,CAAC;IACF,MAAM,gBAAgB,GAAG;QACvB,yBAAyB,EAAE;YACzB;gBACE,OAAO,EAAE,eAAe;gBACxB,MAAM,EAAE,YAAY;aACrB;YACD;gBACE,OAAO,EAAE,sBAAsB;gBAC/B,MAAM,EAAE,YAAY;aACrB;SACF;KACF,CAAC;IACF,EAAE,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC1C,MAAM,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAChD,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE;QACpC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC/C,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,94 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ const BASE_PATH = 'setup/ui/assignhomelayoutedit.jsp';
3
+ const BASE_SELECTOR = 'table.detailList';
4
+ const SAVE_BUTTON_SELECTOR = 'input[name="save"]';
5
+ export class HomePageLayouts extends BrowserforcePlugin {
6
+ async retrieve() {
7
+ const page = await this.browserforce.openPage(BASE_PATH);
8
+ await page.locator(BASE_SELECTOR).waitFor();
9
+ const profiles = await page
10
+ .locator('table.detailList tbody tr td label')
11
+ .evaluateAll((labels) => {
12
+ return labels.map((label) => {
13
+ for (let i = 0; i < label.childNodes.length; i++) {
14
+ if (label.childNodes[i].nodeType === label.TEXT_NODE) {
15
+ return label.childNodes[i].nodeValue ?? '';
16
+ }
17
+ }
18
+ throw new Error('retrieving HomePageLayouts failed');
19
+ });
20
+ });
21
+ const layouts = await page
22
+ .locator('table.detailList tbody tr td select')
23
+ .evaluateAll((selects) => {
24
+ return selects
25
+ .map((select) => select.selectedOptions[0].text)
26
+ .map((text) => (text === 'Home Page Default' ? '' : text));
27
+ });
28
+ const homePageLayoutAssignments = [];
29
+ for (let i = 0; i < profiles.length; i++) {
30
+ homePageLayoutAssignments.push({
31
+ profile: profiles[i],
32
+ layout: layouts[i],
33
+ });
34
+ }
35
+ await page.close();
36
+ return {
37
+ homePageLayoutAssignments,
38
+ };
39
+ }
40
+ diff(source, target) {
41
+ target.homePageLayoutAssignments.sort(compareAssignment);
42
+ const profileNames = target.homePageLayoutAssignments.map((assignment) => assignment.profile);
43
+ source.homePageLayoutAssignments = source.homePageLayoutAssignments
44
+ .filter((assignment) => profileNames.includes(assignment.profile))
45
+ .sort(compareAssignment);
46
+ return super.diff(source, target);
47
+ }
48
+ async apply(config) {
49
+ const profilesList = config.homePageLayoutAssignments
50
+ .map((assignment) => {
51
+ return `'${assignment.profile}'`;
52
+ })
53
+ .join(',');
54
+ const layoutsList = config.homePageLayoutAssignments
55
+ .map((assignment) => {
56
+ return `'${assignment.layout}'`;
57
+ })
58
+ .join(',');
59
+ const profiles = await this.org
60
+ .getConnection()
61
+ .tooling.query(`SELECT Id, Name FROM Profile WHERE NAME IN (${profilesList})`);
62
+ const homePageLayouts = await this.org
63
+ .getConnection()
64
+ .tooling.query(`SELECT Id, Name FROM HomePageLayout WHERE Name IN (${layoutsList})`);
65
+ const page = await this.browserforce.openPage(BASE_PATH);
66
+ await page.locator(BASE_SELECTOR).waitFor();
67
+ for (const assignment of config.homePageLayoutAssignments) {
68
+ const homePageLayoutName = assignment.layout;
69
+ const profile = profiles.records.find((p) => p.Name === assignment.profile);
70
+ if (!profile) {
71
+ throw new Error(`could not find profile '${assignment.profile}'`);
72
+ }
73
+ let homePageLayout = homePageLayouts.records.find((l) => l.Name === homePageLayoutName);
74
+ if (homePageLayoutName === '') {
75
+ homePageLayout = { Id: 'default', Name: 'default' };
76
+ }
77
+ if (homePageLayout === undefined) {
78
+ throw new Error(`Could not find home page layout "${homePageLayoutName}" in list of home page layouts: ${homePageLayouts.records.map((l) => l.Name)}`);
79
+ }
80
+ const profileSelector = `select[id='${profile.Id.substring(0, 15)}']`;
81
+ await page.locator(profileSelector).waitFor();
82
+ await page
83
+ .locator(profileSelector)
84
+ .selectOption(homePageLayout.Id.substring(0, 15));
85
+ }
86
+ await page.locator(SAVE_BUTTON_SELECTOR).first().click();
87
+ await page.waitForLoadState('load');
88
+ await page.close();
89
+ }
90
+ }
91
+ function compareAssignment(a, b) {
92
+ return `${a.profile}:${a.layout}`.localeCompare(`${b.profile}:${b.layout}`, 'en', { numeric: true });
93
+ }
94
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/home-page-layouts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,SAAS,GAAG,mCAAmC,CAAC;AAEtD,MAAM,aAAa,GAAG,kBAAkB,CAAC;AACzC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAmBlD,MAAM,OAAO,eAAgB,SAAQ,kBAAkB;IAC9C,KAAK,CAAC,QAAQ;QACnB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACzD,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC;QAE5C,MAAM,QAAQ,GAAG,MAAM,IAAI;aACxB,OAAO,CAAC,oCAAoC,CAAC;aAC7C,WAAW,CAAC,CAAC,MAA0B,EAAE,EAAE;YAC1C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBACjD,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC;wBACrD,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC;oBAC7C,CAAC;gBACH,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CA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AC7C,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,EAAE,EAC1B,IAAI,EACJ,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,104 @@
1
+ import assert from 'assert';
2
+ import { HomePageLayouts } from './index.js';
3
+ const tests = [
4
+ {
5
+ description: 'should return no change',
6
+ source: {
7
+ homePageLayoutAssignments: [
8
+ {
9
+ profile: 'Standard User',
10
+ layout: '',
11
+ },
12
+ {
13
+ profile: 'System Administrator',
14
+ layout: '',
15
+ },
16
+ ],
17
+ },
18
+ target: {
19
+ homePageLayoutAssignments: [
20
+ {
21
+ profile: 'Standard User',
22
+ layout: '',
23
+ },
24
+ {
25
+ profile: 'System Administrator',
26
+ layout: '',
27
+ },
28
+ ],
29
+ },
30
+ expected: undefined,
31
+ },
32
+ {
33
+ description: 'should filter irrelevant assignments',
34
+ source: {
35
+ homePageLayoutAssignments: [
36
+ {
37
+ profile: 'Foo User',
38
+ layout: '',
39
+ },
40
+ {
41
+ profile: 'Standard User',
42
+ layout: '',
43
+ },
44
+ {
45
+ profile: 'System Administrator',
46
+ layout: '',
47
+ },
48
+ ],
49
+ },
50
+ target: {
51
+ homePageLayoutAssignments: [
52
+ {
53
+ profile: 'Standard User',
54
+ layout: '',
55
+ },
56
+ {
57
+ profile: 'System Administrator',
58
+ layout: '',
59
+ },
60
+ ],
61
+ },
62
+ expected: undefined,
63
+ },
64
+ {
65
+ description: 'should match when unsorted',
66
+ source: {
67
+ homePageLayoutAssignments: [
68
+ {
69
+ profile: 'System Administrator',
70
+ layout: '',
71
+ },
72
+ {
73
+ profile: 'Standard User',
74
+ layout: '',
75
+ },
76
+ ],
77
+ },
78
+ target: {
79
+ homePageLayoutAssignments: [
80
+ {
81
+ profile: 'Standard User',
82
+ layout: '',
83
+ },
84
+ {
85
+ profile: 'System Administrator',
86
+ layout: '',
87
+ },
88
+ ],
89
+ },
90
+ expected: undefined,
91
+ },
92
+ ];
93
+ describe('HomePageLayouts', () => {
94
+ describe('diff()', () => {
95
+ const p = new HomePageLayouts(global.bf);
96
+ for (const t of tests) {
97
+ it(t.description, () => {
98
+ const actual = p.diff(t.source, t.target);
99
+ assert.deepStrictEqual(actual, t.expected);
100
+ });
101
+ }
102
+ });
103
+ });
104
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/plugins/home-page-layouts/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,KAAK,GAAG;IACZ;QACE,WAAW,EAAE,yBAAyB;QACtC,MAAM,EAAE;YACN,yBAAyB,EAAE;gBACzB;oBACE,OAAO,EAAE,eAAe;oBACxB,MAAM,EAAE,EAAE;iBACX;gBACD;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,MAAM,EAAE,EAAE;iBACX;aACF;SACF;QACD,MAAM,EAAE;YACN,yBAAyB,EAAE;gBACzB;oBACE,OAAO,EAAE,eAAe;oBACxB,MAAM,EAAE,EAAE;iBACX;gBACD;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,MAAM,EAAE,EAAE;iBACX;aACF;SACF;QACD,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,WAAW,EAAE,sCAAsC;QACnD,MAAM,EAAE;YACN,yBAAyB,EAAE;gBACzB;oBACE,OAAO,EAAE,UAAU;oBACnB,MAAM,EAAE,EAAE;iBACX;gBACD;oBACE,OAAO,EAAE,eAAe;oBACxB,MAAM,EAAE,EAAE;iBACX;gBACD;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,MAAM,EAAE,EAAE;iBACX;aACF;SACF;QACD,MAAM,EAAE;YACN,yBAAyB,EAAE;gBACzB;oBACE,OAAO,EAAE,eAAe;oBACxB,MAAM,EAAE,EAAE;iBACX;gBACD;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,MAAM,EAAE,EAAE;iBACX;aACF;SACF;QACD,QAAQ,EAAE,SAAS;KACpB;IACD;QACE,WAAW,EAAE,4BAA4B;QACzC,MAAM,EAAE;YACN,yBAAyB,EAAE;gBACzB;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,MAAM,EAAE,EAAE;iBACX;gBACD;oBACE,OAAO,EAAE,eAAe;oBACxB,MAAM,EAAE,EAAE;iBACX;aACF;SACF;QACD,MAAM,EAAE;YACN,yBAAyB,EAAE;gBACzB;oBACE,OAAO,EAAE,eAAe;oBACxB,MAAM,EAAE,EAAE;iBACX;gBACD;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,MAAM,EAAE,EAAE;iBACX;aACF;SACF;QACD,QAAQ,EAAE,SAAS;KACpB;CACF,CAAC;AAEF,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,MAAM,CAAC,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzC,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE;gBACrB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;gBAC1C,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { ActivitySettings as activitySettings } from './activity-settings/index.js';
2
+ import { CompanyInformation as companyInformation } from './company-information/index.js';
3
+ import { CustomerPortal as customerPortal } from './customer-portal/index.js';
4
+ import { DensitySettings as densitySettings } from './density-settings/index.js';
5
+ import { EmailDeliverability as emailDeliverability } from './email-deliverability/index.js';
6
+ import { HighVelocitySalesSettings as highVelocitySalesSettings } from './high-velocity-sales-settings/index.js';
7
+ import { HistoryTracking as historyTracking } from './history-tracking/index.js';
8
+ import { HomePageLayouts as homePageLayouts } from './home-page-layouts/index.js';
9
+ import { LightningExperienceSettings as lightningExperienceSettings } from './lightning-experience-settings/index.js';
10
+ import { LinkedInSalesNavigatorSettings as linkedInSalesNavigatorSettings } from './linkedin-sales-navigator-settings/index.js';
11
+ import { OmniChannelSettings as omniChannelSettings } from './omni-channel-settings/index.js';
12
+ import { OpportunitySplits as opportunitySplits } from './opportunity-splits/index.js';
13
+ import { PermissionSets as permissionSets } from './permission-sets/index.js';
14
+ import { Picklists as picklists } from './picklists/index.js';
15
+ import { RecordTypes as recordTypes } from './record-types/index.js';
16
+ import { RelateContactToMultipleAccounts as relateContactToMultipleAccounts } from './relate-contact-to-multiple-accounts/index.js';
17
+ import { ReportsAndDashboards as reportsAndDashboards } from './reports-and-dashboards/index.js';
18
+ import { SalesforceCpqConfig as salesforceCpqConfig } from './salesforce-cpq-config/index.js';
19
+ import { SalesforceToSalesforce as salesforceToSalesforce } from './salesforce-to-salesforce/index.js';
20
+ import { Security as security } from './security/index.js';
21
+ import { ServiceChannels as serviceChannels } from './service-channels/index.js';
22
+ import { Slack as slack } from './slack/index.js';
23
+ import { UserAccessPolicies as userAccessPolicies } from './user-access-policies/index.js';
24
+ export { userAccessPolicies, activitySettings, companyInformation, customerPortal, densitySettings, emailDeliverability, highVelocitySalesSettings, historyTracking, homePageLayouts, lightningExperienceSettings, linkedInSalesNavigatorSettings, omniChannelSettings, opportunitySplits, permissionSets, picklists, recordTypes, relateContactToMultipleAccounts, reportsAndDashboards, salesforceCpqConfig, salesforceToSalesforce, security, serviceChannels, slack, };
@@ -0,0 +1,25 @@
1
+ import { ActivitySettings as activitySettings } from './activity-settings/index.js';
2
+ import { CompanyInformation as companyInformation } from './company-information/index.js';
3
+ import { CustomerPortal as customerPortal } from './customer-portal/index.js';
4
+ import { DensitySettings as densitySettings } from './density-settings/index.js';
5
+ import { EmailDeliverability as emailDeliverability } from './email-deliverability/index.js';
6
+ import { HighVelocitySalesSettings as highVelocitySalesSettings } from './high-velocity-sales-settings/index.js';
7
+ import { HistoryTracking as historyTracking } from './history-tracking/index.js';
8
+ import { HomePageLayouts as homePageLayouts } from './home-page-layouts/index.js';
9
+ import { LightningExperienceSettings as lightningExperienceSettings } from './lightning-experience-settings/index.js';
10
+ import { LinkedInSalesNavigatorSettings as linkedInSalesNavigatorSettings } from './linkedin-sales-navigator-settings/index.js';
11
+ import { OmniChannelSettings as omniChannelSettings } from './omni-channel-settings/index.js';
12
+ import { OpportunitySplits as opportunitySplits } from './opportunity-splits/index.js';
13
+ import { PermissionSets as permissionSets } from './permission-sets/index.js';
14
+ import { Picklists as picklists } from './picklists/index.js';
15
+ import { RecordTypes as recordTypes } from './record-types/index.js';
16
+ import { RelateContactToMultipleAccounts as relateContactToMultipleAccounts } from './relate-contact-to-multiple-accounts/index.js';
17
+ import { ReportsAndDashboards as reportsAndDashboards } from './reports-and-dashboards/index.js';
18
+ import { SalesforceCpqConfig as salesforceCpqConfig } from './salesforce-cpq-config/index.js';
19
+ import { SalesforceToSalesforce as salesforceToSalesforce } from './salesforce-to-salesforce/index.js';
20
+ import { Security as security } from './security/index.js';
21
+ import { ServiceChannels as serviceChannels } from './service-channels/index.js';
22
+ import { Slack as slack } from './slack/index.js';
23
+ import { UserAccessPolicies as userAccessPolicies } from './user-access-policies/index.js';
24
+ export { userAccessPolicies, activitySettings, companyInformation, customerPortal, densitySettings, emailDeliverability, highVelocitySalesSettings, historyTracking, homePageLayouts, lightningExperienceSettings, linkedInSalesNavigatorSettings, omniChannelSettings, opportunitySplits, permissionSets, picklists, recordTypes, relateContactToMultipleAccounts, reportsAndDashboards, salesforceCpqConfig, salesforceToSalesforce, security, serviceChannels, slack, };
25
+ //# sourceMappingURL=index.js.map