@runeditrun/rer 0.2.99 → 0.2.101

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.
Files changed (72) hide show
  1. package/README.md +30 -102
  2. package/cli/README.md +38 -25
  3. package/cli/app-address.mjs +2 -0
  4. package/cli/business/api.mjs +2 -1
  5. package/cli/business/choices.mjs +1 -1
  6. package/cli/business/command.mjs +36 -25
  7. package/cli/business/connect.mjs +1 -1
  8. package/cli/business/lease.mjs +0 -9
  9. package/cli/business/local-commands.mjs +1 -18
  10. package/cli/business/outbound.mjs +2 -14
  11. package/cli/business/questions.mjs +85 -48
  12. package/cli/business/service.mjs +1 -24
  13. package/cli/business/setup-command.mjs +33 -26
  14. package/cli/business/state.mjs +2 -2
  15. package/cli/business/supervisor.mjs +26 -91
  16. package/cli/companion/command.mjs +2 -0
  17. package/cli/demo-native.mjs +1 -1
  18. package/cli/deploy-command.mjs +5 -4
  19. package/cli/deploy-inputs.mjs +1 -1
  20. package/cli/deploy.mjs +6 -4
  21. package/cli/parse.mjs +2 -1
  22. package/cli/production-auth.mjs +16 -3
  23. package/cli/production-mail.mjs +18 -1
  24. package/cli/site.mjs +1 -1
  25. package/global/CHANGELOG.md +45 -0
  26. package/global/README.md +30 -102
  27. package/global/main.mjs +2 -0
  28. package/modules/container/adapters/d1-limits.mjs +2 -10
  29. package/modules/d1-transport/limits.d.mts +10 -0
  30. package/modules/d1-transport/limits.mjs +10 -0
  31. package/modules/demo-host/native/prepare.mjs +2 -1
  32. package/modules/deploy-kit/README.md +10 -0
  33. package/modules/deploy-kit/provider.mjs +18 -2
  34. package/modules/import-kit/schema/importers.schema.json +104 -2
  35. package/modules/import-kit/src/d1/README.md +13 -0
  36. package/modules/import-kit/src/d1/apply-reads.ts +48 -0
  37. package/modules/import-kit/src/d1/apply.ts +21 -8
  38. package/modules/import-kit/src/d1/history.ts +2 -2
  39. package/modules/import-kit/src/d1/jobs.ts +3 -1
  40. package/modules/import-kit/src/d1/retirement-scope.ts +2 -2
  41. package/modules/import-kit/src/d1/retirement-tally.ts +1 -0
  42. package/modules/import-kit/src/d1/retirement.ts +15 -5
  43. package/modules/import-kit/src/d1/types.ts +14 -0
  44. package/modules/import-kit/src/d1/wave-boundary.ts +33 -0
  45. package/modules/import-kit/src/d1/wave-retirement.ts +47 -0
  46. package/modules/import-kit/src/provenance/credentials.ts +14 -5
  47. package/modules/import-kit/src/status/evidence.ts +3 -1
  48. package/modules/import-kit/src/status/index.ts +17 -2
  49. package/modules/import-kit/src/status/schema.ts +8 -0
  50. package/modules/import-kit/src/status/types.ts +25 -4
  51. package/onboarding/adapter.mjs +7 -1
  52. package/onboarding/operator-installer.mjs +3 -1
  53. package/package.json +1 -1
  54. package/scripts/publish-check/README.md +20 -0
  55. package/scripts/publish-check/diagnostics.mjs +73 -0
  56. package/scripts/publish-check/slots.py +37 -7
  57. package/scripts/publish-check.mjs +64 -37
  58. package/cli/business/archive-task.mjs +0 -32
  59. package/cli/business/catchup-task.mjs +0 -42
  60. package/cli/business/export-inputs.mjs +0 -69
  61. package/cli/business/export-task.mjs +0 -17
  62. package/cli/business/setup-demo.mjs +0 -95
  63. package/cli/business/vendor-door.mjs +0 -231
  64. package/cli/business/vendors/README.md +0 -176
  65. package/cli/business/vendors/calendly.mjs +0 -80
  66. package/cli/business/vendors/common.mjs +0 -199
  67. package/cli/business/vendors/credential-names.mjs +0 -124
  68. package/cli/business/vendors/index.mjs +0 -86
  69. package/cli/business/vendors/pagerduty.mjs +0 -61
  70. package/cli/business/vendors/sentry.mjs +0 -85
  71. package/cli/business/vendors/sorry.mjs +0 -106
  72. package/cli/business/vendors/uptimerobot.mjs +0 -21
