ontrackd 0.0.1 → 0.11.1
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 +14 -0
- package/README.md +133 -2
- package/dist/cli/build.d.ts +1 -0
- package/dist/cli/build.js +172 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/cloud.d.ts +20 -0
- package/dist/cli/cloud.js +395 -0
- package/dist/cli/cloud.js.map +1 -0
- package/dist/cli/feedback.d.ts +4 -0
- package/dist/cli/feedback.js +90 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/hugo.d.ts +1 -0
- package/dist/cli/hugo.js +396 -0
- package/dist/cli/hugo.js.map +1 -0
- package/dist/cli/init.d.ts +8 -0
- package/dist/cli/init.js +346 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/invite.d.ts +2 -0
- package/dist/cli/invite.js +65 -0
- package/dist/cli/invite.js.map +1 -0
- package/dist/cli/link.d.ts +20 -0
- package/dist/cli/link.js +287 -0
- package/dist/cli/link.js.map +1 -0
- package/dist/cli/pull.d.ts +31 -0
- package/dist/cli/pull.js +273 -0
- package/dist/cli/pull.js.map +1 -0
- package/dist/cli/push.d.ts +9 -0
- package/dist/cli/push.js +57 -0
- package/dist/cli/push.js.map +1 -0
- package/dist/cli/remote.d.ts +1 -0
- package/dist/cli/remote.js +114 -0
- package/dist/cli/remote.js.map +1 -0
- package/dist/cli/serve.d.ts +1 -0
- package/dist/cli/serve.js +178 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/sidecar.d.ts +9 -0
- package/dist/cli/sidecar.js +23 -0
- package/dist/cli/sidecar.js.map +1 -0
- package/dist/core/anchorId.d.ts +42 -0
- package/dist/core/anchorId.js +50 -0
- package/dist/core/anchorId.js.map +1 -0
- package/dist/core/apiKind.d.ts +42 -0
- package/dist/core/apiKind.js +83 -0
- package/dist/core/apiKind.js.map +1 -0
- package/dist/core/astroAnchors.d.ts +39 -0
- package/dist/core/astroAnchors.js +217 -0
- package/dist/core/astroAnchors.js.map +1 -0
- package/dist/core/attachmentTypes.d.ts +74 -0
- package/dist/core/attachmentTypes.js +199 -0
- package/dist/core/attachmentTypes.js.map +1 -0
- package/dist/core/elementHints.d.ts +40 -0
- package/dist/core/elementHints.js +116 -0
- package/dist/core/elementHints.js.map +1 -0
- package/dist/core/exportTaskDoc.d.ts +81 -0
- package/dist/core/exportTaskDoc.js +828 -0
- package/dist/core/exportTaskDoc.js.map +1 -0
- package/dist/core/feedbackTypes.d.ts +241 -0
- package/dist/core/feedbackTypes.js +2 -0
- package/dist/core/feedbackTypes.js.map +1 -0
- package/dist/core/fingerprint.d.ts +12 -0
- package/dist/core/fingerprint.js +24 -0
- package/dist/core/fingerprint.js.map +1 -0
- package/dist/core/htmlAnchors.d.ts +18 -0
- package/dist/core/htmlAnchors.js +157 -0
- package/dist/core/htmlAnchors.js.map +1 -0
- package/dist/core/imageSniff.d.ts +7 -0
- package/dist/core/imageSniff.js +12 -0
- package/dist/core/imageSniff.js.map +1 -0
- package/dist/core/ordering.d.ts +16 -0
- package/dist/core/ordering.js +10 -0
- package/dist/core/ordering.js.map +1 -0
- package/dist/core/oxcAst.d.ts +39 -0
- package/dist/core/oxcAst.js +147 -0
- package/dist/core/oxcAst.js.map +1 -0
- package/dist/core/pageUrl.d.ts +10 -0
- package/dist/core/pageUrl.js +27 -0
- package/dist/core/pageUrl.js.map +1 -0
- package/dist/core/participants.d.ts +14 -0
- package/dist/core/participants.js +38 -0
- package/dist/core/participants.js.map +1 -0
- package/dist/core/ports.d.ts +86 -0
- package/dist/core/ports.js +2 -0
- package/dist/core/ports.js.map +1 -0
- package/dist/core/projectSecret.d.ts +9 -0
- package/dist/core/projectSecret.js +57 -0
- package/dist/core/projectSecret.js.map +1 -0
- package/dist/core/recipe.d.ts +117 -0
- package/dist/core/recipe.js +181 -0
- package/dist/core/recipe.js.map +1 -0
- package/dist/core/recordingSummary.d.ts +12 -0
- package/dist/core/recordingSummary.js +150 -0
- package/dist/core/recordingSummary.js.map +1 -0
- package/dist/core/resolveAnchors.d.ts +70 -0
- package/dist/core/resolveAnchors.js +101 -0
- package/dist/core/resolveAnchors.js.map +1 -0
- package/dist/core/scriptImport.d.ts +10 -0
- package/dist/core/scriptImport.js +18 -0
- package/dist/core/scriptImport.js.map +1 -0
- package/dist/core/sourceAnchors.d.ts +62 -0
- package/dist/core/sourceAnchors.js +82 -0
- package/dist/core/sourceAnchors.js.map +1 -0
- package/dist/core/sourceContext.d.ts +62 -0
- package/dist/core/sourceContext.js +182 -0
- package/dist/core/sourceContext.js.map +1 -0
- package/dist/core/sourcePath.d.ts +2 -0
- package/dist/core/sourcePath.js +11 -0
- package/dist/core/sourcePath.js.map +1 -0
- package/dist/core/staleness.d.ts +118 -0
- package/dist/core/staleness.js +155 -0
- package/dist/core/staleness.js.map +1 -0
- package/dist/core/styleOrigin.d.ts +98 -0
- package/dist/core/styleOrigin.js +142 -0
- package/dist/core/styleOrigin.js.map +1 -0
- package/dist/core/svelteAnchors.d.ts +18 -0
- package/dist/core/svelteAnchors.js +125 -0
- package/dist/core/svelteAnchors.js.map +1 -0
- package/dist/core/taskFiles.d.ts +31 -0
- package/dist/core/taskFiles.js +55 -0
- package/dist/core/taskFiles.js.map +1 -0
- package/dist/core/untrusted.d.ts +57 -0
- package/dist/core/untrusted.js +268 -0
- package/dist/core/untrusted.js.map +1 -0
- package/dist/core/vueAnchors.d.ts +21 -0
- package/dist/core/vueAnchors.js +130 -0
- package/dist/core/vueAnchors.js.map +1 -0
- package/dist/expo/app/Avatar.d.ts +6 -0
- package/dist/expo/app/Avatar.js +12 -0
- package/dist/expo/app/Avatar.js.map +1 -0
- package/dist/expo/app/Bars.d.ts +9 -0
- package/dist/expo/app/Bars.js +38 -0
- package/dist/expo/app/Bars.js.map +1 -0
- package/dist/expo/app/CommentThreadSheet.d.ts +35 -0
- package/dist/expo/app/CommentThreadSheet.js +200 -0
- package/dist/expo/app/CommentThreadSheet.js.map +1 -0
- package/dist/expo/app/CommentsSheet.d.ts +22 -0
- package/dist/expo/app/CommentsSheet.js +76 -0
- package/dist/expo/app/CommentsSheet.js.map +1 -0
- package/dist/expo/app/Files.d.ts +16 -0
- package/dist/expo/app/Files.js +62 -0
- package/dist/expo/app/Files.js.map +1 -0
- package/dist/expo/app/Highlight.d.ts +5 -0
- package/dist/expo/app/Highlight.js +12 -0
- package/dist/expo/app/Highlight.js.map +1 -0
- package/dist/expo/app/Icon.d.ts +9 -0
- package/dist/expo/app/Icon.js +22 -0
- package/dist/expo/app/Icon.js.map +1 -0
- package/dist/expo/app/MarkerPins.d.ts +10 -0
- package/dist/expo/app/MarkerPins.js +70 -0
- package/dist/expo/app/MarkerPins.js.map +1 -0
- package/dist/expo/app/Provider.d.ts +13 -0
- package/dist/expo/app/Provider.js +597 -0
- package/dist/expo/app/Provider.js.map +1 -0
- package/dist/expo/app/Sheet.d.ts +53 -0
- package/dist/expo/app/Sheet.js +106 -0
- package/dist/expo/app/Sheet.js.map +1 -0
- package/dist/expo/app/Toolbar.d.ts +26 -0
- package/dist/expo/app/Toolbar.js +71 -0
- package/dist/expo/app/Toolbar.js.map +1 -0
- package/dist/expo/app/adapter.d.ts +55 -0
- package/dist/expo/app/adapter.js +145 -0
- package/dist/expo/app/adapter.js.map +1 -0
- package/dist/expo/app/api.d.ts +68 -0
- package/dist/expo/app/api.js +86 -0
- package/dist/expo/app/api.js.map +1 -0
- package/dist/expo/app/assets/attach.png +0 -0
- package/dist/expo/app/assets/close.png +0 -0
- package/dist/expo/app/assets/comment.png +0 -0
- package/dist/expo/app/assets/edit.png +0 -0
- package/dist/expo/app/assets/file.png +0 -0
- package/dist/expo/app/assets/narrow.png +0 -0
- package/dist/expo/app/assets/panel.png +0 -0
- package/dist/expo/app/assets/pins.png +0 -0
- package/dist/expo/app/assets/pinsOff.png +0 -0
- package/dist/expo/app/assets/remove.png +0 -0
- package/dist/expo/app/assets/reopen.png +0 -0
- package/dist/expo/app/assets/resolve.png +0 -0
- package/dist/expo/app/assets/send.png +0 -0
- package/dist/expo/app/assets/widen.png +0 -0
- package/dist/expo/app/attachments.d.ts +93 -0
- package/dist/expo/app/attachments.js +181 -0
- package/dist/expo/app/attachments.js.map +1 -0
- package/dist/expo/app/cloudApi.d.ts +63 -0
- package/dist/expo/app/cloudApi.js +330 -0
- package/dist/expo/app/cloudApi.js.map +1 -0
- package/dist/expo/app/cloudAuth.d.ts +20 -0
- package/dist/expo/app/cloudAuth.js +71 -0
- package/dist/expo/app/cloudAuth.js.map +1 -0
- package/dist/expo/app/cloudHttp.d.ts +20 -0
- package/dist/expo/app/cloudHttp.js +46 -0
- package/dist/expo/app/cloudHttp.js.map +1 -0
- package/dist/expo/app/cloudSession.d.ts +30 -0
- package/dist/expo/app/cloudSession.js +72 -0
- package/dist/expo/app/cloudSession.js.map +1 -0
- package/dist/expo/app/comments.d.ts +20 -0
- package/dist/expo/app/comments.js +131 -0
- package/dist/expo/app/comments.js.map +1 -0
- package/dist/expo/app/devMenuNone.d.ts +5 -0
- package/dist/expo/app/devMenuNone.js +3 -0
- package/dist/expo/app/devMenuNone.js.map +1 -0
- package/dist/expo/app/devServerNone.d.ts +4 -0
- package/dist/expo/app/devServerNone.js +4 -0
- package/dist/expo/app/devServerNone.js.map +1 -0
- package/dist/expo/app/embeddedConfig.d.ts +1 -0
- package/dist/expo/app/embeddedConfig.js +12 -0
- package/dist/expo/app/embeddedConfig.js.map +1 -0
- package/dist/expo/app/embeddedConfigCloud.d.ts +2 -0
- package/dist/expo/app/embeddedConfigCloud.js +8 -0
- package/dist/expo/app/embeddedConfigCloud.js.map +1 -0
- package/dist/expo/app/embeddedConfigNone.d.ts +2 -0
- package/dist/expo/app/embeddedConfigNone.js +3 -0
- package/dist/expo/app/embeddedConfigNone.js.map +1 -0
- package/dist/expo/app/expo.d.ts +4 -0
- package/dist/expo/app/expo.js +35 -0
- package/dist/expo/app/expo.js.map +1 -0
- package/dist/expo/app/expoGo.d.ts +4 -0
- package/dist/expo/app/expoGo.js +33 -0
- package/dist/expo/app/expoGo.js.map +1 -0
- package/dist/expo/app/expoPickers.d.ts +11 -0
- package/dist/expo/app/expoPickers.js +91 -0
- package/dist/expo/app/expoPickers.js.map +1 -0
- package/dist/expo/app/expoRandom.d.ts +6 -0
- package/dist/expo/app/expoRandom.js +21 -0
- package/dist/expo/app/expoRandom.js.map +1 -0
- package/dist/expo/app/idle.d.ts +4 -0
- package/dist/expo/app/idle.js +7 -0
- package/dist/expo/app/idle.js.map +1 -0
- package/dist/expo/app/index.d.ts +3 -0
- package/dist/expo/app/index.js +3 -0
- package/dist/expo/app/index.js.map +1 -0
- package/dist/expo/app/interactions.d.ts +38 -0
- package/dist/expo/app/interactions.js +40 -0
- package/dist/expo/app/interactions.js.map +1 -0
- package/dist/expo/app/markers.d.ts +28 -0
- package/dist/expo/app/markers.js +187 -0
- package/dist/expo/app/markers.js.map +1 -0
- package/dist/expo/app/movedAnchors.d.ts +46 -0
- package/dist/expo/app/movedAnchors.js +39 -0
- package/dist/expo/app/movedAnchors.js.map +1 -0
- package/dist/expo/app/native.d.ts +12 -0
- package/dist/expo/app/native.js +78 -0
- package/dist/expo/app/native.js.map +1 -0
- package/dist/expo/app/panel.d.ts +27 -0
- package/dist/expo/app/panel.js +37 -0
- package/dist/expo/app/panel.js.map +1 -0
- package/dist/expo/app/payload.d.ts +43 -0
- package/dist/expo/app/payload.js +22 -0
- package/dist/expo/app/payload.js.map +1 -0
- package/dist/expo/app/pick.d.ts +14 -0
- package/dist/expo/app/pick.js +124 -0
- package/dist/expo/app/pick.js.map +1 -0
- package/dist/expo/app/pickerNone.d.ts +1 -0
- package/dist/expo/app/pickerNone.js +2 -0
- package/dist/expo/app/pickerNone.js.map +1 -0
- package/dist/expo/app/placement.d.ts +53 -0
- package/dist/expo/app/placement.js +100 -0
- package/dist/expo/app/placement.js.map +1 -0
- package/dist/expo/app/random.d.ts +13 -0
- package/dist/expo/app/random.js +56 -0
- package/dist/expo/app/random.js.map +1 -0
- package/dist/expo/app/reactNative.d.ts +2 -0
- package/dist/expo/app/reactNative.js +3 -0
- package/dist/expo/app/reactNative.js.map +1 -0
- package/dist/expo/app/runtimeConfig.d.ts +30 -0
- package/dist/expo/app/runtimeConfig.js +104 -0
- package/dist/expo/app/runtimeConfig.js.map +1 -0
- package/dist/expo/app/sheetMotion.d.ts +22 -0
- package/dist/expo/app/sheetMotion.js +39 -0
- package/dist/expo/app/sheetMotion.js.map +1 -0
- package/dist/expo/app/signIn.d.ts +32 -0
- package/dist/expo/app/signIn.js +28 -0
- package/dist/expo/app/signIn.js.map +1 -0
- package/dist/expo/app/state.d.ts +45 -0
- package/dist/expo/app/state.js +32 -0
- package/dist/expo/app/state.js.map +1 -0
- package/dist/expo/app/theme.d.ts +15 -0
- package/dist/expo/app/theme.js +9 -0
- package/dist/expo/app/theme.js.map +1 -0
- package/dist/expo/app/types.d.ts +87 -0
- package/dist/expo/app/types.js +2 -0
- package/dist/expo/app/types.js.map +1 -0
- package/dist/expo/app/useCloudReviewer.d.ts +75 -0
- package/dist/expo/app/useCloudReviewer.js +211 -0
- package/dist/expo/app/useCloudReviewer.js.map +1 -0
- package/dist/expo/app/useComments.d.ts +64 -0
- package/dist/expo/app/useComments.js +156 -0
- package/dist/expo/app/useComments.js.map +1 -0
- package/dist/expo/app/useUploads.d.ts +32 -0
- package/dist/expo/app/useUploads.js +106 -0
- package/dist/expo/app/useUploads.js.map +1 -0
- package/dist/expo/expoGoMetro.cjs +83 -0
- package/dist/expo/expoMetro.cjs +86 -0
- package/dist/expo/metro.cjs +304 -0
- package/dist/expo/metroBuild.d.ts +22 -0
- package/dist/expo/metroBuild.js +169 -0
- package/dist/expo/metroBuild.js.map +1 -0
- package/dist/expo/middleware.d.ts +11 -0
- package/dist/expo/middleware.js +26 -0
- package/dist/expo/middleware.js.map +1 -0
- package/dist/expo/mode.d.ts +20 -0
- package/dist/expo/mode.js +37 -0
- package/dist/expo/mode.js.map +1 -0
- package/dist/expo/publicConfig.d.ts +37 -0
- package/dist/expo/publicConfig.js +87 -0
- package/dist/expo/publicConfig.js.map +1 -0
- package/dist/expo/transform.d.ts +22 -0
- package/dist/expo/transform.js +38 -0
- package/dist/expo/transform.js.map +1 -0
- package/dist/expo/transformer.cjs +73 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/apiRoutes.d.ts +2 -0
- package/dist/integration/apiRoutes.js +3 -0
- package/dist/integration/apiRoutes.js.map +1 -0
- package/dist/integration/buildCredentials.d.ts +12 -0
- package/dist/integration/buildCredentials.js +97 -0
- package/dist/integration/buildCredentials.js.map +1 -0
- package/dist/integration/buildSession.d.ts +8 -0
- package/dist/integration/buildSession.js +96 -0
- package/dist/integration/buildSession.js.map +1 -0
- package/dist/integration/bundleCheck.d.ts +43 -0
- package/dist/integration/bundleCheck.js +111 -0
- package/dist/integration/bundleCheck.js.map +1 -0
- package/dist/integration/commentPull.d.ts +134 -0
- package/dist/integration/commentPull.js +260 -0
- package/dist/integration/commentPull.js.map +1 -0
- package/dist/integration/configuredApi.d.ts +7 -0
- package/dist/integration/configuredApi.js +24 -0
- package/dist/integration/configuredApi.js.map +1 -0
- package/dist/integration/devCloud.d.ts +27 -0
- package/dist/integration/devCloud.js +56 -0
- package/dist/integration/devCloud.js.map +1 -0
- package/dist/integration/devReviewLinks.d.ts +2 -0
- package/dist/integration/devReviewLinks.js +10 -0
- package/dist/integration/devReviewLinks.js.map +1 -0
- package/dist/integration/gitBranch.d.ts +19 -0
- package/dist/integration/gitBranch.js +56 -0
- package/dist/integration/gitBranch.js.map +1 -0
- package/dist/integration/importPlan.d.ts +19 -0
- package/dist/integration/importPlan.js +90 -0
- package/dist/integration/importPlan.js.map +1 -0
- package/dist/integration/index.d.ts +14 -0
- package/dist/integration/index.js +13 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/manifest.d.ts +120 -0
- package/dist/integration/manifest.js +147 -0
- package/dist/integration/manifest.js.map +1 -0
- package/dist/integration/manifestParts.d.ts +29 -0
- package/dist/integration/manifestParts.js +65 -0
- package/dist/integration/manifestParts.js.map +1 -0
- package/dist/integration/manifestSink.d.ts +75 -0
- package/dist/integration/manifestSink.js +157 -0
- package/dist/integration/manifestSink.js.map +1 -0
- package/dist/integration/manifestUpload.d.ts +64 -0
- package/dist/integration/manifestUpload.js +177 -0
- package/dist/integration/manifestUpload.js.map +1 -0
- package/dist/integration/middleware.d.ts +55 -0
- package/dist/integration/middleware.js +379 -0
- package/dist/integration/middleware.js.map +1 -0
- package/dist/integration/nextStyles.d.ts +4 -0
- package/dist/integration/nextStyles.js +121 -0
- package/dist/integration/nextStyles.js.map +1 -0
- package/dist/integration/requestGuards.d.ts +71 -0
- package/dist/integration/requestGuards.js +255 -0
- package/dist/integration/requestGuards.js.map +1 -0
- package/dist/integration/sharedBuild.d.ts +71 -0
- package/dist/integration/sharedBuild.js +105 -0
- package/dist/integration/sharedBuild.js.map +1 -0
- package/dist/integration/sharedInject.d.ts +88 -0
- package/dist/integration/sharedInject.js +164 -0
- package/dist/integration/sharedInject.js.map +1 -0
- package/dist/integration/sidecarProcess.d.ts +26 -0
- package/dist/integration/sidecarProcess.js +137 -0
- package/dist/integration/sidecarProcess.js.map +1 -0
- package/dist/integration/styleCollector.d.ts +49 -0
- package/dist/integration/styleCollector.js +220 -0
- package/dist/integration/styleCollector.js.map +1 -0
- package/dist/integration/transform.d.ts +24 -0
- package/dist/integration/transform.js +36 -0
- package/dist/integration/transform.js.map +1 -0
- package/dist/integration/tunnelClient.d.ts +44 -0
- package/dist/integration/tunnelClient.js +148 -0
- package/dist/integration/tunnelClient.js.map +1 -0
- package/dist/integration/tunnelProtocol.d.ts +152 -0
- package/dist/integration/tunnelProtocol.js +110 -0
- package/dist/integration/tunnelProtocol.js.map +1 -0
- package/dist/mcp/cli.d.ts +2 -0
- package/dist/mcp/cli.js +327 -0
- package/dist/mcp/cli.js.map +1 -0
- package/dist/mcp/cloudRefresh.d.ts +36 -0
- package/dist/mcp/cloudRefresh.js +52 -0
- package/dist/mcp/cloudRefresh.js.map +1 -0
- package/dist/mcp/context.d.ts +7 -0
- package/dist/mcp/context.js +18 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/files.d.ts +66 -0
- package/dist/mcp/files.js +157 -0
- package/dist/mcp/files.js.map +1 -0
- package/dist/mcp/search.d.ts +3 -0
- package/dist/mcp/search.js +9 -0
- package/dist/mcp/search.js.map +1 -0
- package/dist/mcp/server.d.ts +50 -0
- package/dist/mcp/server.js +555 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/overlay/anchors.d.ts +130 -0
- package/dist/overlay/anchors.js +365 -0
- package/dist/overlay/anchors.js.map +1 -0
- package/dist/overlay/api.d.ts +150 -0
- package/dist/overlay/api.js +259 -0
- package/dist/overlay/api.js.map +1 -0
- package/dist/overlay/attachments.d.ts +60 -0
- package/dist/overlay/attachments.js +163 -0
- package/dist/overlay/attachments.js.map +1 -0
- package/dist/overlay/browser.d.ts +1 -0
- package/dist/overlay/browser.js +203 -0
- package/dist/overlay/browser.js.map +1 -0
- package/dist/overlay/chip.d.ts +27 -0
- package/dist/overlay/chip.js +31 -0
- package/dist/overlay/chip.js.map +1 -0
- package/dist/overlay/compact.d.ts +11 -0
- package/dist/overlay/compact.js +21 -0
- package/dist/overlay/compact.js.map +1 -0
- package/dist/overlay/cssScope.d.ts +46 -0
- package/dist/overlay/cssScope.js +180 -0
- package/dist/overlay/cssScope.js.map +1 -0
- package/dist/overlay/cursor.d.ts +2 -0
- package/dist/overlay/cursor.js +68 -0
- package/dist/overlay/cursor.js.map +1 -0
- package/dist/overlay/devBrowser.d.ts +1 -0
- package/dist/overlay/devBrowser.js +18 -0
- package/dist/overlay/devBrowser.js.map +1 -0
- package/dist/overlay/devReview.d.ts +4 -0
- package/dist/overlay/devReview.js +18 -0
- package/dist/overlay/devReview.js.map +1 -0
- package/dist/overlay/directReviewer.d.ts +149 -0
- package/dist/overlay/directReviewer.js +448 -0
- package/dist/overlay/directReviewer.js.map +1 -0
- package/dist/overlay/elementDescription.d.ts +10 -0
- package/dist/overlay/elementDescription.js +251 -0
- package/dist/overlay/elementDescription.js.map +1 -0
- package/dist/overlay/icons.d.ts +8 -0
- package/dist/overlay/icons.js +36 -0
- package/dist/overlay/icons.js.map +1 -0
- package/dist/overlay/identity.d.ts +48 -0
- package/dist/overlay/identity.js +125 -0
- package/dist/overlay/identity.js.map +1 -0
- package/dist/overlay/localMachine.d.ts +23 -0
- package/dist/overlay/localMachine.js +40 -0
- package/dist/overlay/localMachine.js.map +1 -0
- package/dist/overlay/magicLink.d.ts +10 -0
- package/dist/overlay/magicLink.js +87 -0
- package/dist/overlay/magicLink.js.map +1 -0
- package/dist/overlay/modern-screenshot.js +1676 -0
- package/dist/overlay/movedAnchors.d.ts +30 -0
- package/dist/overlay/movedAnchors.js +128 -0
- package/dist/overlay/movedAnchors.js.map +1 -0
- package/dist/overlay/notificationGroups.d.ts +2 -0
- package/dist/overlay/notificationGroups.js +41 -0
- package/dist/overlay/notificationGroups.js.map +1 -0
- package/dist/overlay/permissions.d.ts +10 -0
- package/dist/overlay/permissions.js +9 -0
- package/dist/overlay/permissions.js.map +1 -0
- package/dist/overlay/pinGroups.d.ts +16 -0
- package/dist/overlay/pinGroups.js +17 -0
- package/dist/overlay/pinGroups.js.map +1 -0
- package/dist/overlay/presence.d.ts +50 -0
- package/dist/overlay/presence.js +258 -0
- package/dist/overlay/presence.js.map +1 -0
- package/dist/overlay/projectChannel.d.ts +11 -0
- package/dist/overlay/projectChannel.js +111 -0
- package/dist/overlay/projectChannel.js.map +1 -0
- package/dist/overlay/recorder.d.ts +56 -0
- package/dist/overlay/recorder.js +130 -0
- package/dist/overlay/recorder.js.map +1 -0
- package/dist/overlay/reviewMode.d.ts +21 -0
- package/dist/overlay/reviewMode.js +59 -0
- package/dist/overlay/reviewMode.js.map +1 -0
- package/dist/overlay/reviewerAuth.d.ts +131 -0
- package/dist/overlay/reviewerAuth.js +279 -0
- package/dist/overlay/reviewerAuth.js.map +1 -0
- package/dist/overlay/route.d.ts +18 -0
- package/dist/overlay/route.js +56 -0
- package/dist/overlay/route.js.map +1 -0
- package/dist/overlay/rrweb-record.js +63 -0
- package/dist/overlay/runtime.d.ts +1 -0
- package/dist/overlay/runtime.js +4857 -0
- package/dist/overlay/runtime.js.map +1 -0
- package/dist/overlay/session.d.ts +32 -0
- package/dist/overlay/session.js +76 -0
- package/dist/overlay/session.js.map +1 -0
- package/dist/overlay/sharedMode.d.ts +38 -0
- package/dist/overlay/sharedMode.js +37 -0
- package/dist/overlay/sharedMode.js.map +1 -0
- package/dist/overlay/sheet.d.ts +73 -0
- package/dist/overlay/sheet.js +278 -0
- package/dist/overlay/sheet.js.map +1 -0
- package/dist/overlay/snapshot.d.ts +26 -0
- package/dist/overlay/snapshot.js +185 -0
- package/dist/overlay/snapshot.js.map +1 -0
- package/dist/overlay/state.d.ts +63 -0
- package/dist/overlay/state.js +241 -0
- package/dist/overlay/state.js.map +1 -0
- package/dist/overlay/steps.d.ts +22 -0
- package/dist/overlay/steps.js +34 -0
- package/dist/overlay/steps.js.map +1 -0
- package/dist/overlay/styles.d.ts +7 -0
- package/dist/overlay/styles.js +1449 -0
- package/dist/overlay/styles.js.map +1 -0
- package/dist/overlay/trace.d.ts +19 -0
- package/dist/overlay/trace.js +29 -0
- package/dist/overlay/trace.js.map +1 -0
- package/dist/overlay/upload.d.ts +35 -0
- package/dist/overlay/upload.js +99 -0
- package/dist/overlay/upload.js.map +1 -0
- package/dist/plugin/astro.d.ts +31 -0
- package/dist/plugin/astro.js +22 -0
- package/dist/plugin/astro.js.map +1 -0
- package/dist/plugin/eleventy.d.ts +44 -0
- package/dist/plugin/eleventy.js +186 -0
- package/dist/plugin/eleventy.js.map +1 -0
- package/dist/plugin/next-loader.cjs +11 -0
- package/dist/plugin/next.d.ts +29 -0
- package/dist/plugin/next.js +176 -0
- package/dist/plugin/next.js.map +1 -0
- package/dist/plugin/nextOverlay.d.ts +2 -0
- package/dist/plugin/nextOverlay.js +22 -0
- package/dist/plugin/nextOverlay.js.map +1 -0
- package/dist/plugin/nextTransform.d.ts +19 -0
- package/dist/plugin/nextTransform.js +29 -0
- package/dist/plugin/nextTransform.js.map +1 -0
- package/dist/plugin/rsbuild.d.ts +25 -0
- package/dist/plugin/rsbuild.js +56 -0
- package/dist/plugin/rsbuild.js.map +1 -0
- package/dist/plugin/vite.d.ts +40 -0
- package/dist/plugin/vite.js +585 -0
- package/dist/plugin/vite.js.map +1 -0
- package/dist/plugin/webpack.d.ts +69 -0
- package/dist/plugin/webpack.js +192 -0
- package/dist/plugin/webpack.js.map +1 -0
- package/dist/remote/account.d.ts +41 -0
- package/dist/remote/account.js +177 -0
- package/dist/remote/account.js.map +1 -0
- package/dist/remote/base64url.d.ts +14 -0
- package/dist/remote/base64url.js +71 -0
- package/dist/remote/base64url.js.map +1 -0
- package/dist/remote/branchLabel.d.ts +12 -0
- package/dist/remote/branchLabel.js +20 -0
- package/dist/remote/branchLabel.js.map +1 -0
- package/dist/remote/client.d.ts +340 -0
- package/dist/remote/client.js +424 -0
- package/dist/remote/client.js.map +1 -0
- package/dist/remote/cloudApi.d.ts +72 -0
- package/dist/remote/cloudApi.js +72 -0
- package/dist/remote/cloudApi.js.map +1 -0
- package/dist/remote/codec.d.ts +54 -0
- package/dist/remote/codec.js +62 -0
- package/dist/remote/codec.js.map +1 -0
- package/dist/remote/config.d.ts +30 -0
- package/dist/remote/config.js +112 -0
- package/dist/remote/config.js.map +1 -0
- package/dist/remote/content-schema.d.ts +428 -0
- package/dist/remote/content-schema.js +209 -0
- package/dist/remote/content-schema.js.map +1 -0
- package/dist/remote/content.d.ts +44 -0
- package/dist/remote/content.js +75 -0
- package/dist/remote/content.js.map +1 -0
- package/dist/remote/envelope.d.ts +76 -0
- package/dist/remote/envelope.js +109 -0
- package/dist/remote/envelope.js.map +1 -0
- package/dist/remote/errors.d.ts +55 -0
- package/dist/remote/errors.js +63 -0
- package/dist/remote/errors.js.map +1 -0
- package/dist/remote/ids.d.ts +8 -0
- package/dist/remote/ids.js +25 -0
- package/dist/remote/ids.js.map +1 -0
- package/dist/remote/index.d.ts +7 -0
- package/dist/remote/index.js +8 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/keys.d.ts +62 -0
- package/dist/remote/keys.js +162 -0
- package/dist/remote/keys.js.map +1 -0
- package/dist/remote/localAnchors.d.ts +4 -0
- package/dist/remote/localAnchors.js +23 -0
- package/dist/remote/localAnchors.js.map +1 -0
- package/dist/remote/mapping.d.ts +11 -0
- package/dist/remote/mapping.js +22 -0
- package/dist/remote/mapping.js.map +1 -0
- package/dist/remote/presence.d.ts +63 -0
- package/dist/remote/presence.js +143 -0
- package/dist/remote/presence.js.map +1 -0
- package/dist/remote/realtime.d.ts +142 -0
- package/dist/remote/realtime.js +326 -0
- package/dist/remote/realtime.js.map +1 -0
- package/dist/remote/store.d.ts +183 -0
- package/dist/remote/store.js +907 -0
- package/dist/remote/store.js.map +1 -0
- package/dist/remote/sync.d.ts +113 -0
- package/dist/remote/sync.js +370 -0
- package/dist/remote/sync.js.map +1 -0
- package/dist/remote/types.d.ts +99 -0
- package/dist/remote/types.js +6 -0
- package/dist/remote/types.js.map +1 -0
- package/dist/setup/agents.d.ts +23 -0
- package/dist/setup/agents.js +80 -0
- package/dist/setup/agents.js.map +1 -0
- package/dist/setup/configure.d.ts +27 -0
- package/dist/setup/configure.js +201 -0
- package/dist/setup/configure.js.map +1 -0
- package/dist/setup/connect.d.ts +60 -0
- package/dist/setup/connect.js +244 -0
- package/dist/setup/connect.js.map +1 -0
- package/dist/setup/detect.d.ts +67 -0
- package/dist/setup/detect.js +168 -0
- package/dist/setup/detect.js.map +1 -0
- package/dist/setup/frameworks.d.ts +41 -0
- package/dist/setup/frameworks.js +81 -0
- package/dist/setup/frameworks.js.map +1 -0
- package/dist/sidecar/cli.d.ts +1 -0
- package/dist/sidecar/cli.js +70 -0
- package/dist/sidecar/cli.js.map +1 -0
- package/dist/sidecar/cloudSync.d.ts +33 -0
- package/dist/sidecar/cloudSync.js +139 -0
- package/dist/sidecar/cloudSync.js.map +1 -0
- package/dist/sidecar/commentFiles.d.ts +59 -0
- package/dist/sidecar/commentFiles.js +217 -0
- package/dist/sidecar/commentFiles.js.map +1 -0
- package/dist/sidecar/cssAttribution.d.ts +26 -0
- package/dist/sidecar/cssAttribution.js +114 -0
- package/dist/sidecar/cssAttribution.js.map +1 -0
- package/dist/sidecar/exportTasks.d.ts +38 -0
- package/dist/sidecar/exportTasks.js +249 -0
- package/dist/sidecar/exportTasks.js.map +1 -0
- package/dist/sidecar/http.d.ts +20 -0
- package/dist/sidecar/http.js +904 -0
- package/dist/sidecar/http.js.map +1 -0
- package/dist/sidecar/inviteTarget.d.ts +4 -0
- package/dist/sidecar/inviteTarget.js +32 -0
- package/dist/sidecar/inviteTarget.js.map +1 -0
- package/dist/sidecar/presence.d.ts +4 -0
- package/dist/sidecar/presence.js +92 -0
- package/dist/sidecar/presence.js.map +1 -0
- package/dist/storage/cliSession.d.ts +8 -0
- package/dist/storage/cliSession.js +41 -0
- package/dist/storage/cliSession.js.map +1 -0
- package/dist/storage/devStyleMap.d.ts +12 -0
- package/dist/storage/devStyleMap.js +31 -0
- package/dist/storage/devStyleMap.js.map +1 -0
- package/dist/storage/fileCache.d.ts +34 -0
- package/dist/storage/fileCache.js +122 -0
- package/dist/storage/fileCache.js.map +1 -0
- package/dist/storage/localAttachments.d.ts +82 -0
- package/dist/storage/localAttachments.js +276 -0
- package/dist/storage/localAttachments.js.map +1 -0
- package/dist/storage/localComments.d.ts +31 -0
- package/dist/storage/localComments.js +159 -0
- package/dist/storage/localComments.js.map +1 -0
- package/dist/storage/localCredentials.d.ts +74 -0
- package/dist/storage/localCredentials.js +210 -0
- package/dist/storage/localCredentials.js.map +1 -0
- package/dist/storage/localParticipants.d.ts +33 -0
- package/dist/storage/localParticipants.js +110 -0
- package/dist/storage/localParticipants.js.map +1 -0
- package/dist/storage/localRecipe.d.ts +22 -0
- package/dist/storage/localRecipe.js +46 -0
- package/dist/storage/localRecipe.js.map +1 -0
- package/dist/storage/localScreenshots.d.ts +23 -0
- package/dist/storage/localScreenshots.js +55 -0
- package/dist/storage/localScreenshots.js.map +1 -0
- package/dist/storage/localSource.d.ts +31 -0
- package/dist/storage/localSource.js +175 -0
- package/dist/storage/localSource.js.map +1 -0
- package/dist/storage/pulledComments.d.ts +81 -0
- package/dist/storage/pulledComments.js +107 -0
- package/dist/storage/pulledComments.js.map +1 -0
- package/dist/storage/remoteRecipe.d.ts +7 -0
- package/dist/storage/remoteRecipe.js +85 -0
- package/dist/storage/remoteRecipe.js.map +1 -0
- package/dist/storage/savedRemote.d.ts +2 -0
- package/dist/storage/savedRemote.js +22 -0
- package/dist/storage/savedRemote.js.map +1 -0
- package/dist/storage/sidecarAccess.d.ts +7 -0
- package/dist/storage/sidecarAccess.js +68 -0
- package/dist/storage/sidecarAccess.js.map +1 -0
- package/package.json +306 -4
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type NativeUpload } from './attachments.js';
|
|
2
|
+
import type { LocalCommentBody } from './payload.js';
|
|
3
|
+
import type { Anchor, Participant } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* The slice of `fetch` this client uses. React Native's global fetch is not in the app's type
|
|
6
|
+
* libraries, so it is typed here. A body is JSON text, or a file's bytes (a Blob on React Native).
|
|
7
|
+
*/
|
|
8
|
+
export type FetchLike = (url: string, init: {
|
|
9
|
+
method: string;
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
}) => Promise<{
|
|
13
|
+
ok: boolean;
|
|
14
|
+
status: number;
|
|
15
|
+
text(): Promise<string>;
|
|
16
|
+
}>;
|
|
17
|
+
/** Where an attached file is read from: an `Image` source, headers included. */
|
|
18
|
+
export type AttachmentSource = {
|
|
19
|
+
uri: string;
|
|
20
|
+
headers: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
export type MessageEdit = {
|
|
23
|
+
body: string;
|
|
24
|
+
};
|
|
25
|
+
export type StatusChange = {
|
|
26
|
+
status: 'open' | 'resolved';
|
|
27
|
+
};
|
|
28
|
+
/** An edit with nothing in it is refused here, before anything is sent. */
|
|
29
|
+
export declare function editedBody(edit: MessageEdit): string;
|
|
30
|
+
/** The local API on Metro's dev server: the same `/__fb/*` routes the web overlay calls. */
|
|
31
|
+
export declare function localApi(base: string, fetchImpl?: FetchLike): {
|
|
32
|
+
/** No stored id on a phone: the sidecar recognises a returning reviewer by address and asks to confirm. */
|
|
33
|
+
identify: () => Promise<{
|
|
34
|
+
participant: Participant | null;
|
|
35
|
+
needsConfirmation: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
saveParticipant: (id: string, name: string) => Promise<{
|
|
38
|
+
participant: Participant;
|
|
39
|
+
}>;
|
|
40
|
+
listComments: () => Promise<{
|
|
41
|
+
comments: unknown[];
|
|
42
|
+
}>;
|
|
43
|
+
createComment: (body: LocalCommentBody) => Promise<{
|
|
44
|
+
comment: unknown;
|
|
45
|
+
}>;
|
|
46
|
+
addReply: (id: string, body: {
|
|
47
|
+
author: string;
|
|
48
|
+
authorId: string | null;
|
|
49
|
+
body: string;
|
|
50
|
+
anchor: Anchor;
|
|
51
|
+
attachmentIds?: string[];
|
|
52
|
+
}) => Promise<{
|
|
53
|
+
reply: unknown;
|
|
54
|
+
}>;
|
|
55
|
+
/** A status change, or a new text: never both in one call. */
|
|
56
|
+
updateComment: (id: string, change: StatusChange | MessageEdit) => Promise<{
|
|
57
|
+
comment: unknown;
|
|
58
|
+
}>;
|
|
59
|
+
updateReply: (id: string, replyId: string, edit: MessageEdit) => Promise<{
|
|
60
|
+
reply: unknown;
|
|
61
|
+
}>;
|
|
62
|
+
deleteComment: (id: string) => Promise<null>;
|
|
63
|
+
/** Uploads one file's bytes. It belongs to nothing until a comment or reply claims its id. */
|
|
64
|
+
uploadAttachment(name: string, raw: unknown): Promise<NativeUpload>;
|
|
65
|
+
/** Removes an upload nothing claimed. Quiet: the dev server forgets unclaimed uploads anyway. */
|
|
66
|
+
discardUpload(id: string): Promise<void>;
|
|
67
|
+
attachmentSource: (commentId: string, attachmentId: string) => AttachmentSource;
|
|
68
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { refusalOf, UploadRefused, uploadOf } from './attachments.js';
|
|
2
|
+
const parsed = (text) => {
|
|
3
|
+
try {
|
|
4
|
+
return text ? JSON.parse(text) : null;
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
/** An edit with nothing in it is refused here, before anything is sent. */
|
|
11
|
+
export function editedBody(edit) {
|
|
12
|
+
const body = typeof edit.body === 'string' ? edit.body.trim() : '';
|
|
13
|
+
if (!body)
|
|
14
|
+
throw new Error('Write something first');
|
|
15
|
+
return body;
|
|
16
|
+
}
|
|
17
|
+
/** The local API on Metro's dev server: the same `/__fb/*` routes the web overlay calls. */
|
|
18
|
+
export function localApi(base, fetchImpl = globalThis.fetch) {
|
|
19
|
+
async function call(path, init = {}) {
|
|
20
|
+
const response = await fetchImpl(`${base}/__fb${path}`, {
|
|
21
|
+
method: init.method ?? 'GET',
|
|
22
|
+
headers: { 'content-type': 'application/json' },
|
|
23
|
+
...(init.body === undefined ? {} : { body: JSON.stringify(init.body) }),
|
|
24
|
+
});
|
|
25
|
+
const text = await response.text();
|
|
26
|
+
const data = text ? JSON.parse(text) : null;
|
|
27
|
+
if (!response.ok)
|
|
28
|
+
throw new Error(data?.error ?? `The dev server answered ${response.status}`);
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
const commentPath = (id) => `/comments/${encodeURIComponent(id)}`;
|
|
32
|
+
return {
|
|
33
|
+
/** No stored id on a phone: the sidecar recognises a returning reviewer by address and asks to confirm. */
|
|
34
|
+
identify: () => call('/identify', { method: 'POST', body: { id: null } }),
|
|
35
|
+
saveParticipant: (id, name) => call('/participants', { method: 'POST', body: { id, name } }),
|
|
36
|
+
listComments: () => call('/comments'),
|
|
37
|
+
createComment: (body) => {
|
|
38
|
+
const { attachmentIds, ...rest } = body;
|
|
39
|
+
return call('/comments', { method: 'POST', body: attachmentIds?.length ? { ...rest, attachmentIds } : rest });
|
|
40
|
+
},
|
|
41
|
+
addReply: (id, body) => {
|
|
42
|
+
const { attachmentIds, ...rest } = body;
|
|
43
|
+
return call(`${commentPath(id)}/replies`, { method: 'POST', body: attachmentIds?.length ? { ...rest, attachmentIds } : rest });
|
|
44
|
+
},
|
|
45
|
+
/** A status change, or a new text: never both in one call. */
|
|
46
|
+
updateComment: async (id, change) => call(commentPath(id), {
|
|
47
|
+
method: 'PATCH',
|
|
48
|
+
body: 'status' in change ? { status: change.status } : { body: editedBody(change) },
|
|
49
|
+
}),
|
|
50
|
+
updateReply: async (id, replyId, edit) => call(`${commentPath(id)}/replies/${encodeURIComponent(replyId)}`, { method: 'PATCH', body: { body: editedBody(edit) } }),
|
|
51
|
+
deleteComment: (id) => call(commentPath(id), { method: 'DELETE' }),
|
|
52
|
+
/** Uploads one file's bytes. It belongs to nothing until a comment or reply claims its id. */
|
|
53
|
+
async uploadAttachment(name, raw) {
|
|
54
|
+
let response;
|
|
55
|
+
let data;
|
|
56
|
+
try {
|
|
57
|
+
response = await fetchImpl(`${base}/__fb/uploads?name=${encodeURIComponent(name)}`, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: { 'content-type': 'application/octet-stream' },
|
|
60
|
+
body: raw,
|
|
61
|
+
});
|
|
62
|
+
data = parsed(await response.text());
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
throw new UploadRefused('failed');
|
|
66
|
+
}
|
|
67
|
+
if (!response.ok)
|
|
68
|
+
throw refusalOf(response.status, data);
|
|
69
|
+
return uploadOf(data);
|
|
70
|
+
},
|
|
71
|
+
/** Removes an upload nothing claimed. Quiet: the dev server forgets unclaimed uploads anyway. */
|
|
72
|
+
async discardUpload(id) {
|
|
73
|
+
try {
|
|
74
|
+
await fetchImpl(`${base}/__fb/uploads/${encodeURIComponent(id)}`, { method: 'DELETE', headers: {} });
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Nothing to tell the reviewer.
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
attachmentSource: (commentId, attachmentId) => ({
|
|
81
|
+
uri: `${base}/__fb/attachments/${encodeURIComponent(commentId)}/${encodeURIComponent(attachmentId)}`,
|
|
82
|
+
headers: {},
|
|
83
|
+
}),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/expo/app/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAqB,MAAM,kBAAkB,CAAC;AAkBzF,MAAM,MAAM,GAAG,CAAC,IAAY,EAAW,EAAE;IACvC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,UAAU,UAAU,CAAC,IAAiB;IAC1C,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,YAAwB,UAA8C,CAAC,KAAK;IACjH,KAAK,UAAU,IAAI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AAG,EAAE,GAAG,IAAI,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,IAAI,kBAAkB,CAAC,YAAY,CAAC,EAAE;YACpG,OAAO,EAAE,EAAE;SACZ,CAAC;KACH,CAAC;AACJ,CAAC"}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Files on a comment or a reply, for the native overlay.
|
|
3
|
+
*
|
|
4
|
+
* The rules are a copy of `src/core/attachmentTypes.ts` (this folder compiles on its own and cannot
|
|
5
|
+
* import it); test/expo-attachments-check.mjs compares the two. The refusal words follow
|
|
6
|
+
* `src/overlay/upload.ts`. The server still checks every file's bytes.
|
|
7
|
+
*/
|
|
8
|
+
export type AttachmentKind = 'image' | 'document';
|
|
9
|
+
export type AttachmentType = {
|
|
10
|
+
type: string;
|
|
11
|
+
kind: AttachmentKind | 'recording';
|
|
12
|
+
mime: string;
|
|
13
|
+
extensions: string[];
|
|
14
|
+
maxBytes: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const ATTACHMENTS: {
|
|
17
|
+
maxFilesPerMessage: number;
|
|
18
|
+
types: AttachmentType[];
|
|
19
|
+
};
|
|
20
|
+
/** Every allowed MIME type once: what the document picker is asked to offer. */
|
|
21
|
+
export declare const pickerMimeTypes: string[];
|
|
22
|
+
/** Before uploading: what the name (or, for a photo without one, the type) and size allow. */
|
|
23
|
+
export declare function precheckAttachment(file: {
|
|
24
|
+
name: string;
|
|
25
|
+
size: number;
|
|
26
|
+
type?: string;
|
|
27
|
+
}): {
|
|
28
|
+
ok: true;
|
|
29
|
+
kind: AttachmentKind;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
reason: 'type' | 'size' | 'empty';
|
|
33
|
+
limit?: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function refusalText(reason: 'type' | 'size' | 'empty' | 'count', limit?: number): string;
|
|
36
|
+
export declare function formatBytes(bytes: number): string;
|
|
37
|
+
/** Why a file did not upload; its message is what the composer shows. */
|
|
38
|
+
export declare class UploadRefused extends Error {
|
|
39
|
+
readonly reason: 'type' | 'size' | 'quota' | 'rate' | 'unavailable' | 'failed';
|
|
40
|
+
readonly limit?: number | undefined;
|
|
41
|
+
constructor(reason: 'type' | 'size' | 'quota' | 'rate' | 'unavailable' | 'failed', limit?: number | undefined);
|
|
42
|
+
}
|
|
43
|
+
/** A refusal in either shape: the API's `{error: {code, details}}`, or the sidecar's `{error, reason, limit}`. */
|
|
44
|
+
export declare function refusalOf(status: number, body: unknown, file?: {
|
|
45
|
+
name: string;
|
|
46
|
+
size: number;
|
|
47
|
+
type?: string;
|
|
48
|
+
}): UploadRefused;
|
|
49
|
+
export type NativeUpload = {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
mime: string;
|
|
53
|
+
kind: AttachmentKind;
|
|
54
|
+
bytes: number;
|
|
55
|
+
width?: number;
|
|
56
|
+
height?: number;
|
|
57
|
+
};
|
|
58
|
+
export type NativeAttachment = {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
mime: string;
|
|
62
|
+
kind: AttachmentKind;
|
|
63
|
+
bytes: number;
|
|
64
|
+
width: number | null;
|
|
65
|
+
height: number | null;
|
|
66
|
+
replyId: string | null;
|
|
67
|
+
};
|
|
68
|
+
export declare function uploadOf(body: unknown): NativeUpload;
|
|
69
|
+
/** The files a comment or reply lists, valid ones only, at most twice the per-message limit. */
|
|
70
|
+
export declare function parseAttachments(value: unknown): NativeAttachment[];
|
|
71
|
+
/** Where the app picks a file from. */
|
|
72
|
+
export type PickSource = 'library' | 'camera' | 'files';
|
|
73
|
+
export declare const pickSources: readonly PickSource[];
|
|
74
|
+
/** A file the reviewer picked: a local URI to read the bytes from. */
|
|
75
|
+
export type PickedFile = {
|
|
76
|
+
uri: string;
|
|
77
|
+
name: string;
|
|
78
|
+
mime: string | null;
|
|
79
|
+
size: number | null;
|
|
80
|
+
};
|
|
81
|
+
export type FilePicker = (source: PickSource, limit: number) => Promise<PickedFile[]>;
|
|
82
|
+
/** A picker failure whose message is meant for the reviewer (a refused camera, say). */
|
|
83
|
+
export declare class FilePickError extends Error {
|
|
84
|
+
constructor(message?: string);
|
|
85
|
+
}
|
|
86
|
+
/** What a picker returned, checked: a string URI each, a name, at most `limit` files. */
|
|
87
|
+
export declare function pickedFiles(value: unknown, limit: number): PickedFile[];
|
|
88
|
+
/** Something `fetch` can send as a raw body: on React Native, a Blob read from a file URI. */
|
|
89
|
+
export type RawBody = {
|
|
90
|
+
readonly size: number;
|
|
91
|
+
};
|
|
92
|
+
/** Reads a picked file's bytes. React Native's fetch reads `file://` and `content://` URIs. */
|
|
93
|
+
export declare function fileBody(uri: string): Promise<RawBody>;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
const IMAGE_BYTES = 5242880;
|
|
2
|
+
const DOCUMENT_BYTES = 10485760;
|
|
3
|
+
const documentType = (type, mime) => ({ type, kind: 'document', mime, extensions: [type], maxBytes: DOCUMENT_BYTES });
|
|
4
|
+
export const ATTACHMENTS = {
|
|
5
|
+
maxFilesPerMessage: 5,
|
|
6
|
+
types: [
|
|
7
|
+
{ type: 'png', kind: 'image', mime: 'image/png', extensions: ['png'], maxBytes: IMAGE_BYTES },
|
|
8
|
+
{ type: 'jpeg', kind: 'image', mime: 'image/jpeg', extensions: ['jpg', 'jpeg'], maxBytes: IMAGE_BYTES },
|
|
9
|
+
{ type: 'webp', kind: 'image', mime: 'image/webp', extensions: ['webp'], maxBytes: IMAGE_BYTES },
|
|
10
|
+
{ type: 'gif', kind: 'image', mime: 'image/gif', extensions: ['gif'], maxBytes: IMAGE_BYTES },
|
|
11
|
+
documentType('pdf', 'application/pdf'),
|
|
12
|
+
documentType('docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'),
|
|
13
|
+
documentType('xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'),
|
|
14
|
+
documentType('pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'),
|
|
15
|
+
documentType('txt', 'text/plain'),
|
|
16
|
+
documentType('md', 'text/plain'),
|
|
17
|
+
documentType('csv', 'text/plain'),
|
|
18
|
+
documentType('json', 'text/plain'),
|
|
19
|
+
documentType('log', 'text/plain'),
|
|
20
|
+
{ type: 'rrweb', kind: 'recording', mime: 'application/vnd.ontrackd.recording+gzip', extensions: ['rrweb'], maxBytes: DOCUMENT_BYTES },
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
const MAX_ATTACHMENT_BYTES = Math.max(...ATTACHMENTS.types.map((entry) => entry.maxBytes));
|
|
24
|
+
/** Every allowed MIME type once: what the document picker is asked to offer. */
|
|
25
|
+
export const pickerMimeTypes = [...new Set(ATTACHMENTS.types.filter((entry) => entry.kind !== 'recording').map((entry) => entry.mime))];
|
|
26
|
+
const LONE_SURROGATE = /[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;
|
|
27
|
+
const INVISIBLE = /[\u061c\u200b-\u200f\u2028-\u202e\u2066-\u2069\ufeff]/g;
|
|
28
|
+
function cleanName(name) {
|
|
29
|
+
return name.replace(/[\u0000-\u001f\u007f-\u009f]/g, '').replace(LONE_SURROGATE, '').replace(INVISIBLE, '').replace(/[/\\]/g, '')
|
|
30
|
+
.trim().replace(/^\.+/, '').trim();
|
|
31
|
+
}
|
|
32
|
+
const extensionOf = (name) => {
|
|
33
|
+
const dot = name.lastIndexOf('.');
|
|
34
|
+
return dot > 0 ? name.slice(dot + 1).toLowerCase() : '';
|
|
35
|
+
};
|
|
36
|
+
const byExtension = (extension) => extension ? ATTACHMENTS.types.find((entry) => entry.extensions.includes(extension)) : undefined;
|
|
37
|
+
/** Before uploading: what the name (or, for a photo without one, the type) and size allow. */
|
|
38
|
+
export function precheckAttachment(file) {
|
|
39
|
+
const type = byExtension(extensionOf(cleanName(file.name))) ?? ATTACHMENTS.types.find((entry) => entry.kind === 'image' && entry.mime === file.type);
|
|
40
|
+
// A recording is made by the web overlay's Record button: this one does not record, and never picks one.
|
|
41
|
+
if (!type || type.kind === 'recording')
|
|
42
|
+
return { ok: false, reason: 'type' };
|
|
43
|
+
if (file.size === 0)
|
|
44
|
+
return { ok: false, reason: 'empty' };
|
|
45
|
+
if (file.size > type.maxBytes)
|
|
46
|
+
return { ok: false, reason: 'size', limit: type.maxBytes };
|
|
47
|
+
return { ok: true, kind: type.kind };
|
|
48
|
+
}
|
|
49
|
+
export function refusalText(reason, limit) {
|
|
50
|
+
if (reason === 'size')
|
|
51
|
+
return `Over ${Math.round((limit ?? MAX_ATTACHMENT_BYTES) / 1048576)} MB`;
|
|
52
|
+
if (reason === 'count')
|
|
53
|
+
return `${ATTACHMENTS.maxFilesPerMessage} files at most`;
|
|
54
|
+
if (reason === 'empty')
|
|
55
|
+
return 'This file is empty';
|
|
56
|
+
return 'Only images and documents';
|
|
57
|
+
}
|
|
58
|
+
export function formatBytes(bytes) {
|
|
59
|
+
if (bytes < 1024)
|
|
60
|
+
return `${bytes} B`;
|
|
61
|
+
if (bytes < 1048576)
|
|
62
|
+
return `${Math.round(bytes / 1024)} KB`;
|
|
63
|
+
return `${(bytes / 1048576).toFixed(1)} MB`;
|
|
64
|
+
}
|
|
65
|
+
/** Why a file did not upload; its message is what the composer shows. */
|
|
66
|
+
export class UploadRefused extends Error {
|
|
67
|
+
reason;
|
|
68
|
+
limit;
|
|
69
|
+
constructor(reason, limit) {
|
|
70
|
+
super(reason === 'type' ? refusalText('type') : reason === 'size' ? refusalText('size', limit)
|
|
71
|
+
: reason === 'quota' ? 'No room left for files in this review' : reason === 'rate' ? 'Too many files at once: try again in a minute'
|
|
72
|
+
: reason === 'unavailable' ? 'Files cannot be attached here' : 'Did not upload');
|
|
73
|
+
this.reason = reason;
|
|
74
|
+
this.limit = limit;
|
|
75
|
+
this.name = 'UploadRefused';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
79
|
+
/** A refusal in either shape: the API's `{error: {code, details}}`, or the sidecar's `{error, reason, limit}`. */
|
|
80
|
+
export function refusalOf(status, body, file) {
|
|
81
|
+
const record = isRecord(body) ? body : {};
|
|
82
|
+
const envelope = isRecord(record.error) ? record.error : null;
|
|
83
|
+
const details = envelope && isRecord(envelope.details) ? envelope.details : null;
|
|
84
|
+
const reason = String(details?.reason ?? record.reason ?? '');
|
|
85
|
+
const limit = Number(details?.limit ?? record.limit) || undefined;
|
|
86
|
+
if (reason === 'attachment_type' || reason === 'attachment_empty')
|
|
87
|
+
return new UploadRefused('type');
|
|
88
|
+
if (envelope?.code === 'storage_quota_exceeded' || reason === 'storage_quota')
|
|
89
|
+
return new UploadRefused('quota');
|
|
90
|
+
if (status === 413 && reason === 'attachment_size')
|
|
91
|
+
return new UploadRefused('size', limit);
|
|
92
|
+
if (status === 413) {
|
|
93
|
+
const own = file ? precheckAttachment(file) : null;
|
|
94
|
+
return own && !own.ok && own.reason === 'size' ? new UploadRefused('size', own.limit) : new UploadRefused('failed');
|
|
95
|
+
}
|
|
96
|
+
if (status === 429)
|
|
97
|
+
return new UploadRefused('rate');
|
|
98
|
+
if (status === 403)
|
|
99
|
+
return new UploadRefused('unavailable');
|
|
100
|
+
return new UploadRefused('failed');
|
|
101
|
+
}
|
|
102
|
+
const attachmentId = /^att_[0-9a-z]{24,26}$/;
|
|
103
|
+
const bounded = (value, limit) => [...value].slice(0, limit).join('');
|
|
104
|
+
const size = (value) => typeof value === 'number' && Number.isFinite(value) && value >= 0 ? Math.floor(value) : null;
|
|
105
|
+
export function uploadOf(body) {
|
|
106
|
+
const value = isRecord(body) ? body : {};
|
|
107
|
+
if (typeof value.id !== 'string' || !attachmentId.test(value.id) || (value.kind !== 'image' && value.kind !== 'document'))
|
|
108
|
+
throw new UploadRefused('failed');
|
|
109
|
+
return {
|
|
110
|
+
id: value.id,
|
|
111
|
+
name: typeof value.name === 'string' ? bounded(value.name, 255) : 'file',
|
|
112
|
+
mime: typeof value.mime === 'string' ? bounded(value.mime, 200) : 'application/octet-stream',
|
|
113
|
+
kind: value.kind,
|
|
114
|
+
bytes: size(value.bytes) ?? 0,
|
|
115
|
+
...(size(value.width) !== null && size(value.height) !== null ? { width: size(value.width), height: size(value.height) } : {}),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** The files a comment or reply lists, valid ones only, at most twice the per-message limit. */
|
|
119
|
+
export function parseAttachments(value) {
|
|
120
|
+
if (!Array.isArray(value))
|
|
121
|
+
return [];
|
|
122
|
+
const files = [];
|
|
123
|
+
for (const item of value.slice(0, ATTACHMENTS.maxFilesPerMessage * 2)) {
|
|
124
|
+
if (!isRecord(item)
|
|
125
|
+
|| typeof item.id !== 'string' || !attachmentId.test(item.id)
|
|
126
|
+
|| (item.kind !== 'image' && item.kind !== 'document')
|
|
127
|
+
|| typeof item.name !== 'string'
|
|
128
|
+
|| typeof item.mime !== 'string')
|
|
129
|
+
continue;
|
|
130
|
+
files.push({
|
|
131
|
+
id: item.id,
|
|
132
|
+
name: bounded(item.name, 255),
|
|
133
|
+
mime: bounded(item.mime, 200),
|
|
134
|
+
kind: item.kind,
|
|
135
|
+
bytes: size(item.bytes) ?? 0,
|
|
136
|
+
width: size(item.width),
|
|
137
|
+
height: size(item.height),
|
|
138
|
+
replyId: typeof item.replyId === 'string' ? bounded(item.replyId, 128) : null,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return files;
|
|
142
|
+
}
|
|
143
|
+
export const pickSources = ['library', 'camera', 'files'];
|
|
144
|
+
/** A picker failure whose message is meant for the reviewer (a refused camera, say). */
|
|
145
|
+
export class FilePickError extends Error {
|
|
146
|
+
constructor(message = 'Could not open your files') {
|
|
147
|
+
super(message);
|
|
148
|
+
this.name = 'FilePickError';
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/** What a picker returned, checked: a string URI each, a name, at most `limit` files. */
|
|
152
|
+
export function pickedFiles(value, limit) {
|
|
153
|
+
if (!Array.isArray(value))
|
|
154
|
+
return [];
|
|
155
|
+
const files = [];
|
|
156
|
+
for (const item of value) {
|
|
157
|
+
if (files.length >= limit)
|
|
158
|
+
break;
|
|
159
|
+
if (!isRecord(item) || typeof item.uri !== 'string' || !item.uri || item.uri.length > 4096)
|
|
160
|
+
continue;
|
|
161
|
+
const named = typeof item.name === 'string' && item.name.trim() ? item.name : '';
|
|
162
|
+
files.push({
|
|
163
|
+
uri: item.uri,
|
|
164
|
+
name: bounded(named || 'file', 255),
|
|
165
|
+
mime: typeof item.mime === 'string' ? bounded(item.mime, 200) : null,
|
|
166
|
+
size: size(item.size),
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return files;
|
|
170
|
+
}
|
|
171
|
+
/** Reads a picked file's bytes. React Native's fetch reads `file://` and `content://` URIs. */
|
|
172
|
+
export async function fileBody(uri) {
|
|
173
|
+
const fetchImpl = globalThis.fetch;
|
|
174
|
+
try {
|
|
175
|
+
return await (await fetchImpl(uri)).blob();
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
throw new UploadRefused('failed');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=attachments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachments.js","sourceRoot":"","sources":["../../../src/expo/app/attachments.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,GAAG,OAAO,CAAC;AAC5B,MAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,IAAY,EAAkB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,cAA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AC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI;YAAE,SAAS;QACrG,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,KAAK,CAAC,IAAI,CAAC;YACT,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,OAAO,CAAC,KAAK,IAAI,MAAM,EAAE,GAAG,CAAC;YACnC,IAAI,EAAE,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;YACpE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;SACtB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAKD,+FAA+F;AAC/F,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAW;IACxC,MAAM,SAAS,GAAI,UAA2F,CAAC,KAAK,CAAC;IACrH,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type AttachmentSource, type FetchLike, type MessageEdit, type StatusChange } from './api.js';
|
|
2
|
+
import { type NativeUpload } from './attachments.js';
|
|
3
|
+
import { type CloudSession } from './cloudSession.js';
|
|
4
|
+
import type { LocalCommentBody } from './payload.js';
|
|
5
|
+
import { type RandomBytes } from './random.js';
|
|
6
|
+
import type { AnchorTranslation } from './movedAnchors.js';
|
|
7
|
+
import type { Anchor } from './types.js';
|
|
8
|
+
export declare const cloudMessages: {
|
|
9
|
+
readonly signedOut: "You were signed out. Sign in again to continue.";
|
|
10
|
+
readonly notAuthor: "Only the author or a project admin can change this.";
|
|
11
|
+
readonly cannotReach: "We could not reach the feedback service. Try again in a moment.";
|
|
12
|
+
readonly somethingWentWrong: "Something went wrong at our end. Try again in a moment.";
|
|
13
|
+
};
|
|
14
|
+
/** The server no longer accepts this sign-in. The caller removes it and asks to sign in again. */
|
|
15
|
+
export declare class CloudSignedOutError extends Error {
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
export type CloudApiConfig = {
|
|
19
|
+
apiBase: string;
|
|
20
|
+
projectId: string;
|
|
21
|
+
sessionId: string;
|
|
22
|
+
branch?: string;
|
|
23
|
+
buildId?: string;
|
|
24
|
+
};
|
|
25
|
+
export type CloudApiDependencies = {
|
|
26
|
+
fetch?: FetchLike;
|
|
27
|
+
random?: RandomBytes;
|
|
28
|
+
};
|
|
29
|
+
/** The `/v0` session calls the native overlay needs, with the same methods as `localApi`. */
|
|
30
|
+
export declare function cloudApi(config: CloudApiConfig, session: CloudSession, dependencies?: CloudApiDependencies): {
|
|
31
|
+
listComments: () => Promise<{
|
|
32
|
+
comments: unknown[];
|
|
33
|
+
}>;
|
|
34
|
+
translateAnchors: (build: string, from: Array<{
|
|
35
|
+
buildId: string;
|
|
36
|
+
anchorId: string;
|
|
37
|
+
}>) => Promise<Map<string, AnchorTranslation> | null>;
|
|
38
|
+
createComment(body: LocalCommentBody): Promise<{
|
|
39
|
+
comment: unknown;
|
|
40
|
+
}>;
|
|
41
|
+
addReply(id: string, body: {
|
|
42
|
+
body: string;
|
|
43
|
+
anchor: Anchor;
|
|
44
|
+
attachmentIds?: string[];
|
|
45
|
+
}): Promise<{
|
|
46
|
+
reply: unknown;
|
|
47
|
+
}>;
|
|
48
|
+
/** A status change, or a new text for the comment: never both in one call. */
|
|
49
|
+
updateComment(id: string, change: StatusChange | MessageEdit): Promise<{
|
|
50
|
+
comment: unknown;
|
|
51
|
+
}>;
|
|
52
|
+
/** A new text for one of the reviewer's replies. */
|
|
53
|
+
updateReply(id: string, replyId: string, change: MessageEdit): Promise<{
|
|
54
|
+
reply: unknown;
|
|
55
|
+
}>;
|
|
56
|
+
/** Uploads one file's bytes. It belongs to nothing until a comment or reply claims its id. */
|
|
57
|
+
uploadAttachment(name: string, raw: unknown): Promise<NativeUpload>;
|
|
58
|
+
/** Removes an upload nothing claimed. Quiet: unclaimed uploads expire on their own. */
|
|
59
|
+
discardUpload(uploadId: string): Promise<void>;
|
|
60
|
+
attachmentSource: (commentId: string, attachmentId: string) => AttachmentSource;
|
|
61
|
+
deleteComment(id: string): Promise<null>;
|
|
62
|
+
};
|
|
63
|
+
export type CloudApi = ReturnType<typeof cloudApi>;
|