@octostar/platform-api 0.5.10 → 0.5.11
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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/ContextAPI.d.ts +24 -0
- package/dist/lib/ContextAPI.d.ts.map +1 -0
- package/dist/lib/ContextAPI.js +67 -0
- package/dist/lib/ContextAPI.js.map +1 -0
- package/dist/octostar-platform-api.js +122 -7
- package/package.json +3 -3
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;AACpC,cAAc,kBAAkB,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;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Context, ContextAPISetParams, ContextAPIStaticData, ContextListener } from '@octostar/platform-types';
|
|
2
|
+
type ContextAPIContructorParams<ContextData extends Record<string, any>> = ContextAPIStaticData<ContextData> & {
|
|
3
|
+
id?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare class ContextAPI<ContextData extends Record<string, any>> implements Context<ContextData> {
|
|
6
|
+
readonly static_data: ContextAPIStaticData<ContextData>;
|
|
7
|
+
private channel;
|
|
8
|
+
private listeners;
|
|
9
|
+
private id;
|
|
10
|
+
constructor({ id, ...static_data }: ContextAPIContructorParams<ContextData>);
|
|
11
|
+
get context(): ContextData;
|
|
12
|
+
set context(context: ContextData);
|
|
13
|
+
get channelId(): string | undefined;
|
|
14
|
+
set channelId(channelId: string | undefined);
|
|
15
|
+
getContext(): ContextData;
|
|
16
|
+
setContext(context: ContextAPISetParams<ContextData>): void;
|
|
17
|
+
notifyListeners(): void;
|
|
18
|
+
syncContextToChannel(): void;
|
|
19
|
+
subscribeToChanges(contextListener: ContextListener<ContextData>): string;
|
|
20
|
+
subscribeToChanges(id: string, contextListener: ContextListener<ContextData>): string;
|
|
21
|
+
unsubscribeFromChanges(id: string): void;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=ContextAPI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextAPI.d.ts","sourceRoot":"","sources":["../../src/lib/ContextAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,oBAAoB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGlI,KAAK,0BAA0B,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,oBAAoB,CAAC,WAAW,CAAC,GAAG;IAC7G,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qBAAa,UAAU,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAE,YAAW,OAAO,CAAC,WAAW,CAAC;IAC9F,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAA;IAEvD,OAAO,CAAC,OAAO,CAA+B;IAE9C,OAAO,CAAC,SAAS,CAA+C;IAEhE,OAAO,CAAC,EAAE,CAAS;gBAEP,EAAE,EAAE,EAAE,GAAG,WAAW,EAAE,EAAE,0BAA0B,CAAC,WAAW,CAAC;IAO3E,IAAI,OAAO,IAIU,WAAW,CAF/B;IAED,IAAI,OAAO,CAAC,OAAO,EAAE,WAAW,EAK/B;IAED,IAAI,SAAS,IAIc,MAAM,GAAG,SAAS,CAF5C;IAEC,IAAI,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAe1C;IAEH,UAAU;IAIV,UAAU,CAAC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC;IAKpD,eAAe;IAIf,oBAAoB;IAWpB,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;CAGlC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
export class ContextAPI {
|
|
3
|
+
constructor({ id, ...static_data }) {
|
|
4
|
+
this.static_data = static_data;
|
|
5
|
+
this.listeners = {};
|
|
6
|
+
this.id = id ?? uuidv4();
|
|
7
|
+
this.channelId = static_data.channelId;
|
|
8
|
+
}
|
|
9
|
+
get context() {
|
|
10
|
+
return this.static_data.context;
|
|
11
|
+
}
|
|
12
|
+
set context(context) {
|
|
13
|
+
this.static_data.context = context;
|
|
14
|
+
this.notifyListeners();
|
|
15
|
+
this.syncContextToChannel();
|
|
16
|
+
}
|
|
17
|
+
get channelId() {
|
|
18
|
+
return this.static_data.channelId;
|
|
19
|
+
}
|
|
20
|
+
set channelId(channelId) {
|
|
21
|
+
this.static_data.channelId = channelId;
|
|
22
|
+
const contextChannelId = this.static_data.channelId && `ContextAPI-${this.static_data.channelId}`;
|
|
23
|
+
if (!contextChannelId) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.channel = new BroadcastChannel(contextChannelId);
|
|
27
|
+
this.channel.onmessage = (event) => {
|
|
28
|
+
if (event.data.from !== this.id) {
|
|
29
|
+
this.static_data.context = event.data.context;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
getContext() {
|
|
34
|
+
return this.context;
|
|
35
|
+
}
|
|
36
|
+
setContext(context) {
|
|
37
|
+
this.context =
|
|
38
|
+
typeof context === 'function' ? context(this.context) : context;
|
|
39
|
+
}
|
|
40
|
+
notifyListeners() {
|
|
41
|
+
Object.values(this.listeners).forEach(listener => listener(this.context));
|
|
42
|
+
}
|
|
43
|
+
syncContextToChannel() {
|
|
44
|
+
if (!this.channel) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
this.channel.postMessage({
|
|
48
|
+
from: this.id,
|
|
49
|
+
context: this.context,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
subscribeToChanges(idOrContextListener, contextListenerOrNothing) {
|
|
53
|
+
const id = typeof idOrContextListener === 'string' ? idOrContextListener : uuidv4();
|
|
54
|
+
const contextListener = typeof idOrContextListener === 'function'
|
|
55
|
+
? idOrContextListener
|
|
56
|
+
: contextListenerOrNothing;
|
|
57
|
+
if (!contextListener) {
|
|
58
|
+
throw new Error('Context listener is required');
|
|
59
|
+
}
|
|
60
|
+
this.listeners[id] = contextListener;
|
|
61
|
+
return id;
|
|
62
|
+
}
|
|
63
|
+
unsubscribeFromChanges(id) {
|
|
64
|
+
delete this.listeners[id];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=ContextAPI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextAPI.js","sourceRoot":"","sources":["../../src/lib/ContextAPI.ts"],"names":[],"mappings":"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"}
|
|
@@ -6684,7 +6684,7 @@ var forwardCallsToFutureObject = exports.forwardCallsToFutureObject = function f
|
|
|
6684
6684
|
});
|
|
6685
6685
|
};
|
|
6686
6686
|
|
|
6687
|
-
},{"./constants":33,"./utils":
|
|
6687
|
+
},{"./constants":33,"./utils":44,"post-robot":5}],35:[function(require,module,exports){
|
|
6688
6688
|
"use strict";
|
|
6689
6689
|
|
|
6690
6690
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -6800,8 +6800,19 @@ 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
|
+
});
|
|
6803
6814
|
|
|
6804
|
-
},{"./apis":22,"./components":32,"./constants":33,"./lib/AIClientImpl":36,"./lib/
|
|
6815
|
+
},{"./apis":22,"./components":32,"./constants":33,"./lib/AIClientImpl":36,"./lib/ContextAPI":38,"./lib/JWTProvider":39,"./lib/Proxy":40,"./lib/userWorkspace":41,"./permissions":42,"./types":43,"./utils":44}],36:[function(require,module,exports){
|
|
6805
6816
|
"use strict";
|
|
6806
6817
|
|
|
6807
6818
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7051,6 +7062,110 @@ AsyncServiceLocator.instances = {};
|
|
|
7051
7062
|
},{}],38:[function(require,module,exports){
|
|
7052
7063
|
"use strict";
|
|
7053
7064
|
|
|
7065
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7066
|
+
value: true
|
|
7067
|
+
});
|
|
7068
|
+
exports.ContextAPI = void 0;
|
|
7069
|
+
var _uuid = require("uuid");
|
|
7070
|
+
var _excluded = ["id"];
|
|
7071
|
+
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); }
|
|
7072
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
7073
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
7074
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
7075
|
+
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); } }
|
|
7076
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7077
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7078
|
+
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); }
|
|
7079
|
+
var ContextAPI = exports.ContextAPI = /*#__PURE__*/function () {
|
|
7080
|
+
function ContextAPI(_ref) {
|
|
7081
|
+
var id = _ref.id,
|
|
7082
|
+
static_data = _objectWithoutProperties(_ref, _excluded);
|
|
7083
|
+
_classCallCheck(this, ContextAPI);
|
|
7084
|
+
this.static_data = static_data;
|
|
7085
|
+
this.listeners = {};
|
|
7086
|
+
this.id = id !== null && id !== void 0 ? id : (0, _uuid.v4)();
|
|
7087
|
+
this.channelId = static_data.channelId;
|
|
7088
|
+
}
|
|
7089
|
+
return _createClass(ContextAPI, [{
|
|
7090
|
+
key: "context",
|
|
7091
|
+
get: function get() {
|
|
7092
|
+
return this.static_data.context;
|
|
7093
|
+
},
|
|
7094
|
+
set: function set(context) {
|
|
7095
|
+
this.static_data.context = context;
|
|
7096
|
+
this.notifyListeners();
|
|
7097
|
+
this.syncContextToChannel();
|
|
7098
|
+
}
|
|
7099
|
+
}, {
|
|
7100
|
+
key: "channelId",
|
|
7101
|
+
get: function get() {
|
|
7102
|
+
return this.static_data.channelId;
|
|
7103
|
+
},
|
|
7104
|
+
set: function set(channelId) {
|
|
7105
|
+
var _this = this;
|
|
7106
|
+
this.static_data.channelId = channelId;
|
|
7107
|
+
var contextChannelId = this.static_data.channelId && "ContextAPI-".concat(this.static_data.channelId);
|
|
7108
|
+
if (!contextChannelId) {
|
|
7109
|
+
return;
|
|
7110
|
+
}
|
|
7111
|
+
this.channel = new BroadcastChannel(contextChannelId);
|
|
7112
|
+
this.channel.onmessage = function (event) {
|
|
7113
|
+
if (event.data.from !== _this.id) {
|
|
7114
|
+
_this.static_data.context = event.data.context;
|
|
7115
|
+
}
|
|
7116
|
+
};
|
|
7117
|
+
}
|
|
7118
|
+
}, {
|
|
7119
|
+
key: "getContext",
|
|
7120
|
+
value: function getContext() {
|
|
7121
|
+
return this.context;
|
|
7122
|
+
}
|
|
7123
|
+
}, {
|
|
7124
|
+
key: "setContext",
|
|
7125
|
+
value: function setContext(context) {
|
|
7126
|
+
this.context = typeof context === 'function' ? context(this.context) : context;
|
|
7127
|
+
}
|
|
7128
|
+
}, {
|
|
7129
|
+
key: "notifyListeners",
|
|
7130
|
+
value: function notifyListeners() {
|
|
7131
|
+
var _this2 = this;
|
|
7132
|
+
Object.values(this.listeners).forEach(function (listener) {
|
|
7133
|
+
return listener(_this2.context);
|
|
7134
|
+
});
|
|
7135
|
+
}
|
|
7136
|
+
}, {
|
|
7137
|
+
key: "syncContextToChannel",
|
|
7138
|
+
value: function syncContextToChannel() {
|
|
7139
|
+
if (!this.channel) {
|
|
7140
|
+
return;
|
|
7141
|
+
}
|
|
7142
|
+
this.channel.postMessage({
|
|
7143
|
+
from: this.id,
|
|
7144
|
+
context: this.context
|
|
7145
|
+
});
|
|
7146
|
+
}
|
|
7147
|
+
}, {
|
|
7148
|
+
key: "subscribeToChanges",
|
|
7149
|
+
value: function subscribeToChanges(idOrContextListener, contextListenerOrNothing) {
|
|
7150
|
+
var id = typeof idOrContextListener === 'string' ? idOrContextListener : (0, _uuid.v4)();
|
|
7151
|
+
var contextListener = typeof idOrContextListener === 'function' ? idOrContextListener : contextListenerOrNothing;
|
|
7152
|
+
if (!contextListener) {
|
|
7153
|
+
throw new Error('Context listener is required');
|
|
7154
|
+
}
|
|
7155
|
+
this.listeners[id] = contextListener;
|
|
7156
|
+
return id;
|
|
7157
|
+
}
|
|
7158
|
+
}, {
|
|
7159
|
+
key: "unsubscribeFromChanges",
|
|
7160
|
+
value: function unsubscribeFromChanges(id) {
|
|
7161
|
+
delete this.listeners[id];
|
|
7162
|
+
}
|
|
7163
|
+
}]);
|
|
7164
|
+
}();
|
|
7165
|
+
|
|
7166
|
+
},{"uuid":6}],39:[function(require,module,exports){
|
|
7167
|
+
"use strict";
|
|
7168
|
+
|
|
7054
7169
|
Object.defineProperty(exports, "__esModule", {
|
|
7055
7170
|
value: true
|
|
7056
7171
|
});
|
|
@@ -7134,7 +7249,7 @@ var JWTProvider = exports.JWTProvider = /*#__PURE__*/function () {
|
|
|
7134
7249
|
}]);
|
|
7135
7250
|
}();
|
|
7136
7251
|
|
|
7137
|
-
},{}],
|
|
7252
|
+
},{}],40:[function(require,module,exports){
|
|
7138
7253
|
"use strict";
|
|
7139
7254
|
|
|
7140
7255
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7169,7 +7284,7 @@ var makeProxy = exports.makeProxy = function makeProxy(obj) {
|
|
|
7169
7284
|
return proxyObj;
|
|
7170
7285
|
};
|
|
7171
7286
|
|
|
7172
|
-
},{}],
|
|
7287
|
+
},{}],41:[function(require,module,exports){
|
|
7173
7288
|
"use strict";
|
|
7174
7289
|
|
|
7175
7290
|
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 +7337,7 @@ var getOrCreateUsersPrivateWorkspaceRecord = exports.getOrCreateUsersPrivateWork
|
|
|
7222
7337
|
};
|
|
7223
7338
|
}();
|
|
7224
7339
|
|
|
7225
|
-
},{"uuid":6}],
|
|
7340
|
+
},{"uuid":6}],42:[function(require,module,exports){
|
|
7226
7341
|
"use strict";
|
|
7227
7342
|
|
|
7228
7343
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -7247,14 +7362,14 @@ var ONTOLOGY_PERMISSION_GROUP = exports.ONTOLOGY_PERMISSION_GROUP = 'octostar:on
|
|
|
7247
7362
|
var ALL_PERMISSIONS = exports.ALL_PERMISSIONS = 'all';
|
|
7248
7363
|
var ALL_PERMISSIONS_ARRAY = exports.ALL_PERMISSIONS_ARRAY = [ALL_PERMISSIONS];
|
|
7249
7364
|
|
|
7250
|
-
},{}],
|
|
7365
|
+
},{}],43:[function(require,module,exports){
|
|
7251
7366
|
"use strict";
|
|
7252
7367
|
|
|
7253
7368
|
Object.defineProperty(exports, "__esModule", {
|
|
7254
7369
|
value: true
|
|
7255
7370
|
});
|
|
7256
7371
|
|
|
7257
|
-
},{}],
|
|
7372
|
+
},{}],44:[function(require,module,exports){
|
|
7258
7373
|
"use strict";
|
|
7259
7374
|
|
|
7260
7375
|
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.11",
|
|
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",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"rimraf": "^5.0.5",
|
|
39
39
|
"tsup": "^8.4.0",
|
|
40
40
|
"typescript": "^5.8.2",
|
|
41
|
-
"@octostar/platform-types": "0.5.
|
|
41
|
+
"@octostar/platform-types": "0.5.14"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@octostar/platform-types": "^0.5.
|
|
44
|
+
"@octostar/platform-types": "^0.5.14"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|