@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.
- package/LICENSE +21 -0
- package/README.md +61 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/artifact-keys.d.ts +169 -0
- package/dist/artifact-keys.d.ts.map +1 -0
- package/dist/artifact-keys.js +195 -0
- package/dist/artifact-keys.js.map +1 -0
- package/dist/assets.d.ts +72 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +94 -0
- package/dist/assets.js.map +1 -0
- package/dist/bounded-path.d.ts +29 -0
- package/dist/bounded-path.d.ts.map +1 -0
- package/dist/bounded-path.js +57 -0
- package/dist/bounded-path.js.map +1 -0
- package/dist/bounded.d.ts +47 -0
- package/dist/bounded.d.ts.map +1 -0
- package/dist/bounded.js +93 -0
- package/dist/bounded.js.map +1 -0
- package/dist/build-diagnostic.d.ts +89 -0
- package/dist/build-diagnostic.d.ts.map +1 -0
- package/dist/build-diagnostic.js +91 -0
- package/dist/build-diagnostic.js.map +1 -0
- package/dist/component-types.d.ts +61 -0
- package/dist/component-types.d.ts.map +1 -0
- package/dist/component-types.js +277 -0
- package/dist/component-types.js.map +1 -0
- package/dist/consent-text.d.ts +31 -0
- package/dist/consent-text.d.ts.map +1 -0
- package/dist/consent-text.js +41 -0
- package/dist/consent-text.js.map +1 -0
- package/dist/contract-version.d.ts +150 -0
- package/dist/contract-version.d.ts.map +1 -0
- package/dist/contract-version.js +198 -0
- package/dist/contract-version.js.map +1 -0
- package/dist/credential-fields.d.ts +31 -0
- package/dist/credential-fields.d.ts.map +1 -0
- package/dist/credential-fields.js +36 -0
- package/dist/credential-fields.js.map +1 -0
- package/dist/css-tokens.d.ts +46 -0
- package/dist/css-tokens.d.ts.map +1 -0
- package/dist/css-tokens.js +189 -0
- package/dist/css-tokens.js.map +1 -0
- package/dist/css-value.d.ts +42 -0
- package/dist/css-value.d.ts.map +1 -0
- package/dist/css-value.js +78 -0
- package/dist/css-value.js.map +1 -0
- package/dist/data-api.d.ts +127 -0
- package/dist/data-api.d.ts.map +1 -0
- package/dist/data-api.js +167 -0
- package/dist/data-api.js.map +1 -0
- package/dist/denylist-keys.d.ts +19 -0
- package/dist/denylist-keys.d.ts.map +1 -0
- package/dist/denylist-keys.js +48 -0
- package/dist/denylist-keys.js.map +1 -0
- package/dist/diagnostic-catalog.d.ts +1402 -0
- package/dist/diagnostic-catalog.d.ts.map +1 -0
- package/dist/diagnostic-catalog.js +1311 -0
- package/dist/diagnostic-catalog.js.map +1 -0
- package/dist/dom-members.snapshot.d.ts +33 -0
- package/dist/dom-members.snapshot.d.ts.map +1 -0
- package/dist/dom-members.snapshot.js +760 -0
- package/dist/dom-members.snapshot.js.map +1 -0
- package/dist/early-loading.d.ts +27 -0
- package/dist/early-loading.d.ts.map +1 -0
- package/dist/early-loading.js +44 -0
- package/dist/early-loading.js.map +1 -0
- package/dist/error-catalog.d.ts +749 -0
- package/dist/error-catalog.d.ts.map +1 -0
- package/dist/error-catalog.js +720 -0
- package/dist/error-catalog.js.map +1 -0
- package/dist/executable-config.d.ts +35 -0
- package/dist/executable-config.d.ts.map +1 -0
- package/dist/executable-config.js +44 -0
- package/dist/executable-config.js.map +1 -0
- package/dist/freeze.d.ts +17 -0
- package/dist/freeze.d.ts.map +1 -0
- package/dist/freeze.js +29 -0
- package/dist/freeze.js.map +1 -0
- package/dist/gunzip.d.ts +33 -0
- package/dist/gunzip.d.ts.map +1 -0
- package/dist/gunzip.js +330 -0
- package/dist/gunzip.js.map +1 -0
- package/dist/hostname.d.ts +74 -0
- package/dist/hostname.d.ts.map +1 -0
- package/dist/hostname.js +215 -0
- package/dist/hostname.js.map +1 -0
- package/dist/human-actions.d.ts +49 -0
- package/dist/human-actions.d.ts.map +1 -0
- package/dist/human-actions.js +272 -0
- package/dist/human-actions.js.map +1 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema.d.ts +108 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +240 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/key-checksum.d.ts +33 -0
- package/dist/key-checksum.d.ts.map +1 -0
- package/dist/key-checksum.js +67 -0
- package/dist/key-checksum.js.map +1 -0
- package/dist/libraries.d.ts +60 -0
- package/dist/libraries.d.ts.map +1 -0
- package/dist/libraries.js +120 -0
- package/dist/libraries.js.map +1 -0
- package/dist/limit-catalog.d.ts +371 -0
- package/dist/limit-catalog.d.ts.map +1 -0
- package/dist/limit-catalog.js +414 -0
- package/dist/limit-catalog.js.map +1 -0
- package/dist/limits.d.ts +167 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +175 -0
- package/dist/limits.js.map +1 -0
- package/dist/locale-tag.d.ts +21 -0
- package/dist/locale-tag.d.ts.map +1 -0
- package/dist/locale-tag.js +21 -0
- package/dist/locale-tag.js.map +1 -0
- package/dist/make-diagnostic.d.ts +74 -0
- package/dist/make-diagnostic.d.ts.map +1 -0
- package/dist/make-diagnostic.js +100 -0
- package/dist/make-diagnostic.js.map +1 -0
- package/dist/manifest-compat-diagnostics.d.ts +23 -0
- package/dist/manifest-compat-diagnostics.d.ts.map +1 -0
- package/dist/manifest-compat-diagnostics.js +150 -0
- package/dist/manifest-compat-diagnostics.js.map +1 -0
- package/dist/manifest-compat.d.ts +58 -0
- package/dist/manifest-compat.d.ts.map +1 -0
- package/dist/manifest-compat.js +377 -0
- package/dist/manifest-compat.js.map +1 -0
- package/dist/manifest.d.ts +1769 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +421 -0
- package/dist/manifest.js.map +1 -0
- package/dist/metering.d.ts +126 -0
- package/dist/metering.d.ts.map +1 -0
- package/dist/metering.js +147 -0
- package/dist/metering.js.map +1 -0
- package/dist/migrate.d.ts +70 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +159 -0
- package/dist/migrate.js.map +1 -0
- package/dist/names.d.ts +37 -0
- package/dist/names.d.ts.map +1 -0
- package/dist/names.js +55 -0
- package/dist/names.js.map +1 -0
- package/dist/overage-pricing.d.ts +89 -0
- package/dist/overage-pricing.d.ts.map +1 -0
- package/dist/overage-pricing.js +170 -0
- package/dist/overage-pricing.js.map +1 -0
- package/dist/plan-ids.d.ts +10 -0
- package/dist/plan-ids.d.ts.map +1 -0
- package/dist/plan-ids.js +8 -0
- package/dist/plan-ids.js.map +1 -0
- package/dist/plan-limits.d.ts +138 -0
- package/dist/plan-limits.d.ts.map +1 -0
- package/dist/plan-limits.js +112 -0
- package/dist/plan-limits.js.map +1 -0
- package/dist/plan-pricing.d.ts +145 -0
- package/dist/plan-pricing.d.ts.map +1 -0
- package/dist/plan-pricing.js +172 -0
- package/dist/plan-pricing.js.map +1 -0
- package/dist/plan-usage.d.ts +112 -0
- package/dist/plan-usage.d.ts.map +1 -0
- package/dist/plan-usage.js +134 -0
- package/dist/plan-usage.js.map +1 -0
- package/dist/preview-token.d.ts +52 -0
- package/dist/preview-token.d.ts.map +1 -0
- package/dist/preview-token.js +106 -0
- package/dist/preview-token.js.map +1 -0
- package/dist/prop-names.d.ts +51 -0
- package/dist/prop-names.d.ts.map +1 -0
- package/dist/prop-names.js +150 -0
- package/dist/prop-names.js.map +1 -0
- package/dist/prop-type-docs.d.ts +20 -0
- package/dist/prop-type-docs.d.ts.map +1 -0
- package/dist/prop-type-docs.js +89 -0
- package/dist/prop-type-docs.js.map +1 -0
- package/dist/prop-types.d.ts +97 -0
- package/dist/prop-types.d.ts.map +1 -0
- package/dist/prop-types.js +299 -0
- package/dist/prop-types.js.map +1 -0
- package/dist/props.d.ts +996 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +183 -0
- package/dist/props.js.map +1 -0
- package/dist/proto-guard.d.ts +29 -0
- package/dist/proto-guard.d.ts.map +1 -0
- package/dist/proto-guard.js +79 -0
- package/dist/proto-guard.js.map +1 -0
- package/dist/runtime-errors.d.ts +42 -0
- package/dist/runtime-errors.d.ts.map +1 -0
- package/dist/runtime-errors.js +42 -0
- package/dist/runtime-errors.js.map +1 -0
- package/dist/runtime-pointers.d.ts +58 -0
- package/dist/runtime-pointers.d.ts.map +1 -0
- package/dist/runtime-pointers.js +84 -0
- package/dist/runtime-pointers.js.map +1 -0
- package/dist/secret-scan.d.ts +191 -0
- package/dist/secret-scan.d.ts.map +1 -0
- package/dist/secret-scan.js +542 -0
- package/dist/secret-scan.js.map +1 -0
- package/dist/semver.d.ts +89 -0
- package/dist/semver.d.ts.map +1 -0
- package/dist/semver.js +400 -0
- package/dist/semver.js.map +1 -0
- package/dist/server-key.d.ts +68 -0
- package/dist/server-key.d.ts.map +1 -0
- package/dist/server-key.js +150 -0
- package/dist/server-key.js.map +1 -0
- package/dist/site-manifest-keys.d.ts +107 -0
- package/dist/site-manifest-keys.d.ts.map +1 -0
- package/dist/site-manifest-keys.js +146 -0
- package/dist/site-manifest-keys.js.map +1 -0
- package/dist/site-manifest.d.ts +286 -0
- package/dist/site-manifest.d.ts.map +1 -0
- package/dist/site-manifest.js +100 -0
- package/dist/site-manifest.js.map +1 -0
- package/dist/source-archive.d.ts +119 -0
- package/dist/source-archive.d.ts.map +1 -0
- package/dist/source-archive.js +644 -0
- package/dist/source-archive.js.map +1 -0
- package/dist/source-package-corpus.d.ts +55 -0
- package/dist/source-package-corpus.d.ts.map +1 -0
- package/dist/source-package-corpus.js +303 -0
- package/dist/source-package-corpus.js.map +1 -0
- package/dist/source-package.d.ts +227 -0
- package/dist/source-package.d.ts.map +1 -0
- package/dist/source-package.js +361 -0
- package/dist/source-package.js.map +1 -0
- package/dist/source-secrets.d.ts +21 -0
- package/dist/source-secrets.d.ts.map +1 -0
- package/dist/source-secrets.js +43 -0
- package/dist/source-secrets.js.map +1 -0
- package/dist/ssr-cap.d.ts +61 -0
- package/dist/ssr-cap.d.ts.map +1 -0
- package/dist/ssr-cap.js +107 -0
- package/dist/ssr-cap.js.map +1 -0
- package/dist/ssr-kv.d.ts +18 -0
- package/dist/ssr-kv.d.ts.map +1 -0
- package/dist/ssr-kv.js +18 -0
- package/dist/ssr-kv.js.map +1 -0
- package/dist/ssr-version-ledger.d.ts +53 -0
- package/dist/ssr-version-ledger.d.ts.map +1 -0
- package/dist/ssr-version-ledger.js +88 -0
- package/dist/ssr-version-ledger.js.map +1 -0
- package/dist/style-references.d.ts +58 -0
- package/dist/style-references.d.ts.map +1 -0
- package/dist/style-references.js +241 -0
- package/dist/style-references.js.map +1 -0
- package/dist/tag-name.d.ts +87 -0
- package/dist/tag-name.d.ts.map +1 -0
- package/dist/tag-name.js +222 -0
- package/dist/tag-name.js.map +1 -0
- package/dist/tar-writer.d.ts +74 -0
- package/dist/tar-writer.d.ts.map +1 -0
- package/dist/tar-writer.js +148 -0
- package/dist/tar-writer.js.map +1 -0
- package/dist/testing.d.ts +11 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +11 -0
- package/dist/testing.js.map +1 -0
- package/dist/text-codec.d.ts +36 -0
- package/dist/text-codec.d.ts.map +1 -0
- package/dist/text-codec.js +32 -0
- package/dist/text-codec.js.map +1 -0
- package/dist/url-value.d.ts +41 -0
- package/dist/url-value.d.ts.map +1 -0
- package/dist/url-value.js +147 -0
- package/dist/url-value.js.map +1 -0
- package/dist/usage-guard.d.ts +99 -0
- package/dist/usage-guard.d.ts.map +1 -0
- package/dist/usage-guard.js +104 -0
- package/dist/usage-guard.js.map +1 -0
- package/dist/usage-mirror.d.ts +55 -0
- package/dist/usage-mirror.d.ts.map +1 -0
- package/dist/usage-mirror.js +52 -0
- package/dist/usage-mirror.js.map +1 -0
- package/dist/value-check.d.ts +88 -0
- package/dist/value-check.d.ts.map +1 -0
- package/dist/value-check.js +279 -0
- package/dist/value-check.js.map +1 -0
- package/dist/value-patterns.d.ts +9 -0
- package/dist/value-patterns.d.ts.map +1 -0
- package/dist/value-patterns.js +17 -0
- package/dist/value-patterns.js.map +1 -0
- package/dist/value-schema.d.ts +796 -0
- package/dist/value-schema.d.ts.map +1 -0
- package/dist/value-schema.js +231 -0
- package/dist/value-schema.js.map +1 -0
- package/dist/zod-free.d.ts +59 -0
- package/dist/zod-free.d.ts.map +1 -0
- package/dist/zod-free.js +57 -0
- package/dist/zod-free.js.map +1 -0
- package/package.json +75 -3
- package/schema/DEPLOYED +12 -0
- package/schema/build-diagnostic.v1.json +63 -0
- package/schema/component-manifest.v1.json +1000 -0
- package/schema/data-api.v1.json +194 -0
- package/schema/library-manifest.v1.json +60 -0
- package/schema/published/SHA256SUMS +36 -0
- package/schema/published/build-diagnostic/v1.10.json +83 -0
- package/schema/published/build-diagnostic/v1.3.json +83 -0
- package/schema/published/build-diagnostic/v1.4.json +83 -0
- package/schema/published/build-diagnostic/v1.5.json +83 -0
- package/schema/published/build-diagnostic/v1.6.json +83 -0
- package/schema/published/build-diagnostic/v1.7.json +83 -0
- package/schema/published/build-diagnostic/v1.8.json +83 -0
- package/schema/published/build-diagnostic/v1.9.json +83 -0
- package/schema/published/component-manifest/v1.10.json +1443 -0
- package/schema/published/component-manifest/v1.3.json +1411 -0
- package/schema/published/component-manifest/v1.4.json +1419 -0
- package/schema/published/component-manifest/v1.5.json +1437 -0
- package/schema/published/component-manifest/v1.6.json +1437 -0
- package/schema/published/component-manifest/v1.7.json +1437 -0
- package/schema/published/component-manifest/v1.8.json +1437 -0
- package/schema/published/component-manifest/v1.9.json +1437 -0
- package/schema/published/data-api/v1.10.json +282 -0
- package/schema/published/data-api/v1.3.json +281 -0
- package/schema/published/data-api/v1.4.json +281 -0
- package/schema/published/data-api/v1.5.json +281 -0
- package/schema/published/data-api/v1.6.json +281 -0
- package/schema/published/data-api/v1.7.json +281 -0
- package/schema/published/data-api/v1.8.json +282 -0
- package/schema/published/data-api/v1.9.json +282 -0
- package/schema/published/library-manifest/v1.10.json +68 -0
- package/schema/published/library-manifest/v1.5.json +68 -0
- package/schema/published/library-manifest/v1.6.json +68 -0
- package/schema/published/library-manifest/v1.7.json +68 -0
- package/schema/published/library-manifest/v1.8.json +68 -0
- package/schema/published/library-manifest/v1.9.json +68 -0
- package/schema/published/taggor-config/v1.10.json +56 -0
- package/schema/published/taggor-config/v1.5.json +56 -0
- package/schema/published/taggor-config/v1.6.json +56 -0
- package/schema/published/taggor-config/v1.7.json +56 -0
- package/schema/published/taggor-config/v1.8.json +56 -0
- package/schema/published/taggor-config/v1.9.json +56 -0
- package/schema/taggor-config.v1.json +39 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AA+BzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAY1D,4FAA4F;AAC5F,eAAO,MAAM,eAAe,wEAKjB,CAAC;AAEZ,uFAAuF;AACvF,eAAO,MAAM,aAAa,qEAMf,CAAC;AAEZ,uFAAuF;AACvF,eAAO,MAAM,aAAa,oCAAoD,CAAC;AAE/E,iGAAiG;AACjG,eAAO,MAAM,uBAAuB,gCAAgD,CAAC;AAErF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,CAAC;AAC/D,wEAAwE;AACxE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC5E,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE3D,2FAA2F;AAC3F,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,qDAAqD;AACrD,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,CAAC;AAKtE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,MAAM,CAkB5D;AA2DD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAWjE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAmBnE"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The component manifest, contract v1 (TAG-201): the declarative description of one component that the
|
|
3
|
+
* SDK extracts (TAG-202), the builder stores with each version, the API serves and the runtime
|
|
4
|
+
* reads to register the custom element, coerce attributes, dispatch events and expose slots.
|
|
5
|
+
*
|
|
6
|
+
* The manifest is data only (ADR 0016): nothing in it is code, an expression or a template, every
|
|
7
|
+
* collection is bounded, and unknown keys are rejected at every level. Field names are camelCase
|
|
8
|
+
* (it is authored in TypeScript and mirrors the DOM); anything that travels in the data API is
|
|
9
|
+
* snake_case (see `data-api.ts`). TAG-207 moved the contract version and the `__proto__` guard to
|
|
10
|
+
* `contract-version.ts` and `proto-guard.ts` (both Zod-free) and checks the version first.
|
|
11
|
+
* TAG-212 (contract 1.1) added `data.personal` and `data.privacyPolicyUrl`, the declaration that
|
|
12
|
+
* makes the SDK require the visitor's consent on every submit. TAG-211 (contract 1.2) added
|
|
13
|
+
* `locales`, the languages the component ships messages for and the one it falls back to. TAG-213
|
|
14
|
+
* (contract 1.3) added `assets`, the images and fonts the builder found imported, by content hash.
|
|
15
|
+
* TAG-314 (contract 1.4) added `formAssociated` (the element takes part in the host page's
|
|
16
|
+
* `<form>` through `ElementInternals`) and `delegatesFocus` (the shadow root delegates focus).
|
|
17
|
+
* TAG-210 (contract 1.5) added `libraries`, the workspace-scoped packages and semver ranges a
|
|
18
|
+
* component expects; resolution and ownership stay with the API/builder, which has workspace context.
|
|
19
|
+
*/
|
|
20
|
+
import * as z from "zod";
|
|
21
|
+
import { boundedRecord, cssValueSchema, memberDescriptionSchema, plainText, uniqueArray, } from "./bounded.js";
|
|
22
|
+
import { ASSET_LIMITS, LOCALE_LIMITS, MANIFEST_LIMITS } from "./limits.js";
|
|
23
|
+
import { ASSET_HASH_PATTERN, ASSET_TYPES } from "./assets.js";
|
|
24
|
+
import { cssVarNameSchema, memberNameSchema, propNameSchema, snakeNameSchema, componentNameSchema, } from "./names.js";
|
|
25
|
+
import { tagNameSchema } from "./tag-name.js";
|
|
26
|
+
import { CONTRACT_VERSION_POLICY, classifyContractVersion, contractVersionMessage, contractVersionPattern, } from "./contract-version.js";
|
|
27
|
+
import { boundedPath, boundedSegment } from "./bounded-path.js";
|
|
28
|
+
import { EVENT_SAMPLE_RATE_MIN } from "./metering.js";
|
|
29
|
+
import { findOwnProtoKey } from "./proto-guard.js";
|
|
30
|
+
import { LOCALE_ATTRIBUTE, LOCALE_TAG_MESSAGE, LOCALE_TAG_PATTERN } from "./locale-tag.js";
|
|
31
|
+
import { CSS_VALUE_PATTERN, FONT_FAMILY_PATTERN } from "./css-value.js";
|
|
32
|
+
import { propDeclarationSchema } from "./props.js";
|
|
33
|
+
import { componentLibrariesSchema } from "./libraries.js";
|
|
34
|
+
import { DEFAULT_URL_PROTOCOLS } from "./url-value.js";
|
|
35
|
+
import { arrayValueSchema, booleanValueSchema, enumValueTypeSchema, numberValueSchema, scalarValueSchema, stringValueSchema, valueSchema, } from "./value-schema.js";
|
|
36
|
+
/** Browser capabilities a component may declare; anything else is impossible to request. */
|
|
37
|
+
export const PERMISSION_APIS = Object.freeze([
|
|
38
|
+
"clipboard-write",
|
|
39
|
+
"fullscreen",
|
|
40
|
+
"geolocation",
|
|
41
|
+
"web-share",
|
|
42
|
+
]);
|
|
43
|
+
/** Types of a public CSS variable; the default must look like a value of that type. */
|
|
44
|
+
export const CSS_VAR_TYPES = Object.freeze([
|
|
45
|
+
"color",
|
|
46
|
+
"length",
|
|
47
|
+
"number",
|
|
48
|
+
"percentage",
|
|
49
|
+
"font-family",
|
|
50
|
+
]);
|
|
51
|
+
/** `display` values the runtime may give the host element before and after upgrade. */
|
|
52
|
+
export const SIZE_DISPLAYS = Object.freeze(["block", "inline-block"]);
|
|
53
|
+
/** Collection visibility: `public` collections can be listed by the component through `read`. */
|
|
54
|
+
export const COLLECTION_VISIBILITIES = Object.freeze(["private", "public"]);
|
|
55
|
+
const eventSchema = z
|
|
56
|
+
.strictObject({
|
|
57
|
+
description: memberDescriptionSchema,
|
|
58
|
+
detail: valueSchema.meta({
|
|
59
|
+
description: 'Schema of `event.detail`; use { "type": "object", "fields": {} } for an event without data.',
|
|
60
|
+
}),
|
|
61
|
+
bubbles: z.boolean().optional().meta({ description: "Defaults to true." }),
|
|
62
|
+
composed: z.boolean().optional().meta({ description: "Defaults to true." }),
|
|
63
|
+
})
|
|
64
|
+
.meta({ id: "EventDeclaration" });
|
|
65
|
+
const slotSchema = z
|
|
66
|
+
.strictObject({ description: memberDescriptionSchema })
|
|
67
|
+
.meta({ id: "SlotDeclaration" });
|
|
68
|
+
const partSchema = z
|
|
69
|
+
.strictObject({ description: memberDescriptionSchema })
|
|
70
|
+
.meta({ id: "PartDeclaration" });
|
|
71
|
+
// A font-family list never needs a function; every other type gets the general CSS allowlist.
|
|
72
|
+
const cssVarSchema = z
|
|
73
|
+
.discriminatedUnion("type", [
|
|
74
|
+
z.strictObject({
|
|
75
|
+
type: z.enum(CSS_VAR_TYPES.filter((type) => type !== "font-family")),
|
|
76
|
+
default: cssValueSchema(MANIFEST_LIMITS.cssValueMaxLength, CSS_VALUE_PATTERN, "CSS variable default"),
|
|
77
|
+
description: memberDescriptionSchema,
|
|
78
|
+
}),
|
|
79
|
+
z.strictObject({
|
|
80
|
+
type: z.literal("font-family"),
|
|
81
|
+
default: cssValueSchema(MANIFEST_LIMITS.cssValueMaxLength, FONT_FAMILY_PATTERN, "font-family default"),
|
|
82
|
+
description: memberDescriptionSchema,
|
|
83
|
+
}),
|
|
84
|
+
])
|
|
85
|
+
.meta({ id: "CssVarDeclaration" });
|
|
86
|
+
/** A field of a collection: a scalar, or an array of scalars (checkboxes, multi-select). */
|
|
87
|
+
const collectionFieldSchema = z
|
|
88
|
+
.discriminatedUnion("type", [
|
|
89
|
+
stringValueSchema,
|
|
90
|
+
numberValueSchema,
|
|
91
|
+
booleanValueSchema,
|
|
92
|
+
enumValueTypeSchema,
|
|
93
|
+
arrayValueSchema(scalarValueSchema),
|
|
94
|
+
])
|
|
95
|
+
.meta({ id: "CollectionField" });
|
|
96
|
+
/** One declared collection of `data.collections` (TAG-703 reuses it in the site manifest). */
|
|
97
|
+
export const collectionSchema = z
|
|
98
|
+
.strictObject({
|
|
99
|
+
description: memberDescriptionSchema,
|
|
100
|
+
fields: boundedRecord(snakeNameSchema, collectionFieldSchema, MANIFEST_LIMITS.maxCollectionFields, "fields", 1),
|
|
101
|
+
required: uniqueArray(snakeNameSchema, 1, MANIFEST_LIMITS.maxCollectionFields, "required").optional(),
|
|
102
|
+
visibility: z
|
|
103
|
+
.enum(COLLECTION_VISIBILITIES)
|
|
104
|
+
.optional()
|
|
105
|
+
.meta({ description: 'Defaults to "private".' }),
|
|
106
|
+
})
|
|
107
|
+
.refine(
|
|
108
|
+
// zod-only: collection-required-declared
|
|
109
|
+
(collection) => (collection.required ?? []).every((name) => Object.hasOwn(collection.fields, name)), {
|
|
110
|
+
error: "required must only name declared fields",
|
|
111
|
+
})
|
|
112
|
+
.meta({ id: "CollectionDeclaration" });
|
|
113
|
+
/** A track prop: number, boolean or enum. Free text is impossible, so no PII can ride along. */
|
|
114
|
+
const trackPropSchema = z
|
|
115
|
+
.discriminatedUnion("type", [numberValueSchema, booleanValueSchema, enumValueTypeSchema])
|
|
116
|
+
.meta({ id: "TrackProp" });
|
|
117
|
+
const trackEventSchema = z
|
|
118
|
+
.strictObject({
|
|
119
|
+
description: memberDescriptionSchema,
|
|
120
|
+
props: boundedRecord(snakeNameSchema, trackPropSchema, MANIFEST_LIMITS.maxTrackProps, "track props").optional(),
|
|
121
|
+
})
|
|
122
|
+
.meta({ id: "TrackEventDeclaration" });
|
|
123
|
+
const dataSchema = z
|
|
124
|
+
.strictObject({
|
|
125
|
+
collections: boundedRecord(memberNameSchema, collectionSchema, MANIFEST_LIMITS.maxCollections, "collections").optional(),
|
|
126
|
+
track: boundedRecord(memberNameSchema, trackEventSchema, MANIFEST_LIMITS.maxTrackEvents, "track events").optional(),
|
|
127
|
+
personal: z.boolean().optional().meta({
|
|
128
|
+
description: "True when the collections hold personal data (TAG-212): every submit then carries the visitor's consent. Defaults to false.",
|
|
129
|
+
}),
|
|
130
|
+
privacyPolicyUrl: propNameSchema.optional().meta({
|
|
131
|
+
description: 'Name of the prop of type "url" that links the privacy policy, set per site (TAG-212). Required when personal is true.',
|
|
132
|
+
}),
|
|
133
|
+
})
|
|
134
|
+
.refine((data) => data.personal !== true || data.privacyPolicyUrl !== undefined, {
|
|
135
|
+
// zod-only: personal-requires-privacy-policy
|
|
136
|
+
error: 'a component with personal data must declare privacyPolicyUrl, the name of its "url" prop that links the privacy policy',
|
|
137
|
+
path: ["privacyPolicyUrl"],
|
|
138
|
+
})
|
|
139
|
+
.meta({ id: "DataDeclaration" });
|
|
140
|
+
const pixelsSchema = z.int().min(0).max(MANIFEST_LIMITS.sizeMaxPixels);
|
|
141
|
+
const ratioTermSchema = z.int().min(1).max(MANIFEST_LIMITS.aspectRatioMaxTerm);
|
|
142
|
+
const sizeSchema = z
|
|
143
|
+
.strictObject({
|
|
144
|
+
display: z.enum(SIZE_DISPLAYS).optional().meta({ description: 'Defaults to "block".' }),
|
|
145
|
+
minHeight: pixelsSchema.optional().meta({ description: "Reserved height in CSS pixels." }),
|
|
146
|
+
maxWidth: pixelsSchema.min(1).optional(),
|
|
147
|
+
aspectRatio: z.strictObject({ width: ratioTermSchema, height: ratioTermSchema }).optional(),
|
|
148
|
+
})
|
|
149
|
+
.meta({ id: "SizeHints" });
|
|
150
|
+
/** HTTPS origin without path, wildcard or credentials (`https://api.example.com[:port]`). */
|
|
151
|
+
const ORIGIN_PATTERN = /^https:\/\/(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}(?::[1-9]\d{0,4})?$/;
|
|
152
|
+
const permissionsSchema = z
|
|
153
|
+
.strictObject({
|
|
154
|
+
apis: uniqueArray(z.enum(PERMISSION_APIS), 1, PERMISSION_APIS.length, "apis").optional(),
|
|
155
|
+
connect: uniqueArray(z.string().max(MANIFEST_LIMITS.urlMaxLength).regex(ORIGIN_PATTERN, {
|
|
156
|
+
error: "connect entries must be lowercase https origins without path or wildcard",
|
|
157
|
+
}), 1, MANIFEST_LIMITS.maxConnectOrigins, "connect").optional(),
|
|
158
|
+
})
|
|
159
|
+
.meta({ id: "Permissions" });
|
|
160
|
+
const localeTagSchema = z
|
|
161
|
+
.string()
|
|
162
|
+
.max(LOCALE_LIMITS.localeTagMaxLength, {
|
|
163
|
+
error: `a language tag must be at most ${String(LOCALE_LIMITS.localeTagMaxLength)} characters`,
|
|
164
|
+
})
|
|
165
|
+
.regex(LOCALE_TAG_PATTERN, { error: LOCALE_TAG_MESSAGE });
|
|
166
|
+
/**
|
|
167
|
+
* The languages a component ships messages for (TAG-211, contract 1.2). The SDK's `useLocale` picks
|
|
168
|
+
* one of `supported` from the element's `locale` attribute, the nearest `lang`, the browser's
|
|
169
|
+
* language and finally `default`; the builder extracts both from the author's message catalogs.
|
|
170
|
+
*/
|
|
171
|
+
const localesSchema = z
|
|
172
|
+
.strictObject({
|
|
173
|
+
supported: uniqueArray(localeTagSchema, 1, LOCALE_LIMITS.maxLocales, "supported"),
|
|
174
|
+
default: localeTagSchema,
|
|
175
|
+
})
|
|
176
|
+
// The SDK matches tags without case (`pt-br` finds `pt-BR`), so two tags differing only in case
|
|
177
|
+
// would make one unreachable.
|
|
178
|
+
.refine(
|
|
179
|
+
// zod-only: locales-case-unique
|
|
180
|
+
({ supported }) => new Set(supported.map((tag) => tag.toLowerCase())).size === supported.length, { error: "supported must not list the same language tag twice in different case" })
|
|
181
|
+
.refine(({ supported, default: fallback }) => supported.includes(fallback), {
|
|
182
|
+
// zod-only: locales-default-supported
|
|
183
|
+
error: "default must be one of the supported language tags",
|
|
184
|
+
path: ["default"],
|
|
185
|
+
})
|
|
186
|
+
.meta({ id: "LocalesDeclaration" });
|
|
187
|
+
const assetHashSchema = z.string().max(64).regex(ASSET_HASH_PATTERN, {
|
|
188
|
+
error: "an asset key must be the SHA-256 of the file's bytes, in 64 lowercase hex digits",
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* One asset of `assets` (TAG-213, contract 1.3), keyed by its hash: its type and size. The builder
|
|
192
|
+
* (TAG-410) writes it; the author never does. Served at `/a/<hash>.<extension of type>`.
|
|
193
|
+
*/
|
|
194
|
+
const assetSchema = z
|
|
195
|
+
.strictObject({
|
|
196
|
+
type: z.enum(Object.keys(ASSET_TYPES)).meta({
|
|
197
|
+
description: "MIME type; the CDN path ends in its extension.",
|
|
198
|
+
}),
|
|
199
|
+
size: z
|
|
200
|
+
.int()
|
|
201
|
+
.min(1, { error: "an asset file cannot be empty" })
|
|
202
|
+
.max(ASSET_LIMITS.assetMaxBytes, {
|
|
203
|
+
error: `an asset file must be at most ${String(ASSET_LIMITS.assetMaxBytes)} bytes`,
|
|
204
|
+
})
|
|
205
|
+
.meta({ description: "Size of the file in bytes." }),
|
|
206
|
+
})
|
|
207
|
+
.meta({ id: "AssetDeclaration" });
|
|
208
|
+
/** Semantic versions of the current major up to the newest minor this package knows (TAG-207). */
|
|
209
|
+
const CONTRACT_VERSION_PATTERN = contractVersionPattern();
|
|
210
|
+
/**
|
|
211
|
+
* The component manifest schema (contract v1).
|
|
212
|
+
*
|
|
213
|
+
* Inputs: unknown data. Output: a `ComponentManifest`. Errors: Zod issues with a path and an
|
|
214
|
+
* actionable message for every violation (unknown key, bad name, bound exceeded, default that does
|
|
215
|
+
* not fit its prop). Side effects: none.
|
|
216
|
+
*/
|
|
217
|
+
/**
|
|
218
|
+
* The share of `interaction` and `custom` events the browser sends (TAG-819, contract 1.10);
|
|
219
|
+
* `render`, `error` and `conversion` are never sampled. The edge weights each stored event by
|
|
220
|
+
* `1 / eventSampleRate` from the stored manifest, so the metrics stay estimates of the real total.
|
|
221
|
+
*/
|
|
222
|
+
export const eventSampleRateSchema = z
|
|
223
|
+
.number()
|
|
224
|
+
.min(EVENT_SAMPLE_RATE_MIN)
|
|
225
|
+
.max(1)
|
|
226
|
+
.meta({
|
|
227
|
+
description: `Share of interaction and custom events the browser sends, from ${String(EVENT_SAMPLE_RATE_MIN)} to 1 (default 1: all). Render, error and conversion events are never sampled. Each stored event is weighted by 1 divided by this rate, so totals stay estimates of the real count.`,
|
|
228
|
+
});
|
|
229
|
+
export const componentManifestSchema = z
|
|
230
|
+
.strictObject({
|
|
231
|
+
contractVersion: z.string().regex(CONTRACT_VERSION_PATTERN, {
|
|
232
|
+
error: `contractVersion must be a version this package supports (${String(CONTRACT_VERSION_POLICY.major)}.0.x to ${String(CONTRACT_VERSION_POLICY.major)}.${String(CONTRACT_VERSION_POLICY.minor)}.x)`,
|
|
233
|
+
}),
|
|
234
|
+
name: componentNameSchema,
|
|
235
|
+
tag: tagNameSchema,
|
|
236
|
+
title: plainText(MANIFEST_LIMITS.titleMaxLength),
|
|
237
|
+
description: plainText(MANIFEST_LIMITS.descriptionMaxLength),
|
|
238
|
+
props: boundedRecord(propNameSchema, propDeclarationSchema, MANIFEST_LIMITS.maxProps, "props").optional(),
|
|
239
|
+
events: boundedRecord(memberNameSchema, eventSchema, MANIFEST_LIMITS.maxEvents, "events").optional(),
|
|
240
|
+
slots: boundedRecord(memberNameSchema, slotSchema, MANIFEST_LIMITS.maxSlots, "slots").optional(),
|
|
241
|
+
parts: boundedRecord(memberNameSchema, partSchema, MANIFEST_LIMITS.maxParts, "parts").optional(),
|
|
242
|
+
cssVars: boundedRecord(cssVarNameSchema, cssVarSchema, MANIFEST_LIMITS.maxCssVars, "cssVars").optional(),
|
|
243
|
+
data: dataSchema.optional(),
|
|
244
|
+
size: sizeSchema.optional(),
|
|
245
|
+
permissions: permissionsSchema.optional(),
|
|
246
|
+
libraries: componentLibrariesSchema.optional().meta({
|
|
247
|
+
description: "Workspace-scoped libraries and the semver ranges this component is compatible with. Ownership is resolved by the API and builder.",
|
|
248
|
+
}),
|
|
249
|
+
locales: localesSchema.optional(),
|
|
250
|
+
assets: boundedRecord(assetHashSchema, assetSchema, ASSET_LIMITS.maxAssets, "assets").optional(),
|
|
251
|
+
formAssociated: z.boolean().optional().meta({
|
|
252
|
+
description: "True for a form field component (TAG-314): the element is form-associated, submits the value the component sets under its name attribute, takes part in the form's validation, reset and disabled state, and delegates focus unless delegatesFocus is false. Defaults to false.",
|
|
253
|
+
}),
|
|
254
|
+
eventSampleRate: eventSampleRateSchema.optional(),
|
|
255
|
+
delegatesFocus: z.boolean().optional().meta({
|
|
256
|
+
description: "Whether the shadow root delegates focus (TAG-314): focusing the element, clicking one of its labels or a non-focusable part of it focuses the component's first focusable element. Defaults to the value of formAssociated.",
|
|
257
|
+
}),
|
|
258
|
+
})
|
|
259
|
+
// The policy link must be able to be an https page (security review of TAG-212): a prop limited
|
|
260
|
+
// to http or mailto could never carry one. No `protocols` means the default, https only.
|
|
261
|
+
.refine(
|
|
262
|
+
// zod-only: privacy-policy-https-url-prop
|
|
263
|
+
({ data, props }) => {
|
|
264
|
+
if (data?.privacyPolicyUrl === undefined)
|
|
265
|
+
return true;
|
|
266
|
+
if (props === undefined || !Object.hasOwn(props, data.privacyPolicyUrl))
|
|
267
|
+
return false;
|
|
268
|
+
const policy = props[data.privacyPolicyUrl];
|
|
269
|
+
return (policy?.type === "url" && (policy.protocols ?? DEFAULT_URL_PROTOCOLS).includes("https"));
|
|
270
|
+
}, {
|
|
271
|
+
error: 'privacyPolicyUrl must name a declared prop of type "url" whose protocols include https',
|
|
272
|
+
path: ["data", "privacyPolicyUrl"],
|
|
273
|
+
})
|
|
274
|
+
// The `locale` attribute belongs to the SDK's language choice once `locales` is declared
|
|
275
|
+
// (TAG-211); a prop of that name would read the same attribute with another meaning. Only
|
|
276
|
+
// manifests declaring `locales` (new in 1.2) are refused, so no older manifest becomes invalid.
|
|
277
|
+
.refine(
|
|
278
|
+
// zod-only: locales-no-locale-prop
|
|
279
|
+
({ locales, props }) => locales === undefined || props === undefined || !Object.hasOwn(props, LOCALE_ATTRIBUTE), {
|
|
280
|
+
error: `a component that declares locales cannot have a prop named "${LOCALE_ATTRIBUTE}": the SDK reads the "${LOCALE_ATTRIBUTE}" attribute to choose the language`,
|
|
281
|
+
path: ["props", LOCALE_ATTRIBUTE],
|
|
282
|
+
})
|
|
283
|
+
.meta({
|
|
284
|
+
title: "Taggor component manifest v1",
|
|
285
|
+
description: "Declarative description of a Taggor component. Generated from the Zod source in @taggor/contract; do not edit.",
|
|
286
|
+
});
|
|
287
|
+
/** Most unknown keys one issue message names. */
|
|
288
|
+
const MAX_KEYS_IN_MESSAGE = 10;
|
|
289
|
+
/**
|
|
290
|
+
* The message of one Zod issue for a person or an agent: a bad record key shows the key's own
|
|
291
|
+
* problems, and unknown keys (which come from the input) are quoted bounded (TAG-220). Shared
|
|
292
|
+
* with the source package's metadata files (TAG-407).
|
|
293
|
+
*
|
|
294
|
+
* Inputs: a Zod issue. Output: its message. Errors: none. Side effects: none.
|
|
295
|
+
*/
|
|
296
|
+
export function issueMessage(issue) {
|
|
297
|
+
// A bad record key (prop, event, field name…) arrives as a generic "Invalid key in record"
|
|
298
|
+
// wrapping the key's own issues; surface those, since they say how to fix the name.
|
|
299
|
+
if (issue.code === "invalid_key") {
|
|
300
|
+
const reasons = issue.issues.map((inner) => inner.message).join("; ");
|
|
301
|
+
const message = `invalid name "${boundedSegment(String(issue.path.at(-1)))}": ${reasons}`;
|
|
302
|
+
return issue.path.length === 2 && issue.path[0] === "events"
|
|
303
|
+
? `${message} (the page receives it as "<tag>:<name>", so write the name without the tag or a colon)`
|
|
304
|
+
: message;
|
|
305
|
+
}
|
|
306
|
+
// Zod quotes every unknown key in full; keys come from the input, so bound them (TAG-220).
|
|
307
|
+
if (issue.code === "unrecognized_keys") {
|
|
308
|
+
const shown = issue.keys.slice(0, MAX_KEYS_IN_MESSAGE).map((key) => `"${boundedSegment(key)}"`);
|
|
309
|
+
const more = issue.keys.length - shown.length;
|
|
310
|
+
const label = issue.keys.length === 1 ? "Unrecognized key" : "Unrecognized keys";
|
|
311
|
+
return `${label}: ${shown.join(", ")}${more > 0 ? ` and ${String(more)} more` : ""}`;
|
|
312
|
+
}
|
|
313
|
+
return issue.message;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* How a missing required `<map>.<name>.<field>` is fixed (TAG-206), keyed by `<map>.<field>`;
|
|
317
|
+
* `name` is already bounded.
|
|
318
|
+
*/
|
|
319
|
+
const MISSING_MEMBER_FIELD_HINTS = {
|
|
320
|
+
"events.detail": (name) => `event "${name}" must declare "detail", the value schema of its event.detail payload; use { "type": "object", "fields": {} } for an event without data`,
|
|
321
|
+
"cssVars.default": (name) => `CSS variable "${name}" must declare "default", a value of its type the component uses when the page does not set the variable`,
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Per-parse error map: a missing required field gets a message that names it and, for an event's
|
|
325
|
+
* `detail` and a CSS variable's `default`, says what to write (TAG-206). Zod's own message
|
|
326
|
+
* ("Invalid input: expected object, received undefined") does neither. Returns `undefined` for
|
|
327
|
+
* every other issue, so Zod and schema-level messages stay as they are.
|
|
328
|
+
*/
|
|
329
|
+
const manifestErrorMap = (issue) => {
|
|
330
|
+
if (issue.code !== "invalid_type" || issue.input !== undefined)
|
|
331
|
+
return undefined;
|
|
332
|
+
const path = (issue.path ?? []).map(String);
|
|
333
|
+
const [map, name, field] = path;
|
|
334
|
+
if (path.length === 3 && name !== undefined) {
|
|
335
|
+
const key = `${String(map)}.${String(field)}`;
|
|
336
|
+
const hint = Object.hasOwn(MISSING_MEMBER_FIELD_HINTS, key)
|
|
337
|
+
? MISSING_MEMBER_FIELD_HINTS[key]
|
|
338
|
+
: undefined;
|
|
339
|
+
if (hint !== undefined)
|
|
340
|
+
return hint(boundedSegment(name));
|
|
341
|
+
}
|
|
342
|
+
const last = path.at(-1);
|
|
343
|
+
return last === undefined
|
|
344
|
+
? undefined
|
|
345
|
+
: `missing required field "${boundedSegment(last)}": expected ${issue.expected}`;
|
|
346
|
+
};
|
|
347
|
+
function toIssues(error) {
|
|
348
|
+
return error.issues.map((issue) => ({
|
|
349
|
+
// Paths quote keys of the input: bounded like a __proto__ refusal (TAG-220).
|
|
350
|
+
path: boundedPath(issue.path.map(String)),
|
|
351
|
+
message: issueMessage(issue),
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* The `contractVersion` issue of a decoded manifest, if its version is not a known minor of the
|
|
356
|
+
* current major. Checked before the schema so the message says what to do (update the toolchain,
|
|
357
|
+
* migrate, declare the version) instead of quoting a pattern (TAG-207).
|
|
358
|
+
*/
|
|
359
|
+
function contractVersionIssue(input) {
|
|
360
|
+
if (typeof input !== "object" || input === null || Array.isArray(input))
|
|
361
|
+
return undefined;
|
|
362
|
+
const value = Object.hasOwn(input, "contractVersion")
|
|
363
|
+
? input["contractVersion"]
|
|
364
|
+
: undefined;
|
|
365
|
+
const { kind, version } = classifyContractVersion(value);
|
|
366
|
+
if (kind === "current")
|
|
367
|
+
return undefined;
|
|
368
|
+
return { path: "contractVersion", message: contractVersionMessage(kind, version) };
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Validates an already decoded manifest.
|
|
372
|
+
*
|
|
373
|
+
* Inputs: any value (typically `JSON.parse` output). Output: `{ ok: true, manifest }` or
|
|
374
|
+
* `{ ok: false, issues }` with every problem found. Two checks run first and, when they fail,
|
|
375
|
+
* are the only issue: an own `__proto__` key anywhere (or an input too large to scan, see
|
|
376
|
+
* `findOwnProtoKey`), then a `contractVersion` that is not a known minor of the current major
|
|
377
|
+
* (missing, malformed, newer, or an older major that needs `migrateManifest`). Errors: never
|
|
378
|
+
* throws. Side effects: none.
|
|
379
|
+
*/
|
|
380
|
+
export function parseManifest(input) {
|
|
381
|
+
const finding = findOwnProtoKey(input);
|
|
382
|
+
if (finding !== undefined) {
|
|
383
|
+
return { ok: false, issues: [{ path: finding.path, message: finding.message }] };
|
|
384
|
+
}
|
|
385
|
+
const versionIssue = contractVersionIssue(input);
|
|
386
|
+
if (versionIssue !== undefined)
|
|
387
|
+
return { ok: false, issues: [versionIssue] };
|
|
388
|
+
const result = componentManifestSchema.safeParse(input, { error: manifestErrorMap });
|
|
389
|
+
return result.success
|
|
390
|
+
? { ok: true, manifest: result.data }
|
|
391
|
+
: { ok: false, issues: toIssues(result.error) };
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Decodes and validates a manifest serialized as JSON, refusing oversized text before parsing.
|
|
395
|
+
*
|
|
396
|
+
* Inputs: JSON text. Output: as `parseManifest`; text longer than
|
|
397
|
+
* `MANIFEST_LIMITS.maxJsonLength` or not JSON yields one issue at the empty path. Errors: never
|
|
398
|
+
* throws. Side effects: none.
|
|
399
|
+
*/
|
|
400
|
+
export function parseManifestJson(text) {
|
|
401
|
+
if (text.length > MANIFEST_LIMITS.maxJsonLength) {
|
|
402
|
+
return {
|
|
403
|
+
ok: false,
|
|
404
|
+
issues: [
|
|
405
|
+
{
|
|
406
|
+
path: "",
|
|
407
|
+
message: `manifest JSON must be at most ${String(MANIFEST_LIMITS.maxJsonLength)} characters`,
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
let decoded;
|
|
413
|
+
try {
|
|
414
|
+
decoded = JSON.parse(text);
|
|
415
|
+
}
|
|
416
|
+
catch {
|
|
417
|
+
return { ok: false, issues: [{ path: "", message: "manifest is not valid JSON" }] };
|
|
418
|
+
}
|
|
419
|
+
return parseManifest(decoded);
|
|
420
|
+
}
|
|
421
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EACL,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,GACv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+
* The metering contract of the loader hit point (TAG-801): the one place that names what the edge
|
|
3
|
+
* writes per loader delivery and what counts toward a plan's usage, shared by the writer
|
|
4
|
+
* (apps/edge, domain/loader-hit.ts) and the readers (the API's usage reader; TAG-712 and TAG-1603
|
|
5
|
+
* build the quotas on it).
|
|
6
|
+
*
|
|
7
|
+
* Point layout of the `loader_hits` dataset (TAG-1823: a request writes a DELIVERY point, with no ASN and no
|
|
8
|
+
* visitor identifier, and a separate NETWORK point, with the ASN and `doubles[0] = 0`; `blobs[3]` is reserved and
|
|
9
|
+
* always empty, it held the visitor hash until TAG-1823; only the delivery count under a honored `Sec-GPC: 1`), append-only (a reader of an older layout keeps
|
|
10
|
+
* working): `indexes[0]` site key; `blobs[0]` hostname; `blobs[1]` allowance; `blobs[2]` traffic
|
|
11
|
+
* class; `doubles[0]` 1 (a delivery; sampling weights come from `_sample_interval`);
|
|
12
|
+
* `doubles[1]` the number of components the delivered manifest offered; since TAG-1730 also
|
|
13
|
+
* `blobs[3]` reserved (always empty) and `blobs[4]` the ASN of a network point (the anomaly guard, `usage-guard.ts`).
|
|
14
|
+
*
|
|
15
|
+
* Privacy (golden rule 6): none of it identifies a visitor. The traffic class is derived from the
|
|
16
|
+
* `User-Agent` in memory and only the class is kept.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* The header the API sets when it reads a site's loader itself (`?preload=true` needs the runtime
|
|
20
|
+
* version the loader names, TAG-335). The edge does not record a hit point for such a request: it
|
|
21
|
+
* is not a page loading the snippet, and counting it would make the installation check say
|
|
22
|
+
* "detected" before any page has the snippet. No secret guards it on purpose: sending it can only
|
|
23
|
+
* LOWER the counts of the caller's own non-visitor requests (a real visitor never sends it, and
|
|
24
|
+
* nothing is authorized or unlocked by it), so there is nothing to gain by forging it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const INTERNAL_READ_HEADER = "x-taggor-internal-read";
|
|
27
|
+
/** Whether the page's hostname is on the site's allowlist; `unknown` when there is no usable one. */
|
|
28
|
+
export declare const HOST_ALLOWANCES: readonly ["allowed", "blocked", "unknown"];
|
|
29
|
+
export type HostAllowance = (typeof HOST_ALLOWANCES)[number];
|
|
30
|
+
/** The traffic class of a delivery: a bot never counts toward a plan, it is kept for audit. */
|
|
31
|
+
export declare const TRAFFIC_CLASSES: readonly ["human", "bot"];
|
|
32
|
+
export type TrafficClass = (typeof TRAFFIC_CLASSES)[number];
|
|
33
|
+
/**
|
|
34
|
+
* Whether a delivery counts toward the plan usage: the page's hostname is not known to be off the
|
|
35
|
+
* allowlist and the traffic is not a bot. `unknown` (no usable `Referer`) COUNTS: the domain gate
|
|
36
|
+
* in the browser judges `location.hostname`, so the components mount on such a page, and not
|
|
37
|
+
* counting it would let `referrerpolicy="no-referrer"` escape the plan's ceiling. Only `blocked`
|
|
38
|
+
* (a hostname the site does not allow) and bots are left out, kept for audit.
|
|
39
|
+
* Inputs: the two stored dimensions. Output: true when it counts. Errors: none. No side effects.
|
|
40
|
+
*/
|
|
41
|
+
export declare function countsTowardUsage(allowance: HostAllowance, traffic: TrafficClass): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* The first instant of the UTC month of a date, the start of a usage window (plans are monthly;
|
|
44
|
+
* one clock for every reader, so the edge, the API and the invoice agree).
|
|
45
|
+
* Inputs: a date. Output: a new date at day 1, 00:00:00.000 UTC. Errors: none. No side effects.
|
|
46
|
+
*/
|
|
47
|
+
export declare function usageMonthStart(date: Date): Date;
|
|
48
|
+
/**
|
|
49
|
+
* The kinds of event the browser can report to `POST /e/<siteKey>` (TAG-816), the layout of the
|
|
50
|
+
* `component_events` dataset (append-only): `indexes[0]` site key; `blobs[0]` kind; `blobs[1]` the
|
|
51
|
+
* component tag; `blobs[2]` the published version hash; `blobs[3]` the hostname of the page's
|
|
52
|
+
* `Origin`; `blobs[4]` traffic class; `blobs[5]` the event name (`""` for `render`);
|
|
53
|
+
* `blobs[6]` the visitor's country (ISO 3166-1 alpha-2 from the platform, `""` when unknown) and
|
|
54
|
+
* `blobs[7]` a coarse device class (`DEVICE_CLASSES`, derived from the user agent on the edge);
|
|
55
|
+
* `doubles[0]` 1 (one point per event; sampling weights come from `_sample_interval`). No IP, no
|
|
56
|
+
* visitor identifier, no city or region, no path, no user agent. `render` is the aggregate count; the rest are
|
|
57
|
+
* interactions and are not stored when the visitor sends a privacy signal the site honors.
|
|
58
|
+
*/
|
|
59
|
+
export declare const COMPONENT_EVENT_KINDS: readonly ["render", "interaction", "custom", "error", "conversion"];
|
|
60
|
+
export type ComponentEventKind = (typeof COMPONENT_EVENT_KINDS)[number];
|
|
61
|
+
/**
|
|
62
|
+
* The server-render points of `GET /r/<siteKey>/<tag>` (spike, ADR 0066, no ticket), written by the
|
|
63
|
+
* edge itself into the same `component_events` dataset with the same layout: `indexes[0]` site key;
|
|
64
|
+
* `blobs[0]` the kind; `blobs[1]` the component tag; `blobs[2]` the version hash; every other blob
|
|
65
|
+
* `""` (no hostname, traffic class, name, country nor device: the caller is the customer's server,
|
|
66
|
+
* and nothing of the visitor reaches the route); `doubles[0]` 1. `ssr_render` is a render the edge
|
|
67
|
+
* performed (a cache miss that produced a fragment), the count `ssrRendersPerMonth` reads; `ssr_hit`
|
|
68
|
+
* is a fragment served from the colo cache, metered only (`SSR_FAILED_POINT_KIND` below is the third kind,
|
|
69
|
+
* outside this list). The distinct versions rendered per day are
|
|
70
|
+
* NOT read from these points (sampling can drop a rare version): see `ssr-version-ledger.ts`. They are
|
|
71
|
+
* NOT in `COMPONENT_EVENT_KINDS`, so `POST /e/` refuses them and a browser cannot forge one, and the
|
|
72
|
+
* metrics readers, which name their kinds, never count them.
|
|
73
|
+
*/
|
|
74
|
+
export declare const SSR_POINT_KINDS: readonly ["ssr_render", "ssr_hit"];
|
|
75
|
+
export type SsrPointKind = (typeof SSR_POINT_KINDS)[number];
|
|
76
|
+
/**
|
|
77
|
+
* The kind of a render that gave no fragment (TAG-635): written by the edge with the same layout,
|
|
78
|
+
* for staff queries and alerts. Not in `SSR_POINT_KINDS` on purpose: that list is what the API's
|
|
79
|
+
* usage reader asks for, and a failed render is never counted or billed.
|
|
80
|
+
*/
|
|
81
|
+
export declare const SSR_FAILED_POINT_KIND = "ssr_failed";
|
|
82
|
+
/**
|
|
83
|
+
* The coarse device class of an event (TAG-816), derived from the `User-Agent` on the edge, which
|
|
84
|
+
* keeps only the class: `mobile` (a phone), `tablet`, `desktop`, or `other` (a bot, a library, no
|
|
85
|
+
* header, anything not recognized). Four values, so the dataset's cardinality stays four.
|
|
86
|
+
*/
|
|
87
|
+
export declare const DEVICE_CLASSES: readonly ["mobile", "desktop", "tablet", "other"];
|
|
88
|
+
export type DeviceClass = (typeof DEVICE_CLASSES)[number];
|
|
89
|
+
/**
|
|
90
|
+
* The smallest `eventSampleRate` a manifest may declare (TAG-819): one event in a thousand, so the
|
|
91
|
+
* weight of a sent event (`1 / rate`) never passes 1000 and one forged or lucky event cannot stand
|
|
92
|
+
* for an unbounded count.
|
|
93
|
+
*/
|
|
94
|
+
export declare const EVENT_SAMPLE_RATE_MIN = 0.001;
|
|
95
|
+
/**
|
|
96
|
+
* The kinds the browser never samples (TAG-819): the render count, the `error` reports of the
|
|
97
|
+
* runtime (rare, and a sample would hide a failing release) and the `conversion` (the result the
|
|
98
|
+
* customer measures). Only `interaction` and `custom` follow `eventSampleRate`.
|
|
99
|
+
*/
|
|
100
|
+
export declare const UNSAMPLED_EVENT_KINDS: readonly ComponentEventKind[];
|
|
101
|
+
/**
|
|
102
|
+
* Whether the browser sends one event of this kind, given the component's `eventSampleRate`
|
|
103
|
+
* (TAG-819). A kind that is never sampled, an undeclared rate and a rate outside its bounds always
|
|
104
|
+
* send (a bad value must never silently drop events). Otherwise the event is sent with
|
|
105
|
+
* probability `rate`.
|
|
106
|
+
* Inputs: the kind, the declared rate (or `undefined`) and a draw in `[0, 1)` (`Math.random()` in
|
|
107
|
+
* the browser, a seeded draw in tests). Output: true to send. Errors: none. Pure.
|
|
108
|
+
*/
|
|
109
|
+
export declare function shouldSendEvent(kind: ComponentEventKind, rate: number | undefined, draw: number): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* How many real events one stored event stands for (TAG-819): `1 / rate` for a sampled kind, and 1
|
|
112
|
+
* for a kind that is never sampled or a rate that is not usable. The edge writes it as
|
|
113
|
+
* `doubles[0]` from the rate of the STORED manifest, never from the request, so a visitor cannot
|
|
114
|
+
* claim a weight; summing the weights over the sent events estimates the real total.
|
|
115
|
+
* Inputs: the kind and the declared rate. Output: the weight, at least 1 and at most
|
|
116
|
+
* `1 / EVENT_SAMPLE_RATE_MIN`. Errors: none. Pure.
|
|
117
|
+
*/
|
|
118
|
+
export declare function eventWeight(kind: ComponentEventKind, rate: number | undefined): number;
|
|
119
|
+
/**
|
|
120
|
+
* The most beacons of one kind (`interaction` or `custom`) a component sends in one page view
|
|
121
|
+
* (TAG-820), counted in the SDK's data transport: a component that emits on every keystroke or
|
|
122
|
+
* slider move cannot flood the visitor's network or the dataset. Sampling (`shouldSendEvent`)
|
|
123
|
+
* applies on top; the edge's flood keys stay the technical protection.
|
|
124
|
+
*/
|
|
125
|
+
export declare const EVENT_BEACON_CAP_PER_PAGE = 30;
|
|
126
|
+
//# sourceMappingURL=metering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metering.d.ts","sourceRoot":"","sources":["../src/metering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,qGAAqG;AACrG,eAAO,MAAM,eAAe,4CAA6C,CAAC;AAC1E,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,+FAA+F;AAC/F,eAAO,MAAM,eAAe,2BAA4B,CAAC;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D;;;;;;;GAOG;AACH,wBAAg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