@seedprotocol/sdk 0.1.88 → 0.1.90

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,4 +1,4 @@
1
- export { g as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, f as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SCHEMA_BY_NAME, b as GET_SEEDS, c as GET_SEED_IDS, d as GET_STORAGE_TRANSACTION_ID, e as GET_VERSIONS, I as Item, h as itemMachineAll, i as itemMachineSingle } from './index-CtxwCE0C.js';
1
+ export { g as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, f as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SCHEMA_BY_NAME, b as GET_SEEDS, c as GET_SEED_IDS, d as GET_STORAGE_TRANSACTION_ID, e as GET_VERSIONS, I as Item, h as itemMachineAll, i as itemMachineSingle } from './index-C4VKEAXQ.js';
2
2
  import './constants-rmQ8zg8_.js';
3
3
  import '@ethereum-attestation-service/eas-sdk';
4
4
  import 'thirdweb';
@@ -29,4 +29,4 @@ import 'rxjs';
29
29
  import 'drizzle-orm/sqlite-proxy';
30
30
  import '@zenfs/dom';
31
31
  import 'arweave';
32
- //# sourceMappingURL=index-DtqQJ3vS.js.map
32
+ //# sourceMappingURL=index-4AsvJICt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DtqQJ3vS.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index-4AsvJICt.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -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-4AsvJICt.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-_TspGuXU.js');
2633
2639
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2634
2640
  let hasModelsInDb = false;
2635
2641
  const schemaDefsByModelName = new Map();
@@ -5796,17 +5802,29 @@ const getPublishPayload = (seedLocalId) => __awaiter(void 0, void 0, void 0, fun
5796
5802
  if (!itemProperty.value) {
5797
5803
  continue;
5798
5804
  }
5799
- const foundPropertySchema = yield queryClient.fetchQuery({
5800
- queryKey: [`getPropertySchema${propertyName}`],
5801
- queryFn: () => __awaiter(void 0, void 0, void 0, function* () {
5802
- return easClient.request(GET_SCHEMAS, {
5803
- where: {
5804
- id: {
5805
- equals: itemProperty.schemaUid,
5805
+ let queryParams = {
5806
+ where: {
5807
+ id: {
5808
+ equals: itemProperty.schemaUid,
5809
+ },
5810
+ },
5811
+ };
5812
+ if (!itemProperty.schemaUid) {
5813
+ queryParams = {
5814
+ where: {
5815
+ schemaNames: {
5816
+ some: {
5817
+ name: {
5818
+ equals: toSnakeCase(propertyName),
5819
+ },
5806
5820
  },
5807
5821
  },
5808
- });
5809
- }),
5822
+ },
5823
+ };
5824
+ }
5825
+ const foundPropertySchema = yield queryClient.fetchQuery({
5826
+ queryKey: [`getPropertySchema${propertyName}`],
5827
+ queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return easClient.request(GET_SCHEMAS, queryParams); }),
5810
5828
  });
5811
5829
  if (!foundPropertySchema ||
5812
5830
  !foundPropertySchema.schemas ||
@@ -6631,7 +6649,7 @@ const client = {
6631
6649
  console.error('fs listeners not ready during init');
6632
6650
  }
6633
6651
  globalService.send({ type: 'init', endpoints, models, addresses });
6634
- import('./seed.schema.config-BL0wlKbs.js').then(({ models }) => {
6652
+ import('./seed.schema.config-_TspGuXU.js').then(({ models }) => {
6635
6653
  for (const [key, value] of Object.entries(models)) {
6636
6654
  setModel(key, value);
6637
6655
  }
@@ -7569,4 +7587,4 @@ if (isNode()) {
7569
7587
  }
7570
7588
 
7571
7589
  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
7590
+ //# sourceMappingURL=index-C4VKEAXQ.js.map