@despia-native/kernel 0.0.0-coming-soon.0 → 0.3.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 +202 -0
- package/NOTICE +1414 -0
- package/README.md +16 -1
- package/dist/.dsx-build-stamp.json +7 -0
- package/dist/api-cohort.d.ts +27 -0
- package/dist/api-cohort.d.ts.map +1 -0
- package/dist/api-cohort.js +94 -0
- package/dist/api-cohort.js.map +1 -0
- package/dist/api.d.ts +454 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +2442 -0
- package/dist/api.js.map +1 -0
- package/dist/app-consts.d.ts +10 -0
- package/dist/app-consts.d.ts.map +1 -0
- package/dist/app-consts.js +39 -0
- package/dist/app-consts.js.map +1 -0
- package/dist/app-update.d.ts +12 -0
- package/dist/app-update.d.ts.map +1 -0
- package/dist/app-update.js +32 -0
- package/dist/app-update.js.map +1 -0
- package/dist/aria.d.ts +152 -0
- package/dist/aria.d.ts.map +1 -0
- package/dist/aria.js +524 -0
- package/dist/aria.js.map +1 -0
- package/dist/audio-core.d.ts +260 -0
- package/dist/audio-core.d.ts.map +1 -0
- package/dist/audio-core.js +1440 -0
- package/dist/audio-core.js.map +1 -0
- package/dist/audio-edit.d.ts +100 -0
- package/dist/audio-edit.d.ts.map +1 -0
- package/dist/audio-edit.js +489 -0
- package/dist/audio-edit.js.map +1 -0
- package/dist/audio-mix.d.ts +84 -0
- package/dist/audio-mix.d.ts.map +1 -0
- package/dist/audio-mix.js +393 -0
- package/dist/audio-mix.js.map +1 -0
- package/dist/auth-proof.d.ts +145 -0
- package/dist/auth-proof.d.ts.map +1 -0
- package/dist/auth-proof.js +644 -0
- package/dist/auth-proof.js.map +1 -0
- package/dist/availability-explain.d.ts +3 -0
- package/dist/availability-explain.d.ts.map +1 -0
- package/dist/availability-explain.js +322 -0
- package/dist/availability-explain.js.map +1 -0
- package/dist/availability.d.ts +246 -0
- package/dist/availability.d.ts.map +1 -0
- package/dist/availability.js +615 -0
- package/dist/availability.js.map +1 -0
- package/dist/background.d.ts +116 -0
- package/dist/background.d.ts.map +1 -0
- package/dist/background.js +235 -0
- package/dist/background.js.map +1 -0
- package/dist/boot-tables-flag.d.ts +2 -0
- package/dist/boot-tables-flag.d.ts.map +1 -0
- package/dist/boot-tables-flag.js +16 -0
- package/dist/boot-tables-flag.js.map +1 -0
- package/dist/boot-tables.d.ts +40 -0
- package/dist/boot-tables.d.ts.map +1 -0
- package/dist/boot-tables.js +102 -0
- package/dist/boot-tables.js.map +1 -0
- package/dist/border-edges.d.ts +5 -0
- package/dist/border-edges.d.ts.map +1 -0
- package/dist/border-edges.js +47 -0
- package/dist/border-edges.js.map +1 -0
- package/dist/bus.d.ts +1203 -0
- package/dist/bus.d.ts.map +1 -0
- package/dist/bus.js +2647 -0
- package/dist/bus.js.map +1 -0
- package/dist/calendar-core.d.ts +143 -0
- package/dist/calendar-core.d.ts.map +1 -0
- package/dist/calendar-core.js +372 -0
- package/dist/calendar-core.js.map +1 -0
- package/dist/call-value.d.ts +16 -0
- package/dist/call-value.d.ts.map +1 -0
- package/dist/call-value.js +54 -0
- package/dist/call-value.js.map +1 -0
- package/dist/camera-core.d.ts +222 -0
- package/dist/camera-core.d.ts.map +1 -0
- package/dist/camera-core.js +980 -0
- package/dist/camera-core.js.map +1 -0
- package/dist/canvas-core.d.ts +404 -0
- package/dist/canvas-core.d.ts.map +1 -0
- package/dist/canvas-core.js +2186 -0
- package/dist/canvas-core.js.map +1 -0
- package/dist/capture-core.d.ts +74 -0
- package/dist/capture-core.d.ts.map +1 -0
- package/dist/capture-core.js +158 -0
- package/dist/capture-core.js.map +1 -0
- package/dist/compile/codegen.d.ts +146 -0
- package/dist/compile/codegen.d.ts.map +1 -0
- package/dist/compile/codegen.js +1949 -0
- package/dist/compile/codegen.js.map +1 -0
- package/dist/compile/jstier.d.ts +44 -0
- package/dist/compile/jstier.d.ts.map +1 -0
- package/dist/compile/jstier.js +181 -0
- package/dist/compile/jstier.js.map +1 -0
- package/dist/compile/tier-door.d.ts +41 -0
- package/dist/compile/tier-door.d.ts.map +1 -0
- package/dist/compile/tier-door.js +167 -0
- package/dist/compile/tier-door.js.map +1 -0
- package/dist/compile/tier-realm.d.ts +49 -0
- package/dist/compile/tier-realm.d.ts.map +1 -0
- package/dist/compile/tier-realm.js +368 -0
- package/dist/compile/tier-realm.js.map +1 -0
- package/dist/compile/tier.d.ts +23 -0
- package/dist/compile/tier.d.ts.map +1 -0
- package/dist/compile/tier.js +157 -0
- package/dist/compile/tier.js.map +1 -0
- package/dist/compose-core.d.ts +86 -0
- package/dist/compose-core.d.ts.map +1 -0
- package/dist/compose-core.js +112 -0
- package/dist/compose-core.js.map +1 -0
- package/dist/config-validate.d.ts +31 -0
- package/dist/config-validate.d.ts.map +1 -0
- package/dist/config-validate.js +147 -0
- package/dist/config-validate.js.map +1 -0
- package/dist/config-values.d.ts +106 -0
- package/dist/config-values.d.ts.map +1 -0
- package/dist/config-values.js +340 -0
- package/dist/config-values.js.map +1 -0
- package/dist/contacts-core.d.ts +127 -0
- package/dist/contacts-core.d.ts.map +1 -0
- package/dist/contacts-core.js +211 -0
- package/dist/contacts-core.js.map +1 -0
- package/dist/content-transition.d.ts +58 -0
- package/dist/content-transition.d.ts.map +1 -0
- package/dist/content-transition.js +94 -0
- package/dist/content-transition.js.map +1 -0
- package/dist/controls-core.d.ts +227 -0
- package/dist/controls-core.d.ts.map +1 -0
- package/dist/controls-core.js +652 -0
- package/dist/controls-core.js.map +1 -0
- package/dist/cookies.d.ts +78 -0
- package/dist/cookies.d.ts.map +1 -0
- package/dist/cookies.js +265 -0
- package/dist/cookies.js.map +1 -0
- package/dist/corner-shape-core.d.ts +69 -0
- package/dist/corner-shape-core.d.ts.map +1 -0
- package/dist/corner-shape-core.js +261 -0
- package/dist/corner-shape-core.js.map +1 -0
- package/dist/crypto-core.d.ts +57 -0
- package/dist/crypto-core.d.ts.map +1 -0
- package/dist/crypto-core.js +128 -0
- package/dist/crypto-core.js.map +1 -0
- package/dist/dataviz.d.ts +436 -0
- package/dist/dataviz.d.ts.map +1 -0
- package/dist/dataviz.js +956 -0
- package/dist/dataviz.js.map +1 -0
- package/dist/debug.d.ts +293 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +767 -0
- package/dist/debug.js.map +1 -0
- package/dist/device-ownership.d.ts +50 -0
- package/dist/device-ownership.d.ts.map +1 -0
- package/dist/device-ownership.js +105 -0
- package/dist/device-ownership.js.map +1 -0
- package/dist/effects.d.ts +86 -0
- package/dist/effects.d.ts.map +1 -0
- package/dist/effects.js +98 -0
- package/dist/effects.js.map +1 -0
- package/dist/element.d.ts +108 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +63 -0
- package/dist/element.js.map +1 -0
- package/dist/file-watch.d.ts +16 -0
- package/dist/file-watch.d.ts.map +1 -0
- package/dist/file-watch.js +49 -0
- package/dist/file-watch.js.map +1 -0
- package/dist/filepaths.d.ts +72 -0
- package/dist/filepaths.d.ts.map +1 -0
- package/dist/filepaths.js +271 -0
- package/dist/filepaths.js.map +1 -0
- package/dist/film.d.ts +264 -0
- package/dist/film.d.ts.map +1 -0
- package/dist/film.js +313 -0
- package/dist/film.js.map +1 -0
- package/dist/fonts.d.ts +66 -0
- package/dist/fonts.d.ts.map +1 -0
- package/dist/fonts.js +135 -0
- package/dist/fonts.js.map +1 -0
- package/dist/forms.d.ts +191 -0
- package/dist/forms.d.ts.map +1 -0
- package/dist/forms.js +663 -0
- package/dist/forms.js.map +1 -0
- package/dist/geo.d.ts +289 -0
- package/dist/geo.d.ts.map +1 -0
- package/dist/geo.js +460 -0
- package/dist/geo.js.map +1 -0
- package/dist/handler-announce.d.ts +46 -0
- package/dist/handler-announce.d.ts.map +1 -0
- package/dist/handler-announce.js +96 -0
- package/dist/handler-announce.js.map +1 -0
- package/dist/handoff.d.ts +71 -0
- package/dist/handoff.d.ts.map +1 -0
- package/dist/handoff.js +250 -0
- package/dist/handoff.js.map +1 -0
- package/dist/identity-durability.d.ts +76 -0
- package/dist/identity-durability.d.ts.map +1 -0
- package/dist/identity-durability.js +150 -0
- package/dist/identity-durability.js.map +1 -0
- package/dist/image-core.d.ts +240 -0
- package/dist/image-core.d.ts.map +1 -0
- package/dist/image-core.js +618 -0
- package/dist/image-core.js.map +1 -0
- package/dist/image-schemes.d.ts +10 -0
- package/dist/image-schemes.d.ts.map +1 -0
- package/dist/image-schemes.js +28 -0
- package/dist/image-schemes.js.map +1 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +299 -0
- package/dist/index.js.map +1 -0
- package/dist/ink-core.d.ts +53 -0
- package/dist/ink-core.d.ts.map +1 -0
- package/dist/ink-core.js +119 -0
- package/dist/ink-core.js.map +1 -0
- package/dist/input.d.ts +148 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +358 -0
- package/dist/input.js.map +1 -0
- package/dist/integrity.d.ts +63 -0
- package/dist/integrity.d.ts.map +1 -0
- package/dist/integrity.js +150 -0
- package/dist/integrity.js.map +1 -0
- package/dist/intents.d.ts +95 -0
- package/dist/intents.d.ts.map +1 -0
- package/dist/intents.js +282 -0
- package/dist/intents.js.map +1 -0
- package/dist/interpolate-core.d.ts +37 -0
- package/dist/interpolate-core.d.ts.map +1 -0
- package/dist/interpolate-core.js +443 -0
- package/dist/interpolate-core.js.map +1 -0
- package/dist/jse/color.d.ts +12 -0
- package/dist/jse/color.d.ts.map +1 -0
- package/dist/jse/color.js +196 -0
- package/dist/jse/color.js.map +1 -0
- package/dist/jse/core.d.ts +54 -0
- package/dist/jse/core.d.ts.map +1 -0
- package/dist/jse/core.js +1519 -0
- package/dist/jse/core.js.map +1 -0
- package/dist/jse/dispatch.d.ts +28 -0
- package/dist/jse/dispatch.d.ts.map +1 -0
- package/dist/jse/dispatch.js +116 -0
- package/dist/jse/dispatch.js.map +1 -0
- package/dist/jse/highlight-grammar.d.ts +15 -0
- package/dist/jse/highlight-grammar.d.ts.map +1 -0
- package/dist/jse/highlight-grammar.js +161 -0
- package/dist/jse/highlight-grammar.js.map +1 -0
- package/dist/jse/highlight-grammars.generated.d.ts +2 -0
- package/dist/jse/highlight-grammars.generated.d.ts.map +1 -0
- package/dist/jse/highlight-grammars.generated.js +4 -0
- package/dist/jse/highlight-grammars.generated.js.map +1 -0
- package/dist/jse/highlight.d.ts +37 -0
- package/dist/jse/highlight.d.ts.map +1 -0
- package/dist/jse/highlight.js +323 -0
- package/dist/jse/highlight.js.map +1 -0
- package/dist/jse/jse.d.ts +674 -0
- package/dist/jse/jse.d.ts.map +1 -0
- package/dist/jse/jse.js +5841 -0
- package/dist/jse/jse.js.map +1 -0
- package/dist/jse/pathmatch.d.ts +10 -0
- package/dist/jse/pathmatch.d.ts.map +1 -0
- package/dist/jse/pathmatch.js +73 -0
- package/dist/jse/pathmatch.js.map +1 -0
- package/dist/jse/regex.d.ts +33 -0
- package/dist/jse/regex.d.ts.map +1 -0
- package/dist/jse/regex.js +375 -0
- package/dist/jse/regex.js.map +1 -0
- package/dist/jse/stdlib.d.ts +8 -0
- package/dist/jse/stdlib.d.ts.map +1 -0
- package/dist/jse/stdlib.js +765 -0
- package/dist/jse/stdlib.js.map +1 -0
- package/dist/jse/tokens.d.ts +102 -0
- package/dist/jse/tokens.d.ts.map +1 -0
- package/dist/jse/tokens.js +982 -0
- package/dist/jse/tokens.js.map +1 -0
- package/dist/jse/values.d.ts +206 -0
- package/dist/jse/values.d.ts.map +1 -0
- package/dist/jse/values.js +846 -0
- package/dist/jse/values.js.map +1 -0
- package/dist/keyboard.d.ts +196 -0
- package/dist/keyboard.d.ts.map +1 -0
- package/dist/keyboard.js +186 -0
- package/dist/keyboard.js.map +1 -0
- package/dist/label-choices.d.ts +3 -0
- package/dist/label-choices.d.ts.map +1 -0
- package/dist/label-choices.js +168 -0
- package/dist/label-choices.js.map +1 -0
- package/dist/language.d.ts +33 -0
- package/dist/language.d.ts.map +1 -0
- package/dist/language.js +50 -0
- package/dist/language.js.map +1 -0
- package/dist/length-units.d.ts +30 -0
- package/dist/length-units.d.ts.map +1 -0
- package/dist/length-units.js +83 -0
- package/dist/length-units.js.map +1 -0
- package/dist/lightsensor.d.ts +48 -0
- package/dist/lightsensor.d.ts.map +1 -0
- package/dist/lightsensor.js +97 -0
- package/dist/lightsensor.js.map +1 -0
- package/dist/link-refresh.d.ts +27 -0
- package/dist/link-refresh.d.ts.map +1 -0
- package/dist/link-refresh.js +166 -0
- package/dist/link-refresh.js.map +1 -0
- package/dist/link.d.ts +57 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +333 -0
- package/dist/link.js.map +1 -0
- package/dist/linkpreview.d.ts +114 -0
- package/dist/linkpreview.d.ts.map +1 -0
- package/dist/linkpreview.js +439 -0
- package/dist/linkpreview.js.map +1 -0
- package/dist/list-presence.d.ts +32 -0
- package/dist/list-presence.d.ts.map +1 -0
- package/dist/list-presence.js +48 -0
- package/dist/list-presence.js.map +1 -0
- package/dist/live-stream.d.ts +27 -0
- package/dist/live-stream.d.ts.map +1 -0
- package/dist/live-stream.js +274 -0
- package/dist/live-stream.js.map +1 -0
- package/dist/livelogs.d.ts +134 -0
- package/dist/livelogs.d.ts.map +1 -0
- package/dist/livelogs.js +409 -0
- package/dist/livelogs.js.map +1 -0
- package/dist/logs.d.ts +80 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +206 -0
- package/dist/logs.js.map +1 -0
- package/dist/mcp/apps.d.ts +82 -0
- package/dist/mcp/apps.d.ts.map +1 -0
- package/dist/mcp/apps.js +219 -0
- package/dist/mcp/apps.js.map +1 -0
- package/dist/mcp/entities.d.ts +25 -0
- package/dist/mcp/entities.d.ts.map +1 -0
- package/dist/mcp/entities.js +71 -0
- package/dist/mcp/entities.js.map +1 -0
- package/dist/mcp/result.d.ts +73 -0
- package/dist/mcp/result.d.ts.map +1 -0
- package/dist/mcp/result.js +119 -0
- package/dist/mcp/result.js.map +1 -0
- package/dist/mcp/webmcp.d.ts +162 -0
- package/dist/mcp/webmcp.d.ts.map +1 -0
- package/dist/mcp/webmcp.js +214 -0
- package/dist/mcp/webmcp.js.map +1 -0
- package/dist/mcp.d.ts +5 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +14 -0
- package/dist/mcp.js.map +1 -0
- package/dist/media-core.d.ts +191 -0
- package/dist/media-core.d.ts.map +1 -0
- package/dist/media-core.js +446 -0
- package/dist/media-core.js.map +1 -0
- package/dist/media-timeline-core.d.ts +94 -0
- package/dist/media-timeline-core.d.ts.map +1 -0
- package/dist/media-timeline-core.js +620 -0
- package/dist/media-timeline-core.js.map +1 -0
- package/dist/message.d.ts +42 -0
- package/dist/message.d.ts.map +1 -0
- package/dist/message.js +582 -0
- package/dist/message.js.map +1 -0
- package/dist/missing-element.d.ts +29 -0
- package/dist/missing-element.d.ts.map +1 -0
- package/dist/missing-element.js +76 -0
- package/dist/missing-element.js.map +1 -0
- package/dist/motion-core.d.ts +160 -0
- package/dist/motion-core.d.ts.map +1 -0
- package/dist/motion-core.js +752 -0
- package/dist/motion-core.js.map +1 -0
- package/dist/motion-pose.d.ts +65 -0
- package/dist/motion-pose.d.ts.map +1 -0
- package/dist/motion-pose.js +143 -0
- package/dist/motion-pose.js.map +1 -0
- package/dist/motion.d.ts +132 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +260 -0
- package/dist/motion.js.map +1 -0
- package/dist/mount-core.d.ts +203 -0
- package/dist/mount-core.d.ts.map +1 -0
- package/dist/mount-core.js +437 -0
- package/dist/mount-core.js.map +1 -0
- package/dist/net-core.d.ts +110 -0
- package/dist/net-core.d.ts.map +1 -0
- package/dist/net-core.js +225 -0
- package/dist/net-core.js.map +1 -0
- package/dist/notify.d.ts +399 -0
- package/dist/notify.d.ts.map +1 -0
- package/dist/notify.js +964 -0
- package/dist/notify.js.map +1 -0
- package/dist/orientation-binding.d.ts +39 -0
- package/dist/orientation-binding.d.ts.map +1 -0
- package/dist/orientation-binding.js +64 -0
- package/dist/orientation-binding.js.map +1 -0
- package/dist/orientation.d.ts +55 -0
- package/dist/orientation.d.ts.map +1 -0
- package/dist/orientation.js +89 -0
- package/dist/orientation.js.map +1 -0
- package/dist/ota.d.ts +52 -0
- package/dist/ota.d.ts.map +1 -0
- package/dist/ota.js +122 -0
- package/dist/ota.js.map +1 -0
- package/dist/passkeys.d.ts +91 -0
- package/dist/passkeys.d.ts.map +1 -0
- package/dist/passkeys.js +307 -0
- package/dist/passkeys.js.map +1 -0
- package/dist/payment.d.ts +85 -0
- package/dist/payment.d.ts.map +1 -0
- package/dist/payment.js +270 -0
- package/dist/payment.js.map +1 -0
- package/dist/pending-presenter.d.ts +31 -0
- package/dist/pending-presenter.d.ts.map +1 -0
- package/dist/pending-presenter.js +119 -0
- package/dist/pending-presenter.js.map +1 -0
- package/dist/permission-core.d.ts +59 -0
- package/dist/permission-core.d.ts.map +1 -0
- package/dist/permission-core.js +102 -0
- package/dist/permission-core.js.map +1 -0
- package/dist/persist.d.ts +169 -0
- package/dist/persist.d.ts.map +1 -0
- package/dist/persist.js +361 -0
- package/dist/persist.js.map +1 -0
- package/dist/phase-plan.d.ts +114 -0
- package/dist/phase-plan.d.ts.map +1 -0
- package/dist/phase-plan.js +837 -0
- package/dist/phase-plan.js.map +1 -0
- package/dist/playback-core.d.ts +64 -0
- package/dist/playback-core.d.ts.map +1 -0
- package/dist/playback-core.js +176 -0
- package/dist/playback-core.js.map +1 -0
- package/dist/player-sources.d.ts +12 -0
- package/dist/player-sources.d.ts.map +1 -0
- package/dist/player-sources.js +44 -0
- package/dist/player-sources.js.map +1 -0
- package/dist/proxy-denylist.d.ts +11 -0
- package/dist/proxy-denylist.d.ts.map +1 -0
- package/dist/proxy-denylist.js +44 -0
- package/dist/proxy-denylist.js.map +1 -0
- package/dist/public-config.d.ts +20 -0
- package/dist/public-config.d.ts.map +1 -0
- package/dist/public-config.js +109 -0
- package/dist/public-config.js.map +1 -0
- package/dist/qoe-core.d.ts +72 -0
- package/dist/qoe-core.d.ts.map +1 -0
- package/dist/qoe-core.js +113 -0
- package/dist/qoe-core.js.map +1 -0
- package/dist/reactive-request.d.ts +80 -0
- package/dist/reactive-request.d.ts.map +1 -0
- package/dist/reactive-request.js +192 -0
- package/dist/reactive-request.js.map +1 -0
- package/dist/read-cache.d.ts +129 -0
- package/dist/read-cache.d.ts.map +1 -0
- package/dist/read-cache.js +566 -0
- package/dist/read-cache.js.map +1 -0
- package/dist/recorder-core.d.ts +57 -0
- package/dist/recorder-core.d.ts.map +1 -0
- package/dist/recorder-core.js +136 -0
- package/dist/recorder-core.js.map +1 -0
- package/dist/ref.d.ts +41 -0
- package/dist/ref.d.ts.map +1 -0
- package/dist/ref.js +98 -0
- package/dist/ref.js.map +1 -0
- package/dist/refusal.d.ts +82 -0
- package/dist/refusal.d.ts.map +1 -0
- package/dist/refusal.js +218 -0
- package/dist/refusal.js.map +1 -0
- package/dist/region-insets.d.ts +61 -0
- package/dist/region-insets.d.ts.map +1 -0
- package/dist/region-insets.js +67 -0
- package/dist/region-insets.js.map +1 -0
- package/dist/rive-core.d.ts +323 -0
- package/dist/rive-core.d.ts.map +1 -0
- package/dist/rive-core.js +677 -0
- package/dist/rive-core.js.map +1 -0
- package/dist/runner.d.ts +595 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +4094 -0
- package/dist/runner.js.map +1 -0
- package/dist/scene/a11y.d.ts +11 -0
- package/dist/scene/a11y.d.ts.map +1 -0
- package/dist/scene/a11y.js +67 -0
- package/dist/scene/a11y.js.map +1 -0
- package/dist/scene/anim.d.ts +149 -0
- package/dist/scene/anim.d.ts.map +1 -0
- package/dist/scene/anim.js +396 -0
- package/dist/scene/anim.js.map +1 -0
- package/dist/scene/bind.d.ts +33 -0
- package/dist/scene/bind.d.ts.map +1 -0
- package/dist/scene/bind.js +66 -0
- package/dist/scene/bind.js.map +1 -0
- package/dist/scene/collide.d.ts +56 -0
- package/dist/scene/collide.d.ts.map +1 -0
- package/dist/scene/collide.js +146 -0
- package/dist/scene/collide.js.map +1 -0
- package/dist/scene/frame.d.ts +22 -0
- package/dist/scene/frame.d.ts.map +1 -0
- package/dist/scene/frame.js +57 -0
- package/dist/scene/frame.js.map +1 -0
- package/dist/scene/gltf.d.ts +79 -0
- package/dist/scene/gltf.d.ts.map +1 -0
- package/dist/scene/gltf.js +409 -0
- package/dist/scene/gltf.js.map +1 -0
- package/dist/scene/ir.d.ts +293 -0
- package/dist/scene/ir.d.ts.map +1 -0
- package/dist/scene/ir.js +692 -0
- package/dist/scene/ir.js.map +1 -0
- package/dist/scene/math.d.ts +50 -0
- package/dist/scene/math.d.ts.map +1 -0
- package/dist/scene/math.js +180 -0
- package/dist/scene/math.js.map +1 -0
- package/dist/scene/orbit.d.ts +19 -0
- package/dist/scene/orbit.d.ts.map +1 -0
- package/dist/scene/orbit.js +60 -0
- package/dist/scene/orbit.js.map +1 -0
- package/dist/scene/physics.d.ts +228 -0
- package/dist/scene/physics.d.ts.map +1 -0
- package/dist/scene/physics.js +1500 -0
- package/dist/scene/physics.js.map +1 -0
- package/dist/scene/registry.d.ts +85 -0
- package/dist/scene/registry.d.ts.map +1 -0
- package/dist/scene/registry.js +75 -0
- package/dist/scene/registry.js.map +1 -0
- package/dist/scene/skin.d.ts +82 -0
- package/dist/scene/skin.d.ts.map +1 -0
- package/dist/scene/skin.js +351 -0
- package/dist/scene/skin.js.map +1 -0
- package/dist/scene/sprite.d.ts +36 -0
- package/dist/scene/sprite.d.ts.map +1 -0
- package/dist/scene/sprite.js +107 -0
- package/dist/scene/sprite.js.map +1 -0
- package/dist/scene/viewer.d.ts +96 -0
- package/dist/scene/viewer.d.ts.map +1 -0
- package/dist/scene/viewer.js +235 -0
- package/dist/scene/viewer.js.map +1 -0
- package/dist/scoped-slots.d.ts +9 -0
- package/dist/scoped-slots.d.ts.map +1 -0
- package/dist/scoped-slots.js +42 -0
- package/dist/scoped-slots.js.map +1 -0
- package/dist/screen.d.ts +109 -0
- package/dist/screen.d.ts.map +1 -0
- package/dist/screen.js +309 -0
- package/dist/screen.js.map +1 -0
- package/dist/scroll.d.ts +525 -0
- package/dist/scroll.d.ts.map +1 -0
- package/dist/scroll.js +1226 -0
- package/dist/scroll.js.map +1 -0
- package/dist/settings-plane.d.ts +58 -0
- package/dist/settings-plane.d.ts.map +1 -0
- package/dist/settings-plane.js +86 -0
- package/dist/settings-plane.js.map +1 -0
- package/dist/share-inbox.d.ts +56 -0
- package/dist/share-inbox.d.ts.map +1 -0
- package/dist/share-inbox.js +114 -0
- package/dist/share-inbox.js.map +1 -0
- package/dist/shared-transition.d.ts +152 -0
- package/dist/shared-transition.d.ts.map +1 -0
- package/dist/shared-transition.js +257 -0
- package/dist/shared-transition.js.map +1 -0
- package/dist/sheet-content-padding.d.ts +24 -0
- package/dist/sheet-content-padding.d.ts.map +1 -0
- package/dist/sheet-content-padding.js +32 -0
- package/dist/sheet-content-padding.js.map +1 -0
- package/dist/shot-devices.d.ts +36 -0
- package/dist/shot-devices.d.ts.map +1 -0
- package/dist/shot-devices.js +90 -0
- package/dist/shot-devices.js.map +1 -0
- package/dist/shot-guards.d.ts +100 -0
- package/dist/shot-guards.d.ts.map +1 -0
- package/dist/shot-guards.js +260 -0
- package/dist/shot-guards.js.map +1 -0
- package/dist/shot-scope.d.ts +140 -0
- package/dist/shot-scope.d.ts.map +1 -0
- package/dist/shot-scope.js +302 -0
- package/dist/shot-scope.js.map +1 -0
- package/dist/slot-partition.d.ts +9 -0
- package/dist/slot-partition.d.ts.map +1 -0
- package/dist/slot-partition.js +38 -0
- package/dist/slot-partition.js.map +1 -0
- package/dist/snackbar.d.ts +165 -0
- package/dist/snackbar.d.ts.map +1 -0
- package/dist/snackbar.js +220 -0
- package/dist/snackbar.js.map +1 -0
- package/dist/socket.d.ts +96 -0
- package/dist/socket.d.ts.map +1 -0
- package/dist/socket.js +370 -0
- package/dist/socket.js.map +1 -0
- package/dist/spotlight.d.ts +77 -0
- package/dist/spotlight.d.ts.map +1 -0
- package/dist/spotlight.js +174 -0
- package/dist/spotlight.js.map +1 -0
- package/dist/state-primitive.d.ts +37 -0
- package/dist/state-primitive.d.ts.map +1 -0
- package/dist/state-primitive.js +91 -0
- package/dist/state-primitive.js.map +1 -0
- package/dist/store-query.d.ts +25 -0
- package/dist/store-query.d.ts.map +1 -0
- package/dist/store-query.js +88 -0
- package/dist/store-query.js.map +1 -0
- package/dist/store-value.d.ts +48 -0
- package/dist/store-value.d.ts.map +1 -0
- package/dist/store-value.js +264 -0
- package/dist/store-value.js.map +1 -0
- package/dist/store-versioning.d.ts +70 -0
- package/dist/store-versioning.d.ts.map +1 -0
- package/dist/store-versioning.js +188 -0
- package/dist/store-versioning.js.map +1 -0
- package/dist/store.d.ts +282 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +1144 -0
- package/dist/store.js.map +1 -0
- package/dist/strings.d.ts +141 -0
- package/dist/strings.d.ts.map +1 -0
- package/dist/strings.js +581 -0
- package/dist/strings.js.map +1 -0
- package/dist/telemetry.d.ts +95 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +255 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/transform-core.d.ts +228 -0
- package/dist/transform-core.d.ts.map +1 -0
- package/dist/transform-core.js +921 -0
- package/dist/transform-core.js.map +1 -0
- package/dist/transition-core.d.ts +58 -0
- package/dist/transition-core.d.ts.map +1 -0
- package/dist/transition-core.js +352 -0
- package/dist/transition-core.js.map +1 -0
- package/dist/trim-trailing.d.ts +3 -0
- package/dist/trim-trailing.d.ts.map +1 -0
- package/dist/trim-trailing.js +14 -0
- package/dist/trim-trailing.js.map +1 -0
- package/dist/upload.d.ts +51 -0
- package/dist/upload.d.ts.map +1 -0
- package/dist/upload.js +68 -0
- package/dist/upload.js.map +1 -0
- package/dist/vendor-face.d.ts +44 -0
- package/dist/vendor-face.d.ts.map +1 -0
- package/dist/vendor-face.js +80 -0
- package/dist/vendor-face.js.map +1 -0
- package/dist/vendor-session.d.ts +166 -0
- package/dist/vendor-session.d.ts.map +1 -0
- package/dist/vendor-session.js +423 -0
- package/dist/vendor-session.js.map +1 -0
- package/dist/vendor-surface.d.ts +290 -0
- package/dist/vendor-surface.d.ts.map +1 -0
- package/dist/vendor-surface.js +439 -0
- package/dist/vendor-surface.js.map +1 -0
- package/dist/version-rules.generated.d.ts +17 -0
- package/dist/version-rules.generated.d.ts.map +1 -0
- package/dist/version-rules.generated.js +99 -0
- package/dist/version-rules.generated.js.map +1 -0
- package/dist/view-transition-core.d.ts +99 -0
- package/dist/view-transition-core.d.ts.map +1 -0
- package/dist/view-transition-core.js +127 -0
- package/dist/view-transition-core.js.map +1 -0
- package/dist/view-transition-door.d.ts +26 -0
- package/dist/view-transition-door.d.ts.map +1 -0
- package/dist/view-transition-door.js +88 -0
- package/dist/view-transition-door.js.map +1 -0
- package/dist/window-identity.d.ts +3 -0
- package/dist/window-identity.d.ts.map +1 -0
- package/dist/window-identity.js +27 -0
- package/dist/window-identity.js.map +1 -0
- package/package.json +141 -2
package/dist/socket.js
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
//
|
|
2
|
+
// socket.ts - the `<socket>` block, web half (proposals/realtime.md R2).
|
|
3
|
+
//
|
|
4
|
+
// A `<socket as url>` in a component head is a DECLARED, bidirectional connection. WHEN it
|
|
5
|
+
// connects is the shared reactive law (reactive-request.ts, R0): its url, protocols, headers
|
|
6
|
+
// and hello are formulas, a change closes the old connection after the debounce, a message the
|
|
7
|
+
// old one still delivers never lands, a hole or an unresolved upstream `<api>` holds it. This
|
|
8
|
+
// file owns HOW: the transport, the reconnect ladder, the hello, the send queue, and the
|
|
9
|
+
// envelope, which is shaped like `<api>`'s on purpose so one component can render either:
|
|
10
|
+
//
|
|
11
|
+
// dsx.socket.<as>.data the message window (`keep=`, default 128), newest last
|
|
12
|
+
// .loading .refreshing .error Law 2: loading = nothing to show yet
|
|
13
|
+
// .status the WebSocket module's words (Mandatory/WebSocket dsx.json
|
|
14
|
+
// `state`): idle connecting open closing closed
|
|
15
|
+
// waitingReconnect, plus the gate's `waiting`
|
|
16
|
+
// .blockedBy .fetchedAt the gate's, and the time of the last message
|
|
17
|
+
// .reconnectAttempt .queued the module's context vars, per name instead of ambient
|
|
18
|
+
// .lastCloseCode .lastCloseReason
|
|
19
|
+
//
|
|
20
|
+
// Verbs, as action calls: dsx.socket.<as>.send(value) (a dict is JSON-encoded, a string goes
|
|
21
|
+
// verbatim; "accepted", never "delivered"), .close(), .open(). Events: on:open, on:message
|
|
22
|
+
// ({ data }), on:close ({ code, reason, unsent }), on:error.
|
|
23
|
+
//
|
|
24
|
+
// THE TRANSPORT IS A SEAM. On the web it is the WHATWG WebSocket (the WebSocket module's web
|
|
25
|
+
// facet names the same constructor); the native lanes fill it from the Mandatory WebSocket
|
|
26
|
+
// module. The web facet's durability is in-memory by the browser's own limits, so a message is
|
|
27
|
+
// delivered once per page here; the natives' ack-on-handler-return rides their durable store.
|
|
28
|
+
//
|
|
29
|
+
import { JSE } from "./jse/jse.js";
|
|
30
|
+
import { NSNull, isDict, number, safeInt, string, truthy, watchKey } from "./jse/values.js";
|
|
31
|
+
import { ReactiveRequest } from "./reactive-request.js";
|
|
32
|
+
import { ApiStreamClock, apiWord, interpolateGated, normalizeRequestHeaders } from "./api.js";
|
|
33
|
+
/** The web transport: the WHATWG WebSocket. Headers have no slot in that constructor (the
|
|
34
|
+
* module's own stated web gap), so a header set here is logged once and dropped. */
|
|
35
|
+
const whatwgTransport = {
|
|
36
|
+
open(url, protocols, headers, handlers) {
|
|
37
|
+
if (Object.keys(headers).length > 0) {
|
|
38
|
+
console.warn("[dsx socket] handshake headers are native only: the browser WebSocket has no header slot; put the credential in the url or the hello frame");
|
|
39
|
+
}
|
|
40
|
+
const Ctor = globalThis.WebSocket;
|
|
41
|
+
if (Ctor === undefined)
|
|
42
|
+
throw new Error("no WebSocket in this runtime");
|
|
43
|
+
const ws = protocols.length > 0 ? new Ctor(url, protocols) : new Ctor(url);
|
|
44
|
+
ws.onopen = () => handlers.onOpen();
|
|
45
|
+
ws.onmessage = (event) => handlers.onMessage(typeof event.data === "string" ? event.data : String(event.data));
|
|
46
|
+
ws.onclose = (event) => handlers.onClose(event.code, event.reason);
|
|
47
|
+
ws.onerror = () => handlers.onError();
|
|
48
|
+
return {
|
|
49
|
+
send: (text) => ws.send(text),
|
|
50
|
+
close: (code, reason) => {
|
|
51
|
+
ws.onopen = ws.onmessage = ws.onerror = ws.onclose = null;
|
|
52
|
+
try {
|
|
53
|
+
ws.close(code, reason);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
ws.close();
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
/** The native lanes and tests may replace the transport; null means the WHATWG one. */
|
|
63
|
+
export const SocketTransportSeam = { impl: null };
|
|
64
|
+
/** The module's own outbound cap (Mandatory/WebSocket web/index.js MAX_UNACKED). */
|
|
65
|
+
const MAX_QUEUED = 500;
|
|
66
|
+
const DEFAULT_KEEP = 128;
|
|
67
|
+
export class SocketBlock {
|
|
68
|
+
spec;
|
|
69
|
+
store;
|
|
70
|
+
item;
|
|
71
|
+
onEvent;
|
|
72
|
+
now;
|
|
73
|
+
graph;
|
|
74
|
+
rr;
|
|
75
|
+
conn = null;
|
|
76
|
+
connKey = null;
|
|
77
|
+
connGen = 0;
|
|
78
|
+
isOpen = false;
|
|
79
|
+
/** the key whose first message has not arrived yet: its first message REPLACES the window */
|
|
80
|
+
replacing = false;
|
|
81
|
+
queue = [];
|
|
82
|
+
attempt = 0;
|
|
83
|
+
retryTimer = null;
|
|
84
|
+
authorClosed = false;
|
|
85
|
+
lastReq = null;
|
|
86
|
+
/** module ports' listeners (SocketPort.listen): they see each message first and may consume it */
|
|
87
|
+
listeners = new Set();
|
|
88
|
+
constructor(spec, store, item, opts = {}) {
|
|
89
|
+
this.spec = spec;
|
|
90
|
+
this.store = store;
|
|
91
|
+
this.item = item;
|
|
92
|
+
this.onEvent = opts.onEvent ?? (() => { });
|
|
93
|
+
this.now = opts.now ?? (() => Date.now());
|
|
94
|
+
this.graph = opts.graph ?? null;
|
|
95
|
+
if (store.vars.get(spec.as) === undefined) {
|
|
96
|
+
store.set(spec.as, {
|
|
97
|
+
data: [], loading: false, refreshing: false, error: null, fetchedAt: null, status: "idle",
|
|
98
|
+
blockedBy: [], reconnectAttempt: 0, queued: 0, lastCloseCode: 0, lastCloseReason: "",
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
this.rr = new ReactiveRequest({
|
|
102
|
+
as: spec.as,
|
|
103
|
+
store,
|
|
104
|
+
graph: this.graph,
|
|
105
|
+
materialize: () => this.materialize(),
|
|
106
|
+
identity: (req) => SocketBlock.key(req),
|
|
107
|
+
hasData: () => this.hasData(),
|
|
108
|
+
// `debounce=` takes {{ }} like every attribute (ADR 0017), read when a change is scheduled
|
|
109
|
+
debounceMs: () => safeInt(number(apiWord(this.spec.debounce, this.store, this.item)) ?? 0),
|
|
110
|
+
fire: (req) => { this.authorClosed = false; this.connect(req); },
|
|
111
|
+
});
|
|
112
|
+
if (this.graph !== null)
|
|
113
|
+
this.graph.attach(this, spec.as);
|
|
114
|
+
else
|
|
115
|
+
this.rr.start();
|
|
116
|
+
}
|
|
117
|
+
graphStart() { this.rr.start(); }
|
|
118
|
+
graphReevaluate() { this.rr.reevaluate(); }
|
|
119
|
+
/** url, protocols, headers, hello and auto, evaluated in scope; holes land in `_missing`. */
|
|
120
|
+
materialize() {
|
|
121
|
+
const missing = [];
|
|
122
|
+
const url = interpolateGated(this.spec.url, this.store, this.item, missing);
|
|
123
|
+
const protocols = this.spec.protocols === undefined ? ""
|
|
124
|
+
: interpolateGated(this.spec.protocols, this.store, this.item, missing);
|
|
125
|
+
const headers = this.spec.headers !== undefined ? normalizeRequestHeaders(JSE.eval(stripBraces(this.spec.headers), this.store.jse, this.item)) ?? {} : {};
|
|
126
|
+
let hello = null;
|
|
127
|
+
if (this.spec.hello !== undefined && this.spec.hello.trim() !== "") {
|
|
128
|
+
const value = JSE.eval(stripBraces(this.spec.hello), this.store.jse, this.item);
|
|
129
|
+
hello = value === null || value === undefined || value === NSNull ? null : frameText(value);
|
|
130
|
+
}
|
|
131
|
+
const auto = this.spec.auto !== undefined ? truthy(JSE.eval(stripBraces(this.spec.auto), this.store.jse, this.item)) : true;
|
|
132
|
+
return { url, protocols, headers, hello, auto, _missing: missing };
|
|
133
|
+
}
|
|
134
|
+
static key(req) {
|
|
135
|
+
return `${string(req["url"])}${string(req["protocols"])}${watchKey(req["headers"] ?? null)}${string(req["hello"] ?? "")}${truthy(req["auto"]) ? "1" : "0"}`;
|
|
136
|
+
}
|
|
137
|
+
hasData() {
|
|
138
|
+
const data = this.store.getPath(`${this.spec.as}.data`);
|
|
139
|
+
return Array.isArray(data) && data.length > 0;
|
|
140
|
+
}
|
|
141
|
+
keep() {
|
|
142
|
+
const raw = this.spec.keep;
|
|
143
|
+
if (raw === undefined || raw.trim() === "")
|
|
144
|
+
return DEFAULT_KEEP;
|
|
145
|
+
const text = raw.includes("{{") ? interpolateGated(raw, this.store, this.item, []) : raw;
|
|
146
|
+
const n = Number(text.trim());
|
|
147
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_KEEP;
|
|
148
|
+
}
|
|
149
|
+
emit(name, payload) {
|
|
150
|
+
try {
|
|
151
|
+
this.onEvent(name, payload);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
console.warn("[dsx socket]", name, error);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
set(paths) {
|
|
158
|
+
this.store.batch(() => {
|
|
159
|
+
for (const [k, v] of Object.entries(paths))
|
|
160
|
+
this.store.setPath(`${this.spec.as}.${k}`, v);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
publishQueued() {
|
|
164
|
+
this.set({ queued: this.queue.filter((q) => q.key === this.connKey).length });
|
|
165
|
+
}
|
|
166
|
+
/** Leave the current connection: close it, drop the frames queued for it, say so once. */
|
|
167
|
+
leave(reason, emitClose) {
|
|
168
|
+
if (this.retryTimer !== null) {
|
|
169
|
+
clearTimeout(this.retryTimer);
|
|
170
|
+
this.retryTimer = null;
|
|
171
|
+
}
|
|
172
|
+
const unsent = this.queue.filter((q) => q.key === this.connKey).length;
|
|
173
|
+
this.queue = this.queue.filter((q) => q.key !== this.connKey);
|
|
174
|
+
const had = this.conn !== null || unsent > 0 || this.attempt > 0;
|
|
175
|
+
this.conn?.close(1000, reason);
|
|
176
|
+
this.conn = null;
|
|
177
|
+
this.isOpen = false;
|
|
178
|
+
if (emitClose && had)
|
|
179
|
+
this.emit("close", { code: 1000, reason, unsent });
|
|
180
|
+
}
|
|
181
|
+
connect(req) {
|
|
182
|
+
const key = SocketBlock.key(req);
|
|
183
|
+
const switching = this.connKey !== null && this.connKey !== key;
|
|
184
|
+
if (this.connKey !== key) {
|
|
185
|
+
this.leave("switching", true);
|
|
186
|
+
this.attempt = 0;
|
|
187
|
+
}
|
|
188
|
+
// frames sent while no key was known belong to the first key that connects
|
|
189
|
+
for (const q of this.queue)
|
|
190
|
+
if (q.key === null)
|
|
191
|
+
q.key = key;
|
|
192
|
+
this.connKey = key;
|
|
193
|
+
this.lastReq = req;
|
|
194
|
+
this.replacing = switching || this.replacing;
|
|
195
|
+
this.dial(req, key);
|
|
196
|
+
}
|
|
197
|
+
dial(req, key) {
|
|
198
|
+
const { gen } = this.rr.begin();
|
|
199
|
+
this.connGen = gen;
|
|
200
|
+
const kept = this.hasData();
|
|
201
|
+
this.set({ status: "connecting", loading: !kept, refreshing: kept, blockedBy: [] });
|
|
202
|
+
const protocols = string(req["protocols"]).split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
203
|
+
const current = () => this.rr.isCurrent(gen) && this.connKey === key;
|
|
204
|
+
try {
|
|
205
|
+
const transport = SocketTransportSeam.impl ?? whatwgTransport;
|
|
206
|
+
this.conn = transport.open(string(req["url"]), protocols, isDict(req["headers"]) ? req["headers"] : {}, {
|
|
207
|
+
onOpen: () => {
|
|
208
|
+
if (!current())
|
|
209
|
+
return;
|
|
210
|
+
this.isOpen = true;
|
|
211
|
+
this.attempt = 0;
|
|
212
|
+
const hello = req["hello"];
|
|
213
|
+
if (typeof hello === "string")
|
|
214
|
+
this.conn?.send(hello);
|
|
215
|
+
for (const q of this.queue.filter((x) => x.key === key))
|
|
216
|
+
this.conn?.send(q.text);
|
|
217
|
+
this.queue = this.queue.filter((x) => x.key !== key);
|
|
218
|
+
this.set({ status: "open", loading: false, error: null, reconnectAttempt: 0, queued: 0 });
|
|
219
|
+
this.emit("open", {});
|
|
220
|
+
},
|
|
221
|
+
onMessage: (text) => {
|
|
222
|
+
if (!current())
|
|
223
|
+
return; // R0: a message from a superseded connection never lands
|
|
224
|
+
let data = text;
|
|
225
|
+
try {
|
|
226
|
+
data = JSON.parse(text);
|
|
227
|
+
}
|
|
228
|
+
catch { /* a text frame that is not JSON is the string */ }
|
|
229
|
+
// A module port that consumes the message (an audio player's unframe, audio-revamp section 5.7) keeps
|
|
230
|
+
// it out of the page: no window entry, no on:message.
|
|
231
|
+
for (const listen of [...this.listeners])
|
|
232
|
+
if (listen(text, data))
|
|
233
|
+
return;
|
|
234
|
+
const prior = this.store.getPath(`${this.spec.as}.data`);
|
|
235
|
+
const window = this.replacing || !Array.isArray(prior) ? [] : [...prior];
|
|
236
|
+
this.replacing = false;
|
|
237
|
+
window.push(data);
|
|
238
|
+
const limit = this.keep();
|
|
239
|
+
if (window.length > limit)
|
|
240
|
+
window.splice(0, window.length - limit);
|
|
241
|
+
this.set({ data: window, loading: false, refreshing: false, fetchedAt: this.now() });
|
|
242
|
+
this.emit("message", { data });
|
|
243
|
+
this.graph?.notifySettled(this.spec.as);
|
|
244
|
+
},
|
|
245
|
+
onClose: (code, reason) => {
|
|
246
|
+
if (!current())
|
|
247
|
+
return;
|
|
248
|
+
this.conn = null;
|
|
249
|
+
this.isOpen = false;
|
|
250
|
+
this.set({ lastCloseCode: code, lastCloseReason: reason });
|
|
251
|
+
this.emit("close", { code, reason, unsent: 0 });
|
|
252
|
+
this.afterDrop(req, key);
|
|
253
|
+
},
|
|
254
|
+
onError: () => {
|
|
255
|
+
if (!current())
|
|
256
|
+
return;
|
|
257
|
+
this.set({ error: { status: 0, message: "socket_error", body: null } });
|
|
258
|
+
this.emit("error", { error: { status: 0, message: "socket_error", body: null } });
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
this.set({ error: { status: -2, message: "invalid_request", body: null }, status: "closed", loading: false, refreshing: false });
|
|
264
|
+
this.emit("error", { error: { status: -2, message: "invalid_request", body: null } });
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/** The module's ladder, byte for byte: min(2^attempt, 30) s with full jitter; `reconnect="false"`
|
|
268
|
+
* and an author's close go straight to `closed`. */
|
|
269
|
+
afterDrop(req, key) {
|
|
270
|
+
const reconnect = this.spec.reconnect === undefined || truthy(JSE.eval(stripBraces(this.spec.reconnect), this.store.jse, this.item));
|
|
271
|
+
if (this.authorClosed || !reconnect) {
|
|
272
|
+
this.set({ status: "closed", loading: false, refreshing: false });
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
this.attempt += 1;
|
|
276
|
+
const delay = ApiStreamClock.random() * Math.min(2 ** (this.attempt - 1), 30) * 1000;
|
|
277
|
+
const gen = this.connGen;
|
|
278
|
+
this.set({ status: "waitingReconnect", reconnectAttempt: this.attempt, loading: false });
|
|
279
|
+
this.retryTimer = setTimeout(() => {
|
|
280
|
+
this.retryTimer = null;
|
|
281
|
+
if (!this.rr.isCurrent(gen) || this.connKey !== key || this.authorClosed)
|
|
282
|
+
return;
|
|
283
|
+
this.dial(req, key);
|
|
284
|
+
}, delay);
|
|
285
|
+
}
|
|
286
|
+
send(value) {
|
|
287
|
+
const text = frameText(value);
|
|
288
|
+
if (this.isOpen && this.conn !== null) {
|
|
289
|
+
this.conn.send(text);
|
|
290
|
+
return { ok: true, id: this.spec.as };
|
|
291
|
+
}
|
|
292
|
+
if (this.queue.length >= MAX_QUEUED)
|
|
293
|
+
return { ok: false, id: this.spec.as, error: "queue_full" };
|
|
294
|
+
this.queue.push({ key: this.connKey, text });
|
|
295
|
+
this.publishQueued();
|
|
296
|
+
return { ok: true, id: this.spec.as };
|
|
297
|
+
}
|
|
298
|
+
/** This block as a module's port (bus.ts SocketPort): the block's own send, plus a consuming listener. */
|
|
299
|
+
port() {
|
|
300
|
+
return {
|
|
301
|
+
as: this.spec.as,
|
|
302
|
+
send: (value) => this.send(value),
|
|
303
|
+
listen: (fn) => {
|
|
304
|
+
this.listeners.add(fn);
|
|
305
|
+
return () => { this.listeners.delete(fn); };
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
close() {
|
|
310
|
+
this.authorClosed = true;
|
|
311
|
+
this.rr.cancelTimer();
|
|
312
|
+
this.rr.supersede();
|
|
313
|
+
if (this.retryTimer !== null) {
|
|
314
|
+
clearTimeout(this.retryTimer);
|
|
315
|
+
this.retryTimer = null;
|
|
316
|
+
}
|
|
317
|
+
const had = this.conn !== null;
|
|
318
|
+
this.conn?.close(1000, "client_shutdown");
|
|
319
|
+
this.conn = null;
|
|
320
|
+
this.isOpen = false;
|
|
321
|
+
this.set({ status: "closed", loading: false, refreshing: false, lastCloseCode: 1001, lastCloseReason: "client_shutdown" });
|
|
322
|
+
if (had)
|
|
323
|
+
this.emit("close", { code: 1001, reason: "client_shutdown", unsent: this.queue.length });
|
|
324
|
+
}
|
|
325
|
+
open() {
|
|
326
|
+
this.authorClosed = false;
|
|
327
|
+
const req = this.rr.trackedRequest ?? this.lastReq ?? this.materialize();
|
|
328
|
+
const missing = req["_missing"];
|
|
329
|
+
if (Array.isArray(missing) && missing.length > 0)
|
|
330
|
+
return; // the gate still holds it
|
|
331
|
+
this.connKey = null;
|
|
332
|
+
this.connect(req);
|
|
333
|
+
}
|
|
334
|
+
dispose() {
|
|
335
|
+
this.listeners.clear();
|
|
336
|
+
this.authorClosed = true;
|
|
337
|
+
if (this.retryTimer !== null) {
|
|
338
|
+
clearTimeout(this.retryTimer);
|
|
339
|
+
this.retryTimer = null;
|
|
340
|
+
}
|
|
341
|
+
this.conn?.close(1000, "client_shutdown");
|
|
342
|
+
this.conn = null;
|
|
343
|
+
this.rr.dispose();
|
|
344
|
+
this.graph?.detach(this.spec.as);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/** `hello="{{ { op: 'join' } }}"` and `hello="{ op: 'join' }"` are the same expression. */
|
|
348
|
+
function stripBraces(expr) {
|
|
349
|
+
const t = expr.trim();
|
|
350
|
+
return t.startsWith("{{") && t.endsWith("}}") ? t.slice(2, -2).trim() : t;
|
|
351
|
+
}
|
|
352
|
+
function frameText(value) {
|
|
353
|
+
if (typeof value === "string")
|
|
354
|
+
return value;
|
|
355
|
+
return JSON.stringify(toPlain(value));
|
|
356
|
+
}
|
|
357
|
+
function toPlain(value) {
|
|
358
|
+
if (value === NSNull || value === undefined)
|
|
359
|
+
return null;
|
|
360
|
+
if (Array.isArray(value))
|
|
361
|
+
return value.map(toPlain);
|
|
362
|
+
if (isDict(value)) {
|
|
363
|
+
const out = {};
|
|
364
|
+
for (const [k, v] of Object.entries(value))
|
|
365
|
+
out[k] = toPlain(v);
|
|
366
|
+
return out;
|
|
367
|
+
}
|
|
368
|
+
return value;
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=socket.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../src/socket.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0EAA0E;AAC1E,EAAE;AACF,4FAA4F;AAC5F,8FAA8F;AAC9F,gGAAgG;AAChG,+FAA+F;AAC/F,0FAA0F;AAC1F,2FAA2F;AAC3F,EAAE;AACF,4FAA4F;AAC5F,0EAA0E;AAC1E,gGAAgG;AAChG,mFAAmF;AACn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;QACrB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAa,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACxE,OAAO,GAAG,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** Both indexers degrade on a single huge transaction. 100 is the chunk both handle reliably. */
|
|
2
|
+
export declare const SPOTLIGHT_BATCH_MAX = 100;
|
|
3
|
+
/** Longer than this and the identifier stops fitting comfortably in either platform's index. */
|
|
4
|
+
export declare const SPOTLIGHT_MAX_ID_CHARS = 256;
|
|
5
|
+
export declare const SPOTLIGHT_MAX_TITLE_CHARS = 256;
|
|
6
|
+
export declare const SPOTLIGHT_MAX_DESCRIPTION_CHARS = 2000;
|
|
7
|
+
/** Beyond this, keyword matching gets worse rather than better on both platforms. */
|
|
8
|
+
export declare const SPOTLIGHT_MAX_KEYWORDS = 32;
|
|
9
|
+
export type SpotlightRefusal = "invalid_id" | "invalid_title" | "invalid_route" | "invalid_domain" | "too_many_items";
|
|
10
|
+
export type SpotlightResult<T> = {
|
|
11
|
+
ok: true;
|
|
12
|
+
value: T;
|
|
13
|
+
} | {
|
|
14
|
+
ok: false;
|
|
15
|
+
error: SpotlightRefusal;
|
|
16
|
+
detail?: string;
|
|
17
|
+
};
|
|
18
|
+
export interface SearchItem {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly title: string;
|
|
21
|
+
readonly description: string;
|
|
22
|
+
readonly keywords: readonly string[];
|
|
23
|
+
/** an absolute or app-relative image reference the module resolves to a thumbnail, or "" */
|
|
24
|
+
readonly image: string;
|
|
25
|
+
/** the in-app route a tap opens, always leading-slash */
|
|
26
|
+
readonly route: string;
|
|
27
|
+
/** the grouping the OS shows and `clear({ domain })` removes as a unit */
|
|
28
|
+
readonly domain: string;
|
|
29
|
+
/** epoch milliseconds after which the OS may drop the item, or 0 for "no expiry" */
|
|
30
|
+
readonly expires: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A domain groups items so `clear({ domain })` can remove a whole feature's index at once.
|
|
34
|
+
*
|
|
35
|
+
* It may not contain a colon, and that is load-bearing rather than fussy: the unique identifier
|
|
36
|
+
* is `<domain>:<id>` split at the FIRST colon, which is what lets an id contain colons freely
|
|
37
|
+
* (a URL, a compound key) while the round trip stays exact.
|
|
38
|
+
*/
|
|
39
|
+
export declare function normalizeSearchDomain(raw: unknown): SpotlightResult<string>;
|
|
40
|
+
/** `<domain>:<id>`. The one encoding both platforms use, so a tap resolves the same route. */
|
|
41
|
+
export declare function searchUniqueId(domain: string, id: string): string;
|
|
42
|
+
/** The inverse. Split at the FIRST colon, so an id containing colons round-trips exactly. */
|
|
43
|
+
export declare function parseSearchUniqueId(raw: unknown): {
|
|
44
|
+
domain: string;
|
|
45
|
+
id: string;
|
|
46
|
+
} | null;
|
|
47
|
+
/** Keywords are trimmed, lowercased, deduped and capped. Case folding matters: both indexers
|
|
48
|
+
* match case-insensitively, so keeping "Recipe" and "recipe" as two entries spends the cap on
|
|
49
|
+
* nothing. */
|
|
50
|
+
export declare function normalizeSearchKeywords(raw: unknown): readonly string[];
|
|
51
|
+
export interface RawSearchItem {
|
|
52
|
+
id?: unknown;
|
|
53
|
+
title?: unknown;
|
|
54
|
+
description?: unknown;
|
|
55
|
+
keywords?: unknown;
|
|
56
|
+
image?: unknown;
|
|
57
|
+
route?: unknown;
|
|
58
|
+
domain?: unknown;
|
|
59
|
+
expires?: unknown;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Validate and normalize one indexable item.
|
|
63
|
+
*
|
|
64
|
+
* THE ROUTE IS REQUIRED AND MUST BE ABSOLUTE. An indexed item with no route is worse than no
|
|
65
|
+
* item at all: it appears in the OS search field, the user taps it, and the app opens on its
|
|
66
|
+
* home screen with no explanation. Refusing at index time is the only place that failure can
|
|
67
|
+
* still be fixed.
|
|
68
|
+
*/
|
|
69
|
+
export declare function normalizeSearchItem(raw: RawSearchItem): SpotlightResult<SearchItem>;
|
|
70
|
+
/** Validate a whole batch, refusing on the FIRST bad item with its index in the detail: a
|
|
71
|
+
* partial index is the hardest state to reason about, so the batch is all-or-nothing. */
|
|
72
|
+
export declare function normalizeSearchItems(raw: unknown): SpotlightResult<readonly SearchItem[]>;
|
|
73
|
+
/** Split a batch into transactions both indexers handle reliably. */
|
|
74
|
+
export declare function chunkSearchItems<T>(items: readonly T[], max?: number): T[][];
|
|
75
|
+
/** Human copy for each refusal, so three renderers apologise with one sentence. */
|
|
76
|
+
export declare const SPOTLIGHT_MESSAGES: Readonly<Record<SpotlightRefusal, string>>;
|
|
77
|
+
//# sourceMappingURL=spotlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spotlight.d.ts","sourceRoot":"","sources":["../src/spotlight.ts"],"names":[],"mappings":"AAsBA,iGAAiG;AACjG,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,gGAAgG;AAChG,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,eAAO,MAAM,+BAA+B,OAAO,CAAC;AACpD,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,MAAM,gBAAgB,GACxB,YAAY,GACZ,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,gBAAgB,CAAC;AAErB,MAAM,MAAM,eAAe,CAAC,CAAC,IACzB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,GACtB;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAM5D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAA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,UAAU,CAAC,CA8CnF;AAED;0FAC0F;AAC1F,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAAC,SAAS,UAAU,EAAE,CAAC,CASzF;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,GAAE,MAA4B,GAAG,CAAC,EAAE,EAAE,CAKjG;AAED,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAMzE,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
//
|
|
2
|
+
// spotlight.ts — the SHARED PURE CORE behind Core/Spotlight (F17.7): what an OS-searchable
|
|
3
|
+
// item IS, decided once and run identically by all three renderers.
|
|
4
|
+
//
|
|
5
|
+
// THE ROUND TRIP IS THE PRODUCT. Indexing content into the system search field is only half
|
|
6
|
+
// the feature; the half that matters is the TAP, which arrives as an opaque identifier the app
|
|
7
|
+
// has to turn back into a route. Core Spotlight calls that identifier `uniqueIdentifier`,
|
|
8
|
+
// AppSearch calls it a namespaced document id, and if each platform invented its own encoding
|
|
9
|
+
// then a deep link that worked on iOS would 404 on Android. So the encoding lives here, the
|
|
10
|
+
// round trip is corpus-pinned, and `Mandatory/PushRouting` receives the same route either way.
|
|
11
|
+
//
|
|
12
|
+
// THE BATCH SIZE IS ALSO A SHARED DECISION, not a platform detail: both indexers degrade badly
|
|
13
|
+
// on a single huge transaction (Core Spotlight silently drops the tail, AppSearch throws), and
|
|
14
|
+
// an app that indexes 5,000 notes at first launch must chunk. Chunking identically on both
|
|
15
|
+
// means one progress bar and one resumable cursor.
|
|
16
|
+
//
|
|
17
|
+
// WHAT IS DELIBERATELY NOT HERE: the index itself, the thumbnails, and any decision about WHEN
|
|
18
|
+
// to index. Those are the module's job and the app's job respectively.
|
|
19
|
+
//
|
|
20
|
+
// Pinned by OpenSource/Conformance/spotlight/index.json.
|
|
21
|
+
//
|
|
22
|
+
/** Both indexers degrade on a single huge transaction. 100 is the chunk both handle reliably. */
|
|
23
|
+
export const SPOTLIGHT_BATCH_MAX = 100;
|
|
24
|
+
/** Longer than this and the identifier stops fitting comfortably in either platform's index. */
|
|
25
|
+
export const SPOTLIGHT_MAX_ID_CHARS = 256;
|
|
26
|
+
export const SPOTLIGHT_MAX_TITLE_CHARS = 256;
|
|
27
|
+
export const SPOTLIGHT_MAX_DESCRIPTION_CHARS = 2000;
|
|
28
|
+
/** Beyond this, keyword matching gets worse rather than better on both platforms. */
|
|
29
|
+
export const SPOTLIGHT_MAX_KEYWORDS = 32;
|
|
30
|
+
function fail(error, detail) {
|
|
31
|
+
return detail === undefined ? { ok: false, error } : { ok: false, error, detail };
|
|
32
|
+
}
|
|
33
|
+
function hasControlCharacter(text) {
|
|
34
|
+
for (const c of text) {
|
|
35
|
+
const code = c.codePointAt(0) ?? 0;
|
|
36
|
+
if (code < 0x20 || code === 0x7f)
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A domain groups items so `clear({ domain })` can remove a whole feature's index at once.
|
|
43
|
+
*
|
|
44
|
+
* It may not contain a colon, and that is load-bearing rather than fussy: the unique identifier
|
|
45
|
+
* is `<domain>:<id>` split at the FIRST colon, which is what lets an id contain colons freely
|
|
46
|
+
* (a URL, a compound key) while the round trip stays exact.
|
|
47
|
+
*/
|
|
48
|
+
export function normalizeSearchDomain(raw) {
|
|
49
|
+
const text = String(raw ?? "").trim();
|
|
50
|
+
if (text.length === 0)
|
|
51
|
+
return { ok: true, value: "default" };
|
|
52
|
+
if (text.includes(":")) {
|
|
53
|
+
return fail("invalid_domain", "a domain cannot contain a colon; it is the separator");
|
|
54
|
+
}
|
|
55
|
+
if (text.length > 64)
|
|
56
|
+
return fail("invalid_domain", "a domain is at most 64 characters");
|
|
57
|
+
if (hasControlCharacter(text))
|
|
58
|
+
return fail("invalid_domain", "a domain holds no control characters");
|
|
59
|
+
return { ok: true, value: text };
|
|
60
|
+
}
|
|
61
|
+
/** `<domain>:<id>`. The one encoding both platforms use, so a tap resolves the same route. */
|
|
62
|
+
export function searchUniqueId(domain, id) {
|
|
63
|
+
return `${domain}:${id}`;
|
|
64
|
+
}
|
|
65
|
+
/** The inverse. Split at the FIRST colon, so an id containing colons round-trips exactly. */
|
|
66
|
+
export function parseSearchUniqueId(raw) {
|
|
67
|
+
const text = String(raw ?? "").trim();
|
|
68
|
+
const colon = text.indexOf(":");
|
|
69
|
+
if (colon <= 0 || colon === text.length - 1)
|
|
70
|
+
return null;
|
|
71
|
+
return { domain: text.slice(0, colon), id: text.slice(colon + 1) };
|
|
72
|
+
}
|
|
73
|
+
/** Keywords are trimmed, lowercased, deduped and capped. Case folding matters: both indexers
|
|
74
|
+
* match case-insensitively, so keeping "Recipe" and "recipe" as two entries spends the cap on
|
|
75
|
+
* nothing. */
|
|
76
|
+
export function normalizeSearchKeywords(raw) {
|
|
77
|
+
const list = Array.isArray(raw) ? raw : typeof raw === "string" && raw.length > 0 ? raw.split(",") : [];
|
|
78
|
+
const out = [];
|
|
79
|
+
for (const entry of list) {
|
|
80
|
+
const word = String(entry ?? "").trim().toLowerCase();
|
|
81
|
+
if (word.length === 0)
|
|
82
|
+
continue;
|
|
83
|
+
if (out.includes(word))
|
|
84
|
+
continue;
|
|
85
|
+
out.push(word);
|
|
86
|
+
if (out.length >= SPOTLIGHT_MAX_KEYWORDS)
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Validate and normalize one indexable item.
|
|
93
|
+
*
|
|
94
|
+
* THE ROUTE IS REQUIRED AND MUST BE ABSOLUTE. An indexed item with no route is worse than no
|
|
95
|
+
* item at all: it appears in the OS search field, the user taps it, and the app opens on its
|
|
96
|
+
* home screen with no explanation. Refusing at index time is the only place that failure can
|
|
97
|
+
* still be fixed.
|
|
98
|
+
*/
|
|
99
|
+
export function normalizeSearchItem(raw) {
|
|
100
|
+
const id = String(raw.id ?? "").trim();
|
|
101
|
+
if (id.length === 0)
|
|
102
|
+
return fail("invalid_id", "an item needs an id");
|
|
103
|
+
if (id.length > SPOTLIGHT_MAX_ID_CHARS) {
|
|
104
|
+
return fail("invalid_id", `an id is at most ${SPOTLIGHT_MAX_ID_CHARS} characters`);
|
|
105
|
+
}
|
|
106
|
+
if (hasControlCharacter(id))
|
|
107
|
+
return fail("invalid_id", "an id holds no control characters");
|
|
108
|
+
const title = String(raw.title ?? "").trim();
|
|
109
|
+
if (title.length === 0)
|
|
110
|
+
return fail("invalid_title", "an item needs a title to show");
|
|
111
|
+
if (title.length > SPOTLIGHT_MAX_TITLE_CHARS) {
|
|
112
|
+
return fail("invalid_title", `a title is at most ${SPOTLIGHT_MAX_TITLE_CHARS} characters`);
|
|
113
|
+
}
|
|
114
|
+
const domain = normalizeSearchDomain(raw.domain);
|
|
115
|
+
if (domain.ok !== true)
|
|
116
|
+
return fail(domain.error, domain.detail);
|
|
117
|
+
const route = String(raw.route ?? "").trim();
|
|
118
|
+
if (route.length === 0) {
|
|
119
|
+
return fail("invalid_route", "an indexed item needs the route its tap opens");
|
|
120
|
+
}
|
|
121
|
+
if (!route.startsWith("/")) {
|
|
122
|
+
return fail("invalid_route", "a route is absolute, starting with /");
|
|
123
|
+
}
|
|
124
|
+
if (hasControlCharacter(route))
|
|
125
|
+
return fail("invalid_route", "a route holds no control characters");
|
|
126
|
+
const description = String(raw.description ?? "").trim().slice(0, SPOTLIGHT_MAX_DESCRIPTION_CHARS);
|
|
127
|
+
const image = String(raw.image ?? "").trim();
|
|
128
|
+
let expires = 0;
|
|
129
|
+
if (raw.expires !== undefined && raw.expires !== null) {
|
|
130
|
+
const n = typeof raw.expires === "number" ? raw.expires : Number(raw.expires);
|
|
131
|
+
// A non-numeric or negative expiry means "no expiry" rather than an error: an item that
|
|
132
|
+
// refuses to index because a timestamp was malformed is a worse outcome than one that
|
|
133
|
+
// simply never expires.
|
|
134
|
+
expires = Number.isFinite(n) && n > 0 ? Math.floor(n) : 0;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
ok: true,
|
|
138
|
+
value: {
|
|
139
|
+
id, title, description,
|
|
140
|
+
keywords: normalizeSearchKeywords(raw.keywords),
|
|
141
|
+
image, route, domain: domain.value, expires,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** Validate a whole batch, refusing on the FIRST bad item with its index in the detail: a
|
|
146
|
+
* partial index is the hardest state to reason about, so the batch is all-or-nothing. */
|
|
147
|
+
export function normalizeSearchItems(raw) {
|
|
148
|
+
const list = Array.isArray(raw) ? raw : [];
|
|
149
|
+
const out = [];
|
|
150
|
+
for (let i = 0; i < list.length; i += 1) {
|
|
151
|
+
const one = normalizeSearchItem(list[i]);
|
|
152
|
+
if (one.ok !== true)
|
|
153
|
+
return fail(one.error, `item ${i}: ${one.detail ?? one.error}`);
|
|
154
|
+
out.push(one.value);
|
|
155
|
+
}
|
|
156
|
+
return { ok: true, value: out };
|
|
157
|
+
}
|
|
158
|
+
/** Split a batch into transactions both indexers handle reliably. */
|
|
159
|
+
export function chunkSearchItems(items, max = SPOTLIGHT_BATCH_MAX) {
|
|
160
|
+
const size = max > 0 ? Math.floor(max) : SPOTLIGHT_BATCH_MAX;
|
|
161
|
+
const out = [];
|
|
162
|
+
for (let i = 0; i < items.length; i += size)
|
|
163
|
+
out.push(items.slice(i, i + size));
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
/** Human copy for each refusal, so three renderers apologise with one sentence. */
|
|
167
|
+
export const SPOTLIGHT_MESSAGES = {
|
|
168
|
+
invalid_id: "That is not a usable item id.",
|
|
169
|
+
invalid_title: "Every indexed item needs a title the OS can show.",
|
|
170
|
+
invalid_route: "Every indexed item needs the absolute route its tap opens.",
|
|
171
|
+
invalid_domain: "That is not a usable index domain.",
|
|
172
|
+
too_many_items: "That is more items than one call can index.",
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=spotlight.js.map
|