@seedprotocol/sdk 0.1.70 → 0.1.71
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/{index-Cy1fke9s.js → index-Cv-NmpW4.js} +17 -22
- package/dist/index-Cv-NmpW4.js.map +1 -0
- package/dist/{index-B6WilINl.js → index-DXh19Ejc.js} +2 -2
- package/dist/index-DXh19Ejc.js.map +1 -0
- package/dist/main.js +1 -1
- package/dist/{seed.schema.config-dylVDX7W.js → seed.schema.config-Bp82HrfV.js} +2 -2
- package/dist/{seed.schema.config-dylVDX7W.js.map → seed.schema.config-Bp82HrfV.js.map} +1 -1
- package/dist/src/hydrateFromDb.ts +5 -19
- package/dist/src/seed.ts +4 -31
- package/dist/src/updateMetadata.ts +19 -0
- package/dist/types/src/browser/db/write/updateMetadata.d.ts +5 -0
- package/dist/types/src/browser/db/write/updateMetadata.d.ts.map +1 -0
- package/dist/types/src/browser/property/actors/hydrateFromDb.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-B6WilINl.js.map +0 -1
- package/dist/index-Cy1fke9s.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-Cv-NmpW4.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-DXh19Ejc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DXh19Ejc.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-Cv-NmpW4.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-Cv-NmpW4.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-Bp82HrfV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed.schema.config-
|
|
1
|
+
{"version":3,"file":"seed.schema.config-Bp82HrfV.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;;;;;"}
|
|
@@ -6,6 +6,7 @@ import debug from 'debug'
|
|
|
6
6
|
import { fs } from '@zenfs/core'
|
|
7
7
|
import { metadata } from 'src/shared/seedSchema'
|
|
8
8
|
import { getAppDb } from '@/browser/db/sqlWasmClient'
|
|
9
|
+
import { updateMetadata } from '@/browser/db/write/updateMetadata'
|
|
9
10
|
|
|
10
11
|
const logger = debug('app:property:actors:hydrateFromDb')
|
|
11
12
|
|
|
@@ -209,6 +210,10 @@ export const hydrateFromDb = fromCallback<EventObject, typeof propertyMachine>(
|
|
|
209
210
|
const fileContents = await fs.promises.readFile(filePath)
|
|
210
211
|
const fileHandler = new File([fileContents], refResolvedValue)
|
|
211
212
|
refResolvedDisplayValue = URL.createObjectURL(fileHandler)
|
|
213
|
+
await updateMetadata({
|
|
214
|
+
localId,
|
|
215
|
+
refResolvedDisplayValue,
|
|
216
|
+
})
|
|
212
217
|
}
|
|
213
218
|
}
|
|
214
219
|
}
|
|
@@ -222,25 +227,6 @@ export const hydrateFromDb = fromCallback<EventObject, typeof propertyMachine>(
|
|
|
222
227
|
propertyValueProcessed = propertyValueFromDb.split(',')
|
|
223
228
|
}
|
|
224
229
|
|
|
225
|
-
if (seedLocalIdFromDb === 'sAFXuO7Uez') {
|
|
226
|
-
console.log(`[hydrateFromDb] sending updateContext with:`, {
|
|
227
|
-
type: 'updateContext',
|
|
228
|
-
localId,
|
|
229
|
-
uid,
|
|
230
|
-
propertyValue: propertyValueProcessed,
|
|
231
|
-
seedLocalId: seedLocalIdFromDb,
|
|
232
|
-
seedUid: seedUidFromDb,
|
|
233
|
-
versionLocalId: versionLocalIdFromDb,
|
|
234
|
-
versionUid: versionUidFromDb,
|
|
235
|
-
schemaUid: schemaUidFromDb,
|
|
236
|
-
refValueType,
|
|
237
|
-
localStorageDir,
|
|
238
|
-
resolvedValue: refResolvedValue,
|
|
239
|
-
resolvedDisplayValue: refResolvedDisplayValue,
|
|
240
|
-
renderValue: refResolvedDisplayValue,
|
|
241
|
-
})
|
|
242
|
-
}
|
|
243
|
-
|
|
244
230
|
sendBack({
|
|
245
231
|
type: 'updateContext',
|
|
246
232
|
localId,
|
package/dist/src/seed.ts
CHANGED
|
@@ -1,37 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Subject } from 'rxjs'
|
|
1
|
+
import { SeedConstructorOptions } from '@/types/types'
|
|
2
|
+
import { SeedBase } from '@/shared/seed'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
abstract class SeedBase {
|
|
8
|
-
private readonly _env: Environment = 'browser'
|
|
9
|
-
protected _subject: Subject<void> = new Subject<void>()
|
|
10
|
-
|
|
11
|
-
constructor(props: { endpoints: Endpoints }) {
|
|
12
|
-
console.log('Seed constructor called')
|
|
13
|
-
if (isNode()) {
|
|
14
|
-
this._env = 'node'
|
|
15
|
-
}
|
|
16
|
-
if (isBrowser()) {
|
|
17
|
-
this._env = 'browser'
|
|
18
|
-
}
|
|
19
|
-
if (isReactNative()) {
|
|
20
|
-
this._env = 'react-native'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async initialize() {}
|
|
25
|
-
|
|
26
|
-
subscribe(callback: (event: any) => void) {
|
|
27
|
-
return this._subject.subscribe(callback)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
class SeedSync extends SeedBase {
|
|
4
|
+
class SeedNode extends SeedBase {
|
|
32
5
|
constructor(props: SeedConstructorOptions) {
|
|
33
6
|
super(props)
|
|
34
7
|
}
|
|
35
8
|
}
|
|
36
9
|
|
|
37
|
-
export {
|
|
10
|
+
export { SeedNode }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { metadata, MetadataType } from '@/shared/seedSchema'
|
|
2
|
+
import { getAppDb } from '../sqlWasmClient'
|
|
3
|
+
import { eq } from 'drizzle-orm'
|
|
4
|
+
|
|
5
|
+
type UpdateMetadata = (
|
|
6
|
+
metadataValues: Partial<MetadataType>,
|
|
7
|
+
) => Promise<MetadataType>
|
|
8
|
+
|
|
9
|
+
export const updateMetadata: UpdateMetadata = async (metadataValues) => {
|
|
10
|
+
const appDb = getAppDb()
|
|
11
|
+
|
|
12
|
+
const { localId, ...rest } = metadataValues
|
|
13
|
+
|
|
14
|
+
if (!localId) {
|
|
15
|
+
throw new Error('No localId provided to updateMetadata')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
await appDb.update(metadata).set(rest).where(eq(metadata.localId, localId))
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateMetadata.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/db/write/updateMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAI5D,KAAK,cAAc,GAAG,CACpB,cAAc,EAAE,OAAO,CAAC,YAAY,CAAC,KAClC,OAAO,CAAC,YAAY,CAAC,CAAA;AAE1B,eAAO,MAAM,cAAc,EAAE,cAU5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hydrateFromDb.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/property/actors/hydrateFromDb.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hydrateFromDb.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/property/actors/hydrateFromDb.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,aAAa,KAwQzB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-B6WilINl.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|