botframework-webchat-core 4.18.1 → 4.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/activity.js +3 -0
- package/boot/deprecated/activity.js +7 -0
- package/boot/deprecated/activity.mjs +5 -0
- package/boot/deprecated/graph.js +7 -0
- package/boot/deprecated/graph.mjs +5 -0
- package/boot/deprecated/internal.js +7 -0
- package/boot/deprecated/internal.mjs +5 -0
- package/dist/WebChatActivity-CYqxBG_4.d.mts +271 -0
- package/dist/WebChatActivity-CYqxBG_4.d.ts +271 -0
- package/dist/_dtsroll-chunks/B7Whm73Q-tagged.d.ts +71 -0
- package/dist/_dtsroll-chunks/C-MxR98A-botframework-webchat-core-debug-api.d.ts +135 -0
- package/dist/_dtsroll-chunks/CAquHfZK-botframework-webchat-base.utils.d.ts +17 -0
- package/dist/_dtsroll-chunks/CDVed0Q--botframework-webchat-core.org-schema.d.ts +601 -0
- package/dist/_dtsroll-chunks/vlDgTKWF-botframework-webchat-core-graph.d.ts +239 -0
- package/dist/botframework-webchat-core.activity.d.mts +23 -0
- package/dist/botframework-webchat-core.activity.d.ts +23 -0
- package/dist/botframework-webchat-core.activity.js +2 -0
- package/dist/botframework-webchat-core.activity.js.map +1 -0
- package/dist/botframework-webchat-core.activity.mjs +2 -0
- package/dist/botframework-webchat-core.activity.mjs.map +1 -0
- package/dist/botframework-webchat-core.d.mts +267 -662
- package/dist/botframework-webchat-core.d.ts +556 -0
- package/dist/botframework-webchat-core.graph.d.mts +9 -0
- package/dist/botframework-webchat-core.graph.d.ts +9 -0
- package/dist/botframework-webchat-core.graph.js +2 -0
- package/dist/botframework-webchat-core.graph.js.map +1 -0
- package/dist/botframework-webchat-core.graph.mjs +2 -0
- package/dist/botframework-webchat-core.graph.mjs.map +1 -0
- package/dist/botframework-webchat-core.internal.d.mts +61 -0
- package/dist/botframework-webchat-core.internal.d.ts +61 -0
- package/dist/botframework-webchat-core.internal.js +2 -0
- package/dist/botframework-webchat-core.internal.js.map +1 -0
- package/dist/botframework-webchat-core.internal.mjs +2 -0
- package/dist/botframework-webchat-core.internal.mjs.map +1 -0
- package/dist/botframework-webchat-core.js +2 -0
- package/dist/botframework-webchat-core.js.map +1 -0
- package/dist/botframework-webchat-core.json-ld.d.mts +2 -0
- package/dist/botframework-webchat-core.json-ld.d.ts +2 -0
- package/dist/botframework-webchat-core.json-ld.js +2 -0
- package/dist/botframework-webchat-core.json-ld.js.map +1 -0
- package/dist/botframework-webchat-core.json-ld.mjs +2 -0
- package/dist/botframework-webchat-core.json-ld.mjs.map +1 -0
- package/dist/botframework-webchat-core.mjs +1 -2
- package/dist/botframework-webchat-core.mjs.map +1 -1
- package/dist/botframework-webchat-core.org-schema.d.mts +2 -0
- package/dist/botframework-webchat-core.org-schema.d.ts +2 -0
- package/dist/botframework-webchat-core.org-schema.js +2 -0
- package/dist/botframework-webchat-core.org-schema.js.map +1 -0
- package/dist/botframework-webchat-core.org-schema.mjs +2 -0
- package/dist/botframework-webchat-core.org-schema.mjs.map +1 -0
- package/dist/chunk-A4GEFYZJ.mjs +2 -0
- package/dist/chunk-A4GEFYZJ.mjs.map +1 -0
- package/dist/chunk-HZWWJL43.mjs +2 -0
- package/dist/chunk-HZWWJL43.mjs.map +1 -0
- package/dist/chunk-ICNZKQJW.mjs +2 -0
- package/dist/chunk-ICNZKQJW.mjs.map +1 -0
- package/dist/chunk-K6E6QQMQ.js +2 -0
- package/dist/chunk-K6E6QQMQ.js.map +1 -0
- package/dist/chunk-KPT5FBH2.mjs +2 -0
- package/dist/chunk-KPT5FBH2.mjs.map +1 -0
- package/dist/chunk-LO5BZSVE.js +2 -0
- package/dist/chunk-LO5BZSVE.js.map +1 -0
- package/dist/chunk-LP2X2JTR.js +2 -0
- package/dist/chunk-LP2X2JTR.js.map +1 -0
- package/dist/chunk-RUERYYZO.js +2 -0
- package/dist/chunk-RUERYYZO.js.map +1 -0
- package/dist/chunk-XOE3AOSM.js +2 -0
- package/dist/chunk-XOE3AOSM.js.map +1 -0
- package/dist/chunk-Y6ZDNVRT.mjs +2 -0
- package/dist/chunk-Y6ZDNVRT.mjs.map +1 -0
- package/{lib/createStore.d.ts → dist/createStore-CcvouBrW.d.mts} +29 -7
- package/dist/createStore-CcvouBrW.d.ts +65 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -1
- package/graph.js +3 -0
- package/internal.js +3 -0
- package/json-ld.js +3 -0
- package/org-schema.js +3 -0
- package/package.json +147 -73
- package/src/__tests__/activityFromBot.spec.js +2 -0
- package/src/__tests__/addMetaTag.spec.js +8 -0
- package/src/__tests__/addMetaTag.spec.mjs +8 -0
- package/src/__tests__/connectSaga.spec.js +2 -0
- package/src/__tests__/deleteKey.spec.js +2 -0
- package/src/__tests__/detectSlowConnectionSaga.spec.js +3 -1
- package/src/__tests__/observeOnce.spec.js +2 -0
- package/src/__tests__/speakableActivity.spec.js +2 -0
- package/src/__tests__/uniqueID.spec.js +2 -0
- package/src/actions/clearSuggestedActions.ts +20 -0
- package/src/actions/{connect.js → connect.ts} +9 -1
- package/src/actions/muteVoiceRecording.ts +17 -0
- package/src/actions/postVoiceActivity.ts +21 -0
- package/src/actions/registerActionSink.ts +29 -0
- package/src/actions/registerVoiceHandler.ts +24 -0
- package/src/actions/{sendEvent.js → sendEvent.ts} +1 -1
- package/src/actions/{sendMessageBack.js → sendMessageBack.ts} +1 -1
- package/src/actions/{sendPostBack.js → sendPostBack.ts} +1 -1
- package/src/actions/{setDictateInterims.js → setDictateInterims.ts} +1 -1
- package/src/actions/{setDictateState.js → setDictateState.ts} +1 -1
- package/src/actions/{setLanguage.js → setLanguage.ts} +1 -1
- package/src/actions/{setSendBox.js → setSendBox.ts} +1 -1
- package/src/actions/{setSendTimeout.js → setSendTimeout.ts} +1 -1
- package/src/actions/setSendTypingIndicator.ts +1 -1
- package/src/actions/setSuggestedActions.ts +35 -0
- package/src/actions/setVoiceState.ts +21 -0
- package/src/actions/startVoiceRecording.ts +17 -0
- package/src/actions/stopVoiceRecording.ts +17 -0
- package/src/actions/{submitSendBox.js → submitSendBox.ts} +1 -1
- package/src/actions/unmuteVoiceRecording.ts +17 -0
- package/src/actions/unregisterActionSink.ts +29 -0
- package/src/actions/unregisterVoiceHandler.ts +19 -0
- package/src/boot/activity.ts +19 -0
- package/src/boot/graph.ts +18 -0
- package/src/boot/internal.ts +11 -0
- package/src/boot/json-ld.ts +6 -0
- package/src/boot/org-schema.ts +29 -0
- package/src/buildInfo.ts +9 -0
- package/src/constants/{ActivityClientState.js → ActivityClientState.ts} +3 -3
- package/src/constants/DictateState.ts +10 -0
- package/src/createPromiseQueue.js +8 -6
- package/src/createReducer.ts +28 -20
- package/src/createSagas.ts +6 -3
- package/src/createStore.ts +26 -10
- package/src/env.d.ts +12 -0
- package/src/graph/createGraphFromStore.ts +121 -0
- package/src/index.ts +62 -45
- package/src/internal/StoreDebugAPIRegistry.ts +4 -0
- package/src/internal/actions/setRawState.ts +48 -0
- package/src/internal/types/suggestedActions.ts +11 -0
- package/src/internal/types/suggestedActionsOriginActivity.ts +16 -0
- package/src/reducers/activities/combineActivitiesReducer.ts +58 -0
- package/src/reducers/activities/createGroupedActivitiesReducer.ts +297 -0
- package/src/reducers/activities/patchActivity.ts +37 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.activity.spec.ts +144 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.howTo.spec.ts +148 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.howToWithLivestream.spec.ts +248 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.livestream.spec.ts +156 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.ts +177 -0
- package/src/reducers/activities/sort/private/computePartListTimestamp.ts +9 -0
- package/src/reducers/activities/sort/private/computeSortedActivities.ts +51 -0
- package/src/reducers/activities/sort/private/getLogicalTimestamp.spec.ts +49 -0
- package/src/reducers/activities/sort/private/getLogicalTimestamp.ts +33 -0
- package/src/reducers/activities/sort/private/getPartGroupingMetadataMap.spec.ts +92 -0
- package/src/reducers/activities/sort/private/getPartGroupingMetadataMap.ts +37 -0
- package/src/reducers/activities/sort/private/insertSorted.spec.ts +106 -0
- package/src/reducers/activities/sort/private/insertSorted.ts +18 -0
- package/src/reducers/activities/sort/property/LocalId.ts +60 -0
- package/src/reducers/activities/sort/property/Position.ts +39 -0
- package/src/reducers/activities/sort/property/ReceivedAt.ts +45 -0
- package/src/reducers/activities/sort/property/SendStatus.ts +51 -0
- package/src/reducers/activities/sort/queryLocalIdByActivityId.ts +6 -0
- package/src/reducers/activities/sort/queryLocalIdByClientActivityId.ts +6 -0
- package/src/reducers/activities/sort/types.ts +80 -0
- package/src/reducers/activities/sort/updateActivityChannelData.ts +101 -0
- package/src/reducers/activities/sort/updateSendState.ts +22 -0
- package/src/reducers/activities/sort/upsert.activity.spec.ts +500 -0
- package/src/reducers/activities/sort/upsert.howTo.spec.ts +368 -0
- package/src/reducers/activities/sort/upsert.howToWithLivestream.spec.ts +384 -0
- package/src/reducers/activities/sort/upsert.livestream.spec.ts +418 -0
- package/src/reducers/activities/sort/upsert.ts +498 -0
- package/src/reducers/activities/tsconfig.json +4 -0
- package/src/reducers/createNotificationsReducer.ts +4 -4
- package/src/reducers/suggestedActions.ts +21 -0
- package/src/reducers/suggestedActionsOriginActivity.ts +24 -0
- package/src/reducers/voiceActivity.ts +102 -0
- package/src/sagas/actionSinkSaga.ts +39 -0
- package/src/sagas/observeActivitySaga.ts +51 -1
- package/src/sagas/postActivitySaga.ts +17 -10
- package/src/sagas/postVoiceActivitySaga.ts +76 -0
- package/src/sagas/queueIncomingActivitySaga.ts +10 -4
- package/src/sagas/sendMessageToPostActivitySaga.ts +4 -1
- package/src/sagas/speakActivityAndStartDictateOnIncomingActivityFromOthersSaga.js +10 -4
- package/src/sagas/startDictateOnSpeakCompleteSaga.js +3 -3
- package/src/sagas/startSpeakActivityOnPostActivitySaga.js +15 -5
- package/src/sagas/stopDictateOnCardActionSaga.js +11 -3
- package/src/sagas/stopSpeakingActivityOnInputSaga.js +22 -4
- package/src/selectors/combineSelectors.ts +1 -1
- package/src/tsconfig.json +3 -15
- package/src/types/StoreDebugAPI.ts +25 -0
- package/src/types/WebChatActivity.ts +31 -14
- package/src/types/external/DirectLineActivity.ts +1 -1
- package/src/types/external/Observable.ts +4 -1
- package/src/types/internal/GlobalScopeClock.ts +10 -10
- package/src/types/internal/ReduxState.ts +2 -0
- package/src/types/internal/WebChatOutgoingActivity.ts +1 -1
- package/src/utils/dateToLocaleISOString.chatham.spec.js +1 -2
- package/src/utils/dateToLocaleISOString.japan.spec.js +1 -2
- package/src/utils/dateToLocaleISOString.newfoundland.spec.js +1 -2
- package/src/utils/dateToLocaleISOString.pacific.spec.js +1 -2
- package/src/utils/dateToLocaleISOString.utc.spec.js +1 -3
- package/src/utils/deleteKey.ts +1 -1
- package/src/utils/getActivityLivestreamingMetadata.spec.ts +297 -0
- package/src/utils/getActivityLivestreamingMetadata.ts +197 -0
- package/src/utils/getOrgSchemaMessage.spec.ts +4 -1
- package/src/utils/getOrgSchemaMessage.ts +16 -16
- package/src/utils/onErrorResumeNext.ts +1 -1
- package/src/utils/voiceActivity/getVoiceActivityRole.spec.ts +150 -0
- package/src/utils/voiceActivity/getVoiceActivityRole.ts +16 -0
- package/src/utils/voiceActivity/getVoiceActivityText.spec.ts +100 -0
- package/src/utils/voiceActivity/getVoiceActivityText.ts +11 -0
- package/src/utils/voiceActivity/isVoiceActivity.spec.ts +202 -0
- package/src/utils/voiceActivity/isVoiceActivity.ts +21 -0
- package/src/utils/voiceActivity/isVoiceTranscriptActivity.spec.ts +224 -0
- package/src/utils/voiceActivity/isVoiceTranscriptActivity.ts +24 -0
- package/dist/botframework-webchat-core.mjs.LEGAL.txt +0 -0
- package/lib/actions/clearSuggestedActions.js +0 -15
- package/lib/actions/connect.js +0 -33
- package/lib/actions/connectionStatusUpdate.js +0 -20
- package/lib/actions/deleteActivity.d.ts +0 -13
- package/lib/actions/deleteActivity.d.ts.map +0 -1
- package/lib/actions/deleteActivity.js +0 -19
- package/lib/actions/disconnect.js +0 -21
- package/lib/actions/dismissNotification.d.ts +0 -12
- package/lib/actions/dismissNotification.d.ts.map +0 -1
- package/lib/actions/dismissNotification.js +0 -19
- package/lib/actions/emitTypingIndicator.js +0 -15
- package/lib/actions/incomingActivity.d.ts +0 -14
- package/lib/actions/incomingActivity.d.ts.map +0 -1
- package/lib/actions/incomingActivity.js +0 -19
- package/lib/actions/markActivity.d.ts +0 -17
- package/lib/actions/markActivity.d.ts.map +0 -1
- package/lib/actions/markActivity.js +0 -22
- package/lib/actions/postActivity.d.ts +0 -64
- package/lib/actions/postActivity.d.ts.map +0 -1
- package/lib/actions/postActivity.js +0 -31
- package/lib/actions/queueIncomingActivity.js +0 -18
- package/lib/actions/reconnect.js +0 -17
- package/lib/actions/sagaError.d.ts +0 -8
- package/lib/actions/sagaError.d.ts.map +0 -1
- package/lib/actions/sagaError.js +0 -15
- package/lib/actions/sendEvent.js +0 -19
- package/lib/actions/sendFiles.d.ts +0 -19
- package/lib/actions/sendFiles.d.ts.map +0 -1
- package/lib/actions/sendFiles.js +0 -20
- package/lib/actions/sendMessage.d.ts +0 -19
- package/lib/actions/sendMessage.d.ts.map +0 -1
- package/lib/actions/sendMessage.js +0 -24
- package/lib/actions/sendMessageBack.js +0 -20
- package/lib/actions/sendPostBack.js +0 -18
- package/lib/actions/setClockSkewAdjustment.js +0 -12
- package/lib/actions/setDictateInterims.js +0 -18
- package/lib/actions/setDictateState.js +0 -18
- package/lib/actions/setLanguage.js +0 -18
- package/lib/actions/setNotification.d.ts +0 -10
- package/lib/actions/setNotification.d.ts.map +0 -1
- package/lib/actions/setNotification.js +0 -37
- package/lib/actions/setReferenceGrammarID.js +0 -18
- package/lib/actions/setSendBox.js +0 -18
- package/lib/actions/setSendBoxAttachments.d.ts +0 -13
- package/lib/actions/setSendBoxAttachments.d.ts.map +0 -1
- package/lib/actions/setSendBoxAttachments.js +0 -18
- package/lib/actions/setSendTimeout.js +0 -18
- package/lib/actions/setSendTypingIndicator.d.ts +0 -11
- package/lib/actions/setSendTypingIndicator.d.ts.map +0 -1
- package/lib/actions/setSendTypingIndicator.js +0 -18
- package/lib/actions/setSuggestedActions.js +0 -20
- package/lib/actions/startDictate.js +0 -15
- package/lib/actions/startSpeakingActivity.js +0 -15
- package/lib/actions/stopDictate.js +0 -15
- package/lib/actions/stopSpeakingActivity.js +0 -15
- package/lib/actions/submitSendBox.js +0 -22
- package/lib/actions/updateConnectionStatus.js +0 -18
- package/lib/constants/ActivityClientState.js +0 -16
- package/lib/constants/DictateState.js +0 -17
- package/lib/createPromiseQueue.js +0 -30
- package/lib/createReducer.d.ts +0 -60
- package/lib/createReducer.d.ts.map +0 -1
- package/lib/createReducer.js +0 -45
- package/lib/createSagas.d.ts +0 -8
- package/lib/createSagas.d.ts.map +0 -1
- package/lib/createSagas.js +0 -112
- package/lib/createStore.d.ts.map +0 -1
- package/lib/createStore.js +0 -131
- package/lib/definitions/activityFromBot.js +0 -11
- package/lib/definitions/speakableActivity.js +0 -10
- package/lib/definitions/speakingActivity.js +0 -13
- package/lib/index.d.ts +0 -76
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -309
- package/lib/reducers/connectivityStatus.js +0 -49
- package/lib/reducers/createActivitiesReducer.d.ts +0 -12
- package/lib/reducers/createActivitiesReducer.d.ts.map +0 -1
- package/lib/reducers/createActivitiesReducer.js +0 -267
- package/lib/reducers/createInternalReducer.d.ts +0 -10
- package/lib/reducers/createInternalReducer.d.ts.map +0 -1
- package/lib/reducers/createInternalReducer.js +0 -19
- package/lib/reducers/createNotificationsReducer.d.ts +0 -11
- package/lib/reducers/createNotificationsReducer.d.ts.map +0 -1
- package/lib/reducers/createNotificationsReducer.js +0 -55
- package/lib/reducers/createTypingReducer.d.ts +0 -14
- package/lib/reducers/createTypingReducer.d.ts.map +0 -1
- package/lib/reducers/createTypingReducer.js +0 -50
- package/lib/reducers/dictateInterims.js +0 -23
- package/lib/reducers/dictateState.js +0 -38
- package/lib/reducers/language.js +0 -23
- package/lib/reducers/private/findBeforeAfter.d.ts +0 -4
- package/lib/reducers/private/findBeforeAfter.d.ts.map +0 -1
- package/lib/reducers/private/findBeforeAfter.js +0 -24
- package/lib/reducers/readyState.js +0 -23
- package/lib/reducers/referenceGrammarID.js +0 -23
- package/lib/reducers/sendBoxAttachments.d.ts +0 -9
- package/lib/reducers/sendBoxAttachments.d.ts.map +0 -1
- package/lib/reducers/sendBoxAttachments.js +0 -23
- package/lib/reducers/sendBoxValue.js +0 -23
- package/lib/reducers/sendTimeout.js +0 -23
- package/lib/reducers/sendTypingIndicator.js +0 -23
- package/lib/reducers/shouldSpeakIncomingActivity.js +0 -25
- package/lib/reducers/suggestedActions.js +0 -32
- package/lib/sagas/clearSuggestedActionsOnPostActivitySaga.js +0 -62
- package/lib/sagas/connectSaga.js +0 -445
- package/lib/sagas/connectionStatusToNotificationSaga.js +0 -107
- package/lib/sagas/connectionStatusUpdateSaga.js +0 -63
- package/lib/sagas/detectSlowConnectionSaga.d.ts +0 -5
- package/lib/sagas/detectSlowConnectionSaga.d.ts.map +0 -1
- package/lib/sagas/detectSlowConnectionSaga.js +0 -50
- package/lib/sagas/effects/forever.js +0 -19
- package/lib/sagas/effects/forkPut.js +0 -51
- package/lib/sagas/effects/observeEach.js +0 -45
- package/lib/sagas/effects/observeOnce.d.ts +0 -3
- package/lib/sagas/effects/observeOnce.d.ts.map +0 -1
- package/lib/sagas/effects/observeOnce.js +0 -42
- package/lib/sagas/effects/whileConnected.d.ts +0 -7
- package/lib/sagas/effects/whileConnected.d.ts.map +0 -1
- package/lib/sagas/effects/whileConnected.js +0 -55
- package/lib/sagas/emitTypingIndicatorToPostActivitySaga.js +0 -63
- package/lib/sagas/markAllAsSpokenOnStopSpeakActivitySaga.js +0 -78
- package/lib/sagas/observeActivitySaga.d.ts +0 -2
- package/lib/sagas/observeActivitySaga.d.ts.map +0 -1
- package/lib/sagas/observeActivitySaga.js +0 -117
- package/lib/sagas/postActivitySaga.d.ts +0 -3
- package/lib/sagas/postActivitySaga.d.ts.map +0 -1
- package/lib/sagas/postActivitySaga.js +0 -264
- package/lib/sagas/queueIncomingActivitySaga.d.ts +0 -3
- package/lib/sagas/queueIncomingActivitySaga.d.ts.map +0 -1
- package/lib/sagas/queueIncomingActivitySaga.js +0 -197
- package/lib/sagas/sendEventToPostActivitySaga.js +0 -68
- package/lib/sagas/sendFilesToPostActivitySaga.js +0 -85
- package/lib/sagas/sendMessageBackToPostActivitySaga.js +0 -70
- package/lib/sagas/sendMessageToPostActivitySaga.d.ts +0 -2
- package/lib/sagas/sendMessageToPostActivitySaga.d.ts.map +0 -1
- package/lib/sagas/sendMessageToPostActivitySaga.js +0 -91
- package/lib/sagas/sendPostBackToPostActivitySaga.js +0 -69
- package/lib/sagas/sendTypingIndicatorOnSetSendBoxSaga.d.ts +0 -3
- package/lib/sagas/sendTypingIndicatorOnSetSendBoxSaga.d.ts.map +0 -1
- package/lib/sagas/sendTypingIndicatorOnSetSendBoxSaga.js +0 -145
- package/lib/sagas/speakActivityAndStartDictateOnIncomingActivityFromOthersSaga.js +0 -106
- package/lib/sagas/startDictateOnSpeakCompleteSaga.js +0 -65
- package/lib/sagas/startSpeakActivityOnPostActivitySaga.js +0 -62
- package/lib/sagas/stopDictateOnCardActionSaga.js +0 -65
- package/lib/sagas/stopSpeakingActivityOnInputSaga.js +0 -68
- package/lib/sagas/submitSendBoxSaga.js +0 -84
- package/lib/selectors/activities.d.ts +0 -9
- package/lib/selectors/activities.d.ts.map +0 -1
- package/lib/selectors/activities.js +0 -33
- package/lib/selectors/combineSelectors.js +0 -31
- package/lib/selectors/dictateState.js +0 -12
- package/lib/selectors/language.d.ts +0 -4
- package/lib/selectors/language.d.ts.map +0 -1
- package/lib/selectors/language.js +0 -12
- package/lib/selectors/notifications.js +0 -13
- package/lib/selectors/sendBoxAttachments.js +0 -11
- package/lib/selectors/sendBoxValue.js +0 -12
- package/lib/selectors/sendTimeout.d.ts +0 -4
- package/lib/selectors/sendTimeout.d.ts.map +0 -1
- package/lib/selectors/sendTimeout.js +0 -12
- package/lib/selectors/sendTypingIndicator.d.ts +0 -4
- package/lib/selectors/sendTypingIndicator.d.ts.map +0 -1
- package/lib/selectors/sendTypingIndicator.js +0 -12
- package/lib/selectors/shouldSpeakIncomingActivity.js +0 -12
- package/lib/types/AnyAnd.d.ts +0 -2
- package/lib/types/AnyAnd.d.ts.map +0 -1
- package/lib/types/AnyAnd.js +0 -6
- package/lib/types/GlobalScopePonyfill.d.ts +0 -8
- package/lib/types/GlobalScopePonyfill.d.ts.map +0 -1
- package/lib/types/GlobalScopePonyfill.js +0 -6
- package/lib/types/OneOrMany.d.ts +0 -3
- package/lib/types/OneOrMany.d.ts.map +0 -1
- package/lib/types/OneOrMany.js +0 -6
- package/lib/types/SendBoxAttachment.d.ts +0 -5
- package/lib/types/SendBoxAttachment.d.ts.map +0 -1
- package/lib/types/SendBoxAttachment.js +0 -6
- package/lib/types/WebChatActivity.d.ts +0 -128
- package/lib/types/WebChatActivity.d.ts.map +0 -1
- package/lib/types/WebChatActivity.js +0 -6
- package/lib/types/external/DirectLineActivity.d.ts +0 -3
- package/lib/types/external/DirectLineActivity.d.ts.map +0 -1
- package/lib/types/external/DirectLineActivity.js +0 -6
- package/lib/types/external/DirectLineAnimationCard.d.ts +0 -6
- package/lib/types/external/DirectLineAnimationCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineAnimationCard.js +0 -6
- package/lib/types/external/DirectLineAttachment.d.ts +0 -9
- package/lib/types/external/DirectLineAttachment.d.ts.map +0 -1
- package/lib/types/external/DirectLineAttachment.js +0 -6
- package/lib/types/external/DirectLineAudioCard.d.ts +0 -6
- package/lib/types/external/DirectLineAudioCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineAudioCard.js +0 -6
- package/lib/types/external/DirectLineBasicCardEssence.d.ts +0 -12
- package/lib/types/external/DirectLineBasicCardEssence.d.ts.map +0 -1
- package/lib/types/external/DirectLineBasicCardEssence.js +0 -6
- package/lib/types/external/DirectLineCardAction.d.ts +0 -110
- package/lib/types/external/DirectLineCardAction.d.ts.map +0 -1
- package/lib/types/external/DirectLineCardAction.js +0 -6
- package/lib/types/external/DirectLineCardImage.d.ts +0 -8
- package/lib/types/external/DirectLineCardImage.d.ts.map +0 -1
- package/lib/types/external/DirectLineCardImage.js +0 -6
- package/lib/types/external/DirectLineHeroCard.d.ts +0 -6
- package/lib/types/external/DirectLineHeroCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineHeroCard.js +0 -6
- package/lib/types/external/DirectLineJSBotConnection.d.ts +0 -3
- package/lib/types/external/DirectLineJSBotConnection.d.ts.map +0 -1
- package/lib/types/external/DirectLineJSBotConnection.js +0 -6
- package/lib/types/external/DirectLineMediaCardEssence.d.ts +0 -21
- package/lib/types/external/DirectLineMediaCardEssence.d.ts.map +0 -1
- package/lib/types/external/DirectLineMediaCardEssence.js +0 -6
- package/lib/types/external/DirectLineOAuthCard.d.ts +0 -8
- package/lib/types/external/DirectLineOAuthCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineOAuthCard.js +0 -6
- package/lib/types/external/DirectLineReceiptCard.d.ts +0 -28
- package/lib/types/external/DirectLineReceiptCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineReceiptCard.js +0 -6
- package/lib/types/external/DirectLineSignInCard.d.ts +0 -8
- package/lib/types/external/DirectLineSignInCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineSignInCard.js +0 -6
- package/lib/types/external/DirectLineSuggestedAction.d.ts +0 -7
- package/lib/types/external/DirectLineSuggestedAction.d.ts.map +0 -1
- package/lib/types/external/DirectLineSuggestedAction.js +0 -6
- package/lib/types/external/DirectLineThumbnailCard.d.ts +0 -6
- package/lib/types/external/DirectLineThumbnailCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineThumbnailCard.js +0 -6
- package/lib/types/external/DirectLineVideoCard.d.ts +0 -6
- package/lib/types/external/DirectLineVideoCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineVideoCard.js +0 -6
- package/lib/types/external/Observable.d.ts +0 -49
- package/lib/types/external/Observable.d.ts.map +0 -1
- package/lib/types/external/Observable.js +0 -6
- package/lib/types/external/OrgSchema/Action.d.ts +0 -29
- package/lib/types/external/OrgSchema/Action.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/Action.js +0 -38
- package/lib/types/external/OrgSchema/Claim.d.ts +0 -35
- package/lib/types/external/OrgSchema/Claim.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/Claim.js +0 -41
- package/lib/types/external/OrgSchema/CreativeWork.d.ts +0 -57
- package/lib/types/external/OrgSchema/CreativeWork.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/CreativeWork.js +0 -52
- package/lib/types/external/OrgSchema/DefinedTerm.d.ts +0 -26
- package/lib/types/external/OrgSchema/DefinedTerm.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/DefinedTerm.js +0 -33
- package/lib/types/external/OrgSchema/Project.d.ts +0 -20
- package/lib/types/external/OrgSchema/Project.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/Project.js +0 -32
- package/lib/types/external/OrgSchema/Thing.d.ts +0 -53
- package/lib/types/external/OrgSchema/Thing.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/Thing.js +0 -54
- package/lib/types/external/OrgSchema/VoteAction.d.ts +0 -22
- package/lib/types/external/OrgSchema/VoteAction.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/VoteAction.js +0 -34
- package/lib/types/external/OrgSchema/private/orgSchemaProperties.d.ts +0 -3
- package/lib/types/external/OrgSchema/private/orgSchemaProperties.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/private/orgSchemaProperties.js +0 -22
- package/lib/types/external/OrgSchema/private/orgSchemaProperty.d.ts +0 -4
- package/lib/types/external/OrgSchema/private/orgSchemaProperty.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/private/orgSchemaProperty.js +0 -15
- package/lib/types/internal/GlobalScopeClock.d.ts +0 -15
- package/lib/types/internal/GlobalScopeClock.d.ts.map +0 -1
- package/lib/types/internal/GlobalScopeClock.js +0 -6
- package/lib/types/internal/Notification.d.ts +0 -10
- package/lib/types/internal/Notification.d.ts.map +0 -1
- package/lib/types/internal/Notification.js +0 -6
- package/lib/types/internal/ReduxState.d.ts +0 -19
- package/lib/types/internal/ReduxState.d.ts.map +0 -1
- package/lib/types/internal/ReduxState.js +0 -6
- package/lib/types/internal/SendStatus.d.ts +0 -7
- package/lib/types/internal/SendStatus.d.ts.map +0 -1
- package/lib/types/internal/SendStatus.js +0 -19
- package/lib/types/internal/WebChatOutgoingActivity.d.ts +0 -49
- package/lib/types/internal/WebChatOutgoingActivity.d.ts.map +0 -1
- package/lib/types/internal/WebChatOutgoingActivity.js +0 -6
- package/lib/utils/dateToLocaleISOString.d.ts +0 -2
- package/lib/utils/dateToLocaleISOString.d.ts.map +0 -1
- package/lib/utils/dateToLocaleISOString.js +0 -52
- package/lib/utils/deleteKey.d.ts +0 -2
- package/lib/utils/deleteKey.d.ts.map +0 -1
- package/lib/utils/deleteKey.js +0 -30
- package/lib/utils/getOrgSchemaMessage.d.ts +0 -4
- package/lib/utils/getOrgSchemaMessage.d.ts.map +0 -1
- package/lib/utils/getOrgSchemaMessage.js +0 -21
- package/lib/utils/isForbiddenPropertyName.d.ts +0 -2
- package/lib/utils/isForbiddenPropertyName.d.ts.map +0 -1
- package/lib/utils/isForbiddenPropertyName.js +0 -16
- package/lib/utils/onErrorResumeNext.d.ts +0 -3
- package/lib/utils/onErrorResumeNext.d.ts.map +0 -1
- package/lib/utils/onErrorResumeNext.js +0 -19
- package/lib/utils/once.d.ts +0 -2
- package/lib/utils/once.d.ts.map +0 -1
- package/lib/utils/once.js +0 -16
- package/lib/utils/singleToArray.d.ts +0 -2
- package/lib/utils/singleToArray.d.ts.map +0 -1
- package/lib/utils/singleToArray.js +0 -10
- package/lib/utils/sleep.d.ts +0 -3
- package/lib/utils/sleep.d.ts.map +0 -1
- package/lib/utils/sleep.js +0 -12
- package/lib/utils/uniqueID.d.ts +0 -2
- package/lib/utils/uniqueID.d.ts.map +0 -1
- package/lib/utils/uniqueID.js +0 -14
- package/lib/utils/warnOnce.d.ts +0 -2
- package/lib/utils/warnOnce.d.ts.map +0 -1
- package/lib/utils/warnOnce.js +0 -14
- package/src/actions/clearSuggestedActions.js +0 -9
- package/src/actions/setSuggestedActions.js +0 -12
- package/src/constants/DictateState.js +0 -7
- package/src/reducers/createActivitiesReducer.ts +0 -304
- package/src/reducers/private/findBeforeAfter.spec.ts +0 -90
- package/src/reducers/private/findBeforeAfter.ts +0 -30
- package/src/reducers/suggestedActions.js +0 -23
- package/src/types/OneOrMany.ts +0 -3
- package/src/types/external/OrgSchema/Action.spec.ts +0 -35
- package/src/types/external/OrgSchema/Action.ts +0 -52
- package/src/types/external/OrgSchema/Claim.spec.ts +0 -45
- package/src/types/external/OrgSchema/Claim.ts +0 -48
- package/src/types/external/OrgSchema/CreativeWork.parseCreativeWork.spec.ts +0 -51
- package/src/types/external/OrgSchema/CreativeWork.ts +0 -83
- package/src/types/external/OrgSchema/DefinedTerm.ts +0 -37
- package/src/types/external/OrgSchema/Project.parseProject.spec.ts +0 -17
- package/src/types/external/OrgSchema/Project.ts +0 -29
- package/src/types/external/OrgSchema/Thing.parseThing.spec.ts +0 -54
- package/src/types/external/OrgSchema/Thing.ts +0 -94
- package/src/types/external/OrgSchema/VoteAction.spec.ts +0 -35
- package/src/types/external/OrgSchema/VoteAction.ts +0 -31
- package/src/types/external/OrgSchema/private/orgSchemaProperties.spec.ts +0 -41
- package/src/types/external/OrgSchema/private/orgSchemaProperties.ts +0 -23
- package/src/types/external/OrgSchema/private/orgSchemaProperty.spec.ts +0 -21
- package/src/types/external/OrgSchema/private/orgSchemaProperty.ts +0 -6
- package/src/utils/isForbiddenPropertyName.spec.js +0 -6
- package/src/utils/isForbiddenPropertyName.ts +0 -33
- package/src/utils/singleToArray.ts +0 -3
- package/src/utils/warnOnce.ts +0 -5
- /package/src/actions/{connectionStatusUpdate.js → connectionStatusUpdate.ts} +0 -0
- /package/src/actions/{disconnect.js → disconnect.ts} +0 -0
- /package/src/actions/{emitTypingIndicator.js → emitTypingIndicator.ts} +0 -0
- /package/src/actions/{queueIncomingActivity.js → queueIncomingActivity.ts} +0 -0
- /package/src/actions/{reconnect.js → reconnect.ts} +0 -0
- /package/src/actions/{startDictate.js → startDictate.ts} +0 -0
- /package/src/actions/{startSpeakingActivity.js → startSpeakingActivity.ts} +0 -0
- /package/src/actions/{stopDictate.js → stopDictate.ts} +0 -0
- /package/src/actions/{stopSpeakingActivity.js → stopSpeakingActivity.ts} +0 -0
- /package/src/actions/{updateConnectionStatus.js → updateConnectionStatus.ts} +0 -0
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { lazy, number, parse, string, union, type ObjectEntries } from 'valibot';
|
|
2
|
-
|
|
3
|
-
import { creativeWork, type CreativeWork } from './CreativeWork';
|
|
4
|
-
import { project, type Project } from './Project';
|
|
5
|
-
import orgSchemaProperty from './private/orgSchemaProperty';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A [Claim](https://schema.org/Claim) in Schema.org represents a specific, factually-oriented claim that could be the [itemReviewed](https://schema.org/itemReviewed) in a [ClaimReview](https://schema.org/ClaimReview). The content of a claim can be summarized with the [text](https://schema.org/text) property. Variations on well known claims can have their common identity indicated via [sameAs](https://schema.org/sameAs) links, and summarized with a name. Ideally, a [Claim](https://schema.org/Claim) description includes enough contextual information to minimize the risk of ambiguity or inclarity. In practice, many claims are better understood in the context in which they appear or the interpretations provided by claim reviews.
|
|
9
|
-
*
|
|
10
|
-
* Beyond [ClaimReview](https://schema.org/ClaimReview), the Claim type can be associated with related creative works - for example a [ScholarlyArticle](https://schema.org/ScholarlyArticle) or [Question](https://schema.org/Question) might be about some [Claim](https://schema.org/Claim).
|
|
11
|
-
*
|
|
12
|
-
* This is partial implementation of https://schema.org/Claim.
|
|
13
|
-
*
|
|
14
|
-
* @see https://schema.org/Claim.
|
|
15
|
-
*/
|
|
16
|
-
export type Claim = CreativeWork & {
|
|
17
|
-
/**
|
|
18
|
-
* Indicates an occurrence of a [Claim](https://schema.org/Claim) in some [CreativeWork](https://schema.org/CreativeWork).
|
|
19
|
-
*
|
|
20
|
-
* @see https://schema.org/appearance.
|
|
21
|
-
*/
|
|
22
|
-
appearance?: CreativeWork | undefined;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* For a [Claim](https://schema.org/Claim) interpreted from [MediaObject](https://schema.org/MediaObject) content sed to indicate a claim contained, implied or refined from the content of a [MediaObject](https://schema.org/MediaObject).
|
|
26
|
-
*
|
|
27
|
-
* @see https://schema.org/claimInterpreter.
|
|
28
|
-
*/
|
|
29
|
-
claimInterpreter?: Project | undefined;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The position of an item in a series or sequence of items.
|
|
33
|
-
*
|
|
34
|
-
* @see https://schema.org/position.
|
|
35
|
-
*/
|
|
36
|
-
position?: number | string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const claim = <TEntries extends ObjectEntries>(entries?: TEntries | undefined) =>
|
|
40
|
-
creativeWork({
|
|
41
|
-
appearance: orgSchemaProperty(lazy(() => creativeWork())),
|
|
42
|
-
claimInterpreter: orgSchemaProperty(lazy(() => project())),
|
|
43
|
-
position: orgSchemaProperty(union([number(), string()])),
|
|
44
|
-
|
|
45
|
-
...entries
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const parseClaim = (data: unknown): Claim => parse(claim(), data);
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { parseCreativeWork } from './CreativeWork';
|
|
2
|
-
|
|
3
|
-
describe('CreativeWork', () => {
|
|
4
|
-
test('should parse properties from Thing', () =>
|
|
5
|
-
expect(
|
|
6
|
-
parseCreativeWork({
|
|
7
|
-
'@type': 'CreativeWork',
|
|
8
|
-
name: 'Business @ the Speed of Thought'
|
|
9
|
-
})
|
|
10
|
-
).toEqual({
|
|
11
|
-
'@type': 'CreativeWork',
|
|
12
|
-
name: 'Business @ the Speed of Thought'
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
test('should parse thing of Book type', () =>
|
|
16
|
-
expect(
|
|
17
|
-
parseCreativeWork({
|
|
18
|
-
'@type': 'Book',
|
|
19
|
-
name: 'Business @ the Speed of Thought'
|
|
20
|
-
})
|
|
21
|
-
).toEqual({
|
|
22
|
-
'@type': 'Book',
|
|
23
|
-
name: 'Business @ the Speed of Thought'
|
|
24
|
-
}));
|
|
25
|
-
|
|
26
|
-
test('should parse citation (singular)', () =>
|
|
27
|
-
expect(
|
|
28
|
-
parseCreativeWork({
|
|
29
|
-
'@type': 'Book',
|
|
30
|
-
name: 'Business @ the Speed of Thought',
|
|
31
|
-
citation: { '@type': 'Book', name: 'The Road Ahead' }
|
|
32
|
-
})
|
|
33
|
-
).toEqual({
|
|
34
|
-
'@type': 'Book',
|
|
35
|
-
name: 'Business @ the Speed of Thought',
|
|
36
|
-
citation: [{ '@type': 'Book', name: 'The Road Ahead' }]
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
test('should parse citation (plural)', () =>
|
|
40
|
-
expect(
|
|
41
|
-
parseCreativeWork({
|
|
42
|
-
'@type': 'Book',
|
|
43
|
-
name: 'Business @ the Speed of Thought',
|
|
44
|
-
citation: [{ '@type': 'Book', name: 'The Road Ahead' }]
|
|
45
|
-
})
|
|
46
|
-
).toEqual({
|
|
47
|
-
'@type': 'Book',
|
|
48
|
-
name: 'Business @ the Speed of Thought',
|
|
49
|
-
citation: [{ '@type': 'Book', name: 'The Road Ahead' }]
|
|
50
|
-
}));
|
|
51
|
-
});
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { lazy, parse, string, union, type ObjectEntries } from 'valibot';
|
|
2
|
-
|
|
3
|
-
import { definedTerm, type DefinedTerm } from './DefinedTerm';
|
|
4
|
-
import orgSchemaProperties from './private/orgSchemaProperties';
|
|
5
|
-
import orgSchemaProperty from './private/orgSchemaProperty';
|
|
6
|
-
import { thing, type Thing } from './Thing';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The most generic kind of creative work, including books, movies, photographs, software programs, etc.
|
|
10
|
-
*
|
|
11
|
-
* This is partial implementation of https://schema.org/CreativeWork.
|
|
12
|
-
*
|
|
13
|
-
* @see https://schema.org/CreativeWork
|
|
14
|
-
*/
|
|
15
|
-
// Due to limitations of TypeScript, when using valibot.lazy(), the output type must be explicitly set.
|
|
16
|
-
export type CreativeWork = Thing & {
|
|
17
|
-
/**
|
|
18
|
-
* An abstract is a short description that summarizes a [CreativeWork](https://schema.org/CreativeWork).
|
|
19
|
-
*
|
|
20
|
-
* @see https://schema.org/abstract
|
|
21
|
-
*/
|
|
22
|
-
abstract?: string | undefined;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The author of this content or rating. Please note that author is special in that HTML 5 provides a special mechanism for indicating authorship via the rel tag. That is equivalent to this and may be used interchangeably.
|
|
26
|
-
*
|
|
27
|
-
* @see https://schema.org/author
|
|
28
|
-
*/
|
|
29
|
-
author?: string | undefined;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* A citation or reference to another creative work, such as another publication, web page, scholarly article, etc.
|
|
33
|
-
*
|
|
34
|
-
* @see https://schema.org/citation
|
|
35
|
-
*/
|
|
36
|
-
citation?: readonly CreativeWork[] | undefined;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Keywords or tags used to describe some item. Multiple textual entries in a keywords list are typically delimited by commas, or by repeating the property.
|
|
40
|
-
*
|
|
41
|
-
* @see https://schema.org/keywords
|
|
42
|
-
*/
|
|
43
|
-
keywords?: readonly (DefinedTerm | string)[] | undefined;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* A pattern that something has, for example 'polka dot', 'striped', 'Canadian flag'. Values are typically expressed as text, although links to controlled value schemes are also supported.
|
|
47
|
-
*
|
|
48
|
-
* @see https://schema.org/pattern
|
|
49
|
-
*/
|
|
50
|
-
pattern?: DefinedTerm | undefined;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The textual content of this CreativeWork.
|
|
54
|
-
*
|
|
55
|
-
* @see https://schema.org/text
|
|
56
|
-
*/
|
|
57
|
-
text?: string | undefined;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The schema.org [usageInfo](https://schema.org/usageInfo) property indicates further information about a [CreativeWork](https://schema.org/CreativeWork). This property is applicable both to works that are freely available and to those that require payment or other transactions. It can reference additional information, e.g. community expectations on preferred linking and citation conventions, as well as purchasing details. For something that can be commercially licensed, usageInfo can provide detailed, resource-specific information about licensing options.
|
|
61
|
-
*
|
|
62
|
-
* This property can be used alongside the license property which indicates license(s) applicable to some piece of content. The usageInfo property can provide information about other licensing options, e.g. acquiring commercial usage rights for an image that is also available under non-commercial creative commons licenses.
|
|
63
|
-
*/
|
|
64
|
-
usageInfo?: CreativeWork | undefined;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const creativeWork = <TEntries extends ObjectEntries>(entries?: TEntries | undefined) =>
|
|
68
|
-
thing({
|
|
69
|
-
// For forward compatibility, we did not enforce @type must be "CreativeWork" or any other subtypes.
|
|
70
|
-
// In future, if Schema.org introduced a new subtype of CreativeWork, we should still able to parse that one as a CreativeWork.
|
|
71
|
-
|
|
72
|
-
abstract: orgSchemaProperty(string()),
|
|
73
|
-
author: orgSchemaProperties(string()),
|
|
74
|
-
citation: orgSchemaProperties(lazy(() => creativeWork())),
|
|
75
|
-
keywords: orgSchemaProperties(union([lazy(() => definedTerm()), string()])),
|
|
76
|
-
pattern: orgSchemaProperty(lazy(() => definedTerm())),
|
|
77
|
-
text: orgSchemaProperty(string()),
|
|
78
|
-
usageInfo: orgSchemaProperty(lazy(() => creativeWork())),
|
|
79
|
-
|
|
80
|
-
...entries
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
export const parseCreativeWork = (data: unknown): CreativeWork => parse(creativeWork(), data);
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { parse, string, type ObjectEntries } from 'valibot';
|
|
2
|
-
|
|
3
|
-
import { thing, type Thing } from './Thing';
|
|
4
|
-
import orgSchemaProperty from './private/orgSchemaProperty';
|
|
5
|
-
|
|
6
|
-
export const definedTerm = <TEntries extends ObjectEntries>(entries?: TEntries | undefined) =>
|
|
7
|
-
thing({
|
|
8
|
-
inDefinedTermSet: orgSchemaProperty(string()),
|
|
9
|
-
termCode: orgSchemaProperty(string()),
|
|
10
|
-
|
|
11
|
-
...entries
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A word, name, acronym, phrase, etc. with a formal definition. Often used in the context of category or subject classification, glossaries or dictionaries, product or creative work types, etc. Use the name property for the term being defined, use termCode if the term has an alpha-numeric code allocated, use description to provide the definition of the term.
|
|
16
|
-
*
|
|
17
|
-
* This is partial implementation of https://schema.org/DefinedTerm.
|
|
18
|
-
*
|
|
19
|
-
* @see https://schema.org/DefinedTerm
|
|
20
|
-
*/
|
|
21
|
-
export type DefinedTerm = Thing & {
|
|
22
|
-
/**
|
|
23
|
-
* A [DefinedTermSet](https://schema.org/DefinedTermSet) that contains this term.
|
|
24
|
-
*
|
|
25
|
-
* @see https://schema.org/inDefinedTermSet
|
|
26
|
-
*/
|
|
27
|
-
inDefinedTermSet?: string | undefined;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* A code that identifies this [DefinedTerm](https://schema.org/DefinedTerm) within a [DefinedTermSet](https://schema.org/DefinedTermSet).
|
|
31
|
-
*
|
|
32
|
-
* @see https://schema.org/termCode
|
|
33
|
-
*/
|
|
34
|
-
termCode?: string | undefined;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const parseDefinedTerm = (data: unknown): DefinedTerm => parse(definedTerm(), data);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { parseProject } from './Project';
|
|
2
|
-
|
|
3
|
-
describe('Project', () => {
|
|
4
|
-
test('should parse', () => {
|
|
5
|
-
expect(
|
|
6
|
-
parseProject({
|
|
7
|
-
'@type': 'Project',
|
|
8
|
-
name: 'Microsoft',
|
|
9
|
-
slogan: 'Empower every person and every organization on the planet to achieve more.'
|
|
10
|
-
})
|
|
11
|
-
).toEqual({
|
|
12
|
-
'@type': 'Project',
|
|
13
|
-
name: 'Microsoft',
|
|
14
|
-
slogan: 'Empower every person and every organization on the planet to achieve more.'
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { parse, string, type ObjectEntries } from 'valibot';
|
|
2
|
-
|
|
3
|
-
import { thing, type Thing } from './Thing';
|
|
4
|
-
import orgSchemaProperty from './private/orgSchemaProperty';
|
|
5
|
-
|
|
6
|
-
export const project = <TEntries extends ObjectEntries>(entries?: TEntries | undefined) =>
|
|
7
|
-
thing({
|
|
8
|
-
slogan: orgSchemaProperty(string()),
|
|
9
|
-
|
|
10
|
-
...entries
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* An enterprise (potentially individual but typically collaborative), planned to achieve a particular aim. Use properties from [Organization](https://schema.org/Organization), [subOrganization](https://schema.org/subOrganization)/[parentOrganization](https://schema.org/parentOrganization) to indicate project sub-structures.
|
|
15
|
-
*
|
|
16
|
-
* This is partial implementation of https://schema.org/Project.
|
|
17
|
-
*
|
|
18
|
-
* @see https://schema.org/Project
|
|
19
|
-
*/
|
|
20
|
-
export type Project = Thing & {
|
|
21
|
-
/**
|
|
22
|
-
* A slogan or motto associated with the item.
|
|
23
|
-
*
|
|
24
|
-
* @see https://schema.org/slogan
|
|
25
|
-
*/
|
|
26
|
-
slogan?: string | undefined;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const parseProject = (data: unknown): Project => parse(project(), data);
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { parseThing } from './Thing';
|
|
2
|
-
|
|
3
|
-
describe('Thing', () => {
|
|
4
|
-
test('should parse', () => {
|
|
5
|
-
expect(
|
|
6
|
-
parseThing({
|
|
7
|
-
'@type': 'Thing',
|
|
8
|
-
name: 'John Doe'
|
|
9
|
-
})
|
|
10
|
-
).toEqual({
|
|
11
|
-
'@type': 'Thing',
|
|
12
|
-
name: 'John Doe'
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test('should parse unknown @type', () => {
|
|
17
|
-
expect(
|
|
18
|
-
parseThing({
|
|
19
|
-
'@type': 'Unknown',
|
|
20
|
-
name: 'John Doe'
|
|
21
|
-
})
|
|
22
|
-
).toEqual({
|
|
23
|
-
'@type': 'Unknown',
|
|
24
|
-
name: 'John Doe'
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// This is an intentional drift from JSON-LD.
|
|
29
|
-
// Assuming expecting an object of Thing while the actual is CreativeWork.
|
|
30
|
-
// If unknown properties are removed, we will remove properties that are solely for CreativeWork.
|
|
31
|
-
test('should not remove unknown properties', () => {
|
|
32
|
-
expect(
|
|
33
|
-
parseThing({
|
|
34
|
-
'@type': 'Thing',
|
|
35
|
-
something: 1
|
|
36
|
-
})
|
|
37
|
-
).toEqual({
|
|
38
|
-
'@type': 'Thing',
|
|
39
|
-
something: 1
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test('should set invalid properties to undefined', () => {
|
|
44
|
-
expect(
|
|
45
|
-
parseThing({
|
|
46
|
-
'@type': 'Thing',
|
|
47
|
-
name: 1
|
|
48
|
-
})
|
|
49
|
-
).toEqual({
|
|
50
|
-
'@type': 'Thing',
|
|
51
|
-
name: undefined
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { type EmptyObject } from 'type-fest';
|
|
2
|
-
import { lazy, object, optional, parse, string, unknown, value, type ObjectEntries, type StringSchema } from 'valibot';
|
|
3
|
-
|
|
4
|
-
import { action, type Action } from './Action';
|
|
5
|
-
import orgSchemaProperties from './private/orgSchemaProperties';
|
|
6
|
-
import orgSchemaProperty from './private/orgSchemaProperty';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The most generic type of item.
|
|
10
|
-
*
|
|
11
|
-
* This is partial implementation of https://schema.org/Thing.
|
|
12
|
-
*
|
|
13
|
-
* @see https://schema.org/Thing
|
|
14
|
-
*/
|
|
15
|
-
export type Thing = {
|
|
16
|
-
'@context'?: 'https://schema.org' | undefined;
|
|
17
|
-
'@id'?: string | undefined;
|
|
18
|
-
'@type': string;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* An additional type for the item, typically used for adding more specific types from external vocabularies in microdata syntax. This is a relationship between something and a class that the thing is in. Typically the value is a URI-identified RDF class, and in this case corresponds to the use of rdf:type in RDF. Text values can be used sparingly, for cases where useful information can be added without their being an appropriate schema to reference. In the case of text values, the class label should follow the schema.org [style guide](https://schema.org/docs/styleguide.html).
|
|
22
|
-
*
|
|
23
|
-
* @see https://schema.org/additionalType
|
|
24
|
-
*/
|
|
25
|
-
additionalType?: string | undefined;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* An alias for the item.
|
|
29
|
-
*
|
|
30
|
-
* @see https://schema.org/alternateName
|
|
31
|
-
*/
|
|
32
|
-
alternateName?: string | undefined;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* A description of the item.
|
|
36
|
-
*
|
|
37
|
-
* @see https://schema.org/description
|
|
38
|
-
*/
|
|
39
|
-
description?: string | undefined;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* The name of the item.
|
|
43
|
-
*
|
|
44
|
-
* @see https://schema.org/name
|
|
45
|
-
*/
|
|
46
|
-
name?: string | undefined;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.
|
|
50
|
-
*
|
|
51
|
-
* @see https://schema.org/potentialAction
|
|
52
|
-
*/
|
|
53
|
-
potentialAction?: readonly Action[] | undefined;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* URL of the item.
|
|
57
|
-
*
|
|
58
|
-
* @see https://schema.org/url
|
|
59
|
-
*/
|
|
60
|
-
url?: string | undefined;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const thingEntries = {
|
|
64
|
-
'@context': optional(string([value('https://schema.org')]) as StringSchema<'https://schema.org'>),
|
|
65
|
-
'@id': optional(string()),
|
|
66
|
-
'@type': string(),
|
|
67
|
-
|
|
68
|
-
additionalType: orgSchemaProperty(string()),
|
|
69
|
-
alternateName: orgSchemaProperty(string()),
|
|
70
|
-
description: orgSchemaProperty(string()),
|
|
71
|
-
name: orgSchemaProperty(string()),
|
|
72
|
-
potentialAction: orgSchemaProperties(lazy(() => action())),
|
|
73
|
-
url: orgSchemaProperty(string())
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const thing = <TEntries extends ObjectEntries>(entries?: TEntries | undefined) =>
|
|
77
|
-
object(
|
|
78
|
-
{
|
|
79
|
-
...thingEntries,
|
|
80
|
-
...entries
|
|
81
|
-
},
|
|
82
|
-
// Forward compatibility is the reason why we use unknown() here and not adhere to JSON-LD which drop unknown fields.
|
|
83
|
-
//
|
|
84
|
-
// Example:
|
|
85
|
-
// - CreativeWork.editor must be type of Person (or any of its subtypes, Patient)
|
|
86
|
-
// - Without unknown(), when we parse the CreativeWork, we will drop Patient.diagnosis
|
|
87
|
-
// - That means, CreativeWork.editor.diagnosis will be unset despite CreativeWork.editor is of type Patient
|
|
88
|
-
//
|
|
89
|
-
// We can drop unknown() if there is a way to keep CreativeWork.editor.diagnosis.
|
|
90
|
-
// It is okay to drop future/unsupported properties. But not today/supported properties.
|
|
91
|
-
unknown()
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
export const parseThing = (data: unknown): Thing => parse(thing<EmptyObject>(), data);
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { parseVoteAction } from './VoteAction';
|
|
2
|
-
|
|
3
|
-
describe('VoteAction', () => {
|
|
4
|
-
describe('actionOption', () => {
|
|
5
|
-
test('should parse', () =>
|
|
6
|
-
expect(
|
|
7
|
-
parseVoteAction({
|
|
8
|
-
'@type': 'VoteAction',
|
|
9
|
-
actionOption: 'upvote'
|
|
10
|
-
})
|
|
11
|
-
).toEqual({
|
|
12
|
-
'@type': 'VoteAction',
|
|
13
|
-
actionOption: 'upvote'
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
test('should change invalid into undefined', () => {
|
|
17
|
-
try {
|
|
18
|
-
expect(
|
|
19
|
-
parseVoteAction({
|
|
20
|
-
'@type': 'Action',
|
|
21
|
-
actionOption: 123
|
|
22
|
-
})
|
|
23
|
-
).toEqual({
|
|
24
|
-
'@type': 'Action',
|
|
25
|
-
actionOption: undefined
|
|
26
|
-
});
|
|
27
|
-
} catch (err) {
|
|
28
|
-
console.error(err);
|
|
29
|
-
console.error(err.issues[0].input);
|
|
30
|
-
|
|
31
|
-
throw err;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { parse, string, type ObjectEntries } from 'valibot';
|
|
2
|
-
|
|
3
|
-
import { action, type Action } from './Action';
|
|
4
|
-
import orgSchemaProperty from './private/orgSchemaProperty';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* An action performed by a direct agent and indirect participants upon a direct object. Optionally happens at a location with the help of an inanimate instrument. The execution of the action may produce a result. Specific action sub-type documentation specifies the exact expectation of each argument/role.
|
|
8
|
-
*
|
|
9
|
-
* See also [blog post](http://blog.schema.org/2014/04/announcing-schemaorg-actions.html) and [Actions overview document](https://schema.org/docs/actions.html).
|
|
10
|
-
*
|
|
11
|
-
* This is partial implementation of https://schema.org/Action.
|
|
12
|
-
*
|
|
13
|
-
* @see https://schema.org/Action
|
|
14
|
-
*/
|
|
15
|
-
export type VoteAction = Action & {
|
|
16
|
-
/**
|
|
17
|
-
* A sub property of object. The options subject to this action. Supersedes [option](https://schema.org/option).
|
|
18
|
-
*
|
|
19
|
-
* @see https://schema.org/VoteAction
|
|
20
|
-
*/
|
|
21
|
-
actionOption?: string | undefined;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const voteAction = <TEntries extends ObjectEntries>(entries?: TEntries | undefined) =>
|
|
25
|
-
action({
|
|
26
|
-
actionOption: orgSchemaProperty(string()),
|
|
27
|
-
|
|
28
|
-
...entries
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export const parseVoteAction = (data: unknown): VoteAction => parse(voteAction(), data);
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { parse, string } from 'valibot';
|
|
2
|
-
|
|
3
|
-
import orgSchemaProperties from './orgSchemaProperties';
|
|
4
|
-
|
|
5
|
-
describe('orgSchemaProperties', () => {
|
|
6
|
-
describe('singular', () => {
|
|
7
|
-
test('should transform into plural', () => {
|
|
8
|
-
expect(parse(orgSchemaProperties(string()), 'abc')).toEqual(['abc']);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('should turn item of invalid type into undefined', () => {
|
|
12
|
-
expect(parse(orgSchemaProperties(string()), 0)).toBeUndefined();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test('should turn null into undefined', () => {
|
|
16
|
-
expect(parse(orgSchemaProperties(string()), null)).toBeUndefined();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('should keep undefined as-is', () => {
|
|
20
|
-
expect(parse(orgSchemaProperties(string()), undefined)).toBeUndefined();
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe('plural', () => {
|
|
25
|
-
test('should keep as-is', () => {
|
|
26
|
-
expect(parse(orgSchemaProperties(string()), ['abc', 'xyz'])).toEqual(['abc', 'xyz']);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('should keep empty array as-is', () => {
|
|
30
|
-
expect(parse(orgSchemaProperties(string()), [])).toEqual([]);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('should remove items with invalid type (all)', () => {
|
|
34
|
-
expect(parse(orgSchemaProperties(string()), [0])).toEqual([]);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('should remove items with invalid type (some)', () => {
|
|
38
|
-
expect(parse(orgSchemaProperties(string()), ['abc', 0, 'xyz'])).toEqual(['abc', 'xyz']);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
array,
|
|
3
|
-
fallback,
|
|
4
|
-
parse,
|
|
5
|
-
transform,
|
|
6
|
-
type ArraySchema,
|
|
7
|
-
type BaseSchema,
|
|
8
|
-
type FallbackInfo,
|
|
9
|
-
type Output,
|
|
10
|
-
type UndefinedSchema
|
|
11
|
-
} from 'valibot';
|
|
12
|
-
|
|
13
|
-
import orgSchemaProperty from './orgSchemaProperty';
|
|
14
|
-
|
|
15
|
-
const singularToArray = <T extends BaseSchema>(schema: T): ArraySchema<T> | UndefinedSchema =>
|
|
16
|
-
fallback<ArraySchema<T> | UndefinedSchema, (info?: FallbackInfo) => Output<T>>(
|
|
17
|
-
transform(array(schema), value => value.filter(value => typeof value !== 'undefined')),
|
|
18
|
-
value => (value?.input ? [parse(schema, value?.input)] : undefined)
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
export default function orgSchemaProperties<T extends BaseSchema>(schema: T) {
|
|
22
|
-
return singularToArray(orgSchemaProperty(schema));
|
|
23
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { parse, string } from 'valibot';
|
|
2
|
-
|
|
3
|
-
import orgSchemaProperty from './orgSchemaProperty';
|
|
4
|
-
|
|
5
|
-
describe('orgSchemaProperty', () => {
|
|
6
|
-
test('should keep valid type as-is', () => {
|
|
7
|
-
expect(parse(orgSchemaProperty(string()), 'abc')).toBe('abc');
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test('should keep undefined as-is', () => {
|
|
11
|
-
expect(parse(orgSchemaProperty(string()), undefined)).toBeUndefined();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
test('should convert invalid type to undefined', () => {
|
|
15
|
-
expect(parse(orgSchemaProperty(string()), null)).toBeUndefined();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('should take the first item from an array', () => {
|
|
19
|
-
expect(parse(orgSchemaProperty(string()), ['abc', 'def', 'xyz'])).toBe('abc');
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { array, fallback, optional, transform, union, type BaseSchema } from 'valibot';
|
|
2
|
-
|
|
3
|
-
const orgSchemaProperty = <T extends BaseSchema>(schema: T) =>
|
|
4
|
-
fallback(optional(union([transform(array(schema), array => array[0]), schema])), undefined);
|
|
5
|
-
|
|
6
|
-
export default orgSchemaProperty;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import isForbiddenPropertyName from './isForbiddenPropertyName';
|
|
2
|
-
|
|
3
|
-
test('should forbid "__proto__"', () => expect(isForbiddenPropertyName('__proto__')).toBeTruthy());
|
|
4
|
-
test('should forbid "constructor"', () => expect(isForbiddenPropertyName('constructor')).toBeTruthy());
|
|
5
|
-
test('should forbid "prototype"', () => expect(isForbiddenPropertyName('prototype')).toBeTruthy());
|
|
6
|
-
test('should not forbid "abc"', () => expect(isForbiddenPropertyName('abc')).toBeFalsy());
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
let FORBIDDEN_PROPERTY_NAMES;
|
|
2
|
-
|
|
3
|
-
function getForbiddenPropertyNames(): string[] {
|
|
4
|
-
return (
|
|
5
|
-
FORBIDDEN_PROPERTY_NAMES ||
|
|
6
|
-
(FORBIDDEN_PROPERTY_NAMES = Object.freeze(
|
|
7
|
-
Array.from(
|
|
8
|
-
new Set([
|
|
9
|
-
// As-of writing, `Object.prototype` includes:
|
|
10
|
-
// __defineGetter__
|
|
11
|
-
// __defineSetter__
|
|
12
|
-
// __lookupGetter__
|
|
13
|
-
// __lookupSetter
|
|
14
|
-
// __proto__
|
|
15
|
-
// constructor
|
|
16
|
-
// hasOwnProperty
|
|
17
|
-
// isPrototypeOf
|
|
18
|
-
// propertyIsEnumerable
|
|
19
|
-
// toLocaleString
|
|
20
|
-
// toString
|
|
21
|
-
// valueOf
|
|
22
|
-
...Object.getOwnPropertyNames(Object.prototype),
|
|
23
|
-
|
|
24
|
-
'prototype'
|
|
25
|
-
])
|
|
26
|
-
)
|
|
27
|
-
))
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default function isForbiddenPropertyName(propertyName: string): boolean {
|
|
32
|
-
return getForbiddenPropertyNames().includes(propertyName);
|
|
33
|
-
}
|
package/src/utils/warnOnce.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|