@seedprotocol/sdk 0.1.97 → 0.1.99

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-uwYqpfQT.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-BoPvASL1.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-BHJ84k-m.js.map
32
+ //# sourceMappingURL=index-Mt8WaytK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BHJ84k-m.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index-Mt8WaytK.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- export { j as ImageSrc, I as Item, k as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, t as client, v as getCorrectId, s as getGlobalService, n as useCreateItem, p as useDeleteItem, q as useGlobalServiceStatus, l as useItem, m as useItemProperties, o as useItemProperty, u as useItems, r as useServices, w as withSeed } from './index-uwYqpfQT.js';
1
+ export { j as ImageSrc, I as Item, k as ItemProperty, J as Json, L as List, M as Model, P as Property, R as Relation, T as Text, t as client, v as getCorrectId, s as getGlobalService, n as useCreateItem, p as useDeleteItem, q as useGlobalServiceStatus, l as useItem, m as useItemProperties, o as useItemProperty, u as useItems, r as useServices, w as withSeed } from './index-BoPvASL1.js';
2
2
  import 'immer';
3
3
  import 'reflect-metadata';
4
4
  import './constants-rmQ8zg8_.js';
@@ -1,6 +1,6 @@
1
1
  import { _ as __decorate, a as __metadata } from './constants-rmQ8zg8_.js';
2
2
  import 'drizzle-orm';
3
- import { T as Text, M as Model } from './index-uwYqpfQT.js';
3
+ import { T as Text, M as Model } from './index-BoPvASL1.js';
4
4
  import 'react';
5
5
  import 'reflect-metadata';
6
6
  import 'xstate';
@@ -76,4 +76,4 @@ const models = {
76
76
  };
77
77
 
78
78
  export { models };
79
- //# sourceMappingURL=seed.schema.config-DLj7z3au.js.map
79
+ //# sourceMappingURL=seed.schema.config-Dffe0eOd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed.schema.config-DLj7z3au.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-Dffe0eOd.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;;;;;"}
@@ -8,6 +8,8 @@ import {
8
8
  import { updateItemPropertyValue } from '@/browser/db/write/updateItemPropertyValue'
9
9
 
10
10
  import { getSchemaForItemProperty } from '@/browser/helpers/getSchemaForItemProperty'
11
+ import { INTERNAL_DATA_TYPES } from '@/shared/helpers/constants'
12
+ import { TypedData } from '@ethereum-attestation-service/eas-sdk/dist/offchain/typed-data-handler'
11
13
 
12
14
  export const analyzeInput = fromCallback<
13
15
  EventObject,
@@ -79,7 +81,17 @@ export const analyzeInput = fromCallback<
79
81
  }
80
82
 
