@seedprotocol/sdk 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as __awaiter, D as DB_NAME_SDK_CONFIG, o as models, S as SCHEMA_NJK, p as SCHEMA_TS, q as SDK_DB_CONFIG, r as SEED_DB_CONFIG, A as APP_DB_CONFIG, s as addModelsToInternalDb } from './events-C7mxVpb2.js';
2
+ import { _ as __awaiter, D as DB_NAME_SDK_CONFIG, o as models, S as SCHEMA_NJK, p as SCHEMA_TS, q as SDK_DB_CONFIG, r as SEED_DB_CONFIG, A as APP_DB_CONFIG, s as addModelsToInternalDb } from './events-DbpQM9qG.js';
3
3
  import path from 'path';
4
4
  import fs from 'fs';
5
5
  import { exec as exec$1 } from 'child_process';
@@ -17,7 +17,7 @@ import { camelCase, snakeCase } from 'lodash-es';
17
17
  import * as nunjucks from 'nunjucks';
18
18
  import Database from 'better-sqlite3';
19
19
  import { drizzle } from 'drizzle-orm/better-sqlite3';
20
- import './seed.schema.config-WWLDCsw_.js';
20
+ import './seed.schema.config-Cz8esgav.js';
21
21
  import { defineConfig } from 'drizzle-kit';
22
22
  import dotenv from 'dotenv';
23
23
  import '@sinclair/typebox';
@@ -1616,7 +1616,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1616
1616
  renderValue: refResolvedDisplayValue,
1617
1617
  });
1618
1618
  if (propertyNameFromDb === 'storageTransactionId') {
1619
- const { Item } = yield import('./index-DiskIvP7.js');
1619
+ const { Item } = yield import('./index-D2_skdGT.js');
1620
1620
  const item = yield Item.find({
1621
1621
  seedLocalId,
1622
1622
  modelName: itemModelName,
@@ -4853,7 +4853,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
4853
4853
  if (!models$1) {
4854
4854
  return;
4855
4855
  }
4856
- const { models: SeedModels } = yield import('./seed.schema.config-WWLDCsw_.js');
4856
+ const { models: SeedModels } = yield import('./seed.schema.config-Cz8esgav.js');
4857
4857
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
4858
4858
  let hasModelsInDb = false;
4859
4859
  const schemaDefsByModelName = new Map();
@@ -6103,11 +6103,11 @@ const globalMachine = setup({
6103
6103
  (_a) => __awaiter(void 0, [_a], void 0, function* ({ context }) {
6104
6104
  let SeedClass;
6105
6105
  if (context.environment === 'node') {
6106
- const { SeedNode } = yield import('./seed-BYEGj3gH.js');
6106
+ const { SeedNode } = yield import('./seed-DM5koJUz.js');
6107
6107
  SeedClass = SeedNode;
6108
6108
  }
6109
6109
  else {
6110
- const { SeedBrowser } = yield import('./seed-BTpkUOtG.js');
6110
+ const { SeedBrowser } = yield import('./seed-DHOFK9DF.js');
6111
6111
  SeedClass = SeedBrowser;
6112
6112
  }
6113
6113
  return SeedClass;
@@ -6206,6 +6206,7 @@ const useItemProperty = (propertyName, seedLocalId) => {
6206
6206
  const [property, setProperty] = useImmer(undefined);
6207
6207
  const [isReadingFromDb, setIsReadingFromDb] = useState(false);
6208
6208
  const [isInitialized, setIsInitialized] = useState(false);
6209
+ const dbsAreReady = useDbsAreReady();
6209
6210
  const value = useSelector(property === null || property === void 0 ? void 0 : property.getService(), (snapshot) => {
6210
6211
  if (!snapshot || !snapshot.context) {
6211
6212
  return;
@@ -6214,12 +6215,12 @@ const useItemProperty = (propertyName, seedLocalId) => {
6214
6215
  });
6215
6216
  const status = useSelector(property === null || property === void 0 ? void 0 : property.getService(), (snapshot) => snapshot === null || snapshot === void 0 ? void 0 : snapshot.value);
6216
6217
  useEffect(() => {
6217
- if (property && property.value !== value) {
6218
+ if (dbsAreReady && property && property.value !== value) {
6218
6219
  readFromDb();
6219
6220
  }
6220
- }, [property, value]);
6221
+ }, [dbsAreReady, property, value]);
6221
6222
  const readFromDb = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
6222
- if (isReadingFromDb) {
6223
+ if (!dbsAreReady && isReadingFromDb) {
6223
6224
  return;
6224
6225
  }
6225
6226
  setIsReadingFromDb(true);
@@ -6231,7 +6232,7 @@ const useItemProperty = (propertyName, seedLocalId) => {
6231
6232
  }
6232
6233
  setProperty(() => foundProperty);
6233
6234
  setIsInitialized(true);
6234
- }), [isReadingFromDb]);
6235
+ }), [dbsAreReady, isReadingFromDb]);
6235
6236
  useEffect(() => {
6236
6237
  readFromDb();
6237
6238
  }, []);
@@ -6527,4 +6528,4 @@ const setupServicesEventHandlers = () => {
6527
6528
  };
6528
6529
 
6529
6530
  export { useDeleteItem as $, APP_DB_CONFIG as A, setupFsListeners as B, CHILD_SNAPSHOT as C, DB_NAME_SDK_CONFIG as D, setupAllItemsEventHandlers as E, setupServicesEventHandlers as F, GET_SCHEMAS as G, globalService as H, Item as I, Json as J, getModel as K, List as L, Model as M, getModels as N, getModelNames as O, Property as P, areFsListenersReady as Q, Relation as R, SCHEMA_NJK as S, Text as T, ItemProperty as U, useItems as V, useItem as W, useItemProperties as X, useCreateItem as Y, useItemProperty as Z, __awaiter as _, GET_SEEDS as a, getGlobalService as a0, getCorrectId as a1, GET_SEED_IDS as b, GET_STORAGE_TRANSACTION_ID as c, GET_VERSIONS as d, GET_PROPERTIES as e, GET_ALL_PROPERTIES_FOR_ALL_VERSIONS as f, itemMachineAll as g, internalMachine as h, itemMachineSingle as i, isNode as j, isBrowser as k, isReactNative as l, __decorate as m, __metadata as n, models as o, SCHEMA_TS as p, SDK_DB_CONFIG as q, SEED_DB_CONFIG as r, addModelsToInternalDb as s, ImageSrc as t, createNewMetadataFromExistingRecord as u, generateId as v, eventEmitter as w, getDb as x, DB_NAME_APP as y, setModel as z };
6530
- //# sourceMappingURL=events-C7mxVpb2.js.map
6531
+ //# sourceMappingURL=events-DbpQM9qG.js.map