@taggor/contract 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +61 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/artifact-keys.d.ts +169 -0
- package/dist/artifact-keys.d.ts.map +1 -0
- package/dist/artifact-keys.js +195 -0
- package/dist/artifact-keys.js.map +1 -0
- package/dist/assets.d.ts +72 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +94 -0
- package/dist/assets.js.map +1 -0
- package/dist/bounded-path.d.ts +29 -0
- package/dist/bounded-path.d.ts.map +1 -0
- package/dist/bounded-path.js +57 -0
- package/dist/bounded-path.js.map +1 -0
- package/dist/bounded.d.ts +47 -0
- package/dist/bounded.d.ts.map +1 -0
- package/dist/bounded.js +93 -0
- package/dist/bounded.js.map +1 -0
- package/dist/build-diagnostic.d.ts +89 -0
- package/dist/build-diagnostic.d.ts.map +1 -0
- package/dist/build-diagnostic.js +91 -0
- package/dist/build-diagnostic.js.map +1 -0
- package/dist/component-types.d.ts +61 -0
- package/dist/component-types.d.ts.map +1 -0
- package/dist/component-types.js +277 -0
- package/dist/component-types.js.map +1 -0
- package/dist/consent-text.d.ts +31 -0
- package/dist/consent-text.d.ts.map +1 -0
- package/dist/consent-text.js +41 -0
- package/dist/consent-text.js.map +1 -0
- package/dist/contract-version.d.ts +150 -0
- package/dist/contract-version.d.ts.map +1 -0
- package/dist/contract-version.js +198 -0
- package/dist/contract-version.js.map +1 -0
- package/dist/credential-fields.d.ts +31 -0
- package/dist/credential-fields.d.ts.map +1 -0
- package/dist/credential-fields.js +36 -0
- package/dist/credential-fields.js.map +1 -0
- package/dist/css-tokens.d.ts +46 -0
- package/dist/css-tokens.d.ts.map +1 -0
- package/dist/css-tokens.js +189 -0
- package/dist/css-tokens.js.map +1 -0
- package/dist/css-value.d.ts +42 -0
- package/dist/css-value.d.ts.map +1 -0
- package/dist/css-value.js +78 -0
- package/dist/css-value.js.map +1 -0
- package/dist/data-api.d.ts +127 -0
- package/dist/data-api.d.ts.map +1 -0
- package/dist/data-api.js +167 -0
- package/dist/data-api.js.map +1 -0
- package/dist/denylist-keys.d.ts +19 -0
- package/dist/denylist-keys.d.ts.map +1 -0
- package/dist/denylist-keys.js +48 -0
- package/dist/denylist-keys.js.map +1 -0
- package/dist/diagnostic-catalog.d.ts +1402 -0
- package/dist/diagnostic-catalog.d.ts.map +1 -0
- package/dist/diagnostic-catalog.js +1311 -0
- package/dist/diagnostic-catalog.js.map +1 -0
- package/dist/dom-members.snapshot.d.ts +33 -0
- package/dist/dom-members.snapshot.d.ts.map +1 -0
- package/dist/dom-members.snapshot.js +760 -0
- package/dist/dom-members.snapshot.js.map +1 -0
- package/dist/early-loading.d.ts +27 -0
- package/dist/early-loading.d.ts.map +1 -0
- package/dist/early-loading.js +44 -0
- package/dist/early-loading.js.map +1 -0
- package/dist/error-catalog.d.ts +749 -0
- package/dist/error-catalog.d.ts.map +1 -0
- package/dist/error-catalog.js +720 -0
- package/dist/error-catalog.js.map +1 -0
- package/dist/executable-config.d.ts +35 -0
- package/dist/executable-config.d.ts.map +1 -0
- package/dist/executable-config.js +44 -0
- package/dist/executable-config.js.map +1 -0
- package/dist/freeze.d.ts +17 -0
- package/dist/freeze.d.ts.map +1 -0
- package/dist/freeze.js +29 -0
- package/dist/freeze.js.map +1 -0
- package/dist/gunzip.d.ts +33 -0
- package/dist/gunzip.d.ts.map +1 -0
- package/dist/gunzip.js +330 -0
- package/dist/gunzip.js.map +1 -0
- package/dist/hostname.d.ts +74 -0
- package/dist/hostname.d.ts.map +1 -0
- package/dist/hostname.js +215 -0
- package/dist/hostname.js.map +1 -0
- package/dist/human-actions.d.ts +49 -0
- package/dist/human-actions.d.ts.map +1 -0
- package/dist/human-actions.js +272 -0
- package/dist/human-actions.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema.d.ts +108 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +240 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/key-checksum.d.ts +33 -0
- package/dist/key-checksum.d.ts.map +1 -0
- package/dist/key-checksum.js +67 -0
- package/dist/key-checksum.js.map +1 -0
- package/dist/libraries.d.ts +60 -0
- package/dist/libraries.d.ts.map +1 -0
- package/dist/libraries.js +120 -0
- package/dist/libraries.js.map +1 -0
- package/dist/limit-catalog.d.ts +381 -0
- package/dist/limit-catalog.d.ts.map +1 -0
- package/dist/limit-catalog.js +429 -0
- package/dist/limit-catalog.js.map +1 -0
- package/dist/limits.d.ts +167 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +175 -0
- package/dist/limits.js.map +1 -0
- package/dist/locale-tag.d.ts +21 -0
- package/dist/locale-tag.d.ts.map +1 -0
- package/dist/locale-tag.js +21 -0
- package/dist/locale-tag.js.map +1 -0
- package/dist/make-diagnostic.d.ts +74 -0
- package/dist/make-diagnostic.d.ts.map +1 -0
- package/dist/make-diagnostic.js +100 -0
- package/dist/make-diagnostic.js.map +1 -0
- package/dist/manifest-compat-diagnostics.d.ts +23 -0
- package/dist/manifest-compat-diagnostics.d.ts.map +1 -0
- package/dist/manifest-compat-diagnostics.js +150 -0
- package/dist/manifest-compat-diagnostics.js.map +1 -0
- package/dist/manifest-compat.d.ts +58 -0
- package/dist/manifest-compat.d.ts.map +1 -0
- package/dist/manifest-compat.js +377 -0
- package/dist/manifest-compat.js.map +1 -0
- package/dist/manifest.d.ts +1769 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +421 -0
- package/dist/manifest.js.map +1 -0
- package/dist/metering.d.ts +126 -0
- package/dist/metering.d.ts.map +1 -0
- package/dist/metering.js +147 -0
- package/dist/metering.js.map +1 -0
- package/dist/migrate.d.ts +70 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +159 -0
- package/dist/migrate.js.map +1 -0
- package/dist/money.d.ts +41 -0
- package/dist/money.d.ts.map +1 -0
- package/dist/money.js +52 -0
- package/dist/money.js.map +1 -0
- package/dist/names.d.ts +37 -0
- package/dist/names.d.ts.map +1 -0
- package/dist/names.js +55 -0
- package/dist/names.js.map +1 -0
- package/dist/overage-pricing.d.ts +89 -0
- package/dist/overage-pricing.d.ts.map +1 -0
- package/dist/overage-pricing.js +170 -0
- package/dist/overage-pricing.js.map +1 -0
- package/dist/plan-ids.d.ts +10 -0
- package/dist/plan-ids.d.ts.map +1 -0
- package/dist/plan-ids.js +8 -0
- package/dist/plan-ids.js.map +1 -0
- package/dist/plan-limits.d.ts +138 -0
- package/dist/plan-limits.d.ts.map +1 -0
- package/dist/plan-limits.js +112 -0
- package/dist/plan-limits.js.map +1 -0
- package/dist/plan-pricing.d.ts +145 -0
- package/dist/plan-pricing.d.ts.map +1 -0
- package/dist/plan-pricing.js +172 -0
- package/dist/plan-pricing.js.map +1 -0
- package/dist/plan-usage.d.ts +112 -0
- package/dist/plan-usage.d.ts.map +1 -0
- package/dist/plan-usage.js +134 -0
- package/dist/plan-usage.js.map +1 -0
- package/dist/preview-token.d.ts +52 -0
- package/dist/preview-token.d.ts.map +1 -0
- package/dist/preview-token.js +106 -0
- package/dist/preview-token.js.map +1 -0
- package/dist/prop-names.d.ts +51 -0
- package/dist/prop-names.d.ts.map +1 -0
- package/dist/prop-names.js +150 -0
- package/dist/prop-names.js.map +1 -0
- package/dist/prop-type-docs.d.ts +20 -0
- package/dist/prop-type-docs.d.ts.map +1 -0
- package/dist/prop-type-docs.js +89 -0
- package/dist/prop-type-docs.js.map +1 -0
- package/dist/prop-types.d.ts +97 -0
- package/dist/prop-types.d.ts.map +1 -0
- package/dist/prop-types.js +299 -0
- package/dist/prop-types.js.map +1 -0
- package/dist/props.d.ts +996 -0
- package/dist/props.d.ts.map +1 -0
- package/dist/props.js +183 -0
- package/dist/props.js.map +1 -0
- package/dist/proto-guard.d.ts +29 -0
- package/dist/proto-guard.d.ts.map +1 -0
- package/dist/proto-guard.js +79 -0
- package/dist/proto-guard.js.map +1 -0
- package/dist/runtime-errors.d.ts +42 -0
- package/dist/runtime-errors.d.ts.map +1 -0
- package/dist/runtime-errors.js +42 -0
- package/dist/runtime-errors.js.map +1 -0
- package/dist/runtime-pointers.d.ts +58 -0
- package/dist/runtime-pointers.d.ts.map +1 -0
- package/dist/runtime-pointers.js +84 -0
- package/dist/runtime-pointers.js.map +1 -0
- package/dist/secret-scan.d.ts +191 -0
- package/dist/secret-scan.d.ts.map +1 -0
- package/dist/secret-scan.js +542 -0
- package/dist/secret-scan.js.map +1 -0
- package/dist/semver.d.ts +89 -0
- package/dist/semver.d.ts.map +1 -0
- package/dist/semver.js +400 -0
- package/dist/semver.js.map +1 -0
- package/dist/server-key.d.ts +68 -0
- package/dist/server-key.d.ts.map +1 -0
- package/dist/server-key.js +150 -0
- package/dist/server-key.js.map +1 -0
- package/dist/site-manifest-keys.d.ts +107 -0
- package/dist/site-manifest-keys.d.ts.map +1 -0
- package/dist/site-manifest-keys.js +146 -0
- package/dist/site-manifest-keys.js.map +1 -0
- package/dist/site-manifest.d.ts +286 -0
- package/dist/site-manifest.d.ts.map +1 -0
- package/dist/site-manifest.js +100 -0
- package/dist/site-manifest.js.map +1 -0
- package/dist/source-archive.d.ts +119 -0
- package/dist/source-archive.d.ts.map +1 -0
- package/dist/source-archive.js +644 -0
- package/dist/source-archive.js.map +1 -0
- package/dist/source-package-corpus.d.ts +55 -0
- package/dist/source-package-corpus.d.ts.map +1 -0
- package/dist/source-package-corpus.js +303 -0
- package/dist/source-package-corpus.js.map +1 -0
- package/dist/source-package.d.ts +227 -0
- package/dist/source-package.d.ts.map +1 -0
- package/dist/source-package.js +361 -0
- package/dist/source-package.js.map +1 -0
- package/dist/source-secrets.d.ts +21 -0
- package/dist/source-secrets.d.ts.map +1 -0
- package/dist/source-secrets.js +43 -0
- package/dist/source-secrets.js.map +1 -0
- package/dist/ssr-cap.d.ts +61 -0
- package/dist/ssr-cap.d.ts.map +1 -0
- package/dist/ssr-cap.js +107 -0
- package/dist/ssr-cap.js.map +1 -0
- package/dist/ssr-kv.d.ts +18 -0
- package/dist/ssr-kv.d.ts.map +1 -0
- package/dist/ssr-kv.js +18 -0
- package/dist/ssr-kv.js.map +1 -0
- package/dist/ssr-version-ledger.d.ts +53 -0
- package/dist/ssr-version-ledger.d.ts.map +1 -0
- package/dist/ssr-version-ledger.js +88 -0
- package/dist/ssr-version-ledger.js.map +1 -0
- package/dist/style-references.d.ts +58 -0
- package/dist/style-references.d.ts.map +1 -0
- package/dist/style-references.js +241 -0
- package/dist/style-references.js.map +1 -0
- package/dist/tag-name.d.ts +87 -0
- package/dist/tag-name.d.ts.map +1 -0
- package/dist/tag-name.js +222 -0
- package/dist/tag-name.js.map +1 -0
- package/dist/tar-writer.d.ts +74 -0
- package/dist/tar-writer.d.ts.map +1 -0
- package/dist/tar-writer.js +148 -0
- package/dist/tar-writer.js.map +1 -0
- package/dist/testing.d.ts +11 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +11 -0
- package/dist/testing.js.map +1 -0
- package/dist/text-codec.d.ts +36 -0
- package/dist/text-codec.d.ts.map +1 -0
- package/dist/text-codec.js +32 -0
- package/dist/text-codec.js.map +1 -0
- package/dist/url-value.d.ts +41 -0
- package/dist/url-value.d.ts.map +1 -0
- package/dist/url-value.js +147 -0
- package/dist/url-value.js.map +1 -0
- package/dist/usage-guard.d.ts +99 -0
- package/dist/usage-guard.d.ts.map +1 -0
- package/dist/usage-guard.js +104 -0
- package/dist/usage-guard.js.map +1 -0
- package/dist/usage-mirror.d.ts +55 -0
- package/dist/usage-mirror.d.ts.map +1 -0
- package/dist/usage-mirror.js +52 -0
- package/dist/usage-mirror.js.map +1 -0
- package/dist/value-check.d.ts +88 -0
- package/dist/value-check.d.ts.map +1 -0
- package/dist/value-check.js +279 -0
- package/dist/value-check.js.map +1 -0
- package/dist/value-patterns.d.ts +9 -0
- package/dist/value-patterns.d.ts.map +1 -0
- package/dist/value-patterns.js +17 -0
- package/dist/value-patterns.js.map +1 -0
- package/dist/value-schema.d.ts +796 -0
- package/dist/value-schema.d.ts.map +1 -0
- package/dist/value-schema.js +231 -0
- package/dist/value-schema.js.map +1 -0
- package/dist/zod-free.d.ts +60 -0
- package/dist/zod-free.d.ts.map +1 -0
- package/dist/zod-free.js +59 -0
- package/dist/zod-free.js.map +1 -0
- package/package.json +75 -3
- package/schema/DEPLOYED +12 -0
- package/schema/build-diagnostic.v1.json +63 -0
- package/schema/component-manifest.v1.json +1000 -0
- package/schema/data-api.v1.json +194 -0
- package/schema/library-manifest.v1.json +60 -0
- package/schema/published/SHA256SUMS +36 -0
- package/schema/published/build-diagnostic/v1.10.json +83 -0
- package/schema/published/build-diagnostic/v1.3.json +83 -0
- package/schema/published/build-diagnostic/v1.4.json +83 -0
- package/schema/published/build-diagnostic/v1.5.json +83 -0
- package/schema/published/build-diagnostic/v1.6.json +83 -0
- package/schema/published/build-diagnostic/v1.7.json +83 -0
- package/schema/published/build-diagnostic/v1.8.json +83 -0
- package/schema/published/build-diagnostic/v1.9.json +83 -0
- package/schema/published/component-manifest/v1.10.json +1443 -0
- package/schema/published/component-manifest/v1.3.json +1411 -0
- package/schema/published/component-manifest/v1.4.json +1419 -0
- package/schema/published/component-manifest/v1.5.json +1437 -0
- package/schema/published/component-manifest/v1.6.json +1437 -0
- package/schema/published/component-manifest/v1.7.json +1437 -0
- package/schema/published/component-manifest/v1.8.json +1437 -0
- package/schema/published/component-manifest/v1.9.json +1437 -0
- package/schema/published/data-api/v1.10.json +282 -0
- package/schema/published/data-api/v1.3.json +281 -0
- package/schema/published/data-api/v1.4.json +281 -0
- package/schema/published/data-api/v1.5.json +281 -0
- package/schema/published/data-api/v1.6.json +281 -0
- package/schema/published/data-api/v1.7.json +281 -0
- package/schema/published/data-api/v1.8.json +282 -0
- package/schema/published/data-api/v1.9.json +282 -0
- package/schema/published/library-manifest/v1.10.json +68 -0
- package/schema/published/library-manifest/v1.5.json +68 -0
- package/schema/published/library-manifest/v1.6.json +68 -0
- package/schema/published/library-manifest/v1.7.json +68 -0
- package/schema/published/library-manifest/v1.8.json +68 -0
- package/schema/published/library-manifest/v1.9.json +68 -0
- package/schema/published/taggor-config/v1.10.json +56 -0
- package/schema/published/taggor-config/v1.5.json +56 -0
- package/schema/published/taggor-config/v1.6.json +56 -0
- package/schema/published/taggor-config/v1.7.json +56 -0
- package/schema/published/taggor-config/v1.8.json +56 -0
- package/schema/published/taggor-config/v1.9.json +56 -0
- package/schema/taggor-config.v1.json +39 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The checksum primitives of Taggor's secret key formats (moved here from apps/api's
|
|
3
|
+
* domain/api-key.ts, TAG-902, by the SSR server key spike, ADR 0066, no ticket): the base62
|
|
4
|
+
* alphabet, CRC-32 (the zlib variant) and a fixed-width base62 encoding. The API key
|
|
5
|
+
* (`tgr_<mode>_…`, apps/api) and the server key (`tgs_<mode>_…`, `server-key.ts`) both end in the
|
|
6
|
+
* CRC-32 of the text before it, in base62, so a mistyped or truncated key is refused without a
|
|
7
|
+
* lookup and a secret scanner can tell a real key from a look-alike. The checksum is no secret
|
|
8
|
+
* and no MAC. Zod-free and dependency-free: the edge imports it.
|
|
9
|
+
*/
|
|
10
|
+
/** The base62 alphabet of key bodies and checksums. */
|
|
11
|
+
export const BASE62_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
12
|
+
/** CRC-32 (IEEE 802.3, the zlib one) lookup table. */
|
|
13
|
+
const CRC_TABLE = (() => {
|
|
14
|
+
const table = new Uint32Array(256);
|
|
15
|
+
for (let n = 0; n < 256; n += 1) {
|
|
16
|
+
let c = n;
|
|
17
|
+
for (let k = 0; k < 8; k += 1)
|
|
18
|
+
c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
|
|
19
|
+
table[n] = c >>> 0;
|
|
20
|
+
}
|
|
21
|
+
return table;
|
|
22
|
+
})();
|
|
23
|
+
/**
|
|
24
|
+
* CRC-32 of some bytes (the zlib variant: `crc32("123456789") = 0xcbf43926`).
|
|
25
|
+
* Inputs: the bytes. Output: an unsigned 32-bit integer. Errors: none. Side effects: none.
|
|
26
|
+
*/
|
|
27
|
+
export function crc32(bytes) {
|
|
28
|
+
let crc = 0xffffffff;
|
|
29
|
+
for (const byte of bytes)
|
|
30
|
+
crc = (CRC_TABLE[(crc ^ byte) & 0xff] ?? 0) ^ (crc >>> 8);
|
|
31
|
+
return (crc ^ 0xffffffff) >>> 0;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A non-negative integer in base62, left-padded with `0` to `width`.
|
|
35
|
+
* Inputs: the integer (below 62^width) and the width. Output: `width` characters. Errors: throws
|
|
36
|
+
* on a value that does not fit. Side effects: none.
|
|
37
|
+
*/
|
|
38
|
+
export function toBase62(value, width) {
|
|
39
|
+
let rest = value;
|
|
40
|
+
let text = "";
|
|
41
|
+
for (let i = 0; i < width; i += 1) {
|
|
42
|
+
text = BASE62_ALPHABET.charAt(rest % 62) + text;
|
|
43
|
+
rest = Math.floor(rest / 62);
|
|
44
|
+
}
|
|
45
|
+
if (rest !== 0)
|
|
46
|
+
throw new Error(`${String(value)} does not fit in ${String(width)} base62 digits`);
|
|
47
|
+
return text;
|
|
48
|
+
}
|
|
49
|
+
/** Base62 characters of a key checksum (62^6 > 2^32, so any CRC-32 fits). */
|
|
50
|
+
export const KEY_CHECKSUM_LENGTH = 6;
|
|
51
|
+
/**
|
|
52
|
+
* The checksum a key's text before it must end with.
|
|
53
|
+
* Inputs: the head of a key (prefix and body), ASCII: every key format is ASCII, and the bytes of an
|
|
54
|
+
* ASCII text are its character codes (this package has no `TextEncoder` in its lib). Output:
|
|
55
|
+
* `KEY_CHECKSUM_LENGTH` base62 characters. Errors: throws on a character outside ASCII (a bug of
|
|
56
|
+
* the caller: the formats validate the head first). Side effects: none.
|
|
57
|
+
*/
|
|
58
|
+
export function keyChecksum(head) {
|
|
59
|
+
const bytes = Uint8Array.from(head, (character) => {
|
|
60
|
+
const code = character.charCodeAt(0);
|
|
61
|
+
if (code > 0x7f)
|
|
62
|
+
throw new Error("a key head is ASCII");
|
|
63
|
+
return code;
|
|
64
|
+
});
|
|
65
|
+
return toBase62(crc32(bytes), KEY_CHECKSUM_LENGTH);
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=key-checksum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-checksum.js","sourceRoot":"","sources":["../src/key-checksum.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,eAAe,GAAG,gEAAgE,CAAC;AAEhG,sDAAsD;AACtD,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE;IACtB,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;YAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5E,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC;AAEL;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,KAAiB;IACrC,IAAI,GAAG,GAAG,UAAU,CAAC;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,GAA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,mBAAmB,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace library contracts (TAG-210): a library's immutable package name/version, its public
|
|
3
|
+
* source entry points and peer dependency ranges, plus the ranges a component requests. Ownership
|
|
4
|
+
* is deliberately not encoded here: the API/builder resolves names against the authenticated
|
|
5
|
+
* workspace (TAG-420), never against a client-supplied workspace id.
|
|
6
|
+
*
|
|
7
|
+
* Inputs are JSON-like values and bounded names, paths, maps and semver strings. Outputs are
|
|
8
|
+
* Zod-validated library manifests and component library declarations. Errors are Zod issues, or
|
|
9
|
+
* `undefined` from the pure version-selection helper when no declared version satisfies a range.
|
|
10
|
+
* Side effects: none.
|
|
11
|
+
*/
|
|
12
|
+
import * as z from "zod";
|
|
13
|
+
/** Bounds for names, entries and dependencies in one workspace library declaration. */
|
|
14
|
+
export declare const LIBRARY_LIMITS: Readonly<{
|
|
15
|
+
/** Maximum characters in an npm-style scoped library package name. */
|
|
16
|
+
nameMaxLength: 100;
|
|
17
|
+
/** Public entry points of one library. */
|
|
18
|
+
maxExports: 50;
|
|
19
|
+
/** Library dependencies declared by one component. */
|
|
20
|
+
maxComponentLibraries: 50;
|
|
21
|
+
/** Peer packages a library may require. */
|
|
22
|
+
maxPeerDependencies: 30;
|
|
23
|
+
}>;
|
|
24
|
+
/** A lowercase npm-style package name with an explicit workspace scope. */
|
|
25
|
+
export declare const LIBRARY_NAME_PATTERN = "^@[a-z0-9][a-z0-9_-]{0,31}/[a-z0-9][a-z0-9._-]{0,63}$";
|
|
26
|
+
/** Scoped package name under which workspace libraries are imported. */
|
|
27
|
+
export declare const libraryNameSchema: z.ZodString;
|
|
28
|
+
/** A bounded semver range in npm's supported grammar; resolution shares TAG-402's parser. */
|
|
29
|
+
export declare const semverRangeSchema: z.ZodString;
|
|
30
|
+
/**
|
|
31
|
+
* Schema for one library package's declarative metadata.
|
|
32
|
+
*
|
|
33
|
+
* Inputs: any value. Output: `LibraryManifest` on success. Errors: unknown keys, unsafe names or
|
|
34
|
+
* paths, unbounded maps, invalid versions or ranges. Side effects: none.
|
|
35
|
+
*/
|
|
36
|
+
export declare const libraryManifestSchema: z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
version: z.ZodString;
|
|
39
|
+
exports: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
40
|
+
peerDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
/** Validated metadata for one immutable, workspace-scoped library version. */
|
|
43
|
+
export type LibraryManifest = z.infer<typeof libraryManifestSchema>;
|
|
44
|
+
/**
|
|
45
|
+
* Schema for the bounded map of workspace libraries a component requests.
|
|
46
|
+
*
|
|
47
|
+
* Inputs: any value. Output: validated package names mapped to supported semver ranges. Errors:
|
|
48
|
+
* Zod issues for invalid names, ranges or more than `maxComponentLibraries` entries. Side effects: none.
|
|
49
|
+
*/
|
|
50
|
+
export declare const componentLibrariesSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
51
|
+
/**
|
|
52
|
+
* Chooses the highest exact version that satisfies a component's declared range.
|
|
53
|
+
*
|
|
54
|
+
* Inputs: available version strings and a bounded npm semver range. Output: the original version
|
|
55
|
+
* string with greatest semver precedence, or `undefined` if the range is invalid or has no match.
|
|
56
|
+
* Errors: none. Side effects: none. Workspace ownership must be checked by the caller before this
|
|
57
|
+
* helper is used (TAG-420).
|
|
58
|
+
*/
|
|
59
|
+
export declare function resolveLibraryVersion(availableVersions: readonly string[], range: string): string | undefined;
|
|
60
|
+
//# sourceMappingURL=libraries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libraries.d.ts","sourceRoot":"","sources":["../src/libraries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,uFAAuF;AACvF,eAAO,MAAM,cAAc;IACzB,sEAAsE;;IAEtE,0CAA0C;;IAE1C,sDAAsD;;IAEtD,2CAA2C;;EAE3C,CAAC;AAEH,2EAA2E;AAC3E,eAAO,MAAM,oBAAoB,0DAA0D,CAAC;AAe5F,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,aAMA,CAAC;AAU/B,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,aAO+C,CAAC;AAiC9E;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;kBAuB9B,CAAC;AAEL,8EAA8E;AAC9E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,uCAKpC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,iBAAiB,EAAE,SAAS,MAAM,EAAE,EACpC,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAEpB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace library contracts (TAG-210): a library's immutable package name/version, its public
|
|
3
|
+
* source entry points and peer dependency ranges, plus the ranges a component requests. Ownership
|
|
4
|
+
* is deliberately not encoded here: the API/builder resolves names against the authenticated
|
|
5
|
+
* workspace (TAG-420), never against a client-supplied workspace id.
|
|
6
|
+
*
|
|
7
|
+
* Inputs are JSON-like values and bounded names, paths, maps and semver strings. Outputs are
|
|
8
|
+
* Zod-validated library manifests and component library declarations. Errors are Zod issues, or
|
|
9
|
+
* `undefined` from the pure version-selection helper when no declared version satisfies a range.
|
|
10
|
+
* Side effects: none.
|
|
11
|
+
*/
|
|
12
|
+
import * as z from "zod";
|
|
13
|
+
import { boundedRecord } from "./bounded.js";
|
|
14
|
+
import { MAX_RANGE_LENGTH, maxSatisfying, parseRange } from "./semver.js";
|
|
15
|
+
/** Bounds for names, entries and dependencies in one workspace library declaration. */
|
|
16
|
+
export const LIBRARY_LIMITS = Object.freeze({
|
|
17
|
+
/** Maximum characters in an npm-style scoped library package name. */
|
|
18
|
+
nameMaxLength: 100,
|
|
19
|
+
/** Public entry points of one library. */
|
|
20
|
+
maxExports: 50,
|
|
21
|
+
/** Library dependencies declared by one component. */
|
|
22
|
+
maxComponentLibraries: 50,
|
|
23
|
+
/** Peer packages a library may require. */
|
|
24
|
+
maxPeerDependencies: 30,
|
|
25
|
+
});
|
|
26
|
+
/** A lowercase npm-style package name with an explicit workspace scope. */
|
|
27
|
+
export const LIBRARY_NAME_PATTERN = "^@[a-z0-9][a-z0-9_-]{0,31}/[a-z0-9][a-z0-9._-]{0,63}$";
|
|
28
|
+
const libraryNamePattern = new RegExp(LIBRARY_NAME_PATTERN);
|
|
29
|
+
/** A peer dependency name: unscoped or scoped npm package name. */
|
|
30
|
+
const PACKAGE_NAME_PATTERN = "^(?:[a-z0-9][a-z0-9._-]{0,63}|@[a-z0-9][a-z0-9_-]{0,31}/[a-z0-9][a-z0-9._-]{0,63})$";
|
|
31
|
+
/** Public export names are `.` or safe relative package subpaths; no traversal or wildcards. */
|
|
32
|
+
const EXPORT_NAME_PATTERN = "^(?:\\.|\\./[A-Za-z0-9_-][A-Za-z0-9._-]{0,63}(?:/[A-Za-z0-9_-][A-Za-z0-9._-]{0,63})*)$";
|
|
33
|
+
/** Library sources stay within `src/`; tar-path validation applies again when the package is read. */
|
|
34
|
+
const SOURCE_PATH_PATTERN = "^src/(?:[A-Za-z0-9_-][A-Za-z0-9._-]*/)*[A-Za-z0-9_-][A-Za-z0-9._-]*\\.(?:m?js|tsx?)$";
|
|
35
|
+
/** Scoped package name under which workspace libraries are imported. */
|
|
36
|
+
export const libraryNameSchema = z
|
|
37
|
+
.string()
|
|
38
|
+
.max(LIBRARY_LIMITS.nameMaxLength)
|
|
39
|
+
.regex(libraryNamePattern, {
|
|
40
|
+
error: "library name must be a lowercase scoped package name such as @acme/ui",
|
|
41
|
+
})
|
|
42
|
+
.meta({ id: "LibraryName" });
|
|
43
|
+
const packageNameSchema = z
|
|
44
|
+
.string()
|
|
45
|
+
.max(100)
|
|
46
|
+
.regex(new RegExp(PACKAGE_NAME_PATTERN), {
|
|
47
|
+
error: "peer dependency name must be a lowercase npm package name",
|
|
48
|
+
})
|
|
49
|
+
.meta({ id: "LibraryPeerPackageName" });
|
|
50
|
+
/** A bounded semver range in npm's supported grammar; resolution shares TAG-402's parser. */
|
|
51
|
+
export const semverRangeSchema = z
|
|
52
|
+
.string()
|
|
53
|
+
.max(MAX_RANGE_LENGTH)
|
|
54
|
+
.refine((range) => parseRange(range) !== undefined, {
|
|
55
|
+
// zod-only: library-semver-range
|
|
56
|
+
error: "must be a supported npm semver range",
|
|
57
|
+
})
|
|
58
|
+
.meta({ description: "A supported npm semver range, for example ^1.2.0." });
|
|
59
|
+
const VERSION_NUMBER = "(?:0|[1-9][0-9]{0,14})";
|
|
60
|
+
const PRERELEASE_IDENTIFIER = "(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)";
|
|
61
|
+
const BUILD_IDENTIFIER = "[0-9A-Za-z-]+";
|
|
62
|
+
const EXACT_VERSION_PATTERN = new RegExp(`^${VERSION_NUMBER}\\.${VERSION_NUMBER}\\.${VERSION_NUMBER}(?:-${PRERELEASE_IDENTIFIER}(?:\\.${PRERELEASE_IDENTIFIER})*)?(?:\\+${BUILD_IDENTIFIER}(?:\\.${BUILD_IDENTIFIER})*)?$`);
|
|
63
|
+
const exactVersionSchema = z
|
|
64
|
+
.string()
|
|
65
|
+
.max(MAX_RANGE_LENGTH)
|
|
66
|
+
.regex(EXACT_VERSION_PATTERN, {
|
|
67
|
+
error: "must be an exact semantic version such as 1.2.3",
|
|
68
|
+
})
|
|
69
|
+
.meta({ description: "An exact semantic version; prereleases are allowed." });
|
|
70
|
+
const exportNameSchema = z
|
|
71
|
+
.string()
|
|
72
|
+
.max(128)
|
|
73
|
+
.regex(new RegExp(EXPORT_NAME_PATTERN), {
|
|
74
|
+
error: "export name must be . or a safe relative package subpath",
|
|
75
|
+
})
|
|
76
|
+
.meta({ description: "A package export such as . or ./button." });
|
|
77
|
+
const sourcePathSchema = z
|
|
78
|
+
.string()
|
|
79
|
+
.max(200)
|
|
80
|
+
.regex(new RegExp(SOURCE_PATH_PATTERN), {
|
|
81
|
+
error: "export target must be a TypeScript or JavaScript file under src/",
|
|
82
|
+
})
|
|
83
|
+
.meta({ description: "A source file path relative to the library package, under src/." });
|
|
84
|
+
/**
|
|
85
|
+
* Schema for one library package's declarative metadata.
|
|
86
|
+
*
|
|
87
|
+
* Inputs: any value. Output: `LibraryManifest` on success. Errors: unknown keys, unsafe names or
|
|
88
|
+
* paths, unbounded maps, invalid versions or ranges. Side effects: none.
|
|
89
|
+
*/
|
|
90
|
+
export const libraryManifestSchema = z
|
|
91
|
+
.strictObject({
|
|
92
|
+
name: libraryNameSchema,
|
|
93
|
+
version: exactVersionSchema,
|
|
94
|
+
exports: boundedRecord(exportNameSchema, sourcePathSchema, LIBRARY_LIMITS.maxExports, "exports", 1),
|
|
95
|
+
peerDependencies: boundedRecord(packageNameSchema, semverRangeSchema, LIBRARY_LIMITS.maxPeerDependencies, "peerDependencies").optional(),
|
|
96
|
+
})
|
|
97
|
+
.meta({
|
|
98
|
+
id: "LibraryManifest",
|
|
99
|
+
title: "Taggor workspace library manifest v1",
|
|
100
|
+
description: "Declarative package metadata for an immutable workspace library. Ownership is resolved by the API and builder, not by this document.",
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Schema for the bounded map of workspace libraries a component requests.
|
|
104
|
+
*
|
|
105
|
+
* Inputs: any value. Output: validated package names mapped to supported semver ranges. Errors:
|
|
106
|
+
* Zod issues for invalid names, ranges or more than `maxComponentLibraries` entries. Side effects: none.
|
|
107
|
+
*/
|
|
108
|
+
export const componentLibrariesSchema = boundedRecord(libraryNameSchema, semverRangeSchema, LIBRARY_LIMITS.maxComponentLibraries, "libraries");
|
|
109
|
+
/**
|
|
110
|
+
* Chooses the highest exact version that satisfies a component's declared range.
|
|
111
|
+
*
|
|
112
|
+
* Inputs: available version strings and a bounded npm semver range. Output: the original version
|
|
113
|
+
* string with greatest semver precedence, or `undefined` if the range is invalid or has no match.
|
|
114
|
+
* Errors: none. Side effects: none. Workspace ownership must be checked by the caller before this
|
|
115
|
+
* helper is used (TAG-420).
|
|
116
|
+
*/
|
|
117
|
+
export function resolveLibraryVersion(availableVersions, range) {
|
|
118
|
+
return maxSatisfying(availableVersions, range);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=libraries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"libraries.js","sourceRoot":"","sources":["../src/libraries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1E,uFAAuF;AACvF,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1C,sEAAsE;IACtE,aAAa,EAAE,GAAG;IAClB,0CAA0C;IAC1C,UAAU,EAAE,EAAE;IACd,sDAAsD;IACtD,qBAAqB,EAAE,EAAE;IACzB,2CAA2C;IAC3C,mBAAmB,EAAE,EAAE;CACxB,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,uDAAuD,CAAC;AAC5F,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAE5D,mEAAmE;AACnE,MAAM,oBAAoB,GACxB,qFAAqF,CAAC;AAExF,gGAAgG;AAChG,MAAM,mBAAmB,GACvB,wFAAwF,CAAC;AAE3F,sGAAsG;AACtG,MAAM,mBAAmB,GACvB,sFAAsF,CAAC;AAEzF,wEAAwE;AACxE,MAAM,CAAC,MAAM,iBAAiB,GAAG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AC;AACjD,CAAC"}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The limit catalog (TAG-1627, decisions 78 to 80): the ONE place that says what each limit of a
|
|
3
|
+
* plan is. Zod-free.
|
|
4
|
+
*
|
|
5
|
+
* Every limit a plan carries is one entry here: its name, unit, window, where it is enforced,
|
|
6
|
+
* its default per plan and how the customer is told. `planLimits`, `planQuotas` and `planUsage`
|
|
7
|
+
* (the tables other workspaces read), the API's `LIMIT_NAMES` (what an override may name) and the
|
|
8
|
+
* usage view (`GET /v1/usage`, the portal, `taggor usage`) all read from it, so a limit cannot
|
|
9
|
+
* exist in one of them and not in the others; `limit-catalog.test.ts` fails when it does.
|
|
10
|
+
*
|
|
11
|
+
* The rule of the owner (decision 79): one limit, one window, the advertised number. No hourly or
|
|
12
|
+
* daily sublimit sits beside it. The defaults live in this file; a per-account change is an
|
|
13
|
+
* `entitlement_adjustments` row (decision 80), never a column or a second table.
|
|
14
|
+
*
|
|
15
|
+
* The numbers are PROVISIONAL until the owner approves the plans (TAG-1602), except where a
|
|
16
|
+
* decision fixed them (77: components per site; 78: builds per week).
|
|
17
|
+
*
|
|
18
|
+
* Pay-as-you-go (TAG-1628, decision 84, ADR 0067): every spec also carries a `policy` per plan.
|
|
19
|
+
* Free is `hard` on every limit (the number is the cut). A paid plan is `metered` on the limits
|
|
20
|
+
* whose excess is billed at the end of the month (the rate table is `OVERAGE_RATES` in
|
|
21
|
+
* `plan-pricing.ts`) and `hard` on the rest (security caps, per-build technical caps, members,
|
|
22
|
+
* retention). A `metered` limit never refuses or cuts a paid plan.
|
|
23
|
+
*
|
|
24
|
+
* Server-side rendering (spike, ADR 0066, no ticket) has ONE plan limit, `ssrRendersPerMonth`, a
|
|
25
|
+
* working default the owner has NOT confirmed (it lives only in `SSR_RENDERS_PER_MONTH` below). The
|
|
26
|
+
* distinct component versions rendered on the server per day are NOT a limit of any kind (owner,
|
|
27
|
+
* 2026-11-13): they are the vendor's billing unit, measured as usage (`ssr-version-ledger.ts`) for
|
|
28
|
+
* a later pay-as-you-go price, and nothing is refused because of them.
|
|
29
|
+
*/
|
|
30
|
+
import { type PlanId } from "./plan-ids.js";
|
|
31
|
+
/** Which table a limit feeds: `build` is `planLimits`, `quota` `planQuotas`, `usage` `planUsage`, `plan` only the entitlement. */
|
|
32
|
+
export type LimitGroup = "build" | "quota" | "usage" | "plan";
|
|
33
|
+
/** What the number counts. */
|
|
34
|
+
export type LimitUnit = "count" | "bytes" | "ms" | "days";
|
|
35
|
+
/**
|
|
36
|
+
* The window of a limit: `month` (UTC calendar month), `week` (rolling 7 days), `total` (held at
|
|
37
|
+
* once, no window) or `each` (a cap on one build, one site or one creator, nothing accumulates).
|
|
38
|
+
*/
|
|
39
|
+
export type LimitWindow = "month" | "week" | "total" | "each";
|
|
40
|
+
/**
|
|
41
|
+
* How the customer is told: `usage_notice` (the 80% and 100% e-mails of TAG-1607, plus the usage
|
|
42
|
+
* view), `view_only` (measured and shown in the usage view, nothing e-mails or refuses),
|
|
43
|
+
* `on_refusal` (the usage view when the limit has a counter, and the error of the refused action
|
|
44
|
+
* with the limit and the plan) or `not_enforced` (nothing enforces it yet).
|
|
45
|
+
*/
|
|
46
|
+
export type LimitNotice = "usage_notice" | "view_only" | "on_refusal" | "not_enforced";
|
|
47
|
+
/**
|
|
48
|
+
* What measures a limit in the usage view: a counter name of the API (`usage-meters.ts` has one
|
|
49
|
+
* implementation per name) or `null` for a cap on one item, which has no running count.
|
|
50
|
+
*/
|
|
51
|
+
export type LimitMeter = "renders" | "ssr_renders" | "submissions" | "storage" | "sites" | "api_keys" | "builds_week" | "components_per_site" | "members" | "immediate_emails" | null;
|
|
52
|
+
/**
|
|
53
|
+
* What a billed excess is counted in. One metric is one line of the end-of-month overage ledger and
|
|
54
|
+
* one Stripe meter. `ssr_version_days` is metered usage without a plan limit (decision 82: the
|
|
55
|
+
* versions rendered per day are not a limit); the others are the `meter` of a catalog limit.
|
|
56
|
+
*/
|
|
57
|
+
export declare const OVERAGE_METRICS: readonly ["renders", "ssr_renders", "ssr_version_days", "builds", "submissions", "storage", "extra_sites"];
|
|
58
|
+
/** One billed metric. */
|
|
59
|
+
export type OverageMetric = (typeof OVERAGE_METRICS)[number];
|
|
60
|
+
/**
|
|
61
|
+
* What happens to a plan at a limit: `hard` refuses or cuts at the number; `metered` keeps serving
|
|
62
|
+
* and bills the excess under `metric`.
|
|
63
|
+
*/
|
|
64
|
+
export type LimitPolicy = {
|
|
65
|
+
readonly mode: "hard";
|
|
66
|
+
} | {
|
|
67
|
+
readonly mode: "metered";
|
|
68
|
+
readonly metric: OverageMetric;
|
|
69
|
+
};
|
|
70
|
+
/** One limit. */
|
|
71
|
+
export interface LimitSpec {
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly group: LimitGroup;
|
|
74
|
+
readonly unit: LimitUnit;
|
|
75
|
+
readonly window: LimitWindow;
|
|
76
|
+
/** Where it is enforced, in a few words (a route or a module), for the guide and the portal help. */
|
|
77
|
+
readonly enforcedAt: string;
|
|
78
|
+
readonly notice: LimitNotice;
|
|
79
|
+
readonly meter: LimitMeter;
|
|
80
|
+
/** The default of each plan. */
|
|
81
|
+
readonly defaults: Readonly<Record<PlanId, number>>;
|
|
82
|
+
/** What each plan does at the number (decision 84): Free always `hard`. */
|
|
83
|
+
readonly policy: Readonly<Record<PlanId, LimitPolicy>>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Every limit, in the order the tables and the usage view list them. Add a limit here and
|
|
87
|
+
* nowhere else; the types of the tables follow from it.
|
|
88
|
+
*/
|
|
89
|
+
declare const SPECS: readonly [{
|
|
90
|
+
readonly name: "buildTimeoutMs";
|
|
91
|
+
readonly group: "build";
|
|
92
|
+
readonly unit: "ms";
|
|
93
|
+
readonly window: "each";
|
|
94
|
+
readonly enforcedAt: "builder, one whole build";
|
|
95
|
+
readonly notice: "on_refusal";
|
|
96
|
+
readonly meter: null;
|
|
97
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
98
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "maxSourceBytes";
|
|
101
|
+
readonly group: "build";
|
|
102
|
+
readonly unit: "bytes";
|
|
103
|
+
readonly window: "each";
|
|
104
|
+
readonly enforcedAt: "POST /v1/components/{id}/builds upload and builder, the compressed source";
|
|
105
|
+
readonly notice: "on_refusal";
|
|
106
|
+
readonly meter: null;
|
|
107
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
108
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
109
|
+
}, {
|
|
110
|
+
readonly name: "maxFiles";
|
|
111
|
+
readonly group: "build";
|
|
112
|
+
readonly unit: "count";
|
|
113
|
+
readonly window: "each";
|
|
114
|
+
readonly enforcedAt: "builder, files in the source package";
|
|
115
|
+
readonly notice: "on_refusal";
|
|
116
|
+
readonly meter: null;
|
|
117
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
118
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
119
|
+
}, {
|
|
120
|
+
readonly name: "maxDependencies";
|
|
121
|
+
readonly group: "build";
|
|
122
|
+
readonly unit: "count";
|
|
123
|
+
readonly window: "each";
|
|
124
|
+
readonly enforcedAt: "builder, packages the component imports by name";
|
|
125
|
+
readonly notice: "on_refusal";
|
|
126
|
+
readonly meter: null;
|
|
127
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
128
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: "maxOutputBytes";
|
|
131
|
+
readonly group: "build";
|
|
132
|
+
readonly unit: "bytes";
|
|
133
|
+
readonly window: "each";
|
|
134
|
+
readonly enforcedAt: "builder, bundle and CSS together (2 MiB plus 512 KiB)";
|
|
135
|
+
readonly notice: "on_refusal";
|
|
136
|
+
readonly meter: null;
|
|
137
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
138
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
139
|
+
}, {
|
|
140
|
+
readonly name: "maxAssetBytes";
|
|
141
|
+
readonly group: "build";
|
|
142
|
+
readonly unit: "bytes";
|
|
143
|
+
readonly window: "each";
|
|
144
|
+
readonly enforcedAt: "builder, one image or font a component imports";
|
|
145
|
+
readonly notice: "on_refusal";
|
|
146
|
+
readonly meter: null;
|
|
147
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
148
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
149
|
+
}, {
|
|
150
|
+
readonly name: "maxAssetsBytes";
|
|
151
|
+
readonly group: "build";
|
|
152
|
+
readonly unit: "bytes";
|
|
153
|
+
readonly window: "each";
|
|
154
|
+
readonly enforcedAt: "builder, all assets of one component together";
|
|
155
|
+
readonly notice: "on_refusal";
|
|
156
|
+
readonly meter: null;
|
|
157
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
158
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
159
|
+
}, {
|
|
160
|
+
readonly name: "buildsPerWeek";
|
|
161
|
+
readonly group: "build";
|
|
162
|
+
readonly unit: "count";
|
|
163
|
+
readonly window: "week";
|
|
164
|
+
readonly enforcedAt: "POST /v1/components/{id}/builds, 429 with Retry-After";
|
|
165
|
+
readonly notice: "on_refusal";
|
|
166
|
+
readonly meter: "builds_week";
|
|
167
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
168
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
169
|
+
}, {
|
|
170
|
+
readonly name: "concurrentBuilds";
|
|
171
|
+
readonly group: "build";
|
|
172
|
+
readonly unit: "count";
|
|
173
|
+
readonly window: "each";
|
|
174
|
+
readonly enforcedAt: "builder, a build over it waits for a retry";
|
|
175
|
+
readonly notice: "on_refusal";
|
|
176
|
+
readonly meter: null;
|
|
177
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
178
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "maxSites";
|
|
181
|
+
readonly group: "quota";
|
|
182
|
+
readonly unit: "count";
|
|
183
|
+
readonly window: "total";
|
|
184
|
+
readonly enforcedAt: "POST /v1/sites, 409 site_quota_exceeded";
|
|
185
|
+
readonly notice: "on_refusal";
|
|
186
|
+
readonly meter: "sites";
|
|
187
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
188
|
+
readonly policy: {
|
|
189
|
+
readonly free: {
|
|
190
|
+
readonly mode: "hard";
|
|
191
|
+
};
|
|
192
|
+
readonly pro: Readonly<{
|
|
193
|
+
mode: "metered";
|
|
194
|
+
metric: "extra_sites";
|
|
195
|
+
}>;
|
|
196
|
+
readonly agency: {
|
|
197
|
+
readonly mode: "hard";
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
}, {
|
|
201
|
+
readonly name: "activeApiKeys";
|
|
202
|
+
readonly group: "quota";
|
|
203
|
+
readonly unit: "count";
|
|
204
|
+
readonly window: "total";
|
|
205
|
+
readonly enforcedAt: "POST /v1/api-keys, 409 api_key_quota_exceeded";
|
|
206
|
+
readonly notice: "on_refusal";
|
|
207
|
+
readonly meter: "api_keys";
|
|
208
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
209
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
210
|
+
}, {
|
|
211
|
+
readonly name: "activeApiKeysPerCreator";
|
|
212
|
+
readonly group: "quota";
|
|
213
|
+
readonly unit: "count";
|
|
214
|
+
readonly window: "each";
|
|
215
|
+
readonly enforcedAt: "POST /v1/api-keys, one admin or member (TAG-2293)";
|
|
216
|
+
readonly notice: "on_refusal";
|
|
217
|
+
readonly meter: null;
|
|
218
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
219
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
220
|
+
}, {
|
|
221
|
+
readonly name: "ownerReservedApiKeys";
|
|
222
|
+
readonly group: "quota";
|
|
223
|
+
readonly unit: "count";
|
|
224
|
+
readonly window: "each";
|
|
225
|
+
readonly enforcedAt: "POST /v1/api-keys, places only an owner may fill (TAG-2293)";
|
|
226
|
+
readonly notice: "on_refusal";
|
|
227
|
+
readonly meter: null;
|
|
228
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
229
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
230
|
+
}, {
|
|
231
|
+
readonly name: "componentsPerSite";
|
|
232
|
+
readonly group: "quota";
|
|
233
|
+
readonly unit: "count";
|
|
234
|
+
readonly window: "each";
|
|
235
|
+
readonly enforcedAt: "attach a component to a site, 409 site_component_limit";
|
|
236
|
+
readonly notice: "on_refusal";
|
|
237
|
+
readonly meter: "components_per_site";
|
|
238
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
239
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
240
|
+
}, {
|
|
241
|
+
readonly name: "connectOriginsPerVersion";
|
|
242
|
+
readonly group: "quota";
|
|
243
|
+
readonly unit: "count";
|
|
244
|
+
readonly window: "each";
|
|
245
|
+
readonly enforcedAt: "POST /v1/components/{id}/versions, 402 plan_limit_reached before the INSERT";
|
|
246
|
+
readonly notice: "on_refusal";
|
|
247
|
+
readonly meter: null;
|
|
248
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
249
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
250
|
+
}, {
|
|
251
|
+
readonly name: "rendersPerMonth";
|
|
252
|
+
readonly group: "usage";
|
|
253
|
+
readonly unit: "count";
|
|
254
|
+
readonly window: "month";
|
|
255
|
+
readonly enforcedAt: "hourly usage job: notices at 80% and 100%; Free is cut at 1x (loader mark, off until approved); a paid plan is never cut and, while renders are not billed (`OVERAGE_BILLING_GATES`), the excess is not billed either";
|
|
256
|
+
readonly notice: "usage_notice";
|
|
257
|
+
readonly meter: "renders";
|
|
258
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
259
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
260
|
+
}, {
|
|
261
|
+
readonly name: "ssrRendersPerMonth";
|
|
262
|
+
readonly group: "usage";
|
|
263
|
+
readonly unit: "count";
|
|
264
|
+
readonly window: "month";
|
|
265
|
+
readonly enforcedAt: "GET /r/ on the edge: only Free is cut (the hourly usage job writes the ssrcap mark, ssrCapAction), no fragment over it; a paid plan keeps serving and the excess is billed";
|
|
266
|
+
readonly notice: "on_refusal";
|
|
267
|
+
readonly meter: "ssr_renders";
|
|
268
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
269
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
270
|
+
}, {
|
|
271
|
+
readonly name: "submissionsPerMonth";
|
|
272
|
+
readonly group: "usage";
|
|
273
|
+
readonly unit: "count";
|
|
274
|
+
readonly window: "month";
|
|
275
|
+
readonly enforcedAt: "edge ingest consumer counts each accepted submission; Free is refused at its number, a paid plan keeps them (the excess is billed only when the submissions gate of `OVERAGE_BILLING_GATES` is on)";
|
|
276
|
+
readonly notice: "usage_notice";
|
|
277
|
+
readonly meter: "submissions";
|
|
278
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
279
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
280
|
+
}, {
|
|
281
|
+
readonly name: "storageBytes";
|
|
282
|
+
readonly group: "usage";
|
|
283
|
+
readonly unit: "bytes";
|
|
284
|
+
readonly window: "total";
|
|
285
|
+
readonly enforcedAt: "the JSON of the submissions the workspace holds: Free refuses new ones at its number, a paid plan keeps them (the excess is billed only when the submissions gate of `OVERAGE_BILLING_GATES` is on)";
|
|
286
|
+
readonly notice: "view_only";
|
|
287
|
+
readonly meter: "storage";
|
|
288
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
289
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
290
|
+
}, {
|
|
291
|
+
readonly name: "retentionDays";
|
|
292
|
+
readonly group: "usage";
|
|
293
|
+
readonly unit: "days";
|
|
294
|
+
readonly window: "each";
|
|
295
|
+
readonly enforcedAt: "collection settings and the daily retention purge";
|
|
296
|
+
readonly notice: "on_refusal";
|
|
297
|
+
readonly meter: null;
|
|
298
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
299
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
300
|
+
}, {
|
|
301
|
+
readonly name: "metricsRetentionDays";
|
|
302
|
+
readonly group: "plan";
|
|
303
|
+
readonly unit: "days";
|
|
304
|
+
readonly window: "each";
|
|
305
|
+
readonly enforcedAt: "the daily purge of metrics_daily and the window of GET /v1/metrics";
|
|
306
|
+
readonly notice: "view_only";
|
|
307
|
+
readonly meter: null;
|
|
308
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
309
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
310
|
+
}, {
|
|
311
|
+
readonly name: "immediateEmailsPerMonth";
|
|
312
|
+
readonly group: "plan";
|
|
313
|
+
readonly unit: "count";
|
|
314
|
+
readonly window: "month";
|
|
315
|
+
readonly enforcedAt: "submission notification e-mails: past the number an instant e-mail goes to the daily digest, on every plan";
|
|
316
|
+
readonly notice: "view_only";
|
|
317
|
+
readonly meter: "immediate_emails";
|
|
318
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
319
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
320
|
+
}, {
|
|
321
|
+
readonly name: "members";
|
|
322
|
+
readonly group: "plan";
|
|
323
|
+
readonly unit: "count";
|
|
324
|
+
readonly window: "total";
|
|
325
|
+
readonly enforcedAt: "POST /v1/workspaces/{id}/invitations, 409 member_limit_reached";
|
|
326
|
+
readonly notice: "on_refusal";
|
|
327
|
+
readonly meter: "members";
|
|
328
|
+
readonly defaults: Readonly<Record<"free" | "pro" | "agency", number>>;
|
|
329
|
+
readonly policy: Readonly<Record<"free" | "pro" | "agency", LimitPolicy>>;
|
|
330
|
+
}];
|
|
331
|
+
type Spec = (typeof SPECS)[number];
|
|
332
|
+
/** The name of every limit, as a union. */
|
|
333
|
+
export type CatalogLimitName = Spec["name"];
|
|
334
|
+
/** The names of the limits of one group, as a union. */
|
|
335
|
+
export type NamesOfGroup<G extends LimitGroup> = Extract<Spec, {
|
|
336
|
+
group: G;
|
|
337
|
+
}>["name"];
|
|
338
|
+
/** What one plan allows for the limits of one group. */
|
|
339
|
+
export type GroupRow<G extends LimitGroup> = Readonly<Record<NamesOfGroup<G>, number>>;
|
|
340
|
+
/**
|
|
341
|
+
* The catalog: every limit, deeply frozen.
|
|
342
|
+
*
|
|
343
|
+
* Inputs: none. Output: the entries in listing order. Errors: none. Side effects: none.
|
|
344
|
+
*/
|
|
345
|
+
export declare const LIMIT_CATALOG: readonly LimitSpec[];
|
|
346
|
+
/** The names of every limit in the catalog: what an override may name and an entitlement carries. */
|
|
347
|
+
export declare const CATALOG_LIMIT_NAMES: readonly CatalogLimitName[];
|
|
348
|
+
/**
|
|
349
|
+
* The defaults of every plan for the limits of one group, the rows `planLimits`, `planQuotas` and
|
|
350
|
+
* `planUsage` expose.
|
|
351
|
+
*
|
|
352
|
+
* Inputs: the group. Output: a plan id to row map (frozen rows) holding exactly the group's names.
|
|
353
|
+
* Errors: none. Side effects: none.
|
|
354
|
+
*/
|
|
355
|
+
export declare function catalogRows<G extends LimitGroup>(group: G): Record<PlanId, GroupRow<G>>;
|
|
356
|
+
/**
|
|
357
|
+
* The entry of one limit.
|
|
358
|
+
* Inputs: a catalog name. Output: its entry. Errors: none for a name of the catalog. Side effects:
|
|
359
|
+
* none.
|
|
360
|
+
*/
|
|
361
|
+
export declare function limitSpec(name: CatalogLimitName): LimitSpec;
|
|
362
|
+
/**
|
|
363
|
+
* The billed metric of a limit on a plan, or `null` when the plan is cut or refused at the number.
|
|
364
|
+
*
|
|
365
|
+
* Inputs: a catalog name and a plan id. Output: the `OverageMetric` its excess is billed under, or
|
|
366
|
+
* `null` for a `hard` policy (always the case for Free). Errors: throws for an unknown name. No side
|
|
367
|
+
* effects.
|
|
368
|
+
*/
|
|
369
|
+
export declare function overageMetricOf(name: CatalogLimitName, planId: PlanId): OverageMetric | null;
|
|
370
|
+
/**
|
|
371
|
+
* Whether a usage price (metric, plan) is informational only: the metric is a limit's overage on
|
|
372
|
+
* another plan, but this plan never meters it. Today that is the Agency's extra site, the existing
|
|
373
|
+
* add-on on its subscription (decision 68), so a usage price for it would bill nothing and a
|
|
374
|
+
* schedule for it must be refused (TAG-1635). A metric tied to no limit (`ssr_version_days`) is
|
|
375
|
+
* never informational.
|
|
376
|
+
*
|
|
377
|
+
* Inputs: an overage metric and a plan id. Output: the verdict. Errors: none. No side effects.
|
|
378
|
+
*/
|
|
379
|
+
export declare function isInformationalRate(metric: OverageMetric, planId: PlanId): boolean;
|
|
380
|
+
export {};
|
|
381
|
+
//# sourceMappingURL=limit-catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limit-catalog.d.ts","sourceRoot":"","sources":["../src/limit-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EA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