@notionhq/custom-blocks-host 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1 -1
- package/dist/compatibility/normalizeHostToSandboxMessage.js +4 -4
- package/dist/compatibility/normalizeSandboxToHostMessage.d.ts +232 -8
- package/dist/compatibility/normalizeSandboxToHostMessage.d.ts.map +1 -1
- package/dist/compatibility/{pageResult.d.ts → pages/pageResult.d.ts} +1 -1
- package/dist/compatibility/pages/pageResult.d.ts.map +1 -0
- package/dist/compatibility/{pageWithNullTextFallbackProperties.d.ts → pages/toPageWithNullTextFallbackProperties.d.ts} +2 -2
- package/dist/compatibility/pages/toPageWithNullTextFallbackProperties.d.ts.map +1 -0
- package/dist/compatibility/{pageWithNullTextFallbackProperties.js → pages/toPageWithNullTextFallbackProperties.js} +1 -1
- package/dist/compatibility/{addMetadataReadSchemasForProtocol3To4.d.ts → protocol3To4/addMetadataReadSchemasForProtocol3To4.d.ts} +96 -90
- package/dist/compatibility/{addMetadataReadSchemasForProtocol3To4.d.ts.map → protocol3To4/addMetadataReadSchemasForProtocol3To4.d.ts.map} +1 -1
- package/dist/compatibility/{addMetadataReadSchemasForProtocol3To4.js → protocol3To4/addMetadataReadSchemasForProtocol3To4.js} +1 -1
- package/dist/compatibility/{normalizePageResultsForProtocol3To5.d.ts → protocol3To5/normalizePageResultsForProtocol3To5.d.ts} +2 -2
- package/dist/compatibility/protocol3To5/normalizePageResultsForProtocol3To5.d.ts.map +1 -0
- package/dist/compatibility/{normalizePageResultsForProtocol3To5.js → protocol3To5/normalizePageResultsForProtocol3To5.js} +3 -2
- package/dist/compatibility/protocol3To5/toDateTimeValueForProtocol3To5.d.ts +9 -0
- package/dist/compatibility/protocol3To5/toDateTimeValueForProtocol3To5.d.ts.map +1 -0
- package/dist/compatibility/protocol3To5/toDateTimeValueForProtocol3To5.js +21 -0
- package/dist/compatibility/protocol3To5/toPageForProtocol3To5.d.ts +12 -0
- package/dist/compatibility/protocol3To5/toPageForProtocol3To5.d.ts.map +1 -0
- package/dist/compatibility/protocol3To5/toPageForProtocol3To5.js +20 -0
- package/dist/compatibility/protocol3To5/toPropertyValueForProtocol3To5.d.ts +10 -0
- package/dist/compatibility/protocol3To5/toPropertyValueForProtocol3To5.d.ts.map +1 -0
- package/dist/compatibility/{pageForProtocol3To5.js → protocol3To5/toPropertyValueForProtocol3To5.js} +25 -95
- package/dist/compatibility/{pageForProtocol3To5.d.ts → protocol3To5/toQueryPageForProtocol3To5.d.ts} +11 -21
- package/dist/compatibility/protocol3To5/toQueryPageForProtocol3To5.d.ts.map +1 -0
- package/dist/compatibility/protocol3To5/toQueryPageForProtocol3To5.js +32 -0
- package/dist/compatibility/{normalizePageResultsForProtocol6.d.ts → protocol6/normalizePageResultsForProtocol6.d.ts} +2 -2
- package/dist/compatibility/protocol6/normalizePageResultsForProtocol6.d.ts.map +1 -0
- package/dist/compatibility/{normalizePageResultsForProtocol6.js → protocol6/normalizePageResultsForProtocol6.js} +1 -1
- package/dist/context/initialState.d.ts +1809 -0
- package/dist/context/initialState.d.ts.map +1 -0
- package/dist/context/initialState.js +34 -0
- package/dist/context/resize.d.ts +4 -0
- package/dist/context/resize.d.ts.map +1 -0
- package/dist/createCustomBlockHost.d.ts +13 -9
- package/dist/createCustomBlockHost.d.ts.map +1 -1
- package/dist/createCustomBlockHost.js +37 -24
- package/dist/{autoBindProperties.d.ts → dataSources/bindings/getAutoBoundPropertyIdsByKey.d.ts} +2 -2
- package/dist/dataSources/bindings/getAutoBoundPropertyIdsByKey.d.ts.map +1 -0
- package/dist/{dateValue.d.ts → dataSources/properties/toNotionDateValue.d.ts} +3 -3
- package/dist/dataSources/properties/toNotionDateValue.d.ts.map +1 -0
- package/dist/{queries → dataSources/queries}/querySubscriptions.d.ts +2 -2
- package/dist/dataSources/queries/querySubscriptions.d.ts.map +1 -0
- package/dist/dataSources/types.d.ts +14 -0
- package/dist/dataSources/types.d.ts.map +1 -0
- package/dist/dataSources/validation/validateQueryDataSourceFilter.d.ts +5 -0
- package/dist/dataSources/validation/validateQueryDataSourceFilter.d.ts.map +1 -0
- package/dist/{queries → dataSources/validation}/validateQueryDataSourceFilter.js +2 -2
- package/dist/dataSources/validation/validateQueryDataSourceSorts.d.ts +8 -0
- package/dist/dataSources/validation/validateQueryDataSourceSorts.d.ts.map +1 -0
- package/dist/{queries → dataSources/validation}/validateQueryDataSourceSorts.js +2 -2
- package/dist/index.d.ts +14 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/lifecycle/{initializationController.d.ts → createInitializationController.d.ts} +7 -6
- package/dist/lifecycle/createInitializationController.d.ts.map +1 -0
- package/dist/lifecycle/{initializationController.js → createInitializationController.js} +9 -4
- package/dist/lifecycle/errors/contextUnavailableError.d.ts +3 -0
- package/dist/lifecycle/errors/contextUnavailableError.d.ts.map +1 -0
- package/dist/lifecycle/errors/contextUnavailableError.js +8 -0
- package/dist/lifecycle/errors/initialStateTimeoutError.d.ts +3 -0
- package/dist/lifecycle/errors/initialStateTimeoutError.d.ts.map +1 -0
- package/dist/lifecycle/errors/initialStateTimeoutError.js +8 -0
- package/dist/lifecycle/errors/invalidConnectPayloadError.d.ts +3 -0
- package/dist/lifecycle/errors/invalidConnectPayloadError.d.ts.map +1 -0
- package/dist/lifecycle/errors/invalidConnectPayloadError.js +8 -0
- package/dist/lifecycle/errors/invalidInitResultPayloadError.d.ts +3 -0
- package/dist/lifecycle/errors/invalidInitResultPayloadError.d.ts.map +1 -0
- package/dist/lifecycle/errors/invalidInitResultPayloadError.js +8 -0
- package/dist/lifecycle/errors/invalidLocalPreviewUrlError.d.ts +3 -0
- package/dist/lifecycle/errors/invalidLocalPreviewUrlError.d.ts.map +1 -0
- package/dist/lifecycle/errors/invalidLocalPreviewUrlError.js +7 -0
- package/dist/lifecycle/errors/invalidPropertyBindingError.d.ts +3 -0
- package/dist/lifecycle/errors/invalidPropertyBindingError.d.ts.map +1 -0
- package/dist/lifecycle/errors/invalidPropertyBindingError.js +9 -0
- package/dist/lifecycle/errors/invalidProtocolVersionError.d.ts +5 -0
- package/dist/lifecycle/errors/invalidProtocolVersionError.d.ts.map +1 -0
- package/dist/lifecycle/errors/invalidProtocolVersionError.js +9 -0
- package/dist/lifecycle/errors/missingDataSourceBindingError.d.ts +3 -0
- package/dist/lifecycle/errors/missingDataSourceBindingError.d.ts.map +1 -0
- package/dist/lifecycle/errors/missingDataSourceBindingError.js +8 -0
- package/dist/lifecycle/errors/missingPropertyBindingError.d.ts +3 -0
- package/dist/lifecycle/errors/missingPropertyBindingError.d.ts.map +1 -0
- package/dist/lifecycle/errors/missingPropertyBindingError.js +8 -0
- package/dist/lifecycle/errors/noConnectError.d.ts +8 -0
- package/dist/lifecycle/errors/noConnectError.d.ts.map +1 -0
- package/dist/lifecycle/errors/noConnectError.js +13 -0
- package/dist/lifecycle/errors/noInitResultError.d.ts +3 -0
- package/dist/lifecycle/errors/noInitResultError.d.ts.map +1 -0
- package/dist/lifecycle/errors/noInitResultError.js +8 -0
- package/dist/lifecycle/errors/unknownInitializationError.d.ts +3 -0
- package/dist/lifecycle/errors/unknownInitializationError.d.ts.map +1 -0
- package/dist/lifecycle/errors/unknownInitializationError.js +8 -0
- package/dist/lifecycle/errors/unsupportedProtocolVersionError.d.ts +6 -0
- package/dist/lifecycle/errors/unsupportedProtocolVersionError.d.ts.map +1 -0
- package/dist/lifecycle/errors/unsupportedProtocolVersionError.js +9 -0
- package/dist/lifecycle/isAllowedLocalPreviewUrl.d.ts.map +1 -0
- package/dist/{isAllowedLocalPreviewUrl.js → lifecycle/isAllowedLocalPreviewUrl.js} +1 -1
- package/dist/lifecycle/{protocolVersion.d.ts → isValidBridgeProtocolVersion.d.ts} +1 -1
- package/dist/lifecycle/isValidBridgeProtocolVersion.d.ts.map +1 -0
- package/dist/lifecycle/types.d.ts +16 -1849
- package/dist/lifecycle/types.d.ts.map +1 -1
- package/dist/lifecycle/types.js +1 -41
- package/dist/{lifecycle → manifest}/resolveManifest.d.ts +2 -2
- package/dist/manifest/resolveManifest.d.ts.map +1 -0
- package/dist/manifest/types.d.ts +59 -0
- package/dist/manifest/types.d.ts.map +1 -0
- package/dist/manifest/types.js +10 -0
- package/dist/messages/{sandboxMessageRouter.d.ts → createSandboxMessageRouter.d.ts} +15 -15
- package/dist/messages/createSandboxMessageRouter.d.ts.map +1 -0
- package/dist/messages/{sandboxMessageRouter.js → createSandboxMessageRouter.js} +5 -4
- package/dist/messages/{invalidSandboxMessage.d.ts → getInvalidSandboxMessageResponse.d.ts} +1 -1
- package/dist/messages/getInvalidSandboxMessageResponse.d.ts.map +1 -0
- package/dist/messages/handlers.d.ts +26 -0
- package/dist/messages/handlers.d.ts.map +1 -0
- package/dist/messages/handlers.js +1 -0
- package/dist/messages/logging.d.ts +2 -0
- package/dist/messages/logging.d.ts.map +1 -0
- package/dist/messages/logging.js +1 -0
- package/dist/navigation/parseExternalUrl.d.ts.map +1 -0
- package/dist/navigation/types.d.ts +9 -0
- package/dist/navigation/types.d.ts.map +1 -0
- package/dist/navigation/types.js +1 -0
- package/dist/pages/types.d.ts +20 -0
- package/dist/pages/types.d.ts.map +1 -0
- package/dist/pages/types.js +1 -0
- package/dist/protocol/{messages/updatePage.d.ts → compatibility/protocol3To5/bridgePage.d.ts} +32 -22
- package/dist/protocol/compatibility/protocol3To5/bridgePage.js +21 -0
- package/dist/protocol/{dataSources → compatibility/protocol3To5}/dataSourcePage.js +1 -1
- package/dist/protocol/{dataSources → compatibility/protocol3To5}/dataSourceValue.js +2 -2
- package/dist/protocol/context/containingPage.d.ts +31 -0
- package/dist/protocol/context/containingPage.js +18 -0
- package/dist/protocol/{messages → context/messages}/pageChanged.js +1 -1
- package/dist/protocol/{parent.d.ts → context/parent.d.ts} +11 -1
- package/dist/protocol/context/parent.js +31 -0
- package/dist/protocol/dataSources/bridgeDataSourceBinding.d.ts +164 -0
- package/dist/protocol/dataSources/bridgeDataSourceBinding.js +25 -0
- package/dist/protocol/dataSources/bridgeDataSourceBindings.d.ts +148 -0
- package/dist/protocol/dataSources/bridgeDataSourceBindings.js +3 -0
- package/dist/protocol/dataSources/collectionPointer.d.ts +7 -0
- package/dist/protocol/dataSources/collectionPointer.js +7 -0
- package/dist/protocol/dataSources/collectionSchema.d.ts +144 -0
- package/dist/protocol/dataSources/collectionSchema.js +12 -0
- package/dist/protocol/dataSources/errors.d.ts +2 -2
- package/dist/protocol/dataSources/filters/bridgeDataSourceFilter.d.ts +505 -0
- package/dist/protocol/dataSources/filters/bridgeDataSourceFilter.js +8 -0
- package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.d.ts +253 -0
- package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.js +69 -0
- package/dist/protocol/dataSources/filters/bridgeDataSourceSort.d.ts +11 -0
- package/dist/protocol/dataSources/filters/bridgeDataSourceSort.js +8 -0
- package/dist/protocol/dataSources/filters/checkboxFilterOperator.d.ts +7 -0
- package/dist/protocol/dataSources/filters/checkboxFilterOperator.js +5 -0
- package/dist/protocol/dataSources/filters/containsFilterOperator.d.ts +13 -0
- package/dist/protocol/dataSources/filters/containsFilterOperator.js +9 -0
- package/dist/protocol/dataSources/filters/createdByFilterOperator.d.ts +17 -0
- package/dist/protocol/dataSources/filters/createdByFilterOperator.js +11 -0
- package/dist/protocol/dataSources/filters/dateFilterOperator.d.ts +47 -0
- package/dist/protocol/dataSources/filters/dateFilterOperator.js +73 -0
- package/dist/protocol/dataSources/filters/emptyOperator.d.ts +6 -0
- package/dist/protocol/dataSources/filters/emptyOperator.js +5 -0
- package/dist/protocol/dataSources/filters/numberFilterOperator.d.ts +19 -0
- package/dist/protocol/dataSources/filters/numberFilterOperator.js +11 -0
- package/dist/protocol/dataSources/filters/optionFilterOperator.d.ts +11 -0
- package/dist/protocol/dataSources/filters/optionFilterOperator.js +8 -0
- package/dist/protocol/dataSources/filters/peopleFilterOperator.d.ts +23 -0
- package/dist/protocol/dataSources/filters/peopleFilterOperator.js +11 -0
- package/dist/protocol/dataSources/filters/relationFilterOperator.d.ts +11 -0
- package/dist/protocol/dataSources/filters/relationFilterOperator.js +12 -0
- package/dist/protocol/dataSources/filters/statusFilterOperator.d.ts +15 -0
- package/dist/protocol/dataSources/filters/statusFilterOperator.js +7 -0
- package/dist/protocol/dataSources/filters/statusGroupFilterOperator.d.ts +9 -0
- package/dist/protocol/dataSources/filters/statusGroupFilterOperator.js +18 -0
- package/dist/protocol/dataSources/filters/stringOrStringArray.d.ts +2 -0
- package/dist/protocol/dataSources/filters/stringOrStringArray.js +5 -0
- package/dist/protocol/dataSources/filters/textFilterOperator.d.ts +19 -0
- package/dist/protocol/dataSources/filters/textFilterOperator.js +11 -0
- package/dist/protocol/dataSources/makeBridgeDataSourceBinding.d.ts +6 -0
- package/dist/protocol/dataSources/makeBridgeDataSourceBinding.js +6 -0
- package/dist/protocol/{messages → dataSources/messages}/dataSourcesChanged.d.ts +1 -0
- package/dist/protocol/{messages → dataSources/messages}/dataSourcesChanged.js +2 -2
- package/dist/protocol/{messages/queryDataSourceResult.d.ts → dataSources/messages/queryDataSource.d.ts} +525 -2
- package/dist/protocol/{messages/queryDataSourceResult.js → dataSources/messages/queryDataSource.js} +22 -2
- package/dist/protocol/dataSources/notionDataSource.d.ts +309 -0
- package/dist/protocol/dataSources/notionDataSource.js +38 -0
- package/dist/protocol/dataSources/resolveDataSourceBinding.d.ts +32 -0
- package/dist/protocol/dataSources/resolveDataSourceBinding.js +33 -0
- package/dist/protocol/{messages → handshake}/connect.d.ts +4 -0
- package/dist/protocol/{messages → handshake}/connect.js +2 -2
- package/dist/protocol/{messages → handshake}/init.d.ts +6 -1
- package/dist/protocol/{messages → handshake}/init.js +10 -10
- package/dist/protocol/{messages → handshake}/initResult.d.ts +1 -1
- package/dist/protocol/{messages → handshake}/isInitHandshakeMessage.d.ts +2 -2
- package/dist/protocol/index.d.ts +150 -54
- package/dist/protocol/index.js +73 -54
- package/dist/protocol/manifest/capabilities.d.ts +37 -0
- package/dist/protocol/manifest/capabilities.js +13 -0
- package/dist/protocol/{manifest.d.ts → manifest/manifest.d.ts} +12 -2
- package/dist/protocol/{manifest.js → manifest/manifest.js} +8 -1
- package/dist/protocol/messages/hostToSandbox.d.ts +12 -0
- package/dist/protocol/messages/hostToSandbox.js +15 -15
- package/dist/protocol/messages/messagePayload.d.ts +1 -1
- package/dist/protocol/messages/sandboxToHost.d.ts +232 -8
- package/dist/protocol/messages/sandboxToHost.js +12 -12
- package/dist/protocol/{messages → navigation}/openExternalUrl.d.ts +1 -1
- package/dist/protocol/{messages/createPage.d.ts → pages/bridgePage.d.ts} +67 -65
- package/dist/protocol/pages/bridgePage.js +25 -0
- package/dist/protocol/pages/makeBridgePage.d.ts +4 -0
- package/dist/protocol/pages/makeBridgePage.js +12 -0
- package/dist/protocol/{messages/createPageResult.d.ts → pages/messages/createPage.d.ts} +500 -2
- package/dist/protocol/pages/messages/createPage.js +104 -0
- package/dist/protocol/{messages → pages/messages}/getPage.d.ts +2 -2
- package/dist/protocol/{messages → pages/messages}/getPage.js +4 -3
- package/dist/protocol/{messages → pages/messages}/openPage.d.ts +2 -2
- package/dist/protocol/{messages → pages/messages}/openPage.js +1 -1
- package/dist/protocol/{messages/updatePageResult.d.ts → pages/messages/updatePage.d.ts} +272 -2
- package/dist/protocol/{messages/updatePageResult.js → pages/messages/updatePage.js} +26 -2
- package/dist/protocol/pages/pageAppearance.d.ts +62 -0
- package/dist/protocol/pages/pageAppearance.js +34 -0
- package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +433 -0
- package/dist/protocol/pages/properties/bridgePagePropertyMaps.js +4 -0
- package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +217 -0
- package/dist/protocol/pages/properties/bridgePagePropertyValue.js +144 -0
- package/dist/protocol/pages/properties/dateInput.d.ts +45 -0
- package/dist/protocol/pages/properties/dateInput.js +23 -0
- package/dist/protocol/pages/properties/fileInput.d.ts +16 -0
- package/dist/protocol/pages/properties/fileInput.js +16 -0
- package/dist/protocol/pages/properties/metadataActor.d.ts +6 -0
- package/dist/protocol/pages/properties/metadataActor.js +7 -0
- package/dist/protocol/pages/properties/placeInput.d.ts +10 -0
- package/dist/protocol/pages/properties/placeInput.js +10 -0
- package/dist/protocol/pages/properties/relationInput.d.ts +5 -0
- package/dist/protocol/pages/properties/relationInput.js +2 -0
- package/dist/protocol/pages/properties/richText.d.ts +3 -0
- package/dist/protocol/pages/properties/richText.js +2 -0
- package/dist/protocol/pages/properties/selectOption.d.ts +13 -0
- package/dist/protocol/pages/properties/selectOption.js +16 -0
- package/dist/protocol/pages/properties/userInput.d.ts +10 -0
- package/dist/protocol/pages/properties/userInput.js +13 -0
- package/dist/protocol/users/bridgeUser.d.ts +12 -0
- package/dist/protocol/users/bridgeUser.js +12 -0
- package/dist/protocol/users/{user.d.ts → bridgeUserList.d.ts} +2 -15
- package/dist/protocol/users/bridgeUserList.js +10 -0
- package/dist/protocol/users/makeBridgeUser.d.ts +4 -0
- package/dist/protocol/users/makeBridgeUser.js +11 -0
- package/dist/protocol/{messages → users/messages}/currentUserChanged.js +2 -2
- package/dist/protocol/{messages → users/messages}/getUser.d.ts +2 -2
- package/dist/protocol/{messages → users/messages}/getUser.js +3 -2
- package/dist/protocol/{messages → users/messages}/listUsers.d.ts +2 -2
- package/dist/protocol/{messages → users/messages}/listUsers.js +2 -2
- package/dist/protocol/users/userId.d.ts +3 -0
- package/dist/protocol/users/userId.js +2 -0
- package/dist/protocol/{errors.d.ts → utils/errors.d.ts} +6 -0
- package/dist/protocol/utils/errors.js +11 -0
- package/dist/protocol/utils/nullableStringSchema.d.ts +2 -0
- package/dist/protocol/utils/nullableStringSchema.js +2 -0
- package/dist/users/types.d.ts +9 -0
- package/dist/users/types.d.ts.map +1 -0
- package/dist/users/types.js +1 -0
- package/dist/utils/maybePromise.d.ts +2 -0
- package/dist/utils/maybePromise.d.ts.map +1 -0
- package/dist/utils/maybePromise.js +1 -0
- package/dist/utils/protocolVersion.d.ts.map +1 -0
- package/dist/utils/toNotionPageId.d.ts +3 -0
- package/dist/utils/toNotionPageId.d.ts.map +1 -0
- package/dist/{ids.js → utils/toNotionPageId.js} +1 -1
- package/dist/{utils.d.ts → utils/unreachable.d.ts} +1 -1
- package/dist/utils/unreachable.d.ts.map +1 -0
- package/docs/bridge/protocol.md +16 -1
- package/docs/bridge/versioning.md +2 -2
- package/docs/handlers.md +2 -2
- package/package.json +1 -1
- package/src/compatibility/normalizeHostToSandboxMessage.ts +4 -4
- package/src/compatibility/{pageWithNullTextFallbackProperties.ts → pages/toPageWithNullTextFallbackProperties.ts} +2 -2
- package/src/compatibility/{addMetadataReadSchemasForProtocol3To4.ts → protocol3To4/addMetadataReadSchemasForProtocol3To4.ts} +1 -1
- package/src/compatibility/{normalizePageResultsForProtocol3To5.ts → protocol3To5/normalizePageResultsForProtocol3To5.ts} +4 -6
- package/src/compatibility/protocol3To5/toDateTimeValueForProtocol3To5.ts +25 -0
- package/src/compatibility/protocol3To5/toPageForProtocol3To5.ts +29 -0
- package/src/compatibility/protocol3To5/toPropertyValueForProtocol3To5.ts +102 -0
- package/src/compatibility/protocol3To5/toQueryPageForProtocol3To5.ts +35 -0
- package/src/compatibility/{normalizePageResultsForProtocol6.ts → protocol6/normalizePageResultsForProtocol6.ts} +2 -2
- package/src/context/initialState.ts +65 -0
- package/src/context/resize.ts +4 -0
- package/src/createCustomBlockHost.ts +74 -73
- package/src/{autoBindProperties.ts → dataSources/bindings/getAutoBoundPropertyIdsByKey.ts} +1 -1
- package/src/{dateValue.ts → dataSources/properties/toNotionDateValue.ts} +2 -2
- package/src/{queries → dataSources/queries}/querySubscriptions.ts +2 -2
- package/src/dataSources/types.ts +26 -0
- package/src/{queries → dataSources/validation}/validateQueryDataSourceFilter.ts +11 -13
- package/src/{queries → dataSources/validation}/validateQueryDataSourceSorts.ts +6 -8
- package/src/index.ts +37 -27
- package/src/lifecycle/{initializationController.ts → createInitializationController.ts} +15 -20
- package/src/lifecycle/errors/contextUnavailableError.ts +10 -0
- package/src/lifecycle/errors/initialStateTimeoutError.ts +10 -0
- package/src/lifecycle/errors/invalidConnectPayloadError.ts +10 -0
- package/src/lifecycle/errors/invalidInitResultPayloadError.ts +10 -0
- package/src/lifecycle/errors/invalidLocalPreviewUrlError.ts +10 -0
- package/src/lifecycle/errors/invalidPropertyBindingError.ts +11 -0
- package/src/lifecycle/errors/invalidProtocolVersionError.ts +13 -0
- package/src/lifecycle/errors/missingDataSourceBindingError.ts +10 -0
- package/src/lifecycle/errors/missingPropertyBindingError.ts +10 -0
- package/src/lifecycle/errors/noConnectError.ts +15 -0
- package/src/lifecycle/errors/noInitResultError.ts +10 -0
- package/src/lifecycle/errors/unknownInitializationError.ts +10 -0
- package/src/lifecycle/errors/unsupportedProtocolVersionError.ts +14 -0
- package/src/{isAllowedLocalPreviewUrl.ts → lifecycle/isAllowedLocalPreviewUrl.ts} +1 -1
- package/src/lifecycle/types.ts +17 -103
- package/src/{lifecycle → manifest}/resolveManifest.ts +2 -2
- package/src/manifest/types.ts +28 -0
- package/src/messages/{sandboxMessageRouter.ts → createSandboxMessageRouter.ts} +19 -21
- package/src/messages/handlers.ts +54 -0
- package/src/messages/logging.ts +1 -0
- package/src/navigation/types.ts +20 -0
- package/src/pages/types.ts +55 -0
- package/src/users/types.ts +26 -0
- package/src/utils/maybePromise.ts +1 -0
- package/src/utils/toNotionPageId.ts +7 -0
- package/dist/autoBindProperties.d.ts.map +0 -1
- package/dist/compatibility/normalizePageResultsForProtocol3To5.d.ts.map +0 -1
- package/dist/compatibility/normalizePageResultsForProtocol6.d.ts.map +0 -1
- package/dist/compatibility/pageForProtocol3To5.d.ts.map +0 -1
- package/dist/compatibility/pageResult.d.ts.map +0 -1
- package/dist/compatibility/pageWithNullTextFallbackProperties.d.ts.map +0 -1
- package/dist/dateValue.d.ts.map +0 -1
- package/dist/ids.d.ts +0 -3
- package/dist/ids.d.ts.map +0 -1
- package/dist/isAllowedLocalPreviewUrl.d.ts.map +0 -1
- package/dist/lifecycle/initErrors.d.ts +0 -25
- package/dist/lifecycle/initErrors.d.ts.map +0 -1
- package/dist/lifecycle/initErrors.js +0 -111
- package/dist/lifecycle/initializationController.d.ts.map +0 -1
- package/dist/lifecycle/protocolVersion.d.ts.map +0 -1
- package/dist/lifecycle/resolveManifest.d.ts.map +0 -1
- package/dist/messages/invalidSandboxMessage.d.ts.map +0 -1
- package/dist/messages/parseExternalUrl.d.ts.map +0 -1
- package/dist/messages/sandboxMessageRouter.d.ts.map +0 -1
- package/dist/messages/types.d.ts +0 -65
- package/dist/messages/types.d.ts.map +0 -1
- package/dist/protocol/dataSources/dataSource.d.ts +0 -786
- package/dist/protocol/dataSources/dataSource.js +0 -66
- package/dist/protocol/errors.js +0 -6
- package/dist/protocol/messages/createPage.js +0 -51
- package/dist/protocol/messages/createPageResult.js +0 -43
- package/dist/protocol/messages/queryDataSource.d.ts +0 -1470
- package/dist/protocol/messages/queryDataSource.js +0 -254
- package/dist/protocol/messages/updatePage.js +0 -23
- package/dist/protocol/pages/page.d.ts +0 -1422
- package/dist/protocol/pages/page.js +0 -318
- package/dist/protocol/parent.js +0 -13
- package/dist/protocol/users/user.js +0 -20
- package/dist/protocolVersion.d.ts.map +0 -1
- package/dist/queries/querySubscriptions.d.ts.map +0 -1
- package/dist/queries/types.d.ts +0 -5
- package/dist/queries/types.d.ts.map +0 -1
- package/dist/queries/validateQueryDataSourceFilter.d.ts +0 -5
- package/dist/queries/validateQueryDataSourceFilter.d.ts.map +0 -1
- package/dist/queries/validateQueryDataSourceSorts.d.ts +0 -8
- package/dist/queries/validateQueryDataSourceSorts.d.ts.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/src/compatibility/pageForProtocol3To5.ts +0 -190
- package/src/ids.ts +0 -9
- package/src/lifecycle/initErrors.ts +0 -131
- package/src/messages/types.ts +0 -171
- package/src/queries/types.ts +0 -11
- /package/dist/compatibility/{pageResult.js → pages/pageResult.js} +0 -0
- /package/dist/{messages/types.js → context/resize.js} +0 -0
- /package/dist/{autoBindProperties.js → dataSources/bindings/getAutoBoundPropertyIdsByKey.js} +0 -0
- /package/dist/{dateValue.js → dataSources/properties/toNotionDateValue.js} +0 -0
- /package/dist/{queries → dataSources/queries}/querySubscriptions.js +0 -0
- /package/dist/{queries → dataSources}/types.js +0 -0
- /package/dist/{isAllowedLocalPreviewUrl.d.ts → lifecycle/isAllowedLocalPreviewUrl.d.ts} +0 -0
- /package/dist/lifecycle/{protocolVersion.js → isValidBridgeProtocolVersion.js} +0 -0
- /package/dist/{lifecycle → manifest}/resolveManifest.js +0 -0
- /package/dist/messages/{invalidSandboxMessage.js → getInvalidSandboxMessageResponse.js} +0 -0
- /package/dist/{messages → navigation}/parseExternalUrl.d.ts +0 -0
- /package/dist/{messages → navigation}/parseExternalUrl.js +0 -0
- /package/dist/protocol/{dataSources → compatibility/protocol3To5}/dataSourcePage.d.ts +0 -0
- /package/dist/protocol/{dataSources → compatibility/protocol3To5}/dataSourceValue.d.ts +0 -0
- /package/dist/protocol/{contrast.d.ts → context/contrast.d.ts} +0 -0
- /package/dist/protocol/{contrast.js → context/contrast.js} +0 -0
- /package/dist/protocol/{messages → context/messages}/contrastModeChanged.d.ts +0 -0
- /package/dist/protocol/{messages → context/messages}/contrastModeChanged.js +0 -0
- /package/dist/protocol/{messages → context/messages}/pageChanged.d.ts +0 -0
- /package/dist/protocol/{messages → context/messages}/parentChanged.d.ts +0 -0
- /package/dist/protocol/{messages → context/messages}/parentChanged.js +0 -0
- /package/dist/protocol/{messages → context/messages}/resize.d.ts +0 -0
- /package/dist/protocol/{messages → context/messages}/resize.js +0 -0
- /package/dist/protocol/{messages → context/messages}/themeChanged.d.ts +0 -0
- /package/dist/protocol/{messages → context/messages}/themeChanged.js +0 -0
- /package/dist/protocol/{theme.d.ts → context/theme.d.ts} +0 -0
- /package/dist/protocol/{theme.js → context/theme.js} +0 -0
- /package/dist/protocol/{messages → dataSources/messages}/unsubscribeDataSourceQuery.d.ts +0 -0
- /package/dist/protocol/{messages → dataSources/messages}/unsubscribeDataSourceQuery.js +0 -0
- /package/dist/protocol/dataSources/{dateValue.d.ts → properties/dateValue.d.ts} +0 -0
- /package/dist/protocol/dataSources/{dateValue.js → properties/dateValue.js} +0 -0
- /package/dist/protocol/dataSources/{propertySchema.d.ts → properties/propertySchema.d.ts} +0 -0
- /package/dist/protocol/dataSources/{propertySchema.js → properties/propertySchema.js} +0 -0
- /package/dist/protocol/{messages → handshake}/initResult.js +0 -0
- /package/dist/protocol/{messages → handshake}/isInitHandshakeMessage.js +0 -0
- /package/dist/protocol/{messages → navigation}/openExternalUrl.js +0 -0
- /package/dist/protocol/{messages → users/messages}/currentUserChanged.d.ts +0 -0
- /package/dist/protocol/{ids.d.ts → utils/ids.d.ts} +0 -0
- /package/dist/protocol/{ids.js → utils/ids.js} +0 -0
- /package/dist/protocol/{isLocalBlockServerUrl.d.ts → utils/isLocalBlockServerUrl.d.ts} +0 -0
- /package/dist/protocol/{isLocalBlockServerUrl.js → utils/isLocalBlockServerUrl.js} +0 -0
- /package/dist/protocol/{protocolVersion.d.ts → utils/protocolVersion.d.ts} +0 -0
- /package/dist/protocol/{protocolVersion.js → utils/protocolVersion.js} +0 -0
- /package/dist/protocol/{dataSources → utils}/recordPointer.d.ts +0 -0
- /package/dist/protocol/{dataSources → utils}/recordPointer.js +0 -0
- /package/dist/{protocolVersion.d.ts → utils/protocolVersion.d.ts} +0 -0
- /package/dist/{protocolVersion.js → utils/protocolVersion.js} +0 -0
- /package/dist/{utils.js → utils/unreachable.js} +0 -0
- /package/src/compatibility/{pageResult.ts → pages/pageResult.ts} +0 -0
- /package/src/lifecycle/{protocolVersion.ts → isValidBridgeProtocolVersion.ts} +0 -0
- /package/src/messages/{invalidSandboxMessage.ts → getInvalidSandboxMessageResponse.ts} +0 -0
- /package/src/{messages → navigation}/parseExternalUrl.ts +0 -0
- /package/src/{protocolVersion.ts → utils/protocolVersion.ts} +0 -0
- /package/src/{utils.ts → utils/unreachable.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lifecycle/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lifecycle/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAA;AAC3F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAA;AACtG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAA;AAE5F,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAC1C,cAAc,EACd;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CACrB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB;AAChC,qEAAqE;AACnE;IAAE,MAAM,EAAE,mBAAmB,CAAA;CAAE;AACjC;;;GAGG;GACD;IACA,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,yBAAyB,GAAG,SAAS,CAAA;IACpD,qBAAqB,EAAE,MAAM,CAAA;IAC7B,UAAU,EAAE,MAAM,CAAA;CACjB;AACH,8EAA8E;GAC5E;IAAE,MAAM,EAAE,sBAAsB,CAAA;CAAE;AACpC;;;;GAIG;GACD;IACA,MAAM,EAAE,aAAa,CAAA;IACrB,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC;AACH;;;GAGG;GACD;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,sBAAsB,CAAA;CAAE;AACrD,wFAAwF;GACtF;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAA;AAExB,+EAA+E;AAC/E,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAA;AAExD,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,GAAG;IAC3D,8DAA8D;IAC9D,KAAK,EACF,SAAS;IACX,mFAAmF;OACjF,MAAM;IACR,4FAA4F;OAC1F,YAAY;IACd,4GAA4G;OAC1G,SAAS,CAAA;IACZ,yEAAyE;IACzE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAAA"}
|
package/dist/lifecycle/types.js
CHANGED
|
@@ -1,41 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { notionDataSourceBindingsSchema } from "../protocol/dataSources/dataSource.js";
|
|
3
|
-
import { notionBlockIdSchema } from "../protocol/ids.js";
|
|
4
|
-
import { manifestSchema, } from "../protocol/manifest.js";
|
|
5
|
-
import { customBlockInitErrorInfoSchema, } from "../protocol/messages/init.js";
|
|
6
|
-
import { customBlockPageSchema } from "../protocol/pages/page.js";
|
|
7
|
-
import { notionParentSchema } from "../protocol/parent.js";
|
|
8
|
-
import { notionThemeSchema } from "../protocol/theme.js";
|
|
9
|
-
import { notionUserSchema } from "../protocol/users/user.js";
|
|
10
|
-
import * as v from "valibot";
|
|
11
|
-
export const customBlockHostManifestResultSchema = v.variant("status", [
|
|
12
|
-
v.object({ status: v.literal("success"), manifest: manifestSchema }),
|
|
13
|
-
v.object({
|
|
14
|
-
status: v.literal("error"),
|
|
15
|
-
error: customBlockInitErrorInfoSchema,
|
|
16
|
-
}),
|
|
17
|
-
]);
|
|
18
|
-
export const customBlockHostInitialStateSchema = v.object({
|
|
19
|
-
theme: notionThemeSchema,
|
|
20
|
-
/**
|
|
21
|
-
* Defaults to standard for existing host integrations.
|
|
22
|
-
* TODO(custom-blocks): Make this required when MIN_HOST_SUPPORTED_BRIDGE_PROTOCOL_VERSION increases to 4.
|
|
23
|
-
*/
|
|
24
|
-
contrastMode: v.optional(notionContrastModeSchema),
|
|
25
|
-
blockId: notionBlockIdSchema,
|
|
26
|
-
parent: notionParentSchema,
|
|
27
|
-
page: customBlockPageSchema,
|
|
28
|
-
manifest: manifestSchema,
|
|
29
|
-
dataSources: v.object({ bindings: notionDataSourceBindingsSchema }),
|
|
30
|
-
currentUser: notionUserSchema,
|
|
31
|
-
});
|
|
32
|
-
export const customBlockHostPreparedStateResultSchema = v.variant("status", [
|
|
33
|
-
v.object({
|
|
34
|
-
status: v.literal("success"),
|
|
35
|
-
initialState: v.omit(customBlockHostInitialStateSchema, ["manifest"]),
|
|
36
|
-
}),
|
|
37
|
-
v.object({
|
|
38
|
-
status: v.literal("error"),
|
|
39
|
-
error: customBlockInitErrorInfoSchema,
|
|
40
|
-
}),
|
|
41
|
-
]);
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BridgeCustomBlockManifest } from "../protocol/manifest/manifest.js";
|
|
2
2
|
import type { CustomBlockHostNormalizedManifestResult, CustomBlockManifestSource } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Select the host's manifest result or the sandbox's connect declaration. Both
|
|
@@ -8,6 +8,6 @@ import type { CustomBlockHostNormalizedManifestResult, CustomBlockManifestSource
|
|
|
8
8
|
export declare function resolveManifest(args: {
|
|
9
9
|
manifestSource: CustomBlockManifestSource;
|
|
10
10
|
hostManifest: Promise<CustomBlockHostNormalizedManifestResult>;
|
|
11
|
-
connectManifest:
|
|
11
|
+
connectManifest: BridgeCustomBlockManifest | undefined;
|
|
12
12
|
}): Promise<CustomBlockHostNormalizedManifestResult>;
|
|
13
13
|
//# sourceMappingURL=resolveManifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveManifest.d.ts","sourceRoot":"","sources":["../../src/manifest/resolveManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAA;AACtG,OAAO,KAAK,EACX,uCAAuC,EACvC,yBAAyB,EACzB,MAAM,YAAY,CAAA;AAEnB;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC3C,cAAc,EAAE,yBAAyB,CAAA;IACzC,YAAY,EAAE,OAAO,CAAC,uCAAuC,CAAC,CAAA;IAC9D,eAAe,EAAE,yBAAyB,GAAG,SAAS,CAAA;CACtD,GAAG,OAAO,CAAC,uCAAuC,CAAC,CAenD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { CustomBlockInitErrorInfo } from "../protocol/handshake/init.js";
|
|
2
|
+
import { manifestSchema } from "../protocol/manifest/manifest.js";
|
|
3
|
+
import * as v from "valibot";
|
|
4
|
+
/** Selects the manifest used to initialize a custom block. Both sources load independently. */
|
|
5
|
+
export type CustomBlockManifestSource =
|
|
6
|
+
/** Uses the persisted manifest returned by the host adapter's getPersistedManifest callback. */
|
|
7
|
+
"host"
|
|
8
|
+
/** Uses the manifest sent in connect by a sandbox on a separate HTTP(S) loopback origin. */
|
|
9
|
+
| "sandbox";
|
|
10
|
+
export declare const customBlockHostManifestResultSchema: v.VariantSchema<"status", [v.ObjectSchema<{
|
|
11
|
+
readonly status: v.LiteralSchema<"success", undefined>;
|
|
12
|
+
readonly manifest: v.ObjectSchema<{
|
|
13
|
+
readonly version: v.LiteralSchema<1, undefined>;
|
|
14
|
+
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
15
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
16
|
+
readonly slashCommand: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
17
|
+
readonly icon: v.OptionalSchema<v.ObjectSchema<{
|
|
18
|
+
readonly type: v.LiteralSchema<"emoji", undefined>;
|
|
19
|
+
readonly emoji: v.StringSchema<undefined>;
|
|
20
|
+
}, undefined>, undefined>;
|
|
21
|
+
readonly dataSources: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
22
|
+
readonly name: v.StringSchema<undefined>;
|
|
23
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
24
|
+
readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
25
|
+
readonly type: v.LiteralSchema<"emoji", undefined>;
|
|
26
|
+
readonly emoji: v.StringSchema<undefined>;
|
|
27
|
+
}, undefined>, v.ObjectSchema<{
|
|
28
|
+
readonly type: v.LiteralSchema<"external", undefined>;
|
|
29
|
+
readonly url: v.StringSchema<undefined>;
|
|
30
|
+
}, undefined>], undefined>, undefined>;
|
|
31
|
+
readonly properties: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
32
|
+
readonly name: v.StringSchema<undefined>;
|
|
33
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
34
|
+
readonly type: v.PicklistSchema<readonly ["title", "rich_text", "number", "checkbox", "url", "email", "phone_number", "select", "multi_select", "status", "date", "people", "files", "unique_id", "relation", "place", "formula", "rollup", "button", "verification", "last_visited_time", "location", "created_time", "last_edited_time", "created_by", "last_edited_by"], undefined>;
|
|
35
|
+
}, undefined>, undefined>, {}>;
|
|
36
|
+
}, undefined>, undefined>, {}>;
|
|
37
|
+
readonly capabilities: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
38
|
+
readonly capability: v.StringSchema<undefined>;
|
|
39
|
+
readonly resource: v.StringSchema<undefined>;
|
|
40
|
+
}, undefined>, undefined>, undefined>;
|
|
41
|
+
}, undefined>;
|
|
42
|
+
}, undefined>, v.ObjectSchema<{
|
|
43
|
+
readonly status: v.LiteralSchema<"error", undefined>;
|
|
44
|
+
readonly error: v.ObjectSchema<{
|
|
45
|
+
readonly code: v.StringSchema<undefined>;
|
|
46
|
+
readonly message: v.StringSchema<undefined>;
|
|
47
|
+
readonly isRetryable: v.BooleanSchema<undefined>;
|
|
48
|
+
}, undefined>;
|
|
49
|
+
}, undefined>], undefined>;
|
|
50
|
+
/** A persisted manifest or an explicit loading error. The host validates and normalizes it. */
|
|
51
|
+
export type CustomBlockHostManifestResult = {
|
|
52
|
+
status: "success";
|
|
53
|
+
manifest: v.InferInput<typeof manifestSchema>;
|
|
54
|
+
} | {
|
|
55
|
+
status: "error";
|
|
56
|
+
error: CustomBlockInitErrorInfo;
|
|
57
|
+
};
|
|
58
|
+
export type CustomBlockHostNormalizedManifestResult = v.InferOutput<typeof customBlockHostManifestResultSchema>;
|
|
59
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/manifest/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oDAAoD,CAAA;AAElG,OAAO,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAA;AACtF,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,+FAA+F;AAC/F,MAAM,MAAM,yBAAyB;AACpC,gGAAgG;AAC9F,MAAM;AACR,4FAA4F;GAC1F,SAAS,CAAA;AAEZ,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAM9C,CAAA;AAEF,+FAA+F;AAC/F,MAAM,MAAM,6BAA6B,GACtC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,CAAC,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAA;CAAE,GACpE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,CAAA;AAEvD,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,WAAW,CAClE,OAAO,mCAAmC,CAC1C,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { customBlockInitErrorInfoSchema } from "../protocol/handshake/init.js";
|
|
2
|
+
import { manifestSchema } from "../protocol/manifest/manifest.js";
|
|
3
|
+
import * as v from "valibot";
|
|
4
|
+
export const customBlockHostManifestResultSchema = v.variant("status", [
|
|
5
|
+
v.object({ status: v.literal("success"), manifest: manifestSchema }),
|
|
6
|
+
v.object({
|
|
7
|
+
status: v.literal("error"),
|
|
8
|
+
error: customBlockInitErrorInfoSchema,
|
|
9
|
+
}),
|
|
10
|
+
]);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { InitResultMessage } from "../protocol/
|
|
1
|
+
import type { ResizeMessage } from "../protocol/context/messages/resize.js";
|
|
2
|
+
import type { QueryDataSourceMessage } from "../protocol/dataSources/messages/queryDataSource.js";
|
|
3
|
+
import type { UnsubscribeDataSourceQueryMessage } from "../protocol/dataSources/messages/unsubscribeDataSourceQuery.js";
|
|
4
|
+
import type { ConnectMessage } from "../protocol/handshake/connect.js";
|
|
5
|
+
import type { InitResultMessage } from "../protocol/handshake/initResult.js";
|
|
6
6
|
import type { InvalidSandboxMessage } from "../protocol/messages/invalidSandboxMessage.js";
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type { InitializationController } from "../lifecycle/
|
|
7
|
+
import type { OpenExternalUrlMessage } from "../protocol/navigation/openExternalUrl.js";
|
|
8
|
+
import type { CreatePageMessage } from "../protocol/pages/messages/createPage.js";
|
|
9
|
+
import type { GetPageMessage } from "../protocol/pages/messages/getPage.js";
|
|
10
|
+
import type { OpenPageMessage } from "../protocol/pages/messages/openPage.js";
|
|
11
|
+
import type { UpdatePageMessage } from "../protocol/pages/messages/updatePage.js";
|
|
12
|
+
import type { GetUserMessage } from "../protocol/users/messages/getUser.js";
|
|
13
|
+
import type { ListUsersMessage } from "../protocol/users/messages/listUsers.js";
|
|
14
|
+
import type { InitializationController } from "../lifecycle/createInitializationController.js";
|
|
15
15
|
import type { InitStatus } from "../lifecycle/types.js";
|
|
16
|
-
import type { CustomBlockHostLogDirection } from "./
|
|
16
|
+
import type { CustomBlockHostLogDirection } from "./logging.js";
|
|
17
17
|
export type SandboxMessageRouterOptions = {
|
|
18
18
|
iframe: HTMLIFrameElement;
|
|
19
19
|
sandboxOrigin: string;
|
|
@@ -36,4 +36,4 @@ export type SandboxMessageRouterOptions = {
|
|
|
36
36
|
onResize: (message: ResizeMessage) => void;
|
|
37
37
|
};
|
|
38
38
|
export declare function createSandboxMessageRouter(options: SandboxMessageRouterOptions): (event: MessageEvent) => void;
|
|
39
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=createSandboxMessageRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSandboxMessageRouter.d.ts","sourceRoot":"","sources":["../../src/messages/createSandboxMessageRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6DAA6D,CAAA;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0EAA0E,CAAA;AACtH,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,qFAAqF,CAAA;AAC5I,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uDAAuD,CAAA;AAC3F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0DAA0D,CAAA;AAEjG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oEAAoE,CAAA;AAC/G,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gEAAgE,CAAA;AAC5G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+DAA+D,CAAA;AACtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAA;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+DAA+D,CAAA;AACtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAA;AAChG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAA;AAGpG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAA;AAG9F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAA;AAY/D,MAAM,MAAM,2BAA2B,GAAG;IACzC,MAAM,EAAE,iBAAiB,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,UAAU,CAAA;IAC/B,IAAI,EAAE,CAAC,SAAS,EAAE,2BAA2B,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACxE,QAAQ,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAClD,gBAAgB,EAAE,wBAAwB,CAAC,sBAAsB,CAAC,CAAA;IAClE,mBAAmB,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAA;IACxE,SAAS,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAA;IAC5C,YAAY,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAA;IAClD,iBAAiB,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5E,4BAA4B,EAAE,CAC7B,OAAO,EAAE,iCAAiC,KACtC,IAAI,CAAA;IACT,YAAY,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClE,UAAU,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,iBAAiB,EAAE,CAAC,OAAO,EAAE,sBAAsB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5E,SAAS,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D,SAAS,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D,WAAW,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChE,YAAY,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CAC1C,CAAA;AAED,wBAAgB,0BAA0B,CACzC,OAAO,EAAE,2BAA2B,GAClC,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CA0I/B"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { isInitHandshakeMessage } from "../protocol/
|
|
1
|
+
import { isInitHandshakeMessage } from "../protocol/handshake/isInitHandshakeMessage.js";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
import { normalizeSandboxToHostMessage } from "../compatibility/normalizeSandboxToHostMessage.js";
|
|
4
|
-
import { invalidConnectPayloadError
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { invalidConnectPayloadError } from "../lifecycle/errors/invalidConnectPayloadError.js";
|
|
5
|
+
import { invalidInitResultPayloadError } from "../lifecycle/errors/invalidInitResultPayloadError.js";
|
|
6
|
+
import { unreachable } from "../utils/unreachable.js";
|
|
7
|
+
import { getInvalidSandboxMessageResponse } from "./getInvalidSandboxMessageResponse.js";
|
|
7
8
|
const initializationIdentitySchema = v.object({
|
|
8
9
|
initializationId: v.string(),
|
|
9
10
|
});
|
|
@@ -4,4 +4,4 @@ export type InvalidSandboxMessageResponse = {
|
|
|
4
4
|
nack?: InvalidSandboxMessage;
|
|
5
5
|
};
|
|
6
6
|
export declare function getInvalidSandboxMessageResponse(data: unknown): InvalidSandboxMessageResponse;
|
|
7
|
-
//# sourceMappingURL=
|
|
7
|
+
//# sourceMappingURL=getInvalidSandboxMessageResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getInvalidSandboxMessageResponse.d.ts","sourceRoot":"","sources":["../../src/messages/getInvalidSandboxMessageResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oEAAoE,CAAA;AAE/G,MAAM,MAAM,6BAA6B,GAAG;IAC3C,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,IAAI,CAAC,EAAE,qBAAqB,CAAA;CAC5B,CAAA;AAED,wBAAgB,gCAAgC,CAC/C,IAAI,EAAE,OAAO,GACX,6BAA6B,CAe/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ResizeMessage } from "../protocol/context/messages/resize.js";
|
|
2
|
+
import type { QueryDataSourceMessage } from "../protocol/dataSources/messages/queryDataSource.js";
|
|
3
|
+
import type { OpenExternalUrlMessage } from "../protocol/navigation/openExternalUrl.js";
|
|
4
|
+
import type { CreatePageMessage } from "../protocol/pages/messages/createPage.js";
|
|
5
|
+
import type { GetPageMessage } from "../protocol/pages/messages/getPage.js";
|
|
6
|
+
import type { OpenPageMessage } from "../protocol/pages/messages/openPage.js";
|
|
7
|
+
import type { UpdatePageMessage } from "../protocol/pages/messages/updatePage.js";
|
|
8
|
+
import type { GetUserMessage } from "../protocol/users/messages/getUser.js";
|
|
9
|
+
import type { ListUsersMessage } from "../protocol/users/messages/listUsers.js";
|
|
10
|
+
import type { CustomBlockHostQueryDataSourceResult } from "../dataSources/types.js";
|
|
11
|
+
import type { CustomBlockHostNavigationContext, CustomBlockHostOpenExternalUrlResult } from "../navigation/types.js";
|
|
12
|
+
import type { CustomBlockHostCreatePageResult, CustomBlockHostGetPageResult, CustomBlockHostOpenPageResult, CustomBlockHostUpdatePageResult } from "../pages/types.js";
|
|
13
|
+
import type { CustomBlockHostGetUserResult, CustomBlockHostListUsersResult } from "../users/types.js";
|
|
14
|
+
import type { MaybePromise } from "../utils/maybePromise.js";
|
|
15
|
+
export type CustomBlockHostHandlers = {
|
|
16
|
+
queryDataSource: (message: QueryDataSourceMessage) => MaybePromise<CustomBlockHostQueryDataSourceResult>;
|
|
17
|
+
createPage?: (message: CreatePageMessage) => MaybePromise<CustomBlockHostCreatePageResult>;
|
|
18
|
+
getPage?: (message: GetPageMessage) => MaybePromise<CustomBlockHostGetPageResult>;
|
|
19
|
+
getUser?: (message: GetUserMessage) => MaybePromise<CustomBlockHostGetUserResult>;
|
|
20
|
+
listUsers?: (message: ListUsersMessage) => MaybePromise<CustomBlockHostListUsersResult>;
|
|
21
|
+
openPage?: (message: OpenPageMessage) => MaybePromise<CustomBlockHostOpenPageResult>;
|
|
22
|
+
openExternalUrl?: (message: OpenExternalUrlMessage, context: CustomBlockHostNavigationContext) => MaybePromise<CustomBlockHostOpenExternalUrlResult>;
|
|
23
|
+
updatePage?: (message: UpdatePageMessage) => MaybePromise<CustomBlockHostUpdatePageResult>;
|
|
24
|
+
resize?: (message: ResizeMessage) => void;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/messages/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6DAA6D,CAAA;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0EAA0E,CAAA;AACtH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gEAAgE,CAAA;AAC5G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+DAA+D,CAAA;AACtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAA;AAChG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAA;AAClG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+DAA+D,CAAA;AACtG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAA;AAChG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8DAA8D,CAAA;AACpG,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAA;AACnF,OAAO,KAAK,EACX,gCAAgC,EAChC,oCAAoC,EACpC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EACX,+BAA+B,EAC/B,4BAA4B,EAC5B,6BAA6B,EAC7B,+BAA+B,EAC/B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EACX,4BAA4B,EAC5B,8BAA8B,EAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAE5D,MAAM,MAAM,uBAAuB,GAAG;IACrC,eAAe,EAAE,CAChB,OAAO,EAAE,sBAAsB,KAC3B,YAAY,CAAC,oCAAoC,CAAC,CAAA;IACvD,UAAU,CAAC,EAAE,CACZ,OAAO,EAAE,iBAAiB,KACtB,YAAY,CAAC,+BAA+B,CAAC,CAAA;IAClD,OAAO,CAAC,EAAE,CACT,OAAO,EAAE,cAAc,KACnB,YAAY,CAAC,4BAA4B,CAAC,CAAA;IAC/C,OAAO,CAAC,EAAE,CACT,OAAO,EAAE,cAAc,KACnB,YAAY,CAAC,4BAA4B,CAAC,CAAA;IAC/C,SAAS,CAAC,EAAE,CACX,OAAO,EAAE,gBAAgB,KACrB,YAAY,CAAC,8BAA8B,CAAC,CAAA;IACjD,QAAQ,CAAC,EAAE,CACV,OAAO,EAAE,eAAe,KACpB,YAAY,CAAC,6BAA6B,CAAC,CAAA;IAChD,eAAe,CAAC,EAAE,CACjB,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,gCAAgC,KACrC,YAAY,CAAC,oCAAoC,CAAC,CAAA;IACvD,UAAU,CAAC,EAAE,CACZ,OAAO,EAAE,iBAAiB,KACtB,YAAY,CAAC,+BAA+B,CAAC,CAAA;IAClD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CACzC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../src/messages/logging.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseExternalUrl.d.ts","sourceRoot":"","sources":["../../src/navigation/parseExternalUrl.ts"],"names":[],"mappings":"AAEA,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAclE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BridgeMessagePayload } from "../protocol/messages/messagePayload.js";
|
|
2
|
+
import type { CustomBlockOpenExternalUrlErrorInfo, OpenExternalUrlResultMessage, openExternalUrlMessageSchema } from "../protocol/navigation/openExternalUrl.js";
|
|
3
|
+
import type { InferInput } from "valibot";
|
|
4
|
+
export type CustomBlockHostOpenExternalUrlResult = BridgeMessagePayload<OpenExternalUrlResultMessage, CustomBlockOpenExternalUrlErrorInfo>;
|
|
5
|
+
export type CustomBlockHostNavigationContext = {
|
|
6
|
+
signal: AbortSignal;
|
|
7
|
+
};
|
|
8
|
+
export type OpenExternalUrlMessageInput = InferInput<typeof openExternalUrlMessageSchema>;
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/navigation/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAA;AACvG,OAAO,KAAK,EACX,mCAAmC,EACnC,4BAA4B,EAC5B,4BAA4B,EAC5B,MAAM,gEAAgE,CAAA;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,MAAM,MAAM,oCAAoC,GAAG,oBAAoB,CACtE,4BAA4B,EAC5B,mCAAmC,CACnC,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC9C,MAAM,EAAE,WAAW,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG,UAAU,CACnD,OAAO,4BAA4B,CACnC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BridgeMessagePayload } from "../protocol/messages/messagePayload.js";
|
|
2
|
+
import type { CustomBlockCreatePageErrorInfo, createPageMessageSchema, createPageResultMessageSchema } from "../protocol/pages/messages/createPage.js";
|
|
3
|
+
import type { CustomBlockGetPageErrorInfo, getPageMessageSchema, getPageResultMessageSchema } from "../protocol/pages/messages/getPage.js";
|
|
4
|
+
import type { CustomBlockOpenPageErrorInfo, openPageMessageSchema, openPageResultMessageSchema } from "../protocol/pages/messages/openPage.js";
|
|
5
|
+
import type { CustomBlockUpdatePageErrorInfo, updatePageMessageSchema, updatePageResultMessageSchema } from "../protocol/pages/messages/updatePage.js";
|
|
6
|
+
import type { InferInput } from "valibot";
|
|
7
|
+
/**
|
|
8
|
+
* Host results use InferInput so adapters can return plain string IDs.
|
|
9
|
+
* The runtime validates results before sending them and assigns protocol ID brands.
|
|
10
|
+
* Handler requests use parsed protocol types, whose IDs are already branded.
|
|
11
|
+
*/
|
|
12
|
+
export type CustomBlockHostCreatePageResult = BridgeMessagePayload<InferInput<typeof createPageResultMessageSchema>, CustomBlockCreatePageErrorInfo>;
|
|
13
|
+
export type CustomBlockHostGetPageResult = BridgeMessagePayload<InferInput<typeof getPageResultMessageSchema>, CustomBlockGetPageErrorInfo>;
|
|
14
|
+
export type CustomBlockHostUpdatePageResult = BridgeMessagePayload<InferInput<typeof updatePageResultMessageSchema>, CustomBlockUpdatePageErrorInfo>;
|
|
15
|
+
export type CustomBlockHostOpenPageResult = BridgeMessagePayload<InferInput<typeof openPageResultMessageSchema>, CustomBlockOpenPageErrorInfo>;
|
|
16
|
+
export type CreatePageMessageInput = InferInput<typeof createPageMessageSchema>;
|
|
17
|
+
export type GetPageMessageInput = InferInput<typeof getPageMessageSchema>;
|
|
18
|
+
export type OpenPageMessageInput = InferInput<typeof openPageMessageSchema>;
|
|
19
|
+
export type UpdatePageMessageInput = InferInput<typeof updatePageMessageSchema>;
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAA;AACvG,OAAO,KAAK,EACX,8BAA8B,EAC9B,uBAAuB,EACvB,6BAA6B,EAC7B,MAAM,+DAA+D,CAAA;AACtE,OAAO,KAAK,EACX,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC1B,MAAM,4DAA4D,CAAA;AACnE,OAAO,KAAK,EACX,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,MAAM,6DAA6D,CAAA;AACpE,OAAO,KAAK,EACX,8BAA8B,EAC9B,uBAAuB,EACvB,6BAA6B,EAC7B,MAAM,+DAA+D,CAAA;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC;;;;GAIG;AACH,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CACjE,UAAU,CAAC,OAAO,6BAA6B,CAAC,EAChD,8BAA8B,CAC9B,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG,oBAAoB,CAC9D,UAAU,CAAC,OAAO,0BAA0B,CAAC,EAC7C,2BAA2B,CAC3B,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CACjE,UAAU,CAAC,OAAO,6BAA6B,CAAC,EAChD,8BAA8B,CAC9B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG,oBAAoB,CAC/D,UAAU,CAAC,OAAO,2BAA2B,CAAC,EAC9C,4BAA4B,CAC5B,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE/E,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEzE,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAE3E,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/protocol/{messages/updatePage.d.ts → compatibility/protocol3To5/bridgePage.d.ts}
RENAMED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
export declare const bridgePageForProtocol3To5Schema: v.ObjectSchema<{
|
|
3
|
+
readonly object: v.LiteralSchema<"page", undefined>;
|
|
4
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
5
|
+
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
6
|
+
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
7
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
8
|
+
}, undefined>, v.ObjectSchema<{
|
|
9
|
+
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
10
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
11
|
+
}, undefined>, v.ObjectSchema<{
|
|
12
|
+
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
13
|
+
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
14
|
+
}, undefined>, v.ObjectSchema<{
|
|
15
|
+
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
16
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
17
|
+
}, undefined>, v.ObjectSchema<{
|
|
18
|
+
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
19
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
20
|
+
}, undefined>, v.ObjectSchema<{
|
|
21
|
+
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
22
|
+
}, undefined>], undefined>;
|
|
23
|
+
readonly properties: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
18
24
|
readonly id: v.StringSchema<undefined>;
|
|
19
25
|
readonly type: v.LiteralSchema<"title", undefined>;
|
|
20
26
|
readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
|
|
@@ -228,7 +234,9 @@ export declare const updatePageMessageSchema: v.ObjectSchema<{
|
|
|
228
234
|
readonly id: v.StringSchema<undefined>;
|
|
229
235
|
readonly type: v.LiteralSchema<"verification", undefined>;
|
|
230
236
|
readonly verification: v.StringSchema<undefined>;
|
|
231
|
-
}, undefined>], undefined>, undefined
|
|
237
|
+
}, undefined>], undefined>, undefined>;
|
|
238
|
+
readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
239
|
+
readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
232
240
|
readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
|
|
233
241
|
readonly type: v.LiteralSchema<"emoji", undefined>;
|
|
234
242
|
readonly emoji: v.StringSchema<undefined>;
|
|
@@ -263,9 +271,11 @@ export declare const updatePageMessageSchema: v.ObjectSchema<{
|
|
|
263
271
|
readonly expiry_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
264
272
|
}, undefined>;
|
|
265
273
|
}, undefined>], undefined>, undefined>;
|
|
266
|
-
readonly
|
|
274
|
+
readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
275
|
+
readonly public_url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
276
|
+
/** Whether the page or an ancestor is archived. */
|
|
277
|
+
readonly is_archived: v.BooleanSchema<undefined>;
|
|
278
|
+
/** Whether the page or an ancestor is in Trash. */
|
|
279
|
+
readonly in_trash: v.BooleanSchema<undefined>;
|
|
267
280
|
}, undefined>;
|
|
268
|
-
|
|
269
|
-
* The sandbox sends this message to update a page.
|
|
270
|
-
*/
|
|
271
|
-
export type UpdatePageMessage = v.InferOutput<typeof updatePageMessageSchema>;
|
|
281
|
+
export type BridgePageForProtocol3To5 = v.InferOutput<typeof bridgePageForProtocol3To5Schema>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionParentSchema } from "../../context/parent.js";
|
|
3
|
+
import { notionPageCoverSchema, notionPageIconSchema, } from "../../pages/pageAppearance.js";
|
|
4
|
+
import { bridgePagePropertyWriteMapSchema } from "../../pages/properties/bridgePagePropertyMaps.js";
|
|
5
|
+
import { notionPageIdSchema } from "../../utils/ids.js";
|
|
6
|
+
export const bridgePageForProtocol3To5Schema = v.object({
|
|
7
|
+
object: v.literal("page"),
|
|
8
|
+
id: notionPageIdSchema,
|
|
9
|
+
parent: notionParentSchema,
|
|
10
|
+
properties: bridgePagePropertyWriteMapSchema,
|
|
11
|
+
created_time: v.optional(v.string()),
|
|
12
|
+
last_edited_time: v.optional(v.string()),
|
|
13
|
+
icon: v.optional(notionPageIconSchema),
|
|
14
|
+
cover: v.optional(notionPageCoverSchema),
|
|
15
|
+
url: v.optional(v.string()),
|
|
16
|
+
public_url: v.optional(v.string()),
|
|
17
|
+
/** Whether the page or an ancestor is archived. */
|
|
18
|
+
is_archived: v.boolean(),
|
|
19
|
+
/** Whether the page or an ancestor is in Trash. */
|
|
20
|
+
in_trash: v.boolean(),
|
|
21
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import { notionPageIdSchema } from "
|
|
2
|
+
import { notionPageIdSchema } from "../../utils/ids.js";
|
|
3
3
|
import { notionDataSourceValueSchema } from "./dataSourceValue.js";
|
|
4
4
|
/**
|
|
5
5
|
* Query page shape for protocols 3–5, with flat values keyed by raw property ID.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import { notionDateValueSchema } from "
|
|
3
|
-
import { notionRecordPointerSchema } from "
|
|
2
|
+
import { notionDateValueSchema } from "../../dataSources/properties/dateValue.js";
|
|
3
|
+
import { notionRecordPointerSchema } from "../../utils/recordPointer.js";
|
|
4
4
|
/**
|
|
5
5
|
* Possible types for a data source value.
|
|
6
6
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
export declare const customBlockPageSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
3
|
+
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
4
|
+
}, undefined>, v.ObjectSchema<{
|
|
5
|
+
readonly type: v.LiteralSchema<"page", undefined>;
|
|
6
|
+
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
7
|
+
/**
|
|
8
|
+
* The containing page's own parent. It lets a block distinguish a freestanding page from a
|
|
9
|
+
* database row without a round trip. Not to be confused with the top-level `parent` runtime
|
|
10
|
+
* value, which is the custom block's own parent.
|
|
11
|
+
*/
|
|
12
|
+
readonly parent: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
13
|
+
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
14
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
15
|
+
}, undefined>, v.ObjectSchema<{
|
|
16
|
+
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
17
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
18
|
+
}, undefined>, v.ObjectSchema<{
|
|
19
|
+
readonly type: v.LiteralSchema<"workspace", undefined>;
|
|
20
|
+
readonly workspace: v.LiteralSchema<true, undefined>;
|
|
21
|
+
}, undefined>, v.ObjectSchema<{
|
|
22
|
+
readonly type: v.LiteralSchema<"block_id", undefined>;
|
|
23
|
+
readonly block_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionBlockId">]>;
|
|
24
|
+
}, undefined>, v.ObjectSchema<{
|
|
25
|
+
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
26
|
+
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
27
|
+
}, undefined>, v.ObjectSchema<{
|
|
28
|
+
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
29
|
+
}, undefined>], undefined>;
|
|
30
|
+
}, undefined>], undefined>;
|
|
31
|
+
export type CustomBlockPage = v.InferOutput<typeof customBlockPageSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionPageIdSchema } from "../utils/ids.js";
|
|
3
|
+
import { notionParentSchema } from "./parent.js";
|
|
4
|
+
export const customBlockPageSchema = v.variant("type", [
|
|
5
|
+
/** The viewer cannot access the containing page; its ID and parent are not exposed. */
|
|
6
|
+
v.object({ type: v.literal("unavailable") }),
|
|
7
|
+
/** The viewer can access the containing page; includes its ID and parent location. */
|
|
8
|
+
v.object({
|
|
9
|
+
type: v.literal("page"),
|
|
10
|
+
id: notionPageIdSchema,
|
|
11
|
+
/**
|
|
12
|
+
* The containing page's own parent. It lets a block distinguish a freestanding page from a
|
|
13
|
+
* database row without a round trip. Not to be confused with the top-level `parent` runtime
|
|
14
|
+
* value, which is the custom block's own parent.
|
|
15
|
+
*/
|
|
16
|
+
parent: notionParentSchema,
|
|
17
|
+
}),
|
|
18
|
+
]);
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
+
export declare const pageParentSchema: v.ObjectSchema<{
|
|
3
|
+
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
4
|
+
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
5
|
+
}, undefined>;
|
|
6
|
+
export type PageParent = v.InferOutput<typeof pageParentSchema>;
|
|
7
|
+
export declare const dataSourceParentSchema: v.ObjectSchema<{
|
|
8
|
+
readonly type: v.LiteralSchema<"data_source_id", undefined>;
|
|
9
|
+
readonly data_source_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
10
|
+
}, undefined>;
|
|
11
|
+
export type DataSourceParent = v.InferOutput<typeof dataSourceParentSchema>;
|
|
2
12
|
export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema<{
|
|
3
13
|
readonly type: v.LiteralSchema<"page_id", undefined>;
|
|
4
14
|
readonly page_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionPageId">]>;
|
|
@@ -23,7 +33,7 @@ export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema
|
|
|
23
33
|
* Uses Notion public API parent names, plus an unavailable state:
|
|
24
34
|
* - `page_id` — parented directly under a page.
|
|
25
35
|
* - `block_id` — parented under a non-page container block (toggle, column, callout, ...).
|
|
26
|
-
* - `data_source_id` — parented under a
|
|
36
|
+
* - `data_source_id` — parented under a data source.
|
|
27
37
|
* - `workspace` — top-level / team-rooted.
|
|
28
38
|
* - `agent_id` — owned by an agent, such as an agent instruction page or its blocks.
|
|
29
39
|
* - `unavailable` — the viewer cannot access the parent resource. Neither its ID nor its kind
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
import { notionAgentIdSchema, notionBlockIdSchema, notionDataSourceIdSchema, notionPageIdSchema, } from "../utils/ids.js";
|
|
3
|
+
export const pageParentSchema = v.object({
|
|
4
|
+
type: v.literal("page_id"),
|
|
5
|
+
page_id: notionPageIdSchema,
|
|
6
|
+
});
|
|
7
|
+
export const dataSourceParentSchema = v.object({
|
|
8
|
+
type: v.literal("data_source_id"),
|
|
9
|
+
data_source_id: notionDataSourceIdSchema,
|
|
10
|
+
});
|
|
11
|
+
const workspaceParentSchema = v.object({
|
|
12
|
+
type: v.literal("workspace"),
|
|
13
|
+
workspace: v.literal(true),
|
|
14
|
+
});
|
|
15
|
+
const blockParentSchema = v.object({
|
|
16
|
+
type: v.literal("block_id"),
|
|
17
|
+
block_id: notionBlockIdSchema,
|
|
18
|
+
});
|
|
19
|
+
const agentParentSchema = v.object({
|
|
20
|
+
type: v.literal("agent_id"),
|
|
21
|
+
agent_id: notionAgentIdSchema,
|
|
22
|
+
});
|
|
23
|
+
const unavailableParentSchema = v.object({ type: v.literal("unavailable") });
|
|
24
|
+
export const notionParentSchema = v.variant("type", [
|
|
25
|
+
pageParentSchema,
|
|
26
|
+
dataSourceParentSchema,
|
|
27
|
+
workspaceParentSchema,
|
|
28
|
+
blockParentSchema,
|
|
29
|
+
agentParentSchema,
|
|
30
|
+
unavailableParentSchema,
|
|
31
|
+
]);
|