@taggor/contract 0.0.0-stage → 0.1.0

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 (339) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +61 -2
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/artifact-keys.d.ts +169 -0
  5. package/dist/artifact-keys.d.ts.map +1 -0
  6. package/dist/artifact-keys.js +195 -0
  7. package/dist/artifact-keys.js.map +1 -0
  8. package/dist/assets.d.ts +72 -0
  9. package/dist/assets.d.ts.map +1 -0
  10. package/dist/assets.js +94 -0
  11. package/dist/assets.js.map +1 -0
  12. package/dist/bounded-path.d.ts +29 -0
  13. package/dist/bounded-path.d.ts.map +1 -0
  14. package/dist/bounded-path.js +57 -0
  15. package/dist/bounded-path.js.map +1 -0
  16. package/dist/bounded.d.ts +47 -0
  17. package/dist/bounded.d.ts.map +1 -0
  18. package/dist/bounded.js +93 -0
  19. package/dist/bounded.js.map +1 -0
  20. package/dist/build-diagnostic.d.ts +89 -0
  21. package/dist/build-diagnostic.d.ts.map +1 -0
  22. package/dist/build-diagnostic.js +91 -0
  23. package/dist/build-diagnostic.js.map +1 -0
  24. package/dist/component-types.d.ts +61 -0
  25. package/dist/component-types.d.ts.map +1 -0
  26. package/dist/component-types.js +277 -0
  27. package/dist/component-types.js.map +1 -0
  28. package/dist/consent-text.d.ts +31 -0
  29. package/dist/consent-text.d.ts.map +1 -0
  30. package/dist/consent-text.js +41 -0
  31. package/dist/consent-text.js.map +1 -0
  32. package/dist/contract-version.d.ts +150 -0
  33. package/dist/contract-version.d.ts.map +1 -0
  34. package/dist/contract-version.js +198 -0
  35. package/dist/contract-version.js.map +1 -0
  36. package/dist/credential-fields.d.ts +31 -0
  37. package/dist/credential-fields.d.ts.map +1 -0
  38. package/dist/credential-fields.js +36 -0
  39. package/dist/credential-fields.js.map +1 -0
  40. package/dist/css-tokens.d.ts +46 -0
  41. package/dist/css-tokens.d.ts.map +1 -0
  42. package/dist/css-tokens.js +189 -0
  43. package/dist/css-tokens.js.map +1 -0
  44. package/dist/css-value.d.ts +42 -0
  45. package/dist/css-value.d.ts.map +1 -0
  46. package/dist/css-value.js +78 -0
  47. package/dist/css-value.js.map +1 -0
  48. package/dist/data-api.d.ts +127 -0
  49. package/dist/data-api.d.ts.map +1 -0
  50. package/dist/data-api.js +167 -0
  51. package/dist/data-api.js.map +1 -0
  52. package/dist/denylist-keys.d.ts +19 -0
  53. package/dist/denylist-keys.d.ts.map +1 -0
  54. package/dist/denylist-keys.js +48 -0
  55. package/dist/denylist-keys.js.map +1 -0
  56. package/dist/diagnostic-catalog.d.ts +1402 -0
  57. package/dist/diagnostic-catalog.d.ts.map +1 -0
  58. package/dist/diagnostic-catalog.js +1311 -0
  59. package/dist/diagnostic-catalog.js.map +1 -0
  60. package/dist/dom-members.snapshot.d.ts +33 -0
  61. package/dist/dom-members.snapshot.d.ts.map +1 -0
  62. package/dist/dom-members.snapshot.js +760 -0
  63. package/dist/dom-members.snapshot.js.map +1 -0
  64. package/dist/early-loading.d.ts +27 -0
  65. package/dist/early-loading.d.ts.map +1 -0
  66. package/dist/early-loading.js +44 -0
  67. package/dist/early-loading.js.map +1 -0
  68. package/dist/error-catalog.d.ts +749 -0
  69. package/dist/error-catalog.d.ts.map +1 -0
  70. package/dist/error-catalog.js +720 -0
  71. package/dist/error-catalog.js.map +1 -0
  72. package/dist/executable-config.d.ts +35 -0
  73. package/dist/executable-config.d.ts.map +1 -0
  74. package/dist/executable-config.js +44 -0
  75. package/dist/executable-config.js.map +1 -0
  76. package/dist/freeze.d.ts +17 -0
  77. package/dist/freeze.d.ts.map +1 -0
  78. package/dist/freeze.js +29 -0
  79. package/dist/freeze.js.map +1 -0
  80. package/dist/gunzip.d.ts +33 -0
  81. package/dist/gunzip.d.ts.map +1 -0
  82. package/dist/gunzip.js +330 -0
  83. package/dist/gunzip.js.map +1 -0
  84. package/dist/hostname.d.ts +74 -0
  85. package/dist/hostname.d.ts.map +1 -0
  86. package/dist/hostname.js +215 -0
  87. package/dist/hostname.js.map +1 -0
  88. package/dist/human-actions.d.ts +49 -0
  89. package/dist/human-actions.d.ts.map +1 -0
  90. package/dist/human-actions.js +272 -0
  91. package/dist/human-actions.js.map +1 -0
  92. package/dist/index.d.ts +72 -0
  93. package/dist/index.d.ts.map +1 -0
  94. package/dist/index.js +72 -0
  95. package/dist/index.js.map +1 -0
  96. package/dist/json-schema.d.ts +108 -0
  97. package/dist/json-schema.d.ts.map +1 -0
  98. package/dist/json-schema.js +240 -0
  99. package/dist/json-schema.js.map +1 -0
  100. package/dist/key-checksum.d.ts +33 -0
  101. package/dist/key-checksum.d.ts.map +1 -0
  102. package/dist/key-checksum.js +67 -0
  103. package/dist/key-checksum.js.map +1 -0
  104. package/dist/libraries.d.ts +60 -0
  105. package/dist/libraries.d.ts.map +1 -0
  106. package/dist/libraries.js +120 -0
  107. package/dist/libraries.js.map +1 -0
  108. package/dist/limit-catalog.d.ts +371 -0
  109. package/dist/limit-catalog.d.ts.map +1 -0
  110. package/dist/limit-catalog.js +414 -0
  111. package/dist/limit-catalog.js.map +1 -0
  112. package/dist/limits.d.ts +167 -0
  113. package/dist/limits.d.ts.map +1 -0
  114. package/dist/limits.js +175 -0
  115. package/dist/limits.js.map +1 -0
  116. package/dist/locale-tag.d.ts +21 -0
  117. package/dist/locale-tag.d.ts.map +1 -0
  118. package/dist/locale-tag.js +21 -0
  119. package/dist/locale-tag.js.map +1 -0
  120. package/dist/make-diagnostic.d.ts +74 -0
  121. package/dist/make-diagnostic.d.ts.map +1 -0
  122. package/dist/make-diagnostic.js +100 -0
  123. package/dist/make-diagnostic.js.map +1 -0
  124. package/dist/manifest-compat-diagnostics.d.ts +23 -0
  125. package/dist/manifest-compat-diagnostics.d.ts.map +1 -0
  126. package/dist/manifest-compat-diagnostics.js +150 -0
  127. package/dist/manifest-compat-diagnostics.js.map +1 -0
  128. package/dist/manifest-compat.d.ts +58 -0
  129. package/dist/manifest-compat.d.ts.map +1 -0
  130. package/dist/manifest-compat.js +377 -0
  131. package/dist/manifest-compat.js.map +1 -0
  132. package/dist/manifest.d.ts +1769 -0
  133. package/dist/manifest.d.ts.map +1 -0
  134. package/dist/manifest.js +421 -0
  135. package/dist/manifest.js.map +1 -0
  136. package/dist/metering.d.ts +126 -0
  137. package/dist/metering.d.ts.map +1 -0
  138. package/dist/metering.js +147 -0
  139. package/dist/metering.js.map +1 -0
  140. package/dist/migrate.d.ts +70 -0
  141. package/dist/migrate.d.ts.map +1 -0
  142. package/dist/migrate.js +159 -0
  143. package/dist/migrate.js.map +1 -0
  144. package/dist/names.d.ts +37 -0
  145. package/dist/names.d.ts.map +1 -0
  146. package/dist/names.js +55 -0
  147. package/dist/names.js.map +1 -0
  148. package/dist/overage-pricing.d.ts +89 -0
  149. package/dist/overage-pricing.d.ts.map +1 -0
  150. package/dist/overage-pricing.js +170 -0
  151. package/dist/overage-pricing.js.map +1 -0
  152. package/dist/plan-ids.d.ts +10 -0
  153. package/dist/plan-ids.d.ts.map +1 -0
  154. package/dist/plan-ids.js +8 -0
  155. package/dist/plan-ids.js.map +1 -0
  156. package/dist/plan-limits.d.ts +138 -0
  157. package/dist/plan-limits.d.ts.map +1 -0
  158. package/dist/plan-limits.js +112 -0
  159. package/dist/plan-limits.js.map +1 -0
  160. package/dist/plan-pricing.d.ts +145 -0
  161. package/dist/plan-pricing.d.ts.map +1 -0
  162. package/dist/plan-pricing.js +172 -0
  163. package/dist/plan-pricing.js.map +1 -0
  164. package/dist/plan-usage.d.ts +112 -0
  165. package/dist/plan-usage.d.ts.map +1 -0
  166. package/dist/plan-usage.js +134 -0
  167. package/dist/plan-usage.js.map +1 -0
  168. package/dist/preview-token.d.ts +52 -0
  169. package/dist/preview-token.d.ts.map +1 -0
  170. package/dist/preview-token.js +106 -0
  171. package/dist/preview-token.js.map +1 -0
  172. package/dist/prop-names.d.ts +51 -0
  173. package/dist/prop-names.d.ts.map +1 -0
  174. package/dist/prop-names.js +150 -0
  175. package/dist/prop-names.js.map +1 -0
  176. package/dist/prop-type-docs.d.ts +20 -0
  177. package/dist/prop-type-docs.d.ts.map +1 -0
  178. package/dist/prop-type-docs.js +89 -0
  179. package/dist/prop-type-docs.js.map +1 -0
  180. package/dist/prop-types.d.ts +97 -0
  181. package/dist/prop-types.d.ts.map +1 -0
  182. package/dist/prop-types.js +299 -0
  183. package/dist/prop-types.js.map +1 -0
  184. package/dist/props.d.ts +996 -0
  185. package/dist/props.d.ts.map +1 -0
  186. package/dist/props.js +183 -0
  187. package/dist/props.js.map +1 -0
  188. package/dist/proto-guard.d.ts +29 -0
  189. package/dist/proto-guard.d.ts.map +1 -0
  190. package/dist/proto-guard.js +79 -0
  191. package/dist/proto-guard.js.map +1 -0
  192. package/dist/runtime-errors.d.ts +42 -0
  193. package/dist/runtime-errors.d.ts.map +1 -0
  194. package/dist/runtime-errors.js +42 -0
  195. package/dist/runtime-errors.js.map +1 -0
  196. package/dist/runtime-pointers.d.ts +58 -0
  197. package/dist/runtime-pointers.d.ts.map +1 -0
  198. package/dist/runtime-pointers.js +84 -0
  199. package/dist/runtime-pointers.js.map +1 -0
  200. package/dist/secret-scan.d.ts +191 -0
  201. package/dist/secret-scan.d.ts.map +1 -0
  202. package/dist/secret-scan.js +542 -0
  203. package/dist/secret-scan.js.map +1 -0
  204. package/dist/semver.d.ts +89 -0
  205. package/dist/semver.d.ts.map +1 -0
  206. package/dist/semver.js +400 -0
  207. package/dist/semver.js.map +1 -0
  208. package/dist/server-key.d.ts +68 -0
  209. package/dist/server-key.d.ts.map +1 -0
  210. package/dist/server-key.js +150 -0
  211. package/dist/server-key.js.map +1 -0
  212. package/dist/site-manifest-keys.d.ts +107 -0
  213. package/dist/site-manifest-keys.d.ts.map +1 -0
  214. package/dist/site-manifest-keys.js +146 -0
  215. package/dist/site-manifest-keys.js.map +1 -0
  216. package/dist/site-manifest.d.ts +286 -0
  217. package/dist/site-manifest.d.ts.map +1 -0
  218. package/dist/site-manifest.js +100 -0
  219. package/dist/site-manifest.js.map +1 -0
  220. package/dist/source-archive.d.ts +119 -0
  221. package/dist/source-archive.d.ts.map +1 -0
  222. package/dist/source-archive.js +644 -0
  223. package/dist/source-archive.js.map +1 -0
  224. package/dist/source-package-corpus.d.ts +55 -0
  225. package/dist/source-package-corpus.d.ts.map +1 -0
  226. package/dist/source-package-corpus.js +303 -0
  227. package/dist/source-package-corpus.js.map +1 -0
  228. package/dist/source-package.d.ts +227 -0
  229. package/dist/source-package.d.ts.map +1 -0
  230. package/dist/source-package.js +361 -0
  231. package/dist/source-package.js.map +1 -0
  232. package/dist/source-secrets.d.ts +21 -0
  233. package/dist/source-secrets.d.ts.map +1 -0
  234. package/dist/source-secrets.js +43 -0
  235. package/dist/source-secrets.js.map +1 -0
  236. package/dist/ssr-cap.d.ts +61 -0
  237. package/dist/ssr-cap.d.ts.map +1 -0
  238. package/dist/ssr-cap.js +107 -0
  239. package/dist/ssr-cap.js.map +1 -0
  240. package/dist/ssr-kv.d.ts +18 -0
  241. package/dist/ssr-kv.d.ts.map +1 -0
  242. package/dist/ssr-kv.js +18 -0
  243. package/dist/ssr-kv.js.map +1 -0
  244. package/dist/ssr-version-ledger.d.ts +53 -0
  245. package/dist/ssr-version-ledger.d.ts.map +1 -0
  246. package/dist/ssr-version-ledger.js +88 -0
  247. package/dist/ssr-version-ledger.js.map +1 -0
  248. package/dist/style-references.d.ts +58 -0
  249. package/dist/style-references.d.ts.map +1 -0
  250. package/dist/style-references.js +241 -0
  251. package/dist/style-references.js.map +1 -0
  252. package/dist/tag-name.d.ts +87 -0
  253. package/dist/tag-name.d.ts.map +1 -0
  254. package/dist/tag-name.js +222 -0
  255. package/dist/tag-name.js.map +1 -0
  256. package/dist/tar-writer.d.ts +74 -0
  257. package/dist/tar-writer.d.ts.map +1 -0
  258. package/dist/tar-writer.js +148 -0
  259. package/dist/tar-writer.js.map +1 -0
  260. package/dist/testing.d.ts +11 -0
  261. package/dist/testing.d.ts.map +1 -0
  262. package/dist/testing.js +11 -0
  263. package/dist/testing.js.map +1 -0
  264. package/dist/text-codec.d.ts +36 -0
  265. package/dist/text-codec.d.ts.map +1 -0
  266. package/dist/text-codec.js +32 -0
  267. package/dist/text-codec.js.map +1 -0
  268. package/dist/url-value.d.ts +41 -0
  269. package/dist/url-value.d.ts.map +1 -0
  270. package/dist/url-value.js +147 -0
  271. package/dist/url-value.js.map +1 -0
  272. package/dist/usage-guard.d.ts +99 -0
  273. package/dist/usage-guard.d.ts.map +1 -0
  274. package/dist/usage-guard.js +104 -0
  275. package/dist/usage-guard.js.map +1 -0
  276. package/dist/usage-mirror.d.ts +55 -0
  277. package/dist/usage-mirror.d.ts.map +1 -0
  278. package/dist/usage-mirror.js +52 -0
  279. package/dist/usage-mirror.js.map +1 -0
  280. package/dist/value-check.d.ts +88 -0
  281. package/dist/value-check.d.ts.map +1 -0
  282. package/dist/value-check.js +279 -0
  283. package/dist/value-check.js.map +1 -0
  284. package/dist/value-patterns.d.ts +9 -0
  285. package/dist/value-patterns.d.ts.map +1 -0
  286. package/dist/value-patterns.js +17 -0
  287. package/dist/value-patterns.js.map +1 -0
  288. package/dist/value-schema.d.ts +796 -0
  289. package/dist/value-schema.d.ts.map +1 -0
  290. package/dist/value-schema.js +231 -0
  291. package/dist/value-schema.js.map +1 -0
  292. package/dist/zod-free.d.ts +59 -0
  293. package/dist/zod-free.d.ts.map +1 -0
  294. package/dist/zod-free.js +57 -0
  295. package/dist/zod-free.js.map +1 -0
  296. package/package.json +75 -3
  297. package/schema/DEPLOYED +12 -0
  298. package/schema/build-diagnostic.v1.json +63 -0
  299. package/schema/component-manifest.v1.json +1000 -0
  300. package/schema/data-api.v1.json +194 -0
  301. package/schema/library-manifest.v1.json +60 -0
  302. package/schema/published/SHA256SUMS +36 -0
  303. package/schema/published/build-diagnostic/v1.10.json +83 -0
  304. package/schema/published/build-diagnostic/v1.3.json +83 -0
  305. package/schema/published/build-diagnostic/v1.4.json +83 -0
  306. package/schema/published/build-diagnostic/v1.5.json +83 -0
  307. package/schema/published/build-diagnostic/v1.6.json +83 -0
  308. package/schema/published/build-diagnostic/v1.7.json +83 -0
  309. package/schema/published/build-diagnostic/v1.8.json +83 -0
  310. package/schema/published/build-diagnostic/v1.9.json +83 -0
  311. package/schema/published/component-manifest/v1.10.json +1443 -0
  312. package/schema/published/component-manifest/v1.3.json +1411 -0
  313. package/schema/published/component-manifest/v1.4.json +1419 -0
  314. package/schema/published/component-manifest/v1.5.json +1437 -0
  315. package/schema/published/component-manifest/v1.6.json +1437 -0
  316. package/schema/published/component-manifest/v1.7.json +1437 -0
  317. package/schema/published/component-manifest/v1.8.json +1437 -0
  318. package/schema/published/component-manifest/v1.9.json +1437 -0
  319. package/schema/published/data-api/v1.10.json +282 -0
  320. package/schema/published/data-api/v1.3.json +281 -0
  321. package/schema/published/data-api/v1.4.json +281 -0
  322. package/schema/published/data-api/v1.5.json +281 -0
  323. package/schema/published/data-api/v1.6.json +281 -0
  324. package/schema/published/data-api/v1.7.json +281 -0
  325. package/schema/published/data-api/v1.8.json +282 -0
  326. package/schema/published/data-api/v1.9.json +282 -0
  327. package/schema/published/library-manifest/v1.10.json +68 -0
  328. package/schema/published/library-manifest/v1.5.json +68 -0
  329. package/schema/published/library-manifest/v1.6.json +68 -0
  330. package/schema/published/library-manifest/v1.7.json +68 -0
  331. package/schema/published/library-manifest/v1.8.json +68 -0
  332. package/schema/published/library-manifest/v1.9.json +68 -0
  333. package/schema/published/taggor-config/v1.10.json +56 -0
  334. package/schema/published/taggor-config/v1.5.json +56 -0
  335. package/schema/published/taggor-config/v1.6.json +56 -0
  336. package/schema/published/taggor-config/v1.7.json +56 -0
  337. package/schema/published/taggor-config/v1.8.json +56 -0
  338. package/schema/published/taggor-config/v1.9.json +56 -0
  339. package/schema/taggor-config.v1.json +39 -0
