@seedprotocol/sdk 0.2.30 → 0.2.31

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 { I as Item } from './index-BCmsQoYg.js';
1
+ export { I as Item } from './index-D3qJ54jj.js';
2
2
  import 'immer';
3
3
  import 'reflect-metadata';
4
4
  import 'tslib';
@@ -28,4 +28,4 @@ import 'arweave';
28
28
  import 'use-immer';
29
29
  import '@xstate/react';
30
30
  import 'rxjs';
31
- //# sourceMappingURL=index-DzDVTUae.js.map
31
+ //# sourceMappingURL=index-MhbsovAK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-MhbsovAK.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'immer';
2
2
  import 'reflect-metadata';
3
- export { D as Db, d as ImageSrc, e as Item, f as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, x as client, v as eventEmitter, s as getCorrectId, t as getGlobalService, k as useCreateItem, m as useDeleteItem, n as useGlobalServiceStatus, h as useItem, j as useItemProperties, l as useItemProperty, u as useItems, p as usePersistedSnapshots, o as usePublishItem, r as useService, q as useServices, w as withSeed } from './index-BCmsQoYg.js';
3
+ export { D as Db, d as ImageSrc, e as Item, f as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, x as client, v as eventEmitter, s as getCorrectId, t as getGlobalService, k as useCreateItem, m as useDeleteItem, n as useGlobalServiceStatus, h as useItem, j as useItemProperties, l as useItemProperty, u as useItems, p as usePersistedSnapshots, o as usePublishItem, r as useService, q as useServices, w as withSeed } from './index-D3qJ54jj.js';
4
4
  import 'tslib';
5
5
  import 'drizzle-orm';
6
6
  export { B as BaseArweaveClient, a as BaseEasClient, c as BaseFileManager, b as BaseQueryClient } from './constants-BjOTXEgm.js';
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __metadata } from 'tslib';
2
2
  import 'reflect-metadata';
3
- import { T as Text, M as Model } from './index-BCmsQoYg.js';
3
+ import { T as Text, M as Model } from './index-D3qJ54jj.js';
4
4
  import 'immer';
5
5
  import '@sinclair/typebox';
6
6
  import 'drizzle-orm';
@@ -75,4 +75,4 @@ const models = {
75
75
  };
76
76
 
77
77
  export { models };
78
- //# sourceMappingURL=seed.schema.config-BswsDyRe.js.map
78
+ //# sourceMappingURL=seed.schema.config-DCFBkB3M.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed.schema.config-BswsDyRe.js","sources":["../../src/db/configs/seed.schema.config.ts"],"sourcesContent":["import { Model, Text } from '@/schema'\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-DCFBkB3M.js","sources":["../../src/db/configs/seed.schema.config.ts"],"sourcesContent":["import { Model, Text } from '@/schema'\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;;;;;"}
@@ -25,7 +25,7 @@ export const createMetadata: CreateMetadata = async (
25
25
  propertyRecordSchema.localStorageDir &&
26
26
  propertyRecordSchema.storageType === 'ItemStorage'
27
27
  ) {
28
- metadataValues.refResolvedValue = `${metadataValues.seedLocalId}${propertyRecordSchema.filenameSuffix}`
28
+ metadataValues.refResolvedValue = `${metadataValues.seedUid || metadataValues.seedLocalId}${propertyRecordSchema.filenameSuffix}`
29
29
  metadataValues.refValueType = 'file'
30
30
  }
31
31
 
@@ -19,7 +19,6 @@ export const hydrateFromDb = fromCallback<
19
19
  seedUid,
20
20
  seedLocalId,
21
21
  propertyName: propertyNameRaw,
22
- propertyValue,
23
22
  propertyRecordSchema,
24
23
  modelName,
25
24
  } = context
@@ -116,41 +115,6 @@ export const hydrateFromDb = fromCallback<
116
115
  let propertyValueProcessed: string | string[] | undefined | null =
117
116
  propertyValueFromDb
118
117
 