@@ -1,106 +0,0 @@
1
- import { object, list, assertCount, shape, fail } from './common.mjs';
2
-
3
- // Sorry's public status page API, read anonymously from the page's own HTTPS
4
- // address, as Lamp's Move in reads it (statuspage-import/sorry/fetch.ts,
5
- // fetchSorryPublicResponses): /api/v1/status, the components and notices lists
6
- // (25 a page, `meta.next_page`), then every notice's detail with its components
7
- // and full update history. No key is sent or accepted.
8
-
9
- const label = /^(?!-)[a-z0-9-]{1,63}(?<!-)$/u;
10
- /** The page's public HTTPS origin from its host name alone: no scheme, port,
11
- * path, credentials, IP address or local name can come from the inputs. */
12
- export function originOf(inputs) {
13
- const page = object(inputs.page);
14
- if (Object.keys(page).some(key => key !== 'host')) fail('INVALID_INPUT');
15
- const host = page.host;
16
- if (typeof host !== 'string' || host.length > 253) fail('INVALID_INPUT');
17
- const labels = host.split('.');
18
- if (labels.length < 2 || !labels.every(part => label.test(part)) || /^[0-9]+$/u.test(labels.at(-1))
19
- || ['localhost', 'local', 'internal', 'invalid', 'test'].includes(labels.at(-1))) fail('INVALID_INPUT');
20
- return `https://${host}`;
21
- }
22
- export const route = url => /^\/api\/v1\/(?:status|components|notices(?:\/(?:0|[1-9][0-9]{0,127}))?)$/u.test(url.pathname)
23
- && [...url.searchParams.keys()].every(key => key === 'page');
24
-
25
- const resources = ['components', 'notices'];
26
- /** The documented next page of one public list: the same collection, page n+1, or null. */
27
- function nextPage(value, path, current) {
28
- if (value == null) return null;
29
- if (typeof value !== 'string' || value.length > 2048) fail('INVALID_PAGINATION');
30
- let next;
31
- try { next = new URL(value, 'https://sorry.invalid'); } catch { fail('INVALID_PAGINATION'); }
32
- const params = [...next.searchParams];
33
- if (next.username || next.password || next.hash || ![path, path.replace('/api/v1/', '/v1/')].includes(next.pathname)
34
- || params.length !== 1 || params[0][0] !== 'page' || params[0][1] !== String(current + 1)) fail('INVALID_PAGINATION');
35
- return `${path}?page=${current + 1}`;
36
- }
37
- /** Notice ids exactly as Sorry wrote them (large integers never pass through Number). */
38
- function noticeIds(text) {
39
- const ids = [];
40
- JSON.parse(text, function (key, value, context) {
41
- // A notice is the object with a subject; its components and updates have none.
42
- if (key === 'id' && this && !Array.isArray(this) && Object.hasOwn(this, 'subject')) {
43
- const lexeme = typeof value === 'string' ? value : context?.source;
44
- if (typeof lexeme !== 'string' || !/^(?:0|[1-9][0-9]{0,127})$/u.test(lexeme)) fail('INVALID_RESPONSE');
45
- ids.push(lexeme);
46
- }
47
- return value;
48
- });
49
- return ids;
50
- }
51
-
52
- /** The bundle Lamp's import door reads for its `sorry` source (door-plan.ts
53
- * `doorExport`): the public page address, the saved responses under the file
54
- * names Lamp's Sorry reader requires, each with its original text, and the
55
- * acknowledgement that they are public. Every response here came from the
56
- * page's own unauthenticated API, so it is public by construction; Lamp still
57
- * refuses any private, unpublished or audience-scoped record, and the owner
58
- * reviews the plan before anything is imported. */
59
- export async function* run(ctx) {
60
- const origin = originOf(ctx.inputs);
61
- const s = ctx.state ?? { phase: 0, page: 1, total: null, rows: 0, notices: [], index: 0 };
62
- shape(s, ['phase', 'page', 'total', 'rows', 'notices', 'index']);
63
- assertCount(s.phase, 4); assertCount(s.page, 50); assertCount(s.rows, 5000); assertCount(s.index, 5000);
64
- if (s.total !== null) assertCount(s.total, 5000);
65
- if (!Array.isArray(s.notices) || s.notices.length > 1250 || s.notices.some(id => typeof id !== 'string' || !/^(?:0|[1-9][0-9]{0,127})$/u.test(id))) fail('INVALID_CHECKPOINT');
66
- const file = (name, text, first = false) => (first ? '' : ',') + JSON.stringify({ name, text });
67
- while (s.phase < 4) {
68
- let bytes;
69
- if (s.phase === 0) {
70
- const { body, text } = await ctx.get('/api/v1/status');
71
- const page = object(object(body).page);
72
- if (typeof page.name !== 'string' || typeof page.url !== 'string') fail();
73
- ctx.records(1);
74
- s.phase = 1;
75
- bytes = JSON.stringify({ source: 'sorry', publicUrl: origin, publicAccessAcknowledged: true }).slice(0, -1) + ',"files":[' + file('sorry-status.json', text, true);
76
- } else if (s.phase <= 2) {
77
- const resource = resources[s.phase - 1], path = `/api/v1/${resource}`;
78
- const { body, text } = await ctx.get(s.page === 1 ? path : `${path}?page=${s.page}`);
79
- object(body); const rows = list(body[resource], 25), meta = object(body.meta);
80
- if (meta.count !== rows.length || !Number.isSafeInteger(meta.total_count) || s.total !== null && meta.total_count !== s.total) fail('INVALID_PAGINATION');
81
- ctx.records(rows.length);
82
- if (resource === 'notices') {
83
- const ids = noticeIds(text);
84
- if (ids.length !== rows.length || ids.some(id => s.notices.includes(id))) fail('DUPLICATE_ID');
85
- s.notices.push(...ids);
86
- }
87
- s.rows += rows.length; s.total = meta.total_count;
88
- const next = nextPage(meta.next_page, path, s.page);
89
- if (s.rows > s.total || Boolean(next) !== s.rows < s.total || next && !rows.length) fail('INVALID_PAGINATION');
90
- bytes = file(`sorry-${resource}${s.page === 1 ? '' : `-${s.page}`}.json`, text);
91
- if (next) { if (++s.page > 50) fail('PAGE_LIMIT'); }
92
- else { s.phase++; s.page = 1; s.total = null; s.rows = 0; }
93
- } else {
94
- if (s.index === s.notices.length) { s.phase = 4; yield ctx.item(']}\n', s); break; }
95
- const id = s.notices[s.index];
96
- const { body, text } = await ctx.get(`/api/v1/notices/${id}`);
97
- const notice = object(object(body).notice);
98
- const ids = noticeIds(text);
99
- if (ids.length !== 1 || ids[0] !== id || !Array.isArray(notice.components) || !Array.isArray(notice.updates)) fail('INVALID_RESPONSE');
100
- ctx.records(1 + notice.updates.length);
101
- bytes = file(`sorry-notice-${id}.json`, text);
102
- s.index++;
103
- }
104
- yield ctx.item(bytes, s);
105
- }
106
- }
@@ -1,21 +0,0 @@
1
- import { object, list, reference, shape, fail, withoutCredentials } from './common.mjs';
2
-
3
- export const origin = 'https://api.uptimerobot.com';
4
- const pagination = ['limit','offset','cursor','page','page_token'];
5
- export const route = url => url.pathname === '/v3/monitors' && [...url.searchParams.keys()].every(x => pagination.includes(x));
6
- export async function* run(ctx) {
7
- const state = ctx.state ?? { next: '/v3/monitors?limit=200', seen: [] };
8
- shape(state, ['next','seen']);
9
- if (!Array.isArray(state.seen) || state.seen.length > 600) fail('INVALID_CHECKPOINT');
10
- state.seen.forEach(value => reference(value, origin, /^\/v3\/monitors$/u, pagination));
11
- while (state.next !== null) {
12
- const url = reference(state.next, origin, /^\/v3\/monitors$/u, pagination);
13
- if (state.seen.includes(url.href)) fail('PAGINATION_CYCLE');
14
- const { body } = await ctx.get(url.href);
15
- object(body); ctx.records(list(body.data).length);
16
- if (!Object.hasOwn(body, 'nextLink')) fail();
17
- state.seen.push(url.href);
18
- state.next = body.nextLink == null ? null : reference(body.nextLink, origin, /^\/v3\/monitors$/u, pagination).href;
19
- yield ctx.item(JSON.stringify(withoutCredentials(body, pagination)) + '\n', state);
20
- }
21
- }