@taggor/contract 0.3.0 → 0.5.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/dist/.tsbuildinfo +1 -1
- package/dist/artifact-keys.d.ts +11 -11
- package/dist/artifact-keys.d.ts.map +1 -1
- package/dist/artifact-keys.js +11 -11
- package/dist/artifact-keys.js.map +1 -1
- package/dist/assets.d.ts +5 -5
- package/dist/assets.js +5 -5
- package/dist/bounded-path.d.ts +2 -2
- package/dist/bounded-path.js +2 -2
- package/dist/bounded.d.ts +2 -2
- package/dist/bounded.js +2 -2
- package/dist/build-diagnostic.d.ts +5 -5
- package/dist/build-diagnostic.js +5 -5
- package/dist/component-types.d.ts +7 -7
- package/dist/component-types.js +4 -4
- package/dist/component-types.js.map +1 -1
- package/dist/consent-text.d.ts +1 -1
- package/dist/consent-text.js +1 -1
- package/dist/contract-version.d.ts +17 -16
- package/dist/contract-version.d.ts.map +1 -1
- package/dist/contract-version.js +17 -16
- package/dist/contract-version.js.map +1 -1
- package/dist/credential-fields.d.ts +1 -1
- package/dist/credential-fields.js +1 -1
- package/dist/css-tokens.d.ts +1 -1
- package/dist/css-tokens.js +1 -1
- package/dist/css-value.d.ts +4 -4
- package/dist/css-value.js +4 -4
- package/dist/data-api.d.ts +11 -11
- package/dist/data-api.js +14 -14
- package/dist/data-api.js.map +1 -1
- package/dist/denylist-keys.d.ts +1 -1
- package/dist/denylist-keys.js +4 -4
- package/dist/diagnostic-catalog.d.ts +44 -36
- package/dist/diagnostic-catalog.d.ts.map +1 -1
- package/dist/diagnostic-catalog.js +44 -40
- package/dist/diagnostic-catalog.js.map +1 -1
- package/dist/dom-members.snapshot.d.ts +4 -4
- package/dist/dom-members.snapshot.js +8 -8
- package/dist/early-loading.d.ts +1 -1
- package/dist/early-loading.js +1 -1
- package/dist/error-catalog.d.ts +106 -7
- package/dist/error-catalog.d.ts.map +1 -1
- package/dist/error-catalog.js +143 -48
- package/dist/error-catalog.js.map +1 -1
- package/dist/executable-config.d.ts +1 -1
- package/dist/freeze.d.ts +2 -2
- package/dist/freeze.js +2 -2
- package/dist/gunzip.d.ts +3 -3
- package/dist/gunzip.js +4 -4
- package/dist/gunzip.js.map +1 -1
- package/dist/hostname.d.ts +5 -6
- package/dist/hostname.d.ts.map +1 -1
- package/dist/hostname.js +7 -8
- package/dist/hostname.js.map +1 -1
- package/dist/human-actions.d.ts +4 -4
- package/dist/human-actions.d.ts.map +1 -1
- package/dist/human-actions.js +21 -0
- package/dist/human-actions.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/json-schema.d.ts +15 -16
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/json-schema.js +22 -23
- package/dist/json-schema.js.map +1 -1
- package/dist/key-checksum.d.ts +1 -1
- package/dist/key-checksum.js +1 -1
- package/dist/libraries.d.ts +4 -4
- package/dist/libraries.d.ts.map +1 -1
- package/dist/libraries.js +4 -4
- package/dist/libraries.js.map +1 -1
- package/dist/limit-catalog.d.ts +17 -17
- package/dist/limit-catalog.d.ts.map +1 -1
- package/dist/limit-catalog.js +30 -30
- package/dist/limit-catalog.js.map +1 -1
- package/dist/limits.d.ts +15 -15
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +16 -16
- package/dist/limits.js.map +1 -1
- package/dist/locale-tag.d.ts +2 -2
- package/dist/locale-tag.js +2 -2
- package/dist/make-diagnostic.d.ts +2 -3
- package/dist/make-diagnostic.d.ts.map +1 -1
- package/dist/make-diagnostic.js.map +1 -1
- package/dist/manifest-compat-diagnostics.d.ts +1 -1
- package/dist/manifest-compat.js +1 -1
- package/dist/manifest.d.ts +22 -23
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +32 -33
- package/dist/manifest.js.map +1 -1
- package/dist/metering.d.ts +17 -18
- package/dist/metering.d.ts.map +1 -1
- package/dist/metering.js +17 -18
- package/dist/metering.js.map +1 -1
- package/dist/migrate.d.ts +1 -1
- package/dist/migrate.js +5 -5
- package/dist/migrate.js.map +1 -1
- package/dist/money.d.ts +2 -2
- package/dist/money.js +2 -2
- package/dist/names.d.ts +4 -4
- package/dist/names.js +4 -4
- package/dist/overage-pricing.d.ts +1 -1
- package/dist/overage-pricing.js +1 -1
- package/dist/plan-ids.d.ts +1 -1
- package/dist/plan-ids.js +1 -1
- package/dist/plan-limits.d.ts +13 -13
- package/dist/plan-limits.d.ts.map +1 -1
- package/dist/plan-limits.js +8 -8
- package/dist/plan-limits.js.map +1 -1
- package/dist/plan-pricing.d.ts +10 -12
- package/dist/plan-pricing.d.ts.map +1 -1
- package/dist/plan-pricing.js +12 -14
- package/dist/plan-pricing.js.map +1 -1
- package/dist/plan-usage.d.ts +18 -18
- package/dist/plan-usage.d.ts.map +1 -1
- package/dist/plan-usage.js +19 -20
- package/dist/plan-usage.js.map +1 -1
- package/dist/preview-token.js +2 -2
- package/dist/prop-names.d.ts +5 -5
- package/dist/prop-names.d.ts.map +1 -1
- package/dist/prop-names.js +10 -10
- package/dist/prop-names.js.map +1 -1
- package/dist/prop-type-docs.js +1 -1
- package/dist/prop-types.d.ts +6 -6
- package/dist/prop-types.js +17 -17
- package/dist/prop-types.js.map +1 -1
- package/dist/props.d.ts +5 -5
- package/dist/props.js +6 -6
- package/dist/props.js.map +1 -1
- package/dist/proto-guard.js +3 -3
- package/dist/proto-guard.js.map +1 -1
- package/dist/runtime-errors.d.ts +2 -2
- package/dist/runtime-errors.js +2 -2
- package/dist/runtime-pointers.d.ts +2 -2
- package/dist/runtime-pointers.js +2 -2
- package/{schema → dist/schema}/component-manifest.v1.json +5 -5
- package/dist/secret-scan.d.ts +10 -10
- package/dist/secret-scan.d.ts.map +1 -1
- package/dist/secret-scan.js +15 -16
- package/dist/secret-scan.js.map +1 -1
- package/dist/semver.d.ts +2 -2
- package/dist/semver.js +2 -2
- package/dist/server-key.js +1 -1
- package/dist/site-manifest-keys.d.ts +11 -11
- package/dist/site-manifest-keys.d.ts.map +1 -1
- package/dist/site-manifest-keys.js +18 -18
- package/dist/site-manifest-keys.js.map +1 -1
- package/dist/site-manifest.d.ts +2 -2
- package/dist/site-manifest.js +9 -9
- package/dist/site-manifest.js.map +1 -1
- package/dist/source-archive.d.ts +13 -13
- package/dist/source-archive.js +25 -25
- package/dist/source-archive.js.map +1 -1
- package/dist/source-package-corpus.d.ts +3 -4
- package/dist/source-package-corpus.d.ts.map +1 -1
- package/dist/source-package-corpus.js +4 -6
- package/dist/source-package-corpus.js.map +1 -1
- package/dist/source-package.d.ts +18 -17
- package/dist/source-package.d.ts.map +1 -1
- package/dist/source-package.js +16 -15
- package/dist/source-package.js.map +1 -1
- package/dist/source-secrets.js +1 -1
- package/dist/ssr-cap.d.ts +1 -1
- package/dist/ssr-cap.js +4 -4
- package/dist/ssr-kv.d.ts +2 -2
- package/dist/ssr-kv.js +2 -2
- package/dist/ssr-render.d.ts +2 -2
- package/dist/ssr-render.d.ts.map +1 -1
- package/dist/ssr-render.js +3 -3
- package/dist/ssr-render.js.map +1 -1
- package/dist/ssr-version-ledger.js +3 -3
- package/dist/style-references.d.ts +2 -3
- package/dist/style-references.d.ts.map +1 -1
- package/dist/style-references.js +10 -11
- package/dist/style-references.js.map +1 -1
- package/dist/support-contact.d.ts +11 -0
- package/dist/support-contact.d.ts.map +1 -0
- package/dist/support-contact.js +11 -0
- package/dist/support-contact.js.map +1 -0
- package/dist/tag-name.d.ts +6 -6
- package/dist/tag-name.d.ts.map +1 -1
- package/dist/tag-name.js +7 -7
- package/dist/tag-name.js.map +1 -1
- package/dist/tar-writer.js +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/text-codec.d.ts +2 -2
- package/dist/text-codec.js +2 -2
- package/dist/url-value.d.ts +1 -1
- package/dist/url-value.js +6 -6
- package/dist/usage-guard.d.ts +16 -16
- package/dist/usage-guard.js +15 -15
- package/dist/usage-mirror.d.ts +5 -5
- package/dist/value-check.d.ts +6 -6
- package/dist/value-check.js +21 -21
- package/dist/value-check.js.map +1 -1
- package/dist/value-patterns.js +2 -2
- package/dist/value-schema.d.ts +4 -4
- package/dist/value-schema.d.ts.map +1 -1
- package/dist/value-schema.js +5 -5
- package/dist/value-schema.js.map +1 -1
- package/dist/zod-free.d.ts +25 -24
- package/dist/zod-free.d.ts.map +1 -1
- package/dist/zod-free.js +26 -25
- package/dist/zod-free.js.map +1 -1
- package/package.json +9 -10
- package/schema/DEPLOYED +0 -12
- package/schema/published/SHA256SUMS +0 -41
- package/schema/published/build-diagnostic/v1.10.json +0 -83
- package/schema/published/build-diagnostic/v1.11.json +0 -83
- package/schema/published/build-diagnostic/v1.3.json +0 -83
- package/schema/published/build-diagnostic/v1.4.json +0 -83
- package/schema/published/build-diagnostic/v1.5.json +0 -83
- package/schema/published/build-diagnostic/v1.6.json +0 -83
- package/schema/published/build-diagnostic/v1.7.json +0 -83
- package/schema/published/build-diagnostic/v1.8.json +0 -83
- package/schema/published/build-diagnostic/v1.9.json +0 -83
- package/schema/published/component-manifest/v1.10.json +0 -1443
- package/schema/published/component-manifest/v1.11.json +0 -1443
- package/schema/published/component-manifest/v1.3.json +0 -1411
- package/schema/published/component-manifest/v1.4.json +0 -1419
- package/schema/published/component-manifest/v1.5.json +0 -1437
- package/schema/published/component-manifest/v1.6.json +0 -1437
- package/schema/published/component-manifest/v1.7.json +0 -1437
- package/schema/published/component-manifest/v1.8.json +0 -1437
- package/schema/published/component-manifest/v1.9.json +0 -1437
- package/schema/published/data-api/v1.10.json +0 -282
- package/schema/published/data-api/v1.11.json +0 -282
- package/schema/published/data-api/v1.3.json +0 -281
- package/schema/published/data-api/v1.4.json +0 -281
- package/schema/published/data-api/v1.5.json +0 -281
- package/schema/published/data-api/v1.6.json +0 -281
- package/schema/published/data-api/v1.7.json +0 -281
- package/schema/published/data-api/v1.8.json +0 -282
- package/schema/published/data-api/v1.9.json +0 -282
- package/schema/published/library-manifest/v1.10.json +0 -68
- package/schema/published/library-manifest/v1.11.json +0 -68
- package/schema/published/library-manifest/v1.5.json +0 -68
- package/schema/published/library-manifest/v1.6.json +0 -68
- package/schema/published/library-manifest/v1.7.json +0 -68
- package/schema/published/library-manifest/v1.8.json +0 -68
- package/schema/published/library-manifest/v1.9.json +0 -68
- package/schema/published/taggor-config/v1.10.json +0 -56
- package/schema/published/taggor-config/v1.11.json +0 -56
- package/schema/published/taggor-config/v1.5.json +0 -56
- package/schema/published/taggor-config/v1.6.json +0 -56
- package/schema/published/taggor-config/v1.7.json +0 -56
- package/schema/published/taggor-config/v1.8.json +0 -56
- package/schema/published/taggor-config/v1.9.json +0 -56
- /package/{schema → dist/schema}/build-diagnostic.v1.json +0 -0
- /package/{schema → dist/schema}/data-api.v1.json +0 -0
- /package/{schema → dist/schema}/library-manifest.v1.json +0 -0
- /package/{schema → dist/schema}/taggor-config.v1.json +0 -0
package/dist/plan-usage.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What each plan allows a workspace to USE in a month and how long it may KEEP submissions
|
|
3
|
-
*
|
|
2
|
+
* What each plan allows a workspace to USE in a month and how long it may KEEP submissions,
|
|
3
|
+
* plus the pure rules that read a count against that allowance. Zod-free.
|
|
4
4
|
*
|
|
5
|
-
* The numbers are a
|
|
6
|
-
*
|
|
7
|
-
* TAG-1603 (the entitlement catalog) replaces this table in one place and nothing else changes.
|
|
5
|
+
* The numbers are a proposal, not final: they live only in `planUsage` and in the two rule constants below, so
|
|
6
|
+
* the entitlement catalog replaces this table in one place and nothing else changes.
|
|
8
7
|
* Measuring is all this module supports: a level here never cuts a component or a submission
|
|
9
|
-
*
|
|
8
|
+
* and a count of renders that looks forged
|
|
10
9
|
* (`detectViewSpike`) is never a ground for any action until a person has reviewed it.
|
|
11
10
|
*/
|
|
12
11
|
import { catalogRows } from "./limit-catalog.js";
|
|
@@ -15,11 +14,11 @@ import { DEFAULT_PLAN_ID, PLAN_IDS, isPlanId } from "./plan-limits.js";
|
|
|
15
14
|
const table = catalogRows("usage");
|
|
16
15
|
/** The usage allowance of every plan, by plan id. Frozen. */
|
|
17
16
|
export const planUsage = Object.freeze(Object.fromEntries(PLAN_IDS.map((id) => [id, Object.freeze({ ...table[id] })])));
|
|
18
|
-
/** The percentages of an allowance at which a customer is warned (
|
|
17
|
+
/** The percentages of an allowance at which a customer is warned (80% and 100%). */
|
|
19
18
|
export const USAGE_WARNING_PERCENTS = Object.freeze([80, 100]);
|
|
20
19
|
/**
|
|
21
20
|
* Where a count stands against its allowance. `ok` below 80%, `warning` from 80%, `reached` from
|
|
22
|
-
* 100%. Nothing acts on it in this ticket;
|
|
21
|
+
* 100%. Nothing acts on it in this ticket; adds grace and the rest.
|
|
23
22
|
*/
|
|
24
23
|
export const USAGE_LEVELS = ["ok", "warning", "reached"];
|
|
25
24
|
/**
|
|
@@ -45,17 +44,17 @@ export function usageLevel(used, limit) {
|
|
|
45
44
|
return percent >= warn ? "warning" : "ok";
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
48
|
-
* The rule that marks a site's render count as suspect
|
|
47
|
+
* The rule that marks a site's render count as suspect: the key of a
|
|
49
48
|
* site and its allowed domains are public, so anyone can forge loader hits with a `Referer` and a
|
|
50
49
|
* `User-Agent`. A day with more than `multiplier` times the mean of the `baselineDays` days before
|
|
51
|
-
* it, and at least `minViews`, is a
|
|
50
|
+
* it, and at least `minViews`, is a surge. Provisional.
|
|
52
51
|
*
|
|
53
52
|
* What it does NOT catch: a slow ramp (each day under `multiplier` times the days before it) and
|
|
54
53
|
* steady traffic below `minViews` a day. `minViews` here is only the ceiling of the floor; the
|
|
55
54
|
* plan's own floor is `spikeMinViews`, so steady forging is bounded by the plan (at most about
|
|
56
55
|
* `rendersPerMonth` in a month) instead of by a fixed 1,000 a day. The guard is a brake on sudden
|
|
57
|
-
*
|
|
58
|
-
* having looked
|
|
56
|
+
* surges, not proof of authenticity: nothing may cut a component for renders without a person
|
|
57
|
+
* having looked.
|
|
59
58
|
*/
|
|
60
59
|
export const VIEW_SPIKE_RULE = Object.freeze({
|
|
61
60
|
multiplier: 10,
|
|
@@ -64,17 +63,17 @@ export const VIEW_SPIKE_RULE = Object.freeze({
|
|
|
64
63
|
minViews: 1000,
|
|
65
64
|
});
|
|
66
65
|
/**
|
|
67
|
-
* The daily floor of a plan: a day below it is never a
|
|
66
|
+
* The daily floor of a plan: a day below it is never a surge.
|
|
68
67
|
* Inputs: the plan's renders per month. Output: the lower of `VIEW_SPIKE_RULE.minViews` and a
|
|
69
68
|
* thirtieth of the month (at least 1), so quietly forging the plan's whole month in 30 equal days
|
|
70
|
-
* is a
|
|
69
|
+
* is a surge on the first day that passes the floor rather than going unseen. Errors: none. No
|
|
71
70
|
* side effects.
|
|
72
71
|
*/
|
|
73
72
|
export function spikeMinViews(rendersPerMonth) {
|
|
74
73
|
return Math.max(1, Math.min(VIEW_SPIKE_RULE.minViews, Math.floor(rendersPerMonth / 30)));
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
|
-
* The
|
|
76
|
+
* The surge rule of a plan. Inputs: a plan id (unknown: the default plan). Output: the rule with
|
|
78
77
|
* the plan's floor. Errors: none. No side effects.
|
|
79
78
|
*/
|
|
80
79
|
export function spikeRuleOf(planId) {
|
|
@@ -88,13 +87,13 @@ function dayKey(time) {
|
|
|
88
87
|
return new Date(time).toISOString().slice(0, 10);
|
|
89
88
|
}
|
|
90
89
|
/**
|
|
91
|
-
* Every day of a series that is a
|
|
90
|
+
* Every day of a series that is a surge, earliest first.
|
|
92
91
|
* Inputs: the counted views per UTC day (any order; a missing day is zero), the current time, the
|
|
93
92
|
* rule and the first day to examine (default: yesterday, so today, still partial, and yesterday are
|
|
94
|
-
* looked at). Output: the
|
|
95
|
-
* the `baselineDays` days before it (possibly none). All of them, not the first: a
|
|
93
|
+
* looked at). Output: the surges among the days from `from` to today, each day against the mean of
|
|
94
|
+
* the `baselineDays` days before it (possibly none). All of them, not the first: a surge a person
|
|
96
95
|
* already judged `legit` must not hide a later one. A caller that measures a workspace only
|
|
97
|
-
* every few hours passes the first day of the month, so a
|
|
96
|
+
* every few hours passes the first day of the month, so a surge that happened between two visits
|
|
98
97
|
* is still found. Days before the series count as zero: give it `baselineDays` days before `from`.
|
|
99
98
|
* Errors: none. No side effects.
|
|
100
99
|
*/
|
|
@@ -119,7 +118,7 @@ export function detectViewSpikes(series, now, rule = VIEW_SPIKE_RULE, from) {
|
|
|
119
118
|
return spikes;
|
|
120
119
|
}
|
|
121
120
|
/**
|
|
122
|
-
* The first
|
|
121
|
+
* The first surge of `detectViewSpikes`, or `null`. Same inputs. Errors: none. No side effects.
|
|
123
122
|
*/
|
|
124
123
|
export function detectViewSpike(series, now, rule = VIEW_SPIKE_RULE, from) {
|
|
125
124
|
return detectViewSpikes(series, now, rule, from)[0] ?? null;
|
package/dist/plan-usage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-usage.js","sourceRoot":"","sources":["../src/plan-usage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"plan-usage.js","sourceRoot":"","sources":["../src/plan-usage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAe,MAAM,kBAAkB,CAAC;AAmBpF,gGAAgG;AAChG,MAAM,KAAK,GAA8B,WAAW,CAAC,OAAO,CAAC,CAAC;AAE9D,6DAA6D;AAC7D,MAAM,CAAC,MAAM,SAAS,GAAwC,MAAM,CAAC,MAAM,CACzE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAG7E,CACF,CAAC;AAEF,oFAAoF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AAC,CAAC;QACzC,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ;YAAE,SAAS;QACpC,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC,YAAY,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;YACxD,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,YAAY,GAAG,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC;QAC7C,IAAI,KAAK,GAAG,IAAI,CAAC,UAAU,GAAG,YAAY,EAAE,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA6B,EAC7B,GAAS,EACT,OAAsB,eAAe,EACrC,IAAW;IAEX,OAAO,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,MAA0B;IACpD,OAAO,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/preview-token.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The private preview token
|
|
2
|
+
* The private preview token: the capability in `https://<preview host>/p/<token>` that
|
|
3
3
|
* lets anyone holding the link see ONE build's bundle for seven days. The API signs it when a
|
|
4
4
|
* client reads a succeeded build of its own workspace; the edge verifies it without a database
|
|
5
|
-
* (
|
|
5
|
+
* (the edge has no Postgres binding, so the token carries everything it needs).
|
|
6
6
|
* Pure and import-free on purpose, like the other files the API and the edge share: the HMAC
|
|
7
7
|
* itself is injected (`PreviewSigner`), each Worker brings its own Web Crypto adapter.
|
|
8
8
|
*
|
package/dist/prop-names.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const CUSTOM_ELEMENT_MEMBERS: readonly ["adoptedCallback", "attributeChangedCallback", "connectedCallback", "connectedMoveCallback", "disabledFeatures", "disconnectedCallback", "formAssociated", "formAssociatedCallback", "formDisabledCallback", "formResetCallback", "formStateRestoreCallback", "observedAttributes"];
|
|
6
6
|
/**
|
|
7
|
-
* The form field API of a form field component's element (
|
|
7
|
+
* The form field API of a form field component's element (a manifest with
|
|
8
8
|
* `formAssociated: true`), as on an `<input>`: the runtime defines these accessors on the element
|
|
9
9
|
* class and forwards them to the element's `ElementInternals` (`value` is the last text the component
|
|
10
10
|
* submits, `""` when none), and the generated `<tag>.d.ts` types them. Not reserved: a prop may
|
|
@@ -12,12 +12,12 @@ export declare const CUSTOM_ELEMENT_MEMBERS: readonly ["adoptedCallback", "attri
|
|
|
12
12
|
* prop, the getter is the field's and the setter sets the prop.
|
|
13
13
|
*/
|
|
14
14
|
export declare const FORM_FIELD_ACCESSORS: readonly ["value", "form", "validationMessage", "validity"];
|
|
15
|
-
/** The form field methods of a form field component's element
|
|
15
|
+
/** The form field methods of a form field component's element, forwarded the same way. */
|
|
16
16
|
export declare const FORM_FIELD_METHODS: readonly ["checkValidity", "reportValidity"];
|
|
17
17
|
/**
|
|
18
18
|
* Global HTML attributes with a native effect on any element (HTML Living Standard, "global
|
|
19
19
|
* attributes", plus `part`/`exportparts` from CSS Shadow Parts, `role` from ARIA, Chrome's
|
|
20
|
-
* `virtualkeyboardpolicy` and
|
|
20
|
+
* `virtualkeyboardpolicy` and,, the proposed `focusgroup` (Open UI) and
|
|
21
21
|
* `headingoffset`/`headingreset` (WHATWG heading levels)). `aria-*`, `data-*` and `on*` are refused
|
|
22
22
|
* by the prop name pattern.
|
|
23
23
|
*/
|
|
@@ -32,7 +32,7 @@ export declare const NATIVE_GLOBAL_ATTRIBUTES: readonly ["accesskey", "autocapit
|
|
|
32
32
|
export declare function propAttributeName(propName: string): string;
|
|
33
33
|
/**
|
|
34
34
|
* Inverse of `propAttributeName`: kebab-case attribute to lowerCamelCase prop (`max-value` →
|
|
35
|
-
* `maxValue`). The runtime uses it in `attributeChangedCallback
|
|
35
|
+
* `maxValue`). The runtime uses it in `attributeChangedCallback`.
|
|
36
36
|
*
|
|
37
37
|
* Inputs: any attribute name. Output: the prop name it would belong to; the caller still looks
|
|
38
38
|
* it up among the declared props, so a name that maps to no prop is simply ignored. Errors: none.
|
|
@@ -42,7 +42,7 @@ export declare function attributePropName(attributeName: string): string;
|
|
|
42
42
|
/**
|
|
43
43
|
* Prop names that would shadow a member of the host element (browser snapshot, lifecycle
|
|
44
44
|
* callbacks, `Object.prototype`) or own a global attribute with a native effect. Sorted, unique,
|
|
45
|
-
* only names that the prefix and shape rules do not already refuse. The runtime
|
|
45
|
+
* only names that the prefix and shape rules do not already refuse. The runtime also
|
|
46
46
|
* refuses any name found on the live `HTMLElement.prototype`.
|
|
47
47
|
*/
|
|
48
48
|
export declare const RESERVED_PROP_NAMES: readonly string[];
|
package/dist/prop-names.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-names.d.ts","sourceRoot":"","sources":["../src/prop-names.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,+RAaxB,CAAC;AAEZ;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,6DAKtB,CAAC;AAEZ,
|
|
1
|
+
{"version":3,"file":"prop-names.d.ts","sourceRoot":"","sources":["../src/prop-names.ts"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,eAAO,MAAM,sBAAsB,+RAaxB,CAAC;AAEZ;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,6DAKtB,CAAC;AAEZ,0FAA0F;AAC1F,eAAO,MAAM,kBAAkB,8CAA8D,CAAC;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,scAqC1B,CAAC;AAOZ;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAE/D;AAuBD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAA0C,CAAC;AAQ5F,qGAAqG;AACrG,eAAO,MAAM,iBAAiB,EAAE,MAA0C,CAAC"}
|
package/dist/prop-names.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Prop name rules of component contract v1 without Zod (
|
|
2
|
+
* Prop name rules of component contract v1 without Zod (reserved list derived):
|
|
3
3
|
* the reserved names, the prop name pattern and the prop ↔ attribute mapping. The runtime may
|
|
4
4
|
* import this module's values through `@taggor/contract/zod-free`.
|
|
5
5
|
*
|
|
6
6
|
* A prop is installed as a property and an attribute of the host element, so its name must not
|
|
7
7
|
* shadow anything the element already has. The reserved list is derived, not typed by hand, from:
|
|
8
|
-
* the browser snapshots of the prototype chain (`dom-members.snapshot.ts`: Chrome, and Firefox
|
|
9
|
-
*
|
|
8
|
+
* the browser snapshots of the prototype chain (`dom-members.snapshot.ts`: Chrome, and Firefox),
|
|
9
|
+
* the custom element
|
|
10
10
|
* lifecycle callbacks and static members (not on `HTMLElement.prototype`, but the runtime's class
|
|
11
11
|
* defines them), and the global attributes with a native effect, compared by `propAttributeName`
|
|
12
12
|
* (a prop `contenteditable` would own the attribute `contenteditable`). Names already refused by
|
|
@@ -33,7 +33,7 @@ export const CUSTOM_ELEMENT_MEMBERS = Object.freeze([
|
|
|
33
33
|
"observedAttributes",
|
|
34
34
|
]);
|
|
35
35
|
/**
|
|
36
|
-
* The form field API of a form field component's element (
|
|
36
|
+
* The form field API of a form field component's element (a manifest with
|
|
37
37
|
* `formAssociated: true`), as on an `<input>`: the runtime defines these accessors on the element
|
|
38
38
|
* class and forwards them to the element's `ElementInternals` (`value` is the last text the component
|
|
39
39
|
* submits, `""` when none), and the generated `<tag>.d.ts` types them. Not reserved: a prop may
|
|
@@ -46,12 +46,12 @@ export const FORM_FIELD_ACCESSORS = Object.freeze([
|
|
|
46
46
|
"validationMessage",
|
|
47
47
|
"validity",
|
|
48
48
|
]);
|
|
49
|
-
/** The form field methods of a form field component's element
|
|
49
|
+
/** The form field methods of a form field component's element, forwarded the same way. */
|
|
50
50
|
export const FORM_FIELD_METHODS = Object.freeze(["checkValidity", "reportValidity"]);
|
|
51
51
|
/**
|
|
52
52
|
* Global HTML attributes with a native effect on any element (HTML Living Standard, "global
|
|
53
53
|
* attributes", plus `part`/`exportparts` from CSS Shadow Parts, `role` from ARIA, Chrome's
|
|
54
|
-
* `virtualkeyboardpolicy` and
|
|
54
|
+
* `virtualkeyboardpolicy` and,, the proposed `focusgroup` (Open UI) and
|
|
55
55
|
* `headingoffset`/`headingreset` (WHATWG heading levels)). `aria-*`, `data-*` and `on*` are refused
|
|
56
56
|
* by the prop name pattern.
|
|
57
57
|
*/
|
|
@@ -109,7 +109,7 @@ export function propAttributeName(propName) {
|
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Inverse of `propAttributeName`: kebab-case attribute to lowerCamelCase prop (`max-value` →
|
|
112
|
-
* `maxValue`). The runtime uses it in `attributeChangedCallback
|
|
112
|
+
* `maxValue`). The runtime uses it in `attributeChangedCallback`.
|
|
113
113
|
*
|
|
114
114
|
* Inputs: any attribute name. Output: the prop name it would belong to; the caller still looks
|
|
115
115
|
* it up among the declared props, so a name that maps to no prop is simply ignored. Errors: none.
|
|
@@ -124,7 +124,7 @@ function snapshotMembers(snapshot) {
|
|
|
124
124
|
}
|
|
125
125
|
function deriveReservedNames() {
|
|
126
126
|
const candidates = [
|
|
127
|
-
// The union of the browsers' snapshots
|
|
127
|
+
// The union of the browsers' snapshots: Firefox has `setCapture` and others.
|
|
128
128
|
...[DOM_MEMBER_SNAPSHOT, FIREFOX_DOM_MEMBER_SNAPSHOT].flatMap(snapshotMembers),
|
|
129
129
|
...CUSTOM_ELEMENT_MEMBERS,
|
|
130
130
|
...NATIVE_GLOBAL_ATTRIBUTES.map(attributePropName),
|
|
@@ -134,11 +134,11 @@ function deriveReservedNames() {
|
|
|
134
134
|
}
|
|
135
135
|
// `@__PURE__` on both calls, which take no arguments (esbuild keeps the arguments of a pure call
|
|
136
136
|
// it drops): a bundle that reads neither constant (the runtime's attribute mapping) drops both and
|
|
137
|
-
// the DOM snapshot with them, about 2 KB gz (
|
|
137
|
+
// the DOM snapshot with them, about 2 KB gz (criterion).
|
|
138
138
|
/**
|
|
139
139
|
* Prop names that would shadow a member of the host element (browser snapshot, lifecycle
|
|
140
140
|
* callbacks, `Object.prototype`) or own a global attribute with a native effect. Sorted, unique,
|
|
141
|
-
* only names that the prefix and shape rules do not already refuse. The runtime
|
|
141
|
+
* only names that the prefix and shape rules do not already refuse. The runtime also
|
|
142
142
|
* refuses any name found on the live `HTMLElement.prototype`.
|
|
143
143
|
*/
|
|
144
144
|
export const RESERVED_PROP_NAMES = /* @__PURE__ */ deriveReservedNames();
|
package/dist/prop-names.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-names.js","sourceRoot":"","sources":["../src/prop-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAE7F;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC;IAClD,iBAAiB;IACjB,0BAA0B;IAC1B,mBAAmB;I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CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClG,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,iGAAiG;AACjG,mGAAmG;AACnG,yDAAyD;AACzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB,eAAe,CAAC,mBAAmB,EAAE,CAAC;AAE5F,SAAS,eAAe;IACtB,OAAO,IAAI,MAAM,CACf,yCAAyC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,uBAAuB,CAC9F,CAAC;AACJ,CAAC;AAED,qGAAqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAW,eAAe,CAAC,eAAe,EAAE,CAAC"}
|
package/dist/prop-type-docs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Human descriptions of the prop type catalog
|
|
2
|
+
* Human descriptions of the prop type catalog, in pt-BR and en: what attribute text each
|
|
3
3
|
* type accepts and what value results. SPEC.md's table is generated from this and from
|
|
4
4
|
* `propTypeCatalog` (`pnpm --filter @taggor/contract gen`); the builder and the docs site (en) read
|
|
5
5
|
* the same text. Kept apart from the catalog so the runtime bundle never carries prose.
|
package/dist/prop-types.d.ts
CHANGED
|
@@ -29,13 +29,13 @@ export interface PropTypeEntry<T extends PropType> {
|
|
|
29
29
|
readonly attribute: AttributeSyntax;
|
|
30
30
|
/**
|
|
31
31
|
* Whether the runtime writes the value back to the attribute when the property changes. Arrays
|
|
32
|
-
* and objects are never reflected
|
|
32
|
+
* and objects are never reflected: large JSON in the DOM is slow and leaks to CSS
|
|
33
33
|
* selectors and to page scripts reading attributes.
|
|
34
34
|
*/
|
|
35
35
|
readonly reflect: boolean;
|
|
36
36
|
/**
|
|
37
37
|
* Longest attribute text read, in UTF-16 units of the raw text; longer text is refused before
|
|
38
|
-
* any parsing. A bound, not the value limit: string limits are in code points
|
|
38
|
+
* any parsing. A bound, not the value limit: string limits are in code points.
|
|
39
39
|
*/
|
|
40
40
|
readonly maxAttributeLength: (prop: PropDeclarationOf<T>) => number;
|
|
41
41
|
/** Attribute text (present) → value. Absence is handled by `attributeToValue`. */
|
|
@@ -50,9 +50,9 @@ export type PropTypeCatalog = {
|
|
|
50
50
|
readonly [T in PropType]: PropTypeEntry<T>;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
* The catalog. Data plus pure functions, frozen in depth (
|
|
53
|
+
* The catalog. Data plus pure functions, frozen in depth (a page script cannot swap an
|
|
54
54
|
* entry's `accept`); iterate it (`Object.values`) to cover every type, so a new type is picked up
|
|
55
|
-
* by every consumer's tests
|
|
55
|
+
* by every consumer's tests.
|
|
56
56
|
*/
|
|
57
57
|
export declare const propTypeCatalog: PropTypeCatalog;
|
|
58
58
|
/** A coerced prop value; `problem` says why the input was replaced by the default. */
|
|
@@ -63,7 +63,7 @@ export type Coerced = {
|
|
|
63
63
|
readonly problem: ValueProblem;
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
|
-
* Attribute → prop value, as the runtime's `attributeChangedCallback` needs it
|
|
66
|
+
* Attribute → prop value, as the runtime's `attributeChangedCallback` needs it.
|
|
67
67
|
*
|
|
68
68
|
* Inputs: a declaration accepted by `propDeclarationSchema`, and the attribute text or `null` when
|
|
69
69
|
* the attribute is absent. Output: `{ value }` (absent: `false` for `boolean`, otherwise the
|
|
@@ -75,7 +75,7 @@ export type Coerced = {
|
|
|
75
75
|
*/
|
|
76
76
|
export declare function attributeToValue(prop: PropDeclaration, text: string | null): Coerced;
|
|
77
77
|
/**
|
|
78
|
-
* Property (or `<script type="application/json" data-props>` entry) → prop value
|
|
78
|
+
* Property (or `<script type="application/json" data-props>` entry) → prop value.
|
|
79
79
|
*
|
|
80
80
|
* Inputs: a declaration and any JS value. Output: `{ value }` with a fresh accepted value,
|
|
81
81
|
* `{ value: default }` for `undefined` or `null` (the property was cleared), or
|
package/dist/prop-types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The prop type catalog of component contract v1
|
|
2
|
+
* The prop type catalog of component contract v1: for each of the nine prop types, how an
|
|
3
3
|
* attribute becomes a value, which JS values a property accepts, how a value becomes attribute
|
|
4
|
-
* text again, and whether the runtime reflects it. Zod-free and pure: the runtime
|
|
5
|
-
*
|
|
4
|
+
* text again, and whether the runtime reflects it. Zod-free and pure: the runtime
|
|
5
|
+
* imports it through `@taggor/contract/zod-free`, the SDK types props from
|
|
6
6
|
* `PropValue`, and SPEC.md's "tipo → atributo aceito → valor resultante" table is generated from it.
|
|
7
7
|
*
|
|
8
8
|
* Every rule is fixed by the declared `type` and its plain options (golden rule 5): no `eval`, no
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
* before it is parsed (`MANIFEST_LIMITS`), invalid text never throws, and the coercion helpers fall
|
|
11
11
|
* back to the declared `default`. `parse(serialize(v))` returns `v` for every accepted value
|
|
12
12
|
* (prop-types.test.ts checks it on thousands of generated values), with two documented
|
|
13
|
-
* exceptions: `-0` becomes `0` at any depth, by attribute and by property alike
|
|
14
|
-
* the delivered `default
|
|
13
|
+
* exceptions: `-0` becomes `0` at any depth, by attribute and by property alike and in
|
|
14
|
+
* the delivered `default`, and an `array`/`object` value whose JSON is longer than
|
|
15
15
|
* `propJsonMaxLength` serializes to `null` (set it by property instead). String value limits count
|
|
16
|
-
* code points, like Zod and JSON Schema
|
|
16
|
+
* code points, like Zod and JSON Schema; raw text bounds count UTF-16 units.
|
|
17
17
|
*
|
|
18
|
-
* Why there is no `json` nor `slot` type
|
|
18
|
+
* Why there is no `json` nor `slot` type: a top-level JSON value is
|
|
19
19
|
* either a scalar (covered by the scalar types) or a container, and `array`/`object` are the JSON
|
|
20
20
|
* types with a declared item or field schema; a free `json` would be the same thing without a
|
|
21
21
|
* schema. Slot content is DOM, not a value: it stays in the light DOM and is projected by a native
|
|
@@ -60,7 +60,7 @@ const jsonDepth = MANIFEST_LIMITS.valueSchemaDepth;
|
|
|
60
60
|
/**
|
|
61
61
|
* Turns every `-0` into `0`, in place, at any depth: `String(-0)` and `JSON.stringify(-0)` both
|
|
62
62
|
* give `"0"`, so only `0` survives the attribute, and a property must give the component the same
|
|
63
|
-
* value
|
|
63
|
+
* value. Only ever called on a value `checkValue` has just built (fresh containers with
|
|
64
64
|
* declared fields only, at most `valueSchemaDepth` levels), so mutating it touches nobody's data.
|
|
65
65
|
*/
|
|
66
66
|
function positiveZero(value) {
|
|
@@ -83,16 +83,16 @@ function serializeJson(value) {
|
|
|
83
83
|
return text.length > MANIFEST_LIMITS.propJsonMaxLength ? null : text;
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
* The catalog. Data plus pure functions, frozen in depth (
|
|
86
|
+
* The catalog. Data plus pure functions, frozen in depth (a page script cannot swap an
|
|
87
87
|
* entry's `accept`); iterate it (`Object.values`) to cover every type, so a new type is picked up
|
|
88
|
-
* by every consumer's tests
|
|
88
|
+
* by every consumer's tests.
|
|
89
89
|
*/
|
|
90
90
|
export const propTypeCatalog = deepFreeze({
|
|
91
91
|
string: {
|
|
92
92
|
type: "string",
|
|
93
93
|
attribute: "text",
|
|
94
94
|
reflect: true,
|
|
95
|
-
// In UTF-16 units of the raw text; the limit itself is in code points
|
|
95
|
+
// In UTF-16 units of the raw text; the limit itself is in code points, at most two
|
|
96
96
|
// units each, and `checkValue` applies it exactly.
|
|
97
97
|
maxAttributeLength: (prop) => 2 * (prop.maxLength ?? MANIFEST_LIMITS.stringMaxLength),
|
|
98
98
|
parse: (text, prop) => checkValue(prop, text),
|
|
@@ -125,7 +125,7 @@ export const propTypeCatalog = deepFreeze({
|
|
|
125
125
|
type: "enum",
|
|
126
126
|
attribute: "text",
|
|
127
127
|
reflect: true,
|
|
128
|
-
// Every declared value has at most `enumValueMaxLength` code points
|
|
128
|
+
// Every declared value has at most `enumValueMaxLength` code points, so at most
|
|
129
129
|
// twice as many UTF-16 units: a cheap bound before the exact membership check.
|
|
130
130
|
maxAttributeLength: () => ENUM_ATTRIBUTE_MAX_LENGTH,
|
|
131
131
|
parse: (text, prop) => within(textLength(text, ENUM_ATTRIBUTE_MAX_LENGTH), (bounded) => checkValue(prop, bounded)),
|
|
@@ -211,8 +211,8 @@ function entryOf(prop) {
|
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* The value of a prop when nothing valid was given: the declared `default` as the entry's `accept`
|
|
214
|
-
* returns it (a fresh copy, every `-0` as `0
|
|
215
|
-
* (the same as an absent attribute, by property too
|
|
214
|
+
* returns it (a fresh copy, every `-0` as `0`), and `false` for a `boolean` without one
|
|
215
|
+
* (the same as an absent attribute, by property too). Going through `accept` gives the
|
|
216
216
|
* component the same value whether `0` came from the attribute, a property or the default, and never
|
|
217
217
|
* hands out (or mutates) the manifest's own object. A default `accept` refuses or throws on (only
|
|
218
218
|
* possible in a definition the manifest schema never saw) is returned as declared, as before.
|
|
@@ -233,10 +233,10 @@ function defaultOf(prop, entry) {
|
|
|
233
233
|
function fallback(prop, entry, problem) {
|
|
234
234
|
return { value: defaultOf(prop, entry), problem };
|
|
235
235
|
}
|
|
236
|
-
/** An undeclared type counts as absent: no value, not even its `default
|
|
236
|
+
/** An undeclared type counts as absent: no value, not even its `default`. */
|
|
237
237
|
const UNKNOWN_TYPE = Object.freeze({ value: undefined, problem: "not-allowed" });
|
|
238
238
|
/**
|
|
239
|
-
* Attribute → prop value, as the runtime's `attributeChangedCallback` needs it
|
|
239
|
+
* Attribute → prop value, as the runtime's `attributeChangedCallback` needs it.
|
|
240
240
|
*
|
|
241
241
|
* Inputs: a declaration accepted by `propDeclarationSchema`, and the attribute text or `null` when
|
|
242
242
|
* the attribute is absent. Output: `{ value }` (absent: `false` for `boolean`, otherwise the
|
|
@@ -262,7 +262,7 @@ export function attributeToValue(prop, text) {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
265
|
-
* Property (or `<script type="application/json" data-props>` entry) → prop value
|
|
265
|
+
* Property (or `<script type="application/json" data-props>` entry) → prop value.
|
|
266
266
|
*
|
|
267
267
|
* Inputs: a declaration and any JS value. Output: `{ value }` with a fresh accepted value,
|
|
268
268
|
* `{ value: default }` for `undefined` or `null` (the property was cleared), or
|
package/dist/prop-types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop-types.js","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,OAAO,GAGR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAqDvD;;;GAGG;AACH,MAAM,mBAAmB,GAAG,8CAA8C,CAAC;AAE3E,kGAAkG;AAClG,MAAM,yBAAyB,GAAG,CAAC,GAAG,eAAe,CAAC,kBAAkB,CAAC;AAEzE;;;GAGG;AACH,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,GAAW,EAAwB,EAAE,CACrE,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAE3D,SAAS,MAAM,CAAI,OAA6B,EAAE,IAAuC;IACvF,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAA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AAO,YAAY,CAAC;IAC7C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;IACpF,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC1C,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACxF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAqB,EAAE,KAAc;IACpE,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC;AACvD,CAAC"}
|
package/dist/props.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Prop declarations of component contract v1
|
|
2
|
+
* Prop declarations of component contract v1.
|
|
3
3
|
*
|
|
4
4
|
* A prop is declared by its `type` and plain options; how an HTML attribute becomes a prop value is
|
|
5
|
-
* fully determined by that type (golden rule 5
|
|
6
|
-
* attribute. The per-type parse table is `propTypeCatalog` (prop-types.ts
|
|
5
|
+
* fully determined by that type (golden rule 5): the runtime never evaluates the
|
|
6
|
+
* attribute. The per-type parse table is `propTypeCatalog` (prop-types.ts); this module
|
|
7
7
|
* fixes the shape of each declaration and checks that a declared `default` fits it.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* The defaults of `array` and `object` props have a structural shape (JSON scalars,
|
|
10
10
|
* arrays and records keyed by field names, as deep as a value schema), so the JSON Schema refuses
|
|
11
11
|
* an own `__proto__` key in a default as `parseManifest` does, instead of accepting any JSON.
|
|
12
12
|
*/
|
|
@@ -500,7 +500,7 @@ export type PropType = PropDeclaration["type"];
|
|
|
500
500
|
* or an already parsed attribute must satisfy.
|
|
501
501
|
*
|
|
502
502
|
* Inputs: a prop declaration. Output: a Zod schema with the same rules as the Zod-free
|
|
503
|
-
* `propTypeCatalog[type].accept` (
|
|
503
|
+
* `propTypeCatalog[type].accept` (a test keeps them in agreement): `color` gets the CSS
|
|
504
504
|
* value allowlist (the runtime may narrow it further with `CSS.supports`), `url` the scheme
|
|
505
505
|
* allowlist, the printable-ASCII rule and the WHATWG URL parser (`isAllowedUrl`). Errors: none at
|
|
506
506
|
* build time. Side effects: none.
|
package/dist/props.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Prop declarations of component contract v1
|
|
2
|
+
* Prop declarations of component contract v1.
|
|
3
3
|
*
|
|
4
4
|
* A prop is declared by its `type` and plain options; how an HTML attribute becomes a prop value is
|
|
5
|
-
* fully determined by that type (golden rule 5
|
|
6
|
-
* attribute. The per-type parse table is `propTypeCatalog` (prop-types.ts
|
|
5
|
+
* fully determined by that type (golden rule 5): the runtime never evaluates the
|
|
6
|
+
* attribute. The per-type parse table is `propTypeCatalog` (prop-types.ts); this module
|
|
7
7
|
* fixes the shape of each declaration and checks that a declared `default` fits it.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* The defaults of `array` and `object` props have a structural shape (JSON scalars,
|
|
10
10
|
* arrays and records keyed by field names, as deep as a value schema), so the JSON Schema refuses
|
|
11
11
|
* an own `__proto__` key in a default as `parseManifest` does, instead of accepting any JSON.
|
|
12
12
|
*/
|
|
@@ -51,7 +51,7 @@ const urlPropSchema = z.strictObject({
|
|
|
51
51
|
.optional()
|
|
52
52
|
.meta({ description: 'Accepted URL schemes; defaults to ["https"].' }),
|
|
53
53
|
// Structural rule, also in the JSON Schema: whatever `protocols` says, a default starts with
|
|
54
|
-
// https://, http:// or mailto
|
|
54
|
+
// https://, http:// or mailto:. The declared schemes are checked by
|
|
55
55
|
// the default check below (Zod only, `SEMANTIC_RULES`).
|
|
56
56
|
default: z
|
|
57
57
|
.string()
|
|
@@ -113,7 +113,7 @@ const propVariantsSchema = z.discriminatedUnion("type", [
|
|
|
113
113
|
* or an already parsed attribute must satisfy.
|
|
114
114
|
*
|
|
115
115
|
* Inputs: a prop declaration. Output: a Zod schema with the same rules as the Zod-free
|
|
116
|
-
* `propTypeCatalog[type].accept` (
|
|
116
|
+
* `propTypeCatalog[type].accept` (a test keeps them in agreement): `color` gets the CSS
|
|
117
117
|
* value allowlist (the runtime may narrow it further with `CSS.supports`), `url` the scheme
|
|
118
118
|
* allowlist, the printable-ASCII rule and the WHATWG URL parser (`isAllowedUrl`). Errors: none at
|
|
119
119
|
* build time. Side effects: none.
|
package/dist/props.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,aAAa,EACb,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB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C;IAChE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,eAAe,CAAC;QAClE,OAAO,CAAC,QAAQ,CAAC;YACf,yEAAyE;YACzE,gGAAgG;YAChG,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,SAAS,CAAC;YACjB,OAAO,EAAE,gDAAgD,MAAM,EAAE;SAClE,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC;KACD,IAAI,CAAC,EAAE,EAAE,EAAE,iBAAiB,EAAE,CAAC,CAAC"}
|
package/dist/proto-guard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Refusal of own `__proto__` keys in decoded JSON (
|
|
2
|
+
* Refusal of own `__proto__` keys in decoded JSON (moved here and hardened).
|
|
3
3
|
*
|
|
4
4
|
* `JSON.parse` turns `"__proto__"` into a plain own key. Zod's records skip such a key in silence
|
|
5
5
|
* while the JSON Schema refuses it, so the two validators would disagree; worse, code that copies
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `findOwnProtoKey` before parsing and refuse the whole input, so every validator agrees.
|
|
8
8
|
*
|
|
9
9
|
* The path of a finding names keys of untrusted input and ends up in logs and in the portal, so
|
|
10
|
-
* it is bounded by `boundedPath` (
|
|
10
|
+
* it is bounded by `boundedPath` (`bounded-path.ts`).
|
|
11
11
|
*
|
|
12
12
|
* Zod-free (the runtime and `migrateManifest` use it too). Pure.
|
|
13
13
|
*/
|
|
@@ -51,7 +51,7 @@ export function findOwnProtoKey(input) {
|
|
|
51
51
|
}
|
|
52
52
|
const budget = PROTO_SCAN_MAX_NODES - visited - 1 - pending.length;
|
|
53
53
|
// Checked before listing the entries: a sparse array of length 2**32 - 1 has none, yet
|
|
54
|
-
// JSON.stringify would walk every index
|
|
54
|
+
// JSON.stringify would walk every index.
|
|
55
55
|
if (Array.isArray(value) && value.length > budget)
|
|
56
56
|
return tooLarge();
|
|
57
57
|
const entries = Object.entries(value);
|
package/dist/proto-guard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proto-guard.js","sourceRoot":"","sources":["../src/proto-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAE3F;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC,aAAa,CAAC;AAalE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,6FAA6F;IAC7F,0DAA0D;IAC1D,MAAM,OAAO,GAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC/E,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;QACvD,sFAAsF;QACtF,IAAI,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,oBAAoB;YAAE,OAAO,QAAQ,EAAE,CAAC;QACvE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAW,CAAC;QACrC,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;QACxB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QAC1D,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC;YACtC,OAAO;gBACL,MAAM,EAAE,WAAW;gBACnB,IAAI,EAAE,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,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runtime-errors.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The runtime error telemetry layout (
|
|
2
|
+
* The runtime error telemetry layout (the kinds of failure the
|
|
3
3
|
* browser reports, the bounds on what it reports, and the extra columns of an `error` point of the
|
|
4
4
|
* `component_events` dataset (the first eight columns are the ones of `metering.ts`).
|
|
5
5
|
*
|
|
@@ -21,7 +21,7 @@ export declare const RUNTIME_ERROR_MESSAGE_MAX = 200;
|
|
|
21
21
|
export declare const RUNTIME_ERROR_MAX_FRAMES = 5;
|
|
22
22
|
/**
|
|
23
23
|
* Most reports one component sends per page load: a technical protection against an error loop,
|
|
24
|
-
* not a plan limit
|
|
24
|
+
* not a plan limit.
|
|
25
25
|
*/
|
|
26
26
|
export declare const RUNTIME_ERRORS_PER_COMPONENT_PER_PAGE = 5;
|
|
27
27
|
/**
|