@seedprotocol/sdk 0.1.56 → 0.1.57

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 { f as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, e as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SEEDS, b as GET_SEED_IDS, c as GET_STORAGE_TRANSACTION_ID, d as GET_VERSIONS, I as Item, g as itemMachineAll, i as itemMachineSingle } from './index-Cdz3ZpGp.js';
1
+ export { f as GET_ALL_PROPERTIES_FOR_ALL_VERSIONS, e as GET_PROPERTIES, G as GET_SCHEMAS, a as GET_SEEDS, b as GET_SEED_IDS, c as GET_STORAGE_TRANSACTION_ID, d as GET_VERSIONS, I as Item, g as itemMachineAll, i as itemMachineSingle } from './index-COcsVb0S.js';
2
2
  import './constants-BLctWkrn.js';
3
3
  import 'path';
4
4
  import 'reflect-metadata';
@@ -27,4 +27,4 @@ import '@zenfs/dom';
27
27
  import 'arweave';
28
28
  import 'use-immer';
29
29
  import '@xstate/react';
30
- //# sourceMappingURL=index-DcYDcCt6.js.map
30
+ //# sourceMappingURL=index-p5KR99fK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-p5KR99fK.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- export { h as ImageSrc, I as Item, j as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, s as client, t as getCorrectId, r as getGlobalService, m as useCreateItem, o as useDeleteItem, p as useGlobalServiceStatus, k as useItem, l as useItemProperties, n as useItemProperty, u as useItems, q as useServices, w as withSeed } from './index-Cdz3ZpGp.js';
1
+ export { h as ImageSrc, I as Item, j as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, s as client, t as getCorrectId, r as getGlobalService, m as useCreateItem, o as useDeleteItem, p as useGlobalServiceStatus, k as useItem, l as useItemProperties, n as useItemProperty, u as useItems, q as useServices, w as withSeed } from './index-COcsVb0S.js';
2
2
  import 'immer';
3
3
  import 'reflect-metadata';
4
4
  import './constants-BLctWkrn.js';
@@ -1,6 +1,6 @@
1
1
  import { _ as __decorate, a as __metadata } from './constants-BLctWkrn.js';
2
2
  import 'drizzle-orm';
3
- import { T as Text, M as Model } from './index-Cdz3ZpGp.js';
3
+ import { T as Text, M as Model } from './index-COcsVb0S.js';
4
4
  import 'react';
5
5
  import 'reflect-metadata';
6
6
  import 'xstate';
@@ -74,4 +74,4 @@ const models = {
74
74
  };
75
75
 
76
76
  export { models };
77
- //# sourceMappingURL=seed.schema.config-BjnTnTUw.js.map
77
+ //# sourceMappingURL=seed.schema.config-CJEIY4ZZ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed.schema.config-BjnTnTUw.js","sources":["../../src/shared/configs/seed.schema.config.ts"],"sourcesContent":["import { Model, Text } from '@/browser'\n\n@Model\nclass Seed {\n @Text() uid!: string\n @Text() type!: string\n}\n\n@Model\nclass Version {\n @Text() seedUid!: string\n @Text() note!: string\n}\n\n@Model\nclass Metadata {\n @Text() key!: string\n @Text() value!: string\n}\n\nexport const models = {\n Seed,\n Version,\n Metadata,\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,IAAI,GAAV,MAAM,IAAI,CAAA;CAGT;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAFjB,IAAI,GAAA,UAAA,CAAA;IADT;AACK,CAAA,EAAA,IAAI,CAGT;AAGD,IAAM,OAAO,GAAb,MAAM,OAAO,CAAA;CAGZ;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAiB,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA;AAChB,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAFjB,OAAO,GAAA,UAAA,CAAA;IADZ;AACK,CAAA,EAAA,OAAO,CAGZ;AAGD,IAAM,QAAQ,GAAd,MAAM,QAAQ,CAAA;CAGb;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAe,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;AAFlB,QAAQ,GAAA,UAAA,CAAA;IADb;AACK,CAAA,EAAA,QAAQ,CAGb;AAEY,MAAA,MAAM,GAAG;IACpB,IAAI;IACJ,OAAO;IACP,QAAQ;;;;;"}
1
+ {"version":3,"file":"seed.schema.config-CJEIY4ZZ.js","sources":["../../src/shared/configs/seed.schema.config.ts"],"sourcesContent":["import { Model, Text } from '@/browser'\n\n@Model\nclass Seed {\n @Text() uid!: string\n @Text() type!: string\n}\n\n@Model\nclass Version {\n @Text() seedUid!: string\n @Text() note!: string\n}\n\n@Model\nclass Metadata {\n @Text() key!: string\n @Text() value!: string\n}\n\nexport const models = {\n Seed,\n Version,\n Metadata,\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,IAAI,GAAV,MAAM,IAAI,CAAA;CAGT;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAFjB,IAAI,GAAA,UAAA,CAAA;IADT;AACK,CAAA,EAAA,IAAI,CAGT;AAGD,IAAM,OAAO,GAAb,MAAM,OAAO,CAAA;CAGZ;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAiB,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA;AAChB,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAc,CAAA,EAAA,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA;AAFjB,OAAO,GAAA,UAAA,CAAA;IADZ;AACK,CAAA,EAAA,OAAO,CAGZ;AAGD,IAAM,QAAQ,GAAd,MAAM,QAAQ,CAAA;CAGb;AAFS,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAa,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,KAAA,EAAA,KAAA,CAAA,CAAA;AACZ,UAAA,CAAA;AAAP,IAAA,IAAI,EAAE;;AAAe,CAAA,EAAA,QAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA;AAFlB,QAAQ,GAAA,UAAA,CAAA;IADb;AACK,CAAA,EAAA,QAAQ,CAGb;AAEY,MAAA,MAAM,GAAG;IACpB,IAAI;IACJ,OAAO;IACP,QAAQ;;;;;"}
@@ -188,57 +188,28 @@ export const hydrateFromDb = fromCallback<EventObject, typeof propertyMachine>(
188
188
  renderValue: refResolvedDisplayValue,
189
189
  })
