@aglyn/aglyn 1.0.0-beta.221 → 1.0.0-beta.222

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 (346) hide show
  1. package/package.json +15 -11
  2. package/src/lib/app-utils/agent-openapi.js +1 -1
  3. package/src/lib/app-utils/agent-openapi.js.map +1 -1
  4. package/src/lib/app-utils/analytics-events.d.ts +3 -2
  5. package/src/lib/app-utils/analytics-events.js +3 -2
  6. package/src/lib/app-utils/analytics-events.js.map +1 -1
  7. package/src/lib/app-utils/api-plugins.d.ts +30 -0
  8. package/src/lib/app-utils/api-plugins.js +24 -1
  9. package/src/lib/app-utils/api-plugins.js.map +1 -1
  10. package/src/lib/app-utils/author-html.d.ts +1 -1
  11. package/src/lib/app-utils/author-html.js.map +1 -1
  12. package/src/lib/app-utils/bandwidth-cap.d.ts +12 -1
  13. package/src/lib/app-utils/bandwidth-cap.js +17 -1
  14. package/src/lib/app-utils/bandwidth-cap.js.map +1 -1
  15. package/src/lib/app-utils/compose-reusable-components.d.ts +19 -0
  16. package/src/lib/app-utils/compose-reusable-components.js +116 -26
  17. package/src/lib/app-utils/compose-reusable-components.js.map +1 -1
  18. package/src/lib/app-utils/console-routes.d.ts +4 -0
  19. package/src/lib/app-utils/console-routes.js +3 -0
  20. package/src/lib/app-utils/console-routes.js.map +1 -1
  21. package/src/lib/app-utils/contacts.d.ts +71 -0
  22. package/src/lib/app-utils/contacts.js +55 -0
  23. package/src/lib/app-utils/contacts.js.map +1 -1
  24. package/src/lib/app-utils/contexts.d.ts +1 -0
  25. package/src/lib/app-utils/contexts.js +1 -0
  26. package/src/lib/app-utils/contexts.js.map +1 -1
  27. package/src/lib/app-utils/crm-email-templates.js +21 -4
  28. package/src/lib/app-utils/crm-email-templates.js.map +1 -1
  29. package/src/lib/app-utils/crm-kinds.d.ts +2 -0
  30. package/src/lib/app-utils/crm-kinds.js +1 -0
  31. package/src/lib/app-utils/crm-kinds.js.map +1 -1
  32. package/src/lib/app-utils/crm.d.ts +1199 -67
  33. package/src/lib/app-utils/crm.js +1951 -310
  34. package/src/lib/app-utils/crm.js.map +1 -1
  35. package/src/lib/app-utils/csv-import.d.ts +10 -38
  36. package/src/lib/app-utils/csv-import.js +17 -42
  37. package/src/lib/app-utils/csv-import.js.map +1 -1
  38. package/src/lib/app-utils/csv.d.ts +32 -11
  39. package/src/lib/app-utils/csv.js +43 -5
  40. package/src/lib/app-utils/csv.js.map +1 -1
  41. package/src/lib/app-utils/default-site.d.ts +116 -0
  42. package/src/lib/app-utils/default-site.js +1024 -0
  43. package/src/lib/app-utils/default-site.js.map +1 -0
  44. package/src/lib/app-utils/docs-help.generated.d.ts +22 -22
  45. package/src/lib/app-utils/docs-help.generated.js +44 -10
  46. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  47. package/src/lib/app-utils/docs-index.generated.js +738 -150
  48. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  49. package/src/lib/app-utils/draft-placeholders.d.ts +76 -0
  50. package/src/lib/app-utils/draft-placeholders.js +115 -0
  51. package/src/lib/app-utils/draft-placeholders.js.map +1 -0
  52. package/src/lib/app-utils/entity-picker-context.d.ts +19 -15
  53. package/src/lib/app-utils/entity-picker-context.js +4 -4
  54. package/src/lib/app-utils/entity-picker-context.js.map +1 -1
  55. package/src/lib/app-utils/expand-repeatables.d.ts +66 -10
  56. package/src/lib/app-utils/expand-repeatables.js +88 -14
  57. package/src/lib/app-utils/expand-repeatables.js.map +1 -1
  58. package/src/lib/app-utils/forms.d.ts +33 -22
  59. package/src/lib/app-utils/forms.js +47 -28
  60. package/src/lib/app-utils/forms.js.map +1 -1
  61. package/src/lib/app-utils/full-use-cost.d.ts +277 -0
  62. package/src/lib/app-utils/full-use-cost.js +421 -0
  63. package/src/lib/app-utils/full-use-cost.js.map +1 -0
  64. package/src/lib/app-utils/health-report.js +11 -0
  65. package/src/lib/app-utils/health-report.js.map +1 -1
  66. package/src/lib/app-utils/llms-txt.d.ts +20 -0
  67. package/src/lib/app-utils/llms-txt.js +7 -1
  68. package/src/lib/app-utils/llms-txt.js.map +1 -1
  69. package/src/lib/app-utils/media-asset-facts.d.ts +16 -1
  70. package/src/lib/app-utils/media-asset-facts.js +40 -13
  71. package/src/lib/app-utils/media-asset-facts.js.map +1 -1
  72. package/src/lib/app-utils/media-bandwidth.d.ts +52 -0
  73. package/src/lib/app-utils/media-bandwidth.js +94 -0
  74. package/src/lib/app-utils/media-bandwidth.js.map +1 -0
  75. package/src/lib/app-utils/media-ref.d.ts +241 -33
  76. package/src/lib/app-utils/media-ref.js +324 -43
  77. package/src/lib/app-utils/media-ref.js.map +1 -1
  78. package/src/lib/app-utils/media-src.d.ts +8 -8
  79. package/src/lib/app-utils/media-src.js +27 -11
  80. package/src/lib/app-utils/media-src.js.map +1 -1
  81. package/src/lib/app-utils/media-takedown-reach.d.ts +4 -1
  82. package/src/lib/app-utils/media-takedown-reach.js +6 -3
  83. package/src/lib/app-utils/media-takedown-reach.js.map +1 -1
  84. package/src/lib/app-utils/notifications.d.ts +1 -1
  85. package/src/lib/app-utils/notifications.js +2 -0
  86. package/src/lib/app-utils/notifications.js.map +1 -1
  87. package/src/lib/app-utils/organizations.d.ts +51 -2
  88. package/src/lib/app-utils/organizations.js +56 -3
  89. package/src/lib/app-utils/organizations.js.map +1 -1
  90. package/src/lib/app-utils/page-record-sources.d.ts +87 -0
  91. package/src/lib/app-utils/page-record-sources.js +53 -0
  92. package/src/lib/app-utils/page-record-sources.js.map +1 -0
  93. package/src/lib/app-utils/paid-media-source.d.ts +3 -7
  94. package/src/lib/app-utils/paid-media-source.js +5 -19
  95. package/src/lib/app-utils/paid-media-source.js.map +1 -1
  96. package/src/lib/app-utils/person-erasure.d.ts +5 -2
  97. package/src/lib/app-utils/person-erasure.js.map +1 -1
  98. package/src/lib/app-utils/picklists.d.ts +187 -0
  99. package/src/lib/app-utils/picklists.js +320 -0
  100. package/src/lib/app-utils/picklists.js.map +1 -0
  101. package/src/lib/app-utils/plan-entitlements.d.ts +220 -50
  102. package/src/lib/app-utils/plan-entitlements.js +309 -115
  103. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  104. package/src/lib/app-utils/realm-host-surface.generated.js +2 -0
  105. package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
  106. package/src/lib/app-utils/release-flags.d.ts +1 -1
  107. package/src/lib/app-utils/release-flags.js +11 -0
  108. package/src/lib/app-utils/release-flags.js.map +1 -1
  109. package/src/lib/app-utils/rendered-widths.d.ts +121 -0
  110. package/src/lib/app-utils/rendered-widths.js +211 -0
  111. package/src/lib/app-utils/rendered-widths.js.map +1 -0
  112. package/src/lib/app-utils/repeat-sources.d.ts +2 -1
  113. package/src/lib/app-utils/repeat-sources.js.map +1 -1
  114. package/src/lib/app-utils/screen-route.d.ts +154 -36
  115. package/src/lib/app-utils/screen-route.js +185 -40
  116. package/src/lib/app-utils/screen-route.js.map +1 -1
  117. package/src/lib/app-utils/seo-audit.d.ts +11 -1
  118. package/src/lib/app-utils/seo-audit.js +33 -13
  119. package/src/lib/app-utils/seo-audit.js.map +1 -1
  120. package/src/lib/app-utils/seo-keywords.d.ts +11 -0
  121. package/src/lib/app-utils/seo-keywords.js +19 -5
  122. package/src/lib/app-utils/seo-keywords.js.map +1 -1
  123. package/src/lib/app-utils/seo-page-facts.d.ts +47 -4
  124. package/src/lib/app-utils/seo-page-facts.js +136 -31
  125. package/src/lib/app-utils/seo-page-facts.js.map +1 -1
  126. package/src/lib/app-utils/seo-site-scan.d.ts +42 -4
  127. package/src/lib/app-utils/seo-site-scan.js +113 -12
  128. package/src/lib/app-utils/seo-site-scan.js.map +1 -1
  129. package/src/lib/app-utils/server.d.ts +5 -4
  130. package/src/lib/app-utils/server.js +14 -5
  131. package/src/lib/app-utils/server.js.map +1 -1
  132. package/src/lib/app-utils/site-icon-set.d.ts +195 -0
  133. package/src/lib/app-utils/site-icon-set.js +351 -0
  134. package/src/lib/app-utils/site-icon-set.js.map +1 -0
  135. package/src/lib/app-utils/site-interactions.d.ts +101 -4
  136. package/src/lib/app-utils/site-interactions.js +120 -4
  137. package/src/lib/app-utils/site-interactions.js.map +1 -1
  138. package/src/lib/app-utils/starter-template-nodes.d.ts +7 -0
  139. package/src/lib/app-utils/starter-template-nodes.js +3 -0
  140. package/src/lib/app-utils/starter-template-nodes.js.map +1 -1
  141. package/src/lib/app-utils/starter-templates.d.ts +5 -19
  142. package/src/lib/app-utils/starter-templates.js +5 -49
  143. package/src/lib/app-utils/starter-templates.js.map +1 -1
  144. package/src/lib/app-utils/transfer-launcher-context.d.ts +136 -0
  145. package/src/lib/app-utils/transfer-launcher-context.js +23 -0
  146. package/src/lib/app-utils/transfer-launcher-context.js.map +1 -0
  147. package/src/lib/app-utils/transfer-resume-import.d.ts +39 -0
  148. package/src/lib/app-utils/transfer-resume-import.js +128 -0
  149. package/src/lib/app-utils/transfer-resume-import.js.map +1 -0
  150. package/src/lib/app-utils/upgrade-proposal.d.ts +66 -0
  151. package/src/lib/app-utils/upgrade-proposal.js +95 -0
  152. package/src/lib/app-utils/upgrade-proposal.js.map +1 -0
  153. package/src/lib/app-utils/utc-month.d.ts +33 -0
  154. package/src/lib/app-utils/utc-month.js +35 -0
  155. package/src/lib/app-utils/utc-month.js.map +1 -0
  156. package/src/lib/app-utils/visitor-record-ceiling.d.ts +4 -4
  157. package/src/lib/app-utils/visitor-record-ceiling.js +4 -4
  158. package/src/lib/app-utils/visitor-record-ceiling.js.map +1 -1
  159. package/src/lib/app-utils/wire-nodes.d.ts +39 -19
  160. package/src/lib/app-utils/wire-nodes.js +120 -34
  161. package/src/lib/app-utils/wire-nodes.js.map +1 -1
  162. package/src/lib/data-transfer/access.d.ts +74 -0
  163. package/src/lib/data-transfer/access.js +93 -0
  164. package/src/lib/data-transfer/access.js.map +1 -0
  165. package/src/lib/data-transfer/derive.d.ts +246 -0
  166. package/src/lib/data-transfer/derive.js +1007 -0
  167. package/src/lib/data-transfer/derive.js.map +1 -0
  168. package/src/lib/data-transfer/export-file.d.ts +46 -0
  169. package/src/lib/data-transfer/export-file.js +146 -0
  170. package/src/lib/data-transfer/export-file.js.map +1 -0
  171. package/src/lib/data-transfer/field-catalog.d.ts +134 -0
  172. package/src/lib/data-transfer/field-catalog.js +278 -0
  173. package/src/lib/data-transfer/field-catalog.js.map +1 -0
  174. package/src/lib/data-transfer/header-match.d.ts +129 -0
  175. package/src/lib/data-transfer/header-match.js +367 -0
  176. package/src/lib/data-transfer/header-match.js.map +1 -0
  177. package/src/lib/data-transfer/index.d.ts +34 -0
  178. package/src/lib/data-transfer/index.js +40 -0
  179. package/src/lib/data-transfer/index.js.map +1 -0
  180. package/src/lib/data-transfer/job.d.ts +190 -0
  181. package/src/lib/data-transfer/job.js +229 -0
  182. package/src/lib/data-transfer/job.js.map +1 -0
  183. package/src/lib/data-transfer/lookup.d.ts +45 -0
  184. package/src/lib/data-transfer/lookup.js +71 -0
  185. package/src/lib/data-transfer/lookup.js.map +1 -0
  186. package/src/lib/data-transfer/match.d.ts +99 -0
  187. package/src/lib/data-transfer/match.js +244 -0
  188. package/src/lib/data-transfer/match.js.map +1 -0
  189. package/src/lib/data-transfer/package-plan.d.ts +205 -0
  190. package/src/lib/data-transfer/package-plan.js +475 -0
  191. package/src/lib/data-transfer/package-plan.js.map +1 -0
  192. package/src/lib/data-transfer/package.d.ts +181 -0
  193. package/src/lib/data-transfer/package.js +426 -0
  194. package/src/lib/data-transfer/package.js.map +1 -0
  195. package/src/lib/data-transfer/picklist-map.d.ts +139 -0
  196. package/src/lib/data-transfer/picklist-map.js +271 -0
  197. package/src/lib/data-transfer/picklist-map.js.map +1 -0
  198. package/src/lib/data-transfer/plan.d.ts +176 -0
  199. package/src/lib/data-transfer/plan.js +451 -0
  200. package/src/lib/data-transfer/plan.js.map +1 -0
  201. package/src/lib/data-transfer/policy.d.ts +170 -0
  202. package/src/lib/data-transfer/policy.js +378 -0
  203. package/src/lib/data-transfer/policy.js.map +1 -0
  204. package/src/lib/data-transfer/resource.d.ts +211 -0
  205. package/src/lib/data-transfer/resource.js +241 -0
  206. package/src/lib/data-transfer/resource.js.map +1 -0
  207. package/src/lib/data-transfer/review.d.ts +70 -0
  208. package/src/lib/data-transfer/review.js +233 -0
  209. package/src/lib/data-transfer/review.js.map +1 -0
  210. package/src/lib/data-transfer/similarity.d.ts +40 -0
  211. package/src/lib/data-transfer/similarity.js +106 -0
  212. package/src/lib/data-transfer/similarity.js.map +1 -0
  213. package/src/lib/data-transfer/site-package.d.ts +365 -0
  214. package/src/lib/data-transfer/site-package.js +1077 -0
  215. package/src/lib/data-transfer/site-package.js.map +1 -0
  216. package/src/lib/data-transfer/source.d.ts +74 -0
  217. package/src/lib/data-transfer/source.js +293 -0
  218. package/src/lib/data-transfer/source.js.map +1 -0
  219. package/src/lib/data-transfer/transfer-api.d.ts +898 -0
  220. package/src/lib/data-transfer/transfer-api.js +107 -0
  221. package/src/lib/data-transfer/transfer-api.js.map +1 -0
  222. package/src/lib/foundation/definitions/org-billing.types.d.ts +31 -0
  223. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  224. package/src/lib/foundation/definitions/organization.types.d.ts +42 -1
  225. package/src/lib/foundation/definitions/organization.types.js.map +1 -1
  226. package/src/lib/foundation/definitions/platform.types.d.ts +6 -4
  227. package/src/lib/foundation/definitions/platform.types.js.map +1 -1
  228. package/src/lib/foundation/index.d.ts +1 -1
  229. package/src/lib/foundation/index.js.map +1 -1
  230. package/src/lib/plugin-manager/feature-plugins.d.ts +91 -2
  231. package/src/lib/plugin-manager/feature-plugins.js +48 -3
  232. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
  233. package/src/lib/plugin-manager/first-party-plugins.generated.d.ts +50 -0
  234. package/src/lib/plugin-manager/first-party-plugins.generated.js +1129 -28
  235. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  236. package/src/lib/plugin-manager/index.d.ts +0 -1
  237. package/src/lib/plugin-manager/index.js +0 -1
  238. package/src/lib/plugin-manager/index.js.map +1 -1
  239. package/src/lib/plugin-manager/interaction-recipes.d.ts +142 -0
  240. package/src/lib/plugin-manager/interaction-recipes.js +104 -0
  241. package/src/lib/plugin-manager/interaction-recipes.js.map +1 -0
  242. package/src/lib/plugin-manager/interaction-step-checks.d.ts +66 -0
  243. package/src/lib/plugin-manager/interaction-step-checks.js +86 -0
  244. package/src/lib/plugin-manager/interaction-step-checks.js.map +1 -0
  245. package/src/lib/plugin-manager/plugin-artifact-types.d.ts +235 -0
  246. package/src/lib/plugin-manager/plugin-artifact-types.js +99 -0
  247. package/src/lib/plugin-manager/plugin-artifact-types.js.map +1 -0
  248. package/src/lib/plugin-manager/plugin-contact-capture.d.ts +8 -0
  249. package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
  250. package/src/lib/plugin-manager/plugin-conversion-credit.d.ts +216 -0
  251. package/src/lib/plugin-manager/plugin-conversion-credit.js +91 -0
  252. package/src/lib/plugin-manager/plugin-conversion-credit.js.map +1 -0
  253. package/src/lib/plugin-manager/plugin-entity-pickers.d.ts +83 -0
  254. package/src/lib/plugin-manager/plugin-entity-pickers.js +87 -0
  255. package/src/lib/plugin-manager/plugin-entity-pickers.js.map +1 -0
  256. package/src/lib/plugin-manager/plugin-host-resources.d.ts +6 -0
  257. package/src/lib/plugin-manager/plugin-host-resources.js +6 -1
  258. package/src/lib/plugin-manager/plugin-host-resources.js.map +1 -1
  259. package/src/lib/plugin-manager/plugin-intake-gates.d.ts +75 -0
  260. package/src/lib/plugin-manager/plugin-intake-gates.js +49 -0
  261. package/src/lib/plugin-manager/plugin-intake-gates.js.map +1 -0
  262. package/src/lib/plugin-manager/plugin-jobs.d.ts +5 -5
  263. package/src/lib/plugin-manager/plugin-jobs.js +7 -7
  264. package/src/lib/plugin-manager/plugin-jobs.js.map +1 -1
  265. package/src/lib/plugin-manager/plugin-live-paths.d.ts +70 -0
  266. package/src/lib/plugin-manager/plugin-live-paths.js +66 -0
  267. package/src/lib/plugin-manager/plugin-live-paths.js.map +1 -0
  268. package/src/lib/plugin-manager/plugin-org-erasure.d.ts +3 -2
  269. package/src/lib/plugin-manager/plugin-org-erasure.js +30 -5
  270. package/src/lib/plugin-manager/plugin-org-erasure.js.map +1 -1
  271. package/src/lib/plugin-manager/plugin-person-erasure.d.ts +68 -9
  272. package/src/lib/plugin-manager/plugin-person-erasure.js +196 -51
  273. package/src/lib/plugin-manager/plugin-person-erasure.js.map +1 -1
  274. package/src/lib/plugin-manager/plugin-person-records.d.ts +275 -0
  275. package/src/lib/plugin-manager/plugin-person-records.js +107 -0
  276. package/src/lib/plugin-manager/plugin-person-records.js.map +1 -0
  277. package/src/lib/plugin-manager/plugin-record-counts.d.ts +76 -0
  278. package/src/lib/plugin-manager/plugin-record-counts.js +49 -0
  279. package/src/lib/plugin-manager/plugin-record-counts.js.map +1 -0
  280. package/src/lib/plugin-manager/plugin-record-email-state.d.ts +26 -0
  281. package/src/lib/plugin-manager/plugin-record-email-state.js +16 -0
  282. package/src/lib/plugin-manager/plugin-record-email-state.js.map +1 -1
  283. package/src/lib/plugin-manager/plugin-record-index.d.ts +10 -0
  284. package/src/lib/plugin-manager/plugin-record-index.js.map +1 -1
  285. package/src/lib/plugin-manager/plugin-record-lists.d.ts +86 -6
  286. package/src/lib/plugin-manager/plugin-record-lists.js +42 -5
  287. package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -1
  288. package/src/lib/plugin-manager/plugin-record-origin.d.ts +79 -0
  289. package/src/lib/plugin-manager/plugin-record-origin.js +46 -0
  290. package/src/lib/plugin-manager/plugin-record-origin.js.map +1 -0
  291. package/src/lib/plugin-manager/plugin-record-pages.d.ts +37 -0
  292. package/src/lib/plugin-manager/plugin-record-pages.js +52 -0
  293. package/src/lib/plugin-manager/plugin-record-pages.js.map +1 -0
  294. package/src/lib/plugin-manager/plugin-record-timeline.d.ts +60 -0
  295. package/src/lib/plugin-manager/plugin-record-timeline.js +16 -0
  296. package/src/lib/plugin-manager/plugin-record-timeline.js.map +1 -1
  297. package/src/lib/plugin-manager/plugin-resource-drafts.d.ts +5 -5
  298. package/src/lib/plugin-manager/plugin-resource-drafts.js.map +1 -1
  299. package/src/lib/plugin-manager/plugin-revocations.d.ts +64 -0
  300. package/src/lib/plugin-manager/plugin-revocations.js +47 -0
  301. package/src/lib/plugin-manager/plugin-revocations.js.map +1 -0
  302. package/src/lib/plugin-manager/plugin-send-tallies.d.ts +69 -0
  303. package/src/lib/plugin-manager/plugin-send-tallies.js +45 -0
  304. package/src/lib/plugin-manager/plugin-send-tallies.js.map +1 -0
  305. package/src/lib/plugin-manager/plugin-site-bundle.d.ts +40 -0
  306. package/src/lib/plugin-manager/plugin-site-bundle.js +4 -0
  307. package/src/lib/plugin-manager/plugin-site-bundle.js.map +1 -1
  308. package/src/lib/plugin-manager/plugin-site-export.d.ts +57 -1
  309. package/src/lib/plugin-manager/plugin-site-export.js +23 -10
  310. package/src/lib/plugin-manager/plugin-site-export.js.map +1 -1
  311. package/src/lib/plugin-manager/plugin-sitemap-readers.d.ts +146 -0
  312. package/src/lib/plugin-manager/plugin-sitemap-readers.js +110 -0
  313. package/src/lib/plugin-manager/plugin-sitemap-readers.js.map +1 -0
  314. package/src/lib/plugin-manager/plugin-transfer-resources.d.ts +714 -0
  315. package/src/lib/plugin-manager/plugin-transfer-resources.js +443 -0
  316. package/src/lib/plugin-manager/plugin-transfer-resources.js.map +1 -0
  317. package/src/lib/plugin-manager/plugin-usage-axes.d.ts +54 -5
  318. package/src/lib/plugin-manager/plugin-usage-axes.js +11 -3
  319. package/src/lib/plugin-manager/plugin-usage-axes.js.map +1 -1
  320. package/src/lib/plugin-manager/plugin-user-erasure.js +9 -1
  321. package/src/lib/plugin-manager/plugin-user-erasure.js.map +1 -1
  322. package/src/lib/plugin-manager/plugin-visitor-doors.d.ts +104 -0
  323. package/src/lib/plugin-manager/plugin-visitor-doors.js +108 -0
  324. package/src/lib/plugin-manager/plugin-visitor-doors.js.map +1 -0
  325. package/src/lib/plugin-manager/realm-host-aglyn.generated.js +2 -0
  326. package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
  327. package/src/lib/plugin-manager/repeat-rows.d.ts +5 -6
  328. package/src/lib/plugin-manager/repeat-rows.js.map +1 -1
  329. package/src/lib/app-utils/actions.d.ts +0 -310
  330. package/src/lib/app-utils/actions.js +0 -506
  331. package/src/lib/app-utils/actions.js.map +0 -1
  332. package/src/lib/app-utils/automation-placeholders.d.ts +0 -72
  333. package/src/lib/app-utils/automation-placeholders.js +0 -207
  334. package/src/lib/app-utils/automation-placeholders.js.map +0 -1
  335. package/src/lib/app-utils/dataset-models.d.ts +0 -339
  336. package/src/lib/app-utils/dataset-models.js +0 -722
  337. package/src/lib/app-utils/dataset-models.js.map +0 -1
  338. package/src/lib/app-utils/datasets.d.ts +0 -171
  339. package/src/lib/app-utils/datasets.js +0 -227
  340. package/src/lib/app-utils/datasets.js.map +0 -1
  341. package/src/lib/app-utils/form-abuse-ceiling.d.ts +0 -146
  342. package/src/lib/app-utils/form-abuse-ceiling.js +0 -158
  343. package/src/lib/app-utils/form-abuse-ceiling.js.map +0 -1
  344. package/src/lib/plugin-manager/order-fulfilment.d.ts +0 -142
  345. package/src/lib/plugin-manager/order-fulfilment.js +0 -104
  346. package/src/lib/plugin-manager/order-fulfilment.js.map +0 -1
