@powerhousedao/connect 1.0.20-dev.1 → 1.0.21-dev.0

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 (29) hide show
  1. package/dist/assets/{app-BRmEr17M.js → app-5pzhkdPA.js} +12 -12
  2. package/dist/assets/{app-BRmEr17M.js.map → app-5pzhkdPA.js.map} +1 -1
  3. package/dist/assets/{app-BzvMUA_5.css → app-CmlD3Pwe.css} +1 -1
  4. package/dist/assets/{app-loader-_6yU4PFI.js → app-loader-DMIJ7HEl.js} +122 -55
  5. package/dist/assets/app-loader-DMIJ7HEl.js.map +1 -0
  6. package/dist/assets/{browser--PdVaTAw.js → browser-C3ZBRkVS.js} +4 -4
  7. package/dist/assets/{browser--PdVaTAw.js.map → browser-C3ZBRkVS.js.map} +1 -1
  8. package/dist/assets/{ccip-oTEe2poK.js → ccip-B3SqXqYN.js} +4 -4
  9. package/dist/assets/{ccip-oTEe2poK.js.map → ccip-B3SqXqYN.js.map} +1 -1
  10. package/dist/assets/{content-B1Gquii9.js → content-CS3pyItT.js} +5 -5
  11. package/dist/assets/{content-B1Gquii9.js.map → content-CS3pyItT.js.map} +1 -1
  12. package/dist/assets/{index-Csy31V2Q.js → index-BMVX6QN3.js} +4 -4
  13. package/dist/assets/{index-Csy31V2Q.js.map → index-BMVX6QN3.js.map} +1 -1
  14. package/dist/assets/{index-DSo3d6TG.js → index-CS_ENEm9.js} +4 -4
  15. package/dist/assets/{index-DSo3d6TG.js.map → index-CS_ENEm9.js.map} +1 -1
  16. package/dist/assets/{index-C47jzF-n.js → index-CTQoMeBS.js} +5 -5
  17. package/dist/assets/{index-C47jzF-n.js.map → index-CTQoMeBS.js.map} +1 -1
  18. package/dist/assets/{index-CXljh8x6.js → index-CgD_N1bp.js} +4 -4
  19. package/dist/assets/{index-CXljh8x6.js.map → index-CgD_N1bp.js.map} +1 -1
  20. package/dist/assets/{main.CUjcRUhx.js → main.D_01qktv.js} +2 -2
  21. package/dist/assets/{main.CUjcRUhx.js.map → main.D_01qktv.js.map} +1 -1
  22. package/dist/assets/{reactor-analytics-C7JH8QS3.js → reactor-analytics-Byaaas4F.js} +6 -6
  23. package/dist/assets/{reactor-analytics-C7JH8QS3.js.map → reactor-analytics-Byaaas4F.js.map} +1 -1
  24. package/dist/assets/{router-B-9X40Vx.js → router-BMJPZDcx.js} +6 -6
  25. package/dist/assets/{router-B-9X40Vx.js.map → router-BMJPZDcx.js.map} +1 -1
  26. package/dist/index.html +1 -1
  27. package/dist/vite-envs.sh +1 -1
  28. package/package.json +6 -6
  29. package/dist/assets/app-loader-_6yU4PFI.js.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.1.4 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.1.5 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
4
  @layer theme {
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-BRmEr17M.js","assets/main.CUjcRUhx.js","assets/app-BzvMUA_5.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-5pzhkdPA.js","assets/main.D_01qktv.js","assets/app-CmlD3Pwe.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.CUjcRUhx.js";
14
+ import { _ as __vitePreload } from "./main.D_01qktv.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) {
@@ -97,14 +97,51 @@ const trimResultingState = (document) => {
97
97
  });
98
98
  return { ...document, operations: { global: global2, local } };
99
99
  };
