@seedprotocol/sdk 0.1.117 → 0.1.119

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.
@@ -1,5 +1,4 @@
1
1
  import { __awaiter, __rest } from 'tslib';
2
- import path, { basename } from 'path';
3
2
  import 'reflect-metadata';
4
3
  import { Type } from '@sinclair/typebox';
5
4
  import { fromCallback, createActor, waitFor, setup, assign, raise } from 'xstate';
@@ -15,6 +14,7 @@ import { QueryClient } from '@tanstack/react-query';
15
14
  import { GraphQLClient } from 'graphql-request';
16
15
  import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister';
17
16
  import { persistQueryClient } from '@tanstack/react-query-persist-client';
17
+ import path, { basename } from 'path';
18
18
  import { useImmer } from 'use-immer';
19
19
  import { useSelector } from '@xstate/react';
20
20
  import EventEmitter from 'eventemitter3';
@@ -27,6 +27,7 @@ import { drizzle } from 'drizzle-orm/sqlite-proxy';
27
27
  import { migrate as migrate$1 } from 'drizzle-orm/sqlite-proxy/migrator';
28
28
  import { readMigrationFiles } from 'drizzle-orm/migrator';
29
29
  import { WebAccess } from '@zenfs/dom';
30
+ import * as fsNode from 'node:fs';
30
31
  import Arweave from 'arweave';
31
32
  import { i as internalPropertyNames, I as INTERNAL_DATA_TYPES, V as VERSION_SCHEMA_UID_OPTIMISM_SEPOLIA, d as defaultAttestationData } from './constants-B6s6tGup.js';
32
33
  import { ZERO_BYTES32, SchemaEncoder } from '@ethereum-attestation-service/eas-sdk';
