@openupstream/sdk 0.12.0 → 0.22.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/index.d.ts +57 -5
- package/dist/index.js +109 -6
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +175 -12
- package/dist/internal.js +92 -7
- package/dist/internal.js.map +1 -1
- package/dist/model.d.ts +480 -10
- package/dist/model.js +111 -2
- package/dist/model.js.map +1 -1
- package/package.json +1 -1
package/dist/model.js
CHANGED
|
@@ -28,6 +28,10 @@ export const SITE_PROBLEMS = [
|
|
|
28
28
|
* everything in it.
|
|
29
29
|
*/
|
|
30
30
|
export const MEMBER_ROLES = ['owner', 'developer'];
|
|
31
|
+
/** How long an invitation can be accepted, from its sending (decision 142). */
|
|
32
|
+
export const INVITATION_DAYS = 7;
|
|
33
|
+
/** An Account sends at most this many invitation e-mails a day; an address gets at most one an hour. */
|
|
34
|
+
export const INVITATION_LIMITS = { mailsPerAccountPerDay: 20, mailsPerAddressPerHour: 1 };
|
|
31
35
|
/**
|
|
32
36
|
* What an Account token may do in the whole Account (decision 144):
|
|
33
37
|
* `developer`, as a Member with that role; never `owner`, so a token
|
|
@@ -38,8 +42,43 @@ export const ACCOUNT_TOKEN_ROLES = ['developer'];
|
|
|
38
42
|
export const ACCOUNT_TOKEN_PREFIX = 'oup_tok_';
|
|
39
43
|
/** An Account token expires at most this many days after it is created or rolled. */
|
|
40
44
|
export const ACCOUNT_TOKEN_MAX_DAYS = 365;
|
|
45
|
+
/** At most this many source ranges per Account token (decision 214). */
|
|
46
|
+
export const ACCOUNT_TOKEN_MAX_SOURCE_RANGES = 20;
|
|
47
|
+
/** The owners are e-mailed this many days before an Account token expires, once per expiry (decision 214). */
|
|
48
|
+
export const ACCOUNT_TOKEN_WARNING_DAYS = 14;
|
|
41
49
|
/** Postgres always runs with at least this much memory. */
|
|
42
50
|
export const DATABASE_MIN_MEMORY_MB = 256;
|
|
51
|
+
/**
|
|
52
|
+
* What a Postgres server is for (decision 201): `production` runs a
|
|
53
|
+
* primary and a standby in two Sites, a PgBouncer in each and continuous
|
|
54
|
+
* backups with point-in-time restore; `development` (tests, staging) runs
|
|
55
|
+
* one instance and one PgBouncer in its Home site and has no backups: it
|
|
56
|
+
* is down while its Site is, and its data is lost with its server. Each is
|
|
57
|
+
* billed in units of its own.
|
|
58
|
+
*/
|
|
59
|
+
export const POSTGRES_TIERS = ['production', 'development'];
|
|
60
|
+
export const DEFAULT_POSTGRES_TIER = 'production';
|
|
61
|
+
/**
|
|
62
|
+
* The Postgres major versions a new server can be created with, oldest
|
|
63
|
+
* first (decision 220). A server keeps its major until its customer
|
|
64
|
+
* upgrades it to a newer one; minor versions come with the platform's
|
|
65
|
+
* image. A major leaves this list before its end of life, and servers
|
|
66
|
+
* still on it are upgraded after notice (decision 162).
|
|
67
|
+
*/
|
|
68
|
+
export const POSTGRES_VERSIONS = [17, 18, 19];
|
|
69
|
+
/**
|
|
70
|
+
* A new server's major when the request names none: the newest one that
|
|
71
|
+
* has had its first minor release (x.1), so not a major in its first
|
|
72
|
+
* weeks (decision 220).
|
|
73
|
+
*/
|
|
74
|
+
export const DEFAULT_POSTGRES_VERSION = 18;
|
|
75
|
+
/** Whether `version` is one a new server can be created with or upgraded to. */
|
|
76
|
+
export const isPostgresVersion = (version) => POSTGRES_VERSIONS.includes(version);
|
|
77
|
+
/**
|
|
78
|
+
* The longest name a new Database may have: its owner and group roles
|
|
79
|
+
* (`oup_connect_<name>`) must fit Postgres's 63 characters (decision 189).
|
|
80
|
+
*/
|
|
81
|
+
export const DATABASE_NAME_MAX_LENGTH = 51;
|
|
43
82
|
/**
|
|
44
83
|
* What an API key may do (madAuth API keys, created by the Member): `read`
|
|
45
84
|
* allows every GET, `write` everything. A Member's own session may do
|
|
@@ -74,6 +113,24 @@ export const SERVICE_LIMITS = {
|
|
|
74
113
|
minCpuMillicores: 50,
|
|
75
114
|
maxCpuMillicores: 8000,
|
|
76
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* How far a Service's or Job's containers may use idle CPU beyond their
|
|
118
|
+
* configured CPU (decision 198): 1, never; 2 or 4, up to that many times
|
|
119
|
+
* it. The configured CPU is guaranteed whatever the choice; the rest is
|
|
120
|
+
* used only while the node has idle cores. Each choice has its own price
|
|
121
|
+
* per core-hour (`cpu_hours_1x`, `cpu_hours_2x`, `cpu_hours_4x`).
|
|
122
|
+
*/
|
|
123
|
+
export const CPU_BURSTS = [1, 2, 4];
|
|
124
|
+
export const DEFAULT_CPU_BURST = 2;
|
|
125
|
+
/**
|
|
126
|
+
* How a Service replaces its pods on a rollout (decision 161): `overlap`
|
|
127
|
+
* starts a new pod before an old one stops, so a deploy costs no downtime;
|
|
128
|
+
* `stopFirst` stops every old pod before a new one starts, seconds of
|
|
129
|
+
* downtime per deploy, for an app that must never run twice at once, such
|
|
130
|
+
* as a bot polling one chat or a scheduler without a lock.
|
|
131
|
+
*/
|
|
132
|
+
export const SERVICE_ROLLOUTS = ['overlap', 'stopFirst'];
|
|
133
|
+
export const DEFAULT_SERVICE_ROLLOUT = 'overlap';
|
|
77
134
|
/**
|
|
78
135
|
* Limits of what a Service's or Job's definition names for its containers'
|
|
79
136
|
* environment (decision 170). The values of the Secrets a definition names
|
|
@@ -108,6 +165,26 @@ export const DEFINITION_DATABASE_ACCESS = ['own', 'owner'];
|
|
|
108
165
|
export const MAX_NAMED_DATABASES = 16;
|
|
109
166
|
/** The longest name of a Service or Job that can have a role of its own: Postgres's names end at 63, and the role's has a prefix of 4. */
|
|
110
167
|
export const MAX_NAME_WITH_OWN_ROLE = 59;
|
|
168
|
+
/**
|
|
169
|
+
* Limits of a Function (decisions 159, 211 and 216), the runner's
|
|
170
|
+
* (`function-runner/src/config.rs`), and of its component: a
|
|
171
|
+
* WebAssembly component of at most `maxComponentBytes`.
|
|
172
|
+
*/
|
|
173
|
+
export const FUNCTION_LIMITS = {
|
|
174
|
+
minMemoryMb: 1,
|
|
175
|
+
maxMemoryMb: 512,
|
|
176
|
+
defaultMemoryMb: 64,
|
|
177
|
+
minCpuMs: 1,
|
|
178
|
+
maxCpuMs: 60_000,
|
|
179
|
+
defaultCpuMs: 50,
|
|
180
|
+
minTimeoutMs: 1,
|
|
181
|
+
maxTimeoutMs: 60_000,
|
|
182
|
+
defaultTimeoutMs: 30_000,
|
|
183
|
+
maxComponentBytes: 32 * 1024 * 1024,
|
|
184
|
+
maxOrigins: 64,
|
|
185
|
+
};
|
|
186
|
+
/** A component's digest: `sha256:` and the hex SHA-256 of its bytes. */
|
|
187
|
+
export const FUNCTION_COMPONENT_DIGEST = /^sha256:[0-9a-f]{64}$/;
|
|
111
188
|
/** Limits of a Job, checked by the API; memory and CPU as for a Service. */
|
|
112
189
|
export const JOB_LIMITS = {
|
|
113
190
|
minMemoryMb: SERVICE_LIMITS.minMemoryMb,
|
|
@@ -179,6 +256,38 @@ export function txtRecordName(hostname) {
|
|
|
179
256
|
export const HOSTNAME = /^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
180
257
|
/** A Route's path prefix: `/` or `/segment[/segment…]`, no trailing slash (the schema checks the same). */
|
|
181
258
|
export const PATH_PREFIX = /^(\/|(\/[A-Za-z0-9._~-]+)+)$/;
|
|
182
|
-
|
|
183
|
-
export const
|
|
259
|
+
/** `database` for usage before decision 189; a Postgres server's since. `function`: a Function (decision 216). */
|
|
260
|
+
export const RESOURCE_KINDS = ['database', 'postgres_server', 'bucket', 'service', 'job', 'function'];
|
|
261
|
+
/**
|
|
262
|
+
* `cpu_seconds`: measured CPU, billed until decision 195; `cpu_hours`:
|
|
263
|
+
* configured CPU × hours of pods that burst 2×, until decision 198;
|
|
264
|
+
* `cpu_hours_1x`, `_2x`, `_4x`: configured CPU × hours since, one unit per
|
|
265
|
+
* CPU burst, each with its own price. `memory_gb_hours` and
|
|
266
|
+
* `storage_gb_hours` are Services', Jobs' and Buckets'; a Postgres server's
|
|
267
|
+
* memory and storage are `postgres_memory_gb_hours` and
|
|
268
|
+
* `postgres_storage_gb_hours` (production, decision 200) or
|
|
269
|
+
* `postgres_dev_memory_gb_hours` and `postgres_dev_storage_gb_hours`
|
|
270
|
+
* (development, decision 201), and were `memory_gb_hours` and
|
|
271
|
+
* `storage_gb_hours` before. Events are never rewritten, so the older
|
|
272
|
+
* units stay for the events from before. A Function's are
|
|
273
|
+
* `function_requests` (requests, whatever their outcome) and
|
|
274
|
+
* `function_cpu_ms` (the 1 ms ticks its instances ran through), decision
|
|
275
|
+
* 211; its response bytes are `egress_gb` like any Route's.
|
|
276
|
+
*/
|
|
277
|
+
export const USAGE_UNITS = [
|
|
278
|
+
'cpu_seconds',
|
|
279
|
+
'cpu_hours',
|
|
280
|
+
'cpu_hours_1x',
|
|
281
|
+
'cpu_hours_2x',
|
|
282
|
+
'cpu_hours_4x',
|
|
283
|
+
'memory_gb_hours',
|
|
284
|
+
'storage_gb_hours',
|
|
285
|
+
'postgres_memory_gb_hours',
|
|
286
|
+
'postgres_storage_gb_hours',
|
|
287
|
+
'postgres_dev_memory_gb_hours',
|
|
288
|
+
'postgres_dev_storage_gb_hours',
|
|
289
|
+
'egress_gb',
|
|
290
|
+
'function_requests',
|
|
291
|
+
'function_cpu_ms',
|
|
292
|
+
];
|
|
184
293
|
//# sourceMappingURL=model.js.map
|
package/dist/model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,MAAM,CAAC,MAAM,OAAO,GAAG,iDAAiD,CAAC;AAWzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IACzB,mBAAmB;IACnB,iCAAiC;IACjC,yBAAyB;IACzB,oBAAoB;IACpB,oBAAoB;IACpB,sBAAsB;IACtB,yBAAyB;IACzB,0BAA0B;IAC1B,yBAAyB;IACzB,mBAAmB;C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