@kosdev-code/kos-ui-sdk 0.1.0-next.865 → 0.1.0-next.868

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ChildModels, P as ParentModel, O as OptionsRequired, a as CompanionParentModel, b as ContainerAwareSetup, K as KosContextManager, F as FutureContainerSetup, M as MultipleFutureContainerSetup, L as LogConfig, c as LoggerSetup, d as KosLoggerFactory, e as KosModelSymbol, f as ModelEffects, R as ReferenceConfig, T as TroubleAwareSetup, D as DependencyModels, g as DependencyLifecycle, E as ExtensionManager, S as SubscriptionHandlers, h as KosViewModelSymbol, V as ViewModelConfig, i as StateMachineSetup, j as injectStateMachineSupport, k as KosModelVisitor, l as KosCore, s as sendKosMessageResponse, m as KosLog, u as uuid, p as publish, n as subscribe, I as INDEX_RECORD_SYMBOL, o as INDEX_COLLECTION_KEY, q as KosContainerIndexEvents, r as isIndexableItem, t as Kos, v as isKosModel, B as BASE_URL, w as ServiceFactory, x as KosModelRegistrationFactory, y as ObservableData, z as kosAction, A as kosTopicHandler, G as kosModel, H as resolveServiceUrl, J as getKosModelSync, N as isKosModelReady, Q as modelFactory, U as registerExtensionPoint, W as FutureService, X as FutureAliases, Y as whenReady, Z as kosAutoEffect, _ as isKosExecutionContext, $ as KOS_EXECUTION_CONTEXT, a0 as EXTENSION_FUTURE_LIFECYCLE_WRAPPER, a1 as kosObservable, a2 as sendKosHttpMessageResponse, a3 as SingletonKosModelRegistrationFactory, a4 as kosWhen, a5 as destroyKosModel, a6 as KOS_MODEL_ID, a7 as KosModelContainer, a8 as api$9, a9 as KosDataContainer, aa as get, ab as getQueryParams, ac as kosEffect, ad as FutureHandler, ae as resolveKosCompanion, af as createClient, ag as kosFetch, ah as EXTENSION_CANVAS_RENDERER, ai as post, aj as FetchError, ak as KosWsEvents, al as RegistrationManager, am as registerKosModel, an as registerLegacyModel, ao as kosServiceRequest$8, ap as WebSocketTransport, aq as kosComputed, ar as WebSocketEvents, as as modelHookCache, at as isUpdateable, au as KosModelState, av as KosModelEvents, aw as clearModelHookCacheEntry, ax as getKosModel$1 } from "./index-CvCXisvT.js";
2
- import { ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm, bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b_, b$, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz, cA, cB, cC, cD, cE, cF, cG, cH, cI } from "./index-CvCXisvT.js";
1
+ import { C as ChildModels, P as ParentModel, O as OptionsRequired, a as CompanionParentModel, b as ContainerAwareSetup, K as KosContextManager, F as FutureContainerSetup, M as MultipleFutureContainerSetup, L as LogConfig, c as LoggerSetup, d as KosLoggerFactory, e as KosModelSymbol, f as ModelEffects, R as ReferenceConfig, T as TroubleAwareSetup, D as DependencyModels, g as DependencyLifecycle, E as ExtensionManager, S as SubscriptionHandlers, h as KosViewModelSymbol, V as ViewModelConfig, i as StateMachineSetup, j as injectStateMachineSupport, k as KosModelVisitor, l as KosCore, s as sendKosMessageResponse, m as KosLog, u as uuid, p as publish, n as subscribe, I as INDEX_RECORD_SYMBOL, o as INDEX_COLLECTION_KEY, q as KosContainerIndexEvents, r as isIndexableItem, t as Kos, v as isKosModel, B as BASE_URL, w as ServiceFactory, x as KosModelRegistrationFactory, y as ObservableData, z as kosAction, A as kosTopicHandler, G as kosModel, H as resolveServiceUrl, J as getKosModelSync, N as isKosModelReady, Q as modelFactory, U as registerExtensionPoint, W as FutureService, X as FutureAliases, Y as whenReady, Z as kosAutoEffect, _ as isKosExecutionContext, $ as KOS_EXECUTION_CONTEXT, a0 as EXTENSION_FUTURE_LIFECYCLE_WRAPPER, a1 as kosObservable, a2 as sendKosHttpMessageResponse, a3 as SingletonKosModelRegistrationFactory, a4 as kosWhen, a5 as destroyKosModel, a6 as KOS_MODEL_ID, a7 as KosModelContainer, a8 as api$9, a9 as KosDataContainer, aa as get, ab as getQueryParams, ac as kosEffect, ad as FutureHandler, ae as resolveKosCompanion, af as createClient, ag as kosFetch, ah as EXTENSION_CANVAS_RENDERER, ai as post, aj as FetchError, ak as KosWsEvents, al as RegistrationManager, am as registerKosModel, an as registerLegacyModel, ao as kosServiceRequest$8, ap as WebSocketTransport, aq as kosComputed, ar as WebSocketEvents, as as modelHookCache, at as isUpdateable, au as KosModelState, av as KosModelEvents, aw as clearModelHookCacheEntry, ax as getKosModel$1 } from "./index-D64IOwMG.js";
2
+ import { ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm, bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, bD, bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b_, b$, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, cn, co, cp, cq, cr, cs, ct, cu, cv, cw, cx, cy, cz, cA, cB, cC, cD, cE, cF, cG, cH, cI } from "./index-D64IOwMG.js";
3
3
  import { action, reaction, autorun, makeAutoObservable, runInAction, observable } from "mobx";
