@seedprotocol/sdk 0.1.98 → 0.1.100

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-CtPP67gL.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-lKduRQ-D.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-C8w8cEL5.js.map
32
+ //# sourceMappingURL=index-CxLl6iPh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-C8w8cEL5.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index-CxLl6iPh.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1068,7 +1068,7 @@ const hydrateFromDb = fromCallback(({ sendBack, input: { context } }) => {
1068
1068
  if (propertyRecordSchema &&
1069
1069
  propertyRecordSchema.storageType &&
1070
1070
  propertyRecordSchema.storageType === 'ItemStorage') {
1071
- const { Item } = yield import('./index-C8w8cEL5.js');
1071
+ const { Item } = yield import('./index-CxLl6iPh.js');
1072
1072
  const item = yield Item.find({
1073
1073
  seedLocalId,
1074
1074
  modelName: itemModelName,
@@ -2622,7 +2622,7 @@ const addModelsToDb = fromCallback(({ sendBack, input: { context } }) => {
2622
2622
  if (!models$1) {
2623
2623
  return;
2624
2624
  }
2625
- const { models: SeedModels } = yield import('./seed.schema.config-DJLubts8.js');
2625
+ const { models: SeedModels } = yield import('./seed.schema.config-DbK5jPLE.js');
2626
2626
  const allModels = Object.assign(Object.assign({}, SeedModels), models$1);
2627
2627
  let hasModelsInDb = false;
2628
2628
  const schemaDefsByModelName = new Map();
@@ -5787,7 +5787,8 @@ const getItem = (_a) => __awaiter(void 0, [_a], void 0, function* ({ modelName,
5787
5787
  return Item.create(itemInitObj);
5788
5788
  });
5789
5789
 
5790
- const getSchemaForItemProperty = (_a) => __awaiter(void 0, [_a], void 0, function* ({ schemaUid, propertyName, }) {
5790
+ const getSchemaForItemProperty = (_a) => __awaiter(void 0, [_a], void 0, function* ({ schemaUid, propertyName, easDataType, }) {
5791
+ const propertyNameSnakeCase = toSnakeCase(propertyName);
5791
5792
  let queryParams = {
5792
5793
  where: {
5793
5794
  id: {
@@ -5795,13 +5796,23 @@ const getSchemaForItemProperty = (_a) => __awaiter(void 0, [_a], void 0, functio
5795
5796
  },
5796
5797
  },
5797
5798
  };
5798
- if (!schemaUid || schemaUid === 'null' || schemaUid === 'undefined') {
5799
+ if (!schemaUid && easDataType) {
5800
+ queryParams = {
5801
+ where: {
5802
+ schema: {
5803
+ equals: `${easDataType} ${propertyNameSnakeCase}`,
5804
+ },
5805
+ },
5806
+ };
5807
+ }
5808
+ if (!easDataType &&
5809
+ (!schemaUid || schemaUid === 'null' || schemaUid === 'undefined')) {
5799
5810
  queryParams = {
5800
5811
  where: {
5801
5812
  schemaNames: {
5802
5813
  some: {
5803
5814
  name: {
5804
- equals: toSnakeCase(propertyName),
5815
+ equals: propertyNameSnakeCase,
5805
5816
  },
5806
5817
  },
5807
5818
  },
@@ -5834,6 +5845,7 @@ const getPublishPayload = (seedLocalId) => __awaiter(void 0, void 0, void 0, fun
5834
5845
  if (!itemProperty.value || !itemProperty.propertyDef) {
5835
5846
  continue;
5836
5847
  }
5848
+ const easDataType = INTERNAL_DATA_TYPES[itemProperty.propertyDef.dataType].eas;
5837
5849
  let propertyNameForSchema = propertyName;
5838
5850
  if (itemProperty.propertyDef.dataType === 'Relation') {
5839
5851
  propertyNameForSchema = `${propertyName}Id`;
@@ -5851,11 +5863,11 @@ const getPublishPayload = (seedLocalId) => __awaiter(void 0, void 0, void 0, fun
5851
5863
  const foundPropertySchema = yield getSchemaForItemProperty({
5852
5864
  schemaUid: itemProperty.schemaUid,
5853
5865
  propertyName: propertyNameForSchema,
5866
+ easDataType,
5854
5867
  });
5855
5868
  if (!foundPropertySchema) {
5856
5869
  throw new Error(`No schema found for property ${itemProperty.propertyName} ${itemProperty.localId}`);
5857
5870
  }
5858
- const easDataType = INTERNAL_DATA_TYPES[itemProperty.propertyDef.dataType].eas;
5859
5871
  const data = [
5860
5872
  {
5861
5873
  name: toSnakeCase(propertyNameForSchema),
@@ -6673,7 +6685,7 @@ const client = {
6673
6685
  console.error('fs listeners not ready during init');
6674
6686
  }
6675
6687
  globalService.send({ type: 'init', endpoints, models, addresses });
6676
- import('./seed.schema.config-DJLubts8.js').then(({ models }) => {
6688
+ import('./seed.schema.config-DbK5jPLE.js').then(({ models }) => {
6677
6689
  for (const [key, value] of Object.entries(models)) {
6678
6690
  setModel(key, value);
6679
6691
  }
@@ -6933,7 +6945,15 @@ const analyzeInput = fromCallback(({ sendBack, input: { context, event } }) => {
6933
6945
  return false;
6934
6946
  }
6935
6947
  if (!schemaUid) {
6936
- const schemaFromEas = yield getSchemaForItemProperty({ propertyName });
6948
+ let easDataType;
6949
+ if (propertyRecordSchema.dataType) {
6950
+ easDataType = INTERNAL_DATA_TYPES[propertyRecordSchema.dataType]
6951
+ .eas;
6952
+ }
6953
+ const schemaFromEas = yield getSchemaForItemProperty({
6954
+ propertyName,
6955
+ easDataType,
6956
+ });
6937
6957
  if (schemaFromEas) {
6938
6958
  schemaUid = schemaFromEas.id;
6939
6959
  }
@@ -7618,4 +7638,4 @@ if (isNode()) {
7618
7638
  }
7619
7639
 
7620
7640
  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 };
7621
- //# sourceMappingURL=index-CtPP67gL.js.map
7641
+ //# sourceMappingURL=index-lKduRQ-D.js.map