@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,181 @@
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
+ /** The format tag every package carries. */
18
+ export declare const TRANSFER_PACKAGE_FORMAT = "aglyn-package";
19
+ /** The manifest version this module reads and writes. */
20
+ export declare const TRANSFER_PACKAGE_VERSION = 2;
21
+ /** An item another item needs. */
22
+ export interface PackageDependency {
23
+ kind: string;
24
+ id: string;
25
+ }
26
+ /** One item as the manifest lists it. */
27
+ export interface PackageManifestItem {
28
+ kind: string;
29
+ $id: string;
30
+ slug?: string;
31
+ name?: string;
32
+ contentHash: string;
33
+ deps: PackageDependency[];
34
+ }
35
+ export interface PackageManifest {
36
+ format: typeof TRANSFER_PACKAGE_FORMAT;
37
+ version: typeof TRANSFER_PACKAGE_VERSION;
38
+ items: PackageManifestItem[];
39
+ /** When the package was made (ms since epoch). */
40
+ createdAt?: number;
41
+ /** Where it came from, for the import screen ("Site: Acme"). */
42
+ source?: string;
43
+ }
44
+ /** A whole package: the manifest and each item's content by {@link packageItemKey}. */
45
+ export interface TransferPackage<T = unknown> {
46
+ manifest: PackageManifest;
47
+ items: Record<string, T>;
48
+ }
49
+ /** The key an item is filed under: `<kind>/<id>`. */
50
+ export declare function packageItemKey(item: {
51
+ kind: string;
52
+ $id?: string;
53
+ id?: string;
54
+ }): string;
55
+ /**
56
+ * JSON with every object's keys sorted, at every depth, and `undefined`
57
+ * dropped (as `JSON.stringify` drops it). Dates are their ISO string;
58
+ * a non-finite number is `null`. Two values that are the same data are
59
+ * the same text, whatever order their keys were written in.
60
+ */
61
+ export declare function stableJson(value: unknown): string;
62
+ /** The hash prefix every content hash carries. */
63
+ export declare const CONTENT_HASH_PREFIX = "sha256:";
64
+ /**
65
+ * The content hash of a value: `sha256:` + hex of its {@link stableJson}.
66
+ * Uses WebCrypto (`globalThis.crypto.subtle`), present in browsers and Node.
67
+ */
68
+ export declare function contentHash(value: unknown): Promise<string>;
69
+ /** A manifest read from a file, or why it cannot be. */
70
+ export type PackageManifestRead = {
71
+ ok: true;
72
+ manifest: PackageManifest;
73
+ } | {
74
+ ok: false;
75
+ problems: string[];
76
+ };
77
+ /**
78
+ * A manifest from untrusted JSON. Every problem is reported, not just the
79
+ * first: a wrong format or version, an item without a kind, id or hash, a
80
+ * malformed dependency, an id listed twice.
81
+ */
82
+ export declare function readPackageManifest(raw: unknown): PackageManifestRead;
83
+ /** A dependency that is not in the package (and, where asked, not on the site). */
84
+ export interface MissingPackageDependency {
85
+ /** The item that needs it, by {@link packageItemKey}. */
86
+ item: string;
87
+ dependency: PackageDependency;
88
+ }
89
+ /** The items in an order that installs every dependency before what needs it. */
90
+ export interface PackageDependencyOrder {
91
+ order: PackageManifestItem[];
92
+ missing: MissingPackageDependency[];
93
+ /** Each cycle as item keys; its items are appended to `order` in manifest order. */
94
+ cycles: string[][];
95
+ }
96
+ /**
97
+ * Dependencies first (Kahn's algorithm, ties in manifest order). A
98
+ * dependency outside the package is reported as missing unless `available`
99
+ * says the site has it. Items on a cycle cannot be ordered: each strongly
100
+ * connected group is reported and its items appended last.
101
+ */
102
+ export declare function packageDependencyOrder(items: readonly PackageManifestItem[], available?: (dependency: PackageDependency) => boolean): PackageDependencyOrder;
103
+ /**
104
+ * The selected items and everything they depend on inside the package,
105
+ * transitively — the export picker's "include dependencies". Returns keys
106
+ * in manifest order.
107
+ */
108
+ export declare function packageDependencyClosure(items: readonly PackageManifestItem[], selected: Iterable<string>): string[];
109
+ /** An item the site already holds. */
110
+ export interface ExistingPackageItem {
111
+ kind: string;
112
+ id: string;
113
+ slug?: string;
114
+ name?: string;
115
+ contentHash: string;
116
+ }
117
+ /** How an incoming item compares with what the site holds. */
118
+ export type PackageItemComparison = 'new' | 'identical' | 'differs';
119
+ /** The status the import screen shows: the comparison, unless a dependency is missing. */
120
+ export type PackageItemStatus = PackageItemComparison | 'missingDependency';
121
+ export interface PackageItemMatch {
122
+ item: PackageManifestItem;
123
+ status: PackageItemStatus;
124
+ comparison: PackageItemComparison;
125
+ existing?: ExistingPackageItem;
126
+ matchedBy?: 'id' | 'slug' | 'name';
127
+ /** Dependencies neither in the package nor on the site. */
128
+ missing: PackageDependency[];
129
+ }
130
+ /**
131
+ * Every manifest item against what the site holds: matched by id, then
132
+ * slug, then name, within its kind; compared by content hash; and checked
133
+ * for dependencies that exist in neither place.
134
+ */
135
+ export declare function matchPackageItems(manifest: Pick<PackageManifest, 'items'>, existing: readonly ExistingPackageItem[]): PackageItemMatch[];
136
+ /** What to do with an incoming item that collides with one the site holds. */
137
+ export type PackageCollisionChoice = 'replace' | 'keepBoth' | 'skip' | 'merge';
138
+ /** What to do with an item: create it (new), or a collision choice. */
139
+ export type PackageItemDecision = 'create' | PackageCollisionChoice;
140
+ /** What to do about a dependency the package and the site both lack. */
141
+ export type PackageMissingDependencyChoice = {
142
+ action: 'mapTo';
143
+ id: string;
144
+ } | {
145
+ action: 'dropReference';
146
+ } | {
147
+ action: 'skipItem';
148
+ };
149
+ /**
150
+ * The decision proposed before the person chooses: create a new item, skip
151
+ * an identical one, and skip a differing one — replacing is never assumed;
152
+ * `needsChoice` marks the items the person must decide.
153
+ */
154
+ export declare function proposePackageDecision(match: PackageItemMatch): {
155
+ decision: PackageItemDecision;
156
+ needsChoice: boolean;
157
+ };
158
+ /** The decisions an item may take; `merge` only for kinds that merge key by key. */
159
+ export declare function packageDecisionsFor(match: PackageItemMatch, mergeable?: boolean): PackageItemDecision[];
160
+ /**
161
+ * The slug a kept-both copy takes: `<slug>-copy`, then `-copy-2`, `-copy-3`…
162
+ * until none of `taken` (compared caselessly).
163
+ */
164
+ export declare function keepBothSlug(slug: string, taken: Iterable<string>): string;
165
+ /**
166
+ * The manifest for a set of items. Hashes each item's content; `deps` and
167
+ * the slug and name come from `describe`. Items are listed in the order given.
168
+ */
169
+ export declare function buildPackageManifest<T>(items: readonly {
170
+ kind: string;
171
+ id: string;
172
+ content: T;
173
+ }[], describe?: (item: {
174
+ kind: string;
175
+ id: string;
176
+ content: T;
177
+ }) => {
178
+ slug?: string;
179
+ name?: string;
180
+ deps?: PackageDependency[];
181
+ }, meta?: Pick<PackageManifest, 'createdAt' | 'source'>): Promise<TransferPackage<T>>;
@@ -0,0 +1,426 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ /*==========================================
18
+ * PACKAGES — site items (pages, layouts, components, emails…) carried as one file.
19
+ *
20
+ * A package is a manifest and the items it lists. Each manifest entry
21
+ * names the item's kind and id, its slug or name, a content hash, and the
22
+ * items it depends on (a page on its layout, a layout on its components).
23
+ *
24
+ * ## Content hashes
25
+ *
26
+ * `sha256:` + the hex SHA-256 of the item's stable JSON — keys sorted at
27
+ * every depth, `undefined` dropped — through WebCrypto, which both the
28
+ * browser and Node provide. Equal hashes mean an import would change
29
+ * nothing, so the item is `identical` and skipped by default.
30
+ *
31
+ * ## Importing an item
32
+ *
33
+ * Each item is matched to what the site already holds — by id, then slug,
34
+ * then name, within its kind — and is `new`, `identical` or `differs`;
35
+ * an item whose dependencies are neither in the package nor on the site is
36
+ * flagged `missingDependency`. For a colliding item the person chooses:
37
+ * replace it (as a new version), keep both (a new id and slug), skip it,
38
+ * or merge it (for the kinds that merge key by key, like site settings).
39
+ *=========================================*/ /** The format tag every package carries. */ export const TRANSFER_PACKAGE_FORMAT = 'aglyn-package';
40
+ /** The manifest version this module reads and writes. */ export const TRANSFER_PACKAGE_VERSION = 2;
41
+ /** The key an item is filed under: `<kind>/<id>`. */ export function packageItemKey(item) {
42
+ var _ref, _item_$id;
43
+ return `${item.kind}/${(_ref = (_item_$id = item.$id) != null ? _item_$id : item.id) != null ? _ref : ''}`;
44
+ }
45
+ /**
46
+ * JSON with every object's keys sorted, at every depth, and `undefined`
47
+ * dropped (as `JSON.stringify` drops it). Dates are their ISO string;
48
+ * a non-finite number is `null`. Two values that are the same data are
49
+ * the same text, whatever order their keys were written in.
50
+ */ export function stableJson(value) {
51
+ var _JSON_stringify;
52
+ return (_JSON_stringify = JSON.stringify(canonical(value))) != null ? _JSON_stringify : 'null';
53
+ }
54
+ function canonical(value) {
55
+ if (value === null || value === undefined) return value;
56
+ if (value instanceof Date) return value.toISOString();
57
+ if (typeof value === 'number') return Number.isFinite(value) ? value : null;
58
+ if (Array.isArray(value)) return value.map((entry)=>entry === undefined ? null : canonical(entry));
59
+ if (typeof value === 'object') {
60
+ const source = value;
61
+ const sorted = {};
62
+ for (const key of Object.keys(source).sort()){
63
+ if (source[key] === undefined) continue;
64
+ sorted[key] = canonical(source[key]);
65
+ }
66
+ return sorted;
67
+ }
68
+ return value;
69
+ }
70
+ /** The hash prefix every content hash carries. */ export const CONTENT_HASH_PREFIX = 'sha256:';
71
+ /**
72
+ * The content hash of a value: `sha256:` + hex of its {@link stableJson}.
73
+ * Uses WebCrypto (`globalThis.crypto.subtle`), present in browsers and Node.
74
+ */ export async function contentHash(value) {
75
+ var _globalThis_crypto;
76
+ const subtle = (_globalThis_crypto = globalThis.crypto) == null ? void 0 : _globalThis_crypto.subtle;
77
+ if (!subtle) throw new Error('Content hashing needs WebCrypto (crypto.subtle).');
78
+ const bytes = new TextEncoder().encode(stableJson(value));
79
+ const digest = await subtle.digest('SHA-256', bytes);
80
+ return CONTENT_HASH_PREFIX + [
81
+ ...new Uint8Array(digest)
82
+ ].map((byte)=>byte.toString(16).padStart(2, '0')).join('');
83
+ }
84
+ /**
85
+ * A manifest from untrusted JSON. Every problem is reported, not just the
86
+ * first: a wrong format or version, an item without a kind, id or hash, a
87
+ * malformed dependency, an id listed twice.
88
+ */ export function readPackageManifest(raw) {
89
+ const problems = [];
90
+ if (!raw || typeof raw !== 'object') return {
91
+ ok: false,
92
+ problems: [
93
+ 'The file is not a package.'
94
+ ]
95
+ };
96
+ const source = raw;
97
+ if (source['format'] !== TRANSFER_PACKAGE_FORMAT) {
98
+ var _source_format;
99
+ problems.push(`The file's format is ${JSON.stringify((_source_format = source['format']) != null ? _source_format : null)}, not "${TRANSFER_PACKAGE_FORMAT}".`);
100
+ }
101
+ if (source['version'] !== TRANSFER_PACKAGE_VERSION) {
102
+ problems.push(`The package is version ${String(source['version'])}; this reads version ${TRANSFER_PACKAGE_VERSION}.`);
103
+ }
104
+ if (!Array.isArray(source['items'])) problems.push('The package lists no items.');
105
+ const items = [];
106
+ const seen = new Set();
107
+ for (const [index, entry] of (Array.isArray(source['items']) ? source['items'] : []).entries()){
108
+ const item = entry != null ? entry : {};
109
+ const where = `Item ${index + 1}`;
110
+ const kind = typeof item['kind'] === 'string' ? item['kind'].trim() : '';
111
+ const id = typeof item['$id'] === 'string' ? item['$id'].trim() : '';
112
+ const hash = typeof item['contentHash'] === 'string' ? item['contentHash'] : '';
113
+ if (!kind) problems.push(`${where} has no kind.`);
114
+ if (!id) problems.push(`${where} has no id.`);
115
+ if (!hash.startsWith(CONTENT_HASH_PREFIX)) problems.push(`${where} has no content hash.`);
116
+ const deps = [];
117
+ for (const dep of Array.isArray(item['deps']) ? item['deps'] : []){
118
+ const d = dep != null ? dep : {};
119
+ if (typeof d['kind'] === 'string' && d['kind'] && typeof d['id'] === 'string' && d['id']) {
120
+ deps.push({
121
+ kind: d['kind'],
122
+ id: d['id']
123
+ });
124
+ } else {
125
+ problems.push(`${where} has a dependency without a kind and id.`);
126
+ }
127
+ }
128
+ if (item['deps'] !== undefined && !Array.isArray(item['deps'])) problems.push(`${where} has dependencies that are not a list.`);
129
+ const key = `${kind}/${id}`;
130
+ if (kind && id && seen.has(key)) problems.push(`${where} repeats ${key}.`);
131
+ seen.add(key);
132
+ items.push(_extends({
133
+ kind,
134
+ $id: id
135
+ }, typeof item['slug'] === 'string' ? {
136
+ slug: item['slug']
137
+ } : {}, typeof item['name'] === 'string' ? {
138
+ name: item['name']
139
+ } : {}, {
140
+ contentHash: hash,
141
+ deps
142
+ }));
143
+ }
144
+ if (problems.length) return {
145
+ ok: false,
146
+ problems
147
+ };
148
+ return {
149
+ ok: true,
150
+ manifest: _extends({
151
+ format: TRANSFER_PACKAGE_FORMAT,
152
+ version: TRANSFER_PACKAGE_VERSION,
153
+ items
154
+ }, typeof source['createdAt'] === 'number' ? {
155
+ createdAt: source['createdAt']
156
+ } : {}, typeof source['source'] === 'string' ? {
157
+ source: source['source']
158
+ } : {})
159
+ };
160
+ }
161
+ /**
162
+ * Dependencies first (Kahn's algorithm, ties in manifest order). A
163
+ * dependency outside the package is reported as missing unless `available`
164
+ * says the site has it. Items on a cycle cannot be ordered: each strongly
165
+ * connected group is reported and its items appended last.
166
+ */ export function packageDependencyOrder(items, available = ()=>false) {
167
+ const byKey = new Map(items.map((item)=>[
168
+ packageItemKey(item),
169
+ item
170
+ ]));
171
+ const missing = [];
172
+ const needs = new Map();
173
+ const neededBy = new Map();
174
+ for (const item of items){
175
+ const key = packageItemKey(item);
176
+ const set = new Set();
177
+ for (const dep of item.deps){
178
+ const depKey = packageItemKey(dep);
179
+ if (byKey.has(depKey)) {
180
+ if (!set.has(depKey)) {
181
+ var _neededBy_get;
182
+ set.add(depKey);
183
+ neededBy.set(depKey, [
184
+ ...(_neededBy_get = neededBy.get(depKey)) != null ? _neededBy_get : [],
185
+ key
186
+ ]);
187
+ }
188
+ } else if (!available(dep)) {
189
+ missing.push({
190
+ item: key,
191
+ dependency: dep
192
+ });
193
+ }
194
+ }
195
+ needs.set(key, set);
196
+ }
197
+ const order = [];
198
+ const placed = new Set();
199
+ const position = new Map(items.map((item, at)=>[
200
+ packageItemKey(item),
201
+ at
202
+ ]));
203
+ const byPosition = (a, b)=>{
204
+ var _position_get, _position_get1;
205
+ return ((_position_get = position.get(a)) != null ? _position_get : 0) - ((_position_get1 = position.get(b)) != null ? _position_get1 : 0);
206
+ };
207
+ const ready = items.filter((item)=>{
208
+ var _needs_get;
209
+ return ((_needs_get = needs.get(packageItemKey(item))) == null ? void 0 : _needs_get.size) === 0;
210
+ }).map(packageItemKey);
211
+ while(ready.length){
212
+ var _neededBy_get1;
213
+ // Ties go in manifest order: the earliest ready item is placed next.
214
+ ready.sort(byPosition);
215
+ const key = ready.shift();
216
+ if (placed.has(key)) continue;
217
+ placed.add(key);
218
+ order.push(byKey.get(key));
219
+ for (const dependent of (_neededBy_get1 = neededBy.get(key)) != null ? _neededBy_get1 : []){
220
+ const set = needs.get(dependent);
221
+ set.delete(key);
222
+ if (set.size === 0) ready.push(dependent);
223
+ }
224
+ }
225
+ const rest = items.filter((item)=>!placed.has(packageItemKey(item)));
226
+ const cycles = stronglyConnected(rest, byKey).filter((group)=>{
227
+ var _ref;
228
+ var _byKey_get;
229
+ return group.length > 1 || ((_ref = (_byKey_get = byKey.get(group[0])) == null ? void 0 : _byKey_get.deps.some((dep)=>packageItemKey(dep) === group[0])) != null ? _ref : false);
230
+ });
231
+ return {
232
+ order: [
233
+ ...order,
234
+ ...rest
235
+ ],
236
+ missing,
237
+ cycles
238
+ };
239
+ }
240
+ /** Tarjan's strongly connected components over the given items' in-package edges. */ function stronglyConnected(items, byKey) {
241
+ const keys = new Set(items.map(packageItemKey));
242
+ const index = new Map();
243
+ const low = new Map();
244
+ const stack = [];
245
+ const onStack = new Set();
246
+ const groups = [];
247
+ let counter = 0;
248
+ const visit = (key)=>{
249
+ var _ref;
250
+ var _byKey_get;
251
+ index.set(key, counter);
252
+ low.set(key, counter);
253
+ counter += 1;
254
+ stack.push(key);
255
+ onStack.add(key);
256
+ for (const dep of (_ref = (_byKey_get = byKey.get(key)) == null ? void 0 : _byKey_get.deps) != null ? _ref : []){
257
+ const next = packageItemKey(dep);
258
+ if (!keys.has(next)) continue;
259
+ if (!index.has(next)) {
260
+ visit(next);
261
+ low.set(key, Math.min(low.get(key), low.get(next)));
262
+ } else if (onStack.has(next)) {
263
+ low.set(key, Math.min(low.get(key), index.get(next)));
264
+ }
265
+ }
266
+ if (low.get(key) === index.get(key)) {
267
+ const group = [];
268
+ let member;
269
+ do {
270
+ member = stack.pop();
271
+ onStack.delete(member);
272
+ group.push(member);
273
+ }while (member !== key)
274
+ groups.push(group.reverse());
275
+ }
276
+ };
277
+ for (const key of keys)if (!index.has(key)) visit(key);
278
+ return groups;
279
+ }
280
+ /**
281
+ * The selected items and everything they depend on inside the package,
282
+ * transitively — the export picker's "include dependencies". Returns keys
283
+ * in manifest order.
284
+ */ export function packageDependencyClosure(items, selected) {
285
+ const byKey = new Map(items.map((item)=>[
286
+ packageItemKey(item),
287
+ item
288
+ ]));
289
+ const included = new Set();
290
+ const queue = [
291
+ ...selected
292
+ ].filter((key)=>byKey.has(key));
293
+ while(queue.length){
294
+ var _ref;
295
+ var _byKey_get;
296
+ const key = queue.pop();
297
+ if (included.has(key)) continue;
298
+ included.add(key);
299
+ for (const dep of (_ref = (_byKey_get = byKey.get(key)) == null ? void 0 : _byKey_get.deps) != null ? _ref : []){
300
+ const depKey = packageItemKey(dep);
301
+ if (byKey.has(depKey) && !included.has(depKey)) queue.push(depKey);
302
+ }
303
+ }
304
+ return items.map(packageItemKey).filter((key)=>included.has(key));
305
+ }
306
+ function caseless(value) {
307
+ return String(value != null ? value : '').trim().toLowerCase();
308
+ }
309
+ /**
310
+ * Every manifest item against what the site holds: matched by id, then
311
+ * slug, then name, within its kind; compared by content hash; and checked
312
+ * for dependencies that exist in neither place.
313
+ */ export function matchPackageItems(manifest, existing) {
314
+ const inPackage = new Set(manifest.items.map(packageItemKey));
315
+ const onSite = new Set(existing.map((item)=>`${item.kind}/${item.id}`));
316
+ return manifest.items.map((item)=>{
317
+ const sameKind = existing.filter((entry)=>entry.kind === item.kind);
318
+ let found = sameKind.find((entry)=>entry.id === item.$id);
319
+ let matchedBy = found ? 'id' : undefined;
320
+ if (!found && item.slug) {
321
+ found = sameKind.find((entry)=>entry.slug && caseless(entry.slug) === caseless(item.slug));
322
+ if (found) matchedBy = 'slug';
323
+ }
324
+ if (!found && item.name) {
325
+ found = sameKind.find((entry)=>entry.name && caseless(entry.name) === caseless(item.name));
326
+ if (found) matchedBy = 'name';
327
+ }
328
+ const comparison = !found ? 'new' : found.contentHash === item.contentHash ? 'identical' : 'differs';
329
+ const missing = item.deps.filter((dep)=>{
330
+ const key = packageItemKey(dep);
331
+ return !inPackage.has(key) && !onSite.has(key);
332
+ });
333
+ return _extends({
334
+ item,
335
+ status: missing.length ? 'missingDependency' : comparison,
336
+ comparison
337
+ }, found ? {
338
+ existing: found,
339
+ matchedBy
340
+ } : {}, {
341
+ missing
342
+ });
343
+ });
344
+ }
345
+ /**
346
+ * The decision proposed before the person chooses: create a new item, skip
347
+ * an identical one, and skip a differing one — replacing is never assumed;
348
+ * `needsChoice` marks the items the person must decide.
349
+ */ export function proposePackageDecision(match) {
350
+ if (match.comparison === 'new') return {
351
+ decision: 'create',
352
+ needsChoice: match.missing.length > 0
353
+ };
354
+ if (match.comparison === 'identical') return {
355
+ decision: 'skip',
356
+ needsChoice: match.missing.length > 0
357
+ };
358
+ return {
359
+ decision: 'skip',
360
+ needsChoice: true
361
+ };
362
+ }
363
+ /** The decisions an item may take; `merge` only for kinds that merge key by key. */ export function packageDecisionsFor(match, mergeable = false) {
364
+ if (match.comparison === 'new') return [
365
+ 'create',
366
+ 'skip'
367
+ ];
368
+ return mergeable ? [
369
+ 'replace',
370
+ 'keepBoth',
371
+ 'skip',
372
+ 'merge'
373
+ ] : [
374
+ 'replace',
375
+ 'keepBoth',
376
+ 'skip'
377
+ ];
378
+ }
379
+ /**
380
+ * The slug a kept-both copy takes: `<slug>-copy`, then `-copy-2`, `-copy-3`…
381
+ * until none of `taken` (compared caselessly).
382
+ */ export function keepBothSlug(slug, taken) {
383
+ const used = new Set([
384
+ ...taken
385
+ ].map(caseless));
386
+ const base = `${slug.replace(/-copy(?:-\d+)?$/, '')}-copy`;
387
+ if (!used.has(caseless(base))) return base;
388
+ for(let n = 2;; n += 1){
389
+ const candidate = `${base}-${n}`;
390
+ if (!used.has(caseless(candidate))) return candidate;
391
+ }
392
+ }
393
+ /**
394
+ * The manifest for a set of items. Hashes each item's content; `deps` and
395
+ * the slug and name come from `describe`. Items are listed in the order given.
396
+ */ export async function buildPackageManifest(items, describe = ()=>({}), meta = {}) {
397
+ const entries = [];
398
+ const contents = {};
399
+ for (const item of items){
400
+ var _described_deps;
401
+ const described = describe(item);
402
+ const entry = _extends({
403
+ kind: item.kind,
404
+ $id: item.id
405
+ }, described.slug ? {
406
+ slug: described.slug
407
+ } : {}, described.name ? {
408
+ name: described.name
409
+ } : {}, {
410
+ contentHash: await contentHash(item.content),
411
+ deps: (_described_deps = described.deps) != null ? _described_deps : []
412
+ });
413
+ entries.push(entry);
414
+ contents[packageItemKey(entry)] = item.content;
415
+ }
416
+ return {
417
+ manifest: _extends({
418
+ format: TRANSFER_PACKAGE_FORMAT,
419
+ version: TRANSFER_PACKAGE_VERSION,
420
+ items: entries
421
+ }, meta),
422
+ items: contents
423
+ };
424
+ }
425
+
426
+ //# sourceMappingURL=package.js.map