@seedprotocol/sdk 0.1.56 → 0.1.58
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/constants-BLctWkrn.js.map +1 -1
- package/dist/{index-Cdz3ZpGp.js → index-CpkFYsgU.js} +27 -46
- package/dist/{index-Cdz3ZpGp.js.map → index-CpkFYsgU.js.map} +1 -1
- package/dist/{index-DcYDcCt6.js → index-Ij9VEGXg.js} +2 -2
- package/dist/index-Ij9VEGXg.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-BjnTnTUw.js → seed.schema.config-BzZpzxHI.js} +2 -2
- package/dist/{seed.schema.config-BjnTnTUw.js.map → seed.schema.config-BzZpzxHI.js.map} +1 -1
- package/dist/src/hydrateFromDb.ts +15 -44
- package/dist/src/saveImageSrc.ts +11 -3
- package/dist/types/src/browser/property/actors/hydrateFromDb.d.ts.map +1 -1
- package/dist/types/src/browser/property/actors/saveValueToDb/index.d.ts.map +1 -1
- package/dist/types/src/browser/property/actors/saveValueToDb/saveImageSrc.d.ts.map +1 -1
- package/dist/types/src/shared/helpers/constants.d.ts +0 -1
- package/dist/types/src/shared/helpers/constants.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-DcYDcCt6.js.map +0 -1
|
@@ -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-
|
|
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-CpkFYsgU.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-
|
|
30
|
+
//# sourceMappingURL=index-Ij9VEGXg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Ij9VEGXg.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-
|
|
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-CpkFYsgU.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-
|
|
3
|
+
import { T as Text, M as Model } from './index-CpkFYsgU.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-
|
|
77
|
+
//# sourceMappingURL=seed.schema.config-BzZpzxHI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.schema.config-
|
|
1
|
+
{"version":3,"file":"seed.schema.config-BzZpzxHI.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 (
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
}
|
package/dist/src/saveImageSrc.ts
CHANGED
|
@@ -106,7 +106,15 @@ export const saveImageSrc = fromCallback<
|
|
|
106
106
|
|
|
107
107
|
if (newValueType === 'imageBase64') {
|
|
108
108
|
mimeType = getMimeType(newValue as string)
|
|
109
|
-
|
|
109
|
+
const base64Data = (newValue as string).split(',')[1] // Strip the Base64 prefix
|
|
110
|
+
const binaryString = atob(base64Data)
|
|
111
|
+
|
|
112
|
+
const binaryLength = binaryString.length
|
|
113
|
+
const binaryArray = new Uint8Array(binaryLength)
|
|
114
|
+
for (let i = 0; i < binaryLength; i++) {
|
|
115
|
+
binaryArray[i] = binaryString.charCodeAt(i)
|
|
116
|
+
}
|
|
117
|
+
fileData = binaryArray.buffer
|
|
110
118
|
}
|
|
111
119
|
|
|
112
120
|
if (newValueType === 'url') {
|
|
@@ -158,7 +166,7 @@ export const saveImageSrc = fromCallback<
|
|
|
158
166
|
propertyValue: newImageSeedLocalId,
|
|
159
167
|
seedLocalId,
|
|
160
168
|
seedUid,
|
|
161
|
-
versionLocalId: imageVersionLocalId,
|
|
169
|
+
versionLocalId: imageVersionLocalId || versionLocalId,
|
|
162
170
|
versionUid,
|
|
163
171
|
modelName: itemModelName,
|
|
164
172
|
schemaUid,
|
|
@@ -176,7 +184,7 @@ export const saveImageSrc = fromCallback<
|
|
|
176
184
|
propertyName: propertyNameRaw,
|
|
177
185
|
newValue: newImageSeedLocalId,
|
|
178
186
|
seedLocalId,
|
|
179
|
-
versionLocalId,
|
|
187
|
+
versionLocalId: imageVersionLocalId || versionLocalId,
|
|
180
188
|
modelName: itemModelName,
|
|
181
189
|
schemaUid,
|
|
182
190
|
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,
|
|
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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"saveImageSrc.d.ts","sourceRoot":"","sources":["../../../../../../../src/browser/property/actors/saveValueToDb/saveImageSrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAEL,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAwDzB,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"saveImageSrc.d.ts","sourceRoot":"","sources":["../../../../../../../src/browser/property/actors/saveValueToDb/saveImageSrc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAEL,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,kBAAkB,CAAA;AAwDzB,eAAO,MAAM,YAAY,8HAkJvB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/helpers/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DcYDcCt6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|