190
190
 
191
- if (propertyNameFromDb === 'storageTransactionId') {
191
+ if (
192
+ propertyRecordSchema &&
193
+ propertyRecordSchema.storageType &&
194
+ propertyRecordSchema.storageType === 'ItemStorage'
195
+ ) {
192
196
  const { Item } = await import(`@/browser/item`)
193
197
  const item = await Item.find({
194
198
  seedLocalId,
195
199
  modelName: itemModelName,
196
200
  })
197
201
  if (item) {
198
- for (const [propertyName, property] of Object.entries(
199
- item.properties,
200
- )) {
201
- if (
202
- propertyName === 'html' &&
203
- propertyValueFromDb &&
204
- propertyValueFromDb.length === 43
205
- ) {
206
- const htmlFilePath = `/files/html/${propertyValueFromDb}.html`
207
- const exists = await fs.promises.exists(htmlFilePath)
208
- if (!exists) {
209
- return
210
- }
211
- const renderValue = await fs.promises
212
- .readFile(htmlFilePath, 'utf8')
213
- .catch((error) => {
214
- logger('Error reading html file', error)
215
- })
216
- property
217
- .getService()
218
- .send({ type: 'updateRenderValue', renderValue })
219
- return
220
- }
221
- if (
222
- propertyName === 'json' &&
223
- propertyValueFromDb &&
224
- propertyValueFromDb.length === 43
225
- ) {
226
- const jsonFilePath = `/files/json/${propertyValueFromDb}.json`
227
- const exists = await fs.promises.exists(jsonFilePath)
228
- if (!exists) {
229
- return
230
- }
231
- const renderValue = await fs.promises
232
- .readFile(jsonFilePath, 'utf8')
233
- .catch((error) => {
234
- logger('Error reading json file', error)
235
- })
236
- property
237
- .getService()
238
- .send({ type: 'updateRenderValue', renderValue })
239
- return
240
- }
202
+ const filePath = `/files/${localStorageDir}/${refResolvedValue}`
203
+ const exists = await fs.promises.exists(filePath)
204
+
205
+ if (!exists) {
206
+ return
241
207
  }
208
+
209
+ const renderValue = await fs.promises.readFile(filePath, 'utf8')
210
+ const property = item.properties[propertyName]
211
+ property.getService().send({ type: 'updateRenderValue', renderValue })
212
+ return
242
213
  }
243
214
  }
244
215
  }
@@ -158,7 +158,7 @@ export const saveImageSrc = fromCallback<
158
158
  propertyValue: newImageSeedLocalId,
159
159
  seedLocalId,
160
160
  seedUid,
161
- versionLocalId: imageVersionLocalId,
161
+ versionLocalId: imageVersionLocalId || versionLocalId,
162
162
  versionUid,
163
163
  modelName: itemModelName,
164
164
  schemaUid,
@@ -176,7 +176,7 @@ export const saveImageSrc = fromCallback<
176
176
  propertyName: propertyNameRaw,
177
177
  newValue: newImageSeedLocalId,
178
178
  seedLocalId,
179
- versionLocalId,
179
+ versionLocalId: imageVersionLocalId || versionLocalId,
180
180
  modelName: itemModelName,
181
181
  schemaUid,
182
182
  refSeedType: 'image',
@@ -1 +1 @@
1
- {"version":3,"file":"hydrateFromDb.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/property/actors/hydrateFromDb.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa,KA8OzB,CAAA"}
1
+ {"version":3,"file":"hydrateFromDb.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/property/actors/hydrateFromDb.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa,KAiNzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/browser/property/actors/saveValueToDb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAEL,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAEzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AAEjC,eAAO,MAAM,YAAY,8HAyFvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/browser/property/actors/saveValueToDb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAEL,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAEzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AAEjC,eAAO,MAAM,YAAY,8HA0FvB,CAAA"}
@@ -1,4 +1,3 @@
1
- export declare const APP_DB_CONFIG = "browser.app.db.config.ts";
2
1
  export declare const SCHEMA_NJK = "schema.njk";
3
2
  export declare const SCHEMA_TS = "schema.ts";
4
3
  export declare const INTERNAL_DATA_TYPES: {
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/helpers/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,6BAA6B,CAAA;AACvD,eAAO,MAAM,UAAU,eAAe,CAAA;AACtC,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;CAgB/B,CAAA;AAED,eAAO,MAAM,qBAAqB,UAmBjC,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/helpers/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,eAAe,CAAA;AACtC,eAAO,MAAM,SAAS,cAAc,CAAA;AAEpC,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;CAgB/B,CAAA;AAED,eAAO,MAAM,qBAAqB,UAmBjC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedprotocol/sdk",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "description": "The SDK for Seed Protocol",
5
5
  "type": "module",
6
6
  "types": "./dist/types/src/index.d.ts",