@aglyn/aglyn 1.0.0-beta.220 → 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 (358) 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 +23 -23
  45. package/src/lib/app-utils/docs-help.generated.js +47 -10
  46. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  47. package/src/lib/app-utils/docs-index.generated.js +746 -151
  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 +33 -0
  65. package/src/lib/app-utils/health-report.js.map +1 -1
  66. package/src/lib/app-utils/leaving-notice.d.ts +96 -0
  67. package/src/lib/app-utils/leaving-notice.js +157 -0
  68. package/src/lib/app-utils/leaving-notice.js.map +1 -0
  69. package/src/lib/app-utils/llms-txt.d.ts +20 -0
  70. package/src/lib/app-utils/llms-txt.js +7 -1
  71. package/src/lib/app-utils/llms-txt.js.map +1 -1
  72. package/src/lib/app-utils/media-asset-facts.d.ts +16 -1
  73. package/src/lib/app-utils/media-asset-facts.js +40 -13
  74. package/src/lib/app-utils/media-asset-facts.js.map +1 -1
  75. package/src/lib/app-utils/media-bandwidth.d.ts +52 -0
  76. package/src/lib/app-utils/media-bandwidth.js +94 -0
  77. package/src/lib/app-utils/media-bandwidth.js.map +1 -0
  78. package/src/lib/app-utils/media-ref.d.ts +241 -33
  79. package/src/lib/app-utils/media-ref.js +324 -43
  80. package/src/lib/app-utils/media-ref.js.map +1 -1
  81. package/src/lib/app-utils/media-src.d.ts +8 -8
  82. package/src/lib/app-utils/media-src.js +27 -11
  83. package/src/lib/app-utils/media-src.js.map +1 -1
  84. package/src/lib/app-utils/media-takedown-reach.d.ts +4 -1
  85. package/src/lib/app-utils/media-takedown-reach.js +6 -3
  86. package/src/lib/app-utils/media-takedown-reach.js.map +1 -1
  87. package/src/lib/app-utils/notifications.d.ts +1 -1
  88. package/src/lib/app-utils/notifications.js +2 -0
  89. package/src/lib/app-utils/notifications.js.map +1 -1
  90. package/src/lib/app-utils/operator-alerts.js +17 -0
  91. package/src/lib/app-utils/operator-alerts.js.map +1 -1
  92. package/src/lib/app-utils/organizations.d.ts +51 -2
  93. package/src/lib/app-utils/organizations.js +56 -3
  94. package/src/lib/app-utils/organizations.js.map +1 -1
  95. package/src/lib/app-utils/page-record-sources.d.ts +87 -0
  96. package/src/lib/app-utils/page-record-sources.js +53 -0
  97. package/src/lib/app-utils/page-record-sources.js.map +1 -0
  98. package/src/lib/app-utils/paid-media-source.d.ts +3 -7
  99. package/src/lib/app-utils/paid-media-source.js +5 -19
  100. package/src/lib/app-utils/paid-media-source.js.map +1 -1
  101. package/src/lib/app-utils/person-erasure.d.ts +5 -2
  102. package/src/lib/app-utils/person-erasure.js.map +1 -1
  103. package/src/lib/app-utils/picklists.d.ts +187 -0
  104. package/src/lib/app-utils/picklists.js +320 -0
  105. package/src/lib/app-utils/picklists.js.map +1 -0
  106. package/src/lib/app-utils/plan-entitlements.d.ts +220 -50
  107. package/src/lib/app-utils/plan-entitlements.js +309 -115
  108. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  109. package/src/lib/app-utils/realm-host-surface.generated.js +2 -0
  110. package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
  111. package/src/lib/app-utils/release-flags.d.ts +1 -1
  112. package/src/lib/app-utils/release-flags.js +11 -0
  113. package/src/lib/app-utils/release-flags.js.map +1 -1
  114. package/src/lib/app-utils/rendered-widths.d.ts +121 -0
  115. package/src/lib/app-utils/rendered-widths.js +211 -0
  116. package/src/lib/app-utils/rendered-widths.js.map +1 -0
  117. package/src/lib/app-utils/repeat-sources.d.ts +2 -1
  118. package/src/lib/app-utils/repeat-sources.js.map +1 -1
  119. package/src/lib/app-utils/screen-link-context-value.d.ts +7 -0
  120. package/src/lib/app-utils/screen-link-context-value.js.map +1 -1
  121. package/src/lib/app-utils/screen-link-context.js +14 -2
  122. package/src/lib/app-utils/screen-link-context.js.map +1 -1
  123. package/src/lib/app-utils/screen-route.d.ts +157 -36
  124. package/src/lib/app-utils/screen-route.js +191 -41
  125. package/src/lib/app-utils/screen-route.js.map +1 -1
  126. package/src/lib/app-utils/seo-audit.d.ts +11 -1
  127. package/src/lib/app-utils/seo-audit.js +33 -13
  128. package/src/lib/app-utils/seo-audit.js.map +1 -1
  129. package/src/lib/app-utils/seo-keywords.d.ts +11 -0
  130. package/src/lib/app-utils/seo-keywords.js +19 -5
  131. package/src/lib/app-utils/seo-keywords.js.map +1 -1
  132. package/src/lib/app-utils/seo-page-facts.d.ts +47 -4
  133. package/src/lib/app-utils/seo-page-facts.js +136 -31
  134. package/src/lib/app-utils/seo-page-facts.js.map +1 -1
  135. package/src/lib/app-utils/seo-site-scan.d.ts +42 -4
  136. package/src/lib/app-utils/seo-site-scan.js +113 -12
  137. package/src/lib/app-utils/seo-site-scan.js.map +1 -1
  138. package/src/lib/app-utils/server.d.ts +5 -4
  139. package/src/lib/app-utils/server.js +14 -5
  140. package/src/lib/app-utils/server.js.map +1 -1
  141. package/src/lib/app-utils/site-icon-set.d.ts +195 -0
  142. package/src/lib/app-utils/site-icon-set.js +351 -0
  143. package/src/lib/app-utils/site-icon-set.js.map +1 -0
  144. package/src/lib/app-utils/site-interactions.d.ts +101 -4
  145. package/src/lib/app-utils/site-interactions.js +120 -4
  146. package/src/lib/app-utils/site-interactions.js.map +1 -1
  147. package/src/lib/app-utils/starter-template-nodes.d.ts +7 -0
  148. package/src/lib/app-utils/starter-template-nodes.js +3 -0
  149. package/src/lib/app-utils/starter-template-nodes.js.map +1 -1
  150. package/src/lib/app-utils/starter-templates.d.ts +5 -19
  151. package/src/lib/app-utils/starter-templates.js +5 -49
  152. package/src/lib/app-utils/starter-templates.js.map +1 -1
  153. package/src/lib/app-utils/transfer-launcher-context.d.ts +136 -0
  154. package/src/lib/app-utils/transfer-launcher-context.js +23 -0
  155. package/src/lib/app-utils/transfer-launcher-context.js.map +1 -0
  156. package/src/lib/app-utils/transfer-resume-import.d.ts +39 -0
  157. package/src/lib/app-utils/transfer-resume-import.js +128 -0
  158. package/src/lib/app-utils/transfer-resume-import.js.map +1 -0
  159. package/src/lib/app-utils/upgrade-proposal.d.ts +66 -0
  160. package/src/lib/app-utils/upgrade-proposal.js +95 -0
  161. package/src/lib/app-utils/upgrade-proposal.js.map +1 -0
  162. package/src/lib/app-utils/utc-month.d.ts +33 -0
  163. package/src/lib/app-utils/utc-month.js +35 -0
  164. package/src/lib/app-utils/utc-month.js.map +1 -0
  165. package/src/lib/app-utils/visitor-record-ceiling.d.ts +4 -4
  166. package/src/lib/app-utils/visitor-record-ceiling.js +4 -4
  167. package/src/lib/app-utils/visitor-record-ceiling.js.map +1 -1
  168. package/src/lib/app-utils/wire-nodes.d.ts +39 -19
  169. package/src/lib/app-utils/wire-nodes.js +120 -34
  170. package/src/lib/app-utils/wire-nodes.js.map +1 -1
  171. package/src/lib/data-transfer/access.d.ts +74 -0
  172. package/src/lib/data-transfer/access.js +93 -0
  173. package/src/lib/data-transfer/access.js.map +1 -0
  174. package/src/lib/data-transfer/derive.d.ts +246 -0
  175. package/src/lib/data-transfer/derive.js +1007 -0
  176. package/src/lib/data-transfer/derive.js.map +1 -0
  177. package/src/lib/data-transfer/export-file.d.ts +46 -0
  178. package/src/lib/data-transfer/export-file.js +146 -0
  179. package/src/lib/data-transfer/export-file.js.map +1 -0
  180. package/src/lib/data-transfer/field-catalog.d.ts +134 -0
  181. package/src/lib/data-transfer/field-catalog.js +278 -0
  182. package/src/lib/data-transfer/field-catalog.js.map +1 -0
  183. package/src/lib/data-transfer/header-match.d.ts +129 -0
  184. package/src/lib/data-transfer/header-match.js +367 -0
  185. package/src/lib/data-transfer/header-match.js.map +1 -0
  186. package/src/lib/data-transfer/index.d.ts +34 -0
  187. package/src/lib/data-transfer/index.js +40 -0
  188. package/src/lib/data-transfer/index.js.map +1 -0
  189. package/src/lib/data-transfer/job.d.ts +190 -0
  190. package/src/lib/data-transfer/job.js +229 -0
  191. package/src/lib/data-transfer/job.js.map +1 -0
  192. package/src/lib/data-transfer/lookup.d.ts +45 -0
  193. package/src/lib/data-transfer/lookup.js +71 -0
  194. package/src/lib/data-transfer/lookup.js.map +1 -0
  195. package/src/lib/data-transfer/match.d.ts +99 -0
  196. package/src/lib/data-transfer/match.js +244 -0
  197. package/src/lib/data-transfer/match.js.map +1 -0
  198. package/src/lib/data-transfer/package-plan.d.ts +205 -0
  199. package/src/lib/data-transfer/package-plan.js +475 -0
  200. package/src/lib/data-transfer/package-plan.js.map +1 -0
  201. package/src/lib/data-transfer/package.d.ts +181 -0
  202. package/src/lib/data-transfer/package.js +426 -0
  203. package/src/lib/data-transfer/package.js.map +1 -0
  204. package/src/lib/data-transfer/picklist-map.d.ts +139 -0
  205. package/src/lib/data-transfer/picklist-map.js +271 -0
  206. package/src/lib/data-transfer/picklist-map.js.map +1 -0
  207. package/src/lib/data-transfer/plan.d.ts +176 -0
  208. package/src/lib/data-transfer/plan.js +451 -0
  209. package/src/lib/data-transfer/plan.js.map +1 -0
  210. package/src/lib/data-transfer/policy.d.ts +170 -0
  211. package/src/lib/data-transfer/policy.js +378 -0
  212. package/src/lib/data-transfer/policy.js.map +1 -0
  213. package/src/lib/data-transfer/resource.d.ts +211 -0
  214. package/src/lib/data-transfer/resource.js +241 -0
  215. package/src/lib/data-transfer/resource.js.map +1 -0
  216. package/src/lib/data-transfer/review.d.ts +70 -0
  217. package/src/lib/data-transfer/review.js +233 -0
  218. package/src/lib/data-transfer/review.js.map +1 -0
  219. package/src/lib/data-transfer/similarity.d.ts +40 -0
  220. package/src/lib/data-transfer/similarity.js +106 -0
  221. package/src/lib/data-transfer/similarity.js.map +1 -0
  222. package/src/lib/data-transfer/site-package.d.ts +365 -0
  223. package/src/lib/data-transfer/site-package.js +1077 -0
  224. package/src/lib/data-transfer/site-package.js.map +1 -0
  225. package/src/lib/data-transfer/source.d.ts +74 -0
  226. package/src/lib/data-transfer/source.js +293 -0
  227. package/src/lib/data-transfer/source.js.map +1 -0
  228. package/src/lib/data-transfer/transfer-api.d.ts +898 -0
  229. package/src/lib/data-transfer/transfer-api.js +107 -0
  230. package/src/lib/data-transfer/transfer-api.js.map +1 -0
  231. package/src/lib/foundation/definitions/org-billing.types.d.ts +31 -0
  232. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  233. package/src/lib/foundation/definitions/organization.types.d.ts +42 -1
  234. package/src/lib/foundation/definitions/organization.types.js.map +1 -1
  235. package/src/lib/foundation/definitions/platform.types.d.ts +6 -4
  236. package/src/lib/foundation/definitions/platform.types.js.map +1 -1
  237. package/src/lib/foundation/index.d.ts +1 -1
  238. package/src/lib/foundation/index.js.map +1 -1
  239. package/src/lib/plugin-manager/feature-plugins.d.ts +91 -2
  240. package/src/lib/plugin-manager/feature-plugins.js +48 -3
  241. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
  242. package/src/lib/plugin-manager/first-party-plugins.generated.d.ts +56 -0
  243. package/src/lib/plugin-manager/first-party-plugins.generated.js +1132 -27
  244. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  245. package/src/lib/plugin-manager/index.d.ts +0 -1
  246. package/src/lib/plugin-manager/index.js +0 -1
  247. package/src/lib/plugin-manager/index.js.map +1 -1
  248. package/src/lib/plugin-manager/interaction-recipes.d.ts +142 -0
  249. package/src/lib/plugin-manager/interaction-recipes.js +104 -0
  250. package/src/lib/plugin-manager/interaction-recipes.js.map +1 -0
  251. package/src/lib/plugin-manager/interaction-step-checks.d.ts +66 -0
  252. package/src/lib/plugin-manager/interaction-step-checks.js +86 -0
  253. package/src/lib/plugin-manager/interaction-step-checks.js.map +1 -0
  254. package/src/lib/plugin-manager/plugin-artifact-types.d.ts +235 -0
  255. package/src/lib/plugin-manager/plugin-artifact-types.js +99 -0
  256. package/src/lib/plugin-manager/plugin-artifact-types.js.map +1 -0
  257. package/src/lib/plugin-manager/plugin-contact-capture.d.ts +8 -0
  258. package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
  259. package/src/lib/plugin-manager/plugin-conversion-credit.d.ts +216 -0
  260. package/src/lib/plugin-manager/plugin-conversion-credit.js +91 -0
  261. package/src/lib/plugin-manager/plugin-conversion-credit.js.map +1 -0
  262. package/src/lib/plugin-manager/plugin-entity-pickers.d.ts +83 -0
  263. package/src/lib/plugin-manager/plugin-entity-pickers.js +87 -0
  264. package/src/lib/plugin-manager/plugin-entity-pickers.js.map +1 -0
  265. package/src/lib/plugin-manager/plugin-host-resources.d.ts +6 -0
  266. package/src/lib/plugin-manager/plugin-host-resources.js +6 -1
  267. package/src/lib/plugin-manager/plugin-host-resources.js.map +1 -1
  268. package/src/lib/plugin-manager/plugin-intake-gates.d.ts +75 -0
  269. package/src/lib/plugin-manager/plugin-intake-gates.js +49 -0
  270. package/src/lib/plugin-manager/plugin-intake-gates.js.map +1 -0
  271. package/src/lib/plugin-manager/plugin-jobs.d.ts +5 -5
  272. package/src/lib/plugin-manager/plugin-jobs.js +7 -7
  273. package/src/lib/plugin-manager/plugin-jobs.js.map +1 -1
  274. package/src/lib/plugin-manager/plugin-live-paths.d.ts +70 -0
  275. package/src/lib/plugin-manager/plugin-live-paths.js +66 -0
  276. package/src/lib/plugin-manager/plugin-live-paths.js.map +1 -0
  277. package/src/lib/plugin-manager/plugin-org-erasure.d.ts +3 -2
  278. package/src/lib/plugin-manager/plugin-org-erasure.js +30 -5
  279. package/src/lib/plugin-manager/plugin-org-erasure.js.map +1 -1
  280. package/src/lib/plugin-manager/plugin-person-erasure.d.ts +68 -9
  281. package/src/lib/plugin-manager/plugin-person-erasure.js +196 -51
  282. package/src/lib/plugin-manager/plugin-person-erasure.js.map +1 -1
  283. package/src/lib/plugin-manager/plugin-person-records.d.ts +275 -0
  284. package/src/lib/plugin-manager/plugin-person-records.js +107 -0
  285. package/src/lib/plugin-manager/plugin-person-records.js.map +1 -0
  286. package/src/lib/plugin-manager/plugin-record-counts.d.ts +76 -0
  287. package/src/lib/plugin-manager/plugin-record-counts.js +49 -0
  288. package/src/lib/plugin-manager/plugin-record-counts.js.map +1 -0
  289. package/src/lib/plugin-manager/plugin-record-email-state.d.ts +26 -0
  290. package/src/lib/plugin-manager/plugin-record-email-state.js +16 -0
  291. package/src/lib/plugin-manager/plugin-record-email-state.js.map +1 -1
  292. package/src/lib/plugin-manager/plugin-record-index.d.ts +10 -0
  293. package/src/lib/plugin-manager/plugin-record-index.js.map +1 -1
  294. package/src/lib/plugin-manager/plugin-record-lists.d.ts +86 -6
  295. package/src/lib/plugin-manager/plugin-record-lists.js +42 -5
  296. package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -1
  297. package/src/lib/plugin-manager/plugin-record-origin.d.ts +79 -0
  298. package/src/lib/plugin-manager/plugin-record-origin.js +46 -0
  299. package/src/lib/plugin-manager/plugin-record-origin.js.map +1 -0
  300. package/src/lib/plugin-manager/plugin-record-pages.d.ts +37 -0
  301. package/src/lib/plugin-manager/plugin-record-pages.js +52 -0
  302. package/src/lib/plugin-manager/plugin-record-pages.js.map +1 -0
  303. package/src/lib/plugin-manager/plugin-record-timeline.d.ts +60 -0
  304. package/src/lib/plugin-manager/plugin-record-timeline.js +16 -0
  305. package/src/lib/plugin-manager/plugin-record-timeline.js.map +1 -1
  306. package/src/lib/plugin-manager/plugin-resource-drafts.d.ts +5 -5
  307. package/src/lib/plugin-manager/plugin-resource-drafts.js.map +1 -1
  308. package/src/lib/plugin-manager/plugin-revocations.d.ts +64 -0
  309. package/src/lib/plugin-manager/plugin-revocations.js +47 -0
  310. package/src/lib/plugin-manager/plugin-revocations.js.map +1 -0
  311. package/src/lib/plugin-manager/plugin-send-tallies.d.ts +69 -0
  312. package/src/lib/plugin-manager/plugin-send-tallies.js +45 -0
  313. package/src/lib/plugin-manager/plugin-send-tallies.js.map +1 -0
  314. package/src/lib/plugin-manager/plugin-server-steps.d.ts +170 -0
  315. package/src/lib/plugin-manager/plugin-server-steps.js +116 -0
  316. package/src/lib/plugin-manager/plugin-server-steps.js.map +1 -0
  317. package/src/lib/plugin-manager/plugin-site-bundle.d.ts +40 -0
  318. package/src/lib/plugin-manager/plugin-site-bundle.js +4 -0
  319. package/src/lib/plugin-manager/plugin-site-bundle.js.map +1 -1
  320. package/src/lib/plugin-manager/plugin-site-export.d.ts +57 -1
  321. package/src/lib/plugin-manager/plugin-site-export.js +23 -10
  322. package/src/lib/plugin-manager/plugin-site-export.js.map +1 -1
  323. package/src/lib/plugin-manager/plugin-sitemap-readers.d.ts +146 -0
  324. package/src/lib/plugin-manager/plugin-sitemap-readers.js +110 -0
  325. package/src/lib/plugin-manager/plugin-sitemap-readers.js.map +1 -0
  326. package/src/lib/plugin-manager/plugin-transfer-resources.d.ts +714 -0
  327. package/src/lib/plugin-manager/plugin-transfer-resources.js +443 -0
  328. package/src/lib/plugin-manager/plugin-transfer-resources.js.map +1 -0
  329. package/src/lib/plugin-manager/plugin-usage-axes.d.ts +54 -5
  330. package/src/lib/plugin-manager/plugin-usage-axes.js +11 -3
  331. package/src/lib/plugin-manager/plugin-usage-axes.js.map +1 -1
  332. package/src/lib/plugin-manager/plugin-user-erasure.js +9 -1
  333. package/src/lib/plugin-manager/plugin-user-erasure.js.map +1 -1
  334. package/src/lib/plugin-manager/plugin-visitor-doors.d.ts +104 -0
  335. package/src/lib/plugin-manager/plugin-visitor-doors.js +108 -0
  336. package/src/lib/plugin-manager/plugin-visitor-doors.js.map +1 -0
  337. package/src/lib/plugin-manager/realm-host-aglyn.generated.js +2 -0
  338. package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
  339. package/src/lib/plugin-manager/repeat-rows.d.ts +5 -6
  340. package/src/lib/plugin-manager/repeat-rows.js.map +1 -1
  341. package/src/lib/app-utils/actions.d.ts +0 -310
  342. package/src/lib/app-utils/actions.js +0 -506
  343. package/src/lib/app-utils/actions.js.map +0 -1
  344. package/src/lib/app-utils/automation-placeholders.d.ts +0 -72
  345. package/src/lib/app-utils/automation-placeholders.js +0 -207
  346. package/src/lib/app-utils/automation-placeholders.js.map +0 -1
  347. package/src/lib/app-utils/dataset-models.d.ts +0 -339
  348. package/src/lib/app-utils/dataset-models.js +0 -722
  349. package/src/lib/app-utils/dataset-models.js.map +0 -1
  350. package/src/lib/app-utils/datasets.d.ts +0 -171
  351. package/src/lib/app-utils/datasets.js +0 -227
  352. package/src/lib/app-utils/datasets.js.map +0 -1
  353. package/src/lib/app-utils/form-abuse-ceiling.d.ts +0 -146
  354. package/src/lib/app-utils/form-abuse-ceiling.js +0 -158
  355. package/src/lib/app-utils/form-abuse-ceiling.js.map +0 -1
  356. package/src/lib/plugin-manager/order-fulfilment.d.ts +0 -142
  357. package/src/lib/plugin-manager/order-fulfilment.js +0 -104
  358. package/src/lib/plugin-manager/order-fulfilment.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/data-transfer/policy.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\n/*==========================================\n * CONFLICT POLICY — what a row does to the record it matched, field by field.\n *\n * Record level, the person chooses what happens on a match (update it,\n * skip the row, or create a duplicate anyway), on no match (create or\n * skip) and on an ambiguous match (skip, or choose per row).\n *\n * Field level, the person chooses how an incoming value meets the one the\n * record holds:\n *\n * - `overwrite` — the file's value replaces it;\n * - `fillBlanks` — the file's value is written only where the record has none;\n * - `keepExisting` — the field is never changed on an existing record;\n * - `append` — list fields (tags, multi-select) gain the file's items;\n *\n * and, separately, what a BLANK cell means: `leave` the value alone, or\n * `clear` it.\n *\n * ## Precedence\n *\n * For row R and field F, the first of these that speaks decides:\n *\n * 1. a locked rule the owning plugin declared for F (stage never moves\n * backward, consent is never asserted from a file) — the person sees it,\n * with its reason, and cannot change it;\n * 2. the person's override for row R, field F;\n * 3. the person's choice for field F;\n * 4. the type default (lists append);\n * 5. the person's default for every field.\n *\n * ## The resource sets where the person starts (AGL-3548)\n *\n * The core's starting point — fill blanks, leave on blank — never replaces\n * a value somebody already has, which is right for a person's record and\n * wrong for a record the file is the definition of: a redirect re-imported\n * with a new destination is meant to point there. A resource declares its\n * own starting point ({@link TransferPolicyDefaults}); the wizard opens the\n * Conflicts step on it and the person may still change every part, and the\n * dry run fills whatever a request leaves out from it\n * ({@link withTransferPolicyDefaults}).\n *\n * ## The resource may say when two values are the same\n *\n * The core compares values as stored (lists as sets, caseless). A resource\n * whose write folds a value — a status kept in lower case, a path kept\n * without its trailing slash — passes a {@link TransferValuesComparator}, so\n * `Published` against `published` is no conflict and no change, in the\n * review and the dry run alike.\n *=========================================*/\n\nimport { isTransferListType } from './resource'\nimport type { TransferField } from './resource'\n\n/** What happens to a row that matched an existing record. */\nexport type TransferOnMatch = 'update' | 'skip' | 'duplicate'\n/** What happens to a row that matched nothing. */\nexport type TransferOnNew = 'create' | 'skip'\n/** What happens to a row that matched several records. */\nexport type TransferOnAmbiguous = 'skip' | 'ask'\n\nexport interface TransferRecordPolicy {\n onMatch: TransferOnMatch\n onNew: TransferOnNew\n onAmbiguous: TransferOnAmbiguous\n}\n\n/** How an incoming value meets the existing one. */\nexport type TransferFieldMode = 'overwrite' | 'fillBlanks' | 'keepExisting' | 'append'\n\n/** What a blank cell means for a field. */\nexport type TransferBlankMeans = 'leave' | 'clear'\n\nexport interface TransferFieldPolicy {\n mode: TransferFieldMode\n blank: TransferBlankMeans\n}\n\n/** A rule the owning plugin imposes on a field; shown locked, with its reason. */\nexport interface TransferLockedRule {\n fieldId: string\n /** Why, in a sentence the person reads (\"A stage never moves backward\"). */\n reason: string\n /** The policy forced on the field; parts left out stay the person's choice. */\n forced?: Partial<TransferFieldPolicy>\n /** The file's values are never written to this field at all. */\n refuseValues?: boolean\n}\n\n/** A person's choice for one row. */\nexport interface TransferRowOverride {\n /** What to do with the row, whatever its match said. */\n action?: 'create' | 'update' | 'skip'\n /** The record to update — how an ambiguous row is resolved. */\n recordId?: string\n /** Per-field choices for this row. */\n fields?: Readonly<Record<string, Partial<TransferFieldPolicy>>>\n}\n\nexport interface TransferPolicy {\n record: TransferRecordPolicy\n /** The default for every field. */\n fieldDefault: TransferFieldPolicy\n /** Per-field choices. */\n fields: Readonly<Record<string, Partial<TransferFieldPolicy>>>\n /** The owning plugin's locked rules. */\n locked: readonly TransferLockedRule[]\n /** Per-row choices, by row index. */\n rows: Readonly<Record<number, TransferRowOverride>>\n}\n\n/** Update what matches, create what does not, and ask about the rest. */\nexport const DEFAULT_TRANSFER_RECORD_POLICY: TransferRecordPolicy = {\n onMatch: 'update',\n onNew: 'create',\n onAmbiguous: 'ask',\n}\n\n/**\n * Fill blanks and leave on blank: the default never replaces or clears a\n * value somebody already has. Anything stronger is a choice the person makes.\n */\nexport const DEFAULT_TRANSFER_FIELD_POLICY: TransferFieldPolicy = {\n mode: 'fillBlanks',\n blank: 'leave',\n}\n\n/**\n * Where a resource starts the person (see the block header): its record\n * policy, its default for every field and its choices for single fields,\n * each part optional. The person's choices are made on top of it.\n */\nexport interface TransferPolicyDefaults {\n record?: Partial<TransferRecordPolicy>\n fieldDefault?: Partial<TransferFieldPolicy>\n fields?: Readonly<Record<string, Partial<TransferFieldPolicy>>>\n /** Why the resource starts here, in a sentence the Conflicts step shows. */\n note?: string\n}\n\nconst RECORD_CHOICES = {\n onMatch: ['update', 'skip', 'duplicate'],\n onNew: ['create', 'skip'],\n onAmbiguous: ['skip', 'ask'],\n} as const\nconst FIELD_MODES: readonly TransferFieldMode[] = ['overwrite', 'fillBlanks', 'keepExisting', 'append']\nconst BLANK_MEANS: readonly TransferBlankMeans[] = ['leave', 'clear']\n\nfunction fieldChoice(raw: unknown, list: boolean): Partial<TransferFieldPolicy> {\n const choice = (raw && typeof raw === 'object' ? raw : {}) as Record<string, unknown>\n const out: Partial<TransferFieldPolicy> = {}\n const mode = choice['mode'] as TransferFieldMode\n if (FIELD_MODES.includes(mode) && (mode !== 'append' || list)) out.mode = mode\n const blank = choice['blank'] as TransferBlankMeans\n if (BLANK_MEANS.includes(blank)) out.blank = blank\n return out\n}\n\n/**\n * A resource's defaults as far as they hold for these fields: a choice for a\n * field the catalog lacks, or one that can never be written, is dropped, as\n * is `append` on a field that is not a list and any value that is not a\n * choice — so a context whose catalog differs (one dataset's fields) never\n * makes a dry run refuse the resource's own defaults.\n */\nexport function transferPolicyDefaultsFor(\n defaults: TransferPolicyDefaults | null | undefined,\n fields: readonly TransferField[],\n): TransferPolicyDefaults {\n if (!defaults) return {}\n const out: TransferPolicyDefaults = {}\n const record: Partial<TransferRecordPolicy> = {}\n for (const [part, allowed] of Object.entries(RECORD_CHOICES) as Array<[keyof TransferRecordPolicy, readonly string[]]>) {\n const value = defaults.record?.[part]\n if (typeof value === 'string' && allowed.includes(value)) (record as Record<string, string>)[part] = value\n }\n if (Object.keys(record).length) out.record = record\n const fieldDefault = fieldChoice(defaults.fieldDefault, false)\n if (Object.keys(fieldDefault).length) out.fieldDefault = fieldDefault\n const byId = new Map(fields.map((field) => [field.id, field]))\n const chosen: Record<string, Partial<TransferFieldPolicy>> = {}\n for (const [fieldId, raw] of Object.entries(defaults.fields ?? {})) {\n const field = byId.get(fieldId)\n if (!field || field.readOnly || field.derived || field.system) continue\n const choice = fieldChoice(raw, isTransferListType(field.type))\n if (Object.keys(choice).length) chosen[fieldId] = choice\n }\n if (Object.keys(chosen).length) out.fields = chosen\n if (typeof defaults.note === 'string' && defaults.note.trim()) out.note = defaults.note.trim()\n return out\n}\n\n/**\n * The person's choices on top of a resource's defaults: each part of the\n * record policy and of the field default is the person's where they said\n * one and the resource's where they did not. Field choices sent at all are\n * the person's whole set — the wizard starts them from the resource's, so a\n * choice the person took back stays taken back — and the resource's when\n * none are sent. What neither says, {@link createTransferPolicy} fills from\n * the core's defaults.\n */\nexport function withTransferPolicyDefaults(\n defaults: TransferPolicyDefaults | null | undefined,\n chosen: Partial<TransferPolicy> = {},\n): Partial<TransferPolicy> {\n if (!defaults) return chosen\n return {\n ...chosen,\n record: { ...DEFAULT_TRANSFER_RECORD_POLICY, ...defaults.record, ...chosen.record },\n fieldDefault: { ...DEFAULT_TRANSFER_FIELD_POLICY, ...defaults.fieldDefault, ...chosen.fieldDefault },\n fields: chosen.fields ?? { ...(defaults.fields ?? {}) },\n }\n}\n\n/**\n * The policy a person starts from: the core's defaults with the resource's\n * on top, and no row or field choice beyond the resource's own. The wizard\n * opens on this.\n */\nexport function startingTransferPolicy(\n defaults: TransferPolicyDefaults | null | undefined,\n): Pick<TransferPolicy, 'record' | 'fieldDefault' | 'fields' | 'rows'> {\n return {\n record: { ...DEFAULT_TRANSFER_RECORD_POLICY, ...defaults?.record },\n fieldDefault: { ...DEFAULT_TRANSFER_FIELD_POLICY, ...defaults?.fieldDefault },\n fields: { ...(defaults?.fields ?? {}) },\n rows: {},\n }\n}\n\n/** A policy with every part present, defaults filling what `partial` leaves out. */\nexport function createTransferPolicy(partial: Partial<TransferPolicy> = {}): TransferPolicy {\n return {\n record: { ...DEFAULT_TRANSFER_RECORD_POLICY, ...partial.record },\n fieldDefault: { ...DEFAULT_TRANSFER_FIELD_POLICY, ...partial.fieldDefault },\n fields: partial.fields ?? {},\n locked: partial.locked ?? [],\n rows: partial.rows ?? {},\n }\n}\n\n/** Where a resolved field policy came from. */\nexport type TransferPolicySource = 'locked' | 'row' | 'field' | 'type' | 'default'\n\n/** The policy that applies to one row's field, and why. */\nexport interface ResolvedFieldPolicy extends TransferFieldPolicy {\n /** Where the MODE came from. */\n source: TransferPolicySource\n /** The locked rule, when one applies to the field. */\n locked?: TransferLockedRule\n /** The file's value is never written. */\n refuseValues: boolean\n}\n\n/**\n * The policy for row `rowIndex`, field `field` (see the precedence in the\n * block header). `append` on a field that is not a list is read as\n * `overwrite` — appending to a single value is replacing it.\n */\nexport function resolveFieldPolicy(\n policy: TransferPolicy,\n rowIndex: number,\n field: TransferField,\n): ResolvedFieldPolicy {\n const locked = policy.locked.find((rule) => rule.fieldId === field.id)\n const row = policy.rows[rowIndex]?.fields?.[field.id]\n const chosen = policy.fields[field.id]\n const list = isTransferListType(field.type)\n\n let mode: TransferFieldMode\n let source: TransferPolicySource\n if (locked?.forced?.mode) {\n mode = locked.forced.mode\n source = 'locked'\n } else if (row?.mode) {\n mode = row.mode\n source = 'row'\n } else if (chosen?.mode) {\n mode = chosen.mode\n source = 'field'\n } else if (list) {\n mode = 'append'\n source = 'type'\n } else {\n mode = policy.fieldDefault.mode\n source = 'default'\n }\n if (mode === 'append' && !list) mode = 'overwrite'\n\n const blank = locked?.forced?.blank ?? row?.blank ?? chosen?.blank ?? policy.fieldDefault.blank\n return {\n mode,\n blank,\n source,\n refuseValues: Boolean(locked?.refuseValues),\n ...(locked ? { locked } : {}),\n }\n}\n\n/** The record-level policy for one row, with the person's row choice folded in. */\nexport function resolveRecordPolicy(\n policy: TransferPolicy,\n rowIndex: number,\n): TransferRecordPolicy & { action?: TransferRowOverride['action']; recordId?: string } {\n const row = policy.rows[rowIndex]\n return {\n ...policy.record,\n ...(row?.action ? { action: row.action } : {}),\n ...(row?.recordId ? { recordId: row.recordId } : {}),\n }\n}\n\n/**\n * What is wrong with a policy against a field list, as sentences: a choice\n * or rule for a field that does not exist, an append on a field that is not\n * a list, and a person's choice that a locked rule overrides.\n */\nexport function transferPolicyProblems(policy: TransferPolicy, fields: readonly TransferField[]): string[] {\n const byId = new Map(fields.map((field) => [field.id, field]))\n const problems: string[] = []\n const check = (fieldId: string, setting: Partial<TransferFieldPolicy>, where: string): void => {\n const field = byId.get(fieldId)\n if (!field) {\n problems.push(`${where} names \"${fieldId}\", which is not a field.`)\n return\n }\n if (setting.mode === 'append' && !isTransferListType(field.type)) {\n problems.push(`${where}: \"${field.label}\" is not a list, so it cannot be appended to.`)\n }\n const locked = policy.locked.find((rule) => rule.fieldId === fieldId)\n if (locked?.forced?.mode && setting.mode && setting.mode !== locked.forced.mode) {\n problems.push(`${where}: \"${field.label}\" is locked — ${locked.reason}`)\n }\n }\n for (const [fieldId, setting] of Object.entries(policy.fields)) check(fieldId, setting, 'A field choice')\n for (const [row, override] of Object.entries(policy.rows)) {\n for (const [fieldId, setting] of Object.entries(override.fields ?? {})) {\n check(fieldId, setting, `Row ${Number(row) + 1}`)\n }\n }\n for (const rule of policy.locked) {\n if (!byId.has(rule.fieldId)) problems.push(`A locked rule names \"${rule.fieldId}\", which is not a field.`)\n }\n return problems\n}\n\n/** Whether a value is blank: absent, empty text, an empty list or an empty object. */\nexport function isBlankTransferValue(value: unknown): boolean {\n if (value === null || value === undefined) return true\n if (typeof value === 'string') return !value.trim()\n if (Array.isArray(value)) return value.length === 0\n if (typeof value === 'object' && !(value instanceof Date)) {\n return Object.values(value as Record<string, unknown>).every(isBlankTransferValue)\n }\n return false\n}\n\nfunction listKey(item: unknown): string {\n return typeof item === 'string' ? item.trim().toLowerCase() : JSON.stringify(item)\n}\n\n/** Two lists as one: the existing items, then the incoming ones it lacks (in any case). */\nexport function appendTransferList(existing: unknown, incoming: unknown): unknown[] {\n const before = Array.isArray(existing) ? existing : isBlankTransferValue(existing) ? [] : [existing]\n const after = Array.isArray(incoming) ? incoming : isBlankTransferValue(incoming) ? [] : [incoming]\n const seen = new Set(before.map(listKey))\n const merged = [...before]\n for (const item of after) {\n const key = listKey(item)\n if (seen.has(key)) continue\n seen.add(key)\n merged.push(item)\n }\n return merged\n}\n\n/** What a policy makes of one field. */\nexport interface FieldPolicyOutcome {\n /** The value the record will hold. */\n after: unknown\n /** Whether that differs from what it holds. */\n changed: boolean\n /** Why it is what it is, for the diff table. */\n rule: 'written' | 'filled' | 'kept' | 'appended' | 'cleared' | 'leftBlank' | 'refused'\n}\n\n/**\n * A resource's answer to \"are these the same value\" for one field (see the\n * block header) — `true` or `false`, or `undefined` to leave it to\n * {@link transferValuesEqual}.\n */\nexport type TransferValuesComparator = (field: TransferField, a: unknown, b: unknown) => boolean | undefined\n\n/** Two values of `field` compared by the resource's comparator, then the core's. */\nexport function compareTransferValues(\n field: TransferField,\n a: unknown,\n b: unknown,\n comparator?: TransferValuesComparator,\n): boolean {\n if (comparator) {\n const said = comparator(field, a, b)\n if (typeof said === 'boolean') return said\n }\n return transferValuesEqual(a, b)\n}\n\n/** Whether two field values are the same value; lists compare as sets, caseless. */\nexport function transferValuesEqual(a: unknown, b: unknown): boolean {\n if (isBlankTransferValue(a) && isBlankTransferValue(b)) return true\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false\n const keys = new Set(a.map(listKey))\n return b.every((item) => keys.has(listKey(item)))\n }\n if (a instanceof Date || b instanceof Date) {\n return new Date(a as Date).getTime() === new Date(b as Date).getTime()\n }\n if (a && b && typeof a === 'object' && typeof b === 'object') {\n const left = a as Record<string, unknown>\n const right = b as Record<string, unknown>\n const keys = new Set([...Object.keys(left), ...Object.keys(right)])\n return [...keys].every((key) => transferValuesEqual(left[key], right[key]))\n }\n return a === b\n}\n\n/**\n * One incoming value against the record's value under a resolved policy.\n * `incoming` absent means the column was not mapped: the field is not\n * touched. Blank means the cell was mapped and empty. `equal` decides\n * whether the value the record ends with differs from the one it holds —\n * the resource's comparator, when it has one.\n */\nexport function applyFieldPolicy(\n resolved: Pick<ResolvedFieldPolicy, 'mode' | 'blank' | 'refuseValues'>,\n before: unknown,\n incoming: unknown,\n equal: (a: unknown, b: unknown) => boolean = transferValuesEqual,\n): FieldPolicyOutcome {\n const same = (after: unknown, rule: FieldPolicyOutcome['rule']): FieldPolicyOutcome => ({\n after,\n changed: !equal(before, after),\n rule,\n })\n if (resolved.refuseValues) return { after: before, changed: false, rule: 'refused' }\n if (resolved.mode === 'keepExisting') return { after: before, changed: false, rule: 'kept' }\n if (isBlankTransferValue(incoming)) {\n if (resolved.blank === 'clear' && (resolved.mode === 'overwrite' || resolved.mode === 'append')) {\n return same(null, 'cleared')\n }\n return { after: before, changed: false, rule: 'leftBlank' }\n }\n switch (resolved.mode) {\n case 'overwrite':\n return same(incoming, 'written')\n case 'fillBlanks':\n return isBlankTransferValue(before) ? same(incoming, 'filled') : { after: before, changed: false, rule: 'kept' }\n case 'append':\n return same(appendTransferList(before, incoming), 'appended')\n }\n}\n"],"names":["isTransferListType","DEFAULT_TRANSFER_RECORD_POLICY","onMatch","onNew","onAmbiguous","DEFAULT_TRANSFER_FIELD_POLICY","mode","blank","RECORD_CHOICES","FIELD_MODES","BLANK_MEANS","fieldChoice","raw","list","choice","out","includes","transferPolicyDefaultsFor","defaults","fields","record","part","allowed","Object","entries","value","keys","length","fieldDefault","byId","Map","map","field","id","chosen","fieldId","get","readOnly","derived","system","type","note","trim","withTransferPolicyDefaults","startingTransferPolicy","rows","createTransferPolicy","partial","locked","resolveFieldPolicy","policy","rowIndex","find","rule","row","source","forced","refuseValues","Boolean","resolveRecordPolicy","action","recordId","transferPolicyProblems","problems","check","setting","where","push","label","reason","override","Number","has","isBlankTransferValue","undefined","Array","isArray","Date","values","every","listKey","item","toLowerCase","JSON","stringify","appendTransferList","existing","incoming","before","after","seen","Set","merged","key","add","compareTransferValues","a","b","comparator","said","transferValuesEqual","getTime","left","right","applyFieldPolicy","resolved","equal","same","changed"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAgD2C,GAE3C,SAASA,kBAAkB,QAAQ,gBAAY;AA4D/C,uEAAuE,GACvE,OAAO,MAAMC,iCAAuD;IAClEC,SAAS;IACTC,OAAO;IACPC,aAAa;AACf,EAAC;AAED;;;CAGC,GACD,OAAO,MAAMC,gCAAqD;IAChEC,MAAM;IACNC,OAAO;AACT,EAAC;AAeD,MAAMC,iBAAiB;IACrBN,SAAS;QAAC;QAAU;QAAQ;KAAY;IACxCC,OAAO;QAAC;QAAU;KAAO;IACzBC,aAAa;QAAC;QAAQ;KAAM;AAC9B;AACA,MAAMK,cAA4C;IAAC;IAAa;IAAc;IAAgB;CAAS;AACvG,MAAMC,cAA6C;IAAC;IAAS;CAAQ;AAErE,SAASC,YAAYC,GAAY,EAAEC,IAAa;IAC9C,MAAMC,SAAUF,OAAO,OAAOA,QAAQ,WAAWA,MAAM,CAAC;IACxD,MAAMG,MAAoC,CAAC;IAC3C,MAAMT,OAAOQ,MAAM,CAAC,OAAO;IAC3B,IAAIL,YAAYO,QAAQ,CAACV,SAAUA,CAAAA,SAAS,YAAYO,IAAG,GAAIE,IAAIT,IAAI,GAAGA;IAC1E,MAAMC,QAAQO,MAAM,CAAC,QAAQ;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,MAAM;YAAO;QACjH,KAAK;YACH,OAAOsD,KAAKtB,mBAAmBG,QAAQD,WAAW;IACtD;AACF"}
