@hanzo/dev 4.0.1 → 4.1.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/dist/{BinaryViewer-qn8xfPZp.js → BinaryViewer-CmFUK4zZ.js} +2 -2
- package/dist/{ChatMarkdown-Cyujn3JJ.js → ChatMarkdown-nvEI7iCv.js} +4 -4
- package/dist/{DiffCommentAnnotation-BZu1TP6E.js → DiffCommentAnnotation-BPTN_2a6.js} +1 -1
- package/dist/{DiffFileTree-CcJ91zOM.js → DiffFileTree-B_br90vY.js} +2 -2
- package/dist/{DiffPanel-BXC88NMs.js → DiffPanel-V5R5TPuK.js} +5 -5
- package/dist/{ExpandedImageDialog-BZnGRBJR.js → ExpandedImageDialog-CAorLacL.js} +1 -1
- package/dist/{FileExplorerPane-vBJS6V75.js → FileExplorerPane-CeHulcPz.js} +1 -1
- package/dist/{FilePreviewPanel-jJHWsMzm.js → FilePreviewPanel-BVNLvWOc.js} +8 -8
- package/dist/{MermaidDiagram-paNwQY33.js → MermaidDiagram-CTolIzQD.js} +1 -1
- package/dist/{MermaidFilePreview-B9KxfnIN.js → MermaidFilePreview-CP2zP4FU.js} +1 -1
- package/dist/{MermaidViewer-CAEGpLyD.js → MermaidViewer-BDfYkS9E.js} +2 -2
- package/dist/{NotebookPreview-D01mMCpR.js → NotebookPreview-Cybs5uM0.js} +1 -1
- package/dist/{OfficeFilePreview-DWaRgfQU.js → OfficeFilePreview-7JsmSoKU.js} +1 -1
- package/dist/{OfficeViewer-BudrZbBA.js → OfficeViewer-CJoojlJK.js} +1 -1
- package/dist/{OpenInPicker-Dd3ifHa1.js → OpenInPicker-BIMWUxBP.js} +7 -7
- package/dist/{OpenXmlOfficeViewer-CXcKdq7k.js → OpenXmlOfficeViewer-C24Kj8DM.js} +1 -1
- package/dist/{PreviewImage-C4Ku4z7v.js → PreviewImage-oY5YnuTr.js} +1 -1
- package/dist/{PreviewImageContent-BwOB9Lyd.js → PreviewImageContent-n6eLzY99.js} +1 -1
- package/dist/{PullRequestCodeTab-BcwyMk7d.js → PullRequestCodeTab-Dv_0kVad.js} +7 -7
- package/dist/{PullRequestReviewAnnotation-BU5t_1fC.js → PullRequestReviewAnnotation-LeuwO-iH.js} +4 -4
- package/dist/builder/activity.d.ts +16 -0
- package/dist/builder/activity.js +51 -0
- package/dist/builder/address.d.ts +11 -0
- package/dist/builder/address.js +50 -0
- package/dist/builder/ago.d.ts +2 -0
- package/dist/builder/ago.js +18 -0
- package/dist/builder/api/agents.d.ts +139 -0
- package/dist/builder/api/agents.js +253 -0
- package/dist/builder/api/auto.d.ts +166 -0
- package/dist/builder/api/auto.js +300 -0
- package/dist/builder/api/billing.d.ts +263 -0
- package/dist/builder/api/billing.js +401 -0
- package/dist/builder/api/call.d.ts +53 -0
- package/dist/builder/api/call.js +123 -0
- package/dist/builder/api/capabilities.d.ts +14 -0
- package/dist/builder/api/capabilities.js +41 -0
- package/dist/builder/api/changes.d.ts +74 -0
- package/dist/builder/api/changes.js +75 -0
- package/dist/builder/api/chat.d.ts +12 -0
- package/dist/builder/api/chat.js +28 -0
- package/dist/builder/api/cli.d.ts +59 -0
- package/dist/builder/api/cli.js +133 -0
- package/dist/builder/api/codebases.d.ts +46 -0
- package/dist/builder/api/codebases.js +100 -0
- package/dist/builder/api/coding.d.ts +117 -0
- package/dist/builder/api/coding.js +222 -0
- package/dist/builder/api/connectors.d.ts +76 -0
- package/dist/builder/api/connectors.js +111 -0
- package/dist/builder/api/consent.d.ts +22 -0
- package/dist/builder/api/consent.js +28 -0
- package/dist/builder/api/conversations.d.ts +20 -0
- package/dist/builder/api/conversations.js +23 -0
- package/dist/builder/api/draft.d.ts +38 -0
- package/dist/builder/api/draft.js +87 -0
- package/dist/builder/api/environment.d.ts +55 -0
- package/dist/builder/api/environment.js +126 -0
- package/dist/builder/api/gallery.d.ts +32 -0
- package/dist/builder/api/gallery.js +85 -0
- package/dist/builder/api/git.d.ts +31 -0
- package/dist/builder/api/git.js +47 -0
- package/dist/builder/api/github.d.ts +176 -0
- package/dist/builder/api/github.js +271 -0
- package/dist/builder/api/keys.d.ts +35 -0
- package/dist/builder/api/keys.js +72 -0
- package/dist/builder/api/library.d.ts +116 -0
- package/dist/builder/api/library.js +214 -0
- package/dist/builder/api/limits.d.ts +69 -0
- package/dist/builder/api/limits.js +86 -0
- package/dist/builder/api/links.d.ts +51 -0
- package/dist/builder/api/links.js +75 -0
- package/dist/builder/api/machines.d.ts +122 -0
- package/dist/builder/api/machines.js +238 -0
- package/dist/builder/api/mcp.d.ts +10 -0
- package/dist/builder/api/mcp.js +47 -0
- package/dist/builder/api/members.d.ts +35 -0
- package/dist/builder/api/members.js +95 -0
- package/dist/builder/api/memory.d.ts +14 -0
- package/dist/builder/api/memory.js +35 -0
- package/dist/builder/api/models.d.ts +17 -0
- package/dist/builder/api/models.js +20 -0
- package/dist/builder/api/places.d.ts +32 -0
- package/dist/builder/api/places.js +29 -0
- package/dist/builder/api/platform.d.ts +68 -0
- package/dist/builder/api/platform.js +87 -0
- package/dist/builder/api/plugins.d.ts +42 -0
- package/dist/builder/api/plugins.js +175 -0
- package/dist/builder/api/pref.d.ts +77 -0
- package/dist/builder/api/pref.js +93 -0
- package/dist/builder/api/profile.d.ts +11 -0
- package/dist/builder/api/profile.js +41 -0
- package/dist/builder/api/projects.d.ts +99 -0
- package/dist/builder/api/projects.js +166 -0
- package/dist/builder/api/provider.d.ts +49 -0
- package/dist/builder/api/provider.js +96 -0
- package/dist/builder/api/sandbox.d.ts +90 -0
- package/dist/builder/api/sandbox.js +223 -0
- package/dist/builder/api/sessions.d.ts +123 -0
- package/dist/builder/api/sessions.js +255 -0
- package/dist/builder/api/skills.d.ts +82 -0
- package/dist/builder/api/skills.js +117 -0
- package/dist/builder/api/sse.d.ts +24 -0
- package/dist/builder/api/sse.js +68 -0
- package/dist/builder/api/studio.d.ts +59 -0
- package/dist/builder/api/studio.js +91 -0
- package/dist/builder/api/talk.d.ts +48 -0
- package/dist/builder/api/talk.js +81 -0
- package/dist/builder/api/tools.d.ts +34 -0
- package/dist/builder/api/tools.js +37 -0
- package/dist/builder/api/turn.d.ts +202 -0
- package/dist/builder/api/turn.js +772 -0
- package/dist/builder/api/verdict.d.ts +3 -0
- package/dist/builder/api/verdict.js +21 -0
- package/dist/builder/api/webhooks.d.ts +47 -0
- package/dist/builder/api/webhooks.js +82 -0
- package/dist/builder/api/work.d.ts +110 -0
- package/dist/builder/api/work.js +218 -0
- package/dist/builder/ask.d.ts +51 -0
- package/dist/builder/ask.js +147 -0
- package/dist/builder/automations.d.ts +33 -0
- package/dist/builder/automations.js +453 -0
- package/dist/builder/awake.d.ts +24 -0
- package/dist/builder/awake.js +68 -0
- package/dist/builder/back.d.ts +30 -0
- package/dist/builder/back.js +105 -0
- package/dist/builder/builder.d.ts +12 -0
- package/dist/builder/builder.js +162 -0
- package/dist/builder/carry.d.ts +48 -0
- package/dist/builder/carry.js +278 -0
- package/dist/builder/choice.d.ts +134 -0
- package/dist/builder/choice.js +152 -0
- package/dist/builder/claims.d.ts +13 -0
- package/dist/builder/claims.js +35 -0
- package/dist/builder/clipboard.d.ts +2 -0
- package/dist/builder/clipboard.js +10 -0
- package/dist/builder/customize/agents.d.ts +11 -0
- package/dist/builder/customize/agents.js +513 -0
- package/dist/builder/customize/connectors.d.ts +2 -0
- package/dist/builder/customize/connectors.js +319 -0
- package/dist/builder/customize/drafted.d.ts +4 -0
- package/dist/builder/customize/drafted.js +92 -0
- package/dist/builder/customize/index.d.ts +8 -0
- package/dist/builder/customize/index.js +127 -0
- package/dist/builder/customize/inventory.d.ts +14 -0
- package/dist/builder/customize/inventory.js +127 -0
- package/dist/builder/customize/load.d.ts +9 -0
- package/dist/builder/customize/load.js +22 -0
- package/dist/builder/customize/ocean.d.ts +41 -0
- package/dist/builder/customize/ocean.js +332 -0
- package/dist/builder/customize/plugins.d.ts +2 -0
- package/dist/builder/customize/plugins.js +136 -0
- package/dist/builder/customize/roles.d.ts +4 -0
- package/dist/builder/customize/roles.js +105 -0
- package/dist/builder/customize/say.d.ts +13 -0
- package/dist/builder/customize/say.js +32 -0
- package/dist/builder/customize/skills.d.ts +2 -0
- package/dist/builder/customize/skills.js +208 -0
- package/dist/builder/customize/ui.d.ts +152 -0
- package/dist/builder/customize/ui.js +208 -0
- package/dist/builder/data.d.ts +57 -0
- package/dist/builder/data.js +322 -0
- package/dist/builder/design.d.ts +140 -0
- package/dist/builder/design.js +175 -0
- package/dist/builder/desk.d.ts +48 -0
- package/dist/builder/desk.js +449 -0
- package/dist/builder/dev-mode.d.ts +43 -0
- package/dist/builder/dev-mode.js +120 -0
- package/dist/builder/door.d.ts +11 -0
- package/dist/builder/door.js +126 -0
- package/dist/builder/environment.d.ts +23 -0
- package/dist/builder/environment.js +193 -0
- package/dist/builder/files.d.ts +23 -0
- package/dist/builder/files.js +175 -0
- package/dist/builder/find.d.ts +7 -0
- package/dist/builder/find.js +80 -0
- package/dist/builder/foot.d.ts +30 -0
- package/dist/builder/foot.js +79 -0
- package/dist/builder/forge.d.ts +4 -0
- package/dist/builder/forge.js +570 -0
- package/dist/builder/gear.d.ts +60 -0
- package/dist/builder/gear.js +180 -0
- package/dist/builder/git.d.ts +21 -0
- package/dist/builder/git.js +118 -0
- package/dist/builder/gutter.d.ts +17 -0
- package/dist/builder/gutter.js +25 -0
- package/dist/builder/handoff.d.ts +8 -0
- package/dist/builder/handoff.js +22 -0
- package/dist/builder/host.d.ts +189 -0
- package/dist/builder/host.js +46 -0
- package/dist/builder/index.d.ts +108 -0
- package/dist/builder/index.js +99 -0
- package/dist/builder/landing.d.ts +34 -0
- package/dist/builder/landing.js +725 -0
- package/dist/builder/library.d.ts +21 -0
- package/dist/builder/library.js +526 -0
- package/dist/builder/local.d.ts +80 -0
- package/dist/builder/local.js +124 -0
- package/dist/builder/make.d.ts +10 -0
- package/dist/builder/make.js +120 -0
- package/dist/builder/markdown.d.ts +49 -0
- package/dist/builder/markdown.js +125 -0
- package/dist/builder/marks.d.ts +15 -0
- package/dist/builder/marks.js +18 -0
- package/dist/builder/merge.d.ts +223 -0
- package/dist/builder/merge.js +380 -0
- package/dist/builder/meter.d.ts +31 -0
- package/dist/builder/meter.js +54 -0
- package/dist/builder/mind.d.ts +107 -0
- package/dist/builder/mind.js +335 -0
- package/dist/builder/names.d.ts +40 -0
- package/dist/builder/names.js +189 -0
- package/dist/builder/nav.d.ts +28 -0
- package/dist/builder/nav.js +218 -0
- package/dist/builder/out.d.ts +16 -0
- package/dist/builder/out.js +24 -0
- package/dist/builder/page.d.ts +55 -0
- package/dist/builder/page.js +217 -0
- package/dist/builder/pane.d.ts +30 -0
- package/dist/builder/pane.js +21 -0
- package/dist/builder/panel.d.ts +101 -0
- package/dist/builder/panel.js +408 -0
- package/dist/builder/pdf.d.ts +139 -0
- package/dist/builder/pdf.js +847 -0
- package/dist/builder/pick.d.ts +10 -0
- package/dist/builder/pick.js +38 -0
- package/dist/builder/plain.d.ts +59 -0
- package/dist/builder/plain.js +209 -0
- package/dist/builder/plan.d.ts +63 -0
- package/dist/builder/plan.js +155 -0
- package/dist/builder/plans.d.ts +1 -0
- package/dist/builder/plans.js +157 -0
- package/dist/builder/plugin.d.ts +60 -0
- package/dist/builder/plugin.js +1 -0
- package/dist/builder/plugins/design.d.ts +8 -0
- package/dist/builder/plugins/design.js +71 -0
- package/dist/builder/plugins/index.d.ts +46 -0
- package/dist/builder/plugins/index.js +117 -0
- package/dist/builder/plugins/pdf.d.ts +18 -0
- package/dist/builder/plugins/pdf.js +83 -0
- package/dist/builder/plugins/project.d.ts +5 -0
- package/dist/builder/plugins/project.js +68 -0
- package/dist/builder/plugins/research.d.ts +24 -0
- package/dist/builder/plugins/research.js +147 -0
- package/dist/builder/plugins/sketch.d.ts +9 -0
- package/dist/builder/plugins/sketch.js +101 -0
- package/dist/builder/plugins/slides.d.ts +14 -0
- package/dist/builder/plugins/slides.js +55 -0
- package/dist/builder/plugins/template.d.ts +13 -0
- package/dist/builder/plugins/template.js +95 -0
- package/dist/builder/prefs.d.ts +29 -0
- package/dist/builder/prefs.js +91 -0
- package/dist/builder/preview-url.d.ts +47 -0
- package/dist/builder/preview-url.js +107 -0
- package/dist/builder/project.d.ts +18 -0
- package/dist/builder/project.js +591 -0
- package/dist/builder/prose.d.ts +4 -0
- package/dist/builder/prose.js +57 -0
- package/dist/builder/publish.d.ts +18 -0
- package/dist/builder/publish.js +141 -0
- package/dist/builder/question.d.ts +33 -0
- package/dist/builder/question.js +64 -0
- package/dist/builder/redesign.d.ts +32 -0
- package/dist/builder/redesign.js +117 -0
- package/dist/builder/removal.d.ts +71 -0
- package/dist/builder/removal.js +73 -0
- package/dist/builder/reply.d.ts +50 -0
- package/dist/builder/reply.js +196 -0
- package/dist/builder/roles.d.ts +10 -0
- package/dist/builder/roles.js +28 -0
- package/dist/builder/route.d.ts +85 -0
- package/dist/builder/route.js +126 -0
- package/dist/builder/run.d.ts +4 -0
- package/dist/builder/run.js +804 -0
- package/dist/builder/runmeta.d.ts +16 -0
- package/dist/builder/runmeta.js +69 -0
- package/dist/builder/say.d.ts +2 -0
- package/dist/builder/say.js +7 -0
- package/dist/builder/scheduled.d.ts +3 -0
- package/dist/builder/scheduled.js +328 -0
- package/dist/builder/section.d.ts +27 -0
- package/dist/builder/section.js +60 -0
- package/dist/builder/settings/account.d.ts +1 -0
- package/dist/builder/settings/account.js +111 -0
- package/dist/builder/settings/billing.d.ts +1 -0
- package/dist/builder/settings/billing.js +210 -0
- package/dist/builder/settings/capabilities.d.ts +1 -0
- package/dist/builder/settings/capabilities.js +66 -0
- package/dist/builder/settings/card.d.ts +31 -0
- package/dist/builder/settings/card.js +140 -0
- package/dist/builder/settings/code.d.ts +1 -0
- package/dist/builder/settings/code.js +70 -0
- package/dist/builder/settings/credits.d.ts +10 -0
- package/dist/builder/settings/credits.js +123 -0
- package/dist/builder/settings/environments.d.ts +1 -0
- package/dist/builder/settings/environments.js +60 -0
- package/dist/builder/settings/general.d.ts +1 -0
- package/dist/builder/settings/general.js +58 -0
- package/dist/builder/settings/index.d.ts +4 -0
- package/dist/builder/settings/index.js +25 -0
- package/dist/builder/settings/integrations.d.ts +8 -0
- package/dist/builder/settings/integrations.js +138 -0
- package/dist/builder/settings/keys.d.ts +1 -0
- package/dist/builder/settings/keys.js +114 -0
- package/dist/builder/settings/list.d.ts +10 -0
- package/dist/builder/settings/list.js +28 -0
- package/dist/builder/settings/machines.d.ts +4 -0
- package/dist/builder/settings/machines.js +243 -0
- package/dist/builder/settings/members.d.ts +1 -0
- package/dist/builder/settings/members.js +77 -0
- package/dist/builder/settings/memory.d.ts +1 -0
- package/dist/builder/settings/memory.js +62 -0
- package/dist/builder/settings/notifications.d.ts +1 -0
- package/dist/builder/settings/notifications.js +111 -0
- package/dist/builder/settings/plan.d.ts +17 -0
- package/dist/builder/settings/plan.js +131 -0
- package/dist/builder/settings/privacy.d.ts +1 -0
- package/dist/builder/settings/privacy.js +76 -0
- package/dist/builder/settings/sections.d.ts +16 -0
- package/dist/builder/settings/sections.js +34 -0
- package/dist/builder/settings/shared.d.ts +6 -0
- package/dist/builder/settings/shared.js +58 -0
- package/dist/builder/settings/ui.d.ts +50 -0
- package/dist/builder/settings/ui.js +53 -0
- package/dist/builder/settings/usage.d.ts +1 -0
- package/dist/builder/settings/usage.js +24 -0
- package/dist/builder/shared.d.ts +26 -0
- package/dist/builder/shared.js +15 -0
- package/dist/builder/shelf.d.ts +16 -0
- package/dist/builder/shelf.js +219 -0
- package/dist/builder/side.d.ts +40 -0
- package/dist/builder/side.js +208 -0
- package/dist/builder/site.d.ts +75 -0
- package/dist/builder/site.js +138 -0
- package/dist/builder/spend.d.ts +21 -0
- package/dist/builder/spend.js +80 -0
- package/dist/builder/standing.d.ts +36 -0
- package/dist/builder/standing.js +66 -0
- package/dist/builder/suggest.d.ts +238 -0
- package/dist/builder/suggest.js +463 -0
- package/dist/builder/suggestions.d.ts +49 -0
- package/dist/builder/suggestions.js +260 -0
- package/dist/builder/summary.d.ts +60 -0
- package/dist/builder/summary.js +81 -0
- package/dist/builder/sync.d.ts +1 -0
- package/dist/builder/sync.js +164 -0
- package/dist/builder/tabs.d.ts +85 -0
- package/dist/builder/tabs.js +288 -0
- package/dist/builder/talk.d.ts +5 -0
- package/dist/builder/talk.js +108 -0
- package/dist/builder/thread.d.ts +60 -0
- package/dist/builder/thread.js +302 -0
- package/dist/builder/tools.d.ts +22 -0
- package/dist/builder/tools.js +52 -0
- package/dist/builder/transcript.d.ts +47 -0
- package/dist/builder/transcript.js +108 -0
- package/dist/builder/voice.d.ts +8 -0
- package/dist/builder/voice.js +24 -0
- package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
- package/dist/core.js +1 -0
- package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
- package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
- package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
- package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
- package/package.json +101 -11
- /package/{index.d.ts → dist/core.d.ts} +0 -0
- /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub, as the platform's GitHub App sees it for the signed-in person.
|
|
3
|
+
*
|
|
4
|
+
* GET /v1/provider/github/repos?q=&owner=&limit=&after= most recently pushed first
|
|
5
|
+
* GET /v1/provider/github/repos/{owner}/{repo}/branches?q=&limit=&after= default first
|
|
6
|
+
* GET /v1/provider/github/user the person's own connection
|
|
7
|
+
* POST /v1/provider/github/user/connect {return} → {authorizeUrl}
|
|
8
|
+
* POST /v1/provider/github/user/complete {grant} → the connection
|
|
9
|
+
* POST /v1/provider/github/user/disconnect
|
|
10
|
+
* GET /v1/provider/github/installations the accounts this org has bound the App on (`added` narrows to them)
|
|
11
|
+
* POST /v1/provider/github/issues/backfill {state, repo?} → mirror GitHub issues onto the board
|
|
12
|
+
*
|
|
13
|
+
* Paged by an opaque `after` cursor; `next` is the cursor for the page after
|
|
14
|
+
* this one, or empty on the last. Rows are read defensively: a field the
|
|
15
|
+
* platform left out is an empty value here, never `undefined` in a label.
|
|
16
|
+
*
|
|
17
|
+
* `connected` false with repositories is an org admin seeing the org's
|
|
18
|
+
* installations; false with none is the cue to connect. GitHub returns a
|
|
19
|
+
* connecting person to the page the connect named as its return (a Hanzo app
|
|
20
|
+
* page; the console's /connectors otherwise) with `?complete=github&grant=<id>`,
|
|
21
|
+
* and that page completes it (`complete`, and `landed` in ../back.ts).
|
|
22
|
+
*/
|
|
23
|
+
import { phrase } from '@hanzo/i18n';
|
|
24
|
+
import { call, query, seg } from './call.js';
|
|
25
|
+
import { codebases } from './codebases.js';
|
|
26
|
+
import { links } from './links.js';
|
|
27
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
28
|
+
const num = (v) => (typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
29
|
+
const obj = (v) => v && typeof v === 'object' ? v : {};
|
|
30
|
+
export function repo(raw) {
|
|
31
|
+
const r = obj(raw);
|
|
32
|
+
const owner = str(r.owner);
|
|
33
|
+
const name = str(r.name);
|
|
34
|
+
return {
|
|
35
|
+
owner,
|
|
36
|
+
name,
|
|
37
|
+
full_name: str(r.full_name) || (owner && name ? `${owner}/${name}` : name),
|
|
38
|
+
private: r.private === true,
|
|
39
|
+
default_branch: str(r.default_branch),
|
|
40
|
+
pushed_at: str(r.pushed_at),
|
|
41
|
+
installation_id: num(r.installation_id),
|
|
42
|
+
codebase: str(r.codebase),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function branch(raw) {
|
|
46
|
+
const b = obj(raw);
|
|
47
|
+
return { name: str(b.name), commit: str(b.commit), default: b.default === true };
|
|
48
|
+
}
|
|
49
|
+
export async function repos(t, p = {}, signal) {
|
|
50
|
+
const raw = obj(await call(t, 'GET', `/v1/provider/github/repos${query({ q: p.q?.trim(), owner: p.owner, limit: p.limit ?? 50, after: p.after })}`, undefined, { signal }));
|
|
51
|
+
return {
|
|
52
|
+
repos: (Array.isArray(raw.repos) ? raw.repos : []).map(repo).filter((r) => r.name),
|
|
53
|
+
next: str(raw.next),
|
|
54
|
+
total: num(raw.total),
|
|
55
|
+
unread: (Array.isArray(raw.unread) ? raw.unread : []).filter((x) => typeof x === 'string'),
|
|
56
|
+
connected: raw.connected === true,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export async function branches(t, owner, name, p = {}, signal) {
|
|
60
|
+
const raw = obj(await call(t, 'GET', `/v1/provider/github/repos/${seg(owner)}/${seg(name)}/branches${query({ q: p.q?.trim(), limit: p.limit ?? 50, after: p.after })}`, undefined, { signal }));
|
|
61
|
+
return {
|
|
62
|
+
branches: (Array.isArray(raw.branches) ? raw.branches : []).map(branch).filter((b) => b.name),
|
|
63
|
+
next: str(raw.next),
|
|
64
|
+
total: num(raw.total),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function own(raw) {
|
|
68
|
+
const c = obj(raw);
|
|
69
|
+
return { configured: c.configured === true, connected: c.connected === true, login: str(c.login) };
|
|
70
|
+
}
|
|
71
|
+
export async function connection(t) {
|
|
72
|
+
return own(await call(t, 'GET', '/v1/provider/github/user'));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Where to send the person to authorize the platform's GitHub App — github.com
|
|
76
|
+
* only. `back` is the page GitHub's return lands on; the platform keeps it only
|
|
77
|
+
* when it is a Hanzo app page.
|
|
78
|
+
*/
|
|
79
|
+
export async function connect(t, back) {
|
|
80
|
+
const raw = obj(await call(t, 'POST', '/v1/provider/github/user/connect', back ? { return: back } : undefined));
|
|
81
|
+
const url = str(raw.authorizeUrl);
|
|
82
|
+
if (!/^https:\/\/github\.com\//.test(url))
|
|
83
|
+
throw new Error(phrase('The platform did not name a GitHub address to connect at'));
|
|
84
|
+
return url;
|
|
85
|
+
}
|
|
86
|
+
/** Finish the connect GitHub's return handed this page as `grant`. */
|
|
87
|
+
export async function complete(t, grant) {
|
|
88
|
+
return own(await call(t, 'POST', '/v1/provider/github/user/complete', { grant }));
|
|
89
|
+
}
|
|
90
|
+
export async function disconnect(t) {
|
|
91
|
+
await call(t, 'POST', '/v1/provider/github/user/disconnect');
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Said on the window when this page changes the GitHub connection (a connect
|
|
95
|
+
* finished, a link or an App account let go), so every surface showing it
|
|
96
|
+
* reads it again: Projects' line, Settings' Integrations, and the Hanzo app's
|
|
97
|
+
* Quick setup (@hanzo/app Setup), which says it too. A name the two packages
|
|
98
|
+
* agree on, so neither imports the other.
|
|
99
|
+
*/
|
|
100
|
+
export const CHANGED = 'hanzo:github';
|
|
101
|
+
/** Say the GitHub connection changed. */
|
|
102
|
+
export function changed() {
|
|
103
|
+
if (typeof window !== 'undefined')
|
|
104
|
+
window.dispatchEvent(new Event(CHANGED));
|
|
105
|
+
}
|
|
106
|
+
/** Run `again` each time the GitHub connection changed; the answer stops it. */
|
|
107
|
+
export function heard(again) {
|
|
108
|
+
window.addEventListener(CHANGED, again);
|
|
109
|
+
return () => window.removeEventListener(CHANGED, again);
|
|
110
|
+
}
|
|
111
|
+
/** The accounts this org has bound the App on. An org admin adds one through `/v1/provider/github/connect`. */
|
|
112
|
+
export async function installations(t) {
|
|
113
|
+
const raw = obj(await call(t, 'GET', '/v1/provider/github/installations'));
|
|
114
|
+
return (Array.isArray(raw.installations) ? raw.installations : [])
|
|
115
|
+
.map(obj)
|
|
116
|
+
.map((i) => ({ login: str(i.login), type: str(i.type), grant: str(i.grant), connected: i.connected === true }))
|
|
117
|
+
.filter((i) => i.login);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Whether this page reaches GitHub at all, and as whom: the person's own
|
|
121
|
+
* connection first, else the accounts the org has bound the App on. An org that
|
|
122
|
+
* installed the App (onboarding's Connect GitHub) has its repositories to sync
|
|
123
|
+
* without the person connecting their own, so it reads as connected too.
|
|
124
|
+
*/
|
|
125
|
+
export function linked(me, installed) {
|
|
126
|
+
if (me.connected)
|
|
127
|
+
return me;
|
|
128
|
+
const bound = installed.filter((i) => i.connected).map((i) => i.login);
|
|
129
|
+
return bound.length ? { configured: me.configured, connected: true, login: bound.join(', @') } : me;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* One row of GET /v1/provider/github/repos (apps/provider github_index.go
|
|
133
|
+
* repoView): `owner`, `name`, `full_name`, `private`, `default_branch`,
|
|
134
|
+
* `pushed_at`, `installation_id`, `codebase`. Whether it is on the forge is not
|
|
135
|
+
* in the row — `codebase` is the name it would take, not a sign it has — so
|
|
136
|
+
* `imported` is decided by `grants` from the links and the forge.
|
|
137
|
+
*/
|
|
138
|
+
export function grant(raw) {
|
|
139
|
+
const r = repo(raw);
|
|
140
|
+
if (!r.name)
|
|
141
|
+
return null;
|
|
142
|
+
const full = r.full_name;
|
|
143
|
+
const owner = r.owner || (full.includes('/') ? full.slice(0, full.indexOf('/')) : '');
|
|
144
|
+
return {
|
|
145
|
+
owner,
|
|
146
|
+
name: r.name,
|
|
147
|
+
fullName: full || (owner ? `${owner}/${r.name}` : r.name),
|
|
148
|
+
private: r.private,
|
|
149
|
+
branch: r.default_branch || 'main',
|
|
150
|
+
codebase: r.codebase,
|
|
151
|
+
imported: false,
|
|
152
|
+
status: '',
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** Accounts the grant names, plus any account that could not be read or that the organization added. */
|
|
156
|
+
export function accounts(g) {
|
|
157
|
+
const counts = new Map();
|
|
158
|
+
for (const r of g.repos) {
|
|
159
|
+
if (!r.owner)
|
|
160
|
+
continue;
|
|
161
|
+
counts.set(r.owner, (counts.get(r.owner) ?? 0) + 1);
|
|
162
|
+
}
|
|
163
|
+
const unread = new Set(g.unread.filter(Boolean));
|
|
164
|
+
const names = new Set([...counts.keys(), ...unread]);
|
|
165
|
+
// GitHub's logins are case-blind: an added account is named once, as its repositories spell it.
|
|
166
|
+
const seen = new Set([...names].map((n) => n.toLowerCase()));
|
|
167
|
+
for (const n of g.added ?? []) {
|
|
168
|
+
if (!n || seen.has(n.toLowerCase()))
|
|
169
|
+
continue;
|
|
170
|
+
names.add(n);
|
|
171
|
+
seen.add(n.toLowerCase());
|
|
172
|
+
}
|
|
173
|
+
return [...names]
|
|
174
|
+
.sort((a, b) => a.localeCompare(b))
|
|
175
|
+
.map((name) => {
|
|
176
|
+
const count = counts.get(name) ?? 0;
|
|
177
|
+
return { name, count, blocked: unread.has(name) && count === 0 };
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* How many of the platform's pages a full read takes at most: a hundred rows
|
|
182
|
+
* each, so the twenty thousand one view holds (apps/provider github_index.go
|
|
183
|
+
* maxViewRepos). The listing is most-recently-pushed first, so a smaller bound
|
|
184
|
+
* drops whole accounts whose newest push is older than the rest: twenty pages
|
|
185
|
+
* left out a person's own account behind their organizations' 2,000 newer
|
|
186
|
+
* repositories, whatever they granted it on GitHub.
|
|
187
|
+
*/
|
|
188
|
+
const PAGES = 200;
|
|
189
|
+
/**
|
|
190
|
+
* Every repository the GitHub connection grants, every page, with whether the
|
|
191
|
+
* forge already has it: a link that has landed (GET /v1/sync, its `native`
|
|
192
|
+
* state), or a forge repository under its codebase name (GET /v1/git/repos).
|
|
193
|
+
*/
|
|
194
|
+
export async function grants(t, signal) {
|
|
195
|
+
const rows = [];
|
|
196
|
+
let unread = [];
|
|
197
|
+
let after = '';
|
|
198
|
+
for (let n = 0; n < PAGES; n++) {
|
|
199
|
+
const page = await repos(t, { limit: 100, after }, signal);
|
|
200
|
+
rows.push(...page.repos);
|
|
201
|
+
unread = page.unread;
|
|
202
|
+
if (!page.next)
|
|
203
|
+
break;
|
|
204
|
+
after = page.next;
|
|
205
|
+
}
|
|
206
|
+
const [linked, held] = await Promise.all([links(t, signal).catch(() => []), codebases(t).catch(() => [])]);
|
|
207
|
+
const state = new Map(linked.map((l) => [`${l.owner}/${l.name}`.toLowerCase(), l.status]));
|
|
208
|
+
const names = new Set(held.map((c) => c.name.toLowerCase()));
|
|
209
|
+
return {
|
|
210
|
+
repos: rows
|
|
211
|
+
.map(grant)
|
|
212
|
+
.filter((r) => r !== null)
|
|
213
|
+
.map((r) => {
|
|
214
|
+
// A link's state, '' when the forge could not be read for it; absent with no link.
|
|
215
|
+
const said = state.get(r.fullName.toLowerCase());
|
|
216
|
+
const there = names.has(r.codebase.toLowerCase());
|
|
217
|
+
return { ...r, imported: there || said === 'synced' || said === 'conflict' || said === 'paused', status: said || (there ? 'synced' : '') };
|
|
218
|
+
}),
|
|
219
|
+
unread: unread.filter(Boolean),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The repositories this organization can bring in: `grants`, narrowed to the
|
|
224
|
+
* accounts the organization has added (`installations`, `connected`). The list
|
|
225
|
+
* is the person's own GitHub, which reaches accounts another Hanzo workspace
|
|
226
|
+
* added; the import goes through this organization's own, so it refuses every
|
|
227
|
+
* repository of those. With the organization's accounts unreadable, `grants` as
|
|
228
|
+
* it is: the import still says which it refuses.
|
|
229
|
+
*/
|
|
230
|
+
export async function added(t, signal) {
|
|
231
|
+
const [g, mine] = await Promise.all([grants(t, signal), installations(t).catch(() => null)]);
|
|
232
|
+
if (!mine)
|
|
233
|
+
return g;
|
|
234
|
+
const logins = mine.filter((i) => i.connected).map((i) => i.login);
|
|
235
|
+
const held = new Set(logins.map((l) => l.toLowerCase()));
|
|
236
|
+
const ours = (name) => held.has(name.toLowerCase());
|
|
237
|
+
return { repos: g.repos.filter((r) => ours(r.owner)), unread: g.unread.filter(ours), added: logins };
|
|
238
|
+
}
|
|
239
|
+
/** Queue a mirror of the named repositories onto the forge. The names are `owner/name`. */
|
|
240
|
+
export async function bring(t, repos) {
|
|
241
|
+
const names = repos.map((n) => n.trim()).filter(Boolean);
|
|
242
|
+
if (names.length === 0)
|
|
243
|
+
throw new Error(phrase('Choose a repository first'));
|
|
244
|
+
const raw = obj(await call(t, 'POST', '/v1/provider/github/repos/import', { repos: names }));
|
|
245
|
+
const said = Array.isArray(raw.repos) ? raw.repos : [];
|
|
246
|
+
const made = Array.isArray(raw.codebases) ? raw.codebases : [];
|
|
247
|
+
const codebases = {};
|
|
248
|
+
said.forEach((r, i) => {
|
|
249
|
+
if (typeof r === 'string' && typeof made[i] === 'string' && made[i])
|
|
250
|
+
codebases[r.toLowerCase()] = made[i];
|
|
251
|
+
});
|
|
252
|
+
return { queued: num(raw.queued), codebases };
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Mirror GitHub issues onto the board — open and closed, so a closed one reads as
|
|
256
|
+
* closed here too. `repo` (`name` or `owner/name`) syncs one project; empty syncs
|
|
257
|
+
* every repository the connection grants. Idempotent: a second sync updates and
|
|
258
|
+
* never duplicates, and the App's webhook keeps them live afterwards.
|
|
259
|
+
*/
|
|
260
|
+
export async function syncIssues(t, repo = '') {
|
|
261
|
+
const name = repo.trim();
|
|
262
|
+
const raw = obj(await call(t, 'POST', '/v1/provider/github/issues/backfill', name ? { state: 'all', repo: name } : { state: 'all' }));
|
|
263
|
+
return {
|
|
264
|
+
repos: num(raw.repos),
|
|
265
|
+
issues: num(raw.issues),
|
|
266
|
+
created: num(raw.created),
|
|
267
|
+
updated: num(raw.updated),
|
|
268
|
+
failed: num(raw.failed),
|
|
269
|
+
truncated: raw.truncated === true,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Target } from './call.ts';
|
|
2
|
+
export declare const KINDS: readonly ['secret', 'publishable'];
|
|
3
|
+
export type Kind = (typeof KINDS)[number];
|
|
4
|
+
export interface Key {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: Kind;
|
|
8
|
+
/** The recognizable head, never enough to use the key. */
|
|
9
|
+
prefix: string;
|
|
10
|
+
/** The whole key: a publishable key's only. */
|
|
11
|
+
key: string;
|
|
12
|
+
/** active, expired, revoked or disabled. */
|
|
13
|
+
status: string;
|
|
14
|
+
/** `kind:name` entries; none reaches whatever its holder does. */
|
|
15
|
+
limit: string[];
|
|
16
|
+
/** When it was made, as IAM records it. */
|
|
17
|
+
created: string;
|
|
18
|
+
}
|
|
19
|
+
export interface Minted {
|
|
20
|
+
id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
type: Kind;
|
|
23
|
+
/** The key itself. A secret one is never readable again. */
|
|
24
|
+
key: string;
|
|
25
|
+
limit: string[];
|
|
26
|
+
}
|
|
27
|
+
export declare function keys(t: Target): Promise<Key[]>;
|
|
28
|
+
/** A `kind:name` limit: a lowercase kind, a colon, and a name or `*`. */
|
|
29
|
+
export declare const LIMIT: RegExp;
|
|
30
|
+
/** The limits a person typed, split on commas and spaces; throws on the first that is not one. */
|
|
31
|
+
export declare function limits(raw: string): string[];
|
|
32
|
+
/** Create a new key beside the ones held. The answer is the only time a secret key is shown. */
|
|
33
|
+
export declare function mint(t: Target, type: Kind, name?: string, limit?: string[]): Promise<Minted>;
|
|
34
|
+
/** Revoke exactly one key, by id. Every other key keeps working. */
|
|
35
|
+
export declare function revoke(t: Target, id: string): Promise<void>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A person's API keys, each its own credential: as many as they like, of either
|
|
3
|
+
* type — secret (sk-, it belongs on a server) or publishable (pk-, safe in a
|
|
4
|
+
* page's source).
|
|
5
|
+
*
|
|
6
|
+
* GET /v1/account/keys {keys: [{id, name, type, prefix, key?, status, limit?, created, …}]}
|
|
7
|
+
* POST /v1/account/keys {name, type, limit?} → the key, its secret answered once
|
|
8
|
+
* DELETE /v1/account/keys/{id} revoke exactly that one; it stays listed as revoked
|
|
9
|
+
*
|
|
10
|
+
* Creating a key never touches another. A secret key is answered once and by its
|
|
11
|
+
* prefix after; a publishable key is public by construction and always comes back
|
|
12
|
+
* whole. A limit only narrows what a key may reach — `model:zen5`,
|
|
13
|
+
* `project:acme`, `product:train`, `read:*`.
|
|
14
|
+
*/
|
|
15
|
+
import { phrase } from '@hanzo/i18n';
|
|
16
|
+
import { call, Sentence } from './call.js';
|
|
17
|
+
export const KINDS = ['secret', 'publishable'];
|
|
18
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
19
|
+
const list = (v) => (Array.isArray(v) ? v.filter((s) => typeof s === 'string' && s !== '') : []);
|
|
20
|
+
const kind = (v) => (KINDS.includes(v) ? v : null);
|
|
21
|
+
export async function keys(t) {
|
|
22
|
+
const r = await call(t, 'GET', '/v1/account/keys');
|
|
23
|
+
const rows = Array.isArray(r?.keys) ? r.keys : [];
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const raw of rows) {
|
|
26
|
+
const o = (raw && typeof raw === 'object' ? raw : {});
|
|
27
|
+
const type = kind(o.type);
|
|
28
|
+
if (!type || !str(o.id))
|
|
29
|
+
continue;
|
|
30
|
+
out.push({
|
|
31
|
+
id: str(o.id),
|
|
32
|
+
name: str(o.name),
|
|
33
|
+
type,
|
|
34
|
+
prefix: str(o.prefix),
|
|
35
|
+
key: str(o.key),
|
|
36
|
+
status: str(o.status) || 'active',
|
|
37
|
+
limit: list(o.limit),
|
|
38
|
+
created: str(o.created),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
/** A `kind:name` limit: a lowercase kind, a colon, and a name or `*`. */
|
|
44
|
+
export const LIMIT = /^[a-z][a-z0-9-]*:[^\s,:]+$/;
|
|
45
|
+
/** The limits a person typed, split on commas and spaces; throws on the first that is not one. */
|
|
46
|
+
export function limits(raw) {
|
|
47
|
+
const out = raw
|
|
48
|
+
.split(/[\s,]+/)
|
|
49
|
+
.map((s) => s.trim())
|
|
50
|
+
.filter(Boolean);
|
|
51
|
+
const bad = out.find((s) => !LIMIT.test(s));
|
|
52
|
+
if (bad)
|
|
53
|
+
throw new Sentence(phrase('{limit} is not a limit — write it as kind:name, like model:zen5'), { limit: bad });
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
/** Create a new key beside the ones held. The answer is the only time a secret key is shown. */
|
|
57
|
+
export async function mint(t, type, name = '', limit = []) {
|
|
58
|
+
const body = { type };
|
|
59
|
+
if (name.trim())
|
|
60
|
+
body.name = name.trim();
|
|
61
|
+
if (limit.length)
|
|
62
|
+
body.limit = limit;
|
|
63
|
+
const r = await call(t, 'POST', '/v1/account/keys', body);
|
|
64
|
+
const key = str(r?.key);
|
|
65
|
+
if (!key)
|
|
66
|
+
throw new Error(phrase('The platform answered no key'));
|
|
67
|
+
return { id: str(r?.id), name: str(r?.name), type: kind(r?.type) ?? type, key, limit: list(r?.limit) };
|
|
68
|
+
}
|
|
69
|
+
/** Revoke exactly one key, by id. Every other key keeps working. */
|
|
70
|
+
export async function revoke(t, id) {
|
|
71
|
+
await call(t, 'DELETE', `/v1/account/keys/${encodeURIComponent(id)}`);
|
|
72
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type Target } from './call.ts';
|
|
2
|
+
export declare const KIND_IDS: readonly ['image', 'video', 'audio', 'document', 'slides', 'type', 'model', 'code', 'file'];
|
|
3
|
+
export type Kind = (typeof KIND_IDS)[number];
|
|
4
|
+
/** The kinds a reader narrows to, in the order the Library lists them, '' being all; each label English and marked (`phrase`), drawn through `t`. */
|
|
5
|
+
export declare const KINDS: readonly {
|
|
6
|
+
id: Kind | '';
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const SOURCES: readonly ['chat', 'dev', 'studio', 'workflow'];
|
|
10
|
+
export type Source = (typeof SOURCES)[number];
|
|
11
|
+
export type Scope = 'all' | 'mine' | 'shared';
|
|
12
|
+
/** A product, as a person names it: Chat, Dev and Studio are names, and Workflow a word, marked (`phrase`). */
|
|
13
|
+
export declare const SOURCE: Record<Source, string>;
|
|
14
|
+
export interface Item {
|
|
15
|
+
id: string;
|
|
16
|
+
kind: Kind;
|
|
17
|
+
source: Source;
|
|
18
|
+
name: string;
|
|
19
|
+
mime: string;
|
|
20
|
+
bytes: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
seconds: number;
|
|
24
|
+
pages: number;
|
|
25
|
+
/** The subject that made it. */
|
|
26
|
+
owner: string;
|
|
27
|
+
/** The reader made it. */
|
|
28
|
+
mine: boolean;
|
|
29
|
+
/** Its owner shared it with the org. */
|
|
30
|
+
shared: boolean;
|
|
31
|
+
project: string;
|
|
32
|
+
/** What made it: a conversation, a Dev run, a Studio run, an automation's run. */
|
|
33
|
+
ref: string;
|
|
34
|
+
/** The app path back to what made it, or '' for none. */
|
|
35
|
+
origin: string;
|
|
36
|
+
/** The original, to open in place. */
|
|
37
|
+
url: string;
|
|
38
|
+
/** The original, as a download. */
|
|
39
|
+
download: string;
|
|
40
|
+
/** A still that shows it, or ''. An image is its own. */
|
|
41
|
+
preview: string;
|
|
42
|
+
expires: string;
|
|
43
|
+
created: string;
|
|
44
|
+
updated: string;
|
|
45
|
+
}
|
|
46
|
+
/** What a list is narrowed to. */
|
|
47
|
+
export interface Filter {
|
|
48
|
+
kind?: Kind | '';
|
|
49
|
+
source?: Source | '';
|
|
50
|
+
ref?: string;
|
|
51
|
+
project?: string;
|
|
52
|
+
q?: string;
|
|
53
|
+
/** RFC 3339 bounds on when an item was made. */
|
|
54
|
+
since?: string;
|
|
55
|
+
until?: string;
|
|
56
|
+
scope?: Scope;
|
|
57
|
+
limit?: number;
|
|
58
|
+
cursor?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface Page {
|
|
61
|
+
data: Item[];
|
|
62
|
+
/** The cursor of the next page, or '' at the end. */
|
|
63
|
+
next: string;
|
|
64
|
+
}
|
|
65
|
+
/** An app path back to what made an item: under this origin, never another's. */
|
|
66
|
+
export declare const inApp: (v: unknown) => string;
|
|
67
|
+
/** One item as the platform answers it, or null for a row with no id. */
|
|
68
|
+
export declare function item(raw: unknown): Item | null;
|
|
69
|
+
export declare function items(t: Target, f?: Filter, init?: {
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
}): Promise<Page>;
|
|
72
|
+
export declare function get(t: Target, id: string): Promise<Item>;
|
|
73
|
+
/** What an upload says about where a thing came from. */
|
|
74
|
+
export interface Made {
|
|
75
|
+
source: Source;
|
|
76
|
+
kind?: Kind;
|
|
77
|
+
ref?: string;
|
|
78
|
+
origin?: string;
|
|
79
|
+
project?: string;
|
|
80
|
+
/** The same owner, source and key answer the item already made. */
|
|
81
|
+
key?: string;
|
|
82
|
+
width?: number;
|
|
83
|
+
height?: number;
|
|
84
|
+
seconds?: number;
|
|
85
|
+
pages?: number;
|
|
86
|
+
}
|
|
87
|
+
/** The largest thing an inline upload carries; larger files up to `MAX` reserve a signed PUT. */
|
|
88
|
+
export declare const INLINE: number;
|
|
89
|
+
/** The largest thing one upload carries (2 GiB). */
|
|
90
|
+
export declare const MAX: number;
|
|
91
|
+
/** Bytes as base64, in chunks a call stack holds. */
|
|
92
|
+
export declare function base64(bytes: Uint8Array): string;
|
|
93
|
+
/** Keep a file in the Library. */
|
|
94
|
+
export declare function upload(t: Target, file: {
|
|
95
|
+
name: string;
|
|
96
|
+
type: string;
|
|
97
|
+
bytes?: Uint8Array;
|
|
98
|
+
blob?: Blob;
|
|
99
|
+
}, made: Made): Promise<Item>;
|
|
100
|
+
export interface Change {
|
|
101
|
+
name?: string;
|
|
102
|
+
shared?: boolean;
|
|
103
|
+
project?: string;
|
|
104
|
+
commit?: boolean;
|
|
105
|
+
}
|
|
106
|
+
export declare function change(t: Target, id: string, c: Change): Promise<Item>;
|
|
107
|
+
export declare function remove(t: Target, id: string): Promise<void>;
|
|
108
|
+
/** A size the way a person reads it. */
|
|
109
|
+
export declare function size(bytes: number): string;
|
|
110
|
+
/** The day an instant falls on, as a section of the Library: Today, Yesterday (English, marked), then the month. */
|
|
111
|
+
export declare function day(iso: string, now?: Date): string;
|
|
112
|
+
/** Items under the day each was made, in the order given (newest first). */
|
|
113
|
+
export declare function days(list: Item[], now?: Date): {
|
|
114
|
+
label: string;
|
|
115
|
+
rows: Item[];
|
|
116
|
+
}[];
|