@powerhousedao/connect 1.0.22-dev.3 → 1.0.22-dev.5

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.
Files changed (38) hide show
  1. package/dist/assets/{app-CmlD3Pwe.css → app-D5gNm0Gn.css} +67 -26
  2. package/dist/assets/{app-B1Kg3Mqi.js → app-bXMgXr_2.js} +2102 -5095
  3. package/dist/assets/app-bXMgXr_2.js.map +1 -0
  4. package/dist/assets/{app-loader-CyvIBFFD.js → app-loader-Bbnowyvy.js} +71 -49
  5. package/dist/assets/app-loader-Bbnowyvy.js.map +1 -0
  6. package/dist/assets/{app-loader-DaCxVT0x.css → app-loader-NDVZu4bS.css} +28 -34
  7. package/dist/assets/{browser-CkvGC0ES.js → browser-CX-a5MKk.js} +38 -48
  8. package/dist/assets/browser-CX-a5MKk.js.map +1 -0
  9. package/dist/assets/{ccip-Bmf4h4lT.js → ccip-BBMJrqAU.js} +5 -5
  10. package/dist/assets/ccip-BBMJrqAU.js.map +1 -0
  11. package/dist/assets/{content-BzF_lhEe.js → content-B0W_DYic.js} +80 -115
  12. package/dist/assets/content-B0W_DYic.js.map +1 -0
  13. package/dist/assets/{index-C-IAoQ2W.js → index-CPgk_OFL.js} +4 -4
  14. package/dist/assets/{index-C-IAoQ2W.js.map → index-CPgk_OFL.js.map} +1 -1
  15. package/dist/assets/{index-C_oNKjMv.js → index-CU_lAxAd.js} +4 -4
  16. package/dist/assets/{index-C_oNKjMv.js.map → index-CU_lAxAd.js.map} +1 -1
  17. package/dist/assets/{index-CHSqiU2d.js → index-DT91xQ-T.js} +5 -5
  18. package/dist/assets/{index-CHSqiU2d.js.map → index-DT91xQ-T.js.map} +1 -1
  19. package/dist/assets/{index-Tm1QC9J_.js → index-IlX4YC7Y.js} +551 -748
  20. package/dist/assets/index-IlX4YC7Y.js.map +1 -0
  21. package/dist/assets/{main.DgMxIA1e.js → main.D4SFrwJR.js} +2 -2
  22. package/dist/assets/{main.DgMxIA1e.js.map → main.D4SFrwJR.js.map} +1 -1
  23. package/dist/assets/{reactor-analytics-B1FiZ3Ci.js → reactor-analytics-e6XADmbk.js} +10 -16
  24. package/dist/assets/reactor-analytics-e6XADmbk.js.map +1 -0
  25. package/dist/assets/{router-Ds0OvBDF.js → router-Cw4YsdTX.js} +12 -12
  26. package/dist/assets/router-Cw4YsdTX.js.map +1 -0
  27. package/dist/assets/{style-BPUyhu8E.css → style-CdxGKc2g.css} +36 -25
  28. package/dist/index.html +1 -1
  29. package/dist/vite-envs.sh +1 -1
  30. package/package.json +6 -6
  31. package/dist/assets/app-B1Kg3Mqi.js.map +0 -1
  32. package/dist/assets/app-loader-CyvIBFFD.js.map +0 -1
  33. package/dist/assets/browser-CkvGC0ES.js.map +0 -1
  34. package/dist/assets/ccip-Bmf4h4lT.js.map +0 -1
  35. package/dist/assets/content-BzF_lhEe.js.map +0 -1
  36. package/dist/assets/index-Tm1QC9J_.js.map +0 -1
  37. package/dist/assets/reactor-analytics-B1FiZ3Ci.js.map +0 -1
  38. package/dist/assets/router-Ds0OvBDF.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-B1Kg3Mqi.js","assets/main.DgMxIA1e.js","assets/app-CmlD3Pwe.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-bXMgXr_2.js","assets/main.D4SFrwJR.js","assets/app-D5gNm0Gn.css"])))=>i.map(i=>d[i]);
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -11,7 +11,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11
11
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
12
12
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
13
13
  var _tags, _levelString, _errorHandler, _ConsoleLogger_instances, levelValue_get, _getDocumentModelModule, _drives, _ReadModeService_instances, parseGraphQLErrors_fn, fetchDrive_fn, _a, _ServiceWorkerManager_instances, handleServiceWorkerMessage_fn, handleServiceWorker_fn;
