@seedprotocol/sdk 0.3.7 → 0.3.9

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 (97) hide show
  1. package/dist/addModel.js +4 -0
  2. package/dist/addModel.js.map +1 -1
  3. package/dist/main.js +11 -0
  4. package/dist/main.js.map +1 -1
  5. package/dist/src/ItemProperty/BaseItemProperty.d.ts +6 -6
  6. package/dist/src/ItemProperty/index.js +4 -0
  7. package/dist/src/ItemProperty/index.js.map +1 -0
  8. package/dist/src/ItemProperty/service/actors/hydrateFromDb.js +2 -2
  9. package/dist/src/ItemProperty/service/actors/hydrateFromDb.js.map +1 -1
  10. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.d.ts.map +1 -1
  11. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.js +4 -4
  12. package/dist/src/ItemProperty/service/actors/resolveRelatedValue.js.map +1 -1
  13. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.js +4 -4
  14. package/dist/src/ItemProperty/service/actors/saveValueToDb/analyzeInput.js.map +1 -1
  15. package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts +1 -1
  16. package/dist/src/ItemProperty/service/actors/saveValueToDb/index.d.ts.map +1 -1
  17. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts +5 -0
  18. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.d.ts.map +1 -0
  19. package/dist/src/ItemProperty/service/actors/saveValueToDb/{saveImageSrc.js → saveImage.js} +6 -6
  20. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImage.js.map +1 -0
  21. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.js +2 -2
  22. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveRelation.js.map +1 -1
  23. package/dist/src/ItemProperty/service/propertyMachine.d.ts +7 -7
  24. package/dist/src/ItemProperty/service/propertyMachine.js +6 -6
  25. package/dist/src/ItemProperty/service/propertyMachine.js.map +1 -1
  26. package/dist/src/browser/db/Db.d.ts.map +1 -1
  27. package/dist/src/browser/db/Db.js +35 -8
  28. package/dist/src/browser/db/Db.js.map +1 -1
  29. package/dist/src/browser/helpers/FileManager.d.ts +2 -0
  30. package/dist/src/browser/helpers/FileManager.d.ts.map +1 -1
  31. package/dist/src/browser/helpers/FileManager.js +20 -8
  32. package/dist/src/browser/helpers/FileManager.js.map +1 -1
  33. package/dist/src/browser/index.d.ts +0 -1
  34. package/dist/src/browser/index.d.ts.map +1 -1
  35. package/dist/src/browser/react/index.d.ts +2 -1
  36. package/dist/src/browser/react/index.d.ts.map +1 -1
  37. package/dist/src/browser/react/model.d.ts +7 -0
  38. package/dist/src/browser/react/model.d.ts.map +1 -0
  39. package/dist/src/browser/react/model.js +20 -0
  40. package/dist/src/browser/react/model.js.map +1 -0
  41. package/dist/src/browser/react/services.js +1 -1
  42. package/dist/src/browser/react/services.js.map +1 -1
  43. package/dist/src/browser/workers/FileDownloader.d.ts.map +1 -1
  44. package/dist/src/browser/workers/FileDownloader.js +3 -1
  45. package/dist/src/browser/workers/FileDownloader.js.map +1 -1
  46. package/dist/src/client/ClientManager.d.ts +21 -12
  47. package/dist/src/client/ClientManager.d.ts.map +1 -1
  48. package/dist/src/client/ClientManager.js +21 -0
  49. package/dist/src/client/ClientManager.js.map +1 -1
  50. package/dist/src/client/actors/saveAppState.d.ts.map +1 -1
  51. package/dist/src/client/actors/saveAppState.js +0 -1
  52. package/dist/src/client/actors/saveAppState.js.map +1 -1
  53. package/dist/src/db/read/getModels.d.ts +2 -0
  54. package/dist/src/db/read/getModels.d.ts.map +1 -0
  55. package/dist/src/events/files/download.d.ts.map +1 -1
  56. package/dist/src/events/files/download.js +0 -1
  57. package/dist/src/events/files/download.js.map +1 -1
  58. package/dist/src/events/files/index.d.ts.map +1 -1
  59. package/dist/src/events/files/index.js +0 -1
  60. package/dist/src/events/files/index.js.map +1 -1
  61. package/dist/src/events/services/allItems.d.ts.map +1 -1
  62. package/dist/src/events/services/allItems.js +0 -1
  63. package/dist/src/events/services/allItems.js.map +1 -1
  64. package/dist/src/helpers/FileManager/BaseFileManager.d.ts +2 -0
  65. package/dist/src/helpers/FileManager/BaseFileManager.d.ts.map +1 -1
  66. package/dist/src/helpers/FileManager/BaseFileManager.js +6 -0
  67. package/dist/src/helpers/FileManager/BaseFileManager.js.map +1 -1
  68. package/dist/src/helpers/constants.d.ts +1 -1
  69. package/dist/src/helpers/constants.js +1 -1
  70. package/dist/src/helpers/constants.js.map +1 -1
  71. package/dist/src/helpers/environment.js +1 -1
  72. package/dist/src/helpers/environment.js.map +1 -1
  73. package/dist/src/helpers/getSegmentedItemProperties.js +1 -1
  74. package/dist/src/helpers/getSegmentedItemProperties.js.map +1 -1
  75. package/dist/src/helpers/index.d.ts +1 -1
  76. package/dist/src/helpers/index.d.ts.map +1 -1
  77. package/dist/src/helpers/index.js +3 -3
  78. package/dist/src/helpers/index.js.map +1 -1
  79. package/dist/src/index.d.ts +8 -1
  80. package/dist/src/index.d.ts.map +1 -1
  81. package/dist/src/node/helpers/FileManager.d.ts +2 -0
  82. package/dist/src/node/helpers/FileManager.d.ts.map +1 -1
  83. package/dist/src/node/helpers/index.d.ts.map +1 -1
  84. package/dist/src/node/helpers/index.js +0 -1
  85. package/dist/src/node/helpers/index.js.map +1 -1
  86. package/dist/src/services/db/actors/migrate.js +1 -1
  87. package/dist/src/services/db/actors/migrate.js.map +1 -1
  88. package/dist/src/services/internal/helpers.js +3 -3
  89. package/dist/src/services/internal/helpers.js.map +1 -1
  90. package/dist/src/services/publish/actors/upload.js +1 -1
  91. package/dist/src/services/publish/actors/upload.js.map +1 -1
  92. package/dist/src/types/model.d.ts +2 -15
  93. package/dist/src/types/model.d.ts.map +1 -1
  94. package/package.json +7 -7
  95. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImageSrc.d.ts +0 -5
  96. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImageSrc.d.ts.map +0 -1
  97. package/dist/src/ItemProperty/service/actors/saveValueToDb/saveImageSrc.js.map +0 -1
@@ -1,6 +1,8 @@
1
1
  import { saveAppState } from '../../db/write/saveAppState.js';
2
2
  import filesDownload from './filesDownload.js';
3
+ import debug from 'debug';
3
4
 
