@seedprotocol/sdk 0.1.88 → 0.1.89

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.
@@ -3,7 +3,7 @@ import path, { basename } from 'path';
3
3
  import 'reflect-metadata';
4
4
  import { Type } from '@sinclair/typebox';
5
5
  import { fromCallback, assign, createActor, waitFor, setup, raise } from 'xstate';
6
- import { sql, relations, and, eq, max, or, count, isNotNull, isNull, gt, inArray, like, getTableColumns } from 'drizzle-orm';
6
+ import { sql, relations, or, eq, and, max, count, isNotNull, isNull, gt, inArray, like, getTableColumns } from 'drizzle-orm';
7
7
  import { fs, configureSingle } from '@zenfs/core';
8
8
  import 'dayjs';
9
9
  import { customAlphabet } from 'nanoid';
@@ -419,14 +419,20 @@ relations(propertyUids, ({ one }) => ({
419
419
 
420
420
  const getPropertyData = (propertyName, seedLocalId, seedUid) => __awaiter(void 0, void 0, void 0, function* () {
421
421
  const appDb = getAppDb();
422
- const queryBase = appDb.select().from(metadata);
422
+ const whereClauses = [
423
+ or(eq(metadata.propertyName, propertyName), eq(metadata.propertyName, propertyName + 'Id'), eq(metadata.propertyName, propertyName + 'Ids')),
424
+ ];
423
425
  if (seedLocalId) {
424
- queryBase.where(and(eq(metadata.propertyName, propertyName), eq(metadata.seedLocalId, seedLocalId)));
426
+ whereClauses.push(eq(metadata.seedLocalId, seedLocalId));
425
427
  }
426
428
  if (seedUid) {
427
- queryBase.where(and(eq(metadata.propertyName, propertyName), eq(metadata.seedUid, seedUid)));
429
+ whereClauses.push(eq(metadata.seedUid, seedUid));
428
430
  }
429
- const rows = (yield queryBase.orderBy(sql.raw(`COALESCE(attestation_created_at, created_at) DESC`)));
431
+ const rows = (yield appDb
432
+ .select()
433
+ .from(metadata)
434
+ .where(and(...whereClauses))
435
+ .orderBy(sql.raw(`COALESCE(attestation_created_at, created_at) DESC`)));
430
436
  if (!rows || rows.length === 0) {
431
437
  return;
432
438
  }
@@ -1062,7 +1068,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1062
1068
  if (propertyRecordSchema &&
1063
1069
  propertyRecordSchema.storageType &&
1064
1070
  propertyRecordSchema.storageType === 'ItemStorage') {
1065
- const { Item } = yield import('./index-DtqQJ3vS.js');
1071
+ const { Item } = yield import('./index-CcE521Ay.js');
1066
1072
  const item = yield Item.find({
1067
1073
  seedLocalId,
1068
1074
  modelName: itemModelName,
@@ -2629,7 +2635,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2629
2635
  if (!models$1) {
2630
2636
  return;
2631
2637
  }
2632
- const { models: SeedModels } = yield import('./seed.schema.config-BL0wlKbs.js');
2638
+ const { models: SeedModels } = yield import('./seed.schema.config-CnfT1dNe.js');
2633
2639
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2634
2640
  let hasModelsInDb = false;
2635
2641
  const schemaDefsByModelName = new Map();
@@ -6631,7 +6637,7 @@ const client = {
6631
6637
  console.error('fs listeners not ready during init');
6632
6638
  }
6633
6639
  globalService.send({ type: 'init', endpoints, models, addresses });
6634
- import('./seed.schema.config-BL0wlKbs.js').then(({ models }) => {
6640
+ import('./seed.schema.config-CnfT1dNe.js').then(({ models }) => {
6635
6641
  for (const [key, value] of Object.entries(models)) {
6636
6642
  setModel(key, value);
6637
6643
  }
@@ -7569,4 +7575,4 @@ if (isNode()) {
7569
7575
  }
7570
7576
 
7571
7577
  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 };
7572
- //# sourceMappingURL=index-CtxwCE0C.js.map
7578
+ //# sourceMappingURL=index-BejZtiZ6.js.map