@@ -0,0 +1,443 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { _ as _extends } from "@swc/helpers/_/_extends";
17
+ var _globalScope_RESOURCES_KEY, _globalScope_UIS_KEY;
18
+ import { checkEntitlement, planLabelGrantingFeature } from "../app-utils/plan-entitlements.js";
19
+ import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
20
+ import { buildTransferFieldCatalog, TRANSFER_PRESET_IDS } from "../data-transfer/field-catalog.js";
21
+ import { transferPlanFeature } from "../data-transfer/access.js";
22
+ import { matchRows } from "../data-transfer/match.js";
23
+ import { buildTransferPlan } from "../data-transfer/plan.js";
24
+ import { transferPolicyDefaultsFor } from "../data-transfer/policy.js";
25
+ import { parseTransferResourceKey, transferFieldProblems, transferResourceProblems } from "../data-transfer/resource.js";
26
+ import { TRANSFER_PLAN_REQUIRED } from "../data-transfer/transfer-api.js";
27
+ import { filterPluginsByReleaseFlags, resolveEnabledPlugins, resolveHostEnabledPlugins } from "./enabled-plugins.js";
28
+ import { PLUGIN_TRANSFER_RESOURCES_DECLARED } from "./first-party-plugins.generated.js";
29
+ import { runPluginDeclarationsRepair } from "./plugin-declarations-repair.js";
30
+ /**
31
+ * The load point a plugin with a transfer resource declares in its
32
+ * `console.slots`, so the hub and the wizard load its console registrar and
33
+ * with it the client half.
34
+ */ export const TRANSFER_RESOURCES_LOAD_POINT = 'transferResources';
35
+ /** Every declared resource, in config order — the order the hub lists them. */ export function listDeclaredTransferResources() {
36
+ return PLUGIN_TRANSFER_RESOURCES_DECLARED;
37
+ }
38
+ /** The declared resource with this key, or `null`. */ export function declaredTransferResource(key) {
39
+ var _listDeclaredTransferResources_find;
40
+ const name = key.trim();
41
+ return (_listDeclaredTransferResources_find = listDeclaredTransferResources().find((one)=>one.key === name)) != null ? _listDeclaredTransferResources_find : null;
42
+ }
43
+ /**
44
+ * The declared resources of `subject.scope` whose plugin runs for the
45
+ * subject — the workspace's enabled set for `org`, the site's for `host` —
46
+ * in config order. A resource of a plugin switched off is not offered, the
47
+ * same rule every other surface of that plugin follows.
48
+ */ export function listTransferResourcesFor(subject) {
49
+ const enabled = subject.scope === 'host' ? resolveHostEnabledPlugins(subject.org, subject.host) : resolveEnabledPlugins(subject.org);
50
+ const running = new Set(subject.isFlagOn ? filterPluginsByReleaseFlags(enabled, subject.isFlagOn, {
51
+ staffBypass: subject.staffBypass
52
+ }) : enabled);
53
+ return listDeclaredTransferResources().filter((one)=>one.scope === subject.scope && running.has(one.pluginId));
54
+ }
55
+ /** "Companies" → "companies", "CRM fields" unchanged: the label inside a sentence. */ function inSentence(label) {
56
+ return /^[A-Z][a-z]/.test(label) ? label.charAt(0).toLowerCase() + label.slice(1) : label;
57
+ }
58
+ /**
59
+ * The refusal a resource with no `planGate` gets: its plan feature as
60
+ * `code`, and a sentence naming the plan that includes it, from the same
61
+ * ladder the console's upgrade notices walk. A feature no plan carries — an
62
+ * add-on, the Event Calendar — is never offered as an upgrade: it is named
63
+ * as the add-on it is, the shell's own `blockedExtensionNotice` wording.
64
+ */ export function transferPlanRequired(feature, label, intent) {
65
+ const plan = planLabelGrantingFeature(feature);
66
+ const act = `${intent === 'export' ? 'Exporting' : 'Importing'} ${inSentence(label)}`;
67
+ return {
68
+ status: 403,
69
+ body: {
70
+ error: plan ? `${act} is not included in your current plan. Manage your plan and add-ons from Billing. Included from ${plan}.` : `${act} isn't included in any plan — it's a paid add-on. Manage your plan and add-ons from Billing.`,
71
+ reason: TRANSFER_PLAN_REQUIRED,
72
+ code: feature
73
+ }
74
+ };
75
+ }
76
+ /**
77
+ * The refusal for moving `subject.resource` with `intent` on the
78
+ * workspace's plan, or `null` when the plan may: no `featureFlag`, an
79
+ * exempt intent, or a plan that carries it. A key no plugin declares is
80
+ * `null` here — the route answers it as it answers any unknown resource.
81
+ */ export async function transferPlanRefusal(subject, intent) {
82
+ var _subject_resource;
83
+ const declared = declaredTransferResource(parseTransferResourceKey(String((_subject_resource = subject.resource) != null ? _subject_resource : '')).key);
84
+ const feature = transferPlanFeature(intent, declared);
85
+ if (!declared || !feature) return null;
86
+ let gate;
87
+ try {
88
+ gate = (await resolveTransferResource(subject.resource)).impl.planGate;
89
+ } catch (unused) {
90
+ // A server half that cannot be reached is answered by the route that
91
+ // needs it; the plan is still asked, from the declaration.
92
+ gate = undefined;
93
+ }
94
+ if (gate) return gate(subject, intent);
95
+ return checkEntitlement(subject.org, feature) ? null : transferPlanRequired(feature, declared.label, intent);
96
+ }
97
+ const RECORDS_HOOKS = [
98
+ 'fields',
99
+ 'matchKeys',
100
+ 'readPage',
101
+ 'lookup'
102
+ ];
103
+ /** What only an importable records resource answers: its writes and their undo. */ const IMPORT_HOOKS = [
104
+ 'apply',
105
+ 'revert'
106
+ ];
107
+ const PACKAGE_HOOKS = [
108
+ 'items',
109
+ 'dependencies',
110
+ 'remapIds',
111
+ 'readItems',
112
+ 'writeItems',
113
+ 'revertItems'
114
+ ];
115
+ /** What is missing from `impl` for the kinds a resource declares, as sentences. */ export function pluginTransferResourceProblems(declared, impl) {
116
+ var _impl_presets;
117
+ const problems = [];
118
+ const need = (kind, hooks)=>{
119
+ if (!declared.kinds.includes(kind)) return;
120
+ for (const hook of hooks){
121
+ if (impl[hook] === undefined) {
122
+ problems.push(`${declared.key} declares ${kind} and registers no "${hook}".`);
123
+ }
124
+ }
125
+ };
126
+ need('records', RECORDS_HOOKS);
127
+ if (declared.exportOnly !== true) need('records', IMPORT_HOOKS);
128
+ need('package', PACKAGE_HOOKS);
129
+ if (impl.planGate !== undefined && !declared.featureFlag) {
130
+ problems.push(`${declared.key} registers a "planGate" and declares no "featureFlag", so nothing would ask it.`);
131
+ }
132
+ if (Array.isArray(impl.matchKeys) && !impl.matchKeys.length && declared.kinds.includes('records')) {
133
+ problems.push(`${declared.key} names no match key, so no row could find its record.`);
134
+ }
135
+ const presetIds = new Set();
136
+ for (const preset of (_impl_presets = impl.presets) != null ? _impl_presets : []){
137
+ var _preset_label, _preset_fieldIds;
138
+ if (TRANSFER_PRESET_IDS.includes(preset.id) || presetIds.has(preset.id)) {
139
+ problems.push(`${declared.key} lists preset "${preset.id}" twice, or under a built-in preset's id.`);
140
+ }
141
+ presetIds.add(preset.id);
142
+ if (!((_preset_label = preset.label) == null ? void 0 : _preset_label.trim()) || !((_preset_fieldIds = preset.fieldIds) == null ? void 0 : _preset_fieldIds.length)) {
143
+ problems.push(`${declared.key} lists preset "${preset.id}" with no label or no fields.`);
144
+ }
145
+ }
146
+ return problems;
147
+ }
148
+ /**
149
+ * One table per process, on `globalThis` (AGL-3412): a plugin registers from
150
+ * its declarations at boot, which Next compiles apart from the routes that
151
+ * read, and a module-scoped map would be filled in one copy and read empty in
152
+ * the other.
153
+ */ const RESOURCES_KEY = Symbol.for('@aglyn/aglyn:transfer-resources');
154
+ const UIS_KEY = Symbol.for('@aglyn/aglyn:transfer-resource-uis');
155
+ const globalScope = globalThis;
156
+ const resources = (_globalScope_RESOURCES_KEY = globalScope[RESOURCES_KEY]) != null ? _globalScope_RESOURCES_KEY : globalScope[RESOURCES_KEY] = new Map();
157
+ /** The owner a registration is filed under, and the declaration it must match. */ function claim(what, key, options) {
158
+ var _ref, _getRegisteringPluginId;
159
+ const pluginId = ((_ref = (_getRegisteringPluginId = getRegisteringPluginId()) != null ? _getRegisteringPluginId : options == null ? void 0 : options.pluginId) != null ? _ref : '').trim();
160
+ if (!pluginId) {
161
+ throw new Error(`${what} "${key}" registered with no owner: pass { pluginId } ` + 'when registering outside a plugin register fn');
162
+ }
163
+ const declared = declaredTransferResource(key);
164
+ if (!declared) {
165
+ throw new Error(`${what} "${key}" is not declared in plugins.config.json ` + '(transferResources), so no wizard or job would ever offer it');
166
+ }
167
+ if (declared.pluginId !== pluginId) {
168
+ throw new Error(`${what} "${key}" is declared by "${declared.pluginId}"; refused "${pluginId}"`);
169
+ }
170
+ return declared;
171
+ }
172
+ /**
173
+ * Registers the server half of a resource the plugin declared. The owner is
174
+ * the plugin whose register fn is running, or the `pluginId` passed from a
175
+ * boot declaration. Refused, naming why: no owner, a key nobody declared, a
176
+ * key another plugin declared, a declaration the core's
177
+ * `transferResourceProblems` rejects, and hooks missing for a declared kind.
178
+ * The same plugin registering again replaces its answers.
179
+ */ export function registerPluginTransferResource(key, impl, options) {
180
+ const name = key.trim();
181
+ const declared = claim('transfer resource', name, options);
182
+ const problems = [
183
+ ...transferResourceProblems(declared),
184
+ ...pluginTransferResourceProblems(declared, impl)
185
+ ];
186
+ if (problems.length) {
187
+ throw new Error(`transfer resource "${name}" refused: ${problems.join(' ')}`);
188
+ }
189
+ resources.set(name, {
190
+ pluginId: declared.pluginId,
191
+ impl
192
+ });
193
+ }
194
+ /** Why a resource could not be resolved: nobody declared the key, or nobody registered it. */ export class TransferResourceUnavailableError extends Error {
195
+ constructor(key, reason, message){
196
+ super(message), this.key = key, this.reason = reason;
197
+ this.name = 'TransferResourceUnavailableError';
198
+ }
199
+ }
200
+ async function ensureRegistered(declared) {
201
+ const missing = ()=>declared.filter((one)=>!resources.has(one.key));
202
+ if (missing().length) await runPluginDeclarationsRepair();
203
+ const absent = missing();
204
+ if (absent.length) {
205
+ const names = absent.map((one)=>`"${one.key}" (${one.pluginId})`).join(', ');
206
+ throw new TransferResourceUnavailableError(absent[0].key, 'unregistered', `[plugins] transfer resource(s) ${names} declared and not registered in this process`);
207
+ }
208
+ }
209
+ /**
210
+ * The resource with this key and its server half. Throws
211
+ * {@link TransferResourceUnavailableError}: `undeclared` for a key no plugin
212
+ * declares — and for a key that names an instance of a resource declared
213
+ * without `instances`, or none of one declared with them — (a route answers
214
+ * 404), and `unregistered` for one declared and still missing after the
215
+ * app's declarations step ran once (a route answers 500 — a boot that
216
+ * dropped a registration, never "nothing to move").
217
+ */ export async function resolveTransferResource(key) {
218
+ const asked = String(key != null ? key : '').trim();
219
+ const { key: base, instance } = parseTransferResourceKey(asked);
220
+ const declared = declaredTransferResource(base);
221
+ if (!declared || Boolean(declared.instances) !== (instance !== null)) {
222
+ throw new TransferResourceUnavailableError(asked, 'undeclared', declared ? declared.instances ? `transfer resource "${declared.key}" is moved one instance at a time; name it as "${declared.key}:<instance>"` : `transfer resource "${declared.key}" has no instances; "${asked}" names one` : `no plugin declares a transfer resource "${asked}"`);
223
+ }
224
+ await ensureRegistered([
225
+ declared
226
+ ]);
227
+ const impl = resources.get(declared.key).impl;
228
+ return instance === null ? _extends({}, declared, {
229
+ impl
230
+ }) : _extends({}, declared, {
231
+ key: asked,
232
+ instance,
233
+ impl
234
+ });
235
+ }
236
+ /**
237
+ * Every declared resource with its server half, in config order. Throws
238
+ * naming each one declared and not registered, after the declarations step
239
+ * ran once.
240
+ */ export async function resolveTransferResources() {
241
+ const declared = listDeclaredTransferResources();
242
+ await ensureRegistered(declared);
243
+ return declared.map((one)=>_extends({}, one, {
244
+ impl: resources.get(one.key).impl
245
+ }));
246
+ }
247
+ /** The records hooks of a resolved resource; throws for one that does not declare `records`. */ export function transferRecordsHooks(resource) {
248
+ if (!resource.kinds.includes('records')) {
249
+ throw new Error(`transfer resource "${resource.key}" does not move records`);
250
+ }
251
+ return resource.impl;
252
+ }
253
+ /** The package hooks of a resolved resource; throws for one that does not declare `package`. */ export function transferPackageHooks(resource) {
254
+ if (!resource.kinds.includes('package')) {
255
+ throw new Error(`transfer resource "${resource.key}" does not move a package`);
256
+ }
257
+ return resource.impl;
258
+ }
259
+ /**
260
+ * The resource's field catalog, built by the core. Throws naming every
261
+ * problem `transferFieldProblems` finds: a catalog the wizard cannot trust
262
+ * is refused before a person maps a column to it.
263
+ */ export async function transferResourceCatalog(resource, ctx) {
264
+ const catalog = buildTransferFieldCatalog(await transferRecordsHooks(resource).fields(ctx));
265
+ const problems = transferFieldProblems(catalog.fields);
266
+ if (problems.length) {
267
+ throw new Error(`transfer resource "${resource.key}" has a bad field catalog: ${problems.join(' ')}`);
268
+ }
269
+ return catalog;
270
+ }
271
+ /**
272
+ * The match keys a resource offers in this context and the ones a person
273
+ * starts with: its fixed list (every key a default), or what its
274
+ * `matchKeys(ctx)` answers. Throws for a context that offers no key, which no
275
+ * row could be matched by.
276
+ */ export async function transferResourceMatchKeys(resource, ctx) {
277
+ var _offer_defaults;
278
+ const declared = transferRecordsHooks(resource).matchKeys;
279
+ const offer = typeof declared === 'function' ? await declared(ctx) : {
280
+ keys: declared
281
+ };
282
+ const keys = [
283
+ ...offer.keys
284
+ ];
285
+ if (!keys.length) throw new Error(`transfer resource "${resource.key}" offers no match key, so no row could find its record`);
286
+ const known = new Set(keys.map((key)=>key.fieldId));
287
+ const defaults = ((_offer_defaults = offer.defaults) != null ? _offer_defaults : keys.map((key)=>key.fieldId)).filter((fieldId)=>known.has(fieldId));
288
+ return {
289
+ keys,
290
+ defaults
291
+ };
292
+ }
293
+ /**
294
+ * The plan for one chunk: the resource's own `plan`, or the core's
295
+ * `buildTransferPlan` — handed the resource's comparator when the input
296
+ * carries none.
297
+ */ export async function planTransferResourceRows(resource, ctx, input) {
298
+ const hooks = transferRecordsHooks(resource);
299
+ const compared = !input.valuesEqual && hooks.valuesEqual ? _extends({}, input, {
300
+ valuesEqual: hooks.valuesEqual
301
+ }) : input;
302
+ return hooks.plan ? hooks.plan(ctx, compared) : buildTransferPlan(compared);
303
+ }
304
+ /**
305
+ * The resource's starting policy for this context, kept to what holds for
306
+ * `fields` (`transferPolicyDefaultsFor`); `{}` for a resource that starts
307
+ * from the core's defaults.
308
+ */ export async function transferResourcePolicyDefaults(resource, ctx, fields) {
309
+ const declared = transferRecordsHooks(resource).defaultPolicy;
310
+ const defaults = typeof declared === 'function' ? await declared(ctx) : declared;
311
+ return transferPolicyDefaultsFor(defaults, fields);
312
+ }
313
+ /**
314
+ * Each row's match outcome: the core's `matchRows`, then the resource's own
315
+ * `match` over it when it has one. `records` holds what `lookup` read and
316
+ * whatever the resource's matching added. An answer that is not one outcome
317
+ * per row is refused — a short list would shift every row's verdict.
318
+ */ export async function matchTransferResourceRows(resource, ctx, input) {
319
+ var _answer_records;
320
+ const outcomes = matchRows(input.rows, input.keys, input.lookup);
321
+ const hook = transferRecordsHooks(resource).match;
322
+ if (!hook) return {
323
+ outcomes,
324
+ records: input.records
325
+ };
326
+ const answer = await hook(ctx, _extends({}, input, {
327
+ outcomes
328
+ }));
329
+ if (!Array.isArray(answer == null ? void 0 : answer.outcomes) || answer.outcomes.length !== input.rows.length) {
330
+ var _ref;
331
+ var _answer_outcomes;
332
+ throw new Error(`transfer resource "${resource.key}" matched ${(_ref = answer == null ? void 0 : (_answer_outcomes = answer.outcomes) == null ? void 0 : _answer_outcomes.length) != null ? _ref : 0} of ${input.rows.length} rows`);
333
+ }
334
+ if (!((_answer_records = answer.records) == null ? void 0 : _answer_records.size)) return {
335
+ outcomes: answer.outcomes,
336
+ records: input.records
337
+ };
338
+ return {
339
+ outcomes: answer.outcomes,
340
+ records: new Map([
341
+ ...input.records,
342
+ ...answer.records
343
+ ])
344
+ };
345
+ }
346
+ /** The resource's locked rules, or none. */ export async function transferResourceLockedRules(resource, ctx) {
347
+ var _ref;
348
+ var _transferRecordsHooks_lockedRules, _transferRecordsHooks;
349
+ return (_ref = await ((_transferRecordsHooks_lockedRules = (_transferRecordsHooks = transferRecordsHooks(resource)).lockedRules) == null ? void 0 : _transferRecordsHooks_lockedRules.call(_transferRecordsHooks, ctx))) != null ? _ref : [];
350
+ }
351
+ /**
352
+ * Every planned row that would write and breaks an invariant, checked
353
+ * against the record as it was read (`existing`, by record id). Rows that
354
+ * write nothing (`skip`, `fail`, `unchanged`) are not checked.
355
+ */ export function transferInvariantFailures(invariants, rows, existing) {
356
+ const failures = [];
357
+ if (!(invariants == null ? void 0 : invariants.length)) return failures;
358
+ for (const row of rows){
359
+ var _existing_get;
360
+ if (row.verdict !== 'create' && row.verdict !== 'update') continue;
361
+ const before = row.recordId ? (_existing_get = existing.get(row.recordId)) != null ? _existing_get : null : null;
362
+ for (const invariant of invariants){
363
+ const message = invariant.check(row, before);
364
+ if (message) failures.push({
365
+ row: row.index,
366
+ invariant: invariant.id,
367
+ message
368
+ });
369
+ }
370
+ }
371
+ return failures;
372
+ }
373
+ /** Only for specs: forgets every registered server half. */ export function resetTransferResourcesForTests() {
374
+ resources.clear();
375
+ }
376
+ /** The core wizard's steps, in order. */ export const TRANSFER_WIZARD_STEPS = [
377
+ 'upload',
378
+ 'mapping',
379
+ 'values',
380
+ 'matching',
381
+ 'conflicts',
382
+ 'dryRun',
383
+ 'apply'
384
+ ];
385
+ const uis = (_globalScope_UIS_KEY = globalScope[UIS_KEY]) != null ? _globalScope_UIS_KEY : globalScope[UIS_KEY] = new Map();
386
+ /**
387
+ * Registers the client half of a resource the plugin declared, from its
388
+ * console registrar. Refused on the same terms as the server half — no
389
+ * owner, an undeclared key, another plugin's key — and for an extra step
390
+ * that follows no core step or repeats another's id.
391
+ */ export function registerPluginTransferResourceUi(key, ui, options) {
392
+ var _ui_extraSteps;
393
+ const name = key.trim();
394
+ const declared = claim('transfer resource UI', name, options);
395
+ const ids = new Set();
396
+ for (const step of (_ui_extraSteps = ui.extraSteps) != null ? _ui_extraSteps : []){
397
+ if (!TRANSFER_WIZARD_STEPS.includes(step.after)) {
398
+ throw new Error(`transfer resource UI "${name}": step "${step.id}" follows no wizard step ("${step.after}")`);
399
+ }
400
+ if (ids.has(step.id)) throw new Error(`transfer resource UI "${name}": step "${step.id}" is listed twice`);
401
+ ids.add(step.id);
402
+ }
403
+ uis.set(name, {
404
+ pluginId: declared.pluginId,
405
+ ui
406
+ });
407
+ }
408
+ /** The client half registered for a resource — or for the resource a key names an instance of — or `null`. */ export function pluginTransferResourceUi(key) {
409
+ const entry = uis.get(parseTransferResourceKey(key).key);
410
+ return entry ? _extends({}, entry.ui, {
411
+ pluginId: entry.pluginId
412
+ }) : null;
413
+ }
414
+ /** Every registered client half, in registration order. */ export function listPluginTransferResourceUis() {
415
+ return [
416
+ ...uis.entries()
417
+ ].map(([key, entry])=>({
418
+ key,
419
+ pluginId: entry.pluginId
420
+ }));
421
+ }
422
+ /**
423
+ * The wizard's steps for a resource: the core's, with the plugin's own
424
+ * inserted after the step each names, in the order the plugin lists them.
425
+ */ export function transferWizardSteps(key) {
426
+ var _ref;
427
+ var _pluginTransferResourceUi;
428
+ const extra = (_ref = (_pluginTransferResourceUi = pluginTransferResourceUi(key)) == null ? void 0 : _pluginTransferResourceUi.extraSteps) != null ? _ref : [];
429
+ return TRANSFER_WIZARD_STEPS.flatMap((id)=>[
430
+ {
431
+ id,
432
+ core: true
433
+ },
434
+ ...extra.filter((step)=>step.after === id).map((step)=>_extends({}, step, {
435
+ core: false
436
+ }))
437
+ ]);
438
+ }
439
+ /** Only for specs: forgets every registered client half. */ export function resetTransferResourceUisForTests() {
440
+ uis.clear();
441
+ }
442
+
443
+ //# sourceMappingURL=plugin-transfer-resources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/plugin-transfer-resources.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ComponentType } from 'react'\nimport { checkEntitlement, planLabelGrantingFeature } from '../app-utils/plan-entitlements'\nimport type { PicklistSpec, PicklistValue, PicklistValueSet } from '../app-utils/picklists'\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport {\n buildTransferFieldCatalog,\n TRANSFER_PRESET_IDS,\n type TransferCatalogInput,\n type TransferFieldCatalog,\n type TransferResourcePreset,\n} from '../data-transfer/field-catalog'\nimport { transferPlanFeature, type TransferAccessIntent } from '../data-transfer/access'\nimport type { TransferAliasDictionary } from '../data-transfer/header-match'\nimport {\n matchRows,\n type MatchKeySpec,\n type MatchLookup,\n type MatchLookupRequest,\n type RowMatchOutcome,\n} from '../data-transfer/match'\nimport type { TransferLookupSuggestion } from '../data-transfer/lookup'\nimport type {\n ExistingPackageItem,\n PackageDependency,\n PackageItemDecision,\n PackageManifestItem,\n} from '../data-transfer/package'\nimport type { TransferReferenceKind } from '../data-transfer/package-plan'\nimport {\n buildTransferPlan,\n type BuildTransferPlanInput,\n type PlannedTransferRow,\n type TransferPlan,\n} from '../data-transfer/plan'\nimport {\n transferPolicyDefaultsFor,\n type TransferLockedRule,\n type TransferPolicyDefaults,\n type TransferValuesComparator,\n} from '../data-transfer/policy'\nimport type {\n TransferChunk,\n TransferRowResult,\n TransferUndoEntry,\n TransferUndoSnapshot,\n TransferUndoStep,\n} from '../data-transfer/job'\nimport {\n parseTransferResourceKey,\n transferFieldProblems,\n transferResourceProblems,\n type TransferField,\n type TransferKind,\n type TransferResourceDescriptor,\n} from '../data-transfer/resource'\nimport { TRANSFER_PLAN_REQUIRED, type TransferPlanRequiredResponse } from '../data-transfer/transfer-api'\nimport type { AglynOrgBilling, OrgFeatureFlags } from '../foundation'\nimport type { MdiIconProps } from '../types/nodes'\nimport {\n filterPluginsByReleaseFlags,\n resolveEnabledPlugins,\n resolveHostEnabledPlugins,\n} from './enabled-plugins'\nimport { PLUGIN_TRANSFER_RESOURCES_DECLARED } from './first-party-plugins.generated'\nimport { runPluginDeclarationsRepair } from './plugin-declarations-repair'\n\n/**\n * WHAT A PLUGIN CAN IMPORT AND EXPORT (AGL-3523), the extension point every\n * import wizard, export dialog and transfer job reads.\n *\n * The core in `data-transfer/` knows how a column is matched to a field, how\n * a cell is read, how a row finds its record and what a policy does to it —\n * for no resource in particular. This module is where a resource joins it.\n * The plugin that owns the records declares the resource and answers for it;\n * the job engine and the UI kit ask here and never name a plugin.\n *\n * ## Declared, then registered — and an absent resource is refused\n *\n * The plugin declares the resource in `plugins.config.json`\n * (`transferResources`: a `TransferResourceDescriptor` — key, label, scope,\n * kinds, formats, limits), which the generator compiles. It registers two\n * halves:\n *\n * - the SERVER half, {@link registerPluginTransferResource}, from its\n * `serverDeclarations` or `consoleServerDeclarations` entry: the field\n * catalog, the match keys, the reads, the planned writes and their undo;\n * - the CLIENT half, {@link registerPluginTransferResourceUi}, from its\n * console registrar: how the hub and the wizard show it, and any wizard\n * steps of its own. The registrar loads at\n * {@link TRANSFER_RESOURCES_LOAD_POINT}, which the plugin declares among its\n * `console.slots`.\n *\n * A resource declared with `instances` (one dataset's records, not every\n * dataset's) is reached by a key naming the instance, `<key>:<instance>`:\n * {@link resolveTransferResource} answers the declaration under that whole\n * key, so the job, the person's remembered choices and the one running\n * import are each kept per instance, and the hooks read which instance from\n * `ctx.resource` (`transferResourceInstanceOf`).\n *\n * A resource on the hub that fails at Apply is worse than one that is not on\n * the hub at all, so a declared resource with no server half is never read\n * as \"nothing to move\": {@link resolveTransferResource} runs the app's\n * declarations step once and throws if it is still missing.\n *\n * ## The plugin writes through its own paths\n *\n * `apply` and `revert` are the plugin's, not a generic writer's: plan bands,\n * consent rules, derived fields and activity entries live on the plugin's\n * write paths, and a transfer that went around them would be a way past\n * every one. The engine owns the job — chunks, the ledger, the time budget —\n * and hands the plugin a {@link TransferApplyWriter} that records each row\n * the moment its write lands, so a retried chunk never writes a row twice.\n *\n * Reached by its own subpath, never the barrel: its readers are the transfer\n * routes, the UI kit, and the plugins that answer them.\n */\n\n/*==========================================\n * DECLARATIONS\n *=========================================*/\n\n/** A declaration with the plugin that made it, as the generator compiles it. */\nexport type ResolvedTransferResourceDeclaration = TransferResourceDescriptor & {\n pluginId: string\n}\n\n/**\n * The load point a plugin with a transfer resource declares in its\n * `console.slots`, so the hub and the wizard load its console registrar and\n * with it the client half.\n */\nexport const TRANSFER_RESOURCES_LOAD_POINT = 'transferResources'\n\n/** Every declared resource, in config order — the order the hub lists them. */\nexport function listDeclaredTransferResources(): readonly ResolvedTransferResourceDeclaration[] {\n return PLUGIN_TRANSFER_RESOURCES_DECLARED\n}\n\n/** The declared resource with this key, or `null`. */\nexport function declaredTransferResource(key: string): ResolvedTransferResourceDeclaration | null {\n const name = key.trim()\n return listDeclaredTransferResources().find((one) => one.key === name) ?? null\n}\n\n/** Whose resources are being listed: a workspace, or one of its sites. */\nexport type TransferResourceSubject = (\n | { scope: 'org'; org: { enabledPlugins?: string[] } | null | undefined }\n | {\n scope: 'host'\n org: { enabledPlugins?: string[] } | null | undefined\n host: { disabledPlugins?: string[]; enabledPlugins?: string[] } | null | undefined\n }\n) & {\n /**\n * The release-flag verdict for the subject, when the caller has one: a\n * plugin whose flag is off for them offers nothing to move.\n */\n isFlagOn?: (flagKey: string) => boolean\n /** Staff preview keeps a dark plugin's resources listed. */\n staffBypass?: boolean\n}\n\n/**\n * The declared resources of `subject.scope` whose plugin runs for the\n * subject — the workspace's enabled set for `org`, the site's for `host` —\n * in config order. A resource of a plugin switched off is not offered, the\n * same rule every other surface of that plugin follows.\n */\nexport function listTransferResourcesFor(\n subject: TransferResourceSubject,\n): ResolvedTransferResourceDeclaration[] {\n const enabled =\n subject.scope === 'host'\n ? resolveHostEnabledPlugins(subject.org, subject.host)\n : resolveEnabledPlugins(subject.org)\n const running = new Set(\n subject.isFlagOn\n ? filterPluginsByReleaseFlags(enabled, subject.isFlagOn, { staffBypass: subject.staffBypass })\n : enabled,\n )\n return listDeclaredTransferResources().filter(\n (one) => one.scope === subject.scope && running.has(one.pluginId),\n )\n}\n\n/*==========================================\n * THE SERVER HALF\n *=========================================*/\n\n/** Who is moving what, handed to every server hook. */\nexport interface TransferResourceContext {\n /** The resource key. */\n resource: string\n orgId: string\n /** The site, for a `host` resource; `null` for an `org` one. */\n hostId: string | null\n /** The member moving the data, for the plugin's own checks and audit lines. */\n actorUid: string | null\n /** The job, once one exists; absent for a catalog read or an export page. */\n jobId?: string\n /**\n * The answers of the plugin's own wizard steps, by step id: during the\n * dry run those sent with it, afterwards those the plan was made with.\n * What the person said in the browser — a hook checks every value it\n * reads and enforces what it means; it never trusts one to name who said it.\n */\n extras?: Readonly<Record<string, unknown>>\n /** The uploaded file's column names, once a job holds one. */\n headers?: readonly string[]\n /**\n * For a catalog read (`fields`) only: the list filter the export dialog was\n * opened on, in the plugin's own terms. A resource whose columns depend on\n * which records are read — one form's questions — answers for these;\n * every other read ignores it.\n */\n filter?: Readonly<Record<string, unknown>>\n}\n\n/** Which records an export page reads. */\nexport interface TransferReadOptions {\n /** The most rows one page answers; the plugin may answer fewer. */\n pageSize?: number\n /** Only these records (\"the selection\"). */\n ids?: readonly string[]\n /** The list's own filter, in the plugin's own terms (\"the current filter\"). */\n filter?: Readonly<Record<string, unknown>>\n /**\n * A collaborator scoped to some sites: read only records whose `visibleTo`\n * holds one of these tokens (`memberScopeTokens`). Absent for a reader who\n * sees the whole workspace. The export route reads through the Admin SDK,\n * so this IS the enforcement.\n */\n scopeTokens?: readonly string[]\n}\n\n/** One page of an export: rows keyed by field id, and where the next page starts. */\nexport interface TransferReadPage {\n rows: Array<Record<string, unknown>>\n /** `null` when this was the last page. */\n next: string | null\n}\n\n/** One picklist as the organization holds it: the platform's spec and the effective values. */\nexport interface TransferPicklistList {\n spec: PicklistSpec\n set: PicklistValueSet\n}\n\n/** What a lookup found: the match map, and each found record's current values. */\nexport interface TransferLookupResult {\n lookup: MatchLookup\n /** Record id → its current values by field id, for the plan's before → after. */\n records: ReadonlyMap<string, Readonly<Record<string, unknown>>>\n}\n\n/** What a lookup column's unresolved values are matched against for suggestions. */\nexport interface TransferLookupSuggestRequest {\n /** The target's field ids the column names records by (`TransferLookupTarget.by`). */\n by: readonly string[]\n /** The values that named no record, as the file spelled them. */\n values: readonly string[]\n}\n\n/**\n * How a lookup column's values are resolved to records (AGL-3541): the\n * target resource's own hooks, or the {@link TransferRecordsHooks.lookupTargets}\n * entry of a resource that answers a target no resource moves.\n */\nexport interface TransferLookupTargetHooks {\n /**\n * The target's keys, for the normalizer a `by` field compares with; a\n * `by` field no key names compares caseless.\n */\n matchKeys?: readonly MatchKeySpec[]\n /** The records holding each requested value — the target's `lookup`, asked by id and by each `by` field. */\n lookup(ctx: TransferResourceContext, requests: readonly MatchLookupRequest[]): Promise<TransferLookupResult>\n /**\n * Records named LIKE each value, for the person to pick from, by value as\n * given; best first. The engine shows at most five. Without it, a value\n * that named several records still offers those.\n */\n suggest?(\n ctx: TransferResourceContext,\n request: TransferLookupSuggestRequest,\n ): Promise<Readonly<Record<string, readonly TransferLookupSuggestion[]>>>\n}\n\n/**\n * A rule a row must keep that a field policy cannot say — a value that only\n * moves one way, two fields that must agree. Checked against each planned\n * row before the dry run is shown, so a row that breaks it is reported, not\n * discovered at Apply.\n */\nexport interface TransferInvariant {\n id: string\n /** What the rule is, in a sentence the person reads. */\n label: string\n /** Why this row breaks the rule, or `null` when it keeps it. */\n check(\n row: PlannedTransferRow,\n before: Readonly<Record<string, unknown>> | null,\n ): string | null\n}\n\n/**\n * The engine's ledger, handed to `apply` and `writeItems`. Rows are numbered\n * the way the plan numbers them; a package's items by their manifest index.\n */\nexport interface TransferApplyWriter {\n /** The result an earlier attempt recorded for this row, or `null` — a row with one is not written again. */\n alreadyApplied(row: number): Promise<TransferRowResult | null>\n /** Records a row's result and its undo entry the moment its write lands. */\n markApplied(result: TransferRowResult, undo?: TransferUndoEntry): Promise<void>\n /** Milliseconds left in the chunk's budget; stop at a row boundary when it runs short. */\n timeLeftMs(): number\n}\n\n/** What one chunk's writes came to. */\nexport interface TransferApplyResult {\n /** One per row handled, the rows already applied included. */\n results: TransferRowResult[]\n /** What undo needs, for every row written. */\n undo: TransferUndoEntry[]\n}\n\n/** The person's answer for each undo conflict, by record id. */\nexport type TransferRevertDecisions = Readonly<Record<string, 'revert' | 'keep'>>\n\n/** What a revert did, and what it left for the person. */\nexport interface TransferRevertResult {\n /** The steps carried out. */\n done: TransferUndoStep[]\n /** The records edited since the import, waiting on a decision. */\n conflicts: TransferUndoStep[]\n}\n\n/**\n * The match keys one context offers — a dataset's own fields, say — and the\n * ones a person starts with (every key, in order, when absent).\n */\nexport interface TransferMatchKeyOffer {\n keys: readonly MatchKeySpec[]\n defaults?: readonly string[]\n}\n\n/** What a resource's own matching is handed: the rows, and what the core made of them. */\nexport interface TransferMatchInput {\n /** Each row's values by field id, in file order. */\n rows: ReadonlyArray<Readonly<Record<string, unknown>>>\n /** The keys the person chose, in priority order. */\n keys: readonly MatchKeySpec[]\n /** What the resource's `lookup` answered for those keys. */\n lookup: MatchLookup\n /** The records `lookup` read, by id. */\n records: ReadonlyMap<string, Readonly<Record<string, unknown>>>\n /** The core's outcome for each row (`matchRows`), to keep or replace. */\n outcomes: readonly RowMatchOutcome[]\n}\n\n/** A resource's own match outcomes, and any record they name that `lookup` did not read. */\nexport interface TransferMatchAnswer {\n /** One per row, in file order. */\n outcomes: RowMatchOutcome[]\n /** Records the outcomes name beyond `input.records`, by id — for the review's before and the plan's. */\n records?: ReadonlyMap<string, Readonly<Record<string, unknown>>>\n}\n\n/** The hooks a `records` resource answers with. */\nexport interface TransferRecordsHooks {\n /** The field catalog: standard, custom, derived and system fields, and their groups. */\n fields(ctx: TransferResourceContext): Promise<TransferCatalogInput> | TransferCatalogInput\n /**\n * The keys a row finds its record by, in priority order — fixed, or read\n * for the context when they depend on it (an instance's own fields), with\n * the ones a person starts with. Read through {@link transferResourceMatchKeys}.\n */\n matchKeys:\n | readonly MatchKeySpec[]\n | ((ctx: TransferResourceContext) => Promise<TransferMatchKeyOffer> | TransferMatchKeyOffer)\n /** Other products' header spellings for these fields. */\n aliases?: readonly TransferAliasDictionary[]\n /**\n * Presets of the resource's own, listed after the built-in ones — another\n * product's layout, with that product's column names (`headers`).\n */\n presets?: readonly TransferResourcePreset[]\n /**\n * How many records an export with these options reads, before its first\n * page, so the file carries its row count and the download can be checked\n * whole. Without it the route counts by reading ahead, and a file larger\n * than that is sent without a count.\n */\n count?(ctx: TransferResourceContext, options: TransferReadOptions): Promise<number>\n /** One page of an export, holding only `fieldIds`. `cursor` is `null` for the first page. */\n readPage(\n ctx: TransferResourceContext,\n cursor: string | null,\n fieldIds: readonly string[],\n options?: TransferReadOptions,\n ): Promise<TransferReadPage>\n /**\n * The records holding each requested key value. Undo also asks it for\n * records by id — `TRANSFER_ID_FIELD` with the `aglynId` normalizer — to\n * read what each record holds now, so it answers that key whether or not\n * `matchKeys` names it.\n */\n lookup(\n ctx: TransferResourceContext,\n requests: readonly MatchLookupRequest[],\n ): Promise<TransferLookupResult>\n /** Records named like a lookup column's unresolved values; see {@link TransferLookupTargetHooks.suggest}. */\n suggest?: TransferLookupTargetHooks['suggest']\n /**\n * Lookup targets this resource answers itself, by the key its fields name\n * in `TransferLookupTarget.resource` — records no transfer resource moves,\n * like the workspace's members an owner column names. A target not listed\n * here is a declared resource, resolved through its own hooks.\n */\n lookupTargets?: Readonly<Record<string, TransferLookupTargetHooks>>\n /**\n * The organization's effective list for each picklist the catalog names\n * (`TransferField.picklistId`), by picklist id. Without it a picklist\n * column is imported as typed, and the values step has nothing to match.\n */\n picklists?(\n ctx: TransferResourceContext,\n picklistIds: readonly string[],\n ): Promise<Readonly<Record<string, TransferPicklistList>>>\n /**\n * Adds the values the person chose to add to a picklist, before the\n * import's first write. Called again with the same values if that write\n * is retried, so an id the list already holds is left as it is.\n */\n addPicklistValues?(\n ctx: TransferResourceContext,\n picklistId: string,\n values: readonly PicklistValue[],\n ): Promise<void>\n /**\n * Where the person starts on the Conflicts step (AGL-3548) — fixed, or read\n * for the context. Without it the core's: update what matches, create what\n * does not, ask about the rest; fill blanks and leave on blank. A resource\n * whose file is the definition of its records (a redirect's destination)\n * starts from overwrite. The person can change every part; the dry run\n * fills what a request leaves out from here.\n */\n defaultPolicy?:\n | TransferPolicyDefaults\n | ((ctx: TransferResourceContext) => Promise<TransferPolicyDefaults> | TransferPolicyDefaults)\n /**\n * Which record each row is about, when the core's key-by-key matching is\n * not how the resource tells its records apart (AGL-3548) — a redirect is\n * one rule per mode at a from-path, so `/blog` names the exact rule or the\n * prefix rule by the row's mode. The engine runs it after `matchRows` for\n * the Matching step, the Conflicts step and the dry run alike, so all\n * three show the outcome the write will act on; `plan` receives these\n * outcomes as `input.matches`.\n */\n match?(ctx: TransferResourceContext, input: TransferMatchInput): Promise<TransferMatchAnswer> | TransferMatchAnswer\n /**\n * Whether two values of a field are the same value as the resource stores\n * it (AGL-3548) — a status kept in lower case, a path kept normalized —\n * or `undefined` to leave it to the core. Used by the Conflicts step and\n * the dry run, so a value the write would fold is no conflict and no change.\n */\n valuesEqual?: TransferValuesComparator\n /** The plan, when the core's `buildTransferPlan` is not enough. */\n plan?(\n ctx: TransferResourceContext,\n input: BuildTransferPlanInput,\n ): Promise<TransferPlan> | TransferPlan\n /** The plugin's locked rules, shown locked in the wizard with their reasons. */\n lockedRules?(\n ctx: TransferResourceContext,\n ): Promise<readonly TransferLockedRule[]> | readonly TransferLockedRule[]\n /** Rules each planned row must keep. */\n invariants?: readonly TransferInvariant[]\n /**\n * Writes one chunk's planned rows through the plugin's own write paths.\n * A `lookup` field's value is the resolved record's id, or — when the\n * person chose to create it — `transferLookupNewValue(name)`: the plugin\n * creates that record on its own path, once however many rows name it\n * (and finds the one an earlier attempt created, when a chunk is retried).\n *\n * Nothing in this module or the job engine writes a record: `'records'`\n * here is a transfer kind, and a row's `values` are planned values. So\n * whatever a record write must derive is derived on the plugin's own path\n * — for a dataset record, the data plugin's `datasetIntegrityFields` /\n * `datasetIntegrityUpdate` (`referencedIds`, `filterKeys`,\n * `filterValues`), which its `apply` and `revert` must call like every\n * other writer of `records`.\n */\n apply(\n ctx: TransferResourceContext,\n chunk: TransferChunk<PlannedTransferRow>,\n writer: TransferApplyWriter,\n ): Promise<TransferApplyResult>\n /**\n * Reverses one chunk's writes, deciding each entry with the core's\n * `planTransferUndo` against the record as it is now. A conflict is\n * carried out only when `decisions` says `revert`.\n */\n revert(\n ctx: TransferResourceContext,\n snapshot: TransferUndoSnapshot,\n decisions?: TransferRevertDecisions,\n ): Promise<TransferRevertResult>\n}\n\n/** One item as the plugin reads it for a package: its manifest identity and its content. */\nexport interface TransferPackageItemContent<T = unknown> {\n kind: string\n id: string\n slug?: string\n name?: string\n content: T\n}\n\n/** One item a package import writes, with what the person decided for it. */\nexport interface TransferPackageItemWrite<T = unknown> {\n /** Its index in the manifest — the row the ledger and the results name. */\n row: number\n item: PackageManifestItem\n decision: PackageItemDecision\n /** The id it is written under: its own, the matched item's for a replace, a new one when kept beside an existing item. */\n targetId: string\n /** A kept-both copy's new name and slug, which the write must use in place of the content's. */\n rename?: { name?: string; slug?: string }\n /** The content, references already rewritten by `remapIds`. */\n content: T\n}\n\n/** One step of undoing a package import, decided by the engine. */\nexport type TransferPackageRevertStep<T = unknown> =\n /** The import created it and it is untouched since: delete it. */\n | { action: 'delete'; id: string }\n /** The import replaced it: put back what it held. */\n | { action: 'restore'; id: string; content: T }\n\n/** What a package revert did: the ids it reverted, and the ones its own rules refused, with why. */\nexport interface TransferPackageRevertResult {\n done: string[]\n refused: Array<{ id: string; reason: string }>\n}\n\n/** A plugin's rule an import cannot change, shown with its reason (an imported sequence is a draft). */\nexport interface TransferPackageRule {\n id: string\n label: string\n reason: string\n}\n\n/**\n * The hooks a `package` resource answers with (AGL-3535). An item's kind is\n * the resource key, so a package that carries several resources' items is\n * read, written and undone by each owner.\n *\n * Matching compares content hashes: `items` hashes the same content\n * `readItems` exports (`existingPackageItemsOf`), so an item exported and\n * imported unchanged is `identical`. The engine plans, takes the undo\n * snapshot (each replaced item's content through `readItems`, before the\n * write), keeps the ledger and decides undo; the plugin reads, writes and\n * reverts through its own paths.\n */\nexport interface TransferPackageHooks<T = unknown> {\n /** What the workspace holds now, for matching incoming items: kind, id, name or slug, and the content hash. */\n items(ctx: TransferResourceContext): Promise<ExistingPackageItem[]>\n /** What one item names — other package items, and things of other kinds (`site`, a mailbox) the item needs. */\n dependencies(item: T): PackageDependency[]\n /**\n * The item with its references rewritten: `idMap` maps an item key\n * (`<kind>/<id>`, `packageItemKey`) to the id it now has, `''` for a\n * reference the person dropped (`remapPackageReference`).\n */\n remapIds(item: T, idMap: ReadonlyMap<string, string>): T\n /** The content of these items, for an export and for the undo snapshot. */\n readItems(\n ctx: TransferResourceContext,\n ids: readonly string[],\n ): Promise<Array<TransferPackageItemContent<T>>>\n /**\n * Writes the decided items through the plugin's own write paths, marking\n * each with `writer.markApplied` the moment it lands, with the\n * `targetId` as its `recordId`. Undo entries are the engine's: answer\n * `undo: []`.\n */\n writeItems(\n ctx: TransferResourceContext,\n items: ReadonlyArray<TransferPackageItemWrite<T>>,\n writer: TransferApplyWriter,\n ): Promise<TransferApplyResult>\n /** Carries out the undo steps the engine decided, through the plugin's own paths. */\n revertItems(\n ctx: TransferResourceContext,\n steps: ReadonlyArray<TransferPackageRevertStep<T>>,\n ): Promise<TransferPackageRevertResult>\n /**\n * What the plugin's own write would refuse about this item, each a\n * sentence — checked at the dry run, so a refusal is shown before Apply\n * rather than discovered by it.\n */\n problems?(\n ctx: TransferResourceContext,\n write: TransferPackageItemWrite<T>,\n ): Promise<readonly string[]> | readonly string[]\n /**\n * What the workspace holds of the kinds the items name that no package\n * resource owns (a mailbox, an email list), so a reference to one is\n * known to resolve and one that does not can be mapped. `site` is the\n * engine's own.\n */\n referenceTargets?(\n ctx: TransferResourceContext,\n kinds: readonly string[],\n ): Promise<TransferReferenceKind[]>\n /** The rules an import of this resource cannot change, shown with their reasons. */\n rules?: readonly TransferPackageRule[]\n}\n\n/**\n * A resource's server half. A `records` kind answers every required\n * {@link TransferRecordsHooks} member; a `package` kind every required\n * {@link TransferPackageHooks} member — checked against the declaration at\n * registration.\n */\nexport type PluginTransferResource = Partial<TransferRecordsHooks> &\n Partial<TransferPackageHooks> &\n TransferPlanGateHooks\n\n/*==========================================\n * THE PLAN (AGL-3555)\n *\n * A resource that declares a `featureFlag` is moved only by a workspace\n * whose plan carries it, for every intent but the ones `featureFlagExempt`\n * lists (`data-transfer/access.ts`). The declaration decides WHICH intents\n * ask — so the console's `can` answers the same rule without a request —\n * and the route asks {@link transferPlanRefusal} after the member is\n * admitted, staff included. A resource whose plugin answers the same plan\n * question on its own routes registers {@link TransferPlanGateHooks.planGate}\n * so a transfer refuses in exactly that plugin's words; one that does not\n * gets {@link transferPlanRequired}, from the plan tables.\n *=========================================*/\n\n/** The workspace a plan question is asked about, as the gate read it. */\nexport interface TransferPlanSubject {\n /** The resource key, naming the instance for one declared with `instances`. */\n resource: string\n orgId: string\n hostId: string | null\n /** The workspace document: its plan, subscription and per-org grants. */\n org: Readonly<Record<string, unknown>>\n}\n\n/** A refusal for the workspace's plan: 403, in the flat body every plan-gated console route answers. */\nexport interface TransferPlanRefusal {\n status: 403\n body: TransferPlanRequiredResponse\n}\n\n/** The plan hook a resource may answer with, beside its kind's. */\nexport interface TransferPlanGateHooks {\n /**\n * The refusal for a workspace whose plan does not carry the resource's\n * `featureFlag`, or `null` when it does — the plugin's own answer, so a\n * transfer refuses in the words of the plugin's other routes. Asked only\n * for an intent the declaration gates, and only after the member is\n * admitted. It reads `subject.org`, never the database; it may load the\n * module that answers with its first call.\n */\n planGate?(\n subject: TransferPlanSubject,\n intent: TransferAccessIntent,\n ): Promise<TransferPlanRefusal | null> | TransferPlanRefusal | null\n}\n\n/** \"Companies\" → \"companies\", \"CRM fields\" unchanged: the label inside a sentence. */\nfunction inSentence(label: string): string {\n return /^[A-Z][a-z]/.test(label) ? label.charAt(0).toLowerCase() + label.slice(1) : label\n}\n\n/**\n * The refusal a resource with no `planGate` gets: its plan feature as\n * `code`, and a sentence naming the plan that includes it, from the same\n * ladder the console's upgrade notices walk. A feature no plan carries — an\n * add-on, the Event Calendar — is never offered as an upgrade: it is named\n * as the add-on it is, the shell's own `blockedExtensionNotice` wording.\n */\nexport function transferPlanRequired(\n feature: string,\n label: string,\n intent: TransferAccessIntent,\n): TransferPlanRefusal {\n const plan = planLabelGrantingFeature(feature as keyof OrgFeatureFlags)\n const act = `${intent === 'export' ? 'Exporting' : 'Importing'} ${inSentence(label)}`\n return {\n status: 403,\n body: {\n error: plan\n ? `${act} is not included in your current plan. Manage your plan and add-ons from Billing. Included from ${plan}.`\n : `${act} isn't included in any plan — it's a paid add-on. Manage your plan and add-ons from Billing.`,\n reason: TRANSFER_PLAN_REQUIRED,\n code: feature,\n },\n }\n}\n\n/**\n * The refusal for moving `subject.resource` with `intent` on the\n * workspace's plan, or `null` when the plan may: no `featureFlag`, an\n * exempt intent, or a plan that carries it. A key no plugin declares is\n * `null` here — the route answers it as it answers any unknown resource.\n */\nexport async function transferPlanRefusal(\n subject: TransferPlanSubject,\n intent: TransferAccessIntent,\n): Promise<TransferPlanRefusal | null> {\n const declared = declaredTransferResource(parseTransferResourceKey(String(subject.resource ?? '')).key)\n const feature = transferPlanFeature(intent, declared)\n if (!declared || !feature) return null\n let gate: TransferPlanGateHooks['planGate']\n try {\n gate = (await resolveTransferResource(subject.resource)).impl.planGate\n } catch {\n // A server half that cannot be reached is answered by the route that\n // needs it; the plan is still asked, from the declaration.\n gate = undefined\n }\n if (gate) return gate(subject, intent)\n return checkEntitlement(subject.org as Partial<AglynOrgBilling>, feature)\n ? null\n : transferPlanRequired(feature, declared.label, intent)\n}\n\nconst RECORDS_HOOKS = ['fields', 'matchKeys', 'readPage', 'lookup'] as const\n/** What only an importable records resource answers: its writes and their undo. */\nconst IMPORT_HOOKS = ['apply', 'revert'] as const\nconst PACKAGE_HOOKS = ['items', 'dependencies', 'remapIds', 'readItems', 'writeItems', 'revertItems'] as const\n\n/** What is missing from `impl` for the kinds a resource declares, as sentences. */\nexport function pluginTransferResourceProblems(\n declared: Pick<TransferResourceDescriptor, 'key' | 'kinds' | 'exportOnly' | 'featureFlag'>,\n impl: PluginTransferResource,\n): string[] {\n const problems: string[] = []\n const need = (kind: TransferKind, hooks: readonly string[]) => {\n if (!declared.kinds.includes(kind)) return\n for (const hook of hooks) {\n if ((impl as Record<string, unknown>)[hook] === undefined) {\n problems.push(`${declared.key} declares ${kind} and registers no \"${hook}\".`)\n }\n }\n }\n need('records', RECORDS_HOOKS)\n if (declared.exportOnly !== true) need('records', IMPORT_HOOKS)\n need('package', PACKAGE_HOOKS)\n if (impl.planGate !== undefined && !declared.featureFlag) {\n problems.push(`${declared.key} registers a \"planGate\" and declares no \"featureFlag\", so nothing would ask it.`)\n }\n if (Array.isArray(impl.matchKeys) && !impl.matchKeys.length && declared.kinds.includes('records')) {\n problems.push(`${declared.key} names no match key, so no row could find its record.`)\n }\n const presetIds = new Set<string>()\n for (const preset of impl.presets ?? []) {\n if ((TRANSFER_PRESET_IDS as readonly string[]).includes(preset.id) || presetIds.has(preset.id)) {\n problems.push(`${declared.key} lists preset \"${preset.id}\" twice, or under a built-in preset's id.`)\n }\n presetIds.add(preset.id)\n if (!preset.label?.trim() || !preset.fieldIds?.length) {\n problems.push(`${declared.key} lists preset \"${preset.id}\" with no label or no fields.`)\n }\n }\n return problems\n}\n\ninterface Registered {\n pluginId: string\n impl: PluginTransferResource\n}\n\n/**\n * One table per process, on `globalThis` (AGL-3412): a plugin registers from\n * its declarations at boot, which Next compiles apart from the routes that\n * read, and a module-scoped map would be filled in one copy and read empty in\n * the other.\n */\nconst RESOURCES_KEY = Symbol.for('@aglyn/aglyn:transfer-resources')\nconst UIS_KEY = Symbol.for('@aglyn/aglyn:transfer-resource-uis')\n\nconst globalScope = globalThis as typeof globalThis & {\n [RESOURCES_KEY]?: Map<string, Registered>\n [UIS_KEY]?: Map<string, RegisteredUi>\n}\n\nconst resources: Map<string, Registered> =\n globalScope[RESOURCES_KEY] ?? (globalScope[RESOURCES_KEY] = new Map())\n\n/** The owner a registration is filed under, and the declaration it must match. */\nfunction claim(\n what: string,\n key: string,\n options: { pluginId?: string } | undefined,\n): ResolvedTransferResourceDeclaration {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n `${what} \"${key}\" registered with no owner: pass { pluginId } ` +\n 'when registering outside a plugin register fn',\n )\n }\n const declared = declaredTransferResource(key)\n if (!declared) {\n throw new Error(\n `${what} \"${key}\" is not declared in plugins.config.json ` +\n '(transferResources), so no wizard or job would ever offer it',\n )\n }\n if (declared.pluginId !== pluginId) {\n throw new Error(`${what} \"${key}\" is declared by \"${declared.pluginId}\"; refused \"${pluginId}\"`)\n }\n return declared\n}\n\n/**\n * Registers the server half of a resource the plugin declared. The owner is\n * the plugin whose register fn is running, or the `pluginId` passed from a\n * boot declaration. Refused, naming why: no owner, a key nobody declared, a\n * key another plugin declared, a declaration the core's\n * `transferResourceProblems` rejects, and hooks missing for a declared kind.\n * The same plugin registering again replaces its answers.\n */\nexport function registerPluginTransferResource(\n key: string,\n impl: PluginTransferResource,\n options?: { pluginId?: string },\n): void {\n const name = key.trim()\n const declared = claim('transfer resource', name, options)\n const problems = [\n ...transferResourceProblems(declared),\n ...pluginTransferResourceProblems(declared, impl),\n ]\n if (problems.length) {\n throw new Error(`transfer resource \"${name}\" refused: ${problems.join(' ')}`)\n }\n resources.set(name, { pluginId: declared.pluginId, impl })\n}\n\n/**\n * A declared resource with the server half its plugin registered. For a\n * resource declared with `instances`, `key` is the whole key asked for\n * (`data.dataset:abc123`) and `instance` the instance it names.\n */\nexport type ResolvedTransferResource = ResolvedTransferResourceDeclaration & {\n impl: PluginTransferResource\n instance?: string | null\n}\n\n/** Why a resource could not be resolved: nobody declared the key, or nobody registered it. */\nexport class TransferResourceUnavailableError extends Error {\n constructor(\n readonly key: string,\n readonly reason: 'undeclared' | 'unregistered',\n message: string,\n ) {\n super(message)\n this.name = 'TransferResourceUnavailableError'\n }\n}\n\nasync function ensureRegistered(\n declared: readonly ResolvedTransferResourceDeclaration[],\n): Promise<void> {\n const missing = () => declared.filter((one) => !resources.has(one.key))\n if (missing().length) await runPluginDeclarationsRepair()\n const absent = missing()\n if (absent.length) {\n const names = absent.map((one) => `\"${one.key}\" (${one.pluginId})`).join(', ')\n throw new TransferResourceUnavailableError(\n absent[0].key,\n 'unregistered',\n `[plugins] transfer resource(s) ${names} declared and not registered in this process`,\n )\n }\n}\n\n/**\n * The resource with this key and its server half. Throws\n * {@link TransferResourceUnavailableError}: `undeclared` for a key no plugin\n * declares — and for a key that names an instance of a resource declared\n * without `instances`, or none of one declared with them — (a route answers\n * 404), and `unregistered` for one declared and still missing after the\n * app's declarations step ran once (a route answers 500 — a boot that\n * dropped a registration, never \"nothing to move\").\n */\nexport async function resolveTransferResource(key: string): Promise<ResolvedTransferResource> {\n const asked = String(key ?? '').trim()\n const { key: base, instance } = parseTransferResourceKey(asked)\n const declared = declaredTransferResource(base)\n if (!declared || Boolean(declared.instances) !== (instance !== null)) {\n throw new TransferResourceUnavailableError(\n asked,\n 'undeclared',\n declared\n ? declared.instances\n ? `transfer resource \"${declared.key}\" is moved one instance at a time; name it as \"${declared.key}:<instance>\"`\n : `transfer resource \"${declared.key}\" has no instances; \"${asked}\" names one`\n : `no plugin declares a transfer resource \"${asked}\"`,\n )\n }\n await ensureRegistered([declared])\n const impl = (resources.get(declared.key) as Registered).impl\n return instance === null ? { ...declared, impl } : { ...declared, key: asked, instance, impl }\n}\n\n/**\n * Every declared resource with its server half, in config order. Throws\n * naming each one declared and not registered, after the declarations step\n * ran once.\n */\nexport async function resolveTransferResources(): Promise<ResolvedTransferResource[]> {\n const declared = listDeclaredTransferResources()\n await ensureRegistered(declared)\n return declared.map((one) => ({ ...one, impl: (resources.get(one.key) as Registered).impl }))\n}\n\n/** The records hooks of a resolved resource; throws for one that does not declare `records`. */\nexport function transferRecordsHooks(resource: ResolvedTransferResource): TransferRecordsHooks {\n if (!resource.kinds.includes('records')) {\n throw new Error(`transfer resource \"${resource.key}\" does not move records`)\n }\n return resource.impl as TransferRecordsHooks\n}\n\n/** The package hooks of a resolved resource; throws for one that does not declare `package`. */\nexport function transferPackageHooks(resource: ResolvedTransferResource): TransferPackageHooks {\n if (!resource.kinds.includes('package')) {\n throw new Error(`transfer resource \"${resource.key}\" does not move a package`)\n }\n return resource.impl as TransferPackageHooks\n}\n\n/**\n * The resource's field catalog, built by the core. Throws naming every\n * problem `transferFieldProblems` finds: a catalog the wizard cannot trust\n * is refused before a person maps a column to it.\n */\nexport async function transferResourceCatalog(\n resource: ResolvedTransferResource,\n ctx: TransferResourceContext,\n): Promise<TransferFieldCatalog> {\n const catalog = buildTransferFieldCatalog(await transferRecordsHooks(resource).fields(ctx))\n const problems = transferFieldProblems(catalog.fields)\n if (problems.length) {\n throw new Error(`transfer resource \"${resource.key}\" has a bad field catalog: ${problems.join(' ')}`)\n }\n return catalog\n}\n\n/**\n * The match keys a resource offers in this context and the ones a person\n * starts with: its fixed list (every key a default), or what its\n * `matchKeys(ctx)` answers. Throws for a context that offers no key, which no\n * row could be matched by.\n */\nexport async function transferResourceMatchKeys(\n resource: ResolvedTransferResource,\n ctx: TransferResourceContext,\n): Promise<{ keys: MatchKeySpec[]; defaults: string[] }> {\n const declared = transferRecordsHooks(resource).matchKeys\n const offer: TransferMatchKeyOffer = typeof declared === 'function' ? await declared(ctx) : { keys: declared }\n const keys = [...offer.keys]\n if (!keys.length) throw new Error(`transfer resource \"${resource.key}\" offers no match key, so no row could find its record`)\n const known = new Set(keys.map((key) => key.fieldId))\n const defaults = (offer.defaults ?? keys.map((key) => key.fieldId)).filter((fieldId) => known.has(fieldId))\n return { keys, defaults }\n}\n\n/**\n * The plan for one chunk: the resource's own `plan`, or the core's\n * `buildTransferPlan` — handed the resource's comparator when the input\n * carries none.\n */\nexport async function planTransferResourceRows(\n resource: ResolvedTransferResource,\n ctx: TransferResourceContext,\n input: BuildTransferPlanInput,\n): Promise<TransferPlan> {\n const hooks = transferRecordsHooks(resource)\n const compared = !input.valuesEqual && hooks.valuesEqual ? { ...input, valuesEqual: hooks.valuesEqual } : input\n return hooks.plan ? hooks.plan(ctx, compared) : buildTransferPlan(compared)\n}\n\n/**\n * The resource's starting policy for this context, kept to what holds for\n * `fields` (`transferPolicyDefaultsFor`); `{}` for a resource that starts\n * from the core's defaults.\n */\nexport async function transferResourcePolicyDefaults(\n resource: ResolvedTransferResource,\n ctx: TransferResourceContext,\n fields: readonly TransferField[],\n): Promise<TransferPolicyDefaults> {\n const declared = transferRecordsHooks(resource).defaultPolicy\n const defaults = typeof declared === 'function' ? await declared(ctx) : declared\n return transferPolicyDefaultsFor(defaults, fields)\n}\n\n/**\n * Each row's match outcome: the core's `matchRows`, then the resource's own\n * `match` over it when it has one. `records` holds what `lookup` read and\n * whatever the resource's matching added. An answer that is not one outcome\n * per row is refused — a short list would shift every row's verdict.\n */\nexport async function matchTransferResourceRows(\n resource: ResolvedTransferResource,\n ctx: TransferResourceContext,\n input: Omit<TransferMatchInput, 'outcomes'>,\n): Promise<{ outcomes: RowMatchOutcome[]; records: ReadonlyMap<string, Readonly<Record<string, unknown>>> }> {\n const outcomes = matchRows(input.rows, input.keys, input.lookup)\n const hook = transferRecordsHooks(resource).match\n if (!hook) return { outcomes, records: input.records }\n const answer = await hook(ctx, { ...input, outcomes })\n if (!Array.isArray(answer?.outcomes) || answer.outcomes.length !== input.rows.length) {\n throw new Error(`transfer resource \"${resource.key}\" matched ${answer?.outcomes?.length ?? 0} of ${input.rows.length} rows`)\n }\n if (!answer.records?.size) return { outcomes: answer.outcomes, records: input.records }\n return { outcomes: answer.outcomes, records: new Map([...input.records, ...answer.records]) }\n}\n\n/** The resource's locked rules, or none. */\nexport async function transferResourceLockedRules(\n resource: ResolvedTransferResource,\n ctx: TransferResourceContext,\n): Promise<readonly TransferLockedRule[]> {\n return (await transferRecordsHooks(resource).lockedRules?.(ctx)) ?? []\n}\n\n/** One planned row that breaks one of the resource's invariants. */\nexport interface TransferInvariantFailure {\n row: number\n invariant: string\n message: string\n}\n\n/**\n * Every planned row that would write and breaks an invariant, checked\n * against the record as it was read (`existing`, by record id). Rows that\n * write nothing (`skip`, `fail`, `unchanged`) are not checked.\n */\nexport function transferInvariantFailures(\n invariants: readonly TransferInvariant[] | undefined,\n rows: readonly PlannedTransferRow[],\n existing: ReadonlyMap<string, Readonly<Record<string, unknown>>>,\n): TransferInvariantFailure[] {\n const failures: TransferInvariantFailure[] = []\n if (!invariants?.length) return failures\n for (const row of rows) {\n if (row.verdict !== 'create' && row.verdict !== 'update') continue\n const before = row.recordId ? existing.get(row.recordId) ?? null : null\n for (const invariant of invariants) {\n const message = invariant.check(row, before)\n if (message) failures.push({ row: row.index, invariant: invariant.id, message })\n }\n }\n return failures\n}\n\n/** Only for specs: forgets every registered server half. */\nexport function resetTransferResourcesForTests(): void {\n resources.clear()\n}\n\n/*==========================================\n * THE CLIENT HALF\n *=========================================*/\n\n/** Where in the wizard a plugin's own step goes: after one of the core's steps. */\nexport type TransferWizardStepId =\n | 'upload'\n | 'mapping'\n | 'values'\n | 'matching'\n | 'conflicts'\n | 'dryRun'\n | 'apply'\n\n/** The core wizard's steps, in order. */\nexport const TRANSFER_WIZARD_STEPS: readonly TransferWizardStepId[] = [\n 'upload',\n 'mapping',\n 'values',\n 'matching',\n 'conflicts',\n 'dryRun',\n 'apply',\n]\n\n/** What a plugin's own wizard step is handed. */\nexport interface TransferWizardStepProps {\n resource: string\n orgId: string\n hostId: string | null\n /** The job, once the upload has made one. */\n jobId: string | null\n /** The step's answer so far: what it last passed to `setValue`. */\n value: unknown\n /** Keeps the step's answer, sent with the dry run under the step's `id` in `extras` for the server half to check. */\n setValue(value: unknown): void\n /** Whether the step is done; the wizard holds Next until it is. */\n setComplete(complete: boolean): void\n}\n\n/** A plugin's own step in the import wizard. */\nexport interface TransferWizardStep {\n id: string\n label: string\n /** The core step it follows. */\n after: TransferWizardStepId\n component: ComponentType<TransferWizardStepProps>\n}\n\n/** How the hub and the wizard show a resource. */\nexport interface PluginTransferResourceUi {\n /** The name on the hub and the wizard's title; the declaration's label is the fallback. */\n label: string\n icon?: MdiIconProps\n extraSteps?: readonly TransferWizardStep[]\n /**\n * For a resource declared with `instances`: the record list kind\n * (`registerPluginRecordListSource`) its instances are listed from, so the\n * Import & export hub can offer each one (`dataset` for a dataset's\n * records). Without it the hub cannot name an instance and leaves the\n * resource to the plugin's own surface.\n */\n instancesFrom?: string\n}\n\ninterface RegisteredUi {\n pluginId: string\n ui: PluginTransferResourceUi\n}\n\nconst uis: Map<string, RegisteredUi> = globalScope[UIS_KEY] ?? (globalScope[UIS_KEY] = new Map())\n\n/**\n * Registers the client half of a resource the plugin declared, from its\n * console registrar. Refused on the same terms as the server half — no\n * owner, an undeclared key, another plugin's key — and for an extra step\n * that follows no core step or repeats another's id.\n */\nexport function registerPluginTransferResourceUi(\n key: string,\n ui: PluginTransferResourceUi,\n options?: { pluginId?: string },\n): void {\n const name = key.trim()\n const declared = claim('transfer resource UI', name, options)\n const ids = new Set<string>()\n for (const step of ui.extraSteps ?? []) {\n if (!TRANSFER_WIZARD_STEPS.includes(step.after)) {\n throw new Error(`transfer resource UI \"${name}\": step \"${step.id}\" follows no wizard step (\"${step.after}\")`)\n }\n if (ids.has(step.id)) throw new Error(`transfer resource UI \"${name}\": step \"${step.id}\" is listed twice`)\n ids.add(step.id)\n }\n uis.set(name, { pluginId: declared.pluginId, ui })\n}\n\n/** The client half registered for a resource — or for the resource a key names an instance of — or `null`. */\nexport function pluginTransferResourceUi(key: string): (PluginTransferResourceUi & { pluginId: string }) | null {\n const entry = uis.get(parseTransferResourceKey(key).key)\n return entry ? { ...entry.ui, pluginId: entry.pluginId } : null\n}\n\n/** Every registered client half, in registration order. */\nexport function listPluginTransferResourceUis(): Array<{ key: string; pluginId: string }> {\n return [...uis.entries()].map(([key, entry]) => ({ key, pluginId: entry.pluginId }))\n}\n\n/**\n * The wizard's steps for a resource: the core's, with the plugin's own\n * inserted after the step each names, in the order the plugin lists them.\n */\nexport function transferWizardSteps(\n key: string,\n): Array<{ id: string; core: true } | (TransferWizardStep & { core: false })> {\n const extra = pluginTransferResourceUi(key)?.extraSteps ?? []\n return TRANSFER_WIZARD_STEPS.flatMap((id) => [\n { id, core: true as const },\n ...extra.filter((step) => step.after === id).map((step) => ({ ...step, core: false as const })),\n ])\n}\n\n/** Only for specs: forgets every registered client half. */\nexport function resetTransferResourceUisForTests(): void {\n uis.clear()\n}\n"],"names":["globalScope","checkEntitlement","planLabelGrantingFeature","getRegisteringPluginId","buildTransferFieldCatalog","TRANSFER_PRESET_IDS","transferPlanFeature","matchRows","buildTransferPlan","transferPolicyDefaultsFor","parseTransferResourceKey","transferFieldProblems","transferResourceProblems","TRANSFER_PLAN_REQUIRED","filterPluginsByReleaseFlags","resolveEnabledPlugins","resolveHostEnabledPlugins","PLUGIN_TRANSFER_RESOURCES_DECLARED","runPluginDeclarationsRepair","TRANSFER_RESOURCES_LOAD_POINT","listDeclaredTransferResources","declaredTransferResource","key","name","trim","find","one","listTransferResourcesFor","subject","enabled","scope","org","host","running","Set","isFlagOn","staffBypass","filter","has","pluginId","inSentence","label","test","charAt","toLowerCase","slice","transferPlanRequired","feature","intent","plan","act","status","body","error","reason","code","transferPlanRefusal","declared","String","resource","gate","resolveTransferResource","impl","planGate","undefined","RECORDS_HOOKS","IMPORT_HOOKS","PACKAGE_HOOKS","pluginTransferResourceProblems","problems","need","kind","hooks","kinds","includes","hook","push","exportOnly","featureFlag","Array","isArray","matchKeys","length","presetIds","preset","presets","id","add","fieldIds","RESOURCES_KEY","Symbol","for","UIS_KEY","globalThis","resources","Map","claim","what","options","Error","registerPluginTransferResource","join","set","TransferResourceUnavailableError","message","ensureRegistered","missing","absent","names","map","asked","base","instance","Boolean","instances","get","resolveTransferResources","transferRecordsHooks","transferPackageHooks","transferResourceCatalog","ctx","catalog","fields","transferResourceMatchKeys","offer","keys","known","fieldId","defaults","planTransferResourceRows","input","compared","valuesEqual","transferResourcePolicyDefaults","defaultPolicy","matchTransferResourceRows","answer","outcomes","rows","lookup","match","records","size","transferResourceLockedRules","lockedRules","transferInvariantFailures","invariants","existing","failures","row","verdict","before","recordId","invariant","check","index","resetTransferResourcesForTests","clear","TRANSFER_WIZARD_STEPS","uis","registerPluginTransferResourceUi","ui","ids","step","extraSteps","after","pluginTransferResourceUi","entry","listPluginTransferResourceUis","entries","transferWizardSteps","extra","flatMap","core","resetTransferResourceUisForTests"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;IA4xBCA,4BA4VqCA;AArnCvC,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,oCAAgC;AAE3F,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SACEC,yBAAyB,EACzBC,mBAAmB,QAId,oCA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