4
4
  import { makeAutoObservable as makeAutoObservable2, makeObservable } from "mobx";
5
5
  import log$s from "loglevel";
@@ -794,7 +794,7 @@ const updateCompanionModelRegistration = (typeId, companionRegistration) => {
794
794
  const TOPIC = "/kos/ui/internal/heartbeat/";
795
795
  const pairedClientHeartbeat = ({
796
796
  relationshipId,
797
- destinationAddress: destinationAddress2,
797
+ destinationAddress,
798
798
  onAbort,
799
799
  waitTime,
800
800
  beatTime
@@ -822,7 +822,7 @@ const pairedClientHeartbeat = ({
822
822
  msg: {},
823
823
  options: {
824
824
  topic: `${TOPIC}${relationshipId}`,
825
- destinationAddress: destinationAddress2
825
+ destinationAddress
826
826
  }
827
827
  });
828
828
  }, _beatTime);
@@ -3493,7 +3493,8 @@ let BrowserRouterModelImpl = class {
3493
3493
  id: requestId,
3494
3494
  method,
3495
3495
  path: url,
3496
- body: data
3496
+ body: data,
3497
+ headers: payload.headers
3497
3498
  };
3498
3499
  let status = 200;
3499
3500
  const res = {
@@ -6431,20 +6432,20 @@ __decorateClass$o([
6431
6432
  LogBlockContainerModelImpl = __decorateClass$o([
6432
6433
  kosModel(MODEL_TYPE$n)
6433
6434
  ], LogBlockContainerModelImpl);
6434
- const log$g = KosLog.createLogger({
6435
- name: "log-stream-container-service",
6436
- group: "Services"
6437
- });
6438
- const getKosConnectionId$2 = () => {
6435
+ const getKosConnectionId = () => {
6439
6436
  const params2 = getQueryParams();
6440
6437
  const connId = params2?.connId;
6441
6438
  const result = connId || window?.kosBridge?.("connId");
6442
- KosLog.error(`getKosConnectionId: ${result}`);
6439
+ KosLog.debug(`getKosConnectionId: ${result}`);
6443
6440
  return result;
6444
6441
  };
6445
- const destinationAddress$3 = getKosConnectionId$2();
6442
+ const log$g = KosLog.createLogger({
6443
+ name: "log-stream-container-service",
6444
+ group: "Services"
6445
+ });
6446
6446
  const SERVICE_PATH$1 = "/api/kos/logs/node/{nodeId}/streams";
6447
6447
  const getLogStreams = async () => {
6448
+ const destinationAddress = getKosConnectionId();
6448
6449
  log$g.debug("sending GET for log-stream-container");
6449
6450
  return await api$9.get(
6450
6451
  SERVICE_PATH$1,
@@ -6454,11 +6455,12 @@ const getLogStreams = async () => {
6454
6455
  }
6455
6456
  },
6456
6457
  {
6457
- destinationAddress: destinationAddress$3
6458
+ destinationAddress
6458
6459
  }
6459
6460
  );
6460
6461
  };
6461
6462
  const subscribeToLogStream = async (stream, nodeId = "primary") => {
6463
+ const destinationAddress = getKosConnectionId();
6462
6464
  await api$9.post(
6463
6465
  "/api/kos/logs/node/{nodeId}/{stream}/subscribe",
6464
6466
  {
@@ -6469,21 +6471,23 @@ const subscribeToLogStream = async (stream, nodeId = "primary") => {
6469
6471
  },
6470
6472
  void 0,
6471
6473
  {
6472
- destinationAddress: destinationAddress$3
6474
+ destinationAddress
6473
6475
  }
6474
6476
  );
6475
6477
  };
6476
6478
  const unsubscribeFromLogStream = async (stream) => {
6479
+ const destinationAddress = getKosConnectionId();
6477
6480
  await api$9.post(
6478
6481
  "/api/kos/logs/node/{nodeId}/{stream}/unsubscribe",
6479
6482
  { path: { nodeId: "primary", stream } },
6480
6483
  void 0,
6481
6484
  {
6482
- destinationAddress: destinationAddress$3
6485
+ destinationAddress
6483
6486
  }
6484
6487
  );
6485
6488
  };
6486
6489
  const createOverride = async () => {
6490
+ const destinationAddress = getKosConnectionId();
6487
6491
  await api$9.post(
6488
6492
  "/api/kos/logs/overrides",
6489
6493
  {},
@@ -6494,11 +6498,12 @@ const createOverride = async () => {
6494
6498
  type: "package"
6495
6499
  },
6496
6500
  {
6497
- destinationAddress: destinationAddress$3
6501
+ destinationAddress
6498
6502
  }
6499
6503
  );
6500
6504
  };
6501
6505
  const getLogStreamBlocks = async (stream) => {
6506
+ const destinationAddress = getKosConnectionId();
6502
6507
  const response = await api$9.get(
6503
6508
  "/api/kos/logs/node/{nodeId}/{stream}/blocks",
6504
6509
  {
@@ -6508,12 +6513,13 @@ const getLogStreamBlocks = async (stream) => {
6508
6513
  }
6509
6514
  },
6510
6515
  {
6511
- destinationAddress: destinationAddress$3
6516
+ destinationAddress
6512
6517
  }
6513
6518
  );
6514
6519
  return response;
6515
6520
  };
6516
6521
  const getLogStreamBlock = async (stream, blockId) => {
6522
+ const destinationAddress = getKosConnectionId();
6517
6523
  const response = await api$9.get(
6518
6524
  "/api/kos/logs/node/{nodeId}/{stream}/blocks/{blockId}",
6519
6525
  {
@@ -6524,7 +6530,7 @@ const getLogStreamBlock = async (stream, blockId) => {
6524
6530
  }
6525
6531
  },
6526
6532
  {
6527
- destinationAddress: destinationAddress$3
6533
+ destinationAddress
6528
6534
  }
6529
6535
  );
6530
6536
  return response;
@@ -6532,7 +6538,6 @@ const getLogStreamBlock = async (stream, blockId) => {
6532
6538
  const index$9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6533
6539
  __proto__: null,
6534
6540
  createOverride,
6535
- getKosConnectionId: getKosConnectionId$2,
6536
6541
  getLogStreamBlock,
6537
6542
  getLogStreamBlocks,
6538
6543
  getLogStreams,
@@ -7047,37 +7052,26 @@ const { getAll: getAll$4, postModel: postModel$1 } = ServiceFactory.build({
7047
7052
  basePath: `${URL$6}/api/kos/troubles`
7048
7053
  });
7049
7054
  const log$f = KosLog.createLogger({ name: "trouble-services" });
7050
- const getKosConnectionId$1 = () => {
7051
- const params2 = getQueryParams();
7052
- const connId = params2?.connId;
7053
- log$f.debug(`connId from query params: ${connId}`);
7054
- log$f.debug(
7055
- `window.kosBridge: ${window?.kosBridge ? "available" : "not available"} - ${window?.kosBridge?.("connId")}`
7056
- );
7057
- const result = connId || window?.kosBridge?.("connId");
7058
- log$f.info(`getKosConnectionId: ${result}`);
7059
- return result;
7060
- };
7061
- const destinationAddress$2 = getKosConnectionId$1();
7062
- log$f.info(`Destination address for trouble services: ${destinationAddress$2}`);
7063
7055
  const getTroubles = async (servicePath) => {
7064
7056
  const isKosTroubles = servicePath.includes("/kos/troubles");
7057
+ const destinationAddress = getKosConnectionId();
7065
7058
  log$f.info(
7066
- `Fetching troubles from ${servicePath} with destination address: ${isKosTroubles ? destinationAddress$2 : "N/A (not a kos troubles path)"}`
7059
+ `Fetching troubles from ${servicePath} with destination address: ${isKosTroubles ? destinationAddress : "N/A (not a kos troubles path)"}`
7067
7060
  );
7068
7061
  const response = await getAll$4({
7069
7062
  urlOverride: `${URL$6}${servicePath}`,
7070
- destinationAddress: isKosTroubles ? destinationAddress$2 : void 0
7063
+ destinationAddress: isKosTroubles ? destinationAddress : void 0
7071
7064
  });
7072
7065
  return response;
7073
7066
  };
7074
7067
  const resolveTrouble = async (troubleId, servicePath = "/api/kos/troubles", tracker) => {
7075
7068
  try {
7076
7069
  const isKosTroubles = servicePath.includes("/kos/troubles");
7070
+ const destinationAddress = getKosConnectionId();
7077
7071
  const response = await postModel$1({
7078
7072
  model: {},
7079
7073
  urlOverride: `${URL$6}${servicePath}/resolve/${troubleId}`,
7080
- destinationAddress: isKosTroubles ? destinationAddress$2 : void 0,
7074
+ destinationAddress: isKosTroubles ? destinationAddress : void 0,
7081
7075
  tracker
7082
7076
  });
7083
7077
  if (response?.data) {
@@ -7097,10 +7091,11 @@ const resolveTrouble = async (troubleId, servicePath = "/api/kos/troubles", trac
7097
7091
  };
7098
7092
  const bulkResolveTroubles = async (troubleIds, servicePath = "/api/kos/troubles", tracker) => {
7099
7093
  try {
7094
+ const destinationAddress = getKosConnectionId();
7100
7095
  const response = await postModel$1({
7101
7096
  model: troubleIds,
7102
7097
  urlOverride: `${URL$6}${servicePath}/resolve/`,
7103
- destinationAddress: destinationAddress$2,
7098
+ destinationAddress,
7104
7099
  tracker
7105
7100
  });
7106
7101
  if (response?.data) {
@@ -7121,7 +7116,6 @@ const bulkResolveTroubles = async (troubleIds, servicePath = "/api/kos/troubles"
7121
7116
  const index$8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7122
7117
  __proto__: null,
7123
7118
  bulkResolveTroubles,
7124
- getKosConnectionId: getKosConnectionId$1,
7125
7119
  getTroubles,
7126
7120
  resolveTrouble
7127
7121
  }, Symbol.toStringTag, { value: "Module" }));
@@ -10803,27 +10797,20 @@ const NetworkInterface = new KosModelRegistrationFactory({
10803
10797
  class: NetworkInterfaceModelImpl,
10804
10798
  type: MODEL_TYPE$d
10805
10799
  });
10806
- const getKosConnectionId = () => {
10807
- const params2 = getQueryParams();
10808
- const connId = params2?.connId;
10809
- const result = connId || window?.kosBridge?.("connId");
10810
- KosLog.debug(`getKosConnectionId: ${result}`);
10811
- return result;
10812
- };
10813
10800
  const { URL: URL$3 } = resolveServiceUrl();
10814
10801
  const { getAll: getAll$2 } = ServiceFactory.build({
10815
10802
  basePath: `${URL$3}/api/kos/network/interfaces`
10816
10803
  });
10817
- const destinationAddress$1 = getKosConnectionId();
10818
10804
  const log$b = KosLog.createLogger({
10819
10805
  name: "network-interface-service",
10820
10806
  group: "Services"
10821
10807
  });
10822
10808
  const getNetworkInterfaces = async () => {
10809
+ const destinationAddress = getKosConnectionId();
10823
10810
  log$b.debug("sending GET for copy-logs");
10824
10811
  try {
10825
10812
  const response = await getAll$2({
10826
- destinationAddress: destinationAddress$1
10813
+ destinationAddress
10827
10814
  });
10828
10815
  return [void 0, response?.data];
10829
10816
  } catch (error) {
@@ -12190,7 +12177,7 @@ const updateRegion = async (region) => {
12190
12177
  regionInfo.updateProperty(region);
12191
12178
  };
12192
12179
  async function getKosServiceApi() {
12193
- const { default: API } = await import("./index-CvCXisvT.js").then((n) => n.cJ);
12180
+ const { default: API } = await import("./index-D64IOwMG.js").then((n) => n.cJ);
12194
12181
  return API;
12195
12182
  }
12196
12183
  function kosServiceRequest$7(params2) {
@@ -12555,8 +12542,8 @@ const log$6 = KosLog.createLogger({
12555
12542
  name: "software-info-service",
12556
12543
  group: "Services"
12557
12544
  });
12558
- const destinationAddress = getKosConnectionId();
12559
12545
  const getSoftwareInfos = async (signal) => {
12546
+ const destinationAddress = getKosConnectionId();
12560
12547
  log$6.debug("sending GET for software-info");
12561
12548
  const [error, response] = await api$8.get("/api/kos/manifest/info", void 0, {
12562
12549
  signal,
@@ -12685,10 +12672,10 @@ const login = async (username, password, url = `${BASE_URL}/api/login`) => {
12685
12672
  return configResponse;
12686
12673
  };
12687
12674
  const studioStartPasswordReset = async (userId) => startPasswordReset(userId, `${BASE_URL}/api/server/startPasswordReset`, "");
12688
- const startPasswordReset = async (userId, url = `${BASE_URL}/api/startPasswordReset`, destinationAddress2 = "server") => {
12675
+ const startPasswordReset = async (userId, url = `${BASE_URL}/api/startPasswordReset`, destinationAddress = "server") => {
12689
12676
  const response = await kosFetch(`${url}?email=${userId}`, {
12690
12677
  method: `POST`,
12691
- destinationAddress: destinationAddress2
12678
+ destinationAddress
12692
12679
  });
12693
12680
  if (!response.ok) {
12694
12681
  throw Error(