@microsoft/live-share-react 1.0.0-preview.23 → 1.0.0-preview.24
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/README.md +7 -10
- package/bin/interfaces/LiveInterfaceExtensions.d.ts +17 -0
- package/bin/interfaces/LiveInterfaceExtensions.d.ts.map +1 -1
- package/bin/live-hooks/useLiveEvent.d.ts.map +1 -1
- package/bin/live-hooks/useLiveEvent.js +3 -1
- package/bin/live-hooks/useLiveEvent.js.map +1 -1
- package/bin/live-hooks/useLivePresence.d.ts.map +1 -1
- package/bin/live-hooks/useLivePresence.js +6 -1
- package/bin/live-hooks/useLivePresence.js.map +1 -1
- package/package.json +9 -9
- package/src/interfaces/LiveInterfaceExtensions.ts +17 -0
- package/src/live-hooks/useLiveEvent.ts +8 -1
- package/src/live-hooks/useLivePresence.ts +7 -1
- package/bin/internal-hooks/index.d.ts +0 -2
- package/bin/internal-hooks/index.d.ts.map +0 -1
- package/bin/internal-hooks/index.js +0 -2
- package/bin/internal-hooks/index.js.map +0 -1
- package/bin/internal-hooks/useDynamicDDSRegistry.d.ts +0 -14
- package/bin/internal-hooks/useDynamicDDSRegistry.d.ts.map +0 -1
- package/bin/internal-hooks/useDynamicDDSRegistry.js +0 -142
- package/bin/internal-hooks/useDynamicDDSRegistry.js.map +0 -1
- package/bin/internal-hooks/useSharedStateRegistry.d.ts +0 -31
- package/bin/internal-hooks/useSharedStateRegistry.d.ts.map +0 -1
- package/bin/internal-hooks/useSharedStateRegistry.js +0 -102
- package/bin/internal-hooks/useSharedStateRegistry.js.map +0 -1
- package/bin/internal-hooks/useStateRef.d.ts +0 -7
- package/bin/internal-hooks/useStateRef.d.ts.map +0 -1
- package/bin/internal-hooks/useStateRef.js +0 -15
- package/bin/internal-hooks/useStateRef.js.map +0 -1
- package/bin/live-hooks/useLiveAICompletion.d.ts +0 -29
- package/bin/live-hooks/useLiveAICompletion.d.ts.map +0 -1
- package/bin/live-hooks/useLiveAICompletion.js +0 -186
- package/bin/live-hooks/useLiveAICompletion.js.map +0 -1
- package/bin/live-hooks/useLiveCoPilot.d.ts +0 -28
- package/bin/live-hooks/useLiveCoPilot.d.ts.map +0 -1
- package/bin/live-hooks/useLiveCoPilot.js +0 -178
- package/bin/live-hooks/useLiveCoPilot.js.map +0 -1
- package/bin/live-share-turbo/AzureTurboClient.d.ts +0 -39
- package/bin/live-share-turbo/AzureTurboClient.d.ts.map +0 -1
- package/bin/live-share-turbo/AzureTurboClient.js +0 -56
- package/bin/live-share-turbo/AzureTurboClient.js.map +0 -1
- package/bin/live-share-turbo/LiveShareTurboClient.d.ts +0 -53
- package/bin/live-share-turbo/LiveShareTurboClient.d.ts.map +0 -1
- package/bin/live-share-turbo/LiveShareTurboClient.js +0 -69
- package/bin/live-share-turbo/LiveShareTurboClient.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboDataObject.d.ts +0 -31
- package/bin/live-share-turbo/dds-objects/TurboDataObject.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboDataObject.js +0 -75
- package/bin/live-share-turbo/dds-objects/TurboDataObject.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.d.ts +0 -48
- package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.js +0 -104
- package/bin/live-share-turbo/dds-objects/TurboLiveCanvas.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveEvent.d.ts +0 -28
- package/bin/live-share-turbo/dds-objects/TurboLiveEvent.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveEvent.js +0 -68
- package/bin/live-share-turbo/dds-objects/TurboLiveEvent.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.d.ts +0 -60
- package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.js +0 -111
- package/bin/live-share-turbo/dds-objects/TurboLiveMediaSession.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLivePresence.d.ts +0 -77
- package/bin/live-share-turbo/dds-objects/TurboLivePresence.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLivePresence.js +0 -137
- package/bin/live-share-turbo/dds-objects/TurboLivePresence.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveState.d.ts +0 -30
- package/bin/live-share-turbo/dds-objects/TurboLiveState.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboLiveState.js +0 -74
- package/bin/live-share-turbo/dds-objects/TurboLiveState.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboSharedMap.d.ts +0 -61
- package/bin/live-share-turbo/dds-objects/TurboSharedMap.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/TurboSharedMap.js +0 -108
- package/bin/live-share-turbo/dds-objects/TurboSharedMap.js.map +0 -1
- package/bin/live-share-turbo/dds-objects/index.d.ts +0 -8
- package/bin/live-share-turbo/dds-objects/index.d.ts.map +0 -1
- package/bin/live-share-turbo/dds-objects/index.js +0 -8
- package/bin/live-share-turbo/dds-objects/index.js.map +0 -1
- package/bin/live-share-turbo/index.d.ts +0 -5
- package/bin/live-share-turbo/index.d.ts.map +0 -1
- package/bin/live-share-turbo/index.js +0 -5
- package/bin/live-share-turbo/index.js.map +0 -1
- package/bin/live-share-turbo/interfaces/IFluidTurboClient.d.ts +0 -15
- package/bin/live-share-turbo/interfaces/IFluidTurboClient.d.ts.map +0 -1
- package/bin/live-share-turbo/interfaces/IFluidTurboClient.js +0 -2
- package/bin/live-share-turbo/interfaces/IFluidTurboClient.js.map +0 -1
- package/bin/live-share-turbo/interfaces/index.d.ts +0 -3
- package/bin/live-share-turbo/interfaces/index.d.ts.map +0 -1
- package/bin/live-share-turbo/interfaces/index.js +0 -3
- package/bin/live-share-turbo/interfaces/index.js.map +0 -1
- package/bin/live-share-turbo/internals/FluidTurboClient.d.ts +0 -39
- package/bin/live-share-turbo/internals/FluidTurboClient.d.ts.map +0 -1
- package/bin/live-share-turbo/internals/FluidTurboClient.js +0 -121
- package/bin/live-share-turbo/internals/FluidTurboClient.js.map +0 -1
- package/bin/live-share-turbo/internals/index.d.ts +0 -2
- package/bin/live-share-turbo/internals/index.d.ts.map +0 -1
- package/bin/live-share-turbo/internals/index.js +0 -2
- package/bin/live-share-turbo/internals/index.js.map +0 -1
- package/bin/live-share-turbo/internals/types.d.ts +0 -4
- package/bin/live-share-turbo/internals/types.d.ts.map +0 -1
- package/bin/live-share-turbo/internals/types.js +0 -2
- package/bin/live-share-turbo/internals/types.js.map +0 -1
- package/bin/providers/FluidContextProvider.d.ts +0 -34
- package/bin/providers/FluidContextProvider.d.ts.map +0 -1
- package/bin/providers/FluidContextProvider.js +0 -99
- package/bin/providers/FluidContextProvider.js.map +0 -1
- package/bin/providers/LiveShareContextProvider.d.ts +0 -42
- package/bin/providers/LiveShareContextProvider.d.ts.map +0 -1
- package/bin/providers/LiveShareContextProvider.js +0 -63
- package/bin/providers/LiveShareContextProvider.js.map +0 -1
- package/bin/shared-hooks/useLockedTask.d.ts +0 -11
- package/bin/shared-hooks/useLockedTask.d.ts.map +0 -1
- package/bin/shared-hooks/useLockedTask.js +0 -82
- package/bin/shared-hooks/useLockedTask.js.map +0 -1
- package/bin/shared-hooks/useTaskManager.d.ts +0 -13
- package/bin/shared-hooks/useTaskManager.d.ts.map +0 -1
- package/bin/shared-hooks/useTaskManager.js +0 -86
- package/bin/shared-hooks/useTaskManager.js.map +0 -1
- package/bin/utils/getContainerSchema.d.ts +0 -8
- package/bin/utils/getContainerSchema.d.ts.map +0 -1
- package/bin/utils/getContainerSchema.js +0 -41
- package/bin/utils/getContainerSchema.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useStateRef.js","sourceRoot":"","sources":["../../src/internal-hooks/useStateRef.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAoB,MAAM,OAAO,CAAC;AAExE,MAAM,UAAU,WAAW,CAAI,YAAe;IAC5C,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IACvC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAEtD,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,KAAQ,EAAE,EAAE;QACX,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC,EACD,CAAC,SAAS,EAAE,QAAQ,CAAC,CACtB,CAAC;IAEF,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
import { UserMeetingRole } from "@microsoft/live-share";
|
|
6
|
-
import { IUseLiveAICompletionResults } from "../types";
|
|
7
|
-
/**
|
|
8
|
-
* React hook for using a Live Share Turbo `LiveAICompletion`. Intended for use with OpenAI's Completion API.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Use this hook to set up an `LiveAICompletion` object, which is used for using AI completions collaboratively at minimal cost.
|
|
12
|
-
*
|
|
13
|
-
* @param uniqueKey the unique key for the `LiveAICompletion`. If one does not yet exist, a new one.
|
|
14
|
-
* @param onGetCompletion React useCallback function that returns a Promise<string> for the latest `promptValue`. Function is intended to
|
|
15
|
-
* communicate with a backend API that uses OpenAI's Completion API.
|
|
16
|
-
* @param allowedRoles Optional. The meeting roles eligible to send events through this object.
|
|
17
|
-
* @param defaultPromptValue Optional. Text that sets the default prompt value. Default value is an empty string.
|
|
18
|
-
* @param autoCompletions Optional. Stateful boolean that when true, will automatically send completions when the `promptValue` changes. Default value is
|
|
19
|
-
* false.
|
|
20
|
-
* @param debounceDelayMilliseconds Optional. Stateful number that changes the debounce interval when `autoCompletions` is true. Default value is 2500.
|
|
21
|
-
* @param lockPrompt Optional. Stateful boolean that when true, will restrict prompt changes to only the user with `haveCompletionLock` set to true. Default
|
|
22
|
-
* value is false.
|
|
23
|
-
* @param lockCompletion Optional. Stateful boolean that when true, will restrict manual completion changes to only the user with `haveCompletionLock`
|
|
24
|
-
* set to true. This does not impact the `autoCompletions` setting, because `autoCompletions` already has this behavior. Default value is false.
|
|
25
|
-
*
|
|
26
|
-
* @returns IUseLiveAICompletionResults object that contains stateful responses and callback methods from `LiveAICompletion`.
|
|
27
|
-
*/
|
|
28
|
-
export declare const useLiveAICompletion: (uniqueKey: string, onGetCompletion: (promptValue: string) => Promise<string>, allowedRoles?: UserMeetingRole[], defaultPromptValue?: string, autoCompletions?: boolean, debounceDelayMilliseconds?: number, lockPrompt?: boolean, lockCompletion?: boolean) => IUseLiveAICompletionResults;
|
|
29
|
-
//# sourceMappingURL=useLiveAICompletion.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveAICompletion.d.ts","sourceRoot":"","sources":["../../src/live-hooks/useLiveAICompletion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,mBAAmB,cACjB,MAAM,iCACc,MAAM,KAAK,QAAQ,MAAM,CAAC,iBAC1C,eAAe,EAAE,uBACX,MAAM,oBACT,OAAO,8BACG,MAAM,eACrB,OAAO,mBACH,OAAO,KACzB,2BAyMF,CAAC"}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
import { LiveAICompletion, LiveAICompletionEvents, } from "@microsoft/live-share-turbo";
|
|
15
|
-
import React from "react";
|
|
16
|
-
import { useDynamicDDS } from "../shared-hooks";
|
|
17
|
-
/**
|
|
18
|
-
* React hook for using a Live Share Turbo `LiveAICompletion`. Intended for use with OpenAI's Completion API.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* Use this hook to set up an `LiveAICompletion` object, which is used for using AI completions collaboratively at minimal cost.
|
|
22
|
-
*
|
|
23
|
-
* @param uniqueKey the unique key for the `LiveAICompletion`. If one does not yet exist, a new one.
|
|
24
|
-
* @param onGetCompletion React useCallback function that returns a Promise<string> for the latest `promptValue`. Function is intended to
|
|
25
|
-
* communicate with a backend API that uses OpenAI's Completion API.
|
|
26
|
-
* @param allowedRoles Optional. The meeting roles eligible to send events through this object.
|
|
27
|
-
* @param defaultPromptValue Optional. Text that sets the default prompt value. Default value is an empty string.
|
|
28
|
-
* @param autoCompletions Optional. Stateful boolean that when true, will automatically send completions when the `promptValue` changes. Default value is
|
|
29
|
-
* false.
|
|
30
|
-
* @param debounceDelayMilliseconds Optional. Stateful number that changes the debounce interval when `autoCompletions` is true. Default value is 2500.
|
|
31
|
-
* @param lockPrompt Optional. Stateful boolean that when true, will restrict prompt changes to only the user with `haveCompletionLock` set to true. Default
|
|
32
|
-
* value is false.
|
|
33
|
-
* @param lockCompletion Optional. Stateful boolean that when true, will restrict manual completion changes to only the user with `haveCompletionLock`
|
|
34
|
-
* set to true. This does not impact the `autoCompletions` setting, because `autoCompletions` already has this behavior. Default value is false.
|
|
35
|
-
*
|
|
36
|
-
* @returns IUseLiveAICompletionResults object that contains stateful responses and callback methods from `LiveAICompletion`.
|
|
37
|
-
*/
|
|
38
|
-
export const useLiveAICompletion = (uniqueKey, onGetCompletion, allowedRoles, defaultPromptValue, autoCompletions, debounceDelayMilliseconds, lockPrompt, lockCompletion) => {
|
|
39
|
-
/**
|
|
40
|
-
* Reference boolean for whether hook has registered "listening" events for `LiveAICompletion`.
|
|
41
|
-
*/
|
|
42
|
-
const listeningRef = React.useRef(false);
|
|
43
|
-
/**
|
|
44
|
-
* @see IUseLiveAICompletionResults["promptValue"]
|
|
45
|
-
*/
|
|
46
|
-
const [promptValue, setPromptValue] = React.useState("");
|
|
47
|
-
/**
|
|
48
|
-
* @see IUseLiveAICompletionResults["completionValue"]
|
|
49
|
-
*/
|
|
50
|
-
const [completionValue, setCompletionValue] = React.useState();
|
|
51
|
-
/**
|
|
52
|
-
* @see IUseLiveAICompletionResults["haveCompletionLock"]
|
|
53
|
-
*/
|
|
54
|
-
const [haveCompletionLock, setHaveCompletionLock] = React.useState(false);
|
|
55
|
-
/**
|
|
56
|
-
* User facing: dynamically load the DDS for the given unique key.
|
|
57
|
-
*/
|
|
58
|
-
const { dds: liveAICompletion } = useDynamicDDS(uniqueKey, LiveAICompletion);
|
|
59
|
-
/**
|
|
60
|
-
* @see IUseLiveAICompletionResults["changePrompt"]
|
|
61
|
-
*/
|
|
62
|
-
const changePrompt = React.useCallback((value) => {
|
|
63
|
-
if (liveAICompletion === undefined) {
|
|
64
|
-
console.error(new Error("Cannot call emitEvent when liveEvent is undefined"));
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (!liveAICompletion.isInitialized) {
|
|
68
|
-
console.error(new Error("Cannot call emitEvent while liveEvent is not started"));
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
return liveAICompletion.changePrompt(value);
|
|
72
|
-
}, [liveAICompletion]);
|
|
73
|
-
/**
|
|
74
|
-
* @see IUseLiveAICompletionResults["changePrompt"]
|
|
75
|
-
*/
|
|
76
|
-
const sendCompletion = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
if (liveAICompletion === undefined) {
|
|
78
|
-
throw new Error("Cannot call sendCompletion while `liveAICompletion` is undefined");
|
|
79
|
-
}
|
|
80
|
-
if (!liveAICompletion.isInitialized) {
|
|
81
|
-
throw new Error("Cannot call sendCompletion while `liveAICompletion` is not initialized");
|
|
82
|
-
}
|
|
83
|
-
return liveAICompletion.sendCompletion();
|
|
84
|
-
}), [liveAICompletion]);
|
|
85
|
-
/**
|
|
86
|
-
* Sets up the `LiveAICompletion` instance.
|
|
87
|
-
*/
|
|
88
|
-
React.useEffect(() => {
|
|
89
|
-
if (listeningRef.current ||
|
|
90
|
-
(liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.isInitialized) === undefined)
|
|
91
|
-
return;
|
|
92
|
-
listeningRef.current = true;
|
|
93
|
-
// Register event listeners
|
|
94
|
-
const onPromptChanged = (promptValue, local, completionValuePromise) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
-
setPromptValue(promptValue);
|
|
96
|
-
if (!liveAICompletion.haveValidCompletionValue) {
|
|
97
|
-
setCompletionValue(undefined);
|
|
98
|
-
}
|
|
99
|
-
try {
|
|
100
|
-
const completionValue = yield completionValuePromise;
|
|
101
|
-
setCompletionValue(completionValue);
|
|
102
|
-
}
|
|
103
|
-
catch (_a) {
|
|
104
|
-
// We do nothing, since this typically fails as a result of a new prompt value replacing the old on, permissions changing, etc.
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
const onLockGranted = () => {
|
|
108
|
-
setHaveCompletionLock(true);
|
|
109
|
-
};
|
|
110
|
-
const onLockLost = () => {
|
|
111
|
-
setHaveCompletionLock(true);
|
|
112
|
-
};
|
|
113
|
-
liveAICompletion.on(LiveAICompletionEvents.promptChanged, onPromptChanged);
|
|
114
|
-
liveAICompletion.on(LiveAICompletionEvents.lockGranted, onLockGranted);
|
|
115
|
-
liveAICompletion.on(LiveAICompletionEvents.lockLost, onLockLost);
|
|
116
|
-
if (!liveAICompletion.isInitialized) {
|
|
117
|
-
// Initialize the LiveAICompletion instance
|
|
118
|
-
liveAICompletion.initialize(onGetCompletion, allowedRoles, defaultPromptValue);
|
|
119
|
-
}
|
|
120
|
-
return () => {
|
|
121
|
-
// on unmount, remove event listeners
|
|
122
|
-
listeningRef.current = false;
|
|
123
|
-
liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.off(LiveAICompletionEvents.promptChanged, onPromptChanged);
|
|
124
|
-
liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.off(LiveAICompletionEvents.lockGranted, onLockGranted);
|
|
125
|
-
liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.off(LiveAICompletionEvents.lockLost, onLockLost);
|
|
126
|
-
};
|
|
127
|
-
}, [liveAICompletion]);
|
|
128
|
-
/**
|
|
129
|
-
* Sets the onGetCompletion of the `liveAICompletion` based on the 'onGetCompletion' prop
|
|
130
|
-
*/
|
|
131
|
-
React.useEffect(() => {
|
|
132
|
-
if ((liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.isInitialized) === true &&
|
|
133
|
-
onGetCompletion !== undefined) {
|
|
134
|
-
liveAICompletion.onGetCompletion = onGetCompletion;
|
|
135
|
-
}
|
|
136
|
-
}, [liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.isInitialized, onGetCompletion]);
|
|
137
|
-
/**
|
|
138
|
-
* Sets the autoCompletions of the `liveAICompletion` based on the 'autoCompletions' prop
|
|
139
|
-
*/
|
|
140
|
-
React.useEffect(() => {
|
|
141
|
-
if (liveAICompletion !== undefined &&
|
|
142
|
-
autoCompletions !== undefined &&
|
|
143
|
-
liveAICompletion.autoCompletions !== autoCompletions) {
|
|
144
|
-
liveAICompletion.autoCompletions = autoCompletions;
|
|
145
|
-
}
|
|
146
|
-
}, [liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.autoCompletions, autoCompletions]);
|
|
147
|
-
/**
|
|
148
|
-
* Sets the debounceDelayMilliseconds of the `liveAICompletion` based on the 'debounceDelayMilliseconds' prop
|
|
149
|
-
*/
|
|
150
|
-
React.useEffect(() => {
|
|
151
|
-
if (liveAICompletion !== undefined &&
|
|
152
|
-
debounceDelayMilliseconds !== undefined &&
|
|
153
|
-
liveAICompletion.debounceDelayMilliseconds !== debounceDelayMilliseconds) {
|
|
154
|
-
liveAICompletion.debounceDelayMilliseconds = debounceDelayMilliseconds;
|
|
155
|
-
}
|
|
156
|
-
}, [liveAICompletion, debounceDelayMilliseconds]);
|
|
157
|
-
/**
|
|
158
|
-
* Sets the lockPrompt of the `liveAICompletion` based on the 'lockPrompt' prop
|
|
159
|
-
*/
|
|
160
|
-
React.useEffect(() => {
|
|
161
|
-
if (liveAICompletion !== undefined &&
|
|
162
|
-
lockPrompt !== undefined &&
|
|
163
|
-
liveAICompletion.lockPrompt !== lockPrompt) {
|
|
164
|
-
liveAICompletion.lockPrompt = lockPrompt;
|
|
165
|
-
}
|
|
166
|
-
}, [liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.lockPrompt, lockPrompt]);
|
|
167
|
-
/**
|
|
168
|
-
* Sets the lockCompletion of the `liveAICompletion` based on the 'lockCompletion' prop
|
|
169
|
-
*/
|
|
170
|
-
React.useEffect(() => {
|
|
171
|
-
if (liveAICompletion !== undefined &&
|
|
172
|
-
lockCompletion !== undefined &&
|
|
173
|
-
liveAICompletion.lockCompletion !== lockCompletion) {
|
|
174
|
-
liveAICompletion.lockCompletion = lockCompletion;
|
|
175
|
-
}
|
|
176
|
-
}, [liveAICompletion === null || liveAICompletion === void 0 ? void 0 : liveAICompletion.lockCompletion, lockCompletion]);
|
|
177
|
-
return {
|
|
178
|
-
changePrompt,
|
|
179
|
-
completionValue,
|
|
180
|
-
haveCompletionLock,
|
|
181
|
-
liveAICompletion,
|
|
182
|
-
promptValue,
|
|
183
|
-
sendCompletion,
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
//# sourceMappingURL=useLiveAICompletion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveAICompletion.js","sourceRoot":"","sources":["../../src/live-hooks/useLiveAICompletion.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;AAGH,OAAO,EACH,gBAAgB,EAChB,sBAAsB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAC/B,SAAiB,EACjB,eAAyD,EACzD,YAAgC,EAChC,kBAA2B,EAC3B,eAAyB,EACzB,yBAAkC,EAClC,UAAoB,EACpB,cAAwB,EACG,EAAE;IAC7B;;OAEG;IACH,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC;;OAEG;IACH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,EAAE,CAAC,CAAC;IACjE;;OAEG;IACH,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACvE;;OAEG;IACH,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAC7C,KAAK,CAAC,QAAQ,CAAU,KA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EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAE/C;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IACI,gBAAgB,KAAK,SAAS;YAC9B,cAAc,KAAK,SAAS;YAC5B,gBAAgB,CAAC,cAAc,KAAK,cAAc,EACpD;YACE,gBAAgB,CAAC,cAAc,GAAG,cAAc,CAAC;SACpD;IACL,CAAC,EAAE,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;IAEvD,OAAO;QACH,YAAY;QACZ,eAAe;QACf,kBAAkB;QAClB,gBAAgB;QAChB,WAAW;QACX,cAAc;KACjB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
import { UserMeetingRole } from "@microsoft/live-share";
|
|
6
|
-
import { IUseLiveCoPilotResults } from "../types";
|
|
7
|
-
/**
|
|
8
|
-
* React hook for using a Live Share Turbo `LiveCoPilot`. Intended for use with OpenAI's Completion API.
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* Use this hook to set up an `LiveCoPilot` object, which is used for using AI completions collaboratively at minimal cost.
|
|
12
|
-
*
|
|
13
|
-
* @param uniqueKey the unique key for the `LiveCoPilot`. If one does not yet exist, a new one.
|
|
14
|
-
* @param onGetCompletion React useCallback function that returns a Promise<string> for the latest `promptValue`. Function is intended to
|
|
15
|
-
* communicate with a backend API that uses OpenAI's Completion API.
|
|
16
|
-
* @param allowedRoles Optional. The meeting roles eligible to send events through this object.
|
|
17
|
-
* @param defaultPromptValue Optional. Text that sets the default prompt value. Default value is an empty string.
|
|
18
|
-
* @param autoCompletions Optional. Stateful boolean that when true, will automatically send completions when the `promptValue` changes. Default value is true.
|
|
19
|
-
* @param debounceDelayMilliseconds Optional. Stateful number that changes the debounce interval when `autoCompletions` is true. Default value is 1000.
|
|
20
|
-
* @param lockPrompt Optional. Stateful boolean that when true, will restrict prompt changes to only the user with `haveCompletionLock` set to true. Default
|
|
21
|
-
* value is false.
|
|
22
|
-
* @param lockCompletion Optional. Stateful boolean that when true, will restrict manual completion changes to only the user with `haveCompletionLock`
|
|
23
|
-
* set to true. This does not impact the `autoCompletions` setting, because `autoCompletions` already has this behavior. Default value is false.
|
|
24
|
-
*
|
|
25
|
-
* @returns IUseLiveCoPilotResults object that contains stateful responses and callback methods from `LiveCoPilot`.
|
|
26
|
-
*/
|
|
27
|
-
export declare const useLiveCoPilot: (uniqueKey: string, onGetCompletion: (promptValue: string) => Promise<string>, allowedRoles?: UserMeetingRole[], defaultPromptValue?: string, autoCompletions?: boolean, debounceDelayMilliseconds?: number, lockPrompt?: boolean, lockCompletion?: boolean) => IUseLiveCoPilotResults;
|
|
28
|
-
//# sourceMappingURL=useLiveCoPilot.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveCoPilot.d.ts","sourceRoot":"","sources":["../../src/live-hooks/useLiveCoPilot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAIxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,cAAc,cACZ,MAAM,iCACc,MAAM,KAAK,QAAQ,MAAM,CAAC,iBAC1C,eAAe,EAAE,uBACX,MAAM,oBACT,OAAO,8BACG,MAAM,eACrB,OAAO,mBACH,OAAO,KACzB,sBA4LF,CAAC"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the Microsoft Live Share SDK License.
|
|
4
|
-
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
import { LiveCoPilot, LiveCoPilotEvents } from "@microsoft/live-share-turbo";
|
|
15
|
-
import React from "react";
|
|
16
|
-
import { useDynamicDDS } from "../shared-hooks";
|
|
17
|
-
/**
|
|
18
|
-
* React hook for using a Live Share Turbo `LiveCoPilot`. Intended for use with OpenAI's Completion API.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
* Use this hook to set up an `LiveCoPilot` object, which is used for using AI completions collaboratively at minimal cost.
|
|
22
|
-
*
|
|
23
|
-
* @param uniqueKey the unique key for the `LiveCoPilot`. If one does not yet exist, a new one.
|
|
24
|
-
* @param onGetCompletion React useCallback function that returns a Promise<string> for the latest `promptValue`. Function is intended to
|
|
25
|
-
* communicate with a backend API that uses OpenAI's Completion API.
|
|
26
|
-
* @param allowedRoles Optional. The meeting roles eligible to send events through this object.
|
|
27
|
-
* @param defaultPromptValue Optional. Text that sets the default prompt value. Default value is an empty string.
|
|
28
|
-
* @param autoCompletions Optional. Stateful boolean that when true, will automatically send completions when the `promptValue` changes. Default value is true.
|
|
29
|
-
* @param debounceDelayMilliseconds Optional. Stateful number that changes the debounce interval when `autoCompletions` is true. Default value is 1000.
|
|
30
|
-
* @param lockPrompt Optional. Stateful boolean that when true, will restrict prompt changes to only the user with `haveCompletionLock` set to true. Default
|
|
31
|
-
* value is false.
|
|
32
|
-
* @param lockCompletion Optional. Stateful boolean that when true, will restrict manual completion changes to only the user with `haveCompletionLock`
|
|
33
|
-
* set to true. This does not impact the `autoCompletions` setting, because `autoCompletions` already has this behavior. Default value is false.
|
|
34
|
-
*
|
|
35
|
-
* @returns IUseLiveCoPilotResults object that contains stateful responses and callback methods from `LiveCoPilot`.
|
|
36
|
-
*/
|
|
37
|
-
export const useLiveCoPilot = (uniqueKey, onGetCompletion, allowedRoles, defaultPromptValue, autoCompletions, debounceDelayMilliseconds, lockPrompt, lockCompletion) => {
|
|
38
|
-
/**
|
|
39
|
-
* @see IUseLiveCoPilotResults["promptValue"]
|
|
40
|
-
*/
|
|
41
|
-
const [promptValue, setPromptValue] = React.useState("");
|
|
42
|
-
/**
|
|
43
|
-
* @see IUseLiveCoPilotResults["completionValue"]
|
|
44
|
-
*/
|
|
45
|
-
const [completionValue, setCompletionValue] = React.useState();
|
|
46
|
-
/**
|
|
47
|
-
* @see IUseLiveCoPilotResults["haveCompletionLock"]
|
|
48
|
-
*/
|
|
49
|
-
const [haveCompletionLock, setHaveCompletionLock] = React.useState(false);
|
|
50
|
-
/**
|
|
51
|
-
* User facing: dynamically load the DDS for the given unique key.
|
|
52
|
-
*/
|
|
53
|
-
const { dds: liveCoPilot } = useDynamicDDS(uniqueKey, LiveCoPilot);
|
|
54
|
-
/**
|
|
55
|
-
* @see IUseLiveCoPilotResults["changePrompt"]
|
|
56
|
-
*/
|
|
57
|
-
const changePrompt = React.useCallback((value) => {
|
|
58
|
-
if (liveCoPilot === undefined) {
|
|
59
|
-
console.error(new Error("Cannot call emitEvent when liveEvent is undefined"));
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (!liveCoPilot.isInitialized) {
|
|
63
|
-
console.error(new Error("Cannot call emitEvent while liveEvent is not started"));
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
return liveCoPilot.changePrompt(value);
|
|
67
|
-
}, [liveCoPilot]);
|
|
68
|
-
/**
|
|
69
|
-
* @see IUseLiveCoPilotResults["changePrompt"]
|
|
70
|
-
*/
|
|
71
|
-
const sendCompletion = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
-
if (liveCoPilot === undefined) {
|
|
73
|
-
throw new Error("Cannot call sendCompletion while `liveCoPilot` is undefined");
|
|
74
|
-
}
|
|
75
|
-
if (!liveCoPilot.isInitialized) {
|
|
76
|
-
throw new Error("Cannot call sendCompletion while `liveCoPilot` is not initialized");
|
|
77
|
-
}
|
|
78
|
-
return liveCoPilot.sendCompletion();
|
|
79
|
-
}), [liveCoPilot]);
|
|
80
|
-
/**
|
|
81
|
-
* Sets up the `LiveCoPilot` instance.
|
|
82
|
-
*/
|
|
83
|
-
React.useEffect(() => {
|
|
84
|
-
if (liveCoPilot === undefined)
|
|
85
|
-
return;
|
|
86
|
-
// Register event listeners
|
|
87
|
-
const onPromptChanged = (promptValue, local, completionValuePromise) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
-
setPromptValue(promptValue);
|
|
89
|
-
if (!liveCoPilot.haveValidCompletionValue) {
|
|
90
|
-
setCompletionValue(undefined);
|
|
91
|
-
}
|
|
92
|
-
try {
|
|
93
|
-
const completionValue = yield completionValuePromise;
|
|
94
|
-
setCompletionValue(completionValue);
|
|
95
|
-
}
|
|
96
|
-
catch (_a) {
|
|
97
|
-
// We do nothing, since this typically fails as a result of a new prompt value replacing the old on, permissions changing, etc.
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
const onLockGranted = () => {
|
|
101
|
-
setHaveCompletionLock(true);
|
|
102
|
-
};
|
|
103
|
-
const onLockLost = () => {
|
|
104
|
-
setHaveCompletionLock(true);
|
|
105
|
-
};
|
|
106
|
-
liveCoPilot.on(LiveCoPilotEvents.promptChanged, onPromptChanged);
|
|
107
|
-
liveCoPilot.on(LiveCoPilotEvents.lockGranted, onLockGranted);
|
|
108
|
-
liveCoPilot.on(LiveCoPilotEvents.lockLost, onLockLost);
|
|
109
|
-
if (!liveCoPilot.isInitialized) {
|
|
110
|
-
// Initialize the LiveCoPilot instance
|
|
111
|
-
liveCoPilot.initialize(onGetCompletion, allowedRoles, defaultPromptValue);
|
|
112
|
-
}
|
|
113
|
-
return () => {
|
|
114
|
-
// on unmount, remove event listeners
|
|
115
|
-
liveCoPilot === null || liveCoPilot === void 0 ? void 0 : liveCoPilot.off(LiveCoPilotEvents.promptChanged, onPromptChanged);
|
|
116
|
-
liveCoPilot === null || liveCoPilot === void 0 ? void 0 : liveCoPilot.off(LiveCoPilotEvents.lockGranted, onLockGranted);
|
|
117
|
-
liveCoPilot === null || liveCoPilot === void 0 ? void 0 : liveCoPilot.off(LiveCoPilotEvents.lockLost, onLockLost);
|
|
118
|
-
};
|
|
119
|
-
}, [liveCoPilot]);
|
|
120
|
-
/**
|
|
121
|
-
* Sets the onGetCompletion of the `liveCoPilot` based on the 'onGetCompletion' prop
|
|
122
|
-
*/
|
|
123
|
-
React.useEffect(() => {
|
|
124
|
-
if ((liveCoPilot === null || liveCoPilot === void 0 ? void 0 : liveCoPilot.isInitialized) === true &&
|
|
125
|
-
onGetCompletion !== undefined) {
|
|
126
|
-
liveCoPilot.onGetCompletion = onGetCompletion;
|
|
127
|
-
}
|
|
128
|
-
}, [liveCoPilot === null || liveCoPilot === void 0 ? void 0 : liveCoPilot.isInitialized, onGetCompletion]);
|
|
129
|
-
/**
|
|
130
|
-
* Sets the autoCompletions of the `liveCoPilot` based on the 'autoCompletions' prop
|
|
131
|
-
*/
|
|
132
|
-
React.useEffect(() => {
|
|
133
|
-
if (liveCoPilot !== undefined &&
|
|
134
|
-
autoCompletions !== undefined &&
|
|
135
|
-
liveCoPilot.autoCompletions !== autoCompletions) {
|
|
136
|
-
liveCoPilot.autoCompletions = autoCompletions;
|
|
137
|
-
}
|
|
138
|
-
}, [liveCoPilot === null || liveCoPilot === void 0 ? void 0 : liveCoPilot.autoCompletions, autoCompletions]);
|
|
139
|
-
/**
|
|
140
|
-
* Sets the debounceDelayMilliseconds of the `liveCoPilot` based on the 'debounceDelayMilliseconds' prop
|
|
141
|
-
*/
|
|
142
|
-
React.useEffect(() => {
|
|
143
|
-
if (liveCoPilot !== undefined &&
|
|
144
|
-
debounceDelayMilliseconds !== undefined &&
|
|
145
|
-
liveCoPilot.debounceDelayMilliseconds !== debounceDelayMilliseconds) {
|
|
146
|
-
liveCoPilot.debounceDelayMilliseconds = debounceDelayMilliseconds;
|
|
147
|
-
}
|
|
148
|
-
}, [liveCoPilot, debounceDelayMilliseconds]);
|
|
149
|
-
/**
|
|
150
|
-
* Sets the lockPrompt of the `liveCoPilot` based on the 'lockPrompt' prop
|
|
151
|
-
*/
|
|
152
|
-
React.useEffect(() => {
|
|
153
|
-
if (liveCoPilot !== undefined &&
|
|
154
|
-
lockPrompt !== undefined &&
|
|
155
|
-
liveCoPilot.lockPrompt !== lockPrompt) {
|
|
156
|
-
liveCoPilot.lockPrompt = lockPrompt;
|
|
157
|
-
}
|
|
158
|
-
}, [liveCoPilot === null || liveCoPilot === void 0 ? void 0 : liveCoPilot.lockPrompt, lockPrompt]);
|
|
159
|
-
/**
|
|
160
|
-
* Sets the lockCompletion of the `liveCoPilot` based on the 'lockCompletion' prop
|
|
161
|
-
*/
|
|
162
|
-
React.useEffect(() => {
|
|
163
|
-
if (liveCoPilot !== undefined &&
|
|
164
|
-
lockCompletion !== undefined &&
|
|
165
|
-
liveCoPilot.lockCompletion !== lockCompletion) {
|
|
166
|
-
liveCoPilot.lockCompletion = lockCompletion;
|
|
167
|
-
}
|
|
168
|
-
}, [liveCoPilot === null || liveCoPilot === void 0 ? void 0 : liveCoPilot.lockCompletion, lockCompletion]);
|
|
169
|
-
return {
|
|
170
|
-
changePrompt,
|
|
171
|
-
completionValue,
|
|
172
|
-
haveCompletionLock,
|
|
173
|
-
liveCoPilot,
|
|
174
|
-
promptValue,
|
|
175
|
-
sendCompletion,
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
//# sourceMappingURL=useLiveCoPilot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLiveCoPilot.js","sourceRoot":"","sources":["../../src/live-hooks/useLiveCoPilot.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;;;;AAGH,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC1B,SAAiB,EACjB,eAAyD,EACzD,YAAgC,EAChC,kBAA2B,EAC3B,eAAyB,EACzB,yBAAkC,EAClC,UAAoB,EACpB,cAAwB,EACF,EAAE;IACxB;;OAEG;IACH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,EAAE,CAAC,CAAC;IACjE;;OAEG;IACH,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAU,CAAC;IACvE;;OAEG;IACH,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAC7C,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,aAAa,CACtC,SAAS,EACT,WAAW,CACd,CAAC;IAEF;;OAEG;IACH,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,KAAa,EAAE,EAAE;QACd,IAAI,WAAW,KAAK,SAAS,EAAE;YAC3B,OAAO,CAAC,KAAK,CACT,IAAI,KAAK,CACL,mDAAmD,CACtD,CACJ,CAAC;YACF,OAAO;SACV;QACD,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE;YAC5B,OAAO,CAAC,KAAK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W,aAAX,WAAW,uBAAX,WAAW,CAAE,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC;IAEpD;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IACI,WAAW,KAAK,SAAS;YACzB,yBAAyB,KAAK,SAAS;YACvC,WAAW,CAAC,yBAAyB,KAAK,yBAAyB,EACrE;YACE,WAAW,CAAC,yBAAyB,GAAG,yBAAyB,CAAC;SACrE;IACL,CAAC,EAAE,CAAC,WAAW,EAAE,yBAAyB,CAAC,CAAC,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IACI,WAAW,KAAK,SAAS;YACzB,UAAU,KAAK,SAAS;YACxB,WAAW,CAAC,UAAU,KAAK,UAAU,EACvC;YACE,WAAW,CAAC,UAAU,GAAG,UAAU,CAAC;SACvC;IACL,CAAC,EAAE,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAE1C;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IACI,WAAW,KAAK,SAAS;YACzB,cAAc,KAAK,SAAS;YAC5B,WAAW,CAAC,cAAc,KAAK,cAAc,EAC/C;YACE,WAAW,CAAC,cAAc,GAAG,cAAc,CAAC;SAC/C;IACL,CAAC,EAAE,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC;IAElD,OAAO;QACH,YAAY;QACZ,eAAe;QACf,kBAAkB;QAClB,WAAW;QACX,WAAW;QACX,cAAc;KACjB,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { IFluidContainer, LoadableObjectClass } from "fluid-framework";
|
|
2
|
-
import { AzureClientProps, AzureContainerServices } from "@fluidframework/azure-client";
|
|
3
|
-
import { FluidTurboClient } from "./internals";
|
|
4
|
-
export declare class AzureTurboClient extends FluidTurboClient {
|
|
5
|
-
private _client;
|
|
6
|
-
private _results;
|
|
7
|
-
/**
|
|
8
|
-
* Creates a new client instance using configuration parameters.
|
|
9
|
-
* @param props - Properties for initializing a new AzureClient instance
|
|
10
|
-
*/
|
|
11
|
-
constructor(props: AzureClientProps);
|
|
12
|
-
/**
|
|
13
|
-
* Get the Fluid join container results
|
|
14
|
-
*/
|
|
15
|
-
get results(): {
|
|
16
|
-
container: IFluidContainer;
|
|
17
|
-
services: AzureContainerServices;
|
|
18
|
-
} | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new detached container instance in the Azure Fluid Relay.
|
|
21
|
-
* @param containerSchema - Container schema for the new container.
|
|
22
|
-
* @returns New detached container instance along with associated services.
|
|
23
|
-
*/
|
|
24
|
-
createContainer(additionalDynamicObjectTypes?: LoadableObjectClass<any>[]): Promise<{
|
|
25
|
-
container: IFluidContainer;
|
|
26
|
-
services: AzureContainerServices;
|
|
27
|
-
}>;
|
|
28
|
-
/**
|
|
29
|
-
* Accesses the existing container given its unique ID in the Azure Fluid Relay.
|
|
30
|
-
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
31
|
-
* @param containerSchema - Container schema used to access data objects in the container.
|
|
32
|
-
* @returns Existing container instance along with associated services.
|
|
33
|
-
*/
|
|
34
|
-
getContainer(id: string, additionalDynamicObjectTypes?: LoadableObjectClass<any>[]): Promise<{
|
|
35
|
-
container: IFluidContainer;
|
|
36
|
-
services: AzureContainerServices;
|
|
37
|
-
}>;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=AzureTurboClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureTurboClient.d.ts","sourceRoot":"","sources":["../../src/live-share-turbo/AzureTurboClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAEH,gBAAgB,EAChB,sBAAsB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,qBAAa,gBAAiB,SAAQ,gBAAgB;IAClD,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAKA;IAEhB;;;OAGG;gBACS,KAAK,EAAE,gBAAgB;IAKnC;;OAEG;IACH,IAAoB,OAAO,IACrB;QACI,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,GACD,SAAS,CAEd;IAED;;;;OAIG;IACU,eAAe,CACxB,4BAA4B,CAAC,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAC1D,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;IAOF;;;;;OAKG;IACU,YAAY,CACrB,EAAE,EAAE,MAAM,EACV,4BAA4B,CAAC,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAE,GAC1D,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;KACpC,CAAC;CAML"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { getContainerSchema } from "../utils";
|
|
11
|
-
import { AzureClient, } from "@fluidframework/azure-client";
|
|
12
|
-
import { FluidTurboClient } from "./internals";
|
|
13
|
-
export class AzureTurboClient extends FluidTurboClient {
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new client instance using configuration parameters.
|
|
16
|
-
* @param props - Properties for initializing a new AzureClient instance
|
|
17
|
-
*/
|
|
18
|
-
constructor(props) {
|
|
19
|
-
super();
|
|
20
|
-
this._client = new AzureClient(props);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Get the Fluid join container results
|
|
24
|
-
*/
|
|
25
|
-
get results() {
|
|
26
|
-
return this._results;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Creates a new detached container instance in the Azure Fluid Relay.
|
|
30
|
-
* @param containerSchema - Container schema for the new container.
|
|
31
|
-
* @returns New detached container instance along with associated services.
|
|
32
|
-
*/
|
|
33
|
-
createContainer(additionalDynamicObjectTypes) {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const schema = getContainerSchema(additionalDynamicObjectTypes);
|
|
36
|
-
this._results = yield this._client.createContainer(schema);
|
|
37
|
-
this.registerDynamicObjectListeners();
|
|
38
|
-
return this._results;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Accesses the existing container given its unique ID in the Azure Fluid Relay.
|
|
43
|
-
* @param id - Unique ID of the container in Azure Fluid Relay.
|
|
44
|
-
* @param containerSchema - Container schema used to access data objects in the container.
|
|
45
|
-
* @returns Existing container instance along with associated services.
|
|
46
|
-
*/
|
|
47
|
-
getContainer(id, additionalDynamicObjectTypes) {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const schema = getContainerSchema(additionalDynamicObjectTypes);
|
|
50
|
-
this._results = yield this._client.getContainer(id, schema);
|
|
51
|
-
this.registerDynamicObjectListeners();
|
|
52
|
-
return this._results;
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=AzureTurboClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AzureTurboClient.js","sourceRoot":"","sources":["../../src/live-share-turbo/AzureTurboClient.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EACH,WAAW,GAGd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IASlD;;;OAGG;IACH,YAAY,KAAuB;QAC/B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAoB,OAAO;QAMvB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACU,eAAe,CACxB,4BAAyD;;YAKzD,MAAM,MAAM,GAAG,kBAAkB,CAAC,4BAA4B,CAAC,CAAC;YAChE,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAC3D,IAAI,CAAC,8BAA8B,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;KAAA;IAED;;;;;OAKG;IACU,YAAY,CACrB,EAAU,EACV,4BAAyD;;YAKzD,MAAM,MAAM,GAAG,kBAAkB,CAAC,4BAA4B,CAAC,CAAC;YAChE,IAAI,CAAC,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YAC5D,IAAI,CAAC,8BAA8B,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;KAAA;CACJ"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { IFluidContainer, LoadableObjectClass } from "fluid-framework";
|
|
2
|
-
import { ILiveShareClientOptions, ILiveShareHost } from "@microsoft/live-share";
|
|
3
|
-
import { AzureContainerServices } from "@fluidframework/azure-client";
|
|
4
|
-
import { FluidTurboClient } from "./internals";
|
|
5
|
-
export declare class LiveShareTurboClient extends FluidTurboClient {
|
|
6
|
-
private _client;
|
|
7
|
-
private _results;
|
|
8
|
-
/**
|
|
9
|
-
* Creates a new `LiveShareTurbo` instance.
|
|
10
|
-
* @param host Host for the current Live Share session.
|
|
11
|
-
* @param options Optional. Configuration options for the client.
|
|
12
|
-
*/
|
|
13
|
-
constructor(host: ILiveShareHost, options?: ILiveShareClientOptions);
|
|
14
|
-
/**
|
|
15
|
-
* If true the client is configured to use a local test server.
|
|
16
|
-
*/
|
|
17
|
-
get isTesting(): boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Number of times the client should attempt to get the ID of the container to join for the
|
|
20
|
-
* current context.
|
|
21
|
-
*/
|
|
22
|
-
get maxContainerLookupTries(): number;
|
|
23
|
-
/**
|
|
24
|
-
* Set number of times the client should attempt to get the ID of the container to join for the
|
|
25
|
-
* current context.
|
|
26
|
-
*/
|
|
27
|
-
set maxContainerLookupTries(value: number);
|
|
28
|
-
/**
|
|
29
|
-
* Get the Fluid join container results
|
|
30
|
-
*/
|
|
31
|
-
get results(): {
|
|
32
|
-
container: IFluidContainer;
|
|
33
|
-
services: AzureContainerServices;
|
|
34
|
-
created: boolean;
|
|
35
|
-
} | undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Connects to the fluid container for the current teams context.
|
|
38
|
-
*
|
|
39
|
-
* @remarks
|
|
40
|
-
* The first client joining the container will create the container resulting in the
|
|
41
|
-
* `onContainerFirstCreated` callback being called. This callback can be used to set the initial
|
|
42
|
-
* state of of the containers object prior to the container being attached.
|
|
43
|
-
* @param fluidContainerSchema Fluid objects to create.
|
|
44
|
-
* @param onContainerFirstCreated Optional. Callback that's called when the container is first created.
|
|
45
|
-
* @returns The fluid `container` and `services` objects to use along with a `created` flag that if true means the container had to be created.
|
|
46
|
-
*/
|
|
47
|
-
join(additionalDynamicObjectTypes?: LoadableObjectClass<any>[], onContainerFirstCreated?: (container: IFluidContainer) => void): Promise<{
|
|
48
|
-
container: IFluidContainer;
|
|
49
|
-
services: AzureContainerServices;
|
|
50
|
-
created: boolean;
|
|
51
|
-
}>;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=LiveShareTurboClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LiveShareTurboClient.d.ts","sourceRoot":"","sources":["../../src/live-share-turbo/LiveShareTurboClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAEH,uBAAuB,EACvB,cAAc,EACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,qBAAa,oBAAqB,SAAQ,gBAAgB;IACtD,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAMA;IAEhB;;;;OAIG;gBACS,IAAI,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,uBAAuB;IAKnE;;OAEG;IACH,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED;;;OAGG;IACH,IAAW,uBAAuB,IAAI,MAAM,CAE3C;IAED;;;OAGG;IACH,IAAW,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAE/C;IAED;;OAEG;IACH,IAAoB,OAAO,IACrB;QACI,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;QACjC,OAAO,EAAE,OAAO,CAAC;KACpB,GACD,SAAS,CAEd;IAED;;;;;;;;;;OAUG;IACU,IAAI,CACb,4BAA4B,CAAC,EAAE,mBAAmB,CAAC,GAAG,CAAC,EAAE,EACzD,uBAAuB,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,IAAI,GAC/D,OAAO,CAAC;QACP,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,sBAAsB,CAAC;QACjC,OAAO,EAAE,OAAO,CAAC;KACpB,CAAC;CAWL"}
|