@@ -0,0 +1,107 @@
1
+ /** Source of the pattern every site key matches, for schemas and database checks. */
2
+ export declare const SITE_KEY_PATTERN = "^st_[a-z2-7]{10}$";
3
+ /**
4
+ * Pattern of a site's Turnstile site key (TAG-724): a PUBLIC key (the secret stays on the edge),
5
+ * the same shape the loader accepts.
6
+ */
7
+ export declare const TURNSTILE_SITE_KEY_PATTERN = "^[A-Za-z0-9_-]{1,100}$";
8
+ /**
9
+ * Whether a value is a well-formed Turnstile site key.
10
+ * Inputs: any value. Output: true for a string of 1 to 100 of `A-Za-z0-9_-`. Errors: none.
11
+ * Side effects: none.
12
+ */
13
+ export declare function isTurnstileSiteKey(value: unknown): value is string;
14
+ /** What a site does with a submission the bot filter marked (TAG-730); `keep` is the default. */
15
+ export declare const SUSPECT_POLICIES: readonly ["keep", "drop"];
16
+ /** One of `SUSPECT_POLICIES`. */
17
+ export type SuspectPolicy = (typeof SUSPECT_POLICIES)[number];
18
+ /**
19
+ * Whether a site honors the visitor's Global Privacy Control (`Sec-GPC: 1`) or Do Not Track (`DNT: 1`)
20
+ * signal at the event ingest (TAG-816) when its `protection.respectGpc` is absent. Privacy by default
21
+ * (golden rule 6): ON. The one place that holds the default; flip it here, nowhere else.
22
+ */
23
+ export declare const RESPECT_GPC_DEFAULT = true;
24
+ /**
25
+ * Default daily cap of submissions per site to a form without a Turnstile key, and the hard
26
+ * bounds of a site's own `protection.dailyCap` (TAG-730). The platform ceiling is lower and comes
27
+ * from the deploy's environment (the API reads it); the upper bound here only keeps a
28
+ * manifest value sane.
29
+ */
30
+ export declare const DAILY_CAP_DEFAULT = 1000;
31
+ export declare const DAILY_CAP_MIN = 1;
32
+ export declare const DAILY_CAP_HARD_MAX = 1000000;
33
+ /** The channels a manifest is stored under, in the order the edge looks them up. */
34
+ export declare const MANIFEST_CHANNELS: readonly ["production", "staging"];
35
+ /** One of `MANIFEST_CHANNELS`. */
36
+ export type ManifestChannel = (typeof MANIFEST_CHANNELS)[number];
37
+ /**
38
+ * Whether a value is a well-formed site key.
39
+ * Inputs: any value. Output: a type guard. Errors: none. Side effects: none.
40
+ */
41
+ export declare function isSiteKey(value: unknown): value is string;
42
+ /**
43
+ * KV key of a site's manifest in one channel.
44
+ * Inputs: a site key and a channel. Output: `manifest:<siteKey>:<channel>`.
45
+ * Errors: `TypeError` when the site key is malformed (keys never carry caller text).
46
+ * Side effects: none.
47
+ */
48
+ export declare function manifestKvKey(siteKey: string, channel: ManifestChannel): string;
49
+ /** Seconds a daily cap mark lives (KV's `expirationTtl`); the consumer refreshes it while the cap holds. */
50
+ export declare const DAILY_CAP_MARK_TTL_SECONDS = 3600;
51
+ /**
52
+ * KV key of a site's daily cap mark (TAG-730).
53
+ * Inputs: a site key. Output: `cap:<siteKey>`. Errors: `TypeError` when the site key is malformed.
54
+ * Side effects: none.
55
+ */
56
+ export declare function dailyCapKvKey(siteKey: string): string;
57
+ /**
58
+ * Seconds a Free plan submission cut mark lives (TAG-1628). Six hours, like the render cut marks: the
59
+ * consumer rewrites it with every message it refuses and the usage job with every visit, so a plan
60
+ * upgrade lifts the cut within this time and a lapse of the writers only lets a few messages through
61
+ * (the consumer refuses them again and rewrites the mark).
62
+ */
63
+ export declare const SUBMISSION_CAP_MARK_TTL_SECONDS: number;
64
+ /**
65
+ * KV key of a site's Free plan submission cut mark (TAG-1628, decision 84).
66
+ * Inputs: a site key. Output: `subcap:<siteKey>`. Errors: `TypeError` when the site key is malformed.
67
+ * Side effects: none.
68
+ */
69
+ export declare function submissionCapKvKey(siteKey: string): string;
70
+ /**
71
+ * KV key of a site's usage cut mark (TAG-1714, written by the plan's usage cut since TAG-1625):
72
+ * present while the site's workspace is past its plan's renders per month plus the grace (TAG-1607). The edge reads it on the loader and manifest routes
73
+ * only and then serves the inert answer; the data ingest ignores it, so a form already on a page
74
+ * keeps collecting (decision 64).
75
+ * Inputs: a site key. Output: `viewcap:<siteKey>`. Errors: `TypeError` when the site key is malformed.
76
+ * Side effects: none.
77
+ */
78
+ export declare function viewCapKvKey(siteKey: string): string;
79
+ /**
80
+ * KV key of the published-bundle index entry of a public artifact key.
81
+ * Inputs: an artifact key such as `b/<sha256>.js`. Output: `published:<key>`.
82
+ * Errors: `TypeError` when the key is not a public artifact key. Side effects: none.
83
+ */
84
+ export declare function publishedKvKey(artifactKey: string): string;
85
+ /** The manifest shape before validation, as served for a site without components. */
86
+ export interface EmptySiteManifest {
87
+ readonly siteKey: string;
88
+ readonly revision: 0;
89
+ readonly allowedDomains: readonly [];
90
+ readonly components: readonly [];
91
+ }
92
+ /**
93
+ * The manifest of a site key the edge does not know (or may not show): no components, revision 0.
94
+ * Unknown, disabled and deleted keys all get exactly this, so the answer reveals nothing.
95
+ * Inputs: the requested, well-formed site key. Output: a fresh object. Errors: none.
96
+ * Side effects: none.
97
+ */
98
+ export declare function emptySiteManifest(siteKey: string): EmptySiteManifest;
99
+ /**
100
+ * Most components one site manifest lists: the PLATFORM ceiling (TAG-1623), equal to the highest
101
+ * `planQuotas[*].componentsPerSite` (a test keeps them equal). What one site may attach depends on
102
+ * its plan; this is only what the manifest schema and the loader accept at all, so a plan change
103
+ * never makes a stored manifest invalid. The loader repeats the number (`MAX_COMPONENTS`, it
104
+ * cannot import the contract) and a test keeps that copy equal too.
105
+ */
106
+ export declare const SITE_MANIFEST_MAX_COMPONENTS = 800;
107
+ //# sourceMappingURL=site-manifest-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site-manifest-keys.d.ts","sourceRoot":"","sources":["../src/site-manifest-keys.ts"],"names":[],"mappings":"AAuBA,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAIpD;;;GAGG;AACH,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AAInE;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAElE;AAED,iGAAiG;AACjG,eAAO,MAAM,gBAAgB,2BAA4B,CAAC;AAE1D,iCAAiC;AACjC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,OAAQ,CAAC;AACvC,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,kBAAkB,UAAY,CAAC;AAE5C,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,oCAAqC,CAAC;AAEpE,kCAAkC;AAClC,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAG/E;AAED,4GAA4G;AAC5G,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B,QAAc,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAG1D;AAED,qFAAqF;AACrF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrB,QAAQ,CAAC,cAAc,EAAE,SAAS,EAAE,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAEpE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,MAAM,CAAC"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Zod-free pieces of the site manifest (TAG-602): the site key format, the KV key layout of the
3
+ * manifest store and of the published-bundle index, and the manifest served for a site that does
4
+ * not exist. The API writes KV with these keys and the edge reads with them (the edge never
5
+ * writes, threat T-60), so the layout lives in one place. Nothing here imports Zod, so the edge
6
+ * and the browser runtime can import it from `@taggor/contract/zod-free`.
7
+ *
8
+ * KV layout (one namespace, `MANIFESTS` in the edge):
9
+ * - `manifest:<siteKey>:<channel>`: the JSON of one `SiteManifest` (the channel is the site's
10
+ * environment). Absent for a site that is unknown, disabled or deleted, so those three read
11
+ * alike (TAG-622).
12
+ * - `published:<artifactKey>`: JSON `{ "contractVersion": "1.0.0" }` for each public artifact
13
+ * (`b/<sha256>.js|css`) of a version a site manifest points to. The CDN serves only keys with
14
+ * this entry, so a build that never became a published version is never hosted (TAG-411).
15
+ * - `cap:<siteKey>`: written by the API's queue consumer (TAG-730) for an hour when a site's form
16
+ * without a Turnstile key spent its daily cap of submissions; the edge answers 429
17
+ * `daily_cap_reached` while it exists. The value is not read, only the key's presence.
18
+ * - `subcap:<siteKey>`: written by the same consumer and by the hourly usage job (TAG-1628, decision
19
+ * 84) when the workspace of a FREE site spent its month's submissions or its storage; the edge
20
+ * answers 429 before reading the body while it exists. Only the key's presence is read.
21
+ */
22
+ import { isPublicArtifactKey } from "./artifact-keys.js";
23
+ /** Source of the pattern every site key matches, for schemas and database checks. */
24
+ export const SITE_KEY_PATTERN = "^st_[a-z2-7]{10}$";
25
+ const SITE_KEY = new RegExp(SITE_KEY_PATTERN);
26
+ /**
27
+ * Pattern of a site's Turnstile site key (TAG-724): a PUBLIC key (the secret stays on the edge),
28
+ * the same shape the loader accepts.
29
+ */
30
+ export const TURNSTILE_SITE_KEY_PATTERN = "^[A-Za-z0-9_-]{1,100}$";
31
+ const TURNSTILE_SITE_KEY = new RegExp(TURNSTILE_SITE_KEY_PATTERN);
32
+ /**
33
+ * Whether a value is a well-formed Turnstile site key.
34
+ * Inputs: any value. Output: true for a string of 1 to 100 of `A-Za-z0-9_-`. Errors: none.
35
+ * Side effects: none.
36
+ */
37
+ export function isTurnstileSiteKey(value) {
38
+ return typeof value === "string" && TURNSTILE_SITE_KEY.test(value);
39
+ }
40
+ /** What a site does with a submission the bot filter marked (TAG-730); `keep` is the default. */
41
+ export const SUSPECT_POLICIES = ["keep", "drop"];
42
+ /**
43
+ * Whether a site honors the visitor's Global Privacy Control (`Sec-GPC: 1`) or Do Not Track (`DNT: 1`)
44
+ * signal at the event ingest (TAG-816) when its `protection.respectGpc` is absent. Privacy by default
45
+ * (golden rule 6): ON. The one place that holds the default; flip it here, nowhere else.
46
+ */
47
+ export const RESPECT_GPC_DEFAULT = true;
48
+ /**
49
+ * Default daily cap of submissions per site to a form without a Turnstile key, and the hard
50
+ * bounds of a site's own `protection.dailyCap` (TAG-730). The platform ceiling is lower and comes
51
+ * from the deploy's environment (the API reads it); the upper bound here only keeps a
52
+ * manifest value sane.
53
+ */
54
+ export const DAILY_CAP_DEFAULT = 1_000;
55
+ export const DAILY_CAP_MIN = 1;
56
+ export const DAILY_CAP_HARD_MAX = 1_000_000;
57
+ /** The channels a manifest is stored under, in the order the edge looks them up. */
58
+ export const MANIFEST_CHANNELS = ["production", "staging"];
59
+ /**
60
+ * Whether a value is a well-formed site key.
61
+ * Inputs: any value. Output: a type guard. Errors: none. Side effects: none.
62
+ */
63
+ export function isSiteKey(value) {
64
+ return typeof value === "string" && SITE_KEY.test(value);
65
+ }
66
+ /**
67
+ * KV key of a site's manifest in one channel.
68
+ * Inputs: a site key and a channel. Output: `manifest:<siteKey>:<channel>`.
69
+ * Errors: `TypeError` when the site key is malformed (keys never carry caller text).
70
+ * Side effects: none.
71
+ */
72
+ export function manifestKvKey(siteKey, channel) {
73
+ if (!isSiteKey(siteKey))
74
+ throw new TypeError("not a site key");
75
+ return `manifest:${siteKey}:${channel}`;
76
+ }
77
+ /** Seconds a daily cap mark lives (KV's `expirationTtl`); the consumer refreshes it while the cap holds. */
78
+ export const DAILY_CAP_MARK_TTL_SECONDS = 3600;
79
+ /**
80
+ * KV key of a site's daily cap mark (TAG-730).
81
+ * Inputs: a site key. Output: `cap:<siteKey>`. Errors: `TypeError` when the site key is malformed.
82
+ * Side effects: none.
83
+ */
84
+ export function dailyCapKvKey(siteKey) {
85
+ if (!isSiteKey(siteKey))
86
+ throw new TypeError("not a site key");
87
+ return `cap:${siteKey}`;
88
+ }
89
+ /**
90
+ * Seconds a Free plan submission cut mark lives (TAG-1628). Six hours, like the render cut marks: the
91
+ * consumer rewrites it with every message it refuses and the usage job with every visit, so a plan
92
+ * upgrade lifts the cut within this time and a lapse of the writers only lets a few messages through
93
+ * (the consumer refuses them again and rewrites the mark).
94
+ */
95
+ export const SUBMISSION_CAP_MARK_TTL_SECONDS = 6 * 60 * 60;
96
+ /**
97
+ * KV key of a site's Free plan submission cut mark (TAG-1628, decision 84).
98
+ * Inputs: a site key. Output: `subcap:<siteKey>`. Errors: `TypeError` when the site key is malformed.
99
+ * Side effects: none.
100
+ */
101
+ export function submissionCapKvKey(siteKey) {
102
+ if (!isSiteKey(siteKey))
103
+ throw new TypeError("not a site key");
104
+ return `subcap:${siteKey}`;
105
+ }
106
+ /**
107
+ * KV key of a site's usage cut mark (TAG-1714, written by the plan's usage cut since TAG-1625):
108
+ * present while the site's workspace is past its plan's renders per month plus the grace (TAG-1607). The edge reads it on the loader and manifest routes
109
+ * only and then serves the inert answer; the data ingest ignores it, so a form already on a page
110
+ * keeps collecting (decision 64).
111
+ * Inputs: a site key. Output: `viewcap:<siteKey>`. Errors: `TypeError` when the site key is malformed.
112
+ * Side effects: none.
113
+ */
114
+ export function viewCapKvKey(siteKey) {
115
+ if (!isSiteKey(siteKey))
116
+ throw new TypeError("not a site key");
117
+ return `viewcap:${siteKey}`;
118
+ }
119
+ /**
120
+ * KV key of the published-bundle index entry of a public artifact key.
121
+ * Inputs: an artifact key such as `b/<sha256>.js`. Output: `published:<key>`.
122
+ * Errors: `TypeError` when the key is not a public artifact key. Side effects: none.
123
+ */
124
+ export function publishedKvKey(artifactKey) {
125
+ if (!isPublicArtifactKey(artifactKey))
126
+ throw new TypeError("not a public artifact key");
127
+ return `published:${artifactKey}`;
128
+ }
129
+ /**
130
+ * The manifest of a site key the edge does not know (or may not show): no components, revision 0.
131
+ * Unknown, disabled and deleted keys all get exactly this, so the answer reveals nothing.
132
+ * Inputs: the requested, well-formed site key. Output: a fresh object. Errors: none.
133
+ * Side effects: none.
134
+ */
135
+ export function emptySiteManifest(siteKey) {
136
+ return { siteKey, revision: 0, allowedDomains: [], components: [] };
137
+ }
138
+ /**
139
+ * Most components one site manifest lists: the PLATFORM ceiling (TAG-1623), equal to the highest
140
+ * `planQuotas[*].componentsPerSite` (a test keeps them equal). What one site may attach depends on
141
+ * its plan; this is only what the manifest schema and the loader accept at all, so a plan change
142
+ * never makes a stored manifest invalid. The loader repeats the number (`MAX_COMPONENTS`, it
143
+ * cannot import the contract) and a test keeps that copy equal too.
144
+ */
145
+ export const SITE_MANIFEST_MAX_COMPONENTS = 800;
146
+ //# sourceMappingURL=site-manifest-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site-manifest-keys.js","sourceRoot":"","sources":["../src/site-manifest-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,qFAAqF;AACrF,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAEpD,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAC;AAEnE,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAElE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrE,CAAC;AAED,iGAAiG;AACjG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAK1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC;AACvC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAC/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAE5C,oFAAoF;AACpF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,SAAS,CAAU,CAAC;AAKpE;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,OAAwB;IACrE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC/D,OAAO,YAAY,OAAO,IAAI,OAAO,EAAE,CAAC;AAC1C,CAAC;AAED,4GAA4G;AAC5G,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC/D,OAAO,OAAO,OAAO,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC/D,OAAO,UAAU,OAAO,EAAE,CAAC;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC/D,OAAO,WAAW,OAAO,EAAE,CAAC;AAC9B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAC;IACxF,OAAO,aAAa,WAAW,EAAE,CAAC;AACpC,CAAC;AAUD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,cAAc,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;AACtE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,CAAC"}
@@ -0,0 +1,286 @@
1
+ /**
2
+ * The site manifest (TAG-602): what a site's snippet needs to load its components, compiled by the
3
+ * API from Postgres and stored in KV, served read-only by the edge at `/m/<siteKey>.json`. Public
4
+ * by nature (it goes to every visitor): it holds no workspace id, component id or customer data
5
+ * beyond the site's own allowed domains and component defaults.
6
+ *
7
+ * `servedOn` is stamped by the edge with the server's day (`YYYY-MM-DD`); the runtime reads the
8
+ * day from here and never from the visitor's clock. `revision` only grows, so a stale write loses.
9
+ */
10
+ import * as z from "zod";
11
+ import { SITE_MANIFEST_MAX_COMPONENTS } from "./site-manifest-keys.js";
12
+ export { SITE_MANIFEST_MAX_COMPONENTS };
13
+ /**
14
+ * What the data ingest needs to know about a component's collections (TAG-703): the declared
15
+ * collections to validate submissions against, whether they hold personal data and the name of
16
+ * the prop that carries the privacy policy URL. Copied by the API from the published version's
17
+ * manifest, so the edge never trusts the request for any of it. The edge strips it from the
18
+ * public `/m/` and `/s/` answers: visitors' pages do not need it.
19
+ */
20
+ export declare const siteManifestComponentDataSchema: z.ZodObject<{
21
+ collections: z.ZodRecord<z.ZodString, z.ZodObject<{
22
+ description: z.ZodOptional<z.ZodString>;
23
+ fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
24
+ type: z.ZodLiteral<"string">;
25
+ description: z.ZodOptional<z.ZodString>;
26
+ minLength: z.ZodOptional<z.ZodInt>;
27
+ maxLength: z.ZodOptional<z.ZodInt>;
28
+ format: z.ZodOptional<z.ZodEnum<{
29
+ url: "url";
30
+ date: "date";
31
+ email: "email";
32
+ tel: "tel";
33
+ "date-time": "date-time";
34
+ }>>;
35
+ }, z.core.$strict>, z.ZodObject<{
36
+ type: z.ZodLiteral<"number">;
37
+ description: z.ZodOptional<z.ZodString>;
38
+ min: z.ZodOptional<z.ZodNumber>;
39
+ max: z.ZodOptional<z.ZodNumber>;
40
+ integer: z.ZodOptional<z.ZodBoolean>;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ type: z.ZodLiteral<"boolean">;
43
+ description: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strict>, z.ZodObject<{
45
+ type: z.ZodLiteral<"enum">;
46
+ description: z.ZodOptional<z.ZodString>;
47
+ values: z.ZodArray<z.ZodString>;
48
+ }, z.core.$strict>, z.ZodObject<{
49
+ type: z.ZodLiteral<"array">;
50
+ description: z.ZodOptional<z.ZodString>;
51
+ items: z.ZodDiscriminatedUnion<[z.ZodObject<{
52
+ type: z.ZodLiteral<"string">;
53
+ description: z.ZodOptional<z.ZodString>;
54
+ minLength: z.ZodOptional<z.ZodInt>;
55
+ maxLength: z.ZodOptional<z.ZodInt>;
56
+ format: z.ZodOptional<z.ZodEnum<{
57
+ url: "url";
58
+ date: "date";
59
+ email: "email";
60
+ tel: "tel";
61
+ "date-time": "date-time";
62
+ }>>;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ type: z.ZodLiteral<"number">;
65
+ description: z.ZodOptional<z.ZodString>;
66
+ min: z.ZodOptional<z.ZodNumber>;
67
+ max: z.ZodOptional<z.ZodNumber>;
68
+ integer: z.ZodOptional<z.ZodBoolean>;
69
+ }, z.core.$strict>, z.ZodObject<{
70
+ type: z.ZodLiteral<"boolean">;
71
+ description: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$strict>, z.ZodObject<{
73
+ type: z.ZodLiteral<"enum">;
74
+ description: z.ZodOptional<z.ZodString>;
75
+ values: z.ZodArray<z.ZodString>;
76
+ }, z.core.$strict>], "type">;
77
+ minItems: z.ZodOptional<z.ZodInt>;
78
+ maxItems: z.ZodOptional<z.ZodInt>;
79
+ }, z.core.$strict>], "type">>;
80
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
+ visibility: z.ZodOptional<z.ZodEnum<{
82
+ public: "public";
83
+ private: "private";
84
+ }>>;
85
+ }, z.core.$strict>>;
86
+ personal: z.ZodOptional<z.ZodBoolean>;
87
+ privacyPolicyUrl: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strict>;
89
+ /** One component a site loads. */
90
+ export declare const siteManifestComponentSchema: z.ZodObject<{
91
+ tag: z.ZodString;
92
+ versionHash: z.ZodString;
93
+ bundleUrl: z.ZodString;
94
+ propsSchemaHash: z.ZodString;
95
+ contractVersion: z.ZodString;
96
+ defaults: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
97
+ status: z.ZodEnum<{
98
+ active: "active";
99
+ disabled: "disabled";
100
+ }>;
101
+ loading: z.ZodOptional<z.ZodEnum<{
102
+ idle: "idle";
103
+ }>>;
104
+ eventSampleRate: z.ZodOptional<z.ZodNumber>;
105
+ data: z.ZodOptional<z.ZodObject<{
106
+ collections: z.ZodRecord<z.ZodString, z.ZodObject<{
107
+ description: z.ZodOptional<z.ZodString>;
108
+ fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
109
+ type: z.ZodLiteral<"string">;
110
+ description: z.ZodOptional<z.ZodString>;
111
+ minLength: z.ZodOptional<z.ZodInt>;
112
+ maxLength: z.ZodOptional<z.ZodInt>;
113
+ format: z.ZodOptional<z.ZodEnum<{
114
+ url: "url";
115
+ date: "date";
116
+ email: "email";
117
+ tel: "tel";
118
+ "date-time": "date-time";
119
+ }>>;
120
+ }, z.core.$strict>, z.ZodObject<{
121
+ type: z.ZodLiteral<"number">;
122
+ description: z.ZodOptional<z.ZodString>;
123
+ min: z.ZodOptional<z.ZodNumber>;
124
+ max: z.ZodOptional<z.ZodNumber>;
125
+ integer: z.ZodOptional<z.ZodBoolean>;
126
+ }, z.core.$strict>, z.ZodObject<{
127
+ type: z.ZodLiteral<"boolean">;
128
+ description: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strict>, z.ZodObject<{
130
+ type: z.ZodLiteral<"enum">;
131
+ description: z.ZodOptional<z.ZodString>;
132
+ values: z.ZodArray<z.ZodString>;
133
+ }, z.core.$strict>, z.ZodObject<{
134
+ type: z.ZodLiteral<"array">;
135
+ description: z.ZodOptional<z.ZodString>;
136
+ items: z.ZodDiscriminatedUnion<[z.ZodObject<{
137
+ type: z.ZodLiteral<"string">;
138
+ description: z.ZodOptional<z.ZodString>;
139
+ minLength: z.ZodOptional<z.ZodInt>;
140
+ maxLength: z.ZodOptional<z.ZodInt>;
141
+ format: z.ZodOptional<z.ZodEnum<{
142
+ url: "url";
143
+ date: "date";
144
+ email: "email";
145
+ tel: "tel";
146
+ "date-time": "date-time";
147
+ }>>;
148
+ }, z.core.$strict>, z.ZodObject<{
149
+ type: z.ZodLiteral<"number">;
150
+ description: z.ZodOptional<z.ZodString>;
151
+ min: z.ZodOptional<z.ZodNumber>;
152
+ max: z.ZodOptional<z.ZodNumber>;
153
+ integer: z.ZodOptional<z.ZodBoolean>;
154
+ }, z.core.$strict>, z.ZodObject<{
155
+ type: z.ZodLiteral<"boolean">;
156
+ description: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strict>, z.ZodObject<{
158
+ type: z.ZodLiteral<"enum">;
159
+ description: z.ZodOptional<z.ZodString>;
160
+ values: z.ZodArray<z.ZodString>;
161
+ }, z.core.$strict>], "type">;
162
+ minItems: z.ZodOptional<z.ZodInt>;
163
+ maxItems: z.ZodOptional<z.ZodInt>;
164
+ }, z.core.$strict>], "type">>;
165
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
166
+ visibility: z.ZodOptional<z.ZodEnum<{
167
+ public: "public";
168
+ private: "private";
169
+ }>>;
170
+ }, z.core.$strict>>;
171
+ personal: z.ZodOptional<z.ZodBoolean>;
172
+ privacyPolicyUrl: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strict>>;
174
+ }, z.core.$strict>;
175
+ /** The `data` entry of a site manifest component. */
176
+ export type SiteManifestComponentData = z.infer<typeof siteManifestComponentDataSchema>;
177
+ /** One entry of `SiteManifest.components`. */
178
+ export type SiteManifestComponent = z.infer<typeof siteManifestComponentSchema>;
179
+ /** The manifest of one site. */
180
+ export declare const siteManifestSchema: z.ZodObject<{
181
+ siteKey: z.ZodString;
182
+ revision: z.ZodNumber;
183
+ allowedDomains: z.ZodArray<z.ZodString>;
184
+ components: z.ZodArray<z.ZodObject<{
185
+ tag: z.ZodString;
186
+ versionHash: z.ZodString;
187
+ bundleUrl: z.ZodString;
188
+ propsSchemaHash: z.ZodString;
189
+ contractVersion: z.ZodString;
190
+ defaults: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
191
+ status: z.ZodEnum<{
192
+ active: "active";
193
+ disabled: "disabled";
194
+ }>;
195
+ loading: z.ZodOptional<z.ZodEnum<{
196
+ idle: "idle";
197
+ }>>;
198
+ eventSampleRate: z.ZodOptional<z.ZodNumber>;
199
+ data: z.ZodOptional<z.ZodObject<{
200
+ collections: z.ZodRecord<z.ZodString, z.ZodObject<{
201
+ description: z.ZodOptional<z.ZodString>;
202
+ fields: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
203
+ type: z.ZodLiteral<"string">;
204
+ description: z.ZodOptional<z.ZodString>;
205
+ minLength: z.ZodOptional<z.ZodInt>;
206
+ maxLength: z.ZodOptional<z.ZodInt>;
207
+ format: z.ZodOptional<z.ZodEnum<{
208
+ url: "url";
209
+ date: "date";
210
+ email: "email";
211
+ tel: "tel";
212
+ "date-time": "date-time";
213
+ }>>;
214
+ }, z.core.$strict>, z.ZodObject<{
215
+ type: z.ZodLiteral<"number">;
216
+ description: z.ZodOptional<z.ZodString>;
217
+ min: z.ZodOptional<z.ZodNumber>;
218
+ max: z.ZodOptional<z.ZodNumber>;
219
+ integer: z.ZodOptional<z.ZodBoolean>;
220
+ }, z.core.$strict>, z.ZodObject<{
221
+ type: z.ZodLiteral<"boolean">;
222
+ description: z.ZodOptional<z.ZodString>;
223
+ }, z.core.$strict>, z.ZodObject<{
224
+ type: z.ZodLiteral<"enum">;
225
+ description: z.ZodOptional<z.ZodString>;
226
+ values: z.ZodArray<z.ZodString>;
227
+ }, z.core.$strict>, z.ZodObject<{
228
+ type: z.ZodLiteral<"array">;
229
+ description: z.ZodOptional<z.ZodString>;
230
+ items: z.ZodDiscriminatedUnion<[z.ZodObject<{
231
+ type: z.ZodLiteral<"string">;
232
+ description: z.ZodOptional<z.ZodString>;
233
+ minLength: z.ZodOptional<z.ZodInt>;
234
+ maxLength: z.ZodOptional<z.ZodInt>;
235
+ format: z.ZodOptional<z.ZodEnum<{
236
+ url: "url";
237
+ date: "date";
238
+ email: "email";
239
+ tel: "tel";
240
+ "date-time": "date-time";
241
+ }>>;
242
+ }, z.core.$strict>, z.ZodObject<{
243
+ type: z.ZodLiteral<"number">;
244
+ description: z.ZodOptional<z.ZodString>;
245
+ min: z.ZodOptional<z.ZodNumber>;
246
+ max: z.ZodOptional<z.ZodNumber>;
247
+ integer: z.ZodOptional<z.ZodBoolean>;
248
+ }, z.core.$strict>, z.ZodObject<{
249
+ type: z.ZodLiteral<"boolean">;
250
+ description: z.ZodOptional<z.ZodString>;
251
+ }, z.core.$strict>, z.ZodObject<{
252
+ type: z.ZodLiteral<"enum">;
253
+ description: z.ZodOptional<z.ZodString>;
254
+ values: z.ZodArray<z.ZodString>;
255
+ }, z.core.$strict>], "type">;
256
+ minItems: z.ZodOptional<z.ZodInt>;
257
+ maxItems: z.ZodOptional<z.ZodInt>;
258
+ }, z.core.$strict>], "type">>;
259
+ required: z.ZodOptional<z.ZodArray<z.ZodString>>;
260
+ visibility: z.ZodOptional<z.ZodEnum<{
261
+ public: "public";
262
+ private: "private";
263
+ }>>;
264
+ }, z.core.$strict>>;
265
+ personal: z.ZodOptional<z.ZodBoolean>;
266
+ privacyPolicyUrl: z.ZodOptional<z.ZodString>;
267
+ }, z.core.$strict>>;
268
+ }, z.core.$strict>>;
269
+ turnstileSiteKey: z.ZodOptional<z.ZodString>;
270
+ protection: z.ZodOptional<z.ZodObject<{
271
+ suspects: z.ZodOptional<z.ZodEnum<{
272
+ keep: "keep";
273
+ drop: "drop";
274
+ }>>;
275
+ dailyCap: z.ZodOptional<z.ZodInt>;
276
+ respectGpc: z.ZodOptional<z.ZodBoolean>;
277
+ }, z.core.$strict>>;
278
+ runtimeRing: z.ZodOptional<z.ZodEnum<{
279
+ canary: "canary";
280
+ stable: "stable";
281
+ }>>;
282
+ servedOn: z.ZodOptional<z.ZodString>;
283
+ }, z.core.$strict>;
284
+ /** The manifest of a site, validated. */
285
+ export type SiteManifest = z.infer<typeof siteManifestSchema>;
286
+ //# sourceMappingURL=site-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site-manifest.d.ts","sourceRoot":"","sources":["../src/site-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAQzB,OAAO,EAIL,4BAA4B,EAG7B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,4BAA4B,EAAE,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAS1C,CAAC;AAEH,kCAAkC;AAClC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6BtC,CAAC;AAEH,qDAAqD;AACrD,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,8CAA8C;AAC9C,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,gCAAgC;AAChC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAmC7B,CAAC;AAEH,yCAAyC;AACzC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The site manifest (TAG-602): what a site's snippet needs to load its components, compiled by the
3
+ * API from Postgres and stored in KV, served read-only by the edge at `/m/<siteKey>.json`. Public
4
+ * by nature (it goes to every visitor): it holds no workspace id, component id or customer data
5
+ * beyond the site's own allowed domains and component defaults.
6
+ *
7
+ * `servedOn` is stamped by the edge with the server's day (`YYYY-MM-DD`); the runtime reads the
8
+ * day from here and never from the visitor's clock. `revision` only grows, so a stale write loses.
9
+ */
10
+ import * as z from "zod";
11
+ import { SHA256_HEX_PATTERN } from "./artifact-keys.js";
12
+ import { boundedRecord } from "./bounded.js";
13
+ import { MANIFEST_LIMITS } from "./limits.js";
14
+ import { RUNTIME_RINGS } from "./runtime-pointers.js";
15
+ import { collectionSchema, eventSampleRateSchema } from "./manifest.js";
16
+ import { memberNameSchema, propNameSchema } from "./names.js";
17
+ import { DAILY_CAP_HARD_MAX, DAILY_CAP_MIN, SITE_KEY_PATTERN, SITE_MANIFEST_MAX_COMPONENTS, SUSPECT_POLICIES, TURNSTILE_SITE_KEY_PATTERN, } from "./site-manifest-keys.js";
18
+ import { TAG_NAME_PATTERN } from "./tag-name.js";
19
+ export { SITE_MANIFEST_MAX_COMPONENTS };
20
+ /**
21
+ * What the data ingest needs to know about a component's collections (TAG-703): the declared
22
+ * collections to validate submissions against, whether they hold personal data and the name of
23
+ * the prop that carries the privacy policy URL. Copied by the API from the published version's
24
+ * manifest, so the edge never trusts the request for any of it. The edge strips it from the
25
+ * public `/m/` and `/s/` answers: visitors' pages do not need it.
26
+ */
27
+ export const siteManifestComponentDataSchema = z.strictObject({
28
+ collections: boundedRecord(memberNameSchema, collectionSchema, MANIFEST_LIMITS.maxCollections, "collections"),
29
+ personal: z.boolean().optional(),
30
+ privacyPolicyUrl: propNameSchema.optional(),
31
+ });
32
+ /** One component a site loads. */
33
+ export const siteManifestComponentSchema = z.strictObject({
34
+ /** Custom element tag of the component. */
35
+ tag: z.string().regex(TAG_NAME_PATTERN),
36
+ /** sha256 of the bundle: the content address of the version this site serves. */
37
+ versionHash: z.string().regex(new RegExp(SHA256_HEX_PATTERN)),
38
+ /** Where the loader fetches the bundle (`/b/<versionHash>.js` on the delivery origin). */
39
+ bundleUrl: z.string().max(2048),
40
+ /** sha256 of the props schema, to know when defaults need re-validation. */
41
+ propsSchemaHash: z.string().regex(new RegExp(SHA256_HEX_PATTERN)),
42
+ /** Contract version the component was built for; the edge drops majors past their support. */
43
+ contractVersion: z.string().max(32),
44
+ /** Default props for this site (JSON). */
45
+ defaults: z.record(z.string(), z.json()),
46
+ /** `disabled` is the kill switch: the loader skips the component. */
47
+ status: z.enum(["active", "disabled"]),
48
+ /**
49
+ * When the loader imports the bundle (TAG-335): `idle` waits for an idle moment of the page and
50
+ * fetches the loader's lazy `loading.js` module to do it. Absent means `eager` (on load), so
51
+ * manifests written before this field read the same. An older loader ignores the field.
52
+ */
53
+ loading: z.enum(["idle"]).optional(),
54
+ /**
55
+ * The component's `eventSampleRate` (TAG-819), copied from the published version's manifest: the
56
+ * browser sends that share of `interaction` and `custom` events, and the edge weights what it
57
+ * stores by `1 / rate` from this stored value, never from the request. Absent: all are sent.
58
+ */
59
+ eventSampleRate: eventSampleRateSchema.optional(),
60
+ /** Collections of the component for the data ingest (TAG-703); absent when it declares none. */
61
+ data: siteManifestComponentDataSchema.optional(),
62
+ });
63
+ /** The manifest of one site. */
64
+ export const siteManifestSchema = z.strictObject({
65
+ siteKey: z.string().regex(new RegExp(SITE_KEY_PATTERN)),
66
+ revision: z.number().int().nonnegative(),
67
+ /** Normalized allowed domains (apps/api domain/sites/hostname.ts). */
68
+ allowedDomains: z.array(z.string().max(253)).max(100),
69
+ components: z.array(siteManifestComponentSchema).max(SITE_MANIFEST_MAX_COMPONENTS),
70
+ /**
71
+ * The site's Turnstile public key, embedded in the loader of a site with a collection component
72
+ * so submissions carry a token (TAG-724); absent when the site has none.
73
+ */
74
+ turnstileSiteKey: z.string().regex(new RegExp(TURNSTILE_SITE_KEY_PATTERN)).optional(),
75
+ /**
76
+ * What the customer chose about the submissions of the site's forms (TAG-730): `suspects` (keep
77
+ * is the default, drop is opt-in) and `dailyCap` (per site, up to the platform ceiling the API
78
+ * checks). Absent when nothing was chosen. Never served to visitors (`/m/` leaves it out).
79
+ */
80
+ protection: z
81
+ .strictObject({
82
+ suspects: z.enum(SUSPECT_POLICIES).optional(),
83
+ dailyCap: z.int().min(DAILY_CAP_MIN).max(DAILY_CAP_HARD_MAX).optional(),
84
+ /** TAG-816: honor `Sec-GPC`/`DNT` at the event ingest; absent means `RESPECT_GPC_DEFAULT`. */
85
+ respectGpc: z.boolean().optional(),
86
+ })
87
+ .optional(),
88
+ /**
89
+ * The runtime ring of the site (TAG-611): `canary` sites get the canary runtime version, the
90
+ * rest (field absent or `stable`) the stable one. Set by the Taggor operator, never by the
91
+ * customer; the API writes it only for canary sites, and the edge leaves it out of `/m/`.
92
+ */
93
+ runtimeRing: z.enum(RUNTIME_RINGS).optional(),
94
+ /** ISO day the edge served the manifest; absent in what the API stores. */
95
+ servedOn: z
96
+ .string()
97
+ .regex(/^\d{4}-\d{2}-\d{2}$/)
98
+ .optional(),
99
+ });
100
+ //# sourceMappingURL=site-manifest.js.map