@@ -62,13 +63,29 @@ const withSeed$1 = (config, webpack, isServer) => {
62
63
  // console.log('crypto-browserify exists:', fs.existsSync(path.resolve(process.cwd(), './node_modules/crypto-browserify')))
63
64
  // console.log('path-browserify exists:', fs.existsSync(path.resolve(process.cwd(), './node_modules/path-browserify')))
64
65
  if (!isServer) {
65
- config.resolve.alias['fs'] = path.resolve(process.cwd(), './node_modules/@zenfs/core');
66
- config.resolve.alias['node:fs'] = path.resolve(process.cwd(), './node_modules/@zenfs/core');
67
- config.resolve.alias['@schema'] = path.resolve(process.cwd(), 'schema.ts');
68
- // config.resolve.alias['crypto'] = path.resolve(process.cwd(), './node_modules/crypto-browserify')
69
- // config.resolve.alias['node:crypto'] = path.resolve(process.cwd(), './node_modules/crypto-browserify')
70
- config.resolve.alias['node:path'] = path.resolve(process.cwd(), './node_modules/path-browserify');
71
- config.resolve.alias['path'] = path.resolve(process.cwd(), './node_modules/path-browserify');
66
+ config.resolve.alias['fs'] = '@zenfs/core';
67
+ config.resolve.alias['node:fs'] = '@zenfs/core';
68
+ config.resolve.alias['node:path'] = 'path-browserify';
69
+ config.resolve.alias['path'] = 'path-browserify';
70
+ // config.resolve.alias['fs'] = path.resolve(
71
+ // process.cwd(),
72
+ // './node_modules/@zenfs/core',
73
+ // )
74
+ // config.resolve.alias['node:fs'] = path.resolve(
75
+ // process.cwd(),
76
+ // './node_modules/@zenfs/core',
77
+ // )
78
+ // config.resolve.alias['@schema'] = path.resolve(process.cwd(), 'schema.ts')
79
+ // // config.resolve.alias['crypto'] = path.resolve(process.cwd(), './node_modules/crypto-browserify')
80
+ // // config.resolve.alias['node:crypto'] = path.resolve(process.cwd(), './node_modules/crypto-browserify')
81
+ // config.resolve.alias['node:path'] = path.resolve(
82
+ // process.cwd(),
83
+ // './node_modules/path-browserify',
84
+ // )
85
+ // config.resolve.alias['path'] = path.resolve(
86
+ // process.cwd(),
87
+ // './node_modules/path-browserify',
88
+ // )
72
89
  }
73
90
  if (isServer) {
74
91
  config.externals.push('@sqlite.org/sqlite-wasm');
@@ -2097,7 +2114,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2097
2114
  if (!models$1) {
2098
2115
  return;
2099
2116
  }
2100
- const { models: SeedModels } = yield import('./seed.schema.config-CPGWVSWI.js');
2117
+ const { models: SeedModels } = yield import('./seed.schema.config-DcbShLHu.js');
2101
2118
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2102
2119
  let hasModelsInDb = false;
2103
2120
  const schemaDefsByModelName = new Map();
@@ -2377,9 +2394,21 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
2377
2394
  //
2378
2395
  // _initFs()
2379
2396
  const _checkForFiles = () => __awaiter(void 0, void 0, void 0, function* () {
2380
- journalExists = yield fs.promises.exists(`/${pathToDbDir}/meta/_journal.json`);
2397
+ const journalPath = `/${pathToDbDir}/meta/_journal.json`;
2398
+ journalExists = yield fs.promises.exists(journalPath);
2399
+ const journalExistsAsync = journalExists;
2400
+ const journalExistsSync = fs.existsSync(journalPath);
2401
+ const journalExistsSyncNode = fsNode.existsSync(journalPath);
2402
+ console.log('journalExistsAsync', journalExistsAsync);
2403
+ console.log('journalExistsSync', journalExistsSync);
2404
+ console.log('journalExistsSyncNode', journalExistsSyncNode);
2381
2405
  if (!journalExists) {
2382
- window.location.reload();
2406
+ const handle = yield navigator.storage.getDirectory();
2407
+ yield configureSingle({
2408
+ backend: WebAccess,
2409
+ handle,
2410
+ });
2411
+ // window.location.reload()
2383
2412
  // setTimeout(() => {
2384
2413
  // _checkForFiles().then(() => {
2385
2414
  // return
@@ -2452,8 +2481,14 @@ const migrate = fromCallback(({ sendBack, input: { context } }) => {
2452
2481
  });
2453
2482
  }
2454
2483
  catch (error) {
2455
- console.error('Error migrating database: ', error);
2456
- window.location.reload();
2484
+ // console.error('Error migrating database: ', error)
2485
+ // window.location.reload()
2486
+ const handle = yield navigator.storage.getDirectory();
2487
+ yield configureSingle({
2488
+ backend: WebAccess,
2489
+ handle,
2490
+ });
2491
+ return _migrate();
2457
2492
  }
2458
2493
  setAppDb(drizzleDb);
2459
2494
  // const createTempTableQuery = await appDb.run(
@@ -6481,7 +6516,7 @@ const client = {
6481
6516
  addresses,
6482
6517
  arweaveDomain,
6483
6518
  });
6484
- import('./seed.schema.config-CPGWVSWI.js').then(({ models }) => {
6519
+ import('./seed.schema.config-DcbShLHu.js').then(({ models }) => {
6485
6520
  for (const [key, value] of Object.entries(models)) {
6486
6521
  setModel(key, value);
6487
6522
  }
@@ -7156,7 +7191,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
7156
7191
  if (propertyRecordSchema &&
7157
7192
  propertyRecordSchema.storageType &&
7158
7193
  propertyRecordSchema.storageType === 'ItemStorage') {
7159
- const { Item } = yield import('./index-Dwb6l5UL.js');
7194
+ const { Item } = yield import('./index-PI7JgtNo.js');
7160
7195
  const item = yield Item.find({
7161
7196
  seedLocalId,
7162
7197
  modelName,
@@ -8098,4 +8133,4 @@ if (isNode()) {
8098
8133
  }
8099
8134
 
8100
8135
  export { GET_SCHEMAS as G, Item as I, Json as J, List as L, Model as M, Property as P, Relation as R, Text as T, GET_SCHEMA_BY_NAME as a, GET_SEEDS as b, GET_SEED_IDS as c, GET_STORAGE_TRANSACTION_ID as d, GET_VERSIONS as e, GET_PROPERTIES as f, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS as g, itemMachineAll as h, itemMachineSingle as i, ImageSrc as j, ItemProperty as k, useItem as l, useItemProperties as m, useCreateItem as n, useItemProperty as o, useDeleteItem as p, useGlobalServiceStatus as q, useServices as r, getGlobalService as s, client as t, useItems as u, getCorrectId as v, withSeed as w };
8101
- //# sourceMappingURL=index-Dd6tPdUt.js.map
8136
+ //# sourceMappingURL=index-D9hBdVBw.js.map