@octostar/platform-api 0.5.19 → 0.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factory.js +1 -1
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/FilesAPIImpl.js +1 -1
- package/dist/lib/FilesAPIImpl.js.map +1 -1
- package/dist/lib/LiveContextAPI.d.ts +27 -0
- package/dist/lib/LiveContextAPI.d.ts.map +1 -0
- package/dist/lib/LiveContextAPI.js +120 -0
- package/dist/lib/LiveContextAPI.js.map +1 -0
- package/dist/octostar-platform-api.js +389 -10
- package/package.json +4 -3
package/dist/factory.js
CHANGED
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAMxC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,SAAS,GAAG,CAAC,MAAc,EAAW,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;AAExE,SAAS,iBAAiB,CACxB,SAAiB,EACjB,gBAAwB,MAAM,EAC9B,KAAK,GAAG,CAAC;IAET,0CAA0C;IAC1C,IAAI,OAAsC,CAAC;IAC3C,IAAI,CAAC;QACH,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,+BAA+B;QAC/B,OAAO,a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AAI,OAAO,SAAS,EAAE,CACtE,CAAC;QAEF,MAAM,GAAG,GAAG,kBAAkB,CAAI,QAAsC,CAAC,CAAC;QAE1E,OAAO,iBAAiB,CAAI,GAAG,EAAE;YAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;SAClB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,GAAG,CACT,gEAAgE,KAAK,EAAE,EACvE,CAAC,CACF,CAAC;QACF,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAI,KAAiB,EAAK,EAAE,CACpE,IAAI,KAAK,CACP,EAAE,EACF;IACE,GAAG,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CACpB,IAAI,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE;QAClB,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;KACrE,CAAC;CACL,CACG,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export * from './permissions';
|
|
|
6
6
|
export * from './components';
|
|
7
7
|
export * from './lib/JWTProvider';
|
|
8
8
|
export * from './lib/AIClientImpl';
|
|
9
|
+
export * from './lib/FilesAPIImpl';
|
|
9
10
|
export * from './lib/Proxy';
|
|
10
11
|
export * from './lib/userWorkspace';
|
|
12
|
+
export * from './lib/LiveContextAPI';
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,8 @@ export * from './permissions';
|
|
|
6
6
|
export * from './components';
|
|
7
7
|
export * from './lib/JWTProvider';
|
|
8
8
|
export * from './lib/AIClientImpl';
|
|
9
|
+
export * from './lib/FilesAPIImpl';
|
|
9
10
|
export * from './lib/Proxy';
|
|
10
11
|
export * from './lib/userWorkspace';
|
|
12
|
+
export * from './lib/LiveContextAPI';
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
package/dist/lib/FilesAPIImpl.js
CHANGED
|
@@ -25,7 +25,7 @@ export class FilesAPIImpl {
|
|
|
25
25
|
if (options?.fileOffset !== undefined)
|
|
26
26
|
params.append('file_offset', String(options.fileOffset));
|
|
27
27
|
const queryString = params.toString();
|
|
28
|
-
const url = `/api/v1/files/list/${os_workspace}
|
|
28
|
+
const url = `/api/v1/files/list/${os_workspace}${path ? `/${path}` : ''}${queryString ? `?${queryString}` : ''}`;
|
|
29
29
|
return this.osAPIClient.fetchData({
|
|
30
30
|
endpoint: url,
|
|
31
31
|
method: 'GET',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilesAPIImpl.js","sourceRoot":"","sources":["../../src/lib/FilesAPIImpl.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,YAAY;IAGvB,YAAY,WAAwB;QAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,YAAoB,EAAE,IAAa;QAC5C,MAAM,GAAG,GAAG,IAAI;YACd,CAAC,CAAC,sBAAsB,YAAY,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE;YAClE,CAAC,CAAC,sBAAsB,YAAY,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAgB;YAC/C,QAAQ,EAAE,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C,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LiveContext, LiveContextListener, LiveContextAPISetParams, DefaultLiveContextData } from '@octostar/platform-types';
|
|
2
|
+
export declare class LiveContextAPI<ContextData extends DefaultLiveContextData = DefaultLiveContextData> implements LiveContext<ContextData> {
|
|
3
|
+
private contextData;
|
|
4
|
+
private listeners;
|
|
5
|
+
private postRobotListener;
|
|
6
|
+
private type;
|
|
7
|
+
private channelId;
|
|
8
|
+
private iframeChannelAttr;
|
|
9
|
+
readonly id: string;
|
|
10
|
+
constructor(contextData: ContextData);
|
|
11
|
+
private connectPostRobot;
|
|
12
|
+
private getConnectId;
|
|
13
|
+
private getTargetWindow;
|
|
14
|
+
private setContextAndNotify;
|
|
15
|
+
private getPostRobotEventName;
|
|
16
|
+
private sendContextUpdate;
|
|
17
|
+
getContext(): ContextData;
|
|
18
|
+
setContext(context: LiveContextAPISetParams<ContextData>): Promise<void>;
|
|
19
|
+
subscribeToChanges(contextListener: LiveContextListener<ContextData>): string;
|
|
20
|
+
subscribeToChanges(id: string, contextListener: LiveContextListener<ContextData>): string;
|
|
21
|
+
unsubscribeFromChanges(id: string): void;
|
|
22
|
+
addContextListener<ContextDataToConnect extends DefaultLiveContextData>(LiveContextAPItoConnect: LiveContextAPI<ContextDataToConnect>, mapContext?: (context: ContextDataToConnect) => ContextData): () => void;
|
|
23
|
+
removeContextListener<ContextDataToConnect extends DefaultLiveContextData>(idOrContextAPI: LiveContextAPI<ContextDataToConnect> | string): void;
|
|
24
|
+
connect(): string;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=LiveContextAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveContextAPI.d.ts","sourceRoot":"","sources":["../../src/lib/LiveContextAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,sB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
export class LiveContextAPI {
|
|
5
|
+
constructor(contextData) {
|
|
6
|
+
this.listeners = {};
|
|
7
|
+
this.iframeChannelAttr = 'data-octostar-iframe-channel';
|
|
8
|
+
this.id = uuidv4();
|
|
9
|
+
this.contextData = contextData;
|
|
10
|
+
const iframeChannelId = window.frameElement?.getAttribute(this.iframeChannelAttr);
|
|
11
|
+
this.channelId = iframeChannelId || uuidv4();
|
|
12
|
+
this.type = iframeChannelId ? 'iframe' : 'parent';
|
|
13
|
+
}
|
|
14
|
+
async connectPostRobot() {
|
|
15
|
+
const targetWindow = await this.getTargetWindow();
|
|
16
|
+
const postRobotEventName = this.getPostRobotEventName(this.channelId);
|
|
17
|
+
this.postRobotListener = (postRobot.on(postRobotEventName, { window: targetWindow }, (event) => {
|
|
18
|
+
if (event.data.type === 'init') {
|
|
19
|
+
this.setContext((context) => ({ ...context, ...event.data.context }));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.setContextAndNotify((context) => ({ ...context, ...event.data.context }));
|
|
23
|
+
}
|
|
24
|
+
return Promise.resolve();
|
|
25
|
+
}));
|
|
26
|
+
await this.sendContextUpdate(true);
|
|
27
|
+
}
|
|
28
|
+
getConnectId(contextAPI) {
|
|
29
|
+
return `ContextAPI-${contextAPI.id}`;
|
|
30
|
+
}
|
|
31
|
+
async getTargetWindow() {
|
|
32
|
+
if (this.type === 'iframe' && window.top) {
|
|
33
|
+
return window.top;
|
|
34
|
+
}
|
|
35
|
+
const iframe = document.querySelector(`iframe[${this.iframeChannelAttr}='${this.channelId}']`);
|
|
36
|
+
if (iframe?.contentWindow) {
|
|
37
|
+
return iframe.contentWindow;
|
|
38
|
+
}
|
|
39
|
+
// Wait for the iframe to appear in the DOM
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
const observer = new MutationObserver(() => {
|
|
42
|
+
const iframe = document.querySelector(`iframe[${this.iframeChannelAttr}='${this.channelId}']`);
|
|
43
|
+
if (iframe?.contentWindow) {
|
|
44
|
+
observer.disconnect();
|
|
45
|
+
resolve(iframe.contentWindow);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
// Start observing
|
|
49
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
setContextAndNotify(context) {
|
|
53
|
+
if (typeof context === 'function') {
|
|
54
|
+
this.contextData = context(this.contextData);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.contextData = context;
|
|
58
|
+
}
|
|
59
|
+
Object.values(this.listeners).forEach(listener => listener(this.contextData));
|
|
60
|
+
}
|
|
61
|
+
getPostRobotEventName(channelId) {
|
|
62
|
+
return `${channelId}-${CONTEXT_UPDATE_EVENT}`;
|
|
63
|
+
}
|
|
64
|
+
async sendContextUpdate(isInit = false) {
|
|
65
|
+
try {
|
|
66
|
+
const targetWindow = await this.getTargetWindow();
|
|
67
|
+
postRobot.send(targetWindow, this.getPostRobotEventName(this.channelId), { context: this.contextData, ...(isInit && { type: 'init' }) });
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
// Silently ignore any errors during context update
|
|
71
|
+
console.debug('Failed to send context update:', error);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
getContext() {
|
|
75
|
+
return this.contextData;
|
|
76
|
+
}
|
|
77
|
+
async setContext(context) {
|
|
78
|
+
this.setContextAndNotify(context);
|
|
79
|
+
await this.sendContextUpdate();
|
|
80
|
+
}
|
|
81
|
+
subscribeToChanges(idOrContextListener, contextListenerOrNothing) {
|
|
82
|
+
const id = typeof idOrContextListener === 'string' ? idOrContextListener : uuidv4();
|
|
83
|
+
const contextListener = typeof idOrContextListener === 'function'
|
|
84
|
+
? idOrContextListener
|
|
85
|
+
: contextListenerOrNothing;
|
|
86
|
+
if (!contextListener) {
|
|
87
|
+
const error = new Error('Context listener is required');
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
this.listeners[id] = contextListener;
|
|
91
|
+
return id;
|
|
92
|
+
}
|
|
93
|
+
unsubscribeFromChanges(id) {
|
|
94
|
+
delete this.listeners[id];
|
|
95
|
+
}
|
|
96
|
+
addContextListener(LiveContextAPItoConnect, mapContext = (context) => context) {
|
|
97
|
+
// Merge the new context with existing context
|
|
98
|
+
this.setContext((currentContext) => ({ ...currentContext, ...mapContext(LiveContextAPItoConnect.getContext()) }));
|
|
99
|
+
// Subscribe to changes if id is provided
|
|
100
|
+
const subscriptionId = this.getConnectId(LiveContextAPItoConnect);
|
|
101
|
+
LiveContextAPItoConnect.subscribeToChanges(subscriptionId, (updatedContext) => {
|
|
102
|
+
this.setContext((currentContext) => ({ ...currentContext, ...mapContext(updatedContext) }));
|
|
103
|
+
});
|
|
104
|
+
// Return a callback function that unsubscribes
|
|
105
|
+
return () => this.unsubscribeFromChanges(subscriptionId);
|
|
106
|
+
}
|
|
107
|
+
removeContextListener(idOrContextAPI) {
|
|
108
|
+
const id = typeof idOrContextAPI === 'string' ? idOrContextAPI : this.getConnectId(idOrContextAPI);
|
|
109
|
+
this.unsubscribeFromChanges(id);
|
|
110
|
+
}
|
|
111
|
+
connect() {
|
|
112
|
+
const channelId = this.channelId;
|
|
113
|
+
this.connectPostRobot();
|
|
114
|
+
return channelId;
|
|
115
|
+
}
|
|
116
|
+
destroy() {
|
|
117
|
+
this.postRobotListener?.cancel();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=LiveContextAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveContextAPI.js","sourceRoot":"","sources":["../../src/lib/LiveContextAPI.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAE9C,MAAM,OAAO,cAAc;IAUzB,YAAY,WAAwB;QAP5B,cAAS,GAAqD,EAAE,C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E,CAAC,CAAC;IAClC,CAAC;IAEA,OAAO;QACN,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QACjC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -6480,10 +6480,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6480
6480
|
value: true
|
|
6481
6481
|
});
|
|
6482
6482
|
exports.forwardCallsToFutureObject = exports.createRemoteApiHandle = void 0;
|
|
6483
|
-
var
|
|
6483
|
+
var postRobot = _interopRequireWildcard(require("post-robot"));
|
|
6484
6484
|
var _utils = require("./utils");
|
|
6485
6485
|
var _constants = require("./constants");
|
|
6486
|
-
function
|
|
6486
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
6487
6487
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
|
|
6488
6488
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
6489
6489
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
@@ -6643,7 +6643,7 @@ var createRemoteApiHandle = exports.createRemoteApiHandle = /*#__PURE__*/functio
|
|
|
6643
6643
|
_context.prev = 5;
|
|
6644
6644
|
_context.next = 8;
|
|
6645
6645
|
return (0, _utils.retry)(function () {
|
|
6646
|
-
return
|
|
6646
|
+
return postRobot.send(octostarWindow, topic, params);
|
|
6647
6647
|
}, {
|
|
6648
6648
|
maxAttempts: 5,
|
|
6649
6649
|
retryInterval: 2000
|
|
@@ -6684,7 +6684,7 @@ var forwardCallsToFutureObject = exports.forwardCallsToFutureObject = function f
|
|
|
6684
6684
|
});
|
|
6685
6685
|
};
|
|
6686
6686
|
|
|
6687
|
-
},{"./constants":33,"./utils":
|
|
6687
|
+
},{"./constants":33,"./utils":45,"post-robot":5}],35:[function(require,module,exports){
|
|
6688
6688
|
"use strict";
|
|
6689
6689
|
|
|
6690
6690
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6778,6 +6778,17 @@ Object.keys(_AIClientImpl).forEach(function (key) {
|
|
|
6778
6778
|
}
|
|
6779
6779
|
});
|
|
6780
6780
|
});
|
|
6781
|
+
var _FilesAPIImpl = require("./lib/FilesAPIImpl");
|
|
6782
|
+
Object.keys(_FilesAPIImpl).forEach(function (key) {
|
|
6783
|
+
if (key === "default" || key === "__esModule") return;
|
|
6784
|
+
if (key in exports && exports[key] === _FilesAPIImpl[key]) return;
|
|
6785
|
+
Object.defineProperty(exports, key, {
|
|
6786
|
+
enumerable: true,
|
|
6787
|
+
get: function get() {
|
|
6788
|
+
return _FilesAPIImpl[key];
|
|
6789
|
+
}
|
|
6790
|
+
});
|
|
6791
|
+
});
|
|
6781
6792
|
var _Proxy = require("./lib/Proxy");
|
|
6782
6793
|
Object.keys(_Proxy).forEach(function (key) {
|
|
6783
6794
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -6800,8 +6811,19 @@ Object.keys(_userWorkspace).forEach(function (key) {
|
|
|
6800
6811
|
}
|
|
6801
6812
|
});
|
|
6802
6813
|
});
|
|
6814
|
+
var _LiveContextAPI = require("./lib/LiveContextAPI");
|
|
6815
|
+
Object.keys(_LiveContextAPI).forEach(function (key) {
|
|
6816
|
+
if (key === "default" || key === "__esModule") return;
|
|
6817
|
+
if (key in exports && exports[key] === _LiveContextAPI[key]) return;
|
|
6818
|
+
Object.defineProperty(exports, key, {
|
|
6819
|
+
enumerable: true,
|
|
6820
|
+
get: function get() {
|
|
6821
|
+
return _LiveContextAPI[key];
|
|
6822
|
+
}
|
|
6823
|
+
});
|
|
6824
|
+
});
|
|
6803
6825
|
|
|
6804
|
-
},{"./apis":22,"./components":32,"./constants":33,"./lib/AIClientImpl":36,"./lib/
|
|
6826
|
+
},{"./apis":22,"./components":32,"./constants":33,"./lib/AIClientImpl":36,"./lib/FilesAPIImpl":38,"./lib/JWTProvider":39,"./lib/LiveContextAPI":40,"./lib/Proxy":41,"./lib/userWorkspace":42,"./permissions":43,"./types":44,"./utils":45}],36:[function(require,module,exports){
|
|
6805
6827
|
"use strict";
|
|
6806
6828
|
|
|
6807
6829
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7051,6 +7073,90 @@ AsyncServiceLocator.instances = {};
|
|
|
7051
7073
|
},{}],38:[function(require,module,exports){
|
|
7052
7074
|
"use strict";
|
|
7053
7075
|
|
|
7076
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7077
|
+
value: true
|
|
7078
|
+
});
|
|
7079
|
+
exports.FilesAPIImpl = void 0;
|
|
7080
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7081
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
|
|
7082
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
7083
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
7084
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7085
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7086
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7087
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7088
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7089
|
+
var FilesAPIImpl = exports.FilesAPIImpl = /*#__PURE__*/function () {
|
|
7090
|
+
function FilesAPIImpl(osAPIClient) {
|
|
7091
|
+
_classCallCheck(this, FilesAPIImpl);
|
|
7092
|
+
this.osAPIClient = osAPIClient;
|
|
7093
|
+
}
|
|
7094
|
+
return _createClass(FilesAPIImpl, [{
|
|
7095
|
+
key: "stat",
|
|
7096
|
+
value: function () {
|
|
7097
|
+
var _stat = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(os_workspace, path) {
|
|
7098
|
+
var url;
|
|
7099
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7100
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7101
|
+
case 0:
|
|
7102
|
+
url = path ? "/api/v1/files/stat/".concat(os_workspace, "/").concat(encodeURIComponent(path)) : "/api/v1/files/stat/".concat(os_workspace);
|
|
7103
|
+
return _context.abrupt("return", this.osAPIClient.fetchData({
|
|
7104
|
+
endpoint: url,
|
|
7105
|
+
method: 'GET',
|
|
7106
|
+
headers: {
|
|
7107
|
+
'Content-Type': 'application/json'
|
|
7108
|
+
}
|
|
7109
|
+
}));
|
|
7110
|
+
case 2:
|
|
7111
|
+
case "end":
|
|
7112
|
+
return _context.stop();
|
|
7113
|
+
}
|
|
7114
|
+
}, _callee, this);
|
|
7115
|
+
}));
|
|
7116
|
+
function stat(_x, _x2) {
|
|
7117
|
+
return _stat.apply(this, arguments);
|
|
7118
|
+
}
|
|
7119
|
+
return stat;
|
|
7120
|
+
}()
|
|
7121
|
+
}, {
|
|
7122
|
+
key: "list_folder",
|
|
7123
|
+
value: function () {
|
|
7124
|
+
var _list_folder = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(os_workspace, path, options) {
|
|
7125
|
+
var params, queryString, url;
|
|
7126
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7127
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7128
|
+
case 0:
|
|
7129
|
+
params = new URLSearchParams();
|
|
7130
|
+
if ((options === null || options === void 0 ? void 0 : options.maxFolders) !== undefined) params.append('max_folders', String(options.maxFolders));
|
|
7131
|
+
if ((options === null || options === void 0 ? void 0 : options.maxFiles) !== undefined) params.append('max_files', String(options.maxFiles));
|
|
7132
|
+
if ((options === null || options === void 0 ? void 0 : options.folderOffset) !== undefined) params.append('folder_offset', String(options.folderOffset));
|
|
7133
|
+
if ((options === null || options === void 0 ? void 0 : options.fileOffset) !== undefined) params.append('file_offset', String(options.fileOffset));
|
|
7134
|
+
queryString = params.toString();
|
|
7135
|
+
url = "/api/v1/files/list/".concat(os_workspace).concat(path ? "/".concat(path) : '').concat(queryString ? "?".concat(queryString) : '');
|
|
7136
|
+
return _context2.abrupt("return", this.osAPIClient.fetchData({
|
|
7137
|
+
endpoint: url,
|
|
7138
|
+
method: 'GET',
|
|
7139
|
+
headers: {
|
|
7140
|
+
'Content-Type': 'application/json'
|
|
7141
|
+
}
|
|
7142
|
+
}));
|
|
7143
|
+
case 8:
|
|
7144
|
+
case "end":
|
|
7145
|
+
return _context2.stop();
|
|
7146
|
+
}
|
|
7147
|
+
}, _callee2, this);
|
|
7148
|
+
}));
|
|
7149
|
+
function list_folder(_x3, _x4, _x5) {
|
|
7150
|
+
return _list_folder.apply(this, arguments);
|
|
7151
|
+
}
|
|
7152
|
+
return list_folder;
|
|
7153
|
+
}()
|
|
7154
|
+
}]);
|
|
7155
|
+
}();
|
|
7156
|
+
|
|
7157
|
+
},{}],39:[function(require,module,exports){
|
|
7158
|
+
"use strict";
|
|
7159
|
+
|
|
7054
7160
|
Object.defineProperty(exports, "__esModule", {
|
|
7055
7161
|
value: true
|
|
7056
7162
|
});
|
|
@@ -7134,7 +7240,280 @@ var JWTProvider = exports.JWTProvider = /*#__PURE__*/function () {
|
|
|
7134
7240
|
}]);
|
|
7135
7241
|
}();
|
|
7136
7242
|
|
|
7137
|
-
},{}],
|
|
7243
|
+
},{}],40:[function(require,module,exports){
|
|
7244
|
+
"use strict";
|
|
7245
|
+
|
|
7246
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7247
|
+
value: true
|
|
7248
|
+
});
|
|
7249
|
+
exports.LiveContextAPI = void 0;
|
|
7250
|
+
var _uuid = require("uuid");
|
|
7251
|
+
var postRobot = _interopRequireWildcard(require("post-robot"));
|
|
7252
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
7253
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
7254
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
|
|
7255
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7256
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7257
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
7258
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
7259
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
7260
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7261
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7262
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7263
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7264
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7265
|
+
var CONTEXT_UPDATE_EVENT = 'context-update';
|
|
7266
|
+
var LiveContextAPI = exports.LiveContextAPI = /*#__PURE__*/function () {
|
|
7267
|
+
function LiveContextAPI(contextData) {
|
|
7268
|
+
var _window$frameElement;
|
|
7269
|
+
_classCallCheck(this, LiveContextAPI);
|
|
7270
|
+
this.listeners = {};
|
|
7271
|
+
this.iframeChannelAttr = 'data-octostar-iframe-channel';
|
|
7272
|
+
this.id = (0, _uuid.v4)();
|
|
7273
|
+
this.contextData = contextData;
|
|
7274
|
+
var iframeChannelId = (_window$frameElement = window.frameElement) === null || _window$frameElement === void 0 ? void 0 : _window$frameElement.getAttribute(this.iframeChannelAttr);
|
|
7275
|
+
this.channelId = iframeChannelId || (0, _uuid.v4)();
|
|
7276
|
+
this.type = iframeChannelId ? 'iframe' : 'parent';
|
|
7277
|
+
}
|
|
7278
|
+
return _createClass(LiveContextAPI, [{
|
|
7279
|
+
key: "connectPostRobot",
|
|
7280
|
+
value: function () {
|
|
7281
|
+
var _connectPostRobot = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7282
|
+
var _this = this;
|
|
7283
|
+
var targetWindow, postRobotEventName;
|
|
7284
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7285
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7286
|
+
case 0:
|
|
7287
|
+
_context.next = 2;
|
|
7288
|
+
return this.getTargetWindow();
|
|
7289
|
+
case 2:
|
|
7290
|
+
targetWindow = _context.sent;
|
|
7291
|
+
postRobotEventName = this.getPostRobotEventName(this.channelId);
|
|
7292
|
+
this.postRobotListener = postRobot.on(postRobotEventName, {
|
|
7293
|
+
window: targetWindow
|
|
7294
|
+
}, function (event) {
|
|
7295
|
+
if (event.data.type === 'init') {
|
|
7296
|
+
_this.setContext(function (context) {
|
|
7297
|
+
return _objectSpread(_objectSpread({}, context), event.data.context);
|
|
7298
|
+
});
|
|
7299
|
+
} else {
|
|
7300
|
+
_this.setContextAndNotify(function (context) {
|
|
7301
|
+
return _objectSpread(_objectSpread({}, context), event.data.context);
|
|
7302
|
+
});
|
|
7303
|
+
}
|
|
7304
|
+
return Promise.resolve();
|
|
7305
|
+
});
|
|
7306
|
+
_context.next = 7;
|
|
7307
|
+
return this.sendContextUpdate(true);
|
|
7308
|
+
case 7:
|
|
7309
|
+
case "end":
|
|
7310
|
+
return _context.stop();
|
|
7311
|
+
}
|
|
7312
|
+
}, _callee, this);
|
|
7313
|
+
}));
|
|
7314
|
+
function connectPostRobot() {
|
|
7315
|
+
return _connectPostRobot.apply(this, arguments);
|
|
7316
|
+
}
|
|
7317
|
+
return connectPostRobot;
|
|
7318
|
+
}()
|
|
7319
|
+
}, {
|
|
7320
|
+
key: "getConnectId",
|
|
7321
|
+
value: function getConnectId(contextAPI) {
|
|
7322
|
+
return "ContextAPI-".concat(contextAPI.id);
|
|
7323
|
+
}
|
|
7324
|
+
}, {
|
|
7325
|
+
key: "getTargetWindow",
|
|
7326
|
+
value: function () {
|
|
7327
|
+
var _getTargetWindow = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
7328
|
+
var _this2 = this;
|
|
7329
|
+
var iframe;
|
|
7330
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7331
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7332
|
+
case 0:
|
|
7333
|
+
if (!(this.type === 'iframe' && window.top)) {
|
|
7334
|
+
_context2.next = 2;
|
|
7335
|
+
break;
|
|
7336
|
+
}
|
|
7337
|
+
return _context2.abrupt("return", window.top);
|
|
7338
|
+
case 2:
|
|
7339
|
+
iframe = document.querySelector("iframe[".concat(this.iframeChannelAttr, "='").concat(this.channelId, "']"));
|
|
7340
|
+
if (!(iframe !== null && iframe !== void 0 && iframe.contentWindow)) {
|
|
7341
|
+
_context2.next = 5;
|
|
7342
|
+
break;
|
|
7343
|
+
}
|
|
7344
|
+
return _context2.abrupt("return", iframe.contentWindow);
|
|
7345
|
+
case 5:
|
|
7346
|
+
return _context2.abrupt("return", new Promise(function (resolve) {
|
|
7347
|
+
var observer = new MutationObserver(function () {
|
|
7348
|
+
var iframe = document.querySelector("iframe[".concat(_this2.iframeChannelAttr, "='").concat(_this2.channelId, "']"));
|
|
7349
|
+
if (iframe !== null && iframe !== void 0 && iframe.contentWindow) {
|
|
7350
|
+
observer.disconnect();
|
|
7351
|
+
resolve(iframe.contentWindow);
|
|
7352
|
+
}
|
|
7353
|
+
});
|
|
7354
|
+
// Start observing
|
|
7355
|
+
observer.observe(document.body, {
|
|
7356
|
+
childList: true,
|
|
7357
|
+
subtree: true
|
|
7358
|
+
});
|
|
7359
|
+
}));
|
|
7360
|
+
case 6:
|
|
7361
|
+
case "end":
|
|
7362
|
+
return _context2.stop();
|
|
7363
|
+
}
|
|
7364
|
+
}, _callee2, this);
|
|
7365
|
+
}));
|
|
7366
|
+
function getTargetWindow() {
|
|
7367
|
+
return _getTargetWindow.apply(this, arguments);
|
|
7368
|
+
}
|
|
7369
|
+
return getTargetWindow;
|
|
7370
|
+
}()
|
|
7371
|
+
}, {
|
|
7372
|
+
key: "setContextAndNotify",
|
|
7373
|
+
value: function setContextAndNotify(context) {
|
|
7374
|
+
var _this3 = this;
|
|
7375
|
+
if (typeof context === 'function') {
|
|
7376
|
+
this.contextData = context(this.contextData);
|
|
7377
|
+
} else {
|
|
7378
|
+
this.contextData = context;
|
|
7379
|
+
}
|
|
7380
|
+
Object.values(this.listeners).forEach(function (listener) {
|
|
7381
|
+
return listener(_this3.contextData);
|
|
7382
|
+
});
|
|
7383
|
+
}
|
|
7384
|
+
}, {
|
|
7385
|
+
key: "getPostRobotEventName",
|
|
7386
|
+
value: function getPostRobotEventName(channelId) {
|
|
7387
|
+
return "".concat(channelId, "-").concat(CONTEXT_UPDATE_EVENT);
|
|
7388
|
+
}
|
|
7389
|
+
}, {
|
|
7390
|
+
key: "sendContextUpdate",
|
|
7391
|
+
value: function () {
|
|
7392
|
+
var _sendContextUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
7393
|
+
var isInit,
|
|
7394
|
+
targetWindow,
|
|
7395
|
+
_args3 = arguments;
|
|
7396
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
7397
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
7398
|
+
case 0:
|
|
7399
|
+
isInit = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
|
|
7400
|
+
_context3.prev = 1;
|
|
7401
|
+
_context3.next = 4;
|
|
7402
|
+
return this.getTargetWindow();
|
|
7403
|
+
case 4:
|
|
7404
|
+
targetWindow = _context3.sent;
|
|
7405
|
+
postRobot.send(targetWindow, this.getPostRobotEventName(this.channelId), _objectSpread({
|
|
7406
|
+
context: this.contextData
|
|
7407
|
+
}, isInit && {
|
|
7408
|
+
type: 'init'
|
|
7409
|
+
}));
|
|
7410
|
+
_context3.next = 11;
|
|
7411
|
+
break;
|
|
7412
|
+
case 8:
|
|
7413
|
+
_context3.prev = 8;
|
|
7414
|
+
_context3.t0 = _context3["catch"](1);
|
|
7415
|
+
// Silently ignore any errors during context update
|
|
7416
|
+
console.debug('Failed to send context update:', _context3.t0);
|
|
7417
|
+
case 11:
|
|
7418
|
+
case "end":
|
|
7419
|
+
return _context3.stop();
|
|
7420
|
+
}
|
|
7421
|
+
}, _callee3, this, [[1, 8]]);
|
|
7422
|
+
}));
|
|
7423
|
+
function sendContextUpdate() {
|
|
7424
|
+
return _sendContextUpdate.apply(this, arguments);
|
|
7425
|
+
}
|
|
7426
|
+
return sendContextUpdate;
|
|
7427
|
+
}()
|
|
7428
|
+
}, {
|
|
7429
|
+
key: "getContext",
|
|
7430
|
+
value: function getContext() {
|
|
7431
|
+
return this.contextData;
|
|
7432
|
+
}
|
|
7433
|
+
}, {
|
|
7434
|
+
key: "setContext",
|
|
7435
|
+
value: function () {
|
|
7436
|
+
var _setContext = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(context) {
|
|
7437
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
7438
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
7439
|
+
case 0:
|
|
7440
|
+
this.setContextAndNotify(context);
|
|
7441
|
+
_context4.next = 3;
|
|
7442
|
+
return this.sendContextUpdate();
|
|
7443
|
+
case 3:
|
|
7444
|
+
case "end":
|
|
7445
|
+
return _context4.stop();
|
|
7446
|
+
}
|
|
7447
|
+
}, _callee4, this);
|
|
7448
|
+
}));
|
|
7449
|
+
function setContext(_x) {
|
|
7450
|
+
return _setContext.apply(this, arguments);
|
|
7451
|
+
}
|
|
7452
|
+
return setContext;
|
|
7453
|
+
}()
|
|
7454
|
+
}, {
|
|
7455
|
+
key: "subscribeToChanges",
|
|
7456
|
+
value: function subscribeToChanges(idOrContextListener, contextListenerOrNothing) {
|
|
7457
|
+
var id = typeof idOrContextListener === 'string' ? idOrContextListener : (0, _uuid.v4)();
|
|
7458
|
+
var contextListener = typeof idOrContextListener === 'function' ? idOrContextListener : contextListenerOrNothing;
|
|
7459
|
+
if (!contextListener) {
|
|
7460
|
+
var error = new Error('Context listener is required');
|
|
7461
|
+
throw error;
|
|
7462
|
+
}
|
|
7463
|
+
this.listeners[id] = contextListener;
|
|
7464
|
+
return id;
|
|
7465
|
+
}
|
|
7466
|
+
}, {
|
|
7467
|
+
key: "unsubscribeFromChanges",
|
|
7468
|
+
value: function unsubscribeFromChanges(id) {
|
|
7469
|
+
delete this.listeners[id];
|
|
7470
|
+
}
|
|
7471
|
+
}, {
|
|
7472
|
+
key: "addContextListener",
|
|
7473
|
+
value: function addContextListener(LiveContextAPItoConnect) {
|
|
7474
|
+
var _this4 = this;
|
|
7475
|
+
var mapContext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (context) {
|
|
7476
|
+
return context;
|
|
7477
|
+
};
|
|
7478
|
+
// Merge the new context with existing context
|
|
7479
|
+
this.setContext(function (currentContext) {
|
|
7480
|
+
return _objectSpread(_objectSpread({}, currentContext), mapContext(LiveContextAPItoConnect.getContext()));
|
|
7481
|
+
});
|
|
7482
|
+
// Subscribe to changes if id is provided
|
|
7483
|
+
var subscriptionId = this.getConnectId(LiveContextAPItoConnect);
|
|
7484
|
+
LiveContextAPItoConnect.subscribeToChanges(subscriptionId, function (updatedContext) {
|
|
7485
|
+
_this4.setContext(function (currentContext) {
|
|
7486
|
+
return _objectSpread(_objectSpread({}, currentContext), mapContext(updatedContext));
|
|
7487
|
+
});
|
|
7488
|
+
});
|
|
7489
|
+
// Return a callback function that unsubscribes
|
|
7490
|
+
return function () {
|
|
7491
|
+
return _this4.unsubscribeFromChanges(subscriptionId);
|
|
7492
|
+
};
|
|
7493
|
+
}
|
|
7494
|
+
}, {
|
|
7495
|
+
key: "removeContextListener",
|
|
7496
|
+
value: function removeContextListener(idOrContextAPI) {
|
|
7497
|
+
var id = typeof idOrContextAPI === 'string' ? idOrContextAPI : this.getConnectId(idOrContextAPI);
|
|
7498
|
+
this.unsubscribeFromChanges(id);
|
|
7499
|
+
}
|
|
7500
|
+
}, {
|
|
7501
|
+
key: "connect",
|
|
7502
|
+
value: function connect() {
|
|
7503
|
+
var channelId = this.channelId;
|
|
7504
|
+
this.connectPostRobot();
|
|
7505
|
+
return channelId;
|
|
7506
|
+
}
|
|
7507
|
+
}, {
|
|
7508
|
+
key: "destroy",
|
|
7509
|
+
value: function destroy() {
|
|
7510
|
+
var _this$postRobotListen;
|
|
7511
|
+
(_this$postRobotListen = this.postRobotListener) === null || _this$postRobotListen === void 0 || _this$postRobotListen.cancel();
|
|
7512
|
+
}
|
|
7513
|
+
}]);
|
|
7514
|
+
}();
|
|
7515
|
+
|
|
7516
|
+
},{"post-robot":5,"uuid":6}],41:[function(require,module,exports){
|
|
7138
7517
|
"use strict";
|
|
7139
7518
|
|
|
7140
7519
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7169,7 +7548,7 @@ var makeProxy = exports.makeProxy = function makeProxy(obj) {
|
|
|
7169
7548
|
return proxyObj;
|
|
7170
7549
|
};
|
|
7171
7550
|
|
|
7172
|
-
},{}],
|
|
7551
|
+
},{}],42:[function(require,module,exports){
|
|
7173
7552
|
"use strict";
|
|
7174
7553
|
|
|
7175
7554
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -7222,7 +7601,7 @@ var getOrCreateUsersPrivateWorkspaceRecord = exports.getOrCreateUsersPrivateWork
|
|
|
7222
7601
|
};
|
|
7223
7602
|
}();
|
|
7224
7603
|
|
|
7225
|
-
},{"uuid":6}],
|
|
7604
|
+
},{"uuid":6}],43:[function(require,module,exports){
|
|
7226
7605
|
"use strict";
|
|
7227
7606
|
|
|
7228
7607
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7247,14 +7626,14 @@ var ONTOLOGY_PERMISSION_GROUP = exports.ONTOLOGY_PERMISSION_GROUP = 'octostar:on
|
|
|
7247
7626
|
var ALL_PERMISSIONS = exports.ALL_PERMISSIONS = 'all';
|
|
7248
7627
|
var ALL_PERMISSIONS_ARRAY = exports.ALL_PERMISSIONS_ARRAY = [ALL_PERMISSIONS];
|
|
7249
7628
|
|
|
7250
|
-
},{}],
|
|
7629
|
+
},{}],44:[function(require,module,exports){
|
|
7251
7630
|
"use strict";
|
|
7252
7631
|
|
|
7253
7632
|
Object.defineProperty(exports, "__esModule", {
|
|
7254
7633
|
value: true
|
|
7255
7634
|
});
|
|
7256
7635
|
|
|
7257
|
-
},{}],
|
|
7636
|
+
},{}],45:[function(require,module,exports){
|
|
7258
7637
|
"use strict";
|
|
7259
7638
|
|
|
7260
7639
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octostar/platform-api",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.21",
|
|
4
4
|
"description": "Provides access to the API exposed by Octostar platform to an application run in an iframe",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"octostar",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"module": "dist/index.js",
|
|
29
29
|
"types": "dist/index.d.ts",
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@types/post-robot": "^10.0.6",
|
|
31
32
|
"@types/uuid": "^9.0.2",
|
|
32
33
|
"post-robot": "^10.0.46",
|
|
33
34
|
"uuid": "^9.0.0"
|
|
@@ -38,10 +39,10 @@
|
|
|
38
39
|
"rimraf": "^5.0.5",
|
|
39
40
|
"tsup": "^8.4.0",
|
|
40
41
|
"typescript": "^5.8.2",
|
|
41
|
-
"@octostar/platform-types": "0.5.
|
|
42
|
+
"@octostar/platform-types": "0.5.24"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"@octostar/platform-types": "^0.5.
|
|
45
|
+
"@octostar/platform-types": "^0.5.24"
|
|
45
46
|
},
|
|
46
47
|
"publishConfig": {
|
|
47
48
|
"access": "public"
|