@seedprotocol/sdk 0.3.4 → 0.3.5
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/addModel.js +89 -0
- package/dist/addModel.js.map +1 -0
- package/dist/bin.js +71 -29
- package/dist/bin.js.map +1 -1
- package/dist/db/configs/browser.app.db.config.ts +1 -0
- package/dist/db/configs/node.app.db.config.ts +1 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/node/codegen/templates/model.njk +14 -0
- package/dist/scripts/addModel.d.ts +3 -0
- package/dist/scripts/addModel.d.ts.map +1 -0
- package/dist/scripts/bin.d.ts.map +1 -1
- package/dist/src/db/configs/browser.app.db.config.d.ts.map +1 -1
- package/dist/src/db/configs/node.app.db.config.d.ts.map +1 -1
- package/dist/src/helpers/constants.d.ts +1 -0
- package/dist/src/helpers/constants.d.ts.map +1 -1
- package/dist/src/helpers/constants.js +2 -1
- package/dist/src/helpers/constants.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/node/codegen/drizzle.d.ts +4 -1
- package/dist/src/node/codegen/drizzle.d.ts.map +1 -1
- package/dist/src/node/codegen/drizzle.js +37 -9
- package/dist/src/node/codegen/drizzle.js.map +1 -1
- package/dist/src/node/constants.d.ts.map +1 -1
- package/dist/src/node/constants.js +11 -3
- package/dist/src/node/constants.js.map +1 -1
- package/dist/src/node/helpers/index.d.ts.map +1 -1
- package/dist/src/node/helpers/index.js +19 -8
- package/dist/src/node/helpers/index.js.map +1 -1
- package/dist/src/node/webpack/index.d.ts.map +1 -1
- package/dist/src/node/webpack/index.js +7 -0
- package/dist/src/node/webpack/index.js.map +1 -1
- package/dist/src/schema/index.d.ts.map +1 -1
- package/dist/src/schema/model/index.d.ts +8 -8
- package/dist/src/schema/property/index.d.ts +58 -32
- package/dist/src/schema/property/index.d.ts.map +1 -1
- package/dist/src/schema/property/index.js +13 -6
- package/dist/src/schema/property/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -5,10 +5,12 @@ const TPropertyDataType = Type.Union([
|
|
|
5
5
|
Type.Literal('Number'),
|
|
6
6
|
Type.Literal('List'),
|
|
7
7
|
Type.Literal('Relation'),
|
|
8
|
-
Type.Literal('
|
|
8
|
+
Type.Literal('Image'),
|
|
9
9
|
Type.Literal('FileSrc'),
|
|
10
10
|
Type.Literal('Json'),
|
|
11
|
-
Type.Literal('
|
|
11
|
+
Type.Literal('File'),
|
|
12
|
+
Type.Literal('Boolean'),
|
|
13
|
+
Type.Literal('Date'),
|
|
12
14
|
]);
|
|
13
15
|
const TStorageType = Type.Union([
|
|
14
16
|
Type.Literal('ItemStorage'), // Looks for a storageTransactionId property on the item
|
|
@@ -41,7 +43,7 @@ const Property = {
|
|
|
41
43
|
TObject: Type.String(),
|
|
42
44
|
}),
|
|
43
45
|
Json: () => ({ dataType: 'Json' }),
|
|
44
|
-
|
|
46
|
+
File: () => ({ dataType: 'File' }),
|
|
45
47
|
Number: () => ({ dataType: 'Number' }),
|
|
46
48
|
List: (ref, refValueType) => ({
|
|
47
49
|
dataType: 'List',
|
|
@@ -53,7 +55,9 @@ const Property = {
|
|
|
53
55
|
ref,
|
|
54
56
|
refValueType,
|
|
55
57
|
}),
|
|
56
|
-
|
|
58
|
+
Image: () => ({ dataType: 'Image' }),
|
|
59
|
+
Boolean: () => ({ dataType: 'Boolean' }),
|
|
60
|
+
Date: () => ({ dataType: 'Date' }),
|
|
57
61
|
};
|
|
58
62
|
const PropertyMetadataKey = Symbol('property');
|
|
59
63
|
const PropertyConstructor = (propertyType) => {
|
|
@@ -73,10 +77,13 @@ const PropertyConstructor = (propertyType) => {
|
|
|
73
77
|
};
|
|
74
78
|
};
|
|
75
79
|
const Text = (storageType, srcDir, filenameSuffix) => PropertyConstructor(Property.Text(storageType, srcDir, filenameSuffix));
|
|
80
|
+
const Number = () => PropertyConstructor(Property.Number());
|
|
76
81
|
const Json = () => PropertyConstructor(Property.Json());
|
|
77
|
-
const
|
|
82
|
+
const Image = () => PropertyConstructor(Property.Image());
|
|
78
83
|
const Relation = (ref, refValueType) => PropertyConstructor(Property.Relation(ref, refValueType)); // Adjust for actual relation type
|
|
79
84
|
const List = (ref, reValueType) => PropertyConstructor(Property.List(ref, reValueType)); // Adjust for actual list type
|
|
85
|
+
const Boolean = () => PropertyConstructor(Property.Boolean());
|
|
86
|
+
const Date = () => PropertyConstructor(Property.Date());
|
|
80
87
|
|
|
81
|
-
export {
|
|
88
|
+
export { Boolean, Date, Image, Json, List, Number, Property, PropertyConstructor, PropertyMetadataKey, Relation, TProperty, TPropertyConstructor, TPropertyDataType, TStorageType, Text };
|
|
82
89
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/schema/property/index.ts"],"sourcesContent":["import { Static, Type } from '@sinclair/typebox'\nimport { PropertyDataType, PropertyDefs, StorageType } from '@/types'\n\nexport const TPropertyDataType = Type.Union([\n Type.Literal('Text'),\n Type.Literal('Number'),\n Type.Literal('List'),\n Type.Literal('Relation'),\n Type.Literal('
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/schema/property/index.ts"],"sourcesContent":["import { Static, Type } from '@sinclair/typebox'\nimport { PropertyDataType, PropertyDefs, StorageType } from '@/types'\n\nexport const TPropertyDataType = Type.Union([\n Type.Literal('Text'),\n Type.Literal('Number'),\n Type.Literal('List'),\n Type.Literal('Relation'),\n Type.Literal('Image'),\n Type.Literal('FileSrc'),\n Type.Literal('Json'),\n Type.Literal('File'),\n Type.Literal('Boolean'),\n Type.Literal('Date'),\n])\n\nexport const TStorageType = Type.Union([\n Type.Literal('ItemStorage'), // Looks for a storageTransactionId property on the item\n Type.Literal('PropertyStorage'), // Looks for a storageTransactionId value on the property\n])\n\nexport const TProperty = Type.Object({\n id: Type.Optional(Type.Number()),\n name: Type.Optional(Type.String()),\n dataType: TPropertyDataType,\n ref: Type.Optional(Type.String()),\n modelId: Type.Optional(Type.Number()),\n refModelId: Type.Optional(Type.Number()),\n refValueType: Type.Optional(TPropertyDataType),\n storageType: Type.Optional(TStorageType),\n localStorageDir: Type.Optional(Type.String()),\n filenameSuffix: Type.Optional(Type.String()),\n})\n\nexport const TPropertyConstructor = Type.Function(\n [\n Type.Optional(Type.Union([Type.String(), TStorageType, Type.Undefined()])),\n Type.Optional(Type.Union([Type.String(), TPropertyDataType])),\n Type.Optional(Type.String()),\n ],\n TProperty,\n)\n\nexport const TPropertyDefs = Type.Record(\n TPropertyDataType,\n TPropertyConstructor,\n)\n\nexport const Property: PropertyDefs = {\n Text: (\n storageType?: StorageType,\n localStorageDir?: string,\n filenameSuffix?: string,\n ) => ({\n dataType: 'Text',\n storageType,\n localStorageDir,\n filenameSuffix,\n TObject: Type.String(),\n }),\n Json: () => ({ dataType: 'Json' }),\n File: () => ({ dataType: 'File' }),\n Number: () => ({ dataType: 'Number' }),\n List: (ref: string, refValueType?: PropertyDataType) => ({\n dataType: 'List',\n ref,\n refValueType,\n }),\n Relation: (ref, refValueType?: PropertyDataType) => ({\n dataType: 'Relation',\n ref,\n refValueType,\n }),\n Image: () => ({ dataType: 'Image' }),\n Boolean: () => ({ dataType: 'Boolean' }),\n Date: () => ({ dataType: 'Date' }),\n}\n\nexport const PropertyMetadataKey = Symbol('property')\n\nexport const PropertyConstructor = (propertyType: Static<typeof TProperty>) => {\n return function (parentClassPrototype: any, propertyKey: string) {\n const existingProperties =\n Reflect.getMetadata(PropertyMetadataKey, parentClassPrototype) || []\n\n existingProperties.push({ propertyKey, propertyType })\n // console.log('existingProperties', existingProperties)\n // console.log('propertyKey', propertyKey)\n // console.log('propertyType', propertyType)\n // console.log('PropertyMetadataKey', PropertyMetadataKey)\n // console.log('typeof target', typeof target)\n Reflect.defineMetadata(\n PropertyMetadataKey,\n existingProperties,\n parentClassPrototype,\n )\n // console.log(\n // `After adding ${propertyKey}:`,\n // Reflect.getMetadata(PropertyMetadataKey, parentClassPrototype),\n // )\n }\n}\n\nexport const Text = (\n storageType?: StorageType,\n srcDir?: string,\n filenameSuffix?: string,\n) => PropertyConstructor(Property.Text(storageType, srcDir, filenameSuffix))\nexport const Number = () => PropertyConstructor(Property.Number())\nexport const Json = () => PropertyConstructor(Property.Json())\nexport const File = () => PropertyConstructor(Property.File())\nexport const Image = () => PropertyConstructor(Property.Image())\nexport const Relation = (ref: string, refValueType?: PropertyDataType) =>\n PropertyConstructor(Property.Relation(ref, refValueType)) // Adjust for actual relation type\nexport const List = (ref: string, reValueType?: PropertyDataType) =>\n PropertyConstructor(Property.List(ref, reValueType)) // Adjust for actual list type\nexport const Boolean = () => PropertyConstructor(Property.Boolean())\nexport const Date = () => PropertyConstructor(Property.Date())\n"],"names":[],"mappings":";;AAGa,MAAA,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC;AAC1C,IAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AACpB,IAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;AACtB,IAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AACpB,IAAA,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;AACxB,IAAA,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;AACrB,IAAA,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;AACvB,IAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AACpB,IAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AACpB,IAAA,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;AACvB,IAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AACrB,CAAA;AAEY,MAAA,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC;AACrC,IAAA,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;AAC3B,IAAA,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC;AAChC,CAAA;AAEY,MAAA,SAAS,GAAG,IAAI,CAAC,MAAM,CAA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,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,CAAC;AACpE,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,MAAM,EAAE;AAC1D,MAAM,IAAI,GAAI,MAAM,mBAAmB,CAAC,QAAQ,CAAC,IAAI,EAAE;AAEvD,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,KAAK,EAAE;AAClD,MAAA,QAAQ,GAAG,CAAC,GAAW,EAAE,YAA+B,KACnE,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,EAAC;AAC9C,MAAA,IAAI,GAAG,CAAC,GAAW,EAAE,WAA8B,KAC9D,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,EAAC;AAC/C,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,OAAO,EAAE;AAC5D,MAAM,IAAI,GAAG,MAAM,mBAAmB,CAAC,QAAQ,CAAC,IAAI,EAAE;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seedprotocol/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "The SDK for Seed Protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"rimraf": "^6.0.1",
|
|
79
79
|
"rxjs": "^7.8.1",
|
|
80
80
|
"threads": "^1.7.0",
|
|
81
|
-
"ts-import": "
|
|
81
|
+
"ts-import": "5.0.0-beta.0",
|
|
82
82
|
"ts-morph": "^24.0.0",
|
|
83
83
|
"ts-proto": "^2.6.0",
|
|
84
84
|
"tslib": "^2.8.1",
|
|
@@ -150,6 +150,7 @@
|
|
|
150
150
|
"supports-color": "^10.0.0",
|
|
151
151
|
"ts-api-utils": "~2.0.0",
|
|
152
152
|
"tsconfig-paths": "^4.2.0",
|
|
153
|
+
"tsx": "^4.19.3",
|
|
153
154
|
"typescript": "~5.7.2",
|
|
154
155
|
"vite-plugin-inspect": "^10.0.6",
|
|
155
156
|
"vite-plugin-node-polyfills": "^0.22.0",
|