@@ -0,0 +1,211 @@
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
+ */
17
+ /** Where the records of a resource live: the organization, or one site. */
18
+ export type TransferScope = 'org' | 'host';
19
+ /** Rows in a file, or a set of site items carried as a package. */
20
+ export type TransferKind = 'records' | 'package';
21
+ /** The file formats a resource can be read from and written to. */
22
+ export type TransferFormat = 'csv' | 'json' | 'ndjson';
23
+ export declare const TRANSFER_FORMATS: readonly TransferFormat[];
24
+ /** The bounds one transfer of a resource is held to. */
25
+ export interface TransferLimits {
26
+ /** The most rows (or items) one file may carry. */
27
+ maxRows: number;
28
+ /** The most bytes one uploaded file may carry, when the resource bounds it. */
29
+ maxBytes?: number;
30
+ }
31
+ /** One resource as its owning plugin declares it. */
32
+ export interface TransferResourceDescriptor {
33
+ /** Stable key, lowercase words joined by `-` or `.` — the URL and storage name. */
34
+ key: string;
35
+ /** What a person calls one batch of it ("People", "Pages"). */
36
+ label: string;
37
+ /** One record ("Person", "Page"); defaults to `label`. */
38
+ singularLabel?: string;
39
+ scope: TransferScope;
40
+ kinds: readonly TransferKind[];
41
+ formats: readonly TransferFormat[];
42
+ limits?: TransferLimits;
43
+ /** One sentence on what moves, shown on the hub. */
44
+ description?: string;
45
+ /**
46
+ * The resource is moved one instance at a time — one dataset's records, not
47
+ * every dataset's — so every key that reaches it names the instance as
48
+ * `<key>:<instance>` ({@link transferResourceInstanceKey}). A job, a
49
+ * person's remembered choices and the one-running-import rule are then kept
50
+ * per instance, and the plugin's hooks read which one from the context's
51
+ * `resource` ({@link transferResourceInstanceOf}).
52
+ */
53
+ instances?: boolean;
54
+ /**
55
+ * Any member may EXPORT the records (and open the export dialog), as far
56
+ * as their scope lets them see them — a collaborator only on a site they
57
+ * reach — because the rules let every member read them (a dataset's
58
+ * records). See `data-transfer/access.ts`.
59
+ */
60
+ readableByMembers?: boolean;
61
+ /**
62
+ * The permission that admits a member to EXPORT the records, beside
63
+ * `data.manage`, which always does. A resource that declares neither this
64
+ * nor `readableByMembers` exports for `data.manage` alone. Importing needs
65
+ * `data.manage` either way.
66
+ */
67
+ readPermission?: string;
68
+ /**
69
+ * The resource is exported and never imported — a record of work done (a
70
+ * CRM's logged activities) or a setup edited on its own page. The upload
71
+ * refuses it, its plugin registers no `apply` or `revert`, and a surface
72
+ * offers only Export (AGL-3528).
73
+ */
74
+ exportOnly?: boolean;
75
+ /**
76
+ * The plan feature (an `OrgFeatureFlags` key, `crm`) a workspace's plan
77
+ * must carry to move these records — the flag the owning plugin's console
78
+ * surfaces are gated by. Without it every route of every intent refuses
79
+ * with 403 `plan_required` and the feature as `code`, staff included, and
80
+ * the console offers neither button (AGL-3555). See `data-transfer/access.ts`.
81
+ */
82
+ featureFlag?: string;
83
+ /**
84
+ * The intents that stay open on every plan despite `featureFlag` — an
85
+ * obligation rather than a feature: the CRM's people files are exported
86
+ * on Free, because taking out the people a workspace holds is every
87
+ * plan's right, while importing them is the CRM.
88
+ */
89
+ featureFlagExempt?: readonly ('import' | 'export')[];
90
+ /**
91
+ * The only roles that may IMPORT the records, where the records are —
92
+ * the member's role on the named site (`hostRoleFor`: a workspace owner or
93
+ * admin is every site's admin), or on the workspace for a workspace's
94
+ * records — on top of `data.manage`, for a resource stricter than the
95
+ * permission: gift cards, which an import issues as spendable money, are
96
+ * imported by `["admin"]` alone (AGL-3554). The transfer gate refuses
97
+ * anyone else on every import step, the console's `can('import')` answers
98
+ * `false` for them, and the hub offers them no Import. See
99
+ * `data-transfer/access.ts`.
100
+ */
101
+ importRoles?: readonly TransferImportRole[];
102
+ }
103
+ /** A role {@link TransferResourceDescriptor.importRoles} names: a site role. */
104
+ export type TransferImportRole = 'admin' | 'editor' | 'author' | 'viewer';
105
+ /** Every {@link TransferImportRole}, strongest first. */
106
+ export declare const TRANSFER_IMPORT_ROLES: readonly TransferImportRole[];
107
+ /** Whether a file may be imported into the resource. */
108
+ export declare function transferResourceImports(descriptor: Pick<TransferResourceDescriptor, 'exportOnly'>): boolean;
109
+ /** What a field means, which decides how a cell is read and written. */
110
+ export type TransferFieldType = 'text' | 'longText' | 'email' | 'phone' | 'url' | 'number' | 'integer' | 'currency' | 'percent' | 'boolean' | 'date' | 'datetime' | 'picklist' | 'multiPicklist' | 'tags' | 'address' | 'lookup' | 'json' | 'list';
111
+ export declare const TRANSFER_FIELD_TYPES: readonly TransferFieldType[];
112
+ /**
113
+ * The types whose value is a list, and so the only ones a file can append to:
114
+ * picklist values, tags (kept lower-case), and a `list` of free text items
115
+ * kept as typed.
116
+ */
117
+ export declare const TRANSFER_LIST_FIELD_TYPES: readonly TransferFieldType[];
118
+ /**
119
+ * What a lookup field points at: another resource, found by one of its
120
+ * match keys (a company by domain, an owner by email). A `lookup` field
121
+ * holds one record; a `list` field that names a target holds several, each
122
+ * item resolved on its own (a dataset's multi-reference).
123
+ */
124
+ export interface TransferLookupTarget {
125
+ /** The resource key of the target. */
126
+ resource: string;
127
+ /** The target's field ids a cell may name it by, in the order they are tried. */
128
+ by: readonly string[];
129
+ /** Whether an unresolved value may be offered "create it" in the wizard. */
130
+ creatable?: boolean;
131
+ }
132
+ /** One field of a resource. */
133
+ export interface TransferField {
134
+ /** Stable id; a custom field's id is `custom:<key>`. */
135
+ id: string;
136
+ label: string;
137
+ /** The group id the field is listed under in a picker. */
138
+ group?: string;
139
+ type: TransferFieldType;
140
+ /** A new record cannot be created without it. */
141
+ required?: boolean;
142
+ /** Exported, never written from a file. */
143
+ readOnly?: boolean;
144
+ /** Computed from other fields; exported, never written from a file. */
145
+ derived?: boolean;
146
+ /** Written by the platform (id, created, updated); exported, never written. */
147
+ system?: boolean;
148
+ /** Defined by the organization rather than the resource. */
149
+ custom?: boolean;
150
+ /** May be mapped on import to identify an existing record even when it is never written. */
151
+ matchKey?: boolean;
152
+ /** Header spellings that mean this field, beside its label and id. */
153
+ aliases?: readonly string[];
154
+ /** The picklist whose values a `picklist` or `multiPicklist` field holds. */
155
+ picklistId?: string;
156
+ /** What a `lookup` field resolves to. */
157
+ lookup?: TransferLookupTarget;
158
+ /** The longest text the field stores. */
159
+ maxLength?: number;
160
+ /** One sentence shown beside the field in a picker. */
161
+ description?: string;
162
+ }
163
+ /** The field id every resource uses for the record's Aglyn id. */
164
+ export declare const TRANSFER_ID_FIELD = "id";
165
+ /** Whether values of `type` are lists. */
166
+ export declare function isTransferListType(type: TransferFieldType): boolean;
167
+ /**
168
+ * Whether `field` names records of a target — a `lookup` field, or a `list`
169
+ * field whose items do — so the job engine resolves its values to ids.
170
+ */
171
+ export declare function isTransferLookupField(field: TransferField | null | undefined): field is TransferField & {
172
+ lookup: TransferLookupTarget;
173
+ };
174
+ /** Whether a file's cell may be WRITTEN to `field`. */
175
+ export declare function isTransferFieldWritable(field: TransferField): boolean;
176
+ /** Whether a file's column may be MAPPED to `field` on import — written, or read to match. */
177
+ export declare function isTransferFieldImportable(field: TransferField): boolean;
178
+ /** Whether `key` is a well-formed resource key. */
179
+ export declare function isTransferResourceKey(key: unknown): key is string;
180
+ /**
181
+ * What is wrong with a declaration, as sentences; empty when nothing is.
182
+ * Checked when a plugin registers, so a malformed one fails loudly at
183
+ * startup rather than in a person's wizard.
184
+ */
185
+ export declare function transferResourceProblems(descriptor: TransferResourceDescriptor): string[];
186
+ /** What separates a resource's key from the instance it names: `data.dataset:<datasetId>`. */
187
+ export declare const TRANSFER_INSTANCE_SEPARATOR = ":";
188
+ /** Whether `instance` can be named in a key: letters, digits, `_` and `-`, at most 128. */
189
+ export declare function isTransferResourceInstance(instance: unknown): instance is string;
190
+ /**
191
+ * The key that names one instance of a resource declared with `instances`:
192
+ * `data.dataset` and `abc123` make `data.dataset:abc123`. Throws for an
193
+ * instance a key cannot carry, so a malformed id never becomes a job's key.
194
+ */
195
+ export declare function transferResourceInstanceKey(key: string, instance: string): string;
196
+ /**
197
+ * A key read as the declared resource and the instance it names, if any:
198
+ * `data.dataset:abc123` is `{ key: 'data.dataset', instance: 'abc123' }`, and
199
+ * `people` is `{ key: 'people', instance: null }`. A suffix that is not a
200
+ * well-formed instance is left in `key`, which then names no declaration.
201
+ */
202
+ export declare function parseTransferResourceKey(key: string): {
203
+ key: string;
204
+ instance: string | null;
205
+ };
206
+ /** The instance a hook's context names (`ctx.resource`), or `null` for a resource without instances. */
207
+ export declare function transferResourceInstanceOf(context: {
208
+ resource: string;
209
+ }): string | null;
210
+ /** What is wrong with a field list, as sentences; empty when nothing is. */
211
+ export declare function transferFieldProblems(fields: readonly TransferField[]): string[];
@@ -0,0 +1,241 @@
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
+ */ /*==========================================
17
+ * TRANSFER RESOURCES — what can be imported or exported, and its fields.
18
+ *
19
+ * A resource is one kind of thing a person moves in or out of Aglyn: a
20
+ * collection of records (rows in a file) or a set of site items (a
21
+ * package). The plugin that owns the thing declares it; this module only
22
+ * says what a declaration looks like and what a field may be, so every
23
+ * importer, exporter and wizard reads the same shape.
24
+ *
25
+ * ## A field says what it is, not how it is stored
26
+ *
27
+ * `type` is the field's meaning to a person — an email, a currency amount,
28
+ * a picklist — which is what decides how a cell is read (`derive.ts`), how
29
+ * a header is guessed (`header-match.ts`) and which policies make sense
30
+ * (`policy.ts`: only a list can be appended to). Where the value lives in
31
+ * storage is the owning plugin's business.
32
+ *
33
+ * ## Read-only, derived and system fields export but never import
34
+ *
35
+ * A derived field (a score, a count) is computed from others; a system
36
+ * field (the Aglyn id, created/updated times) is written by the platform.
37
+ * Both are offered on export because a person wants them in the file, and
38
+ * neither is ever written from a file. A `matchKey` field — the Aglyn id
39
+ * above all — may still be MAPPED on import, because it identifies which
40
+ * existing record a row is about; it is read, never written.
41
+ *=========================================*/ /** Where the records of a resource live: the organization, or one site. */ export const TRANSFER_FORMATS = [
42
+ 'csv',
43
+ 'json',
44
+ 'ndjson'
45
+ ];
46
+ /** Every {@link TransferImportRole}, strongest first. */ export const TRANSFER_IMPORT_ROLES = [
47
+ 'admin',
48
+ 'editor',
49
+ 'author',
50
+ 'viewer'
51
+ ];
52
+ /** Whether a file may be imported into the resource. */ export function transferResourceImports(descriptor) {
53
+ return descriptor.exportOnly !== true;
54
+ }
55
+ export const TRANSFER_FIELD_TYPES = [
56
+ 'text',
57
+ 'longText',
58
+ 'email',
59
+ 'phone',
60
+ 'url',
61
+ 'number',
62
+ 'integer',
63
+ 'currency',
64
+ 'percent',
65
+ 'boolean',
66
+ 'date',
67
+ 'datetime',
68
+ 'picklist',
69
+ 'multiPicklist',
70
+ 'tags',
71
+ 'address',
72
+ 'lookup',
73
+ 'json',
74
+ 'list'
75
+ ];
76
+ /**
77
+ * The types whose value is a list, and so the only ones a file can append to:
78
+ * picklist values, tags (kept lower-case), and a `list` of free text items
79
+ * kept as typed.
80
+ */ export const TRANSFER_LIST_FIELD_TYPES = [
81
+ 'multiPicklist',
82
+ 'tags',
83
+ 'list'
84
+ ];
85
+ /** The field id every resource uses for the record's Aglyn id. */ export const TRANSFER_ID_FIELD = 'id';
86
+ /** Whether values of `type` are lists. */ export function isTransferListType(type) {
87
+ return TRANSFER_LIST_FIELD_TYPES.includes(type);
88
+ }
89
+ /**
90
+ * Whether `field` names records of a target — a `lookup` field, or a `list`
91
+ * field whose items do — so the job engine resolves its values to ids.
92
+ */ export function isTransferLookupField(field) {
93
+ var _field_lookup, _field_lookup_by;
94
+ return Boolean(field && (field.type === 'lookup' || field.type === 'list') && ((_field_lookup = field.lookup) == null ? void 0 : _field_lookup.resource) && ((_field_lookup_by = field.lookup.by) == null ? void 0 : _field_lookup_by.length));
95
+ }
96
+ /** Whether a file's cell may be WRITTEN to `field`. */ export function isTransferFieldWritable(field) {
97
+ return !field.readOnly && !field.derived && !field.system;
98
+ }
99
+ /** Whether a file's column may be MAPPED to `field` on import — written, or read to match. */ export function isTransferFieldImportable(field) {
100
+ return isTransferFieldWritable(field) || Boolean(field.matchKey);
101
+ }
102
+ const RESOURCE_KEY = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/;
103
+ /** Whether `key` is a well-formed resource key. */ export function isTransferResourceKey(key) {
104
+ return typeof key === 'string' && key.length <= 64 && RESOURCE_KEY.test(key);
105
+ }
106
+ /**
107
+ * What is wrong with a declaration, as sentences; empty when nothing is.
108
+ * Checked when a plugin registers, so a malformed one fails loudly at
109
+ * startup rather than in a person's wizard.
110
+ */ export function transferResourceProblems(descriptor) {
111
+ var _descriptor_label, _descriptor_kinds, _descriptor_formats;
112
+ var _descriptor_kinds1, _descriptor_formats1;
113
+ const problems = [];
114
+ if (!isTransferResourceKey(descriptor.key)) {
115
+ problems.push(`"${String(descriptor.key)}" is not a resource key (lowercase words joined by - or .).`);
116
+ }
117
+ if (!String((_descriptor_label = descriptor.label) != null ? _descriptor_label : '').trim()) problems.push(`${descriptor.key} has no label.`);
118
+ if (descriptor.scope !== 'org' && descriptor.scope !== 'host') {
119
+ problems.push(`${descriptor.key} has scope "${String(descriptor.scope)}"; it must be org or host.`);
120
+ }
121
+ if (!((_descriptor_kinds1 = descriptor.kinds) == null ? void 0 : _descriptor_kinds1.length)) problems.push(`${descriptor.key} declares no kind.`);
122
+ for (const kind of (_descriptor_kinds = descriptor.kinds) != null ? _descriptor_kinds : []){
123
+ if (kind !== 'records' && kind !== 'package') problems.push(`${descriptor.key} has unknown kind "${String(kind)}".`);
124
+ }
125
+ if (!((_descriptor_formats1 = descriptor.formats) == null ? void 0 : _descriptor_formats1.length)) problems.push(`${descriptor.key} declares no format.`);
126
+ for (const format of (_descriptor_formats = descriptor.formats) != null ? _descriptor_formats : []){
127
+ if (!TRANSFER_FORMATS.includes(format)) problems.push(`${descriptor.key} has unknown format "${String(format)}".`);
128
+ }
129
+ const limits = descriptor.limits;
130
+ if (limits && !(Number.isInteger(limits.maxRows) && limits.maxRows > 0)) {
131
+ problems.push(`${descriptor.key} has a row limit that is not a positive whole number.`);
132
+ }
133
+ if ((limits == null ? void 0 : limits.maxBytes) !== undefined && !(Number.isInteger(limits.maxBytes) && limits.maxBytes > 0)) {
134
+ problems.push(`${descriptor.key} has a byte limit that is not a positive whole number.`);
135
+ }
136
+ if (descriptor.instances !== undefined && typeof descriptor.instances !== 'boolean') {
137
+ problems.push(`${descriptor.key} says "instances" with something other than true or false.`);
138
+ }
139
+ if (descriptor.readPermission !== undefined && !String(descriptor.readPermission).trim()) {
140
+ problems.push(`${descriptor.key} names an empty read permission.`);
141
+ }
142
+ if (descriptor.readableByMembers !== undefined && typeof descriptor.readableByMembers !== 'boolean') {
143
+ problems.push(`${descriptor.key} says "readableByMembers" with something other than true or false.`);
144
+ }
145
+ if (descriptor.readableByMembers === true && descriptor.readPermission !== undefined) {
146
+ problems.push(`${descriptor.key} is readable by every member and names a read permission; say one.`);
147
+ }
148
+ if (descriptor.exportOnly !== undefined && typeof descriptor.exportOnly !== 'boolean') {
149
+ problems.push(`${descriptor.key} says "exportOnly" with something other than true or false.`);
150
+ }
151
+ if (descriptor.featureFlag !== undefined && !String(descriptor.featureFlag).trim()) {
152
+ problems.push(`${descriptor.key} names an empty plan feature.`);
153
+ }
154
+ if (descriptor.importRoles !== undefined) {
155
+ const roles = descriptor.importRoles;
156
+ if (descriptor.exportOnly === true) problems.push(`${descriptor.key} names who may import records it never imports.`);
157
+ if (!Array.isArray(roles) || !roles.length || roles.some((role)=>!TRANSFER_IMPORT_ROLES.includes(role))) {
158
+ problems.push(`${descriptor.key} names an import role that is not ${TRANSFER_IMPORT_ROLES.join(', ')}.`);
159
+ }
160
+ }
161
+ if (descriptor.featureFlagExempt !== undefined) {
162
+ const exempt = descriptor.featureFlagExempt;
163
+ if (descriptor.featureFlag === undefined) {
164
+ problems.push(`${descriptor.key} exempts intents from a plan feature it does not name.`);
165
+ }
166
+ if (!Array.isArray(exempt) || !exempt.length || exempt.some((intent)=>intent !== 'import' && intent !== 'export')) {
167
+ problems.push(`${descriptor.key} exempts something other than import or export from its plan feature.`);
168
+ }
169
+ }
170
+ return problems;
171
+ }
172
+ /** What separates a resource's key from the instance it names: `data.dataset:<datasetId>`. */ export const TRANSFER_INSTANCE_SEPARATOR = ':';
173
+ const INSTANCE_ID = /^[A-Za-z0-9_-]{1,128}$/;
174
+ /** Whether `instance` can be named in a key: letters, digits, `_` and `-`, at most 128. */ export function isTransferResourceInstance(instance) {
175
+ return typeof instance === 'string' && INSTANCE_ID.test(instance);
176
+ }
177
+ /**
178
+ * The key that names one instance of a resource declared with `instances`:
179
+ * `data.dataset` and `abc123` make `data.dataset:abc123`. Throws for an
180
+ * instance a key cannot carry, so a malformed id never becomes a job's key.
181
+ */ export function transferResourceInstanceKey(key, instance) {
182
+ if (!isTransferResourceInstance(instance)) {
183
+ throw new Error(`"${String(instance)}" cannot name an instance of ${key}.`);
184
+ }
185
+ return `${key}${TRANSFER_INSTANCE_SEPARATOR}${instance}`;
186
+ }
187
+ /**
188
+ * A key read as the declared resource and the instance it names, if any:
189
+ * `data.dataset:abc123` is `{ key: 'data.dataset', instance: 'abc123' }`, and
190
+ * `people` is `{ key: 'people', instance: null }`. A suffix that is not a
191
+ * well-formed instance is left in `key`, which then names no declaration.
192
+ */ export function parseTransferResourceKey(key) {
193
+ const text = String(key != null ? key : '').trim();
194
+ const at = text.indexOf(TRANSFER_INSTANCE_SEPARATOR);
195
+ if (at < 0) return {
196
+ key: text,
197
+ instance: null
198
+ };
199
+ const instance = text.slice(at + 1);
200
+ return isTransferResourceInstance(instance) ? {
201
+ key: text.slice(0, at),
202
+ instance
203
+ } : {
204
+ key: text,
205
+ instance: null
206
+ };
207
+ }
208
+ /** The instance a hook's context names (`ctx.resource`), or `null` for a resource without instances. */ export function transferResourceInstanceOf(context) {
209
+ return parseTransferResourceKey(context.resource).instance;
210
+ }
211
+ /** What is wrong with a field list, as sentences; empty when nothing is. */ export function transferFieldProblems(fields) {
212
+ const problems = [];
213
+ const seen = new Set();
214
+ for (const field of fields){
215
+ var _field_id;
216
+ var _field_lookup_by, _field_lookup;
217
+ const id = String((_field_id = field.id) != null ? _field_id : '');
218
+ if (!id.trim()) {
219
+ problems.push(`A field labeled "${field.label}" has no id.`);
220
+ continue;
221
+ }
222
+ if (seen.has(id)) problems.push(`Field "${id}" is declared twice.`);
223
+ seen.add(id);
224
+ if (!TRANSFER_FIELD_TYPES.includes(field.type)) problems.push(`Field "${id}" has unknown type "${String(field.type)}".`);
225
+ if ((field.type === 'picklist' || field.type === 'multiPicklist') && !field.picklistId) {
226
+ problems.push(`Field "${id}" is a picklist with no picklistId.`);
227
+ }
228
+ if ((field.type === 'lookup' || field.type === 'list' && field.lookup) && !((_field_lookup = field.lookup) == null ? void 0 : (_field_lookup_by = _field_lookup.by) == null ? void 0 : _field_lookup_by.length)) {
229
+ problems.push(`Field "${id}" is a lookup that names no target field.`);
230
+ }
231
+ if (field.lookup && field.type !== 'lookup' && field.type !== 'list') {
232
+ problems.push(`Field "${id}" names a lookup target, which only a lookup or list field may.`);
233
+ }
234
+ if (field.required && !isTransferFieldWritable(field)) {
235
+ problems.push(`Field "${id}" is required but can never be written.`);
236
+ }
237
+ }
238
+ return problems;
239
+ }
240
+
241
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/data-transfer/resource.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\n/*==========================================\n * TRANSFER RESOURCES — what can be imported or exported, and its fields.\n *\n * A resource is one kind of thing a person moves in or out of Aglyn: a\n * collection of records (rows in a file) or a set of site items (a\n * package). The plugin that owns the thing declares it; this module only\n * says what a declaration looks like and what a field may be, so every\n * importer, exporter and wizard reads the same shape.\n *\n * ## A field says what it is, not how it is stored\n *\n * `type` is the field's meaning to a person — an email, a currency amount,\n * a picklist — which is what decides how a cell is read (`derive.ts`), how\n * a header is guessed (`header-match.ts`) and which policies make sense\n * (`policy.ts`: only a list can be appended to). Where the value lives in\n * storage is the owning plugin's business.\n *\n * ## Read-only, derived and system fields export but never import\n *\n * A derived field (a score, a count) is computed from others; a system\n * field (the Aglyn id, created/updated times) is written by the platform.\n * Both are offered on export because a person wants them in the file, and\n * neither is ever written from a file. A `matchKey` field — the Aglyn id\n * above all — may still be MAPPED on import, because it identifies which\n * existing record a row is about; it is read, never written.\n *=========================================*/\n\n/** Where the records of a resource live: the organization, or one site. */\nexport type TransferScope = 'org' | 'host'\n\n/** Rows in a file, or a set of site items carried as a package. */\nexport type TransferKind = 'records' | 'package'\n\n/** The file formats a resource can be read from and written to. */\nexport type TransferFormat = 'csv' | 'json' | 'ndjson'\n\nexport const TRANSFER_FORMATS: readonly TransferFormat[] = ['csv', 'json', 'ndjson']\n\n/** The bounds one transfer of a resource is held to. */\nexport interface TransferLimits {\n /** The most rows (or items) one file may carry. */\n maxRows: number\n /** The most bytes one uploaded file may carry, when the resource bounds it. */\n maxBytes?: number\n}\n\n/** One resource as its owning plugin declares it. */\nexport interface TransferResourceDescriptor {\n /** Stable key, lowercase words joined by `-` or `.` — the URL and storage name. */\n key: string\n /** What a person calls one batch of it (\"People\", \"Pages\"). */\n label: string\n /** One record (\"Person\", \"Page\"); defaults to `label`. */\n singularLabel?: string\n scope: TransferScope\n kinds: readonly TransferKind[]\n formats: readonly TransferFormat[]\n limits?: TransferLimits\n /** One sentence on what moves, shown on the hub. */\n description?: string\n /**\n * The resource is moved one instance at a time — one dataset's records, not\n * every dataset's — so every key that reaches it names the instance as\n * `<key>:<instance>` ({@link transferResourceInstanceKey}). A job, a\n * person's remembered choices and the one-running-import rule are then kept\n * per instance, and the plugin's hooks read which one from the context's\n * `resource` ({@link transferResourceInstanceOf}).\n */\n instances?: boolean\n /**\n * Any member may EXPORT the records (and open the export dialog), as far\n * as their scope lets them see them — a collaborator only on a site they\n * reach — because the rules let every member read them (a dataset's\n * records). See `data-transfer/access.ts`.\n */\n readableByMembers?: boolean\n /**\n * The permission that admits a member to EXPORT the records, beside\n * `data.manage`, which always does. A resource that declares neither this\n * nor `readableByMembers` exports for `data.manage` alone. Importing needs\n * `data.manage` either way.\n */\n readPermission?: string\n /**\n * The resource is exported and never imported — a record of work done (a\n * CRM's logged activities) or a setup edited on its own page. The upload\n * refuses it, its plugin registers no `apply` or `revert`, and a surface\n * offers only Export (AGL-3528).\n */\n exportOnly?: boolean\n /**\n * The plan feature (an `OrgFeatureFlags` key, `crm`) a workspace's plan\n * must carry to move these records — the flag the owning plugin's console\n * surfaces are gated by. Without it every route of every intent refuses\n * with 403 `plan_required` and the feature as `code`, staff included, and\n * the console offers neither button (AGL-3555). See `data-transfer/access.ts`.\n */\n featureFlag?: string\n /**\n * The intents that stay open on every plan despite `featureFlag` — an\n * obligation rather than a feature: the CRM's people files are exported\n * on Free, because taking out the people a workspace holds is every\n * plan's right, while importing them is the CRM.\n */\n featureFlagExempt?: readonly ('import' | 'export')[]\n /**\n * The only roles that may IMPORT the records, where the records are —\n * the member's role on the named site (`hostRoleFor`: a workspace owner or\n * admin is every site's admin), or on the workspace for a workspace's\n * records — on top of `data.manage`, for a resource stricter than the\n * permission: gift cards, which an import issues as spendable money, are\n * imported by `[\"admin\"]` alone (AGL-3554). The transfer gate refuses\n * anyone else on every import step, the console's `can('import')` answers\n * `false` for them, and the hub offers them no Import. See\n * `data-transfer/access.ts`.\n */\n importRoles?: readonly TransferImportRole[]\n}\n\n/** A role {@link TransferResourceDescriptor.importRoles} names: a site role. */\nexport type TransferImportRole = 'admin' | 'editor' | 'author' | 'viewer'\n\n/** Every {@link TransferImportRole}, strongest first. */\nexport const TRANSFER_IMPORT_ROLES: readonly TransferImportRole[] = ['admin', 'editor', 'author', 'viewer']\n\n/** Whether a file may be imported into the resource. */\nexport function transferResourceImports(descriptor: Pick<TransferResourceDescriptor, 'exportOnly'>): boolean {\n return descriptor.exportOnly !== true\n}\n\n/** What a field means, which decides how a cell is read and written. */\nexport type TransferFieldType =\n | 'text'\n | 'longText'\n | 'email'\n | 'phone'\n | 'url'\n | 'number'\n | 'integer'\n | 'currency'\n | 'percent'\n | 'boolean'\n | 'date'\n | 'datetime'\n | 'picklist'\n | 'multiPicklist'\n | 'tags'\n | 'address'\n | 'lookup'\n | 'json'\n | 'list'\n\nexport const TRANSFER_FIELD_TYPES: readonly TransferFieldType[] = [\n 'text',\n 'longText',\n 'email',\n 'phone',\n 'url',\n 'number',\n 'integer',\n 'currency',\n 'percent',\n 'boolean',\n 'date',\n 'datetime',\n 'picklist',\n 'multiPicklist',\n 'tags',\n 'address',\n 'lookup',\n 'json',\n 'list',\n]\n\n/**\n * The types whose value is a list, and so the only ones a file can append to:\n * picklist values, tags (kept lower-case), and a `list` of free text items\n * kept as typed.\n */\nexport const TRANSFER_LIST_FIELD_TYPES: readonly TransferFieldType[] = ['multiPicklist', 'tags', 'list']\n\n/**\n * What a lookup field points at: another resource, found by one of its\n * match keys (a company by domain, an owner by email). A `lookup` field\n * holds one record; a `list` field that names a target holds several, each\n * item resolved on its own (a dataset's multi-reference).\n */\nexport interface TransferLookupTarget {\n /** The resource key of the target. */\n resource: string\n /** The target's field ids a cell may name it by, in the order they are tried. */\n by: readonly string[]\n /** Whether an unresolved value may be offered \"create it\" in the wizard. */\n creatable?: boolean\n}\n\n/** One field of a resource. */\nexport interface TransferField {\n /** Stable id; a custom field's id is `custom:<key>`. */\n id: string\n label: string\n /** The group id the field is listed under in a picker. */\n group?: string\n type: TransferFieldType\n /** A new record cannot be created without it. */\n required?: boolean\n /** Exported, never written from a file. */\n readOnly?: boolean\n /** Computed from other fields; exported, never written from a file. */\n derived?: boolean\n /** Written by the platform (id, created, updated); exported, never written. */\n system?: boolean\n /** Defined by the organization rather than the resource. */\n custom?: boolean\n /** May be mapped on import to identify an existing record even when it is never written. */\n matchKey?: boolean\n /** Header spellings that mean this field, beside its label and id. */\n aliases?: readonly string[]\n /** The picklist whose values a `picklist` or `multiPicklist` field holds. */\n picklistId?: string\n /** What a `lookup` field resolves to. */\n lookup?: TransferLookupTarget\n /** The longest text the field stores. */\n maxLength?: number\n /** One sentence shown beside the field in a picker. */\n description?: string\n}\n\n/** The field id every resource uses for the record's Aglyn id. */\nexport const TRANSFER_ID_FIELD = 'id'\n\n/** Whether values of `type` are lists. */\nexport function isTransferListType(type: TransferFieldType): boolean {\n return TRANSFER_LIST_FIELD_TYPES.includes(type)\n}\n\n/**\n * Whether `field` names records of a target — a `lookup` field, or a `list`\n * field whose items do — so the job engine resolves its values to ids.\n */\nexport function isTransferLookupField(\n field: TransferField | null | undefined,\n): field is TransferField & { lookup: TransferLookupTarget } {\n return Boolean(\n field &&\n (field.type === 'lookup' || field.type === 'list') &&\n field.lookup?.resource &&\n field.lookup.by?.length,\n )\n}\n\n/** Whether a file's cell may be WRITTEN to `field`. */\nexport function isTransferFieldWritable(field: TransferField): boolean {\n return !field.readOnly && !field.derived && !field.system\n}\n\n/** Whether a file's column may be MAPPED to `field` on import — written, or read to match. */\nexport function isTransferFieldImportable(field: TransferField): boolean {\n return isTransferFieldWritable(field) || Boolean(field.matchKey)\n}\n\nconst RESOURCE_KEY = /^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/\n\n/** Whether `key` is a well-formed resource key. */\nexport function isTransferResourceKey(key: unknown): key is string {\n return typeof key === 'string' && key.length <= 64 && RESOURCE_KEY.test(key)\n}\n\n/**\n * What is wrong with a declaration, as sentences; empty when nothing is.\n * Checked when a plugin registers, so a malformed one fails loudly at\n * startup rather than in a person's wizard.\n */\nexport function transferResourceProblems(descriptor: TransferResourceDescriptor): string[] {\n const problems: string[] = []\n if (!isTransferResourceKey(descriptor.key)) {\n problems.push(`\"${String(descriptor.key)}\" is not a resource key (lowercase words joined by - or .).`)\n }\n if (!String(descriptor.label ?? '').trim()) problems.push(`${descriptor.key} has no label.`)\n if (descriptor.scope !== 'org' && descriptor.scope !== 'host') {\n problems.push(`${descriptor.key} has scope \"${String(descriptor.scope)}\"; it must be org or host.`)\n }\n if (!descriptor.kinds?.length) problems.push(`${descriptor.key} declares no kind.`)\n for (const kind of descriptor.kinds ?? []) {\n if (kind !== 'records' && kind !== 'package') problems.push(`${descriptor.key} has unknown kind \"${String(kind)}\".`)\n }\n if (!descriptor.formats?.length) problems.push(`${descriptor.key} declares no format.`)\n for (const format of descriptor.formats ?? []) {\n if (!TRANSFER_FORMATS.includes(format)) problems.push(`${descriptor.key} has unknown format \"${String(format)}\".`)\n }\n const limits = descriptor.limits\n if (limits && !(Number.isInteger(limits.maxRows) && limits.maxRows > 0)) {\n problems.push(`${descriptor.key} has a row limit that is not a positive whole number.`)\n }\n if (limits?.maxBytes !== undefined && !(Number.isInteger(limits.maxBytes) && limits.maxBytes > 0)) {\n problems.push(`${descriptor.key} has a byte limit that is not a positive whole number.`)\n }\n if (descriptor.instances !== undefined && typeof descriptor.instances !== 'boolean') {\n problems.push(`${descriptor.key} says \"instances\" with something other than true or false.`)\n }\n if (descriptor.readPermission !== undefined && !String(descriptor.readPermission).trim()) {\n problems.push(`${descriptor.key} names an empty read permission.`)\n }\n if (descriptor.readableByMembers !== undefined && typeof descriptor.readableByMembers !== 'boolean') {\n problems.push(`${descriptor.key} says \"readableByMembers\" with something other than true or false.`)\n }\n if (descriptor.readableByMembers === true && descriptor.readPermission !== undefined) {\n problems.push(`${descriptor.key} is readable by every member and names a read permission; say one.`)\n }\n if (descriptor.exportOnly !== undefined && typeof descriptor.exportOnly !== 'boolean') {\n problems.push(`${descriptor.key} says \"exportOnly\" with something other than true or false.`)\n }\n if (descriptor.featureFlag !== undefined && !String(descriptor.featureFlag).trim()) {\n problems.push(`${descriptor.key} names an empty plan feature.`)\n }\n if (descriptor.importRoles !== undefined) {\n const roles = descriptor.importRoles\n if (descriptor.exportOnly === true) problems.push(`${descriptor.key} names who may import records it never imports.`)\n if (!Array.isArray(roles) || !roles.length || roles.some((role) => !TRANSFER_IMPORT_ROLES.includes(role))) {\n problems.push(`${descriptor.key} names an import role that is not ${TRANSFER_IMPORT_ROLES.join(', ')}.`)\n }\n }\n if (descriptor.featureFlagExempt !== undefined) {\n const exempt = descriptor.featureFlagExempt\n if (descriptor.featureFlag === undefined) {\n problems.push(`${descriptor.key} exempts intents from a plan feature it does not name.`)\n }\n if (!Array.isArray(exempt) || !exempt.length || exempt.some((intent) => intent !== 'import' && intent !== 'export')) {\n problems.push(`${descriptor.key} exempts something other than import or export from its plan feature.`)\n }\n }\n return problems\n}\n\n/** What separates a resource's key from the instance it names: `data.dataset:<datasetId>`. */\nexport const TRANSFER_INSTANCE_SEPARATOR = ':'\n\nconst INSTANCE_ID = /^[A-Za-z0-9_-]{1,128}$/\n\n/** Whether `instance` can be named in a key: letters, digits, `_` and `-`, at most 128. */\nexport function isTransferResourceInstance(instance: unknown): instance is string {\n return typeof instance === 'string' && INSTANCE_ID.test(instance)\n}\n\n/**\n * The key that names one instance of a resource declared with `instances`:\n * `data.dataset` and `abc123` make `data.dataset:abc123`. Throws for an\n * instance a key cannot carry, so a malformed id never becomes a job's key.\n */\nexport function transferResourceInstanceKey(key: string, instance: string): string {\n if (!isTransferResourceInstance(instance)) {\n throw new Error(`\"${String(instance)}\" cannot name an instance of ${key}.`)\n }\n return `${key}${TRANSFER_INSTANCE_SEPARATOR}${instance}`\n}\n\n/**\n * A key read as the declared resource and the instance it names, if any:\n * `data.dataset:abc123` is `{ key: 'data.dataset', instance: 'abc123' }`, and\n * `people` is `{ key: 'people', instance: null }`. A suffix that is not a\n * well-formed instance is left in `key`, which then names no declaration.\n */\nexport function parseTransferResourceKey(key: string): { key: string; instance: string | null } {\n const text = String(key ?? '').trim()\n const at = text.indexOf(TRANSFER_INSTANCE_SEPARATOR)\n if (at < 0) return { key: text, instance: null }\n const instance = text.slice(at + 1)\n return isTransferResourceInstance(instance) ? { key: text.slice(0, at), instance } : { key: text, instance: null }\n}\n\n/** The instance a hook's context names (`ctx.resource`), or `null` for a resource without instances. */\nexport function transferResourceInstanceOf(context: { resource: string }): string | null {\n return parseTransferResourceKey(context.resource).instance\n}\n\n/** What is wrong with a field list, as sentences; empty when nothing is. */\nexport function transferFieldProblems(fields: readonly TransferField[]): string[] {\n const problems: string[] = []\n const seen = new Set<string>()\n for (const field of fields) {\n const id = String(field.id ?? '')\n if (!id.trim()) {\n problems.push(`A field labeled \"${field.label}\" has no id.`)\n continue\n }\n if (seen.has(id)) problems.push(`Field \"${id}\" is declared twice.`)\n seen.add(id)\n if (!TRANSFER_FIELD_TYPES.includes(field.type)) problems.push(`Field \"${id}\" has unknown type \"${String(field.type)}\".`)\n if ((field.type === 'picklist' || field.type === 'multiPicklist') && !field.picklistId) {\n problems.push(`Field \"${id}\" is a picklist with no picklistId.`)\n }\n if ((field.type === 'lookup' || (field.type === 'list' && field.lookup)) && !field.lookup?.by?.length) {\n problems.push(`Field \"${id}\" is a lookup that names no target field.`)\n }\n if (field.lookup && field.type !== 'lookup' && field.type !== 'list') {\n problems.push(`Field \"${id}\" names a lookup target, which only a lookup or list field may.`)\n }\n if (field.required && !isTransferFieldWritable(field)) {\n problems.push(`Field \"${id}\" is required but can never be written.`)\n }\n }\n return problems\n}\n"],"names":["TRANSFER_FORMATS","TRANSFER_IMPORT_ROLES","transferResourceImports","descriptor","exportOnly","TRANSFER_FIELD_TYPES","TRANSFER_LIST_FIELD_TYPES","TRANSFER_ID_FIELD","isTransferListType","type","includes","isTransferLookupField","field","Boolean","lookup","resource","by","length","isTransferFieldWritable","readOnly","derived","system","isTransferFieldImportable","matchKey","RESOURCE_KEY","isTransferResourceKey","key","test","transferResourceProblems","problems","push","String","label","trim","scope","kinds","kind","formats","format","limits","Number","isInteger","maxRows","maxBytes","undefined","instances","readPermission","readableByMembers","featureFlag","importRoles","roles","Array","isArray","some","role","join","featureFlagExempt","exempt","intent","TRANSFER_INSTANCE_SEPARATOR","INSTANCE_ID","isTransferResourceInstance","instance","transferResourceInstanceKey","Error","parseTransferResourceKey","text","at","indexOf","slice","transferResourceInstanceOf","context","transferFieldProblems","fields","seen","Set","id","has","add","picklistId","required"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;2CAyB2C,GAE3C,yEAAyE,GASzE,OAAO,MAAMA,mBAA8C;IAAC;IAAO;IAAQ;CAAS,CAAA;AAsFpF,uDAAuD,GACvD,OAAO,MAAMC,wBAAuD;IAAC;IAAS;IAAU;IAAU;CAAS,CAAA;AAE3G,sDAAsD,GACtD,OAAO,SAASC,wBAAwBC,UAA0D;IAChG,OAAOA,WAAWC,UAAU,KAAK;AACnC;AAwBA,OAAO,MAAMC,uBAAqD;IAChE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;CAIC,GACD,OAAO,MAAMC,4BAA0D;IAAC;IAAiB;IA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