@octostar/platform-api 0.5.17 → 0.5.19
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/apis.d.ts +4 -4
- package/dist/apis.d.ts.map +1 -1
- package/dist/apis.js.map +1 -1
- package/dist/factory.js +1 -1
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/FilesAPIImpl.d.ts +8 -0
- package/dist/lib/FilesAPIImpl.d.ts.map +1 -0
- package/dist/lib/FilesAPIImpl.js +38 -0
- package/dist/lib/FilesAPIImpl.js.map +1 -0
- package/dist/octostar-platform-api.js +10 -254
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -4
- package/dist/lib/ContextAPI.d.ts +0 -32
- package/dist/lib/ContextAPI.d.ts.map +0 -1
- package/dist/lib/ContextAPI.js +0 -92
- package/dist/lib/ContextAPI.js.map +0 -1
- package/dist/lib/classInstanceToObject.d.ts +0 -12
- package/dist/lib/classInstanceToObject.d.ts.map +0 -1
- package/dist/lib/classInstanceToObject.js +0 -48
- package/dist/lib/classInstanceToObject.js.map +0 -1
package/dist/apis.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Desktop, Ontology, ExtrasApi, RemoteAppApi, SavedSearchAPIInterface
|
|
2
|
-
import { EnsureMethodsReturnPromise } from './types';
|
|
1
|
+
import { Desktop, Ontology, ExtrasApi, RemoteAppApi, SavedSearchAPIInterface } from '@octostar/platform-types';
|
|
2
|
+
import { ContextApi, EnsureMethodsReturnPromise } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* @beta
|
|
5
5
|
* Provides access to the desktop API.
|
|
@@ -20,7 +20,7 @@ export declare const ontologyApi: () => EnsureMethodsReturnPromise<Ontology>;
|
|
|
20
20
|
* Provides access to the context API.
|
|
21
21
|
* For asynchronous access, use {@link getContextApi}.
|
|
22
22
|
*/
|
|
23
|
-
export declare const contextApi: () => EnsureMethodsReturnPromise<
|
|
23
|
+
export declare const contextApi: () => EnsureMethodsReturnPromise<ContextApi<unknown>>;
|
|
24
24
|
/**
|
|
25
25
|
* @beta
|
|
26
26
|
* Get the desktop API asynchronously.
|
|
@@ -35,5 +35,5 @@ export declare const getOntologyApi: () => Promise<EnsureMethodsReturnPromise<On
|
|
|
35
35
|
* @beta
|
|
36
36
|
* Get the context API asynchronously.
|
|
37
37
|
*/
|
|
38
|
-
export declare const getContextApi: () => Promise<EnsureMethodsReturnPromise<
|
|
38
|
+
export declare const getContextApi: () => Promise<EnsureMethodsReturnPromise<ContextApi<unknown>>>;
|
|
39
39
|
//# sourceMappingURL=apis.d.ts.map
|
package/dist/apis.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,uBAAuB,
|
|
1
|
+
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAsCjE;;;;GAIG;AACH,eAAO,MAAM,UAAU,2CACwC,CAAC;AAEhE,eAAO,MAAM,SAAS,6CACwC,CAAC;AAE/D,eAAO,MAAM,YAAY,gDACwC,CAAC;AAElE,eAAO,MAAM,cAAc,2DACwC,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,WAAW,4CACwC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,UAAU,uDACwC,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,aAAa,oDACoB,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,cAAc,qDACqB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,aAAa,gEACoB,CAAC"}
|
package/dist/apis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../src/apis.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAE9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,WAAW,GAAG,mBAAmB,CAAC,WAAW,CAAC,cAAc,EAAE;IAClE,KAAK,EAAE,KAAK;CACb,CAAC;KACC,eAAe,CAAC,SAAS,EAAE,GAAG,EAAE,CAC/B,qBAAqB,CAAsC;IACzD,IAAI,EAAE,QAAQ,CAAC,OAAO;CACvB,CAAC,CACH;KACA,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,CAChC,qBAAqB,CAAuC;IAC1D,IAAI,EAAE,QAAQ,CAAC,QAAQ;CACxB,CAAC,CACH;KACA,eAAe,CAAC,SAAS,EAAE,GAAG,EAAE;AAC/B,uCAAuC;AACvC,qBAAqB,CAAkD;IACrE,IAAI,EAAE,QAAQ,CAAC,OAAO;CACvB,CAAC,CACH;KACA,eAAe,CAAC,QAAQ,EAAE,GAAG,EAAE,CAC9B,qBAAqB,CAAwC;IAC3D,IAAI,EAAE,QAAQ,CAAC,MAAM;CACtB,CAAC,CACH;KACA,eAAe,CAAC,WAAW,EAAE,GAAG,EAAE,CACjC,qBAAqB,CAA2C;IAC9D,IAAI,EAAE,QAAQ,CAAC,SAAS;CACzB,CAAC,CACH;KACA,eAAe,CAAC,aAAa,EAAE,GAAG,E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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AAMnC,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,aAAa,CAAC;IACvB,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1B,IACE,MAAM,CAAC,YAAY,CAAC,sBAAsB,CAAC,KAAK,MAAM;YACtD,MAAM,CAAC,YAAY,CAAC,8BAA8B,CAAC,KAAK,SAAS,EACjE,CAAC;YACD,OAAO,aAAa,CAAC;QACvB,CAAC;IACH,CAAC;IACD,wCAAwC;IACxC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CACX,+GAA+G,CAChH,CAAC;QACF,uCAAuC;QACvC,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,gDA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AAE,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
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,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
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,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Files, FileListOptions, FileListResponse, OsAPIClient, WorkspaceItem } from '@octostar/platform-types';
|
|
2
|
+
export declare class FilesAPIImpl implements Files {
|
|
3
|
+
private osAPIClient;
|
|
4
|
+
constructor(osAPIClient: OsAPIClient);
|
|
5
|
+
stat(os_workspace: string, path?: string): Promise<WorkspaceItem>;
|
|
6
|
+
list_folder(os_workspace: string, path?: string, options?: FileListOptions): Promise<FileListResponse>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=FilesAPIImpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilesAPIImpl.d.ts","sourceRoot":"","sources":["../../src/lib/FilesAPIImpl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,aAAa,EAEd,MAAM,0BAA0B,CAAC;AAElC,qBAAa,YAAa,YAAW,KAAK;IACxC,OAAO,CAAC,WAAW,CAAc;gBAErB,WAAW,EAAE,WAAW;IAI9B,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAajE,WAAW,CACf,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,gBAAgB,CAAC;CAuB7B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export class FilesAPIImpl {
|
|
2
|
+
constructor(osAPIClient) {
|
|
3
|
+
this.osAPIClient = osAPIClient;
|
|
4
|
+
}
|
|
5
|
+
async stat(os_workspace, path) {
|
|
6
|
+
const url = path
|
|
7
|
+
? `/api/v1/files/stat/${os_workspace}/${encodeURIComponent(path)}`
|
|
8
|
+
: `/api/v1/files/stat/${os_workspace}`;
|
|
9
|
+
return this.osAPIClient.fetchData({
|
|
10
|
+
endpoint: url,
|
|
11
|
+
method: 'GET',
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async list_folder(os_workspace, path, options) {
|
|
18
|
+
const params = new URLSearchParams();
|
|
19
|
+
if (options?.maxFolders !== undefined)
|
|
20
|
+
params.append('max_folders', String(options.maxFolders));
|
|
21
|
+
if (options?.maxFiles !== undefined)
|
|
22
|
+
params.append('max_files', String(options.maxFiles));
|
|
23
|
+
if (options?.folderOffset !== undefined)
|
|
24
|
+
params.append('folder_offset', String(options.folderOffset));
|
|
25
|
+
if (options?.fileOffset !== undefined)
|
|
26
|
+
params.append('file_offset', String(options.fileOffset));
|
|
27
|
+
const queryString = params.toString();
|
|
28
|
+
const url = `/api/v1/files/list/${os_workspace}/${path}${queryString ? `?${queryString}` : ''}`;
|
|
29
|
+
return this.osAPIClient.fetchData({
|
|
30
|
+
endpoint: url,
|
|
31
|
+
method: 'GET',
|
|
32
|
+
headers: {
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=FilesAPIImpl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilesA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tC,MAAM,GAAG,GAAG,sBAAsB,YAAY,IAAI,IAAI,GACpD,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EACpC,EAAE,CAAC;QACH,OAAO,IAAI,CAAC,WAAW,CAAC,SAAS,CAAmB;YAClD,QAAQ,EAAE,GAAG;YACb,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAC;IACL,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 = _interopRequireDefault(require("post-robot"));
|
|
6484
6484
|
var _utils = require("./utils");
|
|
6485
6485
|
var _constants = require("./constants");
|
|
6486
|
-
function
|
|
6486
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
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["default"].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":43,"post-robot":5}],35:[function(require,module,exports){
|
|
6688
6688
|
"use strict";
|
|
6689
6689
|
|
|
6690
6690
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6800,30 +6800,8 @@ Object.keys(_userWorkspace).forEach(function (key) {
|
|
|
6800
6800
|
}
|
|
6801
6801
|
});
|
|
6802
6802
|
});
|
|
6803
|
-
var _ContextAPI = require("./lib/ContextAPI");
|
|
6804
|
-
Object.keys(_ContextAPI).forEach(function (key) {
|
|
6805
|
-
if (key === "default" || key === "__esModule") return;
|
|
6806
|
-
if (key in exports && exports[key] === _ContextAPI[key]) return;
|
|
6807
|
-
Object.defineProperty(exports, key, {
|
|
6808
|
-
enumerable: true,
|
|
6809
|
-
get: function get() {
|
|
6810
|
-
return _ContextAPI[key];
|
|
6811
|
-
}
|
|
6812
|
-
});
|
|
6813
|
-
});
|
|
6814
|
-
var _classInstanceToObject = require("./lib/classInstanceToObject");
|
|
6815
|
-
Object.keys(_classInstanceToObject).forEach(function (key) {
|
|
6816
|
-
if (key === "default" || key === "__esModule") return;
|
|
6817
|
-
if (key in exports && exports[key] === _classInstanceToObject[key]) return;
|
|
6818
|
-
Object.defineProperty(exports, key, {
|
|
6819
|
-
enumerable: true,
|
|
6820
|
-
get: function get() {
|
|
6821
|
-
return _classInstanceToObject[key];
|
|
6822
|
-
}
|
|
6823
|
-
});
|
|
6824
|
-
});
|
|
6825
6803
|
|
|
6826
|
-
},{"./apis":22,"./components":32,"./constants":33,"./lib/AIClientImpl":36,"./lib/
|
|
6804
|
+
},{"./apis":22,"./components":32,"./constants":33,"./lib/AIClientImpl":36,"./lib/JWTProvider":38,"./lib/Proxy":39,"./lib/userWorkspace":40,"./permissions":41,"./types":42,"./utils":43}],36:[function(require,module,exports){
|
|
6827
6805
|
"use strict";
|
|
6828
6806
|
|
|
6829
6807
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7073,166 +7051,6 @@ AsyncServiceLocator.instances = {};
|
|
|
7073
7051
|
},{}],38:[function(require,module,exports){
|
|
7074
7052
|
"use strict";
|
|
7075
7053
|
|
|
7076
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7077
|
-
value: true
|
|
7078
|
-
});
|
|
7079
|
-
exports.ContextAPI = void 0;
|
|
7080
|
-
var _uuid = require("uuid");
|
|
7081
|
-
var postRobot = _interopRequireWildcard(require("post-robot"));
|
|
7082
|
-
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); }
|
|
7083
|
-
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); }
|
|
7084
|
-
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; }
|
|
7085
|
-
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); }
|
|
7086
|
-
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); }); }; }
|
|
7087
|
-
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; }
|
|
7088
|
-
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; }
|
|
7089
|
-
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; }
|
|
7090
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7091
|
-
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); } }
|
|
7092
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7093
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7094
|
-
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); }
|
|
7095
|
-
var ContextAPI = exports.ContextAPI = /*#__PURE__*/function () {
|
|
7096
|
-
function ContextAPI(_ref) {
|
|
7097
|
-
var targetWindow = _ref.targetWindow,
|
|
7098
|
-
contextData = _ref.contextData,
|
|
7099
|
-
channelId = _ref.channelId;
|
|
7100
|
-
_classCallCheck(this, ContextAPI);
|
|
7101
|
-
this.contextData = contextData;
|
|
7102
|
-
this.listeners = {};
|
|
7103
|
-
this.id = (0, _uuid.v4)();
|
|
7104
|
-
this.targetWindow = targetWindow;
|
|
7105
|
-
this.channelId = channelId;
|
|
7106
|
-
}
|
|
7107
|
-
return _createClass(ContextAPI, [{
|
|
7108
|
-
key: "targetWindow",
|
|
7109
|
-
get: function get() {
|
|
7110
|
-
return this.internalTargetWindow;
|
|
7111
|
-
},
|
|
7112
|
-
set: function set(targetWindow) {
|
|
7113
|
-
this.internalTargetWindow = targetWindow;
|
|
7114
|
-
this.syncContextToChannel('get-context');
|
|
7115
|
-
}
|
|
7116
|
-
}, {
|
|
7117
|
-
key: "channelId",
|
|
7118
|
-
get: function get() {
|
|
7119
|
-
return this.internalChannelId;
|
|
7120
|
-
},
|
|
7121
|
-
set: function set(channelId) {
|
|
7122
|
-
this.internalChannelId = channelId;
|
|
7123
|
-
if (channelId) {
|
|
7124
|
-
this.postRobotEventId = "context-api-update::".concat(channelId);
|
|
7125
|
-
this.listenToPostRobot();
|
|
7126
|
-
this.syncContextToChannel('get-context');
|
|
7127
|
-
}
|
|
7128
|
-
}
|
|
7129
|
-
}, {
|
|
7130
|
-
key: "listenToPostRobot",
|
|
7131
|
-
value: function listenToPostRobot() {
|
|
7132
|
-
var _this = this;
|
|
7133
|
-
if (!this.postRobotEventId) {
|
|
7134
|
-
return;
|
|
7135
|
-
}
|
|
7136
|
-
if (this.postRobotListener) {
|
|
7137
|
-
this.postRobotListener.cancel();
|
|
7138
|
-
}
|
|
7139
|
-
this.postRobotListener = postRobot.on(this.postRobotEventId, function (event) {
|
|
7140
|
-
if (event.data.from !== _this.id) {
|
|
7141
|
-
_this.contextData = _objectSpread(_objectSpread({}, _this.contextData), event.data.contextData);
|
|
7142
|
-
_this.notifyListeners();
|
|
7143
|
-
}
|
|
7144
|
-
return Promise.resolve();
|
|
7145
|
-
});
|
|
7146
|
-
}
|
|
7147
|
-
}, {
|
|
7148
|
-
key: "context",
|
|
7149
|
-
get: function get() {
|
|
7150
|
-
return this.contextData;
|
|
7151
|
-
},
|
|
7152
|
-
set: function set(context) {
|
|
7153
|
-
this.contextData = context;
|
|
7154
|
-
this.notifyListeners();
|
|
7155
|
-
this.syncContextToChannel();
|
|
7156
|
-
}
|
|
7157
|
-
}, {
|
|
7158
|
-
key: "getContext",
|
|
7159
|
-
value: function getContext() {
|
|
7160
|
-
return this.context;
|
|
7161
|
-
}
|
|
7162
|
-
}, {
|
|
7163
|
-
key: "setContext",
|
|
7164
|
-
value: function setContext(context) {
|
|
7165
|
-
this.context = typeof context === 'function' ? context(this.context) : context;
|
|
7166
|
-
}
|
|
7167
|
-
}, {
|
|
7168
|
-
key: "notifyListeners",
|
|
7169
|
-
value: function notifyListeners() {
|
|
7170
|
-
var _this2 = this;
|
|
7171
|
-
Object.values(this.listeners).forEach(function (listener) {
|
|
7172
|
-
return listener(_this2.context);
|
|
7173
|
-
});
|
|
7174
|
-
}
|
|
7175
|
-
}, {
|
|
7176
|
-
key: "syncContextToChannel",
|
|
7177
|
-
value: function () {
|
|
7178
|
-
var _syncContextToChannel = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7179
|
-
var type,
|
|
7180
|
-
_args = arguments;
|
|
7181
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7182
|
-
while (1) switch (_context.prev = _context.next) {
|
|
7183
|
-
case 0:
|
|
7184
|
-
type = _args.length > 0 && _args[0] !== undefined ? _args[0] : 'update-context';
|
|
7185
|
-
if (!(!this.targetWindow || !this.postRobotEventId)) {
|
|
7186
|
-
_context.next = 3;
|
|
7187
|
-
break;
|
|
7188
|
-
}
|
|
7189
|
-
return _context.abrupt("return");
|
|
7190
|
-
case 3:
|
|
7191
|
-
_context.next = 5;
|
|
7192
|
-
return postRobot.send(this.targetWindow, this.postRobotEventId, {
|
|
7193
|
-
from: this.id,
|
|
7194
|
-
type: type,
|
|
7195
|
-
context: this.context
|
|
7196
|
-
});
|
|
7197
|
-
case 5:
|
|
7198
|
-
case "end":
|
|
7199
|
-
return _context.stop();
|
|
7200
|
-
}
|
|
7201
|
-
}, _callee, this);
|
|
7202
|
-
}));
|
|
7203
|
-
function syncContextToChannel() {
|
|
7204
|
-
return _syncContextToChannel.apply(this, arguments);
|
|
7205
|
-
}
|
|
7206
|
-
return syncContextToChannel;
|
|
7207
|
-
}()
|
|
7208
|
-
}, {
|
|
7209
|
-
key: "subscribeToChanges",
|
|
7210
|
-
value: function subscribeToChanges(idOrContextListener, contextListenerOrNothing) {
|
|
7211
|
-
var id = typeof idOrContextListener === 'string' ? idOrContextListener : (0, _uuid.v4)();
|
|
7212
|
-
var contextListener = typeof idOrContextListener === 'function' ? idOrContextListener : contextListenerOrNothing;
|
|
7213
|
-
if (!contextListener) {
|
|
7214
|
-
throw new Error('Context listener is required');
|
|
7215
|
-
}
|
|
7216
|
-
this.listeners[id] = contextListener;
|
|
7217
|
-
return id;
|
|
7218
|
-
}
|
|
7219
|
-
}, {
|
|
7220
|
-
key: "unsubscribeFromChanges",
|
|
7221
|
-
value: function unsubscribeFromChanges(id) {
|
|
7222
|
-
delete this.listeners[id];
|
|
7223
|
-
}
|
|
7224
|
-
}, {
|
|
7225
|
-
key: "destroy",
|
|
7226
|
-
value: function destroy() {
|
|
7227
|
-
var _this$postRobotListen;
|
|
7228
|
-
(_this$postRobotListen = this.postRobotListener) === null || _this$postRobotListen === void 0 || _this$postRobotListen.cancel();
|
|
7229
|
-
}
|
|
7230
|
-
}]);
|
|
7231
|
-
}();
|
|
7232
|
-
|
|
7233
|
-
},{"post-robot":5,"uuid":6}],39:[function(require,module,exports){
|
|
7234
|
-
"use strict";
|
|
7235
|
-
|
|
7236
7054
|
Object.defineProperty(exports, "__esModule", {
|
|
7237
7055
|
value: true
|
|
7238
7056
|
});
|
|
@@ -7316,7 +7134,7 @@ var JWTProvider = exports.JWTProvider = /*#__PURE__*/function () {
|
|
|
7316
7134
|
}]);
|
|
7317
7135
|
}();
|
|
7318
7136
|
|
|
7319
|
-
},{}],
|
|
7137
|
+
},{}],39:[function(require,module,exports){
|
|
7320
7138
|
"use strict";
|
|
7321
7139
|
|
|
7322
7140
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7351,69 +7169,7 @@ var makeProxy = exports.makeProxy = function makeProxy(obj) {
|
|
|
7351
7169
|
return proxyObj;
|
|
7352
7170
|
};
|
|
7353
7171
|
|
|
7354
|
-
},{}],
|
|
7355
|
-
"use strict";
|
|
7356
|
-
|
|
7357
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7358
|
-
value: true
|
|
7359
|
-
});
|
|
7360
|
-
exports.classInstanceToObject = void 0;
|
|
7361
|
-
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); }
|
|
7362
|
-
// Check if an object contains functions deeply
|
|
7363
|
-
var containsDeepFunction = function containsDeepFunction(obj) {
|
|
7364
|
-
if (obj === null || obj === undefined) {
|
|
7365
|
-
return false;
|
|
7366
|
-
}
|
|
7367
|
-
if (typeof obj === 'function') {
|
|
7368
|
-
return true;
|
|
7369
|
-
}
|
|
7370
|
-
if (_typeof(obj) !== 'object') {
|
|
7371
|
-
return false;
|
|
7372
|
-
}
|
|
7373
|
-
if (Array.isArray(obj)) {
|
|
7374
|
-
return obj.some(function (item) {
|
|
7375
|
-
return containsDeepFunction(item);
|
|
7376
|
-
});
|
|
7377
|
-
}
|
|
7378
|
-
return Object.values(obj).some(function (value) {
|
|
7379
|
-
return containsDeepFunction(value);
|
|
7380
|
-
});
|
|
7381
|
-
};
|
|
7382
|
-
var classInstanceToObject = exports.classInstanceToObject = function classInstanceToObject(instance, options) {
|
|
7383
|
-
// Handle null or undefined
|
|
7384
|
-
if (instance === null || instance === undefined) {
|
|
7385
|
-
return instance;
|
|
7386
|
-
}
|
|
7387
|
-
// Handle primitive values
|
|
7388
|
-
if (_typeof(instance) !== 'object' || instance instanceof Date) {
|
|
7389
|
-
return instance;
|
|
7390
|
-
}
|
|
7391
|
-
// Handle arrays
|
|
7392
|
-
if (Array.isArray(instance)) {
|
|
7393
|
-
return instance.map(function (item) {
|
|
7394
|
-
return classInstanceToObject(item, options);
|
|
7395
|
-
});
|
|
7396
|
-
}
|
|
7397
|
-
// Handle objects
|
|
7398
|
-
var obj = {};
|
|
7399
|
-
// Get all own properties (data properties, not methods)
|
|
7400
|
-
Object.keys(instance).forEach(function (key) {
|
|
7401
|
-
var value = instance[key];
|
|
7402
|
-
// Skip functions directly
|
|
7403
|
-
if (typeof value === 'function') {
|
|
7404
|
-
return;
|
|
7405
|
-
}
|
|
7406
|
-
// Skip properties that contain functions deeply
|
|
7407
|
-
if (_typeof(value) === 'object' && value !== null && containsDeepFunction(value)) {
|
|
7408
|
-
return;
|
|
7409
|
-
}
|
|
7410
|
-
// Recursively convert nested objects
|
|
7411
|
-
obj[key] = classInstanceToObject(value, options);
|
|
7412
|
-
});
|
|
7413
|
-
return obj;
|
|
7414
|
-
};
|
|
7415
|
-
|
|
7416
|
-
},{}],42:[function(require,module,exports){
|
|
7172
|
+
},{}],40:[function(require,module,exports){
|
|
7417
7173
|
"use strict";
|
|
7418
7174
|
|
|
7419
7175
|
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); }
|
|
@@ -7466,7 +7222,7 @@ var getOrCreateUsersPrivateWorkspaceRecord = exports.getOrCreateUsersPrivateWork
|
|
|
7466
7222
|
};
|
|
7467
7223
|
}();
|
|
7468
7224
|
|
|
7469
|
-
},{"uuid":6}],
|
|
7225
|
+
},{"uuid":6}],41:[function(require,module,exports){
|
|
7470
7226
|
"use strict";
|
|
7471
7227
|
|
|
7472
7228
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7491,14 +7247,14 @@ var ONTOLOGY_PERMISSION_GROUP = exports.ONTOLOGY_PERMISSION_GROUP = 'octostar:on
|
|
|
7491
7247
|
var ALL_PERMISSIONS = exports.ALL_PERMISSIONS = 'all';
|
|
7492
7248
|
var ALL_PERMISSIONS_ARRAY = exports.ALL_PERMISSIONS_ARRAY = [ALL_PERMISSIONS];
|
|
7493
7249
|
|
|
7494
|
-
},{}],
|
|
7250
|
+
},{}],42:[function(require,module,exports){
|
|
7495
7251
|
"use strict";
|
|
7496
7252
|
|
|
7497
7253
|
Object.defineProperty(exports, "__esModule", {
|
|
7498
7254
|
value: true
|
|
7499
7255
|
});
|
|
7500
7256
|
|
|
7501
|
-
},{}],
|
|
7257
|
+
},{}],43:[function(require,module,exports){
|
|
7502
7258
|
"use strict";
|
|
7503
7259
|
|
|
7504
7260
|
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/dist/types.d.ts
CHANGED
|
@@ -62,5 +62,19 @@ export type RemoteApiError = Error & {
|
|
|
62
62
|
export type EnsureMethodsReturnPromise<T> = {
|
|
63
63
|
[K in keyof T]: T[K] extends (...args: any[]) => any ? (...args: Parameters<T[K]>) => Promise<Awaited<ReturnType<T[K]>>> : T[K];
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* @beta
|
|
67
|
+
* Type representing a context listener.
|
|
68
|
+
*/
|
|
69
|
+
export type ContextListener<T> = (context: T) => void;
|
|
70
|
+
/**
|
|
71
|
+
* @beta
|
|
72
|
+
* Type representing the context API.
|
|
73
|
+
*/
|
|
74
|
+
export type ContextApi<T> = {
|
|
75
|
+
getContext: () => Promise<T>;
|
|
76
|
+
subscribeToChanges: (id: string | ContextListener<T>, callback?: ContextListener<T>) => Promise<void>;
|
|
77
|
+
unsubscribeFromChanges: (id: string) => Promise<void>;
|
|
78
|
+
};
|
|
65
79
|
export {};
|
|
66
80
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,IAAI;IAC1C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI;IAC3C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9E,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI;IACnC,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,CAC5D,IAAI,EACJ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,0BAA0B,CAAC,CAAC,IAAI,uBAAuB,CAAC,CAAC,E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/B,QAAQ,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,KAC1B,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,sBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD,CAAC"}
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AA+FA,yCAAyC;AACzC,mBAAmB;AACnB,gCAAgC;AAChC,yCAAyC;AACzC,cAAc;AACd,qBAAqB;AACrB,kCAAkC;AAClC,2CAA2C;AAC3C,OAAO;AACP,MAAM;AAEN,sBAAsB;AACtB,EAAE;AACF,6BAA6B;AAC7B,wBAAwB;AACxB,wBAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octostar/platform-api",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.19",
|
|
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",
|
|
@@ -33,16 +33,15 @@
|
|
|
33
33
|
"uuid": "^9.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/post-robot": "^10.0.6",
|
|
37
36
|
"babelify": "^10.0.0",
|
|
38
37
|
"browserify": "^17.0.0",
|
|
39
38
|
"rimraf": "^5.0.5",
|
|
40
39
|
"tsup": "^8.4.0",
|
|
41
40
|
"typescript": "^5.8.2",
|
|
42
|
-
"@octostar/platform-types": "0.5.
|
|
41
|
+
"@octostar/platform-types": "0.5.23"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
|
-
"@octostar/platform-types": "^0.5.
|
|
44
|
+
"@octostar/platform-types": "^0.5.23"
|
|
46
45
|
},
|
|
47
46
|
"publishConfig": {
|
|
48
47
|
"access": "public"
|
package/dist/lib/ContextAPI.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Context, ContextAPISetParams, ContextListener } from '@octostar/platform-types';
|
|
2
|
-
export type ContextAPIConstructorParams<ContextData extends Record<string, any>> = {
|
|
3
|
-
contextData?: ContextData;
|
|
4
|
-
targetWindow?: Window;
|
|
5
|
-
channelId?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare class ContextAPI<ContextData extends Record<string, any>> implements Context<ContextData> {
|
|
8
|
-
private contextData?;
|
|
9
|
-
private internalTargetWindow;
|
|
10
|
-
readonly id: string;
|
|
11
|
-
private listeners;
|
|
12
|
-
private postRobotListener;
|
|
13
|
-
private internalChannelId;
|
|
14
|
-
private postRobotEventId;
|
|
15
|
-
constructor({ targetWindow, contextData, channelId, }: ContextAPIConstructorParams<ContextData>);
|
|
16
|
-
get targetWindow(): Window | undefined;
|
|
17
|
-
set targetWindow(targetWindow: Window | undefined);
|
|
18
|
-
get channelId(): string | undefined;
|
|
19
|
-
set channelId(channelId: string | undefined);
|
|
20
|
-
listenToPostRobot(): void;
|
|
21
|
-
get context(): ContextData | undefined;
|
|
22
|
-
set context(context: ContextData | undefined);
|
|
23
|
-
getContext(): ContextData | undefined;
|
|
24
|
-
setContext(context: ContextAPISetParams<ContextData>): void;
|
|
25
|
-
notifyListeners(): void;
|
|
26
|
-
syncContextToChannel(type?: 'update-context' | 'get-context'): Promise<void>;
|
|
27
|
-
subscribeToChanges(contextListener: ContextListener<ContextData>): string;
|
|
28
|
-
subscribeToChanges(id: string, contextListener: ContextListener<ContextData>): string;
|
|
29
|
-
unsubscribeFromChanges(id: string): void;
|
|
30
|
-
destroy(): void;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=ContextAPI.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextAPI.d.ts","sourceRo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AAgB,GAAG,aAAgC;IAgB3D,kBAAkB,CAAC,eAAe,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG,MAAM;IAEzE,kBAAkB,CAChB,EAAE,EAAE,MAAM,EACV,eAAe,EAAE,eAAe,CAAC,WAAW,CAAC,GAC5C,MAAM;IAqBT,sBAAsB,CAAC,EAAE,EAAE,MAAM;IAIjC,OAAO;CAGR"}
|
package/dist/lib/ContextAPI.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
-
import * as postRobot from 'post-robot';
|
|
3
|
-
export class ContextAPI {
|
|
4
|
-
constructor({ targetWindow, contextData, channelId, }) {
|
|
5
|
-
this.contextData = contextData;
|
|
6
|
-
this.listeners = {};
|
|
7
|
-
this.id = uuidv4();
|
|
8
|
-
this.targetWindow = targetWindow;
|
|
9
|
-
this.channelId = channelId;
|
|
10
|
-
}
|
|
11
|
-
get targetWindow() {
|
|
12
|
-
return this.internalTargetWindow;
|
|
13
|
-
}
|
|
14
|
-
set targetWindow(targetWindow) {
|
|
15
|
-
this.internalTargetWindow = targetWindow;
|
|
16
|
-
this.syncContextToChannel('get-context');
|
|
17
|
-
}
|
|
18
|
-
get channelId() {
|
|
19
|
-
return this.internalChannelId;
|
|
20
|
-
}
|
|
21
|
-
set channelId(channelId) {
|
|
22
|
-
this.internalChannelId = channelId;
|
|
23
|
-
if (channelId) {
|
|
24
|
-
this.postRobotEventId = `context-api-update::${channelId}`;
|
|
25
|
-
this.listenToPostRobot();
|
|
26
|
-
this.syncContextToChannel('get-context');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
listenToPostRobot() {
|
|
30
|
-
if (!this.postRobotEventId) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (this.postRobotListener) {
|
|
34
|
-
this.postRobotListener.cancel();
|
|
35
|
-
}
|
|
36
|
-
this.postRobotListener = postRobot.on(this.postRobotEventId, event => {
|
|
37
|
-
if (event.data.from !== this.id) {
|
|
38
|
-
this.contextData = { ...this.contextData, ...event.data.contextData };
|
|
39
|
-
this.notifyListeners();
|
|
40
|
-
}
|
|
41
|
-
return Promise.resolve();
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
get context() {
|
|
45
|
-
return this.contextData;
|
|
46
|
-
}
|
|
47
|
-
set context(context) {
|
|
48
|
-
this.contextData = context;
|
|
49
|
-
this.notifyListeners();
|
|
50
|
-
this.syncContextToChannel();
|
|
51
|
-
}
|
|
52
|
-
getContext() {
|
|
53
|
-
return this.context;
|
|
54
|
-
}
|
|
55
|
-
setContext(context) {
|
|
56
|
-
this.context =
|
|
57
|
-
typeof context === 'function' ? context(this.context) : context;
|
|
58
|
-
}
|
|
59
|
-
notifyListeners() {
|
|
60
|
-
Object.values(this.listeners).forEach(listener => listener(this.context));
|
|
61
|
-
}
|
|
62
|
-
async syncContextToChannel(type = 'update-context') {
|
|
63
|
-
if (!this.targetWindow || !this.postRobotEventId) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
/** Try to exclude functions in the context */
|
|
67
|
-
// const context = classInstanceToObject(this.context);
|
|
68
|
-
await postRobot.send(this.targetWindow, this.postRobotEventId, {
|
|
69
|
-
from: this.id,
|
|
70
|
-
type,
|
|
71
|
-
context: this.context,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
subscribeToChanges(idOrContextListener, contextListenerOrNothing) {
|
|
75
|
-
const id = typeof idOrContextListener === 'string' ? idOrContextListener : uuidv4();
|
|
76
|
-
const contextListener = typeof idOrContextListener === 'function'
|
|
77
|
-
? idOrContextListener
|
|
78
|
-
: contextListenerOrNothing;
|
|
79
|
-
if (!contextListener) {
|
|
80
|
-
throw new Error('Context listener is required');
|
|
81
|
-
}
|
|
82
|
-
this.listeners[id] = contextListener;
|
|
83
|
-
return id;
|
|
84
|
-
}
|
|
85
|
-
unsubscribeFromChanges(id) {
|
|
86
|
-
delete this.listeners[id];
|
|
87
|
-
}
|
|
88
|
-
destroy() {
|
|
89
|
-
this.postRobotListener?.cancel();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=ContextAPI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContextAPI.js","sourceRoot":"","sources":["../../src/lib/ContextAPI.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAUxC,MAAM,OAAO,UAAU;IAiBrB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,SAAS,GACgC;QACzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED,IAAI,YAAY,CAAC,YAAgC;QAC/C,IAAI,CAAC,oBAAoB,GAAG,YAAY,CAAC;QACzC,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAI,SAAS,CAAC,SAA6B;QACzC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;QACnC,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,gBAAgB,GAAG,uBAAuB,SAAS,EAAE,CAAC;YAC3D,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,IAAI,CAAC,gBA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C,gBAAgB;QAEzD,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACjD,OAAO;QACT,CAAC;QAED,8CAA8C;QAC9C,uDAAuD;QAEvD,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,EAAE;YAC7D,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,IAAI;YACJ,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IASD,kBAAkB,CAChB,mBAA0D,EAC1D,wBAAuD;QAEvD,MAAM,EAAE,GACN,OAAO,mBAAmB,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAC3E,MAAM,eAAe,GACnB,OAAO,mBAAmB,KAAK,UAAU;YACvC,CAAC,CAAC,mBAAmB;YACrB,CAAC,CAAC,wBAAwB,CAAC;QAE/B,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC;QACrC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,sBAAsB,CAAC,EAAU;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const classInstanceToObject: <T extends {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
}>(instance: T, options?: {
|
|
4
|
-
globals?: {
|
|
5
|
-
canCallAction?: (prams: {
|
|
6
|
-
method: string;
|
|
7
|
-
class: string;
|
|
8
|
-
}) => boolean;
|
|
9
|
-
};
|
|
10
|
-
methodWrappers?: { [K in keyof T]?: (fn: T[K], ...args: T[K] extends (...args: infer P) => any ? P : never) => T[K] extends (...args: any) => infer R ? R : never; };
|
|
11
|
-
}) => Record<string, any>;
|
|
12
|
-
//# sourceMappingURL=classInstanceToObject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classInstanceToObject.d.ts","sourceRoot":"","sources":["../../src/lib/classInstanceToObject.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EACpE,UAAU,CAAC,EACX,UAAU;IACR,OAAO,CAAC,EAAE;QACR,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC;KACvE,CAAC;IACF,cAAc,CAAC,EAAE,GACd,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CACf,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EACR,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,KAAK,KACxD,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,GACxD,CAAC;CACH,KACA,MAAM,CAAC,MAAM,EAAE,GAAG,CAsCpB,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Check if an object contains functions deeply
|
|
2
|
-
const containsDeepFunction = (obj) => {
|
|
3
|
-
if (obj === null || obj === undefined) {
|
|
4
|
-
return false;
|
|
5
|
-
}
|
|
6
|
-
if (typeof obj === 'function') {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
if (typeof obj !== 'object') {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
if (Array.isArray(obj)) {
|
|
13
|
-
return obj.some(item => containsDeepFunction(item));
|
|
14
|
-
}
|
|
15
|
-
return Object.values(obj).some(value => containsDeepFunction(value));
|
|
16
|
-
};
|
|
17
|
-
export const classInstanceToObject = (instance, options) => {
|
|
18
|
-
// Handle null or undefined
|
|
19
|
-
if (instance === null || instance === undefined) {
|
|
20
|
-
return instance;
|
|
21
|
-
}
|
|
22
|
-
// Handle primitive values
|
|
23
|
-
if (typeof instance !== 'object' || instance instanceof Date) {
|
|
24
|
-
return instance;
|
|
25
|
-
}
|
|
26
|
-
// Handle arrays
|
|
27
|
-
if (Array.isArray(instance)) {
|
|
28
|
-
return instance.map(item => classInstanceToObject(item, options));
|
|
29
|
-
}
|
|
30
|
-
// Handle objects
|
|
31
|
-
const obj = {};
|
|
32
|
-
// Get all own properties (data properties, not methods)
|
|
33
|
-
Object.keys(instance).forEach(key => {
|
|
34
|
-
const value = instance[key];
|
|
35
|
-
// Skip functions directly
|
|
36
|
-
if (typeof value === 'function') {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
// Skip properties that contain functions deeply
|
|
40
|
-
if (typeof value === 'object' && value !== null && containsDeepFunction(value)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
// Recursively convert nested objects
|
|
44
|
-
obj[key] = classInstanceToObject(value, options);
|
|
45
|
-
});
|
|
46
|
-
return obj;
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=classInstanceToObject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classInstanceToObject.js","sourceRoot":"","sources":["../../src/lib/classInstanceToObject.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,oBAAoB,GAAG,CAAC,GAAQ,EAAW,EAAE;IACjD,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;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