119
- if (propertyName && !propertyNameFromDb) {
120
- logger(
121
- `Property name from code is ${propertyName} but has not value in db ${propertyNameFromDb} for Property.${localId}`,
122
- )
123
- }
124
-
125
- if (
126
- propertyName &&
127
- propertyNameFromDb &&
128
- !propertyNameFromDb.includes(propertyName) &&
129
- !propertyName.includes(propertyNameFromDb) &&
130
- propertyNameFromDb !== propertyName
131
- ) {
132
- logger(
133
- `Property name from db ${propertyNameFromDb} does not match property name ${propertyName} for Property.${localId}`,
134
- )
135
- }
136
-
137
- if (propertyValue && propertyValueFromDb !== propertyValue) {
138
- logger(
139
- `Property value from db ${propertyValueFromDb} does not match property value ${propertyValue} for Property.${localId}`,
140
- )
141
- }
142
-
143
- if (seedLocalIdFromDb !== seedLocalId) {
144
- logger(
145
- `Seed local id from db ${seedLocalIdFromDb} does not match seed local id ${seedLocalId} for Property.${localId}`,
146
- )
147
- }
148
-
149
- if (seedUidFromDb !== seedUid) {
150
- logger(
151
- `Seed uid from db ${seedUidFromDb} does not match seed uid ${seedUid} for Property.${localId}`,
152
- )
153
- }
154
118
 
155
119
  if (
156
120
  propertyRecordSchema &&
@@ -194,6 +158,8 @@ export const hydrateFromDb = fromCallback<
194
158
  propertyValueFromDb &&
195
159
  propertyValueFromDb.length === 66
196
160
  ) {
161
+ // Here the storageTransactionId is stored on a different record and
162
+ // we want to add it as the refResolvedValue
197
163
  const storageTransactionQuery = await appDb
198
164
  .select({
199
165
  propertyValue: metadata.propertyValue,
@@ -107,7 +107,7 @@ export const propertyMachine = setup({
107
107
  actions: assign({
108
108
  refResolvedDisplayValue: ({ event }) =>
109
109
  event.refResolvedDisplayValue,
110
- resolvedValue: ({ event }) => event.refResolvedValue,
110
+ refResolvedValue: ({ event }) => event.refResolvedValue,
111
111
  }),
112
112
  },
113
113
  resolvingRelatedValueDone: {
@@ -111,7 +111,7 @@ export const saveItemStorage = fromCallback<
111
111
  propertyRecordSchema.localStorageDir || propertyData.localStorageDir
112
112
  const fileName =
113
113
  propertyData.refResolvedValue ||
114
- `${propertyData.seedLocalId}${propertyRecordSchema.filenameSuffix}`
114
+ `${propertyData.seedUid || propertyData.seedLocalId}${propertyRecordSchema.filenameSuffix}`
115
115
 
116
116
  if (!localStorageDir || !fileName) {
117
117
  throw new Error(
@@ -1,22 +1,23 @@
1
1
  import { EventObject, fromCallback } from 'xstate'
2
- import { itemMachineSingle } from '@/Item/service/itemMachineSingle'
2
+ import { FromCallbackInput, PropertyMachineContext } from '@/types'
3
3
  import { BaseDb } from '@/db/Db/BaseDb'
4
4
 
5
- export const waitForDb = fromCallback<EventObject, typeof itemMachineSingle>(
6
- ({ sendBack }) => {
7
- const _waitForDb = new Promise<void>((resolve) => {
8
- const interval = setInterval(() => {
9
- const appDb = BaseDb.getAppDb()
5
+ export const waitForDb = fromCallback<
6
+ EventObject,
7
+ FromCallbackInput<PropertyMachineContext>
8
+ >(({ sendBack }) => {
9
+ const _waitForDb = new Promise<void>((resolve) => {
10
+ const interval = setInterval(() => {
11
+ const appDb = BaseDb.getAppDb()
10
12
 
11
- if (appDb) {
12
- clearInterval(interval)
13
- resolve()
14
- }
15
- }, 100)
16
- })
13
+ if (appDb) {
14
+ clearInterval(interval)
15
+ resolve()
16
+ }
17
+ }, 100)
18
+ })
17
19
 
18
- _waitForDb.then(() => {
19
- sendBack({ type: 'waitForDbSuccess' })
20
- })
21
- },
22
- )
20
+ _waitForDb.then(() => {
21
+ sendBack({ type: 'waitForDbSuccess' })
22
+ })
23
+ })
@@ -1 +1 @@
1
- {"version":3,"file":"hydrateFromDb.d.ts","sourceRoot":"","sources":["../../../../../../src/ItemProperty/service/actors/hydrateFromDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAOlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAMpD,eAAO,MAAM,aAAa,oGA+RxB,CAAA"}
1
+ {"version":3,"file":"hydrateFromDb.d.ts","sourceRoot":"","sources":["../../../../../../src/ItemProperty/service/actors/hydrateFromDb.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAOlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAMpD,eAAO,MAAM,aAAa,oGA6PxB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedprotocol/sdk",
3
- "version": "0.2.30",
3
+ "version": "0.2.31",
4
4
  "description": "The SDK for Seed Protocol",
5
5
  "type": "module",
6
6
  "engines": {