81
83
  if (!schemaUid) {
82
- const schemaFromEas = await getSchemaForItemProperty({ propertyName })
84
+ let easDataType
85
+
86
+ if (propertyRecordSchema.dataType) {
87
+ easDataType = INTERNAL_DATA_TYPES[propertyRecordSchema.dataType]
88
+ .eas as TypedData['type']
89
+ }
90
+
91
+ const schemaFromEas = await getSchemaForItemProperty({
92
+ propertyName,
93
+ easDataType,
94
+ })
83
95
  if (schemaFromEas) {
84
96
  schemaUid = schemaFromEas.id
85
97
  }
@@ -12,7 +12,7 @@ import {
12
12
 
13
13
  import { getSchemaForItemProperty } from '@/browser/helpers/getSchemaForItemProperty'
14
14
  import { toSnakeCase } from '@/shared/helpers'
15
- import { singular } from 'pluralize'
15
+ import pluralize from 'pluralize'
16
16
 
17
17
  type PublishPayload = {
18
18
  localId: string
@@ -49,6 +49,9 @@ export const getPublishPayload = async (
49
49
  continue
50
50
  }
51
51
 
52
+ const easDataType =
53
+ INTERNAL_DATA_TYPES[itemProperty.propertyDef.dataType].eas
54
+
52
55
  let propertyNameForSchema = propertyName
53
56
 
54
57
  if (itemProperty.propertyDef.dataType === 'Relation') {
@@ -59,7 +62,7 @@ export const getPublishPayload = async (
59
62
  itemProperty.propertyDef.dataType === 'List' &&
60
63
  itemProperty.propertyDef.ref
61
64
  ) {
62
- const singularPropertyName = singular(propertyName)
65
+ const singularPropertyName = pluralize.singular(propertyName)
63
66
  const compositePropertyName = `${singularPropertyName}${itemProperty.propertyDef.ref}Ids`
64
67
  propertyNameForSchema = compositePropertyName
65
68
  }
@@ -74,6 +77,7 @@ export const getPublishPayload = async (
74
77
  const foundPropertySchema = await getSchemaForItemProperty({
75
78
  schemaUid: itemProperty.schemaUid,
76
79
  propertyName: propertyNameForSchema,
80
+ easDataType,
77
81
  })
78
82
 
79
83
  if (!foundPropertySchema) {
@@ -82,9 +86,6 @@ export const getPublishPayload = async (
82
86
  )
83
87
  }
84
88
 
85
- const easDataType =
86
- INTERNAL_DATA_TYPES[itemProperty.propertyDef.dataType].eas
87
-
88
89
  const data = [
89
90
  {
90
91
  name: toSnakeCase(propertyNameForSchema),
@@ -2,10 +2,12 @@ import { Schema, SchemaWhereInput } from '@/browser/gql/graphql'
2
2
  import { toSnakeCase } from '@/shared/helpers'
3
3
  import { GET_SCHEMAS } from '@/browser'
4
4
  import { easClient, queryClient } from '@/browser/helpers'
5
+ import { TypedData } from '@ethereum-attestation-service/eas-sdk/dist/offchain/typed-data-handler'
5
6
 
6
7
  type GetSchemaForPropertyProps = {
7
8
  schemaUid?: string
8
9
  propertyName: string
10
+ easDataType?: TypedData['type']
9
11
  }
10
12
  type GetSchemaForProperty = (
11
13
  props: GetSchemaForPropertyProps,
@@ -13,6 +15,7 @@ type GetSchemaForProperty = (
13
15
  export const getSchemaForItemProperty: GetSchemaForProperty = async ({
14
16
  schemaUid,
15
17
  propertyName,
18
+ easDataType,
16
19
  }): Promise<Schema | void> => {
17
20
  let queryParams: { where: SchemaWhereInput } = {
18
21
  where: {
@@ -22,7 +25,20 @@ export const getSchemaForItemProperty: GetSchemaForProperty = async ({
22
25
  },
23
26
  }
24
27
 
25
- if (!schemaUid || schemaUid === 'null' || schemaUid === 'undefined') {
28
+ if (!schemaUid && easDataType) {
29
+ queryParams = {
30
+ where: {
31
+ schema: {
32
+ equals: `${easDataType} ${propertyName}`,
33
+ },
34
+ },
35
+ }
36
+ }
37
+
38
+ if (
39
+ !easDataType &&
40
+ (!schemaUid || schemaUid === 'null' || schemaUid === 'undefined')
41
+ ) {
26
42
  queryParams = {
27
43
  where: {
28
44
  schemaNames: {
@@ -1 +1 @@
1
- {"version":3,"file":"getPublishPayload.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/db/read/getPublishPayload.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kBAAkB,EAEnB,MAAM,uCAAuC,CAAA;AAM9C,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,OAAO,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,kBAAkB,EAAE,CAAA;IACxC,kBAAkB,EAAE,GAAG,EAAE,CAAA;CAC1B,CAAA;AAED,KAAK,mBAAmB,GAAG,cAAc,EAAE,CAAA;AAE3C,eAAO,MAAM,iBAAiB,gBACf,MAAM,KAClB,OAAO,CAAC,mBAAmB,CA6F7B,CAAA"}
1
+ {"version":3,"file":"getPublishPayload.d.ts","sourceRoot":"","sources":["../../../../../../src/browser/db/read/getPublishPayload.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,kBAAkB,EAEnB,MAAM,uCAAuC,CAAA;AAM9C,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,OAAO,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,kBAAkB,EAAE,kBAAkB,EAAE,CAAA;IACxC,kBAAkB,EAAE,GAAG,EAAE,CAAA;CAC1B,CAAA;AAED,KAAK,mBAAmB,GAAG,cAAc,EAAE,CAAA;AAE3C,eAAO,MAAM,iBAAiB,gBACf,MAAM,KAClB,OAAO,CAAC,mBAAmB,CA8F7B,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import { Schema } from '@/browser/gql/graphql';
2
+ import { TypedData } from '@ethereum-attestation-service/eas-sdk/dist/offchain/typed-data-handler';
2
3
  type GetSchemaForPropertyProps = {
3
4
  schemaUid?: string;
4
5
  propertyName: string;
6
+ easDataType?: TypedData['type'];
5
7
  };
6
8
  type GetSchemaForProperty = (props: GetSchemaForPropertyProps) => Promise<Schema | void>;
7
9
  export declare const getSchemaForItemProperty: GetSchemaForProperty;
@@ -1 +1 @@
1
- {"version":3,"file":"getSchemaForItemProperty.d.ts","sourceRoot":"","sources":["../../../../../src/browser/helpers/getSchemaForItemProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoB,MAAM,uBAAuB,CAAA;AAKhE,KAAK,yBAAyB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB,CAAA;AACD,KAAK,oBAAoB,GAAG,CAC1B,KAAK,EAAE,yBAAyB,KAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;AAC3B,eAAO,MAAM,wBAAwB,EAAE,oBAmCtC,CAAA"}
1
+ {"version":3,"file":"getSchemaForItemProperty.d.ts","sourceRoot":"","sources":["../../../../../src/browser/helpers/getSchemaForItemProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoB,MAAM,uBAAuB,CAAA;AAIhE,OAAO,EAAE,SAAS,EAAE,MAAM,wEAAwE,CAAA;AAElG,KAAK,yBAAyB,GAAG;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CAChC,CAAA;AACD,KAAK,oBAAoB,GAAG,CAC1B,KAAK,EAAE,yBAAyB,KAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;AAC3B,eAAO,MAAM,wBAAwB,EAAE,oBAiDtC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"analyzeInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/browser/property/actors/saveValueToDb/analyzeInput.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;AAKzB,eAAO,MAAM,YAAY,8HAoGvB,CAAA"}
1
+ {"version":3,"file":"analyzeInput.d.ts","sourceRoot":"","sources":["../../../../../../../src/browser/property/actors/saveValueToDb/analyzeInput.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;AAOzB,eAAO,MAAM,YAAY,8HA8GvB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seedprotocol/sdk",
3
- "version": "0.1.97",
3
+ "version": "0.1.99",
4
4
  "description": "The SDK for Seed Protocol",
5
5
  "type": "module",
6
6
  "types": "./dist/types/src/index.d.ts",