5
+ const logger = debug('seedSdk:browser:workers:FileDownloader');
4
6
  class FileDownloader {
5
7
  constructor() {
6
8
  this.workersArchive = [];
@@ -17,7 +19,7 @@ class FileDownloader {
17
19
  const localExcludedTransactions = new Set(excludedTransactions);
18
20
  return new Promise((resolve, reject) => {
19
21
  worker.onmessage = (e) => {
20
- console.log('filesDownload main thread onmessage', e.data);
22
+ logger('filesDownload main thread onmessage', e.data);
21
23
  if (e.data.message === 'excludeTransaction') {
22
24
  localExcludedTransactions.add(e.data.transactionId);
23
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FileDownloader.js","sources":["../../../../../src/browser/workers/FileDownloader.ts"],"sourcesContent":["import { saveAppState } from '@/db/write/saveAppState.js';\nimport filesDownload from './filesDownload.js'\n\n\n\nexport class FileDownloader {\n private cores: number\n private workersArchive: Worker[] = []\n private workerBlobUrl: string\n\n constructor() {\n this.cores = Math.min(navigator.hardwareConcurrency || 4, 4);\n\n this.workerBlobUrl = globalThis.URL.createObjectURL(\n new Blob([filesDownload], { type: 'application/javascript' })\n )\n }\n\n public downloadAll = async ({transactionIds, arweaveHost, excludedTransactions}: DownloadAllFilesParams): Promise<void> => {\n\n if (this.workersArchive.length > 0) {\n for (let i = 0; i < this.workersArchive.length; i++) {\n this.workersArchive[i].terminate()\n delete this.workersArchive[i]\n }\n this.workersArchive = []\n }\n\n const worker = new Worker(this.workerBlobUrl);\n\n this.workersArchive.push(worker)\n\n const localExcludedTransactions = new Set(excludedTransactions)\n\n return new Promise((resolve, reject) => {\n worker.onmessage = (e) => {\n console.log('filesDownload main thread onmessage', e.data);\n\n if (e.data.message === 'excludeTransaction') {\n localExcludedTransactions.add(e.data.transactionId)\n }\n\n if (e.data.done) {\n saveAppState('excludedTransactions', JSON.stringify(Array.from(localExcludedTransactions)))\n .then(() => {\n resolve(e.data)\n })\n .catch((error) => {\n reject(error)\n })\n }\n if (e.data.error) {\n reject(e.data.error)\n }\n }\n \n worker.postMessage({\n transactionIds,\n arweaveHost,\n });\n })\n }\n}\n"],"names":[],"mappings":";;;MAKa,cAAc,CAAA;AAKzB,IAAA,WAAA,GAAA;QAHQ,IAAc,CAAA,cAAA,GAAa,EAAE;QAW9B,IAAW,CAAA,WAAA,GAAG,OAAO,EAAC,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAyB,KAAmB;YAExH,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;AAClC,gBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACnD,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;AAClC,oBAAA,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;;AAE/B,gBAAA,IAAI,CAAC,cAAc,GAAG,EAAE;;YAG1B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;AAE7C,YAAA,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC;AAEhC,YAAA,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,oBAAoB,CAAC;YAE/D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,KAAI;AACrC,gBAAA,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,KAAI;oBACvB,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,CAAC,CAAC,IAAI,CAAC;oBAE1D,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,KAAK,oBAAoB,EAAE;wBAC3C,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;;AAGrD,oBAAA,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE;AACf,wBAAA,YAAY,CAAC,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;6BACzF,IAAI,CAAC,MAAK;AACT,4BAAA,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACjB,yBAAC;AACA,6BAAA,KAAK,CAAC,CAAC,KAAK,KAAI;4BACf,MAAM,CAAC,KAAK,CAAC;AACf,yBAAC,CAAC;;AAEJ,oBAAA,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE;AAChB,wBAAA,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;;AAExB,iBAAC;gBAED,MAAM,CAAC,WAAW,CAAC;oBACjB,cAAc;oBACd,WAAW;AACZ,iBAAA,CAAC;AACJ,aAAC,CAAC;AACJ,SAAC;AAlDC,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,IAAI,CAAC,EAAE,CAAC,CAAC;QAE5D,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,eAAe,CACjD,IAAI,IAAI,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAC9D;;AA+CJ;;;;"}
1
+ {"version":3,"file":"FileDownloader.js","sources":["../../../../../src/browser/workers/FileDownloader.ts"],"sourcesContent":["import { saveAppState } from '@/db/write/saveAppState.js';\nimport filesDownload from './filesDownload.js'\nimport debug from 'debug'\n\nconst logger = debug('seedSdk:browser:workers:FileDownloader')\n\nexport class FileDownloader {\n private cores: number\n private workersArchive: Worker[] = []\n private workerBlobUrl: string\n\n constructor() {\n this.cores = Math.min(navigator.hardwareConcurrency || 4, 4);\n\n this.workerBlobUrl = globalThis.URL.createObjectURL(\n new Blob([filesDownload], { type: 'application/javascript' })\n )\n }\n\n public downloadAll = async ({transactionIds, arweaveHost, excludedTransactions}: DownloadAllFilesParams): Promise<void> => {\n\n if (this.workersArchive.length > 0) {\n for (let i = 0; i < this.workersArchive.length; i++) {\n this.workersArchive[i].terminate()\n delete this.workersArchive[i]\n }\n this.workersArchive = []\n }\n\n const worker = new Worker(this.workerBlobUrl);\n\n this.workersArchive.push(worker)\n\n const localExcludedTransactions = new Set(excludedTransactions)\n\n return new Promise((resolve, reject) => {\n worker.onmessage = (e) => {\n logger('filesDownload main thread onmessage', e.data);\n\n if (e.data.message === 'excludeTransaction') {\n localExcludedTransactions.add(e.data.transactionId)\n }\n\n if (e.data.done) {\n saveAppState('excludedTransactions', JSON.stringify(Array.from(localExcludedTransactions)))\n .then(() => {\n resolve(e.data)\n })\n .catch((error) => {\n reject(error)\n })\n }\n if (e.data.error) {\n reject(e.data.error)\n }\n }\n \n worker.postMessage({\n transactionIds,\n arweaveHost,\n });\n })\n }\n}\n"],"names":[],"mappings":";;;;AAIA,MAAM,MAAM,GAAG,KAAK,CAAC,wCAAwC,CAAC;MAEjD,cAAc,CAAA;AAKzB,IAAA,WAAA,GAAA;QAHQ,IAAc,CAAA,cAAA,GAAa,EAAE;QAW9B,IAAW,CAAA,WAAA,GAAG,OAAO,EAAC,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAyB,KAAmB;YAExH,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;AAClC,gBAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACnD,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;AAClC,oBAAA,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;;AAE/B,gBAAA,IAAI,CAAC,cAAc,GAAG,EAAE;;YAG1B,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;AAE7C,YAAA,IAAI,CAAC,c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AE,wBAAwB,EAAE,CAAC,CAC9D;;AA+CJ;;;;"}
@@ -1,43 +1,52 @@
1
- export declare const clientManager: import("xstate").Actor<import("xstate").StateMachine<import("../types").ClientManagerContext, import("xstate").AnyEventObject, {
2
- [x: string]: import("xstate").ActorRefFromLogic<import("xstate").CallbackActorLogic<import("xstate").EventObject, import("../types").FromCallbackInput<import("../types").ClientManagerContext>, import("xstate").EventObject>> | undefined;
1
+ type ModelDefObj = {
2
+ name: string;
3
+ type: string;
4
+ properties: {
5
+ [key: string]: any;
6
+ };
7
+ };
8
+ export declare const clientManager: import("xstate").Actor<import("xstate").StateMachine<import("..").ClientManagerContext, import("xstate").AnyEventObject, {
9
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").CallbackActorLogic<import("xstate").EventObject, import("..").FromCallbackInput<import("..").ClientManagerContext>, import("xstate").EventObject>> | undefined;
3
10
  }, {
4
11
  src: "initialize";
5
- logic: import("xstate").CallbackActorLogic<import("xstate").EventObject, import("../types").FromCallbackInput<import("../types").ClientManagerContext>, import("xstate").EventObject>;
12
+ logic: import("xstate").CallbackActorLogic<import("xstate").EventObject, import("..").FromCallbackInput<import("..").ClientManagerContext>, import("xstate").EventObject>;
6
13
  id: string | undefined;
7
14
  }, {
8
15
  type: "setAddresses";
9
16
  params: import("xstate").NonReducibleUnknown;
10
- }, never, never, {}, string, import("../types").ClientManagerContext, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").MachineConfig<import("../types").ClientManagerContext, import("xstate").AnyEventObject, {
17
+ }, never, never, {}, string, import("..").ClientManagerContext, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").MachineConfig<import("..").ClientManagerContext, import("xstate").AnyEventObject, {
11
18
  src: "initialize";
12
- logic: import("xstate").CallbackActorLogic<import("xstate").EventObject, import("../types").FromCallbackInput<import("../types").ClientManagerContext>, import("xstate").EventObject>;
19
+ logic: import("xstate").CallbackActorLogic<import("xstate").EventObject, import("..").FromCallbackInput<import("..").ClientManagerContext>, import("xstate").EventObject>;
13
20
  id: string | undefined;
14
21
  }, {
15
22
  type: "setAddresses";
16
23
  params: import("xstate").NonReducibleUnknown;
17
- }, never, never, string, import("../types").ClientManagerContext, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject>>>;
24
+ }, never, never, string, import("..").ClientManagerContext, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject>>>;
18
25
  export declare const ClientManager: {
19
26
  isInitialized: () => boolean;
20
- getService: () => import("xstate").Actor<import("xstate").StateMachine<import("../types").ClientManagerContext, import("xstate").AnyEventObject, {
21
- [x: string]: import("xstate").ActorRefFromLogic<import("xstate").CallbackActorLogic<import("xstate").EventObject, import("../types").FromCallbackInput<import("../types").ClientManagerContext>, import("xstate").EventObject>> | undefined;
27
+ getService: () => import("xstate").Actor<import("xstate").StateMachine<import("..").ClientManagerContext, import("xstate").AnyEventObject, {
28
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").CallbackActorLogic<import("xstate").EventObject, import("..").FromCallbackInput<import("..").ClientManagerContext>, import("xstate").EventObject>> | undefined;
22
29
  }, {
23
30
  src: "initialize";
24
- logic: import("xstate").CallbackActorLogic<import("xstate").EventObject, import("../types").FromCallbackInput<import("../types").ClientManagerContext>, import("xstate").EventObject>;
31
+ logic: import("xstate").CallbackActorLogic<import("xstate").EventObject, import("..").FromCallbackInput<import("..").ClientManagerContext>, import("xstate").EventObject>;
25
32
  id: string | undefined;
26
33
  }, {
27
34
  type: "setAddresses";
28
35
  params: import("xstate").NonReducibleUnknown;
29
- }, never, never, {}, string, import("../types").ClientManagerContext, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").MachineConfig<import("../types").ClientManagerContext, import("xstate").AnyEventObject, {
36
+ }, never, never, {}, string, import("..").ClientManagerContext, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, import("xstate").MachineConfig<import("..").ClientManagerContext, import("xstate").AnyEventObject, {
30
37
  src: "initialize";
31
- logic: import("xstate").CallbackActorLogic<import("xstate").EventObject, import("../types").FromCallbackInput<import("../types").ClientManagerContext>, import("xstate").EventObject>;
38
+ logic: import("xstate").CallbackActorLogic<import("xstate").EventObject, import("..").FromCallbackInput<import("..").ClientManagerContext>, import("xstate").EventObject>;
32
39
  id: string | undefined;
33
40
  }, {
34
41
  type: "setAddresses";
35
42
  params: import("xstate").NonReducibleUnknown;
36
- }, never, never, string, import("../types").ClientManagerContext, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject>>>;
43
+ }, never, never, string, import("..").ClientManagerContext, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject>>>;
37
44
  init: (options: any) => Promise<void>;
38
45
  setAddresses: (addresses: string[]) => Promise<void>;
39
46
  getAddresses: () => Promise<any>;
47
+ addModel: (modelDef: ModelDefObj) => Promise<void>;
40
48
  stop: () => void;
41
49
  unload: () => void;
42
50
  };
51
+ export {};
43
52
  //# sourceMappingURL=ClientManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientManager.d.ts","sourceRoot":"","sources":["../../../src/client/ClientManager.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;oKAIxB,CAAA;AAeF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;oBAQF,GAAG;8BAIO,MAAM,EAAE;;;;CAsBzC,CAAA"}
1
+ {"version":3,"file":"ClientManager.d.ts","sourceRoot":"","sources":["../../../src/client/ClientManager.ts"],"names":[],"mappings":"AAcA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;8JAIxB,CAAA;AAeF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;oBAQF,GAAG;8BAIO,MAAM,EAAE;;yBAab,WAAW;;;CAqBvC,CAAA"}
@@ -2,6 +2,15 @@ import debug from 'debug';
2
2
  import { createActor, waitFor } from 'xstate';
3
3
  import { clientManagerMachine } from './clientManagerMachine.js';
4
4
  import { CLIENT_NOT_INITIALIZED } from '../helpers/constants.js';
5
+ import { BaseDb } from '../db/Db/BaseDb.js';
6
+ import '../seedSchema/SeedSchema.js';
7
+ import '../seedSchema/VersionSchema.js';
8
+ import '../seedSchema/MetadataSchema.js';
9
+ import { appState } from '../seedSchema/AppStateSchema.js';
10
+ import { models } from '../seedSchema/ModelSchema.js';
11
+ import '../seedSchema/ModelUidSchema.js';
12
+ import { eq } from 'drizzle-orm';
13
+ import { getGlobalService } from '../services/global/globalMachine.js';
5
14
 
6
15
  const logger = debug('seedSdk:client');
7
16
  const clientManager = createActor(clientManagerMachine, {
@@ -44,6 +53,18 @@ const ClientManager = {
44
53
  const results = await db.select().from(appState).where(eq(appState.key, 'addresses'));
45
54
  return JSON.parse(results[0]?.value);
46
55
  },
56
+ addModel: async (modelDef) => {
57
+ const db = await BaseDb.getAppDb();
58
+ const existingModels = await db.select().from(models).where(eq(models.name, modelDef.name));
59
+ if (existingModels.length > 0) {
60
+ return;
61
+ }
62
+ await db.insert(models).values({
63
+ name: modelDef.name
64
+ });
65
+ const globalService = getGlobalService();
66
+ globalService.send({ type: 'addModel', modelDef });
67
+ },
47
68
  stop: () => {
48
69
  ensureInitialized();
49
70
  clientManager.stop();
@@ -1 +1 @@
1
- {"version":3,"file":"ClientManager.js","sources":["../../../../src/client/ClientManager.ts"],"sourcesContent":["import debug from 'debug'\nimport { createActor, waitFor } from 'xstate'\nimport { clientManagerMachine } from '@/client/clientManagerMachine'\n// import { BaseDb } from '@/db/Db/BaseDb'\n// import { appState } from '@/seedSchema'\n// import { eq } from 'drizzle-orm'\nimport { CLIENT_NOT_INITIALIZED } from '@/helpers/constants'\n\nconst logger = debug('seedSdk:client')\n\nexport const clientManager = createActor(clientManagerMachine, {\n input: {\n isInitialized: false,\n }\n})\n\nconst subscription = clientManager.subscribe(( snapshot ) => {\n logger('ClientManager snapshot.value:', snapshot.value)\n logger('ClientManager snapshot.context.isInitialized:', snapshot.context.isInitialized)\n})\n\nclientManager.start()\n\nconst ensureInitialized = () => {\n if (!clientManager.getSnapshot().context.isInitialized) {\n throw new Error(CLIENT_NOT_INITIALIZED);\n }\n}\n\nexport const ClientManager = {\n isInitialized: () => {\n return clientManager.getSnapshot().context.isInitialized\n },\n getService: () => {\n ensureInitialized();\n return clientManager;\n },\n init: async (options: any) => {\n clientManager.send({ type: 'init', options });\n await waitFor(clientManager, (snapshot) => snapshot.context.isInitialized);\n },\n setAddresses: async (addresses: string[]) => {\n ensureInitialized();\n logger('setAddresses', addresses);\n clientManager.send({ type: 'setAddresses', addresses });\n await waitFor(clientManager, (snapshot) => !snapshot.context.isSaving);\n logger('setAddresses success', addresses);\n },\n getAddresses: async () => {\n ensureInitialized();\n const db = await BaseDb.getAppDb();\n const results = await db.select().from(appState).where(eq(appState.key, 'addresses'));\n return JSON.parse(results[0]?.value);\n },\n stop: () => {\n ensureInitialized();\n clientManager.stop();\n },\n unload: () => {\n ensureInitialized();\n clientManager.stop();\n subscription.unsubscribe();\n },\n}\n"],"names":[],"mappings":";;;;;AAQA,MAAM,MAAM,GAAiB,KAAK,CAAC,gBAAgB,CAAC;AAEvC,MAAA,aAAa,GAAG,WAAW,CAAC,oBAAoB,EAAE;AAC7D,IAAA,KAAK,EAAE;AACL,QAAA,aAAa,EAAE,KAAK;AACrB;AACF,CAAA;AAED,MAAM,YAAY,GAAW,aAAa,CAAC,SAAS,CAAC,CAAE,QAAQ,KAAK;AAClE,IAAA,MAAM,CAAC,+BAA+B,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvD,MAAM,CAAC,+CAA+C,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC;AAC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AAC,GAAG,EAAE,WAAW,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;KACrC;IACD,IAAI,EAAE,MAAK;AACT,QAAA,iBAAiB,EAAE;QACnB,aAAa,CAAC,IAAI,EAAE;KACrB;IACD,MAAM,EAAE,MAAK;AACX,QAAA,iBAAiB,EAAE;QACnB,aAAa,CAAC,IAAI,EAAE;QACpB,YAAY,CAAC,WAAW,EAAE;KAC3B;;;;;"}
1
+ {"version":3,"file":"ClientManager.js","sources":["../../../../src/client/ClientManager.ts"],"sourcesContent":["import debug from 'debug'\nimport { createActor, waitFor } from 'xstate'\nimport { clientManagerMachine } from '@/client/clientManagerMachine'\n// import { BaseDb } from '@/db/Db/BaseDb'\n// import { appState } from '@/seedSchema'\n// import { eq } from 'drizzle-orm'\nimport { CLIENT_NOT_INITIALIZED } from '@/helpers/constants'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { appState, models } from '@/seedSchema'\nimport { eq } from 'drizzle-orm'\nimport { getGlobalService } from '@/services/global/globalMachine'\n\nconst logger = debug('seedSdk:client')\n\ntype ModelDefObj = {\n name: string\n type: string\n properties: {\n [key: string]: any\n }\n}\n\nexport const clientManager = createActor(clientManagerMachine, {\n input: {\n isInitialized: false,\n }\n})\n\nconst subscription = clientManager.subscribe(( snapshot ) => {\n logger('ClientManager snapshot.value:', snapshot.value)\n logger('ClientManager snapshot.context.isInitialized:', snapshot.context.isInitialized)\n})\n\nclientManager.start()\n\nconst ensureInitialized = () => {\n if (!clientManager.getSnapshot().context.isInitialized) {\n throw new Error(CLIENT_NOT_INITIALIZED);\n }\n}\n\nexport const ClientManager = {\n isInitialized: () => {\n return clientManager.getSnapshot().context.isInitialized\n },\n getService: () => {\n ensureInitialized();\n return clientManager;\n },\n init: async (options: any) => {\n clientManager.send({ type: 'init', options });\n await waitFor(clientManager, (snapshot) => snapshot.context.isInitialized);\n },\n setAddresses: async (addresses: string[]) => {\n ensureInitialized();\n logger('setAddresses', addresses);\n clientManager.send({ type: 'setAddresses', addresses });\n await waitFor(clientManager, (snapshot) => !snapshot.context.isSaving);\n logger('setAddresses success', addresses);\n },\n getAddresses: async () => {\n ensureInitialized();\n const db = await BaseDb.getAppDb();\n const results = await db.select().from(appState).where(eq(appState.key, 'addresses'));\n return JSON.parse(results[0]?.value);\n },\n addModel: async (modelDef: ModelDefObj) => {\n const db = await BaseDb.getAppDb();\n const existingModels = await db.select().from(models).where(eq(models.name, modelDef.name));\n if (existingModels.length > 0) {\n return;\n }\n await db.insert(models).values({\n name: modelDef.name\n })\n const globalService = getGlobalService()\n globalService.send({ type: 'addModel', modelDef });\n },\n stop: () => {\n ensureInitialized();\n clientManager.stop();\n },\n unload: () => {\n ensureInitialized();\n clientManager.stop();\n subscription.unsubscribe();\n },\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,MAAM,GAAiB,KAAK,CAAC,gBAAgB,CAAC;AAUvC,MAAA,aAAa,GAAG,WAAW,CAAC,oBAAoB,EAAE;AAC7D,IAAA,KAAK,EAAE;AACL,QAAA,aAAa,EAAE,KAAK;AACrB;AACF,CAAA;AAED,MAAM,YAAY,GAAW,aAAa,CAAC,SAAS,CAAC,CAAE,QAAQ,KAAK;AAClE,IAAA,MAAM,CAAC,+BAA+B,EAAE,QAAQ,CAAC,KAAK,CAAC;IACvD,MAAM,CAAC,+CAA+C,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC;AACzF,CAAC,CAAC;AAEF,aAAa,CAAC,KAAK,EAAE;AAErB,MAAM,iBAAiB,GAAG,MAAK;IAC7B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE;AACtD,QAAA,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC;;AAE3C,CAAC;AAEY,MAAA,aAAa,GAAG;IAC3B,aAAa,EAAE,MAAK;QAClB,OAAO,aAAa,CAAC,WAAW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,MAAM,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3F,QAAA,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B;;QAEF,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;YAC7B,IAAI,EAAE,QAAQ,CAAC;AAChB,SAAA,CAAC;AACF,QAAA,MAAM,aAAa,GAAG,gBAAgB,EAAE;QACxC,aAAa,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;KACnD;IACD,IAAI,EAAE,MAAK;AACT,QAAA,iBAAiB,EAAE;QACnB,aAAa,CAAC,IAAI,EAAE;KACrB;IACD,MAAM,EAAE,MAAK;AACX,QAAA,iBAAiB,EAAE;QACnB,aAAa,CAAC,IAAI,EAAE;QACpB,YAAY,CAAC,WAAW,EAAE;KAC3B;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"saveAppState.d.ts","sourceRoot":"","sources":["../../../../src/client/actors/saveAppState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAMrC,eAAO,MAAM,YAAY,wGAwCrB,CAAA"}
1
+ {"version":3,"file":"saveAppState.d.ts","sourceRoot":"","sources":["../../../../src/client/actors/saveAppState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAMrC,eAAO,MAAM,YAAY,wGAsCrB,CAAA"}
@@ -18,7 +18,6 @@ const saveAppState = fromCallback(({ sendBack, input: { key, value } }) => {
18
18
  if (!appDb) {
19
19
  throw new Error('App DB not found');
20
20
  }
21
- console.log(`key: ${key} value: ${value}`);
22
21
  appDb.insert(appState)
23
22
  .values({
24
23
  key: key,
@@ -1 +1 @@
1
- {"version":3,"file":"saveAppState.js","sources":["../../../../../src/client/actors/saveAppState.ts"],"sourcesContent":["import { FromCallbackInput } from \"@/types\";\nimport { fromCallback } from \"xstate\";\nimport { ClientManagerContext } from \"@/types\";\nimport { EventObject } from \"xstate\";\nimport debug from \"debug\";\nimport { appState } from \"@/seedSchema\";\n\nconst logger = debug('seedSdk:client:writeToDb')\n\nexport const saveAppState = fromCallback<\nEventObject, \nFromCallbackInput<ClientManagerContext>\n>(\n ({sendBack, input: {key, value}}) => {\n\n const _saveAppState = async () => {\n const { BaseDb } = await import('@/db/Db/BaseDb')\n if (!BaseDb) {\n throw new Error('BaseDb not found')\n }\n const appDb = BaseDb.getAppDb()\n if (!appDb) {\n throw new Error('App DB not found')\n }\n\n console.log(`key: ${key} value: ${value}`)\n\n appDb.insert(appState)\n .values({\n key: key,\n value: JSON.stringify(value),\n })\n .onConflictDoUpdate({\n target: appState.key,\n set: {\n value: JSON.stringify(value),\n },\n })\n \n }\n\n _saveAppState().then(() => {\n sendBack({\n type: 'saveAppStateSuccess',\n key,\n value,\n })\n })\n \n })\n"],"names":[],"mappings":";;;;;;;;;AAOe,KAAK,CAAC,0BAA0B;AAElC,MAAA,YAAY,GAAG,YAAY,CAItC,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,EAAC,EAAC,KAAI;AAElC,IAAA,MAAM,aAAa,GAAG,YAAW;QAC/B,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,uBAAgB,CAAC;QACjD,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC;;AAErC,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE;QAC/B,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC;;QAGrC,OAAO,CAAC,GAAG,CAAC,CAAA,KAAA,EAAQ,GAAG,CAAW,QAAA,EAAA,KAAK,CAAE,CAAA,CAAC;AAE1C,QAAA,KAAK,CAAC,MAAM,CAAC,QAAQ;AAClB,aAAA,MAAM,CAAC;AACN,YAAA,GAAG,EAAE,GAAG;AACR,YAAA,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SAC7B;AACA,aAAA,kBAAkB,CAAC;YAClB,MAAM,EAAE,QAAQ,CAAC,GAAG;AACpB,YAAA,GAAG,EAAE;AACH,gBAAA,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC7B,aAAA;AACF,SAAA,CAAC;AAEN,KAAC;AAED,IAAA,aAAa,EAAE,CAAC,IAAI,CAAC,MAAK;AACxB,QAAA,QAAQ,CAAC;AACP,YAAA,IAAI,EAAE,qBAAqB;YAC3B,GAAG;YACH,KAAK;AACN,SAAA,CAAC;AACJ,KAAC,CAAC;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"saveAppState.js","sources":["../../../../../src/client/actors/saveAppState.ts"],"sourcesContent":["import { FromCallbackInput } from \"@/types\";\nimport { fromCallback } from \"xstate\";\nimport { ClientManagerContext } from \"@/types\";\nimport { EventObject } from \"xstate\";\nimport debug from \"debug\";\nimport { appState } from \"@/seedSchema\";\n\nconst logger = debug('seedSdk:client:writeToDb')\n\nexport const saveAppState = fromCallback<\nEventObject, \nFromCallbackInput<ClientManagerContext>\n>(\n ({sendBack, input: {key, value}}) => {\n\n const _saveAppState = async () => {\n const { BaseDb } = await import('@/db/Db/BaseDb')\n if (!BaseDb) {\n throw new Error('BaseDb not found')\n }\n const appDb = BaseDb.getAppDb()\n if (!appDb) {\n throw new Error('App DB not found')\n }\n\n appDb.insert(appState)\n .values({\n key: key,\n value: JSON.stringify(value),\n })\n .onConflictDoUpdate({\n target: appState.key,\n set: {\n value: JSON.stringify(value),\n },\n })\n \n }\n\n _saveAppState().then(() => {\n sendBack({\n type: 'saveAppStateSuccess',\n key,\n value,\n })\n })\n \n })\n"],"names":[],"mappings":";;;;;;;;;AAOe,KAAK,CAAC,0BAA0B;AAElC,MAAA,YAAY,GAAG,YAAY,CAItC,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,EAAC,EAAC,KAAI;AAElC,IAAA,MAAM,aAAa,GAAG,YAAW;QAC/B,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,OAAO,uBAAgB,CAAC;QACjD,IAAI,CAAC,MAAM,EAAE;AACX,YAAA,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC;;AAErC,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE;QAC/B,IAAI,CAAC,KAAK,EAAE;AACV,YAAA,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC;;AAGrC,QAAA,KAAK,CAAC,MAAM,CAAC,QAAQ;AAClB,aAAA,MAAM,CAAC;AACN,YAAA,GAAG,EAAE,GAAG;AACR,YAAA,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SAC7B;AACA,aAAA,kBAAkB,CAAC;YAClB,MAAM,EAAE,QAAQ,CAAC,GAAG;AACpB,YAAA,GAAG,EAAE;AACH,gBAAA,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC7B,aAAA;AACF,SAAA,CAAC;AAEN,KAAC;AAED,IAAA,aAAa,EAAE,CAAC,IAAI,CAAC,MAAK;AACxB,QAAA,QAAQ,CAAC;AACP,YAAA,IAAI,EAAE,qBAAqB;YAC3B,GAAG;YACH,KAAK;AACN,SAAA,CAAC;AACJ,KAAC,CAAC;AAEJ,CAAC;;;;"}
@@ -0,0 +1,2 @@
1
+ export declare const getModels: () => Promise<any>;
2
+ //# sourceMappingURL=getModels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getModels.d.ts","sourceRoot":"","sources":["../../../../src/db/read/getModels.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,oBAOrB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../../src/events/files/download.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,8BAA8B;;;mBAa1C,CAAA;AAED,eAAO,MAAM,oCAAoC,oCAqKhD,CAAA"}
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../../src/events/files/download.ts"],"names":[],"mappings":"AA0BA,eAAO,MAAM,8BAA8B;;;mBAa1C,CAAA;AAED,eAAO,MAAM,oCAAoC,oCAmKhD,CAAA"}
@@ -145,7 +145,6 @@ const downloadAllFilesBinaryRequestHandler = async () => {
145
145
  logger(error);
146
146
  }
147
147
  }
148
- console.log('[download] Calling downloadAllFiles with transactionIdsToDownload', transactionIdsToDownload);
149
148
  await BaseFileManager.downloadAllFiles({
150
149
  transactionIds: transactionIdsToDownload,
151
150
  arweaveHost: ARWEAVE_HOST,
@@ -1 +1 @@
1
- {"version":3,"file":"download.js","sources":["../../../../../src/events/files/download.ts"],"sourcesContent":["import { syncDbFiles } from '@/services/internal/helpers'\nimport { eventEmitter } from '@/eventBus'\nimport { ARWEAVE_HOST } from '@/services/internal/constants'\nimport { appState } from '@/seedSchema'\nimport { eq } from 'drizzle-orm'\nimport { getAddressesFromDb } from '@/helpers/db'\nimport {\n BaseFileManager,\n} from '@/helpers'\nimport { GET_FILES_METADATA } from '@/schema/file/queries'\nimport debug from 'debug'\nimport { getGlobalService } from '@/services/global/globalMachine'\nimport { waitFor } from 'xstate'\nimport { getMetadata } from '@/db/read/getMetadata'\nimport { saveMetadata } from '@/db/write/saveMetadata'\nimport { GET_TRANSACTION_TAGS } from '@/helpers/ArweaveClient/queries'\nimport { saveAppState } from '@/db/write/saveAppState'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { BaseEasClient, BaseQueryClient, BaseArweaveClient } from '@/helpers'\nimport { getArweave } from '@/helpers/ArweaveClient'\nimport { isBrowser } from '@/helpers/environment'\n\n\nconst logger = debug('seedSdk:files:download')\n\n\nexport const downloadAllFilesRequestHandler = async ({\n endpoints,\n eventId,\n}) => {\n\n if (!isBrowser()) {\n return\n }\n\n await syncDbFiles(endpoints)\n\n eventEmitter.emit('fs.downloadAll.success', { eventId })\n eventEmitter.emit('fs.downloadAllBinary.request', { endpoints })\n}\n\nexport const downloadAllFilesBinaryRequestHandler = async () => {\n let addresses: string[] | undefined\n\n if (BaseDb.isAppDbReady()) {\n addresses = await getAddressesFromDb()\n }\n\n if (!BaseDb.isAppDbReady()) {\n const globalService = getGlobalService()\n const internalService = globalService.getSnapshot().context.internalService\n if (internalService) {\n await waitFor(internalService, (snapshot) => {\n return snapshot.value === 'ready'\n })\n addresses = await getAddressesFromDb()\n }\n }\n\n if (!addresses || addresses.length === 0) {\n return\n }\n\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const { filesMetadata } = await queryClient.fetchQuery({\n queryKey: ['getFilesMetadata', ...addresses],\n queryFn: async () =>\n easClient.request(GET_FILES_METADATA, {\n where: {\n attester: {\n in: addresses,\n },\n schema: {\n is: {\n id: {\n equals:\n '0x55fdefb36fcbbaebeb7d6b41dc3a1a9666e4e42154267c889de064faa7ede517',\n },\n },\n },\n },\n }),\n })\n\n await BaseFileManager.createDirIfNotExists('/files')\n await BaseFileManager.createDirIfNotExists('/files/html')\n await BaseFileManager.createDirIfNotExists('/files/json')\n await BaseFileManager.createDirIfNotExists('/files/images')\n\n const appDb = BaseDb.getAppDb()\n\n if (!appDb) {\n console.warn('[fetchAll/actors] [fetchAllBinaryData] seedDb not available')\n return []\n }\n\n const excludedTransactionsQuery = await appDb\n .select()\n .from(appState)\n .where(eq(appState.key, 'excludedTransactions'))\n\n let excludedTransactions = new Set<string>()\n\n if (excludedTransactionsQuery && excludedTransactionsQuery.length === 1) {\n const valueString = excludedTransactionsQuery[0].value\n if (valueString) {\n const excludedTransactionsArray = JSON.parse(valueString)\n excludedTransactions = new Set(excludedTransactionsArray)\n }\n }\n\n const transactionIds = []\n\n for (const fileMetadata of filesMetadata) {\n const json = JSON.parse(fileMetadata.decodedDataJson)\n const transactionId = json[0].value.value\n if (excludedTransactions.has(transactionId)) {\n continue\n }\n transactionIds.push(transactionId)\n }\n\n const arweave = getArweave()\n\n if (!arweave) {\n console.warn(\n '[fetchAll/actors] [fetchAllBinaryData] arweave not available',\n )\n return []\n }\n\n const arweaveClient = BaseArweaveClient.getArweaveClient()\n\n const transactionIdsToDownload = []\n\n for (const transactionId of transactionIds) {\n\n try {\n const res = await fetch(\n `https://${ARWEAVE_HOST}/tx/${transactionId}/status`,\n )\n\n if (res.status !== 200) {\n logger(\n `[fetchAll/actors] [fetchAllBinaryData] error fetching transaction data for ${transactionId}`,\n )\n\n excludedTransactions.add(transactionId)\n\n await saveAppState(\n 'excludedTransactions',\n JSON.stringify(Array.from(excludedTransactions)),\n )\n\n continue\n }\n \n const { tags: tagsResult } = await queryClient.fetchQuery({\n queryKey: ['getTransactionTags', transactionId],\n queryFn: async () =>\n arweaveClient.request(GET_TRANSACTION_TAGS, {\n transactionId,\n }),\n })\n\n const tags = tagsResult.tags || []\n\n if (tagsResult.tags && tagsResult.tags.length > 0) {\n for (const { name, value } of tags) {\n if (name === 'Content-SHA-256') {\n const metadataRecord = await getMetadata({\n storageTransactionId: transactionId,\n })\n\n if (metadataRecord) {\n await saveMetadata(metadataRecord, {\n contentHash: value,\n })\n }\n }\n }\n }\n\n transactionIdsToDownload.push(transactionId)\n\n \n\n } catch (error) {\n logger(error)\n }\n }\n\n console.log('[download] Calling downloadAllFiles with transactionIdsToDownload', transactionIdsToDownload)\n\n await BaseFileManager.downloadAllFiles({\n transactionIds: transactionIdsToDownload,\n arweaveHost: ARWEAVE_HOST,\n excludedTransactions,\n })\n\n await BaseFileManager.resizeAllImages({\n width: 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E,YACP,aAAa,CAAC,OAAO,CAAC,oBAAoB,EAAE;oBAC1C,aAAa;iBACd,CAAC;AACL,aAAA,CAAC;AAEF,YAAA,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,IAAI,EAAE;AAElC,YAAA,IAAI,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBACjD,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,EAAE;AAClC,oBAAA,IAAI,IAAI,KAAK,iBAAiB,EAAE;AAC9B,wBAAA,MAAM,cAAc,GAAG,MAAM,WAAW,CAAC;AACvC,4BAAA,oBAAoB,EAAE,aAAa;AACpC,yBAAA,CAAC;wBAEF,IAAI,cAAc,EAAE;4BAClB,MAAM,YAAY,CAAC,cAAc,EAAE;AACjC,gCAAA,WAAW,EAAE,KAAK;AACnB,6BAAA,CAAC;;;;;AAMV,YAAA,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC;;QAI5C,OAAO,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC;;;AAIjB,IAAA,OAAO,CAAC,GAAG,CAAC,mEAAmE,EAAE,wBAAwB,CAAC;IAE1G,MAAM,eAAe,CAAC,gBAAgB,CAAC;AACrC,QAAA,cAAc,EAAE,wBAAwB;AACxC,QAAA,WAAW,EAAE,YAAY;QACzB,oBAAoB;AACrB,KAAA,CAAC;IAEF,MAAM,eAAe,CAAC,eAAe,CAAC;AACpC,QAAA,KAAK,EAAE,GAAG;AACV,QAAA,MAAM,EAAE,GAAG;AACZ,KAAA,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"download.js","sources":["../../../../../src/events/files/download.ts"],"sourcesContent":["import { syncDbFiles } from '@/services/internal/helpers'\nimport { eventEmitter } from '@/eventBus'\nimport { ARWEAVE_HOST } from '@/services/internal/constants'\nimport { appState } from '@/seedSchema'\nimport { eq } from 'drizzle-orm'\nimport { getAddressesFromDb } from '@/helpers/db'\nimport {\n BaseFileManager,\n} from '@/helpers'\nimport { GET_FILES_METADATA } from '@/schema/file/queries'\nimport debug from 'debug'\nimport { getGlobalService } from '@/services/global/globalMachine'\nimport { waitFor } from 'xstate'\nimport { getMetadata } from '@/db/read/getMetadata'\nimport { saveMetadata } from '@/db/write/saveMetadata'\nimport { GET_TRANSACTION_TAGS } from '@/helpers/ArweaveClient/queries'\nimport { saveAppState } from '@/db/write/saveAppState'\nimport { BaseDb } from '@/db/Db/BaseDb'\nimport { BaseEasClient, BaseQueryClient, BaseArweaveClient } from '@/helpers'\nimport { getArweave } from '@/helpers/ArweaveClient'\nimport { isBrowser } from '@/helpers/environment'\n\n\nconst logger = debug('seedSdk:files:download')\n\n\nexport const downloadAllFilesRequestHandler = async ({\n endpoints,\n eventId,\n}) => {\n\n if (!isBrowser()) {\n return\n }\n\n await syncDbFiles(endpoints)\n\n eventEmitter.emit('fs.downloadAll.success', { eventId })\n eventEmitter.emit('fs.downloadAllBinary.request', { endpoints })\n}\n\nexport const downloadAllFilesBinaryRequestHandler = async () => {\n let addresses: string[] | undefined\n\n if (BaseDb.isAppDbReady()) {\n addresses = await getAddressesFromDb()\n }\n\n if (!BaseDb.isAppDbReady()) {\n const globalService = getGlobalService()\n const internalService = globalService.getSnapshot().context.internalService\n if (internalService) {\n await waitFor(internalService, (snapshot) => {\n return snapshot.value === 'ready'\n })\n addresses = await getAddressesFromDb()\n }\n }\n\n if (!addresses || addresses.length === 0) {\n return\n }\n\n const queryClient = BaseQueryClient.getQueryClient()\n const easClient = BaseEasClient.getEasClient()\n\n const { filesMetadata } = await queryClient.fetchQuery({\n queryKey: ['getFilesMetadata', ...addresses],\n queryFn: async () =>\n easClient.request(GET_FILES_METADATA, {\n where: {\n attester: {\n in: addresses,\n },\n schema: {\n is: {\n id: {\n equals:\n '0x55fdefb36fcbbaebeb7d6b41dc3a1a9666e4e42154267c889de064faa7ede517',\n },\n },\n },\n },\n }),\n })\n\n await BaseFileManager.createDirIfNotExists('/files')\n await BaseFileManager.createDirIfNotExists('/files/html')\n await BaseFileManager.createDirIfNotExists('/files/json')\n await BaseFileManager.createDirIfNotExists('/files/images')\n\n const appDb = BaseDb.getAppDb()\n\n if (!appDb) {\n console.warn('[fetchAll/actors] [fetchAllBinaryData] seedDb not available')\n return []\n }\n\n const excludedTransactionsQuery = await appDb\n .select()\n .from(appState)\n .where(eq(appState.key, 'excludedTransactions'))\n\n let excludedTransactions = new Set<string>()\n\n if (excludedTransactionsQuery && excludedTransactionsQuery.length === 1) {\n const valueString = excludedTransactionsQuery[0].value\n if (valueString) {\n const excludedTransactionsArray = JSON.parse(valueString)\n excludedTransactions = new Set(excludedTransactionsArray)\n }\n }\n\n const transactionIds = []\n\n for (const fileMetadata of filesMetadata) {\n const json = JSON.parse(fileMetadata.decodedDataJson)\n const transactionId = json[0].value.value\n if (excludedTransactions.has(transactionId)) {\n continue\n }\n transactionIds.push(transactionId)\n }\n\n const arweave = getArweave()\n\n if (!arweave) {\n console.warn(\n '[fetchAll/actors] [fetchAllBinaryData] arweave not available',\n )\n return []\n }\n\n const arweaveClient = BaseArweaveClient.getArweaveClient()\n\n const transactionIdsToDownload = []\n\n for (const transactionId of transactionIds) {\n\n try {\n const res = await fetch(\n `https://${ARWEAVE_HOST}/tx/${transactionId}/status`,\n )\n\n if (res.status !== 200) {\n logger(\n `[fetchAll/actors] [fetchAllBinaryData] error fetching transaction data for ${transactionId}`,\n )\n\n excludedTransactions.add(transactionId)\n\n await saveAppState(\n 'excludedTransactions',\n JSON.stringify(Array.from(excludedTransactions)),\n )\n\n continue\n }\n \n const { tags: tagsResult } = await queryClient.fetchQuery({\n queryKey: ['getTransactionTags', transactionId],\n queryFn: async () =>\n arweaveClient.request(GET_TRANSACTION_TAGS, {\n transactionId,\n }),\n })\n\n const tags = tagsResult.tags || []\n\n if (tagsResult.tags && tagsResult.tags.length > 0) {\n for (const { name, value } of tags) {\n if (name === 'Content-SHA-256') {\n const metadataRecord = await getMetadata({\n storageTransactionId: transactionId,\n })\n\n if (metadataRecord) {\n await saveMetadata(metadataRecord, {\n contentHash: value,\n })\n }\n }\n }\n }\n\n transactionIdsToDownload.push(transactionId)\n\n \n\n } catch (error) {\n logger(error)\n }\n }\n\n await BaseFileManager.downloadAllFiles({\n transactionIds: transactionIdsToDownload,\n arweaveHost: ARWEAVE_HOST,\n excludedTransactions,\n })\n\n await BaseFileManager.resizeAllImages({\n width: 480,\n height: 480,\n })\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,MAAM,GAAG,KAAK,CAAC,wBAAwB,CAAC;AAGvC,MAAM,8BAA8B,GAAG,OAAO,EACnD,SAAS,EACT,OAAO,GACR,KAAI;AAEH,IAAA,IAAI,CAAC,SAAS,EAAE,EAAE;QAChB;;AAGF,IAAA,MAAM,WAAW,CAAC,SAAS,CAAC;IAE5B,YAAY,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,OAAO,EAAE,CAAC;IACxD,YAAY,CAAC,IAAI,CAAC,8BAA8B,EAAE,EAAE,SAAS,EAAE,CAAC;AAClE;AAEa,MAAA,oCAAoC,GAAG,YAAW;AAC7D,IAAA,IAAI,SAA+B;AAEnC,IAAA,IAAI,MAAM,CAAC,YAAY,EAAE,EAAE;AACzB,QAAA,SAAS,GAAG,MAAM,kBAAkB,EAAE;;AAGxC,IAAA,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE;AAC1B,QAAA,MAAM,aAAa,GAAG,gBAAgB,EAAE;QACxC,MAAM,eAAe,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,eAAe;QAC3E,IAAI,eAAe,EAAE;AACnB,YAAA,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,QAAQ,KAAI;AAC1C,gBAAA,OAAO,QAAQ,CAAC,KAAK,KAAK,OAAO;AACnC,aAAC,CAAC;AACF,YAAA,SAAS,GAAG,MAAM,kBAAkB,EAAE;;;IAI1C,IAAI,CAAC,SA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.d.ts","sourceRoot":"","sources":["../../../../src/events/files/index.ts"],"names":[],"mappings":"AA2DA,eAAO,MAAM,gBAAgB,YAW5B,CAAA;AAED,eAAO,MAAM,mBAAmB,eAE/B,CAAA;AAED,eAAO,MAAM,eAAe,eAE3B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/events/files/index.ts"],"names":[],"mappings":"AA0DA,eAAO,MAAM,gBAAgB,YAW5B,CAAA;AAED,eAAO,MAAM,mBAAmB,eAE/B,CAAA;AAED,eAAO,MAAM,eAAe,eAE3B,CAAA"}
@@ -22,7 +22,6 @@ const fsInitHandler = async () => {
22
22
  // })
23
23
  if (isBrowser()) {
24
24
  const FileManager = (await import('../../browser/helpers/FileManager.js')).FileManager;
25
- console.log('FileManager', FileManager);
26
25
  BaseFileManager.setPlatformClass(FileManager);
27
26
  }
28
27
  // if (!isBrowser()) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/events/files/index.ts"],"sourcesContent":["import { eventEmitter } from '@/eventBus'\nimport { downloadAllFilesBinaryRequestHandler, downloadAllFilesRequestHandler } from './download'\nimport { BaseFileManager } from '@/helpers'\nimport { isBrowser } from '@/helpers/environment'\n\n\nlet isInitialized = false\n\n\nconst fsInitHandler = async () => {\n if ( isInitialized ) {\n eventEmitter.emit('fs.init.response', { success: true })\n return\n }\n\n try {\n\n // console.log('fsInitHandler isBrowser', isBrowser())\n\n // console.log({\n // environment: process.env.NEXT_RUNTIME || 'unknown',\n // isServer: typeof window === 'undefined',\n // nodeEnv: process.env.NODE_ENV,\n // // Log what's available in global scope\n // hasWindow: typeof window !== 'undefined',\n // hasDocument: typeof document !== 'undefined',\n // })\n\n if (\n isBrowser()\n ) {\n const FileManager = (await import('../../browser/helpers/FileManager')).FileManager\n console.log('FileManager', FileManager)\n BaseFileManager.setPlatformClass(FileManager)\n }\n\n // if (!isBrowser()) {\n // await import('@/node/helpers/FileManager')\n // }\n\n await BaseFileManager.initializeFileSystem()\n\n isInitialized = true\n\n eventEmitter.emit('fs.init.response', { success: true })\n } catch ( e ) {\n if ( !isInitialized ) {\n console.error('[fs.init] error initializing fs', e)\n eventEmitter.emit('fs.init.response', {\n success: false,\n error: e,\n })\n }\n // TODO: We can ignore this for now but should figure out if this is being called excessively\n }\n}\n\nlet areReady = false\n\nexport const setupFsListeners = () => {\n eventEmitter.addListener(\n 'fs.downloadAll.request',\n downloadAllFilesRequestHandler,\n )\n eventEmitter.addListener(\n 'fs.downloadAllBinary.request',\n downloadAllFilesBinaryRequestHandler,\n )\n eventEmitter.addListener('fs.init', fsInitHandler)\n areReady = true\n}\n\nexport const areFsListenersReady = () => {\n return areReady\n}\n\nexport const isFsInitialized = () => {\n return isInitialized\n}\n"],"names":[],"mappings":";;;;;;AAMA,IAAI,aAAa,GAAG,KAAK;AAGzB,MAAM,aAAa,GAAG,YAAW;IAC/B,IAAK,aAAa,EAAG;QACnB,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACxD;;AAGF,IAAA,IAAI;;;;;;;;;;QAaF,IACE,SAAS,EAAE,EACX;YACA,MAAM,WAAW,GAAG,CAAC,MAAM,OAAO,sCAAmC,CAAC,EAAE,WAAW;AACnF,YAAA,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,WAAW,CAAC;AACvC,YAAA,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC;;;;;AAO/C,QAAA,MAAM,eAAe,CAAC,oBAAoB,EAAE;QAE5C,aAAa,GAAG,IAAI;QAEpB,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;IACxD,OAAQ,CAAC,EAAG;QACZ,IAAK,CAAC,aAAa,EAAG;AACpB,YAAA,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,CAAC,CAAC;AACnD,YAAA,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE;AACpC,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,KAAK,EAAE,CAAC;AACT,aAAA,CAAC;;;;AAIR,CAAC;AAED,IAAI,QAAQ,GAAG,KAAK;AAEb,MAAM,gBAAgB,GAAG,MAAK;AACnC,IAAA,YAAY,CAAC,WAAW,CACtB,wBAAwB,EACxB,8BAA8B,CAC/B;AACD,IAAA,YAAY,CAAC,WAAW,CACtB,8BAA8B,EAC9B,oCAAoC,CACrC;AACD,IAAA,YAAY,CAAC,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC;IAClD,QAAQ,GAAG,IAAI;AACjB;AAEO,MAAM,mBAAmB,GAAG,MAAK;AACtC,IAAA,OAAO,QAAQ;AACjB;AAEO,MAAM,eAAe,GAAG,MAAK;AAClC,IAAA,OAAO,aAAa;AACtB;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/events/files/index.ts"],"sourcesContent":["import { eventEmitter } from '@/eventBus'\nimport { downloadAllFilesBinaryRequestHandler, downloadAllFilesRequestHandler } from './download'\nimport { BaseFileManager } from '@/helpers'\nimport { isBrowser } from '@/helpers/environment'\n\n\nlet isInitialized = false\n\n\nconst fsInitHandler = async () => {\n if ( isInitialized ) {\n eventEmitter.emit('fs.init.response', { success: true })\n return\n }\n\n try {\n\n // console.log('fsInitHandler isBrowser', isBrowser())\n\n // console.log({\n // environment: process.env.NEXT_RUNTIME || 'unknown',\n // isServer: typeof window === 'undefined',\n // nodeEnv: process.env.NODE_ENV,\n // // Log what's available in global scope\n // hasWindow: typeof window !== 'undefined',\n // hasDocument: typeof document !== 'undefined',\n // })\n\n if (\n isBrowser()\n ) {\n const FileManager = (await import('../../browser/helpers/FileManager')).FileManager\n BaseFileManager.setPlatformClass(FileManager)\n }\n\n // if (!isBrowser()) {\n // await import('@/node/helpers/FileManager')\n // }\n\n await BaseFileManager.initializeFileSystem()\n\n isInitialized = true\n\n eventEmitter.emit('fs.init.response', { success: true })\n } catch ( e ) {\n if ( !isInitialized ) {\n console.error('[fs.init] error initializing fs', e)\n eventEmitter.emit('fs.init.response', {\n success: false,\n error: e,\n })\n }\n // TODO: We can ignore this for now but should figure out if this is being called excessively\n }\n}\n\nlet areReady = false\n\nexport const setupFsListeners = () => {\n eventEmitter.addListener(\n 'fs.downloadAll.request',\n downloadAllFilesRequestHandler,\n )\n eventEmitter.addListener(\n 'fs.downloadAllBinary.request',\n downloadAllFilesBinaryRequestHandler,\n )\n eventEmitter.addListener('fs.init', fsInitHandler)\n areReady = true\n}\n\nexport const areFsListenersReady = () => {\n return areReady\n}\n\nexport const isFsInitialized = () => {\n return isInitialized\n}\n"],"names":[],"mappings":";;;;;;AAMA,IAAI,aAAa,GAAG,KAAK;AAGzB,MAAM,aAAa,GAAG,YAAW;IAC/B,IAAK,aAAa,EAAG;QACnB,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACxD;;AAGF,IAAA,IAAI;;;;;;;;;;QAaF,IACE,SAAS,EAAE,EACX;YACA,MAAM,WAAW,GAAG,CAAC,MAAM,OAAO,sCAAmC,CAAC,EAAE,WAAW;AACnF,YAAA,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC;;;;;AAO/C,QAAA,MAAM,eAAe,CAAC,oBAAoB,EAAE;QAE5C,aAAa,GAAG,IAAI;QAEpB,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;IACxD,OAAQ,CAAC,EAAG;QACZ,IAAK,CAAC,aAAa,EAAG;AACpB,YAAA,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,CAAC,CAAC;AACnD,YAAA,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE;AACpC,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,KAAK,EAAE,CAAC;AACT,aAAA,CAAC;;;;AAIR,CAAC;AAED,IAAI,QAAQ,GAAG,KAAK;AAEb,MAAM,gBAAgB,GAAG,MAAK;AACnC,IAAA,YAAY,CAAC,WAAW,CACtB,wBAAwB,EACxB,8BAA8B,CAC/B;AACD,IAAA,YAAY,CAAC,WAAW,CACtB,8BAA8B,EAC9B,oCAAoC,CACrC;AACD,IAAA,YAAY,CAAC,WAAW,CAAC,SAAS,EAAE,aAAa,CAAC;IAClD,QAAQ,GAAG,IAAI;AACjB;AAEO,MAAM,mBAAmB,GAAG,MAAK;AACtC,IAAA,OAAO,QAAQ;AACjB;AAEO,MAAM,eAAe,GAAG,MAAK;AAClC,IAAA,OAAO,aAAa;AACtB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"allItems.d.ts","sourceRoot":"","sources":["../../../../src/events/services/allItems.ts"],"names":[],"mappings":"AAIA,KAAK,gBAAgB,GAAG;IACtB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,kBAAkB,UAAiB,gBAAgB,kBAsB/D,CAAA"}
1
+ {"version":3,"file":"allItems.d.ts","sourceRoot":"","sources":["../../../../src/events/services/allItems.ts"],"names":[],"mappings":"AAIA,KAAK,gBAAgB,GAAG;IACtB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,kBAAkB,UAAiB,gBAAgB,kBAqB/D,CAAA"}
@@ -10,7 +10,6 @@ const saveServiceHandler = async (event) => {
10
10
  const nameOfService = `${modelName}Service`;
11
11
  const service = globalService.getSnapshot().context[nameOfService];
12
12
  if (!service) {
13
- console.log(`[saveServiceHandler] service not found: ${nameOfService}`);
14
13
  return;
15
14
  }
16
15
  await saveAppState(`snapshot__${modelName}`, JSON.stringify(service.getPersistedSnapshot()));
@@ -1 +1 @@
1
- {"version":3,"file":"allItems.js","sources":["../../../../../src/events/services/allItems.ts"],"sourcesContent":["import { getGlobalService } from '@/services/global/globalMachine'\n\nimport { saveAppState } from '@/db/write/saveAppState'\n\ntype SaveServiceEvent = {\n modelName: string\n}\n\nexport const saveServiceHandler = async (event: SaveServiceEvent) => {\n const globalService = getGlobalService()\n\n if (!globalService || !globalService.getSnapshot().context) {\n return\n }\n\n const { modelName } = event\n\n const nameOfService: string = `${modelName}Service`\n\n const service = globalService.getSnapshot().context[nameOfService]\n\n if (!service) {\n console.log(`[saveServiceHandler] service not found: ${nameOfService}`)\n return\n }\n\n await saveAppState(\n `snapshot__${modelName}`,\n JSON.stringify(service.getPersistedSnapshot()),\n )\n}\n"],"names":[],"mappings":";;;MAQa,kBAAkB,GAAG,OAAO,KAAuB,KAAI;AAClE,IAAA,MAAM,aAAa,GAAG,gBAAgB,EAAE;IAExC,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE;QAC1D;;AAGF,IAAA,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK;AAE3B,IAAA,MAAM,aAAa,GAAW,CAAG,EAAA,SAAS,SAAS;IAEnD,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;IAElE,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,OAAO,CAAC,GAAG,CAAC,2CAA2C,aAAa,CAAA,CAAE,CAAC;QACvE;;AAGF,IAAA,MAAM,YAAY,CAChB,CAAA,UAAA,EAAa,SAAS,CAAA,CAAE,EACxB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAC/C;AACH;;;;"}
1
+ {"version":3,"file":"allItems.js","sources":["../../../../../src/events/services/allItems.ts"],"sourcesContent":["import { getGlobalService } from '@/services/global/globalMachine'\n\nimport { saveAppState } from '@/db/write/saveAppState'\n\ntype SaveServiceEvent = {\n modelName: string\n}\n\nexport const saveServiceHandler = async (event: SaveServiceEvent) => {\n const globalService = getGlobalService()\n\n if (!globalService || !globalService.getSnapshot().context) {\n return\n }\n\n const { modelName } = event\n\n const nameOfService: string = `${modelName}Service`\n\n const service = globalService.getSnapshot().context[nameOfService]\n\n if (!service) {\n return\n }\n\n await saveAppState(\n `snapshot__${modelName}`,\n JSON.stringify(service.getPersistedSnapshot()),\n )\n}\n"],"names":[],"mappings":";;;MAQa,kBAAkB,GAAG,OAAO,KAAuB,KAAI;AAClE,IAAA,MAAM,aAAa,GAAG,gBAAgB,EAAE;IAExC,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE;QAC1D;;AAGF,IAAA,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK;AAE3B,IAAA,MAAM,aAAa,GAAW,CAAG,EAAA,SAAS,SAAS;IAEnD,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;IAElE,IAAI,CAAC,OAAO,EAAE;QACZ;;AAGF,IAAA,MAAM,YAAY,CAChB,CAAA,UAAA,EAAa,SAAS,CAAA,CAAE,EACxB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAC/C;AACH;;;;"}
@@ -16,5 +16,7 @@ export declare abstract class BaseFileManager {
16
16
  static readFileAsBuffer(filePath: string): Promise<Buffer>;
17
17
  static readFileAsString(filePath: string): Promise<string>;
18
18
  static getFs(): Promise<any>;
19
+ static getParentDirPath(filePath: string): string;
20
+ static getFilenameFromPath(filePath: string): string;
19
21
  }
20
22
  //# sourceMappingURL=BaseFileManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseFileManager.d.ts","sourceRoot":"","sources":["../../../../src/helpers/FileManager/BaseFileManager.ts"],"names":[],"mappings":"AAAA,8BAAsB,eAAe;IACnC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAQ;IAC5C,OAAO,CAAC,MAAM,CAAC,YAAY,CAAQ;IAEnC,MAAM,CAAC,aAAa,EAAE,OAAO,eAAe,CAAA;IAE5C,MAAM,CAAC,gBAAgB,CAAE,aAAa,EAAE,OAAO,eAAe;WAIjD,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAUlD,MAAM,CAAC,qBAAqB,CAAE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GAAG,MAAM;IAIjD,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAGrD"}
@@ -47,6 +47,12 @@ class BaseFileManager {
47
47
  static async getFs() {
48
48
  return this.PlatformClass.getFs();
49
49
  }
50
+ static getParentDirPath(filePath) {
51
+ return this.PlatformClass.getParentDirPath(filePath);
52
+ }
53
+ static getFilenameFromPath(filePath) {
54
+ return this.PlatformClass.getFilenameFromPath(filePath);
55
+ }
50
56
  }
51
57
  BaseFileManager.fileSystemInitialized = false;
52
58
  BaseFileManager.initializing = false;
@@ -1 +1 @@
1
- {"version":3,"file":"BaseFileManager.js","sources":["../../../../../src/helpers/FileManager/BaseFileManager.ts"],"sourcesContent":["export abstract class BaseFileManager {\n private static fileSystemInitialized = false\n private static initializing = false\n\n static PlatformClass: typeof BaseFileManager\n\n static setPlatformClass( platformClass: typeof BaseFileManager ) {\n this.PlatformClass = platformClass\n }\n\n static async initializeFileSystem(): Promise<void> {\n if (this.initializing || this.fileSystemInitialized) {\n return Promise.resolve()\n }\n this.initializing = true\n await this.PlatformClass.initializeFileSystem()\n this.fileSystemInitialized = true\n this.initializing = false\n }\n\n static getContentUrlFromPath( path: string ): Promise<string | undefined> {\n return this.PlatformClass.getContentUrlFromPath(path)\n }\n\n static downloadAllFiles( {\n transactionIds,\n arweaveHost,\n excludedTransactions,\n }: DownloadAllFilesParams ): Promise<void> {\n return this.PlatformClass.downloadAllFiles({ transactionIds, arweaveHost, excludedTransactions })\n }\n\n static resizeImage( { filePath, width, height }: ResizeImageParams ): Promise<void> {\n return this.PlatformClass.resizeImage({ filePath, width, height })\n }\n\n static resizeAllImages( { width, height }: ResizeAllImagesParams ): Promise<void> {\n return this.PlatformClass.resizeAllImages({ width, height })\n }\n\n static pathExists(filePath: string): Promise<boolean> {\n return this.PlatformClass.pathExists(filePath)\n }\n\n static createDirIfNotExists(filePath: string): Promise<void> {\n return this.PlatformClass.createDirIfNotExists(filePath)\n }\n\n static async waitForFile(filePath: string): Promise<boolean> {\n return this.PlatformClass.waitForFile(filePath)\n }\n\n static async saveFile(filePath: string, content: string | Blob | ArrayBuffer): Promise<void> {\n return this.PlatformClass.saveFile(filePath, content)\n }\n\n static async readFile(filePath: string): Promise<File> {\n return this.PlatformClass.readFile(filePath)\n }\n\n static async readFileAsBuffer(filePath: string): Promise<Buffer> {\n return this.PlatformClass.readFileAsBuffer(filePath)\n }\n\n static async readFileAsString(filePath: string): Promise<string> {\n return this.PlatformClass.readFileAsString(filePath)\n }\n\n static async getFs(): Promise<any> {\n return this.PlatformClass.getFs()\n }\n}\n"],"names":[],"mappings":"MAAsB,eAAe,CAAA;IAMnC,OAAO,gBAAgB,CAAE,aAAqC,EAAA;AAC5D,QAAA,IAAI,CAAC,aAAa,GAAG,aAAa;;IAGpC,aAAa,oBAAoB,GAAA;QAC/B,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,qBAAqB,EAAE;AACnD,YAAA,OAAO,OAAO,CAAC,OAAO,EAAE;;AAE1B,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI;AACxB,QAAA,MAAM,IAAI,CAAC,aAAa,CAAC,oBAAoB,EAAE;AAC/C,QAAA,IAAI,CAAC,qBAAqB,GAAG,IAAI;AACjC,QAAA,IAAI,CAAC,YAAY,GAAG,KAAK;;IAG3B,OAAO,qBAAqB,CAAE,IAAY,EAAA;QACxC,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,IAAI,CAAC;;IAGvD,OAAO,gBAAgB,CAAE,EACE,cAAc,EACd,WAAW,EACX,oBAAoB,GACG,EAAA;AAChD,QAAA,OAAO,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;;IAGnG,OAAO,WAAW,CAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAqB,EAAA;AAChE,QAAA,OAAO,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,E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sourcesContent":["export abstract class BaseFileManager {\n private static fileSystemInitialized = false\n private static initializing = false\n\n static PlatformClass: typeof BaseFileManager\n\n static setPlatformClass( platformClass: typeof BaseFileManager ) {\n this.PlatformClass = platformClass\n }\n\n static async initializeFileSystem(): Promise<void> {\n if (this.initializing || this.fileSystemInitialized) {\n return Promise.resolve()\n }\n this.initializing = true\n await this.PlatformClass.initializeFileSystem()\n this.fileSystemInitialized = true\n this.initializing = false\n }\n\n static getContentUrlFromPath( path: string ): Promise<string | undefined> {\n return this.PlatformClass.getContentUrlFromPath(path)\n }\n\n static downloadAllFiles( {\n transactionIds,\n arweaveHost,\n excludedTransactions,\n }: DownloadAllFilesParams ): Promise<void> {\n return this.PlatformClass.downloadAllFiles({ transactionIds, arweaveHost, excludedTransactions })\n }\n\n static resizeImage( { filePath, width, height }: ResizeImageParams ): Promise<void> {\n return this.PlatformClass.resizeImage({ filePath, width, height })\n }\n\n static resizeAllImages( { width, height }: ResizeAllImagesParams ): Promise<void> {\n return this.PlatformClass.resizeAllImages({ width, height })\n }\n\n static pathExists(filePath: string): Promise<boolean> {\n return this.PlatformClass.pathExists(filePath)\n }\n\n static createDirIfNotExists(filePath: string): Promise<void> {\n return this.PlatformClass.createDirIfNotExists(filePath)\n }\n\n static async waitForFile(filePath: string): Promise<boolean> {\n return this.PlatformClass.waitForFile(filePath)\n }\n\n static async saveFile(filePath: string, content: string | Blob | ArrayBuffer): Promise<void> {\n return this.PlatformClass.saveFile(filePath, content)\n }\n\n static async readFile(filePath: string): Promise<File> {\n return this.PlatformClass.readFile(filePath)\n }\n\n static async readFileAsBuffer(filePath: string): Promise<Buffer> {\n return this.PlatformClass.readFileAsBuffer(filePath)\n }\n\n static async readFileAsString(filePath: string): Promise<string> {\n return this.PlatformClass.readFileAsString(filePath)\n }\n\n static async getFs(): Promise<any> {\n return this.PlatformClass.getFs()\n }\n\n static getParentDirPath(filePath: string): string {\n return this.PlatformClass.getParentDirPath(filePath)\n }\n\n static getFilenameFromPath(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ES = {
9
9
  Number: {
10
10
  eas: 'uint8',
11
11
  },
12
- ImageSrc: {
12
+ Image: {
13
13
  eas: 'string',
14
14
  },
15
15
  Relation: {
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/helpers/constants.ts"],"sourcesContent":["import {\n AttestationRequestData,\n ZERO_BYTES,\n ZERO_BYTES32,\n ZERO_ADDRESS,\n} from '@ethereum-attestation-service/eas-sdk'\n\n\nexport const SCHEMA_NJK = 'schema.njk'\nexport const SCHEMA_TS = 'schema.ts'\n\nexport const INTERNAL_DATA_TYPES = {\n Text: {\n eas: 'string',\n },\n Number: {\n eas: 'uint8',\n },\n ImageSrc: {\n eas: 'string',\n },\n Relation: {\n eas: 'bytes32',\n },\n List: {\n eas: 'bytes32[]',\n },\n FileSrc: {\n eas: 'string',\n },\n Json: {\n eas: 'string',\n },\n Blob: {\n eas: 'bytes32',\n },\n}\n\nexport const internalPropertyNames = [\n 'localId',\n 'uid',\n 'seedLocalId',\n 'seedUid',\n 'schemaUid',\n 'attestationCreatedAt',\n 'createdAt',\n 'updatedAt',\n 'versionsCount',\n 'lastVersionPublishedAt',\n 'latestVersionLocalId',\n 'versionLocalId',\n 'lastLocalUpdateAt',\n 'storageTransactionId',\n 'versionUid',\n 'refSeedType',\n 'refValueType',\n 'refResolvedValue',\n 'refResolvedDisplayValue',\n 'type',\n]\n\nexport const VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA =\n '0x13c0fd59d69dbce40501a41f8b37768d26dd2e2bb0cad64615334d84f7b9bdf6'\n\nexport const defaultAttestationData: AttestationRequestData = {\n recipient: ZERO_ADDRESS,\n revocable: true,\n value: BigInt(0),\n refUID: ZERO_BYTES32,\n expirationTime: BigInt(0),\n data: ZERO_BYTES,\n}\n\nexport enum ImageSize {\n EXTRA_SMALL = 480,\n SMALL = 760,\n MEDIUM = 1024,\n LARGE = 1440,\n EXTRA_LARGE = 1920,\n}\n\nexport const CLIENT_NOT_INITIALIZED = 'ClientManager is not initialized. Please call init() first.'\n\nexport const INIT_SCRIPT_SUCCESS_MESSAGE = '[Seed Protocol] Finished running init script'\n"],"names":[],"mappings":";;AAQO,MAAM,UAAU,GAAG;AACnB,MAAM,SAAS,GAAG;AAEZ,MAAA,mBAAmB,GAAG;AACjC,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,GAAG,EAAE,OAAO;AACb,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,GAAG,EAAE,SAAS;AACf,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,WAAW;AACjB,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,SAAS;AACf,KAAA;;AAGU,MAAA,qBAAqB,GAAG;IACnC,SAAS;IACT,KAAK;IACL,aAAa;IACb,SAAS;IACT,WAAW;IACX,sBAAsB;IACtB,WAAW;IACX,WAAW;IACX,eAAe;IACf,wBAAwB;IACxB,sBAAsB;IACtB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,YAAY;IACZ,aAAa;IACb,cAAc;IACd,kBAAkB;IAClB,yBAAyB;IACzB,MAAM;;AAGD,MAAM,mCAAmC,GAC9C;AAEW,MAAA,sBAAsB,GAA2B;AAC5D,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAChB,IAAA,MAAM,EAAE,YAAY;AACpB,IAAA,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AACzB,IAAA,IAAI,EAAE,UAAU;;IAGN;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,aAAA,CAAA,GAAA,GAAA,CAAA,GAAA,aAAiB;AACjB,IAAA,SAAA,CAAA,SAAA,CAAA,OAAA,CAAA,GAAA,GAAA,CAAA,GAAA,OAAW;AACX,IAAA,SAAA,CAAA,SAAA,CAAA,QAAA,CAAA,GAAA,IAAA,CAAA,GAAA,QAAa;AACb,IAAA,SAAA,CAAA,SAAA,CAAA,OAAA,CAAA,GAAA,IAAA,CAAA,GAAA,OAAY;AACZ,IAAA,SAAA,CAAA,SAAA,CAAA,aAAA,CAAA,GAAA,IAAA,CAAA,GAAA,aAAkB;AACpB,CAAC,EANW,SAAS,KAAT,SAAS,GAMpB,EAAA,CAAA,CAAA;AAEM,MAAM,sBAAsB,GAAG;AAE/B,MAAM,2BAA2B,GAAG;;;;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/helpers/constants.ts"],"sourcesContent":["import {\n AttestationRequestData,\n ZERO_BYTES,\n ZERO_BYTES32,\n ZERO_ADDRESS,\n} from '@ethereum-attestation-service/eas-sdk'\n\n\nexport const SCHEMA_NJK = 'schema.njk'\nexport const SCHEMA_TS = 'schema.ts'\n\nexport const INTERNAL_DATA_TYPES = {\n Text: {\n eas: 'string',\n },\n Number: {\n eas: 'uint8',\n },\n Image: {\n eas: 'string',\n },\n Relation: {\n eas: 'bytes32',\n },\n List: {\n eas: 'bytes32[]',\n },\n FileSrc: {\n eas: 'string',\n },\n Json: {\n eas: 'string',\n },\n Blob: {\n eas: 'bytes32',\n },\n}\n\nexport const internalPropertyNames = [\n 'localId',\n 'uid',\n 'seedLocalId',\n 'seedUid',\n 'schemaUid',\n 'attestationCreatedAt',\n 'createdAt',\n 'updatedAt',\n 'versionsCount',\n 'lastVersionPublishedAt',\n 'latestVersionLocalId',\n 'versionLocalId',\n 'lastLocalUpdateAt',\n 'storageTransactionId',\n 'versionUid',\n 'refSeedType',\n 'refValueType',\n 'refResolvedValue',\n 'refResolvedDisplayValue',\n 'type',\n]\n\nexport const VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA =\n '0x13c0fd59d69dbce40501a41f8b37768d26dd2e2bb0cad64615334d84f7b9bdf6'\n\nexport const defaultAttestationData: AttestationRequestData = {\n recipient: ZERO_ADDRESS,\n revocable: true,\n value: BigInt(0),\n refUID: ZERO_BYTES32,\n expirationTime: BigInt(0),\n data: ZERO_BYTES,\n}\n\nexport enum ImageSize {\n EXTRA_SMALL = 480,\n SMALL = 760,\n MEDIUM = 1024,\n LARGE = 1440,\n EXTRA_LARGE = 1920,\n}\n\nexport const CLIENT_NOT_INITIALIZED = 'ClientManager is not initialized. Please call init() first.'\n\nexport const INIT_SCRIPT_SUCCESS_MESSAGE = '[Seed Protocol] Finished running init script'\n"],"names":[],"mappings":";;AAQO,MAAM,UAAU,GAAG;AACnB,MAAM,SAAS,GAAG;AAEZ,MAAA,mBAAmB,GAAG;AACjC,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,GAAG,EAAE,OAAO;AACb,KAAA;AACD,IAAA,KAAK,EAAE;AACL,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,GAAG,EAAE,SAAS;AACf,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,WAAW;AACjB,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,QAAQ;AACd,KAAA;AACD,IAAA,IAAI,EAAE;AACJ,QAAA,GAAG,EAAE,SAAS;AACf,KAAA;;AAGU,MAAA,qBAAqB,GAAG;IACnC,SAAS;IACT,KAAK;IACL,aAAa;IACb,SAAS;IACT,WAAW;IACX,sBAAsB;IACtB,WAAW;IACX,WAAW;IACX,eAAe;IACf,wBAAwB;IACxB,sBAAsB;IACtB,gBAAgB;IAChB,mBAAmB;IACnB,sBAAsB;IACtB,YAAY;IACZ,aAAa;IACb,cAAc;IACd,kBAAkB;IAClB,yBAAyB;IACzB,MAAM;;AAGD,MAAM,mCAAmC,GAC9C;AAEW,MAAA,sBAAsB,GAA2B;AAC5D,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAChB,IAAA,MAAM,EAAE,YAAY;AACpB,IAAA,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AACzB,IAAA,IAAI,EAAE,UAAU;;IAGN;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,SAAA,CAAA,aAAA,CAAA,GAAA,GAAA,CAAA,GAAA,aAAiB;AACjB,IAAA,SAAA,CAAA,SAAA,CAAA,OAAA,CAAA,GAAA,GAAA,CAAA,GAAA,OAAW;AACX,IAAA,SAAA,CAAA,SAAA,CAAA,QAAA,CAAA,GAAA,IAAA,CAAA,GAAA,QAAa;AACb,IAAA,SAAA,CAAA,SAAA,CAAA,OAAA,CAAA,GAAA,IAAA,CAAA,GAAA,OAAY;AACZ,IAAA,SAAA,CAAA,SAAA,CAAA,aAAA,CAAA,GAAA,IAAA,CAAA,GAAA,aAAkB;AACpB,CAAC,EANW,SAAS,KAAT,SAAS,GAMpB,EAAA,CAAA,CAAA;AAEM,MAAM,sBAAsB,GAAG;AAE/B,MAAM,2BAA2B,GAAG;;;;"}
@@ -1,5 +1,5 @@
1
1
  const isBrowser = () => {
2
- return !isElectron() && typeof window !== 'undefined' && typeof window.document !== 'undefined';
2
+ return !isElectron() && typeof document !== 'undefined' && typeof window !== 'undefined';
3
3
  };
4
4
  const isReactNative = () => {
5
5
  return typeof navigator !== 'undefined' && navigator.product === 'ReactNative';
@@ -1 +1 @@
1
- {"version":3,"file":"environment.js","sources":["../../../../src/helpers/environment.ts"],"sourcesContent":["export const isNode = (): boolean => {\n return (\n typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null\n )\n}\n\nexport const isBrowser = (): boolean => {\n return !isElectron() && typeof window !== 'undefined' && typeof window.document !== 'undefined'\n}\n\nexport const isReactNative = (): boolean => {\n return typeof navigator !== 'undefined' && navigator.product === 'ReactNative'\n}\n\nexport const isElectron = (): boolean => {\n return typeof process !== 'undefined' && process.versions != null && process.versions.electron != null;\n}\n\nexport const getEnvironment = (): string => {\n if (isBrowser()) {\n return 'browser'\n }\n\n if (isElectron()) {\n return 'electron'\n }\n\n if (isReactNative()) {\n return 'react-native'\n }\n\n return 'node'\n}\n"],"names":[],"mappings":"AAQO,MAAM,SAAS,GAAG,MAAc;AACrC,IAAA,OAAO,CAAC,UAAU,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW;AACjG;AAEO,MAAM,aAAa,GAAG,MAAc;IACzC,OAAO,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,OAAO,KAAK,aAAa;AAChF;AAEO,MAAM,UAAU,GAAG,MAAc;AACtC,IAAA,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,IAAI,IAAI;AACxG;AAEO,MAAM,cAAc,GAAG,MAAa;IACzC,IAAI,SAAS,EAAE,EAAE;AACf,QAAA,OAAO,SAAS;;IAGlB,IAAI,UAAU,EAAE,EAAE;AAChB,QAAA,OAAO,UAAU;;IAGnB,IAAI,aAAa,EAAE,EAAE;AACnB,QAAA,OAAO,cAAc;;AAGvB,IAAA,OAAO,MAAM;AACf;;;;"}
1
+ {"version":3,"file":"environment.js","sources":["../../../../src/helpers/environment.ts"],"sourcesContent":["export const isNode = (): boolean => {\n return (\n typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null\n )\n}\n\nexport const isBrowser = (): boolean => {\n return !isElectron() && typeof document !== 'undefined' && typeof window !== 'undefined'\n}\n\nexport const isReactNative = (): boolean => {\n return typeof navigator !== 'undefined' && navigator.product === 'ReactNative'\n}\n\nexport const isElectron = (): boolean => {\n return typeof process !== 'undefined' && process.versions != null && process.versions.electron != null;\n}\n\nexport const getEnvironment = (): string => {\n if (isBrowser()) {\n return 'browser'\n }\n\n if (isElectron()) {\n return 'electron'\n }\n\n if (isReactNative()) {\n return 'react-native'\n }\n\n return 'node'\n}\n"],"names":[],"mappings":"AAQO,MAAM,SAAS,GAAG,MAAc;AACrC,IAAA,OAAO,CAAC,UAAU,EAAE,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,MAAM,KAAK,WAAW;AAC1F;AAEO,MAAM,aAAa,GAAG,MAAc;IACzC,OAAO,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,OAAO,KAAK,aAAa;AAChF;AAEO,MAAM,UAAU,GAAG,MAAc;AACtC,IAAA,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,IAAI,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,IAAI,IAAI;AACxG;AAEO,MAAM,cAAc,GAAG,MAAa;IACzC,IAAI,SAAS,EAAE,EAAE;AACf,QAAA,OAAO,SAAS;;IAGlB,IAAI,UAAU,EAAE,EAAE;AAChB,QAAA,OAAO,UAAU;;IAGnB,IAAI,aAAa,EAAE,EAAE;AACnB,QAAA,OAAO,cAAc;;AAGvB,IAAA,OAAO,MAAM;AACf;;;;"}
@@ -12,7 +12,7 @@ const getSegmentedItemProperties = (item) => {
12
12
  const isItemStorage = itemProperty.propertyDef.storageType &&
13
13
  itemProperty.propertyDef.storageType === 'ItemStorage';
14
14
  itemProperty.propertyDef.dataType === 'Relation' &&
15
- itemProperty.propertyDef.refValueType === 'ImageSrc';
15
+ itemProperty.propertyDef.refValueType === 'Image';
16
16
  const isStorageTransaction = itemProperty.propertyName === 'storageTransactionId';
17
17
  if (itemProperty.propertyDef.dataType === 'Relation') {
18
18
  itemRelationProperties.push(itemProperty);
@@ -1 +1 @@
1
- {"version":3,"file":"getSegmentedItemProperties.js","sources":["../../../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\n\nexport const getSegmentedItemProperties = (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of Object.values(item.properties)) {\n if (!itemProperty.propertyDef) {\n continue\n }\n\n const isItemStorage =\n itemProperty.propertyDef.storageType &&\n itemProperty.propertyDef.storageType === 'ItemStorage'\n\n const isImageSrc =\n itemProperty.propertyDef.dataType === 'Relation' &&\n itemProperty.propertyDef.refValueType === 'ImageSrc'\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId'\n\n if (itemProperty.propertyDef.dataType === 'Relation') {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (itemProperty.propertyDef.dataType === 'List') {\n itemListProperties.push(itemProperty)\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n }\n}\n"],"names":[],"mappings":"AAGa,MAAA,0BAA0B,GAAG,CAAC,IAAgB,KAAI;IAC7D,MAAM,mBAAmB,GAAG,EAAE;IAC9B,MAAM,sBAAsB,GAAG,EAA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O;QACL,mBAAmB;QACnB,sBAAsB;QACtB,kBAAkB;QAClB,oBAAoB;KACrB;AACH;;;;"}
1
+ {"version":3,"file":"getSegmentedItemProperties.js","sources":["../../../../src/helpers/getSegmentedItemProperties.ts"],"sourcesContent":["import { UploadProperty } from '@/db/read/getPublishUploads'\nimport { IItem } from '@/interfaces'\n\nexport const getSegmentedItemProperties = (item: IItem<any>) => {\n const itemBasicProperties = []\n const itemRelationProperties = []\n const itemListProperties = []\n const itemUploadProperties: UploadProperty[] = []\n const itemStorageProperties = []\n let itemStorageTransactionProperty: UploadProperty | undefined\n\n for (const itemProperty of Object.values(item.properties)) {\n if (!itemProperty.propertyDef) {\n continue\n }\n\n const isItemStorage =\n itemProperty.propertyDef.storageType &&\n itemProperty.propertyDef.storageType === 'ItemStorage'\n\n const isImage =\n itemProperty.propertyDef.dataType === 'Relation' &&\n itemProperty.propertyDef.refValueType === 'Image'\n\n const isStorageTransaction =\n itemProperty.propertyName === 'storageTransactionId'\n\n if (itemProperty.propertyDef.dataType === 'Relation') {\n itemRelationProperties.push(itemProperty)\n continue\n }\n\n if (itemProperty.propertyDef.dataType === 'List') {\n itemListProperties.push(itemProperty)\n continue\n }\n\n if (isItemStorage) {\n itemStorageProperties.push(itemProperty)\n continue\n }\n\n if (isStorageTransaction) {\n itemStorageTransactionProperty = { itemProperty, childProperties: [] }\n continue\n }\n\n itemBasicProperties.push(itemProperty)\n }\n\n if (itemStorageTransactionProperty && itemStorageProperties.length > 0) {\n itemStorageTransactionProperty.childProperties = itemStorageProperties\n }\n\n if (itemStorageTransactionProperty) {\n itemUploadProperties.push(itemStorageTransactionProperty)\n }\n\n return {\n itemBasicProperties,\n itemRelationProperties,\n itemListProperties,\n itemUploadProperties,\n }\n}\n"],"names":[],"mappings":"AAGa,MAAA,0BAA0B,GAAG,CAAC,IAAgB,KAAI;IAC7D,MAAM,mBAAmB,GAAG,EAAE;IAC9B,MAAM,sBAAsB,GAAG,EAAE;IACjC,MAAM,kBAAkB,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BAAsB;QACtB,kBAAkB;QAClB,oBAAoB;KACrB;AACH;;;;"}
@@ -9,7 +9,7 @@ export declare const identifyString: (str: string) => "json" | "text" | "base64"
9
9
  export declare const getMimeType: (base64: string) => string | null;
10
10
  export declare const getCorrectId: GetCorrectId;
11
11
  export declare const getDataTypeFromString: (data: string) => "imageBase64" | "base64" | "url" | null;
12
- export declare const convertTxIdToImageSrc: (txId: string) => Promise<string | undefined>;
12
+ export declare const convertTxIdToImage: (txId: string) => Promise<string | undefined>;
13
13
  export declare const getExecutionTime: (task: any, args: any) => Promise<number>;
14
14
  export declare const capitalizeFirstLetter: (string: string) => string;
15
15
  export declare const parseEasRelationPropertyName: (easPropertyName: string) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG9C,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAM7C,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAA;AAED,eAAO,MAAM,WAAW,QAAS,MAAM,WAEtC,CAAA;AAED,eAAO,MAAM,cAAc,QAAS,MAAM,iEA2BzC,CAAA;AAED,eAAO,MAAM,WAAW,WAAY,MAAM,kBAWzC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,YAe1B,CAAA;AAED,eAAO,MAAM,qBAAqB,SAC1B,MAAM,KACX,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,IAwBrC,CAAA;AAED,eAAO,MAAM,qBAAqB,SAC1B,MAAM,KACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAc5B,CAAA;AAED,eAAO,MAAM,gBAAgB,2CAI5B,CAAA;AAED,eAAO,MAAM,qBAAqB,WAAY,MAAM,WACF,CAAA;AAElD,eAAO,MAAM,4BAA4B,oBAAqB,MAAM;;;;CAiBnE,CAAA;AAED,eAAO,MAAM,cAAc,WACjB,MAAM,GAAG,IAAI,GAAG,SAAS,QAC3B,UAAU,GAAG,SAAS,KAC3B,OAAO,CAAC,MAAM,CAkBhB,CAAA;AAED,eAAO,MAAM,QAAQ,gBAAiB,WAAW,KAAG,OAwBnD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG9C,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,+BAA+B,CAAA;AAM7C,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAA;AAED,eAAO,MAAM,WAAW,QAAS,MAAM,WAEtC,CAAA;AAED,eAAO,MAAM,cAAc,QAAS,MAAM,iEA2BzC,CAAA;AAED,eAAO,MAAM,WAAW,WAAY,MAAM,kBAWzC,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,YAe1B,CAAA;AAED,eAAO,MAAM,qBAAqB,SAC1B,MAAM,KACX,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,IAwBrC,CAAA;AAED,eAAO,MAAM,kBAAkB,SACvB,MAAM,KACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAc5B,CAAA;AAED,eAAO,MAAM,gBAAgB,2CAI5B,CAAA;AAED,eAAO,MAAM,qBAAqB,WAAY,MAAM,WACF,CAAA;AAElD,eAAO,MAAM,4BAA4B,oBAAqB,MAAM;;;;CAiBnE,CAAA;AAED,eAAO,MAAM,cAAc,WACjB,MAAM,GAAG,IAAI,GAAG,SAAS,QAC3B,UAAU,GAAG,SAAS,KAC3B,OAAO,CAAC,MAAM,CAkBhB,CAAA;AAED,eAAO,MAAM,QAAQ,gBAAiB,WAAW,KAAG,OAwBnD,CAAA"}
@@ -58,11 +58,11 @@ const getDataTypeFromString = (data) => {
58
58
  }
59
59
  return null;
60
60
  };
61
- const convertTxIdToImageSrc = async (txId) => {
61
+ const convertTxIdToImage = async (txId) => {
62
62
  const imageFilePath = `/files/images/${txId}`;
63
63
  const fileExists = await BaseFileManager.pathExists(imageFilePath);
64
64
  if (!fileExists) {
65
- logger(`[ItemView] [updateImageSrc] ${imageFilePath} does not exist`);
65
+ logger(`[ItemView] [updateImage] ${imageFilePath} does not exist`);
66
66
  return;
67
67
  }
68
68
  const buffer = await BaseFileManager.readFileAsBuffer(imageFilePath);
@@ -97,5 +97,5 @@ const getContentHash = async (base64, uint) => {
97
97
  return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
98
98
  };
99
99
 
100
- export { BaseFileManager, convertTxIdToImageSrc, generateId, getContentHash, getCorrectId, getDataTypeFromString, getMimeType, parseEasRelationPropertyName, toSnakeCase };
100
+ export { BaseFileManager, convertTxIdToImage, generateId, getContentHash, getCorrectId, getDataTypeFromString, getMimeType, parseEasRelationPropertyName, toSnakeCase };
101
101
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/helpers/index.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid'\nimport * as nanoIdDictionary from 'nanoid-dictionary'\nimport debug from 'debug'\nimport { GetCorrectId } from '@/types/helpers'\nimport { GetCorrectIdReturn } from '@/types/helpers'\nimport { BaseFileManager } from './FileManager/BaseFileManager'\nexport * from './ArweaveClient/BaseArweaveClient'\nexport * from './EasClient/BaseEasClient'\nexport * from './QueryClient/BaseQueryClient'\nexport * from './FileManager/BaseFileManager'\nconst logger = debug('seedSdk:shared:helpers')\n\n\nconst { alphanumeric } = nanoIdDictionary\n\nexport const generateId = (): string => {\n return customAlphabet(alphanumeric, 10)()\n}\n\nexport const toSnakeCase = (str: string) => {\n return str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase()\n}\n\nexport const identifyString = (str: string) => {\n try {\n JSON.parse(str)\n return 'json'\n } catch (e) {\n // Not JSON\n }\n\n if (!str) {\n return\n }\n\n if (str.trim().startsWith('<') && str.trim().endsWith('>')) {\n return 'html'\n }\n\n // Simple markdown checks (very naive)\n if (/^#{1,6}\\s|^-{3,}|\\*{3,}|^-{1,2}\\s|\\*\\s/.test(str)) {\n return 'markdown'\n }\n\n if (/^data:image\\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/.test(str)) {\n return 'base64'\n }\n\n // Default to plain text if unsure\n return 'text'\n}\n\nexport const getMimeType = (base64: string) => {\n if (!base64) {\n return null\n }\n const result = base64.match(/^data:([a-zA-Z0-9]+\\/[a-zA-Z0-9-.+]+).*,/)\n\n if (result && result.length > 1) {\n return result[1]\n } else {\n return null // MIME type could not be determined\n }\n}\n\nexport const getCorrectId: GetCorrectId = (localIdOrUid: string) => {\n const id: GetCorrectIdReturn = {\n localId: undefined,\n uid: undefined,\n }\n if (!localIdOrUid) {\n return id\n }\n if (localIdOrUid.length === 10) {\n id.localId = localIdOrUid\n }\n if (localIdOrUid.startsWith('0x') && localIdOrUid.length === 66) {\n id.uid = localIdOrUid\n }\n return id\n}\n\nexport const getDataTypeFromString = (\n data: string,\n): 'imageBase64' | 'base64' | 'url' | null => {\n const nonImageBase64Regex =\n /^(?!data:image\\/(?:jpeg|png|gif|bmp|webp);base64,)[A-Za-z0-9+/=]+$/\n\n if (nonImageBase64Regex.test(data)) {\n return 'base64'\n }\n\n // Regular expression for base64 (simple version, checking for base64 format)\n const imageBase64Regex = /^data:image\\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/\n\n if (imageBase64Regex.test(data)) {\n return 'imageBase64'\n }\n\n // Regular expression for URL (simple version, checking for common URL format)\n const urlRegex =\n /^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$/\n\n if (urlRegex.test(data)) {\n return 'url'\n }\n\n return null\n}\n\nexport const convertTxIdToImageSrc = async (\n txId: string,\n): Promise<string | undefined> => {\n const imageFilePath = `/files/images/${txId}`\n const fileExists = await BaseFileManager.pathExists(imageFilePath)\n if (!fileExists) {\n logger(`[ItemView] [updateImageSrc] ${imageFilePath} does not exist`)\n return\n }\n const buffer = await BaseFileManager.readFileAsBuffer(imageFilePath)\n\n const uint = new Uint8Array(buffer)\n\n const imageBlob = new Blob([uint])\n\n return URL.createObjectURL(imageBlob)\n}\n\nexport const getExecutionTime = async (task, args) => {\n const start = Date.now()\n await task(...args)\n return Date.now() - start\n}\n\nexport const capitalizeFirstLetter = (string: string) =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nexport const parseEasRelationPropertyName = (easPropertyName: string) => {\n // Split the input string on the first underscore\n const [singularProperty, modelName, idSegment] = easPropertyName.split('_')\n\n // If there are any other parts, assume it is a list (e.g., has 'ids' or other suffix)\n const isList = idSegment === 'ids'\n\n // Create the final property name by pluralizing the singular part\n const propertyName = singularProperty.endsWith('s')\n ? singularProperty\n : singularProperty + 's'\n\n return {\n propertyName, // Plural form of the property name\n modelName, // Model name extracted from the second part\n isList, // True if the property is a list (e.g., 'ids' is present)\n }\n}\n\nexport const getContentHash = async (\n base64: string | null | undefined,\n uint: Uint8Array | undefined,\n): Promise<string> => {\n let data\n\n if (base64 && !uint) {\n const encoder = new TextEncoder()\n data = encoder.encode(base64)\n }\n\n if (uint) {\n data = uint\n }\n\n // Hash the data with SHA-256\n const hashBuffer = await crypto.subtle.digest('SHA-256', data as Uint8Array)\n\n // Convert the ArrayBuffer to a hex string\n const hashArray = Array.from(new Uint8Array(hashBuffer))\n return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('')\n}\n\nexport const isBinary = (arrayBuffer: ArrayBuffer): boolean => {\n const view = new Uint8Array(arrayBuffer);\n\n let nonTextCount = 0;\n const threshold = 0.2; // Adjust as needed (e.g., 20% non-text implies binary)\n\n for (let i = 0; i < view.length; i++) {\n const byte = view[i];\n\n // ASCII printable characters (32-126) and common whitespace (9, 10, 13)\n if (\n (byte >= 32 && byte <= 126) || // Printable ASCII\n byte === 9 || byte === 10 || byte === 13 // Tab, LF, CR\n ) {\n continue;\n }\n\n nonTextCount++;\n if (nonTextCount / view.length > threshold) {\n return true; // More than threshold are non-text bytes\n }\n }\n\n return false; // Fewer than threshold are non-text bytes\n}\n"],"names":[],"mappings":";;;;;;;AAUA,MAAM,MAAM,GAAG,KAAK,CAAC,wBAAwB,CAAC;AAG9C,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB;AAElC,MAAM,UAAU,GAAG,MAAa;AACrC,IAAA,OAAO,cAAc,CAAC,YAAY,EAAE,EAAE,CAAC,EAAE;AAC3C;AAEa,MAAA,WAAW,GAAG,CAAC,GAAW,KAAI;IACzC,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE;AAC9D;AA+Ba,MAAA,WAAW,GAAG,CAAC,MAAc,KAAI;IAC5C,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,OAAO,IAAI;;IAEb,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC;IAEvE,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/B,QAAA,OAAO,MAAM,CAAC,CAAC,CAAC;;SACX;QACL,OAAO,IAAI,CAAA;;AAEf;AAEa,MAAA,YAAY,GAAiB,CAAC,YAAoB,KAAI;AACjE,IAAA,MAAM,EAAE,GAAuB;AAC7B,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,GAAG,EAAE,SAAS;KACf;IACD,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,OAAO,EAAE;;AAEX,IAAA,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE;AAC9B,QAAA,EAAE,CAAC,OAAO,GAAG,YAAY;;AAE3B,IAAA,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,MAAM,KAAK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AG3E,IAAA,MAAM,MAAM,GAAG,SAAS,KAAK,KAAK;;AAGlC,IAAA,MAAM,YAAY,GAAG,gBAAgB,CAAC,QAAQ,CAAC,GAAG;AAChD,UAAE;AACF,UAAE,gBAAgB,GAAG,GAAG;IAE1B,OAAO;AACL,QAAA,YAAY;AACZ,QAAA,SAAS;AACT,QAAA,MAAM;KACP;AACH;AAEa,MAAA,cAAc,GAAG,OAC5B,MAAiC,EACjC,IAA4B,KACT;AACnB,IAAA,IAAI,IAAI;IAOR,IAAI,IAAI,EAAE;QACR,IAAI,GAAG,IAAI;;;AAIb,IAAA,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAkB,CAAC;;AAG5E,IAAA,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;AACxD,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AACvE;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/helpers/index.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid'\nimport * as nanoIdDictionary from 'nanoid-dictionary'\nimport debug from 'debug'\nimport { GetCorrectId } from '@/types/helpers'\nimport { GetCorrectIdReturn } from '@/types/helpers'\nimport { BaseFileManager } from './FileManager/BaseFileManager'\nexport * from './ArweaveClient/BaseArweaveClient'\nexport * from './EasClient/BaseEasClient'\nexport * from './QueryClient/BaseQueryClient'\nexport * from './FileManager/BaseFileManager'\nconst logger = debug('seedSdk:shared:helpers')\n\n\nconst { alphanumeric } = nanoIdDictionary\n\nexport const generateId = (): string => {\n return customAlphabet(alphanumeric, 10)()\n}\n\nexport const toSnakeCase = (str: string) => {\n return str.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase()\n}\n\nexport const identifyString = (str: string) => {\n try {\n JSON.parse(str)\n return 'json'\n } catch (e) {\n // Not JSON\n }\n\n if (!str) {\n return\n }\n\n if (str.trim().startsWith('<') && str.trim().endsWith('>')) {\n return 'html'\n }\n\n // Simple markdown checks (very naive)\n if (/^#{1,6}\\s|^-{3,}|\\*{3,}|^-{1,2}\\s|\\*\\s/.test(str)) {\n return 'markdown'\n }\n\n if (/^data:image\\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/.test(str)) {\n return 'base64'\n }\n\n // Default to plain text if unsure\n return 'text'\n}\n\nexport const getMimeType = (base64: string) => {\n if (!base64) {\n return null\n }\n const result = base64.match(/^data:([a-zA-Z0-9]+\\/[a-zA-Z0-9-.+]+).*,/)\n\n if (result && result.length > 1) {\n return result[1]\n } else {\n return null // MIME type could not be determined\n }\n}\n\nexport const getCorrectId: GetCorrectId = (localIdOrUid: string) => {\n const id: GetCorrectIdReturn = {\n localId: undefined,\n uid: undefined,\n }\n if (!localIdOrUid) {\n return id\n }\n if (localIdOrUid.length === 10) {\n id.localId = localIdOrUid\n }\n if (localIdOrUid.startsWith('0x') && localIdOrUid.length === 66) {\n id.uid = localIdOrUid\n }\n return id\n}\n\nexport const getDataTypeFromString = (\n data: string,\n): 'imageBase64' | 'base64' | 'url' | null => {\n const nonImageBase64Regex =\n /^(?!data:image\\/(?:jpeg|png|gif|bmp|webp);base64,)[A-Za-z0-9+/=]+$/\n\n if (nonImageBase64Regex.test(data)) {\n return 'base64'\n }\n\n // Regular expression for base64 (simple version, checking for base64 format)\n const imageBase64Regex = /^data:image\\/[a-zA-Z]+;base64,[A-Za-z0-9+/]+={0,2}$/\n\n if (imageBase64Regex.test(data)) {\n return 'imageBase64'\n }\n\n // Regular expression for URL (simple version, checking for common URL format)\n const urlRegex =\n /^(http:\\/\\/www\\.|https:\\/\\/www\\.|http:\\/\\/|https:\\/\\/)?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,5}(:[0-9]{1,5})?(\\/.*)?$/\n\n if (urlRegex.test(data)) {\n return 'url'\n }\n\n return null\n}\n\nexport const convertTxIdToImage = async (\n txId: string,\n): Promise<string | undefined> => {\n const imageFilePath = `/files/images/${txId}`\n const fileExists = await BaseFileManager.pathExists(imageFilePath)\n if (!fileExists) {\n logger(`[ItemView] [updateImage] ${imageFilePath} does not exist`)\n return\n }\n const buffer = await BaseFileManager.readFileAsBuffer(imageFilePath)\n\n const uint = new Uint8Array(buffer)\n\n const imageBlob = new Blob([uint])\n\n return URL.createObjectURL(imageBlob)\n}\n\nexport const getExecutionTime = async (task, args) => {\n const start = Date.now()\n await task(...args)\n return Date.now() - start\n}\n\nexport const capitalizeFirstLetter = (string: string) =>\n string.charAt(0).toUpperCase() + string.slice(1)\n\nexport const parseEasRelationPropertyName = (easPropertyName: string) => {\n // Split the input string on the first underscore\n const [singularProperty, modelName, idSegment] = easPropertyName.split('_')\n\n // If there are any other parts, assume it is a list (e.g., has 'ids' or other suffix)\n const isList = idSegment === 'ids'\n\n // Create the final property name by pluralizing the singular part\n const propertyName = singularProperty.endsWith('s')\n ? singularProperty\n : singularProperty + 's'\n\n return {\n propertyName, // Plural form of the property name\n modelName, // Model name extracted from the second part\n isList, // True if the property is a list (e.g., 'ids' is present)\n }\n}\n\nexport const getContentHash = async (\n base64: string | null | undefined,\n uint: Uint8Array | undefined,\n): Promise<string> => {\n let data\n\n if (base64 && !uint) {\n const encoder = new TextEncoder()\n data = encoder.encode(base64)\n }\n\n if (uint) {\n data = uint\n }\n\n // Hash the data with SHA-256\n const hashBuffer = await crypto.subtle.digest('SHA-256', data as Uint8Array)\n\n // Convert the ArrayBuffer to a hex string\n const hashArray = Array.from(new Uint8Array(hashBuffer))\n return hashArray.map((b) => b.toString(16).padStart(2, '0')).join('')\n}\n\nexport const isBinary = (arrayBuffer: ArrayBuffer): boolean => {\n const view = new Uint8Array(arrayBuffer);\n\n let nonTextCount = 0;\n const threshold = 0.2; // Adjust as needed (e.g., 20% non-text implies binary)\n\n for (let i = 0; i < view.length; i++) {\n const byte = view[i];\n\n // ASCII printable characters (32-126) and common whitespace (9, 10, 13)\n if (\n (byte >= 32 && byte <= 126) || // Printable ASCII\n byte === 9 || byte === 10 || byte === 13 // Tab, LF, CR\n ) {\n continue;\n }\n\n nonTextCount++;\n if (nonTextCount / view.length > threshold) {\n return true; // More than threshold are non-text bytes\n }\n }\n\n return false; // Fewer than threshold are non-text bytes\n}\n"],"names":[],"mappings":";;;;;;;AAUA,MAAM,MAAM,GAAG,KAAK,CAAC,wBAAwB,CAAC;AAG9C,MAAM,EAAE,YAAY,EAAE,GAAG,gBAAgB;AAElC,MAAM,UAAU,GAAG,MAAa;AACrC,IAAA,OAAO,cAAc,CAAC,YAAY,EAAE,EAAE,CAAC,EAAE;AAC3C;AAEa,MAAA,WAAW,GAAG,CAAC,GAAW,KAAI;IACzC,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE;AAC9D;AA+Ba,MAAA,WAAW,GAAG,CAAC,MAAc,KAAI;IAC5C,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,OAAO,IAAI;;IAEb,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC;IAEvE,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/B,QAAA,OAAO,MAAM,CAAC,CAAC,CAAC;;SACX;QACL,OAAO,IAAI,CAAA;;AAEf;AAEa,MAAA,YAAY,GAAiB,CAAC,YAAoB,KAAI;AACjE,IAAA,MAAM,EAAE,GAAuB;AAC7B,QAAA,OAAO,EAAE,SAAS;AAClB,QAAA,GAAG,EAAE,SAAS;KACf;IACD,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,OAAO,EAAE;;AAEX,IAAA,IAAI,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE;AAC9B,QAAA,EAAE,CAAC,OAAO,GAA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