14
- import { _ as __vitePreload } from "./main.DgMxIA1e.js";
14
+ import { _ as __vitePreload } from "./main.D4SFrwJR.js";
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
16
  import { useState, useEffect, Suspense, lazy } from "react";
17
17
  function _mergeNamespaces(n, m) {
@@ -177,7 +177,7 @@ class InMemoryCache {
177
177
  return this.idToDrive.delete(driveId);
178
178
  }
179
179
  async setDriveBySlug(slug, drive) {
180
- const driveId = drive.state.global.id;
180
+ const driveId = drive.id;
181
181
  this.slugToDriveId.set(slug, driveId);
182
182
  this.setDrive(driveId, drive);
183
183
  }
@@ -6977,6 +6977,7 @@ function processSkipOperation(document, action, customReducer, skipValue, reuseO
6977
6977
  scopeState = resultingStateParser(lastRemainingOperation.resultingState);
6978
6978
  } else {
6979
6979
  const { state } = replayOperations(document.initialState, documentOperations, customReducer, void 0, void 0, void 0, void 0, {
6980
+ reuseHash: true,
6980
6981
  reuseOperationResultingState,
6981
6982
  operationResultingStateParser: resultingStateParser
6982
6983
  });
@@ -7003,6 +7004,7 @@ function processUndoOperation(document, scope, customReducer, reuseOperationResu
7003
7004
  const clearedOperations = [...documentOperations[scope]];
7004
7005
  const diff = diffOperations(garbageCollect(sortedOperations), clearedOperations);
7005
7006
  const doc = replayOperations(document.initialState, documentOperations, customReducer, void 0, void 0, void 0, void 0, {
7007
+ reuseHash: true,
7006
7008
  reuseOperationResultingState,
7007
7009
  operationResultingStateParser: resultingStateParser
7008
7010
  });
@@ -7152,9 +7154,11 @@ function createReducer(stateReducer2, documentReducer = baseReducer) {
7152
7154
  return reducer2;
7153
7155
  }
7154
7156
  function baseCreateExtendedState(initialState, createState2) {
7157
+ const id = generateUUID();
7155
7158
  return {
7159
+ id,
7160
+ slug: id,
7156
7161
  name: "",
7157
- slug: "",
7158
7162
  documentType: "",
7159
7163
  revision: {
7160
7164
  global: 0,
@@ -10525,10 +10529,11 @@ function validateOperations(operations) {
10525
10529
  }
10526
10530
  function createZip(document) {
10527
10531
  const zip = new JSZip();
10528
- const { name: name2, slug, revision, documentType: documentType2, created, lastModified } = document;
10532
+ const { id, slug, name: name2, revision, documentType: documentType2, created, lastModified } = document;
10529
10533
  const header = {
10530
- name: name2,
10534
+ id,
10531
10535
  slug,
10536
+ name: name2,
10532
10537
  revision,
10533
10538
  documentType: documentType2,
10534
10539
  created,
@@ -11381,7 +11386,6 @@ const fileExtension = "phdd";
11381
11386
  const documentType = "powerhouse/document-drive";
11382
11387
  const documentModelName = "DocumentDrive";
11383
11388
  const initialGlobalState = {
11384
- id: "",
11385
11389
  name: "",
11386
11390
  nodes: [],
11387
11391
  icon: null
@@ -22340,14 +22344,18 @@ async function fetchDocument(url, documentId, documentModelModule) {
22340
22344
  local: []
22341
22345
  },
22342
22346
  attachments: {},
22343
- initialState: utils.createExtendedState({
22344
- // TODO: getDocument should return all the initial state fields
22345
- created: result.document.created,
22346
- lastModified: result.document.created,
22347
- state: utils.createState({
22348
- global: result.document.initialState.state.global
22349
- })
22350
- }),
22347
+ initialState: {
22348
+ ...utils.createExtendedState({
22349
+ // TODO: getDocument should return all the initial state fields
22350
+ created: result.document.created,
22351
+ lastModified: result.document.created,
22352
+ state: utils.createState({
22353
+ global: result.document.initialState.state.global
22354
+ })
22355
+ }),
22356
+ id: result.document.id,
22357
+ slug: result.document.slug
22358
+ },
22351
22359
  clipboard: []
22352
22360
  } : null;
22353
22361
  return {
@@ -22402,7 +22410,13 @@ class ReadModeService {
22402
22410
  return document;
22403
22411
  }
22404
22412
  async addReadDrive(url, options) {
22405
- const { id } = (options == null ? void 0 : options.expectedDriveInfo) ?? await requestPublicDrive(url);
22413
+ let id;
22414
+ if (options == null ? void 0 : options.expectedDriveInfo) {
22415
+ id = options.expectedDriveInfo.id;
22416
+ } else {
22417
+ const drive = await requestPublicDrive(url);
22418
+ id = drive.id;
22419
+ }
22406
22420
  const result = await __privateMethod(this, _ReadModeService_instances, fetchDrive_fn).call(this, id, url);
22407
22421
  if (result instanceof Error) {
22408
22422
  throw result;
@@ -22564,8 +22578,8 @@ class DefaultDrivesManager {
22564
22578
  }
22565
22579
  async preserveDrivesById(driveIdsToPreserve, drives, removeStrategy = "detach") {
22566
22580
  const getAllDrives = drives.map((driveId) => this.server.getDrive(driveId));
22567
- const drivesToRemove = (await Promise.all(getAllDrives)).filter((drive) => drive.state.local.listeners.length > 0 || drive.state.local.triggers.length > 0).filter((drive) => !driveIdsToPreserve.includes(drive.state.global.id));
22568
- const driveIds = drivesToRemove.map((drive) => drive.state.global.id);
22581
+ const drivesToRemove = (await Promise.all(getAllDrives)).filter((drive) => drive.state.local.listeners.length > 0 || drive.state.local.triggers.length > 0).filter((drive) => !driveIdsToPreserve.includes(drive.id));
22582
+ const driveIds = drivesToRemove.map((drive) => drive.id);
22569
22583
  if (removeStrategy === "detach") {
22570
22584
  await this.detachDrivesById(driveIds);
22571
22585
  } else {
@@ -22613,7 +22627,7 @@ class DefaultDrivesManager {
22613
22627
  case "remove-all": {
22614
22628
  const getDrives = driveids.map((driveId) => this.server.getDrive(driveId));
22615
22629
  const drives = await Promise.all(getDrives);
22616
- const drivesToRemove = drives.filter((drive) => drive.state.local.listeners.length > 0 || drive.state.local.triggers.length > 0).map((drive) => drive.state.global.id);
22630
+ const drivesToRemove = drives.filter((drive) => drive.state.local.listeners.length > 0 || drive.state.local.triggers.length > 0).map((drive) => drive.id);
22617
22631
  await this.removeDrivesById(drivesToRemove);
22618
22632
  break;
22619
22633
  }
@@ -23501,7 +23515,7 @@ class BaseDocumentDriveServer {
23501
23515
  this.logger.verbose(`[SYNC DEBUG] Created SwitchboardPush transmitter with URL: ${zodListener.callInfo.data || "none"}`);
23502
23516
  await this.listenerManager.setListener(driveId, {
23503
23517
  block: zodListener.block,
23504
- driveId: drive.state.global.id,
23518
+ driveId: drive.id,
23505
23519
  filter: {
23506
23520
  branch: zodListener.filter.branch ?? [],
23507
23521
  documentId: zodListener.filter.documentId ?? [],
@@ -23563,24 +23577,24 @@ class BaseDocumentDriveServer {
23563
23577
  return [...this.documentModelModules];
23564
23578
  }
23565
23579
  async addDrive(input, preferredEditor) {
23566
- const id = input.global.id || generateId();
23567
- if (!id) {
23568
- throw new Error("Invalid Drive Id");
23569
- }
23570
23580
  const document = createDocument({
23571
23581
  state: input
23572
23582
  });
23583
+ if (input.id && input.id.length > 0) {
23584
+ document.id = document.initialState.id = input.id;
23585
+ document.slug = document.initialState.slug = input.id;
23586
+ }
23573
23587
  if (input.slug && input.slug.length > 0) {
23574
- document.slug = input.slug;
23588
+ document.slug = document.initialState.slug = input.slug;
23575
23589
  }
23576
23590
  document.meta = {
23577
23591
  preferredEditor
23578
23592
  };
23579
- await this.documentStorage.create(id, document);
23593
+ await this.documentStorage.create(document);
23580
23594
  if (input.slug && input.slug.length > 0) {
23581
23595
  await this.cache.deleteDriveBySlug(input.slug);
23582
23596
  }
23583
- await this._initializeDrive(id);
23597
+ await this._initializeDrive(document.id);
23584
23598
  this.eventEmitter.emit("driveAdded", document);
23585
23599
  return document;
23586
23600
  }
@@ -23592,9 +23606,9 @@ class BaseDocumentDriveServer {
23592
23606
  pullInterval
23593
23607
  });
23594
23608
  return await this.addDrive({
23609
+ id,
23595
23610
  slug,
23596
23611
  global: {
23597
- id,
23598
23612
  name: name2,
23599
23613
  icon: icon ?? null
23600
23614
  },
@@ -23703,7 +23717,11 @@ class BaseDocumentDriveServer {
23703
23717
  state = doc.state;
23704
23718
  }
23705
23719
  const document = input.document ?? this.getDocumentModelModule(input.documentType).utils.createDocument();
23720
+ if (input.id && input.id.length > 0) {
23721
+ document.id = input.id;
23722
+ }
23706
23723
  const documentStorage = {
23724
+ id: document.id,
23707
23725
  name: document.name,
23708
23726
  slug: document.slug,
23709
23727
  revision: document.revision,
@@ -23715,7 +23733,7 @@ class BaseDocumentDriveServer {
23715
23733
  clipboard: [],
23716
23734
  state: state ?? document.state
23717
23735
  };
23718
- await this.documentStorage.create(input.id, documentStorage);
23736
+ await this.documentStorage.create(documentStorage);
23719
23737
  try {
23720
23738
  await this.documentStorage.addChild(driveId, input.id);
23721
23739
  } catch (e) {
@@ -24396,7 +24414,8 @@ class MemoryStorage {
24396
24414
  exists(documentId) {
24397
24415
  return Promise.resolve(!!this.documents[documentId]);
24398
24416
  }
24399
- create(documentId, document) {
24417
+ create(document) {
24418
+ const documentId = document.id;
24400
24419
  if (!isValidDocumentId(documentId)) {
24401
24420
  throw new DocumentIdValidationError(documentId);
24402
24421
  }
@@ -26054,7 +26073,7 @@ const nodeOptionsMap = {
26054
26073
  };
26055
26074
  const name = "@powerhousedao/connect";
26056
26075
  const productName = "Powerhouse-Connect";
26057
- const version$1 = "1.0.22-dev.3";
26076
+ const version$1 = "1.0.22-dev.5";
26058
26077
  const description = "Powerhouse Connect";
26059
26078
  const main = "./dist/index.html";
26060
26079
  const type = "module";
@@ -26119,6 +26138,7 @@ const connectConfig = {
26119
26138
  studioMode: PH_CONNECT_STUDIO_MODE.toString() === "true",
26120
26139
  warnOutdatedApp: WARN_OUTDATED_APP === "true",
26121
26140
  routerBasename: PH_CONNECT_ROUTER_BASENAME,
26141
+ analyticsDatabaseName: `${PH_CONNECT_ROUTER_BASENAME}:analytics`,
26122
26142
  sentry: {
26123
26143
  dsn: PH_CONNECT_SENTRY_DSN,
26124
26144
  env: PH_CONNECT_SENTRY_ENV,
@@ -26212,6 +26232,7 @@ DriveSections.filter(
26212
26232
  };
26213
26233
  });
26214
26234
  var lzString = { exports: {} };
26235
+ lzString.exports;
26215
26236
  var hasRequiredLzString;
26216
26237
  function requireLzString() {
26217
26238
  if (hasRequiredLzString) return lzString.exports;
@@ -28867,7 +28888,8 @@ const _BrowserStorage = class _BrowserStorage {
28867
28888
  const document = await db.getItem(this.buildDocumentKey(documentId));
28868
28889
  return !!document;
28869
28890
  }
28870
- async create(documentId, document) {
28891
+ async create(document) {
28892
+ const documentId = document.id;
28871
28893
  if (!isValidDocumentId(documentId)) {
28872
28894
  throw new DocumentIdValidationError(documentId);
28873
28895
  }
@@ -31749,7 +31771,7 @@ if (window.__VITE_ENVS.MODE === "development") {
31749
31771
  } else {
31750
31772
  serviceWorkerManager.registerServiceWorker(false);
31751
31773
  }
31752
- const App = lazy(() => __vitePreload(() => import("./app-B1Kg3Mqi.js").then((n) => n.bs), true ? __vite__mapDeps([0,1,2]) : void 0));
31774
+ const App = lazy(() => __vitePreload(() => import("./app-bXMgXr_2.js").then((n) => n.bs), true ? __vite__mapDeps([0,1,2]) : void 0));
31753
31775
  const AppLoader = /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(App, {}) });
31754
31776
  const appLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31755
31777
  __proto__: null,
@@ -31785,17 +31807,17 @@ export {
31785
31807
  pascalCase as Z,
31786
31808
  logger$1 as _,
31787
31809
  createReducer as a,
31788
- invariant as a$,
31810
+ getNamedType as a$,
31789
31811
  getDefaultExportFromCjs as a0,
31790
31812
  LOCAL as a1,
31791
31813
  commonjsGlobal as a2,
31792
- PUBLIC as a3,
31793
- SWITCHBOARD as a4,
31814
+ SWITCHBOARD as a3,
31815
+ PUBLIC as a4,
31794
31816
  locationInfoByLocation as a5,
31795
31817
  sharingTypeOptions as a6,
31796
31818
  objectType as a7,
31797
- recordType as a8,
31798
- stringType as a9,
31819
+ stringType as a8,
31820
+ recordType as a9,
31799
31821
  updateNode as aA,
31800
31822
  FILE as aB,
31801
31823
  moveNode as aC,
@@ -31822,14 +31844,14 @@ export {
31822
31844
  request as aX,
31823
31845
  inspect as aY,
31824
31846
  GraphQLError as aZ,
31825
- getNamedType as a_,
31847
+ invariant as a_,
31826
31848
  capitalCase as aa,
31827
31849
  CLOUD as ab,
31828
31850
  createZip as ac,
31829
31851
  LZString as ad,
31830
31852
  buildSignedOperation as ae,
31831
- getI18n as af,
31832
- getDefaults as ag,
31853
+ getDefaults as af,
31854
+ getI18n as ag,
31833
31855
  connectConfig as ah,
31834
31856
  hashDocumentStateForScope as ai,
31835
31857
  getAugmentedNamespace as aj,
@@ -31850,17 +31872,17 @@ export {
31850
31872
  isFolderNode as ay,
31851
31873
  deleteNode as az,
31852
31874
  SetStateSchemaInputSchema as b,
31853
- DELETE as b$,
31875
+ DUPLICATE as b$,
31854
31876
  isInputObjectType as b0,
31855
31877
  isScalarType as b1,
31856
31878
  isObjectType as b2,
31857
31879
  isInterfaceType as b3,
31858
31880
  isUnionType as b4,
31859
31881
  isEnumType as b5,
31860
- print as b6,
31861
- isPrintableAsBlockString as b7,
31862
- Kind as b8,
31863
- astFromValue as b9,
31882
+ astFromValue as b6,
31883
+ print as b7,
31884
+ DEFAULT_DEPRECATION_REASON as b8,
31885
+ Kind as b9,
31864
31886
  isInputType as bA,
31865
31887
  GraphQLBoolean as bB,
31866
31888
  assertAbstractType as bC,
@@ -31888,7 +31910,7 @@ export {
31888
31910
  READ as bY,
31889
31911
  nodeOptionsMap as bZ,
31890
31912
  defaultFileOptions as b_,
31891
- DEFAULT_DEPRECATION_REASON as ba,
31913
+ isPrintableAsBlockString as ba,
31892
31914
  isSpecifiedDirective as bb,
31893
31915
  isSpecifiedScalarType as bc,
31894
31916
  isIntrospectionType as bd,
@@ -31917,7 +31939,7 @@ export {
31917
31939
  createAction as c,
31918
31940
  RENAME as c0,
31919
31941
  WRITE as c1,
31920
- DUPLICATE as c2,
31942
+ DELETE as c2,
31921
31943
  defaultFolderOptions as c3,
31922
31944
  garbageCollect as c4,
31923
31945
  sortOperations as c5,
@@ -31950,4 +31972,4 @@ export {
31950
31972
  ReorderModulesInputSchema as y,
31951
31973
  DeleteModuleInputSchema as z
31952
31974
  };
31953
- //# sourceMappingURL=app-loader-CyvIBFFD.js.map
31975
+ //# sourceMappingURL=app-loader-Bbnowyvy.js.map