100
+ class CacheStorageManager {
101
+ constructor(cache) {
102
+ __publicField(this, "index", 0);
103
+ __publicField(this, "cache");
104
+ this.cache = cache;
105
+ }
106
+ createStorage() {
107
+ const index = this.index;
108
+ this.index += 1;
109
+ function buildKey(key) {
110
+ return `${index}-${key}`;
111
+ }
112
+ const storage = {
113
+ get: (key) => {
114
+ return this.cache.get(buildKey(key));
115
+ },
116
+ set: (key, value) => {
117
+ this.cache.set(buildKey(key), value);
118
+ return storage;
119
+ },
120
+ delete: (key) => {
121
+ return this.cache.delete(buildKey(key));
122
+ },
123
+ clear: () => {
124
+ this.cache.clear();
125
+ }
126
+ };
127
+ return storage;
128
+ }
129
+ }
100
130
  class InMemoryCache {
101
- constructor() {
102
- __publicField(this, "idTodocument", /* @__PURE__ */ new Map());
103
- __publicField(this, "idToDrive", /* @__PURE__ */ new Map());
104
- __publicField(this, "slugToDriveId", /* @__PURE__ */ new Map());
131
+ constructor(cache = /* @__PURE__ */ new Map()) {
132
+ __publicField(this, "cache");
133
+ __publicField(this, "cacheStorageManager");
134
+ __publicField(this, "idToDocument");
135
+ __publicField(this, "idToDrive");
136
+ __publicField(this, "slugToDriveId");
137
+ this.cache = cache;
138
+ this.cacheStorageManager = new CacheStorageManager(cache);
139
+ this.idToDocument = this.cacheStorageManager.createStorage();
140
+ this.idToDrive = this.cacheStorageManager.createStorage();
141
+ this.slugToDriveId = this.cacheStorageManager.createStorage();
105
142
  }
106
143
  clear() {
107
- this.idTodocument.clear();
144
+ this.idToDocument.clear();
108
145
  this.idToDrive.clear();
109
146
  this.slugToDriveId.clear();
110
147
  }
@@ -113,13 +150,13 @@ class InMemoryCache {
113
150
  /////////////////////////////////////////////////////////////////////////////
114
151
  async setDocument(documentId, document) {
115
152
  const doc = trimResultingState(document);
116
- this.idTodocument.set(documentId, doc);
153
+ this.idToDocument.set(documentId, doc);
117
154
  }
118
155
  async getDocument(documentId) {
119
- return this.idTodocument.get(documentId);
156
+ return this.idToDocument.get(documentId);
120
157
  }
121
158
  async deleteDocument(documentId) {
122
- return this.idTodocument.delete(documentId);
159
+ return this.idToDocument.delete(documentId);
123
160
  }
124
161
  async setDrive(driveId, drive) {
125
162
  const doc = trimResultingState(drive);
@@ -10903,6 +10940,60 @@ const reducer$2 = {
10903
10940
  state.triggers = state.triggers.filter((trigger) => trigger.id !== action.input.triggerId);
10904
10941
  }
10905
10942
  };
10943
+ class DocumentModelNotFoundError extends Error {
10944
+ constructor(id, cause) {
10945
+ super(`Document model "${id}" not found`, { cause });
10946
+ __publicField(this, "id");
10947
+ this.id = id;
10948
+ }
10949
+ }
10950
+ class OperationError extends Error {
10951
+ constructor(status, operation, message, cause) {
10952
+ super(message, { cause: cause ?? operation });
10953
+ __publicField(this, "status");
10954
+ __publicField(this, "operation");
10955
+ this.status = status;
10956
+ this.operation = operation;
10957
+ }
10958
+ }
10959
+ class ConflictOperationError extends OperationError {
10960
+ constructor(existingOperation, newOperation) {
10961
+ super("CONFLICT", newOperation, `Conflicting operation on index ${newOperation.index}`, { existingOperation, newOperation });
10962
+ }
10963
+ }
10964
+ class DocumentIdValidationError extends Error {
10965
+ constructor(documentId) {
10966
+ super(`Invalid document id: ${documentId}`);
10967
+ }
10968
+ }
10969
+ class DocumentSlugValidationError extends Error {
10970
+ constructor(slug) {
10971
+ super(`Invalid slug: ${slug}`);
10972
+ }
10973
+ }
10974
+ class DocumentAlreadyExistsError extends Error {
10975
+ constructor(documentId) {
10976
+ super(`Document with id ${documentId} uses id or slug that already exists`);
10977
+ __publicField(this, "documentId");
10978
+ this.documentId = documentId;
10979
+ }
10980
+ }
10981
+ class DocumentNotFoundError extends Error {
10982
+ constructor(documentId) {
10983
+ super(`Document with id ${documentId} not found`);
10984
+ __publicField(this, "documentId");
10985
+ this.documentId = documentId;
10986
+ }
10987
+ }
10988
+ class SynchronizationUnitNotFoundError extends Error {
10989
+ constructor(message, syncUnitId) {
10990
+ super(message);
10991
+ __publicField(this, "syncUnitId");
10992
+ this.syncUnitId = syncUnitId;
10993
+ }
10994
+ }
10995
+ const isValidDocumentId = (id) => /^[a-zA-Z0-9_-]+$/.test(id);
10996
+ const isValidSlug = (slug) => /^[a-zA-Z0-9_-]+$/.test(slug);
10906
10997
  const byteToHex = [];
10907
10998
  for (let i = 0; i < 256; ++i) {
10908
10999
  byteToHex.push((i + 256).toString(16).slice(1));
@@ -11078,6 +11169,9 @@ const reducer$1 = {
11078
11169
  if (state.nodes.find((node) => node.id === action.input.id)) {
11079
11170
  throw new Error(`Node with id ${action.input.id} already exists!`);
11080
11171
  }
11172
+ if (!isValidDocumentId(action.input.id)) {
11173
+ throw new DocumentIdValidationError(action.input.id);
11174
+ }
11081
11175
  const name2 = handleTargetNameCollisions({
11082
11176
  nodes: state.nodes,
11083
11177
  srcName: action.input.name,
@@ -11170,6 +11264,9 @@ const reducer$1 = {
11170
11264
  if (!node) {
11171
11265
  throw new Error(`Node with id ${action.input.srcId} not found`);
11172
11266
  }
11267
+ if (!isValidDocumentId(action.input.targetId)) {
11268
+ throw new DocumentIdValidationError(action.input.targetId);
11269
+ }
11173
11270
  const duplicatedNode = state.nodes.find((node2) => node2.id === action.input.targetId);
11174
11271
  if (duplicatedNode) {
11175
11272
  throw new Error(`Node with id ${action.input.targetId} already exists`);
@@ -11688,48 +11785,6 @@ const childLogger = (tags) => {
11688
11785
  logger2.errorHandler = errorHandler;
11689
11786
  return logger2;
11690
11787
  };
11691
- class DocumentModelNotFoundError extends Error {
11692
- constructor(id, cause) {
11693
- super(`Document model "${id}" not found`, { cause });
11694
- __publicField(this, "id");
11695
- this.id = id;
11696
- }
11697
- }
11698
- class OperationError extends Error {
11699
- constructor(status, operation, message, cause) {
11700
- super(message, { cause: cause ?? operation });
11701
- __publicField(this, "status");
11702
- __publicField(this, "operation");
11703
- this.status = status;
11704
- this.operation = operation;
11705
- }
11706
- }
11707
- class ConflictOperationError extends OperationError {
11708
- constructor(existingOperation, newOperation) {
11709
- super("CONFLICT", newOperation, `Conflicting operation on index ${newOperation.index}`, { existingOperation, newOperation });
11710
- }
11711
- }
11712
- class DocumentAlreadyExistsError extends Error {
11713
- constructor(documentId) {
11714
- super(`Document with id ${documentId} uses id or slug that already exists`);
11715
- __publicField(this, "documentId");
11716
- this.documentId = documentId;
11717
- }
11718
- }
11719
- class DocumentNotFoundError extends Error {
11720
- constructor(documentId) {
11721
- super(`Document with id ${documentId} not found`);
11722
- __publicField(this, "documentId");
11723
- this.documentId = documentId;
11724
- }
11725
- }
11726
- class SynchronizationUnitNotFoundError extends Error {
11727
- constructor(message, syncUnitId) {
11728
- super(message);
11729
- __publicField(this, "syncUnitId");
11730
- this.syncUnitId = syncUnitId;
11731
- }
11732
- }
11733
11788
  var RunAsap;
11734
11789
  (function(RunAsap2) {
11735
11790
  RunAsap2.useMessageChannel = (() => {
@@ -24362,10 +24417,16 @@ class MemoryStorage {
24362
24417
  return Promise.resolve(!!this.documents[documentId]);
24363
24418
  }
24364
24419
  create(documentId, document) {
24420
+ if (!isValidDocumentId(documentId)) {
24421
+ throw new DocumentIdValidationError(documentId);
24422
+ }
24365
24423
  if (this.documents[documentId]) {
24366
24424
  throw new DocumentAlreadyExistsError(documentId);
24367
24425
  }
24368
24426
  const slug = document.slug.length > 0 ? document.slug : documentId;
24427
+ if (!isValidSlug(slug)) {
24428
+ throw new DocumentSlugValidationError(slug);
24429
+ }
24369
24430
  if (slug && this.slugToDocumentId[slug]) {
24370
24431
  throw new DocumentAlreadyExistsError(documentId);
24371
24432
  }
@@ -26012,7 +26073,7 @@ const nodeOptionsMap = {
26012
26073
  };
26013
26074
  const name = "@powerhousedao/connect";
26014
26075
  const productName = "Powerhouse-Connect";
26015
- const version$1 = "1.0.20-dev.1";
26076
+ const version$1 = "1.0.21-dev.0";
26016
26077
  const description = "Powerhouse Connect";
26017
26078
  const main = "./dist/index.html";
26018
26079
  const type = "module";
@@ -28821,11 +28882,17 @@ const _BrowserStorage = class _BrowserStorage {
28821
28882
  return !!document;
28822
28883
  }
28823
28884
  async create(documentId, document) {
28885
+ if (!isValidDocumentId(documentId)) {
28886
+ throw new DocumentIdValidationError(documentId);
28887
+ }
28824
28888
  const db = await this.db;
28825
28889
  if (await this.exists(documentId)) {
28826
28890
  throw new DocumentAlreadyExistsError(documentId);
28827
28891
  }
28828
28892
  const slug = document.slug.length > 0 ? document.slug : documentId;
28893
+ if (!isValidSlug(slug)) {
28894
+ throw new DocumentSlugValidationError(slug);
28895
+ }
28829
28896
  if (slug) {
28830
28897
  const slugManifest = await this.getSlugManifest();
28831
28898
  if (slugManifest.slugToId[slug]) {
@@ -31697,7 +31764,7 @@ if (window.__VITE_ENVS.MODE === "development") {
31697
31764
  } else {
31698
31765
  serviceWorkerManager.registerServiceWorker(false);
31699
31766
  }
31700
- const App = lazy(() => __vitePreload(() => import("./app-BRmEr17M.js").then((n) => n.bu), true ? __vite__mapDeps([0,1,2]) : void 0));
31767
+ const App = lazy(() => __vitePreload(() => import("./app-5pzhkdPA.js").then((n) => n.bu), true ? __vite__mapDeps([0,1,2]) : void 0));
31701
31768
  const AppLoader = /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(App, {}) });
31702
31769
  const appLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31703
31770
  __proto__: null,
@@ -31899,4 +31966,4 @@ export {
31899
31966
  ReorderModulesInputSchema as y,
31900
31967
  DeleteModuleInputSchema as z
31901
31968
  };
31902
- //# sourceMappingURL=app-loader-_6yU4PFI.js.map
31969
+ //# sourceMappingURL=app-loader-DMIJ7HEl.js.map