@taggor/contract 0.4.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 +13 -12
- package/dist/contract-version.d.ts.map +1 -1
- package/dist/contract-version.js +13 -12
- 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 +67 -7
- package/dist/error-catalog.d.ts.map +1 -1
- package/dist/error-catalog.js +105 -49
- 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 +3 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/json-schema.d.ts +15 -15
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/json-schema.js +22 -22
- 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 +21 -22
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +31 -32
- 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 +16 -16
- 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 +17 -17
- package/dist/source-package.d.ts.map +1 -1
- package/dist/source-package.js +15 -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 +1 -1
- package/dist/ssr-kv.js +1 -1
- 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 +20 -20
- package/dist/value-check.js.map +1 -1
- package/dist/value-patterns.js +2 -2
- package/dist/value-schema.d.ts +3 -3
- package/dist/value-schema.d.ts.map +1 -1
- package/dist/value-schema.js +4 -4
- package/dist/value-schema.js.map +1 -1
- package/dist/zod-free.d.ts +24 -23
- package/dist/zod-free.d.ts.map +1 -1
- package/dist/zod-free.js +25 -24
- 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-pricing.d.ts
CHANGED
|
@@ -41,25 +41,25 @@ export interface OverageRate {
|
|
|
41
41
|
readonly microUsdPerUnit: Readonly<Record<PaidPlanId, number>>;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* THE SEED of the rate table
|
|
44
|
+
* THE SEED of the rate table: the tariffs live in the database
|
|
45
45
|
* (`overage_rates`, versions with an effective date, edited by staff with a reason) and this table
|
|
46
46
|
* is only what migration 0081 inserted as version 1 and what every reader falls back to when the
|
|
47
47
|
* database cannot be read. A test compares it with the migration; nothing else reads it for a price.
|
|
48
48
|
*
|
|
49
|
-
* The tariffs
|
|
49
|
+
* The tariffs (provisional), in micro USD per unit:
|
|
50
50
|
* renders US$ 0,02 per 1.000; SSR renders US$ 0,015 per 1.000; SSR version-day US$ 0,01 (no
|
|
51
51
|
* included amount in v1); build over the weekly limit US$ 0,01; stored submission US$ 0,25 per
|
|
52
|
-
* 1.000; storage US$ 1,00 per GB-month (1000 per MB,
|
|
52
|
+
* 1.000; storage US$ 1,00 per GB-month (1000 per MB, on the average of the cycle's daily readings); extra site US$ 1 (Pro) and US$ 2 (Agency, the existing
|
|
53
53
|
* add-on price, billed on the plan subscription, so its overage rate is informational).
|
|
54
54
|
*/
|
|
55
55
|
export declare const OVERAGE_RATES: Readonly<Record<OverageMetric, OverageRate>>;
|
|
56
56
|
/** The metrics in a fixed order (ledger and Stripe meters follow it). */
|
|
57
57
|
export declare const OVERAGE_METRIC_LIST: readonly OverageMetric[];
|
|
58
58
|
/**
|
|
59
|
-
* The rules around the money of an overage
|
|
59
|
+
* The rules around the money of an overage, numbers only:
|
|
60
60
|
* - `minInvoiceUsdCents`: below it the amount carries to the next month.
|
|
61
61
|
* - `lagHours`: the ledger bills what was counted at least this long ago, never the live count.
|
|
62
|
-
* - NO default spending limit
|
|
62
|
+
* - NO default spending limit: the customer pays what they use. A
|
|
63
63
|
* spending LIMIT is OPTIONAL, set by the customer or by staff, between `spendCapMinUsdCents` and
|
|
64
64
|
* `spendCapMaxUsdCents` (staff: `staffSpendCapMaxUsdCents`). It is a trigger, not a ceiling on the
|
|
65
65
|
* bill: Taggor TRIES to stop the use when the overage reaches it, WITHOUT guarantee, and what was
|
|
@@ -68,8 +68,7 @@ export declare const OVERAGE_METRIC_LIST: readonly OverageMetric[];
|
|
|
68
68
|
* e-mail per milestone per cycle. `spendMilestonePercents` are the named steps of the DEFAULT list
|
|
69
69
|
* (percent of the plan's monthly price: 50%, 100%, 200%, 500%); from there it keeps going, doubling
|
|
70
70
|
* from `spendMilestoneDoublingFrom` (1000%, 2000%, 4000%...) up to `maxSpendMilestones` milestones
|
|
71
|
-
* in all (`defaultSpendMilestonePercents`), so a runaway use keeps warning past 500
|
|
72
|
-
* review M4). The customer may set their own list of up to `maxSpendMilestones` amounts, each at
|
|
71
|
+
* in all (`defaultSpendMilestonePercents`), so a runaway use keeps warning past 500%. The customer may set their own list of up to `maxSpendMilestones` amounts, each at
|
|
73
72
|
* most `spendMilestoneMaxUsdCents`.
|
|
74
73
|
* - `dunningDays`: how long an unpaid overage invoice is chased before new overage is suspended.
|
|
75
74
|
* - `freeCutMultiple`: Free is cut at this multiple of its number (1x, no grace).
|
|
@@ -101,10 +100,9 @@ export declare function defaultSpendMilestonePercents(): readonly number[];
|
|
|
101
100
|
*/
|
|
102
101
|
export declare function overageMicroUsdPerUnit(metric: OverageMetric, planId: PlanId): number | null;
|
|
103
102
|
/**
|
|
104
|
-
* Which of the forgeable metrics are billed (
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* decided that a customer pays what was used, so the three metrics are billed; the guard (a spike
|
|
103
|
+
* Which of the forgeable metrics are billed (all three are on). A render and a stored submission can be forged by
|
|
104
|
+
* anyone with the public site key, so they were kept off the bill until a guard existed. The rule
|
|
105
|
+
* is that a customer pays what was used, so the three metrics are billed; the guard (a surge
|
|
108
106
|
* flag per site, `usage-guard.ts`) no longer holds anything back, it only keeps the Free plan from
|
|
109
107
|
* being cut by forged traffic and warns the customer of an unusual day, and the safety net for a wrong
|
|
110
108
|
* bill is the credit on request (runbook). The switch stays in ONE place: the billing code of the API
|
|
@@ -119,7 +117,7 @@ export interface OverageBillingGates {
|
|
|
119
117
|
/** The submissions metric and the storage that follows it. */
|
|
120
118
|
readonly submissions: boolean;
|
|
121
119
|
}
|
|
122
|
-
/** The gates as the code ships them: both on
|
|
120
|
+
/** The gates as the code ships them: both on; frozen, the literal types are `true`. */
|
|
123
121
|
export declare const OVERAGE_BILLING_GATES: Readonly<{
|
|
124
122
|
readonly loaderHits: true;
|
|
125
123
|
readonly submissions: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-pricing.d.ts","sourceRoot":"","sources":["../src/plan-pricing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plan-pricing.d.ts","sourceRoot":"","sources":["../src/plan-pricing.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAkC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExF,iFAAiF;AACjF,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,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;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;EAaxB,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,SAAS,MAAM,EAAE,CAUjE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI3F;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,uFAAuF;AACvF,eAAO,MAAM,qBAAqB;;;EAGvB,CAAC;AAEZ;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,aAAa,EACrB,KAAK,GAAE,mBAA2C,GACjD,OAAO,CAIT;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,mBAA2C,GACjD,OAAO,CAGT;AAED,gGAAgG;AAChG,eAAO,MAAM,sBAAsB,EAAE,SAAS,aAAa,EAE1D,CAAC"}
|
package/dist/plan-pricing.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What each plan COSTS, the Agency site extension and the overage rates and rules
|
|
3
|
-
* decisions 68 and 71; TAG-1628, decision 84, replaced the cut rule of decisions 69 and 71). Zod-free, frozen, same style as `plan-usage.ts` and `plan-limits.ts`.
|
|
2
|
+
* What each plan COSTS, the Agency site extension and the overage rates and rules. Zod-free, frozen, same style as `plan-usage.ts` and `plan-limits.ts`.
|
|
4
3
|
*
|
|
5
4
|
* Why it lives in the contract: the billing catalog (`apps/api/src/domain/billing/plans.ts`) and the
|
|
6
5
|
* public site both need these numbers, and a number written twice drifts. The billing catalog
|
|
7
6
|
* composes its rows from here; the site reads them through its figures registry, so no plan price
|
|
8
7
|
* is typed by hand in site copy.
|
|
9
8
|
*
|
|
10
|
-
* ALL NUMBERS ARE PROVISIONAL until the
|
|
11
|
-
*
|
|
9
|
+
* ALL NUMBERS ARE PROVISIONAL until the plans and prices are final.
|
|
10
|
+
* Money is US dollar cents.
|
|
12
11
|
* Nothing here charges or cuts; it is a table.
|
|
13
12
|
*
|
|
14
|
-
*
|
|
13
|
+
* The overage rate table below (`OVERAGE_RATES`) is the ONE place
|
|
15
14
|
* the price of a unit above the plan is written; the site, the portal, the API and the Stripe
|
|
16
|
-
* prices read it. Rates are
|
|
15
|
+
* prices read it. Rates are provisional until the prices are final.
|
|
17
16
|
*/
|
|
18
17
|
import { planQuotas } from "./plan-limits.js";
|
|
19
18
|
import { LIMIT_CATALOG, OVERAGE_METRICS } from "./limit-catalog.js";
|
|
@@ -40,15 +39,15 @@ export const planPricing = Object.freeze({
|
|
|
40
39
|
});
|
|
41
40
|
const bothPaid = (value) => Object.freeze({ pro: value, agency: value });
|
|
42
41
|
/**
|
|
43
|
-
* THE SEED of the rate table
|
|
42
|
+
* THE SEED of the rate table: the tariffs live in the database
|
|
44
43
|
* (`overage_rates`, versions with an effective date, edited by staff with a reason) and this table
|
|
45
44
|
* is only what migration 0081 inserted as version 1 and what every reader falls back to when the
|
|
46
45
|
* database cannot be read. A test compares it with the migration; nothing else reads it for a price.
|
|
47
46
|
*
|
|
48
|
-
* The tariffs
|
|
47
|
+
* The tariffs (provisional), in micro USD per unit:
|
|
49
48
|
* renders US$ 0,02 per 1.000; SSR renders US$ 0,015 per 1.000; SSR version-day US$ 0,01 (no
|
|
50
49
|
* included amount in v1); build over the weekly limit US$ 0,01; stored submission US$ 0,25 per
|
|
51
|
-
* 1.000; storage US$ 1,00 per GB-month (1000 per MB,
|
|
50
|
+
* 1.000; storage US$ 1,00 per GB-month (1000 per MB, on the average of the cycle's daily readings); extra site US$ 1 (Pro) and US$ 2 (Agency, the existing
|
|
52
51
|
* add-on price, billed on the plan subscription, so its overage rate is informational).
|
|
53
52
|
*/
|
|
54
53
|
export const OVERAGE_RATES = Object.freeze({
|
|
@@ -83,10 +82,10 @@ export const OVERAGE_RATES = Object.freeze({
|
|
|
83
82
|
/** The metrics in a fixed order (ledger and Stripe meters follow it). */
|
|
84
83
|
export const OVERAGE_METRIC_LIST = OVERAGE_METRICS;
|
|
85
84
|
/**
|
|
86
|
-
* The rules around the money of an overage
|
|
85
|
+
* The rules around the money of an overage, numbers only:
|
|
87
86
|
* - `minInvoiceUsdCents`: below it the amount carries to the next month.
|
|
88
87
|
* - `lagHours`: the ledger bills what was counted at least this long ago, never the live count.
|
|
89
|
-
* - NO default spending limit
|
|
88
|
+
* - NO default spending limit: the customer pays what they use. A
|
|
90
89
|
* spending LIMIT is OPTIONAL, set by the customer or by staff, between `spendCapMinUsdCents` and
|
|
91
90
|
* `spendCapMaxUsdCents` (staff: `staffSpendCapMaxUsdCents`). It is a trigger, not a ceiling on the
|
|
92
91
|
* bill: Taggor TRIES to stop the use when the overage reaches it, WITHOUT guarantee, and what was
|
|
@@ -95,8 +94,7 @@ export const OVERAGE_METRIC_LIST = OVERAGE_METRICS;
|
|
|
95
94
|
* e-mail per milestone per cycle. `spendMilestonePercents` are the named steps of the DEFAULT list
|
|
96
95
|
* (percent of the plan's monthly price: 50%, 100%, 200%, 500%); from there it keeps going, doubling
|
|
97
96
|
* from `spendMilestoneDoublingFrom` (1000%, 2000%, 4000%...) up to `maxSpendMilestones` milestones
|
|
98
|
-
* in all (`defaultSpendMilestonePercents`), so a runaway use keeps warning past 500
|
|
99
|
-
* review M4). The customer may set their own list of up to `maxSpendMilestones` amounts, each at
|
|
97
|
+
* in all (`defaultSpendMilestonePercents`), so a runaway use keeps warning past 500%. The customer may set their own list of up to `maxSpendMilestones` amounts, each at
|
|
100
98
|
* most `spendMilestoneMaxUsdCents`.
|
|
101
99
|
* - `dunningDays`: how long an unpaid overage invoice is chased before new overage is suspended.
|
|
102
100
|
* - `freeCutMultiple`: Free is cut at this multiple of its number (1x, no grace).
|
|
@@ -137,7 +135,7 @@ export function overageMicroUsdPerUnit(metric, planId) {
|
|
|
137
135
|
const rates = OVERAGE_RATES[metric].microUsdPerUnit;
|
|
138
136
|
return rates[planId] ?? null;
|
|
139
137
|
}
|
|
140
|
-
/** The gates as the code ships them: both on
|
|
138
|
+
/** The gates as the code ships them: both on; frozen, the literal types are `true`. */
|
|
141
139
|
export const OVERAGE_BILLING_GATES = Object.freeze({
|
|
142
140
|
loaderHits: true,
|
|
143
141
|
submissions: true,
|
package/dist/plan-pricing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-pricing.js","sourceRoot":"","sources":["../src/plan-pricing.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"plan-pricing.js","sourceRoot":"","sources":["../src/plan-pricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAsB,MAAM,oBAAoB,CAAC;AA2BxF,MAAM,KAAK,GAAG,CAAC,OAAe,EAAE,MAAc,EAAa,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AAEjG,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE;IACzD,GAAG,EAAE,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE;IAChE,MAAM,EAAE;QACN,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC;QAClC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC;YAC3B,aAAa,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ;YACzC,Q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,KAAK,CAAC,CAAC;AACnF,CAAC;AAED,gGAAgG;AAChG,MAAM,CAAC,MAAM,sBAAsB,GAA6B,MAAM,CAAC,MAAM,CAC3E,eAAe,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAClE,CAAC"}
|
package/dist/plan-usage.d.ts
CHANGED
|
@@ -3,25 +3,25 @@ import { type PlanId } from "./plan-limits.js";
|
|
|
3
3
|
export interface PlanUsage {
|
|
4
4
|
/** Loader deliveries that count toward the plan (`countsTowardUsage`), the proxy of renders. */
|
|
5
5
|
readonly rendersPerMonth: number;
|
|
6
|
-
/** Server renders of `GET /r/` (cache misses the edge rendered) in the month
|
|
6
|
+
/** Server renders of `GET /r/` (cache misses the edge rendered) in the month. */
|
|
7
7
|
readonly ssrRendersPerMonth: number;
|
|
8
8
|
/** Submissions accepted (not spam, not from a staging site). */
|
|
9
9
|
readonly submissionsPerMonth: number;
|
|
10
10
|
/** Bytes the submissions of the workspace hold (the JSON of `data`). */
|
|
11
11
|
readonly storageBytes: number;
|
|
12
12
|
/**
|
|
13
|
-
* The most days a submission lives (
|
|
14
|
-
* may choose fewer days, never more
|
|
13
|
+
* The most days a submission lives (12, 24 and 36 months). A collection
|
|
14
|
+
* may choose fewer days, never more.
|
|
15
15
|
*/
|
|
16
16
|
readonly retentionDays: number;
|
|
17
17
|
}
|
|
18
18
|
/** The usage allowance of every plan, by plan id. Frozen. */
|
|
19
19
|
export declare const planUsage: Readonly<Record<PlanId, PlanUsage>>;
|
|
20
|
-
/** The percentages of an allowance at which a customer is warned (
|
|
20
|
+
/** The percentages of an allowance at which a customer is warned (80% and 100%). */
|
|
21
21
|
export declare const USAGE_WARNING_PERCENTS: readonly [80, 100];
|
|
22
22
|
/**
|
|
23
23
|
* Where a count stands against its allowance. `ok` below 80%, `warning` from 80%, `reached` from
|
|
24
|
-
* 100%. Nothing acts on it in this ticket;
|
|
24
|
+
* 100%. Nothing acts on it in this ticket; adds grace and the rest.
|
|
25
25
|
*/
|
|
26
26
|
export declare const USAGE_LEVELS: readonly ["ok", "warning", "reached"];
|
|
27
27
|
export type UsageLevel = (typeof USAGE_LEVELS)[number];
|
|
@@ -38,17 +38,17 @@ export declare function usagePercent(used: number, limit: number): number;
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function usageLevel(used: number, limit: number): UsageLevel;
|
|
40
40
|
/**
|
|
41
|
-
* The rule that marks a site's render count as suspect
|
|
41
|
+
* The rule that marks a site's render count as suspect: the key of a
|
|
42
42
|
* site and its allowed domains are public, so anyone can forge loader hits with a `Referer` and a
|
|
43
43
|
* `User-Agent`. A day with more than `multiplier` times the mean of the `baselineDays` days before
|
|
44
|
-
* it, and at least `minViews`, is a
|
|
44
|
+
* it, and at least `minViews`, is a surge. Provisional.
|
|
45
45
|
*
|
|
46
46
|
* What it does NOT catch: a slow ramp (each day under `multiplier` times the days before it) and
|
|
47
47
|
* steady traffic below `minViews` a day. `minViews` here is only the ceiling of the floor; the
|
|
48
48
|
* plan's own floor is `spikeMinViews`, so steady forging is bounded by the plan (at most about
|
|
49
49
|
* `rendersPerMonth` in a month) instead of by a fixed 1,000 a day. The guard is a brake on sudden
|
|
50
|
-
*
|
|
51
|
-
* having looked
|
|
50
|
+
* surges, not proof of authenticity: nothing may cut a component for renders without a person
|
|
51
|
+
* having looked.
|
|
52
52
|
*/
|
|
53
53
|
export declare const VIEW_SPIKE_RULE: Readonly<{
|
|
54
54
|
multiplier: 10;
|
|
@@ -56,22 +56,22 @@ export declare const VIEW_SPIKE_RULE: Readonly<{
|
|
|
56
56
|
/** The most a day's floor is, whatever the plan; see `spikeMinViews`. */
|
|
57
57
|
minViews: 1000;
|
|
58
58
|
}>;
|
|
59
|
-
/** A
|
|
59
|
+
/** A surge rule with its own floor. */
|
|
60
60
|
export interface ViewSpikeRule {
|
|
61
61
|
readonly multiplier: number;
|
|
62
62
|
readonly baselineDays: number;
|
|
63
63
|
readonly minViews: number;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
|
-
* 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.
|
|
67
67
|
* Inputs: the plan's renders per month. Output: the lower of `VIEW_SPIKE_RULE.minViews` and a
|
|
68
68
|
* thirtieth of the month (at least 1), so quietly forging the plan's whole month in 30 equal days
|
|
69
|
-
* is a
|
|
69
|
+
* is a surge on the first day that passes the floor rather than going unseen. Errors: none. No
|
|
70
70
|
* side effects.
|
|
71
71
|
*/
|
|
72
72
|
export declare function spikeMinViews(rendersPerMonth: number): number;
|
|
73
73
|
/**
|
|
74
|
-
* The
|
|
74
|
+
* The surge rule of a plan. Inputs: a plan id (unknown: the default plan). Output: the rule with
|
|
75
75
|
* the plan's floor. Errors: none. No side effects.
|
|
76
76
|
*/
|
|
77
77
|
export declare function spikeRuleOf(planId: string | undefined): ViewSpikeRule;
|
|
@@ -89,19 +89,19 @@ export interface ViewSpike {
|
|
|
89
89
|
readonly baselineMean: number;
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
* Every day of a series that is a
|
|
92
|
+
* Every day of a series that is a surge, earliest first.
|
|
93
93
|
* Inputs: the counted views per UTC day (any order; a missing day is zero), the current time, the
|
|
94
94
|
* rule and the first day to examine (default: yesterday, so today, still partial, and yesterday are
|
|
95
|
-
* looked at). Output: the
|
|
96
|
-
* the `baselineDays` days before it (possibly none). All of them, not the first: a
|
|
95
|
+
* looked at). Output: the surges among the days from `from` to today, each day against the mean of
|
|
96
|
+
* the `baselineDays` days before it (possibly none). All of them, not the first: a surge a person
|
|
97
97
|
* already judged `legit` must not hide a later one. A caller that measures a workspace only
|
|
98
|
-
* every few hours passes the first day of the month, so a
|
|
98
|
+
* every few hours passes the first day of the month, so a surge that happened between two visits
|
|
99
99
|
* is still found. Days before the series count as zero: give it `baselineDays` days before `from`.
|
|
100
100
|
* Errors: none. No side effects.
|
|
101
101
|
*/
|
|
102
102
|
export declare function detectViewSpikes(series: readonly DailyViews[], now: Date, rule?: ViewSpikeRule, from?: Date): ViewSpike[];
|
|
103
103
|
/**
|
|
104
|
-
* The first
|
|
104
|
+
* The first surge of `detectViewSpikes`, or `null`. Same inputs. Errors: none. No side effects.
|
|
105
105
|
*/
|
|
106
106
|
export declare function detectViewSpike(series: readonly DailyViews[], now: Date, rule?: ViewSpikeRule, from?: Date): ViewSpike | null;
|
|
107
107
|
/**
|
package/dist/plan-usage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-usage.d.ts","sourceRoot":"","sources":["../src/plan-usage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plan-usage.d.ts","sourceRoot":"","sources":["../src/plan-usage.ts"],"names":[],"mappings":"AAWA,OAAO,EAAuC,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEpF,+FAA+F;AAC/F,MAAM,WAAW,SAAS;IACxB,gGAAgG;IAChG,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,iFAAiF;IACjF,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,gEAAgE;IAChE,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,wEAAwE;IACxE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAKD,6DAA6D;AAC7D,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAKzD,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,sBAAsB,oBAAoC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,YAAY,uCAAwC,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KA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V,SAAS,GAAG,IAAI,CAElB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAEjE"}
|
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;AACpF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,GAAG,CAAU,CAAC,CAAC;AAExE;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAGlE;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,KAAa;IACtD,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,KA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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;IACnB,uBAAuB;IACvB,kBAAkB;IAClB,sBAAsB;IACtB,gBAAgB;IAChB,wBAAwB;IACxB,sBAAsB;IACtB,mBAAmB;IACnB,0BAA0B;IAC1B,oBAAoB;CACZ,CAAC,CAAC;AAEZ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,OAAO;IACP,MAAM;IACN,mBAAmB;IACnB,UAAU;CACF,CAAC,CAAC;AAEZ,
|
|
1
|
+
{"version":3,"file":"prop-names.js","sourceRoot":"","sources":["../src/prop-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,mBAAmB,EAAE,2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C,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
|