@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,104 @@
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
+ */ var _globalScope_RECIPES_KEY;
17
+ import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
18
+ import { PLUGIN_INTERACTION_RECIPES_DECLARED } from "./first-party-plugins.generated.js";
19
+ /** Every recipe a first-party plugin declares, in `plugins.config.json` order. */ export function declaredInteractionRecipes() {
20
+ return PLUGIN_INTERACTION_RECIPES_DECLARED;
21
+ }
22
+ /**
23
+ * One table per process, on `globalThis` (AGL-3412): the server apps register
24
+ * from `instrumentation.ts`, which Next compiles apart from the routes that
25
+ * read, and a module-scoped map would be filled in one copy and read empty in
26
+ * the other.
27
+ */ const RECIPES_KEY = Symbol.for('@aglyn/aglyn:interaction-recipes');
28
+ const globalScope = globalThis;
29
+ const recipes = (_globalScope_RECIPES_KEY = globalScope[RECIPES_KEY]) != null ? _globalScope_RECIPES_KEY : globalScope[RECIPES_KEY] = new Map();
30
+ /**
31
+ * Registers a plugin's recipes, in the order its menu lists them.
32
+ *
33
+ * The owner is the plugin whose register fn is running, or the `pluginId`
34
+ * passed for a boot declaration. A registration with neither is refused; so is
35
+ * a recipe id another plugin declares or already registered, because two
36
+ * recipes under one id would each answer for the other's stamps. The same
37
+ * plugin registering again replaces its own. Nothing is registered unless
38
+ * every recipe is accepted.
39
+ */ export function registerInteractionRecipes(list, options) {
40
+ var _ref, _getRegisteringPluginId;
41
+ const pluginId = ((_ref = (_getRegisteringPluginId = getRegisteringPluginId()) != null ? _getRegisteringPluginId : options == null ? void 0 : options.pluginId) != null ? _ref : '').trim();
42
+ if (!pluginId) {
43
+ throw new Error('interaction recipes were registered with no owner: pass { pluginId } ' + 'when registering outside a plugin register fn');
44
+ }
45
+ for (const recipe of list){
46
+ const id = recipe.id.trim();
47
+ if (!id) throw new Error(`"${pluginId}" registered an interaction recipe with no id`);
48
+ const declared = PLUGIN_INTERACTION_RECIPES_DECLARED.find((row)=>row.id === id);
49
+ if (declared && declared.pluginId !== pluginId) {
50
+ throw new Error(`interaction recipe "${id}" is declared by "${declared.pluginId}"; refused "${pluginId}"`);
51
+ }
52
+ const held = recipes.get(id);
53
+ if (held && held.pluginId !== pluginId) {
54
+ throw new Error(`interaction recipe "${id}" is already registered by "${held.pluginId}"; refused "${pluginId}"`);
55
+ }
56
+ }
57
+ for (const [id, entry] of [
58
+ ...recipes
59
+ ])if (entry.pluginId === pluginId) recipes.delete(id);
60
+ for (const recipe of list)recipes.set(recipe.id.trim(), {
61
+ pluginId,
62
+ recipe
63
+ });
64
+ }
65
+ /** Every registered recipe, each plugin's in its own order. */ export function interactionRecipes() {
66
+ return [
67
+ ...recipes.values()
68
+ ].map((entry)=>entry.recipe);
69
+ }
70
+ /** The registered recipe with this id, or `null` for one nobody registered. */ export function interactionRecipe(id) {
71
+ var _ref;
72
+ var _recipes_get;
73
+ return typeof id === 'string' ? (_ref = (_recipes_get = recipes.get(id)) == null ? void 0 : _recipes_get.recipe) != null ? _ref : null : null;
74
+ }
75
+ /**
76
+ * Whether a stamp names a recipe: one a first-party plugin declares, or one a
77
+ * plugin registered in this process.
78
+ */ export function isKnownInteractionRecipe(id) {
79
+ if (typeof id !== 'string' || !id) return false;
80
+ return recipes.has(id) || PLUGIN_INTERACTION_RECIPES_DECLARED.some((row)=>row.id === id);
81
+ }
82
+ /**
83
+ * The recipe a STORED interaction came from, read off its document (AGL-2639).
84
+ *
85
+ * Three answers, and the third is the one that matters. A known id: the
86
+ * interaction was installed from, or begun as, that recipe — one a plugin
87
+ * declares or registered ({@link isKnownInteractionRecipe}). `null`: it was
88
+ * begun blank, or from a recipe this build no longer knows — the editor wrote
89
+ * the field and said "no recipe". `undefined`: the document carries no
90
+ * `recipe` field at all, which is every interaction saved before the stamp
91
+ * existed. Such an interaction may well have started from a recipe — the menu
92
+ * opened the editor prefilled long before anything recorded it — so a reader
93
+ * that needs to know whether a site has a recipe treats `undefined` as
94
+ * UNKNOWN, never as absent, and never writes a `null` over it.
95
+ */ export function interactionRecipeStamp(interaction) {
96
+ const stamp = interaction == null ? void 0 : interaction.recipe;
97
+ if (stamp === undefined) return undefined;
98
+ return isKnownInteractionRecipe(stamp) ? stamp : null;
99
+ }
100
+ /** Only for specs: forgets every registered recipe. */ export function resetInteractionRecipesForTests() {
101
+ recipes.clear();
102
+ }
103
+
104
+ //# sourceMappingURL=interaction-recipes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/interaction-recipes.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InteractionStepBase, SiteInteraction } from '../app-utils/site-interactions'\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport { PLUGIN_INTERACTION_RECIPES_DECLARED } from './first-party-plugins.generated'\n\n/**\n * A READY-TO-EDIT INTERACTION ANOTHER PLUGIN OFFERS (AGL-3080).\n *\n * A recipe is a stored interaction — a trigger, its conditions and an ordered\n * step list — built from the step vocabulary and handed to an editor as a\n * draft. Nothing is written until a person saves, and every field is theirs to\n * change first: the recipe decides where the editor starts, not what the site\n * runs. The plugin that knows what a recipe is FOR writes it — the CRM's\n * \"Welcome a new lead\" is the CRM's — and the plugin that edits and stores\n * interactions offers it. Neither imports the other: the author registers its\n * recipes here, and the editor reads them.\n *\n * A stored interaction remembers the recipe it began as by the recipe's id\n * (its `recipe` stamp), so a recipe's id never changes once it has shipped.\n *\n * ## Declared, then registered\n *\n * A recipe BUILDS its interaction, which is code, so it is registered — from\n * the author's `declarations` entry, which both apps and the console's loader\n * run at boot. Its ID is also declared, under `interactionRecipes` in\n * `plugins.config.json`, and compiled into core, because a validator must know\n * a stamp names a real recipe in every process, including one where the\n * author's declarations did not run: {@link isKnownInteractionRecipe} answers\n * from either. A marketplace plugin's recipes are registered and never\n * compiled, and are known once registered.\n */\n\n/** The compiled declaration: which plugin offers which recipe. */\nexport interface InteractionRecipeDeclaration {\n pluginId: string\n /** The recipe's id, as a stored interaction's `recipe` stamp names it. */\n id: string\n}\n\n/** What a recipe is handed before it builds. */\nexport interface InteractionRecipeInput {\n /** The record a person picked, for a recipe that {@link InteractionRecipe.picks} one. */\n picked?: { id: string; name: string }\n}\n\n/**\n * The record a person picks before a recipe can be built, and the words the\n * editor asks for it in. The editor lists the records of `kind` through the\n * list source the plugin that keeps them publishes (`plugin-record-lists`).\n */\nexport interface InteractionRecipePick {\n /** The record kind, as `plugin-record-lists` lists it: `'form'`. */\n kind: string\n /** The picker's label: \"Form\". */\n label: string\n /** The kind's plural, for the sentence that says the list was cut short: \"forms\". */\n plural: string\n /** What the person is asked to pick, one sentence: \"Pick the form whose new contacts get the tag.\" */\n prompt: string\n /** What the picker says on a site that has none. */\n none: string\n}\n\n/** The interaction a recipe builds: a fresh one each call, stamped with the recipe's id. */\nexport type InteractionRecipeDraft = SiteInteraction<InteractionStepBase> & {\n recipe: string\n}\n\nexport interface InteractionRecipe {\n /** Never changes once shipped: stored interactions name it. */\n id: string\n /** How the recipe reads in a menu; also the interaction's starting name. */\n title: string\n /** One sentence under the title. */\n description: string\n /**\n * The record a person picks before the recipe can be built. A recipe that\n * needs nothing opens the editor at once. Built WITHOUT its pick, such a\n * recipe yields an interaction a validator refuses — a condition with no\n * value — rather than one that saves and then silently matches nothing.\n */\n picks?: InteractionRecipePick\n /**\n * A fresh interaction each call, because the draft is edited in place. It\n * carries `recipe: id` — the provenance is the builder's to stamp, so a\n * writer that saves what it was handed cannot forget it.\n */\n build(input?: InteractionRecipeInput): InteractionRecipeDraft\n}\n\n/** Every recipe a first-party plugin declares, in `plugins.config.json` order. */\nexport function declaredInteractionRecipes(): readonly InteractionRecipeDeclaration[] {\n return PLUGIN_INTERACTION_RECIPES_DECLARED\n}\n\ninterface RegisteredRecipe {\n pluginId: string\n recipe: InteractionRecipe\n}\n\n/**\n * One table per process, on `globalThis` (AGL-3412): the server apps register\n * from `instrumentation.ts`, which Next compiles apart from the routes that\n * read, and a module-scoped map would be filled in one copy and read empty in\n * the other.\n */\nconst RECIPES_KEY = Symbol.for('@aglyn/aglyn:interaction-recipes')\n\nconst globalScope = globalThis as typeof globalThis & {\n [RECIPES_KEY]?: Map<string, RegisteredRecipe>\n}\n\nconst recipes: Map<string, RegisteredRecipe> =\n globalScope[RECIPES_KEY] ?? (globalScope[RECIPES_KEY] = new Map())\n\n/**\n * Registers a plugin's recipes, in the order its menu lists them.\n *\n * The owner is the plugin whose register fn is running, or the `pluginId`\n * passed for a boot declaration. A registration with neither is refused; so is\n * a recipe id another plugin declares or already registered, because two\n * recipes under one id would each answer for the other's stamps. The same\n * plugin registering again replaces its own. Nothing is registered unless\n * every recipe is accepted.\n */\nexport function registerInteractionRecipes(\n list: readonly InteractionRecipe[],\n options?: { pluginId?: string },\n): void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n 'interaction recipes were registered with no owner: pass { pluginId } ' +\n 'when registering outside a plugin register fn',\n )\n }\n for (const recipe of list) {\n const id = recipe.id.trim()\n if (!id) throw new Error(`\"${pluginId}\" registered an interaction recipe with no id`)\n const declared = PLUGIN_INTERACTION_RECIPES_DECLARED.find((row) => row.id === id)\n if (declared && declared.pluginId !== pluginId) {\n throw new Error(\n `interaction recipe \"${id}\" is declared by \"${declared.pluginId}\"; refused \"${pluginId}\"`,\n )\n }\n const held = recipes.get(id)\n if (held && held.pluginId !== pluginId) {\n throw new Error(\n `interaction recipe \"${id}\" is already registered by \"${held.pluginId}\"; refused \"${pluginId}\"`,\n )\n }\n }\n for (const [id, entry] of [...recipes]) if (entry.pluginId === pluginId) recipes.delete(id)\n for (const recipe of list) recipes.set(recipe.id.trim(), { pluginId, recipe })\n}\n\n/** Every registered recipe, each plugin's in its own order. */\nexport function interactionRecipes(): InteractionRecipe[] {\n return [...recipes.values()].map((entry) => entry.recipe)\n}\n\n/** The registered recipe with this id, or `null` for one nobody registered. */\nexport function interactionRecipe(id: unknown): InteractionRecipe | null {\n return typeof id === 'string' ? (recipes.get(id)?.recipe ?? null) : null\n}\n\n/**\n * Whether a stamp names a recipe: one a first-party plugin declares, or one a\n * plugin registered in this process.\n */\nexport function isKnownInteractionRecipe(id: unknown): id is string {\n if (typeof id !== 'string' || !id) return false\n return recipes.has(id) || PLUGIN_INTERACTION_RECIPES_DECLARED.some((row) => row.id === id)\n}\n\n/**\n * The recipe a STORED interaction came from, read off its document (AGL-2639).\n *\n * Three answers, and the third is the one that matters. A known id: the\n * interaction was installed from, or begun as, that recipe — one a plugin\n * declares or registered ({@link isKnownInteractionRecipe}). `null`: it was\n * begun blank, or from a recipe this build no longer knows — the editor wrote\n * the field and said \"no recipe\". `undefined`: the document carries no\n * `recipe` field at all, which is every interaction saved before the stamp\n * existed. Such an interaction may well have started from a recipe — the menu\n * opened the editor prefilled long before anything recorded it — so a reader\n * that needs to know whether a site has a recipe treats `undefined` as\n * UNKNOWN, never as absent, and never writes a `null` over it.\n */\nexport function interactionRecipeStamp(\n interaction: { recipe?: unknown } | null | undefined,\n): string | null | undefined {\n const stamp = interaction?.recipe\n if (stamp === undefined) return undefined\n return isKnownInteractionRecipe(stamp) ? stamp : null\n}\n\n/** Only for specs: forgets every registered recipe. */\nexport function resetInteractionRecipesForTests(): void {\n recipes.clear()\n}\n"],"names":["globalScope","getRegisteringPluginId","PLUGIN_INTERACTION_RECIPES_DECLARED","declaredInteractionRecipes","RECIPES_KEY","Symbol","for","globalThis","recipes","Map","registerInteractionRecipes","list","options","pluginId","trim","Error","recipe","id","declared","find","row","held","get","entry","delete","set","interactionRecipes","values","map","interactionRecipe","isKnownInteractionRecipe","has","some","interactionRecipeStamp","interaction","stamp","undefined","resetInteractionRecipesForTests","clear"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,OAkHCA;AA/GF,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SAASC,mCAAmC,QAAQ,qCAAiC;AAuFrF,gFAAgF,GAChF,OAAO,SAASC;IACd,OAAOD;AACT;AAOA;;;;;CAKC,GACD,MAAME,cAAcC,OAAOC,GAAG,CAAC;AAE/B,MAAMN,cAAcO;AAIpB,MAAMC,WACJR,2BAAAA,WAAW,CAACI,YAAY,YAAxBJ,2BAA6BA,WAAW,CAACI,YAAY,GAAG,IAAIK;AAE9D;;;;;;;;;CASC,GACD,OAAO,SAASC,2BACdC,IAAkC,EAClCC,OAA+B;QAEbX,MAAAA;IAAlB,MAAMY,WAAW,EAACZ,QAAAA,0BAAAA,oCAAAA,0BAA4BW,2BAAAA,QAASC,QAAQ,YAA7CZ,OAAiD,IAAIa,IAAI;IAC3E,IAAI,CAACD,UAAU;QACb,MAAM,IAAIE,MACR,0EACE;IAEN;IACA,KAAK,MAAMC,UAAUL,KAAM;QACzB,MAAMM,KAAKD,OAAOC,EAAE,CAACH,IAAI;QACzB,IAAI,CAACG,IAAI,MAAM,IAAIF,MAAM,CAAC,CAAC,EAAEF,SAAS,6CAA6C,CAAC;QACpF,MAAMK,WAAWhB,oCAAoCiB,IAAI,CAAC,CAACC,MAAQA,IAAIH,EAAE,KAAKA;QAC9E,IAAIC,YAAYA,SAASL,QAAQ,KAAKA,UAAU;YAC9C,MAAM,IAAIE,MACR,CAAC,oBAAoB,EAAEE,GAAG,kBAAkB,EAAEC,SAASL,QAAQ,CAAC,YAAY,EAAEA,SAAS,CAAC,CAAC;QAE7F;QACA,MAAMQ,OAAOb,QAAQc,GAAG,CAACL;QACzB,IAAII,QAAQA,KAAKR,QAAQ,KAAKA,UAAU;YACtC,MAAM,IAAIE,MACR,CAAC,oBAAoB,EAAEE,GAAG,4BAA4B,EAAEI,KAAKR,QAAQ,CAAC,YAAY,EAAEA,SAAS,CAAC,CAAC;QAEnG;IACF;IACA,KAAK,MAAM,CAACI,IAAIM,MAAM,IAAI;WAAIf;KAAQ,CAAE,IAAIe,MAAMV,QAAQ,KAAKA,UAAUL,QAAQgB,MAAM,CAACP;IACxF,KAAK,MAAMD,UAAUL,KAAMH,QAAQiB,GAAG,CAACT,OAAOC,EAAE,CAACH,IAAI,IAAI;QAAED;QAAUG;IAAO;AAC9E;AAEA,6DAA6D,GAC7D,OAAO,SAASU;IACd,OAAO;WAAIlB,QAAQmB,MAAM;KAAG,CAACC,GAAG,CAAC,CAACL,QAAUA,MAAMP,MAAM;AAC1D;AAEA,6EAA6E,GAC7E,OAAO,SAASa,kBAAkBZ,EAAW;;QACVT;IAAjC,OAAO,OAAOS,OAAO,oBAAYT,eAAAA,QAAQc,GAAG,CAACL,wBAAZT,aAAiBQ,MAAM,mBAAI,OAAQ;AACtE;AAEA;;;CAGC,GACD,OAAO,SAASc,yBAAyBb,EAAW;IAClD,IAAI,OAAOA,OAAO,YAAY,CAACA,IAAI,OAAO;IAC1C,OAAOT,QAAQuB,GAAG,CAACd,OAAOf,oCAAoC8B,IAAI,CAAC,CAACZ,MAAQA,IAAIH,EAAE,KAAKA;AACzF;AAEA;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASgB,uBACdC,WAAoD;IAEpD,MAAMC,QAAQD,+BAAAA,YAAalB,MAAM;IACjC,IAAImB,UAAUC,WAAW,OAAOA;IAChC,OAAON,yBAAyBK,SAASA,QAAQ;AACnD;AAEA,qDAAqD,GACrD,OAAO,SAASE;IACd7B,QAAQ8B,KAAK;AACf"}
@@ -0,0 +1,66 @@
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
+ import { type InteractionStepBase, type SiteInteraction } from '../app-utils/site-interactions';
18
+ /**
19
+ * THE CHECK OF A STEP THE PLATFORM DOES NOT KNOW (AGL-3080).
20
+ *
21
+ * `validateInteraction` checks what is the platform's own — the name, the
22
+ * trigger, the guards, the client steps and every declared pick — and leaves
23
+ * any other step to its owner, through `validateStep`. A plugin that edits
24
+ * interactions passes its own checks there. A plugin that only WRITES one —
25
+ * a recipe installed into a site, a drafted interaction graded before it is
26
+ * handed over — cannot import the plugin whose steps it wrote, and still has
27
+ * to refuse what that plugin would refuse.
28
+ *
29
+ * So the plugin that holds a step type's check registers it here, from its
30
+ * `declarations` entry (both apps and the console's browser run it at boot),
31
+ * and {@link validateStoredInteraction} runs the platform's checks with the
32
+ * registered ones. A step with no registered check is judged by the platform
33
+ * alone, as `validateInteraction` judges every step it was not told about.
34
+ *
35
+ * Reached by path, never through a barrel.
36
+ */
37
+ /** One step's complaint, after its `Step N` prefix; `null` passes it. */
38
+ export type InteractionStepCheck = (step: InteractionStepBase, label: string) => string | null;
39
+ interface RegisteredCheck {
40
+ pluginId: string;
41
+ check: InteractionStepCheck;
42
+ }
43
+ /**
44
+ * Registers the check of one or more step types. Returns the unregister, which
45
+ * removes each type only while this check still holds it.
46
+ *
47
+ * The owner is the plugin whose register fn is running, or the `pluginId`
48
+ * passed for a boot declaration. A registration with neither is refused; so is
49
+ * a type another plugin's check already holds, because two checks of one step
50
+ * would each pass what the other refuses. The same plugin registering again
51
+ * replaces its own. Nothing is registered unless every type is accepted.
52
+ */
53
+ export declare function registerInteractionStepChecks(types: readonly string[], check: InteractionStepCheck, options?: {
54
+ pluginId?: string;
55
+ }): () => void;
56
+ /** The check registered for a step type, with its owner, or `null`. */
57
+ export declare function registeredInteractionStepCheck(type: string): RegisteredCheck | null;
58
+ /**
59
+ * An interaction's problem as the platform and every registered step check see
60
+ * it, or `null`: what a plugin that writes an interaction it does not edit
61
+ * asks before it stores one.
62
+ */
63
+ export declare function validateStoredInteraction(interaction: SiteInteraction<InteractionStepBase>): string | null;
64
+ /** Only for specs: forgets every registered check. */
65
+ export declare function resetInteractionStepChecksForTests(): void;
66
+ export {};
@@ -0,0 +1,86 @@
1
+ var _globalScope_CHECKS_KEY;
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
+ */ import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
18
+ import { validateInteraction } from "../app-utils/site-interactions.js";
19
+ /**
20
+ * One table per process, on `globalThis` (AGL-3412): the server apps register
21
+ * from `instrumentation.ts`, which Next compiles apart from the routes that
22
+ * read, and a module-scoped map would be filled in one copy and read empty in
23
+ * the other.
24
+ */ const CHECKS_KEY = Symbol.for('@aglyn/aglyn:interaction-step-checks');
25
+ const globalScope = globalThis;
26
+ const checks = (_globalScope_CHECKS_KEY = globalScope[CHECKS_KEY]) != null ? _globalScope_CHECKS_KEY : globalScope[CHECKS_KEY] = new Map();
27
+ const PLAIN_TYPE = /^[a-z][A-Za-z0-9]*$/;
28
+ /**
29
+ * Registers the check of one or more step types. Returns the unregister, which
30
+ * removes each type only while this check still holds it.
31
+ *
32
+ * The owner is the plugin whose register fn is running, or the `pluginId`
33
+ * passed for a boot declaration. A registration with neither is refused; so is
34
+ * a type another plugin's check already holds, because two checks of one step
35
+ * would each pass what the other refuses. The same plugin registering again
36
+ * replaces its own. Nothing is registered unless every type is accepted.
37
+ */ export function registerInteractionStepChecks(types, check, options) {
38
+ var _ref, _getRegisteringPluginId;
39
+ const pluginId = ((_ref = (_getRegisteringPluginId = getRegisteringPluginId()) != null ? _getRegisteringPluginId : options == null ? void 0 : options.pluginId) != null ? _ref : '').trim();
40
+ if (!pluginId) {
41
+ throw new Error('an interaction step check was registered with no owner: pass { pluginId } ' + 'when registering outside a plugin register fn');
42
+ }
43
+ const list = [
44
+ ...new Set(types.map((type)=>type.trim()))
45
+ ];
46
+ if (!list.length) throw new Error(`"${pluginId}" registered an interaction step check for no step type`);
47
+ for (const type of list){
48
+ if (!PLAIN_TYPE.test(type)) {
49
+ throw new Error(`"${pluginId}" registered a check for "${type}", which is not a plain step type`);
50
+ }
51
+ const held = checks.get(type);
52
+ if (held && held.pluginId !== pluginId) {
53
+ throw new Error(`step "${type}" is already checked by "${held.pluginId}"; refused "${pluginId}"`);
54
+ }
55
+ }
56
+ const entry = {
57
+ pluginId,
58
+ check
59
+ };
60
+ for (const type of list)checks.set(type, entry);
61
+ return ()=>{
62
+ for (const type of list)if (checks.get(type) === entry) checks.delete(type);
63
+ };
64
+ }
65
+ /** The check registered for a step type, with its owner, or `null`. */ export function registeredInteractionStepCheck(type) {
66
+ var _checks_get;
67
+ return (_checks_get = checks.get(type)) != null ? _checks_get : null;
68
+ }
69
+ /**
70
+ * An interaction's problem as the platform and every registered step check see
71
+ * it, or `null`: what a plugin that writes an interaction it does not edit
72
+ * asks before it stores one.
73
+ */ export function validateStoredInteraction(interaction) {
74
+ return validateInteraction(interaction, {
75
+ validateStep: (step, label)=>{
76
+ var _ref;
77
+ var _checks_get;
78
+ return (_ref = (_checks_get = checks.get(step.type)) == null ? void 0 : _checks_get.check(step, label)) != null ? _ref : null;
79
+ }
80
+ });
81
+ }
82
+ /** Only for specs: forgets every registered check. */ export function resetInteractionStepChecksForTests() {
83
+ checks.clear();
84
+ }
85
+
86
+ //# sourceMappingURL=interaction-step-checks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/interaction-step-checks.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getRegisteringPluginId } from '../app-utils/registering-plugin'\nimport {\n type InteractionStepBase,\n type SiteInteraction,\n validateInteraction,\n} from '../app-utils/site-interactions'\n\n/**\n * THE CHECK OF A STEP THE PLATFORM DOES NOT KNOW (AGL-3080).\n *\n * `validateInteraction` checks what is the platform's own — the name, the\n * trigger, the guards, the client steps and every declared pick — and leaves\n * any other step to its owner, through `validateStep`. A plugin that edits\n * interactions passes its own checks there. A plugin that only WRITES one —\n * a recipe installed into a site, a drafted interaction graded before it is\n * handed over — cannot import the plugin whose steps it wrote, and still has\n * to refuse what that plugin would refuse.\n *\n * So the plugin that holds a step type's check registers it here, from its\n * `declarations` entry (both apps and the console's browser run it at boot),\n * and {@link validateStoredInteraction} runs the platform's checks with the\n * registered ones. A step with no registered check is judged by the platform\n * alone, as `validateInteraction` judges every step it was not told about.\n *\n * Reached by path, never through a barrel.\n */\n\n/** One step's complaint, after its `Step N` prefix; `null` passes it. */\nexport type InteractionStepCheck = (step: InteractionStepBase, label: string) => string | null\n\ninterface RegisteredCheck {\n pluginId: string\n check: InteractionStepCheck\n}\n\n/**\n * One table per process, on `globalThis` (AGL-3412): the server apps register\n * from `instrumentation.ts`, which Next compiles apart from the routes that\n * read, and a module-scoped map would be filled in one copy and read empty in\n * the other.\n */\nconst CHECKS_KEY = Symbol.for('@aglyn/aglyn:interaction-step-checks')\n\nconst globalScope = globalThis as typeof globalThis & {\n [CHECKS_KEY]?: Map<string, RegisteredCheck>\n}\n\nconst checks: Map<string, RegisteredCheck> =\n globalScope[CHECKS_KEY] ?? (globalScope[CHECKS_KEY] = new Map())\n\nconst PLAIN_TYPE = /^[a-z][A-Za-z0-9]*$/\n\n/**\n * Registers the check of one or more step types. Returns the unregister, which\n * removes each type only while this check still holds it.\n *\n * The owner is the plugin whose register fn is running, or the `pluginId`\n * passed for a boot declaration. A registration with neither is refused; so is\n * a type another plugin's check already holds, because two checks of one step\n * would each pass what the other refuses. The same plugin registering again\n * replaces its own. Nothing is registered unless every type is accepted.\n */\nexport function registerInteractionStepChecks(\n types: readonly string[],\n check: InteractionStepCheck,\n options?: { pluginId?: string },\n): () => void {\n const pluginId = (getRegisteringPluginId() ?? options?.pluginId ?? '').trim()\n if (!pluginId) {\n throw new Error(\n 'an interaction step check was registered with no owner: pass { pluginId } ' +\n 'when registering outside a plugin register fn',\n )\n }\n const list = [...new Set(types.map((type) => type.trim()))]\n if (!list.length) throw new Error(`\"${pluginId}\" registered an interaction step check for no step type`)\n for (const type of list) {\n if (!PLAIN_TYPE.test(type)) {\n throw new Error(`\"${pluginId}\" registered a check for \"${type}\", which is not a plain step type`)\n }\n const held = checks.get(type)\n if (held && held.pluginId !== pluginId) {\n throw new Error(`step \"${type}\" is already checked by \"${held.pluginId}\"; refused \"${pluginId}\"`)\n }\n }\n const entry: RegisteredCheck = { pluginId, check }\n for (const type of list) checks.set(type, entry)\n return () => {\n for (const type of list) if (checks.get(type) === entry) checks.delete(type)\n }\n}\n\n/** The check registered for a step type, with its owner, or `null`. */\nexport function registeredInteractionStepCheck(type: string): RegisteredCheck | null {\n return checks.get(type) ?? null\n}\n\n/**\n * An interaction's problem as the platform and every registered step check see\n * it, or `null`: what a plugin that writes an interaction it does not edit\n * asks before it stores one.\n */\nexport function validateStoredInteraction(\n interaction: SiteInteraction<InteractionStepBase>,\n): string | null {\n return validateInteraction(interaction, {\n validateStep: (step, label) => checks.get(step.type)?.check(step, label) ?? null,\n })\n}\n\n/** Only for specs: forgets every registered check. */\nexport function resetInteractionStepChecksForTests(): void {\n checks.clear()\n}\n"],"names":["globalScope","getRegisteringPluginId","validateInteraction","CHECKS_KEY","Symbol","for","globalThis","checks","Map","PLAIN_TYPE","registerInteractionStepChecks","types","check","options","pluginId","trim","Error","list","Set","map","type","length","test","held","get","entry","set","delete","registeredInteractionStepCheck","validateStoredInteraction","interaction","validateStep","step","label","resetInteractionStepChecksForTests","clear"],"mappings":"IAiEEA;AAjEF;;;;;;;;;;;;;;;CAeC,GAED,SAASC,sBAAsB,QAAQ,qCAAiC;AACxE,SAGEC,mBAAmB,QACd,oCAAgC;AA8BvC;;;;;CAKC,GACD,MAAMC,aAAaC,OAAOC,GAAG,CAAC;AAE9B,MAAML,cAAcM;AAIpB,MAAMC,UACJP,0BAAAA,WAAW,CAACG,WAAW,YAAvBH,0BAA4BA,WAAW,CAACG,WAAW,GAAG,IAAIK;AAE5D,MAAMC,aAAa;AAEnB;;;;;;;;;CASC,GACD,OAAO,SAASC,8BACdC,KAAwB,EACxBC,KAA2B,EAC3BC,OAA+B;QAEbZ,MAAAA;IAAlB,MAAMa,WAAW,EAACb,QAAAA,0BAAAA,oCAAAA,0BAA4BY,2BAAAA,QAASC,QAAQ,YAA7Cb,OAAiD,IAAIc,IAAI;IAC3E,IAAI,CAACD,UAAU;QACb,MAAM,IAAIE,MACR,+EACE;IAEN;IACA,MAAMC,OAAO;WAAI,IAAIC,IAAIP,MAAMQ,GAAG,CAAC,CAACC,OAASA,KAAKL,IAAI;KAAK;IAC3D,IAAI,CAACE,KAAKI,MAAM,EAAE,MAAM,IAAIL,MAAM,CAAC,CAAC,EAAEF,SAAS,uDAAuD,CAAC;IACvG,KAAK,MAAMM,QAAQH,KAAM;QACvB,IAAI,CAACR,WAAWa,IAAI,CAACF,OAAO;YAC1B,MAAM,IAAIJ,MAAM,CAAC,CAAC,EAAEF,SAAS,0BAA0B,EAAEM,KAAK,iCAAiC,CAAC;QAClG;QACA,MAAMG,OAAOhB,OAAOiB,GAAG,CAACJ;QACxB,IAAIG,QAAQA,KAAKT,QAAQ,KAAKA,UAAU;YACtC,MAAM,IAAIE,MAAM,CAAC,MAAM,EAAEI,KAAK,yBAAyB,EAAEG,KAAKT,QAAQ,CAAC,YAAY,EAAEA,SAAS,CAAC,CAAC;QAClG;IACF;IACA,MAAMW,QAAyB;QAAEX;QAAUF;IAAM;IACjD,KAAK,MAAMQ,QAAQH,KAAMV,OAAOmB,GAAG,CAACN,MAAMK;IAC1C,OAAO;QACL,KAAK,MAAML,QAAQH,KAAM,IAAIV,OAAOiB,GAAG,CAACJ,UAAUK,OAAOlB,OAAOoB,MAAM,CAACP;IACzE;AACF;AAEA,qEAAqE,GACrE,OAAO,SAASQ,+BAA+BR,IAAY;QAClDb;IAAP,QAAOA,cAAAA,OAAOiB,GAAG,CAACJ,iBAAXb,cAAoB;AAC7B;AAEA;;;;CAIC,GACD,OAAO,SAASsB,0BACdC,WAAiD;IAEjD,OAAO5B,oBAAoB4B,aAAa;QACtCC,cAAc,CAACC,MAAMC;;gBAAU1B;4BAAAA,cAAAA,OAAOiB,GAAG,CAACQ,KAAKZ,IAAI,sBAApBb,YAAuBK,KAAK,CAACoB,MAAMC,yBAAU;;IAC9E;AACF;AAEA,oDAAoD,GACpD,OAAO,SAASC;IACd3B,OAAO4B,KAAK;AACd"}
@@ -0,0 +1,235 @@
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
+ import type { InstalledFrom } from '../app-utils/artifact-provenance';
18
+ /**
19
+ * AN INSTALLABLE ARTIFACT TYPE ANOTHER PLUGIN KEEPS (AGL-3080).
20
+ *
21
+ * Installed content is the platform's concept (`artifact-provenance.ts`): a
22
+ * workspace can take a component, a theme or a dataset's schema from a
23
+ * publisher rather than author it. The plugin that sells, installs and
24
+ * updates those copies is one plugin; the plugin whose storage a copy lands
25
+ * in may be another. A dataset schema is published from a dataset and
26
+ * installs as a new one, and datasets are the data plugin's. The installer
27
+ * may not read or write another plugin's storage, and neither plugin may
28
+ * import the other, so this is the contract between them, and core names
29
+ * neither.
30
+ *
31
+ * The owner answers four questions, and the installer keeps everything else:
32
+ * who may act, the listing, its takedown and privacy gates, the purchase, the
33
+ * publisher's preconditions, the provenance stamp and its base snapshot, and
34
+ * the per-version tally.
35
+ *
36
+ * 1. {@link PluginArtifactOwner.snapshot}: publishing. Reads the source the
37
+ * publisher named in their own workspace and reduces it to what may travel.
38
+ * The installer stores what comes back as the version's content.
39
+ * 2. {@link PluginArtifactOwner.admits}: before an install reads its listing,
40
+ * whether this workspace may hold one at all (its plan).
41
+ * 3. {@link PluginArtifactOwner.prepare}: installing. Checks the published
42
+ * content can land here, makes it this workspace's, and writes NOTHING. The
43
+ * installer records provenance over the prepared content, then calls
44
+ * `commit` to write the copy with that stamp.
45
+ * 4. {@link PluginArtifactOwner.locate}: updating. Finds the copy a listing
46
+ * installed, and hands back what the three-way merge diffs together with
47
+ * the one write that applies its result.
48
+ *
49
+ * ## Declared, then registered, and an absent owner refuses
50
+ *
51
+ * The owner DECLARES each type in `plugins.config.json` (`artifactTypes`),
52
+ * compiled into core, and registers its answers from a declarations entry
53
+ * (`consoleServerDeclarations`: an install runs on the console's server). A
54
+ * registry alone would read a failed boot as "nobody keeps this type". The
55
+ * three cases stay apart:
56
+ *
57
+ * - nothing declares the type: {@link resolveArtifactTypeOwner} answers
58
+ * `null`, and the installer refuses the listing as unavailable here;
59
+ * - declared and registered: the owner answers;
60
+ * - declared and NOT registered: the app's declarations step runs again, and
61
+ * if the owner is still missing this THROWS
62
+ * {@link ArtifactTypeOwnerUnavailableError}.
63
+ *
64
+ * Every one of those is decided before the installer writes anything, so an
65
+ * install with no owner refuses whole and never lands half: no copy, no
66
+ * provenance, no tally.
67
+ *
68
+ * Server-only, and reached by its own subpath, never through a barrel.
69
+ */
70
+ /** A compiled declaration: the artifact type, and the plugin that keeps its copies. */
71
+ export interface ArtifactTypeDeclaration {
72
+ pluginId: string;
73
+ type: string;
74
+ }
75
+ /** A refusal, answered as the route's status and `{ error }` body. */
76
+ export interface ArtifactRefusal {
77
+ ok: false;
78
+ status: number;
79
+ error: string;
80
+ }
81
+ /** The workspace a copy is installed into. */
82
+ export interface ArtifactWorkspace {
83
+ /** The organization the copy lands in. */
84
+ orgId: string;
85
+ /** Its organization document: the plan, add-ons and default sharing a copy is held to. */
86
+ org: Readonly<Record<string, unknown>>;
87
+ }
88
+ /** The listing a copy is installed from, as the listing stores it. */
89
+ export interface ArtifactListingFacts {
90
+ listingId: string;
91
+ displayName?: unknown;
92
+ description?: unknown;
93
+ /** The version on offer: the listing's `latestVersion`. */
94
+ version?: unknown;
95
+ }
96
+ /**
97
+ * Where a copy came from, written onto it by its owner. The installer makes
98
+ * both: the owner stores them and never composes either.
99
+ */
100
+ export interface ArtifactInstallStamp {
101
+ /** The provenance every installed copy carries (AGL-1015). */
102
+ installedFrom: InstalledFrom;
103
+ /** The installer's own word for the copy's origin, with the listing and version. */
104
+ source: {
105
+ type: string;
106
+ listingId: string;
107
+ version: unknown;
108
+ };
109
+ }
110
+ /** Publishing: the source a publisher named, in their own workspace. */
111
+ export interface ArtifactSnapshotRequest {
112
+ /** The publishing organization, whose source is read. */
113
+ orgId: string;
114
+ /** The id of the source the publisher named. */
115
+ sourceId: string;
116
+ }
117
+ /** What a published version of the type carries. */
118
+ export interface ArtifactSnapshot {
119
+ ok: true;
120
+ /** The content every install of this version receives. */
121
+ content: unknown;
122
+ /** Facts about the content the listing carries beside it, written as they are. */
123
+ facts?: Readonly<Record<string, string | number | boolean>>;
124
+ }
125
+ /** Installing: one published version, into one workspace. */
126
+ export interface ArtifactInstallRequest extends ArtifactWorkspace {
127
+ listing: ArtifactListingFacts;
128
+ /** The version's content as published (`versions/{v}.{type}`), unvalidated. */
129
+ published: unknown;
130
+ }
131
+ /** What an install landed, reported beside the installer's own fields. */
132
+ export interface ArtifactInstalled {
133
+ ok: true;
134
+ report: Readonly<Record<string, unknown>>;
135
+ }
136
+ /** An install the owner has checked and not yet written. */
137
+ export interface PreparedArtifactInstall {
138
+ ok: true;
139
+ /**
140
+ * The content exactly as the copy will hold it: what the installer records
141
+ * as the base snapshot, so an update diffs this workspace's copy against
142
+ * what really arrived rather than what the publisher sent.
143
+ */
144
+ content: unknown;
145
+ /**
146
+ * Writes the copy with the installer's stamp. It may still refuse (a cap
147
+ * that a concurrent install reached first), and a refusal writes nothing.
148
+ */
149
+ commit(stamp: ArtifactInstallStamp): Promise<ArtifactInstalled | ArtifactRefusal>;
150
+ }
151
+ /** Updating: the copy a listing installed, asked from one site. */
152
+ export interface ArtifactLocateRequest {
153
+ /** The site's organization, or `null` for a site with none. */
154
+ orgId: string | null;
155
+ /** The site the update was asked from. */
156
+ hostId: string;
157
+ listingId: string;
158
+ /** The version on offer, as published, unvalidated. */
159
+ published: unknown;
160
+ }
161
+ /**
162
+ * What taking an update does beyond its content: shown on the preview, and,
163
+ * when `destructive`, applied only once the caller has confirmed it.
164
+ */
165
+ export interface ArtifactUpdateImpact {
166
+ /** Fields added to the update's preview as they are. */
167
+ preview: Readonly<Record<string, unknown>>;
168
+ /** The update reinterprets something the copy already holds. */
169
+ destructive: boolean;
170
+ /** The sentence an unconfirmed destructive merge is refused with. */
171
+ refusal: string;
172
+ }
173
+ /** The installed copy, in the shape its base snapshot holds. */
174
+ export interface InstalledArtifactCopy {
175
+ ok: true;
176
+ /** The copy as it is now. */
177
+ current: unknown;
178
+ /** The version on offer, made this workspace's exactly as an install would. */
179
+ incoming: unknown;
180
+ /** The version the copy was installed at, or `null` when it does not say. */
181
+ installedVersion: string | null;
182
+ /** The hash of the base snapshot it was installed with, or `null`. */
183
+ baseSha: string | null;
184
+ impact?: ArtifactUpdateImpact;
185
+ /** Writes the merged content onto the copy, with the update's stamp. */
186
+ apply(update: {
187
+ content: unknown;
188
+ stamp: ArtifactInstallStamp;
189
+ }): Promise<void>;
190
+ }
191
+ /** A plugin's answers for an installable artifact type it keeps. */
192
+ export interface PluginArtifactOwner {
193
+ snapshot(request: ArtifactSnapshotRequest): Promise<ArtifactSnapshot | ArtifactRefusal>;
194
+ admits(workspace: ArtifactWorkspace): Promise<ArtifactRefusal | null>;
195
+ prepare(request: ArtifactInstallRequest): Promise<PreparedArtifactInstall | ArtifactRefusal>;
196
+ locate(request: ArtifactLocateRequest): Promise<InstalledArtifactCopy | ArtifactRefusal>;
197
+ }
198
+ /** Every declared type, in config order. */
199
+ export declare function listDeclaredArtifactTypes(): readonly ArtifactTypeDeclaration[];
200
+ /** The plugin declared as keeping `type`, or `null` when none is. */
201
+ export declare function declaredArtifactTypeOwner(type: string): ArtifactTypeDeclaration | null;
202
+ interface Registered {
203
+ pluginId: string;
204
+ owner: PluginArtifactOwner;
205
+ }
206
+ /**
207
+ * Registers a plugin's answers for a type it declared. The owner is the plugin
208
+ * whose register fn is running, or the `pluginId` passed from a boot
209
+ * declaration. Refused: no owner, a type nobody declared (no installer would
210
+ * ever ask for it), and a type another plugin declared. The same plugin
211
+ * registering again replaces its answers. Returns the unregister.
212
+ */
213
+ export declare function registerArtifactTypeOwner(type: string, owner: PluginArtifactOwner, options?: {
214
+ pluginId?: string;
215
+ }): () => void;
216
+ /** The registered owner of `type` with its plugin, or `null`. */
217
+ export declare function artifactTypeOwner(type: string): Registered | null;
218
+ /** Only for specs: forgets every registered owner. */
219
+ export declare function resetArtifactTypeOwnersForTests(): void;
220
+ /**
221
+ * The declared owner's registration was not found, even after the app's
222
+ * declarations step ran again.
223
+ */
224
+ export declare class ArtifactTypeOwnerUnavailableError extends Error {
225
+ readonly declared: ArtifactTypeDeclaration;
226
+ constructor(declared: ArtifactTypeDeclaration);
227
+ }
228
+ /**
229
+ * The owner of `type`: `null` when no plugin declares it, the registered
230
+ * answers when one does, and a THROWN {@link ArtifactTypeOwnerUnavailableError}
231
+ * when the declared owner is still missing after the app's declarations step
232
+ * ran once more.
233
+ */
234
+ export declare function resolveArtifactTypeOwner(type: string): Promise<PluginArtifactOwner | null>;
235
+ export {};
@@ -0,0 +1,99 @@
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
+ */ var _globalScope_OWNERS_KEY;
17
+ import { getRegisteringPluginId } from "../app-utils/registering-plugin.js";
18
+ import { PLUGIN_ARTIFACT_TYPES_DECLARED } from "./first-party-plugins.generated.js";
19
+ import { runPluginDeclarationsRepair } from "./plugin-declarations-repair.js";
20
+ /** Every declared type, in config order. */ export function listDeclaredArtifactTypes() {
21
+ return PLUGIN_ARTIFACT_TYPES_DECLARED;
22
+ }
23
+ /** The plugin declared as keeping `type`, or `null` when none is. */ export function declaredArtifactTypeOwner(type) {
24
+ var _listDeclaredArtifactTypes_find;
25
+ return (_listDeclaredArtifactTypes_find = listDeclaredArtifactTypes().find((declared)=>declared.type === type)) != null ? _listDeclaredArtifactTypes_find : null;
26
+ }
27
+ /**
28
+ * One table per process, on `globalThis` (AGL-3412): the owner registers from
29
+ * the app's boot, which Next compiles apart from the routes that read.
30
+ */ const OWNERS_KEY = Symbol.for('@aglyn/aglyn:plugin-artifact-types');
31
+ const globalScope = globalThis;
32
+ const owners = (_globalScope_OWNERS_KEY = globalScope[OWNERS_KEY]) != null ? _globalScope_OWNERS_KEY : globalScope[OWNERS_KEY] = new Map();
33
+ /**
34
+ * Registers a plugin's answers for a type it declared. The owner is the plugin
35
+ * whose register fn is running, or the `pluginId` passed from a boot
36
+ * declaration. Refused: no owner, a type nobody declared (no installer would
37
+ * ever ask for it), and a type another plugin declared. The same plugin
38
+ * registering again replaces its answers. Returns the unregister.
39
+ */ export function registerArtifactTypeOwner(type, owner, options) {
40
+ var _ref, _getRegisteringPluginId;
41
+ const name = type.trim();
42
+ const pluginId = ((_ref = (_getRegisteringPluginId = getRegisteringPluginId()) != null ? _getRegisteringPluginId : options == null ? void 0 : options.pluginId) != null ? _ref : '').trim();
43
+ if (!pluginId) {
44
+ throw new Error(`artifact type "${name}" registered with no owner: pass { pluginId } ` + 'when registering outside a plugin register fn');
45
+ }
46
+ const declared = declaredArtifactTypeOwner(name);
47
+ if (!declared) {
48
+ throw new Error(`artifact type "${name}" is not declared in plugins.config.json ` + '(artifactTypes), so no installer would ever ask for it');
49
+ }
50
+ if (declared.pluginId !== pluginId) {
51
+ throw new Error(`artifact type "${name}" is declared by "${declared.pluginId}"; refused "${pluginId}"`);
52
+ }
53
+ const entry = {
54
+ pluginId,
55
+ owner
56
+ };
57
+ owners.set(name, entry);
58
+ return ()=>{
59
+ if (owners.get(name) === entry) owners.delete(name);
60
+ };
61
+ }
62
+ /** The registered owner of `type` with its plugin, or `null`. */ export function artifactTypeOwner(type) {
63
+ var _owners_get;
64
+ return (_owners_get = owners.get(type)) != null ? _owners_get : null;
65
+ }
66
+ /** Only for specs: forgets every registered owner. */ export function resetArtifactTypeOwnersForTests() {
67
+ owners.clear();
68
+ }
69
+ /**
70
+ * The declared owner's registration was not found, even after the app's
71
+ * declarations step ran again.
72
+ */ export class ArtifactTypeOwnerUnavailableError extends Error {
73
+ constructor(declared){
74
+ super(`artifact type "${declared.type}" is declared by "${declared.pluginId}" but ` + 'no owner is registered in this process: its declarations did not run. ' + 'Refusing to treat it as a type nobody keeps.'), this.declared = declared;
75
+ this.name = 'ArtifactTypeOwnerUnavailableError';
76
+ }
77
+ }
78
+ /**
79
+ * The owner of `type`: `null` when no plugin declares it, the registered
80
+ * answers when one does, and a THROWN {@link ArtifactTypeOwnerUnavailableError}
81
+ * when the declared owner is still missing after the app's declarations step
82
+ * ran once more.
83
+ */ export async function resolveArtifactTypeOwner(type) {
84
+ const declared = declaredArtifactTypeOwner(type);
85
+ if (!declared) return null;
86
+ let registered = artifactTypeOwner(type);
87
+ if (!registered) {
88
+ try {
89
+ await runPluginDeclarationsRepair();
90
+ } catch (error) {
91
+ console.error('[plugin-artifact-types] the declarations repair failed', error);
92
+ }
93
+ registered = artifactTypeOwner(type);
94
+ }
95
+ if (!registered) throw new ArtifactTypeOwnerUnavailableError(declared);
96
+ return registered.owner;
97
+ }
98
+
99
+ //# sourceMappingURL=plugin-artifact-types.js.map