@aglyn/tenant-runtime 1.0.0-beta.143
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.
- package/LICENSE +201 -0
- package/README.md +26 -0
- package/package.json +39 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/apply-publish-schedule.d.ts +34 -0
- package/src/lib/apply-publish-schedule.js +285 -0
- package/src/lib/apply-publish-schedule.js.map +1 -0
- package/src/lib/assign-contact-owner.d.ts +162 -0
- package/src/lib/assign-contact-owner.js +322 -0
- package/src/lib/assign-contact-owner.js.map +1 -0
- package/src/lib/associate-company-by-domain.d.ts +70 -0
- package/src/lib/associate-company-by-domain.js +150 -0
- package/src/lib/associate-company-by-domain.js.map +1 -0
- package/src/lib/author-page-nodes.d.ts +36 -0
- package/src/lib/author-page-nodes.js +296 -0
- package/src/lib/author-page-nodes.js.map +1 -0
- package/src/lib/built-in-page-layout.d.ts +48 -0
- package/src/lib/built-in-page-layout.js +107 -0
- package/src/lib/built-in-page-layout.js.map +1 -0
- package/src/lib/capture-host-contact.d.ts +95 -0
- package/src/lib/capture-host-contact.js +137 -0
- package/src/lib/capture-host-contact.js.map +1 -0
- package/src/lib/collection-fallback-nodes.d.ts +90 -0
- package/src/lib/collection-fallback-nodes.js +602 -0
- package/src/lib/collection-fallback-nodes.js.map +1 -0
- package/src/lib/compose-author-page.d.ts +109 -0
- package/src/lib/compose-author-page.js +225 -0
- package/src/lib/compose-author-page.js.map +1 -0
- package/src/lib/compose-collection-page.d.ts +94 -0
- package/src/lib/compose-collection-page.js +256 -0
- package/src/lib/compose-collection-page.js.map +1 -0
- package/src/lib/compose-screen-nodes.d.ts +156 -0
- package/src/lib/compose-screen-nodes.js +547 -0
- package/src/lib/compose-screen-nodes.js.map +1 -0
- package/src/lib/compose-search-page.d.ts +39 -0
- package/src/lib/compose-search-page.js +57 -0
- package/src/lib/compose-search-page.js.map +1 -0
- package/src/lib/convert-host-lead.d.ts +189 -0
- package/src/lib/convert-host-lead.js +443 -0
- package/src/lib/convert-host-lead.js.map +1 -0
- package/src/lib/defer-lazy-panels.d.ts +58 -0
- package/src/lib/defer-lazy-panels.js +171 -0
- package/src/lib/defer-lazy-panels.js.map +1 -0
- package/src/lib/element-animation-assets.d.ts +62 -0
- package/src/lib/element-animation-assets.js +290 -0
- package/src/lib/element-animation-assets.js.map +1 -0
- package/src/lib/emit-host-event.d.ts +29 -0
- package/src/lib/emit-host-event.js +30 -0
- package/src/lib/emit-host-event.js.map +1 -0
- package/src/lib/enrich-gated-page.d.ts +67 -0
- package/src/lib/enrich-gated-page.js +134 -0
- package/src/lib/enrich-gated-page.js.map +1 -0
- package/src/lib/entry-link-routes.d.ts +61 -0
- package/src/lib/entry-link-routes.js +169 -0
- package/src/lib/entry-link-routes.js.map +1 -0
- package/src/lib/get-author-content.d.ts +119 -0
- package/src/lib/get-author-content.js +288 -0
- package/src/lib/get-author-content.js.map +1 -0
- package/src/lib/get-collection-content.d.ts +290 -0
- package/src/lib/get-collection-content.js +565 -0
- package/src/lib/get-collection-content.js.map +1 -0
- package/src/lib/get-components.d.ts +24 -0
- package/src/lib/get-components.js +102 -0
- package/src/lib/get-components.js.map +1 -0
- package/src/lib/get-datasets.d.ts +45 -0
- package/src/lib/get-datasets.js +169 -0
- package/src/lib/get-datasets.js.map +1 -0
- package/src/lib/get-forms.d.ts +24 -0
- package/src/lib/get-forms.js +116 -0
- package/src/lib/get-forms.js.map +1 -0
- package/src/lib/get-layout-version.d.ts +26 -0
- package/src/lib/get-layout-version.js +99 -0
- package/src/lib/get-layout-version.js.map +1 -0
- package/src/lib/get-media-asset-facts.d.ts +74 -0
- package/src/lib/get-media-asset-facts.js +116 -0
- package/src/lib/get-media-asset-facts.js.map +1 -0
- package/src/lib/get-plugin-installs.d.ts +29 -0
- package/src/lib/get-plugin-installs.js +94 -0
- package/src/lib/get-plugin-installs.js.map +1 -0
- package/src/lib/get-screen-version.d.ts +27 -0
- package/src/lib/get-screen-version.js +66 -0
- package/src/lib/get-screen-version.js.map +1 -0
- package/src/lib/get-screen.d.ts +39 -0
- package/src/lib/get-screen.js +126 -0
- package/src/lib/get-screen.js.map +1 -0
- package/src/lib/get-variables.d.ts +41 -0
- package/src/lib/get-variables.js +128 -0
- package/src/lib/get-variables.js.map +1 -0
- package/src/lib/get-video-asset-facts.d.ts +22 -0
- package/src/lib/get-video-asset-facts.js +22 -0
- package/src/lib/get-video-asset-facts.js.map +1 -0
- package/src/lib/host-event-listeners.d.ts +83 -0
- package/src/lib/host-event-listeners.js +91 -0
- package/src/lib/host-event-listeners.js.map +1 -0
- package/src/lib/org-permissions.d.ts +63 -0
- package/src/lib/org-permissions.js +187 -0
- package/src/lib/org-permissions.js.map +1 -0
- package/src/lib/repeat-record-pages.d.ts +48 -0
- package/src/lib/repeat-record-pages.js +64 -0
- package/src/lib/repeat-record-pages.js.map +1 -0
- package/src/lib/required-site-plugins.d.ts +114 -0
- package/src/lib/required-site-plugins.js +121 -0
- package/src/lib/required-site-plugins.js.map +1 -0
- package/src/lib/resolve-dataset.d.ts +40 -0
- package/src/lib/resolve-dataset.js +64 -0
- package/src/lib/resolve-dataset.js.map +1 -0
- package/src/lib/search-results-nodes.d.ts +48 -0
- package/src/lib/search-results-nodes.js +302 -0
- package/src/lib/search-results-nodes.js.map +1 -0
- package/src/lib/social-image-facts.d.ts +107 -0
- package/src/lib/social-image-facts.js +133 -0
- package/src/lib/social-image-facts.js.map +1 -0
- package/src/lib/stamp-form-dataset-bindings.d.ts +32 -0
- package/src/lib/stamp-form-dataset-bindings.js +59 -0
- package/src/lib/stamp-form-dataset-bindings.js.map +1 -0
- package/src/lib/template-screens.d.ts +227 -0
- package/src/lib/template-screens.js +364 -0
- package/src/lib/template-screens.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @aglyn/tenant-runtime
|
|
2
|
+
|
|
3
|
+
Server-side host-event runtime shared by the tenant app and feature plugins
|
|
4
|
+
(AGL-396). Hosts the event seam that no single plugin owns, and runs none of
|
|
5
|
+
what an event triggers:
|
|
6
|
+
|
|
7
|
+
- `emitHostEvent` — the one emit point; hands an event to every registered
|
|
8
|
+
host-event listener, returning any site alerts for request/response
|
|
9
|
+
emitters (form submit, booking) to surface.
|
|
10
|
+
- `registerHostEventListener` — how a plugin hears host events. Registered by
|
|
11
|
+
a call from the plugin's `serverDeclarations` entry, which both apps run at
|
|
12
|
+
boot, so a core route that never loads the plugin still reaches it. The
|
|
13
|
+
automation engine is one such listener, and lives in its plugin.
|
|
14
|
+
- `dispatchHostAutomation` — runs one automation by id for a site event the
|
|
15
|
+
published page evaluated itself, through the listeners that dispatch.
|
|
16
|
+
|
|
17
|
+
It also hosts the server-side **screen-composition pipeline** — `getScreen`,
|
|
18
|
+
`composeScreenNodes`, and the `get-*` version/component/variable/dataset
|
|
19
|
+
loaders behind it — reached via subpath imports
|
|
20
|
+
(`@aglyn/tenant-runtime/compose-screen-nodes`, etc.). This is the tenant
|
|
21
|
+
render read-path shared by the app's SSR and any plugin that needs to
|
|
22
|
+
compose a screen server-side (e.g. commerce's members-only content route).
|
|
23
|
+
|
|
24
|
+
Depends only on `@aglyn/aglyn`, `@aglyn/tenant-data-admin`, and
|
|
25
|
+
`firebase-admin`, so it is importable from both `apps/tenant` API routes and
|
|
26
|
+
plugin `server.ts` handlers without pulling app code into a lib.
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aglyn/tenant-runtime",
|
|
3
|
+
"version": "1.0.0-beta.143",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"homepage": "https://aglyn.com",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/aglyn/aglyn.git",
|
|
9
|
+
"directory": "libs/tenant/runtime"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"provenance": true
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./src/index.d.ts",
|
|
19
|
+
"default": "./src/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./*": {
|
|
22
|
+
"types": "./src/lib/*.d.ts",
|
|
23
|
+
"default": "./src/lib/*.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@aglyn/aglyn": "1.0.0-beta.143",
|
|
29
|
+
"@aglyn/tenant-data-admin": "1.0.0-beta.143",
|
|
30
|
+
"@swc/helpers": "0.5.23"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"firebase-admin": "^14.3.0"
|
|
34
|
+
},
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"types": "./src/index.d.ts",
|
|
37
|
+
"module": "./src/index.js",
|
|
38
|
+
"main": "./src/index.js"
|
|
39
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
export * from './lib/assign-contact-owner';
|
|
18
|
+
export * from './lib/capture-host-contact';
|
|
19
|
+
export * from './lib/emit-host-event';
|
|
20
|
+
export * from './lib/host-event-listeners';
|
|
21
|
+
export * from './lib/resolve-dataset';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
*/ export * from "./lib/assign-contact-owner.js";
|
|
17
|
+
export * from "./lib/capture-host-contact.js";
|
|
18
|
+
export * from "./lib/emit-host-event.js";
|
|
19
|
+
export * from "./lib/host-event-listeners.js";
|
|
20
|
+
export * from "./lib/resolve-dataset.js";
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../libs/tenant/runtime/src/index.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\nexport * from './lib/assign-contact-owner'\nexport * from './lib/capture-host-contact'\nexport * from './lib/emit-host-event'\nexport * from './lib/host-event-listeners'\nexport * from './lib/resolve-dataset'\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,cAAc,gCAA4B;AAC1C,cAAc,gCAA4B;AAC1C,cAAc,2BAAuB;AACrC,cAAc,gCAA4B;AAC1C,cAAc,2BAAuB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 * as Aglyn from '@aglyn/aglyn/server';
|
|
18
|
+
/**
|
|
19
|
+
* Lazy scheduled-publishing executor (AGL-61): if the doc carries a pending
|
|
20
|
+
* `publishSchedule` whose time has passed, flip the `versionId` pointer,
|
|
21
|
+
* register the screen's routing entry when the route is not live yet
|
|
22
|
+
* (AGL-1589), and mark the schedule applied. Runs during ISR revalidation,
|
|
23
|
+
* so a schedule
|
|
24
|
+
* takes effect on the first regeneration after its time (within the
|
|
25
|
+
* revalidate window) — no dedicated cron needed. Returns the effective
|
|
26
|
+
* versionId; fail-open on write errors (the pointer flips next revalidate).
|
|
27
|
+
*/
|
|
28
|
+
export declare function applyDuePublishSchedule(options: {
|
|
29
|
+
hostId: Aglyn.HostUid;
|
|
30
|
+
collectionName: 'screens' | 'layouts';
|
|
31
|
+
docId: string;
|
|
32
|
+
parent: Pick<Aglyn.AglynScreen, 'versionId' | 'publishSchedule'>;
|
|
33
|
+
}): Promise<Aglyn.VersionUid | undefined>;
|
|
34
|
+
export default applyDuePublishSchedule;
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
17
|
+
import { checkEntitlement, composeScreenRoutePath, findScreenIdByRoutePath, SCREEN_KIND_EMAIL } from "@aglyn/aglyn/server";
|
|
18
|
+
// Deep import, like the Measurement Protocol sender's: `analytics-events.ts`
|
|
19
|
+
// is deliberately DOM-free so both sides of the publish path can share the
|
|
20
|
+
// one definition of `first_publish` (AGL-1588).
|
|
21
|
+
import { isFirstPublishedRoute } from "@aglyn/aglyn/app-utils/analytics-events";
|
|
22
|
+
import { firebaseAdmin, getOrgForHost, sendGa4SitePublished } from "@aglyn/tenant-data-admin";
|
|
23
|
+
import { FieldValue, Timestamp } from "firebase-admin/firestore";
|
|
24
|
+
/** Parent chains deeper than `composeScreenRoutePath` accepts are invalid. */ const MAX_ANCESTOR_READS = 32;
|
|
25
|
+
/**
|
|
26
|
+
* The routing-map path a due publish should register for a screen that has
|
|
27
|
+
* no entry yet, or the reason it must not get one (AGL-1589).
|
|
28
|
+
*
|
|
29
|
+
* Reads the screen and walks its ancestor chain (one doc per level, bounded)
|
|
30
|
+
* because the composed path is `parent segments + own slug` and the executor
|
|
31
|
+
* is handed only the version pointer and the schedule. Runs at most once per
|
|
32
|
+
* schedule that actually comes due, and never for the common case — a screen
|
|
33
|
+
* whose route is already live is answered from the host document alone.
|
|
34
|
+
*
|
|
35
|
+
* The three refusals are all "this cannot become an address", and all three
|
|
36
|
+
* are silent no-ops if left unrecorded, which is the bug this issue is about:
|
|
37
|
+
*
|
|
38
|
+
* - `not-a-page` — an email document (AGL-1383). It has no URL, the serve
|
|
39
|
+
* path refuses to render it, and a routing entry would make it BILLABLE
|
|
40
|
+
* against `screensPerHost` without making it reachable. `kind: 'template'`
|
|
41
|
+
* is deliberately NOT refused: a collection entry template is routed on
|
|
42
|
+
* purpose, which is how the compose pipeline picks it up (AGL-1400).
|
|
43
|
+
* - `no-path` — the screen or an ancestor has no slug, so there is no address
|
|
44
|
+
* to publish at.
|
|
45
|
+
* - `path-taken` — another screen already holds the address. The interactive
|
|
46
|
+
* path refuses this with a message ("Another screen is already published at
|
|
47
|
+
* …"); registering it anyway would put two screens at one path and could
|
|
48
|
+
* take a LIVE page off the site, which is a worse bug than the one being
|
|
49
|
+
* fixed here.
|
|
50
|
+
*/ async function resolveScheduledRoutePath(options) {
|
|
51
|
+
const { hostRef, screenId, routing } = options;
|
|
52
|
+
const screens = hostRef.collection('screens');
|
|
53
|
+
const screensById = {};
|
|
54
|
+
let currentId = screenId;
|
|
55
|
+
for(let depth = 0; currentId && depth < MAX_ANCESTOR_READS; depth += 1){
|
|
56
|
+
if (screensById[currentId]) break; // cycle — composeScreenRoutePath refuses
|
|
57
|
+
const snapshot = await screens.doc(currentId).get();
|
|
58
|
+
if (!snapshot.exists) break;
|
|
59
|
+
if (currentId === screenId) {
|
|
60
|
+
if (snapshot.get('deletedAt') != null || snapshot.get('kind') === SCREEN_KIND_EMAIL) {
|
|
61
|
+
return {
|
|
62
|
+
refused: 'not-a-page'
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
screensById[currentId] = {
|
|
67
|
+
slug: snapshot.get('slug'),
|
|
68
|
+
parentId: snapshot.get('parentId')
|
|
69
|
+
};
|
|
70
|
+
currentId = snapshot.get('parentId');
|
|
71
|
+
}
|
|
72
|
+
const path = composeScreenRoutePath(screenId, screensById);
|
|
73
|
+
if (!path) return {
|
|
74
|
+
refused: 'no-path'
|
|
75
|
+
};
|
|
76
|
+
const owner = findScreenIdByRoutePath(routing, path);
|
|
77
|
+
if (owner && owner !== screenId) return {
|
|
78
|
+
refused: 'path-taken'
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
path
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Lazy scheduled-publishing executor (AGL-61): if the doc carries a pending
|
|
86
|
+
* `publishSchedule` whose time has passed, flip the `versionId` pointer,
|
|
87
|
+
* register the screen's routing entry when the route is not live yet
|
|
88
|
+
* (AGL-1589), and mark the schedule applied. Runs during ISR revalidation,
|
|
89
|
+
* so a schedule
|
|
90
|
+
* takes effect on the first regeneration after its time (within the
|
|
91
|
+
* revalidate window) — no dedicated cron needed. Returns the effective
|
|
92
|
+
* versionId; fail-open on write errors (the pointer flips next revalidate).
|
|
93
|
+
*/ export async function applyDuePublishSchedule(options) {
|
|
94
|
+
var _ref, _ref1;
|
|
95
|
+
var _schedule_publishAt, _this;
|
|
96
|
+
const { hostId, collectionName, docId, parent } = options;
|
|
97
|
+
const schedule = parent.publishSchedule;
|
|
98
|
+
const publishAtMs = ((_ref = schedule == null ? void 0 : (_schedule_publishAt = schedule.publishAt) == null ? void 0 : _schedule_publishAt.seconds) != null ? _ref : 0) * 1000;
|
|
99
|
+
if ((schedule == null ? void 0 : schedule.status) !== 'pending' || publishAtMs > Date.now()) {
|
|
100
|
+
return parent.versionId;
|
|
101
|
+
}
|
|
102
|
+
// Plan gate (AGL-471): the console gates *writing* a schedule on the
|
|
103
|
+
// scheduledPublishing entitlement, but this executor is the authority —
|
|
104
|
+
// a schedule written directly to Firestore must not auto-publish on an
|
|
105
|
+
// unentitled plan.
|
|
106
|
+
const org = (_ref1 = (_this = await getOrgForHost(hostId)) == null ? void 0 : _this.org) != null ? _ref1 : {};
|
|
107
|
+
if (!checkEntitlement(org, 'scheduledPublishing')) {
|
|
108
|
+
// Record the refusal instead of leaving it pending (AGL-1185).
|
|
109
|
+
//
|
|
110
|
+
// The refusal itself is correct and unchanged. What was wrong is that it
|
|
111
|
+
// left no trace: the schedule stayed `pending` and permanently due, so the
|
|
112
|
+
// moment the org upgraded to Business the next beat — every minute since
|
|
113
|
+
// AGL-1159 — published it. Content scheduled on a plan that could not
|
|
114
|
+
// honour it, and forgotten, would surface during an upgrade, which is
|
|
115
|
+
// exactly when nobody is looking for it.
|
|
116
|
+
//
|
|
117
|
+
// Safe to write here because the dueness check above has already passed, so
|
|
118
|
+
// this can only ever mark a schedule that came due and was declined. A
|
|
119
|
+
// future-dated schedule is returned long before this point and is untouched.
|
|
120
|
+
//
|
|
121
|
+
// Terminal on purpose: upgrading does not resurrect it. A schedule whose
|
|
122
|
+
// time passed while unentitled is stale by the time the plan changes, and
|
|
123
|
+
// re-running it is the surprise this removes. Rescheduling is a deliberate
|
|
124
|
+
// act, and the console can now say why the original never ran.
|
|
125
|
+
//
|
|
126
|
+
// Fail-open like every other write here — a failure leaves it pending,
|
|
127
|
+
// which is today's behaviour, and the next beat retries.
|
|
128
|
+
try {
|
|
129
|
+
await firebaseAdmin.app().firestore().collection('hosts').doc(hostId).collection(collectionName).doc(docId).update({
|
|
130
|
+
'publishSchedule.status': 'skipped-unentitled'
|
|
131
|
+
});
|
|
132
|
+
} catch (error) {
|
|
133
|
+
console.error(error);
|
|
134
|
+
}
|
|
135
|
+
return parent.versionId;
|
|
136
|
+
}
|
|
137
|
+
// Scheduled unpublish (AGL-113, screens only): drop the routing-map entry
|
|
138
|
+
// so the path 404s on the next revalidate. This render still serves the
|
|
139
|
+
// current version — the map is matched before this runs.
|
|
140
|
+
if (schedule.action === 'unpublish') {
|
|
141
|
+
if (collectionName === 'screens') {
|
|
142
|
+
try {
|
|
143
|
+
const firestore = firebaseAdmin.app().firestore();
|
|
144
|
+
const hostRef = firestore.collection('hosts').doc(hostId);
|
|
145
|
+
await Promise.all([
|
|
146
|
+
hostRef.update({
|
|
147
|
+
[`screens.${docId}`]: FieldValue.delete()
|
|
148
|
+
}),
|
|
149
|
+
hostRef.collection(collectionName).doc(docId).update({
|
|
150
|
+
'publishSchedule.status': 'applied',
|
|
151
|
+
// Route no longer live — drop the published date to match the
|
|
152
|
+
// interactive unpublish path (constants/screen-publishing.ts).
|
|
153
|
+
publishedAt: FieldValue.delete()
|
|
154
|
+
})
|
|
155
|
+
]);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.error(error);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return parent.versionId;
|
|
161
|
+
}
|
|
162
|
+
if (!schedule.versionId) return parent.versionId;
|
|
163
|
+
// Register the routing entry, not just the version pointer (AGL-1589).
|
|
164
|
+
//
|
|
165
|
+
// Until this, a due publish wrote `versionId` + `status: 'applied'` and
|
|
166
|
+
// nothing else — never `hosts/{hostId}.screens.{screenId}`, the map the
|
|
167
|
+
// tenant matches request paths against. A REPUBLISH was therefore correct
|
|
168
|
+
// (the entry already existed, and only the version needed swapping) and a
|
|
169
|
+
// FIRST publish silently was not: the schedule reported success, the
|
|
170
|
+
// activity log said published, and the URL kept 404ing. Scheduled
|
|
171
|
+
// publishing is a Business feature, so that was a paying customer's page.
|
|
172
|
+
//
|
|
173
|
+
// Mirrors `publishScreenRoute` (constants/screen-publishing.ts): the
|
|
174
|
+
// composed path into the host's map, `publishedAt` stamped on the screen.
|
|
175
|
+
// The stored `slug` is not rewritten — the path was composed FROM it, so
|
|
176
|
+
// there is nothing to change.
|
|
177
|
+
//
|
|
178
|
+
// Screens only. A layout has no address of its own, exactly as the
|
|
179
|
+
// unpublish branch above is screens-only.
|
|
180
|
+
//
|
|
181
|
+
// In practice the CRON BEAT is the only caller that reaches a first publish:
|
|
182
|
+
// the lazy ISR path resolves a request path through the routing map before
|
|
183
|
+
// it ever loads a screen, so an unrouted screen 404s without its schedule
|
|
184
|
+
// being read. That is the same map this now writes — which is why the bug
|
|
185
|
+
// could not heal itself on the next visit.
|
|
186
|
+
const firestore = firebaseAdmin.app().firestore();
|
|
187
|
+
const hostRef = firestore.collection('hosts').doc(hostId);
|
|
188
|
+
const docRef = hostRef.collection(collectionName).doc(docId);
|
|
189
|
+
let routePath;
|
|
190
|
+
// Decided from the routing map as read below — BEFORE the batch registers
|
|
191
|
+
// this entry (AGL-1588). Left undefined outside the screens branch, where
|
|
192
|
+
// no route is going live and no `site_published` is sent at all.
|
|
193
|
+
let firstPublish;
|
|
194
|
+
if (collectionName === 'screens') {
|
|
195
|
+
try {
|
|
196
|
+
var _get;
|
|
197
|
+
const routing = (_get = (await hostRef.get()).get('screens')) != null ? _get : {};
|
|
198
|
+
// An existing entry is the republish case: the route is already live,
|
|
199
|
+
// this only swaps which version it serves, and there is nothing to
|
|
200
|
+
// register and no activation to report.
|
|
201
|
+
if (!routing[docId]) {
|
|
202
|
+
// The same predicate the console's three publish surfaces use, so a
|
|
203
|
+
// `first_publish` breakdown means one thing across all four senders.
|
|
204
|
+
firstPublish = isFirstPublishedRoute(routing);
|
|
205
|
+
const resolved = await resolveScheduledRoutePath({
|
|
206
|
+
hostRef,
|
|
207
|
+
screenId: docId,
|
|
208
|
+
routing
|
|
209
|
+
});
|
|
210
|
+
if ('refused' in resolved) {
|
|
211
|
+
// Record the refusal rather than publishing a pointer at a page
|
|
212
|
+
// nobody can reach — the AGL-1185 posture, for the same reason: an
|
|
213
|
+
// unrecorded decline is indistinguishable from success, and leaving
|
|
214
|
+
// it `pending` would re-attempt it on every beat forever. Terminal:
|
|
215
|
+
// fixing the address is a deliberate act in the console, and
|
|
216
|
+
// rescheduling is part of it.
|
|
217
|
+
try {
|
|
218
|
+
await docRef.update({
|
|
219
|
+
'publishSchedule.status': 'skipped-unroutable'
|
|
220
|
+
});
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error(error);
|
|
223
|
+
}
|
|
224
|
+
return parent.versionId;
|
|
225
|
+
}
|
|
226
|
+
routePath = resolved.path;
|
|
227
|
+
}
|
|
228
|
+
} catch (error) {
|
|
229
|
+
// Fail-open like every other write here: leave the schedule pending and
|
|
230
|
+
// let the next beat (or revalidate) retry. Publishing the pointer while
|
|
231
|
+
// the routing question is unanswered is the failure being fixed.
|
|
232
|
+
console.error(error);
|
|
233
|
+
return parent.versionId;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
try {
|
|
237
|
+
const applied = {
|
|
238
|
+
versionId: schedule.versionId,
|
|
239
|
+
'publishSchedule.status': 'applied'
|
|
240
|
+
};
|
|
241
|
+
if (routePath) {
|
|
242
|
+
// ONE atomic commit, and the order matters more than the write count:
|
|
243
|
+
// a status of `applied` with no routing entry is permanent (nothing
|
|
244
|
+
// retries a terminal status), so the entry and the status must land
|
|
245
|
+
// together or not at all. A failed commit leaves the schedule pending
|
|
246
|
+
// and the next beat runs it again.
|
|
247
|
+
const batch = firestore.batch();
|
|
248
|
+
batch.update(hostRef, {
|
|
249
|
+
[`screens.${docId}`]: routePath
|
|
250
|
+
});
|
|
251
|
+
batch.update(docRef, _extends({}, applied, {
|
|
252
|
+
publishedAt: Timestamp.now()
|
|
253
|
+
}));
|
|
254
|
+
await batch.commit();
|
|
255
|
+
// A route just went live with no browser anywhere near it, which is
|
|
256
|
+
// precisely what the client-side `site_published` in
|
|
257
|
+
// `publishScreenRoute` cannot see (AGL-1562, AGL-1589). Awaited, not
|
|
258
|
+
// floated: this render/beat is the only thing keeping the process
|
|
259
|
+
// alive. It never throws, and it returns immediately when the
|
|
260
|
+
// Measurement Protocol is not configured — the normal state on a
|
|
261
|
+
// self-hosted deployment and in development.
|
|
262
|
+
//
|
|
263
|
+
// ⚠️ NOT the state of our own tenant app any more. This comment used to
|
|
264
|
+
// say GA4_MEASUREMENT_ID / GA4_API_SECRET were unset on the
|
|
265
|
+
// aglyn-tenant Vercel project; both landed on 2026-08-17 12:15 UTC and
|
|
266
|
+
// the sender is LIVE on this path. The stale version of this note is
|
|
267
|
+
// part of what made a 2026-08-19 smoke pass conclude every server-side
|
|
268
|
+
// event was dead (AGL-2327). See docs/ANALYTICS.md.
|
|
269
|
+
await sendGa4SitePublished({
|
|
270
|
+
hostId,
|
|
271
|
+
firstPublish
|
|
272
|
+
});
|
|
273
|
+
} else {
|
|
274
|
+
await docRef.update(applied);
|
|
275
|
+
}
|
|
276
|
+
} catch (error) {
|
|
277
|
+
console.error(error);
|
|
278
|
+
}
|
|
279
|
+
// Serve the scheduled version for this render either way — the schedule
|
|
280
|
+
// is due, and the write (or its retry next revalidate) makes it durable.
|
|
281
|
+
return schedule.versionId;
|
|
282
|
+
}
|
|
283
|
+
export default applyDuePublishSchedule;
|
|
284
|
+
|
|
285
|
+
//# sourceMappingURL=apply-publish-schedule.js.map
|