@opengeni/core 6.36.1-canary.45090389523001 → 6.37.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/domain/session-repository-attach.d.ts +12 -1
- package/dist/index.js +158 -34
- package/dist/index.js.map +1 -1
- package/package.json +16 -17
- package/src/app-templates/feedback-board.app.json +40 -0
- package/src/app-templates/incident-log.app.json +35 -0
- package/src/app-templates/index.ts +15 -4
- package/src/app-templates/issue-tracker.app.json +35 -0
- package/src/domain/event-triggers/github-events.ts +2 -0
- package/src/domain/session-repository-attach.ts +17 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RepositoryResourceRef, type Session } from "@opengeni/contracts";
|
|
2
|
-
import { type Database } from "@opengeni/db";
|
|
2
|
+
import { appendSessionEventsWithLockedSessionUpdate, type Database, type RepositoryAttachRequester } from "@opengeni/db";
|
|
3
3
|
import { type EventBus } from "@opengeni/events";
|
|
4
4
|
export declare const SESSION_RESOURCES_ADDED_EVENT: "session.resources.added";
|
|
5
5
|
/** What attaching one repository to a running chat did. */
|
|
@@ -9,6 +9,8 @@ export type SessionRepositoryAttachResult = {
|
|
|
9
9
|
/** True when a person had removed the repository from the chat earlier. */
|
|
10
10
|
reattached: boolean;
|
|
11
11
|
session: Session;
|
|
12
|
+
/** The events written; already published unless the caller deferred them. */
|
|
13
|
+
events: Awaited<ReturnType<typeof appendSessionEventsWithLockedSessionUpdate>>;
|
|
12
14
|
};
|
|
13
15
|
/**
|
|
14
16
|
* Attach one repository to a chat that has already started, on behalf of a
|
|
@@ -30,4 +32,13 @@ export declare function attachSessionRepositoryResource(deps: {
|
|
|
30
32
|
workspaceId: string;
|
|
31
33
|
sessionId: string;
|
|
32
34
|
resource: RepositoryResourceRef;
|
|
35
|
+
}, options?: {
|
|
36
|
+
/** A caller in a transaction publishes the returned events after it commits. */
|
|
37
|
+
deferPublication?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Who asks (default a person). Anyone else, such as the scheduler, can't
|
|
40
|
+
* undo a person's removal: a removed repository throws
|
|
41
|
+
* `SessionRepositoryRemovedError`.
|
|
42
|
+
*/
|
|
43
|
+
requester?: RepositoryAttachRequester;
|
|
33
44
|
}): Promise<SessionRepositoryAttachResult>;
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EDITABLE_ARTIFACT_HINT_MAX_BYTES,
|
|
3
|
-
EDITABLE_ARTIFACT_HINT_SUBJECT_PREFIX,
|
|
4
|
-
EDITABLE_ARTIFACT_LIVE_PROTOCOL_VERSION,
|
|
5
|
-
EDITABLE_ARTIFACT_LIVE_WIRE_VERSION,
|
|
6
|
-
EditableArtifactApplication,
|
|
7
|
-
EditableArtifactCompatibilityError,
|
|
8
|
-
EditableArtifactHintEncodingError,
|
|
9
|
-
EditableArtifactLiveError,
|
|
10
|
-
EditableArtifactLiveOutboxDispatcher,
|
|
11
|
-
EditableArtifactLiveServer,
|
|
12
|
-
EditableArtifactLiveTicketAuthority,
|
|
13
|
-
InMemoryEditableArtifactLiveTicketStore,
|
|
14
|
-
MathEditableArtifactOutboxRandom,
|
|
15
|
-
SystemEditableArtifactLiveClock,
|
|
16
|
-
SystemEditableArtifactLiveScheduler,
|
|
17
|
-
WebCryptoEditableArtifactLiveTokens,
|
|
18
|
-
decodeEditableArtifactBrokerHint,
|
|
19
|
-
decodeEditableArtifactLiveClientWireFrame,
|
|
20
|
-
decodeEditableArtifactLiveServerWireFrame,
|
|
21
|
-
editableArtifactLiveHintSubject,
|
|
22
|
-
encodeEditableArtifactBrokerHint,
|
|
23
|
-
encodeEditableArtifactLiveAppliedWireFrame,
|
|
24
|
-
encodeEditableArtifactLiveMutationWireFrame,
|
|
25
|
-
encodeEditableArtifactLiveOpenWireFrame,
|
|
26
|
-
encodeEditableArtifactLiveServerWireFrame,
|
|
27
|
-
inspectEditableArtifactLiveWireEnvelope
|
|
28
|
-
} from "./chunk-52AHIXY4.js";
|
|
29
1
|
import {
|
|
30
2
|
EDITABLE_ARTIFACT_EXPORT_FORMATS,
|
|
31
3
|
EDITABLE_ARTIFACT_EXPORT_MAX_DOWNLOAD_BYTES,
|
|
@@ -54,6 +26,34 @@ import {
|
|
|
54
26
|
validateEditableArtifactMaterializationJob,
|
|
55
27
|
validateEditableArtifactPinnedVersion
|
|
56
28
|
} from "./chunk-SH5QEVGO.js";
|
|
29
|
+
import {
|
|
30
|
+
EDITABLE_ARTIFACT_HINT_MAX_BYTES,
|
|
31
|
+
EDITABLE_ARTIFACT_HINT_SUBJECT_PREFIX,
|
|
32
|
+
EDITABLE_ARTIFACT_LIVE_PROTOCOL_VERSION,
|
|
33
|
+
EDITABLE_ARTIFACT_LIVE_WIRE_VERSION,
|
|
34
|
+
EditableArtifactApplication,
|
|
35
|
+
EditableArtifactCompatibilityError,
|
|
36
|
+
EditableArtifactHintEncodingError,
|
|
37
|
+
EditableArtifactLiveError,
|
|
38
|
+
EditableArtifactLiveOutboxDispatcher,
|
|
39
|
+
EditableArtifactLiveServer,
|
|
40
|
+
EditableArtifactLiveTicketAuthority,
|
|
41
|
+
InMemoryEditableArtifactLiveTicketStore,
|
|
42
|
+
MathEditableArtifactOutboxRandom,
|
|
43
|
+
SystemEditableArtifactLiveClock,
|
|
44
|
+
SystemEditableArtifactLiveScheduler,
|
|
45
|
+
WebCryptoEditableArtifactLiveTokens,
|
|
46
|
+
decodeEditableArtifactBrokerHint,
|
|
47
|
+
decodeEditableArtifactLiveClientWireFrame,
|
|
48
|
+
decodeEditableArtifactLiveServerWireFrame,
|
|
49
|
+
editableArtifactLiveHintSubject,
|
|
50
|
+
encodeEditableArtifactBrokerHint,
|
|
51
|
+
encodeEditableArtifactLiveAppliedWireFrame,
|
|
52
|
+
encodeEditableArtifactLiveMutationWireFrame,
|
|
53
|
+
encodeEditableArtifactLiveOpenWireFrame,
|
|
54
|
+
encodeEditableArtifactLiveServerWireFrame,
|
|
55
|
+
inspectEditableArtifactLiveWireEnvelope
|
|
56
|
+
} from "./chunk-52AHIXY4.js";
|
|
57
57
|
import {
|
|
58
58
|
EDITABLE_ARTIFACT_COMPACTION_BYTE_THRESHOLD,
|
|
59
59
|
EDITABLE_ARTIFACT_COMPACTION_TRANSACTION_THRESHOLD,
|
|
@@ -32076,6 +32076,8 @@ function repository(payload) {
|
|
|
32076
32076
|
const repo = object(payload.repository);
|
|
32077
32077
|
if (!repo) return null;
|
|
32078
32078
|
return compact({
|
|
32079
|
+
// The id lets a run attach the repository through the App allowlist.
|
|
32080
|
+
id: int(repo.id),
|
|
32079
32081
|
full_name: text(repo.full_name),
|
|
32080
32082
|
name: text(repo.name),
|
|
32081
32083
|
owner: login(repo.owner),
|
|
@@ -41412,8 +41414,129 @@ var decision_log_app_default = {
|
|
|
41412
41414
|
}
|
|
41413
41415
|
};
|
|
41414
41416
|
|
|
41417
|
+
// src/app-templates/feedback-board.app.json
|
|
41418
|
+
var feedback_board_app_default = {
|
|
41419
|
+
key: "feedback-board",
|
|
41420
|
+
name: "Feedback board",
|
|
41421
|
+
description: "Collect feature requests and let the team vote on them.",
|
|
41422
|
+
team: "Product",
|
|
41423
|
+
package: {
|
|
41424
|
+
format: "opengeni.app-package",
|
|
41425
|
+
version: 1,
|
|
41426
|
+
exportedAt: "2026-11-22T00:00:00.000Z",
|
|
41427
|
+
app: {
|
|
41428
|
+
title: "Feedback board",
|
|
41429
|
+
description: "Feature requests and ideas, with votes.",
|
|
41430
|
+
html: "<!doctype html>\n<html lang='en'>\n<head>\n<meta charset='utf-8'>\n<meta name='viewport' content='width=device-width, initial-scale=1'>\n<title>Feedback board</title>\n<link rel='stylesheet' href='/__opengeni/ui.css'>\n<style>\n/* The Opengeni look (/__opengeni/ui.css): its --og-* tokens and og-* classes. */\n.lead { margin: 0 0 20px; }\nform { display: grid; gap: 8px; margin-bottom: 20px; }\nform .og-button-primary { justify-self: start; }\n.row { display: flex; flex-wrap: wrap; gap: 8px; }\n.row > * { flex: 1 1 160px; }\ntextarea.og-input { resize: vertical; }\nnav { margin-bottom: 12px; }\nnav .og-button[aria-pressed='true'] { background: var(--og-surface-2); font-weight: 600; }\nul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }\nli header { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }\nli h2 { margin: 0 0 4px; font-size: 0.9375rem; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }\nli .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }\nli p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }\nli select.og-input { width: auto; flex: none; }\n.vote { display: grid; justify-items: center; gap: 0; min-width: 56px; height: auto; padding: 6px 8px; }\n.vote strong { font-size: 1rem; line-height: 1.25; }\n.vote[aria-pressed='true'] { background: var(--og-primary); border-color: var(--og-primary-edge); color: var(--og-primary-ink); }\n</style>\n</head>\n<body class='og-app'>\n<main class='og-page'>\n<h1 class='og-title'>Feedback board</h1>\n<p class='lead og-muted'>Feature requests and ideas. Vote for the ones that matter to you.</p>\n<form id='add' class='og-card'>\n<input class='og-input' name='title' required maxlength='200' placeholder='Your idea or request' aria-label='Title'>\n<textarea class='og-input' name='details' maxlength='4000' placeholder='Why it matters, who asked for it' aria-label='Details'></textarea>\n<button type='submit' class='og-button og-button-primary'>Add request</button>\n</form>\n<p id='status' class='og-muted' role='status'></p>\n<ul id='list'></ul>\n</main>\n<script src='/__opengeni/site-tools/client.js'></script>\n<script>\nconst STATUSES = [['new', 'New'], ['planned', 'Planned'], ['in_progress', 'In progress'], ['done', 'Done'], ['declined', 'Declined']];\nconst statusLine = document.getElementById('status');\nconst list = document.getElementById('list');\nlet requests = null;\nlet myVotes = null;\nlet data = null;\nlet reloadTimer = null;\nlet reloadPending = false;\ntry {\n data = createOpenGeniSiteClient().data;\n requests = data.collection('requests');\n myVotes = data.collection('votes');\n} catch { statusLine.textContent = 'Open the saved app to keep requests.'; }\nfunction votesLabel(count) { return count === 1 ? 'vote' : 'votes'; }\nfunction render(records, voted, more) {\n list.replaceChildren();\n statusLine.textContent = records.length === 0\n ? 'No requests yet.'\n : [more ? `Showing the ${records.length} most voted.` : '', voted ? '' : 'Voting is unavailable right now.'].filter(Boolean).join(' ');\n for (const record of records) {\n const item = document.createElement('li');\n item.className = 'og-card';\n const header = document.createElement('header');\n header.style.justifyContent = 'flex-start';\n const vote = document.createElement('button');\n vote.type = 'button';\n vote.className = 'og-button vote';\n // The viewer's own vote record for this request, if they voted.\n const mine = voted ? voted.get(record.id) : undefined;\n const total = Math.max(0, Number(record.data.votes) || 0);\n // Without the viewer's own votes we can't tell a vote from a second vote.\n vote.disabled = !voted;\n vote.setAttribute('aria-pressed', String(Boolean(mine)));\n vote.setAttribute('aria-label', `${mine ? 'Remove your vote for' : 'Vote for'} ${record.data.title}, ${total} ${votesLabel(total)}`);\n const count = document.createElement('strong');\n count.textContent = String(total);\n vote.append(count, votesLabel(total));\n vote.addEventListener('click', async () => {\n vote.disabled = true;\n try {\n // The vote and the count change together, or not at all.\n await data.batch(mine\n ? [{ op: 'delete', collection: 'votes', id: mine }, { op: 'increment', collection: 'requests', id: record.id, field: 'votes', by: -1 }]\n : [{ op: 'insert', collection: 'votes', data: { request: record.id } }, { op: 'increment', collection: 'requests', id: record.id, field: 'votes', by: 1 }]);\n await load();\n } catch { statusLine.textContent = 'Couldn\u2019t save your vote. Try again.'; vote.disabled = false; }\n });\n const text = document.createElement('div');\n text.style.flex = '1';\n const title = document.createElement('h2');\n title.textContent = record.data.title;\n const meta = document.createElement('div');\n meta.className = 'meta og-subtle';\n meta.textContent = record.data.added || '';\n text.append(title, meta);\n if (record.data.details) {\n const details = document.createElement('p');\n details.textContent = record.data.details;\n text.append(details);\n }\n const select = document.createElement('select');\n select.className = 'og-input';\n select.setAttribute('aria-label', `Status of ${record.data.title}`);\n for (const [value, label] of STATUSES) select.add(new Option(label, value, false, value === record.data.status));\n select.addEventListener('change', async () => {\n select.disabled = true;\n try { await requests.patch({ id: record.id }, { status: select.value }); await load(); }\n catch { statusLine.textContent = 'Couldn\u2019t change the status. Try again.'; select.disabled = false; }\n });\n header.append(vote, text, select);\n item.append(header);\n list.append(item);\n }\n}\n// All of the viewer's own votes, a page at a time; null when they can't be read.\nasync function ownVotes() {\n try {\n const voted = new Map();\n let cursor = null;\n do {\n const page = await myVotes.list({ scope: 'own', limit: 200, cursor });\n for (const vote of page.records) voted.set(vote.data.request, vote.id);\n cursor = page.nextCursor;\n } while (cursor);\n return voted;\n } catch { return null; }\n}\nasync function load() {\n if (!requests) return;\n try {\n const [page, voted] = await Promise.all([\n requests.list({ sort: [{ field: 'votes', direction: 'desc' }, { field: '$createdAt', direction: 'desc' }], limit: 200 }),\n ownVotes(),\n ]);\n render(page.records, voted, Boolean(page.nextCursor));\n } catch { statusLine.textContent = 'Couldn\u2019t load requests. Try again in a moment.'; }\n}\n// Reload after others' changes, but not while someone is choosing a status here.\nfunction scheduleLoad() {\n clearTimeout(reloadTimer);\n reloadTimer = setTimeout(() => {\n if (list.contains(document.activeElement) && document.activeElement.tagName === 'SELECT') { reloadPending = true; return; }\n void load();\n }, 400);\n}\nlist.addEventListener('focusout', () => { if (reloadPending) { reloadPending = false; scheduleLoad(); } });\ndocument.getElementById('add').addEventListener('submit', async (event) => {\n event.preventDefault();\n if (!requests) return;\n const formEl = event.currentTarget;\n const button = formEl.querySelector('button');\n if (button.disabled) return;\n const form = new FormData(formEl);\n const entry = { title: String(form.get('title')).trim(), details: String(form.get('details')).trim(), status: 'new', votes: 0, added: new Date().toISOString().slice(0, 10) };\n if (!entry.title) return;\n button.disabled = true;\n try { await requests.insert(entry, { idempotencyKey: crypto.randomUUID() }); formEl.reset(); await load(); }\n catch { statusLine.textContent = 'Couldn\u2019t save that request. Try again.'; }\n finally { button.disabled = false; }\n});\nif (requests) requests.onChange(scheduleLoad);\nstatusLine.textContent = requests ? 'Loading\u2026' : statusLine.textContent;\nvoid load();\n</script>\n</body>\n</html>\n"
|
|
41431
|
+
},
|
|
41432
|
+
tools: [],
|
|
41433
|
+
data: {
|
|
41434
|
+
collections: [
|
|
41435
|
+
{
|
|
41436
|
+
name: "requests",
|
|
41437
|
+
accessMode: "shared"
|
|
41438
|
+
},
|
|
41439
|
+
{
|
|
41440
|
+
name: "votes",
|
|
41441
|
+
accessMode: "per_viewer",
|
|
41442
|
+
uniqueFields: [["request"]]
|
|
41443
|
+
}
|
|
41444
|
+
]
|
|
41445
|
+
},
|
|
41446
|
+
sql: {
|
|
41447
|
+
migrations: [],
|
|
41448
|
+
queries: []
|
|
41449
|
+
},
|
|
41450
|
+
syncs: [],
|
|
41451
|
+
sidebar: [
|
|
41452
|
+
{
|
|
41453
|
+
label: "Feedback board"
|
|
41454
|
+
}
|
|
41455
|
+
]
|
|
41456
|
+
}
|
|
41457
|
+
};
|
|
41458
|
+
|
|
41459
|
+
// src/app-templates/incident-log.app.json
|
|
41460
|
+
var incident_log_app_default = {
|
|
41461
|
+
key: "incident-log",
|
|
41462
|
+
name: "Incident log",
|
|
41463
|
+
description: "Log incidents with their impact, timeline and follow-ups.",
|
|
41464
|
+
team: "Engineering",
|
|
41465
|
+
package: {
|
|
41466
|
+
format: "opengeni.app-package",
|
|
41467
|
+
version: 1,
|
|
41468
|
+
exportedAt: "2026-11-22T00:00:00.000Z",
|
|
41469
|
+
app: {
|
|
41470
|
+
title: "Incident log",
|
|
41471
|
+
description: "What broke, who it hit, and the follow-ups.",
|
|
41472
|
+
html: "<!doctype html>\n<html lang='en'>\n<head>\n<meta charset='utf-8'>\n<meta name='viewport' content='width=device-width, initial-scale=1'>\n<title>Incident log</title>\n<link rel='stylesheet' href='/__opengeni/ui.css'>\n<style>\n/* The Opengeni look (/__opengeni/ui.css): its --og-* tokens and og-* classes. */\n.lead { margin: 0 0 20px; }\nform { display: grid; gap: 8px; margin-bottom: 20px; }\nform .og-button-primary { justify-self: start; }\n.row { display: flex; flex-wrap: wrap; gap: 8px; }\n.row > * { flex: 1 1 160px; }\ntextarea.og-input { resize: vertical; }\nnav { margin-bottom: 12px; }\nnav .og-button[aria-pressed='true'] { background: var(--og-surface-2); font-weight: 600; }\nul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }\nli header { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }\nli h2 { margin: 0 0 4px; font-size: 0.9375rem; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }\nli .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }\nli p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }\nli select.og-input { width: auto; flex: none; }\n</style>\n</head>\n<body class='og-app'>\n<main class='og-page'>\n<h1 class='og-title'>Incident log</h1>\n<p class='lead og-muted'>What broke, who it hit, and what we're doing so it doesn't happen again.</p>\n<form id='add' class='og-card'>\n<input class='og-input' name='title' required maxlength='200' placeholder='What happened?' aria-label='Title'>\n<div class='row'>\n<select class='og-input' name='severity' aria-label='Severity'><option value='sev1'>SEV1 \xB7 major outage</option><option value='sev2' selected>SEV2 \xB7 partial impact</option><option value='sev3'>SEV3 \xB7 minor</option></select>\n<input class='og-input' name='lead' maxlength='120' placeholder='Incident lead' aria-label='Incident lead'>\n</div>\n<textarea class='og-input' name='impact' maxlength='4000' placeholder='Impact: who and what was affected' aria-label='Impact'></textarea>\n<button type='submit' class='og-button og-button-primary'>Log incident</button>\n</form>\n<p id='status' class='og-muted' role='status'></p>\n<ul id='list'></ul>\n</main>\n<script src='/__opengeni/site-tools/client.js'></script>\n<script>\nconst STATUSES = [['investigating', 'Investigating'], ['mitigated', 'Mitigated'], ['resolved', 'Resolved']];\nconst statusLine = document.getElementById('status');\nconst list = document.getElementById('list');\nlet incidents = null;\nlet reloadTimer = null;\nlet reloadPending = false;\ntry { incidents = createOpenGeniSiteClient().data.collection('incidents'); } catch { statusLine.textContent = 'Open the saved app to keep incidents.'; }\nfunction field(record, name, placeholder) {\n const area = document.createElement('textarea');\n area.className = 'og-input';\n area.maxLength = 4000;\n area.placeholder = placeholder;\n area.setAttribute('aria-label', `${placeholder} for ${record.data.title}`);\n area.value = record.data[name] || '';\n area.addEventListener('change', async () => {\n try { await incidents.patch({ id: record.id }, { [name]: area.value.trim() }); statusLine.textContent = 'Saved.'; }\n catch { statusLine.textContent = 'Couldn\u2019t save that. Try again.'; }\n });\n return area;\n}\nfunction render(records, more) {\n list.replaceChildren();\n statusLine.textContent = records.length === 0 ? 'No incidents yet.' : more ? `Showing the newest ${records.length}.` : '';\n for (const record of records) {\n const item = document.createElement('li');\n item.className = 'og-card';\n const header = document.createElement('header');\n const text = document.createElement('div');\n const title = document.createElement('h2');\n title.textContent = record.data.title;\n const meta = document.createElement('div');\n meta.className = 'meta og-subtle';\n const chip = document.createElement('span');\n chip.className = `og-badge${record.data.severity === 'sev1' ? ' og-badge-danger' : record.data.severity === 'sev2' ? ' og-badge-warning' : ''}`;\n chip.textContent = String(record.data.severity || 'sev2').toUpperCase();\n meta.append(chip, [record.data.started, record.data.lead].filter(Boolean).join(' \xB7 '));\n text.append(title, meta);\n const select = document.createElement('select');\n select.className = 'og-input';\n select.setAttribute('aria-label', `Status of ${record.data.title}`);\n for (const [value, label] of STATUSES) select.add(new Option(label, value, false, value === record.data.status));\n select.addEventListener('change', async () => {\n select.disabled = true;\n try { await incidents.patch({ id: record.id }, { status: select.value }); await load(); }\n catch { statusLine.textContent = 'Couldn\u2019t change the status. Try again.'; select.disabled = false; }\n });\n header.append(text, select);\n item.append(header);\n if (record.data.impact) {\n const impact = document.createElement('p');\n impact.textContent = record.data.impact;\n item.append(impact);\n }\n const notes = document.createElement('div');\n notes.style.cssText = 'display:grid;gap:8px;margin-top:10px';\n notes.append(field(record, 'timeline', 'Timeline'), field(record, 'followUps', 'Follow-ups'));\n item.append(notes);\n list.append(item);\n }\n}\nasync function load() {\n if (!incidents) return;\n try {\n const page = await incidents.list({ sort: [{ field: '$createdAt', direction: 'desc' }], limit: 200 });\n render(page.records, Boolean(page.nextCursor));\n } catch { statusLine.textContent = 'Couldn\u2019t load incidents. Try again in a moment.'; }\n}\n// Reload after teammates' changes, but not while someone is typing or choosing here.\nfunction scheduleLoad() {\n clearTimeout(reloadTimer);\n reloadTimer = setTimeout(() => {\n if (list.contains(document.activeElement)) { reloadPending = true; return; }\n void load();\n }, 400);\n}\nlist.addEventListener('focusout', () => { if (reloadPending) { reloadPending = false; scheduleLoad(); } });\ndocument.getElementById('add').addEventListener('submit', async (event) => {\n event.preventDefault();\n if (!incidents) return;\n const formEl = event.currentTarget;\n const button = formEl.querySelector('button');\n if (button.disabled) return;\n const form = new FormData(formEl);\n const now = new Date();\n const entry = { title: String(form.get('title')).trim(), severity: String(form.get('severity')), lead: String(form.get('lead')).trim(), impact: String(form.get('impact')).trim(), status: 'investigating', started: `${now.toISOString().slice(0, 16).replace('T', ' ')} UTC`, timeline: '', followUps: '' };\n if (!entry.title) return;\n button.disabled = true;\n try { await incidents.insert(entry, { idempotencyKey: crypto.randomUUID() }); formEl.reset(); await load(); }\n catch { statusLine.textContent = 'Couldn\u2019t log that incident. Try again.'; }\n finally { button.disabled = false; }\n});\nif (incidents) { incidents.onChange(scheduleLoad); statusLine.textContent = 'Loading\u2026'; }\nvoid load();\n</script>\n</body>\n</html>\n"
|
|
41473
|
+
},
|
|
41474
|
+
tools: [],
|
|
41475
|
+
data: {
|
|
41476
|
+
collections: [
|
|
41477
|
+
{
|
|
41478
|
+
name: "incidents",
|
|
41479
|
+
accessMode: "shared"
|
|
41480
|
+
}
|
|
41481
|
+
]
|
|
41482
|
+
},
|
|
41483
|
+
sql: {
|
|
41484
|
+
migrations: [],
|
|
41485
|
+
queries: []
|
|
41486
|
+
},
|
|
41487
|
+
syncs: [],
|
|
41488
|
+
sidebar: [
|
|
41489
|
+
{
|
|
41490
|
+
label: "Incident log"
|
|
41491
|
+
}
|
|
41492
|
+
]
|
|
41493
|
+
}
|
|
41494
|
+
};
|
|
41495
|
+
|
|
41496
|
+
// src/app-templates/issue-tracker.app.json
|
|
41497
|
+
var issue_tracker_app_default = {
|
|
41498
|
+
key: "issue-tracker",
|
|
41499
|
+
name: "Issue tracker",
|
|
41500
|
+
description: "Track bugs and tasks by status, priority and owner.",
|
|
41501
|
+
team: "Engineering",
|
|
41502
|
+
package: {
|
|
41503
|
+
format: "opengeni.app-package",
|
|
41504
|
+
version: 1,
|
|
41505
|
+
exportedAt: "2026-11-22T00:00:00.000Z",
|
|
41506
|
+
app: {
|
|
41507
|
+
title: "Issue tracker",
|
|
41508
|
+
description: "Bugs and tasks, by status, priority and owner.",
|
|
41509
|
+
html: "<!doctype html>\n<html lang='en'>\n<head>\n<meta charset='utf-8'>\n<meta name='viewport' content='width=device-width, initial-scale=1'>\n<title>Issue tracker</title>\n<link rel='stylesheet' href='/__opengeni/ui.css'>\n<style>\n/* The Opengeni look (/__opengeni/ui.css): its --og-* tokens and og-* classes. */\n.lead { margin: 0 0 20px; }\nform { display: grid; gap: 8px; margin-bottom: 20px; }\nform .og-button-primary { justify-self: start; }\n.row { display: flex; flex-wrap: wrap; gap: 8px; }\n.row > * { flex: 1 1 160px; }\ntextarea.og-input { resize: vertical; }\nnav { margin-bottom: 12px; }\nnav .og-button[aria-pressed='true'] { background: var(--og-surface-2); font-weight: 600; }\nul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }\nli header { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }\nli h2 { margin: 0 0 4px; font-size: 0.9375rem; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }\nli .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }\nli p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }\nli select.og-input { width: auto; flex: none; }\n</style>\n</head>\n<body class='og-app'>\n<main class='og-page'>\n<h1 class='og-title'>Issue tracker</h1>\n<p class='lead og-muted'>Bugs and tasks, by status, priority and owner.</p>\n<form id='add' class='og-card'>\n<input class='og-input' name='title' required maxlength='200' placeholder='What needs doing?' aria-label='Title'>\n<textarea class='og-input' name='details' maxlength='4000' placeholder='Details, steps to reproduce, links' aria-label='Details'></textarea>\n<div class='row'>\n<select class='og-input' name='priority' aria-label='Priority'><option value='low'>Low</option><option value='medium' selected>Medium</option><option value='high'>High</option><option value='urgent'>Urgent</option></select>\n<input class='og-input' name='owner' maxlength='120' placeholder='Owner' aria-label='Owner'>\n</div>\n<button type='submit' class='og-button og-button-primary'>Add issue</button>\n</form>\n<nav id='filters' aria-label='Show'></nav>\n<p id='status' class='og-muted' role='status'></p>\n<ul id='list'></ul>\n</main>\n<script src='/__opengeni/site-tools/client.js'></script>\n<script>\nconst STATUSES = [['open', 'Open'], ['in_progress', 'In progress'], ['done', 'Done']];\nconst PRIORITY = { urgent: 0, high: 1, medium: 2, low: 3 };\nconst statusLine = document.getElementById('status');\nconst list = document.getElementById('list');\nconst filters = document.getElementById('filters');\nlet issues = null;\nlet shown = 'open';\nlet all = [];\nlet loaded = false;\nlet more = false;\nlet reloadTimer = null;\nlet reloadPending = false;\ntry { issues = createOpenGeniSiteClient().data.collection('issues'); } catch { statusLine.textContent = 'Open the saved app to keep issues.'; }\nfor (const [value, label] of [...STATUSES, ['all', 'All']]) {\n const button = document.createElement('button');\n button.className = 'og-button';\n button.type = 'button';\n button.dataset.value = value;\n button.addEventListener('click', () => { shown = value; render(); });\n filters.append(button);\n}\nfunction label(value) { return (STATUSES.find(([key]) => key === value) || [value, value])[1]; }\nfunction render() {\n for (const button of filters.children) {\n const value = button.dataset.value;\n const count = value === 'all' ? all.length : all.filter((record) => record.data.status === value).length;\n button.textContent = `${value === 'all' ? 'All' : label(value)} (${count})`;\n button.setAttribute('aria-pressed', String(value === shown));\n }\n const records = all\n .filter((record) => shown === 'all' || record.data.status === shown)\n .sort((a, b) => (PRIORITY[a.data.priority] ?? 9) - (PRIORITY[b.data.priority] ?? 9));\n list.replaceChildren();\n statusLine.textContent = !loaded\n ? (issues ? 'Loading\u2026' : statusLine.textContent)\n : records.length === 0\n ? (all.length === 0 ? 'No issues yet.' : 'Nothing here.')\n : more ? `Showing the newest ${all.length}.` : '';\n for (const record of records) {\n const item = document.createElement('li');\n item.className = 'og-card';\n const header = document.createElement('header');\n const text = document.createElement('div');\n const title = document.createElement('h2');\n title.textContent = record.data.title;\n const meta = document.createElement('div');\n meta.className = 'meta og-subtle';\n const chip = document.createElement('span');\n chip.className = `og-badge${record.data.priority === 'urgent' || record.data.priority === 'high' ? ' og-badge-danger' : ''}`;\n chip.textContent = record.data.priority || 'medium';\n meta.append(chip, [record.data.owner, record.data.opened].filter(Boolean).join(' \xB7 '));\n text.append(title, meta);\n const select = document.createElement('select');\n select.className = 'og-input';\n select.setAttribute('aria-label', `Status of ${record.data.title}`);\n for (const [value, text] of STATUSES) select.add(new Option(text, value, false, value === record.data.status));\n select.addEventListener('change', async () => {\n select.disabled = true;\n try { await issues.patch({ id: record.id }, { status: select.value }); await load(); }\n catch { statusLine.textContent = 'Couldn\u2019t change the status. Try again.'; select.disabled = false; }\n });\n header.append(text, select);\n item.append(header);\n if (record.data.details) {\n const details = document.createElement('p');\n details.textContent = record.data.details;\n item.append(details);\n }\n list.append(item);\n }\n}\nasync function load() {\n if (!issues) return;\n try {\n // Pages of 200, up to 2,000 issues.\n const records = [];\n let cursor = null;\n do {\n const page = await issues.list({ sort: [{ field: '$createdAt', direction: 'desc' }], limit: 200, cursor });\n records.push(...page.records);\n cursor = page.nextCursor;\n } while (cursor && records.length < 2000);\n all = records;\n more = Boolean(cursor);\n loaded = true;\n render();\n } catch { statusLine.textContent = 'Couldn\u2019t load issues. Try again in a moment.'; }\n}\n// Reload after teammates' changes, but not while someone is choosing a status here.\nfunction scheduleLoad() {\n clearTimeout(reloadTimer);\n reloadTimer = setTimeout(() => {\n if (list.contains(document.activeElement) && document.activeElement.tagName === 'SELECT') { reloadPending = true; return; }\n void load();\n }, 400);\n}\nlist.addEventListener('focusout', () => { if (reloadPending) { reloadPending = false; scheduleLoad(); } });\ndocument.getElementById('add').addEventListener('submit', async (event) => {\n event.preventDefault();\n if (!issues) return;\n const formEl = event.currentTarget;\n const button = formEl.querySelector('button');\n if (button.disabled) return;\n const form = new FormData(formEl);\n const entry = { title: String(form.get('title')).trim(), details: String(form.get('details')).trim(), priority: String(form.get('priority')), owner: String(form.get('owner')).trim(), status: 'open', opened: new Date().toISOString().slice(0, 10) };\n if (!entry.title) return;\n button.disabled = true;\n try { await issues.insert(entry, { idempotencyKey: crypto.randomUUID() }); formEl.reset(); shown = 'open'; await load(); }\n catch { statusLine.textContent = 'Couldn\u2019t save that issue. Try again.'; }\n finally { button.disabled = false; }\n});\nif (issues) issues.onChange(scheduleLoad);\nrender();\nvoid load();\n</script>\n</body>\n</html>\n"
|
|
41510
|
+
},
|
|
41511
|
+
tools: [],
|
|
41512
|
+
data: {
|
|
41513
|
+
collections: [
|
|
41514
|
+
{
|
|
41515
|
+
name: "issues",
|
|
41516
|
+
accessMode: "shared"
|
|
41517
|
+
}
|
|
41518
|
+
]
|
|
41519
|
+
},
|
|
41520
|
+
sql: {
|
|
41521
|
+
migrations: [],
|
|
41522
|
+
queries: []
|
|
41523
|
+
},
|
|
41524
|
+
syncs: [],
|
|
41525
|
+
sidebar: [
|
|
41526
|
+
{
|
|
41527
|
+
label: "Issue tracker"
|
|
41528
|
+
}
|
|
41529
|
+
]
|
|
41530
|
+
}
|
|
41531
|
+
};
|
|
41532
|
+
|
|
41415
41533
|
// src/app-templates/index.ts
|
|
41416
|
-
var APP_TEMPLATE_FILES = [
|
|
41534
|
+
var APP_TEMPLATE_FILES = [
|
|
41535
|
+
issue_tracker_app_default,
|
|
41536
|
+
incident_log_app_default,
|
|
41537
|
+
feedback_board_app_default,
|
|
41538
|
+
decision_log_app_default
|
|
41539
|
+
];
|
|
41417
41540
|
var parsed2;
|
|
41418
41541
|
function appTemplates() {
|
|
41419
41542
|
parsed2 ??= APP_TEMPLATE_FILES.flatMap((file) => {
|
|
@@ -42278,12 +42401,12 @@ import {
|
|
|
42278
42401
|
import { publishDurableSessionEvents as publishDurableSessionEvents6 } from "@opengeni/events";
|
|
42279
42402
|
import { HTTPException as HTTPException53 } from "hono/http-exception";
|
|
42280
42403
|
var SESSION_RESOURCES_ADDED_EVENT = "session.resources.added";
|
|
42281
|
-
async function attachSessionRepositoryResource(deps, input) {
|
|
42404
|
+
async function attachSessionRepositoryResource(deps, input, options = {}) {
|
|
42282
42405
|
const { workspaceId, sessionId, resource } = input;
|
|
42283
42406
|
const current = await requireSession5(deps.db, workspaceId, sessionId);
|
|
42284
42407
|
assertSessionIsNotImported4(current);
|
|
42285
42408
|
if (resourcesIncludeRepository2(current.resources, resource.uri)) {
|
|
42286
|
-
return { attached: false, reattached: false, session: current };
|
|
42409
|
+
return { attached: false, reattached: false, session: current, events: [] };
|
|
42287
42410
|
}
|
|
42288
42411
|
await validateGitHubRepositorySelection(deps.db, workspaceId, [resource]);
|
|
42289
42412
|
let attached = false;
|
|
@@ -42306,7 +42429,7 @@ async function attachSessionRepositoryResource(deps, input) {
|
|
|
42306
42429
|
const admission = admitRequestedRepositories({
|
|
42307
42430
|
removedRepositories: session.removedRepositories ?? [],
|
|
42308
42431
|
requested: [resource],
|
|
42309
|
-
requester: "person"
|
|
42432
|
+
requester: options.requester ?? "person"
|
|
42310
42433
|
});
|
|
42311
42434
|
attached = true;
|
|
42312
42435
|
reattached = admission.changed;
|
|
@@ -42325,13 +42448,14 @@ async function attachSessionRepositoryResource(deps, input) {
|
|
|
42325
42448
|
},
|
|
42326
42449
|
{ activity: "semantic" }
|
|
42327
42450
|
);
|
|
42328
|
-
if (events.length > 0) {
|
|
42451
|
+
if (events.length > 0 && !options.deferPublication) {
|
|
42329
42452
|
await publishDurableSessionEvents6(deps.bus, workspaceId, sessionId, events);
|
|
42330
42453
|
}
|
|
42331
42454
|
return {
|
|
42332
42455
|
attached,
|
|
42333
42456
|
reattached,
|
|
42334
|
-
session: attached ? await requireSession5(deps.db, workspaceId, sessionId) : current
|
|
42457
|
+
session: attached ? await requireSession5(deps.db, workspaceId, sessionId) : current,
|
|
42458
|
+
events
|
|
42335
42459
|
};
|
|
42336
42460
|
}
|
|
42337
42461
|
|